2020-08-27 20:16:52 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "CNProtocol.hpp"
|
|
|
|
#include "CNShared.hpp"
|
|
|
|
#include "CNShardServer.hpp"
|
2020-09-16 23:43:48 +00:00
|
|
|
#include "NPC.hpp"
|
|
|
|
|
|
|
|
#include <map>
|
|
|
|
|
|
|
|
enum class MobState {
|
|
|
|
INACTIVE,
|
|
|
|
ROAMING,
|
|
|
|
COMBAT,
|
|
|
|
RETREAT,
|
|
|
|
DEAD
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Mob : public BaseNPC {
|
|
|
|
MobState state;
|
|
|
|
const int maxHealth;
|
|
|
|
time_t killedTime = 0;
|
|
|
|
const int regenTime;
|
|
|
|
|
|
|
|
Mob(int x, int y, int z, int type, int hp, int angle, int rt)
|
|
|
|
: BaseNPC(x, y, z, type), maxHealth(hp), regenTime(rt) {
|
|
|
|
state = MobState::ROAMING;
|
|
|
|
|
|
|
|
// NOTE: there appear to be discrepancies in the dump
|
|
|
|
appearanceData.iHP = maxHealth;
|
|
|
|
}
|
2020-09-18 21:24:15 +00:00
|
|
|
~Mob() {}
|
2020-09-16 23:43:48 +00:00
|
|
|
};
|
2020-08-27 20:16:52 +00:00
|
|
|
|
2020-09-16 19:46:15 +00:00
|
|
|
namespace MobManager {
|
2020-09-16 23:43:48 +00:00
|
|
|
extern std::map<int32_t, Mob*> Mobs;
|
|
|
|
|
2020-08-27 20:16:52 +00:00
|
|
|
void init();
|
2020-09-16 23:43:48 +00:00
|
|
|
void step(time_t);
|
|
|
|
|
|
|
|
void deadStep(Mob*, time_t);
|
2020-08-27 20:16:52 +00:00
|
|
|
|
|
|
|
void pcAttackNpcs(CNSocket *sock, CNPacketData *data);
|
|
|
|
void combatBegin(CNSocket *sock, CNPacketData *data);
|
|
|
|
void combatEnd(CNSocket *sock, CNPacketData *data);
|
|
|
|
void dotDamageOnOff(CNSocket *sock, CNPacketData *data);
|
|
|
|
|
2020-09-16 23:43:48 +00:00
|
|
|
void killMob(CNSocket *sock, Mob *mob);
|
2020-08-27 20:16:52 +00:00
|
|
|
void giveReward(CNSocket *sock);
|
|
|
|
}
|