174 lines
5.5 KiB
C#
174 lines
5.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 PerfectWorld.Scripts.Managers
|
|
{
|
|
|
|
public class EC_IvtrWing : EC_IvtrEquip
|
|
{
|
|
IVTR_ESSENCE_WING m_Essence;
|
|
WINGMANWING_ESSENCE m_pDBEssence;
|
|
public EC_IvtrWing(int tid, int expire_date) : base(tid, expire_date)
|
|
{
|
|
m_iCID = (int)EC_IvtrItem.InventoryClassId.ICID_WING;
|
|
|
|
// Get database data
|
|
elementdataman pDB = ElementDataManProvider.GetElementDataMan();
|
|
DATA_TYPE DataType = DATA_TYPE.DT_INVALID;
|
|
m_pDBEssence = (WINGMANWING_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 = EC_IvtrType.EQUIP_MASK64_FLYSWORD;
|
|
}
|
|
|
|
public EC_IvtrWing(EC_IvtrWing other) : base(other)
|
|
{
|
|
m_Essence = other.m_Essence;
|
|
m_pDBEssence = other.m_pDBEssence;
|
|
MadeFrom = other.MadeFrom;
|
|
Maker = other.Maker;
|
|
}
|
|
|
|
// Set item detail information
|
|
public override bool SetItemInfo(byte[] pInfoData, int iDataLen)
|
|
{
|
|
// Note: because wing isn't an absolute equipment, so skip
|
|
// CECIvtrEquip::SetItemInfo().
|
|
|
|
if (pInfoData == null || iDataLen <= 0)
|
|
{
|
|
m_bNeedUpdate = false;
|
|
return true;
|
|
}
|
|
|
|
try
|
|
{
|
|
CECDataReader dr = new CECDataReader(pInfoData, iDataLen);
|
|
|
|
m_Essence = new IVTR_ESSENCE_WING(dr.ReadData(Marshal.SizeOf<IVTR_ESSENCE_WING>()));
|
|
ReadMakerInfo(dr);
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
Debug.LogError("EC_IvtrWing::SetItemInfo, data read error (" + e.GetType() + ")");
|
|
return false;
|
|
}
|
|
|
|
LevelReq = (short)m_Essence.require_level;
|
|
m_bNeedUpdate = false;
|
|
|
|
return true;
|
|
}
|
|
|
|
// Get item icon file name
|
|
public override string GetIconFile()
|
|
{
|
|
return m_pDBEssence.FileIcon;
|
|
}
|
|
|
|
// Get item name
|
|
public override string GetName()
|
|
{
|
|
return m_pDBEssence.Name;
|
|
}
|
|
|
|
// Get item description text
|
|
protected override string GetNormalDesc(bool bRepair)
|
|
{
|
|
if (m_bNeedUpdate)
|
|
return null;
|
|
|
|
m_strDesc = "";
|
|
|
|
// Try to build item description
|
|
CECStringTab pDescTab = EC_Game.GetItemDesc();
|
|
CECHostPlayer pHost = EC_Game.GetGameRun().GetHostPlayer();
|
|
|
|
int white = (int)DescriptipionMsg.ITEMDESC_COL_WHITE;
|
|
int red = (int)DescriptipionMsg.ITEMDESC_COL_RED;
|
|
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();
|
|
|
|
// Fly speed bonus
|
|
AddDescText(white, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_ADDFLYSPEED), m_Essence.speed_increase);
|
|
|
|
// Profession requirement
|
|
if (true)
|
|
{
|
|
CECStringTab pFixMsg = EC_Game.GetFixedMsgs();
|
|
int col = (pHost.GetProfession() == (int)PROFESSION.PROF_ARCHOR || pHost.GetProfession() == (int)PROFESSION.PROF_ANGEL) ? white : red;
|
|
AddDescText(col, false, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_PROFESSIONREQ));
|
|
m_strDesc += " ";
|
|
AddDescText(col, false, pFixMsg.GetWideString((int)FixedMsg.FIXMSG_PROF_ARCHOR));
|
|
m_strDesc += " ";
|
|
AddDescText(col, true, pFixMsg.GetWideString((int)FixedMsg.FIXMSG_PROF_ANGEL));
|
|
}
|
|
|
|
// Level requirment
|
|
if (LevelReq > 0)
|
|
{
|
|
int col = pHost.GetMaxLevelSofar() >= LevelReq ? white : red;
|
|
AddDescText(col, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_LEVELREQ), LevelReq);
|
|
}
|
|
|
|
// MP consume
|
|
AddDescText(white, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_MPCONSUME), m_Essence.mp_per_second);
|
|
|
|
// Price
|
|
AddPriceDesc(white, bRepair);
|
|
|
|
AddMakerDesc();
|
|
|
|
// Suite description
|
|
AddSuiteDesc();
|
|
|
|
// Extend description
|
|
AddExtDescText();
|
|
|
|
return m_strDesc;
|
|
}
|
|
|
|
// Get the MP consumed every seconds
|
|
public int GetMPPerSecond()
|
|
{
|
|
return m_Essence.mp_per_second;
|
|
}
|
|
|
|
// Get the launch MP cost
|
|
public int GetLaunchMP()
|
|
{
|
|
return m_Essence.mp_launch;
|
|
}
|
|
|
|
// Get drop model for shown
|
|
public override string GetDropModel()
|
|
{
|
|
return m_pDBEssence.FileMatter;
|
|
}
|
|
|
|
}
|
|
}
|
|
|