merge dev2
This commit is contained in:
commit
fc19ab438e
@ -54,7 +54,7 @@ void Bullet::OnHit(std::set<Entity*>& objects)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!hum->dead && (IsBomb() || player->team_id != hum->team_id)) {
|
if (!hum->dead && (IsBomb() || player->team_id != hum->team_id)) {
|
||||||
float dmg = gun_meta->i->atk() * (1 + player->GetBuffAttrRate(kHAT_Atk)) +
|
float dmg = GetAtk() * (1 + player->GetBuffAttrRate(kHAT_Atk)) +
|
||||||
player->GetBuffAttrAbs(kHAT_Atk);
|
player->GetBuffAttrAbs(kHAT_Atk);
|
||||||
float def = hum->ability.def * (1 + hum->GetBuffAttrRate(kHAT_Def)) +
|
float def = hum->ability.def * (1 + hum->GetBuffAttrRate(kHAT_Def)) +
|
||||||
hum->GetBuffAttrAbs(kHAT_Def);
|
hum->GetBuffAttrAbs(kHAT_Def);
|
||||||
@ -68,7 +68,7 @@ void Bullet::OnHit(std::set<Entity*>& objects)
|
|||||||
{
|
{
|
||||||
Obstacle* obstacle = (Obstacle*)target;
|
Obstacle* obstacle = (Obstacle*)target;
|
||||||
if (!obstacle->IsDead(room) && obstacle->meta->i->attack_type() == 1) {
|
if (!obstacle->IsDead(room) && obstacle->meta->i->attack_type() == 1) {
|
||||||
float dmg = gun_meta->i->atk() * (1 + player->GetBuffAttrRate(kHAT_Atk)) +
|
float dmg = GetAtk() * (1 + player->GetBuffAttrRate(kHAT_Atk)) +
|
||||||
player->GetBuffAttrAbs(kHAT_Atk);
|
player->GetBuffAttrAbs(kHAT_Atk);
|
||||||
float def = 0;
|
float def = 0;
|
||||||
float finaly_dmg = dmg * (1 - def/MetaMgr::Instance()->K);
|
float finaly_dmg = dmg * (1 - def/MetaMgr::Instance()->K);
|
||||||
@ -211,8 +211,8 @@ void Bullet::MapServiceUpdate()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
float bullet_range = gun_meta->i->range();
|
float bullet_range = gun_meta->i->range();
|
||||||
if (gun_upgrade_meta && gun_upgrade_meta->GetAttrValue(gun_lv, EA_ShotRange) > 0) {
|
if (gun_upgrade_meta && gun_upgrade_meta->GetAttrValue(gun_lv, kHAT_ShotRange) > 0) {
|
||||||
bullet_range += gun_upgrade_meta->GetAttrValue(gun_lv, EA_ShotRange);
|
bullet_range += gun_upgrade_meta->GetAttrValue(gun_lv, kHAT_ShotRange);
|
||||||
}
|
}
|
||||||
if (!objects.empty() || distance > bullet_range ||
|
if (!objects.empty() || distance > bullet_range ||
|
||||||
(IsBomb() && meta->i->_inventory_slot() != 4 && distance >= fly_distance)
|
(IsBomb() && meta->i->_inventory_slot() != 4 && distance >= fly_distance)
|
||||||
@ -228,3 +228,10 @@ void Bullet::MapServiceUpdate()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
float Bullet::GetAtk()
|
||||||
|
{
|
||||||
|
return gun_meta->i->atk() +
|
||||||
|
(gun_upgrade_meta ? gun_upgrade_meta->GetAttrValue(gun_lv, kHAT_Atk) : 0);
|
||||||
|
}
|
||||||
|
@ -40,6 +40,7 @@ class Bullet : public MoveableEntity
|
|||||||
void ProcBomb();
|
void ProcBomb();
|
||||||
bool IsBomb();
|
bool IsBomb();
|
||||||
inline void MapServiceUpdate();
|
inline void MapServiceUpdate();
|
||||||
|
float GetAtk();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CircleCollider* self_collider_ = nullptr;
|
CircleCollider* self_collider_ = nullptr;
|
||||||
|
@ -147,6 +147,9 @@ enum HumanAttrType_e
|
|||||||
kHAT_ShotSpeed = 7,
|
kHAT_ShotSpeed = 7,
|
||||||
kHAT_ReloadSpeed = 8,
|
kHAT_ReloadSpeed = 8,
|
||||||
kHAT_FireRate = 9,
|
kHAT_FireRate = 9,
|
||||||
|
kHAT_Volume = 10,
|
||||||
|
kHAT_MaxHp = 11,
|
||||||
|
kHAT_BulletAngle = 20,
|
||||||
kHAT_End
|
kHAT_End
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -182,6 +185,7 @@ enum VirtualPlayer_e
|
|||||||
VP_Mine = 9000003,
|
VP_Mine = 9000003,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if 0
|
||||||
enum EquipAttr_e
|
enum EquipAttr_e
|
||||||
{
|
{
|
||||||
EA_View = 1, //客户端用
|
EA_View = 1, //客户端用
|
||||||
@ -194,6 +198,7 @@ enum EquipAttr_e
|
|||||||
EA_Speed = 8,
|
EA_Speed = 8,
|
||||||
EA_End
|
EA_End
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
enum EquipType_e
|
enum EquipType_e
|
||||||
{
|
{
|
||||||
|
@ -74,7 +74,7 @@ void Human::Initialize()
|
|||||||
RecalcSelfCollider();
|
RecalcSelfCollider();
|
||||||
volume_ = meta->volume;
|
volume_ = meta->volume;
|
||||||
observers_.insert(this);
|
observers_.insert(this);
|
||||||
ability.hp = meta->i->health();
|
ability.hp = meta->i->health() + (spec_weapon.meta ? spec_weapon.GetAttrValue(kHAT_MaxHp) : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
float Human::GetSpeed()
|
float Human::GetSpeed()
|
||||||
@ -325,8 +325,8 @@ void Human::Shot(a8::Vec2& target_dir)
|
|||||||
float bullet_angle = std::get<2>(tuple);
|
float bullet_angle = std::get<2>(tuple);
|
||||||
if (curr_weapon->meta->i->bullet_angle() >= 0.10f) {
|
if (curr_weapon->meta->i->bullet_angle() >= 0.10f) {
|
||||||
int angle = (int)curr_weapon->meta->i->bullet_angle() * 1000;
|
int angle = (int)curr_weapon->meta->i->bullet_angle() * 1000;
|
||||||
if (curr_weapon->upgrade_meta) {
|
if (curr_weapon->GetUpgradeMeta()) {
|
||||||
angle -= curr_weapon->upgrade_meta->GetAttrValue(curr_weapon->weapon_lv, EA_BulletAngle) * 1000;
|
angle -= curr_weapon->GetAttrValue(kHAT_BulletAngle) * 1000;
|
||||||
}
|
}
|
||||||
if (angle > 0) {
|
if (angle > 0) {
|
||||||
bullet_angle += (rand() % angle) / 1000.0f * (rand() % 2 == 0 ? 1 : -1);
|
bullet_angle += (rand() % angle) / 1000.0f * (rand() % 2 == 0 ? 1 : -1);
|
||||||
@ -413,8 +413,8 @@ void Human::TankShot(a8::Vec2& target_dir)
|
|||||||
float bullet_angle = std::get<2>(tuple);
|
float bullet_angle = std::get<2>(tuple);
|
||||||
if (tank_weapon.meta->i->bullet_angle() >= 0.01f) {
|
if (tank_weapon.meta->i->bullet_angle() >= 0.01f) {
|
||||||
int angle = (int)tank_weapon.meta->i->bullet_angle() * 1000;
|
int angle = (int)tank_weapon.meta->i->bullet_angle() * 1000;
|
||||||
if (tank_weapon.upgrade_meta) {
|
if (tank_weapon.GetUpgradeMeta()) {
|
||||||
angle -= tank_weapon.upgrade_meta->GetAttrValue(tank_weapon.weapon_lv, EA_BulletAngle) * 1000;
|
angle -= tank_weapon.GetAttrValue(kHAT_BulletAngle) * 1000;
|
||||||
}
|
}
|
||||||
if (angle > 0) {
|
if (angle > 0) {
|
||||||
bullet_angle += (rand() % angle) / 1000.0f * (rand() % 2 == 0 ? 1 : -1);
|
bullet_angle += (rand() % angle) / 1000.0f * (rand() % 2 == 0 ? 1 : -1);
|
||||||
@ -2179,8 +2179,8 @@ void Human::GenBattleReportData(a8::MutableXObject* params)
|
|||||||
MetaData::RankReward* rank_reward_meta = MetaMgr::Instance()->GetRankReward(rank);
|
MetaData::RankReward* rank_reward_meta = MetaMgr::Instance()->GetRankReward(rank);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
{
|
{
|
||||||
if (rank_reward_meta && rank_reward_meta->i->drop() > 0) {
|
|
||||||
#else
|
#else
|
||||||
|
if (rank_reward_meta && rank_reward_meta->i->drop() > 0) {
|
||||||
#endif
|
#endif
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
{
|
{
|
||||||
|
@ -82,33 +82,39 @@ namespace MetaData
|
|||||||
|
|
||||||
void EquipUpgrade::Init()
|
void EquipUpgrade::Init()
|
||||||
{
|
{
|
||||||
for (int j = 0; j < i->max_lv(); ++j) {
|
const int MAX_LV = 20;
|
||||||
std::array<float, EA_End>& attrs = a8::FastAppend(level_attrs);
|
for (int j = 0; j < MAX_LV; ++j) {
|
||||||
for (size_t k = 0; k < EA_End; ++k) {
|
std::array<float, kHAT_End>& attrs = a8::FastAppend(level_attrs);
|
||||||
|
for (size_t k = 0; k < kHAT_End; ++k) {
|
||||||
attrs[k] = 0;
|
attrs[k] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::vector<std::string> strings;
|
std::vector<std::string> strings;
|
||||||
a8::Split(i->attr_type(), strings, '|');
|
a8::Split(i->attr_type(), strings, '|');
|
||||||
|
int level = 1;
|
||||||
for (auto& str : strings) {
|
for (auto& str : strings) {
|
||||||
std::vector<std::string> strings2;
|
if (str.empty()) {
|
||||||
a8::Split(str, strings2, ':');
|
continue;
|
||||||
if (strings2.size() != 3) {
|
|
||||||
abort();
|
|
||||||
}
|
}
|
||||||
int attr_type = a8::XValue(strings2[0]);
|
++level;
|
||||||
int attr_level = a8::XValue(strings2[1]);
|
std::vector<std::string> strings2;
|
||||||
float attr_value = a8::XValue(strings2[2]).GetDouble();
|
a8::Split(str, strings2, ';');
|
||||||
if (attr_type < EA_End) {
|
for (auto& str2 : strings2) {
|
||||||
if (attr_level >= 0 && attr_level < i->max_lv()) {
|
std::vector<std::string> strings3;
|
||||||
for (int j = 1; j < i->max_lv(); ++j) {
|
a8::Split(str2, strings3, ':');
|
||||||
if (j % attr_level == 0) {
|
if (strings3.size() != 2) {
|
||||||
level_attrs[j][attr_type] = attr_value * (j / attr_level);
|
abort();
|
||||||
}
|
}
|
||||||
}
|
int attr_type = a8::XValue(strings3[0]);
|
||||||
|
int attr_value = a8::XValue(strings3[1]);
|
||||||
|
if (attr_type <= kHAT_End) {
|
||||||
|
level_attrs[level][attr_type] = attr_value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}//end for strings
|
||||||
|
for (int i = level; i < MAX_LV; ++i) {
|
||||||
|
level_attrs[i] = level_attrs[level];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -121,7 +127,7 @@ namespace MetaData
|
|||||||
if (level > (int)level_attrs.size()) {
|
if (level > (int)level_attrs.size()) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (attr_type < EA_End) {
|
if (attr_type <= kHAT_End) {
|
||||||
return level_attrs[level][attr_type];
|
return level_attrs[level][attr_type];
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -443,8 +449,8 @@ namespace MetaData
|
|||||||
void Dress::Init()
|
void Dress::Init()
|
||||||
{
|
{
|
||||||
for (int j = 0; j < i->max_lv(); ++j) {
|
for (int j = 0; j < i->max_lv(); ++j) {
|
||||||
std::array<float, EA_End>& attrs = a8::FastAppend(level_attrs);
|
std::array<float, kHAT_End>& attrs = a8::FastAppend(level_attrs);
|
||||||
for (size_t k = 0; k < EA_End; ++k) {
|
for (size_t k = 0; k < kHAT_End; ++k) {
|
||||||
attrs[k] = 0;
|
attrs[k] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -460,7 +466,7 @@ namespace MetaData
|
|||||||
int attr_type = a8::XValue(strings2[0]);
|
int attr_type = a8::XValue(strings2[0]);
|
||||||
int attr_level = a8::XValue(strings2[1]);
|
int attr_level = a8::XValue(strings2[1]);
|
||||||
float attr_value = a8::XValue(strings2[2]).GetDouble();
|
float attr_value = a8::XValue(strings2[2]).GetDouble();
|
||||||
if (attr_type < EA_End) {
|
if (attr_type < kHAT_End) {
|
||||||
if (attr_level >= 0 && attr_level < i->max_lv()) {
|
if (attr_level >= 0 && attr_level < i->max_lv()) {
|
||||||
for (int j = 1; j < i->max_lv(); ++j) {
|
for (int j = 1; j < i->max_lv(); ++j) {
|
||||||
if (j % attr_type == 0) {
|
if (j % attr_type == 0) {
|
||||||
@ -481,7 +487,7 @@ namespace MetaData
|
|||||||
if (level > (int)level_attrs.size()) {
|
if (level > (int)level_attrs.size()) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (attr_type < EA_End) {
|
if (attr_type < kHAT_End) {
|
||||||
return level_attrs[level][attr_type];
|
return level_attrs[level][attr_type];
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -65,7 +65,7 @@ namespace MetaData
|
|||||||
float GetAttrValue(int level, int attr_type);
|
float GetAttrValue(int level, int attr_type);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<std::array<float, EA_End>> level_attrs;
|
std::vector<std::array<float, kHAT_End>> level_attrs;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Player
|
struct Player
|
||||||
@ -190,7 +190,7 @@ namespace MetaData
|
|||||||
float GetAttrValue(int level, int attr_type);
|
float GetAttrValue(int level, int attr_type);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<std::array<float, EA_End>> level_attrs;
|
std::vector<std::array<float, kHAT_End>> level_attrs;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct RankReward
|
struct RankReward
|
||||||
|
@ -173,7 +173,7 @@ void Player::UpdateShot()
|
|||||||
if (last_shot_frameno_ == 0 ||
|
if (last_shot_frameno_ == 0 ||
|
||||||
(
|
(
|
||||||
(room->frame_no - last_shot_frameno_) * (1000 / SERVER_FRAME_RATE)) >=
|
(room->frame_no - last_shot_frameno_) * (1000 / SERVER_FRAME_RATE)) >=
|
||||||
p_weapon->meta->i->fire_rate()
|
p_weapon->GetAttrValue(kHAT_FireRate)
|
||||||
) {
|
) {
|
||||||
Shot();
|
Shot();
|
||||||
}
|
}
|
||||||
@ -367,8 +367,8 @@ void Player::Shot()
|
|||||||
float bullet_angle = std::get<2>(tuple);
|
float bullet_angle = std::get<2>(tuple);
|
||||||
if (curr_weapon->meta->i->bullet_angle() >= 0.01f) {
|
if (curr_weapon->meta->i->bullet_angle() >= 0.01f) {
|
||||||
int angle = (int)curr_weapon->meta->i->bullet_angle() * 1000;
|
int angle = (int)curr_weapon->meta->i->bullet_angle() * 1000;
|
||||||
if (curr_weapon->upgrade_meta) {
|
if (curr_weapon->GetUpgradeMeta()) {
|
||||||
angle -= curr_weapon->upgrade_meta->GetAttrValue(curr_weapon->weapon_lv, EA_BulletAngle) * 1000;
|
angle -= curr_weapon->GetAttrValue(kHAT_BulletAngle) * 1000;
|
||||||
}
|
}
|
||||||
if (angle > 0) {
|
if (angle > 0) {
|
||||||
bullet_angle += (rand() % angle) / 1000.0f * (rand() % 2 == 0 ? 1 : -1);
|
bullet_angle += (rand() % angle) / 1000.0f * (rand() % 2 == 0 ? 1 : -1);
|
||||||
@ -533,7 +533,11 @@ void Player::LootInteraction(Loot* entity)
|
|||||||
} else {
|
} else {
|
||||||
weapons[0].weapon_idx = 0;
|
weapons[0].weapon_idx = 0;
|
||||||
weapons[0].weapon_id = entity->item_id;
|
weapons[0].weapon_id = entity->item_id;
|
||||||
|
#if 1
|
||||||
|
weapons[0].weapon_lv = std::max(1, entity->item_level);
|
||||||
|
#else
|
||||||
weapons[0].weapon_lv = std::max(1, GetWeaponConfigLv(weapons[0].weapon_id));
|
weapons[0].weapon_lv = std::max(1, GetWeaponConfigLv(weapons[0].weapon_id));
|
||||||
|
#endif
|
||||||
weapons[0].ammo = 0;
|
weapons[0].ammo = 0;
|
||||||
weapons[0].meta = item_meta;
|
weapons[0].meta = item_meta;
|
||||||
weapons[0].Recalc();
|
weapons[0].Recalc();
|
||||||
@ -564,7 +568,11 @@ void Player::LootInteraction(Loot* entity)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
weapon->weapon_id = entity->item_id;
|
weapon->weapon_id = entity->item_id;
|
||||||
|
#if 1
|
||||||
|
weapon->weapon_lv = std::max(1, entity->item_level);
|
||||||
|
#else
|
||||||
weapon->weapon_lv = std::max(1, GetWeaponConfigLv(weapon->weapon_id));
|
weapon->weapon_lv = std::max(1, GetWeaponConfigLv(weapon->weapon_id));
|
||||||
|
#endif
|
||||||
weapon->ammo = 0;
|
weapon->ammo = 0;
|
||||||
weapon->meta = item_meta;
|
weapon->meta = item_meta;
|
||||||
weapon->Recalc();
|
weapon->Recalc();
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include "cs_proto.pb.h"
|
#include "cs_proto.pb.h"
|
||||||
#include "ss_proto.pb.h"
|
#include "ss_proto.pb.h"
|
||||||
#include "room.h"
|
#include "room.h"
|
||||||
|
#include "metamgr.h"
|
||||||
|
|
||||||
#include "framework/cpp/utils.h"
|
#include "framework/cpp/utils.h"
|
||||||
|
|
||||||
@ -73,10 +74,15 @@ Player* PlayerMgr::CreatePlayerByCMJoin(long ip_saddr, int socket, const cs::CMJ
|
|||||||
#endif
|
#endif
|
||||||
for (auto& weapon : msg.weapons()) {
|
for (auto& weapon : msg.weapons()) {
|
||||||
if (weapon.weapon_id() != 0 && weapon.weapon_lv() > 0) {
|
if (weapon.weapon_id() != 0 && weapon.weapon_lv() > 0) {
|
||||||
hum->weapon_configs[weapon.weapon_id()] = weapon.weapon_lv();
|
MetaData::Equip* equip_meta = MetaMgr::Instance()->GetEquip(weapon.weapon_id());
|
||||||
hum->spec_weapon.weapon_id = weapon.weapon_id();
|
if (equip_meta) {
|
||||||
hum->spec_weapon.weapon_lv = weapon.weapon_lv();
|
hum->weapon_configs[weapon.weapon_id()] = weapon.weapon_lv();
|
||||||
hum->spec_weapon.ammo = weapon.ammo();
|
hum->spec_weapon.weapon_id = weapon.weapon_id();
|
||||||
|
hum->spec_weapon.weapon_lv = weapon.weapon_lv();
|
||||||
|
hum->spec_weapon.ammo = weapon.ammo();
|
||||||
|
hum->spec_weapon.meta = equip_meta;
|
||||||
|
hum->spec_weapon.Recalc();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (auto& weapon : msg.grow_weapons()) {
|
for (auto& weapon : msg.grow_weapons()) {
|
||||||
|
@ -501,7 +501,7 @@ void Room::CreateBullet(Human* hum, Weapon* weapon,
|
|||||||
bullet->player = hum;
|
bullet->player = hum;
|
||||||
bullet->room = this;
|
bullet->room = this;
|
||||||
bullet->gun_meta = weapon->meta;
|
bullet->gun_meta = weapon->meta;
|
||||||
bullet->gun_upgrade_meta = weapon->upgrade_meta;
|
bullet->gun_upgrade_meta = weapon->GetUpgradeMeta();
|
||||||
bullet->meta = MetaMgr::Instance()->GetEquip(weapon->meta->i->use_bullet());
|
bullet->meta = MetaMgr::Instance()->GetEquip(weapon->meta->i->use_bullet());
|
||||||
bullet->SetPos(pos);
|
bullet->SetPos(pos);
|
||||||
bullet->dir = dir;
|
bullet->dir = dir;
|
||||||
|
@ -19,12 +19,48 @@ void Weapon::Recalc()
|
|||||||
int Weapon::GetClipVolume()
|
int Weapon::GetClipVolume()
|
||||||
{
|
{
|
||||||
if (upgrade_meta) {
|
if (upgrade_meta) {
|
||||||
return meta->i->clip_volume() + upgrade_meta->GetAttrValue(weapon_lv, EA_Volume);
|
return meta->i->clip_volume() +
|
||||||
|
upgrade_meta->GetAttrValue(weapon_lv, kHAT_Volume);
|
||||||
} else {
|
} else {
|
||||||
return meta->i->clip_volume();
|
return meta->i->clip_volume();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float Weapon::GetAttrValue(HumanAttrType_e attr_type)
|
||||||
|
{
|
||||||
|
if (!meta) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
switch (attr_type) {
|
||||||
|
case kHAT_Atk:
|
||||||
|
{
|
||||||
|
return meta->i->atk() +
|
||||||
|
(upgrade_meta ? upgrade_meta->GetAttrValue(weapon_lv, attr_type) : 0);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case kHAT_FireRate:
|
||||||
|
{
|
||||||
|
return meta->i->fire_rate() -
|
||||||
|
(upgrade_meta ? upgrade_meta->GetAttrValue(weapon_lv, attr_type) : 0);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case kHAT_Volume:
|
||||||
|
{
|
||||||
|
return meta->i->clip_volume() +
|
||||||
|
(upgrade_meta ? upgrade_meta->GetAttrValue(weapon_lv, attr_type) : 0);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case kHAT_MaxHp:
|
||||||
|
{
|
||||||
|
return 0 +
|
||||||
|
(upgrade_meta ? upgrade_meta->GetAttrValue(weapon_lv, attr_type) : 0);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Skin::ToPB(cs::MFSkin* pb_obj)
|
void Skin::ToPB(cs::MFSkin* pb_obj)
|
||||||
{
|
{
|
||||||
pb_obj->set_skin_id(skin_id);
|
pb_obj->set_skin_id(skin_id);
|
||||||
|
@ -53,11 +53,15 @@ struct Weapon
|
|||||||
int weapon_lv = 0;
|
int weapon_lv = 0;
|
||||||
int ammo = 0;
|
int ammo = 0;
|
||||||
MetaData::Equip* meta = nullptr;
|
MetaData::Equip* meta = nullptr;
|
||||||
MetaData::EquipUpgrade* upgrade_meta = nullptr;
|
|
||||||
|
|
||||||
void ToPB(cs::MFWeapon* pb_obj);
|
void ToPB(cs::MFWeapon* pb_obj);
|
||||||
void Recalc();
|
void Recalc();
|
||||||
int GetClipVolume();
|
int GetClipVolume();
|
||||||
|
float GetAttrValue(HumanAttrType_e attr_type);
|
||||||
|
MetaData::EquipUpgrade* GetUpgradeMeta() { return upgrade_meta;}
|
||||||
|
|
||||||
|
private:
|
||||||
|
MetaData::EquipUpgrade* upgrade_meta = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Skin
|
struct Skin
|
||||||
|
@ -99,7 +99,6 @@ message EquipUpgrade
|
|||||||
{
|
{
|
||||||
optional int32 id = 1;
|
optional int32 id = 1;
|
||||||
optional string attr_type = 4;
|
optional string attr_type = 4;
|
||||||
optional int32 max_lv = 5;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
message Player
|
message Player
|
||||||
|
Loading…
x
Reference in New Issue
Block a user