奇迹mu 物品数据库转换代码
#define CHECK_LIMIT(value, limit) ( ((value)<0)?FALSE:((value)>((limit)-1))?FALSE:TRUE)
#define ITEMGET(x,y) ( (x)*512 + (y))
#define SET_NUMBERH(x) ( (BYTE)((DWORD)(x)>>(DWORD)8) )
#define SET_NUMBERL(x) ( (BYTE)((DWORD)(x) & 0xFF) )
#define SET_NUMBERHW(x) ( (WORD)((DWORD)(x)>>(DWORD)16) )
#define SET_NUMBERLW(x) ( (WORD)((DWORD)(x) & 0xFFFF) )
class CItem // 0xd0
{
public:
ULONG m_Number; // +0x0(0x4 物品序列号
short m_Type; // +0x6(0x2) 物品编号
short m_Level; // +0x8(0x2) 物品等级
float m_Durability; // +0x24(0x4) 耐久
BYTE m_Option1; // +0x84(0x1) 技能
BYTE m_Option2; // +0x85(0x1) 幸运
BYTE m_Option3; // +0x86(0x1) 追加
BYTE m_NewOption; // +0x87(0x1) 卓越
BYTE m_SetOption; // +0x9e(0x1) 套装
BYTE m_JewelOfHarmonyOption; // +0xb4(0x1) 强化属性
BYTE m_ItemOptionEx; // +0xba(0x1) 380属性
BYTE m_SocketOptionIndex; // +0xbb(0x1) 镶嵌荧光属性
BYTE m_SocketOption; // +0xbc(0x5) 镶嵌5洞属性
BYTE m_PeriodItemOption; // +0xc2(0x1) 期限道具物品属性
};
//这个是物品转化为16个BYTE数据存到数据库,可以反推
void ItemByteConvert16(LPBYTE buf, CItem * const item , int maxitem)
{
int n=0;
WORD hiWord, loWord;
for (int index=0; index < maxitem ;index++)
{
if ( item.m_Type == ITEMGET(13,19) )
{
if ( CHECK_LIMIT(item.m_Level, 3) != FALSE )
{
buf=-1;
buf=-1;
buf=-1;
buf=-1;
buf=-1;
buf=-1;
buf=-1;
buf=-1;
buf=-1;
buf=-1;
buf=-1;
buf=-1;
buf=-1;
buf=-1;
buf=-1;
buf=-1;
n+=16;
continue;
}
}
if ( item.m_Type == ITEMGET(14,64) ) //Season 2.5 Illusion Torch add-on
{
buf = -1;
buf= -1;
buf= -1;
buf= -1;
buf= -1;
buf= -1;
buf= -1;
buf= -1;
buf= -1;
buf= -1;
buf=-1;
buf=-1;
buf=-1;
buf=-1;
buf=-1;
buf=-1;
n += 16;
continue;
}
if ( item.m_Type < ITEMGET(0,0) )
{
buf=-1;
buf=-1;
buf=-1;
buf=-1;
buf=-1;
buf=-1;
buf=-1;
buf=-1;
buf=-1;
buf=-1;
buf=-1;
buf=-1;
buf=-1;
buf=-1;
buf=-1;
buf=-1;
n+=16;
}
else
{
memset(buf+n, 0, 16);
buf = (BYTE)item.m_Type % 256;
n++;
buf=0;
buf |= item.m_Level * 8;
buf |= item.m_Option1 * 128;
buf |= item.m_Option2 * 4;
buf |= item.m_Option3 & 3;
n++;
buf = item.m_Durability;
n++;
hiWord = item.m_Number >> 16;
loWord = item.m_Number& 0xFFFF;
buf = SET_NUMBERH(hiWord);
n++;
buf = SET_NUMBERL(hiWord);
n++;
buf = SET_NUMBERH(loWord);
n++;
buf = SET_NUMBERL(loWord);
n++;
buf = 0;
BYTE btItemType=0;
btItemType |= (item.m_Type & 0x1E00 ) >> 5;
buf |= ((item.m_Type & 0x100) >> 1);
if ( item.m_Option3 > 3 )
{
buf |= 0x40; // item +16 option
}
buf |= item.m_NewOption;
n++;
buf = item.m_SetOption;
n++;
buf = 0;
buf |= btItemType;
BYTE btItemEffectFor380 = 0;
btItemEffectFor380 = (item.m_ItemOptionEx & 0x80 ) >> 4;
buf |= btItemEffectFor380;
BYTE btPartialyChargeOption = 0;
btPartialyChargeOption = item.m_PeriodItemOption << 1;
buf |= btPartialyChargeOption;
n++;
if ( item.m_JewelOfHarmonyOption == 0xFF )
item.m_JewelOfHarmonyOption = 0;
buf = item.m_JewelOfHarmonyOption;
//Season4 add-on
if(IsSocekt(item.m_Type) >0 || //镶嵌
IsPentagram(item.m_Type )|| IsMuunItem(item.m_Type) || IsStoneofEvolution(item.m_Type) >0)//元素 宠物宠物升级道具
{
buf = item.m_SocketOptionIndex;
}
n++;
buf = item.m_SocketOption;
n++;
buf = item.m_SocketOption;
n++;
buf = item.m_SocketOption;
n++;
buf = item.m_SocketOption;
n++;
buf = item.m_SocketOption;
n++;
}
}
}
很有看点! 论坛人气好旺! 我裤子脱了,纸都准备好了,你就给我看这个? 最近回了很多帖子,都没人理我! 顶一个! 回帖也有有水平的! 勤奋灌水,天天向上! 支持感谢大佬分享 谢谢分享。收下了
页: [1]2