From 511044816d1e9ee98f390d58caa29424b40b4dcb Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Sat, 20 Jul 2019 13:06:26 +0800 Subject: [PATCH] 1 --- server/gameserver/human.cc | 66 -------------------------------------- server/gameserver/human.h | 4 --- 2 files changed, 70 deletions(-) diff --git a/server/gameserver/human.cc b/server/gameserver/human.cc index 38780ee..124131e 100644 --- a/server/gameserver/human.cc +++ b/server/gameserver/human.cc @@ -1007,72 +1007,6 @@ void Human::UpdateAction() break; case AT_UseItem: { - #if 0 - switch (action_item_id) { - case IS_HEALTHKIT: - { - MetaData::Equip* item_meta = MetaMgr::Instance()->GetEquipBySlotId(action_item_id); - if (item_meta){ - if (GetInventory(item_meta->i->_inventory_slot()) > 0) { - float old_health = health; - health += item_meta->i->heal(); - health = std::min(health, GetMaxHP()); - stats.heal_amount += health - old_health; - DecInventory(item_meta->i->_inventory_slot(), 1); - need_sync_active_player = true; - SyncAroundPlayers(); - } - } - } - break; - case IS_PAIN_KILLER: - { - MetaData::Equip* item_meta = MetaMgr::Instance()->GetEquipBySlotId(action_item_id); - if (item_meta){ - if (GetInventory(item_meta->i->_inventory_slot()) > 0) { - if (pain_killer_timer) { - int passed_time = (room->frame_no - pain_killer_frameno) * FRAME_RATE_MS; - int left_time = std::max(0, pain_killer_lastingtime * 1000 - passed_time); - int anodyne_max_time = MetaMgr::Instance()->GetSysParamAsInt("anodyne_max_time"); - left_time = std::min(left_time, anodyne_max_time * 1000); - pain_killer_lastingtime += std::min(item_meta->i->time() * 1000, anodyne_max_time * 1000 - left_time) / 1000; - need_sync_active_player = true; - } else { - pain_killer_frameno = room->frame_no; - pain_killer_lastingtime = item_meta->i->time(); - pain_killer_timer = room->xtimer.AddRepeatTimerAndAttach( - SERVER_FRAME_RATE, - a8::XParams() - .SetSender(this) - .SetParam1(item_meta->i->heal()), - [] (const a8::XParams& param) - { - Human* hum = (Human*)param.sender.GetUserData(); - float old_health = hum->health; - hum->health += param.param1.GetDouble(); - hum->health = std::min(hum->health, hum->GetMaxHP()); - hum->stats.heal_amount += hum->health - old_health; - hum->SyncAroundPlayers(); - if (hum->room->frame_no - hum->pain_killer_frameno > hum->pain_killer_lastingtime * SERVER_FRAME_RATE) { - hum->room->xtimer.DeleteTimer(hum->pain_killer_timer); - hum->pain_killer_timer = nullptr; - } - }, - &xtimer_attacher.timer_list_ - ); - } - DecInventory(item_meta->i->_inventory_slot(), 1); - need_sync_active_player = true; - } - } - } - break; - default: - { - } - break; - } - #endif } break; default: diff --git a/server/gameserver/human.h b/server/gameserver/human.h index 1e5802f..b1fc36e 100644 --- a/server/gameserver/human.h +++ b/server/gameserver/human.h @@ -86,10 +86,6 @@ class Human : public Entity PlayerStats stats; - int pain_killer_frameno = 0; - int pain_killer_lastingtime = 0; - xtimer_list* pain_killer_timer = nullptr; - std::set* team_members = nullptr; std::set kill_humans;