From 4f11cc561efd024b011821ec0ac3f430aa020462 Mon Sep 17 00:00:00 2001 From: Diego Ahumada Date: Sat, 21 Sep 2024 14:02:10 -0300 Subject: [PATCH] fix resets resetting level when they shouldn't, ability/weap prestige being lost --- src/characters/prestige.c | 8 ++++++-- src/characters/v_utils.c | 13 ++++++++----- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/characters/prestige.c b/src/characters/prestige.c index e21c9a4..183091e 100644 --- a/src/characters/prestige.c +++ b/src/characters/prestige.c @@ -180,11 +180,15 @@ void vrx_prestige_menu_handler(edict_t *self, int option) { break; case PRESTIGE_ABILITY_POINTS: self->myskills.speciality_points += 1; + self->myskills.prestige.abilityPoints += 1; self->myskills.prestige.points -= 1; + gi.cprintf(self, PRINT_HIGH, "You have gained an additional ability point.\n"); break; case PRESTIGE_WEAPON_POINTS: - self->myskills.weapon_points += 1; + self->myskills.weapon_points += 4; + self->myskills.prestige.weaponPoints += 1; self->myskills.prestige.points -= 1; + gi.cprintf(self, PRINT_HIGH, "You have gained additional weapon points.\n"); break; case PRESTIGE_ASCEND: vrx_prestige_ascend(self); @@ -250,7 +254,7 @@ void vrx_prestige_reapply_abilities(edict_t* self) { void vrx_prestige_reapply_all(edict_t *self) { struct prestigelist_s *pre = &self->myskills.prestige; self->myskills.speciality_points += pre->abilityPoints; - self->myskills.weapon_points += pre->weaponPoints; + self->myskills.weapon_points += pre->weaponPoints * 4; vrx_prestige_reapply_abilities(self); } diff --git a/src/characters/v_utils.c b/src/characters/v_utils.c index a1bff60..eac5ab7 100644 --- a/src/characters/v_utils.c +++ b/src/characters/v_utils.c @@ -1467,14 +1467,17 @@ void vrx_change_class(char *playername, int newclass, int msgtype) { player->myskills.level = 0; player->myskills.next_level = vrx_get_points_tnl(0); - player->myskills.experience = 0; - for (int j = 1; j <= start_level->value; ++j) { - player->myskills.experience += vrx_get_points_tnl(j - 1); + // reset experience to zero but only if they are ascending + if (msgtype == CHANGECLASS_MSG_ASCEND) { + player->myskills.experience = 0; + for (int j = 1; j <= start_level->value; ++j) { + player->myskills.experience += vrx_get_points_tnl(j - 1); + } } - player->myskills.speciality_points = 0; - player->myskills.weapon_points = 0; + player->myskills.speciality_points = player->myskills.prestige.abilityPoints; + player->myskills.weapon_points = player->myskills.prestige.weaponPoints * 4; vrx_check_for_levelup(player, false); //Save the player.