diff --git a/server/gameserver/frameevent.cc b/server/gameserver/frameevent.cc index 57e0fd2..016760a 100644 --- a/server/gameserver/frameevent.cc +++ b/server/gameserver/frameevent.cc @@ -33,59 +33,6 @@ void FrameEvent::AddEmote(Human* hum, int emote_id) } } -void FrameEvent::AddShot(Human* hum) -{ - { - auto& tuple = a8::FastAppend(shots_); - std::get<0>(tuple) = hum; - auto& p = std::get<1>(tuple); - - p.set_player_id(hum->entity_uniid); - if (hum->tank_weapon.meta) { - hum->tank_weapon.ToPB(p.mutable_weapon()); - } else { - hum->curr_weapon->ToPB(p.mutable_weapon()); - } - p.set_offhand(true); - p.set_bullskin(10001); - } - { - int shot_idx = shots_.size() - 1; - for (auto& cell : hum->grid_list) { - for (auto& hum : cell->human_list) { - hum->shots_.push_back(shot_idx); - } - } - } -} - -void FrameEvent::AddBullet(Human* hum, a8::Vec2 born_pos, a8::Vec2 dir, float fly_distance) -{ - { - auto& tuple = a8::FastAppend(bullets_); - std::get<0>(tuple) = hum; - auto& p = std::get<1>(tuple); - - p.set_player_id(hum->entity_uniid); - if (hum->tank_weapon.meta) { - p.set_bullet_id(hum->tank_weapon.meta->i->use_bullet()); - } else { - p.set_bullet_id(hum->curr_weapon->meta->i->use_bullet()); - } - TypeConvert::ToPb(born_pos, p.mutable_pos()); - TypeConvert::ToPb(dir, p.mutable_dir()); - p.set_bulletskin(10001); - if (hum->tank_weapon.meta) { - p.set_gun_id(hum->tank_weapon.meta->i->id()); - p.set_gun_lv(hum->tank_weapon.weapon_lv); - } else { - p.set_gun_id(hum->curr_weapon->meta->i->id()); - p.set_gun_lv(hum->curr_weapon->weapon_lv); - } - p.set_fly_distance(fly_distance); - } -} - void FrameEvent::AddHpChg(Human* hum) { chged_hps_.push_back(hum); diff --git a/server/gameserver/framemaker.cc b/server/gameserver/framemaker.cc index f23c611..8c25d8f 100644 --- a/server/gameserver/framemaker.cc +++ b/server/gameserver/framemaker.cc @@ -43,14 +43,6 @@ cs::SMUpdate* FrameMaker::MakeUpdateMsg(const Human* hum) for (auto& itr : hum->out_objects) { msg->add_out_objids(itr); } - for (size_t idx : hum->shots_) { - if (idx < room->frame_event.shots_.size()) { - auto& tuple = room->frame_event.shots_[idx]; - if (hum->CanSee(std::get<0>(tuple))) { - *msg->add_shots() = std::get<1>(tuple); - } - } - } for (size_t idx : hum->chged_hps_) { if (idx < room->frame_event.chged_hps_.size()) { Human* target = room->frame_event.chged_hps_[idx]; diff --git a/server/gameserver/human.cc b/server/gameserver/human.cc index 20de76c..32e6d31 100644 --- a/server/gameserver/human.cc +++ b/server/gameserver/human.cc @@ -42,15 +42,6 @@ Human::Human():Entity() } weapons[0] = default_weapon; curr_weapon = &weapons[0]; - inventory_[IS_1XSCOPE] = 1; - - if (MetaMgr::Instance()->fighting_mode) { - inventory_[IS_9MM] = FIGHTING_MODE_BULLET_NUM; - inventory_[IS_556MM] = FIGHTING_MODE_BULLET_NUM; - inventory_[IS_762MM] = FIGHTING_MODE_BULLET_NUM; - inventory_[IS_12GAUGE] = FIGHTING_MODE_BULLET_NUM; - inventory_[IS_RPG] = FIGHTING_MODE_BULLET_NUM; - } } Human::~Human() @@ -62,7 +53,6 @@ void Human::Initialize() Entity::Initialize(); skill_xtimer_attacher_.xtimer = &room->xtimer; RecalcSelfCollider(); - volume_ = meta->volume; observers_.insert(this); } @@ -1100,15 +1090,6 @@ void Human::FillMFActivePlayerData(cs::MFActivePlayerData* player_data) auto p = player_data->add_weapons(); weapon.ToPB(p); } - for (auto& num : inventory_) { - player_data->add_inventory(num); - } - player_data->set_energy_shield(energy_shield); - #if 1 - { - player_data->set_max_energy_shield(max_energy_shield); - } - #endif #if 1 if (skill_meta) { if (last_use_skill_frameno_ == 0) { @@ -1176,16 +1157,6 @@ void Human::RecalcAttr() } } -void Human::RecalcVolume() -{ - MetaData::Equip* backpack_meta = MetaMgr::Instance()->GetEquip(backpack); - if (backpack_meta) { - for (size_t i = 0; i < backpack_meta->volume.size(); ++i) { - volume_[i] = meta->volume[i] + backpack_meta->volume[i]; - } - } -} - void Human::RecalcBuff() { buff = HumanAbility(); @@ -1200,40 +1171,6 @@ void Human::RecalcBuff() } } -int Human::GetInventory(int slot_id) -{ - if (!IsValidSlotId(slot_id)) { - abort(); - } - return inventory_[slot_id]; -} - -void Human::AddInventory(int slot_id, int num) -{ - assert(num > 0); - if (!IsValidSlotId(slot_id)) { - abort(); - } - inventory_[slot_id] += num; -} - -void Human::DecInventory(int slot_id, int num) -{ - assert(num > 0); - if (!IsValidSlotId(slot_id)) { - abort(); - } - inventory_[slot_id] -= num; -} - -int Human::GetVolume(int slot_id) -{ - if (!IsValidSlotId(slot_id)) { - abort(); - } - return volume_[slot_id]; -} - void Human::RecoverHp(int inc_hp) { if (!dead) { @@ -1655,9 +1592,6 @@ void Human::ClearFrameData() } out_objects.clear(); } - if (!shots_.empty()) { - shots_.clear(); - } if (!emotes_.empty()) { emotes_.clear(); } @@ -1788,19 +1722,6 @@ void Human::DeadDrop() room->DropItem(drop_pos, weapon.weapon_id, 1, weapon.weapon_lv); } } - for (size_t slot = 0; slot < inventory_.size(); ++slot) { - if (inventory_[slot] > 0) { - MetaData::Equip* equip_meta = MetaMgr::Instance()->GetEquipBySlotId(slot); - if (equip_meta) { - if (equip_meta->i->equip_type() == 2 && - MetaMgr::Instance()->fighting_mode) { - return; - } - a8::Vec2 drop_pos = pos; - room->DropItem(drop_pos, equip_meta->i->id(), inventory_[slot], 1); - } - } - } } void Human::SendBattleReport() diff --git a/server/gameserver/human.h b/server/gameserver/human.h index 47ca750..cdfce09 100644 --- a/server/gameserver/human.h +++ b/server/gameserver/human.h @@ -172,10 +172,6 @@ class Human : public Entity void RecalcAttr(); void RecalcVolume(); void RecalcBuff(); - int GetInventory(int slot_id); - void AddInventory(int slot_id, int num); - void DecInventory(int slot_id, int num); - int GetVolume(int slot_id); void RecoverHp(int inc_hp); void FillBodyState(::google::protobuf::RepeatedPtrField<::cs::MFBodyState>* states); void SummonHero(); @@ -231,19 +227,12 @@ protected: bool leave_ = false; long long leave_frameno_ = 0; - std::array inventory_ = {}; - std::array volume_ = {}; std::set new_objects; std::set part_objects; std::set del_objects; std::set out_objects; - std::vector shots_; std::vector emotes_; - std::vector smokes_; - std::vector explosions_; std::set observers_; - std::vector chged_tank_oil_value_; - std::vector chged_tank_oil_max_; std::vector chged_hps_; Human* follow_target_ = nullptr; bool follow_synced_active_player = false;