Skip to content

Commit c496571

Browse files
authored
Tww/#297 recipe scan (#298)
* added new skilllineids * migration for itemOptimizedCostsDB * Fixed gear recognition in recipe data constructor * consider reagent increase factor of 0 * depricated function fix * migration fix
1 parent de49f68 commit c496571

13 files changed

+67
-53
lines changed

Classes/CooldownData.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ function CraftSim.CooldownData:Update()
3737
self.maxCharges = maxCharges or 0
3838

3939
if self.isDayCooldown then
40-
local _, maxCooldown = select(2, GetSpellCooldown(self.recipeID))
40+
local _, maxCooldown = select(2, C_Spell.GetSpellCooldown(self.recipeID))
4141
self.maxCooldown = maxCooldown -- for day cooldowns only (cd reductions inclusive)
4242
local elapsedTimeSinceCooldownStart = (self.maxCooldown - currentCooldown)
4343
self.startTime = math.max(GetServerTime() - elapsedTimeSinceCooldownStart, 0)
4444
else
45-
self.cooldownPerCharge = select(4, GetSpellCharges(self.recipeID))
45+
self.cooldownPerCharge = select(4, C_Spell.GetSpellCharges(self.recipeID))
4646
if self.currentCharges < self.maxCharges then
4747
local elapsedTimeSinceCooldownStart = (self.cooldownPerCharge - currentCooldown)
4848
self.startTimeCurrentCharge = GetServerTime() - elapsedTimeSinceCooldownStart

Classes/ReagentData.lua

+4
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,10 @@ function CraftSim.ReagentData:GetMaxSkillFactor()
206206

207207
local maxSkill = skillWithReagents - baseSkill
208208

209+
if maxSkill == 0 then
210+
-- division by zero not possible so just configure that reagents do not influence skill at all by returning a factor of 0
211+
return 0
212+
end
209213
local maxReagentIncreaseFactor = self.recipeData.baseProfessionStats.recipeDifficulty.value / maxSkill
210214

211215
print("ReagentData: maxReagentIncreaseFactor: " .. tostring(maxReagentIncreaseFactor))

Classes/RecipeData.lua

+7-2
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,15 @@ function CraftSim.RecipeData:new(recipeID, isRecraft, isWorkOrder, crafterData)
106106
self.relativeProfitCached = nil
107107
self.isQuestRecipe = tContains(CraftSim.CONST.QUEST_RECIPE_IDS, recipeID)
108108

109+
self.isGear = false
110+
109111
if self.recipeInfo.hyperlink then
110-
local subclassID = select(7, C_Item.GetItemInfoInstant(self.recipeInfo.hyperlink))
112+
local itemInfoInstant = { C_Item.GetItemInfoInstant(self.recipeInfo.hyperlink) }
113+
local subclassID = itemInfoInstant[7]
111114
---@type number?
112115
self.subtypeID = subclassID
116+
-- 4th return value is item equip slot, so if its of non type its not equipable, otherwise its gear
117+
self.isGear = itemInfoInstant[4] ~= CraftSim.CONST.INVENTORY_TYPE_NON_EQUIP_IGNORE
113118
end
114119

115120
self.isOldWorldRecipe = not self:IsDragonflightRecipe()
@@ -131,7 +136,7 @@ function CraftSim.RecipeData:new(recipeID, isRecraft, isWorkOrder, crafterData)
131136
---@type string?
132137
self.allocationItemGUID = nil
133138
self.maxQuality = self.recipeInfo.maxQuality
134-
self.isGear = self.recipeInfo.hasSingleItemOutput and self.recipeInfo.qualityIlvlBonuses ~= nil
139+
--self.isGear = self.recipeInfo.hasSingleItemOutput and self.recipeInfo.qualityIlvlBonuses ~= nil
135140

136141
self.supportsMulticraft = false
137142
self.supportsResourcefulness = false

Classes/ResultData.lua

