Skip to content

Commit cdf7a7b

Browse files
Implement Rare Templates (#826)
* test * Majority of work done, need to check flasks still * warstaffs * tiny changes * cleaned up extra lines, and more templates made * flails mostly working, disabled along axes for now * switch drop down to buttons * enabled drag and drop for rare templates * Claws and daggers, disabled for now * Set sword 1 hand max rune sockets to 2 * Show both boxes on higher resolution screens * Show both boxes on higher resolution screens * Fix function on wrong line * Removed some spaces to match rest of code, and aligned rare box a little * Flasks, Spears, and +gem levels * Updated some modifier values and item names --------- Co-authored-by: LocalIdentity <31035929+LocalIdentity@users.noreply.github.com>
1 parent 3d4aca2 commit cdf7a7b

28 files changed

+4488
-2153
lines changed

src/Classes/ItemDBControl.lua

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,11 @@ function ItemDBClass:DoesItemMatchFilters(item)
100100
if not (weaponInfo and weaponInfo.melee and ((typeSel == 4 and weaponInfo.oneHand) or (typeSel == 5 and not weaponInfo.oneHand))) then
101101
return false
102102
end
103+
if item.type == "Staff" then
104+
if item.base.subType ~= "Warstaff" then
105+
return false
106+
end
107+
end
103108
elseif item.type ~= self.typeList[typeSel] then
104109
return false
105110
end

src/Classes/ItemsTab.lua

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -206,30 +206,41 @@ local ItemsTabClass = newClass("ItemsTab", "UndoHandler", "ControlHost", "Contro
206206

207207
-- Database selector
208208
self.controls.selectDBLabel = new("LabelControl", {"TOPLEFT",self.controls.itemList,"BOTTOMLEFT"}, {0, 14, 0, 16}, "^7Import from:")
209-
self.controls.selectDBLabel.shown = false
210-
--function()
211-
-- return self.height < 980
212-
--end
213-
self.controls.selectDB = new("DropDownControl", {"LEFT",self.controls.selectDBLabel,"RIGHT"}, {4, 0, 150, 18}, { "Uniques", "Rare Templates" })
209+
self.controls.selectDBLabel.shown = function()
210+
return self.height < 980
211+
end
212+
self.selectedDB = "UNIQUE"
214213

214+
-- Uniques Button
215+
self.controls.uniqueButton = new("ButtonControl", {"LEFT",self.controls.selectDBLabel,"RIGHT"}, {4, 0, 110, 18}, "Uniques", function()
216+
self.selectedDB = "UNIQUE"
217+
end)
218+
self.controls.uniqueButton.locked = function() return self.selectedDB == "UNIQUE" end
219+
220+
-- Rare Templates Button
221+
self.controls.rareButton = new("ButtonControl", {"LEFT",self.controls.selectDBLabel,"RIGHT"}, {120, 0, 110, 18}, "Rare Templates", function()
222+
self.selectedDB = "RARE"
223+
end)
224+
self.controls.rareButton.locked = function() return self.selectedDB == "RARE" end
225+
215226
-- Unique database
216227
self.controls.uniqueDB = new("ItemDBControl", {"TOPLEFT",self.controls.itemList,"BOTTOMLEFT"}, {0, 76, 360, function(c) return m_min(244, self.maxY - select(2, c:GetPos())) end}, self, main.uniqueDB, "UNIQUE")
217228
self.controls.uniqueDB.y = function()
218-
return self.controls.selectDBLabel:IsShown() and 118 or 96
229+
return self.controls.selectDBLabel:IsShown() and 118 or 90
219230
end
220231
self.controls.uniqueDB.shown = function()
221-
return not self.controls.selectDBLabel:IsShown() or self.controls.selectDB.selIndex == 1
232+
return not self.controls.selectDBLabel:IsShown() or self.selectedDB == "UNIQUE"
222233
end
223-
234+
224235
-- Rare template database
225-
self.controls.rareDB = new("ItemDBControl", {"TOPLEFT",self.controls.itemList,"BOTTOMLEFT"}, {0, 76, 360, function(c) return m_min(260, self.maxY - select(2, c:GetPos())) end}, self, main.rareDB, "RARE")
236+
self.controls.rareDB = new("ItemDBControl", {"TOPLEFT",self.controls.itemList,"BOTTOMLEFT"}, {0, 76, 360, function(c) return m_min(284, self.maxY - select(2, c:GetPos())) end}, self, main.rareDB, "RARE")
226237
self.controls.rareDB.y = function()
227-
return self.controls.selectDBLabel:IsShown() and 78 or 396
238+
return self.controls.selectDBLabel:IsShown() and 78 or 386
228239
end
229-
self.controls.rareDB.shown = false
230-
--function()
231-
-- return not self.controls.selectDBLabel:IsShown() or self.controls.selectDB.selIndex == 2
232-
--end
240+
self.controls.rareDB.shown = function()
241+
return not self.controls.selectDBLabel:IsShown() or self.selectedDB == "RARE"
242+
end
243+
233244
-- Create/import item
234245
self.controls.craftDisplayItem = new("ButtonControl", {"TOPLEFT",main.portraitMode and self.controls.setManage or self.controls.itemList,"TOPRIGHT"}, {20, main.portraitMode and 0 or -20, 120, 20}, "Craft item...", function()
235246
self:CraftItem()
@@ -804,15 +815,15 @@ holding Shift will put it in the second.]])
804815
t_insert(self.controls.uniqueDB.dragTargetList, self.controls.itemList)
805816
t_insert(self.controls.uniqueDB.dragTargetList, self.controls.sharedItemList)
806817
t_insert(self.controls.uniqueDB.dragTargetList, build.controls.mainSkillMinion)
807-
--t_insert(self.controls.rareDB.dragTargetList, self.controls.itemList)
808-
--t_insert(self.controls.rareDB.dragTargetList, self.controls.sharedItemList)
809-
--t_insert(self.controls.rareDB.dragTargetList, build.controls.mainSkillMinion)
818+
t_insert(self.controls.rareDB.dragTargetList, self.controls.itemList)
819+
t_insert(self.controls.rareDB.dragTargetList, self.controls.sharedItemList)
820+
t_insert(self.controls.rareDB.dragTargetList, build.controls.mainSkillMinion)
810821
t_insert(self.controls.sharedItemList.dragTargetList, self.controls.itemList)
811822
t_insert(self.controls.sharedItemList.dragTargetList, build.controls.mainSkillMinion)
812823
for _, slot in pairs(self.slots) do
813824
t_insert(self.controls.itemList.dragTargetList, slot)
814825
t_insert(self.controls.uniqueDB.dragTargetList, slot)
815-
--t_insert(self.controls.rareDB.dragTargetList, slot)
826+
t_insert(self.controls.rareDB.dragTargetList, slot)
816827
t_insert(self.controls.sharedItemList.dragTargetList, slot)
817828
end
818829

0 commit comments

Comments
 (0)