From 9e30e556693fa8a979e0193edeba87595e3c725a Mon Sep 17 00:00:00 2001 From: CakeLancelot Date: Wed, 6 Jan 2021 05:55:55 -0600 Subject: [PATCH] eggBuffPlayer now takes duration, and buff duration is read from EggType --- src/ChatManager.cpp | 2 +- src/NPCManager.cpp | 6 +++--- src/NPCManager.hpp | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/ChatManager.cpp b/src/ChatManager.cpp index 2501d6a..31890a3 100644 --- a/src/ChatManager.cpp +++ b/src/ChatManager.cpp @@ -476,7 +476,7 @@ void buffCommand(std::string full, std::vector& args, CNSocket* soc if (*tmp) return; - if (NPCManager::eggBuffPlayer(sock, skillId, duration)<0) + if (NPCManager::eggBuffPlayer(sock, skillId, 0, duration)<0) ChatManager::sendServerMessage(sock, "/buff: unknown skill Id"); } diff --git a/src/NPCManager.cpp b/src/NPCManager.cpp index f7aeec5..93ede19 100644 --- a/src/NPCManager.cpp +++ b/src/NPCManager.cpp @@ -648,7 +648,7 @@ BaseNPC* NPCManager::getNearestNPC(std::set* chunks, int X, int Y, int Z return npc; } -int NPCManager::eggBuffPlayer(CNSocket* sock, int skillId, int eggId) { +int NPCManager::eggBuffPlayer(CNSocket* sock, int skillId, int eggId, int duration) { Player* plr = PlayerManager::getPlayer(sock); Player* otherPlr = PlayerManager::getPlayerFromID(plr->iIDGroup); @@ -713,7 +713,7 @@ int NPCManager::eggBuffPlayer(CNSocket* sock, int skillId, int eggId) { // save the buff serverside; // if you get the same buff again, new duration will override the previous one - time_t until = getTime() + (time_t)NanoManager::SkillTable[skillId].durationTime[0] * 25; + time_t until = getTime() + (time_t)duration * 1000; EggBuffs[key] = until; return 0; @@ -818,7 +818,7 @@ void NPCManager::eggPickup(CNSocket* sock, CNPacketData* data) { // buff the player if (type->effectId != 0) - eggBuffPlayer(sock, type->effectId, eggId); + eggBuffPlayer(sock, type->effectId, eggId, type->duration); /* * SHINY_PICKUP_SUCC is only causing a GUI effect in the client diff --git a/src/NPCManager.hpp b/src/NPCManager.hpp index 7250f6e..b21a8e6 100644 --- a/src/NPCManager.hpp +++ b/src/NPCManager.hpp @@ -89,7 +89,7 @@ namespace NPCManager { BaseNPC* getNearestNPC(std::set* chunks, int X, int Y, int Z); /// returns -1 on fail - int eggBuffPlayer(CNSocket* sock, int skillId, int duration); + int eggBuffPlayer(CNSocket* sock, int skillId, int eggId, int duration); void eggStep(CNServer* serv, time_t currTime); void npcDataToEggData(sNPCAppearanceData* npc, sShinyAppearanceData* egg); void eggPickup(CNSocket* sock, CNPacketData* data);