@@ -9,6 +9,7 @@ local curl = require("lcurl.safe")
99local m_max = math.max
1010local s_format = string.format
1111local t_insert = table.insert
12+ local tradeHelpers = LoadModule (" Classes/CompareTradeHelpers" )
1213
1314-- TODO generate these from data files
1415local itemCategoryTags = {
@@ -727,103 +728,25 @@ function TradeQueryGeneratorClass:StartQuery(slot, options)
727728 calcNodesInsteadOfMods = true ,
728729 }
729730 end
730- elseif slot .slotName :find (" ^Weapon %d" ) then
731- if existingItem then
732- if existingItem .type == " Shield" then
733- itemCategoryQueryStr = " armour.shield"
734- itemCategory = " Shield"
735- elseif existingItem .type == " Quiver" then
736- itemCategoryQueryStr = " armour.quiver"
737- itemCategory = " Quiver"
738- elseif existingItem .type == " Bow" then
739- itemCategoryQueryStr = " weapon.bow"
740- itemCategory = " Bow"
741- elseif existingItem .type == " Staff" then
742- itemCategoryQueryStr = " weapon.staff"
743- itemCategory = " Staff"
744- elseif existingItem .type == " Two Handed Sword" then
745- itemCategoryQueryStr = " weapon.twosword"
746- itemCategory = " 2HSword"
747- elseif existingItem .type == " Two Handed Axe" then
748- itemCategoryQueryStr = " weapon.twoaxe"
749- itemCategory = " 2HAxe"
750- elseif existingItem .type == " Two Handed Mace" then
751- itemCategoryQueryStr = " weapon.twomace"
752- itemCategory = " 2HMace"
753- elseif existingItem .type == " Fishing Rod" then
754- itemCategoryQueryStr = " weapon.rod"
755- itemCategory = " FishingRod"
756- elseif existingItem .type == " One Handed Sword" then
757- itemCategoryQueryStr = " weapon.onesword"
758- itemCategory = " 1HSword"
759- elseif existingItem .type == " One Handed Axe" then
760- itemCategoryQueryStr = " weapon.oneaxe"
761- itemCategory = " 1HAxe"
762- elseif existingItem .type == " One Handed Mace" or existingItem .type == " Sceptre" then
763- itemCategoryQueryStr = " weapon.onemace"
764- itemCategory = " 1HMace"
765- elseif existingItem .type == " Wand" then
766- itemCategoryQueryStr = " weapon.wand"
767- itemCategory = " Wand"
768- elseif existingItem .type == " Dagger" then
769- itemCategoryQueryStr = " weapon.dagger"
770- itemCategory = " Dagger"
771- elseif existingItem .type == " Claw" then
772- itemCategoryQueryStr = " weapon.claw"
773- itemCategory = " Claw"
774- elseif existingItem .type :find (" Two Handed" ) ~= nil then
775- itemCategoryQueryStr = " weapon.twomelee"
776- itemCategory = " 2HWeapon"
777- elseif existingItem .type :find (" One Handed" ) ~= nil then
778- itemCategoryQueryStr = " weapon.one"
779- itemCategory = " 1HWeapon"
731+ else
732+ itemCategoryQueryStr , itemCategory = tradeHelpers .getTradeCategoryInfo (slot .slotName , existingItem )
733+
734+ -- Generic Jewel slot: caller selects the jewel subtype.
735+ if slot .slotName :find (" Jewel" ) ~= nil and not slot .slotName :find (" Abyssal" ) then
736+ itemCategory = options .jewelType .. " Jewel"
737+ if itemCategory == " AbyssJewel" then
738+ itemCategoryQueryStr = " jewel.abyss"
739+ elseif itemCategory == " BaseJewel" then
740+ itemCategoryQueryStr = " jewel.base"
780741 else
781- logToFile (" '%s' is not supported for weighted trade query generation" , existingItem .type )
782- return
742+ itemCategoryQueryStr = " jewel"
783743 end
784- else
785- -- Item does not exist in this slot so assume 1H weapon
786- itemCategoryQueryStr = " weapon.one"
787- itemCategory = " 1HWeapon"
788744 end
789- elseif slot .slotName == " Body Armour" then
790- itemCategoryQueryStr = " armour.chest"
791- itemCategory = " Chest"
792- elseif slot .slotName == " Helmet" then
793- itemCategoryQueryStr = " armour.helmet"
794- itemCategory = " Helmet"
795- elseif slot .slotName == " Gloves" then
796- itemCategoryQueryStr = " armour.gloves"
797- itemCategory = " Gloves"
798- elseif slot .slotName == " Boots" then
799- itemCategoryQueryStr = " armour.boots"
800- itemCategory = " Boots"
801- elseif slot .slotName == " Amulet" then
802- itemCategoryQueryStr = " accessory.amulet"
803- itemCategory = " Amulet"
804- elseif slot .slotName == " Ring 1" or slot .slotName == " Ring 2" or slot .slotName == " Ring 3" then
805- itemCategoryQueryStr = " accessory.ring"
806- itemCategory = " Ring"
807- elseif slot .slotName == " Belt" then
808- itemCategoryQueryStr = " accessory.belt"
809- itemCategory = " Belt"
810- elseif slot .slotName :find (" Abyssal" ) ~= nil then
811- itemCategoryQueryStr = " jewel.abyss"
812- itemCategory = " AbyssJewel"
813- elseif slot .slotName :find (" Jewel" ) ~= nil then
814- itemCategoryQueryStr = " jewel"
815- itemCategory = options .jewelType .. " Jewel"
816- if itemCategory == " AbyssJewel" then
817- itemCategoryQueryStr = " jewel.abyss"
818- elseif itemCategory == " BaseJewel" then
819- itemCategoryQueryStr = " jewel.base"
745+
746+ if not itemCategoryQueryStr then
747+ logToFile (" '%s' is not supported for weighted trade query generation" , existingItem and existingItem .type or " n/a" )
748+ return
820749 end
821- elseif slot .slotName :find (" Flask" ) ~= nil then
822- itemCategoryQueryStr = " flask"
823- itemCategory = " Flask"
824- else
825- logToFile (" '%s' is not supported for weighted trade query generation" , existingItem and existingItem .type or " n/a" )
826- return
827750 end
828751
829752 -- Create a temp item for the slot with no mods
0 commit comments