Merge branch 'develop' into feature/skill-data

This commit is contained in:
VDH
2026-01-15 13:33:42 +07:00
32 changed files with 4398 additions and 205 deletions
@@ -33,6 +33,8 @@ namespace BrewMonster
await UniTask.DelayFrame(1);
}
var result = await _elementDataMan.load_data();
//TODO: this is for testing. move it to other place
itemdataman.load_data("",false);
if (result == -1)
{
BMLogger.LogError("ElementDataManProvider: Failed to load element data");
@@ -1590,6 +1590,10 @@ namespace ModelRenderer.Scripts.GameData
recipe_id_data_map[id] = data;
recipe_index_id_map[recipe_index_id_map.Count] = id;
break;
case ID_SPACE.ID_SPACE_ADDON:
addon_id_data_map[id] = data;
addon_index_id_map[addon_index_id_map.Count] = id;
break;
default:
break;
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: ef4cf49bb69644c19a3a3904a40db7db
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: a9c1175c22dab468e92f37bc79dfbef1
@@ -2,6 +2,10 @@ namespace BrewMonster.Scripts
{
public class InventoryConst
{
// Equipment endurance scale
public const int ENDURANCE_SCALE = 100;
// NUM_MAGICCLASS
public const int NUM_MAGICCLASS = 5;
// Index of item in equipment inventory
public const int EQUIPIVTR_WEAPON = 0;
public const int EQUIPIVTR_HEAD = 1;
@@ -8,7 +8,6 @@ using System.Globalization;
using System.IO;
using UnityEngine;
using UnityEngine.AddressableAssets;
namespace BrewMonster.Network
{
public partial class EC_Game
@@ -25,8 +24,10 @@ namespace BrewMonster.Network
private static BrewMonster.CECStringTab m_FixedMsgs; // Fixed message table
private static BrewMonster.CECStringTab m_ItemDesc; // Item desciption string table
private static BrewMonster.CECStringTab m_ItemExtDesc; // Item extend description string table
private static BrewMonster.CECStringTab m_ItemExtProp; // Item extend prop string table
private static BrewMonster.CECStringTab m_SkillDesc = new CECStringTab(); // Skill description string table
private static BrewMonster.CECStringTab m_BuffDesc; // Buff description string table
private static Dictionary<int, ItemMsgMapEntry> m_ItemMsgMap; // TemplateId -> (MessageId, DisplayMode)
private static CECConfigs m_pConfigs;
private static int m_iCurCursor; // Current cursor
@@ -71,6 +72,10 @@ namespace BrewMonster.Network
{
return m_BuffDesc;
}
public static BrewMonster.CECStringTab GetItemExtProp()
{
return m_ItemExtProp;
}
public static bool TryGetItemMsg(int templateId, out int messageId, out int displayMode)
{
@@ -97,7 +102,6 @@ namespace BrewMonster.Network
// Load task templates
// if (m_pTaskMan == null) m_pTaskMan = new ATaskTemplMan();
m_pTaskMan = new ATaskTemplMan();
m_pTaskMan.Init(m_pElementDataMan);
m_pConfigs = new CECConfigs(); /*ElementClient.g_GameCfgs*/;
if (!m_pTaskMan.InitStorageTask())
@@ -135,7 +139,7 @@ namespace BrewMonster.Network
m_ItemExtDesc = new BrewMonster.CECStringTab();
m_SkillDesc = new BrewMonster.CECStringTab();
m_BuffDesc = new BrewMonster.CECStringTab();
m_ItemExtProp = new BrewMonster.CECStringTab();
try
{
// Addressables-only loading (no StreamingAssets/configs file IO).
@@ -165,7 +169,11 @@ namespace BrewMonster.Network
{
Debug.LogWarning("[EC_Game] Failed to load skillstr.txt");
}
var itemExtPropTa = Addressables.LoadAssetAsync<TextAsset>("Assets/Addressable/item_ext_prop.txt").WaitForCompletion();
if (!m_ItemExtProp.InitFromTextAsset(itemExtPropTa, true))
{
Debug.LogWarning("[EC_Game] Failed to load item_ext_prop.txt");
}
// Note: There's no buff_desc.txt file in the configs folder
// You may need to create this file or use a different source for buff descriptions
// (If you add it to Addressables later, load it here.)
@@ -267,6 +275,30 @@ namespace BrewMonster.Network
long unixTime = DateTimeOffset.UtcNow.ToUnixTimeSeconds();
return (int)unixTime + m_iTimeError;
}
#region Dummy Methods for itemdataman
public static int addon_generate_arg(DATA_TYPE type, addon_data data, int arg_num/*ʼIJ*/)
{
return arg_num;
}
public static void get_item_guid(uint id, out int g1, out int g2)
{
g1 = 0;
g2 = 1;
}
public static int addon_update_ess_data(addon_data data, object essence,int ess_size, prerequisition require)
{
return 0;
}
public static void update_require_data(ref prerequisition require)
{
require.durability *= BrewMonster.Scripts.InventoryConst.ENDURANCE_SCALE;
require.max_durability *= BrewMonster.Scripts.InventoryConst.ENDURANCE_SCALE;
}
public static void set_to_classid(DATA_TYPE type, byte[] data, int major_type)
{
}
#endregion
////////////////////////////////////////////////////////////////////////////////
//
@@ -148,10 +148,29 @@ namespace BrewMonster
// Note: This would require GetMouseOnPateTextNPC implementation
// For now, we'll proceed with raycast
if (Physics.RaycastNonAlloc(ray, hits) > 0)
{
// Check if hit terrain, building, or forest (no CECObject component)
if (!hits[0].collider.gameObject.TryGetComponent<CECObject>(out CECObject clickedObject))
{
//Becauce of using RaycastNonAlloc, we need to sort hits by distance.
GameObject closestObject = null;
float closestDistance = float.MaxValue;
foreach (var hit in hits)
{
if(hit.collider == null)
{
continue;
}
if(hit.distance < closestDistance)
{
closestDistance = hit.distance;
closestObject = hit.collider.gameObject;
}
}
if(closestObject == null)
{
return;
}
// Check if hit terrain, building, or forest (no CECObject component)
if (!closestObject.TryGetComponent<CECObject>(out CECObject clickedObject))
{
//ENABLE LATER - CURRENT WORKING FINE
// Hit terrain / building / forest / Hit terrain
// if (m_pWorkMan.IsSitting())
@@ -293,7 +293,7 @@ namespace BrewMonster.Scripts.Managers
equipment.Count = itemData.m_iCount;
equipment.PriceScale = 1.0f;
equipment.ScaleType = 0;
// Parse item info if available (use Content field)
if (itemData.Content != null && itemData.Content.Length > 0)
{
@@ -856,7 +856,7 @@ namespace BrewMonster.Scripts.Managers
string fullDesc = null;
if (showEquipmentDetails && currentSelectedEquipment != null)
{
fullDesc = currentSelectedEquipment.GetNormalDesc();
fullDesc = currentSelectedEquipment.GetDesc();
}
else
{
@@ -0,0 +1,537 @@
// /*
// * FILE: EC_IvtrWeapon.cpp
// *
// * DESCRIPTION:
// *
// * CREATED BY: Duyuxin, 2004/11/19
// *
// * HISTORY:
// *
// * Copyright (c) 2004 Archosaur Studio, All Rights Reserved.
// */
// #include "EC_Global.h"
// #include "EC_IvtrWeapon.h"
// #include "EC_Game.h"
// #include "EC_FixedMsg.h"
// #include "EC_GameRun.h"
// #include "EC_HostPlayer.h"
// #include "EC_RTDebug.h"
// #include "elementdataman.h"
// #include "EC_Configs.h"
using BrewMonster;
using ModelRenderer.Scripts.GameData;
using System.Collections.Generic;
using BrewMonster.Network;
using BrewMonster.Scripts.Managers;
using BrewMonster.Scripts;
#region C# regions
// #define new A_DEBUG_NEW
// ///////////////////////////////////////////////////////////////////////////
// //
// // Define and Macro
// //
// ///////////////////////////////////////////////////////////////////////////
// ///////////////////////////////////////////////////////////////////////////
// //
// // Reference to External variables and functions
// //
// ///////////////////////////////////////////////////////////////////////////
// ///////////////////////////////////////////////////////////////////////////
// //
// // Local Types and Variables and Global variables
// //
// ///////////////////////////////////////////////////////////////////////////
// ///////////////////////////////////////////////////////////////////////////
// //
// // Local functions
// //
// ///////////////////////////////////////////////////////////////////////////
// ///////////////////////////////////////////////////////////////////////////
// //
// // Implement CECIvtrWeapon
// //
// ///////////////////////////////////////////////////////////////////////////
#endregion
namespace PerfectWorld.Scripts.Managers
{
public class EC_IvtrArmor : EC_IvtrEquip
{
//Attributes
//Weapon essence data
protected IVTR_ESSENCE_ARMOR m_Essence;
// data in database
protected ARMOR_MAJOR_TYPE m_pDBMajorType;
protected ARMOR_SUB_TYPE m_pDBSubType;
protected ARMOR_ESSENCE m_pDBEssence;
public EC_IvtrArmor(int tid, int expire_date) : base(tid, expire_date)
{
m_iCID = ICID_WEAPON;
elementdataman pDB = ElementDataManProvider.GetElementDataMan();
DATA_TYPE DataType = DATA_TYPE.DT_INVALID;
m_pDBEssence = (ARMOR_ESSENCE)pDB.get_data_ptr((uint)tid, ID_SPACE.ID_SPACE_ESSENCE, ref DataType);
m_pDBMajorType = (ARMOR_MAJOR_TYPE)pDB.get_data_ptr(m_pDBEssence.id_major_type, ID_SPACE.ID_SPACE_ESSENCE, ref DataType);
m_pDBSubType = (ARMOR_SUB_TYPE)pDB.get_data_ptr(m_pDBEssence.id_sub_type, 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_i64EquipMask = EC_IvtrEquip.ICID_WEAPON;
m_iProcType = (int)m_pDBEssence.proc_type;
FixProps = m_pDBEssence.fixed_props;
RepairFee = m_pDBEssence.repairfee;
ReputationReq = m_pDBEssence.require_reputation;
}
public EC_IvtrArmor(EC_IvtrArmor other) : base(other)
{
m_pDBEssence = other.m_pDBEssence;
m_pDBMajorType = other.m_pDBMajorType;
m_pDBSubType = other.m_pDBSubType;
m_Essence = other.m_Essence;
}
// CECIvtrWeapon::~CECIvtrWeapon()
// {
// }
public override bool SetItemInfo(byte[] pInfoData, int iDataLen)
{
base.SetItemInfo(pInfoData, iDataLen);
if(pInfoData == null || iDataLen == 0)
{
return true;
}
try
{
CECDataReader dr = new CECDataReader(pInfoData ,iDataLen);
// Skip equip requirements and endurance
dr.Offset(6 * sizeof(short), CECDataReader.SEEK_CUR);
dr.Offset(2 * sizeof(int), CECDataReader.SEEK_CUR);
int iEssenceSize = dr.ReadShort();
// Skip maker's information
dr.ReadByte();
int iMakerLen = dr.ReadByte();
dr.Offset(iMakerLen, CECDataReader.SEEK_CUR);
byte[] iEssenceData = dr.ReadData(iEssenceSize);
m_Essence = new IVTR_ESSENCE_ARMOR(iEssenceData);
// ˵
if(m_pDBEssence.fixed_props != 0 && m_pDBEssence.probability_addon_num0 != 1.0f)
{
// Get database data
elementdataman pDataMan = ElementDataManProvider.GetElementDataMan();
CECStringTab PropTab = EC_Game.GetItemExtProp();
int i, iSize = 0;
for(i=0;i<32;i++)
{
if(m_pDBEssence.addons[i].id_addon != 0)
iSize++;
}
if(iSize > 0 && Props.Count == 0)
{
Props.Capacity = iSize;
for(i=0;i<32;i++)
{
if(m_pDBEssence.addons[i].id_addon != 0)
{
Property Prop = new Property();
Prop.Type = (int)m_pDBEssence.addons[i].id_addon;
Prop.Embed = false;
Prop.Suite = false;
Prop.Engraved = false;
Prop.Local = false;
byte bType = PropTab.GetWideString(Prop.Type) != null ? (byte)0xff : (byte)0xff;
DATA_TYPE DataType = DATA_TYPE.DT_INVALID;
object pData = pDataMan.get_data_ptr(m_pDBEssence.addons[i].id_addon, ID_SPACE.ID_SPACE_ADDON, ref DataType);
if (DataType != DATA_TYPE.DT_EQUIPMENT_ADDON)
{
return false;
}
EQUIPMENT_ADDON pAddon = (EQUIPMENT_ADDON)pData;
Prop.NumParam = pAddon.num_params;
for(int j=0; j < Prop.NumParam; j++)
{
if(j==0)
{
Prop.Params[0] = pAddon.param1;
}
else if(j==1)
{
Prop.Params[1] = pAddon.param2;
}
else if(j==2)
{
Prop.Params[2] = pAddon.param3;
}
}
Props.Add(Prop);
}
}
}
}
return true;
}
catch ( System.Exception e)
{
return false;
}
}
// Get item default information from database
public override void DefaultInfo()
{
LevelReq = m_pDBEssence.require_level;
StrengthReq = m_pDBEssence.require_strength;
AgilityReq = m_pDBEssence.require_agility;
ReputationReq = m_pDBEssence.require_reputation;
CurEndurance = m_pDBEssence.durability_min * ENDURANCE_SCALE;
MaxEndurance = m_pDBEssence.durability_min * ENDURANCE_SCALE;
}
// 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 preview info
public override string GetPreviewInfo()
{
int[] aPEEVals = new int[MAX_PEEINDEX];
int[] aRefines = new int[MAX_REFINEINDEX];
for(int i=0; i<MAX_PEEINDEX; i++)
aPEEVals[i] = 0;
for(int i=0; i<MAX_REFINEINDEX; i++)
aRefines[i] = 0;
m_strDesc = "";
BuildAddOnPropDesc(aPEEVals, aRefines);
CECStringTab pDescTab = EC_Game.GetItemDesc();
// Physical defense
if (m_Essence.defense - aPEEVals[PEEI_PHYDEF] + aRefines[REFINE_PHYDEF] != 0)
{
AddDescText((int)DescriptipionMsg.ITEMDESC_COL_WHITE, false, EC_Game.GetItemDesc().GetWideString((int)DescriptipionMsg.ITEMDESC_PHYDEFENCE));
AddDescText((int)DescriptipionMsg.ITEMDESC_COL_WHITE, true, " %+d", m_Essence.defense - aPEEVals[PEEI_PHYDEF] + aRefines[REFINE_PHYDEF]);
}
// Dodge
if (m_Essence.armor - aPEEVals[PEEI_DODGE] + aRefines[REFINE_DODGE] != 0)
{
AddDescText((int)DescriptipionMsg.ITEMDESC_COL_WHITE, false, EC_Game.GetItemDesc().GetWideString((int)DescriptipionMsg.ITEMDESC_DODGE));
AddDescText((int)DescriptipionMsg.ITEMDESC_COL_WHITE, true, " %+d", m_Essence.armor - aPEEVals[PEEI_DODGE] + aRefines[REFINE_DODGE]);
}
// HP
if (m_Essence.hp_enhance - aPEEVals[PEEI_HP] + aRefines[REFINE_HP] != 0)
{
AddDescText((int)DescriptipionMsg.ITEMDESC_COL_WHITE, false, EC_Game.GetItemDesc().GetWideString((int)DescriptipionMsg.ITEMDESC_ADDHP));
}
// MP
if (m_Essence.mp_enhance - aPEEVals[PEEI_MP] != 0)
{
AddDescText((int)DescriptipionMsg.ITEMDESC_COL_WHITE, false, EC_Game.GetItemDesc().GetWideString((int)DescriptipionMsg.ITEMDESC_ADDMP));
AddDescText((int)DescriptipionMsg.ITEMDESC_COL_WHITE, true, " %+d", m_Essence.mp_enhance - aPEEVals[PEEI_MP]);
}
//Gold Resistance
if (m_Essence.resistance[0] - aPEEVals[PEEI_GOLDDEF] + aRefines[REFINE_GOLDDEF] != 0)
{
AddDescText((int)DescriptipionMsg.ITEMDESC_COL_WHITE, false, EC_Game.GetItemDesc().GetWideString((int)DescriptipionMsg.ITEMDESC_GOLDDEFENCE));
AddDescText((int)DescriptipionMsg.ITEMDESC_COL_WHITE, true, " %+d", m_Essence.resistance[0] - aPEEVals[PEEI_GOLDDEF] + aRefines[REFINE_GOLDDEF]);
}
//Wood Resistance
if (m_Essence.resistance[1] - aPEEVals[PEEI_WOODDEF] + aRefines[REFINE_WOODDEF] != 0)
{
AddDescText((int)DescriptipionMsg.ITEMDESC_COL_WHITE, false, EC_Game.GetItemDesc().GetWideString((int)DescriptipionMsg.ITEMDESC_WOODDEFENCE));
AddDescText((int)DescriptipionMsg.ITEMDESC_COL_WHITE, true, " %+d", m_Essence.resistance[1] - aPEEVals[PEEI_WOODDEF] + aRefines[REFINE_WOODDEF]);
}
//Water Resistance
if (m_Essence.resistance[2] - aPEEVals[PEEI_WATERDEF] + aRefines[REFINE_WATERDEF] != 0)
{
AddDescText((int)DescriptipionMsg.ITEMDESC_COL_WHITE, false, EC_Game.GetItemDesc().GetWideString((int)DescriptipionMsg.ITEMDESC_WATERDEFENCE));
AddDescText((int)DescriptipionMsg.ITEMDESC_COL_WHITE, true, " %+d", m_Essence.resistance[2] - aPEEVals[PEEI_WATERDEF] + aRefines[REFINE_WATERDEF]);
}
//Fire Resistance
if (m_Essence.resistance[3] - aPEEVals[PEEI_FIREDEF] + aRefines[REFINE_FIREDEF] != 0)
{
AddDescText((int)DescriptipionMsg.ITEMDESC_COL_WHITE, false, EC_Game.GetItemDesc().GetWideString((int)DescriptipionMsg.ITEMDESC_FIREDEFENCE));
AddDescText((int)DescriptipionMsg.ITEMDESC_COL_WHITE, true, " %+d", m_Essence.resistance[3] - aPEEVals[PEEI_FIREDEF] + aRefines[REFINE_FIREDEF]);
}
//Earth Resistance
if (m_Essence.resistance[4] - aPEEVals[PEEI_EARTHDEF] + aRefines[REFINE_EARTHDEF] != 0)
{
AddDescText((int)DescriptipionMsg.ITEMDESC_COL_WHITE, false, EC_Game.GetItemDesc().GetWideString((int)DescriptipionMsg.ITEMDESC_EARTHDEFENCE));
AddDescText((int)DescriptipionMsg.ITEMDESC_COL_WHITE, true, " %+d", m_Essence.resistance[4] - aPEEVals[PEEI_EARTHDEF] + aRefines[REFINE_EARTHDEF]);
}
return m_strDesc;
}
public override bool GetRefineEffectFor(string strEffect, RefineEffect rhs){
strEffect = "";
if (!m_bNeedUpdate){
switch (rhs.RefineIndex){
case REFINE_PHYDEF:
strEffect = string.Format("{0}{1} {2}(+{3})",
rhs.GetClrAttribute(),
EC_Game.GetItemDesc().GetWideString((int)DescriptipionMsg.ITEMDESC_PHYDEFENCE),
m_Essence.defense - rhs.APEEVals[PEEI_PHYDEF] + rhs.ARefines[REFINE_PHYDEF] + rhs.GetIncEffect(),
rhs.GetClrEffect(),
rhs.GetIncEffect());
break;
case REFINE_DODGE:
strEffect = string.Format("{0}{1} {2}(+{3})",
rhs.GetClrAttribute(),
EC_Game.GetItemDesc().GetWideString((int)DescriptipionMsg.ITEMDESC_DODGE),
m_Essence.armor - rhs.APEEVals[PEEI_DODGE] + rhs.ARefines[REFINE_DODGE] + rhs.GetIncEffect(),
rhs.GetClrEffect(),
rhs.GetIncEffect());
break;
case REFINE_HP:
strEffect = string.Format("{0}{1} {2}(+{3})",
rhs.GetClrAttribute(),
EC_Game.GetItemDesc().GetWideString((int)DescriptipionMsg.ITEMDESC_ADDHP),
m_Essence.hp_enhance - rhs.APEEVals[PEEI_HP] + rhs.ARefines[REFINE_HP] + rhs.GetIncEffect(),
rhs.GetClrEffect(),
rhs.GetIncEffect());
break;
case REFINE_GOLDDEF:
strEffect = string.Format("{0}{1} {2}(+{3})",
rhs.GetClrAttribute(),
EC_Game.GetItemDesc().GetWideString((int)DescriptipionMsg.ITEMDESC_GOLDDEFENCE),
m_Essence.resistance[0] - rhs.APEEVals[PEEI_GOLDDEF] + rhs.ARefines[REFINE_GOLDDEF] + rhs.GetIncEffect(),
rhs.GetClrEffect(),
rhs.GetIncEffect());
break;
case REFINE_WOODDEF:
strEffect = string.Format("{0}{1} {2}(+{3})",
rhs.GetClrAttribute(),
EC_Game.GetItemDesc().GetWideString((int)DescriptipionMsg.ITEMDESC_WOODDEFENCE),
m_Essence.resistance[1] - rhs.APEEVals[PEEI_WOODDEF] + rhs.ARefines[REFINE_WOODDEF] + rhs.GetIncEffect(),
rhs.GetClrEffect(),
rhs.GetIncEffect());
break;
case REFINE_WATERDEF:
strEffect = string.Format("{0}{1} {2}(+{3})",
rhs.GetClrAttribute(),
EC_Game.GetItemDesc().GetWideString((int)DescriptipionMsg.ITEMDESC_WATERDEFENCE),
m_Essence.resistance[2] - rhs.APEEVals[PEEI_WATERDEF] + rhs.ARefines[REFINE_WATERDEF] + rhs.GetIncEffect(),
rhs.GetClrEffect(),
rhs.GetIncEffect());
break;
case REFINE_FIREDEF:
strEffect = string.Format("{0}{1} {2}(+{3})",
rhs.GetClrAttribute(),
EC_Game.GetItemDesc().GetWideString((int)DescriptipionMsg.ITEMDESC_FIREDEFENCE),
m_Essence.resistance[3] - rhs.APEEVals[PEEI_FIREDEF] + rhs.ARefines[REFINE_FIREDEF] + rhs.GetIncEffect(),
rhs.GetClrEffect(),
rhs.GetIncEffect());
break;
case REFINE_EARTHDEF:
strEffect = string.Format("{0}{1} {2}(+{3})",
rhs.GetClrAttribute(),
EC_Game.GetItemDesc().GetWideString((int)DescriptipionMsg.ITEMDESC_EARTHDEFENCE),
m_Essence.resistance[4] - rhs.APEEVals[PEEI_EARTHDEF] + rhs.ARefines[REFINE_EARTHDEF] + rhs.GetIncEffect(),
rhs.GetClrEffect(),
rhs.GetIncEffect());
break;
}
}
return !string.IsNullOrEmpty(strEffect);
}
// Get item description text
protected override string GetNormalDesc(bool bRepair){
if (m_bNeedUpdate)
return null;
int[] aPEEVals = new int[MAX_PEEINDEX];
int[] aRefines = new int[MAX_REFINEINDEX];
for(int i=0; i<MAX_PEEINDEX; i++)
aPEEVals[i] = 0;
for(int i=0; i<MAX_REFINEINDEX; i++)
aRefines[i] = 0;
m_strDesc = "";
BuildAddOnPropDesc(aPEEVals, aRefines);
string strAddon = m_strDesc;
m_strDesc = "";
CECStringTab pDescTab = EC_Game.GetItemDesc();
CECHostPlayer pHost = EC_Game.GetGameRun().GetHostPlayer();
int white = (int)DescriptipionMsg.ITEMDESC_COL_WHITE;
int lblue = (int)DescriptipionMsg.ITEMDESC_COL_LIGHTBLUE;
int red = (int)DescriptipionMsg.ITEMDESC_COL_RED;
int namecol = DecideNameCol();
uint dwPEE = PropEffectEssence();
if (Holes != null && Holes.Count > 0)
{
AddDescText(namecol, false, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_NAMESOCKET), GetName(), Holes.Count);
}
else
{
AddDescText(namecol, false, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_NAME), GetName());
}
// Refine level
if (RefineLvl > 0)
AddDescText(-1, true, "{0} +{1}", pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_LEVEL), RefineLvl);
else
m_strDesc += "\\r";
AddIDDescText();
AddBindDescText();
// Is destroying?
AddDestroyingDesc((int)m_pDBEssence.id_drop_after_damaged, m_pDBEssence.num_drop_after_damaged);
AddExpireTimeDesc();
// Sub class name
AddDescText(white, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_CLASSNAME), m_pDBSubType.name.ToString());
// Weapon level
AddDescText(-1, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_LEVEL), m_pDBEssence.level);
// Physical defence
if (m_Essence.defense - aPEEVals[PEEI_PHYDEF] + aRefines[REFINE_PHYDEF] != 0)
{
AddDescText(white, false, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_PHYDEFENCE));
AddDescText(white, true, " +{0}", m_Essence.defense - aPEEVals[PEEI_PHYDEF] + aRefines[REFINE_PHYDEF]);
}
// Dodge
if (m_Essence.armor - aPEEVals[PEEI_DODGE] + aRefines[REFINE_DODGE] != 0)
{
AddDescText(white, false, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_DODGE));
AddDescText(white, true, " +{0}", m_Essence.armor - aPEEVals[PEEI_DODGE] + aRefines[REFINE_DODGE]);
}
// HP
if (m_Essence.hp_enhance - aPEEVals[PEEI_HP] + aRefines[REFINE_HP] != 0)
{
AddDescText(white, false, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_ADDHP));
AddDescText(white, true, " +{0}", m_Essence.hp_enhance - aPEEVals[PEEI_HP] + aRefines[REFINE_HP]);
}
// MP
if (m_Essence.mp_enhance - aPEEVals[PEEI_MP] != 0)
{
AddDescText(white, false, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_ADDMP));
AddDescText(white, true, " +{0}", m_Essence.mp_enhance - aPEEVals[PEEI_MP]);
}
// Gold Resistance
if (m_Essence.resistance[0] - aPEEVals[PEEI_GOLDDEF] + aRefines[REFINE_GOLDDEF] != 0)
{
AddDescText(white, false, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_GOLDDEFENCE));
AddDescText(white, true, " +{0}", m_Essence.resistance[0] - aPEEVals[PEEI_GOLDDEF] + aRefines[REFINE_GOLDDEF]);
}
// Wood Resistance
if (m_Essence.resistance[1] - aPEEVals[PEEI_WOODDEF] + aRefines[REFINE_WOODDEF] != 0)
{
AddDescText(white, false, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_WOODDEFENCE));
AddDescText(white, true, " +{0}", m_Essence.resistance[1] - aPEEVals[PEEI_WOODDEF] + aRefines[REFINE_WOODDEF]);
}
// Water Resistance
if (m_Essence.resistance[2] - aPEEVals[PEEI_WATERDEF] + aRefines[REFINE_WATERDEF] != 0)
{
AddDescText(white, false, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_WATERDEFENCE));
AddDescText(white, true, " +{0}", m_Essence.resistance[2] - aPEEVals[PEEI_WATERDEF] + aRefines[REFINE_WATERDEF]);
}
// Fire Resistance
if (m_Essence.resistance[3] - aPEEVals[PEEI_FIREDEF] + aRefines[REFINE_FIREDEF] != 0)
{
AddDescText(white, false, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_FIREDEFENCE));
AddDescText(white, true, " +{0}", m_Essence.resistance[3] - aPEEVals[PEEI_FIREDEF] + aRefines[REFINE_FIREDEF]);
}
// Earth Resistance
if (m_Essence.resistance[4] - aPEEVals[PEEI_EARTHDEF] + aRefines[REFINE_EARTHDEF] != 0)
{
AddDescText(white, false, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_EARTHDEFENCE));
AddDescText(white, true, " +{0}", m_Essence.resistance[4] - aPEEVals[PEEI_EARTHDEF] + aRefines[REFINE_EARTHDEF]);
}
// Endurance
int col = white;
if (CurEndurance == 0)
col = red;
else if ((dwPEE & PEE_ENDURANCE) != 0)
col = lblue;
AddDescText(col, false, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_ENDURANCE));
AddDescText(col, true, " {0}/{1}", VisualizeEndurance(CurEndurance), VisualizeEndurance(MaxEndurance));
// Profession requirement
AddProfReqDesc((uint)ProfReq);
// Level requirment
if (LevelReq != 0)
{
col = pHost.GetMaxLevelSofar() >= LevelReq ? white : red;
AddDescText(col, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_LEVELREQ), LevelReq);
}
// Strength requirment
if (StrengthReq != 0)
{
col = pHost.GetExtendProps().bs.strength < StrengthReq ? red : ((dwPEE & PEE_STRENGTHREQ) != 0 ? lblue : white);
AddDescText(col, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_STRENGTHREQ), StrengthReq);
}
// Agility requirment
if (AgilityReq != 0)
{
col = pHost.GetExtendProps().bs.agility < AgilityReq ? red : ((dwPEE & PEE_AGILITYREQ) != 0 ? lblue : white);
AddDescText(col, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_AGILITYREQ), AgilityReq);
}
// Vitality requirment
if (VitalityReq != 0)
{
col = pHost.GetExtendProps().bs.vitality < VitalityReq ? red : ((dwPEE & PEE_VITALITYREQ) != 0 ? lblue : white);
AddDescText(col, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_VITALITYREQ), VitalityReq);
}
// Energy requirment
if (EnergyReq != 0)
{
col = pHost.GetExtendProps().bs.energy < EnergyReq ? red : ((dwPEE & PEE_ENERGYREQ) != 0 ? lblue : white);
AddDescText(col, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_ENERGYREQ), EnergyReq);
}
// Reputation requirement
AddReputationReqDesc();
// Add addon properties
if (!string.IsNullOrEmpty(strAddon))
m_strDesc += strAddon;
// Build tessera description
BuildTesseraDesc();
if(m_pDBEssence.fixed_props == 0 && m_bIsInNPCPack)
AddDescText((int)DescriptipionMsg.ITEMDESC_COL2_BRIGHTBLUE, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_HASRANDOM_PROP));
// Price
AddPriceDesc(white, bRepair);
AddSharpenerDesc();
AddEngravedDesc();
AddMakerDesc();
AddSuiteDesc();
AddExtDescText();
return m_strDesc;
}
// // Does this equipment has random property ?
public bool HasRandomProp()
{
for (int i = 0; i < Props.Count; i++)
{
if (!Props[i].Embed && !Props[i].Engraved && Props[i].Type == 472)
return true;
}
return false;
}
public int GetRefineMaterialNum()
{
return m_pDBEssence.material_need;
}
public override uint GetRefineAddOn()
{
return (uint)m_pDBEssence.levelup_addon;
}
public override string GetDropModel()
{
return m_pDBEssence.FileMatter;
}
public override bool IsRare()
{
return base.IsRare() || m_pDBEssence.level >= 6;
}
public override int GetItemLevel()
{
return m_pDBEssence.level;
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: c94b2c779cdb94d398d4aa10eb44cac6
@@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.AddressableAssets;
using ModelRenderer.Scripts.GameData;
using ModelRenderer.Scripts.Common;
using BrewMonster;
@@ -30,9 +31,15 @@ namespace PerfectWorld.Scripts.Managers
public const int ICID_WEAPON = 2;
// Item Made From Types
public const byte IMT_NULL = 0;
public const byte IMT_SIGN = 1;
public enum ITEM_MAKE_TAG
{
IMT_NULL,
IMT_CREATE, // GM
IMT_DROP, //
IMT_SHOP, // ̳ǻ̵
IMT_PRODUCE, //
IMT_SIGN, // װǩ
};
// Property Effect Essence Flags
public const uint PEE_PHYDAMAGE = 0x00000001;
public const uint PEE_MAGICDAMAGE = 0x00000002;
@@ -97,7 +104,7 @@ namespace PerfectWorld.Scripts.Managers
#endregion
#region Fields
#region Public Fields
// Basic Item Properties
public int TemplateId { get; set; }
@@ -136,11 +143,9 @@ namespace PerfectWorld.Scripts.Managers
// Equipment Arrays
public List<int> Holes { get; set; }
public List<Property> Props { get; set; }
// Description
protected string m_strDesc = "";
#endregion
#region Base Stats (from Element Data)
@@ -497,7 +502,7 @@ namespace PerfectWorld.Scripts.Managers
#region Constructor
public EC_IvtrEquip(int tid, int expireDate)
public EC_IvtrEquip(int tid, int expireDate) : base(tid, expireDate)
{
TemplateId = tid;
ExpireDate = expireDate;
@@ -568,8 +573,9 @@ namespace PerfectWorld.Scripts.Managers
/// <summary>
/// Set item detail information from binary data
/// </summary>
public bool SetItemInfo(byte[] infoData, int dataLen)
public override bool SetItemInfo(byte[] infoData, int dataLen)
{
base.SetItemInfo(infoData, dataLen);
if (infoData == null || dataLen == 0)
return true;
@@ -577,6 +583,7 @@ namespace PerfectWorld.Scripts.Managers
// [6 x short requirements][2 x int endurance][short essenceSize][maker info][essence bytes][short numHole][WORD stoneMask][numHole x int holes][int numProp][props]
if (TryParseEquipInfoNative(infoData, dataLen))
{
BMLogger.Log("CECIvtrEquip::SetItemInfo, native order success");
ParseProperties();
return true;
}
@@ -584,11 +591,11 @@ namespace PerfectWorld.Scripts.Managers
// Fallback to legacy/custom order if server payload differs
if (TryParseEquipInfoLegacy(infoData, dataLen))
{
BMLogger.Log("CECIvtrEquip::SetItemInfo, legacy order success");
ParseProperties();
return true;
}
Debug.LogError("EC_IvtrEquip::SetItemInfo: could not parse detail payload");
return false;
}
@@ -596,62 +603,50 @@ namespace PerfectWorld.Scripts.Managers
{
try
{
int offset = 0;
if (len < 6 * 2 + 2 * 4 + 2) return false;
LevelReq = BitConverter.ToInt16(data, offset); offset += 2;
ProfReq = BitConverter.ToInt16(data, offset); offset += 2;
StrengthReq= BitConverter.ToInt16(data, offset); offset += 2;
VitalityReq= BitConverter.ToInt16(data, offset); offset += 2;
AgilityReq = BitConverter.ToInt16(data, offset); offset += 2;
EnergyReq = BitConverter.ToInt16(data, offset); offset += 2;
CurEndurance = BitConverter.ToInt32(data, offset); offset += 4;
MaxEndurance = BitConverter.ToInt32(data, offset); offset += 4;
int essenceSize = BitConverter.ToInt16(data, offset); offset += 2;
// Maker info (type + length + payload)
if (offset + 2 <= len)
CECDataReader dr = new CECDataReader(data, len);
LevelReq = dr.ReadShort();
ProfReq = dr.ReadShort();
StrengthReq= dr.ReadShort();
VitalityReq= dr.ReadShort();
AgilityReq = dr.ReadShort();
EnergyReq = dr.ReadShort();
CurEndurance = dr.ReadInt();
MaxEndurance = dr.ReadInt();
int essenceSize = dr.ReadShort();
ReadMakerInfo(dr);
dr.Offset(essenceSize, CECDataReader.SEEK_CUR);
if(essenceSize < 0 )
{
ReadMakerInfo(data, ref offset);
throw new Exception("TYPE_DATAERR");
}
if (essenceSize < 0 || offset + essenceSize > len) return false;
offset += essenceSize; // skip essence for now
if (offset + 2 + 2 > len) return false;
int numHole = BitConverter.ToInt16(data, offset); offset += 2;
StoneMask = BitConverter.ToUInt16(data, offset); offset += 2;
Holes.Clear();
int numHole = dr.ReadShort();
StoneMask = (ushort)dr.ReadShort();
if (numHole > 0)
{
if (offset + 4 * numHole > len) return false;
Holes.Clear();
Holes.Capacity = numHole;
for (int i = 0; i < numHole; i++)
{
Holes.Add(BitConverter.ToInt32(data, offset)); offset += 4;
Holes.Add(dr.ReadInt());
}
}
else if (numHole < 0)
else if (numHole == 0)
{
return false;
Holes.Clear();
}
if (offset + 4 > len) return false;
int numProp = BitConverter.ToInt32(data, offset); offset += 4;
Props.Clear();
else
{
throw new Exception("TYPE_DATAERR");
}
int numProp = dr.ReadInt();
if (numProp > 0)
{
Props.Clear();
Props.Capacity = numProp;
for (int i = 0; i < numProp; i++)
{
if (offset + 4 > len) return false;
int type = BitConverter.ToInt32(data, offset); offset += 4;
int type = dr.ReadInt();
Property prop = new Property();
prop.Type = type & 0x1fff;
prop.NumParam = (type & 0x6000) >> 13;
@@ -662,15 +657,18 @@ namespace PerfectWorld.Scripts.Managers
for (int j = 0; j < prop.NumParam; j++)
{
if (offset + 4 > len) return false;
prop.Params[j] = BitConverter.ToInt32(data, offset); offset += 4;
prop.Params[j] = dr.ReadInt();
}
Props.Add(prop);
}
}
else if (numProp < 0)
else if (numProp == 0)
{
return false;
Props.Clear();
}
else
{
throw new Exception("TYPE_DATAERR");
}
// Sanity check to catch misalignment
@@ -679,7 +677,10 @@ namespace PerfectWorld.Scripts.Managers
return true;
}
catch { return false; }
catch (System.Exception ex) {
BMLogger.LogError("CECIvtrEquip::SetItemInfo, data read error (" + ex.GetType() + ")" + ex.StackTrace);
return false;
}
}
private bool TryParseEquipInfoLegacy(byte[] data, int len)
@@ -706,7 +707,7 @@ namespace PerfectWorld.Scripts.Managers
MaxEndurance = BitConverter.ToInt32(data, offset); offset += 4;
int essenceSize = BitConverter.ToInt16(data, offset); offset += 2;
ReadMakerInfo(data, ref offset);
//ReadMakerInfo(data, ref offset);
if (essenceSize < 0 || offset + essenceSize > len) return false;
offset += essenceSize;
@@ -752,33 +753,55 @@ namespace PerfectWorld.Scripts.Managers
/// <summary>
/// Read maker information from binary data
/// </summary>
private void ReadMakerInfo(byte[] data, ref int offset)
private void ReadMakerInfo(CECDataReader dr)
{
MadeFrom = data[offset++];
int makerLen = data[offset++];
// Debug: Log the bytes at current position before reading
// We need to check what bytes are actually at the reader position
MadeFrom = dr.ReadByte();
int makerLen = dr.ReadByte();
if (makerLen > 0)
{
if (MadeFrom == IMT_SIGN)
if (MadeFrom == (byte)ITEM_MAKE_TAG.IMT_SIGN)
{
ushort color = BitConverter.ToUInt16(data, offset); offset += 2;
makerLen -= 2;
string maker = System.Text.Encoding.Unicode.GetString(data, offset, makerLen);
offset += makerLen;
ushort color = (ushort)dr.ReadShort();
makerLen -= sizeof(ushort);
byte[] makerData = dr.ReadData(makerLen);
// Find null terminator (0x00 0x00 for Unicode) and decode only up to that point
int actualLength = makerLen;
for (int i = 0; i < makerLen - 1; i += 2)
{
if (makerData[i] == 0 && makerData[i + 1] == 0)
{
actualLength = i;
break;
}
}
string maker = System.Text.Encoding.Unicode.GetString(makerData, 0, actualLength).TrimEnd('\0');
if (string.IsNullOrEmpty(maker))
{
Debug.LogWarning($"EC_IvtrEquip::ReadMakerInfo: Invalid maker info with makerLen={makerLen + 2}");
return;
}
SetNewMark(maker, ColorFromWord(color));
//#define FASHION_WORDCOLOR_TO_A3DCOLOR(c) A3DCOLORRGB(((c) & (0x1f << 10)) >> 7, ((c) & (0x1f << 5)) >> 2, ((c) & 0x1f) << 3)
//A3DCOLOR clr = FASHION_WORDCOLOR_TO_A3DCOLOR(color);
Color clr = ColorFromWord(color);
SetNewMark(maker, clr);
}
else
{
Maker = System.Text.Encoding.Unicode.GetString(data, offset, makerLen);
offset += makerLen;
//m_strMaker = ACString((ACHAR*)dr.Read_Data(iMakerLen), iMakerLen / sizeof (ACHAR));
byte[] makerData = dr.ReadData(makerLen);
// Find null terminator (0x00 0x00 for Unicode) and decode only up to that point
int actualLength = makerLen;
for (int i = 0; i < makerLen - 1; i += 2)
{
if (makerData[i] == 0 && makerData[i + 1] == 0)
{
actualLength = i;
break;
}
}
Maker = System.Text.Encoding.Unicode.GetString(makerData, 0, actualLength).TrimEnd('\0');
}
}
else
@@ -809,7 +832,7 @@ namespace PerfectWorld.Scripts.Managers
// Add equipment mark display string
Maker = string.Format(GetItemDescString(DescriptipionMsg.ITEMDESC_EQUIPMARK), Maker);
}
MadeFrom = string.IsNullOrEmpty(mark) ? IMT_NULL : IMT_SIGN;
MadeFrom = string.IsNullOrEmpty(mark) ? (byte)ITEM_MAKE_TAG.IMT_NULL : (byte)ITEM_MAKE_TAG.IMT_SIGN;
}
#endregion
@@ -819,7 +842,7 @@ namespace PerfectWorld.Scripts.Managers
/// <summary>
/// Get item name
/// </summary>
public string GetName()
public virtual string GetName()
{
return EC_IvtrItemUtils.Instance.ResolveItemName(TemplateId);
}
@@ -929,7 +952,7 @@ namespace PerfectWorld.Scripts.Managers
/// <summary>
/// Check if item is rare
/// </summary>
public bool IsRare()
public virtual bool IsRare()
{
return RefineLvl >= 3;
}
@@ -1320,7 +1343,7 @@ namespace PerfectWorld.Scripts.Managers
/// Get normal in-inventory description, mirroring C++ CECIvtrEquip::GetNormalDesc.
/// This is a single formatted string using ^color codes and '\\r' as line separators.
/// </summary>
public string GetNormalDesc()
protected override string GetNormalDesc(bool bRepair)
{
// Build addon and refine properties and save it (like C++ does first)
int[] aPEEVals = new int[MAX_PEEINDEX];
@@ -2016,7 +2039,7 @@ namespace PerfectWorld.Scripts.Managers
{
return 0;
}
/// <summary>
/// Check the special refine property
/// </summary>
@@ -2104,7 +2127,6 @@ namespace PerfectWorld.Scripts.Managers
RefineLvl = 0;
PropNum = 0;
EmbedNum = 0;
if (Props.Count == 0)
return;
@@ -2246,7 +2268,7 @@ namespace PerfectWorld.Scripts.Managers
/// <summary>
/// Add description text
/// </summary>
private void AddDescText(int color, bool newLine, string format, params object[] args)
protected override void AddDescText(int color, bool newLine, string format, params object[] args)
{
if (color >= 0)
{
@@ -2605,40 +2627,40 @@ namespace PerfectWorld.Scripts.Managers
if (!IsSharpenerProperty(propType))
{
switch (propType)
{
{
case 0: //
if(!local)
{
if (aPEEVals != null)
aPEEVals[PEEI_PHYDAMAGE] += p0;
}
AddDescText(color, false, GetItemDescString(DescriptipionMsg.ITEMDESC_ADDPHYDAMAGE));
AddDescText(color, true, " %+d", p0);
break;
if(!local)
{
if (aPEEVals != null)
aPEEVals[PEEI_PHYDAMAGE] += p0;
}
AddDescText(color, false, GetItemDescString(DescriptipionMsg.ITEMDESC_ADDPHYDAMAGE));
AddDescText(color, true, " %+d", p0);
break;
case 1: //
if(local)
{
if(p0 != p1)
{
AddDescText(color, false, GetItemDescString(DescriptipionMsg.ITEMDESC_MAXPHYDAMAGE), p0);
AddDescText(color, true, "~%d", p1);
}
else
{
AddDescText(color, true, GetItemDescString(DescriptipionMsg.ITEMDESC_MAXPHYDAMAGE), p0);
}
}
else
{
if (aPEEVals != null)
aPEEVals[PEEI_MAX_PHYDAMAGE] += p0;
AddDescText(color, true, GetItemDescString(DescriptipionMsg.ITEMDESC_MAXPHYDAMAGE), p0);
}
if(local)
{
if(p0 != p1)
{
AddDescText(color, false, GetItemDescString(DescriptipionMsg.ITEMDESC_MAXPHYDAMAGE), p0);
AddDescText(color, true, "~%d", p1);
}
else
{
AddDescText(color, true, GetItemDescString(DescriptipionMsg.ITEMDESC_MAXPHYDAMAGE), p0);
}
}
else
{
if (aPEEVals != null)
aPEEVals[PEEI_MAX_PHYDAMAGE] += p0;
AddDescText(color, true, GetItemDescString(DescriptipionMsg.ITEMDESC_MAXPHYDAMAGE), p0);
}
break;
case 2: // (%)
@@ -4044,21 +4066,19 @@ namespace PerfectWorld.Scripts.Managers
/// <summary>
/// Build add-ons properties description
/// </summary>
private void BuildAddOnPropDesc(int[] aPEEVals, int[] aRefines)
protected void BuildAddOnPropDesc(int[] aPEEVals, int[] aRefines)
{
if (Props.Count == 0)
return;
// Change color
m_strDesc += GetColorString(DescriptipionMsg.ITEMDESC_COL_LIGHTBLUE);
foreach (Property prop in Props)
{
// Properties added by Embedded stone will be printed by BuildTesseraDesc() later
// Ignore suite properties also
if (prop.Embed || prop.Suite || prop.Engraved)
continue;
AddOneAddOnPropDesc(prop.Type, prop.Params, aPEEVals, aRefines, prop.Local);
}
}
@@ -4069,7 +4089,6 @@ namespace PerfectWorld.Scripts.Managers
public int GetSoulPowerAdded()
{
int added = 0;
int propertyCount = Props.Count;
foreach (Property prop in Props)
{
@@ -4089,7 +4108,7 @@ namespace PerfectWorld.Scripts.Managers
/// <summary>
/// Build tessera description (socketed gems/stones)
/// </summary>
private void BuildTesseraDesc()
protected void BuildTesseraDesc()
{
if (Holes.Count == 0)
return;
@@ -4118,7 +4137,7 @@ namespace PerfectWorld.Scripts.Managers
/// <summary>
/// Add suite description
/// </summary>
private void AddSuiteDesc()
protected void AddSuiteDesc()
{
int idSuite = GetSuiteID();
if (idSuite == 0)
@@ -4225,7 +4244,7 @@ namespace PerfectWorld.Scripts.Managers
/// <summary>
/// Add reputation requirement description
/// </summary>
private void AddReputationReqDesc()
protected void AddReputationReqDesc()
{
if (ReputationReq == 0)
return;
@@ -4258,7 +4277,7 @@ namespace PerfectWorld.Scripts.Managers
/// <summary>
/// Add sharpener description (磨刀石 properties)
/// </summary>
private void AddSharpenerDesc()
protected void AddSharpenerDesc()
{
if (Props.Count == 0)
return;
@@ -4437,7 +4456,7 @@ namespace PerfectWorld.Scripts.Managers
/// Append engraved property descriptions to the current description buffer.
/// Mirrors the behaviour of the original C++ AddEngravedDesc.
/// </summary>
private void AddEngravedDesc()
protected void AddEngravedDesc()
{
if (Props.Count == 0)
return;
@@ -4469,26 +4488,31 @@ namespace PerfectWorld.Scripts.Managers
/// <summary>
/// Append maker description (signature / crafted by) to the description buffer.
/// </summary>
private void AddMakerDesc()
protected void AddMakerDesc()
{
if (string.IsNullOrEmpty(Maker))
return;
BMLogger.Log("[THN]EC_IvtrEquip: AddMakerDesc: Maker: " + Maker);
m_strDesc += "\\r";
// For signed marks (IMT_SIGN), Maker already contains color codes and formatted text.
if (MadeFrom == IMT_SIGN)
if (MadeFrom == (byte)ITEM_MAKE_TAG.IMT_SIGN)
{
BMLogger.Log("[THN]EC_IvtrEquip: AddMakerDesc IF: Maker: " + Maker);
m_strDesc += Maker;
}
else
{
BMLogger.Log("[THN]EC_IvtrEquip: AddMakerDesc ELSE: Maker: " + Maker);
// Normal "made by" line using item-desc string if available
string fmt = GetItemDescString(DescriptipionMsg.ITEMDESC_MADEFROM);
if (string.IsNullOrEmpty(fmt))
{
fmt = "Made by {0}";
}
BMLogger.Log("[THN]EC_IvtrEquip: AddMakerDesc ELSE: fmt: " + fmt);
AddDescText((int)DescriptipionMsg.ITEMDESC_COL_GREEN, false, fmt, Maker);
BMLogger.Log("[THN]EC_IvtrEquip: AddMakerDesc ELSE: m_strDesc: " + m_strDesc);
}
}
@@ -4557,7 +4581,7 @@ namespace PerfectWorld.Scripts.Managers
/// <summary>
/// Get preview info
/// </summary>
public string GetPreviewInfo()
public virtual string GetPreviewInfo()
{
m_strDesc = "";
BuildAddOnPropDesc(null, null);
@@ -4620,7 +4644,60 @@ namespace PerfectWorld.Scripts.Managers
return m_strDesc;
}
public struct RefineEffect
{
int m_refineIndex;
public int RefineIndex{ get { return m_refineIndex; } set { m_refineIndex = value; } }
int m_incEffect;
public int IncEffect{ get { return m_incEffect; } set { m_incEffect = value; } }
int[] m_aPEEVals;
public int[] APEEVals{ get { return m_aPEEVals; } set { m_aPEEVals = value; } }
int[] m_aRefines;
public int[] ARefines{ get { return m_aRefines; } set { m_aRefines = value; } }
string m_clrAttribute;
public string ClrAttribute{ get { return m_clrAttribute; } set { m_clrAttribute = value; } }
string m_clrEffect;
public string ClrEffect{ get { return m_clrEffect; } set { m_clrEffect = value; } }
public RefineEffect(int[] aPEEVals, int[] aRefines, string clrAttribute, string clrEffect)
{
m_refineIndex = -1;
m_incEffect = 0;
m_aPEEVals = aPEEVals;
m_aRefines = aRefines;
m_clrAttribute = clrAttribute;
m_clrEffect = clrEffect;
}
public void Set(int refineIndex, int incEffect){
m_refineIndex = refineIndex;
m_incEffect = incEffect;
}
public int GetIncEffect(){
return m_incEffect;
}
public string GetClrAttribute(){
return m_clrAttribute;
}
public string GetClrEffect(){
return m_clrEffect;
}
};
public virtual bool GetRefineEffectFor(string strEffect, RefineEffect rhs){ return false; }
public static int CalcRefineEffect(int refineLevel, int baseEffect)
{
const int MAX_REFINE_LEVEL = 12;
float[] refine_factor = new float[MAX_REFINE_LEVEL + 1]
{ 0, 1.0f, 2.0f, 3.05f, 4.3f, 5.75f, 7.55f, 9.95f, 13f, 17.05f, 22.3f, 29f, 37.5f };
if (refineLevel >= 0 && refineLevel <= MAX_REFINE_LEVEL){
return (int)(baseEffect * refine_factor[refineLevel] + 0.1f);
}
return 0;
}
#endregion
}
@@ -707,7 +707,7 @@ namespace BrewMonster.Scripts.Managers
public bool m_bNeedUpdate; // true, detail data needs to be updated
public bool m_bUpdating; // true, being updating detail data
public uint m_dwUptTime; // Time when updating request was sent (ms)
public string m_strDesc; // Item description
public string m_strDesc = ""; // Item description
public bool m_bIsInNPCPack; // true, this item is in NPC package
public bool m_bLocalDetailData; // true, data from GetDetailDataFromLocal
@@ -812,6 +812,20 @@ namespace BrewMonster.Scripts.Managers
public static EC_IvtrItem CreateItem(int tid, int expire_date, int iCount, int idSpace = 0)
{
var pItem = new EC_IvtrItem(tid, expire_date);
DATA_TYPE DataType = DATA_TYPE.DT_INVALID;
object data = ElementDataManProvider.GetElementDataMan().get_data_ptr((uint)tid, ID_SPACE.ID_SPACE_ESSENCE, ref DataType);
switch(DataType)
{
case DATA_TYPE.DT_WEAPON_ESSENCE:
pItem = new EC_IvtrWeapon(tid, expire_date);
break;
case DATA_TYPE.DT_ARMOR_ESSENCE:
pItem = new EC_IvtrArmor(tid, expire_date);
break;
default:
BMLogger.Log("[THN]EC_IvtrItem: CreateItem: Default Item: tid: " + tid + ", expire_date: " + expire_date + ", pItem: " + pItem.GetName());
break;
}
pItem.SetCount(iCount);
return pItem;
}
@@ -1154,10 +1168,20 @@ namespace BrewMonster.Scripts.Managers
// m_dwUptTime could be set from a game time provider when available.
}
public void GetDetailDataFromLocal()
public virtual void GetDetailDataFromLocal()
{
// Placeholder: when itemdataman is ported, this will read default item content.
SetItemInfo(null, 0);
//itemdataman* pItemDataMan = g_pGame->GetItemDataMan();
object pData_temp = itemdataman.get_item_for_sell((uint)m_tid);
if(pData_temp == null)
{
SetItemInfo(null, 0);
SetLocalProps();
m_bLocalDetailData = true;
return;
}
item_data pData = (item_data)pData_temp;
SetItemInfo(pData.item_content, pData.content_length);
SetLocalProps();
m_bLocalDetailData = true;
}
@@ -1188,25 +1212,9 @@ namespace BrewMonster.Scripts.Managers
m_strDesc = string.Empty;
// Item name line
string name = GetName();
if (!string.IsNullOrEmpty(name))
{
AddDescText(0, true, name);
}
// Core description from item_desc.txt (via EC_Game / TryGetItemMsg)
string mainDesc = TryGetItemMainDesc();
if (!string.IsNullOrEmpty(mainDesc))
{
AddDescText(0, true, mainDesc);
}
// Extended description from item_ext_desc.txt
string extDesc = TryGetItemExtDesc();
if (!string.IsNullOrEmpty(extDesc))
{
AddDescText(0, true, extDesc);
}
CECStringTab pDescTab = EC_Game.GetItemDesc();
AddDescText((int)DescriptipionMsg.ITEMDESC_COL_WHITE, false, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_ERRORITEM));
AddDescText((int)DescriptipionMsg.ITEMDESC_COL_WHITE, false, "({0})", m_tid);
TrimLastReturn();
return m_strDesc;
@@ -1230,8 +1238,32 @@ namespace BrewMonster.Scripts.Managers
AddDescText(col, true, "Price: {0}", price);
}
protected virtual void AddProfReqDesc(int iProfReq)
protected virtual void AddProfReqDesc(uint iProfReq)
{
if (EC_ProfConfigs.ContainsAllProfession(iProfReq))
{
return;// All profession permit equirement
}
CECStringTab pDescTab = EC_Game.GetItemDesc();
CECGameRun pGameRun = EC_Game.GetGameRun();
CECHostPlayer pHost = pGameRun.GetHostPlayer();
int col = (iProfReq & (1 << pHost.GetProfession())) != 0 ? (int)DescriptipionMsg.ITEMDESC_COL_WHITE : (int)DescriptipionMsg.ITEMDESC_COL_RED;
AddDescText(col, false, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_PROFESSIONREQ));
for (int i = 0; i < (int)Profession.NUM_PROFESSION; i++)
{
if ((iProfReq & (1 << i)) != 0)
{
m_strDesc += " ";
string profName = pGameRun.GetProfName(i);
// Remove newline and carriage return characters that cause UI display issues
if (!string.IsNullOrEmpty(profName))
{
profName = profName.Replace("\r", "").Replace("\n", "").Trim();
}
AddDescText(col, false, profName);
}
}
AddDescText(col, true, " ");
}
protected virtual int DecideNameCol()
@@ -1243,7 +1275,7 @@ namespace BrewMonster.Scripts.Managers
{
}
protected void AddDescText(int iCol, bool bRet, string szText, params object[] args)
protected virtual void AddDescText(int iCol, bool bRet, string szText, params object[] args)
{
string line = (args != null && args.Length > 0) ? string.Format(szText, args) : szText;
m_strDesc += line;
@@ -49,7 +49,229 @@ namespace BrewMonster.Scripts.Managers
SIZE_ALL_EQUIPIVTR,
SIZE_GENERALCARD_EQUIPIVTR = SIZE_ALL_EQUIPIVTR - EQUIPIVTR_GENERALCARD1,
}
#region Inventory Essence Struct
#pragma pack(1)
public struct IVTR_ESSENCE_WEAPON
{
public short weapon_type;
public short weapon_dealy;
public int weapon_class;
public int weapon_level;
public int require_projectile; // Ҫҩ
public int damage_low; // Сֵ
public int damage_high; // ֵ
public int magic_damage_low; // ħ
public int magic_damage_high; // ħ
// public int attack; //
public int attack_speed;
public float attack_range;
public float attack_short_range;
public IVTR_ESSENCE_WEAPON( byte[] data)
{
Debug.Log("IVTR_ESSENCE_WEAPON: data.Length: " + data.Length);
CECDataReader dr = new (data, data.Length);
weapon_type = dr.ReadShort();
weapon_dealy = dr.ReadShort();
weapon_class = dr.ReadInt();
weapon_level = dr.ReadInt();
require_projectile = dr.ReadInt();
damage_low = dr.ReadInt();
damage_high = dr.ReadInt();
magic_damage_low = dr.ReadInt();
magic_damage_high = dr.ReadInt();
attack_speed = dr.ReadInt();
attack_range = dr.ReadFloat();
attack_short_range = dr.ReadFloat();
}
};
public struct IVTR_ESSENCE_ARROW
{
// TODO : implement data later
// DWORD dwBowMask;
// int iDamage;
// int iDamageScale;
// int iWeaponReqLow;
// int iWeaponReqHigh;
};
public struct IVTR_ESSENCE_DECORATION
{
// TODO : implement data later
// int damage;
// int magic_damage;
// int defense;
// int armor;
// int resistance[NUM_MAGICCLASS];
};
public struct IVTR_ESSENCE_ARMOR
{
// TODO : implement data later
public int defense;
public int armor;
public int mp_enhance;
public int hp_enhance;
public int[] resistance;
public IVTR_ESSENCE_ARMOR(byte[] data)
{
Debug.Log("IVTR_ESSENCE_ARMOR: data.Length: " + data.Length);
resistance = new int[InventoryConst.NUM_MAGICCLASS];
CECDataReader dr = new (data, data.Length);
defense = dr.ReadInt();
armor = dr.ReadInt();
mp_enhance = dr.ReadInt();
hp_enhance = dr.ReadInt();
for(int i = 0; i < InventoryConst.NUM_MAGICCLASS; i++)
{
resistance[i] = dr.ReadInt();
}
}
};
public struct IVTR_ESSENCE_FASHION
{
// TODO : implement data later
// int require_level;
// unsigned short color;
// unsigned short gender;
};
public struct IVTR_ESSENCE_FLYSWORD
{
// TODO : implement data later
// int cur_time;
// int max_time;
// short require_level;
// char level;
// char improve_level;
// int profession;
// size_t time_per_element;
// float speed_increase;
// float speed_increase2;
};
public struct IVTR_ESSENCE_WING
{
// TODO : implement data later
// int require_level;
// size_t mp_launch;
// size_t mp_per_second;
// float speed_increase;
};
public struct IVTR_ESSENCE_AUTOHP
{
// TODO : implement data later
// int hp_left;
// float trigger;
};
public struct IVTR_ESSENCE_AUTOMP
{
// TODO : implement data later
// int mp_left;
// float trigger;
};
public struct IVTR_ESSENCE_PETEGG
{
// TODO : implement data later
// int req_level;
// int req_class;
// int honor_point;
// int pet_tid;
// int pet_vis_tid;
// int pet_egg_tid;
// int pet_class;
// short level;
// unsigned short color;
// int exp;
// int skill_point;
// unsigned short name_len;
// unsigned short skill_count;
// wchar_t name[8];
};
public struct IVTR_ESSENCE_DESTROYING
{
// TODO : implement data later
// int tid;
};
public struct IVTR_ESSENCE_GOBLIN
{
struct _GOBLIN_DATA
{
// TODO : implement data later
// unsigned int exp;
// short level;
// short total_attribute;
// short strength;
// short agility;
// short vitality;
// short energy;
// short total_genius;
// short genius[5];
// short refine_level;
// int stamina;
// int status_value;
};
// TODO : implement data later
// _GOBLIN_DATA data;
// int equip_cnt;
// int skill_cnt;
};
public struct IVTR_ESSENCE_WEDDING_BOOKCARD
{
// TODO : implement data later
// int year;
// int month;
// int day;
};
public struct IVTR_ESSENCE_WEDDING_INVITECARD
{
// TODO : implement data later
// int start_time;
// int end_time;
// int groom;
// int bride;
// int scene;
// int invitee;
};
public struct IVTR_ESSENCE_FORCE_TOKEN
{
// TODO : implement data later
// int require_force;
// int repu_total;
// int repu_inc_ratio;
};
public struct IVTR_ESSENCE_MONSTERSPIRIT
{
// TODO : implement data later
// int level;
// int type;
// int power;
};
public struct IVTR_ESSENCE_GENERALCARD
{
// TODO : implement data later
// int type;
// int rank;
// int require_level;
// int require_leadership;
// int max_level;
// int level;
// int exp;
// int rebirth_times;
};
#pragma pack()
#endregion
public static class EC_IvtrType
{
@@ -0,0 +1,436 @@
// /*
// * FILE: EC_IvtrWeapon.cpp
// *
// * DESCRIPTION:
// *
// * CREATED BY: Duyuxin, 2004/11/19
// *
// * HISTORY:
// *
// * Copyright (c) 2004 Archosaur Studio, All Rights Reserved.
// */
// #include "EC_Global.h"
// #include "EC_IvtrWeapon.h"
// #include "EC_Game.h"
// #include "EC_FixedMsg.h"
// #include "EC_GameRun.h"
// #include "EC_HostPlayer.h"
// #include "EC_RTDebug.h"
// #include "elementdataman.h"
// #include "EC_Configs.h"
using BrewMonster;
using ModelRenderer.Scripts.GameData;
using System.Collections.Generic;
using BrewMonster.Network;
using BrewMonster.Scripts.Managers;
using BrewMonster.Scripts;
#region C# regions
// #define new A_DEBUG_NEW
// ///////////////////////////////////////////////////////////////////////////
// //
// // Define and Macro
// //
// ///////////////////////////////////////////////////////////////////////////
// ///////////////////////////////////////////////////////////////////////////
// //
// // Reference to External variables and functions
// //
// ///////////////////////////////////////////////////////////////////////////
// ///////////////////////////////////////////////////////////////////////////
// //
// // Local Types and Variables and Global variables
// //
// ///////////////////////////////////////////////////////////////////////////
// ///////////////////////////////////////////////////////////////////////////
// //
// // Local functions
// //
// ///////////////////////////////////////////////////////////////////////////
// ///////////////////////////////////////////////////////////////////////////
// //
// // Implement CECIvtrWeapon
// //
// ///////////////////////////////////////////////////////////////////////////
#endregion
namespace PerfectWorld.Scripts.Managers
{
public class EC_IvtrWeapon : EC_IvtrEquip
{
//Attributes
//Weapon essence data
protected IVTR_ESSENCE_WEAPON m_Essence;
// data in database
protected WEAPON_MAJOR_TYPE m_pDBMajorType;
protected WEAPON_SUB_TYPE m_pDBSubType;
protected WEAPON_ESSENCE m_pDBEssence;
public EC_IvtrWeapon(int tid, int expire_date) : base(tid, expire_date)
{
m_iCID = ICID_WEAPON;
elementdataman pDB = ElementDataManProvider.GetElementDataMan();
DATA_TYPE DataType = DATA_TYPE.DT_INVALID;
m_pDBEssence = (WEAPON_ESSENCE)pDB.get_data_ptr((uint)tid, ID_SPACE.ID_SPACE_ESSENCE, ref DataType);
m_pDBMajorType = (WEAPON_MAJOR_TYPE)pDB.get_data_ptr(m_pDBEssence.id_major_type, ID_SPACE.ID_SPACE_ESSENCE, ref DataType);
m_pDBSubType = (WEAPON_SUB_TYPE)pDB.get_data_ptr(m_pDBEssence.id_sub_type, 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_i64EquipMask = EC_IvtrEquip.ICID_WEAPON;
m_iProcType = (int)m_pDBEssence.proc_type;
FixProps = m_pDBEssence.fixed_props;
RepairFee = m_pDBEssence.repairfee;
ReputationReq = m_pDBEssence.require_reputation;
}
public EC_IvtrWeapon(EC_IvtrWeapon other) : base(other)
{
m_pDBEssence = other.m_pDBEssence;
m_pDBMajorType = other.m_pDBMajorType;
m_pDBSubType = other.m_pDBSubType;
m_Essence = other.m_Essence;
}
// CECIvtrWeapon::~CECIvtrWeapon()
// {
// }
public override bool SetItemInfo(byte[] pInfoData, int iDataLen)
{
base.SetItemInfo(pInfoData, iDataLen);
if(pInfoData == null || iDataLen == 0)
{
return true;
}
try
{
CECDataReader dr = new CECDataReader(pInfoData ,iDataLen);
// Skip equip requirements and endurance
dr.Offset(6 * sizeof(short), CECDataReader.SEEK_CUR);
dr.Offset(2 * sizeof(int), CECDataReader.SEEK_CUR);
int iEssenceSize = dr.ReadShort();
// Skip maker's information
dr.ReadByte();
int iMakerLen = dr.ReadByte();
dr.Offset(iMakerLen, CECDataReader.SEEK_CUR);
byte[] iEssenceData = dr.ReadData(iEssenceSize);
m_Essence = new IVTR_ESSENCE_WEAPON(iEssenceData);
BMLogger.Log("[thn] weapon addon m_Essence: " + m_Essence.ToString());
// ˵
if(m_pDBEssence.fixed_props != 0 && m_pDBEssence.probability_addon_num0 != 1.0f)
{
// Get database data
elementdataman pDataMan = ElementDataManProvider.GetElementDataMan();
CECStringTab PropTab = EC_Game.GetItemExtProp();
int i, iSize = 0;
for(i=0;i<32;i++)
{
if(m_pDBEssence.addons[i].id_addon != 0)
iSize++;
}
if(iSize > 0 && Props.Count == 0)
{
Props.Capacity = iSize;
for(i=0;i<32;i++)
{
if(m_pDBEssence.addons[i].id_addon != 0)
{
Property Prop = new Property();
Prop.Type = (int)m_pDBEssence.addons[i].id_addon;
Prop.Embed = false;
Prop.Suite = false;
Prop.Engraved = false;
Prop.Local = false;
byte bType = PropTab.GetWideString(Prop.Type) != null ? (byte)0xff : (byte)0xff;
DATA_TYPE DataType = DATA_TYPE.DT_INVALID;
object pData = pDataMan.get_data_ptr(m_pDBEssence.addons[i].id_addon, ID_SPACE.ID_SPACE_ADDON, ref DataType);
if (DataType != DATA_TYPE.DT_EQUIPMENT_ADDON)
{
return false;
}
EQUIPMENT_ADDON pAddon = (EQUIPMENT_ADDON)pData;
Prop.NumParam = pAddon.num_params;
for(int j=0; j < Prop.NumParam; j++)
{
if(j==0)
{
Prop.Params[0] = pAddon.param1;
}
else if(j==1)
{
Prop.Params[1] = pAddon.param2;
}
else if(j==2)
{
Prop.Params[2] = pAddon.param3;
}
}
Props.Add(Prop);
}
}
}
}
return true;
}
catch ( System.Exception e)
{
return false;
}
}
// Get item default information from database
public override void DefaultInfo()
{
LevelReq = m_pDBEssence.require_level;
StrengthReq = m_pDBEssence.require_strength;
AgilityReq = m_pDBEssence.require_agility;
ReputationReq = m_pDBEssence.require_reputation;
CurEndurance = m_pDBEssence.durability_min * ENDURANCE_SCALE;
MaxEndurance = m_pDBEssence.durability_min * ENDURANCE_SCALE;
}
// Get item icon file name
public override string GetIconFile()
{
return m_pDBEssence.FileIcon;
}
// Get item name
public override string GetName()
{
BMLogger.Log("[THN]EC_IvtrWeapon: GetName: m_pDBEssence.Name: " + m_pDBEssence.Name);
return m_pDBEssence.Name;
}
// Get preview info
public override string GetPreviewInfo()
{
int[] aPEEVals = new int[MAX_PEEINDEX];
int[] aRefines = new int[MAX_REFINEINDEX];
for(int i=0; i<MAX_PEEINDEX; i++)
aPEEVals[i] = 0;
for(int i=0; i<MAX_REFINEINDEX; i++)
aRefines[i] = 0;
m_strDesc = "";
BuildAddOnPropDesc(aPEEVals, aRefines);
CECStringTab pDescTab = EC_Game.GetItemDesc();
// Physical damage
if (m_Essence.damage_low != 0 || m_Essence.damage_high != 0 || aRefines[REFINE_PHYDAMAGE] != 0)
{
AddDescText((int)DescriptipionMsg.ITEMDESC_COL_WHITE, false, EC_Game.GetItemDesc().GetWideString((int)DescriptipionMsg.ITEMDESC_PHYDAMAGE));
AddDescText((int)DescriptipionMsg.ITEMDESC_COL_WHITE, true, " %d-%d", m_Essence.damage_low - aPEEVals[PEEI_PHYDAMAGE] + aRefines[REFINE_PHYDAMAGE],
m_Essence.damage_high - aPEEVals[PEEI_PHYDAMAGE] - aPEEVals[PEEI_MAX_PHYDAMAGE] + aRefines[REFINE_PHYDAMAGE]);
}
return m_strDesc;
}
public override bool GetRefineEffectFor(string strEffect, RefineEffect rhs){
strEffect = "";
if (!m_bNeedUpdate){
switch (rhs.RefineIndex){
case REFINE_PHYDAMAGE:
strEffect = string.Format("{0}{1} {2}-{3} {4}(+{5})",
rhs.GetClrAttribute(),
EC_Game.GetItemDesc().GetWideString((int)DescriptipionMsg.ITEMDESC_PHYDAMAGE),
m_Essence.damage_low - rhs.APEEVals[PEEI_PHYDAMAGE] + rhs.ARefines[REFINE_PHYDAMAGE] + rhs.GetIncEffect(),
m_Essence.damage_high - rhs.APEEVals[PEEI_PHYDAMAGE] - rhs.ARefines[PEEI_MAX_PHYDAMAGE] + rhs.ARefines[REFINE_PHYDAMAGE] + rhs.GetIncEffect(),
rhs.GetClrEffect(), rhs.GetIncEffect());
break;
case REFINE_MAGICDAMAGE:
strEffect = string.Format("{0}{1} {2}-{3} {4}(+{5})",
rhs.GetClrAttribute(),
EC_Game.GetItemDesc().GetWideString((int)DescriptipionMsg.ITEMDESC_MAGICDAMAGE),
m_Essence.magic_damage_low - rhs.APEEVals[PEEI_MAGICDAMAGE] + rhs.ARefines[REFINE_MAGICDAMAGE] + rhs.GetIncEffect(),
m_Essence.magic_damage_high - rhs.APEEVals[PEEI_MAGICDAMAGE] - rhs.APEEVals[PEEI_MAX_MAGICDAMAGE] + rhs.ARefines[REFINE_MAGICDAMAGE] + rhs.GetIncEffect(),
rhs.GetClrEffect(), rhs.GetIncEffect());
break;
}
}
return !string.IsNullOrEmpty(strEffect);
}
// Get item description text
protected override string GetNormalDesc(bool bRepair){
if (m_bNeedUpdate)
return null;
int[] aPEEVals = new int[MAX_PEEINDEX];
int[] aRefines = new int[MAX_REFINEINDEX];
for(int i=0; i<MAX_PEEINDEX; i++)
aPEEVals[i] = 0;
for(int i=0; i<MAX_REFINEINDEX; i++)
aRefines[i] = 0;
m_strDesc = "";
BuildAddOnPropDesc(aPEEVals, aRefines);
string strAddon = m_strDesc;
m_strDesc = "";
CECStringTab pDescTab = EC_Game.GetItemDesc();
CECHostPlayer pHost = EC_Game.GetGameRun().GetHostPlayer();
int white = (int)DescriptipionMsg.ITEMDESC_COL_WHITE;
int lblue = (int)DescriptipionMsg.ITEMDESC_COL_LIGHTBLUE;
int red = (int)DescriptipionMsg.ITEMDESC_COL_RED;
int namecol = DecideNameCol();
uint dwPEE = PropEffectEssence();
if (Holes != null && Holes.Count > 0)
{
AddDescText(namecol, false, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_NAMESOCKET), GetName(), Holes.Count);
}
else
{
AddDescText(namecol, false, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_NAME), GetName());
}
if (RefineLvl > 0)
AddDescText(-1, true, "{0} +{1}", pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_LEVEL), RefineLvl);
else
m_strDesc += "\\r";
AddIDDescText();
AddBindDescText();
// Is destroying?
AddDestroyingDesc((int)m_pDBEssence.id_drop_after_damaged, m_pDBEssence.num_drop_after_damaged);
AddExpireTimeDesc();
// Sub class name
AddDescText(white, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_CLASSNAME), m_pDBSubType.name.ToString());
// Weapon level
AddDescText(-1, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_LEVEL), m_Essence.weapon_level);
// Attack speed
int col = ((dwPEE & PEE_ATKSPEED) != 0) ? lblue : white;
if (Props != null && Props.Count > 0 && Props[0].Local)
col = white;
AddDescText(col, false, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_ATKSPEED));
AddDescText(col, true, " {0:F2}", 1.0f / (m_Essence.attack_speed * 0.05f));
// Attack distance
AddDescText(white, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_ATKDISTANCE), m_Essence.attack_range - aPEEVals[PEEI_ATKDIST]);
// Weak distance
if (m_Essence.weapon_type == (int)WEAPON_TYPE.WEAPON_TYPE_RANGE)
AddDescText(white, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_WEAKDIST), m_Essence.attack_short_range);
// Physical damage
if (m_Essence.damage_low != 0 || m_Essence.damage_high != 0 || aRefines[REFINE_PHYDAMAGE] != 0)
{
AddDescText(white, false, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_PHYDAMAGE));
AddDescText(white, true, " {0}-{1}", m_Essence.damage_low - aPEEVals[PEEI_PHYDAMAGE] + aRefines[REFINE_PHYDAMAGE],
m_Essence.damage_high - aPEEVals[PEEI_PHYDAMAGE] - aPEEVals[PEEI_MAX_PHYDAMAGE] + aRefines[REFINE_PHYDAMAGE]);
}
// Magic damage
if (m_Essence.magic_damage_low != 0 || m_Essence.magic_damage_high != 0 || aRefines[REFINE_MAGICDAMAGE] != 0)
{
AddDescText(white, false, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_MAGICDAMAGE));
AddDescText(white, true, " {0}-{1}", m_Essence.magic_damage_low - aPEEVals[PEEI_MAGICDAMAGE] + aRefines[REFINE_MAGICDAMAGE],
m_Essence.magic_damage_high - aPEEVals[PEEI_MAGICDAMAGE] - aPEEVals[PEEI_MAX_MAGICDAMAGE] + aRefines[REFINE_MAGICDAMAGE]);
}
// Endurance
col = white;
if (CurEndurance == 0)
col = red;
else if ((dwPEE & PEE_ENDURANCE) != 0)
col = lblue;
AddDescText(col, false, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_ENDURANCE));
AddDescText(col, true, " {0}/{1}", VisualizeEndurance(CurEndurance), VisualizeEndurance(MaxEndurance));
// Projectile requirement
if (m_Essence.weapon_type == (int)WEAPON_TYPE.WEAPON_TYPE_RANGE && m_Essence.require_projectile != 0)
{
DATA_TYPE DataType = DATA_TYPE.DT_INVALID;
object pData = ElementDataManProvider.GetElementDataMan().get_data_ptr((uint)m_Essence.require_projectile, ID_SPACE.ID_SPACE_ESSENCE, ref DataType);
PROJECTILE_TYPE pProjectile = (PROJECTILE_TYPE)pData;
AddDescText(white, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_PROJECTILE), pProjectile.name);
}
// Profession requirement
AddProfReqDesc((uint)ProfReq);
// Level requirment
if (LevelReq != 0)
{
col = pHost.GetMaxLevelSofar() >= LevelReq ? white : red;
AddDescText(col, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_LEVELREQ), LevelReq);
}
// Strength requirment
if (StrengthReq != 0)
{
col = pHost.GetExtendProps().bs.strength < StrengthReq ? red : ((dwPEE & PEE_STRENGTHREQ) != 0 ? lblue : white);
AddDescText(col, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_STRENGTHREQ), StrengthReq);
}
// Agility requirment
if (AgilityReq != 0)
{
col = pHost.GetExtendProps().bs.agility < AgilityReq ? red : ((dwPEE & PEE_AGILITYREQ) != 0 ? lblue : white);
AddDescText(col, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_AGILITYREQ), AgilityReq);
}
// Vitality requirment
if (VitalityReq != 0)
{
col = pHost.GetExtendProps().bs.vitality < VitalityReq ? red : ((dwPEE & PEE_VITALITYREQ) != 0 ? lblue : white);
AddDescText(col, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_VITALITYREQ), VitalityReq);
}
// Energy requirment
if (EnergyReq != 0)
{
col = pHost.GetExtendProps().bs.energy < EnergyReq ? red : ((dwPEE & PEE_ENERGYREQ) != 0 ? lblue : white);
AddDescText(col, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_ENERGYREQ), EnergyReq);
}
// Reputation requirement
AddReputationReqDesc();
// Add addon properties
if (!string.IsNullOrEmpty(strAddon))
m_strDesc += strAddon;
// Build tessera description
BuildTesseraDesc();
if(m_pDBEssence.fixed_props == 0 && m_bIsInNPCPack)
AddDescText((int)DescriptipionMsg.ITEMDESC_COL2_BRIGHTBLUE, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_HASRANDOM_PROP));
// Price
AddPriceDesc(white, bRepair);
AddSharpenerDesc();
AddEngravedDesc();
AddMakerDesc();
AddSuiteDesc();
AddExtDescText();
return m_strDesc;
}
// Get weapon attack speed index
public int GetAttackSpeedIndex()
{
float fCurSpeed = m_Essence.attack_speed * 0.05f - m_pDBSubType.attack_speed;
if (fCurSpeed < -0.101f)
return (int)DescriptipionMsg.ITEMDESC_ATKSPD_VERYFAST;
else if (fCurSpeed < -0.001f)
return (int)DescriptipionMsg.ITEMDESC_ATKSPD_FAST;
else if (fCurSpeed < 0.001f)
return (int)DescriptipionMsg.ITEMDESC_ATKSPD_NORMAL;
else if (fCurSpeed <= 0.101f)
return (int)DescriptipionMsg.ITEMDESC_ATKSPD_SLOW;
else
return (int)DescriptipionMsg.ITEMDESC_ATKSPD_VERYSLOW;
}
// // Does this equipment has random property ?
public bool HasRandomProp()
{
for (int i = 0; i < Props.Count; i++)
{
if (!Props[i].Embed && !Props[i].Engraved && Props[i].Type == 472)
return true;
}
return false;
}
public int GetRefineMaterialNum()
{
return m_pDBEssence.material_need;
}
public override uint GetRefineAddOn()
{
return (uint)m_pDBEssence.levelup_addon;
}
public override string GetDropModel()
{
return m_pDBEssence.FileMatter;
}
public override bool IsRare()
{
return base.IsRare() || m_Essence.weapon_level >= 6;
}
public override int GetItemLevel()
{
return m_Essence.weapon_level;
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 6a4959477dd834d3089fcc85d831669a
@@ -0,0 +1,153 @@
using BrewMonster.Scripts;
using BrewMonster;
public static class EC_ProfConfigs
{
public static bool IsProfession(int prof)
{
return prof >= 0 && prof < (int)Profession.NUM_PROFESSION;
}
public static bool IsGender(int gender)
{
return gender >= 0 && gender < (int)Gender.NUM_GENDER;
}
public static bool IsRace(int race)
{
return race >= 0 && race < (int)Race.NUM_RACE;
}
public static bool IsExist(int prof, int gender)
{
if (IsProfession(prof) && IsGender(gender)){
bool[,] s_bExist = {
{ true, true}, // 0:
{ true, true}, // 1:ʦ
{ true, true}, // 2:ʦ
{ false, true}, // 3:
{ true, false}, // 4:
{ true, true}, // 5:̿
{ true, true}, // 6:â
{ true, true}, // 7:
{ true, true}, // 8:
{ true, true}, // 9:
{ true, true}, // 10:ҹӰ
{ true, true}, // 11:
};
return s_bExist[prof, gender];
}else{
//BMLogger.LogError("EC_ProfConfigs: IsExist: prof: {0} gender: {1} is not exist", prof, gender);
return false;
}
}
public static int GetCounterpartGender(int gender)
{
return gender == (int)Gender.GENDER_MALE ? (int)Gender.GENDER_FEMALE : (int)Gender.GENDER_MALE;
}
public static bool CanShowOnCreate(int prof, int gender)
{
// ɫʱǷӦʾְҵģͣÿְҵʾһԱ
if (IsProfession(prof) && IsGender(gender)){
bool[] s_bShowMale = {
true, // 0:
false, // 1:ʦ
false, // 2:ʦ
false, // 3:
true, // 4:
true, // 5:̿
true, // 6:â
false, // 7:
true, // 8:
false, // 9:
true, // 8:ҹӰ
false, // 9:
};
return (gender == (int)Gender.GENDER_MALE) ? s_bShowMale[prof] : !s_bShowMale[prof];
}
//BMLogger.LogError("EC_ProfConfigs: CanShowOnCreate: prof: {0} gender: {1} is not exist", prof, gender);
return false;
}
public static int GetRaceShowOrder(int race)
{
// ֵԽСȼԽ
if (IsRace(race)){
int[] s_nRaceOrder = {
1,
2,
3,
4,
5,
0,
};
return s_nRaceOrder[race];
}
//BMLogger.LogError("EC_ProfConfigs: GetRaceShowOrder: race: {0} is not exist", race);
return -1;
}
public static int GetRaceByProfession(int prof)
{
if (IsProfession(prof)){
int[] s_nProfRace = {
(int)Race.RACE_HUMAN,
(int)Race.RACE_HUMAN,
(int)Race.RACE_GHOST,
(int)Race.RACE_ORC,
(int)Race.RACE_ORC,
(int)Race.RACE_GHOST,
(int)Race.RACE_ELF,
(int)Race.RACE_ELF,
(int)Race.RACE_LING,
(int)Race.RACE_LING,
(int)Race.RACE_OBORO,
(int)Race.RACE_OBORO,
};
return s_nProfRace[prof];
}
//BMLogger.LogError("EC_ProfConfigs: GetRaceByProfession: prof: {0} is not exist", prof);
return -1;
}
public static int GetProfessionShowOrderInRace(int prof)
{
// ֵԽСȼԽ
if (IsProfession(prof)){
int[] s_nRaceZeroShowOrderProf = {
(int)Profession.PROF_WARRIOR, //
(int)Profession.PROF_ORC, //
(int)Profession.PROF_ANGEL, // ˣ
(int)Profession.PROF_MONK, // ϫʦ
(int)Profession.PROF_JIANLING, //
(int)Profession.PROF_YEYING, // 壺ҹӰ
};
int race = GetRaceByProfession(prof);
return prof == s_nRaceZeroShowOrderProf[race] ? 0 : 1;
}
//BMLogger.LogError("EC_ProfConfigs: GetProfessionShowOrderInRace: prof: {0} is not exist", prof);
return -1;
}
public static bool ContainsAllProfession(uint mask){
return (GetAllProfessionMask() & mask) == GetAllProfessionMask();
}
public static uint GetAllProfessionMask(){
const uint ALL_PROFESSION_MASK = (1 << (int)Profession.NUM_PROFESSION)-1;
return ALL_PROFESSION_MASK;
}
public static int GetMaxBodyID(int prof)
{
if (IsProfession(prof)){
// PROF_ANGEL, PROF_ARCHOR, PROF_MAGE, PROF_WARRIOR didn't have nBodyID
int[] s_maxBodyID = {-1, -1, 4, 5, 3, 4, -1, -1, 4, 4, 1, 1 };
return s_maxBodyID[prof];
}
//BMLogger.LogError("EC_ProfConfigs: GetMaxBodyID: prof: {0} is not exist", prof);
return -1;
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 642d432c42e2d4929aa9b4b989d5334e
+19 -21
View File
@@ -68,7 +68,7 @@ namespace BrewMonster
private QueueActionEvent queueActionEvent;
protected static PLAYER_LEVELEXP_CONFIG _player_levelup_exp;
private CECPlayerActionController m_pActionController;
private enumWingType m_wingType;
private enumWingType m_wingType = enumWingType.WINGTYPE_FLYSWORD;
protected int m_idCurSkillTarget;
protected CECSkill m_pCurSkill;
protected int m_idFaction; // ID of player's faction
@@ -448,6 +448,10 @@ namespace BrewMonster
{
return m_PlayerInfo;
}
// Get basic properties
public ROLEBASICPROP GetBasicProps() { return m_BasicProps; }
// Get extend properties
public ROLEEXTPROP GetExtendProps() { return m_ExtProps; }
protected override void Update()
{
base.Update();
@@ -875,12 +879,6 @@ namespace BrewMonster
//return iLevel * iLevel * 500;
}
// Get basic properties
public ROLEBASICPROP GetBasicProps()
{
return m_BasicProps;
}
public override void TurnFaceTo(int idTarget, float dwTime = 200)
{
if (idTarget != 0)
@@ -961,13 +959,13 @@ namespace BrewMonster
else
iAction = (int)PLAYER_ACTION_TYPE.ACT_WALK;
}
//else if (iMoveEnv == MOVEENV_AIR)
//{
// //if (/*UsingWing()*/ m_wingType == WINGTYPE_WING)
// // iAction = ACT_FLY;
// //else
// // iAction = ACT_FLY_SWORD;
//}
else if (iMoveEnv == (int)MoveEnvironment.MOVEENV_AIR)
{
if (/*UsingWing()*/ m_wingType == enumWingType.WINGTYPE_WING)
iAction = (int)PLAYER_ACTION_TYPE.ACT_FLY;
else
iAction = (int)PLAYER_ACTION_TYPE.ACT_FLY_SWORD;
}
else if (iMoveEnv == (int)MoveEnvironment.MOVEENV_WATER)
{
//if (CanCombineWithMoveForSkill())
@@ -990,13 +988,13 @@ namespace BrewMonster
else
iAction = (int)PLAYER_ACTION_TYPE.ACT_STAND;
}
//else if (iMoveEnv == MOVEENV_AIR)
//{
// if (/*UsingWing()*/ m_wingType == WINGTYPE_WING)
// iAction = ACT_HANGINAIR;
// else
// iAction = ACT_HANGINAIR_SWORD;
//}
else if (iMoveEnv == (int)MoveEnvironment.MOVEENV_AIR)
{
if (/*UsingWing()*/ m_wingType == enumWingType.WINGTYPE_WING)
iAction = (int)PLAYER_ACTION_TYPE.ACT_HANGINAIR;
else
iAction = (int)PLAYER_ACTION_TYPE.ACT_HANGINAIR_SWORD;
}
else if (iMoveEnv == (int)MoveEnvironment.MOVEENV_WATER)
iAction = (int)PLAYER_ACTION_TYPE.ACT_HANGINWATER;
}
@@ -2133,6 +2133,7 @@ namespace CSNetwork.GPDataType
};
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct cmd_object_takeoff
{
public int object_id;
@@ -2149,5 +2150,26 @@ namespace CSNetwork.GPDataType
{
public byte is_active;
};
public struct cmd_reincarnation_tome_info
{
public int tome_exp;
public char tome_active; // 1
public int count;
public struct _entry
{
public int level;
public int timestamp;
public int exp;
};
public _entry[] records;
public bool CheckValid(int buf_size, out int sz)
{ sz = 0;
if (count < 0)
return false;
sz = Marshal.SizeOf<cmd_reincarnation_tome_info>() - Marshal.SizeOf<_entry[]>();
sz += count * Marshal.SizeOf<_entry>();
return buf_size >= sz;
}
};
}
@@ -372,7 +372,6 @@ namespace BrewMonster.Network
public static void GetRoleBaseInfo(int iNumRole, List<int> aRoleIDs)
{
BMLogger.Log($"GetRoleBaseInfo: {iNumRole} {string.Join(", ", aRoleIDs)}");
Instance._gameSession.GetRoleBaseInfo(iNumRole, aRoleIDs);
}
@@ -55,7 +55,7 @@ namespace BrewMonster.UI
return -1;
m_Item[nIndex].strDataName[nSubIndex] = strName;
m_Item[nIndex].dwData[nSubIndex] = dwItemData;
m_Item[nIndex].SetActOnClickBtn(m_OnClickBtn, nIndex);
return nIndex;
}
@@ -3117,7 +3117,6 @@ namespace BrewMonster.UI
if (Enum.IsDefined(typeof(SERVICE_TYPE), idFunction))
{
SERVICE_TYPE k = (SERVICE_TYPE)idFunction;
BMLogger.Log($" PopupCorrespondingServiceDialog: {k}");
}
if (idFunction == (int)SERVICE_TYPE.NPC_SELL || idFunction == (int)SERVICE_TYPE.NPC_BUY)
@@ -1,12 +1,15 @@
using UnityEngine;
using UnityEngine.UI;
using TMPro;
namespace BrewMonster.Scripts.UI
{
public class AwardItem : MonoBehaviour
{
[SerializeField] private Image img;
[SerializeField] private Button btn;
[SerializeField] private GameObject objHint;
[SerializeField] private TMP_Text txtHint;
private bool _bShowHint = false;
private Vector2Int _position;
@@ -27,6 +30,7 @@ namespace BrewMonster.Scripts.UI
public void SetText(string text)
{
// TODO: Add a Text component and set its text
}
public void SetColor(Color color)
@@ -37,6 +41,12 @@ namespace BrewMonster.Scripts.UI
public void SetHint(string text)
{
// TODO : Implement hint functionality
btn.onClick.RemoveAllListeners();
txtHint.text = text;
btn.onClick.AddListener(() => {
HintBehaviour();
});
}
public void ClearCover()
@@ -49,5 +59,10 @@ namespace BrewMonster.Scripts.UI
gameObject.SetActive(show);
}
private void HintBehaviour()
{
_bShowHint = !_bShowHint;
objHint.SetActive(_bShowHint);
}
}
}
@@ -87,9 +87,9 @@ namespace BrewMonster.Scripts.UI
pTask.GetAwardCandidates(idTask, ref ad);
if (ad.m_ulCandItems > 1)
{
string szName;
string szName = "";
string strFile = "";
string szText;
string szText = "";
EC_IvtrItem pItem;
// AUICTranslate trans; // TODO
// int i, j, idItem, nNum;
@@ -128,21 +128,24 @@ namespace BrewMonster.Scripts.UI
{
idItem = ad.m_CandItems[i - 1].m_AwardItems[j - 1].m_ulItemTemplId;
pItem = EC_IvtrItem.CreateItem((int)idItem, 0, 1);
nNum = ad.m_CandItems[i - 1].m_AwardItems[j - 1].m_ulItemNum;
if (nNum > 1)
{
a_sprintf(out szText, _AL("%d"), nNum);
pImage.SetText(szText);
}
else
pImage.SetText(_AL(""));
pItem.GetDetailDataFromLocal();
// pImage.SetHint(trans.Translate(pItem.GetDesc())); // TODO
string strDesc = pItem.GetDesc();
pImage.SetHint(strDesc); // TODO
//Debug.Log("[THN]CDlgAward: pItem.GetDesc():" + pItem.GetDesc());
// af_GetFileTitle(pItem.GetIconFile(), strFile); // TODO
strFile.ToLower();
BMLogger.Log("[THN]CDlgAward: pItem.GetDesc():" + strDesc);
// TODO: Set the image cover here
// pImage.SetCover(GetGameUIMan().m_pA2DSpriteIcons[CECGameUIMan::ICONS_INVENTORY],
// GetGameUIMan().m_IconMap[CECGameUIMan::ICONS_INVENTORY][strFile]);
@@ -102,14 +102,11 @@ namespace BrewMonster.UI
/// </summary>
private void OnGetRoleListComplete(List<RoleInfo> roleInfos)
{
BMLogger.Log($"OnGetRoleListComplete {roleInfos.Count}");
_roleInfos = roleInfos;
}
private void OnClickSelectCharacter(RoleInfo roleInfo)
{
BMLogger.Log($"OnClickSelectCharacter {roleInfo.name}");
UnityGameSession.SelectRoleAsync(roleInfo, OnSelectRoleComplete);
}
@@ -126,7 +126,7 @@ public class NPCShopDetailPanel : MonoBehaviour
// For NPC shop items, we typically have static data only
// Try to get description using GetNormalDesc() which works with base stats
string equipDesc = equipment.GetNormalDesc();
string equipDesc = equipment.GetDesc();
if (!string.IsNullOrEmpty(equipDesc))
{
// Replace C++ style "\r" line separators with real newlines for TMP
+104 -15
View File
@@ -11,36 +11,125 @@ namespace BrewMonster
}
public class CECDataReader
{
private byte[] data;
private int offset;
private int length;
public const int SEEK_SET = 0; /* set file offset to offset */
public const int SEEK_CUR = 1; /* set file offset to current plus offset */
public const int SEEK_END = 2; /* set file offset to EOF plus offset */
public CECDataReader(byte[] data, int offset, int length)
private byte[] data;
private int length;
private int m_pStart;
private int m_pCur;
private int m_pEnd;
public CECDataReader(byte[] pDataBuf, int iDataLen)
{
this.data = data;
this.offset = offset;
this.length = length;
if (pDataBuf == null || iDataLen <= 0)
{
throw new System.InvalidOperationException("Invalid data");
}
data = new byte[iDataLen];
System.Array.Copy(pDataBuf, data, iDataLen);
this.length = iDataLen;
m_pStart = 0;
m_pCur = 0;
m_pEnd = iDataLen;
}
public void Offset(int iOffset, int iSeekFlag)
{
int pCur = 0;
switch (iSeekFlag)
{
case SEEK_SET: pCur = m_pStart + iOffset; break;
case SEEK_CUR: pCur = m_pCur + iOffset; break;
case SEEK_END: pCur = m_pEnd + iOffset; break;
}
m_pCur = pCur;
BoundCheck(0);
}
public int ReadInt()
{
if (offset + sizeof(int) > offset + length)
throw new System.InvalidOperationException("Not enough data to read int");
BoundCheck(sizeof(int));
int value = System.BitConverter.ToInt32(data, offset);
offset += sizeof(int);
int value = System.BitConverter.ToInt32(data, m_pCur);
m_pCur += sizeof(int);
return value;
}
public short ReadShort()
{
BoundCheck(sizeof(short));
short value = System.BitConverter.ToInt16(data, m_pCur);
m_pCur += sizeof(short);
return value;
}
public uint ReadUInt()
{
BoundCheck(sizeof(uint));
uint value = System.BitConverter.ToUInt32(data, m_pCur);
m_pCur += sizeof(uint);
return value;
}
public float ReadFloat()
{
BoundCheck(sizeof(float));
float value = System.BitConverter.ToSingle(data, m_pCur);
m_pCur += sizeof(float);
return value;
}
public byte ReadByte()
{
BoundCheck(sizeof(byte));
byte value = data[m_pCur];
m_pCur += sizeof(byte);
return value;
}
public byte[] ReadData(int size)
{
if (offset + size > offset + length)
throw new System.InvalidOperationException($"Not enough data to read {size} bytes");
BoundCheck(size);
byte[] result = new byte[size];
System.Array.Copy(data, offset, result, 0, size);
offset += size;
System.Array.Copy(data, m_pCur, result, 0, size);
m_pCur += size;
return result;
}
public ushort[] ReadUshortArray(int size)
{
BoundCheck(size * sizeof(ushort));
ushort[] result = new ushort[size];
System.Array.Copy(data, m_pCur, result, 0, size * sizeof(ushort));
m_pCur += size * sizeof(ushort);
return result;
}
public byte[] ReadByteArray(int size)
{
BoundCheck(size);
byte[] result = new byte[size];
System.Array.Copy(data, m_pCur, result, 0, size);
m_pCur += size;
return result;
}
public void PrintData(int size)
{
for(int i =m_pCur; i < m_pCur + size; i++)
{
BMLogger.Log("[thn]CECDataReader: PrintData: data[" + i + "]: " + data[i]);
}
}
void BoundCheck(int dwSize)
{
if (m_pCur + dwSize < m_pStart || m_pCur + dwSize > m_pEnd)
{
throw new System.InvalidOperationException("Out of bounds");
}
}
}
}
@@ -1,5 +1,81 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &165174036537021008
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 3386269673238764405}
- component: {fileID: 5695467372271221829}
- component: {fileID: 8051377020245334668}
m_Layer: 5
m_Name: Panel
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!224 &3386269673238764405
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 165174036537021008}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 1815682412766530288}
m_Father: {fileID: 2175163742848198118}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 366.661, y: -167.5}
m_SizeDelta: {x: 531, y: 335}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &5695467372271221829
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 165174036537021008}
m_CullTransparentMesh: 1
--- !u!114 &8051377020245334668
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 165174036537021008}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!1 &227158560462075115
GameObject:
m_ObjectHideFlags: 0
@@ -1222,6 +1298,7 @@ RectTransform:
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 504415793170309261}
- {fileID: 3386269673238764405}
m_Father: {fileID: 1558872982091896349}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
@@ -1243,6 +1320,8 @@ MonoBehaviour:
m_EditorClassIdentifier:
img: {fileID: 5798109676702798723}
btn: {fileID: 5829300517807457460}
objHint: {fileID: 165174036537021008}
txtHint: {fileID: 7658705790532366309}
--- !u!222 &1897581106405175503
CanvasRenderer:
m_ObjectHideFlags: 0
@@ -1558,6 +1637,142 @@ MonoBehaviour:
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!1 &5403631556117558338
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1815682412766530288}
- component: {fileID: 8320041494551075808}
- component: {fileID: 7658705790532366309}
m_Layer: 5
m_Name: Text (TMP)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1815682412766530288
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5403631556117558338}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 3386269673238764405}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: -20, y: -20}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &8320041494551075808
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5403631556117558338}
m_CullTransparentMesh: 1
--- !u!114 &7658705790532366309
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5403631556117558338}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: New Text
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4294967295
m_fontColor: {r: 0, g: 0, b: 0, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:
topLeft: {r: 1, g: 1, b: 1, a: 1}
topRight: {r: 1, g: 1, b: 1, a: 1}
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
bottomRight: {r: 1, g: 1, b: 1, a: 1}
m_fontColorGradientPreset: {fileID: 0}
m_spriteAsset: {fileID: 0}
m_tintAllSprites: 0
m_StyleSheet: {fileID: 0}
m_TextStyleHashCode: -1183493901
m_overrideHtmlColors: 0
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 36
m_fontSizeBase: 36
m_fontWeight: 400
m_enableAutoSizing: 0
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontStyle: 0
m_HorizontalAlignment: 1
m_VerticalAlignment: 256
m_textAlignment: 65535
m_characterSpacing: 0
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
m_paragraphSpacing: 0
m_charWidthMaxAdj: 0
m_TextWrappingMode: 1
m_wordWrappingRatios: 0.4
m_overflowMode: 0
m_linkedTextComponent: {fileID: 0}
parentLinkedComponent: {fileID: 0}
m_enableKerning: 0
m_ActiveFontFeatures: 6e72656b
m_enableExtraPadding: 0
checkPaddingRequired: 0
m_isRichText: 1
m_EmojiFallbackSupport: 1
m_parseCtrlCharacters: 1
m_isOrthographic: 1
m_isCullingEnabled: 0
m_horizontalMapping: 0
m_verticalMapping: 0
m_uvLineOffset: 0
m_geometrySortingOrder: 0
m_IsTextObjectScaleStatic: 0
m_VertexBufferAutoSizeReduction: 0
m_useMaxVisibleDescender: 1
m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: 0, w: 0}
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!1 &5498099694921818792
GameObject:
m_ObjectHideFlags: 0
+30 -2
View File
@@ -308,13 +308,12 @@ public partial class CECGameRun
}
pData = pUncompBuf;
dataOffset = 0;
}
try
{
// Create data reader / 创建数据读取器
CECDataReader dr = new CECDataReader(pData, dataOffset, (int)dwRealLen);
CECDataReader dr = new CECDataReader(pData, (int)dwRealLen);
// Load host configs / 加载主机配置
CECHostPlayer pHost = GetHostPlayer();
@@ -482,4 +481,33 @@ public partial class CECGameRun
}
return null;
}
public string GetProfName(int i)
{
string szRet = null;
if (i >= 0 && i < (int)Profession.NUM_PROFESSION)
{
int[] s_ProfDesc = {
(int)FixedMsg.FIXMSG_PROF_WARRIOR,
(int)FixedMsg.FIXMSG_PROF_MAGE,
(int)FixedMsg.FIXMSG_PROF_MONK,
(int)FixedMsg.FIXMSG_PROF_HAG,
(int)FixedMsg.FIXMSG_PROF_ORC,
(int)FixedMsg.FIXMSG_PROF_GHOST,
(int)FixedMsg.FIXMSG_PROF_ARCHOR,
(int)FixedMsg.FIXMSG_PROF_ANGEL,
(int)FixedMsg.FIXMSG_PROF_JIANLING,
(int)FixedMsg.FIXMSG_PROF_MEILING,
(int)FixedMsg.FIXMSG_PROF_YEYING,
(int)FixedMsg.FIXMSG_PROF_YUEXIAN,
};
CECStringTab pStrTab = EC_Game.GetFixedMsgs();
szRet = pStrTab.GetWideString(s_ProfDesc[i]);
}
else
{
//BMLogger.LogError("CECGameRun::GetProfName, i: {0} is not exist", i);
return null;
}
return szRet;
}
}
+25
View File
@@ -6152,6 +6152,31 @@ namespace BrewMonster
}
}
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct REINCARNATION_TOME
{
public int tome_exp;
public char tome_active; // 1已激活0未激活 / 1 activated 0 not activated
public int max_level; // 历史最高等级 / Historical highest level
public List<cmd_reincarnation_tome_info._entry> reincarnations;
public const int max_exp = 0; // TODO: Set actual value
public void Clear(){
tome_exp = 0;
tome_active = (char)0;
max_level = 0;
if (reincarnations != null)
{
reincarnations.Clear();
}
else
{
reincarnations = new List<cmd_reincarnation_tome_info._entry>();
}
}
};
REINCARNATION_TOME m_ReincarnationTome;
public int GetMaxLevelSofar() { return Math.Max(m_ReincarnationTome.max_level, m_BasicProps.iLevel);}
public CECCounter GetGatherCnt() { return m_GatherCnt; }
public void UpdateTimers(float dwDeltaTime)