Vendors, set nano skill command + serverside command issues fixed (#74)

Added basic shopkeeper functions, a player can buy the preset 3 items (cannonbolt set), all shopkeepers have the same items atm (need to check the shopkeeper tabledata), setting itemprice is something I didn't figure out.
Added set nano skill command
Implemented a switch for certain commands like health/taros/fusionmatter etc to be handled on the serverside aswell

Co-authored-by: dongresource <dongresource@protonmail.com>
This commit is contained in:
Ariii
2020-09-09 03:15:25 +02:00
committed by dongresource
parent 468840c9ea
commit 3865249387
5 changed files with 148 additions and 0 deletions

View File

@@ -548,6 +548,8 @@ void PlayerManager::setSpecialPlayer(CNSocket* sock, CNPacketData* data) {
return; // ignore the malformed packet
sP_CL2FE_GM_REQ_PC_SET_VALUE* setData = (sP_CL2FE_GM_REQ_PC_SET_VALUE*)data->buf;
Player *plr = PlayerManager::getPlayer(sock);
INITSTRUCT(sP_FE2CL_GM_REP_PC_SET_VALUE, response);
DEBUGLOG(
@@ -557,6 +559,27 @@ void PlayerManager::setSpecialPlayer(CNSocket* sock, CNPacketData* data) {
std::cout << "\tSetValue: " << setData->iSetValue << std::endl;
)
// Handle serverside value-changes
switch (setData->iSetValueType) {
case 1:
plr->HP = setData->iSetValue;
break;
case 2:
// TODO: batteryW
break;
case 3:
// TODO: batteryN nanopotion
break;
case 4:
plr->fusionmatter = setData->iSetValue;
break;
case 5:
plr->money = setData->iSetValue;
break;
default:
break;
}
response.iPC_ID = setData->iPC_ID;
response.iSetValue = setData->iSetValue;
response.iSetValueType = setData->iSetValueType;