2021-03-13 20:22:29 +00:00
|
|
|
#include "Abilities.hpp"
|
2022-07-16 23:19:40 +00:00
|
|
|
|
2021-03-13 20:22:29 +00:00
|
|
|
#include "NPCManager.hpp"
|
2022-07-16 23:19:40 +00:00
|
|
|
#include "PlayerManager.hpp"
|
2021-03-13 20:22:29 +00:00
|
|
|
|
2021-06-20 15:02:16 +00:00
|
|
|
std::map<int32_t, SkillData> Abilities::SkillTable;
|
2021-03-13 20:22:29 +00:00
|
|
|
|
2022-05-16 20:47:30 +00:00
|
|
|
/*
|
|
|
|
// New email notification
|
|
|
|
static void emailUpdateCheck(CNSocket* sock, CNPacketData* data) {
|
|
|
|
INITSTRUCT(sP_FE2CL_REP_PC_NEW_EMAIL, resp);
|
|
|
|
resp.iNewEmailCnt = Database::getUnreadEmailCount(PlayerManager::getPlayer(sock)->iID);
|
|
|
|
sock->sendPacket(resp, P_FE2CL_REP_PC_NEW_EMAIL);
|
|
|
|
}
|
|
|
|
*/
|
2021-03-13 20:22:29 +00:00
|
|
|
|
2022-05-18 14:04:28 +00:00
|
|
|
std::vector<EntityRef> Abilities::matchTargets(SkillData* skill, int count, int32_t *ids) {
|
|
|
|
|
|
|
|
std::vector<EntityRef> targets;
|
|
|
|
|
|
|
|
for (int i = 0; i < count; i++) {
|
|
|
|
int32_t id = ids[i];
|
|
|
|
if (skill->targetType == SkillTargetType::MOBS) {
|
|
|
|
// mob?
|
|
|
|
if (NPCManager::NPCs.find(id) != NPCManager::NPCs.end()) targets.push_back(id);
|
|
|
|
else std::cout << "[WARN] skill: id not found\n";
|
|
|
|
} else {
|
|
|
|
// player?
|
|
|
|
CNSocket* sock = PlayerManager::getSockFromID(id);
|
|
|
|
if (sock != nullptr) targets.push_back(sock);
|
|
|
|
else std::cout << "[WARN] skill: sock not found\n";
|
|
|
|
}
|
2022-05-17 00:28:27 +00:00
|
|
|
}
|
|
|
|
|
2022-05-18 14:04:28 +00:00
|
|
|
return targets;
|
|
|
|
}
|
|
|
|
|
2022-07-17 06:33:57 +00:00
|
|
|
void Abilities::useAbility(SkillData* skill, EntityRef src, std::vector<EntityRef> targets) {
|
2022-05-18 14:04:28 +00:00
|
|
|
for (EntityRef target : targets) {
|
|
|
|
Entity* entity = target.getEntity();
|
|
|
|
if (entity->kind != PLAYER && entity->kind != COMBAT_NPC && entity->kind != MOB)
|
|
|
|
continue; // not a combatant
|
2022-05-17 00:28:27 +00:00
|
|
|
|
2022-07-17 06:33:57 +00:00
|
|
|
// TODO abilities
|
2022-05-18 14:04:28 +00:00
|
|
|
}
|
2022-05-17 00:28:27 +00:00
|
|
|
}
|
|
|
|
|
2022-05-16 20:47:30 +00:00
|
|
|
void Abilities::init() {
|
2022-05-17 00:28:27 +00:00
|
|
|
//REGISTER_SHARD_PACKET(P_CL2FE_REQ_PC_EMAIL_UPDATE_CHECK, emailUpdateCheck);
|
2022-05-16 20:47:30 +00:00
|
|
|
}
|