1
This commit is contained in:
parent
531bdb3e22
commit
b8a837e126
@ -113,10 +113,14 @@ void Human::FillMFObjectFull(cs::MFObjectFull* full_data)
|
|||||||
p->set_disconnected(disconnected);
|
p->set_disconnected(disconnected);
|
||||||
p->set_anim_type(anim_type);
|
p->set_anim_type(anim_type);
|
||||||
p->set_anim_seq(anim_seq);
|
p->set_anim_seq(anim_seq);
|
||||||
if (skin_jlf.skin_id != 0) {
|
if (skin_tank.skin_id != 0) {
|
||||||
skin_jlf.ToPB(p->mutable_skin());
|
skin_tank.ToPB(p->mutable_skin());
|
||||||
} else {
|
} else {
|
||||||
skin.ToPB(p->mutable_skin());
|
if (skin_jlf.skin_id != 0) {
|
||||||
|
skin_jlf.ToPB(p->mutable_skin());
|
||||||
|
} else {
|
||||||
|
skin.ToPB(p->mutable_skin());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
p->set_backpack(backpack);
|
p->set_backpack(backpack);
|
||||||
p->set_helmet(helmet);
|
p->set_helmet(helmet);
|
||||||
@ -318,7 +322,11 @@ void Human::RecalcSelfCollider()
|
|||||||
AddCollider(self_collider_);
|
AddCollider(self_collider_);
|
||||||
}
|
}
|
||||||
self_collider_->pos = a8::Vec2();
|
self_collider_->pos = a8::Vec2();
|
||||||
self_collider_->rad = meta->i->radius();
|
if (skin_tank_meta) {
|
||||||
|
self_collider_->rad = skin_tank_meta->i->rad();
|
||||||
|
} else {
|
||||||
|
self_collider_->rad = meta->i->radius();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Human::IsCollision()
|
bool Human::IsCollision()
|
||||||
@ -2242,3 +2250,39 @@ void Human::SendBattleReport()
|
|||||||
);
|
);
|
||||||
delete params;
|
delete params;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Human::ProcLootSkin(Loot* entity, MetaData::Equip* item_meta)
|
||||||
|
{
|
||||||
|
if (item_meta->i->is_luck()) {
|
||||||
|
if (item_meta->i->is_luck() == 2) {
|
||||||
|
if (skin_tank.skin_id != 0) {
|
||||||
|
int entity_uniid = room->CreateLoot(skin_tank.skin_id, pos, 1, 1);
|
||||||
|
Entity* loot_entity = room->GetEntityByUniId(entity_uniid);
|
||||||
|
if (loot_entity && loot_entity->entity_type == ET_Loot) {
|
||||||
|
((Loot*)loot_entity)->bullet_num = skin_tank.bullet_num;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
skin_tank.skin_id = item_meta->i->id();
|
||||||
|
skin_tank.skin_lv = std::max(1, GetSkinConfigLv(skin_tank.skin_id));
|
||||||
|
skin_tank.bullet_num = entity->bullet_num;
|
||||||
|
skin_tank_meta = item_meta;
|
||||||
|
RecalcSelfCollider();
|
||||||
|
RecalcBuff();
|
||||||
|
SyncAroundPlayers();
|
||||||
|
} else {
|
||||||
|
if (skin_jlf.skin_id != 0) {
|
||||||
|
room->DropItem(pos, skin_jlf.skin_id, 1, skin_jlf.skin_lv);
|
||||||
|
}
|
||||||
|
skin_jlf.skin_id = item_meta->i->id();
|
||||||
|
skin_jlf.skin_lv = std::max(1, GetSkinConfigLv(skin_jlf.skin_id));
|
||||||
|
skin_jlf_meta = MetaMgr::Instance()->GetDress(skin_jlf.skin_id);
|
||||||
|
if (skin_jlf_meta) {
|
||||||
|
skill_meta = MetaMgr::Instance()->GetSkill(skin_jlf_meta->i->skill_id());
|
||||||
|
} else {
|
||||||
|
skill_meta = nullptr;
|
||||||
|
}
|
||||||
|
RecalcBuff();
|
||||||
|
SyncAroundPlayers();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -32,6 +32,7 @@ struct xtimer_list;
|
|||||||
class CircleCollider;
|
class CircleCollider;
|
||||||
class AabbCollider;
|
class AabbCollider;
|
||||||
class Obstacle;
|
class Obstacle;
|
||||||
|
class Loot;
|
||||||
class Human : public Entity
|
class Human : public Entity
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -50,7 +51,7 @@ class Human : public Entity
|
|||||||
MetaData::Dress* skin_meta = nullptr;
|
MetaData::Dress* skin_meta = nullptr;
|
||||||
MetaData::Skill* skill_meta = nullptr;
|
MetaData::Skill* skill_meta = nullptr;
|
||||||
MetaData::Dress* skin_jlf_meta = nullptr;
|
MetaData::Dress* skin_jlf_meta = nullptr;
|
||||||
MetaData::Dress* skin_tank_meta = nullptr;
|
MetaData::Equip* skin_tank_meta = nullptr;
|
||||||
HumanAbility buff;
|
HumanAbility buff;
|
||||||
|
|
||||||
a8::Vec2 move_dir;
|
a8::Vec2 move_dir;
|
||||||
@ -207,6 +208,7 @@ class Human : public Entity
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
void _UpdateMove(int speed);
|
void _UpdateMove(int speed);
|
||||||
|
void ProcLootSkin(Loot* entity, MetaData::Equip* item_meta);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void ClearFrameData();
|
void ClearFrameData();
|
||||||
|
@ -18,6 +18,7 @@ class Loot : public Entity
|
|||||||
int count = 0;
|
int count = 0;
|
||||||
int item_level = 0;
|
int item_level = 0;
|
||||||
bool pickuped = false;
|
bool pickuped = false;
|
||||||
|
int bullet_num = 0;
|
||||||
|
|
||||||
Loot();
|
Loot();
|
||||||
virtual ~Loot() override;
|
virtual ~Loot() override;
|
||||||
|
@ -536,21 +536,7 @@ void Player::LootInteraction(Loot* entity)
|
|||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
{
|
{
|
||||||
if (item_meta->i->is_luck()) {
|
ProcLootSkin(entity, item_meta);
|
||||||
if (skin_jlf.skin_id != 0) {
|
|
||||||
room->DropItem(pos, skin_jlf.skin_id, 1, skin_jlf.skin_lv);
|
|
||||||
}
|
|
||||||
skin_jlf.skin_id = entity->item_id;
|
|
||||||
skin_jlf.skin_lv = std::max(1, GetSkinConfigLv(skin_jlf.skin_id));
|
|
||||||
skin_jlf_meta = MetaMgr::Instance()->GetDress(skin_jlf.skin_id);
|
|
||||||
if (skin_jlf_meta) {
|
|
||||||
skill_meta = MetaMgr::Instance()->GetSkill(skin_jlf_meta->i->skill_id());
|
|
||||||
} else {
|
|
||||||
skill_meta = nullptr;
|
|
||||||
}
|
|
||||||
RecalcBuff();
|
|
||||||
SyncAroundPlayers();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -476,13 +476,13 @@ Hero* Room::CreateHero(Human* hum)
|
|||||||
return hero;
|
return hero;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Room::CreateLoot(int equip_id, a8::Vec2 pos, int count, int equip_lv)
|
int Room::CreateLoot(int equip_id, a8::Vec2 pos, int count, int equip_lv)
|
||||||
{
|
{
|
||||||
MetaData::Equip* equip_meta = MetaMgr::Instance()->GetEquip(equip_id);
|
MetaData::Equip* equip_meta = MetaMgr::Instance()->GetEquip(equip_id);
|
||||||
if (equip_meta) {
|
if (equip_meta) {
|
||||||
if (equip_meta->i->equip_type() == 2 &&
|
if (equip_meta->i->equip_type() == 2 &&
|
||||||
MetaMgr::Instance()->fighting_mode) {
|
MetaMgr::Instance()->fighting_mode) {
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
Loot* entity = new Loot();
|
Loot* entity = new Loot();
|
||||||
entity->room = this;
|
entity->room = this;
|
||||||
@ -512,6 +512,9 @@ void Room::CreateLoot(int equip_id, a8::Vec2 pos, int count, int equip_lv)
|
|||||||
uniid_hash_[entity->entity_uniid] = entity;
|
uniid_hash_[entity->entity_uniid] = entity;
|
||||||
grid_service.AddEntity(entity);
|
grid_service.AddEntity(entity);
|
||||||
entity->BroadcastFullState();
|
entity->BroadcastFullState();
|
||||||
|
return entity->entity_uniid;
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ public:
|
|||||||
void DropItem(a8::Vec2 pos, int item_id, int item_count, int item_lv);
|
void DropItem(a8::Vec2 pos, int item_id, int item_count, int item_lv);
|
||||||
|
|
||||||
Hero* CreateHero(Human* hum);
|
Hero* CreateHero(Human* hum);
|
||||||
void CreateLoot(int equip_id, a8::Vec2 pos, int count, int equip_lv);
|
int CreateLoot(int equip_id, a8::Vec2 pos, int count, int equip_lv);
|
||||||
void CreateBullet(Human* hum, Weapon* weapon,
|
void CreateBullet(Human* hum, Weapon* weapon,
|
||||||
a8::Vec2 pos, a8::Vec2 dir, float fly_distance);
|
a8::Vec2 pos, a8::Vec2 dir, float fly_distance);
|
||||||
|
|
||||||
|
@ -63,6 +63,7 @@ struct Skin
|
|||||||
{
|
{
|
||||||
int skin_id = 0;
|
int skin_id = 0;
|
||||||
int skin_lv = 0;
|
int skin_lv = 0;
|
||||||
|
int bullet_num = 0;
|
||||||
|
|
||||||
void ToPB(cs::MFSkin* pb_obj);
|
void ToPB(cs::MFSkin* pb_obj);
|
||||||
};
|
};
|
||||||
|
@ -77,6 +77,7 @@ message Equip
|
|||||||
optional string bullet_born_offset = 30; //子弹出生偏移
|
optional string bullet_born_offset = 30; //子弹出生偏移
|
||||||
optional float bullet_angle = 34; //子弹浮动方向
|
optional float bullet_angle = 34; //子弹浮动方向
|
||||||
optional string name = 35; //装备名字
|
optional string name = 35; //装备名字
|
||||||
|
optional float rad = 36; //半径
|
||||||
|
|
||||||
optional string inventory_slot = 31; //库存槽位
|
optional string inventory_slot = 31; //库存槽位
|
||||||
optional int32 _inventory_slot = 32; //库存槽位
|
optional int32 _inventory_slot = 32; //库存槽位
|
||||||
|
Loading…
x
Reference in New Issue
Block a user