[M19-P3] 实装 1.13c 物品交易与收购价格计算引擎 (ITEMS_CalculateTransactionCost 0x6FD9B1C0) #483
Labels
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: troytt/diablo2-web#483
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
背景与目标
100% 还原
D2Common.dll中的ITEMS_CalculateTransactionCost (0x6FD9B1C0)及其 3 个子函数,精确计算任意物品的商人售价 (玩家购买价BUY)、商人收购价 (玩家出售价SELL)、铁匠修理费 (REPAIR) 与赌博价 (GAMBLE)。1.13c Ground Truth 对标 (
Items.cpp:1709-2495)BaseCost):IFLAG_STARTITEM) 恒返回1金币。nAC * dwCost / dwMaxAc。qty * dwCost / 1024;书册 (Books.txt) 按书页数量累加:BaseCost + qty * CostPerCharge。nSellCost = BaseCost,nBuyCost = Math.trunc(BaseCost / 2),nRepCost = BaseCost。ITEMS_CalculateAdditionalCostsForItemSkill 0x6FD9CB50):ItemTypes.StaffMods != 7),遍历物品上的单技能 (STAT_ITEM_SINGLESKILL):nSellCost/nRepCost增加(2 * slvl - 1) * (SkillCostAdd + Math.trunc(BaseCost * SkillCostMult / 1024))。nBuyCost(收购价)增加(2 * slvl - 1) * (SkillCostAdd + Math.trunc(BaseCost * SkillCostMult / 4096))(严格 1/4 比例)。IFLAG_IDENTIFIED):dwAdd + BaseCost * dwMultiply / 1024(收购价/2048)并调用ITEMS_CalculateAdditionalCostsForBonusStats (0x6FD9ACE0)按ItemStatCost.txt的Multiply与Add逐点累加(若出现负向词缀导致低于BaseCost,严格触发保底回退nSellCost = BaseCost, nBuyCost = BaseCost / 2)。UniqueItems.txt/SetItems.txt的cost mult与cost add加成并累加属性成本。BaseCost / 2。Math.trunc(Filler.dwCost / 2)。IFLAG_ETHEREAL):收购价nBuyCost = Math.trunc(nBuyCost / 4)(破损无形归 0)。ItemTypes.Class < 7):收购价nBuyCost = Math.trunc(nBuyCost / 4)。Npc.txt汇率、任务折扣、难度最高收购上限 (max buy) 与减价属性:Npc.txt的sell mult/buy mult/rep mult(/ 1024) 及已完成任务的quest*mult(/ 1024)。transactionType === 'sell'时,nBuyCost = Math.min(nBuyCost, NpcTxt.maxBuy[difficulty])(普通 Act 1..5 为5000 / 10000 / 15000 / 20000 / 25000,噩梦30000,地狱35000)。STAT_ITEM_REDUCEDPRICES):仅对BUY、REPAIR、GAMBLE生效(不对SELL生效)。验收标准
src/game/item-cost.ts。[M15-P3] 实装 1.13c 物品交易与收购价格计算引擎 (ITEMS_CalculateTransactionCost 0x6FD9B1C0)to [M19-P3] 实装 1.13c 物品交易与收购价格计算引擎 (ITEMS_CalculateTransactionCost 0x6FD9B1C0)Implemented and verified in commit
3b993cf(tsc --noEmit0 errors,vitest17/17 passing, headless Chrome UI verification passing).