Active power classification

This commit is contained in:
gsemaj 2022-05-16 20:28:27 -04:00
parent 9f74b7decb
commit c8f5aab929
3 changed files with 65 additions and 12 deletions

View File

@ -17,6 +17,35 @@ static void emailUpdateCheck(CNSocket* sock, CNPacketData* data) {
}
*/
void Abilities::init() {
//REGISTER_SHARD_PACKET(P_CL2FE_REQ_PC_EMAIL_UPDATE_CHECK, emailUpdateCheck);
std::vector<EntityRef> Abilities::matchTargets(SkillData *skill, int count, int32_t *ids) {
std::vector<int> tempTargs;
switch (skill->effectTarget)
{
case SkillEffectTarget::POINT:
std::cout << "[SKILL] POINT; ";
break;
case SkillEffectTarget::SELF:
std::cout << "[SKILL] SELF; ";
break;
case SkillEffectTarget::CONE:
std::cout << "[SKILL] CONE; ";
break;
case SkillEffectTarget::AREA_SELF:
std::cout << "[SKILL] AREA_SELF; ";
break;
case SkillEffectTarget::AREA_TARGET:
std::cout << "[SKILL] AREA_TARGET; ";
break;
}
for (int i = 0; i < count; i++) std::cout << ids[i] << " ";
std::cout << std::endl;
std::vector<EntityRef> targets;
return targets;
}
void Abilities::init() {
//REGISTER_SHARD_PACKET(P_CL2FE_REQ_PC_EMAIL_UPDATE_CHECK, emailUpdateCheck);
}

View File

@ -3,11 +3,26 @@
#include "core/Core.hpp"
#include "Combat.hpp"
enum class SkillEffectTarget {
POINT = 1,
SELF = 2,
CONE = 3,
WEAPON = 4,
AREA_SELF = 5,
AREA_TARGET = 6
};
enum class SkillTargetType {
MOBS = 1,
PLAYERS = 2,
SELF = 3 // only used once by client /shrug
};
struct SkillData {
int skillType;
int effectTarget;
int effectType;
int targetType;
SkillEffectTarget effectTarget;
int effectType; // always 1?
SkillTargetType targetType;
int batteryDrainType;
int effectArea;
@ -21,5 +36,6 @@ struct SkillData {
namespace Abilities {
extern std::map<int32_t, SkillData> SkillTable;
std::vector<EntityRef> matchTargets(SkillData*, int, int32_t*);
void init();
}

View File

@ -84,13 +84,14 @@ void Nanos::summonNano(CNSocket *sock, int slot, bool silent) {
plr->nanoDrainRate = 0;
int16_t skillID = plr->Nanos[plr->activeNano].iSkillID;
SkillData* skillData = &Abilities::SkillTable[skillID];
// passive nano unbuffing
if (Abilities::SkillTable[skillID].batteryDrainType == 2) {
if (skillData->batteryDrainType == 2) {
// TODO ABILITIES
/*std::vector<int> targetData = Abilities::findTargets(plr, skillID);
std::vector<EntityRef> targetData = Abilities::matchTargets(skillData, 0, nullptr);
for (auto& pwr : Abilities::Powers)
/*for (auto& pwr : Abilities::Powers)
if (pwr.skillType == Abilities::SkillTable[skillID].skillType)
Abilities::removeBuff(sock, targetData, pwr.bitFlag, pwr.timeBuffID, 0,(Abilities::SkillTable[skillID].targetType == 3));*/
}
@ -290,8 +291,15 @@ static void nanoSummonHandler(CNSocket* sock, CNPacketData* data) {
static void nanoSkillUseHandler(CNSocket* sock, CNPacketData* data) {
Player *plr = PlayerManager::getPlayer(sock);
int16_t nanoID = plr->activeNano;
int16_t skillID = plr->Nanos[nanoID].iSkillID;
// validate request check
sP_CL2FE_REQ_NANO_SKILL_USE* pkt = (sP_CL2FE_REQ_NANO_SKILL_USE*)data->buf;
if (!validInVarPacket(sizeof(sP_CL2FE_REQ_NANO_SKILL_USE), pkt->iTargetCnt, sizeof(int32_t), data->size)) {
std::cout << "[WARN] bad sP_CL2FE_REQ_NANO_SKILL_USE packet size" << std::endl;
return;
}
int16_t skillID = plr->Nanos[plr->activeNano].iSkillID;
SkillData* skillData = &Abilities::SkillTable[skillID];
DEBUGLOG(
std::cout << PlayerManager::getPlayerName(plr) << " requested to summon nano skill " << std::endl;
@ -306,8 +314,8 @@ static void nanoSkillUseHandler(CNSocket* sock, CNPacketData* data) {
plr->Nanos[plr->activeNano].iStamina = 0;
// TODO ABILITIES
/*std::vector<int> targetData = Abilities::findTargets(plr, skillID, data);
for (auto& pwr : Abilities::Powers)
std::vector<EntityRef> targetData = Abilities::matchTargets(skillData, pkt->iTargetCnt, (int32_t*)(pkt + 1));
/*for (auto& pwr : Abilities::Powers)
if (pwr.skillType == Abilities::SkillTable[skillID].skillType)
pwr.handle(sock, targetData, nanoID, skillID, Abilities::SkillTable[skillID].durationTime[boost], Abilities::SkillTable[skillID].powerIntensity[boost]);*/