From 6808365d48e14c790897c7cf412cf40eaf0a31f6 Mon Sep 17 00:00:00 2001 From: JadeShrineMaiden <69916714+JadeShrineMaiden@users.noreply.github.com> Date: Wed, 26 Aug 2020 18:39:49 +0100 Subject: [PATCH] Sanity checks fix (#41) * Sanity checks + Starting level changes - Item movement handler checks to make sure items aren't moved from equipment slot to equipment slot. - Item give command checks to make sure an out of bounds item is not spawned (Below iType 0 or above iType 8) - Players now begin at level 36, consequently the item give command does not level you up now. * Sanity Check - Prevents out of bounds item movement by comparing it to AINVEN_COUNT. * Update ItemManager.cpp * Update ItemManager.cpp --- src/ItemManager.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ItemManager.cpp b/src/ItemManager.cpp index 82e283e..67fff60 100644 --- a/src/ItemManager.cpp +++ b/src/ItemManager.cpp @@ -19,8 +19,8 @@ void ItemManager::itemMoveHandler(CNSocket* sock, CNPacketData* data) { PlayerView& plr = PlayerManager::players[sock]; - if (itemmove->eFrom == 0 && itemmove->eTo == 0) { - // this packet should never happen, tell the client to do nothing and do nothing ourself + if (plr.plr->Equip[itemmove->iFromSlotNum].iType != 0 && itemmove->eFrom == 0 && itemmove->eTo == 0) { + // this packet should never happen unless it is a weapon, tell the client to do nothing and do nothing ourself resp.eTo = itemmove->eFrom; resp.iToSlotNum = itemmove->iFromSlotNum; resp.ToSlotItem = plr.plr->Equip[itemmove->iToSlotNum]; @@ -28,7 +28,7 @@ void ItemManager::itemMoveHandler(CNSocket* sock, CNPacketData* data) { resp.iFromSlotNum = itemmove->iToSlotNum; resp.FromSlotItem = plr.plr->Equip[itemmove->iFromSlotNum]; - sock->sendPacket((void*)&resp, P_FE2CL_REP_PC_ITEM_DELETE_SUCC, sizeof(sP_FE2CL_REP_PC_ITEM_DELETE_SUCC)); + sock->sendPacket((void*)&resp, P_FE2CL_PC_ITEM_MOVE_SUCC, sizeof(sP_FE2CL_PC_ITEM_MOVE_SUCC)); return; }