mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-11-17 03:20:06 +00:00
Make SkillType an enum class
This commit is contained in:
parent
eaebe3ba4c
commit
78c15e2899
@ -126,50 +126,50 @@ static std::vector<SkillResult> handleSkill(SkillData* skill, int power, ICombat
|
||||
|
||||
switch(skill->skillType)
|
||||
{
|
||||
case EST_DAMAGE:
|
||||
case SkillType::DAMAGE:
|
||||
resultSize = sizeof(sSkillResult_Damage);
|
||||
skillHandler = handleSkillDamage;
|
||||
break;
|
||||
case EST_HEAL_HP:
|
||||
case EST_RETURNHOMEHEAL:
|
||||
case SkillType::HEAL_HP:
|
||||
case SkillType::RETURNHOMEHEAL:
|
||||
resultSize = sizeof(sSkillResult_Heal_HP);
|
||||
skillHandler = handleSkillHealHP;
|
||||
break;
|
||||
case EST_JUMP:
|
||||
case EST_RUN:
|
||||
case EST_FREEDOM:
|
||||
case EST_PHOENIX:
|
||||
case EST_INVULNERABLE:
|
||||
case EST_MINIMAPENEMY:
|
||||
case EST_MINIMAPTRESURE:
|
||||
case EST_NANOSTIMPAK:
|
||||
case EST_PROTECTBATTERY:
|
||||
case EST_PROTECTINFECTION:
|
||||
case EST_REWARDBLOB:
|
||||
case EST_REWARDCASH:
|
||||
case EST_STAMINA_SELF:
|
||||
case EST_STEALTH:
|
||||
case SkillType::JUMP:
|
||||
case SkillType::RUN:
|
||||
case SkillType::FREEDOM:
|
||||
case SkillType::PHOENIX:
|
||||
case SkillType::INVULNERABLE:
|
||||
case SkillType::MINIMAPENEMY:
|
||||
case SkillType::MINIMAPTRESURE:
|
||||
case SkillType::NANOSTIMPAK:
|
||||
case SkillType::PROTECTBATTERY:
|
||||
case SkillType::PROTECTINFECTION:
|
||||
case SkillType::REWARDBLOB:
|
||||
case SkillType::REWARDCASH:
|
||||
case SkillType::STAMINA_SELF:
|
||||
case SkillType::STEALTH:
|
||||
resultSize = sizeof(sSkillResult_Buff);
|
||||
skillHandler = handleSkillBuff;
|
||||
break;
|
||||
case EST_BATTERYDRAIN:
|
||||
case SkillType::BATTERYDRAIN:
|
||||
resultSize = sizeof(sSkillResult_BatteryDrain);
|
||||
skillHandler = handleSkillBatteryDrain;
|
||||
break;
|
||||
case EST_RECALL: // still soft lock
|
||||
case EST_RECALL_GROUP: // works for player who uses it
|
||||
case SkillType::RECALL: // still soft lock
|
||||
case SkillType::RECALL_GROUP: // works for player who uses it
|
||||
resultSize = sizeof(sSkillResult_Move);
|
||||
skillHandler = handleSkillMove;
|
||||
break;
|
||||
case EST_PHOENIX_GROUP: // broken
|
||||
case SkillType::PHOENIX_GROUP: // broken
|
||||
resultSize = sizeof(sSkillResult_Resurrect);
|
||||
skillHandler = handleSkillResurrect;
|
||||
break;
|
||||
case EST_RETROROCKET_SELF:
|
||||
case SkillType::RETROROCKET_SELF:
|
||||
// no-op
|
||||
return results;
|
||||
default:
|
||||
std::cout << "[WARN] Unhandled skill type " << skill->skillType << std::endl;
|
||||
std::cout << "[WARN] Unhandled skill type " << (int)skill->skillType << std::endl;
|
||||
return results;
|
||||
}
|
||||
|
||||
@ -178,7 +178,7 @@ static std::vector<SkillResult> handleSkill(SkillData* skill, int power, ICombat
|
||||
SkillResult result = skillHandler(skill, power, src != nullptr ? src : target, target);
|
||||
if(result.size == 0) continue; // skill not applicable
|
||||
if(result.size != resultSize) {
|
||||
std::cout << "[WARN] bad skill result size for " << skill->skillType << " from " << (void*)handleSkillBuff << std::endl;
|
||||
std::cout << "[WARN] bad skill result size for " << (int)skill->skillType << " from " << (void*)handleSkillBuff << std::endl;
|
||||
continue;
|
||||
}
|
||||
results.push_back(result);
|
||||
@ -225,7 +225,7 @@ void Abilities::useNanoSkill(CNSocket* sock, SkillData* skill, sNano& nano, std:
|
||||
pkt->iSkillID = nano.iSkillID;
|
||||
pkt->iNanoStamina = nano.iStamina;
|
||||
pkt->bNanoDeactive = nano.iStamina <= 0;
|
||||
pkt->eST = skill->skillType;
|
||||
pkt->eST = (int32_t)skill->skillType;
|
||||
pkt->iTargetCnt = (int32_t)results.size();
|
||||
|
||||
attachSkillResults(results, resultSize, (uint8_t*)(pkt + 1));
|
||||
@ -263,7 +263,7 @@ void Abilities::useNPCSkill(EntityRef npc, int skillID, std::vector<ICombatant*>
|
||||
sP_FE2CL_NPC_SKILL_HIT* pkt = (sP_FE2CL_NPC_SKILL_HIT*)respbuf;
|
||||
pkt->iNPC_ID = npc.id;
|
||||
pkt->iSkillID = skillID;
|
||||
pkt->eST = skill->skillType;
|
||||
pkt->eST = (int32_t)skill->skillType;
|
||||
pkt->iTargetCnt = (int32_t)results.size();
|
||||
|
||||
attachSkillResults(results, resultSize, (uint8_t*)(pkt + 1));
|
||||
@ -324,62 +324,62 @@ std::vector<ICombatant*> Abilities::matchTargets(ICombatant* src, SkillData* ski
|
||||
}
|
||||
|
||||
/* ripped from client (enums emplaced) */
|
||||
int Abilities::getCSTBFromST(int eSkillType) {
|
||||
int Abilities::getCSTBFromST(SkillType skillType) {
|
||||
int result = 0;
|
||||
switch (eSkillType)
|
||||
switch (skillType)
|
||||
{
|
||||
case EST_RUN:
|
||||
case SkillType::RUN:
|
||||
result = ECSB_UP_MOVE_SPEED;
|
||||
break;
|
||||
case EST_JUMP:
|
||||
case SkillType::JUMP:
|
||||
result = ECSB_UP_JUMP_HEIGHT;
|
||||
break;
|
||||
case EST_STEALTH:
|
||||
case SkillType::STEALTH:
|
||||
result = ECSB_UP_STEALTH;
|
||||
break;
|
||||
case EST_PHOENIX:
|
||||
case SkillType::PHOENIX:
|
||||
result = ECSB_PHOENIX;
|
||||
break;
|
||||
case EST_PROTECTBATTERY:
|
||||
case SkillType::PROTECTBATTERY:
|
||||
result = ECSB_PROTECT_BATTERY;
|
||||
break;
|
||||
case EST_PROTECTINFECTION:
|
||||
case SkillType::PROTECTINFECTION:
|
||||
result = ECSB_PROTECT_INFECTION;
|
||||
break;
|
||||
case EST_SNARE:
|
||||
case SkillType::SNARE:
|
||||
result = ECSB_DN_MOVE_SPEED;
|
||||
break;
|
||||
case EST_SLEEP:
|
||||
case SkillType::SLEEP:
|
||||
result = ECSB_MEZ;
|
||||
break;
|
||||
case EST_MINIMAPENEMY:
|
||||
case SkillType::MINIMAPENEMY:
|
||||
result = ECSB_MINIMAP_ENEMY;
|
||||
break;
|
||||
case EST_MINIMAPTRESURE:
|
||||
case SkillType::MINIMAPTRESURE:
|
||||
result = ECSB_MINIMAP_TRESURE;
|
||||
break;
|
||||
case EST_REWARDBLOB:
|
||||
case SkillType::REWARDBLOB:
|
||||
result = ECSB_REWARD_BLOB;
|
||||
break;
|
||||
case EST_REWARDCASH:
|
||||
case SkillType::REWARDCASH:
|
||||
result = ECSB_REWARD_CASH;
|
||||
break;
|
||||
case EST_INFECTIONDAMAGE:
|
||||
case SkillType::INFECTIONDAMAGE:
|
||||
result = ECSB_INFECTION;
|
||||
break;
|
||||
case EST_FREEDOM:
|
||||
case SkillType::FREEDOM:
|
||||
result = ECSB_FREEDOM;
|
||||
break;
|
||||
case EST_BOUNDINGBALL:
|
||||
case SkillType::BOUNDINGBALL:
|
||||
result = ECSB_BOUNDINGBALL;
|
||||
break;
|
||||
case EST_INVULNERABLE:
|
||||
case SkillType::INVULNERABLE:
|
||||
result = ECSB_INVULNERABLE;
|
||||
break;
|
||||
case EST_BUFFHEAL:
|
||||
case SkillType::BUFFHEAL:
|
||||
result = ECSB_HEAL;
|
||||
break;
|
||||
case EST_NANOSTIMPAK:
|
||||
case SkillType::NANOSTIMPAK:
|
||||
result = ECSB_STIMPAKSLOT1;
|
||||
break;
|
||||
}
|
||||
|
@ -10,6 +10,47 @@
|
||||
|
||||
constexpr size_t MAX_SKILLRESULT_SIZE = sizeof(sSkillResult_BatteryDrain);
|
||||
|
||||
enum class SkillType {
|
||||
DAMAGE = 1,
|
||||
HEAL_HP = 2,
|
||||
KNOCKDOWN = 3,
|
||||
SLEEP = 4,
|
||||
SNARE = 5,
|
||||
HEAL_STAMINA = 6,
|
||||
STAMINA_SELF = 7,
|
||||
STUN = 8,
|
||||
WEAPONSLOW = 9,
|
||||
JUMP = 10,
|
||||
RUN = 11,
|
||||
STEALTH = 12,
|
||||
SWIM = 13,
|
||||
MINIMAPENEMY = 14,
|
||||
MINIMAPTRESURE = 15,
|
||||
PHOENIX = 16,
|
||||
PROTECTBATTERY = 17,
|
||||
PROTECTINFECTION = 18,
|
||||
REWARDBLOB = 19,
|
||||
REWARDCASH = 20,
|
||||
BATTERYDRAIN = 21,
|
||||
CORRUPTIONATTACK = 22,
|
||||
INFECTIONDAMAGE = 23,
|
||||
KNOCKBACK = 24,
|
||||
FREEDOM = 25,
|
||||
PHOENIX_GROUP = 26,
|
||||
RECALL = 27,
|
||||
RECALL_GROUP = 28,
|
||||
RETROROCKET_SELF = 29,
|
||||
BLOODSUCKING = 30,
|
||||
BOUNDINGBALL = 31,
|
||||
INVULNERABLE = 32,
|
||||
NANOSTIMPAK = 33,
|
||||
RETURNHOMEHEAL = 34,
|
||||
BUFFHEAL = 35,
|
||||
EXTRABANK = 36,
|
||||
CORRUPTIONATTACKWIN = 38,
|
||||
CORRUPTIONATTACKLOSE = 39,
|
||||
};
|
||||
|
||||
enum class SkillEffectTarget {
|
||||
POINT = 1,
|
||||
SELF = 2,
|
||||
@ -43,7 +84,7 @@ struct SkillResult {
|
||||
};
|
||||
|
||||
struct SkillData {
|
||||
int skillType; // eST
|
||||
SkillType skillType; // eST
|
||||
SkillEffectTarget effectTarget;
|
||||
int effectType; // always 1?
|
||||
SkillTargetType targetType;
|
||||
@ -64,5 +105,5 @@ namespace Abilities {
|
||||
void useNPCSkill(EntityRef, int skillID, std::vector<ICombatant*>);
|
||||
|
||||
std::vector<ICombatant*> matchTargets(ICombatant*, SkillData*, int, int32_t*);
|
||||
int getCSTBFromST(int eSkillType);
|
||||
int getCSTBFromST(SkillType skillType);
|
||||
}
|
||||
|
@ -482,7 +482,7 @@ static void itemUseHandler(CNSocket* sock, CNPacketData* data) {
|
||||
resp->iSlotNum = request->iSlotNum;
|
||||
resp->RemainItem = gumball;
|
||||
resp->iTargetCnt = 1;
|
||||
resp->eST = EST_NANOSTIMPAK;
|
||||
resp->eST = (int32_t)SkillType::NANOSTIMPAK;
|
||||
resp->iSkillID = 144;
|
||||
|
||||
int eCSB = ECSB_STIMPAKSLOT1 + request->iNanoSlot;
|
||||
|
@ -46,49 +46,8 @@ enum class ePCRegenType {
|
||||
End
|
||||
};
|
||||
|
||||
// nano powers
|
||||
// nano power flags
|
||||
enum {
|
||||
EST_NONE = 0,
|
||||
EST_DAMAGE = 1,
|
||||
EST_HEAL_HP = 2,
|
||||
EST_KNOCKDOWN = 3,
|
||||
EST_SLEEP = 4,
|
||||
EST_SNARE = 5,
|
||||
EST_HEAL_STAMINA = 6,
|
||||
EST_STAMINA_SELF = 7,
|
||||
EST_STUN = 8,
|
||||
EST_WEAPONSLOW = 9,
|
||||
EST_JUMP = 10,
|
||||
EST_RUN = 11,
|
||||
EST_STEALTH = 12,
|
||||
EST_SWIM = 13,
|
||||
EST_MINIMAPENEMY = 14,
|
||||
EST_MINIMAPTRESURE = 15,
|
||||
EST_PHOENIX = 16,
|
||||
EST_PROTECTBATTERY = 17,
|
||||
EST_PROTECTINFECTION = 18,
|
||||
EST_REWARDBLOB = 19,
|
||||
EST_REWARDCASH = 20,
|
||||
EST_BATTERYDRAIN = 21,
|
||||
EST_CORRUPTIONATTACK = 22,
|
||||
EST_INFECTIONDAMAGE = 23,
|
||||
EST_KNOCKBACK = 24,
|
||||
EST_FREEDOM = 25,
|
||||
EST_PHOENIX_GROUP = 26,
|
||||
EST_RECALL = 27,
|
||||
EST_RECALL_GROUP = 28,
|
||||
EST_RETROROCKET_SELF = 29,
|
||||
EST_BLOODSUCKING = 30,
|
||||
EST_BOUNDINGBALL = 31,
|
||||
EST_INVULNERABLE = 32,
|
||||
EST_NANOSTIMPAK = 33,
|
||||
EST_RETURNHOMEHEAL = 34,
|
||||
EST_BUFFHEAL = 35,
|
||||
EST_EXTRABANK = 36,
|
||||
EST__END = 37,
|
||||
EST_CORRUPTIONATTACKWIN = 38,
|
||||
EST_CORRUPTIONATTACKLOSE = 39,
|
||||
|
||||
ECSB_NONE = 0,
|
||||
ECSB_UP_MOVE_SPEED = 1,
|
||||
ECSB_UP_SWIM_SPEED = 2,
|
||||
|
Loading…
Reference in New Issue
Block a user