Skip to content

Commit

Permalink
Merge pull request #81 from LetsTimeIt/namespacing
Browse files Browse the repository at this point in the history
feat: Inspiring mobs are now much more noticeable
feat: Addon now has its own namespace (DungeonTools). There is still one clash, but it is on the MDT side, so there's not much we can do on that.
fix: if a mob does not have an i18n entry, or if the i18n stuff fails, we fall back to the literal key provided
fix: default routes no longer get wiped
  • Loading branch information
srenauld authored Jan 2, 2021
2 parents 6c0ba6c + 61de9c5 commit 55e32b5
Show file tree
Hide file tree
Showing 50 changed files with 146 additions and 101 deletions.
1 change: 1 addition & 0 deletions AceGUIWidget-DungeonToolsNewPullButton.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
local Type, Version = "MDTNewPullButton", 1
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
local MDT = DungeonTools
local L = MDT.L
local width,height = 248,32

Expand Down
2 changes: 1 addition & 1 deletion AceGUIWidget-DungeonToolsPullButton.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
local Type, Version = "MDTPullButton", 1
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
local MDT = MDT
local MDT = DungeonTools
local L = MDT.L


Expand Down
2 changes: 1 addition & 1 deletion AceGUIWidget-DungeonToolsSpellButton.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
local ButtonType, ButtonVersion = "MDTSpellButton", 1
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)

local MDT = DungeonTools
local width,height = 248,32
local tinsert,SetPortraitToTexture,SetPortraitTextureFromCreatureDisplayID,GetItemQualityColor,MouseIsOver = table.insert,SetPortraitToTexture,SetPortraitTextureFromCreatureDisplayID,GetItemQualityColor,MouseIsOver

Expand Down
2 changes: 1 addition & 1 deletion AceGUIWidget-DungeonToolsSpellLabel.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
local LabelType, LabelVersion = "MDTSpellLabel", 1
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)

local MDT = DungeonTools
local width,height = 248,18
local tinsert,SetPortraitToTexture,SetPortraitTextureFromCreatureDisplayID,GetItemQualityColor,MouseIsOver = table.insert,SetPortraitToTexture,SetPortraitTextureFromCreatureDisplayID,GetItemQualityColor,MouseIsOver

