OpenFusion/src/NanoManager.hpp

72 lines
2.4 KiB
C++
Raw Normal View History

#pragma once
2020-08-20 15:43:37 +00:00
#include <set>
#include <vector>
2020-08-20 15:43:37 +00:00
#include "CNShardServer.hpp"
typedef void (*PowerHandler)(CNSocket*, int*, int16_t, int16_t, int16_t, int16_t, int16_t, int32_t, int16_t);
struct NanoPower {
int16_t skillType;
int32_t bitFlag;
int16_t timeBuffID;
PowerHandler handler;
NanoPower(int16_t s, int32_t b, int16_t t, PowerHandler h) : skillType(s), bitFlag(b), timeBuffID(t), handler(h) {}
void handle(CNSocket *sock, int* targetData, int16_t nanoID, int16_t skillID, int16_t duration, int16_t amount) {
if (handler == nullptr)
return;
handler(sock, targetData, nanoID, skillID, duration, amount, skillType, bitFlag, timeBuffID);
}
};
struct NanoData {
int style;
};
struct NanoTuning {
int reqItemCount;
int reqItems;
};
2020-11-07 23:22:48 +00:00
struct SkillData {
int skillType;
int targetType;
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 {
extern std::vector<NanoPower> NanoPowers;
extern std::map<int32_t, NanoData> NanoTable;
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-08-20 15:43:37 +00:00
void nanoSummonHandler(CNSocket* sock, CNPacketData* data);
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);
void nanoSkillSetGMHandler(CNSocket* sock, CNPacketData* data);
void nanoRecallRegisterHandler(CNSocket* sock, CNPacketData* data);
2020-09-18 07:10:30 +00:00
void nanoRecallHandler(CNSocket* sock, CNPacketData* data);
void nanoPotionHandler(CNSocket* sock, CNPacketData* data);
// Helper methods
void addNano(CNSocket* sock, int16_t nanoID, int16_t slot, bool spendfm=false);
void summonNano(CNSocket* sock, int slot);
void setNanoSkill(CNSocket* sock, sP_CL2FE_REQ_NANO_TUNE* skill);
void resetNanoSkill(CNSocket* sock, int16_t nanoID);
void nanoUnbuff(CNSocket* sock, int* targetData, int32_t bitFlag, int16_t timeBuffID, int16_t amount, bool groupPower);
bool applyBuff(CNSocket* sock, int skillID, int eTBU, int eTBT, int32_t groupFlags);
int nanoStyle(int nanoID);
int* findTargets(Player* plr, int skillID, CNPacketData* data = nullptr);
2020-08-20 15:43:37 +00:00
}