mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-11-16 19:20:05 +00:00
some struct reorg
This commit is contained in:
parent
eea4107665
commit
9f74b7decb
@ -8,6 +8,15 @@
|
||||
|
||||
std::map<int32_t, SkillData> Abilities::SkillTable;
|
||||
|
||||
namespace Abilities {
|
||||
/*
|
||||
// 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);
|
||||
}
|
||||
*/
|
||||
|
||||
}; // namespace
|
||||
void Abilities::init() {
|
||||
//REGISTER_SHARD_PACKET(P_CL2FE_REQ_PC_EMAIL_UPDATE_CHECK, emailUpdateCheck);
|
||||
}
|
||||
|
@ -5,14 +5,21 @@
|
||||
|
||||
struct SkillData {
|
||||
int skillType;
|
||||
int effectTarget;
|
||||
int effectType;
|
||||
int targetType;
|
||||
int drainType;
|
||||
int batteryDrainType;
|
||||
int effectArea;
|
||||
|
||||
int batteryUse[4];
|
||||
int durationTime[4];
|
||||
int powerIntensity[4];
|
||||
|
||||
int valueTypes[3];
|
||||
int values[3][4];
|
||||
};
|
||||
|
||||
namespace Abilities {
|
||||
extern std::map<int32_t, SkillData> SkillTable;
|
||||
|
||||
void init();
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ int Eggs::eggBuffPlayer(CNSocket* sock, int skillId, int eggId, int duration) {
|
||||
memset(respbuf, 0, resplen);
|
||||
skill->eCT = 1;
|
||||
skill->iID = plr->iID;
|
||||
skill->iDamage = PC_MAXHEALTH(plr->level) * Abilities::SkillTable[skillId].powerIntensity[0] / 1000;
|
||||
skill->iDamage = PC_MAXHEALTH(plr->level) * Abilities::SkillTable[skillId].values[0][0] / 1000;
|
||||
plr->HP -= skill->iDamage;
|
||||
if (plr->HP < 0)
|
||||
plr->HP = 0;
|
||||
@ -51,7 +51,7 @@ int Eggs::eggBuffPlayer(CNSocket* sock, int skillId, int eggId, int duration) {
|
||||
memset(respbuf, 0, resplen);
|
||||
skill->eCT = 1;
|
||||
skill->iID = plr->iID;
|
||||
skill->iHealHP = PC_MAXHEALTH(plr->level) * Abilities::SkillTable[skillId].powerIntensity[0] / 1000;
|
||||
skill->iHealHP = PC_MAXHEALTH(plr->level) * Abilities::SkillTable[skillId].values[0][0] / 1000;
|
||||
plr->HP += skill->iHealHP;
|
||||
if (plr->HP > PC_MAXHEALTH(plr->level))
|
||||
plr->HP = PC_MAXHEALTH(plr->level);
|
||||
|
@ -281,7 +281,7 @@ static void dealCorruption(Mob *mob, std::vector<int> targetData, int skillID, i
|
||||
int style2 = Nanos::nanoStyle(plr->activeNano);
|
||||
if (style2 == -1) { // no nano
|
||||
respdata[i].iHitFlag = HF_BIT_STYLE_TIE;
|
||||
respdata[i].iDamage = Abilities::SkillTable[skillID].powerIntensity[0] * PC_MAXHEALTH((int)mob->data["m_iNpcLevel"]) / 1500;
|
||||
respdata[i].iDamage = Abilities::SkillTable[skillID].values[0][0] * PC_MAXHEALTH((int)mob->data["m_iNpcLevel"]) / 1500;
|
||||
} else if (style == style2) {
|
||||
respdata[i].iHitFlag = HF_BIT_STYLE_TIE;
|
||||
respdata[i].iDamage = 0;
|
||||
@ -300,7 +300,7 @@ static void dealCorruption(Mob *mob, std::vector<int> targetData, int skillID, i
|
||||
pwr.handle(sock, targetData2, plr->activeNano, skillID, 0, 200);*/
|
||||
} else {
|
||||
respdata[i].iHitFlag = HF_BIT_STYLE_LOSE;
|
||||
respdata[i].iDamage = Abilities::SkillTable[skillID].powerIntensity[0] * PC_MAXHEALTH((int)mob->data["m_iNpcLevel"]) / 1500;
|
||||
respdata[i].iDamage = Abilities::SkillTable[skillID].values[0][0] * PC_MAXHEALTH((int)mob->data["m_iNpcLevel"]) / 1500;
|
||||
respdata[i].iNanoStamina = plr->Nanos[plr->activeNano].iStamina -= 90;
|
||||
if (plr->Nanos[plr->activeNano].iStamina < 0) {
|
||||
respdata[i].bNanoDeactive = 1;
|
||||
|
@ -86,7 +86,7 @@ void Nanos::summonNano(CNSocket *sock, int slot, bool silent) {
|
||||
int16_t skillID = plr->Nanos[plr->activeNano].iSkillID;
|
||||
|
||||
// passive nano unbuffing
|
||||
if (Abilities::SkillTable[skillID].drainType == 2) {
|
||||
if (Abilities::SkillTable[skillID].batteryDrainType == 2) {
|
||||
// TODO ABILITIES
|
||||
/*std::vector<int> targetData = Abilities::findTargets(plr, skillID);
|
||||
|
||||
@ -102,7 +102,7 @@ void Nanos::summonNano(CNSocket *sock, int slot, bool silent) {
|
||||
skillID = plr->Nanos[nanoID].iSkillID;
|
||||
|
||||
// passive nano buffing
|
||||
if (Abilities::SkillTable[skillID].drainType == 2) {
|
||||
if (Abilities::SkillTable[skillID].batteryDrainType == 2) {
|
||||
int boost = 0;
|
||||
if (getNanoBoost(plr))
|
||||
boost = 1;
|
||||
|
@ -231,15 +231,31 @@ static void loadXDT(json& xdtData) {
|
||||
// load nano powers
|
||||
json skills = xdtData["m_pSkillTable"]["m_pSkillData"];
|
||||
|
||||
for (json::iterator _skills = skills.begin(); _skills != skills.end(); _skills++) {
|
||||
auto skills = _skills.value();
|
||||
SkillData skillData = { skills["m_iSkillType"], skills["m_iTargetType"], skills["m_iBatteryDrainType"], skills["m_iEffectArea"] };
|
||||
for (json::iterator _skill = skills.begin(); _skill != skills.end(); _skill++) {
|
||||
auto skill = _skill.value();
|
||||
SkillData skillData = {
|
||||
skill["m_iSkillType"],
|
||||
skill["m_iEffectTarget"],
|
||||
skill["m_iEffectType"],
|
||||
skill["m_iTargetType"],
|
||||
skill["m_iBatteryDrainType"],
|
||||
skill["m_iEffectArea"]
|
||||
};
|
||||
|
||||
skillData.valueTypes[0] = skill["m_iValueA_Type"];
|
||||
skillData.valueTypes[1] = skill["m_iValueB_Type"];
|
||||
skillData.valueTypes[2] = skill["m_iValueC_Type"];
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
skillData.batteryUse[i] = skills["m_iBatteryDrainUse"][i];
|
||||
skillData.durationTime[i] = skills["m_iDurationTime"][i];
|
||||
skillData.powerIntensity[i] = skills["m_iValueA"][i];
|
||||
skillData.batteryUse[i] = skill["m_iBatteryDrainUse"][i];
|
||||
skillData.durationTime[i] = skill["m_iDurationTime"][i];
|
||||
|
||||
skillData.values[0][i] = skill["m_iValueA"][i];
|
||||
skillData.values[1][i] = skill["m_iValueB"][i];
|
||||
skillData.values[2][i] = skill["m_iValueC"][i];
|
||||
}
|
||||
Abilities::SkillTable[skills["m_iSkillNumber"]] = skillData;
|
||||
|
||||
Abilities::SkillTable[skill["m_iSkillNumber"]] = skillData;
|
||||
}
|
||||
|
||||
std::cout << "[INFO] Loaded " << Abilities::SkillTable.size() << " nano skills" << std::endl;
|
||||
|
Loading…
Reference in New Issue
Block a user