Compare commits
No commits in common. "master" and "qq" have entirely different histories.
1
.gitignore
vendored
1
.gitignore
vendored
@ -22,4 +22,3 @@ __pycache__
|
||||
game.py
|
||||
*.cxx
|
||||
compile_commands.json
|
||||
.vscode/settings.json
|
||||
|
@ -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()
|
||||
@ -1566,9 +1570,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 +1611,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 +2090,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 +2548,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,18 +2559,18 @@ 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";
|
||||
}
|
||||
}
|
||||
JsonDataMgr::Instance()->GetBattleReportUrl(url);
|
||||
@ -3371,10 +3310,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 +4014,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());
|
||||
|
@ -152,8 +152,6 @@ class Human : public MoveableEntity
|
||||
int kill_times = 0;
|
||||
int rank = 0;
|
||||
|
||||
int maxtalent = 0;
|
||||
|
||||
std::function<void(Human*)> on_grid_chg;
|
||||
|
||||
Human();
|
||||
@ -297,9 +295,6 @@ 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);
|
||||
@ -312,8 +307,6 @@ protected:
|
||||
void AutoChgWeapon();
|
||||
void CancelRevive();
|
||||
|
||||
void RecalcMaxHp();
|
||||
|
||||
private:
|
||||
void ClearFrameData();
|
||||
void GenBattleReportData(a8::MutableXObject* params);
|
||||
@ -405,8 +398,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_ = {};
|
||||
|
||||
|
@ -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:
|
||||
@ -887,7 +885,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);
|
||||
|
@ -116,10 +116,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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -739,7 +739,6 @@ message CMJoin
|
||||
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
|
||||
}
|
||||
|
||||
//断线重连
|
||||
|
@ -96,7 +96,6 @@ message Equip
|
||||
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 +339,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