添加战利品

This commit is contained in:
aozhiwei 2020-12-04 19:28:31 +08:00
parent 30551d587c
commit 6a40f89ea4
5 changed files with 30 additions and 2 deletions

View File

@ -226,6 +226,7 @@ enum EquipType_e
EQUIP_TYPE_CAR = 9,
EQUIP_TYPE_SKIN = 10,
EQUIP_TYPE_CAMOUFLAGE = 11,
EQUIP_TYPE_SPOILS = 12,
EQUIP_TYPE_End
};

View File

@ -962,8 +962,17 @@ void Human::FillSMGameOver(cs::SMGameOver& msg)
}
}
}
cs::MFPlayerStats* p = msg.add_player_stats();
FillMFPlayerStats(p);
{
cs::MFPlayerStats* p = msg.add_player_stats();
FillMFPlayerStats(p);
}
{
for (auto& pair : spoils_items) {
auto p = msg.add_spoils_items();
p->add_values(pair.first);
p->add_values(pair.second);
}
}
}
void Human::BeKill(int killer_id, const std::string& killer_name, int weapon_id)
@ -2670,6 +2679,16 @@ void Human::ProcCamoutflage(Loot* entity, MetaData::Equip* item_meta)
AddItem(item_meta->i->id(), 1);
}
void Human::ProcSpoils(Loot* entity, MetaData::Equip* item_meta)
{
if (spoils_items.find(item_meta->i->id()) !=
spoils_items.end()) {
spoils_items[item_meta->i->id()] += entity->count;
} else {
spoils_items[item_meta->i->id()] = entity->count;
}
}
void Human::FindLocationWithTarget(Entity* target)
{
a8::Vec2 old_pos = GetPos();

View File

@ -134,6 +134,7 @@ class Human : public MoveableEntity
Weapon grow_weapon;
std::map<int, int> weapon_configs;
std::map<int, int> skin_configs;
std::map<int, int> spoils_items;
bool use_skill = false;
size_t curr_skill_phase = 0;
@ -299,6 +300,7 @@ protected:
void ProcLootSkin(Loot* entity, MetaData::Equip* item_meta);
void ProcLootCar(Loot* entity, MetaData::Equip* item_meta);
void ProcCamoutflage(Loot* entity, MetaData::Equip* item_meta);
void ProcSpoils(Loot* entity, MetaData::Equip* item_meta);
void SelectSkillTargets(const a8::Vec2& target_pos, std::set<Entity*>& target_list);
Buff* GetBuffById(int buff_id);
void ProcSkillPhase(MetaData::SkillPhase* phase);

View File

@ -604,6 +604,11 @@ void Player::LootInteraction(Loot* entity)
ProcCamoutflage(entity, item_meta);
}
break;
case EQUIP_TYPE_SPOILS:
{
ProcSpoils(entity, item_meta);
}
break;
default:
{
if (item_meta->i->_inventory_slot() >= 0 &&

View File

@ -968,6 +968,7 @@ message SMGameOver
repeated MFPlayerStats player_stats = 6; //
optional string room_uuid = 7; //id
repeated MFTeamData team_data = 10; //
repeated MFTuple spoils_items = 11; // 0: id 1:
}
//