1080 lines
46 KiB
C#
1080 lines
46 KiB
C#
using BrewMonster.ELEMENT_DATA;
|
||
using BrewMonster.Network;
|
||
using System;
|
||
using System.Collections.Generic;
|
||
using System.Threading.Tasks;
|
||
using UnityEngine;
|
||
using ModelRenderer.Scripts.GameData;
|
||
using System.Runtime.InteropServices;
|
||
namespace BrewMonster
|
||
{
|
||
|
||
|
||
namespace abase
|
||
{
|
||
public static class abase
|
||
{
|
||
const int RAND_MAX = 0x7fff;
|
||
public static int Rand(int lower, int upper)
|
||
{
|
||
if (upper == lower)
|
||
return lower;
|
||
// Handle invalid range where lower > upper
|
||
if (lower > upper)
|
||
{
|
||
// Swap values to ensure valid range
|
||
int temp = lower;
|
||
lower = upper;
|
||
upper = temp;
|
||
}
|
||
return new System.Random().Next(lower, upper);
|
||
}
|
||
|
||
public static float Rand(float lower, float upper)
|
||
{
|
||
float rng = (float)new System.Random().NextDouble();
|
||
return lower + (upper - lower) * rng / (float)RAND_MAX;
|
||
}
|
||
|
||
public static int RandNormal(float lower, float upper) { return (int)Rand(lower, upper); }
|
||
public static float RandUniform() { return Rand(0f, 1f); }
|
||
|
||
public static int RandSelect(List<float> option)
|
||
{
|
||
int num = option.Count;
|
||
float op = RandUniform();
|
||
for (int i = 0; i<num; i++)
|
||
{
|
||
float prob = (float)option[i];
|
||
if (op<prob)
|
||
return i;
|
||
op -= prob;
|
||
}
|
||
//assert(false);
|
||
return 0;
|
||
}
|
||
//static void* fastalloc(size_t size) { return malloc(size); }
|
||
//static void fastfree(void* buf, size_t size) { free(buf); }
|
||
}
|
||
};
|
||
|
||
namespace ELEMENT_DATA
|
||
{
|
||
public enum LOWER { LOWER_TREND };
|
||
public enum UPPER { UPPER_TREND };
|
||
public enum MIDDLE { MIDDLE_TREND };
|
||
public enum ANY { ANY_TREND };
|
||
|
||
public enum NORMAL { NORMAL_RAND };
|
||
public enum SPECIFIC { SPECIFIC_RAND };
|
||
|
||
//struct can not have a parameterless constructor
|
||
public class SpecRand
|
||
{
|
||
public List<int> IndexList;
|
||
public int IdxCap;
|
||
public int IdxIndex;
|
||
public List<float> RandList;
|
||
public int RandCap;
|
||
public int RandIndex;
|
||
//SpecRand() :IndexList(0),IdxCap(0),IdxIndex(0),RandList(0),RandCap(0),RandIndex(0) { }
|
||
|
||
public SpecRand() {
|
||
IndexList = new List<int>();
|
||
IdxCap = 0;
|
||
IdxIndex = 0;
|
||
RandList = new List<float>();
|
||
RandCap = 0;
|
||
RandIndex = 0;
|
||
|
||
}
|
||
public int RandSelect(int num)
|
||
{
|
||
if (IndexList == null || IndexList.Count == 0) return 0;
|
||
if (IdxIndex >= IdxCap) return 0;
|
||
if (num <= 0) return 0;
|
||
int idx = IndexList[IdxIndex++];
|
||
if (idx >= num) idx = num - 1;
|
||
return idx;
|
||
}
|
||
|
||
public int RandNormal(int lower, int upper)
|
||
{
|
||
if (RandList == null || RandList.Count == 0) return lower;
|
||
if (RandIndex >= RandCap) return lower;
|
||
float r = RandList[RandIndex++];
|
||
if (r < 0) r = 0f;
|
||
if (r >= 1.0f) r = 0.9999999f;
|
||
return (int)((upper - lower + 1) * r + lower);
|
||
}
|
||
|
||
public float Rand(float lower, float upper)
|
||
{
|
||
if (RandList == null || RandList.Count == 0) return lower;
|
||
if (RandIndex >= RandCap) return lower;
|
||
float r = RandList[RandIndex++];
|
||
if (r < 0) r = 0f;
|
||
if (r >= 1.0f) r = 0.9999999f;
|
||
return (float)((upper - lower) * r + lower);
|
||
}
|
||
}
|
||
public class SpecCls
|
||
{
|
||
SpecRand imp;
|
||
public SpecCls(SpecRand tmp) {
|
||
imp = tmp;
|
||
}
|
||
//Could be wrong, need to check
|
||
public int RandSelect(List<float> option)
|
||
{
|
||
int num = option.Count;
|
||
if(imp != null) return imp.RandSelect(num);
|
||
return 0;
|
||
}
|
||
|
||
public int RandNormal(int lower, int upper)
|
||
{
|
||
if (imp != null) return imp.RandNormal(lower, upper);
|
||
return lower;
|
||
}
|
||
|
||
public float Rand(float lower, float upper)
|
||
{
|
||
if (imp != null) return imp.Rand(lower, upper);
|
||
return lower;
|
||
}
|
||
}
|
||
public static class element_data
|
||
{
|
||
public static int RandNormal<TCls, TTrend>(int lower, int upper, TCls c ,TTrend trend)
|
||
{
|
||
if(c != null && c.Equals(NORMAL.NORMAL_RAND))
|
||
{
|
||
if (trend != null && trend.Equals(LOWER.LOWER_TREND))
|
||
{
|
||
return abase.abase.RandNormal(lower, upper);
|
||
}
|
||
else if (trend != null && trend.Equals(MIDDLE.MIDDLE_TREND))
|
||
{
|
||
return abase.abase.RandNormal(lower, upper);
|
||
}
|
||
else if (trend != null && trend.Equals(UPPER.UPPER_TREND))
|
||
{
|
||
return abase.abase.RandNormal(lower, upper);
|
||
}
|
||
else if (trend != null && trend.Equals(ANY.ANY_TREND))
|
||
{
|
||
return abase.abase.RandNormal(lower, upper);
|
||
}
|
||
}
|
||
else if(c != null && c.Equals(SPECIFIC.SPECIFIC_RAND))
|
||
{
|
||
if (trend != null && trend.Equals(LOWER.LOWER_TREND))
|
||
{
|
||
return lower;
|
||
}
|
||
else if (trend != null && trend.Equals(MIDDLE.MIDDLE_TREND))
|
||
{
|
||
return (lower + upper) / 2;
|
||
}
|
||
else if (trend != null && trend.Equals(UPPER.UPPER_TREND))
|
||
{
|
||
return upper;
|
||
}
|
||
else if (trend != null && trend.Equals(ANY.ANY_TREND))
|
||
{
|
||
return abase.abase.RandNormal(lower, upper);
|
||
}
|
||
}
|
||
return 0;
|
||
}
|
||
public static int RandSelect<TCls, TTrend>(List<float> option, TCls c, TTrend trend)
|
||
{
|
||
if(c != null && c.Equals(NORMAL.NORMAL_RAND))
|
||
{
|
||
if (trend != null && trend.Equals(LOWER.LOWER_TREND))
|
||
{
|
||
return abase.abase.RandSelect(option);
|
||
}
|
||
else if (trend != null && trend.Equals(MIDDLE.MIDDLE_TREND))
|
||
{
|
||
return abase.abase.RandSelect(option);
|
||
}
|
||
}
|
||
else if(c != null && c.Equals(SPECIFIC.SPECIFIC_RAND))
|
||
{
|
||
if (trend != null && trend.Equals(LOWER.LOWER_TREND))
|
||
{
|
||
return 0;
|
||
}
|
||
else if (trend != null && trend.Equals(MIDDLE.MIDDLE_TREND))
|
||
{
|
||
return option.Count /2;
|
||
}
|
||
}
|
||
return 0;
|
||
}
|
||
public static float Rand<TCls, TTrend>(float lower, float upper, TCls c, TTrend trend)
|
||
{
|
||
if(c != null && c.Equals(NORMAL.NORMAL_RAND))
|
||
{
|
||
if (trend != null && trend.Equals(LOWER.LOWER_TREND))
|
||
{
|
||
return abase.abase.Rand(lower, upper);
|
||
}
|
||
else if (trend != null && trend.Equals(MIDDLE.MIDDLE_TREND))
|
||
{
|
||
return abase.abase.Rand(lower, upper);
|
||
}
|
||
else if (trend != null && trend.Equals(UPPER.UPPER_TREND))
|
||
{
|
||
return abase.abase.Rand(lower, upper);
|
||
}
|
||
else if (trend != null && trend.Equals(ANY.ANY_TREND))
|
||
{
|
||
return abase.abase.Rand(lower, upper);
|
||
}
|
||
}
|
||
else if(c != null && c.Equals(SPECIFIC.SPECIFIC_RAND))
|
||
{
|
||
if (trend != null && trend.Equals(LOWER.LOWER_TREND))
|
||
{
|
||
return lower;
|
||
}
|
||
else if (trend != null && trend.Equals(MIDDLE.MIDDLE_TREND))
|
||
{
|
||
return (lower + upper) / 2;
|
||
}
|
||
else if (trend != null && trend.Equals(UPPER.UPPER_TREND))
|
||
{
|
||
return upper;
|
||
}
|
||
else if (trend != null && trend.Equals(ANY.ANY_TREND))
|
||
{
|
||
return abase.abase.Rand(lower, upper);
|
||
}
|
||
}
|
||
return 0;
|
||
}
|
||
}
|
||
public enum GEN_ADDON_MODE
|
||
{
|
||
ADDON_LIST_SHOP,
|
||
ADDON_LIST_DROP,
|
||
ADDON_LIST_PRODUCE,
|
||
ADDON_LIST_SPEC,
|
||
};
|
||
public enum ITEM_MAKE_TAG
|
||
{
|
||
IMT_NULL,
|
||
IMT_CREATE,
|
||
IMT_DROP,
|
||
IMT_SHOP,
|
||
IMT_PRODUCE,
|
||
IMT_SIGN, //װ����ǩ��
|
||
};
|
||
//#pragma pack(1)
|
||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||
public struct item_tag_t
|
||
{
|
||
public byte type;
|
||
public byte size;
|
||
public item_tag_t(byte type, byte size)
|
||
{
|
||
this.type = type;
|
||
this.size = size;
|
||
}
|
||
};
|
||
//#pragma pack()
|
||
|
||
};// name space element_data
|
||
public struct LOCATION
|
||
{
|
||
public DATA_TYPE type;
|
||
public object pos;
|
||
};
|
||
public struct guid_t
|
||
{
|
||
public int guid1;
|
||
public int guid2;
|
||
}
|
||
public struct item_data
|
||
{
|
||
public uint type; //��Ʒ��ģ��ID
|
||
public int count; //��Ʒ������
|
||
public int pile_limit; //��Ʒ�Ķѵ�����
|
||
public int equip_mask; //��Ʒ�Ŀ�װ����־��0x8000��ʾ����Ƕ��
|
||
public int proc_type; //��Ʒ�Ĵ�����ʽ
|
||
public int classid; //��Ʒ��Ӧ�����ID
|
||
public guid_t guid; //��Ʒ��GUID
|
||
public int price; //��Ʒ�ļ۸�
|
||
public int expire_date; //����ʱ��
|
||
public int content_length;
|
||
public byte[] item_content;
|
||
};
|
||
public struct _item_content
|
||
{
|
||
public prerequisition preq;
|
||
public short sizeofessence; //װ�������С���ֽڣ�;
|
||
// essence //char ����[]; //ÿ�ֲ�ͬװ���ı���ṹ��ͬ
|
||
public int num_hole; //������Ŀ��������;
|
||
// int hole_type[MAX_NUM_HOLES]; //����Ƕ���������[������Ŀ]; //�������ĿΪ0,���������
|
||
public int num_addon; //���Ա���Ŀ����Ŀ��������;
|
||
// _addon ad[MAX_NUM_ADDONS]; //[���Ա���Ŀ����Ŀ];
|
||
};
|
||
public struct addon_data
|
||
{
|
||
public int id;
|
||
public int[] arg;
|
||
public addon_data(int id =0) {
|
||
this.id = id;
|
||
arg = new int[3]{0,0,0};
|
||
}
|
||
};
|
||
public struct prerequisition
|
||
{
|
||
public short level;
|
||
public short race;
|
||
public short strength;
|
||
public short vitality;
|
||
public short agility;
|
||
public short energy;
|
||
public int durability;
|
||
public int max_durability;
|
||
};
|
||
public enum WEAPON_TYPE
|
||
{
|
||
WEAPON_TYPE_MELEE = 0,
|
||
WEAPON_TYPE_RANGE = 1,
|
||
WEAPON_TYPE_MELEE_ASN = 2, //�̿�ʹ�õĽ���������������Ӱ���﹥�⣬�����������ͬ
|
||
};
|
||
|
||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||
public struct _weapon_essence
|
||
{
|
||
|
||
public short weapon_type; //������� ��Ӧģ����Ľ���Զ�̱�־
|
||
public short weapon_delay; //�����Ĺ����ӳ�ʱ�䣬��50msΪ��λ
|
||
public int weapon_class; //�������� ��Ӧģ����Ĵ��� ���絶�� ������
|
||
public int weapon_level; //�������� ijЩ������Ҫ��������
|
||
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_speed;
|
||
public float attack_range;
|
||
public float attack_short_range;
|
||
};
|
||
public static class itemdataman
|
||
{
|
||
#region const
|
||
public const uint ELEMENTDATAMAN_MAX_NUM_ADDON_PARAM = 3;
|
||
public struct _addon //������Ŀ
|
||
{
|
||
public int addon_type;
|
||
public int[] addon_arg; // 0 ~ 3 ��Ŀ�� ((type & 0x6000)>>13)
|
||
public _addon(int addon_type) {
|
||
this.addon_type = addon_type;
|
||
addon_arg = new int[ELEMENTDATAMAN_MAX_NUM_ADDON_PARAM];
|
||
}
|
||
};
|
||
#region Equip Mask
|
||
public const uint ELEMENTDATAMAN_MAX_NUM_HOLES = 5;
|
||
public const uint ELEMENTDATAMAN_MAX_NUM_ADDONS = 32;
|
||
public const uint ELEMENTDATAMAN_EQUIP_MASK_WEAPON = 0x0001;
|
||
public const uint ELEMENTDATAMAN_EQUIP_MASK_HEAD = 0x0002;
|
||
public const uint ELEMENTDATAMAN_EQUIP_MASK_NECK = 0x0004;
|
||
public const uint ELEMENTDATAMAN_EQUIP_MASK_SHOULDER = 0x0008;
|
||
public const uint ELEMENTDATAMAN_EQUIP_MASK_BODY = 0x0010;
|
||
public const uint ELEMENTDATAMAN_EQUIP_MASK_WAIST = 0x0020;
|
||
public const uint ELEMENTDATAMAN_EQUIP_MASK_LEG = 0x0040;
|
||
public const uint ELEMENTDATAMAN_EQUIP_MASK_FOOT = 0x0080;
|
||
public const uint ELEMENTDATAMAN_EQUIP_MASK_WRIST = 0x0100;
|
||
public const uint ELEMENTDATAMAN_EQUIP_MASK_FINGER1 = 0x0200;
|
||
public const uint ELEMENTDATAMAN_EQUIP_MASK_FINGER2 = 0x0400;
|
||
public const uint ELEMENTDATAMAN_EQUIP_MASK_PROJECTILE = 0x0800;
|
||
public const uint ELEMENTDATAMAN_EQUIP_MASK_FLYSWORD = 0x1000;
|
||
public const uint ELEMENTDATAMAN_EQUIP_MASK_DAMAGERUNE = 0x20000;
|
||
public const uint ELEMENTDATAMAN_EQUIP_MASK_BIBLE = 0x40000;
|
||
public const uint ELEMENTDATAMAN_EQUIP_MASK_SPEAKER = 0x80000;
|
||
public const uint ELEMENTDATAMAN_EQUIP_MASK_AUTO_HP = 0x100000;
|
||
public const uint ELEMENTDATAMAN_EQUIP_MASK_AUTO_MP = 0x200000;
|
||
public const uint ELEMENTDATAMAN_EQUIP_MASK_ELF = 0x800000; //lgc
|
||
public const uint ELEMENTDATAMAN_EQUIP_MASK_STALLCARD = 0x1000000;
|
||
public const uint ELEMENTDATAMAN_EQUIP_MASK_FORCE_TICKET = 0x4000000;
|
||
public const uint ELEMENTDATAMAN_EQUIP_MASK_DYNSKILL_ALL = 0x18000000; public const uint ELEMENTDATAMAN_EQUIP_MASK_HAS_ADDON = 0x40000000;
|
||
public const uint ELEMENTDATAMAN_EQUIP_MASK_EXTEND64 = 0x80000000;
|
||
public const uint ELEMENTDATAMAN_EQUIP_MASK_HIGH = 0xC0000000;
|
||
#endregion
|
||
#endregion
|
||
public static Dictionary<uint, LOCATION> sale_item_id_index_map = new Dictionary<uint, LOCATION>();
|
||
public static elementdataman _edm;
|
||
|
||
public static List<byte[]> sale_item_ptr_array = new List<byte[]>();
|
||
public static List<uint> sale_item_size_array = new List<uint>();
|
||
public static int load_data(string pathname, bool disable_bind2)
|
||
{
|
||
_edm = ElementDataManProvider.GetElementDataMan();
|
||
|
||
generate_item_for_sell(disable_bind2);
|
||
return 0;
|
||
// if(await _edm.load_data(pathname) == 0)
|
||
// {
|
||
// generate_item_for_sell(disable_bind2);
|
||
// return 0;
|
||
// }
|
||
// else
|
||
// return -1;
|
||
}
|
||
|
||
public static int generate_item_for_sell(bool disable_bind2)
|
||
{
|
||
|
||
//#define CASE_CLEAR_PROC_TYPE(ESSENCE) case DT_##ESSENCE: \
|
||
// {\
|
||
// DATA_TYPE dt2;\
|
||
// ESSENCE* ess = (ESSENCE*)get_data_ptr(id, ID_SPACE_ESSENCE, dt2); \
|
||
// if (dt2 == datatype && ess && disable_bind2) ess->proc_type &= ~(0x0040);\
|
||
// }
|
||
|
||
byte[] item = null;
|
||
uint size = 0;
|
||
int ret = 0;
|
||
DATA_TYPE datatype = DATA_TYPE.DT_INVALID;
|
||
item_tag_t tag = new item_tag_t((byte)ITEM_MAKE_TAG.IMT_SHOP, (byte)0);
|
||
//uint id = _edm.get_first_data_id(ID_SPACE.ID_SPACE_ESSENCE,ref datatype);
|
||
for (int i = 0; i < _edm.essence_id_data_type_map.Count; i++)
|
||
{
|
||
ret = 0;
|
||
uint id = _edm.get_data_id(ID_SPACE.ID_SPACE_ESSENCE, i, ref datatype);
|
||
switch (datatype)
|
||
{
|
||
case DATA_TYPE.DT_WEAPON_ESSENCE:
|
||
ret = generate_item_temp.generate_weapon(id,ID_SPACE.ID_SPACE_ESSENCE,
|
||
out item,out size,SPECIFIC.SPECIFIC_RAND,GEN_ADDON_MODE.ADDON_LIST_SHOP,tag);
|
||
break;
|
||
case DATA_TYPE.DT_ARMOR_ESSENCE:
|
||
ret = generate_item_temp.generate_armor(id, ID_SPACE.ID_SPACE_ESSENCE,
|
||
out item,out size,SPECIFIC.SPECIFIC_RAND,GEN_ADDON_MODE.ADDON_LIST_SHOP,tag);
|
||
break;
|
||
case DATA_TYPE.DT_DECORATION_ESSENCE:
|
||
ret = generate_item_temp.generate_decoration(id,ID_SPACE.ID_SPACE_ESSENCE,
|
||
out item,out size,SPECIFIC.SPECIFIC_RAND,GEN_ADDON_MODE.ADDON_LIST_SHOP,tag);
|
||
break;
|
||
case DATA_TYPE.DT_PROJECTILE_ESSENCE:
|
||
ret = generate_item_temp.generate_projectile(id,ID_SPACE.ID_SPACE_ESSENCE,
|
||
out item,out size,SPECIFIC.SPECIFIC_RAND);
|
||
break;
|
||
case DATA_TYPE.DT_FASHION_ESSENCE:
|
||
ret = generate_item_temp.generate_fashion_item(id, ID_SPACE.ID_SPACE_ESSENCE, out item, out size, SPECIFIC.SPECIFIC_RAND, tag);
|
||
break;
|
||
case DATA_TYPE.DT_TASKDICE_ESSENCE:
|
||
ret = generate_item_temp.generate_taskdice(id, ID_SPACE.ID_SPACE_ESSENCE, out item, out size, SPECIFIC.SPECIFIC_RAND);
|
||
break;
|
||
case DATA_TYPE.DT_TASKNORMALMATTER_ESSENCE:
|
||
ret = generate_item_temp.generate_tasknormalmatter(id,ID_SPACE.ID_SPACE_ESSENCE,
|
||
out item,out size,SPECIFIC.SPECIFIC_RAND,GEN_ADDON_MODE.ADDON_LIST_SHOP,tag);
|
||
break;
|
||
case DATA_TYPE.DT_WINGMANWING_ESSENCE:
|
||
ret = generate_item_temp.generate_wingmanwing(id, ID_SPACE.ID_SPACE_ESSENCE, out item, out size, SPECIFIC.SPECIFIC_RAND, tag);
|
||
break;
|
||
case DATA_TYPE.DT_MEDICINE_ESSENCE:
|
||
ret = generate_item_temp.generate_medicine(id, ID_SPACE.ID_SPACE_ESSENCE, out item, out size, SPECIFIC.SPECIFIC_RAND);
|
||
break;
|
||
case DATA_TYPE.DT_MATERIAL_ESSENCE:
|
||
ret = generate_item_temp.generate_material(id, ID_SPACE.ID_SPACE_ESSENCE, out item, out size, SPECIFIC.SPECIFIC_RAND);
|
||
break;
|
||
case DATA_TYPE.DT_SKILLTOME_ESSENCE:
|
||
ret = generate_item_temp.generate_skilltome(id, ID_SPACE.ID_SPACE_ESSENCE, out item, out size, SPECIFIC.SPECIFIC_RAND);
|
||
break;
|
||
case DATA_TYPE.DT_PET_EGG_ESSENCE:
|
||
ret = generate_item_temp.generate_pet_egg(id, ID_SPACE.ID_SPACE_ESSENCE, out item, out size, SPECIFIC.SPECIFIC_RAND);
|
||
break;
|
||
case DATA_TYPE.DT_PET_FOOD_ESSENCE:
|
||
ret = generate_item_temp.generate_pet_food(id, ID_SPACE.ID_SPACE_ESSENCE, out item, out size, SPECIFIC.SPECIFIC_RAND);
|
||
break;
|
||
case DATA_TYPE.DT_FLYSWORD_ESSENCE:
|
||
ret = generate_item_temp.generate_flysword(id, ID_SPACE.ID_SPACE_ESSENCE, out item, out size, SPECIFIC.SPECIFIC_RAND, tag);
|
||
break;
|
||
case DATA_TYPE.DT_TOWNSCROLL_ESSENCE:
|
||
ret = generate_item_temp.generate_townscroll(id, ID_SPACE.ID_SPACE_ESSENCE, out item, out size, SPECIFIC.SPECIFIC_RAND);
|
||
break;
|
||
|
||
default:
|
||
ret = -1;
|
||
break;
|
||
}
|
||
//Debug.Log("[THN]return_item_for_sell: ret:" + ret + " size:" + size + " datatype:" + datatype + " id:" + id);
|
||
if (ret == 0 && size != 0)
|
||
{
|
||
sale_item_ptr_array.Add(item);
|
||
sale_item_size_array.Add(size);
|
||
LOCATION loc;
|
||
loc.type = datatype;
|
||
loc.pos = sale_item_ptr_array.Count - 1;
|
||
sale_item_id_index_map[id] = loc;
|
||
}
|
||
#region unimplemented
|
||
|
||
|
||
// CASE_CLEAR_PROC_TYPE(PROJECTILE_ESSENCE)
|
||
|
||
// ret = generate_projectile(id, ID_SPACE_ESSENCE, (char**)&item, size, element_data::SPECIFIC(0));
|
||
// break;
|
||
|
||
|
||
// case DT_QUIVER_ESSENCE:
|
||
// ret = generate_quiver_for_sell(id, ID_SPACE_ESSENCE, (char**)&item, size, element_data::SPECIFIC(0));
|
||
// break;
|
||
|
||
// CASE_CLEAR_PROC_TYPE(STONE_ESSENCE)
|
||
|
||
// ret = generate_stone(id, ID_SPACE_ESSENCE, (char**)&item, size, element_data::SPECIFIC(0));
|
||
// break;
|
||
|
||
// CASE_CLEAR_PROC_TYPE(DECORATION_ESSENCE)
|
||
|
||
// ret = generate_decoration(id, ID_SPACE_ESSENCE, (char**)&item, size, element_data::SPECIFIC(0), element_data::ADDON_LIST_SHOP, &tag, sizeof(tag));
|
||
// break;
|
||
|
||
// CASE_CLEAR_PROC_TYPE(MEDICINE_ESSENCE)
|
||
|
||
// ret = generate_medicine(id, ID_SPACE_ESSENCE, (char**)&item, size, element_data::SPECIFIC(0));
|
||
// break;
|
||
|
||
// CASE_CLEAR_PROC_TYPE(WINGMANWING_ESSENCE)
|
||
|
||
// ret = generate_wingmanwing(id, ID_SPACE_ESSENCE, (char**)&item, size, element_data::SPECIFIC(0), &tag, sizeof(tag));
|
||
// break;
|
||
|
||
// CASE_CLEAR_PROC_TYPE(MATERIAL_ESSENCE)
|
||
|
||
// ret = generate_material(id, ID_SPACE_ESSENCE, (char**)&item, size, (MATERIAL_ESSENCE*)0, DT_MATERIAL_ESSENCE);
|
||
// break;
|
||
|
||
// CASE_CLEAR_PROC_TYPE(DYE_TICKET_ESSENCE)
|
||
|
||
// ret = generate_material(id, ID_SPACE_ESSENCE, (char**)&item, size, (DYE_TICKET_ESSENCE*)0, DT_DYE_TICKET_ESSENCE);
|
||
// break;
|
||
|
||
// CASE_CLEAR_PROC_TYPE(FIREWORKS_ESSENCE)
|
||
|
||
// ret = generate_fireworks(id, ID_SPACE_ESSENCE, (char**)&item, size, element_data::SPECIFIC(0));
|
||
// break;
|
||
|
||
// CASE_CLEAR_PROC_TYPE(WAR_TANKCALLIN_ESSENCE)
|
||
|
||
// ret = generate_tankcallin(id, ID_SPACE_ESSENCE, (char**)&item, size, element_data::SPECIFIC(0));
|
||
// break;
|
||
|
||
// CASE_CLEAR_PROC_TYPE(SKILLMATTER_ESSENCE)
|
||
|
||
// ret = generate_skillmatter(id, ID_SPACE_ESSENCE, (char**)&item, size, element_data::SPECIFIC(0));
|
||
// break;
|
||
|
||
// CASE_CLEAR_PROC_TYPE(DAMAGERUNE_ESSENCE)
|
||
|
||
// ret = generate_damagerune(id, ID_SPACE_ESSENCE, (char**)&item, size, element_data::SPECIFIC(0));
|
||
// break;
|
||
|
||
// CASE_CLEAR_PROC_TYPE(ARMORRUNE_ESSENCE)
|
||
|
||
// ret = generate_armorrune(id, ID_SPACE_ESSENCE, (char**)&item, size, element_data::SPECIFIC(0));
|
||
// break;
|
||
|
||
// CASE_CLEAR_PROC_TYPE(SKILLTOME_ESSENCE)
|
||
|
||
// ret = generate_skilltome(id, ID_SPACE_ESSENCE, (char**)&item, size, element_data::SPECIFIC(0));
|
||
// break;
|
||
|
||
// CASE_CLEAR_PROC_TYPE(FLYSWORD_ESSENCE)
|
||
|
||
// ret = generate_flysword(id, ID_SPACE_ESSENCE, (char**)&item, size, element_data::SPECIFIC(0), &tag, sizeof(tag));
|
||
// break;
|
||
|
||
// CASE_CLEAR_PROC_TYPE(TOWNSCROLL_ESSENCE)
|
||
|
||
// ret = generate_townscroll(id, ID_SPACE_ESSENCE, (char**)&item, size, element_data::SPECIFIC(0));
|
||
// break;
|
||
|
||
// CASE_CLEAR_PROC_TYPE(UNIONSCROLL_ESSENCE)
|
||
|
||
// ret = generate_unionscroll(id, ID_SPACE_ESSENCE, (char**)&item, size, element_data::SPECIFIC(0));
|
||
// break;
|
||
|
||
// CASE_CLEAR_PROC_TYPE(REVIVESCROLL_ESSENCE)
|
||
|
||
// ret = generate_revivescroll(id, ID_SPACE_ESSENCE, (char**)&item, size, element_data::SPECIFIC(0));
|
||
// break;
|
||
|
||
// CASE_CLEAR_PROC_TYPE(ELEMENT_ESSENCE)
|
||
|
||
// ret = generate_element(id, ID_SPACE_ESSENCE, (char**)&item, size, element_data::SPECIFIC(0));
|
||
// break;
|
||
|
||
// CASE_CLEAR_PROC_TYPE(TASKMATTER_ESSENCE)
|
||
|
||
// ret = generate_taskmatter(id, ID_SPACE_ESSENCE, (char**)&item, size, element_data::SPECIFIC(0));
|
||
// break;
|
||
|
||
// CASE_CLEAR_PROC_TYPE(TOSSMATTER_ESSENCE)
|
||
|
||
// ret = generate_tossmatter(id, ID_SPACE_ESSENCE, (char**)&item, size, element_data::SPECIFIC(0));
|
||
// break;
|
||
|
||
// CASE_CLEAR_PROC_TYPE(TASKDICE_ESSENCE)
|
||
|
||
// ret = generate_taskdice(id, ID_SPACE_ESSENCE, (char**)&item, size, element_data::SPECIFIC(0));
|
||
// break;
|
||
|
||
// CASE_CLEAR_PROC_TYPE(TASKNORMALMATTER_ESSENCE)
|
||
|
||
// ret = generate_tasknormalmatter(id, ID_SPACE_ESSENCE, (char**)&item, size, element_data::SPECIFIC(0));
|
||
// break;
|
||
|
||
// CASE_CLEAR_PROC_TYPE(FASHION_ESSENCE)
|
||
|
||
// ret = generate_fashion_item(id, ID_SPACE_ESSENCE, (char**)&item, size, element_data::SPECIFIC(0), &tag, sizeof(tag));
|
||
// break;
|
||
|
||
// CASE_CLEAR_PROC_TYPE(FACEPILL_ESSENCE)
|
||
|
||
// ret = generate_facepill(id, ID_SPACE_ESSENCE, (char**)&item, size, element_data::SPECIFIC(0));
|
||
// break;
|
||
|
||
// CASE_CLEAR_PROC_TYPE(FACETICKET_ESSENCE)
|
||
|
||
// ret = generate_faceticket(id, ID_SPACE_ESSENCE, (char**)&item, size, element_data::SPECIFIC(0));
|
||
// break;
|
||
|
||
// CASE_CLEAR_PROC_TYPE(GM_GENERATOR_ESSENCE)
|
||
|
||
// ret = generate_gm_generator(id, ID_SPACE_ESSENCE, (char**)&item, size, element_data::SPECIFIC(0));
|
||
// break;
|
||
|
||
// CASE_CLEAR_PROC_TYPE(PET_EGG_ESSENCE)
|
||
|
||
// ret = generate_pet_egg(id, ID_SPACE_ESSENCE, (char**)&item, size, element_data::SPECIFIC(0));
|
||
// break;
|
||
|
||
// CASE_CLEAR_PROC_TYPE(PET_FOOD_ESSENCE)
|
||
|
||
// ret = generate_pet_food(id, ID_SPACE_ESSENCE, (char**)&item, size, element_data::SPECIFIC(0));
|
||
// break;
|
||
|
||
// CASE_CLEAR_PROC_TYPE(REFINE_TICKET_ESSENCE)
|
||
|
||
// ret = generate_refine_ticket(id, ID_SPACE_ESSENCE, (char**)&item, size, element_data::SPECIFIC(0));
|
||
// break;
|
||
|
||
// CASE_CLEAR_PROC_TYPE(BIBLE_ESSENCE)
|
||
|
||
// ret = generate_bible(id, ID_SPACE_ESSENCE, (char**)&item, size, element_data::SPECIFIC(0));
|
||
// break;
|
||
|
||
// CASE_CLEAR_PROC_TYPE(SPEAKER_ESSENCE)
|
||
|
||
// ret = generate_speaker(id, ID_SPACE_ESSENCE, (char**)&item, size, element_data::SPECIFIC(0));
|
||
// break;
|
||
|
||
// CASE_CLEAR_PROC_TYPE(AUTOHP_ESSENCE)
|
||
|
||
// ret = generate_hp_amulet(id, ID_SPACE_ESSENCE, (char**)&item, size, element_data::SPECIFIC(0));
|
||
// break;
|
||
|
||
// CASE_CLEAR_PROC_TYPE(AUTOMP_ESSENCE)
|
||
|
||
// ret = generate_mp_amulet(id, ID_SPACE_ESSENCE, (char**)&item, size, element_data::SPECIFIC(0));
|
||
// break;
|
||
|
||
// CASE_CLEAR_PROC_TYPE(DOUBLE_EXP_ESSENCE)
|
||
|
||
// ret = generate_double_exp(id, ID_SPACE_ESSENCE, (char**)&item, size, element_data::SPECIFIC(0));
|
||
// break;
|
||
|
||
// CASE_CLEAR_PROC_TYPE(TRANSMITSCROLL_ESSENCE)
|
||
|
||
// ret = generate_transmitscroll(id, ID_SPACE_ESSENCE, (char**)&item, size, element_data::SPECIFIC(0));
|
||
// break;
|
||
|
||
// CASE_CLEAR_PROC_TYPE(GOBLIN_ESSENCE)
|
||
|
||
// ret = generate_elf(id, ID_SPACE_ESSENCE, (char**)&item, size);
|
||
// break;
|
||
|
||
// CASE_CLEAR_PROC_TYPE(GOBLIN_EQUIP_ESSENCE)
|
||
|
||
// ret = generate_elf_equip(id, ID_SPACE_ESSENCE, (char**)&item, size);
|
||
// break;
|
||
|
||
// CASE_CLEAR_PROC_TYPE(GOBLIN_EXPPILL_ESSENCE)
|
||
|
||
// ret = generate_elf_exppill(id, ID_SPACE_ESSENCE, (char**)&item, size);
|
||
// break;
|
||
|
||
// CASE_CLEAR_PROC_TYPE(SELL_CERTIFICATE_ESSENCE)
|
||
|
||
// ret = generate_stallcard(id, ID_SPACE_ESSENCE, (char**)&item, size);
|
||
// break;
|
||
|
||
// CASE_CLEAR_PROC_TYPE(TARGET_ITEM_ESSENCE)
|
||
|
||
// ret = generate_skilltrigger2(id, ID_SPACE_ESSENCE, (char**)&item, size);
|
||
// break;
|
||
|
||
// CASE_CLEAR_PROC_TYPE(LOOK_INFO_ESSENCE)
|
||
|
||
// ret = generate_queryotherproperty(id, ID_SPACE_ESSENCE, (char**)&item, size);
|
||
// break;
|
||
|
||
// CASE_CLEAR_PROC_TYPE(INC_SKILL_ABILITY_ESSENCE)
|
||
|
||
// ret = generate_incskillability(id, ID_SPACE_ESSENCE, (char**)&item, size);
|
||
// break;
|
||
|
||
// CASE_CLEAR_PROC_TYPE(WEDDING_BOOKCARD_ESSENCE)
|
||
|
||
// ret = generate_wedding_bookcard(id, ID_SPACE_ESSENCE, (char**)&item, size);
|
||
// break;
|
||
|
||
// CASE_CLEAR_PROC_TYPE(WEDDING_INVITECARD_ESSENCE)
|
||
|
||
// ret = generate_wedding_invitecard(id, ID_SPACE_ESSENCE, (char**)&item, size);
|
||
// break;
|
||
|
||
// CASE_CLEAR_PROC_TYPE(SHARPENER_ESSENCE)
|
||
|
||
// ret = generate_sharpener(id, ID_SPACE_ESSENCE, (char**)&item, size);
|
||
// break;
|
||
|
||
// CASE_CLEAR_PROC_TYPE(FACTION_MATERIAL_ESSENCE)
|
||
|
||
// ret = generate_factionmaterial(id, ID_SPACE_ESSENCE, (char**)&item, size);
|
||
// break;
|
||
|
||
// CASE_CLEAR_PROC_TYPE(CONGREGATE_ESSENCE)
|
||
|
||
// ret = generate_congregate(id, ID_SPACE_ESSENCE, (char**)&item, size);
|
||
// break;
|
||
|
||
// CASE_CLEAR_PROC_TYPE(FORCE_TOKEN_ESSENCE)
|
||
|
||
// ret = generate_force_ticket(id, ID_SPACE_ESSENCE, (char**)&item, size);
|
||
// break;
|
||
|
||
// CASE_CLEAR_PROC_TYPE(DYNSKILLEQUIP_ESSENCE)
|
||
|
||
// ret = generate_dynskillequip(id, ID_SPACE_ESSENCE, (char**)&item, size);
|
||
// break;
|
||
|
||
// CASE_CLEAR_PROC_TYPE(MONEY_CONVERTIBLE_ESSENCE)
|
||
|
||
// ret = generate_moneyconvertibleitem(id, ID_SPACE_ESSENCE, (char**)&item, size);
|
||
// break;
|
||
|
||
// CASE_CLEAR_PROC_TYPE(MONSTER_SPIRIT_ESSENCE)
|
||
|
||
// ret = generate_soul(id, ID_SPACE_ESSENCE, (char**)&item, size);
|
||
// break;
|
||
|
||
// CASE_CLEAR_PROC_TYPE(POKER_ESSENCE)
|
||
|
||
// ret = generate_generalcard(id, ID_SPACE_ESSENCE, (char**)&item, size, element_data::SPECIFIC(0));
|
||
// break;
|
||
|
||
// CASE_CLEAR_PROC_TYPE(POKER_DICE_ESSENCE)
|
||
|
||
// ret = generate_generalcard_dice(id, ID_SPACE_ESSENCE, (char**)&item, size);
|
||
// break;
|
||
|
||
// CASE_CLEAR_PROC_TYPE(SHOP_TOKEN_ESSENCE)
|
||
|
||
// ret = generate_shoptoken(id, ID_SPACE_ESSENCE, (char**)&item, size);
|
||
// break;
|
||
|
||
// CASE_CLEAR_PROC_TYPE(UNIVERSAL_TOKEN_ESSENCE)
|
||
|
||
// ret = generate_universal_token(id, ID_SPACE_ESSENCE, (char**)&item, size);
|
||
// break;
|
||
|
||
// case DT_MONSTER_ESSENCE:
|
||
// case DT_NPC_ESSENCE:
|
||
// default:
|
||
// continue;
|
||
|
||
// }
|
||
#endregion
|
||
}
|
||
return 0;
|
||
}
|
||
|
||
|
||
private static item_data deserialize_item_data(byte[] buffer)
|
||
{
|
||
// Deserialize item_data from byte array
|
||
// Layout matches generate_item_temp.cs serialization order
|
||
// type (uint), count (uint written as 1), pile_limit (int), equip_mask (int),
|
||
// proc_type (uint), classid (int), guid1 (int), guid2 (int), price (int), expire_date (int),
|
||
// content_length (int), item_content pointer (int)
|
||
int offset = 0;
|
||
item_data item = new item_data();
|
||
|
||
item.type = BitConverter.ToUInt32(buffer, offset); offset += 4;
|
||
// count is written as uint but struct has int, read as uint then cast
|
||
item.count = (int)BitConverter.ToUInt32(buffer, offset); offset += 4;
|
||
item.pile_limit = BitConverter.ToInt32(buffer, offset); offset += 4;
|
||
item.equip_mask = BitConverter.ToInt32(buffer, offset); offset += 4;
|
||
// proc_type is written as uint but struct has int, read as uint then cast
|
||
item.proc_type = (int)BitConverter.ToUInt32(buffer, offset); offset += 4;
|
||
item.classid = BitConverter.ToInt32(buffer, offset); offset += 4;
|
||
item.guid.guid1 = BitConverter.ToInt32(buffer, offset); offset += 4;
|
||
item.guid.guid2 = BitConverter.ToInt32(buffer, offset); offset += 4;
|
||
item.price = BitConverter.ToInt32(buffer, offset); offset += 4;
|
||
item.expire_date = BitConverter.ToInt32(buffer, offset); offset += 4;
|
||
item.content_length = BitConverter.ToInt32(buffer, offset); offset += 4;
|
||
|
||
// item_content is stored as an offset/pointer in the buffer (points to where content starts)
|
||
int item_content_offset = BitConverter.ToInt32(buffer, offset); offset += 4;
|
||
// Extract the actual content bytes
|
||
if (item.content_length > 0 && item_content_offset > 0 && item_content_offset < buffer.Length)
|
||
{
|
||
int contentStart = item_content_offset;
|
||
int contentEnd = Math.Min(contentStart + item.content_length, buffer.Length);
|
||
int actualLength = contentEnd - contentStart;
|
||
if (actualLength > 0)
|
||
{
|
||
item.item_content = new byte[actualLength];
|
||
Array.Copy(buffer, contentStart, item.item_content, 0, actualLength);
|
||
}
|
||
else
|
||
{
|
||
item.item_content = new byte[0];
|
||
}
|
||
}
|
||
else
|
||
{
|
||
item.item_content = new byte[0];
|
||
}
|
||
return item;
|
||
}
|
||
|
||
public static object get_item_for_sell(uint id)
|
||
{
|
||
LOCATION itr;
|
||
bool result = sale_item_id_index_map.TryGetValue(id, out itr);
|
||
if (result)
|
||
{
|
||
// itr.pos contains the index into sale_item_ptr_array
|
||
int index = (int)itr.pos;
|
||
if (index >= 0 && index < sale_item_ptr_array.Count)
|
||
{
|
||
byte[] itemBuffer = sale_item_ptr_array[index];
|
||
if (itemBuffer != null && itemBuffer.Length > 0)
|
||
{
|
||
item_data item = deserialize_item_data(itemBuffer);
|
||
return item;
|
||
}
|
||
}
|
||
}
|
||
return null;
|
||
}
|
||
|
||
public static uint generate_equipment_addon_buffer_2
|
||
(DATA_TYPE essencetype,
|
||
List<int> candidate_addon,
|
||
byte[] addon_buffer, int start_offset,
|
||
uint addon_num)
|
||
{
|
||
|
||
//���ɶ��addon�����ܻ��в�������ʧ��
|
||
//if(addon_num == 0)
|
||
//return 0;
|
||
byte[] addon_sld = addon_buffer;
|
||
int i,j;
|
||
int anum = 0;
|
||
int offset = start_offset;
|
||
for(i=0; i<candidate_addon.Count; i++)
|
||
{
|
||
int id = candidate_addon[i];
|
||
if(id <= 0) continue;
|
||
|
||
//��ʼ���� addon
|
||
addon_data addondata = new addon_data();
|
||
int rparanum;
|
||
if((rparanum = generate_addon(essencetype,(uint)id, ref addondata)) < 0) continue;
|
||
|
||
//*(int*)addon_sld = (addondata.id &(~(0x3<<13))) | (rparanum<<13);
|
||
//addon_sld += sizeof(int);
|
||
int value = (addondata.id & (~(0x3 << 13))) | (rparanum << 13);
|
||
byte[] intBytes = BitConverter.GetBytes(value);
|
||
Array.Copy(intBytes, 0, addon_buffer, offset, 4);
|
||
offset += 4;
|
||
|
||
anum ++;
|
||
for(j=0; j<rparanum; j++)
|
||
{
|
||
//*(int*)addon_sld = addondata.arg[j];
|
||
//addon_sld += sizeof(int);
|
||
value = addondata.arg[j];
|
||
intBytes = BitConverter.GetBytes(value);
|
||
Array.Copy(intBytes, 0, addon_buffer, offset, 4);
|
||
offset += 4;
|
||
}
|
||
}
|
||
return (uint)(addon_sld.Length - start_offset);
|
||
}
|
||
|
||
|
||
public static int generate_addon(DATA_TYPE datatype,uint addon_id, ref addon_data data)
|
||
{
|
||
DATA_TYPE dt = DATA_TYPE.DT_INVALID;
|
||
int paramnum = 0;
|
||
object temp = _edm.get_data_ptr(addon_id, ID_SPACE.ID_SPACE_ADDON, ref dt);
|
||
if(temp == null)
|
||
{
|
||
return -1;
|
||
}
|
||
EQUIPMENT_ADDON addon = (EQUIPMENT_ADDON) temp;
|
||
if(dt != DATA_TYPE.DT_EQUIPMENT_ADDON) // error
|
||
{
|
||
return -1;
|
||
}
|
||
else
|
||
{
|
||
data.id = (int)addon_id;
|
||
if(data.arg == null)
|
||
{
|
||
data.arg = new int[3]{0,0,0};
|
||
}
|
||
paramnum = addon.num_params;
|
||
data.arg[0] = addon.param1;
|
||
data.arg[1] = addon.param2;
|
||
data.arg[2] = addon.param3;
|
||
}
|
||
|
||
return EC_Game.addon_generate_arg(datatype, data, paramnum);
|
||
}
|
||
|
||
public static void generate_template_addon<RAN_CLASS>(
|
||
DATA_TYPE dt,float unique_prob,
|
||
List<int> unique, List<int> produce, List<int> drop, byte[] addon_buf,
|
||
ref uint addon_num,ref uint addon_size, RAN_CLASS cls,GEN_ADDON_MODE normal_addon,List<int> sa_list)
|
||
{
|
||
if(normal_addon == GEN_ADDON_MODE.ADDON_LIST_DROP)
|
||
{
|
||
uint un = 0;
|
||
//ASSERT(addon_size == 0);
|
||
if(element_data.Rand<RAN_CLASS, LOWER>(0f,1f,cls,LOWER.LOWER_TREND) < unique_prob)
|
||
{
|
||
un = 1;
|
||
addon_size = generate_equipment_addon_buffer(dt, unique, 16, addon_buf,0, un);
|
||
addon_num -= un;
|
||
}
|
||
addon_size += generate_equipment_addon_buffer(dt, drop, 32, addon_buf, (int)addon_size, addon_num);
|
||
addon_num += un;
|
||
}
|
||
else if(normal_addon == GEN_ADDON_MODE.ADDON_LIST_PRODUCE)
|
||
{
|
||
uint un = 0;
|
||
//ASSERT(addon_size == 0);
|
||
if(element_data.Rand<RAN_CLASS, LOWER>(0f,1f,cls,LOWER.LOWER_TREND) < unique_prob)
|
||
{
|
||
un = 1;
|
||
addon_size = generate_equipment_addon_buffer(dt, unique, 16, addon_buf,0, un);
|
||
addon_num -= un;
|
||
}
|
||
addon_size += generate_equipment_addon_buffer(dt, produce, 32, addon_buf, (int)addon_size, addon_num);
|
||
addon_num += un;
|
||
}
|
||
else if (normal_addon == GEN_ADDON_MODE.ADDON_LIST_SPEC)
|
||
{
|
||
addon_size = generate_spec_addon_buffer(dt,addon_buf, 0, itemdataman.ELEMENTDATAMAN_MAX_NUM_ADDONS, addon_num,sa_list);
|
||
}
|
||
else
|
||
{
|
||
addon_size = 0;
|
||
addon_num = 0;
|
||
}
|
||
}
|
||
|
||
public static uint generate_equipment_addon_buffer
|
||
(DATA_TYPE essencetype,
|
||
List<int> candidate_addon,
|
||
int candidate_num,
|
||
byte[] addon_buffer,
|
||
int start_offset,
|
||
uint addon_num)
|
||
{
|
||
if(addon_num == 0) return 0;
|
||
int[] addon_list = new int[32];
|
||
int i;
|
||
uint anum;
|
||
//����addon���������
|
||
for(anum = 0,i=0; i<addon_num; i++)
|
||
{
|
||
// float * prob_header =(float*) (candidate_header + sizeof(unsigned int));
|
||
// int addon_index = abase::RandSelect(prob_header, sizeof(unsigned int)+sizeof(float), candidate_num);
|
||
// int id = *(int*)(candidate_header + addon_index*(sizeof(unsigned int)+sizeof(float)));
|
||
uint id = (uint)candidate_addon[i];
|
||
if(id <= 0) continue;
|
||
/*
|
||
//�������ɶ��һ����addon
|
||
for(j =0; j < anum ; j ++)
|
||
{
|
||
if(addon_list[j] == id) break;
|
||
}
|
||
if(j != anum) continue;
|
||
*/
|
||
addon_list[anum++] = (int)id;
|
||
|
||
|
||
}
|
||
addon_num = anum;
|
||
|
||
List<int> addon_list_converted = new List<int>();
|
||
for (int j = 0; j < anum; j++)
|
||
{
|
||
addon_list_converted.Add(addon_list[j]);
|
||
}
|
||
return generate_equipment_addon_buffer_2(essencetype, addon_list_converted, addon_buffer, start_offset, addon_num);
|
||
}
|
||
|
||
public static uint generate_spec_addon_buffer
|
||
(DATA_TYPE essencetype,
|
||
byte[] addon_buffer,
|
||
int start_offset,
|
||
uint max_addon_size,
|
||
uint addon_num,
|
||
List<int> sa_list)
|
||
{
|
||
addon_num = 0;
|
||
if(sa_list.Count == 0) return 0;
|
||
int i;
|
||
for(i = 0; i < max_addon_size; i ++)
|
||
{
|
||
if(sa_list[i] <= 0) break;
|
||
}
|
||
if(i == 0 ) return 0;
|
||
addon_num = (uint)i;
|
||
return generate_equipment_addon_buffer_2(essencetype,sa_list,addon_buffer,start_offset, addon_num);
|
||
}
|
||
public static void get_item_guid( uint id, out int g1, out int g2)
|
||
{
|
||
EC_Game.get_item_guid(id,out g1,out g2);
|
||
}
|
||
public static int addon_update_ess_data(addon_data data, object essence,int ess_size, prerequisition require)
|
||
{
|
||
return EC_Game.addon_update_ess_data(data, essence, ess_size, require);
|
||
}
|
||
public static void update_require_data(ref prerequisition require)
|
||
{
|
||
EC_Game.update_require_data(ref require);
|
||
}
|
||
public static void set_to_classid(DATA_TYPE type, byte[] data, int major_type)
|
||
{
|
||
EC_Game.set_to_classid(type, data, major_type);
|
||
}
|
||
}
|
||
|
||
} |