diff --git a/server/gameserver/constant.h b/server/gameserver/constant.h index 147b47ad..1fe8675f 100644 --- a/server/gameserver/constant.h +++ b/server/gameserver/constant.h @@ -550,3 +550,5 @@ const int MAP_BLOCK_START_ID = 1000000000; const int ANDROID_AI_ID_START = 10001; const int MAX_SKILL_LV = 15; + +const int DOUBLE_GUN_ANIMATION = 4; diff --git a/server/gameserver/metadata.cc b/server/gameserver/metadata.cc index 18af59d0..e83dd77a 100644 --- a/server/gameserver/metadata.cc +++ b/server/gameserver/metadata.cc @@ -489,16 +489,6 @@ namespace MetaData a8::SetBitFlag(special_damage_type, n); } } -#ifdef DEBUG - { - gun_muzzle_position = std::make_shared> - ( - 0.8, - 3.1, - 3.0 - ); - } -#endif } void Equip::Init2() diff --git a/server/gameserver/metadata.h b/server/gameserver/metadata.h index 99914aa5..79b91a37 100644 --- a/server/gameserver/metadata.h +++ b/server/gameserver/metadata.h @@ -119,6 +119,22 @@ namespace MetaData bool Match(CondAddBuff_e cond, int val, int val2); }; + struct HeroShotAnimation + { + int id = 0; + + float r_t = 0; + float r_x = 0; + float r_y = 0; + float r_z = 0; + + float l_t = 0; + float l_x = 0; + float l_y = 0; + float l_z = 0; + + }; + struct Player { const metatable::Player* i = nullptr; @@ -129,6 +145,7 @@ namespace MetaData std::vector> pre_appear_effect; bool HasDrop() { return !dead_drop.empty();}; std::tuple pve_score; + std::map shot_animations; void Init(); int RandDrop(); diff --git a/server/gameserver/metamgr.cc b/server/gameserver/metamgr.cc index 9025fb1c..1e455567 100644 --- a/server/gameserver/metamgr.cc +++ b/server/gameserver/metamgr.cc @@ -557,11 +557,100 @@ public: MetaMgr::Instance()->terminator_meta = MetaMgr::Instance()->GetPlayer(5005); } #endif + LoadHeroAndEquipShotData(); Check(); } private: + void LoadHeroAndEquipShotData() + { + a8::XObject xobj; + xobj.ReadFromFile(res_path + "shot_animation.json"); + { + auto hero_list_xobj = xobj.At("hero"); + std::vector keys; + hero_list_xobj->GetKeys(keys); + for (auto& key : keys) { + auto hero_xobj = hero_list_xobj->At(key); + int hero_id = a8::XValue(key); + std::vector keys2; + hero_xobj->GetKeys(keys2); + + for (auto& key2 : keys2) { + auto anim_xobj = hero_xobj->At(key2); + int id = a8::XValue(key2); + float r_t = anim_xobj->At("t")->AsXValue().GetDouble(); + float r_x = anim_xobj->At("r")->At("x")->AsXValue().GetDouble(); + float r_y = anim_xobj->At("r")->At("y")->AsXValue().GetDouble(); + float r_z = anim_xobj->At("r")->At("z")->AsXValue().GetDouble(); + + float l_t = anim_xobj->At("t")->AsXValue().GetDouble(); + float l_x = anim_xobj->At("l")->At("x")->AsXValue().GetDouble(); + float l_y = anim_xobj->At("l")->At("y")->AsXValue().GetDouble(); + float l_z = anim_xobj->At("l")->At("z")->AsXValue().GetDouble(); + + { + MetaData::Player* hero_meta = MetaMgr::Instance()->GetPlayer(hero_id); + if (hero_meta) { + MetaData::HeroShotAnimation anim; + anim.id = id; + + anim.r_t = r_t; + anim.r_x = r_x; + anim.r_y = r_y; + anim.r_z = r_z; + + anim.l_t = l_t; + anim.l_x = l_x; + anim.l_y = l_y; + anim.l_z = l_z; + + hero_meta->shot_animations[id] = anim; + } + } + a8::UdpLog::Instance()->Info + ("shot animation hero_id:%d anim_id:%d r_t:%f r_x:%f r_y:%f r_z:%f l_t:%f l_x:%f l_y:%f l_z:%f", + { + hero_id, + id, + r_t, + r_x, + r_y, + r_z, + l_t, + l_x, + l_y, + l_z + }); + } + } + } + { + auto equip_list_xobj = xobj.At("equip"); + std::vector keys; + equip_list_xobj->GetKeys(keys); + for (auto& key : keys) { + auto equip_xobj = equip_list_xobj->At(key); + int equip_id = a8::XValue(key); + + float x = equip_xobj->At("x")->AsXValue().GetDouble(); + float y = equip_xobj->At("y")->AsXValue().GetDouble(); + float z = equip_xobj->At("z")->AsXValue().GetDouble(); + + MetaData::Equip* equip_meta = MetaMgr::Instance()->GetEquip(equip_id); + if (equip_meta) { + equip_meta->gun_muzzle_position = std::make_shared> + ( + x, + y, + z + ); + } + } + } + } + void Check() { diff --git a/server/tools/protobuild/metatable.proto b/server/tools/protobuild/metatable.proto index 12a10354..0bdb61b1 100755 --- a/server/tools/protobuild/metatable.proto +++ b/server/tools/protobuild/metatable.proto @@ -194,6 +194,8 @@ message Equip optional float critical = 70; optional float cri_damage = 71; + + optional int32 shootfire = 73; } message EquipUpgrade diff --git a/third_party/a8engine b/third_party/a8engine index 9b63b8fe..b17543da 160000 --- a/third_party/a8engine +++ b/third_party/a8engine @@ -1 +1 @@ -Subproject commit 9b63b8fee2f459b1bd096c76d4f6aecfc2ba45bd +Subproject commit b17543dae9a329dac545a7fe33bbefab0c9f5d4b