+3-1
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,16 @@ function CraftSim.ResultData:UpdatePossibleResultItems()
6262
table.insert(self.itemsByQuality, Item:CreateFromItemLink(itemLink))
6363
end
6464
else
65+
print("fetching quality ids itemids:", false, true)
6566
local itemIDs = CraftSim.UTIL:GetDifferentQualityIDsByCraftingReagentTbl(recipeData.recipeID,
6667
craftingReagentInfoTbl, recipeData.allocationItemGUID)
6768
for _, itemID in pairs(itemIDs) do
69+
print("itemID: " .. itemID)
6870
table.insert(self.itemsByQuality, Item:CreateFromItemID(itemID))
6971
end
7072
end
7173

72-
if not recipeData.isGear and self.itemsByQuality[1] and self.itemsByQuality[2] then
74+
if not recipeData.isGear and self.itemsByQuality[1] and self.itemsByQuality[2] and not recipeData.supportsQualities then
7375
if self.itemsByQuality[1]:GetItemID() == self.itemsByQuality[2]:GetItemID() then
7476
self.itemsByQuality = { self.itemsByQuality[1] } -- force one of an item (illustrious insight e.g. has always 3 items in it for whatever reason)
7577
end

DB/itemOptimizedCostsDB.lua

+18-19
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,14 @@ function CraftSim.DB.ITEM_OPTIMIZED_COSTS:Migrate()
5858

5959
CraftSimDB.itemOptimizedCostsDB.version = 2
6060
end
61+
62+
-- 2 -> 3 (17.0.0 - TWW)
63+
if CraftSimDB.itemOptimizedCostsDB.version == 2 then
64+
-- clear the db for a reset
65+
self:ClearAll()
66+
67+
CraftSimDB.itemOptimizedCostsDB.version = 3
68+
end
6169
end
6270

6371
function CraftSim.DB.ITEM_OPTIMIZED_COSTS:ClearAll()
@@ -88,25 +96,16 @@ function CraftSim.DB.ITEM_OPTIMIZED_COSTS:Add(recipeData)
8896

8997
-- only if reachable
9098
for qualityID, item in ipairs(recipeData.resultData.itemsByQuality) do
91-
local chance = recipeData.resultData.chanceByQuality[qualityID] or 0
92-
local minChance = recipeData.resultData.chancebyMinimumQuality[qualityID] or 0
93-
if minChance > 0 then
94-
print("Caching Optimized Costs Data for: " .. recipeData.recipeName)
95-
local itemID = item:GetItemID()
96-
CraftSimDB.itemOptimizedCostsDB.data[itemID] = CraftSimDB.itemOptimizedCostsDB.data[itemID] or {}
97-
98-
CraftSimDB.itemOptimizedCostsDB.data[itemID][recipeData:GetCrafterUID()] = {
99-
crafter = recipeData:GetCrafterUID(),
100-
qualityID = qualityID,
101-
craftingChance = chance,
102-
craftingChanceMin = minChance,
103-
expectedCosts = recipeData.priceData.expectedCostsByQuality[qualityID],
104-
expectedCostsMin = recipeData.priceData.expectedCostsByMinimumQuality[qualityID],
105-
expectedCrafts = recipeData.resultData.expectedCraftsByQuality[qualityID],
106-
expectedCraftsMin = recipeData.resultData.expectedCraftsByMinimumQuality[qualityID],
107-
profession = recipeData.professionData.professionInfo.profession,
108-
}
109-
end
99+
print("Caching Optimized Costs Data for: " .. recipeData.recipeName)
100+
local itemID = item:GetItemID()
101+
CraftSimDB.itemOptimizedCostsDB.data[itemID] = CraftSimDB.itemOptimizedCostsDB.data[itemID] or {}
102+
103+
CraftSimDB.itemOptimizedCostsDB.data[itemID][recipeData:GetCrafterUID()] = {
104+
crafter = recipeData:GetCrafterUID(),
105+
qualityID = qualityID,
106+
expectedCostsPerItem = recipeData.priceData.expectedCostsPerItem,
107+
profession = recipeData.professionData.professionInfo.profession,
108+
}
110109
end
111110
end
112111
end

DB/optionsDB.lua

+4-4
Original file line numberDiff line numberDiff line change
@@ -208,10 +208,10 @@ function CraftSim.DB.OPTIONS:Migrate()
208208
end
209209

