diff --git a/src/controller.cpp b/src/controller.cpp index b766350..21ccc7a 100644 --- a/src/controller.cpp +++ b/src/controller.cpp @@ -39,8 +39,8 @@ void Controller::init() 08179043 0x1 97 B8 0817904E 0x1 8C AD */ - Mem::WriteUChar((void*)(0x08179043), 0xB8); //异界被击 - Mem::WriteUChar((void*)(0x0817904E), 0xAD); //异界被击 + Mem::WriteUChar((void*)(0x08179043), 0xB8); + Mem::WriteUChar((void*)(0x0817904E), 0xAD); @@ -50,7 +50,7 @@ void Controller::init() mhook_UseJewel_dispatch_sig.Hook((void**)&old_UseJewel_dispatch_sig, (void*)hook_UseJewel_dispatch_sig); - mhook_UseJewel_dispatch_sig.Hook((void**)&old_Dispatcher_ModItemAttr_dispatch_sig, (void*)hook_Dispatcher_ModItemAttr_dispatch_sig); + mhook_Dispatcher_ModItemAttr_dispatch_sig.Hook((void**)&old_Dispatcher_ModItemAttr_dispatch_sig, (void*)hook_Dispatcher_ModItemAttr_dispatch_sig); mhook_PacketDispatcher_doDispatch.Hook((void**)&old_PacketDispatcher_doDispatch, (void*)hook_PacketDispatcher_doDispatch); @@ -88,186 +88,33 @@ int Controller::hook_IPacketDispatcher_ParamBase_dispatch_template(int a1, int a int Controller::hook_UseJewel_dispatch_sig(void* pDispatcher_UseJewel, CUser* user, PacketBuf* pBuf) { - printf("getCurCharacName :%s \n", user->getCurCharacName().c_str()); - printf("getCurCharacNo :%d \n", user->getCurCharacNo()); - printf("get_buf_ptr :%p %p \n", pBuf->get_buf_ptr(0)); - printf("get_len :%d \n", pBuf->get_len()); - - // printf("pBuf :%s \n", Util::ToHexString((const unsigned char*)pBuf->get_buf_ptr(0),40).c_str()); - int state = user->get_state(); - LOG("state :%d \n", state); - //校验角色状态是否允许镶嵌 - if (state != 3) - return 0; - - int isEnableAvatarSocketAction = user->isEnableAvatarSocketAction(); - if (isEnableAvatarSocketAction) - user->SendCmdErrorPacket(205, (unsigned char)isEnableAvatarSocketAction); - //解析packet_buf - - //时装所在的背包槽 - int avartar_inven_slot = pBuf->get_short(); - LOG("avartar_inven_slot :%d \n", avartar_inven_slot); - //时装item_id - int avartar_item_id = pBuf->get_int(); - LOG("avartar_item_id :%d \n", avartar_item_id); - //本次镶嵌徽章数量 - int emblem_cnt = pBuf->get_byte(); - LOG("emblem_cnt :%d \n", emblem_cnt); - - if (user->CheckItemLock(2, avartar_inven_slot)) - { - user->SendCmdErrorPacket(205, 213); - return 0; - } - - //获取时装道具 - CInventory* inven = user->getCurCharacInvenW(); - if (!inven) - { - LOG("pUser->getCurCharacInvenW : error \n"); - return 0; - } - Inven_Item* avartar = inven->GetInvenRef(CInventory::INVENTORY_TYPE_AVARTAR, avartar_inven_slot); - if (!avartar) - { - LOG("inven->GetInvenRef : error \n"); - return 0; - } - //校验时装 数据是否合法 - if (avartar->isEmpty() || (avartar->getKey() != avartar_item_id) || user->CheckItemLock(2, avartar_inven_slot)) - { - - LOG("avartar->isEmpty() || avartar->getKey() || pUser->CheckItemLock() : error \n"); - return 0; - } - //获取时装插槽数据 - WongWork::CAvatarItemMgr* avartar_add_info = avartar->get_add_info(); - WongWork::CAvatarItemMgr* inven_avartar_mgr = inven->GetAvatarItemMgrR(); - int jewel_socket_data = inven_avartar_mgr->getJewelSocketData(avartar_add_info); - if (!jewel_socket_data) - { - LOG("jewel_socket_data : error \n"); - return 0; - } - - LOG("jewel_socket_data :%s \n", Util::ToHexString((const unsigned char*)jewel_socket_data, 40).c_str()); - if (emblem_cnt <= 3) - { - std::map> emblems; - for (int i = 0; i < emblem_cnt; i++) - { - //徽章所在的背包槽 - int emblem_inven_slot = pBuf->get_short(); - //徽章item_id - int emblem_item_id = pBuf->get_int(); - //该徽章镶嵌的时装插槽id - int avartar_socket_slot = pBuf->get_byte(); - - //获取徽章道具 - Inven_Item* emblem = inven->GetInvenRef(CInventory::INVENTORY_TYPE_ITEM, emblem_inven_slot); - //校验徽章及插槽数据是否合法 - if (emblem->isEmpty() || (emblem->getKey() != emblem_item_id) || (avartar_socket_slot >= 3)) - { - LOG("emblem->isEmpty() || (emblem->getKey() : error \n"); - user->SendCmdErrorPacket(205, 209); - return 0; - } - - //校验徽章是否满足时装插槽颜色要求 - - //获取徽章pvf数据 - CDataManager* DataManager = CDataManager::G_CDataManager(); - if (!DataManager) - { - LOG("CDataManager::G_CDataManager() : error \n"); - user->SendCmdErrorPacket(205, 209); - return 0; - } - CStackableItem* citem = (CStackableItem*)DataManager->find_item(emblem_item_id); - if (!citem) - { - LOG("DataManager->find_item() : error \n"); - user->SendCmdErrorPacket(205, 209); - return 0; - } - - //校验徽章类型 - if (!citem->is_stackable() || (citem->GetItemType() != 20)) - { - LOG("citem->is_stackable() || (citem->GetItemType() : error \n"); - user->SendCmdErrorPacket(205, 209); - return 0; - } - - //获取徽章支持的插槽 - int emblem_socket_type = citem->getJewelTargetSocket(); - - //获取要镶嵌的时装插槽类型 - int avartar_socket_type = *(short*)(jewel_socket_data + avartar_socket_slot * 6); - if (!(emblem_socket_type & avartar_socket_type)) - { - //插槽类型不匹配 - LOG("emblem_socket_type & avartar_socket_type\n"); - user->SendCmdErrorPacket(205, 209); - return 0; - } - LOG("avartar_socket_slot:%d emblem_inven_slot:%d emblem_item_id:%d\n", avartar_socket_slot, emblem_inven_slot, emblem_item_id); - emblems[avartar_socket_slot] = std::make_pair(emblem_inven_slot, emblem_item_id); - } - LOG("数据已读取!!!\n"); - - for (auto& avartar_socket_slot : emblems) - { - //删除徽章 - int emblem_inven_slot = avartar_socket_slot.second.first; - inven->delete_item(CInventory::INVENTORY_TYPE_ITEM, emblem_inven_slot, 1, 8, 1); - - //设置时装插槽数据 - int emblem_item_id = avartar_socket_slot.second.second; - *(int*)(jewel_socket_data + avartar_socket_slot.first * 6 + 2) = emblem_item_id; - LOG("徽章item_id=%d 已成功镶嵌进avartar_socket_slot=%d 的槽内!\n", emblem_item_id, avartar_socket_slot); - } - - //时装插槽数据存档 - DB_UpdateAvatarJewelSlot::makeRequest(user->getCurCharacNo(), avartar->get_ui_id(), (void*)jewel_socket_data); - - //通知客户端时装数据已更新 - user->SendUpdateItemList(1, 1, avartar_inven_slot); - LOG("徽章镶嵌完毕!!!"); - //回包给客户端 - InterfacePacketBuf* packet_guard = (InterfacePacketBuf*)PacketGuard::NewPacketGuard(); - - packet_guard->put_header(1, 204); - packet_guard->put_int(1); - packet_guard->finalize(1); - user->Send((PacketGuard*)packet_guard); - PacketGuard::DelPacketGuard((PacketGuard*)packet_guard); - } - + ENUM_PACK_RET_TYPE ret = CDispatch::Get()->UseJewel_dispatch_sig(pDispatcher_UseJewel, user, pBuf); + int result = (ret == PAK_ERROR) ? 1 : 0; // 08217C06 分解 - return 0; + return result; } int Controller::hook_Dispatcher_ModItemAttr_dispatch_sig(Dispatcher_ModItemAttr* dis_mod, CUser* user, PacketBuf* pBuf) { PacketBuf new_buf; memcpy(&new_buf, pBuf, sizeof(PacketBuf)); - int equipment_pos = new_buf.get_short(); - int equipment_id = new_buf.get_int(); - int item_pos = new_buf.get_short(); + short equipment_pos = 0; + int equipment_id = 0; + short item_pos = 0; + + if ((unsigned __int8)new_buf.get_short(&equipment_pos) != 1 + || (unsigned __int8)new_buf.get_int(&equipment_id) != 1 + || (unsigned __int8)new_buf.get_short(&item_pos) != 1) + { + user->SendCmdErrorPacket(84, -1); + return 0; + } + CInventory* CurCharacInvenW = user->getCurCharacInvenR(); auto item_inven = CurCharacInvenW->GetInvenRef(CInventory::INVENTORY_TYPE_ITEM, item_pos); - LOG(u8"UseEquipmentMoveItem [ equipment_pos:%d equipment_id:%d item_pos:%d item_id:%d ]" - , equipment_pos - , equipment_id - , item_pos - , item_inven->getKey() - ); - if (!item_inven->isEmpty() && item_inven->getKey() == ITEM_ID_YIJIRUHUN) { ENUM_PACK_RET_TYPE ret = CDispatch::Get()->Dispatcher_ModItemAttr_dispatch_sig(dis_mod, user, pBuf); @@ -312,7 +159,7 @@ int Controller::hook_PacketDispatcher_doDispatch(PacketDispatcher* a1, CUser* us , packet_class , packet_id , packet_len - , Util::ToHexString((const unsigned char*)packet_src, packet_len).c_str() + , Utils::ToHexString((const unsigned char*)packet_src, packet_len).c_str() ); if (v25) diff --git a/src/df_main.cpp b/src/df_main.cpp index 92a013d..90c65ef 100644 --- a/src/df_main.cpp +++ b/src/df_main.cpp @@ -532,6 +532,18 @@ int _Inter_LoadEtc_dispatch_sig(void* pThis, void* pUser, char* a3) +void PrintTag() +{ + printf("\n"); + LOG("**********************************************************"); + LOG(" DNF Server Plugin %s ", MY_VERSION); + LOG(" "); + LOG(" /\\ /\\ "); + LOG(" "); + LOG(" __ "); + LOG(" By:Vance "); + LOG("**********************************************************"); +} void loga() { @@ -621,22 +633,6 @@ void loga() } -void PrintTag() -{ - printf("\n"); - LOG("**********************************************************"); - LOG(" DNF Server Plugin %s ", MY_VERSION); - LOG(" "); - LOG(" /\\ /\\ "); - LOG(" "); - LOG(" __ "); - LOG(" By:Vance "); - LOG("**********************************************************"); -} - - - - void __attribute__((constructor)) my_init(void) { //patchGame(); diff --git a/src/dispatch.cpp b/src/dispatch.cpp index 7608dbc..1fb2725 100644 --- a/src/dispatch.cpp +++ b/src/dispatch.cpp @@ -23,7 +23,6 @@ ENUM_PACK_RET_TYPE CDispatch::UseEquipmentMoveItem(CUser* user, PacketBuf* pBuf) if (user->get_state() != 3) { - LOG(u8"玩家状态不正常!"); return PAK_IGNORE; } @@ -34,10 +33,19 @@ ENUM_PACK_RET_TYPE CDispatch::UseEquipmentMoveItem(CUser* user, PacketBuf* pBuf) return PAK_IGNORE; } - LOG(u8"UseEquipmentMoveItem :%s ", Util::ToHexString((const unsigned char*)pBuf->get_buf_ptr(0), 40).c_str()); - int equipment_pos = pBuf->get_short(); //装备位置 - int equipment_id = pBuf->get_int(); //装备代码 - int item_pos = pBuf->get_short(); //物品位置 + LOG(u8"UseEquipmentMoveItem :%s ", Utils::ToHexString((const unsigned char*)pBuf->get_buf_ptr(0), 40).c_str()); + + short equipment_pos = 0; + int equipment_id = 0; + short item_pos = 0; + + if ((unsigned __int8)pBuf->get_short(&equipment_pos) != 1 + || (unsigned __int8)pBuf->get_int(&equipment_id) != 1 + || (unsigned __int8)pBuf->get_short(&item_pos) != 1) + { + user->SendCmdErrorPacket(84, -1); + return PAK_IGNORE; + } //1 物品栏 2 时装 if (user->CheckItemLock(1, equipment_pos)) @@ -94,8 +102,8 @@ ENUM_PACK_RET_TYPE CDispatch::UseEquipmentMoveItem(CUser* user, PacketBuf* pBuf) return PAK_IGNORE; } - CItem* equipment_citem = DataManager->find_item(equipment_id); - CItem* item_citem = DataManager->find_item(item_id); + CEquipItem* equipment_citem = (CEquipItem*)DataManager->find_item(equipment_id); + CStackableItem* item_citem = (CStackableItem*)DataManager->find_item(item_id); LOG(u8"equipment_citem +12: %p" , *(int*)equipment_citem + 12 ); @@ -227,9 +235,17 @@ ENUM_PACK_RET_TYPE CDispatch::Dispatcher_ModItemAttr_dispatch_sig(Dispatcher_Mod user->SendCmdErrorPacket(84, 0xD1u); return PAK_IGNORE; } - int equipment_pos = pBuf->get_short(); - int equipment_id = pBuf->get_int(); - int item_pos = pBuf->get_short(); + short equipment_pos = 0; + int equipment_id = 0; + short item_pos = 0; + + if ((unsigned __int8)pBuf->get_short(&equipment_pos) != 1 + || (unsigned __int8)pBuf->get_int(&equipment_id) != 1 + || (unsigned __int8)pBuf->get_short(&item_pos) != 1) + { + user->SendCmdErrorPacket(84, -1); + return PAK_IGNORE; + } auto CurCharacInvenW = (CInventory*)user->getCurCharacInvenW(); Inven_Item equipment_inven = {}; @@ -301,9 +317,176 @@ ENUM_PACK_RET_TYPE CDispatch::Dispatcher_ModItemAttr_dispatch_sig(Dispatcher_Mod CInventory::INVENTORY_TYPE_ITEM, equipment_pos, equipment_inven); - + dis_mod->_SendResult(user, 1, item_pos, equipment_pos); return PAK_IGNORE; } +ENUM_PACK_RET_TYPE CDispatch::UseJewel_dispatch_sig(void* pDispatcher_UseJewel, CUser* user, PacketBuf* pBuf) +{ + printf("getCurCharacName :%s \n", user->getCurCharacName().c_str()); + printf("getCurCharacNo :%d \n", user->getCurCharacNo()); + printf("get_buf_ptr :%p %p \n", pBuf->get_buf_ptr(0)); + printf("get_len :%d \n", pBuf->get_len()); + + // printf("pBuf :%s \n", Util::ToHexString((const unsigned char*)pBuf->get_buf_ptr(0),40).c_str()); + int state = user->get_state(); + LOG("state :%d \n", state); + //校验角色状态是否允许镶嵌 + if (state != 3) + return PAK_IGNORE; + + int isEnableAvatarSocketAction = user->isEnableAvatarSocketAction(); + if (isEnableAvatarSocketAction) + user->SendCmdErrorPacket(205, (unsigned char)isEnableAvatarSocketAction); + //解析packet_buf + + short avartar_inven_slot = 0; //时装所在的背包槽 + int avartar_item_id = 0; //时装item_id + char emblem_cnt = 0; //本次镶嵌徽章数量 + + if ((unsigned __int8)pBuf->get_short(&avartar_inven_slot) != 1 + || (unsigned __int8)pBuf->get_int(&avartar_item_id) != 1 + || (unsigned __int8)pBuf->get_byte(&emblem_cnt) != 1) + { + user->SendCmdErrorPacket(205, -1); + return PAK_IGNORE; + } + + if (user->CheckItemLock(2, avartar_inven_slot)) + { + user->SendCmdErrorPacket(205, 213); + return PAK_IGNORE; + } + + //获取时装道具 + CInventory* inven = user->getCurCharacInvenW(); + if (!inven) + { + LOG("pUser->getCurCharacInvenW : error \n"); + return PAK_IGNORE; + } + Inven_Item* avartar = inven->GetInvenRef(CInventory::INVENTORY_TYPE_AVARTAR, avartar_inven_slot); + if (!avartar) + { + LOG("inven->GetInvenRef : error \n"); + return PAK_IGNORE; + } + //校验时装 数据是否合法 + if (avartar->isEmpty() || (avartar->getKey() != avartar_item_id) || user->CheckItemLock(2, avartar_inven_slot)) + { + + LOG("avartar->isEmpty() || avartar->getKey() || pUser->CheckItemLock() : error \n"); + return PAK_IGNORE; + } + //获取时装插槽数据 + WongWork::CAvatarItemMgr* avartar_add_info = (WongWork::CAvatarItemMgr*)avartar->get_add_info(); + WongWork::CAvatarItemMgr* inven_avartar_mgr = inven->GetAvatarItemMgrR(); + int jewel_socket_data = inven_avartar_mgr->getJewelSocketData(avartar_add_info); + if (!jewel_socket_data) + { + LOG("jewel_socket_data : error \n"); + return PAK_IGNORE; + } + + LOG("jewel_socket_data :%s \n", Utils::ToHexString((const unsigned char*)jewel_socket_data, 40).c_str()); + if (emblem_cnt <= 3) + { + std::map> emblems; + for (int i = 0; i < emblem_cnt; i++) + { + //徽章所在的背包槽 + short emblem_inven_slot = 0; + pBuf->get_short(&emblem_inven_slot); + //徽章item_id + int emblem_item_id = 0; + pBuf->get_int(&emblem_item_id); + //该徽章镶嵌的时装插槽id + char avartar_socket_slot = 0; + pBuf->get_byte(&avartar_socket_slot); + + //获取徽章道具 + Inven_Item* emblem = inven->GetInvenRef(CInventory::INVENTORY_TYPE_ITEM, emblem_inven_slot); + //校验徽章及插槽数据是否合法 + if (emblem->isEmpty() || (emblem->getKey() != emblem_item_id) || (avartar_socket_slot >= 3)) + { + LOG("emblem->isEmpty() || (emblem->getKey() : error \n"); + user->SendCmdErrorPacket(205, 209); + return PAK_IGNORE; + } + + //校验徽章是否满足时装插槽颜色要求 + + //获取徽章pvf数据 + CDataManager* DataManager = CDataManager::G_CDataManager(); + if (!DataManager) + { + LOG("CDataManager::G_CDataManager() : error \n"); + user->SendCmdErrorPacket(205, 209); + return PAK_IGNORE; + } + CStackableItem* citem = (CStackableItem*)DataManager->find_item(emblem_item_id); + if (!citem) + { + LOG("DataManager->find_item() : error \n"); + user->SendCmdErrorPacket(205, 209); + return PAK_IGNORE; + } + + //校验徽章类型 + if (!citem->is_stackable() || (citem->GetItemType() != 20)) + { + LOG("citem->is_stackable() || (citem->GetItemType() : error \n"); + user->SendCmdErrorPacket(205, 209); + return PAK_IGNORE; + } + + //获取徽章支持的插槽 + int emblem_socket_type = citem->getJewelTargetSocket(); + + //获取要镶嵌的时装插槽类型 + int avartar_socket_type = *(short*)(jewel_socket_data + avartar_socket_slot * 6); + if (!(emblem_socket_type & avartar_socket_type)) + { + //插槽类型不匹配 + LOG("emblem_socket_type & avartar_socket_type\n"); + user->SendCmdErrorPacket(205, 209); + return PAK_IGNORE; + } + LOG("avartar_socket_slot:%d emblem_inven_slot:%d emblem_item_id:%d\n", avartar_socket_slot, emblem_inven_slot, emblem_item_id); + emblems[avartar_socket_slot] = std::make_pair(emblem_inven_slot, emblem_item_id); + } + LOG("数据已读取!!!\n"); + + for (auto& avartar_socket_slot : emblems) + { + //删除徽章 + int emblem_inven_slot = avartar_socket_slot.second.first; + inven->delete_item(CInventory::INVENTORY_TYPE_ITEM, emblem_inven_slot, 1, 8, 1); + + //设置时装插槽数据 + int emblem_item_id = avartar_socket_slot.second.second; + *(int*)(jewel_socket_data + avartar_socket_slot.first * 6 + 2) = emblem_item_id; + LOG("徽章item_id=%d 已成功镶嵌进avartar_socket_slot=%d 的槽内!\n", emblem_item_id, avartar_socket_slot); + } + + //时装插槽数据存档 + DB_UpdateAvatarJewelSlot::makeRequest(user->getCurCharacNo(), avartar->get_ui_id(), (void*)jewel_socket_data); + + //通知客户端时装数据已更新 + user->SendUpdateItemList(1, 1, avartar_inven_slot); + LOG("徽章镶嵌完毕!!!"); + //回包给客户端 + InterfacePacketBuf* packet_guard = (InterfacePacketBuf*)PacketGuard::NewPacketGuard(); + + packet_guard->put_header(1, 204); + packet_guard->put_int(1); + packet_guard->finalize(1); + user->Send((PacketGuard*)packet_guard); + PacketGuard::DelPacketGuard((PacketGuard*)packet_guard); + return PAK_OK; + } + return PAK_IGNORE; +} + diff --git a/src/dispatch.h b/src/dispatch.h index 5e45d8e..ecfe1ea 100644 --- a/src/dispatch.h +++ b/src/dispatch.h @@ -4,7 +4,7 @@ #include "import.h" #include "inline_hook.h" #include "Singleton.h" -#include "sdk_class.h" +#include "./sdk/sdk_class.h" #include "utils.h" class CDispatch @@ -18,6 +18,9 @@ public: ENUM_PACK_RET_TYPE Dispatcher_ModItemAttr_dispatch_sig(Dispatcher_ModItemAttr* dis_mod, CUser* user, PacketBuf* pBuf); + ENUM_PACK_RET_TYPE UseJewel_dispatch_sig(void* pDispatcher_UseJewel, CUser* user, PacketBuf* pBuf); + + protected: diff --git a/src/sdk/AccountCargo.h b/src/sdk/AccountCargo.h new file mode 100644 index 0000000..3028e34 --- /dev/null +++ b/src/sdk/AccountCargo.h @@ -0,0 +1,145 @@ +#pragma once +#ifndef __ACCOUNTCARGO_H__ +#define __ACCOUNTCARGO_H__ + +#pragma pack(push, 0x01) + +class CAccountCargo +{ +public: + + int GetCapacity() + { + return CallT(base::CAccountCargo::GetCapacity, this); + } + int GetMoney() + { + return CallT(base::CAccountCargo::GetMoney, this); + } + int SetDBData(CUser* a2, Inven_Item* a3, uint a4, uint a5) + { + return CallT(base::CAccountCargo::SetDBData, this, a2, a3, a4, a5); + } + int Clear() + { + return CallT(base::CAccountCargo::Clear, this); + } + int ResetSlot(int a2) + { + return CallT(base::CAccountCargo::ResetSlot, this, a2); + } + int* GetSlot(int a2) + { + return CallT(base::CAccountCargo::GetSlot, this, a2); + } + int GetSlotRef(int a2) + { + return CallT(base::CAccountCargo::GetSlotRef, this, a2); + } + int CheckInsertCondition(Inven_Item* a2) + { + return CallT(base::CAccountCargo::CheckInsertCondition, this, a2); + } + int InsertItem(Inven_Item* a2, int a3) + { + return CallT(base::CAccountCargo::InsertItem, this, a2, a3); + } + int DeleteItem(int a2, int a3) + { + return CallT(base::CAccountCargo::DeleteItem, this, a2, a3); + } + int MoveItem(int a2, int a3) + { + return CallT(base::CAccountCargo::MoveItem, this, a2, a3); + } + int DepositMoney(uint a2) + { + return CallT(base::CAccountCargo::DepositMoney, this, a2); + } + int WithdrawMoney(uint a2) + { + return CallT(base::CAccountCargo::WithdrawMoney, this, a2); + } + int CheckMoneyLimit(uint a2) + { + return CallT(base::CAccountCargo::CheckMoneyLimit, this, a2); + } + int CheckValidSlot(int a2) + { + return CallT(base::CAccountCargo::CheckValidSlot, this); + } + int GetEmptySlot() + { + return CallT(base::CAccountCargo::GetEmptySlot, this); + } + int CheckSlotEmpty(int a2) + { + return CallT(base::CAccountCargo::CheckSlotEmpty, this, a2); + } + int GetSpecificItemSlot(int a2) + { + return CallT(base::CAccountCargo::GetSpecificItemSlot, this, a2); + } + int CheckStackLimit(int a2, int a3, int a4) + { + return CallT(base::CAccountCargo::CheckStackLimit, this); + } + int AddMoney(uint a2) + { + return CallT(base::CAccountCargo::AddMoney, this, a2); + } + int SubMoney(uint a2) + { + return CallT(base::CAccountCargo::SubMoney, this, a2); + } + int GetItemCount() + { + return CallT(base::CAccountCargo::GetItemCount, this); + } + int SendNotifyMoney(int a2) + { + return CallT(base::CAccountCargo::SendNotifyMoney, this, a2); + } + int SendItemList() + { + return CallT(base::CAccountCargo::SendItemList, this); + } + int MakeItemPacket(PacketGuard* a2, int a3) + { + return CallT(base::CAccountCargo::MakeItemPacket, this, a2, a3); + } + int CreateAccountCargo(CUser* a2) + { + return CallT(base::CAccountCargo::CreateAccountCargo, this, a2); + } + int UpgradeAccountCargo(CUser* a2) + { + return CallT(base::CAccountCargo::UpgradeAccountCargo, this, a2); + } + int SendNotifyRecipe(CUser* a2, int a3, bool a4) + { + return CallT(base::CAccountCargo::SendNotifyRecipe, this, a2, a3, a4); + } + int DeleteAccountCargo(CUser* a2) + { + return CallT(base::CAccountCargo::DeleteAccountCargo, this, a2); + } + int SetStable() + { + return CallT(base::CAccountCargo::SetStable, this); + } + int SetCapacity(uint a2) + { + return CallT(base::CAccountCargo::SetCapacity, this, a2); + } + int IsAlter(void) + { + return CallT(base::CAccountCargo::IsAlter, this); + } + +}; + +#pragma pack(pop) + +#endif // __ACCOUNTCARGO_H__ + diff --git a/src/sdk/DataManager.h b/src/sdk/DataManager.h new file mode 100644 index 0000000..db43f26 --- /dev/null +++ b/src/sdk/DataManager.h @@ -0,0 +1,28 @@ +#pragma once +#ifndef __DATAMANAGER_H__ +#define __DATAMANAGER_H__ + +#pragma pack(push, 0x01) + + +class CDataManager +{ +public: + static CDataManager* G_CDataManager(void) + { + typedef CDataManager* (*__func)(void); + return ((__func)base::CDataManager::G_CDataManager)(); + } + + //获取装备pvf数据 + CItem* find_item(int a2) + { + typedef CItem* (*__func)(CDataManager* a1, int a2); + return ((__func)base::CDataManager::find_item)(this, a2); + } +}; + +#pragma pack(pop) + +#endif // __DATAMANAGER_H__ + diff --git a/src/sdk/Inventory.h b/src/sdk/Inventory.h new file mode 100644 index 0000000..e5adcc8 --- /dev/null +++ b/src/sdk/Inventory.h @@ -0,0 +1,71 @@ +#pragma once +#ifndef __INVENTORY_H__ +#define __INVENTORY_H__ +#pragma pack(push, 0x01) + + +class CInventory +{ +public: + + enum INVEN_TYPE : int + { + INVENTORY_TYPE_BODY = 0, //身上穿的装备 + INVENTORY_TYPE_ITEM = 1, //物品栏 + INVENTORY_TYPE_AVARTAR = 2, //时装栏 + }; + +public: + //获取时装管理器 + WongWork::CAvatarItemMgr* GetAvatarItemMgrR() + { + typedef WongWork::CAvatarItemMgr* (*__func)(void* a1); + return ((__func)base::CInventory::GetAvatarItemMgrR)(this); + } + + int delete_item(INVEN_TYPE a2, int pos, int num, int a5, int a6 = 1) + { + typedef int (*__func)(CInventory* a1, INVEN_TYPE a2, int a3, int a4, int a5, int a6); + return ((__func)base::CInventory::delete_item)(this, a2, pos, num, a5, a6); + } + + //使用金币 + int use_money(int a2, int a3, char a4) + { + typedef int (*__func)(CInventory* a1, int a2, int a3, char a4); + return ((__func)base::CInventory::use_money)(this, a2, a3, a4); + } + + //获得金币 + int gain_money(unsigned int a2, int a3, char a4, int a5) + { + typedef int (*__func)(CInventory* a1, unsigned int a2, int a3, char a4, int a5); + return ((__func)base::CInventory::gain_money)(this, a2, a3, a4, a5); + } + + //获取背包槽中的道具 + Inven_Item* GetInvenRef(INVEN_TYPE a2, int a3) + { + typedef Inven_Item* (*__func)(CInventory* a1, INVEN_TYPE a2, int a3); + return ((__func)base::CInventory::GetInvenRef)(this, a2, a3); + } + + Inven_Item* GetInvenSlot(Inven_Item* a2, INVEN_TYPE a3, int a4) + { + typedef Inven_Item* (__attribute__((__stdcall__))* fnCInventory_GetInvenSlot)(Inven_Item* dest, CInventory* pThis, int space, int location); + static fnCInventory_GetInvenSlot CInventory_GetInvenSlot = (fnCInventory_GetInvenSlot)(base::CInventory::GetInvenSlot); + return CInventory_GetInvenSlot(a2, this, a3, a4); + } + + int update_item(INVEN_TYPE a2, int a3, Inven_Item a4) + { + return CallT(base::CInventory::update_item, this, a2, a3, a4); + } + +}; + + +#pragma pack(pop) + +#endif // __INVENTORY_H__ + diff --git a/src/sdk/Item.h b/src/sdk/Item.h new file mode 100644 index 0000000..a366cee --- /dev/null +++ b/src/sdk/Item.h @@ -0,0 +1,346 @@ +#pragma once +#ifndef __ITEM_H__ +#define __ITEM_H__ + +#pragma pack(push, 0x01) + + +class CItem +{ +public: + + /** + * @brief 是否为消耗品 + * @return + */ + bool is_stackable() + { + typedef bool (*__func)(CItem* a1); + return ((__func)base::CItem::is_stackable)(this); + } + + bool IsRoutingItem() + { + typedef bool (*__func)(CItem* a1); + return ((__func)base::CItem::IsRoutingItem)(this); + } + + /** + * @brief 取附加类型 + * @return + */ + int GetAttachType() + { + return CallT(base::CItem::GetAttachType, this); + } + + int GetCashPrice() + { + return CallT(base::CItem::GetCashPrice, this); + } + + int GetDyeInfo() + { + return CallT(base::CItem::GetDyeInfo, this); + } + + int GetExpertJobAdditionalExp(int a2) + { + return CallT(base::CItem::GetExpertJobAdditionalExp, this, a2); + } + + int GetExpertJobCompoundMaterialVariation() + { + return CallT(base::CItem::GetExpertJobCompoundMaterialVariation, this); + } + + int GetExpertJobCompoundRateVariation() + { + return CallT(base::CItem::GetExpertJobCompoundRateVariation, this); + } + + int GetExpertJobCompoundResultVariation(int a2) + { + return CallT(base::CItem::GetExpertJobCompoundResultVariation, this, a2); + } + + int GetExpertJobSelfDisjointBigWinRate() + { + return CallT(base::CItem::GetExpertJobSelfDisjointBigWinRate, this); + } + + int GetExpertJobSelfDisjointResultVariation() + { + return CallT(base::CItem::GetExpertJobSelfDisjointResultVariation, this); + } + + int GetFinishPointPrice() + { + return CallT(base::CItem::GetFinishPointPrice, this); + } + + int GetIncreaseStatusIntData(int a2, int& a3) + { + return CallT(base::CItem::GetIncreaseStatusIntData, this, a2, a3); + } + + int GetIncreaseStatusType() + { + return CallT(base::CItem::GetIncreaseStatusType, this); + } + + int GetItemIconName() + { + return CallT(base::CItem::GetItemIconName, this); + } + + int GetItemName() + { + return CallT(base::CItem::GetItemName, this); + } + + int GetMedalPrice() + { + return CallT(base::CItem::GetMedalPrice, this); + } + + int GetNeedLevel() + { + return CallT(base::CItem::GetNeedLevel, this); + } + + int GetNeedMaterial() + { + return CallT(base::CItem::GetNeedMaterial, this); + } + + int GetQuestItemDropBouns() + { + return CallT(base::CItem::GetQuestItemDropBouns, this); + } + + int GetRandomOptionGrade() + { + return CallT(base::CItem::GetRandomOptionGrade, this); + } + + int GetSellPrice() + { + return CallT(base::CItem::GetSellPrice, this); + } + + int GetUpSkillType() + { + return CallT(base::CItem::GetUpSkillType, this); + } + + int GetUsablePvPRank() + { + return CallT(base::CItem::GetUsablePvPRank, this); + } + + int getAdvanceAltarNeedGage() + { + return CallT(base::CItem::getAdvanceAltarNeedGage, this); + } + + int getExpirationDate() + { + return CallT(base::CItem::getExpirationDate, this); + } + + int getFootControlRateLimit() + { + return CallT(base::CItem::getFootControlRateLimit, this); + } + + int getItemGroupName() + { + return CallT(base::CItem::getItemGroupName, this); + } + + int getUsableLevel() + { + return CallT(base::CItem::getUsableLevel, this); + } + + int getUsablePeriod() + { + return CallT(base::CItem::getUsablePeriod, this); + } + + int get_gen_rate() + { + return CallT(base::CItem::get_gen_rate, this); + } + + int get_grade() + { + return CallT(base::CItem::get_grade, this); + } + + int get_index() + { + return CallT(base::CItem::get_index, this); + } + + int get_need_skill() + { + return CallT(base::CItem::get_need_skill, this); + } + + int get_price() + { + return CallT(base::CItem::get_price, this); + } + + int get_rarity() + { + return CallT(base::CItem::get_rarity, this); + } + + + + +private: +}; + +class CStackableItem : public CItem +{ +public: + //获取消耗品类型 + int GetItemType() + { + typedef int (*__func)(void* a1); + return ((__func)base::CStackableItem::GetItemType)(this); + } + + //获取徽章支持的镶嵌槽类型 + int getJewelTargetSocket() + { + typedef int (*__func)(CStackableItem* a1); + return ((__func)base::CStackableItem::getJewelTargetSocket)(this); + } +}; + +class CEquipItem : public CItem +{ +public: + int GetItemType() + { + return CallT(base::CEquipItem::GetItemType, this); + } + +}; + +class Inven_Item +{ +public: + unsigned char package; + unsigned char UnknownData_NUSL[0x3C]; + +public: + + //获取道具附加信息 + int get_add_info() + { + typedef int (*__func)(Inven_Item* a1); + return ((__func)base::Inven_Item::get_add_info)(this); + } + + //检查背包中道具是否为空 + bool isEmpty() + { + typedef bool (*__func)(Inven_Item* a1); + return ((__func)base::Inven_Item::isEmpty)(this); + } + //获取背包中道具item_id + int getKey() + { + typedef int (*__func)(Inven_Item* a1); + return ((__func)base::Inven_Item::getKey)(this); + } + //道具是否是装备 + bool isEquipableItemType() + { + typedef bool (*__func)(Inven_Item* a1); + return ((__func)base::Inven_Item::isEquipableItemType)(this); + } + + int get_ui_id() + { + return *(int*)(this + 0x7); + } + + bool IsTradeLimitAttachTypeItem() + { + return CallT(base::Inven_Item::IsTradeLimitAttachTypeItem, this); + } + + int GetItemSpace() + { + return CallT(base::Inven_Item::GetItemSpace, this); + } + + int SetReSealCount(uchar a2) + { + return CallT(base::Inven_Item::SetReSealCount, this, a2); + } + + int GetReSealCount() + { + return CallT(base::Inven_Item::GetReSealCount, this); + } + + +}; + +class DB_UpdateAvatarJewelSlot +{ +public: + static int makeRequest(int a1, unsigned int a2, void* src) + { + typedef int (*__func)(int a1, unsigned int a2, void* src); + return ((__func)base::DB_UpdateAvatarJewelSlot::makeRequest)(a1, a2, src); + } +}; + +class Dispatcher_ModItemAttr +{ +public: + int _SendResult(CUser* a2, ushort a3, ushort a4, ushort a5) + { + return CallT(base::Dispatcher_ModItemAttr::_SendResult, this, a2, a3, a4, a5); + } + + +}; + +class stMoveItemParam +{ +public: + static stMoveItemParam* NewstMoveItemParam() + { + void* v62 = malloc(0x20000); + if (!v62) return NULL; + CallT(base::stMoveItemParam::stMoveItemParam_make, v62); + return (stMoveItemParam*)v62; + } + + static void DelstMoveItemParam(stMoveItemParam* a1) + { + CallT(base::stMoveItemParam::stMoveItemParam_destroy, a1); + free(a1); + } + + static void DelstMoveItemParam2(stMoveItemParam* a1) + { + CallT(base::stMoveItemParam::stMoveItemParam_del, a1); + } + + +}; +#pragma pack(pop) + +#endif // __ITEM_H__ + diff --git a/src/sdk/PacketBuf.h b/src/sdk/PacketBuf.h new file mode 100644 index 0000000..9345073 --- /dev/null +++ b/src/sdk/PacketBuf.h @@ -0,0 +1,341 @@ +#pragma once +#ifndef __PACKETBUF_H__ +#define __PACKETBUF_H__ +#pragma pack(push, 0x01) + + +class PacketBuf +{ +public: + unsigned char UnknownData_0000[0x20000]; + +public: + PacketBuf() + { + memset(UnknownData_0000, 0, sizeof(UnknownData_0000)); + CallT(base::PacketBuf::PacketBuf_make, this); + } + + ~PacketBuf() + { + CallT(base::PacketBuf::PacketBuf_destroy, this); + } + + static PacketBuf* NewPacketBuf() + { + void* v62 = malloc(0x20000); + if (!v62) return NULL; + return CallT(base::PacketBuf::PacketBuf_make, v62); + } + + static void DelPacketBuf(PacketBuf* a1) + { + CallT(base::PacketBuf::PacketBuf_destroy, a1); + free(a1); + } + + int at(int a2) + { + return CallT(base::PacketBuf::at, this, a2); + } + + int bind_packet(char* a2, int a3) + { + return CallT(base::PacketBuf::bind_packet, this, a2, a3); + } + + int clear() + { + return CallT(base::PacketBuf::clear, this); + } + + int clear_ptr() + { + return CallT(base::PacketBuf::clear_ptr, this); + } + + int compress_packet() + { + return CallT(base::PacketBuf::compress_packet, this); + } + + int copy(PacketBuf const& a2) + { + return CallT(base::PacketBuf::copy, this, a2); + } + + int encFinalize() + { + return CallT(base::PacketBuf::encFinalize, this); + } + + int encrypt_packet() + { + return CallT(base::PacketBuf::encrypt_packet, this); + } + + int finalize(bool a2) + { + return CallT(base::PacketBuf::finalize, this, a2); + } + + int getLastError() + { + return CallT(base::PacketBuf::getLastError, this); + } + + int get_binary(char* a2, int a3) + { + return CallT(base::PacketBuf::get_binary, this, a2, a3); + } + + int get_buf_ptr(int a2) + { + return CallT(base::PacketBuf::get_buf_ptr, this, a2); + } + + int get_byte(char* a2) + { + return CallT(base::PacketBuf::get_byte, this, a2); + } + + int get_byte_u(uchar* a2) + { + return CallT(base::PacketBuf::get_byte_u, this, a2); + } + + int get_index() + { + return CallT(base::PacketBuf::get_index, this); + } + + int get_int(int* a2) + { + return CallT(base::PacketBuf::get_int, this, a2); + } + + int get_int_u(uint* a2) + { + return CallT(base::PacketBuf::get_int_u, this, a2); + } + + int get_int_ul(ulong* a2) + { + return CallT(base::PacketBuf::get_int_ul, this, a2); + } + + int get_item_idx(ulong* a2) + { + return CallT(base::PacketBuf::get_item_idx, this, a2); + } + + int get_len() + { + return CallT(base::PacketBuf::get_len, this); + } + + int get_packet(int a2) + { + return CallT(base::PacketBuf::get_packet, this, a2); + } + + int get_short(short* a2) + { + return CallT(base::PacketBuf::get_short, this, a2); + } + + int get_short_u(ushort* a2) + { + return CallT(base::PacketBuf::get_short_u, this, a2); + } + + int get_str(char* a2, int a3, int a4) + { + return CallT(base::PacketBuf::get_str, this, a2, a3, a4); + } + + int isCompressRequired(char* a2) + { + return CallT(base::PacketBuf::isCompressRequired, this, a2); + } + + int isEncryptRequired() + { + return CallT(base::PacketBuf::isEncryptRequired, this); + } + + int is_finallized() + { + return CallT(base::PacketBuf::is_finallized, this); + } + + int is_len_end(int a2) + { + return CallT(base::PacketBuf::is_len_end, this, a2); + } + + int is_ptr_end(int a2, int a3) + { + return CallT(base::PacketBuf::is_ptr_end, this, a2, a3); + } + + int put_binary(char* a2, int a3) + { + return CallT(base::PacketBuf::put_binary, this, a2, a3); + } + + int put_binary_c(char const* a2, int a3) + { + return CallT(base::PacketBuf::put_binary_c, this, a2, a3); + } + + int put_byte(int a2) + { + return CallT(base::PacketBuf::put_byte, this, a2); + } + + int put_header(int a2, int a3) + { + return CallT(base::PacketBuf::put_header, this, a2, a3); + } + + int put_int(int a2) + { + return CallT(base::PacketBuf::put_int, this, a2); + } + + int put_item_idx(ulong a2) + { + return CallT(base::PacketBuf::put_item_idx, this, a2); + } + + int put_packet(Inven_Item const& a2) + { + return CallT(base::PacketBuf::put_packet, this, a2); + } + + int put_short(int a2) + { + return CallT(base::PacketBuf::put_short, this, a2); + } + + int put_str(char* a2, int a3) + { + return CallT(base::PacketBuf::put_str, this, a2, a3); + } + + int put_str_c(char const* a2, int a3) + { + return CallT(base::PacketBuf::put_str_c, this, a2, a3); + } + + int setLastError(int a2) + { + return CallT(base::PacketBuf::setLastError, this, a2); + } + + int set_index(int a2) + { + return CallT(base::PacketBuf::set_index, this, a2); + } + + int set_packet(char const* a2, int a3) + { + return CallT(base::PacketBuf::set_packet, this, a2, a3); + } + + +}; + + + +class InterfacePacketBuf +{ +public: + int put_header(int a2, int a3) + { + typedef int (*__func)(InterfacePacketBuf* a1, int a2, int a3); + return ((__func)base::InterfacePacketBuf::put_header)(this, a2, a3); + } + + int put_byte(char a2) + { + typedef int (*__func)(InterfacePacketBuf* a1, char a2); + return ((__func)base::InterfacePacketBuf::put_byte)(this, a2); + } + int put_short(short a2) + { + typedef int (*__func)(InterfacePacketBuf* a1, short a2); + return ((__func)base::InterfacePacketBuf::put_short)(this, a2); + } + + int put_int(int a2) + { + typedef int (*__func)(InterfacePacketBuf* a1, int a2); + return ((__func)base::InterfacePacketBuf::put_int)(this, a2); + } + + int put_binary(char* a2, int a3) + { + typedef int (*__func)(InterfacePacketBuf* a1, char* a2, int a3); + return ((__func)base::InterfacePacketBuf::put_binary)(this, a2, a3); + } + + int finalize(bool a2) + { + typedef int (*__func)(InterfacePacketBuf* a1, bool a2); + return ((__func)base::InterfacePacketBuf::finalize)(this, a2); + } + + int put_str(const char* a2, int a3) + { + typedef int (*__func)(InterfacePacketBuf* a1, const char* a2, int a3); + return ((__func)base::InterfacePacketBuf::put_str)(this, a2, a3); + } + + int put_packet(const Inven_Item* a2) + { + typedef int (*__func)(InterfacePacketBuf* a1, const Inven_Item* a2); + return ((__func)base::InterfacePacketBuf::put_packet)(this, a2); + } +}; + +class PacketGuard +{ +public: + static PacketGuard* NewPacketGuard() + { + void* v62 = malloc(0x20000); + typedef int (*__func)(void* a1); + if (!v62) return NULL; + ((__func)base::PacketGuard::PacketGuard_make)(v62); + return (PacketGuard*)v62; + } + static void DelPacketGuard(PacketGuard* a1) + { + typedef int (*__func)(void* a1); + ((__func)base::PacketGuard::PacketGuard_destroy)(a1); + free(a1); + } +}; + +class PacketDispatcher +{ +public: + int getDispatcher(int a2) + { + typedef int (*__func)(PacketDispatcher* a1, int a2); + return ((__func)base::PacketDispatcher::getDispatcher)(this, a2); + } + + void** get_dispatcher(int a2) + { + typedef void** (*__func)(PacketDispatcher* a1, int a2); + return ((__func)base::PacketDispatcher::get_dispatcher)(this, a2); + } +}; + +#pragma pack(pop) + +#endif // __PACKETBUF_H__ + diff --git a/src/sdk/User.h b/src/sdk/User.h new file mode 100644 index 0000000..69bc9ff --- /dev/null +++ b/src/sdk/User.h @@ -0,0 +1,159 @@ +#pragma once +#ifndef __CUSER_H__ +#define __CUSER_H__ + +#pragma pack(push, 0x01) + + +class CUserCharacInfo +{ +public: + //获取角色名字 + std::string getCurCharacName() + { + typedef char* (*__func)(CUserCharacInfo* a1); + return std::string(((__func)base::CUserCharacInfo::getCurCharacName)(this)); + } + + //获取角色编号 + int getCurCharacNo() + { + typedef int (*__func)(CUserCharacInfo* a1); + return int(((__func)base::CUserCharacInfo::getCurCharacNo)(this)); + } + + //获取角色上次退出游戏时间 + int getCurCharacLastPlayTick() + { + typedef int (*__func)(CUserCharacInfo* a1); + return int(((__func)base::CUserCharacInfo::getCurCharacLastPlayTick)(this)); + } + + //获取角色等级 + int get_level_up_exp(int a2) + { + typedef int (*__func)(CUserCharacInfo* a1, int a2); + return int(((__func)base::CUserCharacInfo::get_level_up_exp)(this, a2)); + } + + //获取角色背包 + CInventory* getCurCharacInvenW() + { + typedef CInventory* (*__func)(CUserCharacInfo* a1); + return ((__func)base::CUserCharacInfo::getCurCharacInvenW)(this); + } + + bool _checkItemMovable(int a2, int a3, int a4, int a5, int a6, int a7) + { + CallT(base::CUserCharacInfo::_checkItemMovable, this, a2, a3, a4, a5, a6, a7); + } + + CInventory* getCurCharacInvenR() + { + return CallT(base::CUserCharacInfo::getCurCharacInvenR, this); + } + + int getCurCharacR() + { + return CallT(base::CUserCharacInfo::getCurCharacR, this); + } + +}; + +class CUser : public CUserCharacInfo +{ +public: + int get_state() + { + typedef int (*__func)(CUser* a1); + return int(((__func)base::CUser::get_state)(this)); + } + + /** + * @brief 检查物品锁定 + * @param a2 背包位置 + * @param a3 物品栏位 + * @return + */ + bool CheckItemLock(int a2, int a3) + { + typedef bool (*__func)(CUser* a1, int a2, int a3); + return int(((__func)base::CUser::CheckItemLock)(this, a2, a3)); + } + + int SendNotiPacketMessage(char* a2, int a3) + { + typedef bool (*__func)(CUser* a1, char* a2, int a3); + return int(((__func)base::CUser::SendNotiPacketMessage)(this, a2, a3)); + } + + //角色增加经验 + int gain_exp_sp(unsigned int a2, int a3, int a4, int a5, int a6, int a7) + { + typedef int (*__func)(CUserCharacInfo* a1, unsigned int a2, int a3, int a4, int a5, int a6, int a7); + return int(((__func)base::CUser::gain_exp_sp)(this, a2, a3, a4, a5, a6, a7)); + } + + //发送道具 + int AddItem(int a2, int a3, int a4, int a5, int a6) + { + typedef int (*__func)(CUser* a1, int a2, int a3, int a4, int a5, int a6); + return int(((__func)base::CUser::AddItem)(this, a2, a3, a4, a5, a6)); + } + + //通知客户端道具更新(客户端指针, 通知方式[仅客户端=1, 世界广播=0, 小队=2, war room=3], itemSpace[装备=0, 时装=1], 道具所在的背包槽) + int SendUpdateItemList(int a2, int a3, int a4) + { + typedef int (*__func)(CUserCharacInfo* a1, int a2, int a3, int a4); + return int(((__func)base::CUser::SendUpdateItemList)(this, a2, a3, a4)); + } + + int SendCmdErrorPacket(int packet_id, unsigned char a3) + { + typedef int (*__func)(CUser* a1, int a2, unsigned char a3); + return int(((__func)base::CUser::SendCmdErrorPacket)(this, packet_id, a3)); + } + + int isEnableAvatarSocketAction() + { + typedef int (*__func)(CUser* a1); + return int(((__func)base::CUser::isEnableAvatarSocketAction)(this)); + } + + int Send(PacketGuard* a2) + { + typedef int (*__func)(CUser* a1, PacketGuard* a2); + return int(((__func)base::CUser::Send)(this, a2)); + } + + CUser* setLastPacketID(int a2) + { + return CallT(base::CUser::setLastPacketID, this, a2); + } + + CAccountCargo* GetAccountCargo() + { + return CallT(base::CUser::GetAccountCargo, this); + } + + int CheckInTrade() + { + return CallT(base::CUser::CheckInTrade, this); + } + + bool IsExistAccountCargo() + { + return CallT(base::CUser::IsExistAccountCargo, this); + } + + int send_itemspace(int a2) + { + return CallT(base::CUser::send_itemspace, this, a2); + } + +}; + +#pragma pack(pop) + +#endif // __CUSER_H__ + diff --git a/src/base.h b/src/sdk/base.h similarity index 85% rename from src/base.h rename to src/sdk/base.h index b3432f2..c7d48b5 100644 --- a/src/base.h +++ b/src/sdk/base.h @@ -164,14 +164,51 @@ namespace base { const int PacketBuf_make = 0x0858C8C0; const int PacketBuf_destroy = 0x0858C8DC; + + const int at = 0x0822B6D4; const int bind_packet = 0x0858D4DE; - const int get_len = 0x0858DA52; - const int get_buf_ptr = 0x0858DA38; - const int get_byte = 0x858CF22; - const int get_short = 0x858CFC0; - const int get_int = 0x858D27E; - const int get_binary = 0x858D3B2; + const int clear = 0x0858C8E2; + const int clear_ptr = 0x0858C93A; + const int compress_packet = 0x0858DAA2; const int copy = 0x0858DCD2; + const int encFinalize = 0x0858DF30; + const int encrypt_packet = 0x0858D86A; + const int finalize = 0x0858D548; + const int getLastError = 0x086D18E2; + const int get_binary = 0x0858D3B2; + const int get_buf_ptr = 0x0858DA38; + const int get_byte = 0x0858CF22; + const int get_byte_u = 0x0858CF70; + const int get_index = 0x08110B1C; + const int get_int = 0x0858D0F0; + const int get_int_u = 0x0858D240; + const int get_int_ul = 0x0858D27E; + const int get_item_idx = 0x0822B6E8; + const int get_len = 0x0858DA52; + const int get_packet = 0x0822B702; + const int get_short = 0x0858CFC0; + const int get_short_u = 0x0858D0B0; + const int get_str = 0x0858D2BC; + const int isCompressRequired = 0x0858E248; + const int isEncryptRequired = 0x0858DA28; + const int is_finallized = 0x0848F390; + const int is_len_end = 0x0858CEFC; + const int is_ptr_end = 0x0858CEC4; + const int put_binary = 0x0811DEDC; + const int put_binary_c = 0x0815093E; + const int put_byte = 0x080CB89E; + const int put_header = 0x0858C94A; + const int put_int = 0x080CB8C2; + const int put_item_idx = 0x0822B6B0; + const int put_packet = 0x0858DC2E; + const int put_short = 0x080D9E80; + const int put_str = 0x081B73B8; + const int put_str_c = 0x0822B684; + const int setLastError = 0x0858E286; + const int set_index = 0x081252BA; + const int set_packet = 0x0858D462; + + } namespace InterfacePacketBuf diff --git a/src/enum.h b/src/sdk/enum.h similarity index 100% rename from src/enum.h rename to src/sdk/enum.h diff --git a/src/ida_sdk.h b/src/sdk/ida_sdk.h similarity index 100% rename from src/ida_sdk.h rename to src/sdk/ida_sdk.h diff --git a/src/sdk/sdk_class.h b/src/sdk/sdk_class.h new file mode 100644 index 0000000..b91de0b --- /dev/null +++ b/src/sdk/sdk_class.h @@ -0,0 +1,120 @@ +#ifndef USER_CLASS_H +#define USER_CLASS_H +#include "base.h" +#include "enum.h" +#include "ida_sdk.h" +#include + +template R CallT(A call_addr, const ARG ... arguments) +{ + if (!call_addr) + { + return R(); + } + const auto control = reinterpret_cast(call_addr); + try + { + return control(arguments ...); + } + catch (...) + { + + } + return R(); +} + + +class CAccountCargo; +class DB_UpdateAvatarJewelSlot; +class CInventory; +class CStackableItem; +class Inven_Item; +class CItem; +class CUserCharacInfo; +class CUser; +class PacketBuf; +class PacketGuard; +class InterfacePacketBuf; +class Dispatcher_ModItemAttr; + + + + +#pragma pack(push, 0x01) + +namespace WongWork +{ + + class CAvatarItemMgr + { + public: + //鑾峰彇鏃惰鎻掓Ы鏁版嵁 + int getJewelSocketData(WongWork::CAvatarItemMgr* a2) + { + typedef int (*__func)(WongWork::CAvatarItemMgr* a1, void* a2); + return ((__func)base::WongWork::CAvatarItemMgr::getJewelSocketData)(this, a2); + } + }; + + class CHackAnalyzer + { + public: + int addServerHackCnt(CUserCharacInfo* a2, int a3, int a4, int a5, int a6) + { + typedef int (*__func)(WongWork::CHackAnalyzer* a1, CUserCharacInfo* a2, int a3, int a4, int a5, int a6); + + return CallT(base::WongWork::CHackAnalyzer::addServerHackCnt, this, a2, a3, a4, a5, a6); + return ((__func)base::WongWork::CHackAnalyzer::addServerHackCnt)(this, a2, a3, a4, a5, a6); + } + }; +} + +class CSecu_ProtectionField +{ +public: + + static CSecu_ProtectionField* Get() + { + return (CSecu_ProtectionField*)(*(int*)base::GlobalData::s_pSecuProtectionField); + } + + int Check(CUser* a2, int a3) + { + return CallT(base::CSecu_ProtectionField::Check, this, a2, a3); + } + +}; + +class cUserHistoryLog +{ +public: + +}; + +class AvatarRechargeServer +{ +public: + + static AvatarRechargeServer* Get() + { + return CallT(base::AvatarRechargeServer::Get); + } + + char SendDurability(CUser* a2, char a3, short a4, char a5, int a6) + { + return CallT(base::AvatarRechargeServer::SendDurability, this, a2, a3, a4, a5, a6); + } +}; + +#pragma pack(pop) + + +#include "User.h" +#include "AccountCargo.h" +#include "Item.h" +#include "DataManager.h" +#include "Inventory.h" +#include "PacketBuf.h" + + +#endif // __DXFBASE_H__ diff --git a/src/sdk_class.h b/src/sdk_class.h deleted file mode 100644 index b68e439..0000000 --- a/src/sdk_class.h +++ /dev/null @@ -1,982 +0,0 @@ -#ifndef USER_CLASS_H -#define USER_CLASS_H -#include "base.h" -#include "enum.h" -#include "ida_sdk.h" -#include - -#pragma pack(push, 0x01) - -template R CallT(A call_addr, const ARG ... arguments) -{ - if (!call_addr) - { - return R(); - } - const auto control = reinterpret_cast(call_addr); - try - { - return control(arguments ...); - } - catch (...) - { - - } - return R(); -} - -class CAccountCargo; -class DB_UpdateAvatarJewelSlot; -class CInventory; -class CStackableItem; -class Inven_Item; -class CItem; -class CUserCharacInfo; -class CUser; -class PacketBuf; -class PacketGuard; -class InterfacePacketBuf; -class Dispatcher_ModItemAttr; - - -namespace WongWork -{ - - class CAvatarItemMgr - { - public: - //鑾峰彇鏃惰鎻掓Ы鏁版嵁 - int getJewelSocketData(WongWork::CAvatarItemMgr* a2) - { - typedef int (*__func)(WongWork::CAvatarItemMgr* a1, void* a2); - return ((__func)base::WongWork::CAvatarItemMgr::getJewelSocketData)(this, a2); - } - }; - - class CHackAnalyzer - { - public: - int addServerHackCnt(CUserCharacInfo* a2, int a3, int a4, int a5, int a6) - { - typedef int (*__func)(WongWork::CHackAnalyzer* a1, CUserCharacInfo* a2, int a3, int a4, int a5, int a6); - - return CallT(base::WongWork::CHackAnalyzer::addServerHackCnt, this, a2, a3, a4, a5, a6); - return ((__func)base::WongWork::CHackAnalyzer::addServerHackCnt)(this, a2, a3, a4, a5, a6); - } - }; -} - -class CUserCharacInfo -{ -public: - //鑾峰彇瑙掕壊鍚嶅瓧 - std::string getCurCharacName() - { - typedef char* (*__func)(CUserCharacInfo* a1); - return std::string(((__func)base::CUserCharacInfo::getCurCharacName)(this)); - } - - //鑾峰彇瑙掕壊缂栧彿 - int getCurCharacNo() - { - typedef int (*__func)(CUserCharacInfo* a1); - return int(((__func)base::CUserCharacInfo::getCurCharacNo)(this)); - } - - //鑾峰彇瑙掕壊涓婃閫鍑烘父鎴忔椂闂 - int getCurCharacLastPlayTick() - { - typedef int (*__func)(CUserCharacInfo* a1); - return int(((__func)base::CUserCharacInfo::getCurCharacLastPlayTick)(this)); - } - - //鑾峰彇瑙掕壊绛夌骇 - int get_level_up_exp(int a2) - { - typedef int (*__func)(CUserCharacInfo* a1, int a2); - return int(((__func)base::CUserCharacInfo::get_level_up_exp)(this, a2)); - } - - //鑾峰彇瑙掕壊鑳屽寘 - CInventory* getCurCharacInvenW() - { - typedef CInventory* (*__func)(CUserCharacInfo* a1); - return ((__func)base::CUserCharacInfo::getCurCharacInvenW)(this); - } - - bool _checkItemMovable(int a2, int a3, int a4, int a5, int a6, int a7) - { - CallT(base::CUserCharacInfo::_checkItemMovable, this, a2, a3, a4, a5, a6, a7); - } - - CInventory* getCurCharacInvenR() - { - return CallT(base::CUserCharacInfo::getCurCharacInvenR, this); - } - - int getCurCharacR() - { - return CallT(base::CUserCharacInfo::getCurCharacR, this); - } - -}; - -class CUser : public CUserCharacInfo -{ -public: - int get_state() - { - typedef int (*__func)(CUser* a1); - return int(((__func)base::CUser::get_state)(this)); - } - - /** - * @brief 妫鏌ョ墿鍝侀攣瀹 - * @param a2 鑳屽寘浣嶇疆 - * @param a3 鐗╁搧鏍忎綅 - * @return - */ - bool CheckItemLock(int a2, int a3) - { - typedef bool (*__func)(CUser* a1, int a2, int a3); - return int(((__func)base::CUser::CheckItemLock)(this, a2, a3)); - } - - int SendNotiPacketMessage(char* a2, int a3) - { - typedef bool (*__func)(CUser* a1, char* a2, int a3); - return int(((__func)base::CUser::SendNotiPacketMessage)(this, a2, a3)); - } - - //瑙掕壊澧炲姞缁忛獙 - int gain_exp_sp(unsigned int a2, int a3, int a4, int a5, int a6, int a7) - { - typedef int (*__func)(CUserCharacInfo* a1, unsigned int a2, int a3, int a4, int a5, int a6, int a7); - return int(((__func)base::CUser::gain_exp_sp)(this, a2, a3, a4, a5, a6, a7)); - } - - //鍙戦侀亾鍏 - int AddItem(int a2, int a3, int a4, int a5, int a6) - { - typedef int (*__func)(CUser* a1, int a2, int a3, int a4, int a5, int a6); - return int(((__func)base::CUser::AddItem)(this, a2, a3, a4, a5, a6)); - } - - //閫氱煡瀹㈡埛绔亾鍏锋洿鏂(瀹㈡埛绔寚閽, 閫氱煡鏂瑰紡[浠呭鎴风=1, 涓栫晫骞挎挱=0, 灏忛槦=2, war room=3], itemSpace[瑁呭=0, 鏃惰=1], 閬撳叿鎵鍦ㄧ殑鑳屽寘妲) - int SendUpdateItemList(int a2, int a3, int a4) - { - typedef int (*__func)(CUserCharacInfo* a1, int a2, int a3, int a4); - return int(((__func)base::CUser::SendUpdateItemList)(this, a2, a3, a4)); - } - - int SendCmdErrorPacket(int packet_id, unsigned char a3) - { - typedef int (*__func)(CUser* a1, int a2, unsigned char a3); - return int(((__func)base::CUser::SendCmdErrorPacket)(this, packet_id, a3)); - } - - int isEnableAvatarSocketAction() - { - typedef int (*__func)(CUser* a1); - return int(((__func)base::CUser::isEnableAvatarSocketAction)(this)); - } - - int Send(PacketGuard* a2) - { - typedef int (*__func)(CUser* a1, PacketGuard* a2); - return int(((__func)base::CUser::Send)(this, a2)); - } - - CUser* setLastPacketID(int a2) - { - return CallT(base::CUser::setLastPacketID, this, a2); - } - - CAccountCargo* GetAccountCargo() - { - return CallT(base::CUser::GetAccountCargo, this); - } - - int CheckInTrade() - { - return CallT(base::CUser::CheckInTrade, this); - } - - bool IsExistAccountCargo() - { - return CallT(base::CUser::IsExistAccountCargo, this); - } - - int send_itemspace(int a2) - { - return CallT(base::CUser::send_itemspace, this, a2); - } - -}; - -class CAccountCargo -{ -public: - - int GetCapacity() - { - return CallT(base::CAccountCargo::GetCapacity, this); - } - int GetMoney() - { - return CallT(base::CAccountCargo::GetMoney, this); - } - int SetDBData(CUser* a2, Inven_Item* a3, uint a4, uint a5) - { - return CallT(base::CAccountCargo::SetDBData, this, a2, a3, a4, a5); - } - int Clear() - { - return CallT(base::CAccountCargo::Clear, this); - } - int ResetSlot(int a2) - { - return CallT(base::CAccountCargo::ResetSlot, this, a2); - } - int* GetSlot(int a2) - { - return CallT(base::CAccountCargo::GetSlot, this, a2); - } - int GetSlotRef(int a2) - { - return CallT(base::CAccountCargo::GetSlotRef, this, a2); - } - int CheckInsertCondition(Inven_Item* a2) - { - return CallT(base::CAccountCargo::CheckInsertCondition, this, a2); - } - int InsertItem(Inven_Item* a2, int a3) - { - return CallT(base::CAccountCargo::InsertItem, this, a2, a3); - } - int DeleteItem(int a2, int a3) - { - return CallT(base::CAccountCargo::DeleteItem, this, a2, a3); - } - int MoveItem(int a2, int a3) - { - return CallT(base::CAccountCargo::MoveItem, this, a2, a3); - } - int DepositMoney(uint a2) - { - return CallT(base::CAccountCargo::DepositMoney, this, a2); - } - int WithdrawMoney(uint a2) - { - return CallT(base::CAccountCargo::WithdrawMoney, this, a2); - } - int CheckMoneyLimit(uint a2) - { - return CallT(base::CAccountCargo::CheckMoneyLimit, this, a2); - } - int CheckValidSlot(int a2) - { - return CallT(base::CAccountCargo::CheckValidSlot, this); - } - int GetEmptySlot() - { - return CallT(base::CAccountCargo::GetEmptySlot, this); - } - int CheckSlotEmpty(int a2) - { - return CallT(base::CAccountCargo::CheckSlotEmpty, this, a2); - } - int GetSpecificItemSlot(int a2) - { - return CallT(base::CAccountCargo::GetSpecificItemSlot, this, a2); - } - int CheckStackLimit(int a2, int a3, int a4) - { - return CallT(base::CAccountCargo::CheckStackLimit, this); - } - int AddMoney(uint a2) - { - return CallT(base::CAccountCargo::AddMoney, this, a2); - } - int SubMoney(uint a2) - { - return CallT(base::CAccountCargo::SubMoney, this, a2); - } - int GetItemCount() - { - return CallT(base::CAccountCargo::GetItemCount, this); - } - int SendNotifyMoney(int a2) - { - return CallT(base::CAccountCargo::SendNotifyMoney, this, a2); - } - int SendItemList() - { - return CallT(base::CAccountCargo::SendItemList, this); - } - int MakeItemPacket(PacketGuard* a2, int a3) - { - return CallT(base::CAccountCargo::MakeItemPacket, this, a2, a3); - } - int CreateAccountCargo(CUser* a2) - { - return CallT(base::CAccountCargo::CreateAccountCargo, this, a2); - } - int UpgradeAccountCargo(CUser* a2) - { - return CallT(base::CAccountCargo::UpgradeAccountCargo, this, a2); - } - int SendNotifyRecipe(CUser* a2, int a3, bool a4) - { - return CallT(base::CAccountCargo::SendNotifyRecipe, this, a2, a3, a4); - } - int DeleteAccountCargo(CUser* a2) - { - return CallT(base::CAccountCargo::DeleteAccountCargo, this, a2); - } - int SetStable() - { - return CallT(base::CAccountCargo::SetStable, this); - } - int SetCapacity(uint a2) - { - return CallT(base::CAccountCargo::SetCapacity, this, a2); - } - int IsAlter(void) - { - return CallT(base::CAccountCargo::IsAlter, this); - } - -}; - -class CItem -{ -public: - - /** - * @brief 鏄惁涓烘秷鑰楀搧 - * @return - */ - bool is_stackable() - { - typedef bool (*__func)(CItem* a1); - return ((__func)base::CItem::is_stackable)(this); - } - - bool IsRoutingItem() - { - typedef bool (*__func)(CItem* a1); - return ((__func)base::CItem::IsRoutingItem)(this); - } - - /** - * @brief 鍙栭檮鍔犵被鍨 - * @return - */ - int GetAttachType() - { - return CallT(base::CItem::GetAttachType, this); - } - - int GetCashPrice() - { - return CallT(base::CItem::GetCashPrice, this); - } - - int GetDyeInfo() - { - return CallT(base::CItem::GetDyeInfo, this); - } - - int GetExpertJobAdditionalExp(int a2) - { - return CallT(base::CItem::GetExpertJobAdditionalExp, this, a2); - } - - int GetExpertJobCompoundMaterialVariation() - { - return CallT(base::CItem::GetExpertJobCompoundMaterialVariation, this); - } - - int GetExpertJobCompoundRateVariation() - { - return CallT(base::CItem::GetExpertJobCompoundRateVariation, this); - } - - int GetExpertJobCompoundResultVariation(int a2) - { - return CallT(base::CItem::GetExpertJobCompoundResultVariation, this, a2); - } - - int GetExpertJobSelfDisjointBigWinRate() - { - return CallT(base::CItem::GetExpertJobSelfDisjointBigWinRate, this); - } - - int GetExpertJobSelfDisjointResultVariation() - { - return CallT(base::CItem::GetExpertJobSelfDisjointResultVariation, this); - } - - int GetFinishPointPrice() - { - return CallT(base::CItem::GetFinishPointPrice, this); - } - - int GetIncreaseStatusIntData(int a2, int& a3) - { - return CallT(base::CItem::GetIncreaseStatusIntData, this, a2, a3); - } - - int GetIncreaseStatusType() - { - return CallT(base::CItem::GetIncreaseStatusType, this); - } - - int GetItemIconName() - { - return CallT(base::CItem::GetItemIconName, this); - } - - int GetItemName() - { - return CallT(base::CItem::GetItemName, this); - } - - int GetMedalPrice() - { - return CallT(base::CItem::GetMedalPrice, this); - } - - int GetNeedLevel() - { - return CallT(base::CItem::GetNeedLevel, this); - } - - int GetNeedMaterial() - { - return CallT(base::CItem::GetNeedMaterial, this); - } - - int GetQuestItemDropBouns() - { - return CallT(base::CItem::GetQuestItemDropBouns, this); - } - - int GetRandomOptionGrade() - { - return CallT(base::CItem::GetRandomOptionGrade, this); - } - - int GetSellPrice() - { - return CallT(base::CItem::GetSellPrice, this); - } - - int GetUpSkillType() - { - return CallT(base::CItem::GetUpSkillType, this); - } - - int GetUsablePvPRank() - { - return CallT(base::CItem::GetUsablePvPRank, this); - } - - int getAdvanceAltarNeedGage() - { - return CallT(base::CItem::getAdvanceAltarNeedGage, this); - } - - int getExpirationDate() - { - return CallT(base::CItem::getExpirationDate, this); - } - - int getFootControlRateLimit() - { - return CallT(base::CItem::getFootControlRateLimit, this); - } - - int getItemGroupName() - { - return CallT(base::CItem::getItemGroupName, this); - } - - int getUsableLevel() - { - return CallT(base::CItem::getUsableLevel, this); - } - - int getUsablePeriod() - { - return CallT(base::CItem::getUsablePeriod, this); - } - - int get_gen_rate() - { - return CallT(base::CItem::get_gen_rate, this); - } - - int get_grade() - { - return CallT(base::CItem::get_grade, this); - } - - int get_index() - { - return CallT(base::CItem::get_index, this); - } - - int get_need_skill() - { - return CallT(base::CItem::get_need_skill, this); - } - - int get_price() - { - return CallT(base::CItem::get_price, this); - } - - int get_rarity() - { - return CallT(base::CItem::get_rarity, this); - } - - - - -private: -}; - -class CStackableItem : public CItem -{ -public: - //鑾峰彇娑堣楀搧绫诲瀷 - int GetItemType() - { - typedef int (*__func)(void* a1); - return ((__func)base::CStackableItem::GetItemType)(this); - } - - //鑾峰彇寰界珷鏀寔鐨勯暥宓屾Ы绫诲瀷 - int getJewelTargetSocket() - { - typedef int (*__func)(CStackableItem* a1); - return ((__func)base::CStackableItem::getJewelTargetSocket)(this); - } -}; - -class CEquipItem : public CItem -{ -public: - int GetItemType() - { - return CallT(base::CEquipItem::GetItemType, this); - } - -}; - -class Inven_Item -{ -public: - unsigned char package; - unsigned char UnknownData_NUSL[0x3C]; - -public: - - //鑾峰彇閬撳叿闄勫姞淇℃伅 - WongWork::CAvatarItemMgr* get_add_info() - { - typedef WongWork::CAvatarItemMgr* (*__func)(Inven_Item* a1); - return ((__func)base::Inven_Item::get_add_info)(this); - } - - //妫鏌ヨ儗鍖呬腑閬撳叿鏄惁涓虹┖ - bool isEmpty() - { - typedef bool (*__func)(Inven_Item* a1); - return ((__func)base::Inven_Item::isEmpty)(this); - } - //鑾峰彇鑳屽寘涓亾鍏穒tem_id - int getKey() - { - typedef int (*__func)(Inven_Item* a1); - return ((__func)base::Inven_Item::getKey)(this); - } - //閬撳叿鏄惁鏄澶 - bool isEquipableItemType() - { - typedef bool (*__func)(Inven_Item* a1); - return ((__func)base::Inven_Item::isEquipableItemType)(this); - } - - int get_ui_id() - { - return *(int*)(this + 0x7); - } - - bool IsTradeLimitAttachTypeItem() - { - return CallT(base::Inven_Item::IsTradeLimitAttachTypeItem, this); - } - - int GetItemSpace() - { - return CallT(base::Inven_Item::GetItemSpace, this); - } - - int SetReSealCount(uchar a2) - { - return CallT(base::Inven_Item::SetReSealCount, this, a2); - } - - int GetReSealCount() - { - return CallT(base::Inven_Item::GetReSealCount, this); - } - - -}; - -class CDataManager -{ -public: - static CDataManager* G_CDataManager(void) - { - typedef CDataManager* (*__func)(void); - return ((__func)base::CDataManager::G_CDataManager)(); - } - - //鑾峰彇瑁呭pvf鏁版嵁 - CItem* find_item(int a2) - { - typedef CItem* (*__func)(CDataManager* a1, int a2); - return ((__func)base::CDataManager::find_item)(this, a2); - } -}; - -class CInventory -{ -public: - - enum INVEN_TYPE : int - { - INVENTORY_TYPE_BODY = 0, //韬笂绌跨殑瑁呭 - INVENTORY_TYPE_ITEM = 1, //鐗╁搧鏍 - INVENTORY_TYPE_AVARTAR = 2, //鏃惰鏍 - }; - -public: - //鑾峰彇鏃惰绠$悊鍣 - WongWork::CAvatarItemMgr* GetAvatarItemMgrR() - { - typedef WongWork::CAvatarItemMgr* (*__func)(void* a1); - return ((__func)base::CInventory::GetAvatarItemMgrR)(this); - } - - int delete_item(INVEN_TYPE a2, int pos, int num, int a5, int a6 = 1) - { - typedef int (*__func)(CInventory* a1, INVEN_TYPE a2, int a3, int a4, int a5, int a6); - return ((__func)base::CInventory::delete_item)(this, a2, pos, num, a5, a6); - } - - //浣跨敤閲戝竵 - int use_money(int a2, int a3, char a4) - { - typedef int (*__func)(CInventory* a1, int a2, int a3, char a4); - return ((__func)base::CInventory::use_money)(this, a2, a3, a4); - } - - //鑾峰緱閲戝竵 - int gain_money(unsigned int a2, int a3, char a4, int a5) - { - typedef int (*__func)(CInventory* a1, unsigned int a2, int a3, char a4, int a5); - return ((__func)base::CInventory::gain_money)(this, a2, a3, a4, a5); - } - - //鑾峰彇鑳屽寘妲戒腑鐨勯亾鍏 - Inven_Item* GetInvenRef(INVEN_TYPE a2, int a3) - { - typedef Inven_Item* (*__func)(CInventory* a1, INVEN_TYPE a2, int a3); - return ((__func)base::CInventory::GetInvenRef)(this, a2, a3); - } - - Inven_Item* GetInvenSlot(Inven_Item* a2, INVEN_TYPE a3, int a4) - { - typedef Inven_Item* (__attribute__((__stdcall__))* fnCInventory_GetInvenSlot)(Inven_Item* dest, CInventory* pThis, int space, int location); - static fnCInventory_GetInvenSlot CInventory_GetInvenSlot = (fnCInventory_GetInvenSlot)(base::CInventory::GetInvenSlot); - return CInventory_GetInvenSlot(a2, this, a3, a4); - } - - int update_item(INVEN_TYPE a2, int a3, Inven_Item a4) - { - return CallT(base::CInventory::update_item, this, a2, a3, a4); - } - -}; - -class DB_UpdateAvatarJewelSlot -{ -public: - static int makeRequest(int a1, unsigned int a2, void* src) - { - typedef int (*__func)(int a1, unsigned int a2, void* src); - return ((__func)base::DB_UpdateAvatarJewelSlot::makeRequest)(a1, a2, src); - } -}; - -class PacketBuf -{ -public: - unsigned char UnknownData_0000[0x20000]; - -public: - PacketBuf() - { - memset(UnknownData_0000, 0, sizeof(UnknownData_0000)); - CallT(base::PacketBuf::PacketBuf_make, this); - } - - ~PacketBuf() - { - CallT(base::PacketBuf::PacketBuf_destroy, this); - } - - static PacketBuf* NewPacketBuf() - { - void* v62 = malloc(0x20000); - if (!v62) return NULL; - return CallT(base::PacketBuf::PacketBuf_make, v62); - } - - static void DelPacketBuf(PacketBuf* a1) - { - CallT(base::PacketBuf::PacketBuf_destroy, a1); - free(a1); - } - - int bind_packet(char* a2, int a3) - { - return CallT(base::PacketBuf::bind_packet, this, a2, a3); - } - - //鍙栧ぇ灏 - int get_len() - { - typedef int (*__func)(PacketBuf* a1); - return ((__func)base::PacketBuf::get_len)(this); - } - - //鍙栨寚閽 - int get_buf_ptr(int a2 = 0) - { - typedef int (*__func)(PacketBuf* a1, int a2); - return ((__func)base::PacketBuf::get_buf_ptr)(this, a2); - } - - char get_byte() - { - char result; - typedef int (*__func)(PacketBuf* a1, char* a2); - if (((__func)base::PacketBuf::get_byte)(this, &result) == 1) - { - return result; - } - return 0; - } - - short get_short() - { - short result; - typedef int (*__func)(PacketBuf* a1, short* a2); - if (((__func)base::PacketBuf::get_short)(this, &result) == 1) - { - return result; - } - return 0; - } - - int get_int() - { - int result; - typedef int (*__func)(PacketBuf* a1, int* a2); - if (((__func)base::PacketBuf::get_int)(this, &result) == 1) - { - return result; - } - return 0; - } - - int get_binary(char* a2, int a3) - { - typedef int (*__func)(PacketBuf* a1, char* a2, int a3); - return ((__func)base::PacketBuf::get_binary)(this, a2, a3); - } - - void* copy(const PacketBuf* a2) - { - return CallT(base::PacketBuf::copy, this, a2); - } -}; - -class InterfacePacketBuf -{ -public: - int put_header(int a2, int a3) - { - typedef int (*__func)(InterfacePacketBuf* a1, int a2, int a3); - return ((__func)base::InterfacePacketBuf::put_header)(this, a2, a3); - } - - int put_byte(char a2) - { - typedef int (*__func)(InterfacePacketBuf* a1, char a2); - return ((__func)base::InterfacePacketBuf::put_byte)(this, a2); - } - int put_short(short a2) - { - typedef int (*__func)(InterfacePacketBuf* a1, short a2); - return ((__func)base::InterfacePacketBuf::put_short)(this, a2); - } - - int put_int(int a2) - { - typedef int (*__func)(InterfacePacketBuf* a1, int a2); - return ((__func)base::InterfacePacketBuf::put_int)(this, a2); - } - - int put_binary(char* a2, int a3) - { - typedef int (*__func)(InterfacePacketBuf* a1, char* a2, int a3); - return ((__func)base::InterfacePacketBuf::put_binary)(this, a2, a3); - } - - int finalize(bool a2) - { - typedef int (*__func)(InterfacePacketBuf* a1, bool a2); - return ((__func)base::InterfacePacketBuf::finalize)(this, a2); - } - - int put_str(const char* a2, int a3) - { - typedef int (*__func)(InterfacePacketBuf* a1, const char* a2, int a3); - return ((__func)base::InterfacePacketBuf::put_str)(this, a2, a3); - } - - int put_packet(const Inven_Item* a2) - { - typedef int (*__func)(InterfacePacketBuf* a1, const Inven_Item* a2); - return ((__func)base::InterfacePacketBuf::put_packet)(this, a2); - } -}; - -class PacketGuard -{ -public: - static PacketGuard* NewPacketGuard() - { - void* v62 = malloc(0x20000); - typedef int (*__func)(void* a1); - if (!v62) return NULL; - ((__func)base::PacketGuard::PacketGuard_make)(v62); - return (PacketGuard*)v62; - } - static void DelPacketGuard(PacketGuard* a1) - { - typedef int (*__func)(void* a1); - ((__func)base::PacketGuard::PacketGuard_destroy)(a1); - free(a1); - } -}; - -class PacketDispatcher -{ -public: - int getDispatcher(int a2) - { - typedef int (*__func)(PacketDispatcher* a1, int a2); - return ((__func)base::PacketDispatcher::getDispatcher)(this, a2); - } - - void** get_dispatcher(int a2) - { - typedef void** (*__func)(PacketDispatcher* a1, int a2); - return ((__func)base::PacketDispatcher::get_dispatcher)(this, a2); - } -}; - -class CSecu_ProtectionField -{ -public: - - static CSecu_ProtectionField* Get() - { - return (CSecu_ProtectionField*)(*(int*)base::GlobalData::s_pSecuProtectionField); - } - - int Check(CUser* a2, int a3) - { - return CallT(base::CSecu_ProtectionField::Check, this, a2, a3); - } - -}; - -class stMoveItemParam -{ -public: - static stMoveItemParam* NewstMoveItemParam() - { - void* v62 = malloc(0x20000); - if (!v62) return NULL; - CallT(base::stMoveItemParam::stMoveItemParam_make, v62); - return (stMoveItemParam*)v62; - } - - static void DelstMoveItemParam(stMoveItemParam* a1) - { - CallT(base::stMoveItemParam::stMoveItemParam_destroy, a1); - free(a1); - } - - static void DelstMoveItemParam2(stMoveItemParam* a1) - { - CallT(base::stMoveItemParam::stMoveItemParam_del, a1); - } - - -}; - -class cUserHistoryLog -{ -public: - -}; - -class AvatarRechargeServer -{ -public: - - static AvatarRechargeServer* Get() - { - return CallT(base::AvatarRechargeServer::Get); - } - - char SendDurability(CUser* a2, char a3, short a4, char a5, int a6) - { - return CallT(base::AvatarRechargeServer::SendDurability, this, a2, a3, a4, a5, a6); - } -}; - -class Dispatcher_ModItemAttr -{ -public: - int _SendResult(CUser* a2, ushort a3, ushort a4, ushort a5) - { - return CallT(base::Dispatcher_ModItemAttr::_SendResult, this, a2, a3, a4, a5); - } - - -}; -#pragma pack(pop) -#endif // __DXFBASE_H__ diff --git a/src/utils.h b/src/utils.h index 85e8faa..7374b7b 100644 --- a/src/utils.h +++ b/src/utils.h @@ -8,7 +8,7 @@ #define SET_TEXTA(X) #X -namespace Util +namespace Utils { /** * @brief 鍒16杩涘埗Hex鏂囨湰 @@ -50,7 +50,7 @@ namespace Util } -#define LOG(format,...) Util::_Log(format,##__VA_ARGS__) +#define LOG(format,...) Utils::_Log(format,##__VA_ARGS__) #endif // utils_h__ \ No newline at end of file