111
This commit is contained in:
@@ -51,8 +51,8 @@ void Controller::init()
|
||||
auto code_importCashShopItemList = assembler.GetBytes(true);
|
||||
void *new_importCashShopItemList_addr = Utils::alloc(code_importCashShopItemList.size());
|
||||
CMem::WriteBytes(new_importCashShopItemList_addr, code_importCashShopItemList.data(), code_importCashShopItemList.size());
|
||||
LOG("code :%s", Utils::ToHexString((const unsigned char *)code_importCashShopItemList.data(), code_importCashShopItemList.size()).c_str());
|
||||
LOG("code_addr :%p", new_importCashShopItemList_addr);
|
||||
YLOG("code :%s", Utils::ToHexString((const unsigned char *)code_importCashShopItemList.data(), code_importCashShopItemList.size()).c_str());
|
||||
YLOG("code_addr :%p", new_importCashShopItemList_addr);
|
||||
|
||||
CMem::HookJmp(base::importCashShopItemList_hook_begin, (int)new_importCashShopItemList_addr);
|
||||
|
||||
@@ -85,8 +85,8 @@ void Controller::init()
|
||||
auto code_ProcessIPG_ResultOutput = assembler.GetBytes(true);
|
||||
void *new_ProcessIPG_ResultOutput_addr = Utils::alloc(code_ProcessIPG_ResultOutput.size());
|
||||
CMem::WriteBytes(new_ProcessIPG_ResultOutput_addr, code_ProcessIPG_ResultOutput.data(), code_ProcessIPG_ResultOutput.size());
|
||||
LOG("code_2 :%s", Utils::ToHexString((const unsigned char *)code_ProcessIPG_ResultOutput.data(), code_ProcessIPG_ResultOutput.size()).c_str());
|
||||
LOG("code_addr_2 :%p", new_ProcessIPG_ResultOutput_addr);
|
||||
YLOG("code_2 :%s", Utils::ToHexString((const unsigned char *)code_ProcessIPG_ResultOutput.data(), code_ProcessIPG_ResultOutput.size()).c_str());
|
||||
YLOG("code_addr_2 :%p", new_ProcessIPG_ResultOutput_addr);
|
||||
|
||||
CMem::HookJmp(base::ItemVendingMachine::ProcessIPG_ResultOutput_hook_begin, (int)new_ProcessIPG_ResultOutput_addr);
|
||||
|
||||
@@ -106,7 +106,7 @@ void Controller::init()
|
||||
|
||||
HOOK_SETUP(Init);
|
||||
|
||||
LOG("Controller::init()");
|
||||
YLOG("Controller::init()");
|
||||
}
|
||||
|
||||
void Controller::Jinit()
|
||||
@@ -130,7 +130,7 @@ int Controller::hook_IPacketDispatcher_ParamBase_dispatch_template(int a1, int a
|
||||
// [DNF_PROJECT] + 24 0x8bd7de0 : Dispatcher_Antibot::process(CUser *,MSG_BASE &,ParamBase &)
|
||||
// [DNF_PROJECT] + 28 0x8bd7de4 : IPacketDispatcher<MSG_BASE,ParamBase,(ch_state)0>::send(CUser *,ParamBase&)
|
||||
|
||||
// LOG("ParamBase_dispatch_template[ +12 :%p +16 :%p +20 :%p +24 :%p +28 :%p ]"
|
||||
// YLOG("ParamBase_dispatch_template[ +12 :%p +16 :%p +20 :%p +24 :%p +28 :%p ]"
|
||||
// , *(int*)a1 + 12
|
||||
// , *(int*)a1 + 16
|
||||
// , *(int*)a1 + 20
|
||||
@@ -181,7 +181,7 @@ int Controller::hook_PacketDispatcher_doDispatch(PacketDispatcher *a1, CUser *us
|
||||
if (dispatcher)
|
||||
{
|
||||
// v32 = (**dispatcher)(dispatcher, user, v25);
|
||||
// LOG("Recv() class:%d id:%d len:%d %p [ +00 :%p +12 :%p +16 :%p +20 :%p +24 :%p +28 :%p ]"
|
||||
// YLOG("Recv() class:%d id:%d len:%d %p [ +00 :%p +12 :%p +16 :%p +20 :%p +24 :%p +28 :%p ]"
|
||||
// , packet_class
|
||||
// , packet_id
|
||||
// , packet_len
|
||||
@@ -195,7 +195,7 @@ int Controller::hook_PacketDispatcher_doDispatch(PacketDispatcher *a1, CUser *us
|
||||
// );
|
||||
}
|
||||
|
||||
// LOG("Recv() class:%d id:%d len:%d packet_data :%s ", packet_class, packet_id, packet_len, Utils::ToHexString((const unsigned char *)packet_src, packet_len).c_str());
|
||||
// YLOG("Recv() class:%d id:%d len:%d packet_data :%s ", packet_class, packet_id, packet_len, Utils::ToHexString((const unsigned char *)packet_src, packet_len).c_str());
|
||||
|
||||
if (packet_id == PACKET_ID_ITEM_USE_EQUIPMENT_MOVEITEM)
|
||||
{
|
||||
@@ -203,7 +203,7 @@ int Controller::hook_PacketDispatcher_doDispatch(PacketDispatcher *a1, CUser *us
|
||||
PacketBuf *v25 = PacketBuf::NewPacketBuf();
|
||||
user->setLastPacketID(packet_id);
|
||||
v25->bind_packet(packet_src, packet_len);
|
||||
LOG("Recv() class:%d id:%d len:%d packet_data :%s ", packet_class, packet_id, packet_len, Utils::ToHexString((const unsigned char *)packet_src, packet_len).c_str());
|
||||
YLOG("Recv() class:%d id:%d len:%d packet_data :%s ", packet_class, packet_id, packet_len, Utils::ToHexString((const unsigned char *)packet_src, packet_len).c_str());
|
||||
|
||||
if (v25)
|
||||
{
|
||||
|
||||
@@ -465,20 +465,20 @@ int _reach_game_world(void *pThis, void *a2)
|
||||
int _Inter_LoadEtc_dispatch_sig(void *pThis, void *pUser, char *a3)
|
||||
{
|
||||
int result = Inter_LoadEtc_dispatch_sig(pThis, pUser, a3);
|
||||
LOG("_Inter_LoadEtc_dispatch_sig begin");
|
||||
YLOG("_Inter_LoadEtc_dispatch_sig begin");
|
||||
|
||||
// typedef double(__cdecl* FN_sqrt)(_In_ double _X);
|
||||
|
||||
CUserCharacInfo_getCurCharacNo getCurCharacNo = (CUserCharacInfo_getCurCharacNo)(0x080CBC4E);
|
||||
int CurCharacNo = getCurCharacNo(pUser);
|
||||
LOG("CurCharacNo :%d", CurCharacNo);
|
||||
YLOG("CurCharacNo :%d", CurCharacNo);
|
||||
|
||||
CUserCharacInfo_getCurCharacName getCurCharacName = (CUserCharacInfo_getCurCharacName)0x8101028;
|
||||
|
||||
char *name = getCurCharacName(pUser);
|
||||
LOG("CurCharacName :%s", name);
|
||||
YLOG("CurCharacName :%s", name);
|
||||
|
||||
LOG("_Inter_LoadEtc_dispatch_sig end");
|
||||
YLOG("_Inter_LoadEtc_dispatch_sig end");
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -566,17 +566,17 @@ void PrintAuroraTag()
|
||||
{
|
||||
printf("\n");
|
||||
|
||||
LOG("**********************************************************");
|
||||
LOG(" DNF_Server Plugin S%s ", MY_VERSION);
|
||||
LOG(" By:Rindro-Aurora ");
|
||||
LOG(" PowerBy:Vance ");
|
||||
LOG("**********************************************************");
|
||||
LOG("DP_S插件已加载*************************************凌众-极光");
|
||||
LOG("DP_S插件已加载*************************************凌众-极光");
|
||||
LOG("DP_S插件已加载*************************************凌众-极光");
|
||||
LOG("DP_S插件已加载*************************************凌众-极光");
|
||||
LOG("DP_S插件已加载*************************************凌众-极光");
|
||||
LOG("DP_S插件已加载*************************************凌众-极光");
|
||||
YLOG("**********************************************************");
|
||||
YLOG(" DNF_Server Plugin S%s ", MY_VERSION);
|
||||
YLOG(" By:Rindro-Aurora ");
|
||||
YLOG(" PowerBy:Vance ");
|
||||
YLOG("**********************************************************");
|
||||
YLOG("DP_S插件已加载*************************************凌众-极光");
|
||||
YLOG("DP_S插件已加载*************************************凌众-极光");
|
||||
YLOG("DP_S插件已加载*************************************凌众-极光");
|
||||
YLOG("DP_S插件已加载*************************************凌众-极光");
|
||||
YLOG("DP_S插件已加载*************************************凌众-极光");
|
||||
YLOG("DP_S插件已加载*************************************凌众-极光");
|
||||
}
|
||||
|
||||
int _Inter_LoadGeolocation_dispatch_sig(void *pThis, void *pUser, char *a3)
|
||||
|
||||
@@ -31,7 +31,7 @@ ENUM_PACK_RET_TYPE CDispatch::UseEquipmentMoveItem(CUser *user, PacketBuf *pBuf)
|
||||
return PAK_IGNORE;
|
||||
}
|
||||
|
||||
LOG(u8"UseEquipmentMoveItem :%s ", Utils::ToHexString((const unsigned char *)pBuf->get_buf_ptr(0), 40).c_str());
|
||||
YLOG(u8"UseEquipmentMoveItem :%s ", Utils::ToHexString((const unsigned char *)pBuf->get_buf_ptr(0), 40).c_str());
|
||||
|
||||
short equipment_pos = 0;
|
||||
int equipment_id = 0;
|
||||
@@ -53,38 +53,38 @@ ENUM_PACK_RET_TYPE CDispatch::UseEquipmentMoveItem(CUser *user, PacketBuf *pBuf)
|
||||
CInventory *invenR = user->getCurCharacInvenR();
|
||||
if (!invenR)
|
||||
{
|
||||
LOG(u8"user->getCurCharacInvenW : error \n");
|
||||
YLOG(u8"user->getCurCharacInvenW : error \n");
|
||||
return PAK_IGNORE;
|
||||
}
|
||||
|
||||
Inven_Item *equipment_InvenRef = invenR->GetInvenRef(CInventory::INVENTORY_TYPE_ITEM, equipment_pos);
|
||||
if (!equipment_InvenRef)
|
||||
{
|
||||
LOG(u8"inven->GetInvenRef : error \n");
|
||||
YLOG(u8"inven->GetInvenRef : error \n");
|
||||
return PAK_IGNORE;
|
||||
}
|
||||
Inven_Item *item_avartar = invenR->GetInvenRef(CInventory::INVENTORY_TYPE_ITEM, item_pos);
|
||||
if (!item_avartar)
|
||||
{
|
||||
LOG(u8"inven->GetInvenRef : error \n");
|
||||
YLOG(u8"inven->GetInvenRef : error \n");
|
||||
return PAK_IGNORE;
|
||||
}
|
||||
|
||||
if (equipment_InvenRef->isEmpty())
|
||||
{
|
||||
LOG(u8"equipment_InvenRef->isEmpty");
|
||||
YLOG(u8"equipment_InvenRef->isEmpty");
|
||||
return PAK_IGNORE;
|
||||
}
|
||||
if (equipment_InvenRef->getKey() != equipment_id)
|
||||
{
|
||||
LOG(u8"equipment_InvenRef->getKey() != equipment_id");
|
||||
YLOG(u8"equipment_InvenRef->getKey() != equipment_id");
|
||||
user->SendCmdErrorPacket(4, 0);
|
||||
return PAK_IGNORE;
|
||||
}
|
||||
|
||||
if (item_avartar->isEmpty())
|
||||
{
|
||||
LOG(u8"item_avartar->isEmpty");
|
||||
YLOG(u8"item_avartar->isEmpty");
|
||||
return PAK_IGNORE;
|
||||
}
|
||||
|
||||
@@ -94,21 +94,21 @@ ENUM_PACK_RET_TYPE CDispatch::UseEquipmentMoveItem(CUser *user, PacketBuf *pBuf)
|
||||
|
||||
if (!DataManager)
|
||||
{
|
||||
LOG(u8"G_CDataManager error");
|
||||
YLOG(u8"G_CDataManager error");
|
||||
return PAK_IGNORE;
|
||||
}
|
||||
|
||||
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);
|
||||
YLOG(u8"equipment_citem +12: %p", *(int *)equipment_citem + 12);
|
||||
|
||||
if (!equipment_citem || !item_citem)
|
||||
{
|
||||
LOG(u8"!equipment_citem || !item_citem");
|
||||
YLOG(u8"!equipment_citem || !item_citem");
|
||||
return PAK_IGNORE;
|
||||
}
|
||||
|
||||
LOG(u8"UseEquipmentMoveItem [ equipment_pos:%d equipment_id:%d item_pos:%d item_id:%d ]", equipment_pos, equipment_id, item_pos, item_id);
|
||||
YLOG(u8"UseEquipmentMoveItem [ equipment_pos:%d equipment_id:%d item_pos:%d item_id:%d ]", equipment_pos, equipment_id, item_pos, item_id);
|
||||
|
||||
// Data: equipment_citem->GetItemType=147418664 item_citem->is_stackable=1 item_citem->GetItemType=11
|
||||
int equipment_Type = ((CEquipItem *)equipment_citem)->GetItemType();
|
||||
@@ -118,18 +118,18 @@ ENUM_PACK_RET_TYPE CDispatch::UseEquipmentMoveItem(CUser *user, PacketBuf *pBuf)
|
||||
return PAK_OK;
|
||||
}
|
||||
|
||||
LOG(u8"Data: equipment_citem->GetItemType=%d item_citem->is_stackable=%d item_citem->GetItemType=%d", equipment_Type, item_citem->is_stackable(), item_citem->GetItemType());
|
||||
YLOG(u8"Data: equipment_citem->GetItemType=%d item_citem->is_stackable=%d item_citem->GetItemType=%d", equipment_Type, item_citem->is_stackable(), item_citem->GetItemType());
|
||||
|
||||
if (equipment_Type <= 9 || equipment_Type > 21 || equipment_Type == 11)
|
||||
{
|
||||
LOG(u8"equipment_Type <= 9 || equipment_Type > 21 || equipment_Type == 11");
|
||||
YLOG(u8"equipment_Type <= 9 || equipment_Type > 21 || equipment_Type == 11");
|
||||
user->SendCmdErrorPacket(84, 0xD5);
|
||||
return PAK_IGNORE;
|
||||
}
|
||||
|
||||
if (item_citem->is_stackable() != true || item_citem->GetItemType() != ITEM_TYPE_CONSUMABLES)
|
||||
{
|
||||
LOG(u8"item_citem->is_stackable() != true || item_citem->GetItemType() != ITEM_TYPE_CONSUMABLES");
|
||||
YLOG(u8"item_citem->is_stackable() != true || item_citem->GetItemType() != ITEM_TYPE_CONSUMABLES");
|
||||
|
||||
// 没有镜像手机认证,无法使用该功能
|
||||
user->SendCmdErrorPacket(205, 209);
|
||||
@@ -142,7 +142,7 @@ ENUM_PACK_RET_TYPE CDispatch::UseEquipmentMoveItem(CUser *user, PacketBuf *pBuf)
|
||||
int v9 = 0; // 返回给客户端的错误码
|
||||
if (item_id == ITEM_ID_KUAJIESHI)
|
||||
{
|
||||
LOG(u8"user->CheckInTrade:%d", user->CheckInTrade());
|
||||
YLOG(u8"user->CheckInTrade:%d", user->CheckInTrade());
|
||||
|
||||
if (user->CheckInTrade())
|
||||
{
|
||||
@@ -151,14 +151,14 @@ ENUM_PACK_RET_TYPE CDispatch::UseEquipmentMoveItem(CUser *user, PacketBuf *pBuf)
|
||||
if (!user->IsExistAccountCargo())
|
||||
{
|
||||
v9 = 19;
|
||||
LOG(u8"user->IsExistAccountCargo :%d", user->IsExistAccountCargo());
|
||||
YLOG(u8"user->IsExistAccountCargo :%d", user->IsExistAccountCargo());
|
||||
}
|
||||
else
|
||||
{
|
||||
CAccountCargo *AccountCargo = user->GetAccountCargo();
|
||||
|
||||
LOG(u8"ins_item.IsTradeLimitAttachTypeItem :%d", new_equipment_item.IsTradeLimitAttachTypeItem());
|
||||
LOG(u8"AccountCargo->CheckInsertCondition :%d", AccountCargo->CheckInsertCondition(&new_equipment_item));
|
||||
YLOG(u8"ins_item.IsTradeLimitAttachTypeItem :%d", new_equipment_item.IsTradeLimitAttachTypeItem());
|
||||
YLOG(u8"AccountCargo->CheckInsertCondition :%d", AccountCargo->CheckInsertCondition(&new_equipment_item));
|
||||
|
||||
int empty_slot = 0;
|
||||
if (AccountCargo->CheckSlotEmpty(empty_slot) != 1)
|
||||
@@ -167,15 +167,15 @@ ENUM_PACK_RET_TYPE CDispatch::UseEquipmentMoveItem(CUser *user, PacketBuf *pBuf)
|
||||
if (empty_slot < 0)
|
||||
{
|
||||
v9 = 4;
|
||||
LOG("AccountCargo->CheckSlotEmpty :%d", empty_slot);
|
||||
YLOG("AccountCargo->CheckSlotEmpty :%d", empty_slot);
|
||||
return PAK_IGNORE;
|
||||
}
|
||||
}
|
||||
LOG(u8"empty_slot :%d", empty_slot);
|
||||
YLOG(u8"empty_slot :%d", empty_slot);
|
||||
// inven->delete_item(1, emblem_inven_slot, 1, 8, 1);
|
||||
auto invenW = user->getCurCharacInvenW();
|
||||
InterfacePacketBuf *packet_guard = (InterfacePacketBuf *)PacketGuard::NewPacketGuard();
|
||||
LOG("%p", invenW);
|
||||
YLOG("%p", invenW);
|
||||
if (invenW->delete_item(CInventory::INVENTORY_TYPE_ITEM, equipment_pos, 1, 37, 1) && invenW->delete_item(CInventory::INVENTORY_TYPE_ITEM, item_pos, 1, 37, 1))
|
||||
{
|
||||
int a9 = AccountCargo->InsertItem(&new_equipment_item, empty_slot);
|
||||
@@ -243,10 +243,10 @@ ENUM_PACK_RET_TYPE CDispatch::Dispatcher_ModItemAttr_dispatch_sig(Dispatcher_Mod
|
||||
}
|
||||
CEquipItem *equipment_item = (CEquipItem *)CDataManager::G_CDataManager()->find_item(equipment_id);
|
||||
|
||||
LOG("(*(int(**)(CItem*))(*(_DWORD*)equipment_item + 12)) :%p %p"
|
||||
YLOG("(*(int(**)(CItem*))(*(_DWORD*)equipment_item + 12)) :%p %p"
|
||||
|
||||
,
|
||||
(*(int (**)(CItem *))(*(_DWORD *)equipment_item + 12)), ((int (**)(CItem *))(*(_DWORD *)equipment_item + 12))
|
||||
,
|
||||
(*(int (**)(CItem *))(*(_DWORD *)equipment_item + 12)), ((int (**)(CItem *))(*(_DWORD *)equipment_item + 12))
|
||||
|
||||
);
|
||||
|
||||
@@ -325,7 +325,7 @@ ENUM_PACK_RET_TYPE CDispatch::UseJewel_dispatch_sig(void *pDispatcher_UseJewel,
|
||||
|
||||
// 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);
|
||||
YLOG("state :%d \n", state);
|
||||
// 校验角色状态是否允许镶嵌
|
||||
if (state != 3)
|
||||
return PAK_IGNORE;
|
||||
@@ -355,20 +355,20 @@ ENUM_PACK_RET_TYPE CDispatch::UseJewel_dispatch_sig(void *pDispatcher_UseJewel,
|
||||
CInventory *CurCharacInvenW = user->getCurCharacInvenW();
|
||||
if (!CurCharacInvenW)
|
||||
{
|
||||
LOG("pUser->getCurCharacInvenW : error \n");
|
||||
YLOG("pUser->getCurCharacInvenW : error \n");
|
||||
return PAK_IGNORE;
|
||||
}
|
||||
Inven_Item *avartar_inven_item = CurCharacInvenW->GetInvenRef(CInventory::INVENTORY_TYPE_AVARTAR, avartar_inven_slot);
|
||||
if (!avartar_inven_item)
|
||||
{
|
||||
LOG("inven->GetInvenRef : error \n");
|
||||
YLOG("inven->GetInvenRef : error \n");
|
||||
return PAK_IGNORE;
|
||||
}
|
||||
// 校验时装 数据是否合法
|
||||
if (avartar_inven_item->isEmpty() || (avartar_inven_item->getKey() != avartar_item_id) || user->CheckItemLock(2, avartar_inven_slot))
|
||||
{
|
||||
|
||||
LOG("avartar->isEmpty() || avartar->getKey() || pUser->CheckItemLock() : error \n");
|
||||
YLOG("avartar->isEmpty() || avartar->getKey() || pUser->CheckItemLock() : error \n");
|
||||
return PAK_IGNORE;
|
||||
}
|
||||
// 获取时装插槽数据
|
||||
@@ -379,11 +379,11 @@ ENUM_PACK_RET_TYPE CDispatch::UseJewel_dispatch_sig(void *pDispatcher_UseJewel,
|
||||
|
||||
if (!JewelSocketData)
|
||||
{
|
||||
LOG("jewel_socket_data : error \n");
|
||||
YLOG("jewel_socket_data : error \n");
|
||||
return PAK_IGNORE;
|
||||
}
|
||||
|
||||
LOG("jewel_socket_data 1:%s \n", Utils::ToHexString((const unsigned char *)JewelSocketData, 30).c_str());
|
||||
YLOG("jewel_socket_data 1:%s \n", Utils::ToHexString((const unsigned char *)JewelSocketData, 30).c_str());
|
||||
if (emblem_cnt <= 3)
|
||||
{
|
||||
std::map<int, std::pair<int, int>> emblems;
|
||||
@@ -399,14 +399,14 @@ ENUM_PACK_RET_TYPE CDispatch::UseJewel_dispatch_sig(void *pDispatcher_UseJewel,
|
||||
char avartar_socket_slot = 0;
|
||||
pBuf->get_byte(&avartar_socket_slot);
|
||||
|
||||
LOG("emblem_inven_slot :%d emblem_item_id :%d avartar_socket_slot :%d", emblem_inven_slot, emblem_item_id, avartar_socket_slot);
|
||||
YLOG("emblem_inven_slot :%d emblem_item_id :%d avartar_socket_slot :%d", emblem_inven_slot, emblem_item_id, avartar_socket_slot);
|
||||
|
||||
// 获取徽章道具
|
||||
Inven_Item *emblem = CurCharacInvenW->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");
|
||||
YLOG("emblem->isEmpty() || (emblem->getKey() : error \n");
|
||||
user->SendCmdErrorPacket(205, 209);
|
||||
return PAK_IGNORE;
|
||||
}
|
||||
@@ -417,14 +417,14 @@ ENUM_PACK_RET_TYPE CDispatch::UseJewel_dispatch_sig(void *pDispatcher_UseJewel,
|
||||
CDataManager *DataManager = CDataManager::G_CDataManager();
|
||||
if (!DataManager)
|
||||
{
|
||||
LOG("CDataManager::G_CDataManager() : error \n");
|
||||
YLOG("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");
|
||||
YLOG("DataManager->find_item() : error \n");
|
||||
user->SendCmdErrorPacket(205, 209);
|
||||
return PAK_IGNORE;
|
||||
}
|
||||
@@ -432,7 +432,7 @@ ENUM_PACK_RET_TYPE CDispatch::UseJewel_dispatch_sig(void *pDispatcher_UseJewel,
|
||||
// 校验徽章类型
|
||||
if (!citem->is_stackable() || (citem->GetItemType() != 20))
|
||||
{
|
||||
LOG("citem->is_stackable() || (citem->GetItemType() : error \n");
|
||||
YLOG("citem->is_stackable() || (citem->GetItemType() : error \n");
|
||||
user->SendCmdErrorPacket(205, 209);
|
||||
return PAK_IGNORE;
|
||||
}
|
||||
@@ -446,15 +446,15 @@ ENUM_PACK_RET_TYPE CDispatch::UseJewel_dispatch_sig(void *pDispatcher_UseJewel,
|
||||
sizeof(stAvatarEmblemInfo_t);
|
||||
|
||||
int avartar_socket_type = JewelSocketData->EmblemSocketData[avartar_socket_slot].slot_type;
|
||||
LOG("emblem_socket_type :%d avartar_socket_type :%d", emblem_socket_type, avartar_socket_type);
|
||||
YLOG("emblem_socket_type :%d avartar_socket_type :%d", emblem_socket_type, avartar_socket_type);
|
||||
if (!(emblem_socket_type & avartar_socket_type))
|
||||
{
|
||||
// 插槽类型不匹配
|
||||
LOG("emblem_socket_type & avartar_socket_type\n");
|
||||
YLOG("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);
|
||||
YLOG("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);
|
||||
|
||||
if (CurCharacInvenW->delete_item(CInventory::INVENTORY_TYPE_ITEM, emblem_inven_slot, 1, 8, 1))
|
||||
@@ -463,7 +463,7 @@ ENUM_PACK_RET_TYPE CDispatch::UseJewel_dispatch_sig(void *pDispatcher_UseJewel,
|
||||
}
|
||||
}
|
||||
|
||||
LOG("jewel_socket_data 2:%s \n", Utils::ToHexString((const unsigned char *)JewelSocketData, 30).c_str());
|
||||
YLOG("jewel_socket_data 2:%s \n", Utils::ToHexString((const unsigned char *)JewelSocketData, 30).c_str());
|
||||
|
||||
inven_avartar_mgr->setEmblemSocketData(avartar_add_info, JewelSocketData);
|
||||
// 时装插槽数据存档
|
||||
|
||||
@@ -1,6 +1,42 @@
|
||||
#include "l_squirrel.h"
|
||||
#include "l_squirrel_register.hpp"
|
||||
#include "spdlog/spdlog.h"
|
||||
#include <spdlog/spdlog.h>
|
||||
#include <spdlog/sinks/stdout_color_sinks.h>
|
||||
#include <spdlog/sinks/basic_file_sink.h>
|
||||
#include <iostream>
|
||||
#include <ctime>
|
||||
#include <sstream>
|
||||
#include <chrono>
|
||||
|
||||
static char szGamePathA[256];
|
||||
void setupLogger()
|
||||
{
|
||||
getConfigPath(szGamePathA, sizeof(szGamePathA));
|
||||
std::string Path = std::string(szGamePathA);
|
||||
std::string log_filename = "log/dps_log/" + Path.substr(Path.find("cfg") + 4) + "/log_";
|
||||
char time_buffer[100];
|
||||
std::time_t now = std::time(nullptr);
|
||||
std::tm *local_time = std::localtime(&now);
|
||||
strftime(time_buffer, sizeof(time_buffer), "%Y-%m-%d_%H-%M-%S", local_time);
|
||||
log_filename += std::string(time_buffer) + ".txt";
|
||||
|
||||
auto console_sink = std::make_shared<spdlog::sinks::stdout_color_sink_mt>();
|
||||
console_sink->set_level(spdlog::level::info);
|
||||
console_sink->set_pattern("[multi_sink_example] [%^%l%$] %v");
|
||||
|
||||
auto file_sink = std::make_shared<spdlog::sinks::basic_file_sink_mt>(log_filename, true);
|
||||
file_sink->set_level(spdlog::level::info);
|
||||
file_sink->set_pattern("[%Y-%m-%d %H:%M:%S] [%^%l%$] %v");
|
||||
|
||||
auto logger = std::make_shared<spdlog::logger>("logger", spdlog::sinks_init_list{console_sink, file_sink});
|
||||
logger->set_level(spdlog::level::info);
|
||||
logger->flush_on(spdlog::level::info);
|
||||
|
||||
logger->info("欢迎使用Dps插件");
|
||||
|
||||
spdlog::register_logger(logger);
|
||||
spdlog::set_default_logger(logger);
|
||||
}
|
||||
|
||||
// 虚拟机对象
|
||||
HSQUIRRELVM v;
|
||||
@@ -163,8 +199,7 @@ void InitSquirrel()
|
||||
sqstd_register_stringlib(v);
|
||||
sqstd_seterrorhandlers(v);
|
||||
|
||||
// 设置日志格式
|
||||
spdlog::set_pattern("[%Y-%m-%d %H:%M:%S.%e] [%l] %v");
|
||||
setupLogger();
|
||||
sq_setprintfunc(v, printfunc, errorfunc); // sets the print function
|
||||
|
||||
// 输出版本信息
|
||||
|
||||
@@ -333,6 +333,6 @@ namespace Utils
|
||||
|
||||
}
|
||||
|
||||
#define LOG(format, ...) Utils::_Log(format, ##__VA_ARGS__)
|
||||
#define YLOG(format, ...) Utils::_Log(format, ##__VA_ARGS__)
|
||||
|
||||
#endif // utils_h__
|
||||
Reference in New Issue
Block a user