Expand Down
2 changes: 1 addition & 1 deletion BattleForAzeroth/AtalDazar.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local MDT = MDT
local MDT = DungeonTools
local L = MDT.L
local dungeonIndex = 15
MDT.dungeonTotalCount[dungeonIndex] = {normal=198,teeming=237,teemingEnabled=true}
Expand Down
2 changes: 1 addition & 1 deletion BattleForAzeroth/Freehold.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local MDT = MDT
local MDT = DungeonTools
local L = MDT.L
local dungeonIndex = 16
MDT.mapInfo[dungeonIndex] = {
Expand Down
2 changes: 1 addition & 1 deletion BattleForAzeroth/KingsRest.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local MDT = MDT
local MDT = DungeonTools
local L = MDT.L
local dungeonIndex = 17
MDT.dungeonTotalCount[dungeonIndex] = {normal=246,teeming=286,teemingEnabled=true}
Expand Down
2 changes: 1 addition & 1 deletion BattleForAzeroth/MechagonCity.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local MDT = MDT
local MDT = DungeonTools
local L = MDT.L
local dungeonIndex = 26
MDT.mapInfo[dungeonIndex] = {
Expand Down
2 changes: 1 addition & 1 deletion BattleForAzeroth/MechagonIsland.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local MDT = MDT
local MDT = DungeonTools
local L = MDT.L
local dungeonIndex = 25
MDT.mapInfo[dungeonIndex] = {
Expand Down
2 changes: 1 addition & 1 deletion BattleForAzeroth/ShrineoftheStorm.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local MDT = MDT
local MDT = DungeonTools
local L = MDT.L
local dungeonIndex = 18
MDT.mapInfo[dungeonIndex] = {
Expand Down
2 changes: 1 addition & 1 deletion BattleForAzeroth/SiegeofBoralus.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local MDT = MDT
local MDT = DungeonTools
local L = MDT.L
local dungeonIndex = 19
MDT.mapInfo[dungeonIndex] = {
Expand Down
2 changes: 1 addition & 1 deletion BattleForAzeroth/TempleofSethraliss.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local MDT = MDT
local MDT = DungeonTools
local L = MDT.L
local dungeonIndex = 20
MDT.dungeonTotalCount[dungeonIndex] = {normal=220,teeming=264,teemingEnabled=true}
Expand Down
2 changes: 1 addition & 1 deletion BattleForAzeroth/TheMotherlode.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local MDT = MDT
local MDT = DungeonTools
local L = MDT.L
local dungeonIndex = 21
MDT.dungeonTotalCount[dungeonIndex] = {normal=384,teeming=460,teemingEnabled=true}
Expand Down
2 changes: 1 addition & 1 deletion BattleForAzeroth/TheUnderrot.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local MDT = MDT
local MDT = DungeonTools
local L = MDT.L
local dungeonIndex = 22
MDT.mapInfo[dungeonIndex] = {
Expand Down
2 changes: 1 addition & 1 deletion BattleForAzeroth/TolDagor.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local MDT = MDT
local MDT = DungeonTools
local L = MDT.L
local dungeonIndex = 23
MDT.mapInfo[dungeonIndex] = {
Expand Down
2 changes: 1 addition & 1 deletion BattleForAzeroth/WaycrestManor.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local MDT = MDT
local MDT = DungeonTools
local L = MDT.L
local dungeonIndex = 24
MDT.mapInfo[dungeonIndex] = {
Expand Down
1 change: 1 addition & 0 deletions BattleForAzeroth/overrides.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
local MDT = DungeonTools
local displayIdOverrides = {

}
Expand Down
12 changes: 6 additions & 6 deletions Bindings.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<Bindings>
<Binding name="MDTTOGGLE" runOnUp="false" category="Dungeon Tools">
MDT:ShowInterface()
<Binding name="DungeonToolsToggle" runOnUp="false" category="Dungeon Tools">
DungeonTools:ShowInterface()
</Binding>
<Binding name="MDTNPC" runOnUp="false" category="Dungeon Tools">
MDT:AddCloneAtCursorPosition()
<Binding name="DungeonToolsNPC" runOnUp="false" category="Dungeon Tools">
DungeonTools:AddCloneAtCursorPosition()
</Binding>
<Binding name="MDTWAYPOINT" runOnUp="false" category="Dungeon Tools">
MDT:AddPatrolWaypointAtCursorPosition()
<Binding name="DungeonToolsWaypoint" runOnUp="false" category="Dungeon Tools">
DungeonTools:AddPatrolWaypointAtCursorPosition()
</Binding>
</Bindings>
8 changes: 4 additions & 4 deletions DataCollection.lua
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---Tracks spells casted by enemies and adds them to the dataset
local db
local f
local MDT = MDT

local MDT = DungeonTools
local commsObject = MDT.commsObject
MDT.DataCollection = {}
local DC = MDT.DataCollection
function DC:Init()
Expand Down Expand Up @@ -232,7 +232,7 @@ function MDT:RequestDataCollectionUpdate()
if true then return end
local distribution = self:IsPlayerInGroup()
if not distribution then return end
MDTcommsObject:SendCommMessage(self.dataCollectionPrefixes.request, "0", distribution, nil, "ALERT")
commsObject:SendCommMessage(self.dataCollectionPrefixes.request, "0", distribution, nil, "ALERT")
end

---Distribute collected data to party/raid
Expand All @@ -250,7 +250,7 @@ function DC:DistributeData()
[2] = db.dataCollectionCC
}
local export = MDT:TableToString(package,false,5)
MDTcommsObject:SendCommMessage(MDT.dataCollectionPrefixes.distribute, export, distribution, nil, "BULK",nil,nil)
commsObject:SendCommMessage(MDT.dataCollectionPrefixes.distribute, export, distribution, nil, "BULK",nil,nil)
end
end

Expand Down
29 changes: 17 additions & 12 deletions DungeonEnemies.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local MDT = MDT
local MDT = DungeonTools
local db
local tonumber,tinsert,slen,pairs,ipairs,tostring,next,type,sformat,twipe,max,tremove,DrawLine = tonumber,table.insert,string.len,pairs,ipairs,tostring,next,type,string.format,table.wipe,math.max,table.remove,DrawLine
local L = MDT.L
Expand Down Expand Up @@ -66,7 +66,7 @@ function MDT:DoFramesOverlap(frameA, frameB, offset)
end


MDTDungeonEnemyMixin = {};
DungeonToolsEnemyMixin = {};

local defaultSizes = {
["texture_Background"] = 20,
Expand All @@ -83,13 +83,13 @@ local defaultSizes = {
["texture_DragUp"] = 8,
}

function MDTDungeonEnemyMixin:updateSizes(scale)
function DungeonToolsEnemyMixin:updateSizes(scale)
for tex,size in pairs(defaultSizes) do
self[tex]:SetSize(size*self.normalScale*scale,size*self.normalScale*scale)
end
end

function MDTDungeonEnemyMixin:OnEnter()
function DungeonToolsEnemyMixin:OnEnter()
self:updateSizes(1.2)
self:SetFrameLevel(self:GetFrameLevel()+5)
self:DisplayPatrol(true)
Expand Down Expand Up @@ -131,7 +131,7 @@ function MDTDungeonEnemyMixin:OnEnter()
end
end

function MDTDungeonEnemyMixin:OnLeave()
function DungeonToolsEnemyMixin:OnLeave()
self:updateSizes(1)
self:SetFrameLevel(self:GetFrameLevel()-5)
if db.devMode then
Expand Down Expand Up @@ -306,7 +306,7 @@ local function setUpMouseHandlersAwakened(self,clone,scale,riftOffsets)
end)
end

function MDTDungeonEnemyMixin:OnClick(button, down)
function DungeonToolsEnemyMixin:OnClick(button, down)

if button == "LeftButton" then
if IsShiftKeyDown() then
Expand Down Expand Up @@ -393,7 +393,7 @@ function MDT:GetPatrolBlips()
return patrolPoints
end

function MDTDungeonEnemyMixin:DisplayPatrol(shown)
function DungeonToolsEnemyMixin:DisplayPatrol(shown)
local scale = MDT:GetScale()

--Hide all points/line
Expand Down Expand Up @@ -489,7 +489,8 @@ function MDT:DisplayBlipTooltip(blip, shown)
]]
local occurence = (blip.data.isBoss and "") or blip.cloneIdx

local text = data.name.." "..occurence..group.."\n"..string.format(L["Level %d %s"],data.level,data.creatureType).."\n".. string.format(L["%s HP"],MDT:FormatEnemyHealth(health)).."\n"
local mobName = data.name or ""
local text = mobName.." "..occurence..group.."\n"..string.format(L["Level %d %s"],data.level,data.creatureType).."\n".. string.format(L["%s HP"],MDT:FormatEnemyHealth(health)).."\n"
local count = MDT:IsCurrentPresetTeeming() and data.teemingCount or data.count
text = text ..L["Forces"]..": ".. MDT:FormatEnemyForces(count)
local reapingText
Expand Down Expand Up @@ -607,7 +608,7 @@ end

local emissaryIds = {[155432]=true,[155433]=true,[155434]=true}

function MDTDungeonEnemyMixin:SetUp(data,clone)
function DungeonToolsEnemyMixin:SetUp(data,clone)
local scale = MDT:GetScale()
self:ClearAllPoints()
self:SetPoint("CENTER", MDT.main_frame.mapPanelTile1,"TOPLEFT",clone.x*scale,clone.y*scale)
Expand Down Expand Up @@ -706,7 +707,7 @@ function MDT:DungeonEnemies_UpdateEnemies()
if clone.sublevel == currentSublevel or (not clone.sublevel) then
--skip rifts that were dragged to another sublevel
if not (data.corrupted and riftOffsets and riftOffsets[data.id] and riftOffsets[data.id].sublevel) then
local blip = MDT.dungeonEnemies_framePools:Acquire("MDTDungeonEnemyTemplate")
local blip = MDT.dungeonEnemies_framePools:Acquire("DungeonToolsEnemyTemplate")
blip:SetUp(data,clone)
blip.enemyIdx = enemyIdx
blip.cloneIdx = cloneIdx
Expand All @@ -721,7 +722,7 @@ function MDT:DungeonEnemies_UpdateEnemies()
for enemyIdx,data in pairs(enemies) do
if data.id == npcId then
for cloneIdx,clone in pairs(data["clones"]) do
local blip = MDT.dungeonEnemies_framePools:Acquire("MDTDungeonEnemyTemplate")
local blip = MDT.dungeonEnemies_framePools:Acquire("DungeonToolsEnemyTemplate")
blip:SetUp(data,clone)
blip.enemyIdx = enemyIdx
blip.cloneIdx = cloneIdx
Expand All @@ -736,7 +737,7 @@ end
function MDT:DungeonEnemies_CreateFramePools()
db = self:GetDB()
MDT.dungeonEnemies_framePools = MDT.dungeonEnemies_framePools or CreateFramePoolCollection()
MDT.dungeonEnemies_framePools:CreatePool("Button", MDT.main_frame.mapPanelFrame, "MDTDungeonEnemyTemplate");
MDT.dungeonEnemies_framePools:CreatePool("Button", MDT.main_frame.mapPanelFrame, "DungeonToolsEnemyTemplate");
end

function MDT:FindPullOfBlip(blip)
Expand Down Expand Up @@ -908,6 +909,10 @@ end
---DungeonEnemies_GetPullColor
---Returns the custom color for a pull
function MDT:DungeonEnemies_GetPullColor(pull,pulls)
if not preset or not preset.value or not preset.value.pulls then
r,g,b = MDT:HexToRGB(db.defaultColor)
return r,g,b
end
pulls = pulls or preset.value.pulls
local r,g,b = MDT:HexToRGB(pulls[pull]["color"])
if not r then
Expand Down
6 changes: 3 additions & 3 deletions DungeonEnemies.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
..\FrameXML\UI.xsd">
<Script file="DungeonEnemies.lua"/>

<Button name="MDTDungeonEnemyTemplate" enableMouse="true" virtual="true" mixin="MDTDungeonEnemyMixin">
<Button name="DungeonToolsEnemyTemplate" enableMouse="true" virtual="true" mixin="DungeonToolsEnemyMixin">

<Layers>

Expand Down Expand Up @@ -94,7 +94,7 @@
</Anchors>
</Texture>
<Texture name="$parent_Indicator" hidden="false" parentKey="texture_Indicator" file = "Interface\AddOns\DungeonTools\Textures\UI-EncounterJournalTextures">
<TexCoords left="0.85" right="0.97" top="0.43" bottom="0.4865"/>
<TexCoords left="0.826" right="0.924" top="0.338" bottom="0.387"/>
<Color r="2.04" g="0" b="0" a="0"/>
<Anchors>
<Anchor point="CENTER"/>
Expand Down Expand Up @@ -137,5 +137,5 @@
<OnClick method="OnClick"/>
</Scripts>
</Button>
<Frame name="MDTAnimatedLineTemplate" virtual="true"/>
<Frame name="DungeonToolsAnimatedLineTemplate" virtual="true"/>
</Ui>
50 changes: 30 additions & 20 deletions DungeonTools.lua
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ SLASH_DUNGEONTOOLS1 = "/mplus"
SLASH_DUNGEONTOOLS2 = "/mdt"
SLASH_DUNGEONTOOLS3 = "/dungeontools"

BINDING_NAME_MDTTOGGLE = L["Toggle Window"]
BINDING_NAME_MDTNPC = L["New NPC at Cursor Position"]
BINDING_NAME_MDTWAYPOINT = L["New Patrol Waypoint at Cursor Position"]
BINDING_NAME_DungeonToolsToggle = L["Toggle Window"]
BINDING_NAME_DungeonToolsNPC = L["New NPC at Cursor Position"]
BINDING_NAME_DungeonToolsWaypoint = L["New Patrol Waypoint at Cursor Position"]

function SlashCmdList.DUNGEONTOOLS(cmd, editbox)
local rqst, arg = strsplit(' ', cmd)
Expand Down Expand Up @@ -149,23 +149,6 @@ do
icon:Show("DungeonTools")
end

--if db.dataCollectionActive then MDT.DataCollection:Init() end
--fix db corruption
do
for _,presets in pairs(db.presets) do
for presetIdx,preset in pairs(presets) do
if presetIdx == 1 then
if preset.text ~= "Default" then
preset.text = "Default"
preset.value = {}
end
end
end
end
for k,v in pairs(db.currentPreset) do
if v <= 0 then db.currentPreset[k] = 1 end
end
end
--register AddOn Options
MDT:RegisterOptions()
self:UnregisterEvent("ADDON_LOADED")
Expand Down Expand Up @@ -658,8 +641,35 @@ function MDT:GetDB()
end

local framesInitialized

function MDT:ImportFromLegacyMDT()
mdtDb = LibStub("AceDB-3.0"):New("MythicDungeonToolsDB", defaultSavedVars).global
for dungeonIdx,presets in pairs(mdtDb.presets) do
if not db.presets[dungeonIdx] then
db.presets[dungeonIdx] = {}
end
oldPresetLen = #db.presets[dungeonIdx]
newPresetLen = #presets
-- Quick hack
db.presets[dungeonIdx][newPresetLen] = MDT:DeepCopy(db.presets[dungeonIdx][oldPresetLen])
currentIdx = oldPresetLen
for _,preset in pairs(presets) do
if preset["text"] ~= "Default" and preset["text"] ~= "<New Preset>" then
db.presets[dungeonIdx][currentIdx] = MDT:DeepCopy(preset)
db.presets[dungeonIdx][currentIdx]["text"] = preset["text"].." (Imported)";
currentIdx = currentIdx + 1
end
end
end
db.Imported = true
end
function MDT:ShowInterface(force)
if not framesInitialized then initFrames() end

if not db.Imported then
MDT:ImportFromLegacyMDT()
end

if self.main_frame:IsShown() and not force then
MDT:HideInterface()
else
Expand Down
2 changes: 1 addition & 1 deletion EnemyInfo.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local MDT = MDT
local MDT = DungeonTools
local L = MDT.L
local AceGUI = LibStub("AceGUI-3.0")
local db
Expand Down
1 change: 1 addition & 0 deletions Legion/BlackRookHold.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
local dungeonIndex = 1
local nerfMultiplier = 0.834
local pi = math.pi
local MDT = DungeonTools
MDT.dungeonTotalCount[dungeonIndex] = { normal=300, teeming=360, teemingEnabled=true}
MDT.dungeonBosses[dungeonIndex] = {--Black Rook Hold
[1] = {
Expand Down
1 change: 1 addition & 0 deletions Legion/CathedralOfEternalNight.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
local dungeonIndex = 2
local pi = math.pi
local nerfMultiplier = 1
local MDT = DungeonTools
MDT.dungeonTotalCount[dungeonIndex] = {normal=305,teeming=335,teemingEnabled=true}
MDT.dungeonBosses[dungeonIndex] = { --Cathedral of Eternal Night
[2] = {
Expand Down
1 change: 1 addition & 0 deletions Legion/CourtOfStars.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
local dungeonIndex = 3
local nerfMultiplier = 1
local pi = math.pi
local MDT = DungeonTools
MDT.dungeonTotalCount[dungeonIndex] = {normal=160,teeming=192,teemingEnabled=true}
MDT.dungeonBosses[dungeonIndex] = {--Court of Stars
[1] = {
Expand Down
Loading

0 comments on commit 55e32b5

Please sign in to comment.