2020-08-23 17:14:54 +00:00
|
|
|
#pragma once
|
2020-08-20 15:43:37 +00:00
|
|
|
|
2020-09-15 14:46:52 +00:00
|
|
|
#include <set>
|
|
|
|
#include <vector>
|
|
|
|
|
2020-08-20 15:43:37 +00:00
|
|
|
#include "CNShardServer.hpp"
|
|
|
|
|
2020-09-18 16:37:26 +00:00
|
|
|
typedef void (*ActivePowerHandler)(CNSocket*, CNPacketData*, int16_t, int16_t, int16_t, int32_t, int32_t);
|
2020-09-15 14:46:52 +00:00
|
|
|
|
|
|
|
struct ActivePower {
|
|
|
|
std::set<int> powers;
|
|
|
|
ActivePowerHandler handler;
|
2020-09-18 16:37:26 +00:00
|
|
|
int16_t eSkillType;
|
2020-09-15 14:46:52 +00:00
|
|
|
int32_t flag;
|
|
|
|
int32_t amount;
|
|
|
|
|
2020-09-18 16:37:26 +00:00
|
|
|
ActivePower(std::set<int> p, ActivePowerHandler h, int16_t t, int32_t f, int32_t a) : powers(p), handler(h), eSkillType(t), flag(f), amount(a) {}
|
2020-09-15 14:46:52 +00:00
|
|
|
|
|
|
|
void handle(CNSocket *sock, CNPacketData *data, int16_t nanoId, int16_t skillId) {
|
|
|
|
if (handler == nullptr)
|
|
|
|
return;
|
|
|
|
|
|
|
|
handler(sock, data, nanoId, skillId, eSkillType, flag, amount);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2020-09-18 16:37:26 +00:00
|
|
|
struct PassivePower {
|
|
|
|
std::set<int> powers;
|
|
|
|
int16_t eSkillType;
|
|
|
|
int32_t iCBFlag;
|
|
|
|
int16_t eCharStatusTimeBuffID;
|
|
|
|
int16_t iValue;
|
|
|
|
|
|
|
|
PassivePower(std::set<int> p, int16_t t, int32_t f, int16_t b, int16_t a) : powers(p), eSkillType(t), iCBFlag(f), eCharStatusTimeBuffID(b), iValue(a) {}
|
|
|
|
};
|
|
|
|
|
2020-09-25 05:35:27 +00:00
|
|
|
struct NanoData {
|
|
|
|
int style;
|
|
|
|
};
|
|
|
|
|
2020-08-20 15:43:37 +00:00
|
|
|
namespace NanoManager {
|
2020-09-15 14:46:52 +00:00
|
|
|
extern std::vector<ActivePower> ActivePowers;
|
2020-09-18 16:37:26 +00:00
|
|
|
extern std::vector<PassivePower> PassivePowers;
|
2020-09-25 05:35:27 +00:00
|
|
|
extern std::map<int32_t, NanoData> NanoTable;
|
2020-08-20 15:43:37 +00:00
|
|
|
void init();
|
2020-09-15 14:46:52 +00:00
|
|
|
|
2020-08-20 15:43:37 +00:00
|
|
|
void nanoSummonHandler(CNSocket* sock, CNPacketData* data);
|
2020-08-22 18:02:08 +00:00
|
|
|
void nanoEquipHandler(CNSocket* sock, CNPacketData* data);
|
|
|
|
void nanoUnEquipHandler(CNSocket* sock, CNPacketData* data);
|
|
|
|
void nanoGMGiveHandler(CNSocket* sock, CNPacketData* data);
|
|
|
|
void nanoSkillUseHandler(CNSocket* sock, CNPacketData* data);
|
|
|
|
void nanoSkillSetHandler(CNSocket* sock, CNPacketData* data);
|
2020-09-09 01:15:25 +00:00
|
|
|
void nanoSkillSetGMHandler(CNSocket* sock, CNPacketData* data);
|
2020-09-18 07:10:30 +00:00
|
|
|
void nanoRecallHandler(CNSocket* sock, CNPacketData* data);
|
2020-09-25 05:35:27 +00:00
|
|
|
void nanoPotionHandler(CNSocket* sock, CNPacketData* data);
|
2020-08-22 18:02:08 +00:00
|
|
|
|
|
|
|
// Helper methods
|
|
|
|
void addNano(CNSocket* sock, int16_t nanoId, int16_t slot);
|
2020-08-25 18:30:20 +00:00
|
|
|
void summonNano(CNSocket* sock, int slot);
|
2020-08-22 18:02:08 +00:00
|
|
|
void setNanoSkill(CNSocket* sock, int16_t nanoId, int16_t skillId);
|
|
|
|
void resetNanoSkill(CNSocket* sock, int16_t nanoId);
|
2020-09-18 07:10:30 +00:00
|
|
|
|
|
|
|
void nanoBuff(CNSocket* sock, int16_t nanoId, int skillId, int16_t eSkillType, int32_t iCBFlag, int16_t eCharStatusTimeBuffID, int16_t iValue = 0);
|
|
|
|
void nanoUnbuff(CNSocket* sock, int32_t iCBFlag, int16_t eCharStatusTimeBuffID, int16_t iValue = 0);
|
2020-09-25 05:35:27 +00:00
|
|
|
|
|
|
|
int nanoStyle(int nanoId);
|
2020-08-20 15:43:37 +00:00
|
|
|
}
|