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-11-12 00:59:52 +00:00
|
|
|
typedef void (*PowerHandler)(CNSocket*, int*, int16_t, int16_t, int16_t, int16_t, int16_t, int32_t, int16_t);
|
2020-09-15 14:46:52 +00:00
|
|
|
|
2020-11-12 00:59:52 +00:00
|
|
|
struct NanoPower {
|
2020-11-08 00:26:44 +00:00
|
|
|
int16_t skillType;
|
|
|
|
int32_t bitFlag;
|
|
|
|
int16_t timeBuffID;
|
|
|
|
PowerHandler handler;
|
2020-09-15 14:46:52 +00:00
|
|
|
|
2020-11-12 00:59:52 +00:00
|
|
|
NanoPower(int16_t s, int32_t b, int16_t t, PowerHandler h) : skillType(s), bitFlag(b), timeBuffID(t), handler(h) {}
|
2020-09-15 14:46:52 +00:00
|
|
|
|
2020-11-12 00:59:52 +00:00
|
|
|
void handle(CNSocket *sock, int* targetData, int16_t nanoID, int16_t skillID, int16_t duration, int16_t amount) {
|
2020-09-15 14:46:52 +00:00
|
|
|
if (handler == nullptr)
|
|
|
|
return;
|
|
|
|
|
2020-11-08 00:26:44 +00:00
|
|
|
handler(sock, targetData, nanoID, skillID, duration, amount, skillType, bitFlag, timeBuffID);
|
2020-09-15 14:46:52 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2020-09-25 05:35:27 +00:00
|
|
|
struct NanoData {
|
|
|
|
int style;
|
|
|
|
};
|
|
|
|
|
2020-10-24 20:28:35 +00:00
|
|
|
struct NanoTuning {
|
|
|
|
int reqItemCount;
|
|
|
|
int reqItems;
|
|
|
|
};
|
|
|
|
|
2020-11-07 23:22:48 +00:00
|
|
|
struct SkillData {
|
|
|
|
int skillType;
|
|
|
|
int targetType;
|
2020-11-08 00:26:44 +00:00
|
|
|
int drainType;
|
2020-11-07 23:22:48 +00:00
|
|
|
int batteryUse[4];
|
|
|
|
int durationTime[4];
|
|
|
|
int powerIntensity[4];
|
|
|
|
};
|
|
|
|
|
2020-08-20 15:43:37 +00:00
|
|
|
namespace NanoManager {
|
2020-11-12 00:59:52 +00:00
|
|
|
extern std::vector<NanoPower> NanoPowers;
|
2020-09-25 05:35:27 +00:00
|
|
|
extern std::map<int32_t, NanoData> NanoTable;
|
2020-10-24 20:28:35 +00:00
|
|
|
extern std::map<int32_t, NanoTuning> NanoTunings;
|
2020-11-07 23:22:48 +00:00
|
|
|
extern std::map<int32_t, SkillData> SkillTable;
|
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-11-08 00:26:44 +00:00
|
|
|
void nanoRecallRegisterHandler(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
|
2020-11-08 00:26:44 +00:00
|
|
|
void addNano(CNSocket* sock, int16_t nanoID, int16_t slot, bool spendfm=false);
|
2020-08-25 18:30:20 +00:00
|
|
|
void summonNano(CNSocket* sock, int slot);
|
2020-10-24 20:28:35 +00:00
|
|
|
void setNanoSkill(CNSocket* sock, sP_CL2FE_REQ_NANO_TUNE* skill);
|
2020-11-08 00:26:44 +00:00
|
|
|
void resetNanoSkill(CNSocket* sock, int16_t nanoID);
|
2020-11-12 00:59:52 +00:00
|
|
|
void nanoUnbuff(CNSocket* sock, int* targetData, int32_t bitFlag, int16_t timeBuffID, int16_t amount, bool groupPower);
|
2020-11-08 00:26:44 +00:00
|
|
|
void applyBuff(CNSocket* sock, int skillID, int eTBU, int eTBT, int32_t groupFlags);
|
|
|
|
int nanoStyle(int nanoID);
|
2020-11-12 00:59:52 +00:00
|
|
|
int* findTargets(Player* plr, int skillID, CNPacketData* data = nullptr);
|
2020-08-20 15:43:37 +00:00
|
|
|
}
|