From 5895149c83071b9801b3a9d75a95b711d8f6cdc6 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Thu, 25 May 2023 20:15:00 +0800 Subject: [PATCH] 1 --- server/gameserver/hero.cc | 5 +++++ server/gameserver/human.cc | 16 ++++++++++++++++ server/gameserver/mt/Hero.cc | 7 +++++++ server/gameserver/mt/Hero.h | 1 + 4 files changed, 29 insertions(+) diff --git a/server/gameserver/hero.cc b/server/gameserver/hero.cc index aad7b8e5..249be5ea 100644 --- a/server/gameserver/hero.cc +++ b/server/gameserver/hero.cc @@ -282,6 +282,11 @@ void Hero::BeKill(int killer_id, const std::string& killer_name, int weapon_id) if (meta->HasDrop() && !room->IsPveRoom()) { room->ScatterDrop(GetPos().ToGlmVec3(), meta->RandDrop()); } + if (!room->IsPveRoom() && !room->IsNewBieRoom()) { + for (int id : meta->_drop_list) { + room->ScatterDrop(GetPos().ToGlmVec3(), id); + } + } room->frame_event.AddDead(GetWeakPtrRef(), 0); room->xtimer.SetTimeoutEx ( diff --git a/server/gameserver/human.cc b/server/gameserver/human.cc index 49da28b3..c063096d 100644 --- a/server/gameserver/human.cc +++ b/server/gameserver/human.cc @@ -1260,6 +1260,22 @@ void Human::DeadDrop() { on_dead_remove_objects_.clear(); } + { + if (!room->IsGameOver() && IsAndroid()) { + if (!room->IsPveRoom() && !room->IsNewBieRoom()) { + for (int id : meta->_drop_list) { + room->ScatterDrop(GetPos().ToGlmVec3(), id); + } + } + if (GetCurrWeapon() && + GetCurrWeapon()->weapon_idx == GUN_SLOT1) { + int num = 1 + rand() % 2; + for (int i = 0; i < num; ++i) { + room->ScatterDrop(GetPos().ToGlmVec3(), GetCurrWeapon()->meta->id()); + } + } + } + } { if (GetInventory(IS_YELLOW_STONE) > 0 && gemstone > 0) { room->frame_event.AddPropChg diff --git a/server/gameserver/mt/Hero.cc b/server/gameserver/mt/Hero.cc index 5a216eb6..12783dfb 100644 --- a/server/gameserver/mt/Hero.cc +++ b/server/gameserver/mt/Hero.cc @@ -31,6 +31,13 @@ namespace mt ); } } + { + std::vector strings; + a8::Split(drop(), strings, '|'); + for (const std::string& str : strings) { + _drop_list.push_back(a8::XValue(str).GetInt()); + } + } { std::vector strings; a8::Split(volume(), strings, '|'); diff --git a/server/gameserver/mt/Hero.h b/server/gameserver/mt/Hero.h index d1667c7d..677879cf 100644 --- a/server/gameserver/mt/Hero.h +++ b/server/gameserver/mt/Hero.h @@ -45,6 +45,7 @@ namespace mt bool HasDrop() const { return !_dead_drop.empty();}; std::tuple _pve_score; std::map shot_animations; + std::vector _drop_list; void Init1(); static void StaticPostInit();