Use PC_MAXHEALTH() in the rest of the codebase.

+ minor fixups
This commit is contained in:
dongresource 2020-09-21 18:03:25 +02:00
parent 113ecc8f60
commit 321dca3f79
4 changed files with 28 additions and 24 deletions

View File

@ -153,11 +153,11 @@ int Database::createCharacter(sP_CL2LS_REQ_SAVE_CHAR_NAME* save, int AccountID)
create.EyeColor = 1; create.EyeColor = 1;
create.FaceStyle = 1; create.FaceStyle = 1;
create.Gender = 1; create.Gender = 1;
create.HP = 1000; create.Level = 1;
create.HP = PC_MAXHEALTH(create.Level);
create.HairColor = 1; create.HairColor = 1;
create.HairStyle = 1; create.HairStyle = 1;
create.Height = 0; create.Height = 0;
create.Level = 1;
create.SkinColor = 1; create.SkinColor = 1;
create.isGM = settings::GM; create.isGM = settings::GM;
create.x_coordinates = settings::SPAWN_X; create.x_coordinates = settings::SPAWN_X;

View File

@ -8,6 +8,7 @@
* implementing just yet anyway. * implementing just yet anyway.
*/ */
// floats
const float VALUE_BATTERY_EMPTY_PENALTY = 0.5f; const float VALUE_BATTERY_EMPTY_PENALTY = 0.5f;
const float CN_EP_RANK_1 = 0.8f; const float CN_EP_RANK_1 = 0.8f;
const float CN_EP_RANK_2 = 0.7f; const float CN_EP_RANK_2 = 0.7f;
@ -15,6 +16,7 @@ const float CN_EP_RANK_3 = 0.5f;
const float CN_EP_RANK_4 = 0.3f; const float CN_EP_RANK_4 = 0.3f;
const float CN_EP_RANK_5 = 0.29f; const float CN_EP_RANK_5 = 0.29f;
// nano powers
enum { enum {
EST_NONE = 0, EST_NONE = 0,
EST_DAMAGE = 1, EST_DAMAGE = 1,

View File

@ -184,6 +184,7 @@ void NanoManager::addNano(CNSocket* sock, int16_t nanoId, int16_t slot) {
resp.Nano.iStamina = 150; resp.Nano.iStamina = 150;
resp.iQuestItemSlotNum = slot; resp.iQuestItemSlotNum = slot;
resp.iPC_Level = level; resp.iPC_Level = level;
resp.iPC_FusionMatter = plr->fusionmatter; // will decrese in actual nano missions
// Update player // Update player
plr->Nanos[nanoId] = resp.Nano; plr->Nanos[nanoId] = resp.Nano;
@ -311,7 +312,7 @@ bool doDebuff(CNSocket *sock, int32_t *pktdata, sSkillResult_Damage_N_Debuff *re
mob->appearanceData.iHP -= amount; mob->appearanceData.iHP -= amount;
if (mob->appearanceData.iHP <= 0) if (mob->appearanceData.iHP <= 0)
MobManager::giveReward(sock); MobManager::killMob(sock, mob);
respdata[i].eCT = 4; respdata[i].eCT = 4;
respdata[i].iDamage = amount; respdata[i].iDamage = amount;
@ -352,6 +353,7 @@ bool doHeal(CNSocket *sock, int32_t *pktdata, sSkillResult_Heal_HP *respdata, in
} }
} }
// player not found
if (plr == nullptr) if (plr == nullptr)
return false; return false;
@ -381,7 +383,7 @@ bool doDamage(CNSocket *sock, int32_t *pktdata, sSkillResult_Damage *respdata, i
mob->appearanceData.iHP -= amount; mob->appearanceData.iHP -= amount;
if (mob->appearanceData.iHP <= 0) if (mob->appearanceData.iHP <= 0)
MobManager::giveReward(sock); MobManager::killMob(sock, mob);
respdata[i].eCT = 4; respdata[i].eCT = 4;
respdata[i].iDamage = amount; respdata[i].iDamage = amount;
@ -431,7 +433,7 @@ bool doLeech(CNSocket *sock, int32_t *pktdata, sSkillResult_Heal_HP *healdata, i
mob->appearanceData.iHP -= amount; mob->appearanceData.iHP -= amount;
if (mob->appearanceData.iHP <= 0) if (mob->appearanceData.iHP <= 0)
MobManager::giveReward(sock); MobManager::killMob(sock, mob);
damagedata->eCT = 4; damagedata->eCT = 4;
damagedata->iDamage = amount; damagedata->iDamage = amount;
@ -444,8 +446,8 @@ bool doLeech(CNSocket *sock, int32_t *pktdata, sSkillResult_Heal_HP *healdata, i
} }
template<class sPAYLOAD, template<class sPAYLOAD,
bool (*work)(CNSocket*,int32_t*,sPAYLOAD*,int,int32_t,int32_t), bool (*work)(CNSocket*,int32_t*,sPAYLOAD*,int,int32_t,int32_t),
bool isLeech=false> bool isLeech=false>
void activePower(CNSocket *sock, CNPacketData *data, void activePower(CNSocket *sock, CNPacketData *data,
int16_t nanoId, int16_t skillId, int16_t eSkillType, int16_t nanoId, int16_t skillId, int16_t eSkillType,
int32_t iCBFlag, int32_t amount) { int32_t iCBFlag, int32_t amount) {
@ -501,15 +503,15 @@ void activePower(CNSocket *sock, CNPacketData *data,
// active nano power dispatch table // active nano power dispatch table
std::vector<ActivePower> ActivePowers = { std::vector<ActivePower> ActivePowers = {
ActivePower(StunPowers, activePower<sSkillResult_Damage_N_Debuff, doDebuff>, EST_STUN, CSB_BIT_STUN, 0), ActivePower(StunPowers, activePower<sSkillResult_Damage_N_Debuff, doDebuff>, EST_STUN, CSB_BIT_STUN, 0),
ActivePower(HealPowers, activePower<sSkillResult_Heal_HP, doHeal>, EST_HEAL_HP, CSB_BIT_NONE, 333), ActivePower(HealPowers, activePower<sSkillResult_Heal_HP, doHeal>, EST_HEAL_HP, CSB_BIT_NONE, 333),
// TODO: Recall // TODO: Recall
ActivePower(DrainPowers, activePower<sSkillResult_Buff, doBuff>, EST_BOUNDINGBALL, CSB_BIT_BOUNDINGBALL, 0), ActivePower(DrainPowers, activePower<sSkillResult_Buff, doBuff>, EST_BOUNDINGBALL, CSB_BIT_BOUNDINGBALL, 0),
ActivePower(SnarePowers, activePower<sSkillResult_Damage_N_Debuff, doDebuff>, EST_SNARE, CSB_BIT_DN_MOVE_SPEED, 0), ActivePower(SnarePowers, activePower<sSkillResult_Damage_N_Debuff, doDebuff>, EST_SNARE, CSB_BIT_DN_MOVE_SPEED, 0),
ActivePower(DamagePowers, activePower<sSkillResult_Damage, doDamage>, EST_DAMAGE, CSB_BIT_NONE, 133), ActivePower(DamagePowers, activePower<sSkillResult_Damage, doDamage>, EST_DAMAGE, CSB_BIT_NONE, 133),
// TODO: GroupRevive // TODO: GroupRevive
ActivePower(LeechPowers, activePower<sSkillResult_Heal_HP, doLeech, true>, EST_BLOODSUCKING, CSB_BIT_NONE, 133), ActivePower(LeechPowers, activePower<sSkillResult_Heal_HP, doLeech, true>, EST_BLOODSUCKING, CSB_BIT_NONE, 133),
ActivePower(SleepPowers, activePower<sSkillResult_Damage_N_Debuff, doDebuff>, EST_SLEEP, CSB_BIT_MEZ, 0), ActivePower(SleepPowers, activePower<sSkillResult_Damage_N_Debuff, doDebuff>, EST_SLEEP, CSB_BIT_MEZ, 0),
}; };
}; // namespace }; // namespace
@ -588,17 +590,17 @@ void NanoManager::nanoUnbuff(CNSocket* sock, int32_t iCBFlag, int16_t eCharStatu
namespace NanoManager { namespace NanoManager {
std::vector<PassivePower> PassivePowers = { std::vector<PassivePower> PassivePowers = {
PassivePower(ScavangePowers, EST_REWARDBLOB, CSB_BIT_REWARD_BLOB, ECSB_REWARD_BLOB, 0), PassivePower(ScavangePowers, EST_REWARDBLOB, CSB_BIT_REWARD_BLOB, ECSB_REWARD_BLOB, 0),
PassivePower(RunPowers, EST_RUN, CSB_BIT_UP_MOVE_SPEED, ECSB_UP_MOVE_SPEED, 200), PassivePower(RunPowers, EST_RUN, CSB_BIT_UP_MOVE_SPEED, ECSB_UP_MOVE_SPEED, 200),
PassivePower(BonusPowers, EST_REWARDCASH, CSB_BIT_REWARD_CASH, ECSB_REWARD_CASH, 0), PassivePower(BonusPowers, EST_REWARDCASH, CSB_BIT_REWARD_CASH, ECSB_REWARD_CASH, 0),
PassivePower(GuardPowers, EST_PROTECTBATTERY, CSB_BIT_PROTECT_BATTERY, ECSB_PROTECT_BATTERY, 0), PassivePower(GuardPowers, EST_PROTECTBATTERY, CSB_BIT_PROTECT_BATTERY, ECSB_PROTECT_BATTERY, 0),
PassivePower(RadarPowers, EST_MINIMAPENEMY, CSB_BIT_MINIMAP_ENEMY, ECSB_MINIMAP_ENEMY, 0), PassivePower(RadarPowers, EST_MINIMAPENEMY, CSB_BIT_MINIMAP_ENEMY, ECSB_MINIMAP_ENEMY, 0),
PassivePower(AntidotePowers, EST_PROTECTINFECTION, CSB_BIT_PROTECT_INFECTION, ECSB_PROTECT_INFECTION, 0), PassivePower(AntidotePowers, EST_PROTECTINFECTION, CSB_BIT_PROTECT_INFECTION, ECSB_PROTECT_INFECTION, 0),
PassivePower(FreedomPowers, EST_FREEDOM, CSB_BIT_FREEDOM, ECSB_FREEDOM, 0), PassivePower(FreedomPowers, EST_FREEDOM, CSB_BIT_FREEDOM, ECSB_FREEDOM, 0),
PassivePower(JumpPowers, EST_JUMP, CSB_BIT_UP_JUMP_HEIGHT, ECSB_UP_JUMP_HEIGHT, 400), PassivePower(JumpPowers, EST_JUMP, CSB_BIT_UP_JUMP_HEIGHT, ECSB_UP_JUMP_HEIGHT, 400),
PassivePower(SelfRevivePowers, EST_PHOENIX, CSB_BIT_PHOENIX, ECSB_PHOENIX, 0), PassivePower(SelfRevivePowers, EST_PHOENIX, CSB_BIT_PHOENIX, ECSB_PHOENIX, 0),
PassivePower(SneakPowers, EST_STEALTH, CSB_BIT_UP_STEALTH, ECSB_UP_STEALTH, 0), PassivePower(SneakPowers, EST_STEALTH, CSB_BIT_UP_STEALTH, ECSB_UP_STEALTH, 0),
PassivePower(TreasureFinderPowers, EST_MINIMAPTRESURE, CSB_BIT_MINIMAP_TRESURE, ECSB_MINIMAP_TRESURE, 0), PassivePower(TreasureFinderPowers, EST_MINIMAPTRESURE, CSB_BIT_MINIMAP_TRESURE, ECSB_MINIMAP_TRESURE, 0),
}; };
}; // namespace }; // namespace

View File

@ -633,7 +633,7 @@ void PlayerManager::revivePlayer(CNSocket* sock, CNPacketData* data) {
plr->x = target.x; plr->x = target.x;
plr->y = target.y; plr->y = target.y;
plr->z = target.z; plr->z = target.z;
plr->HP = 1000 * plr->level; plr->HP = PC_MAXHEALTH(plr->level);
// Response parameters // Response parameters
response.PCRegenData.iActiveNanoSlotNum = plr->activeNano; response.PCRegenData.iActiveNanoSlotNum = plr->activeNano;