皮肤逻辑ok
This commit is contained in:
parent
1163463151
commit
94f57bd47d
@ -22,7 +22,8 @@ Android::~Android()
|
||||
void Android::Initialize()
|
||||
{
|
||||
health = meta->i->health();
|
||||
skin = 14001;
|
||||
skin.skin_id = 14001;
|
||||
skin.skin_lv = 1;
|
||||
RecalcSelfCollider();
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ void Hero::FillMFObjectFull(cs::MFObjectFull* full_data)
|
||||
pos.ToPB(p->mutable_pos());
|
||||
attack_dir.ToPB(p->mutable_dir());
|
||||
|
||||
p->set_skin(skin);
|
||||
skin.ToPB(p->mutable_skin());
|
||||
p->set_backpack(backpack);
|
||||
p->set_helmet(helmet);
|
||||
p->set_chest(chest);
|
||||
|
@ -15,7 +15,7 @@ class Hero : public Entity
|
||||
|
||||
Human* master = nullptr;
|
||||
|
||||
int skin = 0;
|
||||
Skin skin;
|
||||
int backpack = 0;
|
||||
int helmet = 0;
|
||||
int chest = 0;
|
||||
|
@ -99,7 +99,7 @@ void Human::FillMFObjectFull(cs::MFObjectFull* full_data)
|
||||
p->set_disconnected(disconnected);
|
||||
p->set_anim_type(anim_type);
|
||||
p->set_anim_seq(anim_seq);
|
||||
p->set_skin(skin);
|
||||
skin.ToPB(p->mutable_skin());
|
||||
p->set_backpack(backpack);
|
||||
p->set_helmet(helmet);
|
||||
p->set_chest(chest);
|
||||
@ -1117,7 +1117,7 @@ void Human::FillMFActivePlayerData(cs::MFActivePlayerData* player_data)
|
||||
player_data->set_action_target_id(action_target_id);
|
||||
}
|
||||
}
|
||||
player_data->set_skin(skin);
|
||||
skin.ToPB(player_data->mutable_skin());
|
||||
player_data->set_backpack(backpack);
|
||||
player_data->set_helmet(helmet);
|
||||
player_data->set_chest(chest);
|
||||
@ -1671,6 +1671,12 @@ int Human::GetWeaponConfigLv(int weapon_id)
|
||||
return itr != weapon_configs.end() ? itr->second : 0;
|
||||
}
|
||||
|
||||
int Human::GetSkinConfigLv(int skin_id)
|
||||
{
|
||||
auto itr = skin_configs.find(skin_id);
|
||||
return itr != skin_configs.end() ? itr->second : 0;
|
||||
}
|
||||
|
||||
void Human::ClearFrameData()
|
||||
{
|
||||
if (!new_objects.empty()) {
|
||||
|
@ -60,7 +60,7 @@ class Human : public Entity
|
||||
int action_duration = 0;
|
||||
int action_item_id = 0;
|
||||
int action_target_id = 0;
|
||||
int skin = 0;
|
||||
Skin skin;
|
||||
int backpack = 0;
|
||||
int helmet = 0;
|
||||
int chest = 0;
|
||||
@ -102,6 +102,7 @@ class Human : public Entity
|
||||
|
||||
float def = 0.0f;
|
||||
std::map<int, int> weapon_configs;
|
||||
std::map<int, int> skin_configs;
|
||||
|
||||
Human();
|
||||
virtual ~Human() override;
|
||||
@ -176,6 +177,7 @@ class Human : public Entity
|
||||
void SendUIUpdate();
|
||||
void SendWxVoip();
|
||||
int GetWeaponConfigLv(int weapon_id);
|
||||
int GetSkinConfigLv(int skin_id);
|
||||
|
||||
private:
|
||||
void ClearFrameData();
|
||||
|
@ -28,7 +28,7 @@ void Player::Initialize()
|
||||
Human::Initialize();
|
||||
health = meta->i->health();
|
||||
max_energy_shield = energy_shield;
|
||||
skin_meta = MetaMgr::Instance()->GetDress(skin);
|
||||
skin_meta = MetaMgr::Instance()->GetDress(skin.skin_id);
|
||||
if (skin_meta) {
|
||||
skill_meta = MetaMgr::Instance()->GetSkill(skin_meta->i->skill_id());
|
||||
} else {
|
||||
@ -547,11 +547,12 @@ void Player::LootInteraction(Loot* entity)
|
||||
break;
|
||||
case 8:
|
||||
{
|
||||
if (skin != 0) {
|
||||
room->DropItem(pos, skin, 1, 1);
|
||||
if (skin.skin_id != 0) {
|
||||
room->DropItem(pos, skin.skin_id, 1, skin.skin_lv);
|
||||
}
|
||||
skin = entity->item_id;
|
||||
skin_meta = MetaMgr::Instance()->GetDress(skin);
|
||||
skin.skin_id = entity->item_id;
|
||||
skin.skin_lv = std::max(1, GetSkinConfigLv(skin.skin_id));
|
||||
skin_meta = MetaMgr::Instance()->GetDress(skin.skin_id);
|
||||
if (skin_meta) {
|
||||
skill_meta = MetaMgr::Instance()->GetSkill(skin_meta->i->skill_id());
|
||||
} else {
|
||||
|
@ -37,15 +37,22 @@ Player* PlayerMgr::CreatePlayerByCMJoin(int socket, const cs::CMJoin& msg)
|
||||
hum->use_touch = msg.use_touch();
|
||||
hum->avatar_url = msg.avatar_url();
|
||||
hum->energy_shield = msg.energy_shield();
|
||||
hum->skin = msg.baseskin();
|
||||
// hum->basemelee = msg.basemelee();
|
||||
// hum->elo_score = msg.elo_score();
|
||||
// hum->gmode = msg.gmode();
|
||||
for (auto& weapon : msg.weapons()) {
|
||||
if (weapon.weapon_id() != 0 && weapon.weapon_lv() > 0) {
|
||||
hum->weapon_configs[weapon.weapon_id()] = weapon.weapon_lv();
|
||||
}
|
||||
}
|
||||
for (auto& skin : msg.skins()) {
|
||||
if (skin.skin_id() != 0 && skin.skin_lv() > 0) {
|
||||
hum->skin_configs[skin.skin_id()] = skin.skin_lv();
|
||||
}
|
||||
}
|
||||
#if 1
|
||||
hum->skin.skin_id = msg.baseskin();
|
||||
if (hum->skin.skin_id != 0){
|
||||
hum->skin.skin_lv = std::max(1, hum->GetSkinConfigLv(hum->skin.skin_id));
|
||||
}
|
||||
#endif
|
||||
socket_hash_[socket] = hum;
|
||||
return hum;
|
||||
}
|
||||
|
@ -26,3 +26,9 @@ int Weapon::GetClipVolume()
|
||||
return meta->i->clip_volume();
|
||||
}
|
||||
}
|
||||
|
||||
void Skin::ToPB(cs::MFSkin* pb_obj)
|
||||
{
|
||||
pb_obj->set_skin_id(skin_id);
|
||||
pb_obj->set_skin_lv(skin_lv);
|
||||
}
|
||||
|
@ -17,6 +17,12 @@ namespace MetaData
|
||||
struct EquipUpgrade;
|
||||
}
|
||||
|
||||
namespace cs
|
||||
{
|
||||
class MFWeapon;
|
||||
class MFSkin;
|
||||
}
|
||||
|
||||
struct GasData
|
||||
{
|
||||
GasMode_e gas_mode = GasInactive;
|
||||
@ -47,6 +53,14 @@ struct Weapon
|
||||
int GetClipVolume();
|
||||
};
|
||||
|
||||
struct Skin
|
||||
{
|
||||
int skin_id = 0;
|
||||
int skin_lv = 0;
|
||||
|
||||
void ToPB(cs::MFSkin* pb_obj);
|
||||
};
|
||||
|
||||
struct PlayerStats
|
||||
{
|
||||
int kills = 0;
|
||||
|
@ -125,6 +125,13 @@ message MFWeapon
|
||||
optional int32 ammo = 4; //弹药数
|
||||
}
|
||||
|
||||
//皮肤
|
||||
message MFSkin
|
||||
{
|
||||
optional int32 skin_id = 1; //皮肤id
|
||||
optional int32 skin_lv = 2; //皮肤等级
|
||||
}
|
||||
|
||||
//玩家信息-部分
|
||||
message MFPlayerPart
|
||||
{
|
||||
@ -149,7 +156,7 @@ message MFPlayerFull
|
||||
optional int32 anim_seq = 11; //
|
||||
//optional int32 action_type = 12; //0: none 1:reload 2:useitem 3:relive 4: rescue
|
||||
//optional int32 action_duration = 22; //持续时间毫秒
|
||||
optional int32 skin = 13; //皮肤id
|
||||
optional MFSkin skin = 13; //皮肤id
|
||||
optional int32 backpack = 14; //背包
|
||||
optional int32 helmet = 16; //头盔
|
||||
optional int32 chest = 17; //防弹衣
|
||||
@ -312,7 +319,7 @@ message MFHeroFull
|
||||
optional MFVector2D dir = 3; //朝向
|
||||
optional int32 masert_uniid = 4; //主人id
|
||||
|
||||
optional int32 skin = 13; //皮肤id
|
||||
optional MFSkin skin = 13; //皮肤id
|
||||
optional int32 backpack = 14; //背包
|
||||
optional int32 helmet = 16; //头盔
|
||||
optional int32 chest = 17; //防弹衣
|
||||
@ -380,7 +387,7 @@ message MFActivePlayerData
|
||||
optional int32 action_item_id = 6;
|
||||
optional int32 action_target_id = 7;
|
||||
|
||||
optional int32 skin = 30; //皮肤id
|
||||
optional MFSkin skin = 30; //皮肤id
|
||||
optional int32 backpack = 31; //背包
|
||||
optional int32 helmet = 32; //头盔
|
||||
optional int32 chest = 33; //防弹衣
|
||||
@ -575,23 +582,20 @@ message CMJoin
|
||||
{
|
||||
optional int32 server_id = 1; //serverid
|
||||
optional string team_uuid = 2; //队伍唯一id (没组队时为空字符串)
|
||||
optional int32 team_mode = 3; //队伍模式 0:单人 1:多人
|
||||
optional int32 player_count = 4; //玩家数(单人时为1)
|
||||
optional bool auto_fill = 5; //是否自动填充玩家
|
||||
optional int32 bot = 6; //是否机器人
|
||||
optional string name = 7; //角色名
|
||||
optional bool use_touch = 8; //zzz
|
||||
optional string account_id = 9; //账号id account_id
|
||||
optional string account_id = 3; //账号id account_id
|
||||
optional int32 team_mode = 4; //队伍模式 0:单人 1:多人
|
||||
optional int32 player_count = 5; //玩家数(单人时为1)
|
||||
optional bool auto_fill = 6; //是否自动填充玩家
|
||||
optional int32 bot = 7; //是否机器人
|
||||
optional string name = 8; //角色名
|
||||
optional bool use_touch = 9; //zzz
|
||||
repeated int32 emotes = 10; //表情列表
|
||||
optional string avatar_url = 11; //头像
|
||||
optional int32 energy_shield = 12; //能量护盾
|
||||
optional int32 baseskin = 13; //皮肤id
|
||||
optional int32 basemelee = 14; //xx
|
||||
optional int32 elo_score = 15;
|
||||
repeated MFPlug plugs = 16;
|
||||
repeated MFWeapon weapons = 17; //武器列表
|
||||
|
||||
optional string gmode = 21;
|
||||
repeated MFSkin skins = 18; //皮肤列表 key: 皮肤id value:皮肤等级
|
||||
}
|
||||
|
||||
//移动
|
||||
|
Loading…
x
Reference in New Issue
Block a user