From 7196130558950116f25caf45faabdeb976076c56 Mon Sep 17 00:00:00 2001 From: Chomper9981 Date: Wed, 8 Apr 2026 10:17:02 +0700 Subject: [PATCH] Modify Price desc. --- .../Scripts/Managers/EC_InventoryUI.cs | 1 + .../Managers/EC_IvtrItem/EC_IvtrEquip.cs | 46 +++++++++++-------- .../Managers/EC_IvtrItem/EC_IvtrGoblin.cs | 2 +- .../Managers/EC_IvtrItem/EC_IvtrItem.cs | 2 + 4 files changed, 30 insertions(+), 21 deletions(-) diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_InventoryUI.cs b/Assets/PerfectWorld/Scripts/Managers/EC_InventoryUI.cs index 6f18117f1f..c04efa156c 100644 --- a/Assets/PerfectWorld/Scripts/Managers/EC_InventoryUI.cs +++ b/Assets/PerfectWorld/Scripts/Managers/EC_InventoryUI.cs @@ -1435,6 +1435,7 @@ namespace BrewMonster.Scripts.Managers string fullDesc = null; if (showEquipmentDetails && currentSelectedEquipment != null) { + currentSelectedEquipment.SetPriceScale((int)EC_IvtrItem.ScaleType.SCALE_SELL, 1f); fullDesc = currentSelectedEquipment.GetDesc(EC_IvtrItem.DescType.DESC_NORMAL, EC_Game.GetGameRun().GetHostPlayer().GetEquipment()); } else diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrEquip.cs b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrEquip.cs index a7650f3420..f65c3c43d5 100644 --- a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrEquip.cs +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrEquip.cs @@ -171,10 +171,8 @@ namespace BrewMonster.Scripts /// class id /// public int CID { get; set; } - public int Price { get; set; } public int Count { get; set; } - public float PriceScale { get; set; } - public int ScaleType { get; set; } + //public int ScaleType { get; set; } // Equipment Requirements public int LevelReq { get; set; } @@ -569,10 +567,10 @@ namespace BrewMonster.Scripts TemplateId = tid; ExpireDate = expireDate; CID = (int)InventoryClassId.ICID_EQUIP; - Price = 0; + m_iPrice = 0; Count = 1; - PriceScale = 1.0f; - ScaleType = 0; + m_fPriceScale = 1.0f; + //ScaleType = 0; LevelReq = 0; StrengthReq = 0; @@ -600,10 +598,10 @@ namespace BrewMonster.Scripts TemplateId = other.TemplateId; ExpireDate = other.ExpireDate; CID = other.CID; - Price = other.Price; + m_iPrice = other.m_iPrice; Count = other.Count; - PriceScale = other.PriceScale; - ScaleType = other.ScaleType; + m_fPriceScale = other.m_fPriceScale; + //ScaleType = other.ScaleType; // Copy equipment properties LevelReq = other.LevelReq; @@ -751,10 +749,10 @@ namespace BrewMonster.Scripts if (len < 16 + 6 * 2 + 8 + 2) return false; // A legacy format we used earlier that prefixed price/scale before requirements - Price = BitConverter.ToInt32(data, offset); offset += 4; + m_iPrice = BitConverter.ToInt32(data, offset); offset += 4; Count = BitConverter.ToInt32(data, offset); offset += 4; - PriceScale = BitConverter.ToSingle(data, offset); offset += 4; - ScaleType = BitConverter.ToInt32(data, offset); offset += 4; + m_fPriceScale = BitConverter.ToSingle(data, offset); offset += 4; + //ScaleType = BitConverter.ToInt32(data, offset); offset += 4; LevelReq = BitConverter.ToInt16(data, offset); offset += 2; ProfReq = BitConverter.ToInt16(data, offset); offset += 2; @@ -980,17 +978,25 @@ namespace BrewMonster.Scripts /// /// Get scaled item price /// - public int GetScaledPrice() + public override int GetScaledPrice() { - if (ScaleType != SCALE_SELL) - return (int)(Price * Count * PriceScale + 0.5f); - - int price = Price * Count; + Debug.Log($"GetScaledPrice: m_iScaleType: {m_iScaleType}"); + if (m_iScaleType != (int)EC_IvtrItem.ScaleType.SCALE_SELL) + return base.GetScaledPrice(); + + int price = m_iPrice * Count; if (MaxEndurance == CurEndurance || MaxEndurance == 0) - return (int)(price * PriceScale + 0.5f); + { + Debug.Log($"GetScaledPrice: price: {price}, MaxEndurance: {m_fPriceScale}"); + return (int)(price * m_fPriceScale + 0.5f); + } + else - return (int)(price * PriceScale * CurEndurance / (float)MaxEndurance + 0.5f); + { + Debug.Log($"GetScaledPrice: price: {price}, PriceScale: {m_fPriceScale}, CurEndurance: {CurEndurance}, MaxEndurance: {MaxEndurance}, factor: {CurEndurance / (float)MaxEndurance}"); + return (int)(price * m_fPriceScale * CurEndurance / (float)MaxEndurance + 0.5f); + } } /// @@ -1876,7 +1882,7 @@ namespace BrewMonster.Scripts /// /// Add price description /// - public void AddPriceDesc(int col, bool repair) + protected override void AddPriceDesc(int col, bool repair) { if (repair) AddDescText(col, false, GetItemDescString(DescriptipionMsg.ITEMDESC_REPAIRCOST), GetRepairCost()); diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrGoblin.cs b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrGoblin.cs index b4c5beb0df..d75f44eee8 100644 --- a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrGoblin.cs +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrGoblin.cs @@ -165,7 +165,7 @@ namespace BrewMonster.Scripts DATA_TYPE DataType = DATA_TYPE.DT_INVALID; m_pDBEssence = (GOBLIN_ESSENCE)pDB.get_data_ptr((uint)tid, ID_SPACE.ID_SPACE_ESSENCE, ref DataType); m_iPileLimit = m_pDBEssence.pile_num_max; - Price = m_pDBEssence.price; + m_iPrice = m_pDBEssence.price; m_iShopPrice = m_pDBEssence.shop_price; m_iProcType = (int)m_pDBEssence.proc_type; m_bNeedUpdate = false; diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrItem.cs b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrItem.cs index 183694dda1..408d3ac2e9 100644 --- a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrItem.cs +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrItem.cs @@ -1141,6 +1141,8 @@ namespace BrewMonster.Scripts public virtual int GetScaledPrice() { int iPrice = m_iScaleType == (int)ScaleType.SCALE_BUY ? m_iShopPrice : m_iPrice; + string str = m_iScaleType == (int)ScaleType.SCALE_BUY ? "ShopPrice" : "Price"; + Debug.Log($"GetScaledPrice: iPrice: {iPrice} is {str}, m_iScaleType: {m_iScaleType}, m_fPriceScale: {m_fPriceScale}"); return GetScaledPrice(iPrice, m_iCount, m_iScaleType, m_fPriceScale); }