210210
if CraftSimDB.optionsDB.version == 2 then
211-
CraftSimDB.optionsDB.data[CraftSim.CONST.GENERAL_OPTIONS.MODULE_CUSTOMER_SERVICE] = nil
212-
CraftSimDB.optionsDB.data[CraftSim.CONST.GENERAL_OPTIONS.CUSTOMER_SERVICE_WHISPER_FORMAT] = nil
213-
CraftSimDB.optionsDB.data[CraftSim.CONST.GENERAL_OPTIONS.CUSTOMER_SERVICE_ALLOW_LIVE_PREVIEW] = nil
214-
CraftSimDB.optionsDB.data[CraftSim.CONST.GENERAL_OPTIONS.CUSTOMER_SERVICE_ACTIVE_PREVIEW_IDS] = nil
211+
CraftSimDB.optionsDB.data["MODULE_CUSTOMER_SERVICE"] = nil
212+
CraftSimDB.optionsDB.data["CUSTOMER_SERVICE_WHISPER_FORMAT"] = nil
213+
CraftSimDB.optionsDB.data["CUSTOMER_SERVICE_ALLOW_LIVE_PREVIEW"] = nil
214+
CraftSimDB.optionsDB.data["CUSTOMER_SERVICE_ACTIVE_PREVIEW_IDS"] = nil
215215

216216
CraftSimDB.optionsDB.version = 3
217217
end

Locals/enUS.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ function CraftSim.LOCAL_EN:GetData()
6767
[CraftSim.CONST.TEXT.MULTICRAFT_EXPLANATION_TOOLTIP] =
6868
"Multicraft gives you a chance of crafting more items than you would usually produce with a recipe.\n\nThe additional amount is usually between 1 and 2.5y\nwhere y = the usual amount 1 craft yields.",
6969
[CraftSim.CONST.TEXT.REAGENTSKILL_EXPLANATION_TOOLTIP] =
70-
"The quality of your materials can give you a maximum of 25% of the base recipe difficulty as bonus skill.\n\nAll Q1 Materials: 0% Bonus\nAll Q2 Materials: 12.5% Bonus\nAll Q3 Materials: 25% Bonus\n\nThe skill is calculated by the amount of materials of each quality weighted against their quality\nand a specific weight value that is unique to each individual dragon flight crafting material item\n\nThis is however different for recrafts. There the maximum the reagents can increase the quality\nis dependent on the quality of materials the item was originally crafted with.\nThe exact workings are not known.\nHowever, CraftSim internally compares the achieved skill with all q3 and calculates\nthe max skill increase based on that.",
70+
"The quality of your materials can give you a maximum of 40% of the base recipe difficulty as bonus skill.\n\nAll Q1 Materials: 0% Bonus\nAll Q2 Materials: 20% Bonus\nAll Q3 Materials: 40% Bonus\n\nThe skill is calculated by the amount of materials of each quality weighted against their quality\nand a specific weight value that is unique to each individual dragon flight crafting material item\n\nThis is however different for recrafts. There the maximum the reagents can increase the quality\nis dependent on the quality of materials the item was originally crafted with.\nThe exact workings are not known.\nHowever, CraftSim internally compares the achieved skill with all q3 and calculates\nthe max skill increase based on that.",
7171
[CraftSim.CONST.TEXT.REAGENTFACTOR_EXPLANATION_TOOLTIP] =
72-
"The maximum the materials can contribute to a recipe is most of the time 25% of the base recipe difficulty.\n\nHowever in the case of recrafting, this value can vary based on previous crafts\nand the quality of materials that were used.",
72+
"The maximum the materials can contribute to a recipe is most of the time 40% of the base recipe difficulty.\n\nHowever in the case of recrafting, this value can vary based on previous crafts\nand the quality of materials that were used.",
7373

7474
-- Simulation Mode
7575
[CraftSim.CONST.TEXT.SIMULATION_MODE_NONE] = "None",

