mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-16 22:58:34 +00:00
[Character] Record character stats to character_stats_record table (#3522)
* [Character] Record character stats to * Record stats on disconnect as well * Record later in connect process * Move enter zone code path so we're after bonuses * Ok this spot for real * Adjust recording * Update client_packet.cpp * Timestamps * Update database_update_manifest.cpp * Update client_packet.cpp * Fix stat bonuses
This commit is contained in:
@@ -62,6 +62,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#include "../common/repositories/account_repository.h"
|
||||
|
||||
#include "../common/events/player_event_logs.h"
|
||||
#include "../common/repositories/character_stats_record_repository.h"
|
||||
|
||||
extern QueryServ* QServ;
|
||||
extern Zone* zone;
|
||||
@@ -915,6 +916,8 @@ void Client::CompleteConnect()
|
||||
|
||||
heroforge_wearchange_timer.Start(250);
|
||||
|
||||
RecordStats();
|
||||
|
||||
// enforce some rules..
|
||||
if (!CanEnterZone()) {
|
||||
LogInfo("Kicking character [{}] from zone, not allowed here (missing requirements)", GetCleanName());
|
||||
@@ -16392,3 +16395,91 @@ void Client::Handle_OP_RaidClearNPCMarks(const EQApplicationPacket* app)
|
||||
r->RaidClearNPCMarks(this);
|
||||
}
|
||||
}
|
||||
|
||||
void Client::RecordStats()
|
||||
{
|
||||
auto r = CharacterStatsRecordRepository::FindOne(
|
||||
database,
|
||||
CharacterID()
|
||||
);
|
||||
|
||||
r.status = Admin();
|
||||
r.name = GetCleanName();
|
||||
r.aa_points = GetAAPoints() + GetSpentAA();
|
||||
r.level = GetLevel();
|
||||
r.class_ = GetBaseClass();
|
||||
r.race = GetBaseRace();
|
||||
r.hp = GetMaxHP() - GetSpellBonuses().HP;
|
||||
r.mana = GetMaxMana() - GetSpellBonuses().Mana;
|
||||
r.endurance = GetMaxEndurance() - GetSpellBonuses().Endurance;
|
||||
r.ac = GetDisplayAC() - GetSpellBonuses().AC;
|
||||
r.strength = GetSTR() - GetSpellBonuses().STR;
|
||||
r.stamina = GetSTA() - GetSpellBonuses().STA;
|
||||
r.dexterity = GetDEX() - GetSpellBonuses().DEX;
|
||||
r.agility = GetAGI() - GetSpellBonuses().AGI;
|
||||
r.intelligence = GetINT() - GetSpellBonuses().INT;
|
||||
r.wisdom = GetWIS() - GetSpellBonuses().WIS;
|
||||
r.charisma = GetCHA() - GetSpellBonuses().CHA;
|
||||
r.magic_resist = GetMR() - GetSpellBonuses().MR;
|
||||
r.fire_resist = GetFR() - GetSpellBonuses().FR;
|
||||
r.cold_resist = GetCR() - GetSpellBonuses().CR;
|
||||
r.poison_resist = GetPR() - GetSpellBonuses().PR;
|
||||
r.disease_resist = GetDR() - GetSpellBonuses().DR;
|
||||
r.corruption_resist = GetCorrup() - GetSpellBonuses().Corrup;
|
||||
r.heroic_strength = GetHeroicSTR() - GetSpellBonuses().HeroicSTR;
|
||||
r.heroic_stamina = GetHeroicSTA() - GetSpellBonuses().HeroicSTA;
|
||||
r.heroic_dexterity = GetHeroicDEX() - GetSpellBonuses().HeroicDEX;
|
||||
r.heroic_agility = GetHeroicAGI() - GetSpellBonuses().HeroicAGI;
|
||||
r.heroic_intelligence = GetHeroicINT() - GetSpellBonuses().HeroicINT;
|
||||
r.heroic_wisdom = GetHeroicWIS() - GetSpellBonuses().HeroicWIS;
|
||||
r.heroic_charisma = GetHeroicCHA() - GetSpellBonuses().HeroicCHA;
|
||||
r.heroic_magic_resist = GetHeroicMR() - GetSpellBonuses().HeroicMR;
|
||||
r.heroic_fire_resist = GetHeroicFR() - GetSpellBonuses().HeroicFR;
|
||||
r.heroic_cold_resist = GetHeroicCR() - GetSpellBonuses().HeroicCR;
|
||||
r.heroic_poison_resist = GetHeroicPR() - GetSpellBonuses().HeroicPR;
|
||||
r.heroic_disease_resist = GetHeroicDR() - GetSpellBonuses().HeroicDR;
|
||||
r.heroic_corruption_resist = GetHeroicCorrup() - GetSpellBonuses().HeroicCorrup;
|
||||
r.haste = GetHaste();
|
||||
r.accuracy = GetAccuracy() - GetSpellBonuses().Accuracy[EQ::skills::HIGHEST_SKILL + 1];
|
||||
r.attack = GetTotalATK() - GetSpellBonuses().ATK;
|
||||
r.avoidance = GetAvoidance() - GetSpellBonuses().AvoidMeleeChance;
|
||||
r.clairvoyance = GetClair() - GetSpellBonuses().Clairvoyance;
|
||||
r.combat_effects = GetCombatEffects() - GetSpellBonuses().ProcChance;
|
||||
r.damage_shield_mitigation = GetDSMit() - GetSpellBonuses().DSMitigation;
|
||||
r.damage_shield = GetDS() - GetSpellBonuses().DamageShield;
|
||||
r.dot_shielding = GetDoTShield() - GetSpellBonuses().DoTShielding;
|
||||
r.hp_regen = GetHPRegen() - GetSpellBonuses().HPRegen;
|
||||
r.mana_regen = GetManaRegen() - GetSpellBonuses().ManaRegen;
|
||||
r.endurance_regen = GetEnduranceRegen() - GetSpellBonuses().EnduranceRegen;
|
||||
r.shielding = GetShielding() - GetSpellBonuses().MeleeMitigation;
|
||||
r.spell_damage = GetSpellDmg() - GetSpellBonuses().SpellDmg;
|
||||
r.spell_shielding = GetSpellShield() - GetSpellBonuses().SpellShield;
|
||||
r.strikethrough = GetStrikeThrough() - GetSpellBonuses().StrikeThrough;
|
||||
r.stun_resist = GetStunResist() - GetSpellBonuses().StunResist;
|
||||
r.backstab = 0;
|
||||
r.wind = GetWindMod();
|
||||
r.brass = GetBrassMod();
|
||||
r.string = GetStringMod();
|
||||
r.percussion = GetPercMod();
|
||||
r.singing = GetSingMod();
|
||||
r.baking = GetSkill(EQ::skills::SkillType::SkillBaking);
|
||||
r.alchemy = GetSkill(EQ::skills::SkillType::SkillAlchemy);
|
||||
r.jewelry = GetSkill(EQ::skills::SkillType::SkillJewelryMaking);
|
||||
r.tailoring = GetSkill(EQ::skills::SkillType::SkillTailoring);
|
||||
r.blacksmithing = GetSkill(EQ::skills::SkillType::SkillBlacksmithing);
|
||||
r.fletching = GetSkill(EQ::skills::SkillType::SkillFletching);
|
||||
r.brewing = GetSkill(EQ::skills::SkillType::SkillBrewing);
|
||||
r.fishing = GetSkill(EQ::skills::SkillType::SkillFishing);
|
||||
r.pottery = GetSkill(EQ::skills::SkillType::SkillPottery);
|
||||
r.alcohol = GetSkill(EQ::skills::SkillType::SkillAlcoholTolerance);
|
||||
r.tinkering = GetSkill(EQ::skills::SkillType::SkillTinkering);
|
||||
r.updated_at = std::time(nullptr);
|
||||
|
||||
if (r.character_id > 0) {
|
||||
CharacterStatsRecordRepository::UpdateOne(database, r);
|
||||
} else {
|
||||
r.character_id = CharacterID();
|
||||
r.created_at = std::time(nullptr);
|
||||
CharacterStatsRecordRepository::InsertOne(database, r);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user