From cd7fec2d5b5a0d97803295f00c74ce53daf1bb8f Mon Sep 17 00:00:00 2001 From: Gent Date: Fri, 18 Sep 2020 14:42:11 -0400 Subject: [PATCH 1/2] Fix invalid item bug --- src/CNShardServer.cpp | 1 - src/ItemManager.cpp | 6 ++++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/CNShardServer.cpp b/src/CNShardServer.cpp index e2aefc2..e6bc59a 100644 --- a/src/CNShardServer.cpp +++ b/src/CNShardServer.cpp @@ -47,7 +47,6 @@ void CNShardServer::keepAliveTimer(CNServer* serv, time_t currTime) { } void CNShardServer::periodicSaveTimer(CNServer* serv, time_t currTime) { - std::cout << "players size: " << PlayerManager::players.size() << std::endl; for (auto& pair : PlayerManager::players) { Database::updatePlayer(pair.second.plr); } diff --git a/src/ItemManager.cpp b/src/ItemManager.cpp index b6b2bc2..627192e 100644 --- a/src/ItemManager.cpp +++ b/src/ItemManager.cpp @@ -162,6 +162,12 @@ void ItemManager::itemGMGiveHandler(CNSocket* sock, CNPacketData* data) { // sock->sendPacket(new CNPacketData((void*)resp, P_FE2CL_REP_PC_GIVE_ITEM_FAIL, sizeof(sP_FE2CL_REP_PC_GIVE_ITEM_FAIL), sock->getFEKey())); } else if (itemreq->eIL == 1 && itemreq->Item.iType >= 0 && itemreq->Item.iType <= 10) { + if (ItemData.find(std::pair(itemreq->Item.iID, itemreq->Item.iType)) == ItemData.end()) { + // invalid item + std::cout << "[WARN] Item id " << itemreq->Item.iID << " with type " << itemreq->Item.iType << " is invalid (give item)" << std::endl; + return; + } + INITSTRUCT(sP_FE2CL_REP_PC_GIVE_ITEM_SUCC, resp); resp.eIL = itemreq->eIL; From 5dbca0b7b1e6a3fa1ce68c6b632872ed93a27612 Mon Sep 17 00:00:00 2001 From: Gent Date: Fri, 18 Sep 2020 23:26:20 -0400 Subject: [PATCH 2/2] Fix fusion matter amount not displaying on enter --- src/PlayerManager.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/PlayerManager.cpp b/src/PlayerManager.cpp index 58c3af8..2cda4e7 100644 --- a/src/PlayerManager.cpp +++ b/src/PlayerManager.cpp @@ -206,6 +206,7 @@ void PlayerManager::enterPlayer(CNSocket* sock, CNPacketData* data) { response.PCLoadData2CL.iHP = plr.HP; response.PCLoadData2CL.iLevel = plr.level; response.PCLoadData2CL.iCandy = plr.money; + response.PCLoadData2CL.iFusionMatter = plr.fusionmatter; response.PCLoadData2CL.iMentor = 5; // Computress response.PCLoadData2CL.iMentorCount = 1; // how many guides the player has had response.PCLoadData2CL.iMapNum = 0;