Locals/frFR.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ function CraftSim.LOCAL_FR:GetData()
6565
[CraftSim.CONST.TEXT.MULTICRAFT_EXPLANATION_TOOLTIP] =
6666
"Multicraft gives you a chance of crafting more items than you would usually produce with a recipe.\n\nThe additional amount is usually between 1 and 2.5y\nwhere y = the usual amount 1 craft yields.",
6767
[CraftSim.CONST.TEXT.REAGENTSKILL_EXPLANATION_TOOLTIP] =
68-
"The quality of your materials can give you a maximum of 25% of the base recipe difficulty as bonus skill.\n\nAll Q1 Materials: 0% Bonus\nAll Q2 Materials: 12.5% Bonus\nAll Q3 Materials: 25% Bonus\n\nThe skill is calculated by the amount of materials of each quality weighted against their quality\nand a specific weight value that is unique to each individual dragon flight crafting material item\n\nThis is however different for recrafts. There the maximum the reagents can increase the quality\nis dependent on the quality of materials the item was originally crafted with.\nThe exact workings are not known.\nHowever, CraftSim internally compares the achieved skill with all q3 and calculates\nthe max skill increase based on that.",
68+
"The quality of your materials can give you a maximum of 40% of the base recipe difficulty as bonus skill.\n\nAll Q1 Materials: 0% Bonus\nAll Q2 Materials: 20% Bonus\nAll Q3 Materials: 40% Bonus\n\nThe skill is calculated by the amount of materials of each quality weighted against their quality\nand a specific weight value that is unique to each individual dragon flight crafting material item\n\nThis is however different for recrafts. There the maximum the reagents can increase the quality\nis dependent on the quality of materials the item was originally crafted with.\nThe exact workings are not known.\nHowever, CraftSim internally compares the achieved skill with all q3 and calculates\nthe max skill increase based on that.",
6969
[CraftSim.CONST.TEXT.REAGENTFACTOR_EXPLANATION_TOOLTIP] =
70-
"The maximum the materials can contribute to a recipe is most of the time 25% of the base recipe difficulty.\n\nHowever in the case of recrafting, this value can vary based on previous crafts\nand the quality of materials that were used.",
70+
"The maximum the materials can contribute to a recipe is most of the time 40% of the base recipe difficulty.\n\nHowever in the case of recrafting, this value can vary based on previous crafts\nand the quality of materials that were used.",
7171

7272
-- Simulation Mode
7373
[CraftSim.CONST.TEXT.SIMULATION_MODE_NONE] = "None",

Locals/itIT.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ function CraftSim.LOCAL_IT:GetData()
3232
[CraftSim.CONST.TEXT.MULTICRAFT_EXPLANATION_TOOLTIP] =
3333
"Creazione multipla ti permette di creare occasionalmente più oggetti del solito.\n\nLa quantità aggiuntiva è stimata tra 1 e 2.5y,\ndove y è la quantità che si ottiene normalmente con una singola operazione di crezione.",
3434
[CraftSim.CONST.TEXT.REAGENTSKILL_EXPLANATION_TOOLTIP] =
35-
"La qualità dei reagenti utilizzati può aumentare la Competenza fino a 25% della Difficoltà ricetta di base.\n\nSolo reagenti di Grado 1: bonus dello 0%\nSolo reagenti di Grado 2: bonus del 12.5%\nSolo reagenti di Grado 3: bonus del 25%\n\nLa Competenza bonus è uguale alla quantità di reagenti di ogni qualità moltiplicata per le rispettive qualità\ne per un punteggio specifico per ogni tipo di reagente.\n\nNel caso di una ricreazione, invece, la Competenza bonus ottenibile dipende anche dai reagenti utilizzati per la creazione originale e per le ricreazioni precedenti.\nIl funzionamento esatto non è conosciuto.\nComunque, CraftSim confronta internamente la Competenza raggiunta con tutti i reagenti di Grado 3 e usa quei valori per calcolare la Competenza bonus reagenti massima.",
35+
"La qualità dei reagenti utilizzati può aumentare la Competenza fino a 40% della Difficoltà ricetta di base.\n\nSolo reagenti di Grado 1: bonus dello 0%\nSolo reagenti di Grado 2: bonus del 20%\nSolo reagenti di Grado 3: bonus del 40%\n\nLa Competenza bonus è uguale alla quantità di reagenti di ogni qualità moltiplicata per le rispettive qualità\ne per un punteggio specifico per ogni tipo di reagente.\n\nNel caso di una ricreazione, invece, la Competenza bonus ottenibile dipende anche dai reagenti utilizzati per la creazione originale e per le ricreazioni precedenti.\nIl funzionamento esatto non è conosciuto.\nComunque, CraftSim confronta internamente la Competenza raggiunta con tutti i reagenti di Grado 3 e usa quei valori per calcolare la Competenza bonus reagenti massima.",
3636
[CraftSim.CONST.TEXT.REAGENTFACTOR_EXPLANATION_TOOLTIP] =
37-
"La qualità dei reagenti utilizzati può aumentare la Competenza fino a 25% della Difficoltà ricetta di base.\n\nNel caso di una ricreazione, però, questo valore può variare in base alla qualità dei reagenti utilizzati per la creazione originale e per le ricreazioni precedenti.",
37+
"La qualità dei reagenti utilizzati può aumentare la Competenza fino a 40% della Difficoltà ricetta di base.\n\nNel caso di una ricreazione, però, questo valore può variare in base alla qualità dei reagenti utilizzati per la creazione originale e per le ricreazioni precedenti.",
3838

