mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-11-26 06:50:06 +00:00
EggBuffs now stores debuff timestamp instead of remaining time
This commit is contained in:
parent
45ed99ae35
commit
c7006b46ed
@ -19,7 +19,7 @@
|
||||
std::map<int32_t, BaseNPC*> NPCManager::NPCs;
|
||||
std::map<int32_t, WarpLocation> NPCManager::Warps;
|
||||
std::vector<WarpLocation> NPCManager::RespawnPoints;
|
||||
/// sock, CBFlag -> remaining time
|
||||
/// sock, CBFlag -> until
|
||||
std::map<std::pair<CNSocket*, int32_t>, time_t> NPCManager::EggBuffs;
|
||||
nlohmann::json NPCManager::NPCData;
|
||||
|
||||
@ -695,7 +695,9 @@ int NPCManager::eggBuffPlayer(CNSocket* sock, int skillId, int duration) {
|
||||
}
|
||||
|
||||
// save the buff serverside;
|
||||
EggBuffs[key] = duration;
|
||||
// if you get the same buff again, new duration will override the previous one
|
||||
time_t until = getTimestamp() + duration;
|
||||
EggBuffs[key] = until;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -704,9 +706,8 @@ void NPCManager::buffStep(CNServer* serv, time_t currTime) {
|
||||
|
||||
auto it = EggBuffs.begin();
|
||||
while (it != EggBuffs.end()) {
|
||||
// decrement remaining time
|
||||
it->second --;
|
||||
if (it->second > 0)
|
||||
// check remaining time
|
||||
if (it->second > getTimestamp())
|
||||
it++;
|
||||
|
||||
// if time reached 0
|
||||
|
Loading…
Reference in New Issue
Block a user