106 lines
3.5 KiB
C#
106 lines
3.5 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Reflection;
|
|
using System.IO;
|
|
using BrewMonster;
|
|
using ModelRenderer.Scripts.Common;
|
|
using ModelRenderer.Scripts.GameData;
|
|
using UnityEngine;
|
|
using PerfectWorld.Scripts.Managers;
|
|
using BrewMonster.Network;
|
|
using BrewMonster.Scripts.Managers;
|
|
using BrewMonster.Scripts;
|
|
using CSNetwork.GPDataType;
|
|
using System.Runtime.InteropServices;
|
|
namespace BrewMonster.Scripts
|
|
{
|
|
public class EC_IvtrTaskItem : EC_IvtrItem
|
|
{
|
|
protected TASKMATTER_ESSENCE m_pDBEssence;
|
|
/// <summary>
|
|
/// Not create logic yet (add summary later)
|
|
/// </summary>
|
|
/// <param name="tid">Template id</param>
|
|
/// <param name="expire_date">Expire date</param>
|
|
public EC_IvtrTaskItem(int tid, int expire_date) : base(tid, expire_date)
|
|
{
|
|
m_iCID = (int)InventoryClassId.ICID_TASKITEM;
|
|
|
|
// Get database data
|
|
elementdataman pDB = ElementDataManProvider.GetElementDataMan();
|
|
DATA_TYPE DataType = DATA_TYPE.DT_INVALID;
|
|
m_pDBEssence = (TASKMATTER_ESSENCE)pDB.get_data_ptr((uint)tid, ID_SPACE.ID_SPACE_ESSENCE, ref DataType);
|
|
|
|
m_iPileLimit = m_pDBEssence.pile_num_max;
|
|
m_iPrice = 0;
|
|
m_iShopPrice = 0;
|
|
m_iProcType = (int)m_pDBEssence.proc_type;
|
|
m_i64EquipMask = 0;
|
|
|
|
m_bNeedUpdate = false;
|
|
}
|
|
|
|
public EC_IvtrTaskItem(EC_IvtrTaskItem other) : base(other)
|
|
{
|
|
m_pDBEssence = other.m_pDBEssence;
|
|
}
|
|
|
|
public override bool SetItemInfo(byte[] pInfoData, int iDataLen)
|
|
{
|
|
base.SetItemInfo(pInfoData, iDataLen);
|
|
return true;
|
|
}
|
|
|
|
// Get item icon file name
|
|
public override string GetIconFile()
|
|
{
|
|
return m_pDBEssence.FileIcon;
|
|
}
|
|
|
|
// Get item name
|
|
public override string GetName()
|
|
{
|
|
// Try Unicode first (for Vietnamese/wide char names), then fallback to CP936
|
|
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;
|
|
// Fallback to legacy CP936 if Unicode was empty
|
|
s = ByteToStringUtils.UshortArrayToCP936String(m_pDBEssence.name);
|
|
if (!string.IsNullOrEmpty(s))
|
|
return s;
|
|
}
|
|
return base.GetName(); // Fallback to base class method
|
|
}
|
|
// Get item description text
|
|
protected override string GetNormalDesc(bool bRepair)
|
|
{
|
|
m_strDesc = string.Empty;
|
|
|
|
// Try to build item description
|
|
CECStringTab pDescTab = EC_Game.GetItemDesc();
|
|
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());
|
|
|
|
AddIDDescText();
|
|
|
|
AddExpireTimeDesc();
|
|
|
|
// Task item
|
|
AddDescText(white, false, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_TASKITEM));
|
|
|
|
// Extend description
|
|
AddExtDescText();
|
|
|
|
return m_strDesc;
|
|
}
|
|
}
|
|
}
|
|
|