From 56db57024a0269603c3634d7ba695a12a0fa4876 Mon Sep 17 00:00:00 2001 From: Openarl Date: Tue, 21 Feb 2017 02:48:31 +1000 Subject: [PATCH] Sneaking in more features - Added MoM total to Calcs tab - Quality normalisation now only occurs when an item is first added --- Classes/ItemDBControl.lua | 8 ++++---- Classes/ItemsTab.lua | 10 +++++++--- Modules/CalcSections.lua | 1 + Modules/ItemTools.lua | 9 ++++++--- Modules/ModParser.lua | 5 ++++- README.md | 2 ++ changelog.txt | 2 ++ manifest.xml | 12 ++++++------ 8 files changed, 32 insertions(+), 17 deletions(-) diff --git a/Classes/ItemDBControl.lua b/Classes/ItemDBControl.lua index 145b599c..c0881358 100644 --- a/Classes/ItemDBControl.lua +++ b/Classes/ItemDBControl.lua @@ -262,7 +262,7 @@ function ItemDBClass:OnKeyDown(key, doubleClick) self.selIndex = index if IsKeyDown("CTRL") then -- Immediately add and equip it - self.itemsTab:CreateDisplayItemFromRaw(selItem.raw) + self.itemsTab:CreateDisplayItemFromRaw(selItem.raw, true) local newItem = self.itemsTab.displayItem self.itemsTab:AddDisplayItem(true) itemLib.buildItemModList(newItem) @@ -282,7 +282,7 @@ function ItemDBClass:OnKeyDown(key, doubleClick) end end elseif doubleClick then - self.itemsTab:CreateDisplayItemFromRaw(selItem.raw) + self.itemsTab:CreateDisplayItemFromRaw(selItem.raw, true) end end end @@ -322,7 +322,7 @@ function ItemDBClass:OnKeyUp(key) if self.selDragActive then self.selDragActive = false if self.itemsTab.controls.itemList:IsMouseOver() and self.itemsTab.controls.itemList.selDragIndex then - self.itemsTab:CreateDisplayItemFromRaw(self.selItem.raw) + self.itemsTab:CreateDisplayItemFromRaw(self.selItem.raw, true) local newItem = self.itemsTab.displayItem self.itemsTab:AddDisplayItem() itemLib.buildItemModList(newItem) @@ -332,7 +332,7 @@ function ItemDBClass:OnKeyUp(key) for slotName, slot in pairs(self.itemsTab.slots) do if not slot.inactive and slot:IsMouseOver() then if self.itemsTab:IsItemValidForSlot(self.selItem, slotName) then - self.itemsTab:CreateDisplayItemFromRaw(self.selItem.raw) + self.itemsTab:CreateDisplayItemFromRaw(self.selItem.raw, true) local newItem = self.itemsTab.displayItem self.itemsTab:AddDisplayItem(true) itemLib.buildItemModList(newItem) diff --git a/Classes/ItemsTab.lua b/Classes/ItemsTab.lua index b7f9fb56..a991d75a 100644 --- a/Classes/ItemsTab.lua +++ b/Classes/ItemsTab.lua @@ -266,7 +266,7 @@ function ItemsTabClass:Draw(viewPort, inputEvents) if event.key == "v" and IsKeyDown("CTRL") then local newItem = Paste() if newItem then - self:CreateDisplayItemFromRaw(newItem) + self:CreateDisplayItemFromRaw(newItem, true) end elseif event.key == "z" and IsKeyDown("CTRL") then self:Undo() @@ -360,6 +360,7 @@ function ItemsTabClass:CraftItem() else item.implicitLines = 0 end + itemLib.normaliseQuality(item) return itemLib.makeItemFromRaw(itemLib.createItemRaw(item)) end popup = main:OpenPopup(370, 130, "Craft Item", { @@ -420,7 +421,7 @@ function ItemsTabClass:EditDisplayItemText() edit = common.New("EditControl", nil, 0, 40, 480, 420, "", nil, "^%C\t\n", nil, nil, 14), save = common.New("ButtonControl", nil, -45, 470, 80, 20, self.displayItem and "Save" or "Create", function() local id = self.displayItem and self.displayItem.id - self:CreateDisplayItemFromRaw(buildRaw()) + self:CreateDisplayItemFromRaw(buildRaw(), not self.displayItem) self.displayItem.id = id main:ClosePopup() end), @@ -457,9 +458,12 @@ function ItemsTabClass:EditDisplayItemText() end -- Attempt to create a new item from the given item raw text and sets it as the new display item -function ItemsTabClass:CreateDisplayItemFromRaw(itemRaw) +function ItemsTabClass:CreateDisplayItemFromRaw(itemRaw, normalise) local newItem = itemLib.makeItemFromRaw(itemRaw) if newItem then + if normalise then + itemLib.normaliseQuality(newItem) + end self:SetDisplayItem(newItem) end end diff --git a/Modules/CalcSections.lua b/Modules/CalcSections.lua index d596ff8f..0e8495a4 100644 --- a/Modules/CalcSections.lua +++ b/Modules/CalcSections.lua @@ -659,5 +659,6 @@ return { { breakdown = "BlockDuration" }, { modName = { "StunRecovery", "BlockRecovery" }, }, }, }, + { label = "Mind over Matter", { format = "{0:mod:1}%", { modName = "DamageTakenFromManaBeforeLife" }, }, }, } }, } \ No newline at end of file diff --git a/Modules/ItemTools.lua b/Modules/ItemTools.lua index 513e2439..e52b35e2 100644 --- a/Modules/ItemTools.lua +++ b/Modules/ItemTools.lua @@ -257,15 +257,18 @@ function itemLib.parseItemRaw(item) item.affixLimit = (item.base.type == "Jewel" and 4 or 6) end end - if not item.corrupted and not item.uniqueID and item.base and (item.base.armour or item.base.weapon or item.base.flask) then - item.quality = 20 - end if item.variantList then item.variant = m_min(#item.variantList, item.variant or #item.variantList) end itemLib.buildItemModList(item) end +function itemLib.normaliseQuality(item) + if not item.corrupted and not item.uniqueID and item.base and (item.base.armour or item.base.weapon or item.base.flask) then + item.quality = 20 + end +end + -- Create raw item data for given item function itemLib.createItemRaw(item) local rawLines = { } diff --git a/Modules/ModParser.lua b/Modules/ModParser.lua index 2f1b564c..b138a299 100644 --- a/Modules/ModParser.lua +++ b/Modules/ModParser.lua @@ -109,6 +109,7 @@ local modNameList = { ["to avoid being chilled"] = "AvoidChilled", ["to avoid being ignited"] = "AvoidIgnite", ["to avoid elemental status ailments"] = { "AvoidShock", "AvoidFrozen", "AvoidChilled", "AvoidIgnite" }, + ["damage is taken from mana before life"] = { "DamageTakenFromManaBeforeLife" }, -- Stun modifiers ["stun recovery"] = "StunRecovery", ["stun and block recovery"] = "StunRecovery", @@ -328,6 +329,7 @@ local preFlagList = { ["^socketed curse gems have "] = { tag = { type = "SocketedIn", keyword = "curse" } }, ["^socketed melee gems have "] = { tag = { type = "SocketedIn", keyword = "melee" } }, ["^your flasks grant "] = { }, + ["^when hit, "] = { }, ["^auras you cast grant "] = { addToAura = true }, ["^you and allies affected by your auras have "] = { tag = { type = "Condition", var = "HaveAuraActive" } }, } @@ -947,7 +949,8 @@ local function parseMod(line, order) elseif modForm == "CONV" then modSuffix, line = scan(line, convTypes, true) if not modSuffix then - return { }, line + modSuffix = "" + --return { }, line end elseif modForm == "PEN" then modName, line = scan(line, penTypes, true) diff --git a/README.md b/README.md index 9f2a5ddb..c0d50103 100644 --- a/README.md +++ b/README.md @@ -57,6 +57,8 @@ Head over to the [Releases](https://github.com/Openarl/PathOfBuilding/releases) * Have you used a Warcry Recently? * Consumed a corpse Recently? * Added support for the "Consecrated Ground grants 40% increased Damage" modifier from Sanctify + * The total Damage taken from Mana before Life is now displayed in the Other Defences section in the Calcs tab + * The Items tab now only normalises quality on items when they are first added, allowing the quality to be edited if necessary ### 1.3.4 - 2017/02/20 * Added support for the Offering skills and Mistress of Sacrifice diff --git a/changelog.txt b/changelog.txt index c28af1f6..79fcdf84 100644 --- a/changelog.txt +++ b/changelog.txt @@ -8,6 +8,8 @@ VERSION[1.3.5][2017/02/21] * Have you used a Warcry Recently? * Consumed a corpse Recently? * Added support for the "Consecrated Ground grants 40% increased Damage" modifier from Sanctify + * The total Damage taken from Mana before Life is now displayed in the Other Defences section in the Calcs tab + * The Items tab now only normalises quality on items when they are first added, allowing the quality to be edited if necessary VERSION[1.3.4][2017/02/20] * Added support for the Offering skills and Mistress of Sacrifice VERSION[1.3.3][2017/02/19] diff --git a/manifest.xml b/manifest.xml index fd7120db..2ee48995 100644 --- a/manifest.xml +++ b/manifest.xml @@ -7,7 +7,7 @@ - + @@ -21,10 +21,10 @@ - + - + @@ -45,12 +45,12 @@ - + - + - +