添加调试日志
This commit is contained in:
parent
6fc0eeca8e
commit
68afdd8441
@ -2002,6 +2002,20 @@ void Human::WinExp(Human* sender, int exp)
|
||||
race_ != kZombieRace) {
|
||||
abort();
|
||||
}
|
||||
if (room->debug_trace) {
|
||||
a8::UdpLog::Instance()->Debug
|
||||
(
|
||||
"WinExp before sender_id:%d uniid:%d race:%d level:%d exp:%d add_exp:%d ",
|
||||
{
|
||||
sender->GetEntityUniId(),
|
||||
GetEntityUniId(),
|
||||
GetRace(),
|
||||
GetLevel(),
|
||||
GetExp(),
|
||||
exp
|
||||
}
|
||||
);
|
||||
}
|
||||
exp_ += exp;
|
||||
MetaData::Player* old_meta = meta;
|
||||
int start_meta_id = race_ == kHumanRace ? HUMAN_RACE_META_START_ID : ZOMBIE_RACE_META_START_ID;
|
||||
@ -2026,6 +2040,19 @@ void Human::WinExp(Human* sender, int exp)
|
||||
room->OnZombieAppear(this);
|
||||
}
|
||||
}
|
||||
if (room->debug_trace) {
|
||||
a8::UdpLog::Instance()->Debug
|
||||
(
|
||||
"WinExp after sender_id:%d uniid:%d race:%d level:%d exp:%d add_exp:%d ",
|
||||
{
|
||||
sender->GetEntityUniId(),
|
||||
GetRace(),
|
||||
GetLevel(),
|
||||
GetExp(),
|
||||
exp
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
bool Human::IsEnemy(Human* hum)
|
||||
|
@ -262,6 +262,7 @@ class Human : public MoveableEntity
|
||||
void RecalcBuffAttr();
|
||||
void ProcBuffEffect(Human* caster, Buff* buff);
|
||||
int GetLevel() {return level_;};
|
||||
int GetExp() {return exp_;};
|
||||
void OnAttack() {};
|
||||
void OnHit() {};
|
||||
int GetItemNum(int item_id);
|
||||
|
@ -572,6 +572,20 @@ void Room::RemoveObjectLater(RoomEntity* entity)
|
||||
void Room::OnHumanDie(Human* hum)
|
||||
{
|
||||
if (GetRoomMode() == kZombieMode) {
|
||||
if (debug_trace) {
|
||||
a8::UdpLog::Instance()->Debug
|
||||
(
|
||||
"OnHumanDie uniid:%d name:%s race:%d level:%d exp:%d killer_id:%d ",
|
||||
{
|
||||
hum->GetEntityUniId(),
|
||||
hum->name,
|
||||
hum->GetRace(),
|
||||
hum->GetLevel(),
|
||||
hum->GetExp(),
|
||||
hum->stats.killer_id
|
||||
}
|
||||
);
|
||||
}
|
||||
if (hum->GetRace() == kHumanRace) {
|
||||
RemoveRescue(hum);
|
||||
hum->DeadDrop();
|
||||
@ -2892,9 +2906,15 @@ void Room::ZombieModeStart()
|
||||
if (human_hash_.size() != GetRoomMaxPlayerNum()) {
|
||||
abort();
|
||||
}
|
||||
#ifdef DEBUG
|
||||
debug_trace = true;
|
||||
#endif
|
||||
std::vector<Human*> human_list;
|
||||
for (auto& pair : human_hash_) {
|
||||
human_list.push_back(pair.second);
|
||||
if (RoomMgr::Instance()->IsGM(pair.second->account_id)) {
|
||||
debug_trace = true;
|
||||
}
|
||||
}
|
||||
std::random_shuffle(human_list.begin(), human_list.end());
|
||||
for (size_t i = 0; i < 2; ++i) {
|
||||
|
@ -42,6 +42,7 @@ public:
|
||||
a8::TimerAttacher timer_attacher;
|
||||
GridService* grid_service = nullptr;
|
||||
MapService* map_service = nullptr;
|
||||
bool debug_trace = false;
|
||||
|
||||
~Room();
|
||||
void InitData(RoomInitInfo& init_info);
|
||||
|
@ -466,18 +466,7 @@ void RoomMgr::JoinErrorHandle(const cs::CMJoin& msg, int error_code, int socket_
|
||||
});
|
||||
}
|
||||
|
||||
bool RoomMgr::IsGM(const cs::CMJoin& msg)
|
||||
bool RoomMgr::IsGM(const std::string& account_id)
|
||||
{
|
||||
if (gm_hash_.find(msg.account_id()) == gm_hash_.end()) {
|
||||
return false;
|
||||
}
|
||||
for (int equip_id : msg.prepare_items()) {
|
||||
MetaData::Equip* item_meta = MetaMgr::Instance()->GetEquip(equip_id);
|
||||
if (item_meta) {
|
||||
if (item_meta->i->equip_type() == EQUIP_TYPE_CAR) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return gm_hash_.find(account_id) != gm_hash_.end();
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ class RoomMgr : public a8::Singleton<RoomMgr>
|
||||
int OverRoomNum();
|
||||
Room* GetRoomByUuid(long long uuid);
|
||||
void AddOverRoom(long long room_uuid);
|
||||
bool IsGM(const cs::CMJoin& msg);
|
||||
bool IsGM(const std::string& account_id);
|
||||
|
||||
private:
|
||||
void InstallReportStateTimer();
|
||||
|
Loading…
x
Reference in New Issue
Block a user