3939
-- Simulation Mode
4040
[CraftSim.CONST.TEXT.SIMULATION_MODE_NONE] = "Nessuno",

Locals/ruRU.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ function CraftSim.LOCAL_RU:GetData()
6565
[CraftSim.CONST.TEXT.MULTICRAFT_EXPLANATION_TOOLTIP] =
6666
"Перепроизводство дает вам возможность создать больше предметов, чем вы обычно производите по рецепту.\n\nДополнительная сумма обычно составляет от 1 до 2.5y\nгде y = обычная сумма, которую дает 1 крафт.",
6767
[CraftSim.CONST.TEXT.REAGENTSKILL_EXPLANATION_TOOLTIP] =
68-
"Качество ваших материалов может дать вам максимум 25% от базовой сложности рецепта в качестве бонусного навыка.\n\nВсе материалы Q1: бонус 0%\nВсе материалы Q2: бонус 12,5%\nВсе материалы Q3: бонус 25%\n n\nНавык рассчитывается по количеству материалов каждого качества, взвешенному по отношению к их качеству\n и конкретному значению веса, которое уникально для каждого отдельного материала для крафта Dragonflight\n\nОднако для переделок это отличается. Существует предел того, насколько реагенты могут увеличить качество,\nон зависит от качества материалов, из которых изначально был создан предмет.\nТочные принципы работы неизвестны.\nОднако CraftSim внутренне сравнивает достигнутый навык со всеми q3 и рассчитывает\nмаксимальное увеличение навыка на основе этого.",
68+
"Качество ваших материалов может дать вам максимум 40% от базовой сложности рецепта в качестве бонусного навыка.\n\nВсе материалы Q1: бонус 0%\nВсе материалы Q2: бонус 20%\nВсе материалы Q3: бонус 40%\n n\nНавык рассчитывается по количеству материалов каждого качества, взвешенному по отношению к их качеству\n и конкретному значению веса, которое уникально для каждого отдельного материала для крафта Dragonflight\n\nОднако для переделок это отличается. Существует предел того, насколько реагенты могут увеличить качество,\nон зависит от качества материалов, из которых изначально был создан предмет.\nТочные принципы работы неизвестны.\nОднако CraftSim внутренне сравнивает достигнутый навык со всеми q3 и рассчитывает\nмаксимальное увеличение навыка на основе этого.",
6969
[CraftSim.CONST.TEXT.REAGENTFACTOR_EXPLANATION_TOOLTIP] =
70-
"Наибольший вклад, который материалы могут внести в рецепт, в большинстве случаев составляет 25% от базовой сложности рецепта.\n\nОднако в случае переделки это значение может варьироваться в зависимости от предыдущих крафтов\n и качества использованных ранее материалов.",
70+
"Наибольший вклад, который материалы могут внести в рецепт, в большинстве случаев составляет 40% от базовой сложности рецепта.\n\nОднако в случае переделки это значение может варьироваться в зависимости от предыдущих крафтов\n и качества использованных ранее материалов.",
7171

7272
-- Simulation Mode
7373
[CraftSim.CONST.TEXT.SIMULATION_MODE_NONE] = "Нет",

0 commit comments

Comments
 (0)