implemented basic eggs functionality

This commit is contained in:
Kamil
2020-10-24 21:48:55 +02:00
committed by Gent
parent de99522340
commit 674d5112f3
8 changed files with 257 additions and 13 deletions

View File

@@ -7,6 +7,7 @@
#include "contrib/JSON.hpp"
#include <map>
#include <unordered_map>
#include <vector>
#define RESURRECT_HEIGHT 400
@@ -16,11 +17,32 @@ struct WarpLocation {
int x, y, z, instanceID, isInstance, limitTaskID, npcID;
};
struct Egg : public BaseNPC {
bool summoned;
bool dead = false;
time_t deadUntil;
Egg(int x, int y, int z, uint64_t iID, int type, int32_t id, bool summon)
: BaseNPC(x, y, z, 0, iID, type, id) {
summoned = summon;
npcClass = NPCClass::NPC_EGG;
}
};
struct EggType {
int dropCrateId;
int effectId;
int duration;
int regen;
};
namespace NPCManager {
extern std::map<int32_t, BaseNPC*> NPCs;
extern std::map<int32_t, WarpLocation> Warps;
extern std::vector<WarpLocation> RespawnPoints;
extern std::vector<WarpLocation> RespawnPoints;
extern std::unordered_map<int, Egg*> Eggs;
extern std::map<std::pair<CNSocket*, int32_t>, time_t> EggBuffs;
extern std::unordered_map<int, EggType> EggTypes;
extern nlohmann::json NPCData;
extern int32_t nextId;
void init();
@@ -54,5 +76,8 @@ namespace NPCManager {
/// returns -1 on fail
int eggBuffPlayer(CNSocket* sock, int skillId, int duration);
void buffStep(CNServer* serv, time_t currTime);
void eggStep(CNServer* serv, time_t currTime);
void npcDataToEggData(sNPCAppearanceData* npc, sShinyAppearanceData* egg);
void eggSummon(CNSocket* sock, CNPacketData* data);
void eggPickup(CNSocket* sock, CNPacketData* data);
}