Compare commits
22 Commits
banshu2001
...
master
Author | SHA1 | Date | |
---|---|---|---|
06cd095e37 | |||
62816aeb7b | |||
315c7d57e4 | |||
cae20c8783 | |||
088b45189a | |||
a89bf30f56 | |||
cffcc9fe50 | |||
6c8b349eb8 | |||
094c6b58a0 | |||
1ad105df3c | |||
ad47190220 | |||
9141ac81f9 | |||
bb5bb8bdb9 | |||
![]() |
983277ae4a | ||
![]() |
85b9e474f3 | ||
![]() |
4e7ddfa237 | ||
![]() |
dfac21df80 | ||
![]() |
6a40f89ea4 | ||
![]() |
30551d587c | ||
![]() |
db16743f9a | ||
![]() |
ff0b198474 | ||
![]() |
aa84b1bf39 |
3
.gitignore
vendored
3
.gitignore
vendored
@ -21,4 +21,5 @@ __pycache__
|
||||
.user
|
||||
game.py
|
||||
*.cxx
|
||||
compile_commands.json
|
||||
compile_commands.json
|
||||
.vscode/settings.json
|
||||
|
@ -138,7 +138,8 @@ enum BuffEffectType_e
|
||||
kBET_CliEffect1 = 19, //僵尸被动光环减速(客户端表现用)
|
||||
kBET_CliEffect2 = 20, //僵尸被动光环毒物(客户端表现用)
|
||||
kBET_CliEffect3 = 21, //僵尸被动光环地震(客户端表现用)
|
||||
kBET_CliEffect4 = 22, //被拖拽(客户端表现用)
|
||||
kBET_CliEffect4 = 22, //被拖拽(客户端表现用)
|
||||
kBET_HunLuan = 23, //混乱,在烟雾弹中不自动瞄准
|
||||
kBET_End
|
||||
};
|
||||
|
||||
@ -226,6 +227,7 @@ enum EquipType_e
|
||||
EQUIP_TYPE_CAR = 9,
|
||||
EQUIP_TYPE_SKIN = 10,
|
||||
EQUIP_TYPE_CAMOUFLAGE = 11,
|
||||
EQUIP_TYPE_SPOILS = 12,
|
||||
EQUIP_TYPE_End
|
||||
};
|
||||
|
||||
|
@ -136,12 +136,8 @@ void Human::Initialize()
|
||||
RecalcSelfCollider();
|
||||
volume_ = meta->volume;
|
||||
observers_.insert(this);
|
||||
ability.hp = meta->i->health();
|
||||
for (auto& weapon : spec_weapons) {
|
||||
if (weapon.meta) {
|
||||
ability.hp += weapon.meta ? weapon.GetAttrValue(kHAT_MaxHp) : 0;
|
||||
}
|
||||
}
|
||||
RecalcMaxHp();
|
||||
ability.hp = ability.max_hp;
|
||||
}
|
||||
|
||||
float Human::GetSpeed()
|
||||
@ -222,6 +218,9 @@ void Human::FillMFObjectFull(Room* room, Human* hum, cs::MFObjectFull* full_data
|
||||
p->set_max_energy_shield(max_energy_shield);
|
||||
}
|
||||
#endif
|
||||
if (guild_id != 0) {
|
||||
p->set_guild_id(guild_id);
|
||||
}
|
||||
p->set_vip(vip);
|
||||
p->set_sdmg(sdmg);
|
||||
p->set_kill_count(stats.kills);
|
||||
@ -306,6 +305,9 @@ void Human::FillMFPlayerStats(cs::MFPlayerStats* stats_pb)
|
||||
}
|
||||
|
||||
stats_pb->set_account_id(account_id);
|
||||
if (guild_id != 0) {
|
||||
stats_pb->set_guild_id(guild_id);
|
||||
}
|
||||
|
||||
for (auto& pair : stats.items) {
|
||||
auto p = stats_pb->add_items();
|
||||
@ -378,6 +380,9 @@ void Human::FillMFTeamData(cs::MFTeamData* team_data, bool is_game_over)
|
||||
team_data->set_user_value1(user_value1);
|
||||
team_data->set_user_value2(user_value2);
|
||||
team_data->set_user_value3(user_value3);
|
||||
if (guild_id != 0) {
|
||||
team_data->set_guild_id(guild_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -953,8 +958,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)
|
||||
@ -1552,7 +1566,9 @@ void Human::RecalcBaseAttr()
|
||||
if (helmet_meta) {
|
||||
ability.def += helmet_meta->i->def();
|
||||
}
|
||||
ability.max_hp = std::max(ability.hp, ability.max_hp);
|
||||
RecalcSkinAttr();
|
||||
RecalcTalentAttr();
|
||||
RecalcMaxHp();
|
||||
}
|
||||
|
||||
int Human::GetInventory(int slot_id)
|
||||
@ -1593,7 +1609,7 @@ void Human::RecoverHp(int inc_hp)
|
||||
{
|
||||
if (!dead) {
|
||||
ability.hp += inc_hp;
|
||||
ability.hp = std::max(GetHP(), GetMaxHP());
|
||||
ability.hp = std::min(GetHP(), GetMaxHP());
|
||||
}
|
||||
}
|
||||
|
||||
@ -2072,6 +2088,69 @@ bool Human::IsEnemy(Human* hum)
|
||||
}
|
||||
}
|
||||
|
||||
void Human::RecalcTalentAttr()
|
||||
{
|
||||
talent_attr_abs_ = {};
|
||||
if (curr_weapon == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for(int i = 1;i <= maxtalent; i++)
|
||||
{
|
||||
auto talent = MetaMgr::Instance()->GetTalent(i);
|
||||
if (talent->GetEquipLabel() == curr_weapon->meta->i->equip_label()) {
|
||||
talent_attr_abs_[kHAT_Atk] += talent->GetAtkPlus();
|
||||
talent_attr_abs_[kHAT_MaxHp] += talent->GetHpPlus();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void Human::RecalcSkinAttr()
|
||||
{
|
||||
std::map<int, int> skinmap = {};
|
||||
int fashionid = 0;
|
||||
for(int i = 0;i < 6;i++)
|
||||
{
|
||||
skinmap[skins[i].skin_id] = skins[i].skin_id;
|
||||
if (i == 1) {
|
||||
fashionid = skins[i].skin_id;
|
||||
}
|
||||
}
|
||||
|
||||
skin_attr_abs_ = {};
|
||||
auto fashion = MetaMgr::Instance()->GetFashion(fashionid);
|
||||
if (fashion != nullptr && fashion->CheckFashion(skinmap)){
|
||||
fashion->GetAttr(skin_attr_abs_);
|
||||
}
|
||||
|
||||
for(auto& item:skinmap)
|
||||
{
|
||||
auto skinattr = MetaMgr::Instance()->GetSkinAttr(item.first);
|
||||
if (skinattr == nullptr) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for(int i = kHAT_Begin; i < kHAT_End; i++)
|
||||
{
|
||||
skin_attr_abs_[i] += (*skinattr)[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Human::RecalcMaxHp()
|
||||
{
|
||||
ability.max_hp = meta->i->health();
|
||||
for (auto& weapon : spec_weapons) {
|
||||
if (weapon.meta) {
|
||||
ability.max_hp += weapon.meta ? weapon.GetAttrValue(kHAT_MaxHp) : 0;
|
||||
}
|
||||
}
|
||||
ability.max_hp += talent_attr_abs_[kHAT_MaxHp];
|
||||
ability.max_hp += skin_attr_abs_[kHAT_MaxHp];
|
||||
}
|
||||
|
||||
void Human::_InternalUpdateMove(float speed)
|
||||
{
|
||||
float nx = move_dir.x * speed;
|
||||
@ -2530,7 +2609,7 @@ void Human::SendBattleReport()
|
||||
url = "http://192.168.100.41/webapp/index.php?c=Role&a=battleReport";
|
||||
} else {
|
||||
if (JsonDataMgr::Instance()->channel != 0) {
|
||||
url = a8::Format("http://game2004api-test.kingsome.cn/%d/webapp/index.php?c=Role&a=battleReport",
|
||||
url = a8::Format("https://game2004api-test.kingsome.cn/%d/webapp/index.php?c=Role&a=battleReport",
|
||||
{
|
||||
JsonDataMgr::Instance()->channel
|
||||
});
|
||||
@ -2541,20 +2620,21 @@ void Human::SendBattleReport()
|
||||
} else {
|
||||
if (JsonDataMgr::Instance()->channel != 0) {
|
||||
if (kTouTiaoChannelId == JsonDataMgr::Instance()->channel) {
|
||||
url = a8::Format("http://game2004api-al.kingsome.cn/%d/webapp/index.php?c=Role&a=battleReport",
|
||||
url = a8::Format("https://game2004api-al.kingsome.cn/%d/webapp/index.php?c=Role&a=battleReport",
|
||||
{
|
||||
JsonDataMgr::Instance()->channel
|
||||
});
|
||||
} else {
|
||||
url = a8::Format("http://game2004api.kingsome.cn/%d/webapp/index.php?c=Role&a=battleReport",
|
||||
url = a8::Format("https://game2004api.kingsome.cn/%d/webapp/index.php?c=Role&a=battleReport",
|
||||
{
|
||||
JsonDataMgr::Instance()->channel
|
||||
});
|
||||
}
|
||||
} else {
|
||||
url = "http://game2004api.kingsome.cn/webapp/index.php?c=Role&a=battleReport";
|
||||
url = "https://game2004api.kingsome.cn/webapp/index.php?c=Role&a=battleReport";
|
||||
}
|
||||
}
|
||||
JsonDataMgr::Instance()->GetBattleReportUrl(url);
|
||||
std::string data;
|
||||
params->ToUrlEncodeStr(data);
|
||||
f8::HttpClientPool::Instance()->HttpGet(
|
||||
@ -2660,6 +2740,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();
|
||||
@ -3281,6 +3371,10 @@ float Human::GetAttrAbs(int attr_id)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (IsValidHumanAttr(attr_id)) {
|
||||
attr_abs_val += talent_attr_abs_[attr_id];
|
||||
attr_abs_val += skin_attr_abs_[attr_id];
|
||||
}
|
||||
return attr_abs_val;
|
||||
}
|
||||
|
||||
@ -3985,14 +4079,10 @@ void Human::OnMetaChange()
|
||||
curr_weapon = &weapons[0];
|
||||
}
|
||||
}
|
||||
ability.hp = meta->i->health();
|
||||
for (auto& weapon : spec_weapons) {
|
||||
if (weapon.meta) {
|
||||
ability.hp += weapon.meta ? weapon.GetAttrValue(kHAT_MaxHp) : 0;
|
||||
}
|
||||
}
|
||||
|
||||
room->frame_event.AddHpChg(this);
|
||||
RecalcBaseAttr();
|
||||
ability.hp = ability.max_hp;
|
||||
skill_meta_ = MetaMgr::Instance()->GetSkill(meta->i->active_skill());
|
||||
ResetSkill();
|
||||
MetaData::Skill* passive_skill_meta = MetaMgr::Instance()->GetSkill(meta->i->passive_skill());
|
||||
@ -4073,13 +4163,34 @@ void Human::ProcReloadAction()
|
||||
if (GetInventory(bullet_meta->i->_inventory_slot()) <=
|
||||
p_weapon->GetClipVolume() - ammo) {
|
||||
add_num = GetInventory(bullet_meta->i->_inventory_slot());
|
||||
if (p_weapon->meta->i->reloadtype() == 1) {
|
||||
add_num = 1;
|
||||
}
|
||||
DecInventory(bullet_meta->i->_inventory_slot(), add_num);
|
||||
} else {
|
||||
add_num = p_weapon->GetClipVolume() - ammo;
|
||||
if (p_weapon->meta->i->reloadtype() == 1) {
|
||||
add_num = 1;
|
||||
}
|
||||
DecInventory(bullet_meta->i->_inventory_slot(), add_num);
|
||||
}
|
||||
p_weapon->ammo += add_num;
|
||||
need_sync_active_player = true;;
|
||||
need_sync_active_player = true;
|
||||
if (p_weapon->meta->i->reloadtype() == 1) {
|
||||
room->xtimer.AddDeadLineTimerAndAttach
|
||||
(1,
|
||||
a8::XParams()
|
||||
.SetSender(this)
|
||||
.SetParam1(p_weapon->weapon_idx)
|
||||
.SetParam2(p_weapon->weapon_id),
|
||||
[] (const a8::XParams& param)
|
||||
{
|
||||
Human* hum = (Human*)param.sender.GetUserData();
|
||||
hum->NextReload(param.param2, param.param1);
|
||||
},
|
||||
&xtimer_attacher.timer_list_
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4087,3 +4198,19 @@ void Human::ProcReloadAction()
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void Human::NextReload(int prev_weapon_id, int prev_weapon_idx)
|
||||
{
|
||||
if (action_type != AT_None) {
|
||||
return;
|
||||
}
|
||||
Weapon* p_weapon = curr_weapon;
|
||||
if (car_weapon.meta) {
|
||||
p_weapon = &car_weapon;
|
||||
}
|
||||
if (p_weapon &&
|
||||
p_weapon->weapon_id == prev_weapon_id &&
|
||||
p_weapon->weapon_idx == prev_weapon_idx) {
|
||||
AutoLoadingBullet(true);
|
||||
}
|
||||
}
|
||||
|
@ -62,6 +62,7 @@ class Human : public MoveableEntity
|
||||
long long user_value1 = 0;
|
||||
long long user_value2 = 0;
|
||||
long long user_value3 = 0;
|
||||
long long guild_id = 0;
|
||||
long long last_cmmove_frameno = 0;
|
||||
bool downed = false;
|
||||
bool disconnected = false;
|
||||
@ -133,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;
|
||||
@ -150,6 +152,8 @@ class Human : public MoveableEntity
|
||||
int kill_times = 0;
|
||||
int rank = 0;
|
||||
|
||||
int maxtalent = 0;
|
||||
|
||||
std::function<void(Human*)> on_grid_chg;
|
||||
|
||||
Human();
|
||||
@ -293,17 +297,23 @@ class Human : public MoveableEntity
|
||||
void DeadDrop();
|
||||
bool IsEnemy(Human* hum);
|
||||
|
||||
void RecalcTalentAttr();
|
||||
void RecalcSkinAttr();
|
||||
|
||||
protected:
|
||||
void _InternalUpdateMove(float speed);
|
||||
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);
|
||||
void AutoChgWeapon();
|
||||
void CancelRevive();
|
||||
|
||||
void RecalcMaxHp();
|
||||
|
||||
private:
|
||||
void ClearFrameData();
|
||||
void GenBattleReportData(a8::MutableXObject* params);
|
||||
@ -334,6 +344,7 @@ private:
|
||||
void OnMetaChange();
|
||||
void OnChgToTerminator();
|
||||
void ProcReloadAction();
|
||||
void NextReload(int prev_weapon_id, int prev_weapon_idx);
|
||||
|
||||
protected:
|
||||
int level_ = 0;
|
||||
@ -394,6 +405,8 @@ private:
|
||||
|
||||
std::array<float, kHAT_End> buff_attr_abs_ = {};
|
||||
std::array<float, kHAT_End> buff_attr_rate_ = {};
|
||||
std::array<float, kHAT_End> talent_attr_abs_ = {};
|
||||
std::array<float, kHAT_End> skin_attr_abs_ = {};
|
||||
|
||||
std::array<ObjectSyncFlags, FIXED_OBJECT_MAXID> fixed_object_sync_flags_ = {};
|
||||
|
||||
|
@ -24,14 +24,28 @@ void JsonDataMgr::Init()
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
std::string gameserver_cluster_json_file;
|
||||
std::string setting_json_file;
|
||||
|
||||
gameserver_cluster_json_file = a8::Format("%s/node%d/game%d.gameserver.cluster.json",
|
||||
{
|
||||
work_path_,
|
||||
App::Instance()->node_id,
|
||||
GAME_ID
|
||||
});
|
||||
setting_json_file = a8::Format("%s/game%d.gameserver.setting.json",
|
||||
{
|
||||
work_path_,
|
||||
GAME_ID
|
||||
});
|
||||
gameserver_cluster_json_.ReadFromFile(gameserver_cluster_json_file);
|
||||
setting_json_.ReadFromFile(setting_json_file);
|
||||
if (setting_json_.GetType() == a8::XOT_OBJECT &&
|
||||
setting_json_.HasKey("battle_report_url")) {
|
||||
battle_report_url_ = setting_json_.Get("battle_report_url").GetString();
|
||||
}
|
||||
|
||||
ip = GetConf()->At("ip")->AsXValue().GetString();
|
||||
listen_port = GetConf()->At("listen_port")->AsXValue();
|
||||
if (GetConf()->HasKey("channel")) {
|
||||
@ -39,6 +53,11 @@ void JsonDataMgr::Init()
|
||||
}
|
||||
server_info = a8::Format("%s:%d", {ip, listen_port});
|
||||
Reload();
|
||||
|
||||
a8::UdpLog::Instance()->Info("battle_report_url:%s",
|
||||
{
|
||||
battle_report_url_
|
||||
});
|
||||
}
|
||||
|
||||
void JsonDataMgr::UnInit()
|
||||
@ -72,3 +91,10 @@ void JsonDataMgr::Reload()
|
||||
});
|
||||
masterserver_cluster_json_.ReadFromFile(masterserver_cluster_json_file);
|
||||
}
|
||||
|
||||
void JsonDataMgr::GetBattleReportUrl(std::string& url)
|
||||
{
|
||||
if (!battle_report_url_.empty()) {
|
||||
url = battle_report_url_;
|
||||
}
|
||||
}
|
||||
|
@ -19,9 +19,14 @@ public:
|
||||
std::string server_info;
|
||||
|
||||
void Reload();
|
||||
void GetBattleReportUrl(std::string& url);
|
||||
|
||||
private:
|
||||
std::string battle_report_url_;
|
||||
|
||||
private:
|
||||
std::string work_path_ = "../config";
|
||||
a8::XObject setting_json_;
|
||||
a8::XObject gameserver_cluster_json_;
|
||||
a8::XObject masterserver_cluster_json_;
|
||||
};
|
||||
|
@ -95,7 +95,7 @@ namespace MetaData
|
||||
|
||||
void EquipUpgrade::Init()
|
||||
{
|
||||
const int MAX_LV = 20;
|
||||
const int MAX_LV = 64;
|
||||
for (int j = 0; j < MAX_LV; ++j) {
|
||||
std::array<float, kHAT_End>& attrs = a8::FastAppend(level_attrs);
|
||||
for (size_t k = 0; k < kHAT_End; ++k) {
|
||||
@ -580,4 +580,81 @@ namespace MetaData
|
||||
);
|
||||
}
|
||||
|
||||
void Talent::Init()
|
||||
{
|
||||
talentid = i->talent_id();
|
||||
if (i->equip_label() > 0) {
|
||||
equiplabel = i->equip_label();
|
||||
hpplus = i->hp_upgrade();
|
||||
} else {
|
||||
equiplabel = i->equip_label2();
|
||||
atkplus = i->atk_upgrade();
|
||||
}
|
||||
}
|
||||
|
||||
int Talent::GetId()
|
||||
{
|
||||
return talentid;
|
||||
}
|
||||
|
||||
int Talent::GetEquipLabel()
|
||||
{
|
||||
return equiplabel;
|
||||
}
|
||||
|
||||
int Talent::GetHpPlus()
|
||||
{
|
||||
return hpplus;
|
||||
}
|
||||
|
||||
int Talent::GetAtkPlus()
|
||||
{
|
||||
return atkplus;
|
||||
}
|
||||
|
||||
void Fashion::Init()
|
||||
{
|
||||
fashionid = i->id();
|
||||
std::vector<std::string> strings;
|
||||
a8::Split(i->spera_attr(), strings, ';');
|
||||
for(auto& item: strings)
|
||||
{
|
||||
std::vector<std::string> itemstrs;
|
||||
a8::Split(item, itemstrs, ':');
|
||||
if (itemstrs.size() < 2) {
|
||||
continue;
|
||||
}
|
||||
|
||||
int key = a8::XValue(itemstrs[0]).GetInt();
|
||||
int value = a8::XValue(itemstrs[1]).GetInt();
|
||||
attr_abs[key] = value;
|
||||
}
|
||||
|
||||
strings.clear();
|
||||
a8::Split(i->item_id(), strings, '|');
|
||||
for(auto& item: strings)
|
||||
{
|
||||
fashion_details.push_back(a8::XValue(item).GetInt());
|
||||
}
|
||||
}
|
||||
|
||||
bool Fashion::CheckFashion(const std::map<int, int> &skins)
|
||||
{
|
||||
for(auto& item: fashion_details)
|
||||
{
|
||||
if (skins.find(item) == skins.end()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Fashion::GetAttr(std::array<float, kHAT_End> &attarr)
|
||||
{
|
||||
for(int i = kHAT_Begin; i < kHAT_End; i++)
|
||||
{
|
||||
attarr[i] = attr_abs[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -234,4 +234,32 @@ namespace MetaData
|
||||
|
||||
};
|
||||
|
||||
struct Talent
|
||||
{
|
||||
const metatable::Talent* i = nullptr;
|
||||
void Init();
|
||||
int GetId();
|
||||
int GetEquipLabel();
|
||||
int GetHpPlus();
|
||||
int GetAtkPlus();
|
||||
|
||||
private:
|
||||
int talentid = 0;
|
||||
int equiplabel = 0;
|
||||
int hpplus = 0;
|
||||
int atkplus = 0;
|
||||
};
|
||||
|
||||
struct Fashion
|
||||
{
|
||||
const metatable::Fashion* i = nullptr;
|
||||
void Init();
|
||||
bool CheckFashion(const std::map<int, int> &skins);
|
||||
void GetAttr(std::array<float, kHAT_End> &attarr);
|
||||
|
||||
private:
|
||||
int fashionid = 0;
|
||||
std::array<float, kHAT_End> attr_abs = {};
|
||||
std::vector<int> fashion_details = {};
|
||||
};
|
||||
}
|
||||
|
@ -63,6 +63,11 @@ public:
|
||||
std::list<metatable::AI> ai_meta_list;
|
||||
std::list<MetaData::AI> ai_list;
|
||||
|
||||
std::list<metatable::Talent> talent_meta_list;
|
||||
std::list<MetaData::Talent> talent_list;
|
||||
std::list<metatable::Fashion> fashion_meta_list;
|
||||
std::list<MetaData::Fashion> fashion_list;
|
||||
|
||||
std::map<std::string, MetaData::Parameter*> parameter_hash;
|
||||
std::map<int, MetaData::Map*> gamemap_hash;
|
||||
std::map<int, MetaData::AirDrop*> airdrop_hash;
|
||||
@ -90,6 +95,9 @@ public:
|
||||
std::map<int, MetaData::Robot*> robot_hash;
|
||||
std::map<int, std::vector<MetaData::AirLine*>> airline_hash;
|
||||
std::map<int, MetaData::AI*> ai_hash;
|
||||
std::map<int, MetaData::Talent*> talent_hash;
|
||||
std::map<int, MetaData::Fashion*> fashion_hash;
|
||||
std::map<int, std::array<float, kHAT_End>> skinatt_hash;
|
||||
|
||||
void Load()
|
||||
{
|
||||
@ -138,6 +146,8 @@ public:
|
||||
f8::ReadCsvMetaFile(res_path + "equipUpgrade@equipUpgrade.csv", equipupgrade_meta_list);
|
||||
f8::ReadCsvMetaFile(res_path + "robot@robot.csv", robot_meta_list);
|
||||
f8::ReadCsvMetaFile(res_path + "ai@ai.csv", ai_meta_list);
|
||||
f8::ReadCsvMetaFile(res_path + "talent@talent.csv", talent_meta_list);
|
||||
f8::ReadCsvMetaFile(res_path + "fashion@fashion.csv", fashion_meta_list);
|
||||
BindToMetaData();
|
||||
#if 1
|
||||
{
|
||||
@ -489,6 +499,12 @@ private:
|
||||
if (meta._inventory_slot() > -1) {
|
||||
equip_slot_hash[meta._inventory_slot()] = &item;
|
||||
}
|
||||
|
||||
if (meta.equip_type() == 10) {
|
||||
skinatt_hash[item.i->id()][kHAT_Atk] = meta.atk();
|
||||
|
||||
skinatt_hash[item.i->id()][kHAT_MaxHp] = meta.max_hp();
|
||||
}
|
||||
}
|
||||
|
||||
for (auto& meta : player_meta_list) {
|
||||
@ -616,6 +632,20 @@ private:
|
||||
item.Init();
|
||||
ai_hash[a8::MakeInt64(meta.ai_level(), meta.ai_mode())] = &item;
|
||||
}
|
||||
|
||||
for (auto& meta : talent_meta_list) {
|
||||
MetaData::Talent& item = a8::FastAppend(talent_list);
|
||||
item.i = &meta;
|
||||
item.Init();
|
||||
talent_hash[meta.talent_id()] = &item;
|
||||
}
|
||||
|
||||
for (auto& meta : fashion_meta_list) {
|
||||
MetaData::Fashion& item = a8::FastAppend(fashion_list);
|
||||
item.i = &meta;
|
||||
item.Init();
|
||||
fashion_hash[meta.id()] = &item;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
@ -848,3 +878,21 @@ MetaData::AI* MetaMgr::GetAI(int ai_level, int ai_mode)
|
||||
auto itr = loader_->ai_hash.find(a8::MakeInt64(ai_level, ai_mode));
|
||||
return itr != loader_->ai_hash.end() ? itr->second : nullptr;
|
||||
}
|
||||
|
||||
MetaData::Talent* MetaMgr::GetTalent(int talentid)
|
||||
{
|
||||
auto itr = loader_->talent_hash.find(talentid);
|
||||
return itr != loader_->talent_hash.end() ? itr->second : nullptr;
|
||||
}
|
||||
|
||||
MetaData::Fashion* MetaMgr::GetFashion(int fashionid)
|
||||
{
|
||||
auto itr = loader_->fashion_hash.find(fashionid);
|
||||
return itr != loader_->fashion_hash.end() ? itr->second : nullptr;
|
||||
}
|
||||
|
||||
std::array<float, kHAT_End>* MetaMgr::GetSkinAttr(int skinid)
|
||||
{
|
||||
auto itr = loader_->skinatt_hash.find(skinid);
|
||||
return itr != loader_->skinatt_hash.end() ? &(itr->second) : nullptr;
|
||||
}
|
||||
|
@ -49,6 +49,10 @@ class MetaMgr : public a8::Singleton<MetaMgr>
|
||||
MetaData::Robot* RandRobot(std::set<int>& refreshed_robot_set);
|
||||
MetaData::AI* GetAI(int ai_level, int ai_mode);
|
||||
|
||||
MetaData::Talent* GetTalent(int talentid);
|
||||
MetaData::Fashion* GetFashion(int fashionid);
|
||||
std::array<float, kHAT_End>* GetSkinAttr(int skinid);
|
||||
|
||||
int gas_inactive_time = 10;
|
||||
int newbie_gas_inactive_time = 5;
|
||||
int midbrid_gas_inactive_time = 15;
|
||||
|
@ -582,6 +582,7 @@ void Player::LootInteraction(Loot* entity)
|
||||
a8::SetBitFlag(status, HS_AlreadyEquip);
|
||||
ProcNewBieLogic();
|
||||
}
|
||||
RecalcBaseAttr();
|
||||
}
|
||||
break;
|
||||
case EQUIP_TYPE_OLDSKIN:
|
||||
@ -592,6 +593,7 @@ void Player::LootInteraction(Loot* entity)
|
||||
case EQUIP_TYPE_SKIN:
|
||||
{
|
||||
ProcLootSkin(entity, item_meta);
|
||||
RecalcBaseAttr();
|
||||
}
|
||||
break;
|
||||
case EQUIP_TYPE_CAR:
|
||||
@ -604,6 +606,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 &&
|
||||
@ -880,6 +887,7 @@ void Player::ProcPrepareItems(const ::google::protobuf::RepeatedField< ::google:
|
||||
add_num = curr_weapon->GetClipVolume();
|
||||
curr_weapon->ammo = add_num;
|
||||
}
|
||||
RecalcBaseAttr();
|
||||
}
|
||||
for (auto& spec_weapon : spec_weapons) {
|
||||
MetaData::Equip* item_meta = MetaMgr::Instance()->GetEquip(spec_weapon.weapon_id);
|
||||
@ -980,8 +988,13 @@ void Player::_CMMove(f8::MsgHdr& hdr, const cs::CMMove& msg)
|
||||
if (moving) {
|
||||
moved_frames = 0;
|
||||
}
|
||||
shot_start = msg.shot_start();
|
||||
shot_hold = msg.shot_hold();
|
||||
//前一个状态是纯点射
|
||||
if (shot_start && !shot_hold) {
|
||||
|
||||
} else {
|
||||
shot_start = msg.shot_start();
|
||||
shot_hold = msg.shot_hold();
|
||||
}
|
||||
fly_distance = std::min(200.0f, msg.fly_distance());
|
||||
if (!shot_hold) {
|
||||
series_shot_frames = 0;
|
||||
|
@ -72,6 +72,7 @@ Player* PlayerMgr::CreatePlayerByCMJoin(Player* hum,
|
||||
hum->user_value1 = msg.user_value1();
|
||||
hum->user_value2 = msg.user_value2();
|
||||
hum->user_value3 = msg.user_value3();
|
||||
hum->guild_id = msg.guild_id();
|
||||
#if 0
|
||||
if (hum->atk_add > 0.9999f) {
|
||||
hum->atk_add = hum->atk_add / 100.0f;
|
||||
@ -115,6 +116,10 @@ Player* PlayerMgr::CreatePlayerByCMJoin(Player* hum,
|
||||
#else
|
||||
hum->SetSkinInfo(msg.baseskin());
|
||||
#endif
|
||||
hum->maxtalent = msg.talent();
|
||||
hum->RecalcTalentAttr();
|
||||
hum->RecalcSkinAttr();
|
||||
|
||||
socket_hash_[socket] = hum;
|
||||
return hum;
|
||||
}
|
||||
|
@ -162,9 +162,9 @@ void RoomMgr::_CMJoin(f8::MsgHdr& hdr, const cs::CMJoin& msg)
|
||||
);
|
||||
hum->meta = MetaMgr::Instance()->human_meta;
|
||||
hum->room = room;
|
||||
room->AddPlayer(hum);
|
||||
hum->ProcPrepareItems(msg.prepare_items());
|
||||
hum->ProcPrepareItems2(msg.prepare_items2());
|
||||
room->AddPlayer(hum);
|
||||
PlayerMgr::Instance()->IncAccountNum(msg.account_id());
|
||||
if (JsonDataMgr::Instance()->channel != 0 &&
|
||||
JsonDataMgr::Instance()->channel != channel) {
|
||||
@ -558,6 +558,13 @@ std::string RoomMgr::GenTeamHashData(const std::string& team_uuid, std::map<std:
|
||||
|
||||
void RoomMgr::OnJoinRoomOk(const cs::CMJoin& msg, Player* hum)
|
||||
{
|
||||
a8::UdpLog::Instance()->Info
|
||||
("join room ok: %s,%s,%d",
|
||||
{
|
||||
hum->account_id,
|
||||
msg.team_uuid(),
|
||||
hum->room->GetRoomUuid()
|
||||
});
|
||||
if (msg.team_members().size() <= 1) {
|
||||
return;
|
||||
}
|
||||
|
@ -187,6 +187,7 @@ message MFPlayerFull
|
||||
optional int32 obj_uniid = 1; //唯一id
|
||||
optional MFVec2 pos = 2; //位置
|
||||
optional MFVec2 dir = 3; //朝向
|
||||
optional int64 guild_id = 4; //公会id
|
||||
|
||||
optional float max_health = 5; //血量
|
||||
optional float health = 6; //血量
|
||||
@ -527,6 +528,7 @@ message MFTeamData
|
||||
optional int64 user_value1 = 31; //对应好友系统的user_value1
|
||||
optional int64 user_value2 = 32; //对应好友系统的user_value2
|
||||
optional int64 user_value3 = 33; //对应好友系统的user_value3
|
||||
optional int64 guild_id = 34; //公会id
|
||||
}
|
||||
|
||||
//子弹
|
||||
@ -612,6 +614,7 @@ message MFPlayerStats
|
||||
optional string killer_account_id = 42; //杀手accountid(机器人为空)
|
||||
|
||||
optional string account_id = 21; //账号id
|
||||
optional int64 guild_id = 22; //公会id
|
||||
}
|
||||
|
||||
//空投
|
||||
@ -732,9 +735,11 @@ message CMJoin
|
||||
optional int64 user_value1 = 31; //对应好友系统的user_value1
|
||||
optional int64 user_value2 = 32; //对应好友系统的user_value2
|
||||
optional int64 user_value3 = 33; //对应好友系统的user_value3
|
||||
optional int64 guild_id = 34; //公会id
|
||||
optional bool force_entry_newbie_room = 50; //是否强制进新手房
|
||||
repeated MFTeamMember team_members = 51; //包括自己
|
||||
optional int32 room_mode = 52; //0:吃鸡模式 1:僵尸模式
|
||||
optional int32 talent = 53; //已激活天赋max id
|
||||
}
|
||||
|
||||
//断线重连
|
||||
@ -964,6 +969,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:道具数量
|
||||
}
|
||||
|
||||
//离开
|
||||
|
@ -95,6 +95,8 @@ message Equip
|
||||
optional int32 drop_id = 40;
|
||||
optional int32 explosion_effect = 42;
|
||||
optional string param1 = 43;
|
||||
optional int32 reloadtype = 46;
|
||||
optional int32 equip_label = 47;
|
||||
|
||||
optional string inventory_slot = 31; //库存槽位
|
||||
optional int32 _inventory_slot = 32; //库存槽位
|
||||
@ -337,4 +339,22 @@ message MapTplThingJson
|
||||
optional float param3 = 11;
|
||||
optional string object_type = 12;
|
||||
optional int32 _object_type = 13;
|
||||
}
|
||||
|
||||
message Talent
|
||||
{
|
||||
optional int32 talent_id = 1;
|
||||
optional string name = 2;
|
||||
optional int32 hp_upgrade = 3;
|
||||
optional int32 equip_label = 4;
|
||||
optional int32 atk_upgrade = 5;
|
||||
optional int32 equip_label2 = 6;
|
||||
}
|
||||
|
||||
message Fashion
|
||||
{
|
||||
optional int32 id = 1;
|
||||
optional string name = 2;
|
||||
optional string item_id = 3;
|
||||
optional string spera_attr = 4;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user