#pragma once #include "core/Core.hpp" #include "JSON.hpp" #include "Transport.hpp" #include "Chunking.hpp" #include "Entities.hpp" #include #include #include #include #define RESURRECT_HEIGHT 400 typedef void (*NPCEventHandler)(CombatNPC*); struct NPCEvent { int32_t npcType; AIState triggerState; NPCEventHandler handler; NPCEvent(int32_t t, AIState tr, NPCEventHandler hndlr) : npcType(t), triggerState(tr), handler(hndlr) {} }; namespace NPCManager { extern std::unordered_map NPCs; extern std::map Warps; extern std::vector RespawnPoints; extern std::vector NPCEvents; extern nlohmann::json NPCData; extern int32_t nextId; void init(); void queueNPCRemoval(int32_t); void destroyNPC(int32_t); void updateNPCPosition(int32_t, int X, int Y, int Z, uint64_t I, int angle); void sendToViewable(Entity* npc, void* buf, uint32_t type, size_t size); BaseNPC *summonNPC(int x, int y, int z, uint64_t instance, int type, bool respawn=false, bool baseInstance=false); BaseNPC* getNearestNPC(std::set* chunks, int X, int Y, int Z); }