虚弱0 度精华0阅读权限30在线时间52 小时
|
- #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[0x5]; // +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[index].m_Type == ITEMGET(13,19) )
- {
- if ( CHECK_LIMIT(item[index].m_Level, 3) != FALSE )
- {
- buf[n+0]=-1;
- buf[n+1]=-1;
- buf[n+2]=-1;
- buf[n+3]=-1;
- buf[n+4]=-1;
- buf[n+5]=-1;
- buf[n+6]=-1;
- buf[n+7]=-1;
- buf[n+8]=-1;
- buf[n+9]=-1;
- buf[n+10]=-1;
- buf[n+11]=-1;
- buf[n+12]=-1;
- buf[n+13]=-1;
- buf[n+14]=-1;
- buf[n+15]=-1;
- n+=16;
- continue;
- }
- }
- if ( item[index].m_Type == ITEMGET(14,64) ) //Season 2.5 Illusion Torch add-on
- {
- buf[n] = -1;
- buf[n+1]= -1;
- buf[n+2]= -1;
- buf[n+3]= -1;
- buf[n+4]= -1;
- buf[n+5]= -1;
- buf[n+6]= -1;
- buf[n+7]= -1;
- buf[n+8]= -1;
- buf[n+9]= -1;
- buf[n+10]=-1;
- buf[n+11]=-1;
- buf[n+12]=-1;
- buf[n+13]=-1;
- buf[n+14]=-1;
- buf[n+15]=-1;
- n += 16;
- continue;
- }
- if ( item[index].m_Type < ITEMGET(0,0) )
- {
- buf[n+0]=-1;
- buf[n+1]=-1;
- buf[n+2]=-1;
- buf[n+3]=-1;
- buf[n+4]=-1;
- buf[n+5]=-1;
- buf[n+6]=-1;
- buf[n+7]=-1;
- buf[n+8]=-1;
- buf[n+9]=-1;
- buf[n+10]=-1;
- buf[n+11]=-1;
- buf[n+12]=-1;
- buf[n+13]=-1;
- buf[n+14]=-1;
- buf[n+15]=-1;
- n+=16;
- }
- else
- {
- memset(buf+n, 0, 16);
- buf[n] = (BYTE)item[index].m_Type % 256;
- n++;
- buf[n]=0;
- buf[n] |= item[index].m_Level * 8;
- buf[n] |= item[index].m_Option1 * 128;
- buf[n] |= item[index].m_Option2 * 4;
- buf[n] |= item[index].m_Option3 & 3;
- n++;
- buf[n] = item[index].m_Durability;
- n++;
- hiWord = item[index].m_Number >> 16;
- loWord = item[index].m_Number & 0xFFFF;
- buf[n] = SET_NUMBERH(hiWord);
- n++;
- buf[n] = SET_NUMBERL(hiWord);
- n++;
- buf[n] = SET_NUMBERH(loWord);
- n++;
- buf[n] = SET_NUMBERL(loWord);
- n++;
- buf[n] = 0;
- BYTE btItemType=0;
- btItemType |= (item[index].m_Type & 0x1E00 ) >> 5;
- buf[n] |= ((item[index].m_Type & 0x100) >> 1);
- if ( item[index].m_Option3 > 3 )
- {
- buf[n] |= 0x40; // item +16 option
- }
- buf[n] |= item[index].m_NewOption;
- n++;
- buf[n] = item[index].m_SetOption;
- n++;
- buf[n] = 0;
- buf[n] |= btItemType;
- BYTE btItemEffectFor380 = 0;
- btItemEffectFor380 = (item[index].m_ItemOptionEx & 0x80 ) >> 4;
- buf[n] |= btItemEffectFor380;
-
- BYTE btPartialyChargeOption = 0;
- btPartialyChargeOption = item[index].m_PeriodItemOption << 1;
- buf[n] |= btPartialyChargeOption;
- n++;
- if ( item[index].m_JewelOfHarmonyOption == 0xFF )
- item[index].m_JewelOfHarmonyOption = 0;
- buf[n] = item[index].m_JewelOfHarmonyOption;
- //Season4 add-on
- if(IsSocekt(item[index].m_Type) >0 || //镶嵌
- IsPentagram(item[index].m_Type )|| IsMuunItem(item[index].m_Type) || IsStoneofEvolution(item[index].m_Type) >0)//元素 宠物 宠物升级道具
- {
- buf[n] = item[index].m_SocketOptionIndex;
- }
- n++;
- buf[n] = item[index].m_SocketOption[0];
- n++;
- buf[n] = item[index].m_SocketOption[1];
- n++;
- buf[n] = item[index].m_SocketOption[2];
- n++;
- buf[n] = item[index].m_SocketOption[3];
- n++;
- buf[n] = item[index].m_SocketOption[4];
- n++;
- }
- }
- }
复制代码
|
|