Compare commits
8 Commits
master
...
banshu2001
Author | SHA1 | Date | |
---|---|---|---|
![]() |
48f6aaa216 | ||
![]() |
55aea64c8c | ||
![]() |
93afef4361 | ||
![]() |
57cd7d74d9 | ||
![]() |
02d5677b08 | ||
![]() |
a7df7c2165 | ||
![]() |
fb12c701bd | ||
![]() |
5c3bd6b74a |
1
.gitignore
vendored
1
.gitignore
vendored
@ -22,4 +22,3 @@ __pycache__
|
||||
game.py
|
||||
*.cxx
|
||||
compile_commands.json
|
||||
.vscode/settings.json
|
||||
|
@ -1,7 +1,7 @@
|
||||
project(gameserver)
|
||||
project(gameserver2004)
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
|
||||
set(GAME_ID 2004)
|
||||
set(GAME_ID 2001)
|
||||
|
||||
if (${RELEASE})
|
||||
set(CMAKE_BUILD_TYPE "Release")
|
||||
@ -71,7 +71,7 @@ set(EXECUTABLE_OUTPUT_PATH
|
||||
)
|
||||
|
||||
add_executable(
|
||||
gameserver${GAME_ID} ${SRC_LIST}
|
||||
gameserver2004 ${SRC_LIST}
|
||||
)
|
||||
|
||||
add_custom_target(script_pb_protocol ALL)
|
||||
@ -79,11 +79,11 @@ add_custom_command(TARGET script_pb_protocol
|
||||
PRE_BUILD
|
||||
COMMAND python ../../third_party/tools/scripts/construct/build_pb.py --cpp_out=. --pb_files=cs_proto,cs_msgid,ss_proto,ss_msgid,metatable --python_out=../tools/robot/virtualclient
|
||||
)
|
||||
add_dependencies(gameserver${GAME_ID} script_pb_protocol)
|
||||
add_dependencies(gameserver2004 script_pb_protocol)
|
||||
|
||||
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
target_link_libraries(
|
||||
gameserver${GAME_ID}
|
||||
gameserver2004
|
||||
pthread
|
||||
mysqlclient
|
||||
protobuf
|
||||
@ -101,7 +101,7 @@ if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
)
|
||||
else()
|
||||
target_link_libraries(
|
||||
gameserver${GAME_ID}
|
||||
gameserver2004
|
||||
pthread
|
||||
mysqlclient
|
||||
protobuf
|
||||
|
@ -139,7 +139,6 @@ enum BuffEffectType_e
|
||||
kBET_CliEffect2 = 20, //僵尸被动光环毒物(客户端表现用)
|
||||
kBET_CliEffect3 = 21, //僵尸被动光环地震(客户端表现用)
|
||||
kBET_CliEffect4 = 22, //被拖拽(客户端表现用)
|
||||
kBET_HunLuan = 23, //混乱,在烟雾弹中不自动瞄准
|
||||
kBET_End
|
||||
};
|
||||
|
||||
@ -227,7 +226,6 @@ enum EquipType_e
|
||||
EQUIP_TYPE_CAR = 9,
|
||||
EQUIP_TYPE_SKIN = 10,
|
||||
EQUIP_TYPE_CAMOUFLAGE = 11,
|
||||
EQUIP_TYPE_SPOILS = 12,
|
||||
EQUIP_TYPE_End
|
||||
};
|
||||
|
||||
|
@ -136,8 +136,12 @@ void Human::Initialize()
|
||||
RecalcSelfCollider();
|
||||
volume_ = meta->volume;
|
||||
observers_.insert(this);
|
||||
RecalcMaxHp();
|
||||
ability.hp = ability.max_hp;
|
||||
ability.hp = meta->i->health();
|
||||
for (auto& weapon : spec_weapons) {
|
||||
if (weapon.meta) {
|
||||
ability.hp += weapon.meta ? weapon.GetAttrValue(kHAT_MaxHp) : 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
float Human::GetSpeed()
|
||||
@ -218,9 +222,6 @@ 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);
|
||||
@ -305,9 +306,6 @@ 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();
|
||||
@ -380,9 +378,6 @@ 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -958,18 +953,9 @@ void Human::FillSMGameOver(cs::SMGameOver& msg)
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
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)
|
||||
{
|
||||
@ -1566,9 +1552,7 @@ void Human::RecalcBaseAttr()
|
||||
if (helmet_meta) {
|
||||
ability.def += helmet_meta->i->def();
|
||||
}
|
||||
RecalcSkinAttr();
|
||||
RecalcTalentAttr();
|
||||
RecalcMaxHp();
|
||||
ability.max_hp = std::max(ability.hp, ability.max_hp);
|
||||
}
|
||||
|
||||
int Human::GetInventory(int slot_id)
|
||||
@ -1609,7 +1593,7 @@ void Human::RecoverHp(int inc_hp)
|
||||
{
|
||||
if (!dead) {
|
||||
ability.hp += inc_hp;
|
||||
ability.hp = std::min(GetHP(), GetMaxHP());
|
||||
ability.hp = std::max(GetHP(), GetMaxHP());
|
||||
}
|
||||
}
|
||||
|
||||
@ -2088,69 +2072,6 @@ 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;
|
||||
@ -2609,7 +2530,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("https://game2004api-test.kingsome.cn/%d/webapp/index.php?c=Role&a=battleReport",
|
||||
url = a8::Format("http://game2004api-test.kingsome.cn/%d/webapp/index.php?c=Role&a=battleReport",
|
||||
{
|
||||
JsonDataMgr::Instance()->channel
|
||||
});
|
||||
@ -2620,21 +2541,26 @@ void Human::SendBattleReport()
|
||||
} else {
|
||||
if (JsonDataMgr::Instance()->channel != 0) {
|
||||
if (kTouTiaoChannelId == JsonDataMgr::Instance()->channel) {
|
||||
url = a8::Format("https://game2004api-al.kingsome.cn/%d/webapp/index.php?c=Role&a=battleReport",
|
||||
url = a8::Format("http://game2004api-al.kingsome.cn/%d/webapp/index.php?c=Role&a=battleReport",
|
||||
{
|
||||
JsonDataMgr::Instance()->channel
|
||||
});
|
||||
} else {
|
||||
url = a8::Format("https://game2004api.kingsome.cn/%d/webapp/index.php?c=Role&a=battleReport",
|
||||
url = a8::Format("http://game2004api.kingsome.cn/%d/webapp/index.php?c=Role&a=battleReport",
|
||||
{
|
||||
JsonDataMgr::Instance()->channel
|
||||
});
|
||||
}
|
||||
} else {
|
||||
url = "https://game2004api.kingsome.cn/webapp/index.php?c=Role&a=battleReport";
|
||||
url = "http://game2004api.kingsome.cn/webapp/index.php?c=Role&a=battleReport";
|
||||
}
|
||||
}
|
||||
if (GAME_ID == 2001) {
|
||||
url = "https://game2001api-test.kingsome.cn/5991/webapp/index.php?c=Role&a=battleReport";
|
||||
if (f8::IsOnlineEnv()) {
|
||||
url = "https://game2001api-banshu.kingsome.cn/5991/webapp/index.php?c=Role&a=battleReport";
|
||||
}
|
||||
}
|
||||
JsonDataMgr::Instance()->GetBattleReportUrl(url);
|
||||
std::string data;
|
||||
params->ToUrlEncodeStr(data);
|
||||
f8::HttpClientPool::Instance()->HttpGet(
|
||||
@ -2740,16 +2666,6 @@ 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();
|
||||
@ -3371,10 +3287,6 @@ 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;
|
||||
}
|
||||
|
||||
@ -4079,10 +3991,14 @@ 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());
|
||||
@ -4163,34 +4079,13 @@ 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;
|
||||
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_
|
||||
);
|
||||
}
|
||||
need_sync_active_player = true;;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4198,19 +4093,3 @@ 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,7 +62,6 @@ 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;
|
||||
@ -134,7 +133,6 @@ 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;
|
||||
@ -152,8 +150,6 @@ class Human : public MoveableEntity
|
||||
int kill_times = 0;
|
||||
int rank = 0;
|
||||
|
||||
int maxtalent = 0;
|
||||
|
||||
std::function<void(Human*)> on_grid_chg;
|
||||
|
||||
Human();
|
||||
@ -297,23 +293,17 @@ 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);
|
||||
@ -344,7 +334,6 @@ private:
|
||||
void OnMetaChange();
|
||||
void OnChgToTerminator();
|
||||
void ProcReloadAction();
|
||||
void NextReload(int prev_weapon_id, int prev_weapon_idx);
|
||||
|
||||
protected:
|
||||
int level_ = 0;
|
||||
@ -405,8 +394,6 @@ 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,28 +24,14 @@ 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")) {
|
||||
@ -53,11 +39,6 @@ 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()
|
||||
@ -91,10 +72,3 @@ 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,14 +19,9 @@ 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 = 64;
|
||||
const int MAX_LV = 20;
|
||||
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,81 +580,4 @@ 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,32 +234,4 @@ 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,11 +63,6 @@ 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;
|
||||
@ -95,9 +90,6 @@ 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()
|
||||
{
|
||||
@ -146,8 +138,6 @@ 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
|
||||
{
|
||||
@ -499,12 +489,6 @@ 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) {
|
||||
@ -632,20 +616,6 @@ 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:
|
||||
@ -878,21 +848,3 @@ 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,10 +49,6 @@ 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,7 +582,6 @@ void Player::LootInteraction(Loot* entity)
|
||||
a8::SetBitFlag(status, HS_AlreadyEquip);
|
||||
ProcNewBieLogic();
|
||||
}
|
||||
RecalcBaseAttr();
|
||||
}
|
||||
break;
|
||||
case EQUIP_TYPE_OLDSKIN:
|
||||
@ -593,7 +592,6 @@ void Player::LootInteraction(Loot* entity)
|
||||
case EQUIP_TYPE_SKIN:
|
||||
{
|
||||
ProcLootSkin(entity, item_meta);
|
||||
RecalcBaseAttr();
|
||||
}
|
||||
break;
|
||||
case EQUIP_TYPE_CAR:
|
||||
@ -606,11 +604,6 @@ 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 &&
|
||||
@ -887,7 +880,6 @@ 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);
|
||||
@ -988,13 +980,8 @@ void Player::_CMMove(f8::MsgHdr& hdr, const cs::CMMove& msg)
|
||||
if (moving) {
|
||||
moved_frames = 0;
|
||||
}
|
||||
//前一个状态是纯点射
|
||||
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,7 +72,6 @@ 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;
|
||||
@ -116,10 +115,6 @@ 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;
|
||||
}
|
||||
|
@ -457,6 +457,11 @@ int Room::CreateLoot(int equip_id, a8::Vec2 pos, int count, int equip_lv)
|
||||
{
|
||||
MetaData::Equip* equip_meta = MetaMgr::Instance()->GetEquip(equip_id);
|
||||
if (equip_meta) {
|
||||
#if 1
|
||||
if (equip_meta->i->equip_type() == EQUIP_TYPE_SKIN) {
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
Loot* entity = EntityFactory::Instance()->MakeLoot(AllocUniid());
|
||||
entity->room = this;
|
||||
entity->meta = equip_meta;
|
||||
@ -3282,6 +3287,7 @@ void Room::NotifySysPiao(const std::string& msg, int color, int duration)
|
||||
|
||||
void Room::OnZombieAppear(Human* hum)
|
||||
{
|
||||
#if 0
|
||||
if (hum->GetRace() == kZombieRace && hum->meta->i->level() == 3 && !sent_zombie_boss_notify) {
|
||||
sent_zombie_boss_notify = true;
|
||||
TouchPlayerList
|
||||
@ -3296,6 +3302,7 @@ void Room::OnZombieAppear(Human* hum)
|
||||
}
|
||||
);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
int Room::GetAliveCountByRace(RaceType_e race)
|
||||
|
@ -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,13 +558,6 @@ 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,7 +187,6 @@ 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; //血量
|
||||
@ -528,7 +527,6 @@ 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
|
||||
}
|
||||
|
||||
//子弹
|
||||
@ -614,7 +612,6 @@ message MFPlayerStats
|
||||
optional string killer_account_id = 42; //杀手accountid(机器人为空)
|
||||
|
||||
optional string account_id = 21; //账号id
|
||||
optional int64 guild_id = 22; //公会id
|
||||
}
|
||||
|
||||
//空投
|
||||
@ -735,11 +732,9 @@ 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
|
||||
}
|
||||
|
||||
//断线重连
|
||||
@ -969,7 +964,6 @@ 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,8 +95,6 @@ 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; //库存槽位
|
||||
@ -340,21 +338,3 @@ message MapTplThingJson
|
||||
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