eggBuffPlayer now takes duration, and buff duration is read from EggType

This commit is contained in:
CakeLancelot 2021-01-06 05:55:55 -06:00
parent 46b6d9fcc7
commit 9e30e55669
3 changed files with 5 additions and 5 deletions

View File

@ -476,7 +476,7 @@ void buffCommand(std::string full, std::vector<std::string>& 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");
}

View File

@ -648,7 +648,7 @@ BaseNPC* NPCManager::getNearestNPC(std::set<Chunk*>* 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

View File

@ -89,7 +89,7 @@ namespace NPCManager {
BaseNPC* getNearestNPC(std::set<Chunk*>* 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);