From 54662c4ec27fa36c15e69d0d892f64c4caf77bcf Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Tue, 11 Apr 2023 12:05:17 +0800 Subject: [PATCH] 1 --- server/gameserver/human.cc | 19 +++++++++++++++++++ server/gameserver/mt/Equip.cc | 11 +++++++++++ server/gameserver/mt/Equip.h | 5 +++++ 3 files changed, 35 insertions(+) diff --git a/server/gameserver/human.cc b/server/gameserver/human.cc index 5eb587d9..23fd6d83 100644 --- a/server/gameserver/human.cc +++ b/server/gameserver/human.cc @@ -1238,6 +1238,25 @@ void Human::DeadDrop() } } } + { + if (GetInventory(IS_GEMSTONE) > 0) { + room->frame_event.AddPropChg + ( + GetWeakPtrRef(), + kPropGemstone, + 0, + 0, + false); + + #if 0 + SetMaxHP(GetMaxHP() + dto.item_meta->_max_hp * GetBattleContext()->GetMaxHP()); + #endif + + gemstone = 0; + DecInventory(IS_GEMSTONE, GetInventory(IS_GEMSTONE)); + SyncVolume(IS_GEMSTONE); + } + } MarkSyncActivePlayer(__FILE__, __LINE__, __func__); } diff --git a/server/gameserver/mt/Equip.cc b/server/gameserver/mt/Equip.cc index 542838b6..ee97b881 100644 --- a/server/gameserver/mt/Equip.cc +++ b/server/gameserver/mt/Equip.cc @@ -5,6 +5,7 @@ IMPL_TABLE(mt::Equip) std::map mt::Equip::slot_hash_; +const mt::Equip* mt::Equip::gem_stone_ = nullptr; namespace mt { @@ -324,4 +325,14 @@ namespace mt }); } + void Equip::StaticPostInit() + { + gem_stone_ = GetById(GEMSTONE_ID); + } + + const Equip* Equip::GetGemStone() + { + return gem_stone_; + } + } diff --git a/server/gameserver/mt/Equip.h b/server/gameserver/mt/Equip.h index 8518a358..2e8e5fa1 100644 --- a/server/gameserver/mt/Equip.h +++ b/server/gameserver/mt/Equip.h @@ -10,6 +10,8 @@ namespace mt "equip@equip.json", "id") public: + static const int GEMSTONE_ID = 31001; + int lock_time = 0; //0,0,0,0,后座力,是否取消定身 std::vector> _bullet_born_offset; @@ -42,8 +44,11 @@ namespace mt bool Match(EventAddBuff_e event, int val, int val2) const; static const Equip* GetByIdBySlotId(int slot_id); static void AdjustMuzzlePos(); + static const Equip* GetGemStone(); + static void StaticPostInit(); private: + static const mt::Equip* gem_stone_; static std::map slot_hash_; std::map>> _gun_muzzle_position_hash_; };