134 lines
4.3 KiB
C#
134 lines
4.3 KiB
C#
using BrewMonster.Network;
|
|
using BrewMonster.Scripts.Managers;
|
|
using CSNetwork.GPDataType;
|
|
using ModelRenderer.Scripts.Common;
|
|
using ModelRenderer.Scripts.GameData;
|
|
using System;
|
|
namespace BrewMonster.Scripts
|
|
{
|
|
public class EC_IvtrSkillMat : EC_IvtrItem
|
|
{
|
|
/// <summary>
|
|
/// Not create logic yet (add summary later)
|
|
/// </summary>
|
|
/// <param name="tid">Template id</param>
|
|
/// <param name="expire_date">Expire date</param>
|
|
public EC_IvtrSkillMat(int tid, int expire_date) : base(tid, expire_date)
|
|
{
|
|
m_iCID = (int)InventoryClassId.ICID_SKILLMATTER;
|
|
|
|
elementdataman pDB = ElementDataManProvider.GetElementDataMan();
|
|
DATA_TYPE dataType = DATA_TYPE.DT_INVALID;
|
|
m_pDBEssence = (SKILLMATTER_ESSENCE)pDB.get_data_ptr((uint)tid, ID_SPACE.ID_SPACE_ESSENCE, ref dataType);
|
|
|
|
m_iPileLimit = m_pDBEssence.pile_num_max;
|
|
m_iPrice = m_pDBEssence.price;
|
|
m_iShopPrice = m_pDBEssence.shop_price;
|
|
m_iProcType = (int)m_pDBEssence.proc_type;
|
|
m_i64EquipMask = 0;
|
|
m_bUseable = true;
|
|
m_bNeedUpdate = false;
|
|
}
|
|
|
|
public EC_IvtrSkillMat(EC_IvtrSkillMat other) : base(other)
|
|
{
|
|
m_pDBEssence = other.m_pDBEssence;
|
|
}
|
|
|
|
public override bool SetItemInfo(byte[] pInfoData, int iDataLen)
|
|
{
|
|
base.SetItemInfo(pInfoData, iDataLen);
|
|
return true;
|
|
}
|
|
|
|
public override string GetIconFile()
|
|
{
|
|
base.GetIconFile();
|
|
return Convert.ToBase64String(m_pDBEssence.file_icon);
|
|
}
|
|
|
|
public override string GetName()
|
|
{
|
|
if(m_pDBEssence.name != null && m_pDBEssence.name.Length > 0)
|
|
{
|
|
string s = ByteToStringUtils.UshortArrayToUnicodeString(m_pDBEssence.name);
|
|
if(!string.IsNullOrEmpty(s) && !string.IsNullOrWhiteSpace(s))
|
|
{
|
|
return s;
|
|
}
|
|
|
|
s = ByteToStringUtils.UshortArrayToCP936String(m_pDBEssence.name);
|
|
if(!string.IsNullOrEmpty(s))
|
|
return s;
|
|
}
|
|
return base.GetName();
|
|
}
|
|
|
|
public override int GetCoolTime(out int piMax)
|
|
{
|
|
piMax = 0;
|
|
CECHostPlayer pHost = EC_Game.GetGameRun().GetHostPlayer();
|
|
return pHost != null ? pHost.GetCoolTime((int)CoolTimeIndex.GP_CT_SKILLMATTER, out piMax) : 0;
|
|
}
|
|
|
|
protected override string GetNormalDesc(bool bRepair)
|
|
{
|
|
m_strDesc = string.Empty;
|
|
|
|
CECStringTab pDescTab = EC_Game.GetItemDesc();
|
|
int red = (int)DescriptipionMsg.ITEMDESC_COL_RED;
|
|
int white = (int)DescriptipionMsg.ITEMDESC_COL_WHITE;
|
|
int namecol = DecideNameCol();
|
|
|
|
if (m_iCount > 1)
|
|
{
|
|
AddDescText(namecol, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_NAMENUMBER), GetName(), m_iCount);
|
|
}
|
|
else
|
|
{
|
|
AddDescText(namecol, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_NAME), GetName());
|
|
}
|
|
|
|
AddExpireTimeDesc();
|
|
|
|
if (m_pDBEssence.level_required > 0)
|
|
{
|
|
CECHostPlayer pHost = EC_Game.GetGameRun().GetHostPlayer();
|
|
int hostLevel = pHost != null ? pHost.GetMaxLevelSofar() : 0;
|
|
int col = hostLevel >= m_pDBEssence.level_required ? white : red;
|
|
AddDescText(col, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_LEVELREQ), m_pDBEssence.level_required);
|
|
}
|
|
|
|
AddExtDescText();
|
|
return m_strDesc;
|
|
}
|
|
|
|
public override bool CheckUseCondition()
|
|
{
|
|
if(m_pDBEssence.id == 0)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
CECHostPlayer pHost = EC_Game.GetGameRun().GetHostPlayer();
|
|
if(pHost == null)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
if(pHost.GetMaxLevelSofar() < m_pDBEssence.level_required)
|
|
{
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public override string GetDropModel()
|
|
{
|
|
base.GetDropModel();
|
|
return Convert.ToBase64String(m_pDBEssence.file_matter);
|
|
}
|
|
}
|
|
}
|
|
|