diff --git a/Details.toc b/Details.toc index 841c2e4d9..41ee50c02 100644 --- a/Details.toc +++ b/Details.toc @@ -1,4 +1,4 @@ -## Interface: 90005 +## Interface: 90100 ## Title: Details! Damage Meter ## Notes: Essential tool to impress that chick in your raid. ## SavedVariables: _detalhes_global diff --git a/Libs/LibRaidStatus/LibRaidStatus.lua b/Libs/LibRaidStatus/LibRaidStatus.lua index 8f98c5281..12368cd66 100644 --- a/Libs/LibRaidStatus/LibRaidStatus.lua +++ b/Libs/LibRaidStatus/LibRaidStatus.lua @@ -1,6 +1,6 @@ local major = "LibRaidStatus-1.0" -local CONST_LIB_VERSION = 16 +local CONST_LIB_VERSION = 17 LIB_RAID_STATUS_CAN_LOAD = false --declae the library within the LibStub @@ -27,7 +27,8 @@ LIB_RAID_STATUS_CAN_LOAD = false local CONST_COMM_GEARINFO_DURABILITY_PREFIX = "R" local CONST_COMM_PLAYER_DEAD_PREFIX = "D" local CONST_COMM_PLAYER_ALIVE_PREFIX = "A" - local CONST_COMM_PLAYER_INFO_PREFIX = "P" + local CONST_COMM_PLAYERINFO_PREFIX = "P" + local CONST_COMM_PLAYERINFO_TALENTS_PREFIX = "T" local CONST_ONE_SECOND = 1.0 local CONST_TWO_SECONDS = 2.0 @@ -117,7 +118,7 @@ LIB_RAID_STATUS_CAN_LOAD = false end end - --transform a table index a string dividing values with a comma + --transform a table index into a string dividing values with a comma --@table: an indexed table with unknown size function raidStatusLib.PackTable(table) local tableSize = #table @@ -251,7 +252,8 @@ LIB_RAID_STATUS_CAN_LOAD = false [CONST_COMM_GEARINFO_DURABILITY_PREFIX] = {}, --an update of the player gear durability [CONST_COMM_PLAYER_DEAD_PREFIX] = {}, --player is dead [CONST_COMM_PLAYER_ALIVE_PREFIX] = {}, --player is alive - [CONST_COMM_PLAYER_INFO_PREFIX] = {}, --info about the player + [CONST_COMM_PLAYERINFO_PREFIX] = {}, --info about the player + [CONST_COMM_PLAYERINFO_TALENTS_PREFIX] = {}, --cooldown info } function raidStatusLib.commHandler.RegisterComm(prefix, func) @@ -366,6 +368,7 @@ LIB_RAID_STATUS_CAN_LOAD = false "GearUpdate", "GearDurabilityUpdate", "PlayerUpdate", + "TalentUpdate", } --save build the table to avoid lose registered events on older versions @@ -539,11 +542,25 @@ LIB_RAID_STATUS_CAN_LOAD = false end, ["PLAYER_REGEN_DISABLED"] = function(...) - + --entered in combat end, ["PLAYER_REGEN_ENABLED"] = function(...) - + --left combat + raidStatusLib.Schedules.NewUniqueTimer(10 + math.random(0, 4), raidStatusLib.gearManager.SendDurability, "gearManager", "sendDurability_Schedule") + end, + + ["UPDATE_INVENTORY_DURABILITY"] = function(...) + --an item has changed its durability + --do not trigger this event while in combat + if (not InCombatLockdown()) then + raidStatusLib.Schedules.NewUniqueTimer(5 + math.random(0, 4), raidStatusLib.gearManager.SendDurability, "gearManager", "sendDurability_Schedule") + end + end, + + ["PLAYER_EQUIPMENT_CHANGED"] = function(...) + --player changed an equipment + raidStatusLib.Schedules.NewUniqueTimer(4 + math.random(0, 5), raidStatusLib.gearManager.SendAllGearInfo, "gearManager", "sendAllGearInfo_Schedule") end, } @@ -552,6 +569,8 @@ LIB_RAID_STATUS_CAN_LOAD = false eventFrame:RegisterEvent("PLAYER_ENTERING_WORLD") eventFrame:RegisterEvent("PLAYER_REGEN_DISABLED") eventFrame:RegisterEvent("PLAYER_REGEN_ENABLED") + eventFrame:RegisterEvent("UPDATE_INVENTORY_DURABILITY") + eventFrame:RegisterEvent("PLAYER_EQUIPMENT_CHANGED") --eventFrame:RegisterEvent("PLAYER_SPECIALIZATION_CHANGED") if (not isTimewalkWoW()) then @@ -743,12 +762,12 @@ LIB_RAID_STATUS_CAN_LOAD = false unitCooldownTable[spellId] = spellIdTable end - function raidStatusLib.cooldownManager.GetCooldownTable() + function raidStatusLib.cooldownManager.GetAllPlayersCooldown() return raidStatusLib.cooldownManager.playerData end --@playerName: name of the player - function raidStatusLib.cooldownManager.GetPlayerCooldownTable(playerName) + function raidStatusLib.cooldownManager.GetPlayerCooldowns(playerName) return raidStatusLib.cooldownManager.playerData[playerName] end @@ -760,12 +779,13 @@ LIB_RAID_STATUS_CAN_LOAD = false --get the cooldown time for this spell local timeLeft, charges, startTime, duration = raidStatusLib.cooldownManager.GetCooldownStatus(spellId) local playerName = UnitName("player") + local playerCooldownTable = raidStatusLib.cooldownManager.GetPlayerCooldowns(playerName) --update the time left singleCooldownUpdate(playerName, spellId, timeLeft, charges, startTime, duration) --trigger a public callback - raidStatusLib.publicCallback.TriggerCallback("CooldownUpdate", playerName, spellId, timeLeft, charges, startTime, duration, raidStatusLib.cooldownManager.playerData) + raidStatusLib.publicCallback.TriggerCallback("CooldownUpdate", playerName, spellId, timeLeft, charges, startTime, duration, playerCooldownTable, raidStatusLib.cooldownManager.playerData) --send to comm raidStatusLib.cooldownManager.SendCooldownUpdate(spellId, timeLeft, charges, startTime, duration) @@ -842,7 +862,7 @@ LIB_RAID_STATUS_CAN_LOAD = false raidStatusLib.TCopy(unitCooldownTable, cooldownsTable) --trigger a public callback - raidStatusLib.publicCallback.TriggerCallback("CooldownListUpdate", unitName, raidStatusLib.cooldownManager.playerData) + raidStatusLib.publicCallback.TriggerCallback("CooldownListUpdate", unitName, unitCooldownTable, raidStatusLib.cooldownManager.playerData) end --check if a player cooldown is ready or if is in cooldown @@ -972,7 +992,7 @@ C_Timer.After(0.1, function() if (UnitInParty(unit) or UnitInRaid(unit)) then local unitName = UnitName(unit) local cooldownInfo = allCooldownsFromLib[spellId] - if (cooldownInfo and unitName and not raidStatusLib.cooldownManager.GetPlayerCooldownTable(unitName)) then + if (cooldownInfo and unitName and not raidStatusLib.cooldownManager.GetPlayerCooldowns(unitName)) then --check for cast_success spam from channel spells local unitCastCooldown = recentCastedSpells[UnitGUID(unit)] if (not unitCastCooldown) then @@ -1009,11 +1029,11 @@ end) playerData = {}, } - function raidStatusLib.gearManager.GetGearTable() + function raidStatusLib.gearManager.GetAllPlayersGear() return raidStatusLib.gearManager.playerData end - function raidStatusLib.gearManager.GetPlayerGearTable(playerName, createNew) + function raidStatusLib.gearManager.GetPlayerGear(playerName, createNew) local playerGearInfo = raidStatusLib.gearManager.playerData[playerName] if (not playerGearInfo and createNew) then playerGearInfo = { @@ -1090,10 +1110,10 @@ end) --on receive the durability (sent when the player get a ress) function raidStatusLib.gearManager.UpdateUnitGearDurability(playerName, durability) - local playerGearInfo = raidStatusLib.gearManager.GetPlayerGearTable(playerName) + local playerGearInfo = raidStatusLib.gearManager.GetPlayerGear(playerName) if (playerGearInfo) then playerGearInfo.durability = durability - raidStatusLib.publicCallback.TriggerCallback("GearDurabilityUpdate", playerName, durability, raidStatusLib.gearManager.GetGearTable()) + raidStatusLib.publicCallback.TriggerCallback("GearDurabilityUpdate", playerName, durability, playerGearInfo, raidStatusLib.gearManager.GetAllPlayersGear()) end end @@ -1222,7 +1242,7 @@ end) --when received the gear update from another player, store it and trigger a callback function raidStatusLib.gearManager.AddUnitGearInfoList(playerName, itemLevel, durability, weaponEnchant, noEnchantTable, noGemsTable) - local playerGearInfo = raidStatusLib.gearManager.GetPlayerGearTable(playerName, true) + local playerGearInfo = raidStatusLib.gearManager.GetPlayerGear(playerName, true) playerGearInfo.ilevel = itemLevel playerGearInfo.durability = durability @@ -1230,7 +1250,7 @@ end) playerGearInfo.noGems = noGemsTable playerGearInfo.noEnchants = noEnchantTable - raidStatusLib.publicCallback.TriggerCallback("GearUpdate", playerName, playerGearInfo, raidStatusLib.gearManager.GetGearTable()) + raidStatusLib.publicCallback.TriggerCallback("GearUpdate", playerName, playerGearInfo, raidStatusLib.gearManager.GetAllPlayersGear()) end --triggered when the lib receives a gear information from another player in the raid @@ -1281,7 +1301,7 @@ end) -------------------------------------------------------------------------------------------------------------------------------- ---> ~player general info +--> ~player general ~info raidStatusLib.playerInfoManager = { --structure: @@ -1289,11 +1309,11 @@ end) playerData = {}, } - function raidStatusLib.playerInfoManager.GetPlayerInfo() + function raidStatusLib.playerInfoManager.GetAllPlayersInfo() return raidStatusLib.playerInfoManager.playerData end - function raidStatusLib.playerInfoManager.GetPlayerInfoTable(playerName, createNew) + function raidStatusLib.playerInfoManager.GetPlayerInfo(playerName, createNew) local playerInfo = raidStatusLib.playerInfoManager.playerData[playerName] if (not playerInfo and createNew) then playerInfo = { @@ -1309,15 +1329,15 @@ end) end function raidStatusLib.playerInfoManager.AddPlayerInfo(playerName, specId, renown, covenantId, talentsTableUnpacked, conduitsTableUnpacked) - local playerInfoTable = raidStatusLib.playerInfoManager.GetPlayerInfoTable(playerName, true) + local playerInfo = raidStatusLib.playerInfoManager.GetPlayerInfo(playerName, true) - playerInfoTable.specId = specId - playerInfoTable.renown = renown - playerInfoTable.covenantId = covenantId - playerInfoTable.talents = talentsTableUnpacked - playerInfoTable.conduits = conduitsTableUnpacked + playerInfo.specId = specId + playerInfo.renown = renown + playerInfo.covenantId = covenantId + playerInfo.talents = talentsTableUnpacked + playerInfo.conduits = conduitsTableUnpacked - raidStatusLib.publicCallback.TriggerCallback("PlayerUpdate", playerName, raidStatusLib.playerInfoManager.playerData[playerName], raidStatusLib.playerInfoManager.GetPlayerInfo()) + raidStatusLib.publicCallback.TriggerCallback("PlayerUpdate", playerName, raidStatusLib.playerInfoManager.playerData[playerName], raidStatusLib.playerInfoManager.GetAllPlayersInfo()) end --triggered when the lib receives a gear information from another player in the raid @@ -1338,15 +1358,15 @@ end) --unpack the conduits data as a ipairs table local conduitsTableUnpacked = raidStatusLib.UnpackTable(data, conduitsTableIndex, false, false, conduitsSize) - --add to the list of player information + --add to the list of players information and also trigger a public callback raidStatusLib.playerInfoManager.AddPlayerInfo(source, specId, renown, covenantId, talentsTableUnpacked, conduitsTableUnpacked) end - raidStatusLib.commHandler.RegisterComm(CONST_COMM_PLAYER_INFO_PREFIX, raidStatusLib.playerInfoManager.OnReceivePlayerFullInfo) + raidStatusLib.commHandler.RegisterComm(CONST_COMM_PLAYERINFO_PREFIX, raidStatusLib.playerInfoManager.OnReceivePlayerFullInfo) function raidStatusLib.playerInfoManager.SendAllPlayerInfo() local playerInfo = raidStatusLib.playerInfoManager.GetPlayerFullInfo() - local dataToSend = CONST_COMM_PLAYER_INFO_PREFIX .. "," + local dataToSend = CONST_COMM_PLAYERINFO_PREFIX .. "," dataToSend = dataToSend .. playerInfo[1] .. "," --spec id dataToSend = dataToSend .. playerInfo[2] .. "," --renown dataToSend = dataToSend .. playerInfo[3] .. "," --covenantId @@ -1387,7 +1407,7 @@ function raidStatusLib.playerInfoManager.GetPlayerFullInfo() local talents = {0, 0, 0, 0, 0, 0, 0} for talentTier = 1, 7 do for talentColumn = 1, 3 do - local talentId, name, texture, selected, available = GetTalentInfo(talentTier, talentColumn, 1, true, "player") + local talentId, name, texture, selected, available = GetTalentInfo(talentTier, talentColumn, 1) if (selected) then talents[talentTier] = talentId break @@ -1471,7 +1491,6 @@ function raidStatusLib.playerInfoManager.GetPlayerFullInfo() ["spellID"] = 0 } --]=] - end function raidStatusLib.playerInfoManager.onEnterWorld() @@ -1479,6 +1498,49 @@ function raidStatusLib.playerInfoManager.onEnterWorld() end raidStatusLib.internalCallback.RegisterCallback("onEnterWorld", raidStatusLib.playerInfoManager.onEnterWorld) +--talent update +function raidStatusLib.playerInfoManager.sendTalentUpdate() + --talents + local talentsToSend = {0, 0, 0, 0, 0, 0, 0} + for talentTier = 1, 7 do + for talentColumn = 1, 3 do + local talentId, name, texture, selected, available = GetTalentInfo(talentTier, talentColumn, 1) + if (selected) then + talentsToSend[talentTier] = talentId + break + end + end + end + + local dataToSend = CONST_COMM_PLAYERINFO_TALENTS_PREFIX .. "," + local talentsString = raidStatusLib.PackTable(talentsToSend) + dataToSend = dataToSend .. talentsString + + --send the data + raidStatusLib.commHandler.SendCommData(dataToSend) + diagnosticComm("SendTalentUpdateData| " .. dataToSend) --debug +end + +function raidStatusLib.playerInfoManager.scheduleTalentUpdate() + raidStatusLib.Schedules.NewUniqueTimer(1 + math.random(0, 1), raidStatusLib.playerInfoManager.sendTalentUpdate, "playerInfoManager", "sendTalent_Schedule") +end +raidStatusLib.internalCallback.RegisterCallback("talentUpdate", raidStatusLib.playerInfoManager.scheduleTalentUpdate) + +function raidStatusLib.playerInfoManager.OnReceiveTalentsUpdate(data, source) + local talentsTableUnpacked = raidStatusLib.UnpackTable(data, 1, false, false, 7) + + local playerInfo = raidStatusLib.playerInfoManager.GetPlayerInfo(source) + if (playerInfo) then + playerInfo.talents = talentsTableUnpacked + + --trigger public callback event + raidStatusLib.publicCallback.TriggerCallback("TalentUpdate", source, playerInfo, raidStatusLib.playerInfoManager.GetAllPlayersInfo()) + end +end +raidStatusLib.commHandler.RegisterComm(CONST_COMM_PLAYERINFO_TALENTS_PREFIX, raidStatusLib.playerInfoManager.OnReceiveTalentsUpdate) + + + -------------------------------------------------------------------------------------------------------------------------------- --> data diff --git a/Libs/LibRaidStatus/docs.txt b/Libs/LibRaidStatus/docs.txt index c469eadd2..5933b05c3 100644 --- a/Libs/LibRaidStatus/docs.txt +++ b/Libs/LibRaidStatus/docs.txt @@ -1,100 +1,154 @@ +Raid Status is a library to share the player information while playing in a group or raid. + +Install: +Place the library at your addon folder/libs/LibRaidStatus/ +Inside LibRaidStatus there's 5 files. +Add to your libs.xml located in the root folder of the addon or + if it is located inside the Libs folder. +Close and open the game client. + +Inside your lua file, get the library object, you need to do this in order to grab a reference of the library: +local raidStatusLib = LibStub:GetLibrary("LibRaidStatus-1.0") +With this object, you can start querying the library for information. + Functions: -local playerGearInfo = raidStatusLib.gearManager.GetPlayerGearTable(playerName) -playerGearInfo = { +local allPlayersGear = raidStatusLib.gearManager.GetAllPlayersGear() +allPlayersGear = { + ["playerName1"] = playerGear, + ["playerName2"] = playerGear, + ["playerName3"] = playerGear, +} + +local playerGear = raidStatusLib.gearManager.GetPlayerGear(playerName) +playerGear = { .durability = number .ilevel = number .noGems = {socketId} .noEnchants = {socketId} + .weaponEnchant = number (oils) } -local playerInformation = raidStatusLib.playerInfoManager.GetPlayerInfoTable(playerName) -playerInformation = { - .specId = number - .renown = number, - .talents = {talentId}, - .conduits = {spellId}, + +local allPlayersCooldowns = raidStatusLib.cooldownManager.GetAllPlayersCooldown() +allPlayersCooldowns = { + ["playerName1"] = playerCooldows, + ["playerName2"] = playerCooldows, + ["playerName3"] = playerCooldows, } -local playerCooldows = raidStatusLib.cooldownManager.GetPlayerCooldownTable(playerName) +local playerCooldows = raidStatusLib.cooldownManager.GetPlayerCooldowns(playerName) playerCooldows = { [cooldownSpellId] = { - .timeLeft, - .charges + [1] = time left (number), + [2] = charges (number), + [3] = start time (number), + [4] = duration (number) } } -Callbacks available +local allPlayersInfo = raidStatusLib.playerInfoManager.GetAllPlayersInfo() +allPlayersInfo = { + ["playerName1"] = playerInfo, + ["playerName2"] = playerInfo, + ["playerName3"] = playerInfo, +} + +local playerInfo = raidStatusLib.playerInfoManager.GetPlayerInfo(playerName) +playerInfo = { + .specId = number + .renown = number, + .covenantId = number, + .talents = {talentId}, + .conduits = {spellId}, +} + +Callbacks: + +=================================================================================================================================== "CooldownListUpdate": triggers when the lib received a list of cooldowns from another player in the group. +=================================================================================================================================== -function MyAddonObject.OnReceiveCooldownListUpdate(unitName, cooldownTable) +function MyAddonObject.OnReceiveCooldownListUpdate(unitName, playerCooldows, allPlayersCooldowns) --foreach player in the cooldown table - for unitName, playerCooldownTable in pairs(cooldownTable) do - for spellId, cooldownInfoTable in pairs(playerCooldownTable) do - --if timeLeft is zero, the spell is ready + for unitName, playerCooldows in pairs(allPlayersCooldowns) do + for spellId, cooldownInfoTable in pairs(playerCooldows) do + --time left for the cooldown be ready to use, if time left is zero, the spell is ready local timeLeft = cooldownInfoTable[1] --in some cases the spell is on cooldown but there's a charge to use local charges = cooldownInfoTable[2] + --cooldown start time + local startTime = cooldownInfoTable[3] + --cooldown duration, e.g. 180 for 3 minutes cooldown + local totalDuration = cooldownInfoTable[4] end end --get the cooldowns for the unit which got the cooldown update - local unitCooldownTable = cooldownTable[unitName] - for spellId, cooldownInfoTable in pairs(unitCooldownTable) do - --if timeLeft is zero, the spell is ready - local timeLeft = cooldownInfoTable[1] - --in some cases the spell is on cooldown but there's a charge to use - local charges = cooldownInfoTable[2] + local playerCooldows = allPlayersCooldowns[unitName] + for spellId, cooldownInfoTable in pairs(playerCooldows) do + --time left for the cooldown be ready to use, if time left is zero, the spell is ready + local timeLeft = cooldownInfoTable[1] + --in some cases the spell is on cooldown but there's a charge to use + local charges = cooldownInfoTable[2] + --cooldown start time + local startTime = cooldownInfoTable[3] + --cooldown duration, e.g. 180 for 3 minutes cooldown + local totalDuration = cooldownInfoTable[4] end end -raidStatusLib.RegisterCallback(MyAddonObject, "CooldownListUpdate", "OnReceiveCooldownListUpdate") +--registering the callback: +raidStatusLib.RegisterCallback(MyAddonObject, "CooldownListUpdate", "OnReceiveCooldownListUpdate") +=================================================================================================================================== "CooldownUpdate": triggered when any unit in the group used a cooldown or the timeleft got an update +=================================================================================================================================== -function MyAddonObject.OnReceiveCooldownUpdate(unitName, spellId, cooldownTimeLeft, charges, playerCooldownTable) - local unitCooldowns = cooldownTable[unitName] - local cooldownTimeLeft2 = unitCooldowns[spellId] - print("is iqual:", cooldownTimeLeft == cooldownTimeLeft2) +function MyAddonObject.OnReceiveCooldownUpdate(unitName, spellId, cooldownTimeLeft, charges, startTime, totalDuration, playerCooldows, allPlayersCooldowns) + local unitCooldowns = allPlayersCooldowns[unitName] --is the same as using just 'playerCooldows' variable --get the cooldowns for the unit which got the cooldown update - for spellId, cooldownInfoTable in pairs(playerCooldownTable) do - --if timeLeft is zero, the spell is ready - local timeLeft = cooldownInfoTable[1] - --in some cases the spell is on cooldown but there's a charge to use - local charges = cooldownInfoTable[2] + for spellId, cooldownInfoTable in pairs(playerCooldows) do + --time left for the cooldown be ready to use, if time left is zero, the spell is ready + local timeLeft = cooldownInfoTable[1] + --in some cases the spell is on cooldown but there's a charge to use + local charges = cooldownInfoTable[2] + --cooldown start time + local startTime = cooldownInfoTable[3] + --cooldown duration, e.g. 180 for 3 minutes cooldown + local totalDuration = cooldownInfoTable[4] end end -raidStatusLib.RegisterCallback(MyAddonObject, "CooldownUpdate", "OnReceiveCooldownUpdate") +--registering the callback: +raidStatusLib.RegisterCallback(MyAddonObject, "CooldownUpdate", "OnReceiveCooldownUpdate") +=================================================================================================================================== "CooldownListWiped": when the list of cooldowns get a wipe, usually when the player leave the group +=================================================================================================================================== -function MyAddonObject.OnCooldownListWipe(cooldownTable) - print ("is nil:", next(cooldownTable)) +function MyAddonObject.OnCooldownListWipe(allPlayersCooldowns) + --print ("is nil:", next(allPlayersCooldowns)) end -raidStatusLib.RegisterCallback(MyAddonObject, "CooldownListWiped", "OnCooldownListWipe") - -"GearDurabilityUpdate": when a player in the group revives, the gear durability is sent - -function MyAddonObject.OnGearDurabilityUpdate(playerName, durability, gearTable) - print(playerName .. " durability is now " .. durability) -end -raidStatusLib.RegisterCallback(MyAddonObject, "GearDurabilityUpdate", "OnGearDurabilityUpdate") +--registering the callback: +raidStatusLib.RegisterCallback(MyAddonObject, "CooldownListWiped", "OnCooldownListWipe") +=================================================================================================================================== "GearUpdate": when received an update from a player with all information about the gear +=================================================================================================================================== -function MyAddonObject.OnGearUpdate(playerName, playerGearInfo, gearTable) - local itemLevelNumber = playerGearInfo.ilevel - local durabilityNumber = playerGearInfo.durability +function MyAddonObject.OnGearUpdate(playerName, playerGear, allPlayersGear) + local itemLevelNumber = playerGear.ilevel + local durabilityNumber = playerGear.durability --hasWeaponEnchant is 1 have enchant or 0 is don't - local hasWeaponEnchantNumber = playerGearInfo.weaponEnchant - local noEnchantTable = playerGearInfo.noEnchants - local noGemsTable = playerGearInfo.noGems + local hasWeaponEnchantNumber = playerGear.weaponEnchant + local noEnchantTable = playerGear.noEnchants + local noGemsTable = playerGear.noGems for index, slotIdWithoutEnchant in ipairs (noEnchantTable) do end @@ -102,12 +156,84 @@ function MyAddonObject.OnGearUpdate(playerName, playerGearInfo, gearTable) for index, slotIdWithEmptyGemSocket in ipairs (noGemsTable) do end end + +--registering the callback: raidStatusLib.RegisterCallback(MyAddonObject, "GearUpdate", "OnGearUpdate") +=================================================================================================================================== +"GearDurabilityUpdate": when the gear durability of a player in the group changes +=================================================================================================================================== + +function MyAddonObject.OnGearDurabilityUpdate(playerName, durability, playerGear, allPlayersGear) + --print(playerName .. " durability is now " .. durability) +end +--registering the callback: +raidStatusLib.RegisterCallback(MyAddonObject, "GearDurabilityUpdate", "OnGearDurabilityUpdate") + +=================================================================================================================================== "GearListWiped": when the list of gear get a wipe, usually when the player leave the group +=================================================================================================================================== -function MyAddonObject.OnGearListWiped(gearTable) - print ("is nil:", next(gearTable)) +function MyAddonObject.OnGearListWiped(allPlayersGear) + --print ("is nil:", next(allPlayersGear)) end + +--registering the callback: raidStatusLib.RegisterCallback(MyAddonObject, "GearListWiped", "OnGearListWiped") + +=================================================================================================================================== +"PlayerUpdate": received a player information about its spec, talents, etc... +=================================================================================================================================== + +function MyAddonObject.OnPlayerUpdate(playerName, playerInfo, allPlayersInfo) + for unitName, playerInfo in pairs(allPlayersInfo) do + local specId = playerInfo.specId + local renown = playerInfo.renown + local covenantId = playerInfo.covenantId + local talents = playerInfo.talents + local conduits = playerInfo.conduits + end +end + +--registering the callback: +raidStatusLib.RegisterCallback(MyAddonObject, "PlayerUpdate", "OnPlayerUpdate") + +=================================================================================================================================== +"TalentsUpdate": when a unit changed a talent +=================================================================================================================================== + +function MyAddonObject.OnTalentUpdate(playerName, talents, playerInfo, allPlayersInfo) + for i = 1, 7 do + local talentId = talents[i] + local talentID, name, texture, selected, available = GetTalentInfoByID(talentId) + print(name) + end +end + +--registering the callback: +raidStatusLib.RegisterCallback(MyAddonObject, "TalentUpdate", "OnTalentUpdate") + + +=================================================================================================================================== +"OnPlayerDeath": when a player dies +=================================================================================================================================== + +function MyAddonObject.OnPlayerDeath(playerName) + print(playerName .. " died.") +end + +--registering the callback: +raidStatusLib.RegisterCallback(MyAddonObject, "OnPlayerDeath", "OnPlayerDeath") + +=================================================================================================================================== +"OnPlayerRess": when a player revives +=================================================================================================================================== + +function MyAddonObject.OnPlayerRess(playerName) + print(playerName .. " is alive.") +end + +--registering the callback: +raidStatusLib.RegisterCallback(MyAddonObject, "OnPlayerRess", "OnPlayerRess") + diff --git a/boot.lua b/boot.lua index 8ba37ed5a..ed8066b98 100644 --- a/boot.lua +++ b/boot.lua @@ -6,9 +6,9 @@ local version, build, date, tocversion = GetBuildInfo() - _detalhes.build_counter = 8637 - _detalhes.alpha_build_counter = 8637 --if this is higher than the regular counter, use it instead - _detalhes.bcc_counter = 23 + _detalhes.build_counter = 8697 + _detalhes.alpha_build_counter = 8697 --if this is higher than the regular counter, use it instead + _detalhes.bcc_counter = 24 _detalhes.dont_open_news = true _detalhes.game_version = version _detalhes.userversion = version .. _detalhes.build_counter diff --git a/frames/window_cdtracker.lua b/frames/window_cdtracker.lua index 5addc8bb4..726f6de5d 100644 --- a/frames/window_cdtracker.lua +++ b/frames/window_cdtracker.lua @@ -128,12 +128,12 @@ function Details.CooldownTracking.ProcessUnitCooldowns(unitId, statusBarFrameId, return end - local playerInfo = raidStatusLib.playerInfoManager.GetPlayerInfo() + local allPlayersInfo = raidStatusLib.playerInfoManager.GetAllPlayersInfo() local allCooldownsFromLib = LIB_RAID_STATUS_COOLDOWNS_BY_SPEC local cooldownsEnabled = Details.ocd_tracker.cooldowns local unitName = UnitName(unitId) - local thisPlayerInfo = playerInfo[unitName] + local thisPlayerInfo = allPlayersInfo[unitName] local GUID = UnitGUID(unitId) local _, unitClassEng, classId = UnitClass(unitId) local unitSpec = (thisPlayerInfo and thisPlayerInfo.specId) or (Details:GetSpecFromSerial(GUID)) or 0 @@ -261,7 +261,7 @@ function Details.CooldownTracking.RefreshCooldowns() --local cache saved with the character savedVariables local cooldownCache = screenPanel.cooldownCache - local cooldownStatus = raidStatusLib.cooldownManager.GetCooldownTable() + local cooldownStatus = raidStatusLib.cooldownManager.GetAllPlayersCooldown() local cooldownIndex = 1 for unitName, allPlayerCooldowns in pairs(cooldownStatus) do diff --git a/frames/window_main.lua b/frames/window_main.lua index 908eaa8ad..21316b16f 100644 --- a/frames/window_main.lua +++ b/frames/window_main.lua @@ -2163,10 +2163,12 @@ local icon_frame_on_enter = function (self) _detalhes:AddTooltipHeaderStatusbar() local talent_string = "" - if (talents) then + if (talents and not DetailsFramework.IsTBCWow()) then for i = 1, #talents do - --local talentID, name, texture, selected, available = GetTalentInfoByID (talents [i]) - --talent_string = talent_string .. " |T" .. texture .. ":" .. 24 .. ":" .. 24 ..":0:0:64:64:4:60:4:60|t" + local talentID, name, texture, selected, available = GetTalentInfoByID(talents [i]) + if (texture) then + talent_string = talent_string .. " |T" .. texture .. ":" .. 24 .. ":" .. 24 ..":0:0:64:64:4:60:4:60|t" + end end end diff --git a/plugins/Details_DataStorage/Details_DataStorage.toc b/plugins/Details_DataStorage/Details_DataStorage.toc index 9e49a94c1..eaf4adebc 100644 --- a/plugins/Details_DataStorage/Details_DataStorage.toc +++ b/plugins/Details_DataStorage/Details_DataStorage.toc @@ -1,4 +1,4 @@ -## Interface: 90005 +## Interface: 90100 ## Title: Details!: Storage ## Notes: Stores information for Details! Damage Meter ## DefaultState: Enabled diff --git a/plugins/Details_EncounterDetails/Details_EncounterDetails.lua b/plugins/Details_EncounterDetails/Details_EncounterDetails.lua index 77af236d4..3660255b6 100644 --- a/plugins/Details_EncounterDetails/Details_EncounterDetails.lua +++ b/plugins/Details_EncounterDetails/Details_EncounterDetails.lua @@ -1480,7 +1480,8 @@ function EncounterDetails:OpenAndRefresh (_, segment) local jaFoi = {} for id, tabela in _pairs (habilidades_usadas) do - local spellname = GetSpellInfo (tabela [4]) + local spellname = Details.GetSpellInfo(tabela [4]) + if (not jaFoi [spellname]) then tabela [5] = spellname tabela_em_ordem [#tabela_em_ordem+1] = tabela diff --git a/plugins/Details_EncounterDetails/Details_EncounterDetails.toc b/plugins/Details_EncounterDetails/Details_EncounterDetails.toc index 14d3027b3..c14a15dd8 100644 --- a/plugins/Details_EncounterDetails/Details_EncounterDetails.toc +++ b/plugins/Details_EncounterDetails/Details_EncounterDetails.toc @@ -1,4 +1,4 @@ -## Interface: 90005 +## Interface: 90100 ## Title: Details!: Encounter Breakdown (plugin) ## Notes: Show detailed information about a boss encounter. Also provide damage per phase, graphic charts, easy weakauras creation. ## RequiredDeps: Details diff --git a/plugins/Details_RaidCheck/Details_RaidCheck.lua b/plugins/Details_RaidCheck/Details_RaidCheck.lua index ae4b12b10..9a51f9b08 100644 --- a/plugins/Details_RaidCheck/Details_RaidCheck.lua +++ b/plugins/Details_RaidCheck/Details_RaidCheck.lua @@ -67,7 +67,7 @@ end tinsert (UISpecialFrames, "Details_RaidCheck") DetailsRaidCheck:SetPluginDescription (Loc ["STRING_RAIDCHECK_PLUGIN_DESC"]) - local version = "v2.0" + local version = "v3.0.1" local debugmode = false --local debugmode = true @@ -380,8 +380,9 @@ end data = dataInOrder local raidStatusLib = LibStub:GetLibrary("LibRaidStatus-1.0") - local playerInfo = raidStatusLib.playerInfoManager.GetPlayerInfo() - local gearInfo = raidStatusLib.gearManager.GetGearTable() + --get the information of all players + local playersInfoData = raidStatusLib.playerInfoManager.GetAllPlayersInfo() + local playersGearData = raidStatusLib.gearManager.GetAllPlayersGear() local libRaidStatus = 0 @@ -393,7 +394,7 @@ end local line = self:GetLine (i) if (line) then - local thisPlayerInfo = playerInfo[playerTable.UnitNameRealm] + local thisPlayerInfo = playersInfoData[playerTable.UnitNameRealm] if (thisPlayerInfo) then local playerCovenantId = thisPlayerInfo.covenantId if (playerCovenantId > 0) then @@ -407,7 +408,7 @@ end end --repair status - local thisPlayerGearInfo = gearInfo[playerTable.UnitNameRealm] + local thisPlayerGearInfo = playersGearData[playerTable.UnitNameRealm] if (thisPlayerGearInfo) then line.RepairStatus:SetText(thisPlayerGearInfo.durability .. "%") else @@ -615,6 +616,7 @@ end end) local update_panel = function (self, elapsed) + show_panel.NextUpdate = show_panel.NextUpdate - elapsed if (show_panel.NextUpdate > 0) then @@ -684,9 +686,11 @@ end local talentsTable = _detalhes:GetTalents (unitSerial) unitClassID = ((unitClassID + 128) ^ 4) + tonumber (string.byte (unitName, 1) .. "" .. string.byte (unitName, 2)) - + local unitNameWithRealm = GetUnitName(unitID, true) + tinsert (PlayerData, {unitName, unitClassID, Name = unitName, + UnitNameRealm = unitNameWithRealm, Class = unitClass, Serial = unitSerial, Role = unitRole, diff --git a/plugins/Details_RaidCheck/Details_RaidCheck.toc b/plugins/Details_RaidCheck/Details_RaidCheck.toc index 440ff0b32..b6ce576f8 100644 --- a/plugins/Details_RaidCheck/Details_RaidCheck.toc +++ b/plugins/Details_RaidCheck/Details_RaidCheck.toc @@ -1,4 +1,4 @@ -## Interface: 90005 +## Interface: 90100 ## Title: Details!: Raid Check (plugin) ## Notes: Show talents and item level for all members in your group, also shows food and flask state. ## RequiredDeps: Details diff --git a/plugins/Details_Streamer/Details_Streamer.toc b/plugins/Details_Streamer/Details_Streamer.toc index 55f1e6375..35cc1f6d9 100644 --- a/plugins/Details_Streamer/Details_Streamer.toc +++ b/plugins/Details_Streamer/Details_Streamer.toc @@ -1,4 +1,4 @@ -## Interface: 90005 +## Interface: 90100 ## Title: Details!: Streamer (plugin) ## Notes: Show which spells you are casting, viewers can see what are you doing and follow your steps. ## RequiredDeps: Details diff --git a/plugins/Details_TinyThreat/Details_TinyThreat.toc b/plugins/Details_TinyThreat/Details_TinyThreat.toc index 6d9a6b45d..4597e6389 100644 --- a/plugins/Details_TinyThreat/Details_TinyThreat.toc +++ b/plugins/Details_TinyThreat/Details_TinyThreat.toc @@ -1,4 +1,4 @@ -## Interface: 90005 +## Interface: 90100 ## Title: Details!: Tiny Threat (plugin) ## Notes: Threat meter plugin, show threat for group members in the window. Select it from the Plugin menu in the Orange Cogwheel. ## RequiredDeps: Details diff --git a/plugins/Details_Vanguard/Details_Vanguard.toc b/plugins/Details_Vanguard/Details_Vanguard.toc index e4b82843b..fff800973 100644 --- a/plugins/Details_Vanguard/Details_Vanguard.toc +++ b/plugins/Details_Vanguard/Details_Vanguard.toc @@ -1,4 +1,4 @@ -## Interface: 90005 +## Interface: 90100 ## Title: Details!: Vanguard (plugin) ## Notes: Show the health and debuffs for tanks in your group. ## SavedVariablesPerCharacter: _detalhes_databaseVanguard diff --git a/startup.lua b/startup.lua index e40dd185a..88b293afd 100644 --- a/startup.lua +++ b/startup.lua @@ -533,7 +533,7 @@ function Details:StartMeUp() --I'll never stop! end) end - if (DetailsFramework.IsTBCWow()) then + if (DetailsFramework.IsTBCWow() and not _G.CONFIG_OPTION_DONT_MOVE_BATTLEGROUND_MINIMAP_ICON_ON_ERROR) then --remover isso em versões mais atualizadas if (_detalhes.bcc_counter == 18 or _detalhes.bcc_counter == 19) then @@ -564,7 +564,7 @@ function Details:StartMeUp() --I'll never stop! taintWarning:Show() taintWarning:SetPoint ("topleft", StaticPopup1, "bottomleft", 0, -10) - if (MiniMapBattlefieldFrame:IsShown())then + if (MiniMapBattlefieldFrame:IsShown() and not Details.DontMoveMininapIconOnBattlegroundError)then if (not originalPosition) then local a = {}