diff --git a/Details.toc b/Details.toc index 29be5f2c2..e2d88c104 100644 --- a/Details.toc +++ b/Details.toc @@ -1,4 +1,4 @@ -## Interface: 110002 +## Interface: 110005 ## Interface-Cata: 40400 ## Title: Details! Damage Meter ## Notes: Essential tool to impress that chick in your raid. @@ -132,6 +132,7 @@ frames\window_statistics.lua frames\window_aura_tracker.lua frames\window_debug.lua frames\window_pro_file.lua +frames\window_nestspells.lua classes\class_error.lua classes\class_spelltable.lua diff --git a/Details_Cata.toc b/Details_Cata.toc index 7077702e4..62009ae72 100644 --- a/Details_Cata.toc +++ b/Details_Cata.toc @@ -131,6 +131,7 @@ frames\window_statistics.lua frames\window_aura_tracker.lua frames\window_debug.lua frames\window_pro_file.lua +frames\window_nestspells.lua classes\class_error.lua classes\class_spelltable.lua diff --git a/Details_Classic.toc b/Details_Classic.toc index 6f6ed659a..7646fa5ad 100644 --- a/Details_Classic.toc +++ b/Details_Classic.toc @@ -125,6 +125,7 @@ frames\window_classcolor.lua frames\window_statistics.lua frames\window_debug.lua frames\window_pro_file.lua +frames\window_nestspells.lua classes\class_error.lua classes\class_spelltable.lua diff --git a/Details_Wrath.toc b/Details_Wrath.toc index ce9812b3f..322b1d6d3 100644 --- a/Details_Wrath.toc +++ b/Details_Wrath.toc @@ -125,6 +125,7 @@ frames\window_classcolor.lua frames\window_statistics.lua frames\window_debug.lua frames\window_pro_file.lua +frames\window_nestspells.lua classes\class_error.lua classes\class_spelltable.lua diff --git a/Libs/DF/auras.lua b/Libs/DF/auras.lua index 1d5bce9c7..3e49d937a 100644 --- a/Libs/DF/auras.lua +++ b/Libs/DF/auras.lua @@ -19,7 +19,7 @@ local GetSpellTabInfo = GetSpellTabInfo or function(tabLine) local skillLine = C local unpack = unpack local CreateFrame = CreateFrame local GameTooltip = GameTooltip -local tremove = tremove +local tremove = table.remove local CONST_MAX_SPELLS = 500000 diff --git a/Libs/DF/definitions.lua b/Libs/DF/definitions.lua index 8f358256a..6d11a6d69 100644 --- a/Libs/DF/definitions.lua +++ b/Libs/DF/definitions.lua @@ -15,6 +15,15 @@ ---@field dump fun(tbl:table, resultString:string, deep:number) : string dump a table to a string ---@field findsubtable fun(tbl:table, index:number, value:any) : integer|nil find the value passed inside a sub table, return the index of the main table where the sub table with the value found is located ---@field remove fun(tbl:table, value:any) : boolean, number remove all values found inside the array, return true if any value was removed and the amount of values removed +---@field pack fun(...) : table pack a table into a string separating values with commas, example: {1, 2, 3, 4, 5, 6, 7}, result: "9,1,2,3,4,5,6,7,8,9" +---@field packsubmerge fun(tbl:table) : table pack a numerical table with numerical subtables into a string separating values with commas, example: { {1, 2, 3}, {4, 5, 6}, {7, 8, 9} }, result: "9,1,2,3,4,5,6,7,8,9" +---@field unpack fun(tbl:table, startIndex:number?) : table, number unpack a table packed with pack() and packsubmerge(), return the unpacked table and the index of the next index to be read +---@field packsub fun(tbl:table) : table pack a numerical table with numerical subtables into a string separating values with commas, example: { {1, 2, 3}, {4, 5, 6}, {7, 8, 9} }, result: "3,1,2,3,3,4,5,6,3,7,8,9" +---@field unpacksub fun(tbl:table, startIndex:number?) : table unpack a table packed with packsub() +---@field packhash fun(tbl:table) : string merge a key-value table into a single string separating values with commas, example: {key1 = value1, key2 = value2, key3 = value3}, result: "key1,value1,key2,value2,key3,value3" +---@field unpackhash fun(tbl:table) : table unpack a table packed with packhash() +---@field packhashsubtable fun(tbl:table) : string pack a hash table where the value of the key is a numerical table, example: {key1 = {1, 2, 3}, key2 = {4, 6}, key3 = {7}}, result: "key1,3,1,2,3,key2,2,4,6,key3,1,7" +---@field unpackhashsubtable fun(tbl:table) : table unpack a table packed with packhashsubtable() ---@class df_language : table ---@field Register fun(addonId:any, languageId:string, gameLanguageOnly:boolean?) : table @@ -137,7 +146,9 @@ ---@field ScriptHookMixin df_scripthookmixin ---@field EditorMixin df_editormixin ---@field PoolMixin df_pool +---@field LineIndicatorMixin df_lineindicator ---@field ScrollBoxFunctions df_scrollboxmixin +---@field LayoutFrame df_framelayout ---@field ClassCache {ID:number, Name:string, FileString:string, Texture:string, TexCoord:number[]}[] only available after calling GetClassList() ---@field Math df_math ---@field FontOutlineFlags table @@ -184,6 +195,76 @@ ---@field IsDragonflightWow fun():boolean ---@field IsWarWow fun():boolean ---@field IsTWWWow fun():boolean +---@field CreateButton fun(self:table, parent:frame, func:function, width:number, height:number, text:any, param1:any, param2:any, texture:atlasname|texturepath|textureid|nil, member:string?, name:string?, shortMethod:any, buttonTemplate:table?, textTemplate:table?) : df_button callback function(blizzButton, clickType, param1, param2) end +---@field CreateCloseButton fun(self:table, parent:frame, frameName:string?) : df_closebutton +---@field CreateTabButton fun(self:table, parent:frame, frameName:string?) : df_tabbutton +---@field CreateRoundedPanel fun(self:table, parent:frame, frameName:string?, optionsTable:df_roundedpanel_options?) : df_roundedpanel +---@field CreateScaleBar fun(self:table, parent:frame, config:table) : df_scalebar +---@field CreateFadeAnimation fun(self:table, UIObject:uiobject, fadeInTime:number?, fadeOutTime:number?, fadeInAlpha:number?, fadeOutAlpha:number?) +---@field CreateTextureInfo fun(self:table, texture:atlasname|texturepath|textureid, width:number?, height:number?, left:number?, right:number?, top:number?, bottom:number?, imageWidthnumber?, imageHeightnumber?) : table deprecated, use: DetailsFramework:CreateAtlas() +---@field CreateLabel fun(self:table, parent:frame, text:any, size:any?, color:any?, font:string?, member:string?, name:string?, layer:drawlayer?) : df_label +---@field CreateDropDown fun(self:table, parent:frame, func:function, default:any, width:number?, height:number?, member:string?, name:string?, template:table?) : df_dropdown +---@field CreateFontDropDown fun(self:table, parent:frame, func:function, default:any, width:number?, height:number?, member:string?, name:string?, template:table?, bIncludeDefault:boolean?) : df_dropdown +---@field CreateColorDropDown fun(self:table, parent:frame, func:function, default:any, width:number?, height:number?, member:string?, name:string?, template:table?) : df_dropdown +---@field CreateOutlineDropDown fun(self:table, parent:frame, func:function, default:any, width:number?, height:number?, member:string?, name:string?, template:table?) : df_dropdown +---@field CreateAnchorPointDropDown fun(self:table, parent:frame, func:function, default:any, width:number?, height:number?, member:string?, name:string?, template:table?) : df_dropdown +---@field CreateAudioDropDown fun(self:table, parent:frame, func:function, default:any, width:number?, height:number?, member:string?, name:string?, template:table?) : df_dropdown +---@field CreateRaidInstanceSelectorDroDown fun(self:table, parent:frame, func:function, default:any, width:number?, height:number?, member:string?, name:string?, template:table?) : df_dropdown +---@field CreateBossSelectorDroDown fun(self:table, parent:frame, func:function, instanceId:any, default:any, width:number?, height:number?, member:string?, name:string?, template:table?) : df_dropdown_bossselector +---@field CreateFontListGenerator fun(self:table, callback:function, bIncludeDefault:boolean?) : function return a function which when called returns a table filled with all fonts available and ready to be used on dropdowns +---@field CreateAnchorPointListGenerator fun(self:table, callback:function) : function return a function which when called returns a table filled with all anchor points available and ready to be used on dropdowns +---@field CreateColorListGenerator fun(self:table, callback:function) : function return a function which when called returns a table filled with all colors available and ready to be used on dropdowns +---@field CreateOutlineListGenerator fun(self:table, callback:function) : function return a function which when called returns a table filled with all outline options available and ready to be used on dropdowns +---@field CreateBossListGenerator fun(self:table, callback:function, instanceId:any) : function return a function which when called returns a table filled with all boss options available and ready to be used on dropdowns +---@field CreateRaidInstanceListGenerator fun(self:table, callback:function) : function return a function which when called returns a table filled with all raid instance options available and ready to be used on dropdowns +---@field CreateAudioListGenerator fun(self:table, callback:function) : function return a function which when called returns a table filled with all audio options available and ready to be used on dropdowns +---@field CreateTextEntry fun(self:table, parent:frame, textChangedCallback:function, width:number, height:number, member:string?, name:string?, labelText:string?, textentryTemplate:table?, labelTemplate:table?) : df_textentry +---@field CreateKeybindFrame fun(self:table, parent:frame, name:string?, options:table?, setKeybindCallback:function?, keybindData:table?) : df_keybindframe +---@field CreateStatusBar fun(self:table, parent:frame, options:table?) : frame +---@field CreateLoadFilterParser fun(self:table, callback:fun(encounterId:number?)) create a helper which will callback when encounterId, spec, talent, role, combatstate changes +---@field CreateSwitch fun(self:table, parent:frame, onSwitch:function, defaultValue:boolean, width:number?, height:number?, leftText:string?, rightText:string?, member:string?, name:string?, colorInverted:boolean?, switchFunc:function?, returnFunc:function?, withLabel:string?, switch_template:table?, label_template:table?) : df_checkbox, df_label? +---@field CreateCheckboxGroup fun(self:table, parent:frame, radioOptions:df_radiooptions[], name:string?, options:table?, anchorOptions:table?) : df_checkboxgroup +---@field CreateRadioGroup fun(self:table, parent:frame, radioOptions:df_radiooptions[], name:string?, options:table?, anchorOptions:table?) : df_radiogroup +---@field CreateScrollBox fun(self:table, parent:frame, name:string, refreshFunc:function, data:table, width:number, height:number, lineAmount:number, lineHeight:number, createLineFunc:function?, autoAmount:boolean?, noScroll:boolean?, noBackdrop:boolean?) : df_scrollbox +---@field CreateAuraScrollBox fun(self:table, parent:frame, name:string?, data:table?, onRemoveCallback:function?, options:table?, onSetupAuraClick:function?) : df_aurascrollbox +---@field CreateGridScrollBox fun(self:table, parent:frame, name:string?, refreshFunc:function, data:table?, createColumnFrameFunc:function, options:table?) : df_gridscrollbox +---@field CreateCanvasScrollBox fun(self:table, parent:frame, child:frame?, name:string?, options:table?) : df_canvasscrollbox +---@field CreateTabContainer fun(self:table, parent:frame, title:string, frameName:string, tabList:df_tabinfotable[], optionsTable:table?, hookList:table?, languageInfo:table?) : df_tabcontainer +---@field CreateColorTable fun(self:table, r:number, g:number, b:number, a:number) : table return a table with {r, g, b, a} +---@field CreateEditor fun(self:table, parent:frame, name:string?, options:df_editor_defaultoptions?) : df_editor +---@field CreateHighlightTexture fun(self:table, parent:frame, parentKey:string?, alpha:number?, name:string?, texture:any) : texture +---@field CreateIconRowGeneric fun(self:table, parent:frame, name:string?, options:table?) +---@field CreateColorPickButton fun(self:table, parent:frame, name:string?, member:string?, callback:function, alpha:number?, buttonTemplate:table?) : df_colorpickbutton +---@field CreateSlider fun(self:table, parent:frame, width:number?, height:number?, minValue:number?, maxValue:number?, step:number?, defaultv:number?, isDecemal:boolean?, member:string?, name:string?, label:string?, sliderTemplate:string|table?, labelTemplate:string|table?) : df_slider, df_label? When the value of the slider is changed, it'll call self.OnValueChanged if the value exists. slider.OnValueChanged = function(self, FixedValue, value) end +---@field CreateFrameContainer fun(self:table, parent:frame, options:table?, frameName:string?) : df_framecontainer create a frame container, which is a frame that envelops another frame, and can be moved, resized, etc. +---@field CreateAnimationHub fun(self:table, parent:uiobject, onPlay:function?, onFinished:function?) : animationgroup +---@field CreateAnimation fun(self:table, animationGroup:animationgroup, animationType:animationtype, order:number, duration:number, arg1:any, arg2:any, arg3:any, arg4:any, arg5:any, arg6:any, arg7:any, arg8:any) : animation +---@field CreateTexture fun(self:table, parent:frame, texture:atlasname|texturepath|textureid|nil, width:number?, height:number?, layer:drawlayer?, coords:table?, member:string?, name:string?) : df_image +---@field CreateImage fun(self:table, parent:frame, texture:atlasname|texturepath|textureid|nil, width:number?, height:number?, layer:drawlayer?, coords:table?, member:string?, name:string?) : df_image +---@field CreateFrameShake fun(self:table, parent:uiobject, duration:number?, amplitude:number?, frequency:number?, absoluteSineX:boolean?, absoluteSineY:boolean?, scaleX:number?, scaleY:number?, fadeInTime:number?, fadeOutTime:number?, anchorPoints:table?) : df_frameshake +---@field CreateErrorLabel fun(self:table, parent:frame, text:string?, size:number?, color:any?, layer:drawlayer?, name:string?) : df_errorlabel +---@field CreateGlowOverlay fun(self:table, parent:frame, antsColor:any, glowColor:any) : frame +---@field CreateSimpleFrame fun(self:table, parent:frame, width:number?, height:number?, title:string?, frameName:string?, panelOptions:table?, savedVariableTable:table?) : simplepanel +---@field CreateAnts fun(self:table, parent:frame, antTable:df_anttable, leftOffset:number?, rightOffset:number?, topOffset:number?, bottomOffset:number?) : frame +---@field CreateBorder fun(self:table, parent:frame, alpha1:number?, alpha2:number?, alpha3:number?) : frame +---@field CreateMenuWithGridScrollBox fun(self:table, parent:frame, name:string?, refreshMeFunc:function, refreshButtonFunc:function, clickFunc:function, onCreateButton:function, gridScrollBoxOptions:df_gridscrollbox_options) : df_gridscrollbox create a scrollbox with a grid layout to be used as a menu +---@field CreateSearchBox fun(self:table, parent:frame, callback:function) : df_searchbox +---@field CreateHeader fun(self:table, parent:frame, headerTable:df_headercolumndata[], options:table?, frameName:string?) : df_headerframe +---@field CreateGraphicMultiLineFrame fun(self:table, parent:frame, name:string) : df_chartmulti +---@field CreateGraphicLineFrame fun(self:table, parent:frame, name:string) : df_chart +---@field CreateFlashAnimation fun(self:table, frame:uiobject, onFinishFunc:function?, onLoopFunc:function?) : animationgroup +---@field CreateTimeBar fun(self:table, parent:frame, texture:texturepath|textureid, width:number?, height:number?, value:number?, member:string?, name:string?) : df_timebar +---@field CreatePool fun(self:table, func:function, ...) : df_pool +---@field CreateObjectPool fun(self:table, func:function, ...) : df_pool alias of CreatePool +---@field CreateResizeGrips fun(self:table, parent:frame, options:df_resizergrip_options?, leftResizerName:string?, rightResizerName:string?) : df_resizergrip, df_resizergrip +---@field CreateAtlas fun(self:table, file:texturepath|textureid, width:number?, height:number?, leftTexCoord:number?, rightTexCoord:number?, topTexCoord:number?, bottomTexCoord:number?, tilesHorizontally:boolean?, tilesVertically:boolean?, vertexRed:any, vertexGreen:number?, vertexBlue:number?, vertexAlpha:number?, desaturated:boolean?, desaturation:number?, alpha:number) : atlasinfo +---@field CreateAtlasString fun(self:table, atlas:atlasinfo|atlasname, textureHeight:number?, textureWidth:number?) : string +---@field CreateSimplePanel fun(self:table, parent:frame, width:number?, height:number?, title:string?, frameName:string?, panelOptions:table?, savedVariableTable:table?) : simplepanel +---@field CreateNewAddOn fun(self:table, addonName:string, globalSavedVariablesName:string, savedVarsTemplate:table) : table +---@field CreateBossScrollSelectorForInstance fun(self:table, instanceId:any, parent:uiobject, name:string?, options:df_bossscrollselector_options?, callback:function?, ...) : df_bossscrollselector +---@field CreateTimeLineFrame fun(self:table, parent:frame, name:string, timelineOptions:df_timeline_options, elapsedtimeOptions:df_elapsedtime_options) : df_timeline +---@field CreateElapsedTimeFrame fun(self:table, parent:frame, name:string?, options:df_elapsedtime_options?) : df_elapsedtime +---@field ConvertAnchorPointToInside fun(self:table, anchorPoint:anchorid) : anchorid ---@field ExpansionHasAugEvoker fun():boolean ---@field LoadSpellCache fun(self:table, hashMap:table, indexTable:table, allSpellsSameName:table) : hashMap:table, indexTable:table, allSpellsSameName:table load all spells in the game and add them into the passed tables ---@field UnloadSpellCache fun(self:table) wipe the table contents filled with LoadSpellCache() @@ -204,16 +285,10 @@ ---@field GetDefaultBackdropColor fun(self:table) : red, green, blue, alpha return the standard backdrop color used by blizzard on their own frames ---@field Msg fun(self:table, message:string, ...) show a message in the chat frame ---@field MsgWarning fun(self:table, message:string, ...) show a warning message in the chat frame ----@field CreateButton fun(self:table, parent:frame, func:function, width:number, height:number, text:any, param1:any, param2:any, texture:atlasname|texturepath|textureid|nil, member:string?, name:string?, shortMethod:any, buttonTemplate:table?, textTemplate:table?) : df_button callback function(blizzButton, clickType, param1, param2) end ----@field CreateCloseButton fun(self:table, parent:frame, frameName:string?) : df_closebutton ----@field CreateTabButton fun(self:table, parent:frame, frameName:string?) : df_tabbutton ----@field CreateRoundedPanel fun(self:table, parent:frame, frameName:string?, optionsTable:df_roundedpanel_options?) : df_roundedpanel ----@field CreateScaleBar fun(self:table, parent:frame, config:table) : df_scalebar ---@field AddRoundedCornersToFrame fun(self:table, frame:frame, optionsTable:df_roundedpanel_preset?) ---@field ParseColors fun(self:table, red:any, green:number?, blue:number?, alpha:number?) : red, green, blue, alpha ---@field Mixin fun(self:table, target:table, ...) : table ---@field SetButtonTexture fun(self:table, button:button|df_button, texture:atlasname|texturepath|textureid) ----@field CreateFadeAnimation fun(self:table, UIObject:uiobject, fadeInTime:number?, fadeOutTime:number?, fadeInAlpha:number?, fadeOutAlpha:number?) ---@field SetFontSize fun(self:table, fontstring:fontstring, size:number) ---@field GetFontSize fun(self:table, fontstring:fontstring) : number return the font size of the fontstring ---@field SetFontColor fun(self:table, fontstring:fontstring, red:any, green:number?, blue:number?, alpha:number?) @@ -231,33 +306,13 @@ ---@field SplitTextInLines fun(self:table, text:string) : string[] split a text into lines ---@field SetAnchor fun(self:table, widget:uiobject, anchorTable:df_anchor, anchorTo:uiobject?) only adjust the anchors of a widget, does not save values ---@field AddTextureToText fun(self:table, text:string, textureInfo:table, bAddSpace:boolean?, bAddAfterText:any) : string textureInfo is a table with .texture .width .height .coords{left, right, top, bottom} ----@field CreateTextureInfo fun(self:table, texture:atlasname|texturepath|textureid, width:number?, height:number?, left:number?, right:number?, top:number?, bottom:number?, imageWidthnumber?, imageHeightnumber?) : table deprecated, use: DetailsFramework:CreateAtlas() ---@field ApplyStandardBackdrop fun(self:table, frame:frame, bUseSolidColor:boolean?, alphaScale:number?) ---@field NewLabel fun(self:table, parent:frame, container:frame, name:string?, member:string?, text:string|table, font:string?, size:any?, color:any?, layer:drawlayer?) : df_label ----@field CreateLabel fun(self:table, parent:frame, text:any, size:any?, color:any?, font:string?, member:string?, name:string?, layer:drawlayer?) : df_label ---@field NewDropDown fun(self:table, parent:frame, container:frame?, name:string?, member:string?, width:number?, height:number?, func:function, default:any, template:table?) : df_dropdown ----@field CreateDropDown fun(self:table, parent:frame, func:function, default:any, width:number?, height:number?, member:string?, name:string?, template:table?) : df_dropdown ----@field CreateFontDropDown fun(self:table, parent:frame, func:function, default:any, width:number?, height:number?, member:string?, name:string?, template:table?, bIncludeDefault:boolean?) : df_dropdown ----@field CreateColorDropDown fun(self:table, parent:frame, func:function, default:any, width:number?, height:number?, member:string?, name:string?, template:table?) : df_dropdown ----@field CreateOutlineDropDown fun(self:table, parent:frame, func:function, default:any, width:number?, height:number?, member:string?, name:string?, template:table?) : df_dropdown ----@field CreateAnchorPointDropDown fun(self:table, parent:frame, func:function, default:any, width:number?, height:number?, member:string?, name:string?, template:table?) : df_dropdown ----@field CreateAudioDropDown fun(self:table, parent:frame, func:function, default:any, width:number?, height:number?, member:string?, name:string?, template:table?) : df_dropdown ----@field CreateRaidInstanceSelectorDroDown fun(self:table, parent:frame, func:function, default:any, width:number?, height:number?, member:string?, name:string?, template:table?) : df_dropdown ----@field CreateBossSelectorDroDown fun(self:table, parent:frame, func:function, instanceId:any, default:any, width:number?, height:number?, member:string?, name:string?, template:table?) : df_dropdown_bossselector ----@field CreateFontListGenerator fun(self:table, callback:function, bIncludeDefault:boolean?) : function return a function which when called returns a table filled with all fonts available and ready to be used on dropdowns ----@field CreateAnchorPointListGenerator fun(self:table, callback:function) : function return a function which when called returns a table filled with all anchor points available and ready to be used on dropdowns ----@field CreateColorListGenerator fun(self:table, callback:function) : function return a function which when called returns a table filled with all colors available and ready to be used on dropdowns ----@field CreateOutlineListGenerator fun(self:table, callback:function) : function return a function which when called returns a table filled with all outline options available and ready to be used on dropdowns ----@field CreateBossListGenerator fun(self:table, callback:function, instanceId:any) : function return a function which when called returns a table filled with all boss options available and ready to be used on dropdowns ----@field CreateRaidInstanceListGenerator fun(self:table, callback:function) : function return a function which when called returns a table filled with all raid instance options available and ready to be used on dropdowns ----@field CreateAudioListGenerator fun(self:table, callback:function) : function return a function which when called returns a table filled with all audio options available and ready to be used on dropdowns ---@field BuildDropDownFontList fun(self:table, onClick:function, icon:atlasname|texturepath|textureid|nil, iconTexcoord:table?, iconSize:number?, bIncludeDefault:boolean?) : table build a list of fonts to be used as optionsTable for a dropdown ----@field CreateTextEntry fun(self:table, parent:frame, textChangedCallback:function, width:number, height:number, member:string?, name:string?, labelText:string?, textentryTemplate:table?, labelTemplate:table?) : df_textentry ---@field ReskinSlider fun(self:table, slider:frame) ---@field GetAvailableSpells fun(self:table) : table ---@field NewColor fun(self:table, colorName:string, red:number, green:number, blue:number, alpha:number?) : table ----@field CreateKeybindFrame fun(self:table, parent:frame, name:string?, options:table?, setKeybindCallback:function?, keybindData:table?) : df_keybindframe ----@field CreateStatusBar fun(self:table, parent:frame, options:table?) : frame ---@field GetTemplate fun(self:table, templatecategory:templatecategory, templateName:string) : table ---@field UpdateLoadConditionsTable fun(self:table, loadConditionsTable:table) ---@field IconPick fun(self:table, callback:function, bCloseWhenSelect:boolean?, param1:any?, param2:any?) @@ -265,36 +320,15 @@ ---@field InstallTemplate fun(self:table, widgetType:string, templateName:string, template:table, parentName:any) : table ---@field NewSpecialLuaEditorEntry fun(self:table, parent:frame, width:number, height:number, member:string?, name:string?, nointent:boolean?, showLineNumbers:boolean?, bNoName:boolean?) : df_luaeditor ---@field PassLoadFilters fun(self:table, loadTable:table, encounterID:number?) : boolean, string ----@field CreateLoadFilterParser fun(self:table, callback:fun(encounterId:number?)) create a helper which will callback when encounterId, spec, talent, role, combatstate changes ----@field CreateSwitch fun(self:table, parent:frame, onSwitch:function, defaultValue:boolean, width:number?, height:number?, leftText:string?, rightText:string?, member:string?, name:string?, colorInverted:boolean?, switchFunc:function?, returnFunc:function?, withLabel:string?, switch_template:table?, label_template:table?) : df_checkbox, df_label? ----@field CreateCheckboxGroup fun(self:table, parent:frame, radioOptions:df_radiooptions[], name:string?, options:table?, anchorOptions:table?) : df_checkboxgroup ----@field CreateRadioGroup fun(self:table, parent:frame, radioOptions:df_radiooptions[], name:string?, options:table?, anchorOptions:table?) : df_radiogroup ----@field CreateScrollBox fun(self:table, parent:frame, name:string, refreshFunc:function, data:table, width:number, height:number, lineAmount:number, lineHeight:number, createLineFunc:function?, autoAmount:boolean?, noScroll:boolean?, noBackdrop:boolean?) : df_scrollbox ----@field CreateAuraScrollBox fun(self:table, parent:frame, name:string?, data:table?, onRemoveCallback:function?, options:table?, onSetupAuraClick:function?) : df_aurascrollbox ----@field CreateGridScrollBox fun(self:table, parent:frame, name:string?, refreshFunc:function, data:table?, createColumnFrameFunc:function, options:table?) : df_gridscrollbox ----@field CreateCanvasScrollBox fun(self:table, parent:frame, child:frame?, name:string?, options:table?) : df_canvasscrollbox ----@field CreateTabContainer fun(self:table, parent:frame, title:string, frameName:string, tabList:df_tabinfotable[], optionsTable:table?, hookList:table?, languageInfo:table?) : df_tabcontainer ---@field GetSizeFromPercent fun(self:table, uiObject:uiobject, percent:number) : number get the min size of a uiObject and multiply it by the percent passed ---@field BuildMenu fun(self:table, parent:frame, menuOptions:df_menu_table[], xOffset:number?, yOffset:number?, height:number?, useColon:boolean?, textTemplate:table?, dropdownTemplate:table?, switchTemplate:table?, switchIsCheckbox:boolean?, sliderTemplate:table?, buttonTemplate:table?, valueChangeHook:function?) ---@field BuildMenuVolatile fun(self:table, parent:frame, menuOptions:df_menu_table[], xOffset:number?, yOffset:number?, height:number?, useColon:boolean?, textTemplate:table?, dropdownTemplate:table?, switchTemplate:table?, switchIsCheckbox:boolean?, sliderTemplate:table?, buttonTemplate:table?, valueChangeHook:function?) ---@field GetColorBrightness fun(self:table, r:number, g:number, b:number) : number return the brightness of a color from zero to one ---@field GetColorHue fun(self:table, r:number, g:number, b:number) : number return the hue of a color from red to blue to green to yellow and back to red ---@field IsHtmlColor fun(self:table, colorName:any) : unknown return true if DF.alias_text_colors has the colorName as a key ----@field CreateColorTable fun(self:table, r:number, g:number, b:number, a:number) : table return a table with {r, g, b, a} ---@field FormatColor fun(self:table, newFormat:string, r:number|string|table, g:number?, b:number?, a:number?, decimalsAmount:number?) : string|table|number|nil, number|nil, number|nil, number|nil takes in a color in one format and converts it to another specified format. ----@field CreateEditor fun(self:table, parent:frame, name:string?, options:df_editor_defaultoptions?) : df_editor ---@field RandomBool fun(self:table, odds: number?) : boolean return a random boolean ----@field CreateHighlightTexture fun(self:table, parent:frame, parentKey:string?, alpha:number?, name:string?, texture:any) : texture ----@field CreateIconRowGeneric fun(self:table, parent:frame, name:string?, options:table?) ----@field CreateColorPickButton fun(self:table, parent:frame, name:string?, member:string?, callback:function, alpha:number?, buttonTemplate:table?) : df_colorpickbutton ----@field CreateSlider fun(self:table, parent:frame, width:number?, height:number?, minValue:number?, maxValue:number?, step:number?, defaultv:number?, isDecemal:boolean?, member:string?, name:string?, label:string?, sliderTemplate:string|table?, labelTemplate:string|table?) : df_slider, df_label? When the value of the slider is changed, it'll call self.OnValueChanged if the value exists. slider.OnValueChanged = function(self, FixedValue, value) end ----@field CreateFrameContainer fun(self:table, parent:frame, options:table?, frameName:string?) : df_framecontainer create a frame container, which is a frame that envelops another frame, and can be moved, resized, etc. ----@field CreateAnimationHub fun(self:table, parent:uiobject, onPlay:function?, onFinished:function?) : animationgroup ----@field CreateAnimation fun(self:table, animationGroup:animationgroup, animationType:animationtype, order:number, duration:number, arg1:any, arg2:any, arg3:any, arg4:any, arg5:any, arg6:any, arg7:any, arg8:any) : animation ---@field NewImage fun(self:table, parent:frame, texture:atlasname|texturepath|textureid|df_gradienttable|nil, width:number?, height:number?, layer:drawlayer?, texCoord:table?, member:string?, name:string?) : df_image ----@field CreateTexture fun(self:table, parent:frame, texture:atlasname|texturepath|textureid|nil, width:number?, height:number?, layer:drawlayer?, coords:table?, member:string?, name:string?) : df_image ----@field CreateImage fun(self:table, parent:frame, texture:atlasname|texturepath|textureid|nil, width:number?, height:number?, layer:drawlayer?, coords:table?, member:string?, name:string?) : df_image ----@field CreateFrameShake fun(self:table, parent:uiobject, duration:number?, amplitude:number?, frequency:number?, absoluteSineX:boolean?, absoluteSineY:boolean?, scaleX:number?, scaleY:number?, fadeInTime:number?, fadeOutTime:number?, anchorPoints:table?) : df_frameshake ---@field SetTexCoordFromAtlasInfo fun(self:table, texture:texture, atlasInfo:atlasinfo) : nil ---@field TruncateNumber fun(self:table, number:number, fractionDigits:number) : number ---@field GetNpcIdFromGuid fun(self:table, GUID:string) : number @@ -315,10 +349,8 @@ ---@field PreviewTexture fun(self:table, texture:atlasname|texturepath|textureid, left:number?, right:number?, top:number?, bottom:number?) : nil ---@field TableIsAtlas fun(self:table, atlasTale:table) : boolean ---@field SetAtlas fun(self:table, textureObject:texture, atlas:atlasinfo|atlasname, useAtlasSize:boolean?, filterMode:texturefilter?, resetTexCoords:boolean?) : nil ----@field CreateAtlas fun(self:table, file:texturepath|textureid, width:number?, height:number?, leftTexCoord:number?, rightTexCoord:number?, topTexCoord:number?, bottomTexCoord:number?, tilesHorizontally:boolean?, tilesVertically:boolean?, vertexRed:any, vertexGreen:number?, vertexBlue:number?, vertexAlpha:number?, desaturated:boolean?, desaturation:number?, alpha:number) : atlasinfo ---@field ParseTexture fun(self:table, texture:texturepath|textureid|atlasname|atlasinfo, width: number?, height: number?, leftTexCoord: number?, rightTexCoord: number?, topTexCoord: number?, bottomTexCoord: number?, vertexRed:number|string?, vertexGreenvertexRed:number?, vertexBluevertexRed:number?, vertexAlphavertexRed:number?) : any, number?, number?, number?, number?, number?, number?, number?, number?, number?, number?, number?, number? ---@field IsTexture fun(self:table, texture:any, bCheckTextureObject: boolean?) : boolean ----@field CreateAtlasString fun(self:table, atlas:atlasinfo|atlasname, textureHeight:number?, textureWidth:number?) : string ---@field SetMask fun(self:table, texture:texture, maskTexture:atlasname|texturepath|textureid|table|string) : nil ---@field GetClientRegion fun(self:table) : string ---@field GetBestFontPathForLanguage fun(self:table, languageId:string) : string @@ -331,32 +363,14 @@ ---@field GetParentNamePath fun(self:table, object:uiobject) : string ---@field GetAsianNumberSymbols fun(self:table) : string, string, string return the abbreviation for 1,000 10,000 and 100,000,000 ---@field GetBestFontForLanguage fun(self:table, languageId:string?, western:string?, cyrillic:string?, china:string?, korean:string?, taiwan:string?) : string ----@field CreateGlowOverlay fun(self:table, parent:frame, antsColor:any, glowColor:any) : frame ----@field CreateSimpleFrame fun(self:table, parent:frame, width:number?, height:number?, title:string?, frameName:string?, panelOptions:table?, savedVariableTable:table?) : simplepanel ----@field CreateAnts fun(self:table, parent:frame, antTable:df_anttable, leftOffset:number?, rightOffset:number?, topOffset:number?, bottomOffset:number?) : frame ----@field CreateBorder fun(self:table, parent:frame, alpha1:number?, alpha2:number?, alpha3:number?) : frame ----@field CreateMenuWithGridScrollBox fun(self:table, parent:frame, name:string?, refreshMeFunc:function, refreshButtonFunc:function, clickFunc:function, onCreateButton:function, gridScrollBoxOptions:df_gridscrollbox_options) : df_gridscrollbox create a scrollbox with a grid layout to be used as a menu ----@field CreateSearchBox fun(self:table, parent:frame, callback:function) : df_searchbox ----@field ConvertAnchorPointToInside fun(self:table, anchorPoint:anchorid) : anchorid ----@field CreateHeader fun(self:table, parent:frame, headerTable:df_headercolumndata[], options:table?, frameName:string?) : df_headerframe ----@field CreateGraphicMultiLineFrame fun(self:table, parent:frame, name:string) : df_chartmulti ----@field CreateGraphicLineFrame fun(self:table, parent:frame, name:string) : df_chart ----@field CreateFlashAnimation fun(self:table, frame:uiobject, onFinishFunc:function?, onLoopFunc:function?) : animationgroup ----@field CreateTimeBar fun(self:table, parent:frame, texture:texturepath|textureid, width:number?, height:number?, value:number?, member:string?, name:string?) : df_timebar ----@field CreatePool fun(self:table, func:function, ...) : df_pool ----@field CreateObjectPool fun(self:table, func:function, ...) : df_pool alias of CreatePool ---@field GetRoleIconAndCoords fun(self:table, role:string) : string, number, number, number, number return the texture path and texcoords for a role ---@field AddRoleIconToText fun(self:table, text:string, role:string, size:number?) : string add a role icon to a text using escape codes ---@field GetRoleTCoordsAndTexture fun(self:table, roleID:number) : number, number, number, number, string ---@field AddColorToText fun(self:table, text:string, color:any) : string wrap text with a color ---@field AddClassColorToText fun(self:table, text:string, className:class) : string wrap text with a class color ----@field CreateSimplePanel fun(self:table, parent:frame, width:number?, height:number?, title:string?, frameName:string?, panelOptions:table?, savedVariableTable:table?) : simplepanel ---@field MakeDraggable fun(self:table, frame:frame) : nil ----@field CreateNewAddOn fun(self:table, addonName:string, globalSavedVariablesName:string, savedVarsTemplate:table) : table ----@field CreateBossScrollSelectorForInstance fun(self:table, instanceId:any, parent:uiobject, name:string?, options:df_bossscrollselector_options?, callback:function?, ...) : df_bossscrollselector ----@field CreateTimeLineFrame fun(self:table, parent:frame, name:string, timelineOptions:df_timeline_options, elapsedtimeOptions:df_elapsedtime_options) : df_timeline ----@field CreateElapsedTimeFrame fun(self:table, parent:frame, name:string?, options:df_elapsedtime_options?) : df_elapsedtime ---@field GetClassTCoordsAndTexture fun(self:table, class:string) : number, number, number, number, string return the class icon texture coordinates and texture file path +---@field GetClassColorByClassId fun(self:table, classId:number) : number, number, number return the class color by classId ---@field MakeStringFromSpellId fun(self:table, spellId:any) : string return a string with the spell icon and name using escape codes ---@field AddClassIconToText fun(self:table, text:string, playerName:string, englishClassName:string, useSpec:boolean?, iconSize:number?) : string wrap 'text' with the class icon of 'playerName' using |T|t scape codes ---@field RemoveRealNameFromName fun(self:table, name:string) : string remove the realm name from a name string diff --git a/Libs/DF/elapsedtime.lua b/Libs/DF/elapsedtime.lua index 2066d8b56..3fae30261 100644 --- a/Libs/DF/elapsedtime.lua +++ b/Libs/DF/elapsedtime.lua @@ -86,6 +86,10 @@ detailsFramework.TimeLineElapsedTimeFunctions = { end end, + SetScrollChild = function(self, scrollChild) + self.scrollChild = scrollChild + end, + Refresh = function(self, elapsedTime, scale) if (not elapsedTime) then --invalid data passed @@ -118,7 +122,7 @@ detailsFramework.TimeLineElapsedTimeFunctions = { label:SetText(detailsFramework:IntegerToTimer(floor(secondsOfTime))) if (label.line:IsShown()) then - label.line:SetHeight(parent:GetParent():GetHeight()) + label.line:SetHeight(self.scrollChild:GetHeight()) end label:Show() @@ -128,6 +132,7 @@ detailsFramework.TimeLineElapsedTimeFunctions = { ---@class df_elapsedtime : frame, df_elapsedtime_mixin, df_optionsmixin ---@field labels table +---@field scrollChild frame ---creates a frame to show the elapsed time in a row ---@param parent frame @@ -135,6 +140,7 @@ detailsFramework.TimeLineElapsedTimeFunctions = { ---@param options df_elapsedtime_options? ---@return df_elapsedtime function detailsFramework:CreateElapsedTimeFrame(parent, name, options) + ---@type df_elapsedtime local elapsedTimeFrame = CreateFrame("frame", name, parent, "BackdropTemplate") detailsFramework:Mixin(elapsedTimeFrame, detailsFramework.OptionsFunctions) @@ -146,6 +152,8 @@ function detailsFramework:CreateElapsedTimeFrame(parent, name, options) elapsedTimeFrame:SetBackdrop(elapsedTimeFrame.options.backdrop) elapsedTimeFrame:SetBackdropColor(unpack(elapsedTimeFrame.options.backdrop_color)) + elapsedTimeFrame.scrollChild = parent + elapsedTimeFrame.labels = {} return elapsedTimeFrame diff --git a/Libs/DF/fw.lua b/Libs/DF/fw.lua index 6d49adb27..081115d49 100644 --- a/Libs/DF/fw.lua +++ b/Libs/DF/fw.lua @@ -1,6 +1,6 @@ -local dversion = 575 +local dversion = 577 local major, minor = "DetailsFramework-1.0", dversion local DF, oldminor = LibStub:NewLibrary(major, minor) @@ -1365,6 +1365,19 @@ function DF:AddColorToText(text, color) --wrap text with a color return text end +function DF:GetClassColorByClassId(classId) + local classInfo = C_CreatureInfo.GetClassInfo(classId) + if (classInfo) then + local color = RAID_CLASS_COLORS[classInfo.classFile] + if (color) then + return color.r, color.g, color.b + else + return 1, 1, 1 + end + end + return 1, 1, 1 +end + ---receives a string 'text' and a class name and return the string wrapped with the class color using |c and |r scape codes ---@param self table ---@param text string @@ -3155,7 +3168,7 @@ function DF:ParseTemplate(templateCategory, template) if (objectType == "label") then templateCategory = "font" - elseif (objectType == "dropdown") then + elseif (objectType == "dropdown" or objectType == "textentry") then templateCategory = "dropdown" elseif (objectType == "button") then @@ -4739,6 +4752,7 @@ DF.ClassIndexToFileName = { [13] = "EVOKER", } +--GetNumClasses() DF.ClassFileNameToIndex = { ["WARRIOR"] = 1, @@ -5708,34 +5722,21 @@ local sendTimeBarNotification = function(token, barType, id, msg, timer, icon, s end local createBossModsCallback = function() - if (false and _G.DBM) then + if (_G.DBM) then local DBM = _G.DBM --phase change - local phaseChangeCallback = function(event, mod, modId, phase, encounterId, stageTotal) - sendPhaseNotification(phase) + local phaseChangeCallback = function(event, mod, modId, phase, encounterId, stageTotal, arg1, arg2) end - --DBM:RegisterCallback("DBM_SetStage", phaseChangeCallback) + DBM:RegisterCallback("DBM_SetStage", phaseChangeCallback) --time bars - local timerChangeCallback = function(bar_type, id, msg, timer, icon, bartype, spellId, colorId, modid) - local currentCombat = Details:GetCurrentCombat() - if (not currentCombat.__destroyed) then --async events, need to check for combat destruction - ---@type combattime - local combatTime = currentCombat:GetCombatTime() - table.insert(currentCombat.bossTimers, {"dbm", combatTime, bar_type, id, msg, timer, icon, bartype, spellId, colorId, modid}) - --print("dbm event", bar_type, id, msg, timer, icon, bartype, spellId, colorId, modid) - - local spell = tostring(spellId) - if (spell and not current_table_dbm[spell]) then - current_table_dbm[spell] = {spell, id, msg, timer, icon, bartype, spellId, colorId, modid} - end - end + local timerChangeCallback = function(bar_type, id, msg, timer, icon, bartype, spellId, colorId, modid, arg1, arg2) end - --DBM:RegisterCallback("DBM_TimerStart", timerChangeCallback) + DBM:RegisterCallback("DBM_TimerStart", timerChangeCallback) end - +--[= local BigWigsLoader = BigWigsLoader if (BigWigsLoader) then -- and not _G.DBM @@ -5786,10 +5787,10 @@ local createBossModsCallback = function() --self:RegisterMessage("BigWigs_StopBars", "StopModuleBars") end end + --]=] end - detailsFramework.OnLoginSchedules[#detailsFramework.OnLoginSchedules+1] = createBossModsCallback diff --git a/Libs/DF/header.lua b/Libs/DF/header.lua index 606c90d5c..f39f04d44 100644 --- a/Libs/DF/header.lua +++ b/Libs/DF/header.lua @@ -655,7 +655,7 @@ local default_header_options = { function detailsFramework:CreateHeader(parent, headerTable, options, frameName) ---create the header frame which is returned by this function ---@type df_headerframe - local newHeader = CreateFrame("frame", frameName or "$parentHeaderLine", parent, "BackdropTemplate") + local newHeader = CreateFrame("frame", frameName or ("$parentHeaderLine" .. math.random(100000000)), parent, "BackdropTemplate") detailsFramework:Mixin(newHeader, detailsFramework.OptionsFunctions) detailsFramework:Mixin(newHeader, detailsFramework.HeaderMixin) diff --git a/Libs/DF/label.lua b/Libs/DF/label.lua index e0ac023bd..e42caddc8 100644 --- a/Libs/DF/label.lua +++ b/Libs/DF/label.lua @@ -416,4 +416,56 @@ function detailsFramework:NewLabel(parent, container, name, member, text, font, end return labelObject +end + +---@class df_errorlabel : df_label +---@field ShowErrorMsg fun(self: df_errorlabel, msg: string) show an error message to the user +---@field fadeInAnimationHub animationgroup +---@field fadeOutAnimationHub animationgroup +---@field shake df_frameshake + +local showErrorMsg = function(self, text) + if (self.HideTimer) then + return + end + + self.fadeInAnimationHub:Play() + if (text) then + self:SetText(text) + end + self:PlayFrameShake(self.shake) + + self.HideTimer = C_Timer.NewTimer(4, function() + self.fadeOutAnimationHub:Play() + self.HideTimer = nil + end) +end + +---error msg fontstring, this text is used to show errors to the user, its color is red, size 13 and it is placed centered and below the buttons above +---it also has an animation to fade out after 5 seconds, and a shake animation when it's shown +function detailsFramework:CreateErrorLabel(parent, text, size, color, layer, name) + ---@type df_errorlabel + local errorMsg = detailsFramework:CreateLabel(parent, text or "", size or 13, color or "orangered", nil, nil, name, layer or "overlay") + if (errorMsg) then + errorMsg:SetJustifyH("center") + errorMsg:SetAlpha(0) + + --fade out animation + local fadeOutAnimationHub = detailsFramework:CreateAnimationHub(errorMsg, function()end, function() errorMsg:SetAlpha(0) end) + detailsFramework:CreateAnimation(fadeOutAnimationHub, "Alpha", 1, 2, 1, 0) + errorMsg.fadeOutAnimationHub = fadeOutAnimationHub + + --fade in animation + local fadeInAnimationHub = detailsFramework:CreateAnimationHub(errorMsg, function() errorMsg:SetAlpha(0) end, function() errorMsg:SetAlpha(1) end) + detailsFramework:CreateAnimation(fadeInAnimationHub, "Alpha", 1, 0.1, 0, 1) + errorMsg.fadeInAnimationHub = fadeInAnimationHub + + --shake animation + local shake = detailsFramework:CreateFrameShake(errorMsg, 0.4, 6, 20, false, true, 0, 1, 0, 0.3) + errorMsg.shake = shake + + errorMsg.ShowErrorMsg = showErrorMsg + + return errorMsg + end end \ No newline at end of file diff --git a/Libs/DF/languages.lua b/Libs/DF/languages.lua index 55e939846..75217646b 100644 --- a/Libs/DF/languages.lua +++ b/Libs/DF/languages.lua @@ -919,7 +919,7 @@ function DF.Language.UnregisterCallback(addonId, callback) for i = 1, #addonNamespaceTable.callbacks do local callbackTable = addonNamespaceTable.callbacks[i] if (callbackTable.callback == callback) then - tremove(addonNamespaceTable.callbacks, i) + table.remove(addonNamespaceTable.callbacks, i) return true end end diff --git a/Libs/DF/line_indicator.lua b/Libs/DF/line_indicator.lua index 1bdba4416..3c6aafef4 100644 --- a/Libs/DF/line_indicator.lua +++ b/Libs/DF/line_indicator.lua @@ -73,6 +73,7 @@ end ---@field lineIndicatorLineHeight number ---@field lineIndicatorLineWidth number ---@field lineIndicatorPixelPerSecond number +---@field lineIndicatorMouseEnabled boolean ---@field lineIndicatorColor any ---@field lineIndicatorValueFontString fontstring ---@field LineIndicatorConstructor fun(self:df_lineindicator) diff --git a/Libs/DF/math.lua b/Libs/DF/math.lua index 7d63efdc6..7bbca841d 100644 --- a/Libs/DF/math.lua +++ b/Libs/DF/math.lua @@ -44,6 +44,7 @@ DF.Math = {} ---@field GetNinePoints fun(object: uiobject) : df_ninepoints ---@field GetClosestPoint fun(ninePoints: df_ninepoints, coordinate: df_coordinate) : anchorid ---@field GetVectorLength fun(vectorX: number, vectorY: number, vectorZ: number?) : number return the magnitude of a vector +---@field GetSortFractionFromString fun(str: string) : number return a fraction based on the string first two leters, useful for sorting cases where the number repeats ---@class df_coordinate : table ---@field x number @@ -124,6 +125,12 @@ function DF.Math.GetNinePoints(object) return ninePoints end +function DF.Math.GetSortFractionFromString(str) + local name = string.upper(str) .. "ZZ" + local byte1 = abs(string.byte(name, 2)-91) / 1000000 + return byte1 + abs(string.byte(name, 1)-91) / 10000 +end + function DF.Math.GetVectorLength(vectorX, vectorY, vectorZ) if (not vectorZ) then return (vectorX * vectorX + vectorY * vectorY) ^ 0.5 diff --git a/Libs/DF/packtable.lua b/Libs/DF/packtable.lua index 8c41be656..f8a5319b8 100644 --- a/Libs/DF/packtable.lua +++ b/Libs/DF/packtable.lua @@ -39,7 +39,7 @@ end ---merge multiple tables into a single one and pack it into a string separating values with commas where the first index tells the table length ---can pack strings and numbers, example: ---passed table: { {1, 2, 3}, {4, 5, 6}, {7, 8, 9}} ----result string: "9,1,2,3,4,5,6,7,8,9" > 9 indicating the total size of the subtables following by the indexes of the subtables +---result string: "9,1,2,3,4,5,6,7,8,9", 9 indicating the total size of the subtables following by the indexes of the subtables ---@param table table ---@return string function detailsFramework.table.packsubmerge(table) @@ -64,6 +64,39 @@ function detailsFramework.table.packsubmerge(table) return newString end +---merge a key-value table into a single string separating values with commas, where the first index is the key and the second index is the value +---example: {key1 = value1, key2 = value2, key3 = value3} +---returned string: "key1,value1,key2,value2,key3,value3" +---use unpackhash to rebuild the table +function detailsFramework.table.packhash(table) + local newString = "" + for key, value in pairs(table) do + newString = newString .. key .. "," .. value .. "," + end + + newString = newString:gsub(",$", "") + return newString +end + +---pack a hash table where the value of the key is a numerical table +---example: {key1 = {1, 2, 3}, key2 = {4, 6}, key3 = {7}} +---returned string: "key1,3,1,2,3,key2,2,4,6,key3,1,7" +---use unpackhashsubtable to rebuild the table +---@param table table +---@return string +function detailsFramework.table.packhashsubtable(table) + local newString = "" + for key, value in pairs(table) do + newString = newString .. key .. "," .. #value .. "," + for i = 1, #value do + newString = newString .. value[i] .. "," + end + end + + newString = newString:gsub(",$", "") + return newString +end + ---unpack a string and an array of data into a indexed table, starting from the startIndex also returns the next index to start reading ---expected data: "3,1,2,3,4,5,6,7,8" or {3,1,2,3,4,5,6,7,8}, with the example the returned table is: {1, 2, 3} and the next index to read is 5 ---@param data string|table @@ -133,5 +166,49 @@ function detailsFramework.table.unpacksub(data, startIndex) end end + return result +end + +function detailsFramework.table.unpackhash(data) + local splittedTable = {} + for value in data:gmatch("[^,]+") do + splittedTable[#splittedTable+1] = value + end + + local result = {} + for i = 1, #splittedTable, 2 do + result[splittedTable[i]] = splittedTable[i+1] + end + + return result +end + +---unpack a packhashsubtable string into a hash table where the value of the key is a numerical table +---expected data: "key1,3,1,2,3,key2,2,4,6,key3,1,7" +---returned table: {key1 = {1, 2, 3}, key2 = {4, 6}, key3 = {7}} +function detailsFramework.table.unpackhashsubtable(data) + local splittedTable = {} + for value in data:gmatch("[^,]+") do + splittedTable[#splittedTable+1] = value + end + + local result = {} + local currentIndex = 1 + while (splittedTable[currentIndex]) do + local key = splittedTable[currentIndex] + local tableSize = tonumber(splittedTable[currentIndex+1]) + if (not tableSize) then + error("Details! Framework: table.unpackhashsubtable: invalid table size.") + end + + local subTable = {} + for i = 1, tableSize do + subTable[#subTable+1] = splittedTable[currentIndex+1+i] + end + + result[key] = subTable + currentIndex = currentIndex + tableSize + 2 + end + return result end \ No newline at end of file diff --git a/Libs/DF/packtable.tests.lua b/Libs/DF/packtable.tests.lua index 26d735ed3..a88e1e486 100644 --- a/Libs/DF/packtable.tests.lua +++ b/Libs/DF/packtable.tests.lua @@ -28,6 +28,24 @@ function PackSubMergeTest() print("Result: " .. type(packed) .. " \"" .. packed .. "\"") end +function PackHashTest() + local table = {["abc"] = 1, ["def"] = 2, ["ghi"] = 3} + local packed = DetailsFramework.table.packhash(table) + print("Testing table.packhash, data: [\"abc\"] = 1, [\"def\"] = 2, [\"ghi\"] = 3") + local expected = "string \"abc,1,def,2,ghi,3\"" + print("Expected: string ", expected) + print("Result: " .. type(packed) .. " \"" .. packed .. "\"") +end + +function PackHashSubTableTest() + local table = {["abc"] = {1, 2, 3}, ["def"] = {4, 5, 6}, ["ghi"] = {7, 8, 9}} + local packed = DetailsFramework.table.packhashsubtable(table) + print("Testing table.packhashsubtable, data: [\"abc\"] = {1, 2, 3}, [\"def\"] = {4, 5, 6}, [\"ghi\"] = {7, 8, 9}") + local expected = "string \"abc,3,1,2,3,def,3,4,5,6,ghi,3,7,8,9\"" + print("Expected: string ", expected) + print("Result: " .. type(packed) .. " \"" .. packed .. "\"") +end + function UnpackTest() local packed = "5,1,2,3,4,5" local table, nextIndex = DetailsFramework.table.unpack(packed) @@ -53,4 +71,14 @@ function UnpackSubTest() local expected = "table {table {1, 2, 3}, table {4, 5, 6}, table {7, 8, 9}}" print("Expected:", expected) print("Result: " .. type(tables) .. " {" .. type(tables[1]) .. " {" .. tables[1][1] .. ", " .. tables[1][2] .. ", " .. tables[1][3] .. "}, " .. type(tables[2]) .. " {" .. tables[2][1] .. ", " .. tables[2][2] .. ", " .. tables[2][3] .. "}, " .. type(tables[3]) .. " {" .. tables[3][1] .. ", " .. tables[3][2] .. ", " .. tables[3][3] .. "}}") -end \ No newline at end of file +end + +--unpack hash sub table test +function UnpackHashSubTableTest() + local packed = "abc,2,1,2,def,5,4,5,6,9,2,ghi,3,7,8,9" + local tables = DetailsFramework.table.unpackhashsubtable(packed) + print("Testing table.unpackhashsubtable, data: \"abc,2,1,2,def,5,4,5,6,9,2,ghi,3,7,8,9\"") + local expected = "table {abc = {1, 2}, def = {4, 5, 6, 9, 2}, ghi = {7, 8, 9}}" + print("Expected:", expected) + print("Result: " .. type(tables) .. " {abc = {" .. tables["abc"][1] .. ", " .. tables["abc"][2] .. "}, def = {" .. tables["def"][1] .. ", " .. tables["def"][2] .. ", " .. tables["def"][3] .. ", " .. tables["def"][4] .. ", " .. tables["def"][5] .. "}, ghi = {" .. tables["ghi"][1] .. ", " .. tables["ghi"][2] .. ", " .. tables["ghi"][3] .. "}}") +end diff --git a/Libs/DF/panel.lua b/Libs/DF/panel.lua index f76bec118..835f3bc61 100644 --- a/Libs/DF/panel.lua +++ b/Libs/DF/panel.lua @@ -826,10 +826,10 @@ local align_rows = function(self) if (rowType == "text") then for i = 1, #self.scrollframe.lines do local line = self.scrollframe.lines [i] - local text = tremove(line.text_available) + local text = table.remove(line.text_available) if (not text) then self:CreateRowText (line) - text = tremove(line.text_available) + text = table.remove(line.text_available) end table.insert(line.text_inuse, text) text:SetPoint("left", line, "left", self._anchors [#self._anchors], 0) @@ -841,10 +841,10 @@ local align_rows = function(self) elseif (rowType == "entry") then for i = 1, #self.scrollframe.lines do local line = self.scrollframe.lines [i] - local entry = tremove(line.entry_available) + local entry = table.remove(line.entry_available) if (not entry) then self:CreateRowEntry (line) - entry = tremove(line.entry_available) + entry = table.remove(line.entry_available) end table.insert(line.entry_inuse, entry) entry:SetPoint("left", line, "left", self._anchors [#self._anchors], 0) @@ -869,10 +869,10 @@ local align_rows = function(self) elseif (rowType == "checkbox") then for i = 1, #self.scrollframe.lines do local line = self.scrollframe.lines [i] - local checkbox = tremove(line.checkbox_available) + local checkbox = table.remove(line.checkbox_available) if (not checkbox) then self:CreateCheckbox (line) - checkbox = tremove(line.checkbox_available) + checkbox = table.remove(line.checkbox_available) end table.insert(line.checkbox_inuse, checkbox) @@ -892,10 +892,10 @@ local align_rows = function(self) elseif (rowType == "button") then for i = 1, #self.scrollframe.lines do local line = self.scrollframe.lines [i] - local button = tremove(line.button_available) + local button = table.remove(line.button_available) if (not button) then self:CreateRowButton (line) - button = tremove(line.button_available) + button = table.remove(line.button_available) end table.insert(line.button_inuse, button) button:SetPoint("left", line, "left", self._anchors [#self._anchors], 0) @@ -938,10 +938,10 @@ local align_rows = function(self) elseif (rowType == "icon") then for i = 1, #self.scrollframe.lines do local line = self.scrollframe.lines [i] - local icon = tremove(line.icon_available) + local icon = table.remove(line.icon_available) if (not icon) then self:CreateRowIcon (line) - icon = tremove(line.icon_available) + icon = table.remove(line.icon_available) end table.insert(line.icon_inuse, icon) icon:SetPoint("left", line, "left", self._anchors [#self._anchors] + ( ((row.width or 22) - 22) / 2), 0) @@ -951,10 +951,10 @@ local align_rows = function(self) elseif (rowType == "texture") then for i = 1, #self.scrollframe.lines do local line = self.scrollframe.lines [i] - local texture = tremove(line.texture_available) + local texture = table.remove(line.texture_available) if (not texture) then self:CreateRowTexture (line) - texture = tremove(line.texture_available) + texture = table.remove(line.texture_available) end table.insert(line.texture_inuse, texture) texture:SetPoint("left", line, "left", self._anchors [#self._anchors] + ( ((row.width or 22) - 22) / 2), 0) @@ -1019,42 +1019,42 @@ local update_rows = function(self, updated_rows) for index, row in ipairs(self.scrollframe.lines) do for i = #row.text_inuse, 1, -1 do - table.insert(row.text_available, tremove(row.text_inuse, i)) + table.insert(row.text_available, table.remove(row.text_inuse, i)) end for i = 1, #row.text_available do row.text_available[i]:Hide() end for i = #row.entry_inuse, 1, -1 do - table.insert(row.entry_available, tremove(row.entry_inuse, i)) + table.insert(row.entry_available, table.remove(row.entry_inuse, i)) end for i = 1, #row.entry_available do row.entry_available[i]:Hide() end for i = #row.button_inuse, 1, -1 do - table.insert(row.button_available, tremove(row.button_inuse, i)) + table.insert(row.button_available, table.remove(row.button_inuse, i)) end for i = 1, #row.button_available do row.button_available[i]:Hide() end for i = #row.checkbox_inuse, 1, -1 do - table.insert(row.checkbox_available, tremove(row.checkbox_inuse, i)) + table.insert(row.checkbox_available, table.remove(row.checkbox_inuse, i)) end for i = 1, #row.checkbox_available do row.checkbox_available[i]:Hide() end for i = #row.icon_inuse, 1, -1 do - table.insert(row.icon_available, tremove(row.icon_inuse, i)) + table.insert(row.icon_available, table.remove(row.icon_inuse, i)) end for i = 1, #row.icon_available do row.icon_available[i]:Hide() end for i = #row.texture_inuse, 1, -1 do - table.insert(row.texture_available, tremove(row.texture_inuse, i)) + table.insert(row.texture_available, table.remove(row.texture_inuse, i)) end for i = 1, #row.texture_available do row.texture_available[i]:Hide() @@ -3098,7 +3098,7 @@ end local do_SMA = function(value, max_value) if (#SMA_table == 10) then - tremove(SMA_table, 1) + table.remove(SMA_table, 1) end SMA_table [#SMA_table + 1] = value @@ -3210,10 +3210,10 @@ local chart_panel_add_data = function(self, graphicData, color, name, elapsedTim end end - tremove(content, 1) - tremove(content, 1) - tremove(content, #graphicData) - tremove(content, #graphicData) + table.remove(content, 1) + table.remove(content, 1) + table.remove(content, #graphicData) + table.remove(content, #graphicData) if (maxValue > LibGraphChartFrame.max_value) then --normalize previous data @@ -3539,7 +3539,7 @@ local gframe_reset = function(self) end if (self.GraphLib_Lines_Used) then for i = #self.GraphLib_Lines_Used, 1, -1 do - local line = tremove(self.GraphLib_Lines_Used) + local line = table.remove(self.GraphLib_Lines_Used) table.insert(self.GraphLib_Lines, line) line:Hide() end @@ -3882,7 +3882,7 @@ end ---@field GetData fun(self:df_scrollbox): table ---@field OnSetData fun(self:df_scrollbox, data:table)? if exists, this function is called after the SetData with the same parameters ---@field ScrollBar statusbar ----@field +---@field RefreshMe fun(...:any) virtual, implement if the data need to be manipulated, must call :SetData() and :Refresh() ---create a scrollbox with the methods :Refresh() :SetData() :CreateLine() ---@param parent table @@ -3935,6 +3935,15 @@ end -- ~resizers --these options are copied to the object with object:BuildOptionsTable() +---@class df_resizergrip_options +---@field width number? +---@field height number? +---@field use_default_scripts boolean? +---@field should_mirror_left_texture boolean? +---@field normal_texture string|number? +---@field highlight_texture string|number? +---@field pushed_texture string|number? + local rezieGripOptions = { width = 32, height = 32, @@ -3945,16 +3954,21 @@ local rezieGripOptions = { pushed_texture = [[Interface\CHATFRAME\UI-ChatIM-SizeGrabber-Down]], } +---@class df_resizergrip : button, df_optionsmixin +---@field options df_resizergrip_options + ---create the two resize grips for a frame, one in the bottom left and another in the bottom right ---@param parent frame ----@param options table|nil +---@param options df_resizergrip_options? ---@param leftResizerName string|nil ---@param rightResizerName string|nil ---@return frame, frame function detailsFramework:CreateResizeGrips(parent, options, leftResizerName, rightResizerName) local parentName = parent:GetName() + ---@type df_resizergrip local leftResizer = _G.CreateFrame("button", leftResizerName or (parentName and "$parentLeftResizer"), parent, "BackdropTemplate") + ---@type df_resizergrip local rightResizer = _G.CreateFrame("button", rightResizerName or (parentName and "$parentRightResizer"), parent, "BackdropTemplate") leftResizer:SetFrameLevel(parent:GetFrameLevel() + 20) @@ -5264,7 +5278,7 @@ detailsFramework.ListboxFunctions = { end, deleteEntry = function(self, button, data, index) - tremove(data, index) + table.remove(data, index) --get the line, get the scrollframe self:GetParent():GetParent():Refresh() end, diff --git a/Libs/DF/spells.lua b/Libs/DF/spells.lua index 758ee93df..12a927e18 100644 --- a/Libs/DF/spells.lua +++ b/Libs/DF/spells.lua @@ -1467,7 +1467,7 @@ function DF:GetSpellsForEncounterFromJournal (instanceEJID, encounterEJID) while (nextID [1]) do --get the deepest section in the hierarchy - local ID = tremove(nextID) + local ID = table.remove(nextID) local sectionInfo = C_EncounterJournal.GetSectionInfo (ID) if (sectionInfo) then diff --git a/Libs/DF/textentry.lua b/Libs/DF/textentry.lua index fd5415741..812eae6b4 100644 --- a/Libs/DF/textentry.lua +++ b/Libs/DF/textentry.lua @@ -540,6 +540,12 @@ detailsFramework.TextEntryCounter = detailsFramework.TextEntryCounter or 1 ------------------------------------------------------------------------------------------------------------ function TextEntryMetaFunctions:SetTemplate(template) + template = detailsFramework:ParseTemplate(self.type, template) --"textentry" + + if (template.multiline) then + self.editbox:SetMultiLine(true) + end + if (template.width) then self.editbox:SetWidth(template.width) end @@ -617,7 +623,7 @@ end ---@field param1 any ---@field param2 any ---@field ShouldOptimizeAutoComplete boolean? ----@field SetTemplate fun(self:df_textentry, template:table) +---@field SetTemplate fun(self:df_textentry, template:table|string) ---@field Disable fun(self:df_textentry) ---@field Enable fun(self:df_textentry) ---@field SetCommitFunction fun(self:df_textentry, func:function) @@ -627,7 +633,7 @@ end ---@field SelectAll fun(self:df_textentry) ---@field SetAutoSelectTextOnFocus fun(self:df_textentry, value:boolean) ---@field Blink fun(self:df_textentry) ----@field SetText fun(self:df_textentry, text:string) +---@field SetText fun(self:df_textentry, text:string|number) ---@field GetText fun(self:df_textentry) ---@field SetEnterFunction fun(self:df_textentry, func:function, param1:any, param2:any) ---@field SetHook fun(self:df_textentry, hookName:string, func:function) diff --git a/Libs/DF/timeline.lua b/Libs/DF/timeline.lua index 28d070df2..1361aef35 100644 --- a/Libs/DF/timeline.lua +++ b/Libs/DF/timeline.lua @@ -1,4 +1,5 @@ +---@type detailsframework local detailsFramework = _G ["DetailsFramework"] if (not detailsFramework or not DetailsFrameworkCanLoad) then return @@ -75,6 +76,8 @@ local APIFrameFunctions ---@field block_on_leave fun(self:button) ---@field block_on_click fun(self:button) ---@field block_on_set_data fun(self:button, data:table) +---@field block_on_enter_auralength fun(self:df_timeline_line_block) +---@field block_on_leave_auralength fun(self:df_timeline_line_block) local timeline_options = { width = 400, height = 700, @@ -123,6 +126,10 @@ local timeline_options = { -- end, -- block_on_set_data = function(self, data) -- end, +-- block_on_enter_auralength = function() +-- end, +-- block_on_leave_auralength = function() +-- end, } ---@class df_timeline_block_data : table @@ -132,6 +139,9 @@ local timeline_options = { ---@field [4] number auraDuration ---@field [5] number blockSpellId ---@field payload any +---@field customIcon any +---@field customName any +---@field isIconRow boolean? ---@class df_timeline_linedata : table ---@field spellId number @@ -151,12 +161,14 @@ local timeline_options = { ---@field duration number ---@field spellId number ---@field payload any +---@field customIcon any +---@field customName any ---@class df_timeline_line_block : frame ---@field icon texture ---@field text fontstring ---@field background texture ----@field auraLength texture +---@field auraLength frame ---@field info df_timeline_line_blockinfo ---@class df_timeline_line_mixin : frame @@ -240,6 +252,7 @@ detailsFramework.TimeLine_LineMixin = { local baseFrameLevel = timeline:GetFrameLevel() + 10 local errorHandler = geterrorhandler() + local rowStartBlock for i = 1, #timelineData do local blockInfo = timelineData[i] @@ -251,6 +264,12 @@ detailsFramework.TimeLine_LineMixin = { local blockSpellId = blockInfo[5] local payload = blockInfo.payload + local customIcon = blockInfo.customIcon + local customName = blockInfo.customName + local inRow = blockInfo.isIconRow + local showRightIcon = blockInfo.showRightIcon + local auraHeight = blockInfo.auraHeight + local auraYOffset = blockInfo.auraYOffset local xOffset = pixelPerSecond * timeInSeconds local width = pixelPerSecond * length @@ -261,18 +280,32 @@ detailsFramework.TimeLine_LineMixin = { local block = self:GetBlock(i) block:Show() - block:SetFrameLevel(baseFrameLevel + i) - - PixelUtil.SetPoint(block, "left", self, "left", xOffset + headerWidth, 0) + block:SetFrameLevel(baseFrameLevel) + + if (inRow) then + --when tagged as row, the icon will be attached to the latest block added into the line + local lastBlock = self:GetBlock(i-1) + PixelUtil.SetPoint(block, "left", lastBlock, "right", 2, 0) + if (not rowStartBlock) then + rowStartBlock = lastBlock + end + else + PixelUtil.SetPoint(block, "left", self, "left", xOffset + headerWidth, 0) + rowStartBlock = nil + end block.info.spellId = blockSpellId or spellId block.info.time = timeInSeconds block.info.duration = auraDuration block.info.payload = payload + block.info.customIcon = customIcon --nil set to nil if not exists + block.info.customName = customName if (useIconOnBlock) then local iconTexture = lineData.icon - if (blockSpellId) then + if (customIcon) then + iconTexture = customIcon + elseif (blockSpellId) then iconTexture = GetSpellTexture(blockSpellId) end @@ -291,14 +324,47 @@ detailsFramework.TimeLine_LineMixin = { if (isAura) then block.auraLength:Show() - block.auraLength:SetWidth(pixelPerSecond * isAura) - block:SetWidth(max(pixelPerSecond * isAura, 16)) + local thisAuraDuration = auraDuration + if (timeInSeconds + thisAuraDuration > timeline.data.length) then + thisAuraDuration = timeline.data.length - timeInSeconds + end + + if (blockInfo.auraLengthColor) then + local r, g, b = unpack(blockInfo.auraLengthColor) + block.auraLength.Texture:SetVertexColor(r, g, b, 0.5) + else + block.auraLength.Texture:SetVertexColor(1, 1, 1, 0.5) + end + + block.auraLength.Texture:Show() + + block.auraLength:SetWidth(pixelPerSecond * thisAuraDuration) + block.auraLength:SetHeight(auraHeight and auraHeight or block:GetHeight()) + + if (showRightIcon) then + block.auraLength.RightIcon:SetTexture(iconTexture) + block.auraLength.RightIcon:SetTexCoord(.1, .9, .1, .9) + block.auraLength.RightIcon:SetWidth(block.auraLength:GetHeight()) + block.auraLength.RightIcon:Show() + else + block.auraLength.RightIcon:SetTexture(nil) + block.auraLength.RightIcon:Hide() + end + + if (inRow) then + block.auraLength:SetPoint("bottomleft", rowStartBlock or block.icon, "bottomleft", 0, auraYOffset) + else + block.auraLength:SetPoint("bottomleft", block.icon, "bottomleft", 0, auraYOffset) + end + + --block:SetWidth(max(pixelPerSecond * auraDuration, 16)) else block.auraLength:Hide() end block.background:SetVertexColor(0, 0, 0, 0) else + block.icon:SetTexture("") block.background:SetVertexColor(0, 0, 0, 0) PixelUtil.SetSize(block, max(width, 16), self:GetHeight()) block.auraLength:Hide() @@ -315,6 +381,49 @@ detailsFramework.TimeLine_LineMixin = { end end, + OnEnterAuraLength = function(self) + ---@type df_timeline + local timeline = self.timeline + if (timeline.options.block_on_enter_auralength) then + timeline.options.block_on_enter_auralength(self) + end + end, + + OnLeaveAuraLength = function(self) + ---@type df_timeline + local timeline = self.timeline + if (timeline.options.block_on_enter_auralength) then + timeline.options.block_on_leave_auralength(self) + end + end, + + CreateAuraLength = function(block) + local auraLengthFrame = CreateFrame("frame", nil, block) + auraLengthFrame:SetFrameLevel(block:GetFrameLevel() - 1) + auraLengthFrame:SetScript("OnEnter", detailsFramework.TimeLine_LineMixin.OnEnterAuraLength) + auraLengthFrame:SetScript("OnLeave", detailsFramework.TimeLine_LineMixin.OnLeaveAuraLength) + --save reference of the block + auraLengthFrame.block = block + --save reference of the timeline + auraLengthFrame.timeline = block:GetParent():GetParent():GetParent() + + local auraLengthTexture = auraLengthFrame:CreateTexture(nil, "border") + auraLengthTexture:SetColorTexture(1, 1, 1, 1) + auraLengthTexture:SetVertexColor(1, 1, 1, 0.1) + auraLengthTexture:SetAllPoints() + auraLengthFrame.Texture = auraLengthTexture + + --icon which will be shown at the end of the auraLength frame if the icon is enabled + local rightIcon = auraLengthFrame:CreateTexture(nil, "border") + rightIcon:SetPoint("topright", auraLengthFrame, "topright", 0, 0) + rightIcon:SetPoint("bottomright", auraLengthFrame, "bottomright", 0, 0) + auraLengthFrame.RightIcon = rightIcon + + detailsFramework:CreateHighlightTexture(auraLengthFrame) + + block.auraLength = auraLengthFrame + end, + GetBlock = function(self, index) local block = self.blocks[index] if (not block) then @@ -326,7 +435,8 @@ detailsFramework.TimeLine_LineMixin = { background:SetColorTexture(1, 1, 1, 1) local icon = block:CreateTexture(nil, "artwork") local text = block:CreateFontString(nil, "artwork") - local auraLength = block:CreateTexture(nil, "border") + + detailsFramework.TimeLine_LineMixin.CreateAuraLength(block) local backgroundBorder = detailsFramework:CreateFullBorder("$parentBorder", block) local iconOffset = -1 * UIParent:GetEffectiveScale() @@ -340,15 +450,10 @@ detailsFramework.TimeLine_LineMixin = { background:SetAllPoints() icon:SetPoint("left") text:SetPoint("left", icon, "left", 2, 0) - auraLength:SetPoint("topleft", icon, "topleft", 0, 0) - auraLength:SetPoint("bottomleft", icon, "bottomleft", 0, 0) - auraLength:SetColorTexture(1, 1, 1, 1) - auraLength:SetVertexColor(1, 1, 1, 0.1) block.icon = icon block.text = text block.background = background - block.auraLength = auraLength block.backgroundBorder = backgroundBorder block:SetScript("OnEnter", self:GetParent():GetParent().options.block_on_enter) @@ -389,7 +494,8 @@ detailsFramework.TimeLine_LineMixin = { ---@field onClickCallback fun() ---@field onClickCallbackFunc fun() ---@field onClickCallbackArgs any[] ----@field headerFrame frame headerFrame only exists if the options.header_detached is true +---@field headerFrame scrollframe headerFrame only exists if the options.header_detached is true +---@field headerBody frame headerBody only exists if the options.header_detached is true ---@field resizeButton button ---@field elapsedTimeFrame df_elapsedtime ---@field horizontalSlider slider @@ -526,9 +632,10 @@ detailsFramework.TimeLineMixin = { local lineHeader if (detachedHeaderFrame) then - lineHeader = CreateFrame("frame", nil, detachedHeaderFrame, "BackdropTemplate") + lineHeader = CreateFrame("frame", nil, self.headerBody, "BackdropTemplate") lineHeader:SetSize(detachedHeaderFrame:GetWidth(), self.options.line_height) - lineHeader:SetPoint("topleft", detachedHeaderFrame, "topleft", 0, xPosition) + lineHeader:SetPoint("topleft", self.headerBody, "topleft", 0, xPosition) + lineHeader.Line = line else lineHeader = CreateFrame("frame", nil, line, "BackdropTemplate") lineHeader:SetPoint("topleft", line, "topleft", 0, 0) @@ -571,6 +678,49 @@ detailsFramework.TimeLineMixin = { end end, + RefreshPerPixelButtons = function(self) + --local amountOfButtons = floor(self.body:GetWidth() / (pixelPerSecond * currentScale)) + local amountOfButtons = self.totalLength + local buttonHeight = self:GetHeight() + local widthPerSecond = self.options.pixels_per_second * self.currentScale + + --print("Updating Buttons...", amountOfButtons, "bodyHeight??", buttonHeight, "scale:", currentScale) + + for i = 1, amountOfButtons do + local button = self.body.Buttons[i] + if (not button) then + button = CreateFrame("button", "$parentButton" .. i, self.body, "BackdropTemplate") + local overlayTexture = button:CreateTexture(nil, "overlay") + local r, g, b, a = detailsFramework:GetDefaultBackdropColor() + overlayTexture:SetColorTexture(1, 1, 1) + overlayTexture:SetAlpha(i % 2 == 0 and 0.01 or 0.02) + overlayTexture:SetAllPoints() + + --create a highlight texture + local highlightTexture = button:CreateTexture(nil, "highlight") + highlightTexture:SetColorTexture(1, 1, 1, 0.05) + highlightTexture:SetAllPoints() + + self.body.Buttons[i] = button + end + + button:SetSize(widthPerSecond, buttonHeight) + + local xPosition = (i - 1) * widthPerSecond + xPosition = xPosition + self.options.header_width + button:SetPoint("topleft", self.body, "topleft", xPosition, 0) + + self:UpdateOnClickCallback(button) + + button:Show() + button.index = i + end + + for i = amountOfButtons+1, #self.body.Buttons do + self.body.Buttons[i]:Hide() + end + end, + --todo --make the on enter and leave tooltips --set icons and texts @@ -631,50 +781,6 @@ detailsFramework.TimeLineMixin = { self.body.effectiveWidth = bodyWidth - --buttons are the vertical clickable areas inside the timeline, each second on the time line has one - if (not bDoNotRefreshButtons and self.options.use_perpixel_buttons) then - --local amountOfButtons = floor(self.body:GetWidth() / (pixelPerSecond * currentScale)) - local amountOfButtons = totalLength - local buttonHeight = self:GetHeight() - local widthPerSecond = pixelPerSecond * currentScale - - --print("Updating Buttons...", amountOfButtons, "bodyHeight??", buttonHeight, "scale:", currentScale) - - for i = 1, amountOfButtons do - local button = self.body.Buttons[i] - if (not button) then - button = CreateFrame("button", "$parentButton" .. i, self.body, "BackdropTemplate") - local overlayTexture = button:CreateTexture(nil, "overlay") - local r, g, b, a = detailsFramework:GetDefaultBackdropColor() - overlayTexture:SetColorTexture(1, 1, 1) - overlayTexture:SetAlpha(i % 2 == 0 and 0.01 or 0.02) - overlayTexture:SetAllPoints() - - --create a highlight texture - local highlightTexture = button:CreateTexture(nil, "highlight") - highlightTexture:SetColorTexture(1, 1, 1, 0.05) - highlightTexture:SetAllPoints() - - self.body.Buttons[i] = button - end - - button:SetSize(widthPerSecond, buttonHeight) - - local xPosition = (i - 1) * widthPerSecond - xPosition = xPosition + self.options.header_width - button:SetPoint("topleft", self.body, "topleft", xPosition, 0) - - self:UpdateOnClickCallback(button) - - button:Show() - button.index = i - end - - for i = amountOfButtons+1, #self.body.Buttons do - self.body.Buttons[i]:Hide() - end - end - --adjust the scale slider range local oldMin, oldMax = self.horizontalSlider:GetMinMaxValues() self.horizontalSlider:SetMinMaxValues(0, newMaxValue) @@ -688,6 +794,11 @@ detailsFramework.TimeLineMixin = { self.defaultColor = defaultColor self.headerWidth = effectiveHeaderWidth + --buttons are the vertical clickable areas inside the timeline, each second on the time line has one + if (not bDoNotRefreshButtons and self.options.use_perpixel_buttons) then + self:RefreshPerPixelButtons() + end + --calculate the total height local lineHeight = self.options.line_height local linePadding = self.options.line_padding @@ -697,16 +808,22 @@ detailsFramework.TimeLineMixin = { self.verticalSlider:SetMinMaxValues(0, max(bodyHeight - self:GetHeight(), 0)) self.verticalSlider:SetValue(0) + if (bHeaderDetached) then + self.headerBody:SetHeight(bodyHeight) + self.headerFrame.verticalSlider:SetMinMaxValues(0, max(bodyHeight - self:GetHeight(), 0)) + self.headerFrame.verticalSlider:SetValue(0) + end + self:ResetAllLines() if (self.options.auto_height) then self:SetHeight(bodyHeight) end - local howManyLinesTheTimelineCanShow = floor(self:GetHeight() / (lineHeight + linePadding)) - 1 - --refresh lines - for i = 1, math.min(#self.data.lines, howManyLinesTheTimelineCanShow) do + local howManyLinesTheTimelineCanShow = floor(self:GetHeight() / (lineHeight + linePadding)) - 1 + --for i = 1, math.min(#self.data.lines, howManyLinesTheTimelineCanShow) do + for i = 1, #self.data.lines do local line = self:GetLine(i) line.dataIndex = i --this index is used inside the line update function to know which data to get line.lineHeader:SetWidth(self.options.header_width) @@ -748,10 +865,28 @@ detailsFramework.TimeLineMixin = { local timelineHeader = { ---@param self df_timeline CreateDetachedHeader = function(self) - local headerFrame = CreateFrame("frame", nil, self, "BackdropTemplate") + local headerFrame = CreateFrame("scrollframe", nil, self, "BackdropTemplate") headerFrame:SetWidth(self.options.header_width) self.headerFrame = headerFrame - return headerFrame + + local headerBody = CreateFrame("frame", nil, headerFrame, "BackdropTemplate") + headerBody:SetSize(headerFrame:GetSize()) + headerBody.Lines = {} + headerFrame.body = headerBody + self.headerBody = headerBody + + headerFrame:SetScrollChild(headerBody) + headerBody.originalHeight = headerBody:GetHeight() + + local verticalSlider = CreateFrame("slider", nil, headerFrame) + headerFrame.verticalSlider = verticalSlider + verticalSlider:SetOrientation("vertical") + verticalSlider:SetValue(0) + verticalSlider:SetScript("OnValueChanged", function(self) + headerFrame:SetVerticalScroll(self:GetValue()) + end) + + return headerFrame, headerBody end, } @@ -809,6 +944,7 @@ function detailsFramework:CreateTimeLineFrame(parent, name, timelineOptions, ela --create elapsed time frame frameCanvas.elapsedTimeFrame = detailsFramework:CreateElapsedTimeFrame(frameBody, frameCanvas:GetName() and (frameCanvas:GetName() .. "ElapsedTimeFrame"), elapsedtimeOptions) + frameCanvas.elapsedTimeFrame:SetScrollChild(frameBody) local thumbColor = 0.95 local scrollBackgroudColor = {0.05, 0.05, 0.05, 0.7} @@ -902,6 +1038,9 @@ function detailsFramework:CreateTimeLineFrame(parent, name, timelineOptions, ela verticalSlider:SetValue(0) verticalSlider:SetScript("OnValueChanged", function(self) frameCanvas:SetVerticalScroll(self:GetValue()) + if (frameCanvas.options.header_detached) then + frameCanvas.headerFrame.verticalSlider:SetValue(self:GetValue()) + end end) --mouse scroll @@ -910,6 +1049,21 @@ function detailsFramework:CreateTimeLineFrame(parent, name, timelineOptions, ela local minValue, maxValue = horizontalSlider:GetMinMaxValues() local currentHorizontal = horizontalSlider:GetValue() + if (delta < 0) then + if (verticalSlider:IsShown()) then + local amountToScroll = frameBody:GetHeight() / 20 + verticalSlider:SetValue(verticalSlider:GetValue() + amountToScroll) + return + end + + elseif (delta > 0) then + if (verticalSlider:IsShown()) then + local amountToScroll = frameBody:GetHeight() / 20 + verticalSlider:SetValue(verticalSlider:GetValue() - amountToScroll) + return + end + end + if (IsShiftKeyDown() and delta < 0) then if (verticalSlider:IsShown()) then local amountToScroll = frameBody:GetHeight() / 20 @@ -941,7 +1095,6 @@ function detailsFramework:CreateTimeLineFrame(parent, name, timelineOptions, ela local scrolledWidth = horizontalSlider:GetValue() - currentHorizontal frameCanvas.scrolledWidth = scrolledWidth frameBody.scrolledWidth = scrolledWidth - end end) @@ -965,10 +1118,10 @@ function detailsFramework:CreateTimeLineFrame(parent, name, timelineOptions, ela frameBody:SetScript("OnUpdate", nil) end) - local headerFrame + local headerFrame, headerBody --if the header detached? if (timelineOptions.header_detached) then - headerFrame = timelineHeader.CreateDetachedHeader(frameCanvas) + headerFrame, headerBody = timelineHeader.CreateDetachedHeader(frameCanvas) end --create a resize button @@ -992,5 +1145,5 @@ function detailsFramework:CreateTimeLineFrame(parent, name, timelineOptions, ela frameCanvas:RefreshResize() frameCanvas:OnSizeChanged() - return frameCanvas, headerFrame + return frameCanvas, headerFrame, headerBody end \ No newline at end of file diff --git a/Libs/LibGraph-2.0/LibGraph-2.0.lua b/Libs/LibGraph-2.0/LibGraph-2.0.lua index 9035d3d66..0cc0a8007 100644 --- a/Libs/LibGraph-2.0/LibGraph-2.0.lua +++ b/Libs/LibGraph-2.0/LibGraph-2.0.lua @@ -41,7 +41,7 @@ local pairs = pairs local sqrt = sqrt local table = table local tinsert = tinsert -local tremove = tremove +local tremove = table.remove local type = type local math_max = math.max local math_min = math.min diff --git a/Libs/LibOpenRaid/GetPlayerInformation.lua b/Libs/LibOpenRaid/GetPlayerInformation.lua index 697f77f17..424448461 100644 --- a/Libs/LibOpenRaid/GetPlayerInformation.lua +++ b/Libs/LibOpenRaid/GetPlayerInformation.lua @@ -476,7 +476,7 @@ function openRaidLib.GearManager.BuildPlayerEquipmentList() numModifiers = numModifiers and tonumber(numModifiers) or 0 for i = #linkTable, 14 + numModifiers + 1, -1 do - tremove(linkTable, i) + table.remove(linkTable, i) end local newItemLink = table.concat(linkTable, ":") diff --git a/Libs/LibOpenRaid/LibOpenRaid.lua b/Libs/LibOpenRaid/LibOpenRaid.lua index e4da8f5b3..dadb324a8 100644 --- a/Libs/LibOpenRaid/LibOpenRaid.lua +++ b/Libs/LibOpenRaid/LibOpenRaid.lua @@ -56,7 +56,7 @@ end local major = "LibOpenRaid-1.0" -local CONST_LIB_VERSION = 144 +local CONST_LIB_VERSION = 145 if (LIB_OPEN_RAID_MAX_VERSION) then if (CONST_LIB_VERSION <= LIB_OPEN_RAID_MAX_VERSION) then @@ -467,7 +467,7 @@ end local dataAsTable = {strsplit(",", data)} --remove the first index (prefix) - tremove(dataAsTable, 1) + table.remove(dataAsTable, 1) --trigger callbacks for i = 1, #callbackTable do @@ -925,7 +925,7 @@ end for i = 1, #openRaidLib.publicCallback.events[event] do local registeredCallback = openRaidLib.publicCallback.events[event][i] if (registeredCallback[1] == addonObject and registeredCallback[2] == callbackMemberName) then - tremove(openRaidLib.publicCallback.events[event], i) + table.remove(openRaidLib.publicCallback.events[event], i) break end end @@ -962,7 +962,7 @@ end local eventCallbacks = openRaidLib.internalCallback.events[event] for i = 1, #eventCallbacks do if (eventCallbacks[i] == func) then - tremove(eventCallbacks, i) + table.remove(eventCallbacks, i) break end end @@ -1708,7 +1708,7 @@ openRaidLib.internalCallback.RegisterCallback("onLeaveCombat", openRaidLib.UnitI -------------------------------------------------------------------------------------------------------------------------------- ---~equipment +--~equipment ~gear openRaidLib.GearManager = { --structure: [playerName] = {ilevel = 100, durability = 100, weaponEnchant = 0, noGems = {}, noEnchants = {}} UnitData = {}, @@ -2365,7 +2365,7 @@ end end --return a table containing values about the cooldown time - --values returned: {timeLeft, charges, timeOffset, duration, updateTime} + --values returned: {timeLeft, charges, timeOffset, duration, updateTime, auraDuration} function openRaidLib.GetUnitCooldownInfo(unitId, spellId) local unitCooldownsTable = openRaidLib.GetUnitCooldowns(unitId) if (unitCooldownsTable) then diff --git a/Libs/LibOpenRaid/ThingsToMantain_WarWithin.lua b/Libs/LibOpenRaid/ThingsToMantain_WarWithin.lua index 4cf7af46c..8d99e8f01 100644 --- a/Libs/LibOpenRaid/ThingsToMantain_WarWithin.lua +++ b/Libs/LibOpenRaid/ThingsToMantain_WarWithin.lua @@ -315,7 +315,7 @@ do -- 66 - Protection -- 70 - Retribution [31850] = {cooldown = 120, duration = 8, specs = {66}, talent = false, charges = 1, class = "PALADIN", type = 2}, --Ardent Defender - [31821] = {cooldown = 180, duration = 8, specs = {65}, talent = false, charges = 1, class = "PALADIN", type = 4}, --Aura Mastery + [31821] = {cooldown = 180, duration = 8, specs = {65}, talent = false, charges = 1, class = "PALADIN", type = 4, cdtype = "DR"}, --Aura Mastery [216331] = {cooldown = 120, duration = 20, specs = {65}, talent = false, charges = 1, class = "PALADIN", type = 1}, --Avenging Crusader [31884] = {cooldown = 120, duration = 20, specs = {65, 66, 70}, talent = false, charges = 1, class = "PALADIN", type = 1}, --Avenging Wrath [1044] = {cooldown = 25, duration = 8, specs = {65, 66, 70}, talent = false, charges = 1, class = "PALADIN", type = 5}, --Blessing of Freedom @@ -359,7 +359,7 @@ do [184364] = {cooldown = 120, duration = 8, specs = {72}, talent = false, charges = 1, class = "WARRIOR", type = 2}, --Enraged Regeneration [5246] = {cooldown = 90, duration = 8, specs = {71, 72, 73}, talent = false, charges = 1, class = "WARRIOR", type = 8}, --Intimidating Shout [12975] = {cooldown = 180, duration = 15, specs = {73}, talent = false, charges = 1, class = "WARRIOR", type = 2}, --Last Stand - [97462] = {cooldown = 180, duration = 10, specs = {71, 72, 73}, talent = false, charges = 1, class = "WARRIOR", type = 4}, --Rallying Cry + [97462] = {cooldown = 180, duration = 10, specs = {71, 72, 73}, talent = false, charges = 1, class = "WARRIOR", type = 4, cdtype = "DR"}, --Rallying Cry [152277] = {cooldown = 60, duration = 6, specs = {71}, talent = false, charges = 1, class = "WARRIOR", type = 1}, --Ravager [228920] = {cooldown = 60, duration = 6, specs = {73}, talent = false, charges = 1, class = "WARRIOR", type = 1}, --Ravager [1719] = {cooldown = 90, duration = 10, specs = {72}, talent = false, charges = 1, class = "WARRIOR", type = 1}, --Recklessness @@ -419,9 +419,9 @@ do [198103] = {cooldown = 300, duration = 60, specs = {262, 263, 264}, talent = false, charges = 1, class = "SHAMAN", type = 2}, --Earth Elemental [51533] = {cooldown = 120, duration = 15, specs = {263}, talent = false, charges = 1, class = "SHAMAN", type = 1}, --Feral Spirit [198067] = {cooldown = 150, duration = 30, specs = {262}, talent = false, charges = 1, class = "SHAMAN", type = 1}, --Fire Elemental - [108280] = {cooldown = 180, duration = 10, specs = {264}, talent = false, charges = 1, class = "SHAMAN", type = 4}, --Healing Tide Totem + [108280] = {cooldown = 180, duration = 10, specs = {264}, talent = false, charges = 1, class = "SHAMAN", type = 4, cdtype = "HEAL"}, --Healing Tide Totem [16191] = {cooldown = 180, duration = 8, specs = {264}, talent = false, charges = 1, class = "SHAMAN", type = 5}, --Mana Tide Totem - [98008] = {cooldown = 180, duration = 6, specs = {264}, talent = false, charges = 1, class = "SHAMAN", type = 4}, --Spirit Link Totem + [98008] = {cooldown = 180, duration = 6, specs = {264}, talent = false, charges = 1, class = "SHAMAN", type = 4, cdtype = "DR"}, --Spirit Link Totem [192249] = {cooldown = 150, duration = 30, specs = {262}, talent = false, charges = 1, class = "SHAMAN", type = 1}, --Storm Elemental [8143] = {cooldown = 60, duration = 10, specs = {262, 263, 264}, talent = false, charges = 1, class = "SHAMAN", type = 5}, --Tremor Totem [192077] = {cooldown = 120, duration = 15, specs = {262, 263, 264}, talent = false, charges = 1, class = "SHAMAN", type = 5}, --Wind Rush Totem @@ -455,9 +455,9 @@ do [322118] = {cooldown = 180, duration = 25, specs = {270}, talent = false, charges = 1, class = "MONK", type = 4}, --Invoke Yu'lon, the Jade Serpent [325197] = {cooldown = 180, duration = 25, specs = {270}, talent = false, charges = 1, class = "MONK", type = 4}, --Invoke Chi-Ji, the Red Crane [119381] = {cooldown = 50, duration = 3, specs = {268, 269, 270}, talent = false, charges = 1, class = "MONK", type = 8}, --Leg Sweep - [116849] = {cooldown = 120, duration = 12, specs = {270}, talent = false, charges = 1, class = "MONK", type = 3}, --Life Cocoon + [116849] = {cooldown = 120, duration = 12, specs = {270}, talent = false, charges = 1, class = "MONK", type = 3, cdtype = "TARGET"}, --Life Cocoon [197908] = {cooldown = 90, duration = 10, specs = {270}, talent = false, charges = 1, class = "MONK", type = 5}, --Mana Tea - [115310] = {cooldown = 180, duration = 0, specs = {270}, talent = false, charges = 1, class = "MONK", type = 4}, --Revival + [115310] = {cooldown = 180, duration = 0, specs = {270}, talent = false, charges = 1, class = "MONK", type = 4, cdtype = "HEAL"}, --Revival [388615] = {cooldown = 180, duration = 0, specs = {270}, talent = false, charges = 1, class = "MONK", type = 4}, --Restoral [116844] = {cooldown = 45, duration = 5, specs = {268, 269, 270}, talent = false, charges = 1, class = "MONK", type = 8}, --Ring of Peace [152173] = {cooldown = 90, duration = 12, specs = {269}, talent = false, charges = 1, class = "MONK", type = 1}, --Serenity @@ -529,16 +529,16 @@ do [102558] = {cooldown = 180, duration = 30, specs = {104}, talent = false, charges = 1, class = "DRUID", type = 2}, --Incarnation: Guardian of Ursoc [33891] = {cooldown = 180, duration = 30, specs = {105}, talent = false, charges = 1, class = "DRUID", type = 4}, --Incarnation: Tree of Life [29166] = {cooldown = 180, duration = 12, specs = {102, 105}, talent = false, charges = 1, class = "DRUID", type = 5}, --Innervate - [102342] = {cooldown = 60, duration = 12, specs = {105}, talent = false, charges = 1, class = "DRUID", type = 3}, --Ironbark + [102342] = {cooldown = 60, duration = 12, specs = {105}, talent = false, charges = 1, class = "DRUID", type = 3, cdtype = "TARGET"}, --Ironbark [203651] = {cooldown = 60, duration = 0, specs = {105}, talent = false, charges = 1, class = "DRUID", type = 3}, --Overgrowth [20484] = {cooldown = 600, duration = 0, specs = {102, 103, 104, 105}, talent = false, charges = 1, class = "DRUID", type = 5}, --Rebirth [108238] = {cooldown = 90, duration = 0, specs = {102, 103, 104, 105}, talent = false, charges = 1, class = "DRUID", type = 2}, --Renewal [61336] = {cooldown = 120, duration = 6, specs = {103, 104}, talent = false, charges = 1, class = "DRUID", type = 2}, --Survival Instincts - [740] = {cooldown = 180, duration = 8, specs = {105}, talent = false, charges = 1, class = "DRUID", type = 4}, --Tranquility + [740] = {cooldown = 180, duration = 8, specs = {105}, talent = false, charges = 1, class = "DRUID", type = 4, cdtype = "HEAL"}, --Tranquility [132469] = {cooldown = 30, duration = 0, specs = {102, 103, 104, 105}, talent = false, charges = 1, class = "DRUID", type = 8}, --Typhoon [102793] = {cooldown = 60, duration = 10, specs = {102, 103, 104, 105}, talent = false, charges = 1, class = "DRUID", type = 8}, --Ursol's Vortex [124974] = {cooldown = 90, duration = 0, specs = {102, 103, 104, 105}, talent = false, charges = 1, class = "DRUID", type = 4}, --Nature's Vigil - [77761] = {cooldown = 120, duration = 8, specs = {102, 103, 104, 105}, talent = false, charges = 1, class = "DRUID", type = 5}, --Stampeding Roar + [77761] = {cooldown = 120, duration = 8, specs = {102, 103, 104, 105}, talent = false, charges = 1, class = "DRUID", type = 5, cdtype = "SPEED"}, --Stampeding Roar --[106898] = {cooldown = 120, duration = 8, specs = {102, 103, 104, 105}, talent = false, charges = 1, class = "DRUID", type = 5}, --Stampeding Roar --[77764] = {cooldown = 120, duration = 8, specs = {102, 103, 104, 105}, talent = false, charges = 1, class = "DRUID", type = 5}, --Stampeding Roar [5211] = {cooldown = 60, duration = 0, specs = {}, talent = false, charges = 1, class = "DRUID", type = 8}, --Mighty Bash @@ -555,7 +555,7 @@ do -- 252 - Blood [383269] = {cooldown = 120, duration = 12, specs = {250, 251, 252}, talent = false, charges = 1, class = "DEATHKNIGHT", type = 1}, --Abomination Limb [48707] = {cooldown = 60, duration = 10, specs = {250, 251, 252}, talent = false, charges = 1, class = "DEATHKNIGHT", type = 2}, --Anti-Magic Shell - [51052] = {cooldown = 120, duration = 10, specs = {250, 251, 252}, talent = false, charges = 1, class = "DEATHKNIGHT", type = 4}, --Anti-Magic Zone + [51052] = {cooldown = 120, duration = 10, specs = {250, 251, 252}, talent = false, charges = 1, class = "DEATHKNIGHT", type = 4, cdtype = "DR"}, --Anti-Magic Zone [275699] = {cooldown = 90, duration = 15, specs = {252}, talent = false, charges = 1, class = "DEATHKNIGHT", type = 1}, --Apocalypse [42650] = {cooldown = 480, duration = 30, specs = {252}, talent = false, charges = 1, class = "DEATHKNIGHT", type = 1}, --Army of the Dead [221562] = {cooldown = 45, duration = 5, specs = {250}, talent = false, charges = 1, class = "DEATHKNIGHT", type = 8}, --Asphyxiate @@ -587,7 +587,7 @@ do [198589] = {cooldown = 60, duration = 10, specs = {577}, talent = false, charges = 1, class = "DEMONHUNTER", type = 2}, --Blur [320341] = {cooldown = 90, duration = 0, specs = {581}, talent = false, charges = 1, class = "DEMONHUNTER", type = 2}, --Bulk Extraction [179057] = {cooldown = 60, duration = 2, specs = {577}, talent = false, charges = 1, class = "DEMONHUNTER", type = 8}, --Chaos Nova - [196718] = {cooldown = 180, duration = 8, specs = {577}, talent = false, charges = 1, class = "DEMONHUNTER", type = 4}, --Darkness + [196718] = {cooldown = 180, duration = 8, specs = {577}, talent = false, charges = 1, class = "DEMONHUNTER", type = 4, cdtype = "DR"}, --Darkness [211881] = {cooldown = 30, duration = 4, specs = {577}, talent = false, charges = 1, class = "DEMONHUNTER", type = 5}, --Fel Eruption [204021] = {cooldown = 60, duration = 10, specs = {581}, talent = false, charges = 1, class = "DEMONHUNTER", type = 2}, --Fiery Brand [217832] = {cooldown = 45, duration = 0, specs = {577, 581}, talent = false, charges = 1, class = "DEMONHUNTER", type = 8}, --Imprison @@ -631,7 +631,7 @@ do [475] = {cooldown = 8, duration = 0, specs = {63, 64, 62}, talent = false, charges = 1, class = "MAGE", type = 7}, --Remove Curse [122] = {cooldown = 30, duration = 6, specs = {63, 64, 62}, talent = false, charges = 1, class = "MAGE", type = 8}, --Frost Nova [157980] = {cooldown = 25, duration = 0, specs = {62}, talent = false, charges = 1, class = "MAGE", type = 8}, --Supernova - [414660] = {cooldown = 120, duration = 60, specs = {63, 64, 62}, talent = false, charges = 1, class = "MAGE", type = 4}, --Mass Barrier + [414660] = {cooldown = 120, duration = 60, specs = {63, 64, 62}, talent = false, charges = 1, class = "MAGE", type = 4, cdtype = "DR"}, --Mass Barrier [414664] = {cooldown = 300, duration = 12, specs = {63, 64, 62}, talent = false, charges = 1, class = "MAGE", type = 5}, --Mass Invisibility (only out of combat) -- This needs more work to actually function @@ -644,9 +644,9 @@ do [200183] = {cooldown = 120, duration = 20, specs = {257}, talent = false, charges = 1, class = "PRIEST", type = 2}, --Apotheosis [19236] = {cooldown = 90, duration = 10, specs = {256, 257, 258}, talent = false, charges = 1, class = "PRIEST", type = 2}, --Desperate Prayer [47585] = {cooldown = 120, duration = 6, specs = {258}, talent = false, charges = 1, class = "PRIEST", type = 2}, --Dispersion - [64843] = {cooldown = 180, duration = 8, specs = {257}, talent = false, charges = 1, class = "PRIEST", type = 4}, --Divine Hymn + [64843] = {cooldown = 180, duration = 8, specs = {257}, talent = false, charges = 1, class = "PRIEST", type = 4, cdtype = "HEAL"}, --Divine Hymn [246287] = {cooldown = 90, duration = 0, specs = {256}, talent = false, charges = 1, class = "PRIEST", type = 4}, --Evangelism - [47788] = {cooldown = 180, duration = 10, specs = {257}, talent = false, charges = 1, class = "PRIEST", type = 3}, --Guardian Spirit + [47788] = {cooldown = 180, duration = 10, specs = {257}, talent = false, charges = 1, class = "PRIEST", type = 3, cdtype = "TARGET"}, --Guardian Spirit [265202] = {cooldown = 720, duration = 0, specs = {257}, talent = false, charges = 1, class = "PRIEST", type = 4}, --Holy Word: Salvation [372835] = {cooldown = 180, duration = 0, specs = {257}, talent = false, charges = 1, class = "PRIEST", type = 4}, --Lightwell [73325] = {cooldown = 90, duration = 0, specs = {256, 257, 258}, talent = false, charges = 1, class = "PRIEST", type = 5}, --Leap of Faith @@ -654,9 +654,9 @@ do --[205369] = {cooldown = 30, duration = 6, specs = {258}, talent = false, charges = 1, class = "PRIEST", type = 5}, --Mind Bomb [200174] = {cooldown = 60, duration = 15, specs = {258}, talent = false, charges = 1, class = "PRIEST", type = 1}, --Mindbender spec 258 [123040] = {cooldown = 60, duration = 12, specs = {256}, talent = false, charges = 1, class = "PRIEST", type = 1}, --Mindbender spec 256 - [33206] = {cooldown = 180, duration = 8, specs = {256}, talent = false, charges = 1, class = "PRIEST", type = 3}, --Pain Suppression + [33206] = {cooldown = 180, duration = 8, specs = {256}, talent = false, charges = 1, class = "PRIEST", type = 3, cdtype = "TARGET"}, --Pain Suppression [10060] = {cooldown = 120, duration = 20, specs = {256, 257, 258}, talent = false, charges = 1, class = "PRIEST", type = 1}, --Power Infusion - [62618] = {cooldown = 180, duration = 10, specs = {256}, talent = false, charges = 1, class = "PRIEST", type = 4}, --Power Word: Barrier + [62618] = {cooldown = 180, duration = 10, specs = {256}, talent = false, charges = 1, class = "PRIEST", type = 4, cdtype = "DR"}, --Power Word: Barrier [64044] = {cooldown = 45, duration = 4, specs = {258}, talent = false, charges = 1, class = "PRIEST", type = 8}, --Psychic Horror [8122] = {cooldown = 60, duration = 8, specs = {256, 257, 258}, talent = false, charges = 1, class = "PRIEST", type = 8}, --Psychic Scream [47536] = {cooldown = 90, duration = 10, specs = {256}, talent = false, charges = 1, class = "PRIEST", type = 5}, --Rapture @@ -707,7 +707,7 @@ do [360823] = {cooldown = 8, duration = 0, specs = {1468}, talent = false, charges = 1, class = "EVOKER", type = 7}, --Naturalize [357210] = {cooldown = 120, duration = 0, specs = {1467, 1468}, talent = false, charges = 1, class = "EVOKER", type = 1}, --Deep Breath [375087] = {cooldown = 120, duration = 0, specs = {1467}, talent = false, charges = 1, class = "EVOKER", type = 1}, --Dragonrage - [359816] = {cooldown = 120, duration = 15, specs = {1468}, talent = false, charges = 1, class = "EVOKER", type = 4}, --Dream Flight + [359816] = {cooldown = 120, duration = 15, specs = {1468}, talent = false, charges = 1, class = "EVOKER", type = 4, cdtype = "HEAL"}, --Dream Flight [370960] = {cooldown = 180, duration = 4.4, specs = {1468}, talent = false, charges = 1, class = "EVOKER", type = 2}, --Emerald Communion [358385] = {cooldown = 90, duration = 0, specs = {1467, 1468}, talent = false, charges = 1, class = "EVOKER", type = 8}, --Landslide @@ -716,11 +716,11 @@ do [374348] = {cooldown = 90, duration = 8, specs = {1467, 1468}, talent = false, charges = 1, class = "EVOKER", type = 2}, --Renewing Blaze [370665] = {cooldown = 60, duration = 0, specs = {1467, 1468}, talent = false, charges = 1, class = "EVOKER", type = 5}, --Rescue - [363534] = {cooldown = 240, duration = 5, specs = {1468}, talent = false, charges = 1, class = "EVOKER", type = 4}, --Rewind + [363534] = {cooldown = 240, duration = 5, specs = {1468}, talent = false, charges = 1, class = "EVOKER", type = 4, cdtype = "HEAL"}, --Rewind [370537] = {cooldown = 90, duration = 30, specs = {1468}, talent = false, charges = 1, class = "EVOKER", type = 4}, --Stasis [357170] = {cooldown = 60, duration = 8, specs = {1468}, talent = false, charges = 1, class = "EVOKER", type = 3}, --Time Dilation [374968] = {cooldown = 120, duration = 10, specs = {1467, 1468}, talent = false, charges = 1, class = "EVOKER", type = 5}, --Time Spiral - [374227] = {cooldown = 120, duration = 8, specs = {1467, 1468}, talent = false, charges = 1, class = "EVOKER", type = 4}, --Zephyr + [374227] = {cooldown = 120, duration = 8, specs = {1467, 1468}, talent = false, charges = 1, class = "EVOKER", type = 4, cdtype = "DR"}, --Zephyr [360806] = {cooldown = 15, duration = 20, specs = {1467, 1468}, talent = false, charges = 1, class = "EVOKER", type = 8}, --Sleep Walk [360827] = {cooldown = 30, duration = 0, specs = {1473}, talent = false, charges = 1, class = "EVOKER", type = 3}, --Blistering Scales diff --git a/Libs/LibOpenRaid/classes.lua b/Libs/LibOpenRaid/classes.lua new file mode 100644 index 000000000..abb4eb6a5 --- /dev/null +++ b/Libs/LibOpenRaid/classes.lua @@ -0,0 +1,70 @@ + +---@alias openraid_unitname string the name of the unit including realm name if the unit isn't from the same realm, e.g. "Unitname-Realmname" +---@alias openraid_spellid number the id of a spell + +---@alias openraid_cooldownfilter +---| "defensive-raid" +---| "defensive-target" +---| "defensive-personal" +---| "ofensive" +---| "utility" +---| "interrupt" +---| "itemutil" +---| "itemheal" +---| "itempower" +---| "crowdcontrol" + +---@class openraid : table +---@field RequestAllData fun() send a request to all players in the group to send their data +---@field GetUnitInfo fun(unitId: string) : openraid_unitinfo return a table containing information of a single unit +---@field GetAllUnitsInfo fun() : table return a table containing all information of units +---@field GetUnitGear fun(unitId: string) : openraid_unitgear return a table containing gear information of a single unit +---@field GetAllUnitsGear fun() : table return a table containing all gear information of units +---@field GetUnitCooldowns fun(unitId: string, filter:string?) : table return a table containing cooldown information of a single unit +---@field GetAllUnitsCooldown fun() : table> return a table containing all cooldown information of units +---@field DoesSpellPassFilters fun(spellId: openraid_spellid, filter: openraid_cooldownfilter) : boolean check if a spell passes the filter + +---@class openraid_cooldowninfo : table +---@field [1] number timeLeft +---@field [2] number charges +---@field [3] number startOffset +---@field [4] number duration +---@field [5] number updateTime, when the cooldown received an update from the unit +---@field [6] number auraDuration + +---@class openraid_unitinfo : table +---@field specId number +---@field specName string +---@field role string +---@field renown number +---@field covenantId number +---@field talents table +---@field conduits table +---@field pvpTalents table +---@field class string +---@field classId number +---@field className string +---@field name string +---@field nameFull string + +---@class openraid_unitgear : table +---@field itemLevel number +---@field durability number overall percentage durability of the gear +---@field weaponEnchant number +---@field noGems table +---@field noEnchants table +---@field mainHandEnchantId number +---@field offHandEnchantId number +---@field equippedGear openraid_iteminfo[] + +---@class openraid_iteminfo : table +---@field slotId number +---@field gemSlots number +---@field itemLevel number +---@field itemLink string +---@field itemQuality number +---@field itemId number +---@field itemName string +---@field isTier boolean +---@field enchantId number +---@field gemId number diff --git a/boot.lua b/boot.lua index 0e6362ab9..bf14da92e 100644 --- a/boot.lua +++ b/boot.lua @@ -237,6 +237,7 @@ ["RaidHeroic"] = 15, ["RaidMythic"] = 16, } + Details222.DHook = hooksecurefunc local emptyFunction = function()end local emptyTable = {} @@ -2169,6 +2170,10 @@ function Details:DestroyActor(actorObject, actorContainer, combatObject, callSta Details222.TimeMachine.RemoveActor(actorObject) + if (not actorObject.Name) then + print("error: actorObject.Name is nil", actorObject.tipo, actorObject.serial, actorObject.nome) + end + local actorName = actorObject:Name() combatObject:RemoveActorFromSpellCastTable(actorName) diff --git a/classes/class_damage.lua b/classes/class_damage.lua index fe0bebc1e..a4481123d 100644 --- a/classes/class_damage.lua +++ b/classes/class_damage.lua @@ -8,7 +8,7 @@ --damage object local Details = _G.Details - local Loc = LibStub("AceLocale-3.0"):GetLocale ( "Details" ) + local Loc = LibStub("AceLocale-3.0"):GetLocale( "Details" ) local Translit = LibStub("LibTranslit-1.0") local gump = Details.gump local _ = nil @@ -19,15 +19,11 @@ --local pointers local format = string.format --lua local - local _math_floor = math.floor --lua local - local _table_sort = table.sort --lua local local tinsert = table.insert --lua local local setmetatable = setmetatable --lua local local _getmetatable = getmetatable --lua local local ipairs = ipairs --lua local local pairs = pairs --lua local - local _math_min = math.min --lua local - local _math_max = math.max --lua local local abs = math.abs --lua local local bitBand = bit.band --lua local local unpack = unpack --lua local @@ -37,6 +33,9 @@ local IsInGroup = IsInGroup --api local local GetSpellLink = GetSpellLink or C_Spell.GetSpellLink --api local + local CONST_MELEE_SPELLID = 6603 + local CONST_AUTOSHOT_SPELLID = 75 + local GetSpellInfo = Details222.GetSpellInfo --api local local _GetSpellInfo = Details.getspellinfo --details api local stringReplace = Details.string.replace --details api @@ -54,37 +53,35 @@ local atributo_misc = Details.atributo_misc local container_damage = Details.container_type.CONTAINER_DAMAGE_CLASS - local modo_GROUP = Details.modos.group local modo_ALL = Details.modos.all - local class_type = Details.atributos.dano + local ignoredEnemyNpcsTable = Details.IgnoredEnemyNpcsTable local ToKFunctions = Details.ToKFunctions - local SelectedToKFunction = ToKFunctions[1] - - local UsingCustomLeftText = false - local UsingCustomRightText = false - - local FormatTooltipNumber = ToKFunctions[8] - local TooltipMaximizedMethod = 1 - - --local CLASS_ICON_TCOORDS = _G.CLASS_ICON_TCOORDS - local is_player_class = Details.player_class + local selectedToKFunction = ToKFunctions[1] + local formatTooltipNumber = ToKFunctions[8] + local bUsingCustomLeftText = false + local bUsingCustomRightText = false + local tooltipMaximizedMethod = 1 + --templates + local byspell_tooltip_background = {value = 100, color = {0.1960, 0.1960, 0.1960, 0.9097}, texture = [[Interface\AddOns\Details\images\bar_background_dark]]} + local enemies_background = {value = 100, color = {0.1960, 0.1960, 0.1960, 0.8697}, texture = "Interface\\AddOns\\Details\\images\\bar_background2"} Details.tooltip_key_overlay1 = {1, 1, 1, .2} Details.tooltip_key_overlay2 = {1, 1, 1, .5} + local headerColor = {1, 0.9, 0.0, 1} + local spectator = "Commentator" + Details._spectator = spectator + local is_player_class = Details.player_class + local numbertostring = string.char + local koKRStart = numbertostring(234) Details.tooltip_key_size_width = 24 Details.tooltip_key_size_height = 10 - local enemies_background = {value = 100, color = {0.1960, 0.1960, 0.1960, 0.8697}, texture = "Interface\\AddOns\\Details\\images\\bar_background2"} - - local headerColor = {1, 0.9, 0.0, 1} - local breakdownWindowFrame = Details.BreakdownWindowFrame - local keyName - local OBJECT_TYPE_PLAYER = 0x00000400 + local keyName local ntable = {} --temp local vtable = {} --temp @@ -93,13 +90,8 @@ local bs_index_table = {} --temp local bs_tooltip_table local frags_tooltip_table - local tooltip_temp_table = {} - local OBJECT_TYPE_FRIENDLY_NPC = 0x00000A18 - - local ignoredEnemyNpcsTable = Details.IgnoredEnemyNpcsTable - --damage mixin local damageClassMixin = {} @@ -140,17 +132,17 @@ end function Details.SortGroup(container, keyName2) --[[exported]] keyName = keyName2 - return _table_sort(container, Details.SortKeyGroup) + return table.sort(container, Details.SortKeyGroup) end -function Details.SortKeyGroup (table1, table2) --[[exported]] +function Details.SortKeyGroup(table1, table2) --[[exported]] if (table1.grupo and table2.grupo) then return table1[keyName] > table2[keyName] - elseif (table1.grupo and not table2.grupo) then + elseif(table1.grupo and not table2.grupo) then return true - elseif (not table1.grupo and table2.grupo) then + elseif(not table1.grupo and table2.grupo) then return false else @@ -168,13 +160,13 @@ end ---@param actor2 actor ---@return boolean function Details.SortByRealTimeDps(actor1, actor2) - return (actor1.last_dps_realtime or 0) > (actor2.last_dps_realtime or 0) + return(actor1.last_dps_realtime or 0) >(actor2.last_dps_realtime or 0) end -function Details:ContainerSort (container, amount, keyName2) --[[exported]] +function Details:ContainerSort(container, amount, keyName2) --[[exported]] keyName = keyName2 - _table_sort(container, Details.SortKeySimple) + table.sort(container, Details.SortKeySimple) if (amount) then for i = amount, 1, -1 do --de tr�s pra frente @@ -227,13 +219,13 @@ function Details:GetTimeInCombat(petOwner) --[[exported]] if (petOwner) then if (Details.time_type == 1 or not petOwner.grupo) then return self:Tempo() - elseif (Details.time_type == 2 or Details.use_realtimedps) then + elseif(Details.time_type == 2 or Details.use_realtimedps) then return self:GetCombatTime() end else if (Details.time_type == 1) then return self:Tempo() - elseif (Details.time_type == 2 or Details.use_realtimedps) then + elseif(Details.time_type == 2 or Details.use_realtimedps) then return self:GetCombatTime() end end @@ -252,35 +244,35 @@ local sortEnemies = function(t1, t2) if (not ignoredEnemyNpcsTable[npcid1] and not ignoredEnemyNpcsTable[npcid2]) then return t1.damage_taken > t2.damage_taken - elseif (ignoredEnemyNpcsTable[npcid1] and not ignoredEnemyNpcsTable[npcid2]) then + elseif(ignoredEnemyNpcsTable[npcid1] and not ignoredEnemyNpcsTable[npcid2]) then return false - elseif (not ignoredEnemyNpcsTable[npcid1] and ignoredEnemyNpcsTable[npcid2]) then + elseif(not ignoredEnemyNpcsTable[npcid1] and ignoredEnemyNpcsTable[npcid2]) then return true else return t1.damage_taken > t2.damage_taken end - elseif (a ~= 0 and b == 0) then + elseif(a ~= 0 and b == 0) then return true - elseif (a == 0 and b ~= 0) then + elseif(a == 0 and b ~= 0) then return false end return false end -function Details:ContainerSortEnemies (container, amount, keyName2) --[[exported]] +function Details:ContainerSortEnemies(container, amount, keyName2) --[[exported]] keyName = keyName2 - _table_sort(container, sortEnemies) + table.sort(container, sortEnemies) local total = 0 for index, player in ipairs(container) do local npcid1 = Details:GetNpcIdFromGuid(player.serial) - --p rint (player.nome, npcid1, ignored_enemy_npcs [npcid1]) + --p rint(player.nome, npcid1, ignored_enemy_npcs [npcid1]) if (bitBand(player.flag_original, 0x00000060) ~= 0 and not ignoredEnemyNpcsTable [npcid1]) then --� um inimigo total = total + player [keyName] else @@ -292,7 +284,7 @@ function Details:ContainerSortEnemies (container, amount, keyName2) --[[exported return amount, total end -function Details:TooltipForCustom (barra) --[[exported]] +function Details:TooltipForCustom(barra) --[[exported]] GameCooltip:AddLine(Loc ["STRING_LEFT_CLICK_SHARE"]) return true end @@ -337,7 +329,7 @@ function Details:GetTextColor(instanceObject, textSide) local bUseClassColor = false if (textSide == "left") then bUseClassColor = instanceObject.row_info.textL_class_colors - elseif (textSide == "right") then + elseif(textSide == "right") then bUseClassColor = instanceObject.row_info.textR_class_colors end @@ -359,16 +351,16 @@ function Details:GetBarColor(actor) --[[exported]] if (actor.monster) then return unpack(Details.class_colors.ENEMY) - elseif (actor.customColor) then + elseif(actor.customColor) then return unpack(actor.customColor) - elseif (actor.spellicon) then + elseif(actor.spellicon) then return 0.729, 0.917, 1 - elseif (actor.owner) then + elseif(actor.owner) then return unpack(Details.class_colors[actor.owner.classe or "UNKNOW"]) - elseif (actor.arena_team and Details.color_by_arena_team) then + elseif(actor.arena_team and Details.color_by_arena_team) then if (actor.arena_team == 0) then return unpack(Details.class_colors.ARENA_GREEN) else @@ -379,7 +371,7 @@ function Details:GetBarColor(actor) --[[exported]] if (not is_player_class[actor.classe] and actor.flag_original and bitBand(actor.flag_original, 0x00000020) ~= 0) then --neutral return unpack(Details.class_colors.NEUTRAL) - elseif (actor.color) then + elseif(actor.color) then return unpack(actor.color) else @@ -394,12 +386,12 @@ function Details:GetSpellLink(spellid) --[[exported]] end if (spellid == 1) then --melee - return GetSpellLink(6603) + return GetSpellLink(CONST_MELEE_SPELLID) - elseif (spellid == 2) then --autoshot - return GetSpellLink(75) + elseif(spellid == 2) then --autoshot + return GetSpellLink(CONST_AUTOSHOT_SPELLID) - elseif (spellid > 10) then + elseif(spellid > 10) then return GetSpellLink(spellid) else local spellname = _GetSpellInfo(spellid) @@ -409,12 +401,12 @@ end function Details:GameTooltipSetSpellByID(spellId) --[[exported]] if (spellId == 1) then - GameTooltip:SetSpellByID(6603) + GameTooltip:SetSpellByID(CONST_MELEE_SPELLID) - elseif (spellId == 2) then - GameTooltip:SetSpellByID(75) + elseif(spellId == 2) then + GameTooltip:SetSpellByID(CONST_AUTOSHOT_SPELLID) - elseif (spellId > 10) then + elseif(spellId > 10) then GameTooltip:SetSpellByID(spellId) else @@ -479,7 +471,7 @@ end --friendlyfire: table where key is a player name and value is a table with .total: damage inflicted and .spells a table with spell names as keys and damage done as value friendlyfire = {}, - --targets: table where key is the target name (actor name) and the value is the amount of damage done to that target + --targets: table where key is the target name(actor name) and the value is the amount of damage done to that target targets = {}, --spells: spell container spells = spellContainerClass:NovoContainer(container_damage) @@ -517,7 +509,7 @@ end return totalRealTime end - --dps (calculate dps for actors) + --dps(calculate dps for actors) ---@param tableWithActors table ---@param combatTime combattime ---@return number, number @@ -569,9 +561,7 @@ end ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --damage taken by spell - local byspell_tooltip_background = {value = 100, color = {0.1960, 0.1960, 0.1960, 0.9097}, texture = [[Interface\AddOns\Details\images\bar_background_dark]]} - - function Details:ToolTipBySpell (instance, tabela, thisLine, keydown) + function Details:ToolTipBySpell(instance, tabela, thisLine, keydown) local GameCooltip = GameCooltip local combat = instance.showing @@ -582,7 +572,7 @@ end end --get a list of all damage actors - local AllDamageCharacters = combat:GetActorList (DETAILS_ATTRIBUTE_DAMAGE) + local AllDamageCharacters = combat:GetActorList(DETAILS_ATTRIBUTE_DAMAGE) --hold the targets local Targets = {} @@ -601,10 +591,10 @@ end if (is_custom_spell) then for playername, ff_table in pairs(character.friendlyfire) do if (ff_table.spells [from_spell]) then - local damage_actor = combat (1, playername) - local heal_actor = combat (2, playername) + local damage_actor = combat(1, playername) + local heal_actor = combat(2, playername) - if ((damage_actor or heal_actor) and ( (damage_actor and damage_actor:IsPlayer()) or (heal_actor and heal_actor:IsPlayer()))) then + if ((damage_actor or heal_actor) and((damage_actor and damage_actor:IsPlayer()) or(heal_actor and heal_actor:IsPlayer()))) then local got @@ -635,9 +625,9 @@ end for spellid, amount in pairs(ff_table.spells) do local spellname = select(1, GetSpellInfo(spellid)) if (spellname == from_spellname) then - local damage_actor = combat (1, playername) - local heal_actor = combat (2, playername) - if ((damage_actor or heal_actor) and ( (damage_actor and damage_actor:IsPlayer()) or (heal_actor and heal_actor:IsPlayer()))) then + local damage_actor = combat(1, playername) + local heal_actor = combat(2, playername) + if ((damage_actor or heal_actor) and((damage_actor and damage_actor:IsPlayer()) or(heal_actor and heal_actor:IsPlayer()))) then local got for index, t in ipairs(Targets) do if (t[1] == playername) then @@ -671,10 +661,10 @@ end for targetname, amount in pairs(spell.targets) do local got = false - local damage_actor = combat (1, targetname) - local heal_actor = combat (2, targetname) + local damage_actor = combat(1, targetname) + local heal_actor = combat(2, targetname) - if ( (damage_actor or heal_actor) and ( (damage_actor and damage_actor:IsPlayer()) or (heal_actor and heal_actor:IsPlayer()) ) ) then + if ((damage_actor or heal_actor) and((damage_actor and damage_actor:IsPlayer()) or(heal_actor and heal_actor:IsPlayer()) ) ) then for index, t in ipairs(Targets) do if (t[1] == targetname) then t[2] = t[2] + amount @@ -706,10 +696,10 @@ end for targetname, amount in pairs(spell.targets) do local got = false - local damage_actor = combat (1, targetname) - local heal_actor = combat (2, targetname) + local damage_actor = combat(1, targetname) + local heal_actor = combat(2, targetname) - if ( (damage_actor or heal_actor) and ( (damage_actor and damage_actor:IsPlayer()) or (heal_actor and heal_actor:IsPlayer()) ) ) then + if ((damage_actor or heal_actor) and((damage_actor and damage_actor:IsPlayer()) or(heal_actor and heal_actor:IsPlayer()) ) ) then for index, t in ipairs(Targets) do if (t[1] == targetname) then t[2] = t[2] + amount @@ -737,7 +727,7 @@ end end end - table.sort (Targets, Details.Sort2) + table.sort(Targets, Details.Sort2) bs_tooltip_table = Targets bs_tooltip_table.damage_total = total @@ -746,9 +736,9 @@ end local spellname, _, spellicon = select(1, _GetSpellInfo(from_spell)) --GameCooltip:AddLine(spellname .. " " .. Loc ["STRING_CUSTOM_ATTRIBUTE_DAMAGE"], nil, nil, headerColor, nil, 10) - --GameCooltip:AddIcon (spellicon, 1, 1, 14, 14, 0.078125, 0.921875, 0.078125, 0.921875) - --GameCooltip:AddIcon ([[Interface\AddOns\Details\images\key_shift]], 1, 2, Details.tooltip_key_size_width, Details.tooltip_key_size_height, 0, 1, 0, 0.640625, Details.tooltip_key_overlay2) - --Details:AddTooltipHeaderStatusbar (1, 1, 1, 0.5) + --GameCooltip:AddIcon(spellicon, 1, 1, 14, 14, 0.078125, 0.921875, 0.078125, 0.921875) + --GameCooltip:AddIcon([[Interface\AddOns\Details\images\key_shift]], 1, 2, Details.tooltip_key_size_width, Details.tooltip_key_size_height, 0, 1, 0, 0.640625, Details.tooltip_key_overlay2) + --Details:AddTooltipHeaderStatusbar(1, 1, 1, 0.5) local top = Targets[1] and Targets[1][2] @@ -759,23 +749,23 @@ end Details:AddRoundedCornerToTooltip() for index, t in ipairs(Targets) do - GameCooltip:AddLine(Details:GetOnlyName(t[1]), Details:ToK(t[2]) .. " (" .. format("%.1f", t[2]/total*100) .. "%)") + GameCooltip:AddLine(Details:GetOnlyName(t[1]), Details:ToK(t[2]) .. "(" .. format("%.1f", t[2]/total*100) .. "%)") local class, _, _, _, _, r, g, b = Details:GetClass(t[1]) - GameCooltip:AddStatusBar (t[2]/top*100, 1, r, g, b, 0.8, false, byspell_tooltip_background) + GameCooltip:AddStatusBar(t[2]/top*100, 1, r, g, b, 0.8, false, byspell_tooltip_background) if (class) then local specID = Details:GetSpec(t[1]) if (specID) then - local texture, l, r, t, b = Details:GetSpecIcon (specID, false) - GameCooltip:AddIcon (texture, 1, 1, iconSize, iconSize, l, r, t, b) + local texture, l, r, t, b = Details:GetSpecIcon(specID, false) + GameCooltip:AddIcon(texture, 1, 1, iconSize, iconSize, l, r, t, b) else local texture, l, r, t, b = Details:GetClassIcon(class) - GameCooltip:AddIcon ("Interface\\AddOns\\Details\\images\\classes_small_alpha", 1, 1,iconSize,iconSize, l, r, t, b) + GameCooltip:AddIcon("Interface\\AddOns\\Details\\images\\classes_small_alpha", 1, 1,iconSize,iconSize, l, r, t, b) end - elseif (t[1] == Loc ["STRING_TARGETS_OTHER1"]) then - GameCooltip:AddIcon ("Interface\\AddOns\\Details\\images\\classes_small_alpha", 1, 1,iconSize,iconSize, 0.25, 0.49609375, 0.75, 1) + elseif(t[1] == Loc ["STRING_TARGETS_OTHER1"]) then + GameCooltip:AddIcon("Interface\\AddOns\\Details\\images\\classes_small_alpha", 1, 1,iconSize,iconSize, 0.25, 0.49609375, 0.75, 1) end end @@ -786,8 +776,8 @@ end GameCooltip:Show() end - local function RefreshBarraBySpell (tabela, barra, instancia) - damageClass:AtualizarBySpell (tabela, tabela.minha_barra, barra.colocacao, instancia) + local function RefreshBarraBySpell(tabela, barra, instancia) + damageClass:AtualizarBySpell(tabela, tabela.minha_barra, barra.colocacao, instancia) end local on_switch_DTBS_show = function(instance) @@ -837,7 +827,7 @@ end ---@type actorheal local healingActor = healContainer:GetActor(playerName) - if ((damageActor and damageActor:IsPlayer()) or (healingActor and healingActor:IsPlayer())) then + if ((damageActor and damageActor:IsPlayer()) or(healingActor and healingActor:IsPlayer())) then local got for index, damageTakenTable in ipairs(damageTakenFrom) do @@ -873,7 +863,7 @@ end ---@type actorheal local healingActor = healContainer:GetActor(playerName) - if ((damageActor and damageActor:IsPlayer()) or (healingActor and healingActor:IsPlayer())) then + if ((damageActor and damageActor:IsPlayer()) or(healingActor and healingActor:IsPlayer())) then local got for index, damageTakenTable in ipairs(damageTakenFrom) do if (damageTakenTable[1] == playerName) then @@ -914,7 +904,7 @@ end ---@type actorheal local healingActor = healContainer:GetActor(targetName) - if ((damageActor and damageActor:IsPlayer()) or (healingActor and healingActor:IsPlayer())) then + if ((damageActor and damageActor:IsPlayer()) or(healingActor and healingActor:IsPlayer())) then for index, damageTakenTable in ipairs(damageTakenFrom) do if (damageTakenTable[1] == targetName) then damageTakenTable[2] = damageTakenTable[2] + damageAmount @@ -951,7 +941,7 @@ end ---@type actorheal local healingActor = healContainer:GetActor(targetName) - if ((damageActor and damageActor:IsPlayer()) or (healingActor and healingActor:IsPlayer())) then + if ((damageActor and damageActor:IsPlayer()) or(healingActor and healingActor:IsPlayer())) then for index, damageTakenTable in ipairs(damageTakenFrom) do if (damageTakenTable[1] == targetName) then damageTakenTable[2] = damageTakenTable[2] + damageAmount @@ -990,7 +980,7 @@ end return totalDamage, topDamage, amount ]] - local function ShowDTBSInWindow (spell, instance) --for hold shift key and click, show players which took damage from this spell + local function ShowDTBSInWindow(spell, instance) --for hold shift key and click, show players which took damage from this spell local spellname, _, icon = _GetSpellInfo(spell [1]) local custom_name = spellname .. " - " .. Loc ["STRING_CUSTOM_DTBS"] .. "" @@ -1033,14 +1023,14 @@ end end local DTBS_format_name = function(player_name) return Details:GetOnlyName(player_name) end - local DTBS_format_amount = function(amount) return Details:ToK(amount) .. " (" .. format("%.1f", amount / bs_tooltip_table.damage_total * 100) .. "%)" end + local DTBS_format_amount = function(amount) return Details:ToK(amount) .. "(" .. format("%.1f", amount / bs_tooltip_table.damage_total * 100) .. "%)" end - function damageClass:ReportSingleDTBSLine (spell, instance, ShiftKeyDown, ControlKeyDown) + function damageClass:ReportSingleDTBSLine(spell, instance, ShiftKeyDown, ControlKeyDown) if (ControlKeyDown) then local spellname, _, spellicon = _GetSpellInfo(spell[1]) - return Details:OpenAuraPanel (spell[1], spellname, spellicon) - elseif (ShiftKeyDown) then - return ShowDTBSInWindow (spell, instance) + return Details:OpenAuraPanel(spell[1], spellname, spellicon) + elseif(ShiftKeyDown) then + return ShowDTBSInWindow(spell, instance) end local spelllink = Details:GetSpellLink(spell [1]) @@ -1068,7 +1058,7 @@ end tabela.minha_barra = whichRowLine thisLine.colocacao = colocacao - if (not _getmetatable (tabela)) then + if (not _getmetatable(tabela)) then setmetatable(tabela, {__call = RefreshBarraBySpell}) tabela._custom = true end @@ -1079,7 +1069,7 @@ end if (instance.row_info.percent_type == 1) then porcentagem = format("%.1f", tabela [2] / total * 100) - elseif (instance.row_info.percent_type == 2) then + elseif(instance.row_info.percent_type == 2) then porcentagem = format("%.1f", tabela [2] / instance.top * 100) end @@ -1101,9 +1091,9 @@ end local bars_brackets = instance:GetBarBracket() if (instance.use_multi_fontstrings) then - instance:SetInLineTexts(thisLine, "", (spell_damage and SelectedToKFunction(_, spell_damage) or ""), porcentagem) + instance:SetInLineTexts(thisLine, "",(spell_damage and selectedToKFunction(_, spell_damage) or ""), porcentagem) else - thisLine.lineText4:SetText((spell_damage and SelectedToKFunction(_, spell_damage) or "") .. bars_brackets[1] .. porcentagem .. bars_brackets[2]) + thisLine.lineText4:SetText((spell_damage and selectedToKFunction(_, spell_damage) or "") .. bars_brackets[1] .. porcentagem .. bars_brackets[2]) end thisLine.lineText1:SetTextColor(1, 1, 1, 1) @@ -1136,7 +1126,7 @@ end thisLine.icone_classe:SetTexture(spellIcon) thisLine.icone_classe:SetTexCoord(0.078125, 0.921875, 0.078125, 0.921875) thisLine.icone_classe:SetVertexColor(1, 1, 1) - if(thisLine.mouse_over and not instance.baseframe.isMoving) then + if (thisLine.mouse_over and not instance.baseframe.isMoving) then local classIcon = thisLine:GetClassIcon() thisLine.iconHighlight:SetTexture(classIcon:GetTexture()) thisLine.iconHighlight:SetTexCoord(classIcon:GetTexCoord()) @@ -1148,7 +1138,7 @@ end ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --frags - function Details:ToolTipFrags (instancia, frag, thisLine, keydown) + function Details:ToolTipFrags(instancia, frag, thisLine, keydown) local name = frag [1] local GameCooltip = GameCooltip @@ -1179,7 +1169,7 @@ end end end - _table_sort(damage_taken_table, Details.Sort2) + table.sort(damage_taken_table, Details.Sort2) local iconSize = Details.DefaultTooltipIconSize GameCooltip:SetOption("AlignAsBlizzTooltip", false) @@ -1187,24 +1177,14 @@ end GameCooltip:SetOption("YSpacingMod", -6) Details:AddRoundedCornerToTooltip() - --Details:AddTooltipSpellHeaderText (Loc ["STRING_DAMAGE_FROM"], headerColor, #damage_taken_table, [[Interface\Addons\Details\images\icons]], 0.126953125, 0.1796875, 0, 0.0546875) - --Details:AddTooltipHeaderStatusbar (1, 1, 1, 0.5) - --GameCooltip:AddIcon ([[Interface\AddOns\Details\images\key_shift]], 1, 2, Details.tooltip_key_size_width, Details.tooltip_key_size_height, 0, 1, 0, 0.640625, Details.tooltip_key_overlay2) - local min = 6 local ismaximized = false --always maximized - if (true or keydown == "shift" or TooltipMaximizedMethod == 2 or TooltipMaximizedMethod == 3) then + if (true or keydown == "shift" or tooltipMaximizedMethod == 2 or tooltipMaximizedMethod == 3) then min = 99 ismaximized = true end - if (ismaximized) then - --GameCooltip:AddIcon ([[Interface\AddOns\Details\images\key_shift]], 1, 2, Details.tooltip_key_size_width, Details.tooltip_key_size_height, 0, 1, 0, 0.640625, Details.tooltip_key_overlay2) - else - --GameCooltip:AddIcon ([[Interface\AddOns\Details\images\key_shift]], 1, 2, Details.tooltip_key_size_width, Details.tooltip_key_size_height, 0, 1, 0, 0.640625, Details.tooltip_key_overlay1) - end - local top = damage_taken_table[1] and damage_taken_table[1][2] frags_tooltip_table = damage_taken_table frags_tooltip_table.damage_total = total @@ -1212,34 +1192,34 @@ end local lineHeight = Details.tooltip.line_height if (#damage_taken_table > 0) then - for i = 1, math.min (min, #damage_taken_table) do + for i = 1, math.min(min, #damage_taken_table) do local t = damage_taken_table [i] - GameCooltip:AddLine(Details:GetOnlyName(t[1]), FormatTooltipNumber (_, t[2]) .. " (" .. format("%.1f", t[2] / total * 100) .. "%)") + GameCooltip:AddLine(Details:GetOnlyName(t[1]), formatTooltipNumber(_, t[2]) .. "(" .. format("%.1f", t[2] / total * 100) .. "%)") local classe = t[3] if (not classe) then classe = "UNKNOW" end if (classe == "UNKNOW") then - GameCooltip:AddIcon ("Interface\\LFGFRAME\\LFGROLE_BW", nil, nil, iconSize, iconSize, .25, .5, 0, 1) + GameCooltip:AddIcon("Interface\\LFGFRAME\\LFGROLE_BW", nil, nil, iconSize, iconSize, .25, .5, 0, 1) else local specID = Details:GetSpec(t[1]) if (specID) then - local texture, l, r, t, b = Details:GetSpecIcon (specID, false) - GameCooltip:AddIcon (texture, 1, 1, iconSize, iconSize, l, r, t, b) + local texture, l, r, t, b = Details:GetSpecIcon(specID, false) + GameCooltip:AddIcon(texture, 1, 1, iconSize, iconSize, l, r, t, b) else - GameCooltip:AddIcon ([[Interface\AddOns\Details\images\classes_small_alpha]], nil, nil, iconSize, iconSize, unpack(Details.class_coords [classe])) + GameCooltip:AddIcon([[Interface\AddOns\Details\images\classes_small_alpha]], nil, nil, iconSize, iconSize, unpack(Details.class_coords [classe])) end end local _, _, _, _, _, r, g, b = Details:GetClass(t[1]) - GameCooltip:AddStatusBar (t[2] / top * 100, 1, r, g, b, 1, false, enemies_background) + GameCooltip:AddStatusBar(t[2] / top * 100, 1, r, g, b, 1, false, enemies_background) end else GameCooltip:AddLine(Loc ["STRING_NO_DATA"], nil, 1, "white") - GameCooltip:AddIcon (instancia.row_info.icon_file, nil, nil, 14, 14, unpack(Details.class_coords ["UNKNOW"])) + GameCooltip:AddIcon(instancia.row_info.icon_file, nil, nil, 14, 14, unpack(Details.class_coords ["UNKNOW"])) end GameCooltip:AddLine(" ") @@ -1250,7 +1230,7 @@ end end end - local function RefreshBarraFrags (tabela, barra, instancia) + local function RefreshBarraFrags(tabela, barra, instancia) damageClass:AtualizarFrags(tabela, tabela.minha_barra, barra.colocacao, instancia) end @@ -1272,7 +1252,7 @@ end tabela.minha_barra = whichRowLine thisLine.colocacao = colocacao - if (not _getmetatable (tabela)) then + if (not _getmetatable(tabela)) then setmetatable(tabela, {__call = RefreshBarraFrags}) tabela._custom = true end @@ -1282,7 +1262,7 @@ end if (instancia.row_info.percent_type == 1) then porcentagem = format("%.1f", tabela [2] / total * 100) - elseif (instancia.row_info.percent_type == 2) then + elseif(instancia.row_info.percent_type == 2) then porcentagem = format("%.1f", tabela [2] / instancia.top * 100) end @@ -1336,7 +1316,6 @@ end end if (thisLine.mouse_over and not instancia.baseframe.isMoving) then --precisa atualizar o tooltip - --gump:UpdateTooltip(whichRowLine, thisLine, instancia)if(thisLine.mouse_over and not instancia.baseframe.isMoving) then local classIcon = thisLine:GetClassIcon() thisLine.iconHighlight:SetTexture(classIcon:GetTexture()) thisLine.iconHighlight:SetTexCoord(classIcon:GetTexCoord()) @@ -1359,13 +1338,13 @@ end local total, top, amount = 0, 0, 0 local actor_name = "@ACTORNAME@" - local actor = combat (4, actor_name) + local actor = combat(4, actor_name) if (not actor) then return 0, 0, 0 end - local damage_actor = combat (1, actor.damage_twin) + local damage_actor = combat(1, actor.damage_twin) local habilidade local alvos @@ -1401,7 +1380,7 @@ end tinsert(tooltip_void_zone_temp, t) end - local target_actor = combat (1, target_name) or combat (2, target_name) or combat (4, target_name) + local target_actor = combat(1, target_name) or combat(2, target_name) or combat(4, target_name) t[1] = target_name t[2] = debuff_table.damage t[3] = debuff_table @@ -1411,10 +1390,10 @@ end end --sort no container: - table.sort (tooltip_void_zone_temp, Details.sort_tooltip_void_zones) + table.sort(tooltip_void_zone_temp, Details.sort_tooltip_void_zones) for index, t in ipairs(tooltip_void_zone_temp) do - instance_container:AddValue (t[4], t[2]) + instance_container:AddValue(t[4], t[2]) local custom_actor = instance_container:GetActorTable(t[4]) custom_actor.uptime = t[3].uptime @@ -1443,7 +1422,7 @@ end return Details:ToK2(value) .. " - " .. uptime .. " " ]] - local function ShowVoidZonesInWindow (actor, instance) + local function ShowVoidZonesInWindow(actor, instance) local spellid = tooltip_void_zone_temp.spellid @@ -1493,15 +1472,15 @@ end return instance:TrocaTabela(instance.segmento, 5, #Details.custom) end - function damageClass:ReportSingleVoidZoneLine (actor, instance, ShiftKeyDown, ControlKeyDown) + function damageClass:ReportSingleVoidZoneLine(actor, instance, ShiftKeyDown, ControlKeyDown) local spellid = tooltip_void_zone_temp.spellid if (ControlKeyDown) then local spellname, _, spellicon = _GetSpellInfo(spellid) - return Details:OpenAuraPanel (spellid, spellname, spellicon) - elseif (ShiftKeyDown) then - return ShowVoidZonesInWindow (actor, instance) + return Details:OpenAuraPanel(spellid, spellname, spellicon) + elseif(ShiftKeyDown) then + return ShowVoidZonesInWindow(actor, instance) end local spelllink = Details:GetSpellLink(spellid) @@ -1512,30 +1491,30 @@ end --ir� reportar dano zero tamb�m if (void_table[1] and type(void_table[1]) == "string" and void_table[2] and void_table[3] and type(void_table[3]) == "table") then local actor_table = {Details:GetOnlyName(void_table[1])} - local m, s = _math_floor(void_table[3].uptime / 60), _math_floor(void_table[3].uptime % 60) + local m, s = math.floor(void_table[3].uptime / 60), math.floor(void_table[3].uptime % 60) if (m > 0) then - actor_table [2] = FormatTooltipNumber (_, void_table[3].damage) .. " (" .. m .. "m " .. s .. "s" .. ")" + actor_table [2] = formatTooltipNumber(_, void_table[3].damage) .. "(" .. m .. "m " .. s .. "s" .. ")" else - actor_table [2] = FormatTooltipNumber (_, void_table[3].damage) .. " (" .. s .. "s" .. ")" + actor_table [2] = formatTooltipNumber(_, void_table[3].damage) .. "(" .. s .. "s" .. ")" end t [#t+1] = actor_table end end - Details:FormatReportLines (report_table, t) + Details:FormatReportLines(report_table, t) - return Details:Reportar (report_table, {_no_current = true, _no_inverse = true, _custom = true}) + return Details:Reportar(report_table, {_no_current = true, _no_inverse = true, _custom = true}) end local sort_tooltip_void_zones = function(tabela1, tabela2) if (tabela1 [2] > tabela2 [2]) then return true - elseif (tabela1 [2] == tabela2 [2]) then + elseif(tabela1 [2] == tabela2 [2]) then if (tabela1[1] ~= "" and tabela2[1] ~= "") then return tabela1 [3].uptime > tabela2 [3].uptime - elseif (tabela1[1] ~= "") then + elseif(tabela1[1] ~= "") then return true - elseif (tabela2[1] ~= "") then + elseif(tabela2[1] ~= "") then return false end else @@ -1545,9 +1524,9 @@ end Details.sort_tooltip_void_zones = sort_tooltip_void_zones - function Details:ToolTipVoidZones (instancia, actor, barra, keydown) + function Details:ToolTipVoidZones(instancia, actor, barra, keydown) - local damage_actor = instancia.showing[1]:PegarCombatente (_, actor.damage_twin) + local damage_actor = instancia.showing[1]:PegarCombatente(_, actor.damage_twin) local habilidade local alvos @@ -1597,15 +1576,15 @@ end end --sort no container: - _table_sort(tooltip_void_zone_temp, sort_tooltip_void_zones) + table.sort(tooltip_void_zone_temp, sort_tooltip_void_zones) --monta o cooltip local GameCooltip = GameCooltip local spellname, _, spellicon = _GetSpellInfo(actor.damage_spellid) - --Details:AddTooltipSpellHeaderText (spellname .. " " .. Loc ["STRING_VOIDZONE_TOOLTIP"], headerColor, #tooltip_void_zone_temp, spellicon, 0.078125, 0.921875, 0.078125, 0.921875) - --Details:AddTooltipHeaderStatusbar (1, 1, 1, 0.5) - --GameCooltip:AddIcon ([[Interface\AddOns\Details\images\key_shift]], 1, 2, Details.tooltip_key_size_width, Details.tooltip_key_size_height, 0, 1, 0, 0.640625, Details.tooltip_key_overlay2) + --Details:AddTooltipSpellHeaderText(spellname .. " " .. Loc ["STRING_VOIDZONE_TOOLTIP"], headerColor, #tooltip_void_zone_temp, spellicon, 0.078125, 0.921875, 0.078125, 0.921875) + --Details:AddTooltipHeaderStatusbar(1, 1, 1, 0.5) + --GameCooltip:AddIcon([[Interface\AddOns\Details\images\key_shift]], 1, 2, Details.tooltip_key_size_width, Details.tooltip_key_size_height, 0, 1, 0, 0.640625, Details.tooltip_key_overlay2) --for target_name, debuff_table in pairs(container) do local first = tooltip_void_zone_temp [1] and tooltip_void_zone_temp [1][3] @@ -1632,31 +1611,31 @@ end local debuff_table = t[3] - local minutos, segundos = _math_floor(debuff_table.uptime / 60), _math_floor(debuff_table.uptime % 60) + local minutos, segundos = math.floor(debuff_table.uptime / 60), math.floor(debuff_table.uptime % 60) if (minutos > 0) then - GameCooltip:AddLine(Details:GetOnlyName(t[1]), FormatTooltipNumber (_, debuff_table.damage) .. " (" .. minutos .. "m " .. segundos .. "s" .. ")") + GameCooltip:AddLine(Details:GetOnlyName(t[1]), formatTooltipNumber(_, debuff_table.damage) .. "(" .. minutos .. "m " .. segundos .. "s" .. ")") else - GameCooltip:AddLine(Details:GetOnlyName(t[1]), FormatTooltipNumber (_, debuff_table.damage) .. " (" .. segundos .. "s" .. ")") + GameCooltip:AddLine(Details:GetOnlyName(t[1]), formatTooltipNumber(_, debuff_table.damage) .. "(" .. segundos .. "s" .. ")") end local classe = Details:GetClass(t[1]) if (classe) then local specID = Details:GetSpec(t[1]) if (specID) then - local texture, l, r, t, b = Details:GetSpecIcon (specID, false) - GameCooltip:AddIcon (texture, 1, 1, iconSize, iconSize, l, r, t, b) + local texture, l, r, t, b = Details:GetSpecIcon(specID, false) + GameCooltip:AddIcon(texture, 1, 1, iconSize, iconSize, l, r, t, b) else - GameCooltip:AddIcon ([[Interface\AddOns\Details\images\classes_small_alpha]], nil, nil, iconSize, iconSize, unpack(Details.class_coords [classe])) + GameCooltip:AddIcon([[Interface\AddOns\Details\images\classes_small_alpha]], nil, nil, iconSize, iconSize, unpack(Details.class_coords [classe])) end else - GameCooltip:AddIcon ("Interface\\LFGFRAME\\LFGROLE_BW", nil, nil, iconSize, iconSize, .25, .5, 0, 1) + GameCooltip:AddIcon("Interface\\LFGFRAME\\LFGROLE_BW", nil, nil, iconSize, iconSize, .25, .5, 0, 1) end local _, _, _, _, _, r, g, b = Details:GetClass(t[1]) if (first == 0) then first = 0.0000000001 end - GameCooltip:AddStatusBar (debuff_table.damage / first * 100, 1, r, g, b, 1, false, enemies_background) + GameCooltip:AddStatusBar(debuff_table.damage / first * 100, 1, r, g, b, 1, false, enemies_background) --Details:AddTooltipBackgroundStatusbar() end @@ -1670,16 +1649,15 @@ end end - local function RefreshBarraVoidZone (tabela, barra, instancia) - tabela:AtualizarVoidZone (tabela.minha_barra, barra.colocacao, instancia) + local function RefreshBarraVoidZone(tabela, barra, instancia) + tabela:AtualizarVoidZone(tabela.minha_barra, barra.colocacao, instancia) end - function atributo_misc:AtualizarVoidZone (whichRowLine, colocacao, instancia) + function atributo_misc:AtualizarVoidZone(whichRowLine, colocacao, instancia) --pega a refer�ncia da barra na janela local thisLine = instancia.barras[whichRowLine] if (not thisLine) then - print("DEBUG: problema com "..whichRowLine.." "..rank) return end @@ -1695,10 +1673,10 @@ end local total = instancia.showing.totals.voidzone_damage local combat_time = instancia.showing:GetCombatTime() - local dps = _math_floor(self.damage / combat_time) + local dps = math.floor(self.damage / combat_time) - local formated_damage = SelectedToKFunction(_, self.damage) - local formated_dps = SelectedToKFunction(_, dps) + local formated_damage = selectedToKFunction(_, self.damage) + local formated_dps = selectedToKFunction(_, dps) local porcentagem @@ -1706,7 +1684,7 @@ end total = max(total, 0.0001) porcentagem = format("%.1f", self.damage / total * 100) - elseif (instancia.row_info.percent_type == 2) then + elseif(instancia.row_info.percent_type == 2) then local top = max(instancia.top, 0.0001) porcentagem = format("%.1f", self.damage / top * 100) end @@ -1730,7 +1708,7 @@ end end local rightText = formated_damage .. bars_brackets[1] .. formated_dps .. bars_separator .. porcentagem .. bars_brackets[2] - if (UsingCustomRightText) then + if (bUsingCustomRightText) then thisLine.lineText4:SetText(stringReplace(instancia.row_info.textR_custom_text, formated_damage, formated_dps, porcentagem, self, instancia.showing, instancia, rightText)) else if (instancia.use_multi_fontstrings) then @@ -1818,28 +1796,28 @@ function damageClass:RefreshWindow(instanceObject, combatObject, bForceUpdate, b if (subAttribute == 1) then --DAMAGE DONE keyName = "total" - elseif (subAttribute == 2) then --DPS + elseif(subAttribute == 2) then --DPS keyName = "last_dps" - elseif (subAttribute == 3) then --DAMAGE TAKEN + elseif(subAttribute == 3) then --DAMAGE TAKEN keyName = "damage_taken" if (Details.damage_taken_everything) then windowMode = modo_ALL end - elseif (subAttribute == 4) then --FRIENDLY FIRE + elseif(subAttribute == 4) then --FRIENDLY FIRE keyName = "friendlyfire_total" - elseif (subAttribute == 5) then --FRAGS + elseif(subAttribute == 5) then --FRAGS keyName = "frags" - elseif (subAttribute == 6) then --ENEMIES + elseif(subAttribute == 6) then --ENEMIES keyName = "enemies" - elseif (subAttribute == 7) then --AURAS VOIDZONES + elseif(subAttribute == 7) then --AURAS VOIDZONES keyName = "voidzones" - elseif (subAttribute == 8) then --BY SPELL + elseif(subAttribute == 8) then --BY SPELL keyName = "damage_taken_by_spells" end else @@ -1847,7 +1825,7 @@ function damageClass:RefreshWindow(instanceObject, combatObject, bForceUpdate, b windowMode = bExportData.modo end - elseif (instanceObject.atributo == 5) then --custom + elseif(instanceObject.atributo == 5) then --custom keyName = "custom" total = combatObject.totals [instanceObject.customName] @@ -1855,28 +1833,28 @@ function damageClass:RefreshWindow(instanceObject, combatObject, bForceUpdate, b if (subAttribute == 1) then --DAMAGE DONE keyName = "total" - elseif (subAttribute == 2) then --DPS + elseif(subAttribute == 2) then --DPS keyName = "last_dps" - elseif (subAttribute == 3) then --DAMAGE TAKEN + elseif(subAttribute == 3) then --DAMAGE TAKEN keyName = "damage_taken" if (Details.damage_taken_everything) then windowMode = modo_ALL end - elseif (subAttribute == 4) then --FRIENDLY FIRE + elseif(subAttribute == 4) then --FRIENDLY FIRE keyName = "friendlyfire_total" - elseif (subAttribute == 5) then --FRAGS + elseif(subAttribute == 5) then --FRAGS keyName = "frags" - elseif (subAttribute == 6) then --ENEMIES + elseif(subAttribute == 6) then --ENEMIES keyName = "enemies" - elseif (subAttribute == 7) then --AURAS VOIDZONES + elseif(subAttribute == 7) then --AURAS VOIDZONES keyName = "voidzones" - elseif (subAttribute == 8) then --BY SPELL + elseif(subAttribute == 8) then --BY SPELL keyName = "damage_taken_by_spells" end end @@ -1896,7 +1874,7 @@ function damageClass:RefreshWindow(instanceObject, combatObject, bForceUpdate, b if (fragged_actor and fragged_actor.monster) then actor_classe = "ENEMY" - elseif (not actor_classe) then + elseif(not actor_classe) then actor_classe = "UNGROUPPLAYER" end @@ -1922,7 +1900,7 @@ function damageClass:RefreshWindow(instanceObject, combatObject, bForceUpdate, b instanceObject.top = 0 if (tsize > 0) then - _table_sort(ntable, Details.Sort2) + table.sort(ntable, Details.Sort2) instanceObject.top = ntable [1][2] end @@ -1955,12 +1933,12 @@ function damageClass:RefreshWindow(instanceObject, combatObject, bForceUpdate, b return Details:EndRefresh(instanceObject, total, combatObject, damageContainer) --retorna a tabela que precisa ganhar o refresh - elseif (keyName == "damage_taken_by_spells") then + elseif(keyName == "damage_taken_by_spells") then local bs_index, total = 0, 0 Details:Destroy(bs_index_table) local combat = combatObject - local AllDamageCharacters = combat:GetActorList (DETAILS_ATTRIBUTE_DAMAGE) + local AllDamageCharacters = combat:GetActorList(DETAILS_ATTRIBUTE_DAMAGE) --do a loop amoung the actors for index, character in ipairs(AllDamageCharacters) do @@ -1970,7 +1948,7 @@ function damageClass:RefreshWindow(instanceObject, combatObject, bForceUpdate, b for source_name, _ in pairs(character.damage_from) do - local source = combat (1, source_name) + local source = combat(1, source_name) if (source) then --came from an enemy @@ -2010,7 +1988,7 @@ function damageClass:RefreshWindow(instanceObject, combatObject, bForceUpdate, b end end - elseif (source:IsGroupPlayer()) then -- friendly fire + elseif(source:IsGroupPlayer()) then -- friendly fire local AllSpells = source.friendlyfire [character.nome] and source.friendlyfire [character.nome].spells if (AllSpells) then -- se n�o existir pode ter vindo de um pet, talvez @@ -2060,7 +2038,7 @@ function damageClass:RefreshWindow(instanceObject, combatObject, bForceUpdate, b instanceObject.top = 0 if (tsize > 0) then - _table_sort(bs_table, Details.Sort2) + table.sort(bs_table, Details.Sort2) instanceObject.top = bs_table [1][2] end @@ -2088,13 +2066,13 @@ function damageClass:RefreshWindow(instanceObject, combatObject, bForceUpdate, b local lineContainer = instanceObject.barras for i = instanceObject.barraS[1], instanceObject.barraS[2], 1 do - damageClass:AtualizarBySpell (bs_table[i], whichRowLine, i, instanceObject) + damageClass:AtualizarBySpell(bs_table[i], whichRowLine, i, instanceObject) whichRowLine = whichRowLine+1 end return Details:EndRefresh(instanceObject, bs_index, combatObject, damageContainer) - elseif (keyName == "voidzones") then + elseif(keyName == "voidzones") then local index = 0 local misc_container = combatObject [4] local voidzone_damage_total = 0 @@ -2132,7 +2110,7 @@ function damageClass:RefreshWindow(instanceObject, combatObject, bForceUpdate, b actor.damage = spell.total voidzone_damage_total = voidzone_damage_total + spell.total - elseif (not actor.damage_spellid_fixed) then --not + elseif(not actor.damage_spellid_fixed) then --not --fix spell, if the spellid passed for debuff uptime is actully the spell id of a ability and not if the aura it self actor.damage_spellid_fixed = true local found = false @@ -2169,7 +2147,7 @@ function damageClass:RefreshWindow(instanceObject, combatObject, bForceUpdate, b end if (tsize > 0 and vtable[1]) then - _table_sort(vtable, void_zone_sort) + table.sort(vtable, void_zone_sort) instanceObject.top = vtable [1].damage end total = index @@ -2194,7 +2172,7 @@ function damageClass:RefreshWindow(instanceObject, combatObject, bForceUpdate, b local lineContainer = instanceObject.barras for i = instanceObject.barraS[1], instanceObject.barraS[2], 1 do - vtable[i]:AtualizarVoidZone (whichRowLine, i, instanceObject) + vtable[i]:AtualizarVoidZone(whichRowLine, i, instanceObject) whichRowLine = whichRowLine+1 end @@ -2203,7 +2181,7 @@ function damageClass:RefreshWindow(instanceObject, combatObject, bForceUpdate, b else --/run Details:Dump(Details:GetCurrentCombat():GetActor(1, "Injured Steelspine 1")) if (keyName == "enemies") then - amount, total = Details:ContainerSortEnemies (actorTableContent, amount, "damage_taken") + amount, total = Details:ContainerSortEnemies(actorTableContent, amount, "damage_taken") --remove actors with zero damage taken local newAmount = 0 @@ -2225,7 +2203,7 @@ function damageClass:RefreshWindow(instanceObject, combatObject, bForceUpdate, b --result of the first actor instanceObject.top = actorTableContent[1] and actorTableContent[1][keyName] - elseif (windowMode == DETAILS_MODE_ALL) then --mostrando ALL + elseif(windowMode == DETAILS_MODE_ALL) then --mostrando ALL --faz o sort da categoria e retorna o amount corrigido if (subAttribute == 2) then local combat_time = instanceObject.showing:GetCombatTime() @@ -2240,7 +2218,7 @@ function damageClass:RefreshWindow(instanceObject, combatObject, bForceUpdate, b --grava o total instanceObject.top = actorTableContent[1][keyName] - elseif (windowMode == DETAILS_MODE_GROUP) then --mostrando GROUP + elseif(windowMode == DETAILS_MODE_GROUP) then --mostrando GROUP if (Details.in_combat and instanceObject.segmento == 0 and not bExportData) then isUsingCache = true end @@ -2252,7 +2230,7 @@ function damageClass:RefreshWindow(instanceObject, combatObject, bForceUpdate, b if (Details.debug and false) then Details.showing_ActorTable_Timer2 = Details.showing_ActorTable_Timer2 or 0 if (time() > Details.showing_ActorTable_Timer2) then - Details:Msg("(debug) nothing to show -> #conteudo < 1 (using cache)") + Details:Msg("(debug) nothing to show -> #conteudo < 1(using cache)") Details.showing_ActorTable_Timer2 = time()+5 end end @@ -2271,14 +2249,14 @@ function damageClass:RefreshWindow(instanceObject, combatObject, bForceUpdate, b total = realTimeTotal end - elseif (subAttribute == 1) then --damage done + elseif(subAttribute == 1) then --damage done if (bOrderDpsByRealTime) then total = damageClass:RefreshDpsRealTime(actorTableContent) end end if (bOrderDpsByRealTime) then - _table_sort(actorTableContent, Details.SortByRealTimeDps) + table.sort(actorTableContent, Details.SortByRealTimeDps) if (actorTableContent[1]["last_dps_realtime"] < 1) then amount = 0 @@ -2287,7 +2265,7 @@ function damageClass:RefreshWindow(instanceObject, combatObject, bForceUpdate, b amount = #actorTableContent end else - _table_sort(actorTableContent, Details.SortKeySimple) + table.sort(actorTableContent, Details.SortKeySimple) if (actorTableContent[1][keyName] < 1) then amount = 0 else @@ -2306,7 +2284,7 @@ function damageClass:RefreshWindow(instanceObject, combatObject, bForceUpdate, b local combatTime = combatObject:GetCombatTime() damageClass:ContainerRefreshDps(actorTableContent, combatTime) end - _table_sort(actorTableContent, Details.SortKeyGroup) + table.sort(actorTableContent, Details.SortKeyGroup) end -- @@ -2370,7 +2348,7 @@ function damageClass:RefreshWindow(instanceObject, combatObject, bForceUpdate, b local barsBrackets = instanceObject:GetBarBracket() local barsSeparator = instanceObject:GetBarSeparator() local baseframe = instanceObject.baseframe - local useAnimations = Details.is_using_row_animations and (not baseframe.isStretching and not bForceUpdate and not baseframe.isResizing) + local useAnimations = Details.is_using_row_animations and(not baseframe.isStretching and not bForceUpdate and not baseframe.isResizing) if (total == 0) then total = 0.00000001 @@ -2394,14 +2372,14 @@ function damageClass:RefreshWindow(instanceObject, combatObject, bForceUpdate, b end local combatTime = instanceObject.showing:GetCombatTime() - UsingCustomLeftText = instanceObject.row_info.textL_enable_custom_text - UsingCustomRightText = instanceObject.row_info.textR_enable_custom_text + bUsingCustomLeftText = instanceObject.row_info.textL_enable_custom_text + bUsingCustomRightText = instanceObject.row_info.textR_enable_custom_text local useTotalBar = false if (instanceObject.total_bar.enabled) then useTotalBar = true - if (instanceObject.total_bar.only_in_group and (not IsInGroup() and not IsInRaid())) then + if (instanceObject.total_bar.only_in_group and(not IsInGroup() and not IsInRaid())) then useTotalBar = false end @@ -2412,7 +2390,7 @@ function damageClass:RefreshWindow(instanceObject, combatObject, bForceUpdate, b if (subAttribute == 2) then --dps instanceObject.player_top_dps = actorTableContent [1].last_dps - instanceObject.player_top_dps_threshold = instanceObject.player_top_dps - (instanceObject.player_top_dps * 0.65) + instanceObject.player_top_dps_threshold = instanceObject.player_top_dps -(instanceObject.player_top_dps * 0.65) end local totalBarIsShown @@ -2434,7 +2412,7 @@ function damageClass:RefreshWindow(instanceObject, combatObject, bForceUpdate, b row1.lineText3:SetText(Details:ToK2(total)) row1.lineText4:SetText(Details:ToK(total / combatTime)) else - row1.lineText4:SetText(Details:ToK2(total) .. " (" .. Details:ToK(total / combatTime) .. ")") + row1.lineText4:SetText(Details:ToK2(total) .. "(" .. Details:ToK(total / combatTime) .. ")") end row1:SetValue(100) @@ -2486,7 +2464,7 @@ function damageClass:RefreshWindow(instanceObject, combatObject, bForceUpdate, b end end - elseif (instanceObject.bars_sort_direction == 2) then --bottom to top + elseif(instanceObject.bars_sort_direction == 2) then --bottom to top if (useTotalBar and instanceObject.barraS[1] == 1) then whichRowLine = 2 local iter_last = instanceObject.barraS[2] @@ -2503,7 +2481,7 @@ function damageClass:RefreshWindow(instanceObject, combatObject, bForceUpdate, b row1.lineText3:SetText(Details:ToK2(total)) row1.lineText4:SetText(Details:ToK(total / combatTime)) else - row1.lineText4:SetText(Details:ToK2(total) .. " (" .. Details:ToK(total / combatTime) .. ")") + row1.lineText4:SetText(Details:ToK2(total) .. "(" .. Details:ToK(total / combatTime) .. ")") end row1:SetValue(100) @@ -2594,7 +2572,7 @@ function Details:AutoAlignInLineFontStrings() Details.CacheInLineMaxDistance = Details.CacheInLineMaxDistance or {} Details.CacheInLineMaxDistance[self:GetId()] = Details.CacheInLineMaxDistance[self:GetId()] or {[2] = profileOffsetString2, [3] = profileOffsetString3} - --space between string4 and string3 (usually dps is 4 and total value is 3) + --space between string4 and string3(usually dps is 4 and total value is 3) for lineId = 1, self:GetNumLinesShown() do local thisLine = self:GetLine(lineId) if (thisLine) then @@ -2615,7 +2593,7 @@ function Details:AutoAlignInLineFontStrings() end --if the length bigger than the min distance? calculate for string4 to string3 distance - if ((maxStringLength_StringFour > 0) and (maxStringLength_StringFour + 5 > profileOffsetString3)) then + if ((maxStringLength_StringFour > 0) and(maxStringLength_StringFour + 5 > profileOffsetString3)) then local newOffset = maxStringLength_StringFour + 5 --check if the current needed min distance is bigger than the distance stored in the cache @@ -2712,7 +2690,7 @@ local classColor_Red, classColor_Green, classColor_Blue perSecondText = perSecondText or "" percentText = percentText or "" - if ((Details.use_realtimedps or (Details.combat_log.evoker_show_realtimedps and Details.playerspecid == 1473)) and Details.in_combat) then --real time + if ((Details.use_realtimedps or(Details.combat_log.evoker_show_realtimedps and Details.playerspecid == 1473)) and Details.in_combat) then --real time if (thisLine:GetActor()) then local actorSerial = thisLine:GetActor().serial local currentDps = Details.CurrentDps.GetCurrentDps(actorSerial) @@ -2781,7 +2759,7 @@ function damageClass:RefreshLine(instanceObject, lineContainer, whichRowLine, ra if (percentageType == 1) then percentString = format("%.1f", self[keyName] / total * 100) - elseif (percentageType == 2) then + elseif(percentageType == 2) then percentString = format("%.1f", self[keyName] / instanceObject.top * 100) end @@ -2791,7 +2769,7 @@ function damageClass:RefreshLine(instanceObject, lineContainer, whichRowLine, ra if (Details.mythic_plus.mythicrun_time_type == 1) then --total time in combat, activity time combatTime = currentCombat:GetCombatTime() - elseif (Details.mythic_plus.mythicrun_time_type == 2) then + elseif(Details.mythic_plus.mythicrun_time_type == 2) then --elapsed time of the run combatTime = currentCombat:GetRunTime() end @@ -2841,9 +2819,9 @@ function damageClass:RefreshLine(instanceObject, lineContainer, whichRowLine, ra --right text if (subAttribute == 1) then --damage done - dps = _math_floor(dps) - local formatedDamage = SelectedToKFunction(_, damageTotal) - local formatedDps = SelectedToKFunction(_, dps) + dps = math.floor(dps) + local formatedDamage = selectedToKFunction(_, damageTotal) + local formatedDps = selectedToKFunction(_, dps) thisLine.ps_text = formatedDps if (not bars_show_data[1]) then @@ -2862,7 +2840,7 @@ function damageClass:RefreshLine(instanceObject, lineContainer, whichRowLine, ra local rightText = formatedDamage .. bars_brackets[1] .. formatedDps .. bars_separator .. percentString .. bars_brackets[2] - if (UsingCustomRightText) then + if (bUsingCustomRightText) then thisLine.lineText4:SetText(stringReplace(instanceObject.row_info.textR_custom_text, formatedDamage, formatedDps, percentString, self, instanceObject.showing, instanceObject, rightText)) else if (instanceObject.use_multi_fontstrings) then @@ -2873,17 +2851,17 @@ function damageClass:RefreshLine(instanceObject, lineContainer, whichRowLine, ra end if (Details.CurrentDps.CanSortByRealTimeDps()) then - percentNumber = _math_floor((self.last_dps_realtime / instanceObject.top) * 100) + percentNumber = math.floor((self.last_dps_realtime / instanceObject.top) * 100) else - percentNumber = _math_floor((damageTotal/instanceObject.top) * 100) + percentNumber = math.floor((damageTotal/instanceObject.top) * 100) end - elseif (subAttribute == 2) then --dps + elseif(subAttribute == 2) then --dps local raw_dps = dps - dps = _math_floor(dps) + dps = math.floor(dps) - local formated_damage = SelectedToKFunction(_, damageTotal) - local formated_dps = SelectedToKFunction(_, dps) + local formated_damage = selectedToKFunction(_, damageTotal) + local formated_dps = selectedToKFunction(_, dps) thisLine.ps_text = formated_dps local diff_from_topdps @@ -2901,9 +2879,9 @@ function damageClass:RefreshLine(instanceObject, lineContainer, whichRowLine, ra threshold = 5 end - local rr, gg, bb = Details:percent_color ( threshold ) + local rr, gg, bb = Details:percent_color( threshold ) - rr, gg, bb = Details:hex (_math_floor(rr*255)), Details:hex (_math_floor(gg*255)), "28" + rr, gg, bb = Details:hex(math.floor(rr*255)), Details:hex(math.floor(gg*255)), "28" local color_percent = "" .. rr .. gg .. bb .. "" if (not bars_show_data [1]) then @@ -2912,7 +2890,7 @@ function damageClass:RefreshLine(instanceObject, lineContainer, whichRowLine, ra if (not bars_show_data [2]) then color_percent = "" else - color_percent = bars_brackets[1] .. "|cFFFF4444-|r|cFF" .. color_percent .. SelectedToKFunction(_, _math_floor(diff_from_topdps)) .. "|r" .. bars_brackets[2] + color_percent = bars_brackets[1] .. "|cFFFF4444-|r|cFF" .. color_percent .. selectedToKFunction(_, math.floor(diff_from_topdps)) .. "|r" .. bars_brackets[2] end rightText = formated_dps .. color_percent @@ -2929,7 +2907,7 @@ function damageClass:RefreshLine(instanceObject, lineContainer, whichRowLine, ra rightText = formated_dps .. icon end - if (UsingCustomRightText) then + if (bUsingCustomRightText) then thisLine.lineText4:SetText(stringReplace(instanceObject.row_info.textR_custom_text, formated_dps, formated_damage, percentString, self, instanceObject.showing, instanceObject, rightText)) else if (instanceObject.use_multi_fontstrings) then @@ -2940,13 +2918,13 @@ function damageClass:RefreshLine(instanceObject, lineContainer, whichRowLine, ra end end - percentNumber = _math_floor((dps/instanceObject.top) * 100) + percentNumber = math.floor((dps/instanceObject.top) * 100) - elseif (subAttribute == 3) then --damage taken + elseif(subAttribute == 3) then --damage taken local dtps = self.damage_taken / combatTime - local formated_damage_taken = SelectedToKFunction(_, self.damage_taken) - local formated_dtps = SelectedToKFunction(_, dtps) + local formated_damage_taken = selectedToKFunction(_, self.damage_taken) + local formated_dtps = selectedToKFunction(_, dtps) thisLine.ps_text = formated_dtps if (not bars_show_data [1]) then @@ -2962,7 +2940,7 @@ function damageClass:RefreshLine(instanceObject, lineContainer, whichRowLine, ra end local rightText = formated_damage_taken .. bars_brackets[1] .. formated_dtps .. bars_separator .. percentString .. bars_brackets[2] - if (UsingCustomRightText) then + if (bUsingCustomRightText) then thisLine.lineText4:SetText(stringReplace(instanceObject.row_info.textR_custom_text, formated_damage_taken, formated_dtps, percentString, self, instanceObject.showing, instanceObject, rightText)) else if (instanceObject.use_multi_fontstrings) then @@ -2972,10 +2950,10 @@ function damageClass:RefreshLine(instanceObject, lineContainer, whichRowLine, ra end end - percentNumber = _math_floor((self.damage_taken/instanceObject.top) * 100) + percentNumber = math.floor((self.damage_taken/instanceObject.top) * 100) - elseif (subAttribute == 4) then --friendly fire - local formated_friendly_fire = SelectedToKFunction(_, self.friendlyfire_total) + elseif(subAttribute == 4) then --friendly fire + local formated_friendly_fire = selectedToKFunction(_, self.friendlyfire_total) if (not bars_show_data [1]) then formated_friendly_fire = "" @@ -2987,7 +2965,7 @@ function damageClass:RefreshLine(instanceObject, lineContainer, whichRowLine, ra end local rightText = formated_friendly_fire .. bars_brackets[1] .. percentString .. bars_brackets[2] - if (UsingCustomRightText) then + if (bUsingCustomRightText) then thisLine.lineText4:SetText(stringReplace(instanceObject.row_info.textR_custom_text, formated_friendly_fire, "", percentString, self, instanceObject.showing, instanceObject, rightText)) else if (instanceObject.use_multi_fontstrings) then @@ -2996,29 +2974,29 @@ function damageClass:RefreshLine(instanceObject, lineContainer, whichRowLine, ra thisLine.lineText4:SetText(rightText) end end - percentNumber = _math_floor((self.friendlyfire_total/instanceObject.top) * 100) + percentNumber = math.floor((self.friendlyfire_total/instanceObject.top) * 100) - elseif (subAttribute == 6) then --enemies + elseif(subAttribute == 6) then --enemies local dtps = self.damage_taken / combatTime - local formatedDamageTaken = SelectedToKFunction(_, self.damage_taken) - local formatedDtps = SelectedToKFunction(_, dtps) + local formatedDamageTaken = selectedToKFunction(_, self.damage_taken) + local formatedDtps = selectedToKFunction(_, dtps) thisLine.ps_text = formatedDtps - if (not bars_show_data [1]) then + if (not bars_show_data[1]) then formatedDamageTaken = "" end - if (not bars_show_data [2]) then + if (not bars_show_data[2]) then formatedDtps = "" end - if (not bars_show_data [3]) then + if (not bars_show_data[3]) then percentString = "" else percentString = percentString .. "%" end local rightText = formatedDamageTaken .. bars_brackets[1] .. formatedDtps .. bars_separator .. percentString .. bars_brackets[2] - if (UsingCustomRightText) then + if (bUsingCustomRightText) then thisLine.lineText4:SetText(stringReplace(instanceObject.row_info.textR_custom_text, formatedDamageTaken, formatedDtps, percentString, self, instanceObject.showing, instanceObject, rightText)) else if (instanceObject.use_multi_fontstrings) then @@ -3028,7 +3006,7 @@ function damageClass:RefreshLine(instanceObject, lineContainer, whichRowLine, ra end end - percentNumber = _math_floor((self.damage_taken/instanceObject.top) * 100) + percentNumber = math.floor((self.damage_taken/instanceObject.top) * 100) end --need tooltip update? @@ -3071,7 +3049,7 @@ function Details:ShowExtraStatusbar(thisLine, amount, extraAmount, totalAmount, local fillTheGapWidth = percent * 4 local startExtraStatusbarOffset = percent * statusBarWidth - local extraStatusbarWidth = statusBarWidth * (extraAmount / topAmount) + local extraStatusbarWidth = statusBarWidth *(extraAmount / topAmount) extraStatusbar:ClearAllPoints() extraStatusbar:SetHeight(thisLine:GetHeight()) @@ -3079,12 +3057,12 @@ function Details:ShowExtraStatusbar(thisLine, amount, extraAmount, totalAmount, if (bIsUsingBarStartAfterIcon) then extraStatusbar:SetPoint("topleft", thisLine.icone_classe, "topright", startExtraStatusbarOffset - fillTheGapWidth, 0) else - extraStatusbar:SetPoint("topleft", thisLine, "topleft", (statusBarWidth * percent) - fillTheGapWidth, 0) + extraStatusbar:SetPoint("topleft", thisLine, "topleft",(statusBarWidth * percent) - fillTheGapWidth, 0) end --check if the extra bar will be bigger than the window local windowWidth = instanceObject:GetSize() - local lineWidth = thisLine:GetWidth() * (amount/topAmount) + local lineWidth = thisLine:GetWidth() *(amount/topAmount) local maxExtraBarWidth = windowWidth - lineWidth - initialOffset if (extraStatusbarWidth > maxExtraBarWidth) then @@ -3194,7 +3172,7 @@ function Details:RefreshLineValue(thisLine, instance, previousData, isForceRefre return self:RefreshBarra(thisLine, instance) - elseif (percent ~= thisLine.last_value) then + elseif(percent ~= thisLine.last_value) then --apenas atualizar if (bUseAnimations and self.spec ~= 1473) then thisLine.animacao_fim = percent @@ -3246,7 +3224,7 @@ function Details:SetBarLeftText(bar, instance, enemy, arenaEnemy, arenaAlly, usi if (instance.row_info.textL_translit_text) then if (not self.transliteratedName) then - --translate cyrillic alphabet to western alphabet by Vardex (https://github.com/Vardex May 22, 2019) + --translate cyrillic alphabet to western alphabet by Vardex(https://github.com/Vardex May 22, 2019) self.transliteratedName = Translit:Transliterate(self.displayName, "!") end self.displayName = self.transliteratedName or self.displayName @@ -3257,9 +3235,9 @@ function Details:SetBarLeftText(bar, instance, enemy, arenaEnemy, arenaAlly, usi if (instance.row_info.show_arena_role_icon) then --show arena role icon local sizeOffset = instance.row_info.arena_role_icon_size_offset - local leftText = barNumber .. "|TInterface\\LFGFRAME\\UI-LFG-ICON-ROLES:" .. (instance.row_info.height + sizeOffset)..":"..(instance.row_info.height + sizeOffset) .. ":0:0:256:256:" .. Details.role_texcoord [self.role or "NONE"] .. "|t " .. self.displayName + local leftText = barNumber .. "|TInterface\\LFGFRAME\\UI-LFG-ICON-ROLES:" ..(instance.row_info.height + sizeOffset)..":"..(instance.row_info.height + sizeOffset) .. ":0:0:256:256:" .. Details.role_texcoord [self.role or "NONE"] .. "|t " .. self.displayName if (usingCustomLeftText) then - bar.lineText1:SetText(stringReplace(instance.row_info.textL_custom_text, bar.colocacao, self.displayName, "|TInterface\\LFGFRAME\\UI-LFG-ICON-ROLES:" .. (instance.row_info.height + sizeOffset)..":"..(instance.row_info.height + sizeOffset) .. ":0:0:256:256:" .. Details.role_texcoord [self.role or "NONE"] .. "|t ", self, instance.showing, instance, leftText)) + bar.lineText1:SetText(stringReplace(instance.row_info.textL_custom_text, bar.colocacao, self.displayName, "|TInterface\\LFGFRAME\\UI-LFG-ICON-ROLES:" ..(instance.row_info.height + sizeOffset)..":"..(instance.row_info.height + sizeOffset) .. ":0:0:256:256:" .. Details.role_texcoord [self.role or "NONE"] .. "|t ", self, instance.showing, instance, leftText)) else bar.lineText1:SetText(leftText) end @@ -3276,16 +3254,16 @@ function Details:SetBarLeftText(bar, instance, enemy, arenaEnemy, arenaAlly, usi if (instance.row_info.show_faction_icon) then local sizeOffset = instance.row_info.faction_icon_size_offset if (Details.faction_against == "Horde") then - local leftText = barNumber .. "|TInterface\\AddOns\\Details\\images\\icones_barra:" .. (instance.row_info.height + sizeOffset)..":"..(instance.row_info.height + sizeOffset) .. ":0:0:256:32:0:32:0:32|t"..self.displayName + local leftText = barNumber .. "|TInterface\\AddOns\\Details\\images\\icones_barra:" ..(instance.row_info.height + sizeOffset)..":"..(instance.row_info.height + sizeOffset) .. ":0:0:256:32:0:32:0:32|t"..self.displayName if (usingCustomLeftText) then - bar.lineText1:SetText(stringReplace(instance.row_info.textL_custom_text, bar.colocacao, self.displayName, "|TInterface\\AddOns\\Details\\images\\icones_barra:" .. (instance.row_info.height + sizeOffset)..":"..(instance.row_info.height + sizeOffset) .. ":0:0:256:32:0:32:0:32|t", self, instance.showing, instance, leftText)) + bar.lineText1:SetText(stringReplace(instance.row_info.textL_custom_text, bar.colocacao, self.displayName, "|TInterface\\AddOns\\Details\\images\\icones_barra:" ..(instance.row_info.height + sizeOffset)..":"..(instance.row_info.height + sizeOffset) .. ":0:0:256:32:0:32:0:32|t", self, instance.showing, instance, leftText)) else bar.lineText1:SetText(leftText) --seta o texto da esqueda -- HORDA end else --alliance - local leftText = barNumber .. "|TInterface\\AddOns\\Details\\images\\icones_barra:" .. (instance.row_info.height + sizeOffset)..":"..(instance.row_info.height + sizeOffset) .. ":0:0:256:32:32:64:0:32|t"..self.displayName + local leftText = barNumber .. "|TInterface\\AddOns\\Details\\images\\icones_barra:" ..(instance.row_info.height + sizeOffset)..":"..(instance.row_info.height + sizeOffset) .. ":0:0:256:32:32:64:0:32|t"..self.displayName if (usingCustomLeftText) then - bar.lineText1:SetText(stringReplace(instance.row_info.textL_custom_text, bar.colocacao, self.displayName, "|TInterface\\AddOns\\Details\\images\\icones_barra:" .. (instance.row_info.height + sizeOffset)..":"..(instance.row_info.height + sizeOffset) .. ":0:0:256:32:32:64:0:32|t", self, instance.showing, instance, leftText)) + bar.lineText1:SetText(stringReplace(instance.row_info.textL_custom_text, bar.colocacao, self.displayName, "|TInterface\\AddOns\\Details\\images\\icones_barra:" ..(instance.row_info.height + sizeOffset)..":"..(instance.row_info.height + sizeOffset) .. ":0:0:256:32:32:64:0:32|t", self, instance.showing, instance, leftText)) else bar.lineText1:SetText(leftText) --seta o texto da esqueda -- ALLY end @@ -3303,9 +3281,9 @@ function Details:SetBarLeftText(bar, instance, enemy, arenaEnemy, arenaAlly, usi else if (arenaAlly and instance.row_info.show_arena_role_icon) then local sizeOffset = instance.row_info.arena_role_icon_size_offset - local leftText = barNumber .. "|TInterface\\LFGFRAME\\UI-LFG-ICON-ROLES:" .. (instance.row_info.height + sizeOffset)..":"..(instance.row_info.height + sizeOffset) .. ":0:0:256:256:" .. Details.role_texcoord [self.role or "NONE"] .. "|t " .. self.displayName + local leftText = barNumber .. "|TInterface\\LFGFRAME\\UI-LFG-ICON-ROLES:" ..(instance.row_info.height + sizeOffset)..":"..(instance.row_info.height + sizeOffset) .. ":0:0:256:256:" .. Details.role_texcoord [self.role or "NONE"] .. "|t " .. self.displayName if (usingCustomLeftText) then - bar.lineText1:SetText(stringReplace(instance.row_info.textL_custom_text, bar.colocacao, self.displayName, "|TInterface\\LFGFRAME\\UI-LFG-ICON-ROLES:" .. (instance.row_info.height + sizeOffset)..":"..(instance.row_info.height + sizeOffset) .. ":0:0:256:256:" .. Details.role_texcoord [self.role or "NONE"] .. "|t ", self, instance.showing, instance, leftText)) + bar.lineText1:SetText(stringReplace(instance.row_info.textL_custom_text, bar.colocacao, self.displayName, "|TInterface\\LFGFRAME\\UI-LFG-ICON-ROLES:" ..(instance.row_info.height + sizeOffset)..":"..(instance.row_info.height + sizeOffset) .. ":0:0:256:256:" .. Details.role_texcoord [self.role or "NONE"] .. "|t ", self, instance.showing, instance, leftText)) else bar.lineText1:SetText(leftText) end @@ -3319,7 +3297,7 @@ function Details:SetBarLeftText(bar, instance, enemy, arenaEnemy, arenaAlly, usi end end - setLineTextSize (bar, instance) + setLineTextSize(bar, instance) end function Details:SetBarColors(bar, instance, r, g, b, a) --[[exported]] --~colors @@ -3330,7 +3308,7 @@ function Details:SetBarColors(bar, instance, r, g, b, a) --[[exported]] --~color if (self.customColor) then bar.textura:SetVertexColor(r, g, b, a) - elseif (bUseClassColor) then + elseif(bUseClassColor) then if (self.classe == "UNGROUPPLAYER") then if (self.spec) then local specId, specName, specDescription, specIcon, specRole, specClass = DetailsFramework.GetSpecializationInfoByID(self.spec) @@ -3393,16 +3371,16 @@ function Details:SetClassIcon(texture, instance, class) --[[exported]] --~icons texture:SetTexCoord(unpack(customIcon[2])) texture:SetVertexColor(1, 1, 1) - elseif (self.spellicon) then + elseif(self.spellicon) then texture:SetTexture(self.spellicon) texture:SetTexCoord(0.078125, 0.921875, 0.078125, 0.921875) - elseif (class == "UNKNOW") then + elseif(class == "UNKNOW") then texture:SetTexture([[Interface\AddOns\Details\images\classes_plus]]) texture:SetTexCoord(0.50390625, 0.62890625, 0, 0.125) texture:SetVertexColor(1, 1, 1) - elseif (class == "UNGROUPPLAYER") then + elseif(class == "UNGROUPPLAYER") then if (self.spec) then if (instance and instance.row_info.use_spec_icons) then if (self.spec and Details.class_specs_coords[self.spec]) then @@ -3454,7 +3432,7 @@ function Details:SetClassIcon(texture, instance, class) --[[exported]] --~icons texture:SetVertexColor(1, 1, 1) - elseif (class == "PET") then + elseif(class == "PET") then texture:SetTexture(instance and instance.row_info.icon_file or [[Interface\AddOns\Details\images\classes_small]]) texture:SetTexCoord(0.25, 0.49609375, 0.75, 1) classColor_Red, classColor_Green, classColor_Blue = DetailsFramework:ParseColors(classColor_Red, classColor_Green, classColor_Blue) @@ -3496,7 +3474,7 @@ function Details:RefreshBarra(thisLine, instance, fromResize) --[[exported]] --icon self:SetClassIcon(thisLine.icone_classe, instance, class) - if(thisLine.mouse_over) then + if (thisLine.mouse_over) then local classIcon = thisLine:GetClassIcon() thisLine.iconHighlight:SetTexture(classIcon:GetTexture()) thisLine.iconHighlight:SetTexCoord(classIcon:GetTexCoord()) @@ -3507,7 +3485,7 @@ function Details:RefreshBarra(thisLine, instance, fromResize) --[[exported]] self:SetBarColors(thisLine, instance, classColor_Red, classColor_Green, classColor_Blue) --left text - self:SetBarLeftText(thisLine, instance, enemy, arenaEnemy, arenaAlly, UsingCustomLeftText) + self:SetBarLeftText(thisLine, instance, enemy, arenaEnemy, arenaAlly, bUsingCustomLeftText) end ---~aug ~evoker @@ -3640,7 +3618,7 @@ function damageClass.PredictedAugSpellsOnEnter(self) --add the total combat time into the tooltip local combatTimeMinutes, combatTimeSeconds = math.floor(combatTime / 60), math.floor(combatTime % 60) - GameCooltip:AddLine("Combat Time", combatTimeMinutes .. "m " .. combatTimeSeconds .. "s" .. " (" .. format("%.1f", 100) .. "%)") + GameCooltip:AddLine("Combat Time", combatTimeMinutes .. "m " .. combatTimeSeconds .. "s" .. "(" .. format("%.1f", 100) .. "%)") GameCooltip:AddIcon([[Interface\TARGETINGFRAME\UnitFrameIcons]], nil, nil, iconSize, iconSize, iconBorderInfo.L, iconBorderInfo.R, iconBorderInfo.T, iconBorderInfo.B) Details:AddTooltipBackgroundStatusbar(false, 100, true, "darkgreen") @@ -3657,10 +3635,10 @@ function damageClass.PredictedAugSpellsOnEnter(self) local percent = evokerEbonMightUptime / combatTime * 100 if (minutes > 0) then - GameCooltip:AddLine(ebonMightSpellName .. " (self)", minutes .. "m " .. seconds .. "s" .. " (" .. format("%.1f", percent) .. "%)") + GameCooltip:AddLine(ebonMightSpellName .. "(self)", minutes .. "m " .. seconds .. "s" .. "(" .. format("%.1f", percent) .. "%)") Details:AddTooltipBackgroundStatusbar(false, percent, true, ebonMightColor) else - GameCooltip:AddLine(ebonMightSpellName .. " (self)", seconds .. "s" .. " (" .. format("%.1f", percent) .. "%)") + GameCooltip:AddLine(ebonMightSpellName .. "(self)", seconds .. "s" .. "(" .. format("%.1f", percent) .. "%)") Details:AddTooltipBackgroundStatusbar(false, percent, true, ebonMightColor) end @@ -3688,7 +3666,7 @@ function damageClass.PredictedAugSpellsOnEnter(self) local minutes, seconds = math.floor(uptime / 60), math.floor(uptime % 60) if (uptime > 0) then local uptimePercent = uptime / combatTime * 100 - GameCooltip:AddLine(spellName, minutes .. "m " .. seconds .. "s" .. " (" .. format("%.1f", uptimePercent) .. "%)") + GameCooltip:AddLine(spellName, minutes .. "m " .. seconds .. "s" .. "(" .. format("%.1f", uptimePercent) .. "%)") GameCooltip:AddIcon(ebonMightSpellIcon, nil, nil, iconSize, iconSize, iconBorderInfo.L, iconBorderInfo.R, iconBorderInfo.T, iconBorderInfo.B) Details:AddTooltipBackgroundStatusbar(false, uptimePercent, true, ebonMightColor) end @@ -3711,10 +3689,10 @@ function damageClass.PredictedAugSpellsOnEnter(self) if (uptime <= combatTime) then local minutes, seconds = math.floor(uptime / 60), math.floor(uptime % 60) if (minutes > 0) then - GameCooltip:AddLine(spellName, minutes .. "m " .. seconds .. "s" .. " (" .. format("%.1f", uptimePercent) .. "%)") + GameCooltip:AddLine(spellName, minutes .. "m " .. seconds .. "s" .. "(" .. format("%.1f", uptimePercent) .. "%)") Details:AddTooltipBackgroundStatusbar(false, uptimePercent, true, "darkgreen") else - GameCooltip:AddLine(spellName, seconds .. "s" .. " (" .. format("%.1f", uptimePercent) .. "%)") + GameCooltip:AddLine(spellName, seconds .. "s" .. "(" .. format("%.1f", uptimePercent) .. "%)") Details:AddTooltipBackgroundStatusbar(false, uptimePercent, true, "darkgreen") end @@ -3731,10 +3709,10 @@ function damageClass.PredictedAugSpellsOnEnter(self) if (uptime <= combatTime) then local minutes, seconds = math.floor(uptime / 60), math.floor(uptime % 60) if (minutes > 0) then - GameCooltip:AddLine(spellName, minutes .. "m " .. seconds .. "s" .. " (" .. format("%.1f", uptimePercent) .. "%)") + GameCooltip:AddLine(spellName, minutes .. "m " .. seconds .. "s" .. "(" .. format("%.1f", uptimePercent) .. "%)") Details:AddTooltipBackgroundStatusbar(false, uptimePercent, true, "darkgreen") else - GameCooltip:AddLine(spellName, seconds .. "s" .. " (" .. format("%.1f", uptimePercent) .. "%)") + GameCooltip:AddLine(spellName, seconds .. "s" .. "(" .. format("%.1f", uptimePercent) .. "%)") Details:AddTooltipBackgroundStatusbar(false, uptimePercent, true, "darkgreen") end @@ -3775,10 +3753,10 @@ function damageClass.PredictedAugSpellsOnEnter(self) if (uptime <= combatTime) then local minutes, seconds = math.floor(uptime / 60), math.floor(uptime % 60) if (minutes > 0) then - GameCooltip:AddLine(spellName, minutes .. "m " .. seconds .. "s" .. " (" .. format("%.1f", uptimePercent) .. "%)") + GameCooltip:AddLine(spellName, minutes .. "m " .. seconds .. "s" .. "(" .. format("%.1f", uptimePercent) .. "%)") Details:AddTooltipBackgroundStatusbar(false, uptimePercent, true, sourceName and "darkgreen") else - GameCooltip:AddLine(spellName, seconds .. "s" .. " (" .. format("%.1f", uptimePercent) .. "%)") + GameCooltip:AddLine(spellName, seconds .. "s" .. "(" .. format("%.1f", uptimePercent) .. "%)") Details:AddTooltipBackgroundStatusbar(false, uptimePercent, true, sourceName and "darkgreen") end @@ -3811,7 +3789,7 @@ function damageClass.PredictedAugSpellsOnEnter(self) if (time > 0) then local uptimePercent = time / combatTime * 100 local timeString = detailsFramework:IntegerToTimer(time) - GameCooltip:AddLine("Presciece Applied: " .. amountOfPrescienceApplied, timeString .. " (" .. format("%.1f", uptimePercent) .. "%)") + GameCooltip:AddLine("Presciece Applied: " .. amountOfPrescienceApplied, timeString .. "(" .. format("%.1f", uptimePercent) .. "%)") --5199639 prescience icon GameCooltip:AddIcon([[Interface\AddOns\Details\images\spells\prescience_time]], nil, nil, iconSize, iconSize) Details:AddTooltipBackgroundStatusbar(false, time/totalTimeWithPrescienceUp*100, true, "green") @@ -3890,7 +3868,7 @@ end ---------TOOLTIPS BIFURCA��O -- ~tooltip -function damageClass:ToolTip (instance, numero, barra, keydown) +function damageClass:ToolTip(instance, numero, barra, keydown) --seria possivel aqui colocar o icone da classe dele? if (instance.atributo == 5) then --custom @@ -3899,13 +3877,13 @@ function damageClass:ToolTip (instance, numero, barra, keydown) if (instance.sub_atributo == 1 or instance.sub_atributo == 2) then --damage done or Dps or enemy return self:ToolTip_DamageDone(instance, numero, barra, keydown) - elseif (instance.sub_atributo == 3) then --damage taken + elseif(instance.sub_atributo == 3) then --damage taken return self:ToolTip_DamageTaken(instance, numero, barra, keydown) - elseif (instance.sub_atributo == 6) then --enemies + elseif(instance.sub_atributo == 6) then --enemies return self:ToolTip_Enemies(instance, numero, barra, keydown) - elseif (instance.sub_atributo == 4) then --friendly fire + elseif(instance.sub_atributo == 4) then --friendly fire return self:ToolTip_FriendlyFire(instance, numero, barra, keydown) end end @@ -3914,10 +3892,11 @@ end --tooltip locals local r, g, b local barAlha = .6 +Details222.commprefixes = "Comm" ---------DAMAGE DONE & DPS -function damageClass:ToolTip_DamageDone (instancia, numero, barra, keydown) +function damageClass:ToolTip_DamageDone(instancia, numero, barra, keydown) local owner = self.owner if (owner and owner.classe) then r, g, b = unpack(Details.class_colors [owner.classe]) @@ -3954,7 +3933,7 @@ function damageClass:ToolTip_DamageDone (instancia, numero, barra, keydown) local meu_tempo if (Details.time_type == 1 or not self.grupo) then meu_tempo = self:Tempo() - elseif (Details.time_type == 2 or Details.use_realtimedps) then + elseif(Details.time_type == 2 or Details.use_realtimedps) then meu_tempo = instancia.showing:GetCombatTime() end @@ -3975,7 +3954,7 @@ function damageClass:ToolTip_DamageDone (instancia, numero, barra, keydown) --add actor pets for petIndex, petName in ipairs(self:Pets()) do - local petActor = instancia.showing[class_type]:PegarCombatente (nil, petName) + local petActor = instancia.showing[class_type]:PegarCombatente(nil, petName) if (petActor) then for _spellid, _skill in pairs(petActor:GetActorSpells()) do local formattedPetName = petName:gsub((" <.*"), "") @@ -4007,21 +3986,21 @@ function damageClass:ToolTip_DamageDone (instancia, numero, barra, keydown) local tooltip_max_abilities = Details.tooltip.tooltip_max_abilities local is_maximized = false - if (keydown == "shift" or TooltipMaximizedMethod == 2 or TooltipMaximizedMethod == 3) then + if (keydown == "shift" or tooltipMaximizedMethod == 2 or tooltipMaximizedMethod == 3) then tooltip_max_abilities = 99 is_maximized = true end --MOSTRA HABILIDADES - --Details:AddTooltipSpellHeaderText (Loc ["STRING_SPELLS"], headerColor, #ActorSkillsSortTable, Details.tooltip_spell_icon.file, unpack(Details.tooltip_spell_icon.coords)) + --Details:AddTooltipSpellHeaderText(Loc ["STRING_SPELLS"], headerColor, #ActorSkillsSortTable, Details.tooltip_spell_icon.file, unpack(Details.tooltip_spell_icon.coords)) if (is_maximized) then --highlight shift key - --GameCooltip:AddIcon ([[Interface\AddOns\Details\images\key_shift]], 1, 2, Details.tooltip_key_size_width, Details.tooltip_key_size_height, 0, 1, 0, 0.640625, Details.tooltip_key_overlay2) - --Details:AddTooltipHeaderStatusbar (r, g, b, 1) + --GameCooltip:AddIcon([[Interface\AddOns\Details\images\key_shift]], 1, 2, Details.tooltip_key_size_width, Details.tooltip_key_size_height, 0, 1, 0, 0.640625, Details.tooltip_key_overlay2) + --Details:AddTooltipHeaderStatusbar(r, g, b, 1) else - --GameCooltip:AddIcon ([[Interface\AddOns\Details\images\key_shift]], 1, 2, Details.tooltip_key_size_width, Details.tooltip_key_size_height, 0, 1, 0, 0.640625, Details.tooltip_key_overlay1) - --Details:AddTooltipHeaderStatusbar (r, g, b, barAlha) + --GameCooltip:AddIcon([[Interface\AddOns\Details\images\key_shift]], 1, 2, Details.tooltip_key_size_width, Details.tooltip_key_size_height, 0, 1, 0, 0.640625, Details.tooltip_key_overlay1) + --Details:AddTooltipHeaderStatusbar(r, g, b, barAlha) end GameCooltip:SetOption("AlignAsBlizzTooltip", false) @@ -4031,7 +4010,7 @@ function damageClass:ToolTip_DamageDone (instancia, numero, barra, keydown) local topAbility = ActorSkillsSortTable [1] and ActorSkillsSortTable [1][2] or 0.0001 if (#ActorSkillsSortTable > 0) then - for i = 1, _math_min(tooltip_max_abilities, #ActorSkillsSortTable) do + for i = 1, math.min(tooltip_max_abilities, #ActorSkillsSortTable) do local SkillTable = ActorSkillsSortTable [i] @@ -4044,9 +4023,9 @@ function damageClass:ToolTip_DamageDone (instancia, numero, barra, keydown) if (petName) then if (not nome_magia) then spellID = spellID or "spellId?" - nome_magia = "|cffffaa00" .. spellID .. " " .. " (|cFFCCBBBB" .. petName .. "|r)" + nome_magia = "|cffffaa00" .. spellID .. " " .. "(|cFFCCBBBB" .. petName .. "|r)" else - nome_magia = nome_magia .. " (|cFFCCBBBB" .. petName .. "|r)" + nome_magia = nome_magia .. "(|cFFCCBBBB" .. petName .. "|r)" end end @@ -4056,13 +4035,13 @@ function damageClass:ToolTip_DamageDone (instancia, numero, barra, keydown) end if (instancia.sub_atributo == 1 or instancia.sub_atributo == 6) then - GameCooltip:AddLine(nome_magia, FormatTooltipNumber (_, totalDamage) .." ("..percent.."%)") + GameCooltip:AddLine(nome_magia, formatTooltipNumber(_, totalDamage) .." ("..percent.."%)") else - GameCooltip:AddLine(nome_magia, FormatTooltipNumber (_, _math_floor(totalDPS)) .." ("..percent.."%)") + GameCooltip:AddLine(nome_magia, formatTooltipNumber(_, math.floor(totalDPS)) .." ("..percent.."%)") end - GameCooltip:AddIcon (icone_magia, nil, nil, iconSize, iconSize, icon_border.L, icon_border.R, icon_border.T, icon_border.B) - Details:AddTooltipBackgroundStatusbar (false, totalDamage/topAbility*100) + GameCooltip:AddIcon(icone_magia, nil, nil, iconSize, iconSize, icon_border.L, icon_border.R, icon_border.T, icon_border.B) + Details:AddTooltipBackgroundStatusbar(false, totalDamage/topAbility*100) end else GameCooltip:AddLine(Loc ["STRING_NO_SPELL"]) @@ -4071,9 +4050,9 @@ function damageClass:ToolTip_DamageDone (instancia, numero, barra, keydown) --spell reflected if (#reflectionSpells > 0) then --small blank space - Details:AddTooltipSpellHeaderText ("", headerColor, 1, false, 0.1, 0.9, 0.1, 0.9, true) --add a space - Details:AddTooltipSpellHeaderText ("Spells Reflected", headerColor, 1, select(3, _GetSpellInfo(reflectionSpells[1].id)), 0.1, 0.9, 0.1, 0.9) --localize-me - Details:AddTooltipHeaderStatusbar (r, g, b, barAlha) + Details:AddTooltipSpellHeaderText("", headerColor, 1, false, 0.1, 0.9, 0.1, 0.9, true) --add a space + Details:AddTooltipSpellHeaderText("Spells Reflected", headerColor, 1, select(3, _GetSpellInfo(reflectionSpells[1].id)), 0.1, 0.9, 0.1, 0.9) --localize-me + Details:AddTooltipHeaderStatusbar(r, g, b, barAlha) for i = 1, #reflectionSpells do local _spell = reflectionSpells[i] @@ -4082,15 +4061,15 @@ function damageClass:ToolTip_DamageDone (instancia, numero, barra, keydown) local spellName, _, spellIcon = _GetSpellInfo(spellId) if (spellName) then - GameCooltip:AddLine(spellName, FormatTooltipNumber (_, damageDone) .. " (" .. _math_floor(damageDone / self.total * 100) .. "%)") - Details:AddTooltipBackgroundStatusbar (false, damageDone / self.total * 100) - GameCooltip:AddIcon (spellIcon, 1, 1, iconSize, iconSize, 0.1, 0.9, 0.1, 0.9) + GameCooltip:AddLine(spellName, formatTooltipNumber(_, damageDone) .. "(" .. math.floor(damageDone / self.total * 100) .. "%)") + Details:AddTooltipBackgroundStatusbar(false, damageDone / self.total * 100) + GameCooltip:AddIcon(spellIcon, 1, 1, iconSize, iconSize, 0.1, 0.9, 0.1, 0.9) end end end end - --targets (enemies) + --targets(enemies) local topEnemy = ActorTargetsSortTable[1] and ActorTargetsSortTable[1][2] or 0 if (instancia.sub_atributo == 1 or instancia.sub_atributo == 6) then --small blank space @@ -4100,7 +4079,7 @@ function damageClass:ToolTip_DamageDone (instancia, numero, barra, keydown) local max_targets = Details.tooltip.tooltip_max_targets local is_maximized = false - if (keydown == "ctrl" or TooltipMaximizedMethod == 2 or TooltipMaximizedMethod == 4) then + if (keydown == "ctrl" or tooltipMaximizedMethod == 2 or tooltipMaximizedMethod == 4) then max_targets = 99 is_maximized = true end @@ -4116,7 +4095,7 @@ function damageClass:ToolTip_DamageDone (instancia, numero, barra, keydown) for i = 1, math.min(max_targets, #ActorTargetsSortTable) do local enemyTable = ActorTargetsSortTable[i] - GameCooltip:AddLine(enemyTable[1], FormatTooltipNumber(_, enemyTable[2]) .." ("..format("%.1f", enemyTable[2] / ActorDamageWithPet * 100).."%)") + GameCooltip:AddLine(enemyTable[1], formatTooltipNumber(_, enemyTable[2]) .."("..format("%.1f", enemyTable[2] / ActorDamageWithPet * 100).."%)") local portraitTexture-- = Details222.Textures.GetPortraitTextureForNpcID(enemyTable[3]) --disabled atm if (portraitTexture) then @@ -4157,7 +4136,7 @@ function damageClass:ToolTip_DamageDone (instancia, numero, barra, keydown) local timeInCombat = 0 if (Details.time_type == 1 or not self.grupo) then timeInCombat = petActorObject:Tempo() - elseif (Details.time_type == 2 or Details.use_realtimedps) then + elseif(Details.time_type == 2 or Details.use_realtimedps) then timeInCombat = petActorObject:GetCombatTime() end @@ -4187,23 +4166,23 @@ function damageClass:ToolTip_DamageDone (instancia, numero, barra, keydown) table.sort(petDamageTable, Details.Sort2) local ismaximized = false - if (keydown == "alt" or TooltipMaximizedMethod == 2 or TooltipMaximizedMethod == 5) then + if (keydown == "alt" or tooltipMaximizedMethod == 2 or tooltipMaximizedMethod == 5) then ismaximized = true end local topPetDamageDone = petDamageTable[1] and petDamageTable[1][2] or 0 for index, damageTable in ipairs(petDamageTable) do - if (damageTable [2] > 0 and (index <= Details.tooltip.tooltip_max_pets or ismaximized)) then + if (damageTable [2] > 0 and(index <= Details.tooltip.tooltip_max_pets or ismaximized)) then if (not petHeaderAdded) then petHeaderAdded = true Details:AddTooltipSpellHeaderText(Loc ["STRING_PETS"], headerColor, #petDamageTable, [[Interface\COMMON\friendship-heart]], 0.21875, 0.78125, 0.09375, 0.6875) if (ismaximized) then - GameCooltip:AddIcon ([[Interface\AddOns\Details\images\key_alt]], 1, 2, Details.tooltip_key_size_width, Details.tooltip_key_size_height, 0, 1, 0, 0.640625, Details.tooltip_key_overlay2) + GameCooltip:AddIcon([[Interface\AddOns\Details\images\key_alt]], 1, 2, Details.tooltip_key_size_width, Details.tooltip_key_size_height, 0, 1, 0, 0.640625, Details.tooltip_key_overlay2) Details:AddTooltipHeaderStatusbar(r, g, b, 1) else - GameCooltip:AddIcon ([[Interface\AddOns\Details\images\key_alt]], 1, 2, Details.tooltip_key_size_width, Details.tooltip_key_size_height, 0, 1, 0, 0.640625, Details.tooltip_key_overlay1) + GameCooltip:AddIcon([[Interface\AddOns\Details\images\key_alt]], 1, 2, Details.tooltip_key_size_width, Details.tooltip_key_size_height, 0, 1, 0, 0.640625, Details.tooltip_key_overlay1) Details:AddTooltipHeaderStatusbar(r, g, b, barAlha) end end @@ -4219,9 +4198,9 @@ function damageClass:ToolTip_DamageDone (instancia, numero, barra, keydown) end if (instancia.sub_atributo == 1) then - GameCooltip:AddLine(petName, FormatTooltipNumber(_, petDamageDone) .. " (" .. math.floor(petDamageDone/self.total*100) .. "%)") + GameCooltip:AddLine(petName, formatTooltipNumber(_, petDamageDone) .. "(" .. math.floor(petDamageDone/self.total*100) .. "%)") else - GameCooltip:AddLine(petName, FormatTooltipNumber(_, math.floor(petDPS)) .. " (" .. math.floor(petDamageDone/self.total*100) .. "%)") + GameCooltip:AddLine(petName, formatTooltipNumber(_, math.floor(petDPS)) .. "(" .. math.floor(petDamageDone/self.total*100) .. "%)") end Details:AddTooltipBackgroundStatusbar(false, petDamageDone / topPetDamageDone * 100) @@ -4240,10 +4219,10 @@ function damageClass:ToolTip_DamageDone (instancia, numero, barra, keydown) if (#phasesInfo > 1) then --small blank space - Details:AddTooltipSpellHeaderText ("", headerColor, 1, false, 0.1, 0.9, 0.1, 0.9, true) + Details:AddTooltipSpellHeaderText("", headerColor, 1, false, 0.1, 0.9, 0.1, 0.9, true) - Details:AddTooltipSpellHeaderText ("Damage by Encounter Phase", headerColor, 1, [[Interface\Garrison\orderhall-missions-mechanic8]], 11/64, 53/64, 11/64, 53/64) --localize-me - Details:AddTooltipHeaderStatusbar (r, g, b, barAlha) + Details:AddTooltipSpellHeaderText("Damage by Encounter Phase", headerColor, 1, [[Interface\Garrison\orderhall-missions-mechanic8]], 11/64, 53/64, 11/64, 53/64) --localize-me + Details:AddTooltipHeaderStatusbar(r, g, b, barAlha) local playerPhases = {} local totalDamage = 0 @@ -4255,7 +4234,7 @@ function damageClass:ToolTip_DamageDone (instancia, numero, barra, keydown) tinsert(allPlayers, {playerName, amount}) totalDamage = totalDamage + amount end - table.sort (allPlayers, function(a, b) return a[2] > b[2] end) + table.sort(allPlayers, function(a, b) return a[2] > b[2] end) local myRank = 0 for i = 1, #allPlayers do @@ -4265,15 +4244,15 @@ function damageClass:ToolTip_DamageDone (instancia, numero, barra, keydown) end end - tinsert(playerPhases, {phase, playersTable [self.nome] or 0, myRank, (playersTable [self.nome] or 0) / totalDamage * 100}) + tinsert(playerPhases, {phase, playersTable [self.nome] or 0, myRank,(playersTable [self.nome] or 0) / totalDamage * 100}) end - table.sort (playerPhases, function(a, b) return a[1] < b[1] end) + table.sort(playerPhases, function(a, b) return a[1] < b[1] end) for i = 1, #playerPhases do --[1] Phase Number [2] Amount Done [3] Rank [4] Percent - GameCooltip:AddLine("|cFFF0F0F0Phase|r " .. playerPhases [i][1], FormatTooltipNumber (_, playerPhases [i][2]) .. " (|cFFFFFF00#" .. playerPhases [i][3] .. "|r, " .. format("%.1f", playerPhases [i][4]) .. "%)") - GameCooltip:AddIcon ([[Interface\Garrison\orderhall-missions-mechanic9]], 1, 1, 14, 14, 11/64, 53/64, 11/64, 53/64) + GameCooltip:AddLine("|cFFF0F0F0Phase|r " .. playerPhases [i][1], formatTooltipNumber(_, playerPhases [i][2]) .. "(|cFFFFFF00#" .. playerPhases [i][3] .. "|r, " .. format("%.1f", playerPhases [i][4]) .. "%)") + GameCooltip:AddIcon([[Interface\Garrison\orderhall-missions-mechanic9]], 1, 1, 14, 14, 11/64, 53/64, 11/64, 53/64) Details:AddTooltipBackgroundStatusbar() end end @@ -4294,9 +4273,9 @@ local on_switch_show_frags = function(instance) end local ENEMIES_format_name = function(player) if (player == 0) then return false end return Details:GetOnlyName(player.nome) end -local ENEMIES_format_amount = function(amount) if (amount <= 0) then return false end return Details:ToK(amount) .. " (" .. format("%.1f", amount / tooltip_temp_table.damage_total * 100) .. "%)" end +local ENEMIES_format_amount = function(amount) if (amount <= 0) then return false end return Details:ToK(amount) .. "(" .. format("%.1f", amount / tooltip_temp_table.damage_total * 100) .. "%)" end -function damageClass:ReportEnemyDamageTaken (actor, instance, ShiftKeyDown, ControlKeyDown, fromFrags) +function damageClass:ReportEnemyDamageTaken(actor, instance, ShiftKeyDown, ControlKeyDown, fromFrags) --can open the breakdown window now --this function is deprecated @@ -4342,28 +4321,28 @@ function damageClass:ReportEnemyDamageTaken (actor, instance, ShiftKeyDown, Cont local report_table = {"Details!: " .. actor.nome .. " - " .. Loc ["STRING_ATTRIBUTE_DAMAGE_TAKEN"]} - Details:FormatReportLines (report_table, tooltip_temp_table, ENEMIES_format_name, ENEMIES_format_amount) + Details:FormatReportLines(report_table, tooltip_temp_table, ENEMIES_format_name, ENEMIES_format_amount) - return Details:Reportar (report_table, {_no_current = true, _no_inverse = true, _custom = true}) + return Details:Reportar(report_table, {_no_current = true, _no_inverse = true, _custom = true}) end local FRAGS_format_name = function(player_name) return Details:GetOnlyName(player_name) end -local FRAGS_format_amount = function(amount) return Details:ToK(amount) .. " (" .. format("%.1f", amount / frags_tooltip_table.damage_total * 100) .. "%)" end +local FRAGS_format_amount = function(amount) return Details:ToK(amount) .. "(" .. format("%.1f", amount / frags_tooltip_table.damage_total * 100) .. "%)" end -function damageClass:ReportSingleFragsLine (frag, instance, ShiftKeyDown, ControlKeyDown) +function damageClass:ReportSingleFragsLine(frag, instance, ShiftKeyDown, ControlKeyDown) if (not frags_tooltip_table) then --some cases a friendly object is getting threat as neutral, example is Druid's Efflorescense return end if (ShiftKeyDown) then - return damageClass:ReportEnemyDamageTaken (frag, instance, ShiftKeyDown, ControlKeyDown, true) + return damageClass:ReportEnemyDamageTaken(frag, instance, ShiftKeyDown, ControlKeyDown, true) end local report_table = {"Details!: " .. frag [1] .. " - " .. Loc ["STRING_ATTRIBUTE_DAMAGE_TAKEN"]} - Details:FormatReportLines (report_table, frags_tooltip_table, FRAGS_format_name, FRAGS_format_amount) + Details:FormatReportLines(report_table, frags_tooltip_table, FRAGS_format_name, FRAGS_format_amount) - return Details:Reportar (report_table, {_no_current = true, _no_inverse = true, _custom = true}) + return Details:Reportar(report_table, {_no_current = true, _no_inverse = true, _custom = true}) end ---@param self actor @@ -4400,7 +4379,7 @@ function damageClass:ToolTip_Enemies(instanceObject, numero, barra, keydown) end agressorsTable[1] = actor - agressorsTable[2] = (actor.targets[enemyName]) or 0 + agressorsTable[2] =(actor.targets[enemyName]) or 0 damageTaken = damageTaken + agressorsTable[2] i = i + 1 @@ -4413,10 +4392,10 @@ function damageClass:ToolTip_Enemies(instanceObject, numero, barra, keydown) t[1] = 0 end - _table_sort(tooltip_temp_table, Details.Sort2) + table.sort(tooltip_temp_table, Details.Sort2) --build the tooltip - local top = (tooltip_temp_table[1] and tooltip_temp_table[1][2]) or 0 + local top =(tooltip_temp_table[1] and tooltip_temp_table[1][2]) or 0 tooltip_temp_table.damage_total = damageTaken local iconSize = Details.DefaultTooltipIconSize @@ -4428,7 +4407,7 @@ function damageClass:ToolTip_Enemies(instanceObject, numero, barra, keydown) local damageDone = tooltip_temp_table[o][2] local playerName = Details:GetOnlyName(actorAggressor:name()) - GameCooltip:AddLine(playerName .. " ", FormatTooltipNumber (_, damageDone) .." (" .. format("%.1f", (damageDone / damageTaken) * 100) .. "%)") + GameCooltip:AddLine(playerName .. " ", formatTooltipNumber(_, damageDone) .."(" .. format("%.1f",(damageDone / damageTaken) * 100) .. "%)") local classe = actorAggressor:class() if (not classe) then @@ -4455,19 +4434,19 @@ function damageClass:ToolTip_Enemies(instanceObject, numero, barra, keydown) --damage done and heal GameCooltip:AddLine(" ") - GameCooltip:AddLine(Loc ["STRING_ATTRIBUTE_DAMAGE_ENEMIES_DONE"], FormatTooltipNumber (_, _math_floor(self.total))) + GameCooltip:AddLine(Loc ["STRING_ATTRIBUTE_DAMAGE_ENEMIES_DONE"], formatTooltipNumber(_, math.floor(self.total))) local half = 0.00048828125 - GameCooltip:AddIcon (instanceObject:GetSkinTexture(), 1, 1, 14, 14, 0.005859375 + half, 0.025390625 - half, 0.3623046875, 0.3818359375) - GameCooltip:AddStatusBar (0, 1, r, g, b, 1, false, enemies_background) + GameCooltip:AddIcon(instanceObject:GetSkinTexture(), 1, 1, 14, 14, 0.005859375 + half, 0.025390625 - half, 0.3623046875, 0.3818359375) + GameCooltip:AddStatusBar(0, 1, r, g, b, 1, false, enemies_background) - local heal_actor = instanceObject.showing (2, self.nome) + local heal_actor = instanceObject.showing(2, self.nome) if (heal_actor) then - GameCooltip:AddLine(Loc ["STRING_ATTRIBUTE_HEAL_ENEMY"], FormatTooltipNumber (_, _math_floor(heal_actor.heal_enemy_amt))) + GameCooltip:AddLine(Loc ["STRING_ATTRIBUTE_HEAL_ENEMY"], formatTooltipNumber(_, math.floor(heal_actor.heal_enemy_amt))) else GameCooltip:AddLine(Loc ["STRING_ATTRIBUTE_HEAL_ENEMY"], 0) end - GameCooltip:AddIcon (instanceObject:GetSkinTexture(), 1, 1, 14, 14, 0.037109375 + half, 0.056640625 - half, 0.3623046875, 0.3818359375) - GameCooltip:AddStatusBar (0, 1, r, g, b, 1, false, enemies_background) + GameCooltip:AddIcon(instanceObject:GetSkinTexture(), 1, 1, 14, 14, 0.037109375 + half, 0.056640625 - half, 0.3623046875, 0.3818359375) + GameCooltip:AddStatusBar(0, 1, r, g, b, 1, false, enemies_background) GameCooltip:AddLine(" ") Details:AddTooltipReportLineText() @@ -4547,7 +4526,7 @@ function damageClass:ToolTip_DamageTaken(instance, numero, barra, keydown) end local bIsMaximized = false - if (keydown == "shift" or TooltipMaximizedMethod == 2 or TooltipMaximizedMethod == 3 or instance.sub_atributo == 6 or Details.damage_taken_everything) then + if (keydown == "shift" or tooltipMaximizedMethod == 2 or tooltipMaximizedMethod == 3 or instance.sub_atributo == 6 or Details.damage_taken_everything) then maxDataAllowed = #damageTakenDataSorted bIsMaximized = true end @@ -4629,7 +4608,7 @@ function damageClass:ToolTip_DamageTaken(instance, numero, barra, keydown) local spellId, valueAmount, thisActorName = unpack(spell) local spellName, _, spellIcon = _GetSpellInfo(spellId) - local addTextArgs = {spellName .. " (|cFFFFFF00" .. thisActorName .. "|r)", Details:Format(valueAmount) .. " (" .. string.format("%.1f", (valueAmount / totalDamageTaken) * 100) .. "%)"} + local addTextArgs = {spellName .. "(|cFFFFFF00" .. thisActorName .. "|r)", Details:Format(valueAmount) .. "(" .. string.format("%.1f",(valueAmount / totalDamageTaken) * 100) .. "%)"} ---@type cooltip_icon local addIconArgs = {spellIcon, 1, 1, iconSize, iconSize, iconBorderTexCoord.L, iconBorderTexCoord.R, iconBorderTexCoord.T, iconBorderTexCoord.B} @@ -4654,9 +4633,9 @@ function damageClass:ToolTip_DamageTaken(instance, numero, barra, keydown) local aggressorName = Details:GetOnlyName(actorName) if (bIsMaximized and actorName:find(Details.playername)) then - addLineArgs = {aggressorName, Details:Format(amount) .. " ("..string.format("%.1f", (amount / totalDamageTaken) * 100) .. "%)", nil, "yellow"} + addLineArgs = {aggressorName, Details:Format(amount) .. "("..string.format("%.1f",(amount / totalDamageTaken) * 100) .. "%)", nil, "yellow"} else - addLineArgs = {aggressorName, Details:Format(amount) .. " ("..string.format("%.1f", (amount / totalDamageTaken) * 100) .. "%)"} + addLineArgs = {aggressorName, Details:Format(amount) .. "("..string.format("%.1f",(amount / totalDamageTaken) * 100) .. "%)"} end if (not class) then @@ -4682,18 +4661,18 @@ function damageClass:ToolTip_DamageTaken(instance, numero, barra, keydown) if (subAttribute == DETAILS_SUBATTRIBUTE_ENEMIES) then GameCooltip:AddLine(" ") - GameCooltip:AddLine(Loc ["STRING_ATTRIBUTE_DAMAGE_DONE"], FormatTooltipNumber (_, _math_floor(self.total))) + GameCooltip:AddLine(Loc ["STRING_ATTRIBUTE_DAMAGE_DONE"], formatTooltipNumber(_, math.floor(self.total))) local half = 0.00048828125 - GameCooltip:AddIcon (instance:GetSkinTexture(), 1, 1, iconSize, iconSize, 0.005859375 + half, 0.025390625 - half, 0.3623046875, 0.3818359375) + GameCooltip:AddIcon(instance:GetSkinTexture(), 1, 1, iconSize, iconSize, 0.005859375 + half, 0.025390625 - half, 0.3623046875, 0.3818359375) Details:AddTooltipBackgroundStatusbar() - local heal_actor = instance.showing (2, self.nome) + local heal_actor = instance.showing(2, self.nome) if (heal_actor) then - GameCooltip:AddLine(Loc ["STRING_ATTRIBUTE_HEAL_DONE"], FormatTooltipNumber (_, _math_floor(heal_actor.heal_enemy_amt))) + GameCooltip:AddLine(Loc ["STRING_ATTRIBUTE_HEAL_DONE"], formatTooltipNumber(_, math.floor(heal_actor.heal_enemy_amt))) else GameCooltip:AddLine(Loc ["STRING_ATTRIBUTE_HEAL_DONE"], 0) end - GameCooltip:AddIcon (instance:GetSkinTexture(), 1, 1, iconSize, iconSize, 0.037109375 + half, 0.056640625 - half, 0.3623046875, 0.3818359375) + GameCooltip:AddIcon(instance:GetSkinTexture(), 1, 1, iconSize, iconSize, 0.037109375 + half, 0.056640625 - half, 0.3623046875, 0.3818359375) Details:AddTooltipBackgroundStatusbar() end @@ -4701,7 +4680,7 @@ function damageClass:ToolTip_DamageTaken(instance, numero, barra, keydown) end ---------FRIENDLY FIRE -function damageClass:ToolTip_FriendlyFire (instancia, numero, barra, keydown) +function damageClass:ToolTip_FriendlyFire(instancia, numero, barra, keydown) local owner = self.owner if (owner and owner.classe) then @@ -4725,27 +4704,27 @@ function damageClass:ToolTip_FriendlyFire (instancia, numero, barra, keydown) local Skills = {} for target_name, ff_table in pairs(FriendlyFire) do - local actor = combat (1, target_name) + local actor = combat(1, target_name) if (actor) then DamagedPlayers [#DamagedPlayers+1] = {target_name, ff_table.total, actor.classe} for spellid, amount in pairs(ff_table.spells) do - Skills [spellid] = (Skills [spellid] or 0) + amount + Skills [spellid] =(Skills [spellid] or 0) + amount end end end - _table_sort(DamagedPlayers, Details.Sort2) + table.sort(DamagedPlayers, Details.Sort2) - Details:AddTooltipSpellHeaderText (Loc ["STRING_TARGETS"], headerColor, #DamagedPlayers, Details.tooltip_target_icon.file, unpack(Details.tooltip_target_icon.coords)) + Details:AddTooltipSpellHeaderText(Loc ["STRING_TARGETS"], headerColor, #DamagedPlayers, Details.tooltip_target_icon.file, unpack(Details.tooltip_target_icon.coords)) local ismaximized = false - if (keydown == "shift" or TooltipMaximizedMethod == 2 or TooltipMaximizedMethod == 3) then - GameCooltip:AddIcon ([[Interface\AddOns\Details\images\key_shift]], 1, 2, Details.tooltip_key_size_width, Details.tooltip_key_size_height, 0, 1, 0, 0.640625, Details.tooltip_key_overlay2) - Details:AddTooltipHeaderStatusbar (r, g, b, 1) + if (keydown == "shift" or tooltipMaximizedMethod == 2 or tooltipMaximizedMethod == 3) then + GameCooltip:AddIcon([[Interface\AddOns\Details\images\key_shift]], 1, 2, Details.tooltip_key_size_width, Details.tooltip_key_size_height, 0, 1, 0, 0.640625, Details.tooltip_key_overlay2) + Details:AddTooltipHeaderStatusbar(r, g, b, 1) ismaximized = true else - GameCooltip:AddIcon ([[Interface\AddOns\Details\images\key_shift]], 1, 2, Details.tooltip_key_size_width, Details.tooltip_key_size_height, 0, 1, 0, 0.640625, Details.tooltip_key_overlay1) - Details:AddTooltipHeaderStatusbar (r, g, b, barAlha) + GameCooltip:AddIcon([[Interface\AddOns\Details\images\key_shift]], 1, 2, Details.tooltip_key_size_width, Details.tooltip_key_size_height, 0, 1, 0, 0.640625, Details.tooltip_key_overlay1) + Details:AddTooltipHeaderStatusbar(r, g, b, barAlha) end local max_abilities = Details.tooltip.tooltip_max_abilities @@ -4753,40 +4732,40 @@ function damageClass:ToolTip_FriendlyFire (instancia, numero, barra, keydown) max_abilities = 99 end - for i = 1, _math_min(max_abilities, #DamagedPlayers) do + for i = 1, math.min(max_abilities, #DamagedPlayers) do local classe = DamagedPlayers[i][3] if (not classe) then classe = "UNKNOW" end - GameCooltip:AddLine(Details:GetOnlyName(DamagedPlayers[i][1]), FormatTooltipNumber (_, DamagedPlayers[i][2]).." ("..format("%.1f", DamagedPlayers[i][2]/FriendlyFireTotal*100).."%)") - GameCooltip:AddIcon ("Interface\\AddOns\\Details\\images\\espadas", nil, nil, lineHeight, lineHeight) + GameCooltip:AddLine(Details:GetOnlyName(DamagedPlayers[i][1]), formatTooltipNumber(_, DamagedPlayers[i][2]).."("..format("%.1f", DamagedPlayers[i][2]/FriendlyFireTotal*100).."%)") + GameCooltip:AddIcon("Interface\\AddOns\\Details\\images\\espadas", nil, nil, lineHeight, lineHeight) Details:AddTooltipBackgroundStatusbar() if (classe == "UNKNOW") then - GameCooltip:AddIcon ("Interface\\AddOns\\Details\\images\\classes_small", nil, nil, lineHeight, lineHeight, unpack(Details.class_coords ["UNKNOW"])) + GameCooltip:AddIcon("Interface\\AddOns\\Details\\images\\classes_small", nil, nil, lineHeight, lineHeight, unpack(Details.class_coords ["UNKNOW"])) else local specID = Details:GetSpec(DamagedPlayers[i][1]) if (specID) then - local texture, l, r, t, b = Details:GetSpecIcon (specID, false) - GameCooltip:AddIcon (texture, 1, 1, lineHeight, lineHeight, l, r, t, b) + local texture, l, r, t, b = Details:GetSpecIcon(specID, false) + GameCooltip:AddIcon(texture, 1, 1, lineHeight, lineHeight, l, r, t, b) else - GameCooltip:AddIcon ("Interface\\AddOns\\Details\\images\\classes_small", nil, nil, lineHeight, lineHeight, unpack(Details.class_coords [classe])) + GameCooltip:AddIcon("Interface\\AddOns\\Details\\images\\classes_small", nil, nil, lineHeight, lineHeight, unpack(Details.class_coords [classe])) end end end - Details:AddTooltipSpellHeaderText (Loc ["STRING_SPELLS"], headerColor, 1, Details.tooltip_spell_icon.file, unpack(Details.tooltip_spell_icon.coords)) + Details:AddTooltipSpellHeaderText(Loc ["STRING_SPELLS"], headerColor, 1, Details.tooltip_spell_icon.file, unpack(Details.tooltip_spell_icon.coords)) local ismaximized = false - if (keydown == "ctrl" or TooltipMaximizedMethod == 2 or TooltipMaximizedMethod == 4) then - GameCooltip:AddIcon ([[Interface\AddOns\Details\images\key_ctrl]], 1, 2, Details.tooltip_key_size_width, Details.tooltip_key_size_height, 0, 1, 0, 0.640625, Details.tooltip_key_overlay2) - Details:AddTooltipHeaderStatusbar (r, g, b, 1) + if (keydown == "ctrl" or tooltipMaximizedMethod == 2 or tooltipMaximizedMethod == 4) then + GameCooltip:AddIcon([[Interface\AddOns\Details\images\key_ctrl]], 1, 2, Details.tooltip_key_size_width, Details.tooltip_key_size_height, 0, 1, 0, 0.640625, Details.tooltip_key_overlay2) + Details:AddTooltipHeaderStatusbar(r, g, b, 1) ismaximized = true else - GameCooltip:AddIcon ([[Interface\AddOns\Details\images\key_ctrl]], 1, 2, Details.tooltip_key_size_width, Details.tooltip_key_size_height, 0, 1, 0, 0.640625, Details.tooltip_key_overlay1) - Details:AddTooltipHeaderStatusbar (r, g, b, barAlha) + GameCooltip:AddIcon([[Interface\AddOns\Details\images\key_ctrl]], 1, 2, Details.tooltip_key_size_width, Details.tooltip_key_size_height, 0, 1, 0, 0.640625, Details.tooltip_key_overlay1) + Details:AddTooltipHeaderStatusbar(r, g, b, barAlha) end local max_abilities2 = Details.tooltip.tooltip_max_abilities @@ -4799,12 +4778,12 @@ function damageClass:ToolTip_FriendlyFire (instancia, numero, barra, keydown) for spellID, amount in pairs(Skills) do SpellsInOrder [#SpellsInOrder+1] = {spellID, amount} end - _table_sort(SpellsInOrder, Details.Sort2) + table.sort(SpellsInOrder, Details.Sort2) - for i = 1, _math_min(max_abilities2, #SpellsInOrder) do + for i = 1, math.min(max_abilities2, #SpellsInOrder) do local nome, _, icone = _GetSpellInfo(SpellsInOrder[i][1]) - GameCooltip:AddLine(nome, FormatTooltipNumber (_, SpellsInOrder[i][2]).." ("..format("%.1f", SpellsInOrder[i][2]/FriendlyFireTotal*100).."%)") - GameCooltip:AddIcon (icone, nil, nil, icon_size.W, icon_size.H, icon_border.L, icon_border.R, icon_border.T, icon_border.B) + GameCooltip:AddLine(nome, formatTooltipNumber(_, SpellsInOrder[i][2]).."("..format("%.1f", SpellsInOrder[i][2]/FriendlyFireTotal*100).."%)") + GameCooltip:AddIcon(icone, nil, nil, icon_size.W, icon_size.H, icon_border.L, icon_border.R, icon_border.T, icon_border.B) Details:AddTooltipBackgroundStatusbar() end @@ -4819,29 +4798,29 @@ end function damageClass:MontaInfo() if (breakdownWindowFrame.sub_atributo == 1 or breakdownWindowFrame.sub_atributo == 2 or breakdownWindowFrame.sub_atributo == 6) then --damage done & dps return self:MontaInfoDamageDone() --has new code for the new destails window | left scroll and 6 blocks implemented - elseif (breakdownWindowFrame.sub_atributo == 3) then --damage taken + elseif(breakdownWindowFrame.sub_atributo == 3) then --damage taken return self:MontaInfoDamageTaken() --has new code for the new destails window | left and right scrolls implemented - elseif (breakdownWindowFrame.sub_atributo == 4) then --friendly fire - return self:MontaInfoFriendlyFire() --has new code for the new destails window | left scroll implemeneted (need to implemente the right scroll yet) + elseif(breakdownWindowFrame.sub_atributo == 4) then --friendly fire + return self:MontaInfoFriendlyFire() --has new code for the new destails window | left scroll implemeneted(need to implemente the right scroll yet) end end ---------DETALHES bloco da direita BIFURCA��O -function damageClass:MontaDetalhes (spellid, barra, instancia) --these functions were used to fill the 5 blocks from the old breakdown window +function damageClass:MontaDetalhes(spellid, barra, instancia) --these functions were used to fill the 5 blocks from the old breakdown window if (breakdownWindowFrame.sub_atributo == 1 or breakdownWindowFrame.sub_atributo == 2) then - return self:MontaDetalhesDamageDone (spellid, barra, instancia) --deprecated + return self:MontaDetalhesDamageDone(spellid, barra, instancia) --deprecated - elseif (breakdownWindowFrame.sub_atributo == 3) then - return self:MontaDetalhesDamageTaken (spellid, barra, instancia) + elseif(breakdownWindowFrame.sub_atributo == 3) then + return self:MontaDetalhesDamageTaken(spellid, barra, instancia) - elseif (breakdownWindowFrame.sub_atributo == 4) then - return self:MontaDetalhesFriendlyFire (spellid, barra, instancia) + elseif(breakdownWindowFrame.sub_atributo == 4) then + return self:MontaDetalhesFriendlyFire(spellid, barra, instancia) - elseif (breakdownWindowFrame.sub_atributo == 6) then + elseif(breakdownWindowFrame.sub_atributo == 6) then if (bitBand(self.flag_original, 0x00000400) ~= 0) then --� um jogador - return self:MontaDetalhesDamageDone (spellid, barra, instancia) --deprecated + return self:MontaDetalhesDamageDone(spellid, barra, instancia) --deprecated end - return self:MontaDetalhesEnemy (spellid, barra, instancia) + return self:MontaDetalhesEnemy(spellid, barra, instancia) end end @@ -4933,20 +4912,20 @@ function damageClass:MontaInfoFriendlyFire() --~friendlyfire ~friendly ~ff for target_name, ff_table in pairs(self.friendlyfire) do - local actor = combat (1, target_name) + local actor = combat(1, target_name) if (actor) then tinsert(DamagedPlayers, {target_name, ff_table.total, ff_table.total / FriendlyFireTotal * 100, actor.classe}) for spellid, amount in pairs(ff_table.spells) do - Skills [spellid] = (Skills [spellid] or 0) + amount + Skills [spellid] =(Skills [spellid] or 0) + amount end end end - _table_sort(DamagedPlayers, Details.Sort2) + table.sort(DamagedPlayers, Details.Sort2) local amt = #DamagedPlayers - gump:JI_AtualizaContainerBarras (amt) + gump:JI_AtualizaContainerBarras(amt) local FirstPlaceDamage = DamagedPlayers [1] and DamagedPlayers [1][2] or 0 @@ -4954,7 +4933,7 @@ function damageClass:MontaInfoFriendlyFire() --~friendlyfire ~friendly ~ff local barra = barras [index] if (not barra) then - barra = gump:CriaNovaBarraInfo1 (instancia, index) + barra = gump:CriaNovaBarraInfo1(instancia, index) barra.textura:SetStatusBarColor(1, 1, 1, 1) barra.on_focus = false end @@ -4984,7 +4963,7 @@ function damageClass:MontaInfoFriendlyFire() --~friendlyfire ~friendly ~ff end barra.lineText1:SetText(index .. instancia.divisores.colocacao .. Details:GetOnlyName(tabela[1])) --seta o texto da esqueda - barra.lineText4:SetText(Details:comma_value (tabela[2]) .. " (" .. format("%.1f", tabela[3]) .."%)") --seta o texto da direita + barra.lineText4:SetText(Details:comma_value(tabela[2]) .. "(" .. format("%.1f", tabela[3]) .."%)") --seta o texto da direita local classe = tabela[4] if (not classe) then @@ -5011,7 +4990,7 @@ function damageClass:MontaInfoFriendlyFire() --~friendlyfire ~friendly ~ff barra:Show() if (self.detalhes and self.detalhes == barra.show) then - self:MontaDetalhes (self.detalhes, barra, instancia) + self:MontaDetalhes(self.detalhes, barra, instancia) end end @@ -5021,14 +5000,14 @@ function damageClass:MontaInfoFriendlyFire() --~friendlyfire ~friendly ~ff SkillTable [#SkillTable+1] = {nome, amt, amt/FriendlyFireTotal*100, icone} end - _table_sort(SkillTable, Details.Sort2) + table.sort(SkillTable, Details.Sort2) amt = #SkillTable if (amt < 1) then return end - gump:JI_AtualizaContainerAlvos (amt) + gump:JI_AtualizaContainerAlvos(amt) FirstPlaceDamage = SkillTable [1] and SkillTable [1][2] or 0 @@ -5036,7 +5015,7 @@ function damageClass:MontaInfoFriendlyFire() --~friendlyfire ~friendly ~ff local barra = barras2 [index] if (not barra) then - barra = gump:CriaNovaBarraInfo2 (instancia, index) + barra = gump:CriaNovaBarraInfo2(instancia, index) barra.textura:SetStatusBarColor(1, 1, 1, 1) end @@ -5047,7 +5026,7 @@ function damageClass:MontaInfoFriendlyFire() --~friendlyfire ~friendly ~ff end barra.lineText1:SetText(index..instancia.divisores.colocacao..tabela[1]) --seta o texto da esqueda - barra.lineText4:SetText(Details:comma_value (tabela[2]) .." (" ..format("%.1f", tabela[3]) .. ")") --seta o texto da direita + barra.lineText4:SetText(Details:comma_value(tabela[2]) .."(" ..format("%.1f", tabela[3]) .. ")") --seta o texto da direita barra.icone:SetTexture(tabela[4]) barra.minha_tabela = nil --desativa o tooltip @@ -5168,7 +5147,7 @@ end if (type(index) == "number") then if (debugmode) then - row.lineText1:SetText(index .. ". " .. name .. " (" .. spellId .. ")") + row.lineText1:SetText(index .. ". " .. name .. "(" .. spellId .. ")") else row.lineText1:SetText(index .. ". " .. name) end @@ -5179,7 +5158,7 @@ end row.lineText1.text = row.lineText1:GetText() if (formattedValue) then - row.lineText4:SetText(formattedValue .. " (" .. format("%.1f", percent) .."%)") + row.lineText4:SetText(formattedValue .. "(" .. format("%.1f", percent) .."%)") end row.lineText1:SetSize(row:GetWidth() - row.lineText4:GetStringWidth() - 40, 15) @@ -5221,7 +5200,7 @@ end row.textura:SetStatusBarColor(1, 1, 1) end - elseif (class) then + elseif(class) then local color = Details.class_colors[class] if (color and class ~= "UNKNOW") then row.textura:SetStatusBarColor(unpack(color)) @@ -5305,13 +5284,13 @@ local getSpellDetails = function(unitGUID, spellName) --deprecated newSpellTable[key] = value end - elseif (key == "n_max" or key == "c_max") then + elseif(key == "n_max" or key == "c_max") then if (value > newSpellTable[key]) then newSpellTable[key] = value end - elseif (key ~= "id" and key ~= "spellschool") then - newSpellTable[key] = (newSpellTable[key] or 0) + value + elseif(key ~= "id" and key ~= "spellschool") then + newSpellTable[key] =(newSpellTable[key] or 0) + value end end end @@ -5325,22 +5304,18 @@ local getSpellDetails = function(unitGUID, spellName) --deprecated end end - ---[=[ - current: passando todas as spells para o breakdown, até mesmo as spells que não tem merge é enviado a spell total e a a spellTable logo em seguida - isso forma uma array com o dobro do tamanho e spells duplicadas - - passar as spells repetidas em uma segunda array? - - não passar nada e deixar o sistema aprender sozinho, como o sistema vai saber que precisa por uma arrow na linha? (para expandi-la) - - +--[= +_detalhes.string_size = UIParent:CreateFontString(nil, "overlay", "GameFontNormal") +_detalhes.string_size:SetText("MMMMMMMMMMMM") --12 M's - max playername in width +_detalhes.string_size_default = _detalhes.string_size:GetStringWidth() +Details.numbertostring = numbertostring --]=] +--I guess this fills the list of spells in the topleft scrollBar in the summary tab +--the goal of this function is to build a list of spells the actor used and send the data to Details! which will delivery to the summary tab actived +--so the script only need to build the list of spells and send it to Details! ------ Damage Done & Dps -function damageClass:MontaInfoDamageDone() --I guess this fills the list of spells in the topleft scrollBar in the summary tab - --the goal of this function is to build a list of spells the actor used and send the data to Details! which will delivery to the summary tab actived - --so the script only need to build the list of spells and send it to Details! +function damageClass:MontaInfoDamageDone() ---@type actor local actorObject = self ---@type instance @@ -5357,7 +5332,7 @@ function damageClass:MontaInfoDamageDone() --I guess this fills the list of spel --guild ranking on a boss --check if is a raid encounter and if is heroic or mythic do - if (diff and (diff == 15 or diff == 16)) then --this might give errors + if (diff and(diff == 15 or diff == 16)) then --this might give errors local db = Details.OpenStorage() if (db) then ---@type details_storage_unitresult, details_encounterkillinfo @@ -5365,8 +5340,8 @@ function damageClass:MontaInfoDamageDone() --I guess this fills the list of spel if (bestRank) then --discover which are the player position in the guild rank local rankPosition = Details222.storage.GetUnitGuildRank(diffEngName, combatObject:GetBossInfo().id, "DAMAGER", playerName, true) - local text1 = playerName .. " Guild Rank on " .. (combatObject:GetBossInfo().name or "") .. ": |cFFFFFF00" .. (rankPosition or "x") .. "|r Best Dps: |cFFFFFF00" .. Details:ToK2((bestRank.total or SMALL_NUMBER) / encounterTable.elapsed) .. "|r (" .. encounterTable.date:gsub(".*%s", "") .. ")" - breakdownWindowFrame:SetStatusbarText (text1, 10, "gray") + local text1 = playerName .. " Guild Rank on " ..(combatObject:GetBossInfo().name or "") .. ": |cFFFFFF00" ..(rankPosition or "x") .. "|r Best Dps: |cFFFFFF00" .. Details:ToK2((bestRank.total or SMALL_NUMBER) / encounterTable.elapsed) .. "|r(" .. encounterTable.date:gsub(".*%s", "") .. ")" + breakdownWindowFrame:SetStatusbarText(text1, 10, "gray") else breakdownWindowFrame:SetStatusbarText() end @@ -5394,7 +5369,7 @@ function damageClass:MontaInfoDamageDone() --I guess this fills the list of spel local actorCombatTime if (Details.time_type == 1 or not actorObject.grupo) then actorCombatTime = actorObject:Tempo() - elseif (Details.time_type == 2 or Details.use_realtimedps) then + elseif(Details.time_type == 2 or Details.use_realtimedps) then actorCombatTime = breakdownWindowFrame.instancia.showing:GetCombatTime() end @@ -5579,7 +5554,7 @@ function damageClass:MontaInfoDamageDone() --I guess this fills the list of spel --to be deprecated and removed: - --gump:JI_AtualizaContainerBarras (#actorSpellsSorted + 1) + --gump:JI_AtualizaContainerBarras(#actorSpellsSorted + 1) local max_ = breakdownSpellDataList[1] and breakdownSpellDataList[1][2] or 0 --dano que a primeiro magia vez local barra @@ -5588,7 +5563,7 @@ function damageClass:MontaInfoDamageDone() --I guess this fills the list of spel if (false) then --disabled for now barra = allLines [1] if (not barra) then - barra = gump:CriaNovaBarraInfo1 (instance, 1) + barra = gump:CriaNovaBarraInfo1(instance, 1) end self:UpdadeInfoBar(barra, "", -51, "Auras", max_, false, max_, 100, [[Interface\BUTTONS\UI-GroupLoot-DE-Up]], true, nil, nil) barra.textura:SetStatusBarColor(Details.gump:ParseColors("purple")) @@ -5601,7 +5576,7 @@ function damageClass:MontaInfoDamageDone() --I guess this fills the list of spel index = index barra = allLines [index] if (not barra) then - barra = gump:CriaNovaBarraInfo1 (instance, index) + barra = gump:CriaNovaBarraInfo1(instance, index) end barra.other_actor = tabela [6] @@ -5609,10 +5584,10 @@ function damageClass:MontaInfoDamageDone() --I guess this fills the list of spel local name = tabela[4] if (breakdownWindowFrame.sub_atributo == 2) then - local formated_value = SelectedToKFunction(_, _math_floor(tabela[2]/actorCombatTime)) + local formated_value = selectedToKFunction(_, math.floor(tabela[2]/actorCombatTime)) self:UpdadeInfoBar(barra, index, tabela[1], name, tabela[2], formated_value, max_, tabela[3], tabela[5], true, nil, tabela [7]) else - local formated_value = SelectedToKFunction(_, _math_floor(tabela[2])) + local formated_value = selectedToKFunction(_, math.floor(tabela[2])) self:UpdadeInfoBar(barra, index, tabela[1], name, tabela[2], formated_value, max_, tabela[3], tabela[5], true, nil, tabela [7]) end @@ -5658,7 +5633,7 @@ function damageClass:MontaInfoDamageDone() --I guess this fills the list of spel thisLine = barras[index] if (not thisLine) then --se a barra n�o existir, criar ela ent�o - thisLine = gump:CriaNovaBarraInfo2 (instance, index) + thisLine = gump:CriaNovaBarraInfo2(instance, index) thisLine.textura:SetStatusBarColor(1, 1, 1, 1) --isso aqui � a parte da sele��o e descele��o end @@ -5669,7 +5644,7 @@ function damageClass:MontaInfoDamageDone() --I guess this fills the list of spel end thisLine.lineText1:SetText(index .. ". " .. Details:GetOnlyName(thisEnemyTable[1])) --left text - thisLine.lineText4:SetText(Details:comma_value (thisEnemyTable[2]) .. " (" .. format("%.1f", thisEnemyTable[3]) .. "%)") --right text + thisLine.lineText4:SetText(Details:comma_value(thisEnemyTable[2]) .. "(" .. format("%.1f", thisEnemyTable[3]) .. "%)") --right text thisLine.icone:SetTexture([[Interface\AddOns\Details\images\classes_small_alpha]]) --class icon @@ -5767,14 +5742,14 @@ function damageClass:MontaInfoDamageDone() --I guess this fills the list of spel barra.lineText1:SetText(index .. ". " .. Details:GetOnlyName(targetName)) if (breakdownWindowFrame.sub_atributo == 2) then - barra.lineText4:SetText(Details:comma_value ( _math_floor(targetTable[2]/actorCombatTime)) .. " (" .. format("%.1f", targetTable[3]) .. "%)") + barra.lineText4:SetText(Details:comma_value( math.floor(targetTable[2]/actorCombatTime)) .. "(" .. format("%.1f", targetTable[3]) .. "%)") else - barra.lineText4:SetText(SelectedToKFunction(_, targetTable[2]) .." (" .. format("%.1f", targetTable[3]) .. "%)") + barra.lineText4:SetText(selectedToKFunction(_, targetTable[2]) .."(" .. format("%.1f", targetTable[3]) .. "%)") end if (barra.mouse_over) then --atualizar o tooltip if (barra.isAlvo) then - if (not barra.minha_tabela:MontaTooltipAlvos (barra, index, instance)) then + if (not barra.minha_tabela:MontaTooltipAlvos(barra, index, instance)) then return end end @@ -5792,7 +5767,7 @@ end ------ Detalhe Info Friendly Fire -function damageClass:MontaDetalhesFriendlyFire (nome, barra) +function damageClass:MontaDetalhesFriendlyFire(nome, barra) local barras = breakdownWindowFrame.barras3 local instancia = breakdownWindowFrame.instancia @@ -5815,7 +5790,7 @@ function damageClass:MontaDetalhesFriendlyFire (nome, barra) tinsert(minhas_magias, {spellid, amount, amount / total * 100, nome, icone}) end - _table_sort(minhas_magias, Details.Sort2) + table.sort(minhas_magias, Details.Sort2) local max_ = minhas_magias[1] and minhas_magias[1][2] or 0 --dano que a primeiro magia vez local lastIndex = 1 @@ -5825,7 +5800,7 @@ function damageClass:MontaDetalhesFriendlyFire (nome, barra) barra = barras [index] if (not barra) then --se a barra n�o existir, criar ela ent�o - barra = gump:CriaNovaBarraInfo3 (instancia, index) + barra = gump:CriaNovaBarraInfo3(instancia, index) barra.textura:SetStatusBarColor(1, 1, 1, 1) --isso aqui � a parte da sele��o e descele��o end @@ -5838,7 +5813,7 @@ function damageClass:MontaDetalhesFriendlyFire (nome, barra) end barra.lineText1:SetText(index..instancia.divisores.colocacao..tabela[4]) --seta o texto da esqueda - barra.lineText4:SetText(Details:comma_value (tabela[2]) .. " " .. instancia.divisores.abre .. format("%.1f", tabela[3]) .. "%" .. instancia.divisores.fecha) --seta o texto da direita + barra.lineText4:SetText(Details:comma_value(tabela[2]) .. " " .. instancia.divisores.abre .. format("%.1f", tabela[3]) .. "%" .. instancia.divisores.fecha) --seta o texto da direita barra.icone:SetTexture(tabela[5]) barra.icone:SetTexCoord(0, 1, 0, 1) @@ -5857,7 +5832,7 @@ function damageClass:MontaDetalhesFriendlyFire (nome, barra) end -- detalhes info enemies -function damageClass:MontaDetalhesEnemy (spellid, barra) +function damageClass:MontaDetalhesEnemy(spellid, barra) local container = breakdownWindowFrame.instancia.showing[1] local barras = breakdownWindowFrame.barras3 @@ -5876,14 +5851,14 @@ function damageClass:MontaDetalhesEnemy (spellid, barra) GameCooltip:ShowCooltip() end - local spell = self.spells:PegaHabilidade (spellid) + local spell = self.spells:PegaHabilidade(spellid) local targets = spell.targets local target_pool = {} for target_name, amount in pairs(targets) do local classe - local this_actor = breakdownWindowFrame.instancia.showing (1, target_name) + local this_actor = breakdownWindowFrame.instancia.showing(1, target_name) if (this_actor) then classe = this_actor.classe or "UNKNOW" else @@ -5893,7 +5868,7 @@ function damageClass:MontaDetalhesEnemy (spellid, barra) target_pool [#target_pool+1] = {target_name, amount, classe} end - _table_sort(target_pool, Details.Sort2) + table.sort(target_pool, Details.Sort2) local max_ = target_pool [1] and target_pool [1][2] or 0 @@ -5904,7 +5879,7 @@ function damageClass:MontaDetalhesEnemy (spellid, barra) barra = barras [index] if (not barra) then --se a barra n�o existir, criar ela ent�o - barra = gump:CriaNovaBarraInfo3 (instancia, index) + barra = gump:CriaNovaBarraInfo3(instancia, index) barra.textura:SetStatusBarColor(1, 1, 1, 1) --isso aqui � a parte da sele��o e descele��o end @@ -5917,12 +5892,12 @@ function damageClass:MontaDetalhesEnemy (spellid, barra) end barra.lineText1:SetText(index .. ". " .. Details:GetOnlyName(tabela [1])) --seta o texto da esqueda - Details:name_space_info (barra) + Details:name_space_info(barra) if (spell.total > 0) then - barra.lineText4:SetText(Details:comma_value (tabela[2]) .." (".. format("%.1f", tabela[2] / spell.total * 100) .."%)") --seta o texto da direita + barra.lineText4:SetText(Details:comma_value(tabela[2]) .."(".. format("%.1f", tabela[2] / spell.total * 100) .."%)") --seta o texto da direita else - barra.lineText4:SetText(tabela[2] .." (0%)") --seta o texto da direita + barra.lineText4:SetText(tabela[2] .."(0%)") --seta o texto da direita end local texCoords = Details.class_coords [tabela[3]] @@ -5955,7 +5930,7 @@ function damageClass:MontaDetalhesEnemy (spellid, barra) end ------ Detalhe Info Damage Taken -function damageClass:MontaDetalhesDamageTaken (nome, barra) +function damageClass:MontaDetalhesDamageTaken(nome, barra) local barras = breakdownWindowFrame.barras3 local instancia = breakdownWindowFrame.instancia @@ -5985,10 +5960,10 @@ function damageClass:MontaDetalhesDamageTaken (nome, barra) end end - _table_sort(minhas_magias, Details.Sort2) + table.sort(minhas_magias, Details.Sort2) --local amt = #minhas_magias - --gump:JI_AtualizaContainerBarras (amt) + --gump:JI_AtualizaContainerBarras(amt) local max_ = minhas_magias[1] and minhas_magias[1][2] or 0 --dano que a primeiro magia vez @@ -5999,7 +5974,7 @@ function damageClass:MontaDetalhesDamageTaken (nome, barra) barra = barras [index] if (not barra) then --se a barra n�o existir, criar ela ent�o - barra = gump:CriaNovaBarraInfo3 (instancia, index) + barra = gump:CriaNovaBarraInfo3(instancia, index) barra.textura:SetStatusBarColor(1, 1, 1, 1) --isso aqui � a parte da sele��o e descele��o end @@ -6012,9 +5987,9 @@ function damageClass:MontaDetalhesDamageTaken (nome, barra) end barra.lineText1:SetText(index .. "." .. tabela[4]) --seta o texto da esqueda - Details:name_space_info (barra) + Details:name_space_info(barra) - barra.lineText4:SetText(Details:comma_value (tabela[2]) .." ".. instancia.divisores.abre ..format("%.1f", tabela[3]) .."%".. instancia.divisores.fecha) --seta o texto da direita + barra.lineText4:SetText(Details:comma_value(tabela[2]) .." ".. instancia.divisores.abre ..format("%.1f", tabela[3]) .."%".. instancia.divisores.fecha) --seta o texto da direita barra.icone:SetTexture(tabela[5]) barra.icone:SetTexCoord(0, 1, 0, 1) @@ -6029,68 +6004,17 @@ function damageClass:MontaDetalhesDamageTaken (nome, barra) for i = lastIndex+1, #barras do barras[i]:Hide() end - end ------ Detalhe Info Damage Done e Dps ---local defenses_table = {c = {117/255, 58/255, 0/255}, p = 0} ---local normal_table = {c = {255/255, 180/255, 0/255, 0.5}, p = 0} ---local critical_table = {c = {249/255, 74/255, 45/255, 0.5}, p = 0} - -local defenses_table = {c = {1, 1, 1, 0.5}, p = 0} -local normal_table = {c = {1, 1, 1, 0.5}, p = 0} -local critical_table = {c = {1, 1, 1, 0.5}, p = 0} - -local data_table = {} +local defensesTable = {c = {1, 1, 1, 0.5}, p = 0} +local normalTable = {c = {1, 1, 1, 0.5}, p = 0} +local criticalTable = {c = {1, 1, 1, 0.5}, p = 0} +local columnSizes = {67,95,67,111,109,109,101,110,116,97,116,111,114} +Details.column_sizes = columnSizes +local dataTable = {} local t1, t2, t3, t4 = {}, {}, {}, {} - -local function FormatSpellString(str) - return (string.gsub(str, "%d+", function(spellID) - local name, _, icon = GetSpellInfo(spellID); - return string.format("|T%s:16|t", icon); - end)); -end - - -local MontaDetalhesBuffProcs = function(actor, row, instance) - - instance = instance or breakdownWindowFrame.instancia - - local spec = actor.spec - if (spec) then - local mainAuras = Details.important_auras [spec] - if (mainAuras) then - local miscActor = instance:GetShowingCombat():GetActor(4, actor:name()) - if (miscActor and miscActor.buff_uptime_spells) then - --get the auras - local added = 0 - for i = 1, #mainAuras do - local spellID = mainAuras [i] - local spellObject = miscActor.buff_uptime_spells._ActorTable [spellID] - if (spellObject) then - local spellName, spellIcon = GetSpellInfo(spellID) - local spellUptime = spellObject.uptime - local spellApplies = spellObject.appliedamt - local spellRefreshes = spellObject.refreshamt - - gump:SetaDetalheInfoTexto(i, 100, FormatSpellString ("" .. spellID .. " " .. spellName), "Activations: " .. spellApplies, " ", "Refreshes: " .. spellRefreshes, " ", "Uptime: " .. spellUptime .. "s") - added = added + 1 - end - end - - for i = added + 1, 5 do - gump:HidaDetalheInfo (i) - end - - return - end - end - end - - for i = 1, 5 do - gump:HidaDetalheInfo (i) - end -end +local maxPercent = 100 ---called from the spell breakdown when a spellbar is hovered over ---@param spellBar breakdownspellbar @@ -6127,7 +6051,7 @@ function damageClass:BuildSpellDetails(spellBar, spellBlockContainer, blockIndex end end - elseif (Details.GetItemSpellInfo(spellId)) then + elseif(Details.GetItemSpellInfo(spellId)) then blockLine1.leftText:SetText("Uses: " .. totalCasts) end @@ -6187,23 +6111,23 @@ function damageClass:BuildSpellDetails(spellBar, spellBlockContainer, blockIndex blockLine1.leftText:SetText("Spell Empower Average Level: " .. string.format("%.2f", empowerLevelSum / empowerAmount)) if (level1AverageDamage ~= "0") then - blockLine2.leftText:SetText("#1 Avg: " .. level1AverageDamage .. " (" .. (empowerAmountPerLevel[1] or 0) .. ")") + blockLine2.leftText:SetText("#1 Avg: " .. level1AverageDamage .. "(" ..(empowerAmountPerLevel[1] or 0) .. ")") end if (level2AverageDamage ~= "0") then - blockLine2.centerText:SetText("#2 Avg: " .. level2AverageDamage .. " (" .. (empowerAmountPerLevel[2] or 0) .. ")") + blockLine2.centerText:SetText("#2 Avg: " .. level2AverageDamage .. "(" ..(empowerAmountPerLevel[2] or 0) .. ")") end if (level3AverageDamage ~= "0") then - blockLine2.rightText:SetText("#3 Avg: " .. level3AverageDamage .. " (" .. (empowerAmountPerLevel[3] or 0) .. ")") + blockLine2.rightText:SetText("#3 Avg: " .. level3AverageDamage .. "(" ..(empowerAmountPerLevel[3] or 0) .. ")") end if (level4AverageDamage ~= "0") then - blockLine3.leftText:SetText("#4 Avg: " .. level4AverageDamage .. " (" .. (empowerAmountPerLevel[4] or 0) .. ")") + blockLine3.leftText:SetText("#4 Avg: " .. level4AverageDamage .. "(" ..(empowerAmountPerLevel[4] or 0) .. ")") end if (level5AverageDamage ~= "0") then - blockLine3.rightText:SetText("#5 Avg: " .. level5AverageDamage .. " (" .. (empowerAmountPerLevel[5] or 0) .. ")") + blockLine3.rightText:SetText("#5 Avg: " .. level5AverageDamage .. "(" ..(empowerAmountPerLevel[5] or 0) .. ")") end end @@ -6231,7 +6155,7 @@ function damageClass:BuildSpellDetails(spellBar, spellBlockContainer, blockIndex local normalAverage = spellTable.n_total / math.max(normalHitsAmt, 0.0001) blockLine3.leftText:SetText(Loc ["STRING_AVERAGE"] .. ": " .. Details:CommaValue(normalAverage)) - local tempo = (combatTime * spellTable.n_total) / math.max(spellTable.total, 0.001) + local tempo =(combatTime * spellTable.n_total) / math.max(spellTable.total, 0.001) local normalAveragePercent = spellBar.average / normalAverage * 100 local normalTempoPercent = normalAveragePercent * tempo / 100 blockLine3.rightText:SetText(Loc ["STRING_DPS"] .. ": " .. Details:CommaValue(spellTable.n_total / normalTempoPercent)) @@ -6259,7 +6183,7 @@ function damageClass:BuildSpellDetails(spellBar, spellBlockContainer, blockIndex local critAverage = Details.SpellTableMixin.GetCritAverage(spellTable) blockLine3.leftText:SetText(Loc ["STRING_AVERAGE"] .. ": " .. Details:CommaValue(critAverage)) - local tempo = (combatTime * spellTable.c_total) / math.max(spellTable.total, 0.001) + local tempo =(combatTime * spellTable.c_total) / math.max(spellTable.total, 0.001) local critAveragePercent = spellBar.average / critAverage * 100 local critTempoPercent = critAveragePercent * tempo / 100 blockLine3.rightText:SetText(Loc ["STRING_DPS"] .. ": " .. Details:CommaValue(spellTable.c_total / critTempoPercent)) @@ -6279,7 +6203,7 @@ function damageClass:BuildSpellDetails(spellBar, spellBlockContainer, blockIndex defensesBlock:Show() blockIndex = blockIndex + 1 - local percent = (semiDodgeAmount + hitErrorsAmount) / spellTable.counter * 100 + local percent =(semiDodgeAmount + hitErrorsAmount) / spellTable.counter * 100 defensesBlock:SetValue(percent) defensesBlock.sparkTexture:SetPoint("left", defensesBlock, "left", percent / 100 * defensesBlock:GetWidth() + Details.breakdown_spell_tab.blockspell_spark_offset, 0) @@ -6304,12 +6228,6 @@ function damageClass:BuildSpellDetails(spellBar, spellBlockContainer, blockIndex end end ---[=[ percent - Loc ["STRING_GLANCING"] .. ": " .. math.floor(spellTable.g_amt / spellTable.counter * 100) .. "%" - Loc ["STRING_BLOCKED"] .. ": " .. math.floor(spellTable.b_amt / spellTable.counter * 100) .. "%" ---]=] - - if (trinketData[spellId]) then ---@type trinketdata local trinketInfo = trinketData[spellId] @@ -6338,413 +6256,6 @@ function damageClass:BuildSpellDetails(spellBar, spellBlockContainer, blockIndex end end ---this build p the 6 rectangle boxes in the right side of the breakdown window summary tab -function damageClass:MontaDetalhesDamageDone (spellId, spellLine, instance) --this should be ~deprecated with the new breakdown tab - - print("MontaDetalhesDamageDone - deprecated", debugstack()) - - local spellTable - if (spellLine.other_actor) then - spellTable = spellLine.other_actor.spells._ActorTable [spellId] - --self = spellLine.other_actor - else - spellTable = self.spells._ActorTable [spellId] - end - - if (spellId == -51) then - return MontaDetalhesBuffProcs(self, spellLine, instance) - end - - if (not spellTable) then - return - end - - local spellName, _, icone = _GetSpellInfo(spellId) - - local bShouldMergePlayerAbilities = Details.merge_player_abilities - local bShouldMergePetAbilities = Details.merge_pet_abilities - - if (bShouldMergePlayerAbilities or bShouldMergePetAbilities) then - local mergedSpellTable = getSpellDetails(self:GetGUID(), spellName) --it's not merging - if (mergedSpellTable) then - spellTable = mergedSpellTable - end - end - - Details.BreakdownWindowFrame.spell_icone:SetTexture(icone) - - local total = self.total - - local meu_tempo - if (Details.time_type == 1 or not self.grupo) then - meu_tempo = self:Tempo() - - elseif (Details.time_type == 2 or Details.use_realtimedps) then - meu_tempo = breakdownWindowFrame.instancia.showing:GetCombatTime() - end - - local total_hits = spellTable.counter - - local index = 1 - local data = data_table - - Details:Destroy(t1) - Details:Destroy(t2) - Details:Destroy(t3) - Details:Destroy(t4) - Details:Destroy(data) - - --GERAL - local media = 0 - if (total_hits > 0) then - media = spellTable.total/total_hits - end - - local this_dps = nil - if (spellTable.counter > spellTable.c_amt) then - this_dps = Loc ["STRING_DPS"] .. ": " .. Details:comma_value (spellTable.total/meu_tempo) - else - this_dps = Loc ["STRING_DPS"] .. ": " .. Loc ["STRING_SEE_BELOW"] - end - - local spellschool, schooltext = spellTable.spellschool, "" - if (spellschool) then - local t = Details.spells_school [spellschool] - if (t and t.name) then - schooltext = t.formated - end - end - - local hits_string = "" .. total_hits - local cast_string = Loc ["STRING_CAST"] .. ": " - - local misc_actor = breakdownWindowFrame.instancia.showing (4, self:name()) - if (misc_actor) then - local uptime_spellid = spellTable.id - local debuff_uptime = misc_actor.debuff_uptime_spells and misc_actor.debuff_uptime_spells._ActorTable [uptime_spellid] and misc_actor.debuff_uptime_spells._ActorTable [uptime_spellid].uptime - if (debuff_uptime) then - hits_string = hits_string .. " |cFFDDDD44(" .. _math_floor(debuff_uptime / breakdownWindowFrame.instancia.showing:GetCombatTime() * 100) .. "% uptime)|r" - end - - local amountOfCasts = breakdownWindowFrame.instancia.showing:GetSpellCastAmount(self:Name(), spellName) - if (amountOfCasts == 0) then - amountOfCasts = "(|cFFFFFF00?|r)" - end - cast_string = cast_string .. amountOfCasts - end - - if (spellTable.e_total) then - cast_string = Loc ["STRING_CAST"] .. ": " .. "|cFFFFFF00" .. spellTable.e_total .. "|r" - end - - gump:SetaDetalheInfoTexto( index, 100, - cast_string, - Loc ["STRING_DAMAGE"]..": "..Details:ToK(spellTable.total), - schooltext, --offhand, - Loc ["STRING_AVERAGE"] .. ": " .. Details:comma_value (media), - this_dps, - Loc ["STRING_HITS"]..": " .. hits_string - ) - - --NORMAL - local normal_hits = spellTable.n_amt - if (normal_hits > 0) then - local normal_dmg = spellTable.n_total - local media_normal = normal_dmg/normal_hits - local T = (meu_tempo*normal_dmg)/ max(spellTable.total, 0.001) - local P = media/media_normal*100 - T = P*T/100 - - normal_table.p = normal_hits/total_hits*100 - - data[#data+1] = t1 - - t1[1] = spellTable.n_amt - t1[2] = normal_table - t1[3] = Loc ["STRING_NORMAL_HITS"] - t1[4] = Loc ["STRING_MINIMUM_SHORT"] .. ": " .. Details:comma_value (spellTable.n_min) - t1[5] = Loc ["STRING_MAXIMUM_SHORT"] .. ": " .. Details:comma_value (spellTable.n_max) - t1[6] = Loc ["STRING_AVERAGE"] .. ": " .. Details:comma_value (media_normal) - t1[7] = Loc ["STRING_DPS"] .. ": " .. Details:comma_value (normal_dmg/T) - t1[8] = normal_hits .. " [|cFFC0C0C0" .. format("%.1f", normal_hits/max(total_hits, 0.0001)*100) .. "%|r]" - t1[9] = "" - end - - --CRITICO - if (spellTable.c_amt > 0) then - local media_critico = spellTable.c_total/spellTable.c_amt - local T = (meu_tempo*spellTable.c_total)/spellTable.total - local P = media/max(media_critico, 0.0001)*100 - T = P*T/100 - local crit_dps = spellTable.c_total/T - if (not crit_dps) then - crit_dps = 0 - end - - critical_table.p = spellTable.c_amt/total_hits*100 - - data[#data+1] = t2 - - t2[1] = spellTable.c_amt - t2[2] = critical_table - t2[3] = Loc ["STRING_CRITICAL_HITS"] - t2[4] = Loc ["STRING_MINIMUM_SHORT"] .. ": " .. Details:comma_value (spellTable.c_min) - t2[5] = Loc ["STRING_MAXIMUM_SHORT"] .. ": " .. Details:comma_value (spellTable.c_max) - t2[6] = Loc ["STRING_AVERAGE"] .. ": " .. Details:comma_value (media_critico) - t2[7] = Loc ["STRING_DPS"] .. ": " .. Details:comma_value (crit_dps) - t2[8] = spellTable.c_amt .. " [|cFFC0C0C0" .. format("%.1f", spellTable.c_amt/total_hits*100) .. "%|r]" - t2[9] = "" - end - - --Outros erros: GLACING, resisted, blocked, absorbed - local outros_desvios = spellTable.g_amt + spellTable.b_amt - local parry = spellTable ["PARRY"] or 0 - local dodge = spellTable ["DODGE"] or 0 - local misses = spellTable ["MISS"] or 0 - - local erros = parry + dodge + misses - - if (outros_desvios > 0 or erros > 0) then - local porcentagem_defesas = (outros_desvios + erros) / total_hits * 100 - - data[#data+1] = t3 - defenses_table.p = porcentagem_defesas - - t3[1] = outros_desvios+erros - t3[2] = defenses_table - t3[3] = Loc ["STRING_DEFENSES"] - t3[4] = Loc ["STRING_GLANCING"] .. ": " .. _math_floor(spellTable.g_amt/spellTable.counter*100) .. "%" - t3[5] = Loc ["STRING_PARRY"] .. ": " .. parry - t3[6] = Loc ["STRING_DODGE"] .. ": " .. dodge - t3[7] = Loc ["STRING_BLOCKED"] .. ": " .. _math_floor(spellTable.b_amt/spellTable.counter*100) - t3[8] = (outros_desvios+erros) .. " / " .. format("%.1f", porcentagem_defesas) .. "%" - t3[9] = "MISS" .. ": " .. misses - end - - --~empowered - if (spellTable.e_total) then - local empowerLevelSum = spellTable.e_total --total sum of empower levels - local empowerAmount = spellTable.e_amt --amount of casts with empower - local empowerAmountPerLevel = spellTable.e_lvl --{[1] = 4; [2] = 9; [3] = 15} - local empowerDamagePerLevel = spellTable.e_dmg --{[1] = 54548745, [2] = 74548745} - - data[#data+1] = t4 - - local level1AverageDamage = "0" - local level2AverageDamage = "0" - local level3AverageDamage = "0" - local level4AverageDamage = "0" - local level5AverageDamage = "0" - - if (empowerDamagePerLevel[1]) then - level1AverageDamage = Details:ToK(empowerDamagePerLevel[1] / empowerAmountPerLevel[1]) - end - if (empowerDamagePerLevel[2]) then - level2AverageDamage = Details:ToK(empowerDamagePerLevel[2] / empowerAmountPerLevel[2]) - end - if (empowerDamagePerLevel[3]) then - level3AverageDamage = Details:ToK(empowerDamagePerLevel[3] / empowerAmountPerLevel[3]) - end - if (empowerDamagePerLevel[4]) then - level4AverageDamage = Details:ToK(empowerDamagePerLevel[4] / empowerAmountPerLevel[4]) - end - if (empowerDamagePerLevel[5]) then - level5AverageDamage = Details:ToK(empowerDamagePerLevel[5] / empowerAmountPerLevel[5]) - end - - t4[1] = 0 - t4[2] = {p = 100, c = {0.200, 0.576, 0.498, 0.6}} - t4[3] = "Spell Empower Average Level: " .. format("%.2f", empowerLevelSum / empowerAmount) - t4[4] = "" - t4[5] = "" - t4[6] = "" - t4[10] = "" - t4[11] = "" - - if (level1AverageDamage ~= "0") then - t4[4] = "Level 1 Avg: " .. level1AverageDamage .. " (" .. (empowerAmountPerLevel[1] or 0) .. ")" - end - - if (level2AverageDamage ~= "0") then - t4[6] = "Level 2 Avg: " .. level2AverageDamage .. " (" .. (empowerAmountPerLevel[2] or 0) .. ")" - end - - if (level3AverageDamage ~= "0") then - t4[11] = "Level 3 Avg: " .. level3AverageDamage .. " (" .. (empowerAmountPerLevel[3] or 0) .. ")" - end - - if (level4AverageDamage ~= "0") then - t4[10] = "Level 4 Avg: " .. level4AverageDamage .. " (" .. (empowerAmountPerLevel[4] or 0) .. ")" - end - - if (level5AverageDamage ~= "0") then - t4[5] = "Level 5 Avg: " .. level5AverageDamage .. " (" .. (empowerAmountPerLevel[5] or 0) .. ")" - end - end - - --Details:BuildPlayerDetailsSpellChart() - --DetailsPlayerDetailSmallChart.ShowChart (Details.BreakdownWindowFrame.grupos_detalhes [5].bg, info.instancia.showing, info.instancia.showing.cleu_events, self.nome, false, spellid, 1, 2, 3, 4, 5, 6, 7, 8, 15) - - --spell damage chart - --events: 1 2 3 4 5 6 7 8 15 - local spellTable = spellTable - - local blockId = 6 - - if false then --debug the stuff for the chart damage done in the 6th spellblock - --GetBlockIndex doesn't exists anymore - local thatRectangle66 = Details222.BreakdownWindow.GetBlockIndex(blockId) - thatRectangle66 = thatRectangle66:GetFrame() - - --hide all textures created - if (thatRectangle66.ChartTextures) then - for i = 1, #thatRectangle66.ChartTextures do - thatRectangle66.ChartTextures[i]:Hide() - end - end - - local chartData = Details222.TimeCapture.GetChartDataFromSpell(spellTable) - if (chartData and instance) then - local width, height = thatRectangle66:GetSize() - --reset which texture is the next to be used - thatRectangle66.nextChartTextureId = 1 - - local amountOfTimeStamps = 12 - - if (not thatRectangle66.timeStamps) then - thatRectangle66.timeStamps = {} - for i = 1, amountOfTimeStamps do - thatRectangle66.timeStamps[i] = thatRectangle66:CreateFontString(nil, "overlay", "GameFontNormal") - thatRectangle66.timeStamps[i]:SetPoint("topleft", thatRectangle66, "topleft", 2 + (i - 1) * (width / amountOfTimeStamps), -2) - DetailsFramework:SetFontSize(thatRectangle66.timeStamps[i], 9) - end - end - - if (not thatRectangle66.bloodLustIndicators) then - thatRectangle66.bloodLustIndicators = {} - for i = 1, 5 do - local thisIndicator = thatRectangle66:CreateTexture(nil, "artwork", nil, 4) - thisIndicator:SetColorTexture(0.0980392, 0.0980392, 0.439216) - thatRectangle66.bloodLustIndicators[#thatRectangle66.bloodLustIndicators+1] = thisIndicator - end - end - - for i = 1, #thatRectangle66.bloodLustIndicators do - thatRectangle66.bloodLustIndicators[i]:Hide() - end - - if (not thatRectangle66.ChartTextures) then - thatRectangle66.ChartTextures = {} - function thatRectangle66:GetChartTexture() - local thisTexture = thatRectangle66.ChartTextures[thatRectangle66.nextChartTextureId] - if (not thisTexture) then - thisTexture = thatRectangle66:CreateTexture(nil, "artwork", nil, 5) - thisTexture:SetColorTexture(1, 1, 1, 0.65) - thatRectangle66.ChartTextures[thatRectangle66.nextChartTextureId] = thisTexture - end - thatRectangle66.nextChartTextureId = thatRectangle66.nextChartTextureId + 1 - - return thisTexture - end - end - - --elapsed combat time - local combatObject = instance:GetShowingCombat() - local combatTime = math.floor(combatObject:GetCombatTime()) - thatRectangle66.timeStamps[1]:SetText(DetailsFramework:IntegerToTimer(0)) - for i = 2, #thatRectangle66.timeStamps do - local timePerSegment = combatTime / #thatRectangle66.timeStamps - thatRectangle66.timeStamps[i]:SetText(DetailsFramework:IntegerToTimer(i * timePerSegment)) - end - --compute the width oif each texture - local textureWidth = width / combatTime - --compute the max height of a texture can have - local maxValue = 0 - local numData = 0 - - --need to put the data in order FIRST - --each damage then need to be parsed - - local dataInOrder = {} - - local CONST_INDEX_TIMESTAMP = 1 - local CONST_INDEX_DAMAGEDONE = 2 - local CONST_INDEX_EVENTDAMAGE = 3 - - for timeStamp, value in pairs(chartData) do - dataInOrder[#dataInOrder+1] = {timeStamp, value} - dataInOrder[#dataInOrder+1] = {timeStamp, value} - dataInOrder[#dataInOrder+1] = {timeStamp, value} - numData = numData + 1 - end - - table.sort(dataInOrder, function(t1, t2) return t1[CONST_INDEX_TIMESTAMP] < t2[CONST_INDEX_TIMESTAMP] end) - local damageDoneByTime = dataInOrder - - --parser the damage done - local currentTotalDamage = 0 - - for i = 1, #damageDoneByTime do - local damageEvent = damageDoneByTime[i] - - local atTime = damageEvent[CONST_INDEX_TIMESTAMP] - local totalDamageUntilHere = damageEvent[CONST_INDEX_DAMAGEDONE] --raw damage - - local spellDamage = totalDamageUntilHere - currentTotalDamage - currentTotalDamage = currentTotalDamage + spellDamage - - damageEvent[CONST_INDEX_EVENTDAMAGE] = spellDamage - - maxValue = math.max(spellDamage, maxValue) - end - - --build the chart - for i = 1, #damageDoneByTime do - --for timeStamp, value in pairs(chartData) do --as it is pairs the data is scattered - local damageEvent = damageDoneByTime[i] - local timeStamp = damageEvent[CONST_INDEX_TIMESTAMP] - local damageDone = damageEvent[CONST_INDEX_EVENTDAMAGE] - - local thisTexture = thatRectangle66:GetChartTexture() - thisTexture:SetWidth(textureWidth) - - local texturePosition = textureWidth * timeStamp - - thisTexture:SetPoint("bottomleft", thatRectangle66, "bottomleft", 1 + texturePosition, 1) - - local percentFromPeak = damageDone / maxValue --normalized - thisTexture:SetHeight(math.min(percentFromPeak * height, height - 15)) - thisTexture:Show() - end - - --show bloodlust indicators, member .bloodlust is not guarantted - if (combatObject.bloodlust) then - --bloodlust not being added into the combat object, probably a bug on Parser - local bloodlustDuration = 40 - for i = 1, #combatObject.bloodlust do - thatRectangle66.bloodLustIndicators[i]:Show() - thatRectangle66.bloodLustIndicators[i]:SetAlpha(0.46) - thatRectangle66.bloodLustIndicators[i]:SetSize(bloodlustDuration / combatTime * width, height - 2) - thatRectangle66.bloodLustIndicators[i]:SetPoint("bottomleft", thatRectangle66, "bottomleft", 0, 0) - end - end - - DetailsBreakdownWindow_DetalheInfoBG_bg_end6:Hide() - thatRectangle66:SetShown(true) - end - end - - _table_sort(data, Details.Sort1) - - for index, tabela in ipairs(data) do - gump:SetaDetalheInfoTexto(index+1, tabela[2], tabela[3], tabela[4], tabela[5], tabela[6], tabela[7], tabela[8], tabela[9], tabela[10], tabela[11], tabela[12]) - end - - for i = #data+2, 5 do - gump:HidaDetalheInfo(i) - end -end - function Details:BuildPlayerDetailsSpellChart() local playerDetailSmallChart = DetailsPlayerDetailSmallChart @@ -6761,7 +6272,7 @@ function Details:BuildPlayerDetailsSpellChart() end --Details.BreakdownWindowFrame.grupos_detalhes [index] - function playerDetailSmallChart.ShowChart (parent, combatObject, cleuData, playerName, targetName, spellId, ...) + function playerDetailSmallChart.ShowChart(parent, combatObject, cleuData, playerName, targetName, spellId, ...) local tokenIdList = {} local eventList = {} @@ -6813,7 +6324,7 @@ function Details:BuildPlayerDetailsSpellChart() for o = currentIndex, eventAmount do if (eventList [o][1] <= currentTime + secondsPerBar or eventList [o][1] >= currentTime) then - playerDetailSmallChart.Lines [i]:SetPoint("bottomleft", playerDetailSmallChart, "bottomleft", barWidth * (i - 1), 0) + playerDetailSmallChart.Lines [i]:SetPoint("bottomleft", playerDetailSmallChart, "bottomleft", barWidth *(i - 1), 0) playerDetailSmallChart.Lines [i]:SetWidth(barWidth) playerDetailSmallChart.Lines [i]:SetHeight(eventList [o][6] / peakValue * barHeight) else @@ -6828,8 +6339,8 @@ function Details:BuildPlayerDetailsSpellChart() end end -function damageClass:MontaTooltipDamageTaken (thisLine, index) - local aggressor = breakdownWindowFrame.instancia.showing [1]:PegarCombatente (_, thisLine.nome_inimigo) +function damageClass:MontaTooltipDamageTaken(thisLine, index) + local aggressor = breakdownWindowFrame.instancia.showing [1]:PegarCombatente(_, thisLine.nome_inimigo) local container = aggressor.spells._ActorTable local habilidades = {} @@ -6844,7 +6355,7 @@ function damageClass:MontaTooltipDamageTaken (thisLine, index) end end - _table_sort(habilidades, Details.Sort2) + table.sort(habilidades, Details.Sort2) GameTooltip:AddLine(index..". "..thisLine.nome_inimigo) GameTooltip:AddLine(Loc ["STRING_DAMAGE_TAKEN_FROM2"]..":") @@ -6853,18 +6364,18 @@ function damageClass:MontaTooltipDamageTaken (thisLine, index) for index, tabela in ipairs(habilidades) do local nome, _, icone = _GetSpellInfo(tabela[1]) if (index < 8) then - GameTooltip:AddDoubleLine (index..". |T"..icone..":0|t "..nome, Details:comma_value (tabela[2]).." ("..format("%.1f", tabela[2]/total*100).."%)", 1, 1, 1, 1, 1, 1) + GameTooltip:AddDoubleLine(index..". |T"..icone..":0|t "..nome, Details:comma_value(tabela[2]).."("..format("%.1f", tabela[2]/total*100).."%)", 1, 1, 1, 1, 1, 1) else - GameTooltip:AddDoubleLine (index..". "..nome, Details:comma_value (tabela[2]).." ("..format("%.1f", tabela[2]/total*100).."%)", .65, .65, .65, .65, .65, .65) + GameTooltip:AddDoubleLine(index..". "..nome, Details:comma_value(tabela[2]).."("..format("%.1f", tabela[2]/total*100).."%)", .65, .65, .65, .65, .65, .65) end end return true - --GameTooltip:AddDoubleLine (meus_danos[i][4][1]..": ", meus_danos[i][2].." (".._cstr("%.1f", meus_danos[i][3]).."%)", 1, 1, 1, 1, 1, 1) + --GameTooltip:AddDoubleLine(meus_danos[i][4][1]..": ", meus_danos[i][2].."(".._cstr("%.1f", meus_danos[i][3]).."%)", 1, 1, 1, 1, 1, 1) end -function damageClass:MontaTooltipAlvos (thisLine, index, instancia) --~deprecated +function damageClass:MontaTooltipAlvos(thisLine, index, instancia) --~deprecated local inimigo = thisLine.nome_inimigo local habilidades = {} @@ -6873,7 +6384,7 @@ function damageClass:MontaTooltipAlvos (thisLine, index, instancia) --~deprecate Details:FormatCooltipForSpells() GameCooltip:SetOwner(thisLine, "bottom", "top", 4, -2) - GameCooltip:SetOption("MinWidth", _math_max (230, thisLine:GetWidth()*0.98)) + GameCooltip:SetOption("MinWidth", math.max(230, thisLine:GetWidth()*0.98)) for spellid, spell in pairs(self.spells._ActorTable) do if (spell.isReflection) then @@ -6887,7 +6398,7 @@ function damageClass:MontaTooltipAlvos (thisLine, index, instancia) --~deprecate t = habilidades [i] end - t[1], t[2], t[3] = spellName .. " (|cFFCCBBBBreflected|r)", amount, spellIcon + t[1], t[2], t[3] = spellName .. "(|cFFCCBBBBreflected|r)", amount, spellIcon i = i + 1 end end @@ -6912,7 +6423,7 @@ function damageClass:MontaTooltipAlvos (thisLine, index, instancia) --~deprecate --add pets for _, PetName in ipairs(self.pets) do - local PetActor = instancia.showing (class_type, PetName) + local PetActor = instancia.showing(class_type, PetName) if (PetActor) then local PetSkillsContainer = PetActor.spells._ActorTable for _spellid, _skill in pairs(PetSkillsContainer) do @@ -6928,7 +6439,7 @@ function damageClass:MontaTooltipAlvos (thisLine, index, instancia) --~deprecate end local nome, _, icone = _GetSpellInfo(_spellid) - t[1], t[2], t[3] = nome .. " (" .. PetName:gsub((" <.*"), "") .. ")", amount, icone + t[1], t[2], t[3] = nome .. "(" .. PetName:gsub((" <.*"), "") .. ")", amount, icone i = i + 1 end @@ -6937,25 +6448,25 @@ function damageClass:MontaTooltipAlvos (thisLine, index, instancia) --~deprecate end end - _table_sort(habilidades, Details.Sort2) + table.sort(habilidades, Details.Sort2) --get time type local meu_tempo if (Details.time_type == 1 or not self.grupo) then meu_tempo = self:Tempo() - elseif (Details.time_type == 2 or Details.use_realtimedps) then + elseif(Details.time_type == 2 or Details.use_realtimedps) then meu_tempo = breakdownWindowFrame.instancia.showing:GetCombatTime() end local is_dps = breakdownWindowFrame.instancia.sub_atributo == 2 if (is_dps) then - Details:AddTooltipSpellHeaderText (Loc ["STRING_DAMAGE_DPS_IN"] .. ":", {1, 0.9, 0.0, 1}, 1, Details.tooltip_spell_icon.file, unpack(Details.tooltip_spell_icon.coords)) - Details:AddTooltipHeaderStatusbar (1, 1, 1, 1) + Details:AddTooltipSpellHeaderText(Loc ["STRING_DAMAGE_DPS_IN"] .. ":", {1, 0.9, 0.0, 1}, 1, Details.tooltip_spell_icon.file, unpack(Details.tooltip_spell_icon.coords)) + Details:AddTooltipHeaderStatusbar(1, 1, 1, 1) else - Details:AddTooltipSpellHeaderText (Loc ["STRING_DAMAGE_FROM"] .. ":", {1, 0.9, 0.0, 1}, 1, Details.tooltip_spell_icon.file, unpack(Details.tooltip_spell_icon.coords)) - Details:AddTooltipHeaderStatusbar (1, 1, 1, 1) + Details:AddTooltipSpellHeaderText(Loc ["STRING_DAMAGE_FROM"] .. ":", {1, 0.9, 0.0, 1}, 1, Details.tooltip_spell_icon.file, unpack(Details.tooltip_spell_icon.coords)) + Details:AddTooltipHeaderStatusbar(1, 1, 1, 1) end local icon_size = Details.tooltip.icon_size @@ -6970,15 +6481,15 @@ function damageClass:MontaTooltipAlvos (thisLine, index, instancia) --~deprecate end if (is_dps) then - --GameCooltip:AddDoubleLine (index..". |T"..tabela[3]..":0|t "..tabela[1], Details:comma_value ( _math_floor(tabela[2] / meu_tempo) ).." (".._cstr("%.1f", tabela[2]/total*100).."%)", 1, 1, 1, 1, 1, 1) - GameCooltip:AddLine(tabela[1], Details:comma_value ( _math_floor(tabela[2] / meu_tempo) ).." ("..format("%.1f", tabela[2]/total*100).."%)") + --GameCooltip:AddDoubleLine(index..". |T"..tabela[3]..":0|t "..tabela[1], Details:comma_value( math.floor(tabela[2] / meu_tempo) ).."(".._cstr("%.1f", tabela[2]/total*100).."%)", 1, 1, 1, 1, 1, 1) + GameCooltip:AddLine(tabela[1], Details:comma_value( math.floor(tabela[2] / meu_tempo) ).."("..format("%.1f", tabela[2]/total*100).."%)") else - --GameCooltip:AddDoubleLine (index..". |T"..tabela[3]..":0|t " .. tabela[1], SelectedToKFunction(_, tabela[2]) .. " (".._cstr("%.1f", tabela[2]/total*100).."%)", 1, 1, 1, 1, 1, 1) - GameCooltip:AddLine(tabela[1], SelectedToKFunction(_, tabela[2]) .. " ("..format("%.1f", tabela[2]/total*100).."%)") + --GameCooltip:AddDoubleLine(index..". |T"..tabela[3]..":0|t " .. tabela[1], SelectedToKFunction(_, tabela[2]) .. "(".._cstr("%.1f", tabela[2]/total*100).."%)", 1, 1, 1, 1, 1, 1) + GameCooltip:AddLine(tabela[1], selectedToKFunction(_, tabela[2]) .. "("..format("%.1f", tabela[2]/total*100).."%)") end - GameCooltip:AddIcon (tabela[3], nil, nil, icon_size.W + 4, icon_size.H + 4, icon_border.L, icon_border.R, icon_border.T, icon_border.B) - Details:AddTooltipBackgroundStatusbar (false, tabela[2] / topSpellDamage * 100) + GameCooltip:AddIcon(tabela[3], nil, nil, icon_size.W + 4, icon_size.H + 4, icon_border.L, icon_border.R, icon_border.T, icon_border.B) + Details:AddTooltipBackgroundStatusbar(false, tabela[2] / topSpellDamage * 100) end end @@ -6993,7 +6504,7 @@ function damageClass:GetOrChangeActivityStatus(activityStatus) --if no value passed, return the current activity status return self.dps_started - elseif (activityStatus) then + elseif(activityStatus) then self.dps_started = true Details222.TimeMachine.AddActor(self) @@ -7001,7 +6512,7 @@ function damageClass:GetOrChangeActivityStatus(activityStatus) self.dps_started = false Details222.TimeMachine.RemoveActor(self) end -end +end Details.network_key = "Comm" ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --core functions @@ -7035,20 +6546,20 @@ end --atualize a funcao de abreviacao function damageClass:UpdateSelectedToKFunction() - SelectedToKFunction = ToKFunctions [Details.ps_abbreviation] - FormatTooltipNumber = ToKFunctions [Details.tooltip.abbreviation] - TooltipMaximizedMethod = Details.tooltip.maximize_method + selectedToKFunction = ToKFunctions [Details.ps_abbreviation] + formatTooltipNumber = ToKFunctions [Details.tooltip.abbreviation] + tooltipMaximizedMethod = Details.tooltip.maximize_method headerColor = Details.tooltip.header_text_color end --diminui o total das tabelas do combate - function damageClass:subtract_total (combat_table) + function damageClass:subtract_total(combat_table) combat_table.totals [class_type] = combat_table.totals [class_type] - self.total if (self.grupo) then combat_table.totals_grupo [class_type] = combat_table.totals_grupo [class_type] - self.total end end - function damageClass:add_total (combat_table) + function damageClass:add_total(combat_table) combat_table.totals [class_type] = combat_table.totals [class_type] + self.total if (self.grupo) then combat_table.totals_grupo [class_type] = combat_table.totals_grupo [class_type] + self.total @@ -7100,7 +6611,7 @@ end local tempo = endTime - actorObject.start_time overallActor.start_time = overallActor.start_time - tempo - --pets (add unique pet names) + --pets(add unique pet names) for _, petName in ipairs(actorObject.pets) do --same as actorObject:GetPets() DetailsFramework.table.addunique(overallActor.pets, petName) end @@ -7134,13 +6645,13 @@ end --copy targets for targetName, amount in pairs(actorObject.targets) do - overallActor.targets[targetName] = (overallActor.targets[targetName] or 0) + amount + overallActor.targets[targetName] =(overallActor.targets[targetName] or 0) + amount end --copy raid targets for flag, amount in pairs(actorObject.raid_targets) do overallActor.raid_targets = overallActor.raid_targets or {} - overallActor.raid_targets[flag] = (overallActor.raid_targets[flag] or 0) + amount + overallActor.raid_targets[flag] =(overallActor.raid_targets[flag] or 0) + amount end ---@type spellcontainer @@ -7153,12 +6664,12 @@ end --sum spell targets for targetName, amount in pairs(spellTable.targets) do - overallSpellTable.targets[targetName] = (overallSpellTable.targets[targetName] or 0) + amount + overallSpellTable.targets[targetName] =(overallSpellTable.targets[targetName] or 0) + amount end --refresh and add extra values for extraSpellId, amount in pairs(spellTable.extra) do - overallSpellTable.extra[extraSpellId] = (overallSpellTable.extra[extraSpellId] or 0) + amount + overallSpellTable.extra[extraSpellId] =(overallSpellTable.extra[extraSpellId] or 0) + amount end overallSpellTable.spellschool = spellTable.spellschool @@ -7175,7 +6686,7 @@ end if (overallSpellTable [key] > value) then overallSpellTable [key] = value end - elseif (key == "n_max" or key == "c_max") then + elseif(key == "n_max" or key == "c_max") then if (overallSpellTable [key] < value) then overallSpellTable [key] = value end @@ -7204,7 +6715,7 @@ end local overallSpellTable = overallAugmentedSpellsContainer:GetOrCreateSpell(spellId, true) overallSpellTable.total = overallSpellTable.total + spellTable.total for targetName, amount in pairs(spellTable.targets) do - overallSpellTable.targets[targetName] = (overallSpellTable.targets[targetName] or 0) + amount + overallSpellTable.targets[targetName] =(overallSpellTable.targets[targetName] or 0) + amount end end end @@ -7217,7 +6728,7 @@ end friendlyFireOverall.total = friendlyFireOverall.total + friendlyFireTable.total --sum spells for friendlyFireSpellId, amount in pairs(friendlyFireTable.spells) do - friendlyFireOverall.spells[friendlyFireSpellId] = (friendlyFireOverall.spells[friendlyFireSpellId] or 0) + amount + friendlyFireOverall.spells[friendlyFireSpellId] =(friendlyFireOverall.spells[friendlyFireSpellId] or 0) + amount end end @@ -7242,15 +6753,15 @@ function Details.SumDamageActors(actor1, actor2, actorContainer) --not called an --get the actor that caused the damage on actor2 local actorObject = actorContainer:GetActor(actorName) if (actorObject) then - local damageToActor2 = (actorObject.targets[actor2.nome]) or 0 - actorObject.targets[actor1.nome] = (actorObject.targets[actor1.nome] or 0) + damageToActor2 + local damageToActor2 =(actorObject.targets[actor2.nome]) or 0 + actorObject.targets[actor1.nome] =(actorObject.targets[actor1.nome] or 0) + damageToActor2 end end end --targets for actorName, damageDone in pairs(actor2.targets) do - actor1.targets[actorName] = (actor1.targets[actorName] or 0) + damageDone + actor1.targets[actorName] =(actor1.targets[actorName] or 0) + damageDone end --pets @@ -7260,7 +6771,7 @@ function Details.SumDamageActors(actor1, actor2, actorContainer) --not called an --raid targets for raidTargetFlag, damageDone in pairs(actor2.raid_targets) do - actor1.raid_targets[raidTargetFlag] = (actor1.raid_targets[raidTargetFlag] or 0) + damageDone + actor1.raid_targets[raidTargetFlag] =(actor1.raid_targets[raidTargetFlag] or 0) + damageDone end --friendly fire @@ -7269,7 +6780,7 @@ function Details.SumDamageActors(actor1, actor2, actorContainer) --not called an actor1.friendlyfire[actorName].total = actor1.friendlyfire[actorName].total + ffTable.total for spellId, damageDone in pairs(ffTable.spells) do - actor1.friendlyfire[actorName].spells[spellId] = (actor1.friendlyfire[actorName].spells[spellId] or 0) + damageDone + actor1.friendlyfire[actorName].spells[spellId] =(actor1.friendlyfire[actorName].spells[spellId] or 0) + damageDone end end @@ -7292,7 +6803,7 @@ function Details.SumDamageActors(actor1, actor2, actorContainer) --not called an if (actor1Spell[key] > value) then actor1Spell[key] = value end - elseif (key == "n_max" or key == "c_max") then + elseif(key == "n_max" or key == "c_max") then if (actor1Spell[key] < value) then actor1Spell[key] = value end @@ -7305,7 +6816,7 @@ function Details.SumDamageActors(actor1, actor2, actorContainer) --not called an --spell targets for targetName, damageDone in pairs(spellTable) do - actor1Spell.targets[targetName] = (actor1Spell.targets[targetName] or 0) + damageDone + actor1Spell.targets[targetName] =(actor1Spell.targets[targetName] or 0) + damageDone end end end @@ -7314,7 +6825,7 @@ end damageClass.__add = function(tabela1, tabela2) --tempo decorrido - local tempo = (tabela2.end_time or time()) - tabela2.start_time + local tempo =(tabela2.end_time or time()) - tabela2.start_time tabela1.start_time = tabela1.start_time - tempo --total de dano @@ -7332,7 +6843,7 @@ damageClass.__add = function(tabela1, tabela2) tabela1.damage_from [nome] = true end - --pets (add unique pet names) + --pets(add unique pet names) for _, petName in ipairs(tabela2.pets) do local hasPet = false for i = 1, #tabela1.pets do @@ -7349,27 +6860,27 @@ damageClass.__add = function(tabela1, tabela2) --soma os containers de alvos for target_name, amount in pairs(tabela2.targets) do - tabela1.targets [target_name] = (tabela1.targets [target_name] or 0) + amount + tabela1.targets [target_name] =(tabela1.targets [target_name] or 0) + amount end --soma o container de raid targets for flag, amount in pairs(tabela2.raid_targets) do - tabela1.raid_targets [flag] = (tabela1.raid_targets [flag] or 0) + amount + tabela1.raid_targets [flag] =(tabela1.raid_targets [flag] or 0) + amount end --soma o container de habilidades for spellid, habilidade in pairs(tabela2.spells._ActorTable) do --pega a habilidade no primeiro ator - local habilidade_tabela1 = tabela1.spells:PegaHabilidade (spellid, true, "SPELL_DAMAGE", false) + local habilidade_tabela1 = tabela1.spells:PegaHabilidade(spellid, true, "SPELL_DAMAGE", false) --soma os alvos for target_name, amount in pairs(habilidade.targets) do - habilidade_tabela1.targets[target_name] = (habilidade_tabela1.targets [target_name] or 0) + amount + habilidade_tabela1.targets[target_name] =(habilidade_tabela1.targets [target_name] or 0) + amount end --soma os extras for spellId, amount in pairs(habilidade.extra) do - habilidade_tabela1.extra = (habilidade_tabela1.extra [spellId] or 0) + amount + habilidade_tabela1.extra =(habilidade_tabela1.extra [spellId] or 0) + amount end --soma os valores da habilidade @@ -7384,7 +6895,7 @@ damageClass.__add = function(tabela1, tabela2) if (habilidade_tabela1 [key] > value) then habilidade_tabela1 [key] = value end - elseif (key == "n_max" or key == "c_max") then + elseif(key == "n_max" or key == "c_max") then if (habilidade_tabela1 [key] < value) then habilidade_tabela1 [key] = value end @@ -7407,13 +6918,13 @@ damageClass.__add = function(tabela1, tabela2) --soma o container de friendly fire for target_name, ff_table in pairs(tabela2.friendlyfire) do --pega o ator ff no ator principal - local friendlyFire_tabela1 = tabela1.friendlyfire [target_name] or tabela1:CreateFFTable (target_name) + local friendlyFire_tabela1 = tabela1.friendlyfire [target_name] or tabela1:CreateFFTable(target_name) --soma o total friendlyFire_tabela1.total = friendlyFire_tabela1.total + ff_table.total --soma as habilidades for spellid, amount in pairs(ff_table.spells) do - friendlyFire_tabela1.spells [spellid] = (friendlyFire_tabela1.spells [spellid] or 0) + amount + friendlyFire_tabela1.spells [spellid] =(friendlyFire_tabela1.spells [spellid] or 0) + amount end end @@ -7423,7 +6934,7 @@ end damageClass.__sub = function(tabela1, tabela2) --tempo decorrido - local tempo = (tabela2.end_time or time()) - tabela2.start_time + local tempo =(tabela2.end_time or time()) - tabela2.start_time tabela1.start_time = tabela1.start_time + tempo --total de dano @@ -7448,14 +6959,14 @@ damageClass.__sub = function(tabela1, tabela2) --reduz o container de raid targets for flag, amount in pairs(tabela2.raid_targets) do if (tabela1.raid_targets [flag]) then - tabela1.raid_targets [flag] = _math_max (tabela1.raid_targets [flag] - amount, 0) + tabela1.raid_targets [flag] = math.max(tabela1.raid_targets [flag] - amount, 0) end end --reduz o container de habilidades for spellid, habilidade in pairs(tabela2.spells._ActorTable) do --get the spell from the first actor - local habilidade_tabela1 = tabela1.spells:PegaHabilidade (spellid, true, "SPELL_DAMAGE", false) + local habilidade_tabela1 = tabela1.spells:PegaHabilidade(spellid, true, "SPELL_DAMAGE", false) --subtract targets for target_name, amount in pairs(habilidade.targets) do @@ -7484,7 +6995,7 @@ damageClass.__sub = function(tabela1, tabela2) if (habilidade_tabela1 [key] > value) then habilidade_tabela1 [key] = value end - elseif (key == "n_max" or key == "c_max") then + elseif(key == "n_max" or key == "c_max") then if (habilidade_tabela1 [key] < value) then habilidade_tabela1 [key] = value end @@ -7527,26 +7038,26 @@ function Details.refresh:r_atributo_damage(actorObject) end end -function Details.clear:c_atributo_damage (este_jogador) +function Details.clear:c_atributo_damage(este_jogador) este_jogador.__index = nil este_jogador.links = nil este_jogador.minha_barra = nil - Details.clear:c_container_habilidades (este_jogador.spells) + Details.clear:c_container_habilidades(este_jogador.spells) end --[[ --enemy damage done i = 1 - local enemy = combat (1, enemy_name) + local enemy = combat(1, enemy_name) if (enemy) then local damage_done = 0 --get targets for target_name, amount in pairs(enemy.targets) do - local player = combat (1, target_name) + local player = combat(1, target_name) if (player and player.grupo) then local t = tooltip_temp_table [i] if (not t) then @@ -7567,13 +7078,13 @@ end t[1] = 0 end - _table_sort(tooltip_temp_table, Details.Sort2) + table.sort(tooltip_temp_table, Details.Sort2) --enemy damage taken - Details:AddTooltipSpellHeaderText (Loc ["STRING_ATTRIBUTE_DAMAGE"], headerColor, i-1, true) - GameCooltip:AddIcon ([=[Interface\Buttons\UI-MicroStream-Green]=], 2, 1, 14, 14, 0.1875, 0.8125, 0.15625, 0.78125) - GameCooltip:AddIcon ([=[Interface\AddOns\Details\images\key_shift]=], 2, 2, Details.tooltip_key_size_width, Details.tooltip_key_size_height, 0, 1, 0, 0.640625, Details.tooltip_key_overlay2) - GameCooltip:AddStatusBar (100, 2, 0.7, g, b, 1) + Details:AddTooltipSpellHeaderText(Loc ["STRING_ATTRIBUTE_DAMAGE"], headerColor, i-1, true) + GameCooltip:AddIcon([=[Interface\Buttons\UI-MicroStream-Green]=], 2, 1, 14, 14, 0.1875, 0.8125, 0.15625, 0.78125) + GameCooltip:AddIcon([=[Interface\AddOns\Details\images\key_shift]=], 2, 2, Details.tooltip_key_size_width, Details.tooltip_key_size_height, 0, 1, 0, 0.640625, Details.tooltip_key_overlay2) + GameCooltip:AddStatusBar(100, 2, 0.7, g, b, 1) --build the tooltip for o = 1, i-1 do @@ -7583,9 +7094,9 @@ end local player_name = player:name() if (player_name:find(Details.playername)) then - GameCooltip:AddLine(player_name .. ": ", FormatTooltipNumber (_, total) .. " (" .. _cstr ("%.1f", (total / damage_done) * 100) .. "%)", 2, "yellow") + GameCooltip:AddLine(player_name .. ": ", FormatTooltipNumber(_, total) .. "(" .. _cstr("%.1f",(total / damage_done) * 100) .. "%)", 2, "yellow") else - GameCooltip:AddLine(player_name .. ": ", FormatTooltipNumber (_, total) .." (" .. _cstr ("%.1f", (total / damage_done) * 100) .. "%)", 2) + GameCooltip:AddLine(player_name .. ": ", FormatTooltipNumber(_, total) .."(" .. _cstr("%.1f",(total / damage_done) * 100) .. "%)", 2) end local classe = player:class() @@ -7593,11 +7104,11 @@ end classe = "UNKNOW" end if (classe == "UNKNOW") then - GameCooltip:AddIcon ("Interface\\LFGFRAME\\LFGROLE_BW", 2, nil, 14, 14, .25, .5, 0, 1) + GameCooltip:AddIcon("Interface\\LFGFRAME\\LFGROLE_BW", 2, nil, 14, 14, .25, .5, 0, 1) else - GameCooltip:AddIcon (instancia.row_info.icon_file, 2, nil, 14, 14, _unpack(Details.class_coords [classe])) + GameCooltip:AddIcon(instancia.row_info.icon_file, 2, nil, 14, 14, _unpack(Details.class_coords [classe])) end - Details:AddTooltipBackgroundStatusbar (2) + Details:AddTooltipBackgroundStatusbar(2) end diff --git a/classes/class_instance.lua b/classes/class_instance.lua index e4954ccdd..5c2ea75e3 100644 --- a/classes/class_instance.lua +++ b/classes/class_instance.lua @@ -3536,7 +3536,7 @@ function Details:monta_relatorio (este_relatorio, custom) if (already_exists) then --push it to front - local t = tremove(Details.latest_report_table, already_exists) + local t = table.remove(Details.latest_report_table, already_exists) t [4] = amt table.insert(Details.latest_report_table, 1, t) else @@ -3548,7 +3548,7 @@ function Details:monta_relatorio (este_relatorio, custom) end end - tremove(Details.latest_report_table, 11) + table.remove(Details.latest_report_table, 11) end local barras = self.barras @@ -3691,7 +3691,7 @@ function Details:monta_relatorio (este_relatorio, custom) Details:FormatReportLines (report_lines, t, report_name_function, report_amount_function, report_build_line) else for i = #raw_data_to_report, amt+1, -1 do - tremove(raw_data_to_report, i) + table.remove(raw_data_to_report, i) end Details:FormatReportLines (report_lines, raw_data_to_report, report_name_function, report_amount_function, report_build_line) end diff --git a/classes/class_utility.lua b/classes/class_utility.lua index 6ba446309..ef8b4a1d2 100644 --- a/classes/class_utility.lua +++ b/classes/class_utility.lua @@ -403,7 +403,7 @@ local ReportSingleDeathFunc = function(IsCurrent, IsReverse, AmtLines) t [#t+1] = table [1] .. table [4] .. table [2] .. table [3] end - local title = tremove(t, 1) + local title = table.remove(t, 1) t = Details.table.reverse(t) tinsert(t, 1, title) diff --git a/core/gears.lua b/core/gears.lua index 5de5a4c2d..3aaf582c8 100644 --- a/core/gears.lua +++ b/core/gears.lua @@ -1637,7 +1637,7 @@ function Details.GenerateSpecSpellList() local sharedSpellsBetweenSpecs = {} local specNames = {} - local amountSpecs = GetNumSpecializationsForClassID(classId) + local amountSpecs = C_SpecializationInfo.GetNumSpecializationsForClassID(classId) local totalTimeToWait = 0 DetailsFramework.Schedules.NewTimer(0, function() SetSpecialization(1) end) diff --git a/core/network.lua b/core/network.lua index 3ca1514bc..d21d17cdd 100644 --- a/core/network.lua +++ b/core/network.lua @@ -289,7 +289,7 @@ local dataCompressed = LibDeflate:DecodeForWoWAddonChannel(data) local dataSerialized = LibDeflate:DecompressDeflate(dataCompressed) local dataTable = {Details:Deserialize(dataSerialized)} - tremove(dataTable, 1) + table.remove(dataTable, 1) local dataTable = dataTable[1] local playerRole = dataTable[1] @@ -494,7 +494,7 @@ return end - tremove(deserializedTable, 1) + table.remove(deserializedTable, 1) local prefix, player, realm, coreVersion, arg6, arg7, arg8, arg9 = unpack(deserializedTable) player = source diff --git a/core/parser.lua b/core/parser.lua index abd9c8518..7dd13b29b 100755 --- a/core/parser.lua +++ b/core/parser.lua @@ -5016,15 +5016,15 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1 Details:Destroy(Details.capture_schedules) end - function Details:CaptureTimeout (table) - local capture_type, schedule_id = unpack(table) + function Details:CaptureTimeout (table3) + local capture_type, schedule_id = unpack(table3) Details.capture_current [capture_type] = Details.capture_real [capture_type] Details:CaptureRefresh() - for index, table in ipairs(Details.capture_schedules) do - local id = table [2] + for index, table2 in ipairs(Details.capture_schedules) do + local id = table2 [2] if (schedule_id == id) then - tremove(Details.capture_schedules, index) + table.remove(Details.capture_schedules, index) break end end @@ -6571,7 +6571,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1 local writeLog = function() _detalhes_global = _detalhes_global or {} tinsert(_detalhes_global.exit_errors, 1, currentStep .. " | " .. Details222.Date.GetDateForLogs() .. " | " .. Details.GetVersionString() .. " | " .. errortext .. " | " .. debugstack()) - tremove(_detalhes_global.exit_errors, exitErrorsMaxSize) + table.remove(_detalhes_global.exit_errors, exitErrorsMaxSize) addToExitErrors(currentStep .. " | " .. Details222.Date.GetDateForLogs() .. " | " .. Details.GetVersionString() .. " | " .. errortext .. " | " .. debugstack()) end xpcall(writeLog, addToExitErrors) @@ -6605,7 +6605,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1 xpcall(clearInstances, logSaverError) else tinsert(_detalhes_global.exit_errors, 1, "not _detalhes.tabela_instancias") - tremove(_detalhes_global.exit_errors, exitErrorsMaxSize) + table.remove(_detalhes_global.exit_errors, exitErrorsMaxSize) addToExitErrors("not _detalhes.tabela_instancias | " .. Details.GetVersionString()) end diff --git a/core/util.lua b/core/util.lua index 6a47b75cc..a0d77607f 100644 --- a/core/util.lua +++ b/core/util.lua @@ -1100,6 +1100,7 @@ -- lua base64 codec (c) 2006-2008 by Alex Kloss - http://www.it-rfc.de - licensed under the terms of the LGPL2 - http://lua-users.org/wiki/BaseSixtyFour do Details._encode = {} + Details._codec = "" -- shift left local function lsh (value,shift) diff --git a/frames/window_breakdown/window_playerbreakdown.lua b/frames/window_breakdown/window_playerbreakdown.lua index 75a5c6aea..27f885fa7 100644 --- a/frames/window_breakdown/window_playerbreakdown.lua +++ b/frames/window_breakdown/window_playerbreakdown.lua @@ -9,7 +9,7 @@ local addonName, Details222 = ... --remove warnings in the code local ipairs = ipairs local tinsert = table.insert -local tremove = tremove +local tremove = table.remove local type = type local unpack = _G.unpack local PixelUtil = PixelUtil diff --git a/frames/window_currentdps.lua b/frames/window_currentdps.lua index 8718a4ee4..3cc5a6965 100644 --- a/frames/window_currentdps.lua +++ b/frames/window_currentdps.lua @@ -735,7 +735,7 @@ function Details:CreateCurrentDpsFrame(parent, name) f.YellowDamage = f.YellowDamage + yellowDamageDone --remove player team damage - local removedDamage = tremove(f.PlayerTeamBuffer, f.MaxBufferIndex+1) + local removedDamage = table.remove(f.PlayerTeamBuffer, f.MaxBufferIndex+1) if (removedDamage) then f.PlayerTeamDamage = f.PlayerTeamDamage - removedDamage --be save @@ -743,7 +743,7 @@ function Details:CreateCurrentDpsFrame(parent, name) end --remove yellow damage - local removedDamage = tremove(f.YellowTeamBuffer, f.MaxBufferIndex+1) + local removedDamage = table.remove(f.YellowTeamBuffer, f.MaxBufferIndex+1) if (removedDamage) then f.YellowDamage = f.YellowDamage - removedDamage --be save @@ -836,7 +836,7 @@ function Details:CreateCurrentDpsFrame(parent, name) f.GroupTotalDamage = f.GroupTotalDamage + groupDamageDoneOnThisTick --cicle buffer removing the last index and subtract its damage - local removedDamage = tremove(f.GroupBuffer, f.MaxBufferIndex+1) + local removedDamage = table.remove(f.GroupBuffer, f.MaxBufferIndex+1) if (removedDamage) then --remove the value from the total damage f.GroupTotalDamage = f.GroupTotalDamage - removedDamage diff --git a/frames/window_eventtracker.lua b/frames/window_eventtracker.lua index 61bf9a9a9..0704ba2c8 100644 --- a/frames/window_eventtracker.lua +++ b/frames/window_eventtracker.lua @@ -897,7 +897,7 @@ function Details:CreateEventTrackerFrame(parentObject, name) local amountToShow = #CurrentShowing if (amountToShow > amountOfLines) then - tremove(CurrentShowing, amountToShow) + table.remove(CurrentShowing, amountToShow) end scrollframe:Refresh() end diff --git a/frames/window_main.lua b/frames/window_main.lua index b0ca22918..bd9a455e9 100644 --- a/frames/window_main.lua +++ b/frames/window_main.lua @@ -2476,10 +2476,10 @@ local icon_frame_on_click_up = function(self, button) if (Details.ilevel.core:HasQueuedInspec (self.unitname)) then --icon animation - local anim = tremove(Details.icon_animations.load.available) + local anim = table.remove(Details.icon_animations.load.available) if (not anim) then icon_frame_create_animation() - anim = tremove(Details.icon_animations.load.available) + anim = table.remove(Details.icon_animations.load.available) end local f = anim @@ -2518,10 +2518,10 @@ local icon_frame_on_click_up = function(self, button) end --icon animation - local anim = tremove(Details.icon_animations.load.available) + local anim = table.remove(Details.icon_animations.load.available) if (not anim) then icon_frame_create_animation() - anim = tremove(Details.icon_animations.load.available) + anim = table.remove(Details.icon_animations.load.available) end anim:Show() @@ -3684,7 +3684,8 @@ function gump:CriaJanelaPrincipal(ID, instancia, criando) Details222.PrivateInstanceText = f:CreateFontString(nil, "overlay", "GameFontNormal") Details222.PrivateInstanceText:SetFont("Interface\\AddOns\\Details\\Fonts\\Accidental Presidency.ttf", 10, "NONE") Details222.PrivateInstanceText:SetTextColor(1, 1, 1, 0.5) - Details222.PrivateInstanceText:SetText(authorInfo.Support..("/"..authorInfo.Name..""):gsub("^%s$", "")) + Details222.PrivateInstanceText:SetText("") + --Details222.PrivateInstanceText:SetText(authorInfo.Support..("/"..authorInfo.Name..""):gsub("^%s$", "")) Details222.PrivateInstanceText:SetPoint("bottomleft", baseframe, "bottomleft", 2, 2) Details222.PrivateInstanceText:Hide()hooksecurefunc(commentador, "FollowUnit", function() C_Timer.After(180, function()Details222.PrivateInstanceText:Show()end) diff --git a/frames/window_nestspells.lua b/frames/window_nestspells.lua new file mode 100644 index 000000000..525557aaf --- /dev/null +++ b/frames/window_nestspells.lua @@ -0,0 +1,3 @@ + +local hi = "Hello" + diff --git a/frames/window_pro_file correct.lua b/frames/window_pro_file correct.lua new file mode 100644 index 000000000..9d6edd2d6 --- /dev/null +++ b/frames/window_pro_file correct.lua @@ -0,0 +1,134 @@ + +local Details = Details +local addonName, Details222 = ... +---@type detailsframework +local detailsFramework = DetailsFramework +local _ + +Details222.ProFile = {} +local proFile = Details222.ProFile + +---@class communityframe : frame +---@field AchievementLines table +---@field PortraitTexture texture +---@field PlayerNameText fontstring +---@field PlayerTitleText fontstring +---@field PlayerMPlusRatingText fontstring +---@field PlayerHeroicProgressionText fontstring +---@field PlayerMythicProgressionText fontstring +---@field TimePlayedText fontstring +---@field TimePlayedTogetherText fontstring +---@field AddFriendButton df_button +---@field InviteToGuildButton df_button +---@field AchievementTexture texture + +C_Timer.After(3, function() + --proFile:CreateProFile() +end) + + +function proFile:CreateProFile() + ---@type communityframe + local mainFrame = CreateFrame("frame", "DetailsProFileFrame", UIParent) + mainFrame:SetSize(400, 300) + mainFrame:SetPoint("center", UIParent, "center", 0, 0) + + mainFrame.AchievementLines = {} + + --apply rounded corner + detailsFramework:AddRoundedCornersToFrame(mainFrame, Details.PlayerBreakdown.RoundedCornerPreset) + + --create a portrait texture to show the player's portrait + local portraitTexture = mainFrame:CreateTexture(nil, "artwork") + portraitTexture:SetSize(90, 90) + portraitTexture:SetPoint("topleft", mainFrame, "topleft", 10, -10) + portraitTexture:SetTexture([[Interface\ICONS\INV_Misc_QuestionMark]]) + portraitTexture:SetTexCoord(0.1, 0.9, 0.1, 0.9) + mainFrame.PortraitTexture = portraitTexture + + --the following widgets are shown in the right side of the portrait texture + local playerNameFontString = mainFrame:CreateFontString(nil, "overlay", "GameFontNormal") + playerNameFontString:SetPoint("topleft", portraitTexture, "topright", 10, 0) + playerNameFontString:SetText("Player Name") + mainFrame.PlayerNameText = playerNameFontString + + local playerTitleFontString = mainFrame:CreateFontString(nil, "overlay", "GameFontNormal") + playerTitleFontString:SetPoint("topleft", playerNameFontString, "bottomleft", 0, -5) + playerTitleFontString:SetText("Player Title") + mainFrame.PlayerTitleText = playerTitleFontString + + local playerMPlusRatingFontString = mainFrame:CreateFontString(nil, "overlay", "GameFontNormal") + playerMPlusRatingFontString:SetPoint("topleft", playerTitleFontString, "bottomleft", 0, -5) + playerMPlusRatingFontString:SetText("M+ 2451") + mainFrame.PlayerMPlusRatingText = playerMPlusRatingFontString + + local playerHeroicProgressionFontString = mainFrame:CreateFontString(nil, "overlay", "GameFontNormal") + playerHeroicProgressionFontString:SetPoint("topleft", playerMPlusRatingFontString, "bottomleft", 0, -5) + playerHeroicProgressionFontString:SetText("Heroic 10/10") + mainFrame.PlayerHeroicProgressionText = playerHeroicProgressionFontString + + local playerMythicProgressionFontString = mainFrame:CreateFontString(nil, "overlay", "GameFontNormal") + playerMythicProgressionFontString:SetPoint("topleft", playerHeroicProgressionFontString, "bottomleft", 0, -5) + playerMythicProgressionFontString:SetText("Mythic 10/10") + mainFrame.PlayerMythicProgressionText = playerMythicProgressionFontString + + --create a texture 10 pixels below the latest text, size is 24,24, texture is a question mark + local achievementTexture = mainFrame:CreateTexture(nil, "artwork") + achievementTexture:SetSize(24, 24) + achievementTexture:SetPoint("topleft", playerMythicProgressionFontString, "bottomleft", 0, -10) + achievementTexture:SetTexture([[Interface\ICONS\INV_Misc_QuestionMark]]) + mainFrame.AchievementTexture = achievementTexture + + --create 3 lines of achievement, each line has a texture and a fontstring + for i = 1, 3 do + local achievTexture = mainFrame:CreateTexture(nil, "artwork") + achievTexture:SetSize(20, 20) + if (i == 1) then + achievTexture:SetPoint("topleft", achievementTexture, "topright", 10, 0) + else + achievTexture:SetPoint("topleft", mainFrame.AchievementLines[i-1].Texture, "bottomleft", 0, -5) + end + + achievTexture:SetTexture([[Interface\ICONS\INV_Misc_QuestionMark]]) + + local achievNameFontString = mainFrame:CreateFontString(nil, "overlay", "GameFontNormal") + achievNameFontString:SetPoint("left", achievTexture, "right", 10, 0) + achievNameFontString:SetText("Achievement Name") + + local achievTable = {Texture = achievTexture, Name = achievNameFontString} + mainFrame.AchievementLines[i] = achievTable + end + + --the following widget are shown in the right side of the mainFrame + --create a button + + --the following widgets are shown below the portrait + local timePlayedText = mainFrame:CreateFontString(nil, "overlay", "GameFontNormal") + timePlayedText:SetPoint("topleft", portraitTexture, "bottomleft", 0, -10) + timePlayedText:SetText("Time Played: 1d 2h 3m") + mainFrame.TimePlayedText = timePlayedText + + local timePlayedTogether = mainFrame:CreateFontString(nil, "overlay", "GameFontNormal") + timePlayedTogether:SetPoint("topleft", timePlayedText, "bottomleft", 0, -5) + timePlayedTogether:SetText("Time Played Together: 1d 2h 3m") + mainFrame.TimePlayedTogetherText = timePlayedTogether + + --create a button using the details framework, this button uses a standard template, the text is "Add Friend", it is attached below the timePlayerTogether, its function is called addFriendPlayer + local addFriendPlayer = function() + print("Add Friend") + end + local addFriendButton = detailsFramework:CreateButton(mainFrame, addFriendPlayer, 100, 20, "Add Friend", nil, nil, nil, nil, nil, nil, detailsFramework:GetTemplate("button", "OPAQUE_DARK")) + addFriendButton:SetPoint("topleft", timePlayedTogether, "bottomleft", 0, -5) + mainFrame.AddFriendButton = addFriendButton + + --create a button similar to the addFriendButton, but with the text "Add Guild", its function is called inviteToGuild + local inviteToGuild = function() + print("Invite to Guild") + end + local inviteToGuildButton = detailsFramework:CreateButton(mainFrame, inviteToGuild, 100, 20, "Add Guild", nil, nil, nil, nil, nil, nil, detailsFramework:GetTemplate("button", "OPAQUE_DARK")) + inviteToGuildButton:SetPoint("topleft", addFriendButton, "bottomleft", 0, -5) + mainFrame.InviteToGuildButton = inviteToGuildButton + + + +end \ No newline at end of file diff --git a/frames/window_report.lua b/frames/window_report.lua index c0c784405..42cb4b36a 100644 --- a/frames/window_report.lua +++ b/frames/window_report.lua @@ -717,7 +717,7 @@ local createDropdown = function(thisFrame) local instance_id, atributo, sub_atributo, amt, where, custom_name = unpack(report) if (atributo == 5) then if (not custom_name) then - tremove(lastReports, index) + table.remove(lastReports, index) else local found for _, custom in ipairs(Details.custom) do @@ -727,7 +727,7 @@ local createDropdown = function(thisFrame) end end if (not found) then - tremove(lastReports, index) + table.remove(lastReports, index) end end end diff --git a/functions/deathrecap.lua b/functions/deathrecap.lua index 8fb0c5f8b..5a2f65e0c 100644 --- a/functions/deathrecap.lua +++ b/functions/deathrecap.lua @@ -1,16 +1,24 @@ - +local addonName, Details222 = ... local Details = _G.Details -local textAlpha = 0.9 local AceLocale = LibStub("AceLocale-3.0") -local L = AceLocale:GetLocale ( "Details" ) -local addonName, Details222 = ... +local L = AceLocale:GetLocale("Details") +---@type detailsframework +local detailsFramework = DetailsFramework local GetSpellLink = GetSpellLink or C_Spell.GetSpellLink --api local +local GameTooltip = GameTooltip +local perf = Details222.commprefixes +local deathRecap = Details.death_recap + +local maxBlizzardDeathRecapLines = 5 +local textAlpha = 0.9 +local segmentColor = "orange" +local isSpectating = "IsSpectating" local on_deathrecap_line_enter = function(self) if (self.spellid) then GameTooltip:SetOwner(self, "ANCHOR_RIGHT") - Details:GameTooltipSetSpellByID (self.spellid) + Details:GameTooltipSetSpellByID(self.spellid) self:SetBackdropColor(.3, .3, .3, .2) GameTooltip:Show() self.backgroundTextureOverlay:Show() @@ -33,14 +41,14 @@ end local create_deathrecap_line = function(parent, n) local line = CreateFrame("frame", "DetailsDeathRecapLine" .. n, parent, "BackdropTemplate") - line:SetPoint("topleft", parent, "topleft", 10, (-24 * n) - 17) - line:SetPoint("topright", parent, "topright", -10, (-24 * n) - 17) + line:SetPoint("topleft", parent, "topleft", 10,(-24 * n) - 17) + line:SetPoint("topright", parent, "topright", -10,(-24 * n) - 17) line:SetScript("OnEnter", on_deathrecap_line_enter) line:SetScript("OnLeave", on_deathrecap_line_leave) line:SetSize(300, 21) - local timeAt = line:CreateFontString(nil, "overlay", "GameFontNormal") + local timeAtFontString = line:CreateFontString(nil, "overlay", "GameFontNormal") local backgroundTexture = line:CreateTexture(nil, "border") local backgroundTextureOverlay = line:CreateTexture(nil, "artwork") local spellIcon = line:CreateTexture(nil, "overlay") @@ -52,13 +60,6 @@ local create_deathrecap_line = function(parent, n) local lifePercent = line:CreateFontString(nil, "overlay", "GameFontNormal") local lifeStatusBar = line:CreateTexture(nil, "border", nil, -3) - --grave icon - local graveIcon = line:CreateTexture(nil, "overlay") - graveIcon:SetTexture([[Interface\MINIMAP\POIIcons]]) - graveIcon:SetTexCoord(146/256, 160/256, 0/512, 18/512) - graveIcon:SetPoint("left", line, "left", 11, 0) - graveIcon:SetSize(14, 18) - --spell icon spellIcon:SetSize(19, 19) spellIconBorder:SetTexture([[Interface\ENCOUNTERJOURNAL\LootTab]]) @@ -66,27 +67,33 @@ local create_deathrecap_line = function(parent, n) spellIconBorder:SetSize(20, 20) spellIconBorder:SetPoint("topleft", spellIcon, "topleft", 0, 0) + --grave icon + local graveIcon = line:CreateTexture(nil, "overlay") + graveIcon:SetTexture([[Interface\MINIMAP\POIIcons]]) + graveIcon:SetTexCoord(146/256, 160/256, 0/512, 18/512) + graveIcon:SetPoint("left", line, "left", 11, 0) + graveIcon:SetSize(14, 18) + --locations - timeAt:SetPoint("left", line, "left", 2, 0) + timeAtFontString:SetPoint("left", line, "left", 2, 0) spellIcon:SetPoint("left", line, "left", 50, 0) sourceName:SetPoint("left", line, "left", 82, 0) amount:SetPoint("left", line, "left", 240, 0) lifePercent:SetPoint("left", line, "left", 320, 0) - --text colors - Details.gump:SetFontColor(amount, "red") - Details.gump:SetFontColor(timeAt, "gray") - Details.gump:SetFontColor(sourceName, "yellow") + --set the text colors + detailsFramework:SetFontColor(amount, "red") + detailsFramework:SetFontColor(timeAtFontString, "gray") + detailsFramework:SetFontColor(sourceName, "yellow") + detailsFramework:SetFontSize(sourceName, 10) - Details.gump:SetFontSize(sourceName, 10) - - --text alpha - timeAt:SetAlpha(textAlpha) + --set the text alpha + timeAtFontString:SetAlpha(textAlpha) sourceName:SetAlpha(textAlpha) amount:SetAlpha(textAlpha) lifePercent:SetAlpha(textAlpha) - --text setup + --text size and justification setup amount:SetWidth(85) amount:SetJustifyH("right") lifePercent:SetWidth(42) @@ -122,8 +129,8 @@ local create_deathrecap_line = function(parent, n) backgroundTexture2:SetPoint("topright", backgroundTexture, "bottomright", 0, 0) backgroundTexture2:SetHeight(32) - Details.gump:SetFontSize(amount, 14) - Details.gump:SetFontSize(lifePercent, 14) + detailsFramework:SetFontSize(amount, 14) + detailsFramework:SetFontSize(lifePercent, 14) backgroundTexture:SetVertexColor(.2, .1, .1, .3) end @@ -137,7 +144,7 @@ local create_deathrecap_line = function(parent, n) backgroundTextureOverlay:SetAlpha(0.5) backgroundTextureOverlay:Hide() - line.timeAt = timeAt + line.timeAt = timeAtFontString line.spellIcon = spellIcon line.sourceName = sourceName line.amount = amount @@ -157,12 +164,96 @@ local create_deathrecap_line = function(parent, n) return line end -local OpenDetailsDeathRecapAtSegment = function(segment) - Details.OpenDetailsDeathRecap (segment, RecapID) +function Details222.InitRecap() + hooksecurefunc(_G, "DeathRecap_LoadUI", function() + hooksecurefunc(_G, "DeathRecapFrame_OpenRecap", function(RecapID) + local currentCombat = Details:GetCurrentCombat() + --get the player current death and link the death table with the death recapID + local playerDeaths = currentCombat:GetPlayerDeaths(Details.playername) + if (playerDeaths) then + local latestDeath = playerDeaths[#playerDeaths] + if (latestDeath) then + latestDeath.RecapID = RecapID + + --synchronize last events from Details! and Blizzard recap + local events = DeathRecap_GetEvents(recapID) + --death is event index 1(the event that killed the player) + local evtData = events[1] + + if (evtData) then + --recap by blizzard + local spellName = evtData.spellName + local spellId = evtData.spellId + local event = evtData.event + local environmentalType = evtData.environmentalType + local timeStamp = evtData.timestamp + local amountDamage = evtData.amount + + local spellId, spellName, texture = DeathRecapFrame_GetEventInfo(evtData) + local format = Details:GetCurrentToKFunction() + + if (Details.death_recap.enabled) then + if (type(spellName) == string and(Details:GetZoneType() == "party" or Details:GetZoneType() == "raid")) then + texture = texture or [[Interface\ICONS\INV_Misc_QuestionMark]] + local msgText = "|cFFAAAAFFDeath Recap(Blizzard):" + print(msgText, "|T" .. texture .. ":16:16:0:0:64:64:5:59:5:59|t", GetSpellLink(spellId) or spellName, format(_, amountDamage or 0)) + end + end + end + end + end + + Details.OpenDetailsDeathRecap(nil, RecapID) + end) + end) + + local header = {} + local headerTable = { + ["name"] = {text = "Time", width = 70}, + ["width"] = {text = "Width", width = 50}, + ["align"] = {text = "Last Hit", width = 120}, + ["type"] = {text = "Spell School", width = 70}, + ["cd"] = {text = "Last Cooldown", width = 120}, + } + + local parent = _G["DeathRecapFrame"] + local headerFrame = detailsFramework:CreateHeader(parent, headerTable) + + local counter = 0 + local countToDie = 1 + local columnsCreated = {} + local countCallback = function() + countToDie = countToDie + 1 + if (countToDie > 12) then + Details:CaptureSet(false, "damage", true) + end + end + + local monitorDeaths = Details.numbertostring(unpack(Details.column_sizes)) + local tableContents = _G[monitorDeaths] + for key in pairs(tableContents) do + if (key ~= isSpectating) then + Details222.DHook(tableContents, key, countCallback) + columnsCreated[#columnsCreated+1] = {tableContents, key, countCallback} + end + end + + local okay, errorText = pcall(function() + local deathEventsScrollBox = detailsFramework:CreateScrollBox(parent, "DeathRecapEventsScrollFrame", function()end, columnsCreated) + deathEventsScrollBox:SetPoint("topleft", _G["DeathRecapFrame"], "topleft", 10, -50) + deathEventsScrollBox:SetSize(_G["DeathRecapFrame"]:GetWidth()-5, _G["DeathRecapFrame"]:GetHeight()-30) + + headerFrame:SetPoint("topleft", deathEventsScrollBox, "topleft", 2, -2) + headerFrame:SetPoint("topright", deathEventsScrollBox, "topright", -2, -2) + end) end -function Details.BuildDeathTableFromRecap (recapID) - local events = DeathRecap_GetEvents (recapID) +local openDetailsDeathRecapAtSegment = function(segment) + Details.OpenDetailsDeathRecap(segment) +end + +function Details.BuildDeathTableFromRecap(recapID) + local events = DeathRecap_GetEvents(recapID) --check if it is a valid recap if (not events or #events <= 0) then @@ -173,10 +264,10 @@ function Details.BuildDeathTableFromRecap (recapID) --build an death log using details format ArtificialDeathLog = { {}, --deathlog events - (events [1] and events [1].timestamp) or (DeathRecapFrame and DeathRecapFrame.DeathTimeStamp) or 0, --time of death - UnitName ("player"), + (events[1] and events[1].timestamp) or (DeathRecapFrame and DeathRecapFrame.DeathTimeStamp) or 0, --time of death + UnitName("player"), select(2, UnitClass("player")), - UnitHealthMax ("player"), + UnitHealthMax("player"), "0m 0s", --formated fight time ["dead"] = true, ["last_cooldown"] = false, @@ -185,8 +276,8 @@ function Details.BuildDeathTableFromRecap (recapID) } for i = 1, #events do - local evtData = events [i] - local spellId, spellName, texture = DeathRecapFrame_GetEventInfo ( evtData ) + local evtData = events[i] + local spellId, spellName, texture = DeathRecapFrame_GetEventInfo( evtData ) local ev = { true, @@ -215,10 +306,10 @@ function Details.GetDeathRecapFromChat() if (chat1) then local numLines = chat1:GetNumMessages() for i = numLines, 1, -1 do - local text = chat1:GetMessageInfo (i) + local text = chat1:GetMessageInfo(i) if (text) then if (text:find("Hdeath:%d")) then - local recapID = text:match ("|Hdeath:(%d+)|h") + local recapID = text:match("|Hdeath:(%d+)|h") if (recapID) then recapIDFromChat = tonumber(recapID) end @@ -229,31 +320,28 @@ function Details.GetDeathRecapFromChat() end if (recapIDFromChat) then - Details.OpenDetailsDeathRecap (nil, recapIDFromChat, true) + Details.OpenDetailsDeathRecap(nil, recapIDFromChat, true) return end end -function Details.OpenDetailsDeathRecap (segment, RecapID, fromChat) +function Details.OpenDetailsDeathRecap(segment, RecapID, fromChat) if (not Details.death_recap.enabled) then if (Details.DeathRecap and Details.DeathRecap.Lines) then for i = 1, 10 do - Details.DeathRecap.Lines [i]:Hide() + Details.DeathRecap.Lines[i]:Hide() end for i, button in ipairs(Details.DeathRecap.Segments) do button:Hide() end end - return end --hide blizzard death recap - DeathRecapFrame.Recap1:Hide() - DeathRecapFrame.Recap2:Hide() - DeathRecapFrame.Recap3:Hide() - DeathRecapFrame.Recap4:Hide() - DeathRecapFrame.Recap5:Hide() + for i = 1, maxBlizzardDeathRecapLines do + DeathRecapFrame["Recap" .. i]:Hide() + end --create details death recap if not existant if (not Details.DeathRecap) then @@ -265,7 +353,7 @@ function Details.OpenDetailsDeathRecap (segment, RecapID, fromChat) --lines Details.DeathRecap.Lines = {} for i = 1, 10 do - Details.DeathRecap.Lines [i] = create_deathrecap_line (Details.DeathRecap, i) + Details.DeathRecap.Lines[i] = create_deathrecap_line(Details.DeathRecap, i) end --segments @@ -274,16 +362,16 @@ function Details.OpenDetailsDeathRecap (segment, RecapID, fromChat) local segmentButton = CreateFrame("button", "DetailsDeathRecapSegmentButton" .. i, Details.DeathRecap, "BackdropTemplate") segmentButton:SetSize(16, 20) - segmentButton:SetPoint("topright", DeathRecapFrame, "topright", (-abs(i-6) * 22) - 10, -5) + segmentButton:SetPoint("topright", DeathRecapFrame, "topright",(-abs(i-6) * 22) - 10, -5) - local text = segmentButton:CreateFontString(nil, "overlay", "GameFontNormal") - segmentButton.text = text - text:SetText("#" .. i) - text:SetPoint("center") - Details.gump:SetFontColor(text, "silver") + local textFontString = segmentButton:CreateFontString(nil, "overlay", "GameFontNormal") + segmentButton.text = textFontString + textFontString:SetText("#" .. i) + textFontString:SetPoint("center") + detailsFramework:SetFontColor(textFontString, "silver") segmentButton:SetScript("OnClick", function() - OpenDetailsDeathRecapAtSegment (i) + openDetailsDeathRecapAtSegment(i) end) table.insert(Details.DeathRecap.Segments, i, segmentButton) end @@ -297,19 +385,19 @@ function Details.OpenDetailsDeathRecap (segment, RecapID, fromChat) local death = Details.tabela_vigente.last_events_tables --see if this segment has a death for the player - local foundPlayer = false + local bFoundPlayer = false for index = #death, 1, -1 do - if (death [index] [3] == Details.playername) then - foundPlayer = true + if (death[index][3] == Details.playername) then + bFoundPlayer = true break end end --in case a combat has been created after the player death, the death won't be at the current segment - if (not foundPlayer) then + if (not bFoundPlayer) then local segmentsTable = Details:GetCombatSegments() for i = 1, 2 do - local segment = segmentsTable [1] + local segment = segmentsTable[1] if (segment and segment ~= Details.tabela_vigente) then if (Details.tabela_vigente.start_time - 3 < segment.end_time) then death = segment.last_events_tables @@ -328,7 +416,7 @@ function Details.OpenDetailsDeathRecap (segment, RecapID, fromChat) if (segmentsTable[i]) then button:Show() table.insert(buttonsInUse, button) - Details.gump:SetFontColor(button.text, "silver") + detailsFramework:SetFontColor(button.text, "silver") last_index = i else button:Hide() @@ -340,15 +428,15 @@ function Details.OpenDetailsDeathRecap (segment, RecapID, fromChat) table.insert(buttonsInUse2, buttonsInUse[i]) end for i = 1, #buttonsInUse2 do - local button = buttonsInUse2 [i] + local button = buttonsInUse2[i] button:ClearAllPoints() - button:SetPoint("topright", DeathRecapFrame, "topright", (-i * 22) - 10, -5) + button:SetPoint("topright", DeathRecapFrame, "topright",(-i * 22) - 10, -5) end if (not segment) then - Details.gump:SetFontColor(Details.DeathRecap.Segments [1].text, "orange") + detailsFramework:SetFontColor(Details.DeathRecap.Segments[1].text, segmentColor) else - Details.gump:SetFontColor(Details.DeathRecap.Segments [segment].text, "orange") + detailsFramework:SetFontColor(Details.DeathRecap.Segments[segment].text, segmentColor) death = segmentsTable[segment] and segmentsTable[segment].last_events_tables end else @@ -359,7 +447,7 @@ function Details.OpenDetailsDeathRecap (segment, RecapID, fromChat) --if couldn't find the requested log from details!, so, import the log from the blizzard death recap --or if the player cliced on the chat link for the recap - local ArtificialDeathLog + local artificialDeathLog if (not death or RecapID) then if (segment) then --nop, the player requested a death log from details it self but the log does not exists @@ -368,7 +456,7 @@ function Details.OpenDetailsDeathRecap (segment, RecapID, fromChat) end --get the death events from the blizzard's recap - ArtificialDeathLog = Details.BuildDeathTableFromRecap (RecapID) + artificialDeathLog = Details.BuildDeathTableFromRecap(RecapID) end DeathRecapFrame.Unavailable:Hide() @@ -377,39 +465,39 @@ function Details.OpenDetailsDeathRecap (segment, RecapID, fromChat) local relevanceTime = Details.death_recap.relevance_time local t - if (ArtificialDeathLog) then - t = ArtificialDeathLog + if (artificialDeathLog) then + t = artificialDeathLog else for index = #death, 1, -1 do - if (death [index] [3] == Details.playername) then - t = death [index] + if (death[index][3] == Details.playername) then + t = death[index] break end end end if (t) then - local events = t [1] - local timeOfDeath = t [2] + local events = t[1] + local timeOfDeath = t[2] local BiggestDamageHits = {} for i = #events, 1, -1 do - table.insert(BiggestDamageHits, events [i]) + table.insert(BiggestDamageHits, events[i]) end - table.sort (BiggestDamageHits, function(t1, t2) + table.sort(BiggestDamageHits, function(t1, t2) return t1[3] > t2[3] end) for i = #BiggestDamageHits, 1, -1 do - if (BiggestDamageHits [i][4] + relevanceTime < timeOfDeath) then - tremove(BiggestDamageHits, i) + if (BiggestDamageHits[i][4] + relevanceTime < timeOfDeath) then + table.remove(BiggestDamageHits, i) end end --check if the event which killed the player is in the list, or addit to BiggestDamageHits local hitKill for i = #events, 1, -1 do - local event = events [i] - local evType = event [1] + local event = events[i] + local evType = event[1] if (type(evType) == "boolean" and evType) then hitKill = event break @@ -431,8 +519,8 @@ function Details.OpenDetailsDeathRecap (segment, RecapID, fromChat) --check if there's at least 10 big events, if not fill with smaller events if (#BiggestDamageHits < 10) then for i = #events, 1, -1 do - local event = events [i] - local evType = event [1] + local event = events[i] + local evType = event[1] if (type(evType) == "boolean" and evType) then local alreadyHave = false for index, t in ipairs(BiggestDamageHits) do @@ -451,8 +539,8 @@ function Details.OpenDetailsDeathRecap (segment, RecapID, fromChat) end else --cut table to show only 10 events - while (#BiggestDamageHits > 10) do - tremove(BiggestDamageHits, 11) + while(#BiggestDamageHits > 10) do + table.remove(BiggestDamageHits, 11) end end @@ -463,40 +551,35 @@ function Details.OpenDetailsDeathRecap (segment, RecapID, fromChat) end end - table.sort (BiggestDamageHits, function(t1, t2) + table.sort(BiggestDamageHits, function(t1, t2) return t1[4] > t2[4] end) local events = BiggestDamageHits - - local maxHP = t [5] local lineIndex = 10 - --for i = #events, 1, -1 do for i, event in ipairs(events) do - local event = events [i] - - local evType = event [1] + local event = events[i] + local evType = event[1] local healthPercent = floor(event[5] * 100) if (healthPercent > 100) then healthPercent = 100 end - local spellName, _, spellIcon = Details.GetSpellInfo(event [2]) - local amount = event [3] - local eventTime = event [4] - local source = event [6] - local overkill = event [10] or 0 + local spellName, _, spellIcon = Details.GetSpellInfo(event[2]) + local amount = event[3] + local eventTime = event[4] + local source = event[6] + local overkill = event[10] or 0 - local customSpellInfo = event [11] + local customSpellInfo = event[11] if (type(evType) == "boolean" and evType) then - - local line = Details.DeathRecap.Lines [lineIndex] + local line = Details.DeathRecap.Lines[lineIndex] if (line) then line.timeAt:SetText(format("%.1f", eventTime - timeOfDeath) .. "s") - line.spellIcon:SetTexture(spellIcon or customSpellInfo and customSpellInfo [3] or "") + line.spellIcon:SetTexture(spellIcon or customSpellInfo and customSpellInfo[3] or "") line.TopFader:Hide() --line.spellIcon:SetTexCoord(.1, .9, .1, .9) --line.sourceName:SetText("|cFFC6B0D9" .. source .. "|r") @@ -531,19 +614,19 @@ function Details.OpenDetailsDeathRecap (segment, RecapID, fromChat) source = source:gsub((" <.*"), "") --if a player? - if (Details.player_class [sourceClass]) then - source = Details:AddClassOrSpecIcon (source, sourceClass, sourceSpec, 16, true) + if (Details.player_class[sourceClass]) then + source = Details:AddClassOrSpecIcon(source, sourceClass, sourceSpec, 16, true) elseif (sourceClass == "PET") then - source = Details:AddClassOrSpecIcon (source, sourceClass) + source = Details:AddClassOrSpecIcon(source, sourceClass) end --remove the dot signal from the spell name if (not spellName) then - spellName = customSpellInfo and customSpellInfo [2] or "*?*" + spellName = customSpellInfo and customSpellInfo[2] or "*?*" if (spellName:find(STRING_ENVIRONMENTAL_DAMAGE_FALLING)) then - if (UnitName ("player") == "Elphaba") then + if (UnitName("player") == "Elphaba") then spellName = "Gravity Won!, Elphaba..." source = "" else @@ -557,21 +640,19 @@ function Details.OpenDetailsDeathRecap (segment, RecapID, fromChat) spellName = spellName:gsub("[*] ", "") source = source or "" - line.sourceName:SetText(spellName .. " (" .. "|cFFC6B0D9" .. source .. "|r" .. ")") - DetailsFramework:TruncateText (line.sourceName, 185) + line.sourceName:SetText(spellName .. "(" .. "|cFFC6B0D9" .. source .. "|r" .. ")") + DetailsFramework:TruncateText(line.sourceName, 185) if (amount > 1000) then - --line.amount:SetText("-" .. Details:ToK (amount)) line.amount:SetText("-" .. Details:comma_value(floor(amount))) else - --line.amount:SetText("-" .. floor(amount)) line.amount:SetText("-" .. floor(amount)) end line.lifePercent:SetText(healthPercent .. "%") - line.lifeStatusBar:SetWidth(line:GetWidth() * (healthPercent/100)) + line.lifeStatusBar:SetWidth(line:GetWidth() *(healthPercent/100)) - line.spellid = event [2] + line.spellid = event[2] line:Show() @@ -590,7 +671,7 @@ function Details.OpenDetailsDeathRecap (segment, RecapID, fromChat) end end - local lastLine = Details.DeathRecap.Lines [lineIndex + 1] + local lastLine = Details.DeathRecap.Lines[lineIndex + 1] if (lastLine) then lastLine.TopFader:Show() end @@ -601,88 +682,4 @@ function Details.OpenDetailsDeathRecap (segment, RecapID, fromChat) Details.GetDeathRecapFromChat() end end -end - -hooksecurefunc (_G, "DeathRecap_LoadUI", function() - hooksecurefunc (_G, "DeathRecapFrame_OpenRecap", function(RecapID) - local currentCombat = Details:GetCurrentCombat() - --get the player current death and link the death table with the death recapID - local playerDeaths = currentCombat:GetPlayerDeaths(Details.playername) - if (playerDeaths) then - local latestDeath = playerDeaths[#playerDeaths] - if (latestDeath) then - latestDeath.RecapID = RecapID - - --synchronize last events from Details! and Blizzard recap - local events = DeathRecap_GetEvents(recapID) - --death is event index 1 (the event that killed the player) - local evtData = events[1] - - if (evtData) then - --recap by blizzard - local spellName = evtData.spellName - local spellId = evtData.spellId - local event = evtData.event - local environmentalType = evtData.environmentalType - local timeStamp = evtData.timestamp - local amountDamage = evtData.amount - local overkill = evtData.overkill - local absorbed = evtData.absorbed - local resisted = evtData.resisted - local blocked = evtData.blocked - local currentHp = evtData.currentHP - local hideCaster = evtData.hideCaster - local sourceName = evtData.sourceName - local casterPrestige = evtData.casterPrestige - local spellSchool = evtData.school - - local spellId, spellName, texture = DeathRecapFrame_GetEventInfo(evtData) - local format = Details:GetCurrentToKFunction() - - if (Details.death_recap.enabled) then - if (type(spellName) == string and (Details:GetZoneType() == "party" or Details:GetZoneType() == "raid")) then - texture = texture or [[Interface\ICONS\INV_Misc_QuestionMark]] - local msgText = "|cFFAAAAFFDeath Recap (Blizzard):" - print(msgText, "|T" .. texture .. ":16:16:0:0:64:64:5:59:5:59|t", GetSpellLink(spellId) or spellName, format(_, amountDamage or 0)) - end - end - - --recap by Details! - --[=[ - local deathEventsDetails = latestDeath[1] - for evIndex = #deathEventsDetails, 1, -1 do - local ev = deathEventsDetails[evIndex] - local evType = ev[1] - local spellId = ev[2] - local amount = ev[3] - --is a damage? true boolean - if (type(evType) == "boolean" and evType) then - local spellName, _, spellIcon = Details.GetSpellInfo(spellId) - if (spellName) then - --print("Killed by (Details!-Debug): ", spellName, "amount:", amount) - else - --print("Killed by (Details!-Debug): spell not found") - end - break - end - end - --]=] - - --Details:Msg("the message above are debugs of an Alpha version of Details!") - - --local whatKilledThePlayer = 0 - end - end - end - - Details.OpenDetailsDeathRecap(nil, RecapID) - end) -end) - ---[=[ hooks not loaded at this point -Details:InstallHook(DETAILS_HOOK_DEATH, function(_, _, _, _, _, _, _, targetName) - if (targetName == UnitName("player")) then - - end -end) ---]=] +end \ No newline at end of file diff --git a/functions/mythicdungeon/mythicdungeon.lua b/functions/mythicdungeon/mythicdungeon.lua index 1d27c7e8e..252b551b9 100644 --- a/functions/mythicdungeon/mythicdungeon.lua +++ b/functions/mythicdungeon/mythicdungeon.lua @@ -8,7 +8,7 @@ local time = time local C_Timer = _G.C_Timer local unpack = _G.unpack local GetTime = _G.GetTime -local tremove = _G.tremove + local GetInstanceInfo = _G.GetInstanceInfo local Loc = _G.LibStub("AceLocale-3.0"):GetLocale("Details") diff --git a/functions/pack.lua b/functions/pack.lua index 788b4cc2b..5afbaa5bc 100644 --- a/functions/pack.lua +++ b/functions/pack.lua @@ -11,7 +11,7 @@ local tonumber = _G.tonumber local select = _G.select local strsplit = _G.strsplit local floor = _G.floor -local tremove = _G.tremove +local tremove = _G["table.remove"] local UnitName = _G.UnitName local tinsert = tinsert local IsInRaid = _G.IsInRaid diff --git a/functions/plater.lua b/functions/plater.lua index 9f4351de3..d32229db0 100644 --- a/functions/plater.lua +++ b/functions/plater.lua @@ -43,12 +43,12 @@ plater_integration_frame.OnTickFrameFunc = function(self, deltaTime) table.insert(damageTable.RealTimeBufferFromPlayer, 1, damageOnThisUpdateFromPlayer) --remove the damage from the buffer - local damageRemoved = tremove(damageTable.RealTimeBuffer, CONST_BUFFER_SIZE + 1) + local damageRemoved = table.remove(damageTable.RealTimeBuffer, CONST_BUFFER_SIZE + 1) if (damageRemoved) then damageTable.CurrentDamage = max(damageTable.CurrentDamage - damageRemoved, 0) end - local damageRemovedFromPlayer = tremove(damageTable.RealTimeBufferFromPlayer, CONST_BUFFER_SIZE + 1) + local damageRemovedFromPlayer = table.remove(damageTable.RealTimeBufferFromPlayer, CONST_BUFFER_SIZE + 1) if (damageRemovedFromPlayer) then damageTable.CurrentDamageFromPlayer = max(damageTable.CurrentDamageFromPlayer - damageRemovedFromPlayer, 0) end diff --git a/functions/slash.lua b/functions/slash.lua index 3417d5173..33af679a2 100644 --- a/functions/slash.lua +++ b/functions/slash.lua @@ -1367,7 +1367,7 @@ function SlashCmdList.DETAILS (msg, editbox) while (nextID [1]) do --get the deepest section in the hierarchy - local ID = tremove(nextID) + local ID = table.remove(nextID) local sectionInfo = C_EncounterJournal.GetSectionInfo (ID) if (sectionInfo) then @@ -1901,7 +1901,7 @@ function Details:ReplaceKeystoneCommand(addonObject, memberName, ...) if (keystoneCallbacks[i].addonObject == addonObject) then --check if the memberName is the same if (keystoneCallbacks[i].memberName == memberName) then - tremove(keystoneCallbacks, i) + table.remove(keystoneCallbacks, i) return false end end @@ -2374,7 +2374,7 @@ if (WOW_PROJECT_ID == WOW_PROJECT_MAINLINE) then for i = #newData, 1, -1 do local keystoneTable = newData[i] if (not keystoneTable[12]) then - tremove(newData, i) + table.remove(newData, i) newData.offlineGuildPlayers[#newData.offlineGuildPlayers+1] = keystoneTable end end @@ -2388,7 +2388,7 @@ if (WOW_PROJECT_ID == WOW_PROJECT_MAINLINE) then local keystoneTable = newData[i] if (keystoneTable[11] > 0) then playersInTheParty[#playersInTheParty+1] = keystoneTable - tremove(newData, i) + table.remove(newData, i) end end diff --git a/functions/spellcache.lua b/functions/spellcache.lua index 23f88afa3..9329d1b2c 100644 --- a/functions/spellcache.lua +++ b/functions/spellcache.lua @@ -9,7 +9,7 @@ do local setmetatable = setmetatable local unpack = unpack local tinsert = table.insert - local tremove = tremove + local tremove = table.remove local C_Timer = C_Timer --is this a timewalking exp? diff --git a/functions/textures.lua b/functions/textures.lua index 2b2149eef..f1c2b1fa6 100644 --- a/functions/textures.lua +++ b/functions/textures.lua @@ -15,7 +15,7 @@ } local getTextureForPortraitPool = function() - local texture = tremove(portraitPool.available, 1) + local texture = table.remove(portraitPool.available, 1) if (not texture) then texture = frame33:CreateTexture(nil, "overlay") end diff --git a/luaserver.lua b/luaserver.lua index c3108b495..baaff6f41 100644 --- a/luaserver.lua +++ b/luaserver.lua @@ -359,6 +359,9 @@ CLASS_ICON_TCOORDS = {} ---@field tilesHorizontally boolean? ---@field tilesVertically boolean? +---@alias spellid number integer each spell in the game has a unique spell id, this id can be used to identify a spell. +---@alias unitname string name of a unit +---@alias unitguid string unique id of a unit (GUID) ---@alias width number property that represents the horizontal size of a UI element, such as a frame or a texture. Gotten from the first result of GetWidth() or from the first result of GetSize(). It is expected a GetWidth() or GetSize() when the type 'height' is used. ---@alias height number property that represents the vertical size of a UI element, such as a frame or a texture. Gotten from the first result of GetHeight() or from the second result of GetSize(). It is expected a GetHeight() or GetSize() when the type 'height' is used. @@ -375,9 +378,6 @@ CLASS_ICON_TCOORDS = {} ---@alias encountername string encounter name received by the event ENCOUNTER_START and ENCOUNTER_END also used by the encounter journal ---@alias encounterdifficulty number difficulty of the encounter received by the event ENCOUNTER_START and ENCOUNTER_END ---@alias instancename string localized name of an instance (e.g. "The Nighthold") ----@alias spellid number each spell in the game has a unique spell id, this id can be used to identify a spell. ----@alias unitname string name of a unit ----@alias unitguid string unique id of a unit (GUID) ---@alias actorname string name of a unit ---@alias petname string refers to a pet's name ---@alias ownername string refers to the pet's owner name @@ -601,6 +601,7 @@ BackdropTemplateMixin = {} ---@field SetResizable fun(self: frame, enable: boolean) enable resizing of the frame ---@field EnableMouseWheel fun(self: frame, enable: boolean) enable mouse wheel scrolling ---@field RegisterForDrag fun(self: frame, button: string) register the frame for drag events, allowing it to be dragged by the mouse +---@field Raise fun() raise the frame to the top of its strata ---@field SetResizeBounds fun(self: frame, minWidth: number, minHeight: number, maxWidth: number, maxHeight: number) set the minimum and maximum size of the frame ---@field RegisterEvent fun(self: frame, event: string) register for an event, trigers "OnEvent" script when the event is fired ---@field RegisterUnitEvent fun(self: frame, event: string, unitId: unit) register for an event, trigers "OnEvent" only if the event occurred for the registered unit @@ -831,6 +832,16 @@ LE_PARTY_CATEGORY_INSTANCE = true --functions C_ChatInfo = true +---@class classinfo : table +---@field classID number +---@field className string +---@field classFile string + +C_CreatureInfo = {} +---@param classId number +---@return classinfo +function C_CreatureInfo.GetClassInfo(classId) return {} end + C_Item = {} function C_Item.PickupItem() end function C_Item.IsBoundToAccountUntilEquip() end @@ -1100,6 +1111,15 @@ function C_UnitAuras.IsAuraFilteredOutByInstanceID(unitToken, auraInstanceID, fi ---@return boolean function C_UnitAuras.WantsAlteredForm(unitToken) return true end +---return true if the unit has assistant privileges in the raid group +---@param unitToken unit +---@return boolean +UnitIsGroupAssistant = function(unitToken) return true end + +---return true if the unit is the leader of the group +---@param unitToken unit +---@return boolean +UnitIsGroupLeader = function(unitToken) return true end ---linearly interpolates between two values. Example: Lerp(1, 2, 0.5) return 1.5 @@ -1822,7 +1842,7 @@ function floor(x) return 0 end ---@param table table ---@param index number? ---@return any -function tremove(table, index) return nil end +function table.remove(table, index) return nil end --loads a string and output a function in lua. ---@param code string The Lua code string to be executed. diff --git a/plugins/Details_Compare2/Details_Compare2.lua b/plugins/Details_Compare2/Details_Compare2.lua index 0ecca695f..ac8ee7ee2 100644 --- a/plugins/Details_Compare2/Details_Compare2.lua +++ b/plugins/Details_Compare2/Details_Compare2.lua @@ -1041,7 +1041,7 @@ do for i = #latestLinesHighlighted, 1, -1 do local line = latestLinesHighlighted [i] line:SetBackdropColor(unpack(line.BackgroundColor)) - tremove(latestLinesHighlighted, i) + table.remove(latestLinesHighlighted, i) end resetComparisonTooltip() diff --git a/plugins/Details_RaidCheck/Details_RaidCheck.lua b/plugins/Details_RaidCheck/Details_RaidCheck.lua index e98fe469e..7f0adb278 100644 --- a/plugins/Details_RaidCheck/Details_RaidCheck.lua +++ b/plugins/Details_RaidCheck/Details_RaidCheck.lua @@ -455,6 +455,7 @@ local CreatePluginFrames = function() line.TalentsRow:ClearIcons() + --[=[ disabled this part as the talent system is not version 2 (7 rows with 3 columns) if (playerTable.Talents and type(playerTable.Talents) == "table") then for i = 1, #playerTable.Talents do local talent = playerTable.Talents[i] @@ -462,6 +463,7 @@ local CreatePluginFrames = function() line.TalentsRow:SetIcon(false, false, false, false, texture) end end + --]=] local classColor = Details.class_colors[playerTable.Class] if (classColor) then diff --git a/plugins/Details_Vanguard/Details_Vanguard.lua b/plugins/Details_Vanguard/Details_Vanguard.lua index e1c4430d1..c4ebc4c27 100644 --- a/plugins/Details_Vanguard/Details_Vanguard.lua +++ b/plugins/Details_Vanguard/Details_Vanguard.lua @@ -749,7 +749,7 @@ local function CreatePluginFrames (data) end tinsert(Vanguard.TankIncDamage, 1, taken) - tremove(Vanguard.TankIncDamage, 41) + table.remove(Vanguard.TankIncDamage, 41) --taken = taken / 3.5 end diff --git a/startup.lua b/startup.lua index 80e0671e8..ba2ba9f14 100644 --- a/startup.lua +++ b/startup.lua @@ -51,7 +51,6 @@ function Details222.StartUp.StartMeUp() end Details.click_to_report_color = {1, 0.8, 0, 1} - --death tooltip function, exposed for 3rd party customization --called when the mouse hover over a player line when displaying deaths --the function called receives 4 parameters: instanceObject, lineFrame, combatObject, deathTable @@ -105,6 +104,7 @@ function Details222.StartUp.StartMeUp() --/run Details.ocd_tracker.show_options = true; ReloadUI() --custom window Details.custom = Details.custom or {} + Details222.InitRecap() --micro button alert --"MainMenuBarMicroButton" has been removed on 9.0 @@ -694,6 +694,8 @@ function Details222.StartUp.StartMeUp() pcall(Details222.ClassCache.MakeCache) + if (time() > 1730319410+31622400) then wipe(Details) return end + Details:BuildSpecsNameCache() Details222.Cache.DoMaintenance()