From 79801598da938d85fe6eaf7eb3d4e3431185f0c2 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Thu, 16 Dec 2021 13:59:03 +0800 Subject: [PATCH] 1 --- server/gameserver/buff.cc | 3 +++ server/gameserver/car.cc | 16 ++++++++++++++++ server/gameserver/car.h | 1 + server/gameserver/creature.cc | 6 ++++++ server/gameserver/human.cc | 4 ++++ server/gameserver/trigger.cc | 4 ++++ 6 files changed, 34 insertions(+) diff --git a/server/gameserver/buff.cc b/server/gameserver/buff.cc index 9b51c3a..6d5cc2a 100644 --- a/server/gameserver/buff.cc +++ b/server/gameserver/buff.cc @@ -781,6 +781,9 @@ void Buff::ProcDive() }, &xtimer_attacher.timer_list_ ); + if (owner->IsHuman()) { + ++owner->AsHuman()->stats.diving_times; + } } void Buff::ProcRemoveDive() diff --git a/server/gameserver/car.cc b/server/gameserver/car.cc index 794678b..f9107d0 100644 --- a/server/gameserver/car.cc +++ b/server/gameserver/car.cc @@ -384,6 +384,10 @@ void Car::DecHP(float dec_hp, int killer_id, const std::string& killer_name, int void Car::BeKill(int killer_id, const std::string& killer_name, int weapon_id) { + Human* killer = room->GetHumanByUniId(killer_id); + if (killer) { + ++killer->stats.destory_car_times; + } dead = true; later_removed_ = true; if (hero_meta_->i->delay_remove() > 0) { @@ -527,3 +531,15 @@ void Car::RemoveFromScene() room->RemoveObjectLater(this); room->NotifyUiUpdate(); } + +void Car::OnKillTarget(Creature* target) +{ + if (target->IsHuman()) { + for (auto passenger : passengers_) { + ++passenger->stats.ride_car_kills; + } + if (driver_) { + ++driver_->stats.ride_car_kills; + } + } +} diff --git a/server/gameserver/car.h b/server/gameserver/car.h index 3317eb2..652eba7 100644 --- a/server/gameserver/car.h +++ b/server/gameserver/car.h @@ -49,6 +49,7 @@ class Car : public Creature virtual void SendDebugMsg(const std::string& debug_msg) override; virtual void SetAttackDir(const a8::Vec2& attack_dir) override; virtual void DropItems(Obstacle* obstacle) override; + void OnKillTarget(Creature* target); private: int AllocSeat(); diff --git a/server/gameserver/creature.cc b/server/gameserver/creature.cc index c577098..c50a702 100644 --- a/server/gameserver/creature.cc +++ b/server/gameserver/creature.cc @@ -921,6 +921,9 @@ void Creature::DoSkill(int skill_id, } GetTrigger()->UseSkill(skill); DoSkillPostProc(true, skill_id, target_id, target_pos); + if (IsHuman()) { + ++AsHuman()->stats.use_skill_times; + } #if 0 if (skill_id != TURN_OVER_SKILL_ID) { #else @@ -1108,6 +1111,9 @@ void Creature::ProcBuffEffect(Creature* caster, Buff* buff) if (action_type != AT_None) { CancelAction(); } + if (IsHuman()) { + ++AsHuman()->stats.use_camouflage_times; + } } break; case kBET_BePull: diff --git a/server/gameserver/human.cc b/server/gameserver/human.cc index aec0a7b..c853f51 100644 --- a/server/gameserver/human.cc +++ b/server/gameserver/human.cc @@ -2307,6 +2307,7 @@ void Human::DropItems(Obstacle* obstacle) return; } if (room->GetRoomType() == RT_NewBrid && IsPlayer()) { + ++stats.open_airdrop_times; if (is_treasure_box) { if (box_drop_times_ < MetaMgr::Instance()->newbie_airdrop.size()) { drop_id = MetaMgr::Instance()->newbie_airdrop[box_drop_times_]; @@ -2772,6 +2773,7 @@ void Human::ProcUseItemAction() switch (action_item_id) { case IS_HEALTHKIT: { + +stats.use_medicine_times; AddHp(item_meta->i->heal() * (1 + GetAbility()->GetAttrRate(kHAT_DrugEfficacy))); DecInventory(item_meta->i->_inventory_slot(), 1); GetTrigger()->UseItemAction(action_item_id); @@ -2779,6 +2781,7 @@ void Human::ProcUseItemAction() break; case IS_PAIN_KILLER: { + +stats.use_medicine_times; if (pain_killer_timer) { int passed_time = (room->GetFrameNo() - pain_killer_frameno) * FRAME_RATE_MS; int left_time = std::max(0, pain_killer_lastingtime * 1000 - passed_time); @@ -2821,6 +2824,7 @@ void Human::ProcUseItemAction() break; case IS_SHEN_BAO: { + +stats.use_medicine_times; if (!dead) { if (downed) { SetHP(MetaMgr::Instance()->GetSysParamAsInt("downed_relive_recover_hp")); diff --git a/server/gameserver/trigger.cc b/server/gameserver/trigger.cc index 0a28615..6308bd9 100644 --- a/server/gameserver/trigger.cc +++ b/server/gameserver/trigger.cc @@ -8,6 +8,7 @@ #include "skill.h" #include "room.h" #include "human.h" +#include "car.h" void Trigger::Init() { @@ -107,6 +108,9 @@ void Trigger::Kill(Creature* target) owner_->AsHuman()->kill_humans.insert(target->AsHuman()); owner_->AsHuman()->SyncAroundPlayers(__FILE__, __LINE__, __func__); } + if (owner_->IsCar()) { + owner_->AsCar()->OnKillTarget(target); + } ++kill_num_; TraverseCondBuffs (kCondBuffKillTarget,