Modify Price desc.

This commit is contained in:
Chomper9981
2026-04-08 10:17:02 +07:00
parent 21eeae10cb
commit 7196130558
4 changed files with 30 additions and 21 deletions
@@ -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
@@ -171,10 +171,8 @@ namespace BrewMonster.Scripts
/// class id
/// </summary>
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
/// <summary>
/// Get scaled item price
/// </summary>
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);
}
}
/// <summary>
@@ -1876,7 +1882,7 @@ namespace BrewMonster.Scripts
/// <summary>
/// Add price description
/// </summary>
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());
@@ -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;
@@ -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);
}