This commit is contained in:
aozhiwei 2024-08-24 07:43:18 +08:00
commit f37aed628b
60 changed files with 1063 additions and 566 deletions

View File

@ -12,4 +12,6 @@
SMJoinedNotify
SMMapInfo
SMUiUpdate
https://www.cnblogs.com/fellow1988/p/17263427.html
export ASAN_OPTIONS=halt_on_error=false:print_scariness=true:fast_unwind_on_malloc=true:detect_leak=1

View File

@ -1,3 +1,4 @@
{
"api_url": "https://game2006api-test.kingsome.cn/webapp/index.php"
"api_url": "https://game2006api-test.kingsome.cn/webapp/index.php",
"api_secret_key": "BIgDh5J%uUktooKxT!IM7#m$NtB51%la"
}

View File

@ -1,3 +1,4 @@
{
"api_url": "https://game2006api-test.kingsome.cn/webapp/index.php"
"api_url": "https://game2006api-test.kingsome.cn/webapp/index.php",
"api_secret_key": "BIgDh5J%uUktooKxT!IM7#m$NtB51%la"
}

View File

@ -0,0 +1 @@
../gameserver/test_config

View File

@ -16,9 +16,9 @@ message(LIB_DIR: ${LIB_DIR} )
set(CMAKE_CXX_FLAGS_RELEASE "-Wall -g -std=gnu++1z -DGAME_ID=${GAME_ID} -DNDEBUG -DDT_VIRTUAL_QUERYFILTER -DNEW_WEAPON_SYS=1 -DNEW_NUM=1 -DA8_PERFT=1")
if (${ASAN})
set(CMAKE_CXX_FLAGS_DEBUG "-Wall -g -std=gnu++1z -DGAME_ID=${GAME_ID} -DMYDEBUG -DDT_VIRTUAL_QUERYFILTER -DNEW_WEAPON_SYS=1 -fsanitize=address -DNEW_NUM=1 -fno-omit-frame-pointer -DA8_PERFT=1")
set(CMAKE_CXX_FLAGS_DEBUG "-Wall -g -std=gnu++1z -DGAME_ID=${GAME_ID} -DMYDEBUG -DDT_VIRTUAL_QUERYFILTER -DNEW_WEAPON_SYS=1 -fsanitize=address -DNEW_NUM=1 -fno-omit-frame-pointer -DA8_PERFT=1 -fsanitize-recover=address")
else()
set(CMAKE_CXX_FLAGS_DEBUG "-Wall -g -std=gnu++1z -DGAME_ID=${GAME_ID} -DMYDEBUG -DDT_VIRTUAL_QUERYFILTER -DNEW_WEAPON_SYS=1 -DNEW_NUM=1 -DA8_PERFT=1")
set(CMAKE_CXX_FLAGS_DEBUG "-Wall -g -std=gnu++1z -DGAME_ID=${GAME_ID} -DMYDEBUG -DDT_VIRTUAL_QUERYFILTER -DNEW_WEAPON_SYS=1 -DNEW_NUM=1 -DA8_PERFT=1 -fsanitize-recover=address")
endif()
include_directories(

View File

@ -168,6 +168,16 @@ void GGListener::Init()
void GGListener::UnInit()
{
std::vector<std::weak_ptr<SocketDisconnectHandler>> del_handlers;
for (auto& pair : disconnect_listener_hash_) {
SocketDisconnectHandler *handle = nullptr, *tmp = nullptr;
list_for_each_entry_safe(handle, tmp, &pair.second, entry) {
del_handlers.push_back(handle->holder);
}
}
for (auto& handler : del_handlers) {
RemoveSocketDisconnectHandler(handler);
}
tcp_listener_ = nullptr;
}

View File

@ -45,7 +45,7 @@ void Android::Initialize()
{
Human::Initialize();
account_id = a8::Format("0000_2006_%d", {robot_meta->id()});
RandSkin();
//RandSkin();
GiveEquip();
RecalcBaseAttr();
SetInfiniteBulletMode();
@ -63,6 +63,7 @@ void Android::Initialize()
);
GetNetData()->Init(this);
}
RandSkin();
SetHP(GetNetData()->GetMaxHP());
SetMaxHP(GetHP());
{
@ -176,6 +177,13 @@ void Android::GiveEquip()
void Android::RandSkin()
{
#ifdef MYDEBUG
{
Skin& skin = skins[0];
skin.skin_id = 1 + meta->skinlist();
skin.skin_lv = 1;
}
#endif
#if 0
if (!robot_meta->_skin_id.empty()) {
Skin& skin = skins[0];

View File

@ -47,9 +47,10 @@ void BatchSync::AddGlobalObject(Creature* c)
std::get<1>(*tuple).FillSMSyncPosition(sync_msg);
room_->TraversePlayerList
(
[&sync_msg] (Player* hum) mutable
[&sync_msg] (Player* hum) mutable -> bool
{
hum->SendNotifyMsg(sync_msg);
return true;
});
}
},

View File

@ -0,0 +1,391 @@
#include "precompile.h"
#include <random>
#include <glm/glm.hpp>
#include <a8/mutable_xobject.h>
#include <f8/app.h>
#include <f8/udplog.h>
#include "boxdrop.h"
#include "room.h"
#include "hero.h"
#include "roomobstacle.h"
#include "httpproxy.h"
#include "jsondatamgr.h"
#include "player.h"
#include "mapinstance.h"
#include "human.h"
#include "stats.h"
#include "mt/MapMode.h"
#include "mt/Hero.h"
#include "mt/MapThing.h"
#include "mt/Param.h"
const int BOX_ID = 150001;
BoxDrop::BoxDrop(Room* room):room_(room)
{
}
void BoxDrop::Init()
{
}
void BoxDrop::UnInit()
{
}
void BoxDrop::OnHeroDeadDrop(Hero* hero)
{
int box_num = GetAndDecObjBoxNum(hero->GetUniId());
if (box_num > 0) {
Drop(box_num, hero->GetPos().ToGlmVec3());
}
}
void BoxDrop::OnObstacleDeadDrop(Obstacle* ob)
{
int box_num = GetAndDecObjBoxNum(ob->GetUniId());
if (box_num > 0) {
Drop(box_num, ob->GetPos().ToGlmVec3());
}
}
void BoxDrop::OnHumanDeadDrop(Human* hum)
{
if (hum->box_num <= 0) {
return;
}
if (room_->IsGameOver()) {
return;
}
if (room_->GetVictoryTeam()) {
return;
}
int drop_num = 0;
for (int i = 0; i < hum->box_num; ++i) {
int rnd = a8::RandEx(0, 100);
if (hum->stats->abandon_battle) {
if (rnd <= (mt::Param::s().battle_event_end_loss_rate_quit * 100)) {
++drop_num;
}
} else {
if (rnd <= (mt::Param::s().battle_event_end_loss_rate_dead * 100)) {
++drop_num;
}
}
}
drop_num = std::min(drop_num, hum->box_num);
if (drop_num > 0) {
Drop(drop_num, hum->GetPos().ToGlmVec3());
hum->box_num -= drop_num;
room_->frame_event.AddPropChgEx(hum->GetWeakPtrRef(), kPropBoxNum, 0, hum->box_num,
0, 0, false);
}
}
void BoxDrop::Drop(int num, const glm::vec3& center)
{
for (int i = 0; i < num; ++i) {
glm::vec3 dir = GlmHelper::UP;
GlmHelper::RotateY(dir, a8::RandAngle());
glm::vec3 born_pos = center;
GlmHelper::Normalize(dir);
glm::vec3 start = born_pos;
room_->map_instance->Scale(start);
glm::vec3 real_pos = born_pos;
float distance = 25.0f + rand() % 50;
for (int i = 0; i < 4; ++i) {
glm::vec3 end = born_pos + dir * distance;
glm::vec3 hit_point;
bool hit_result = false;
room_->map_instance->Scale(end);
if (room_->map_instance->Raycast(start,
end,
hit_point,
hit_result,
room_->map_instance->GetMoveIncludeFlags(),
room_->map_instance->GetMoveExcludeFlags())) {
room_->map_instance->UnScale(hit_point);
if (GlmHelper::Norm2D(hit_point - born_pos) > 5) {
real_pos = hit_point;
break;
}
}
GlmHelper::RotateY(dir, glm::radians(90.0f));
}
room_->CreateObstacle(BOX_ID, real_pos.x, real_pos.y, real_pos.z);
}
}
void BoxDrop::OnBattleStart()
{
if (room_->GetMapModeMeta() && room_->GetMapModeMeta()->mapMode() == mt::kTreasureBoxMode) {
get_box_num_timer_ = room_->xtimer.SetIntervalWpEx
(SERVER_FRAME_RATE * 20,
[this] (int event, const a8::Args* args)
{
if (a8::TIMER_EXEC_EVENT == event) {
if (!room_->IsGameOver() && !room_->GetVictoryTeam()) {
if (!alloced_) {
RequestAllocBoxNum();
}
}
}
},
&room_->xtimer_attacher_);
RequestAllocBoxNum();
}
}
void BoxDrop::RequestAllocBoxNum()
{
std::string account_id;
std::string session_id;
if (!FillAccountIdSessionId(account_id, session_id)) {
return;
}
std::string url;
JsonDataMgr::Instance()->GetApiUrl(url);
auto url_params = a8::MutableXObject::CreateObject();
url_params->SetVal("c", "Battle");
url_params->SetVal("a", "requestAllocBoxNum");
url_params->SetVal("room_uuid", room_->GetRoomUuid());
url_params->SetVal("account_id", account_id);
url_params->SetVal("session_id", session_id);
HttpProxy::Instance()->HttpGet
(
[room_wp = room_->weak_from_this(), room_uuid = room_->GetRoomUuid()]
(bool ok, a8::XObject* rsp_obj, f8::HttpContext* ctx)
{
if (ok) {
f8::UdpLog::Instance()->Info
("RequestAllocBoxNum ok room_uuid:%s %s",
{
room_uuid,
rsp_obj->ToJsonStr()
});
if (rsp_obj->GetType() != a8::XOT_OBJECT ||
!rsp_obj->HasKey("errcode")) {
return;
}
if (!room_wp.expired()) {
auto room = room_wp.lock();
if (rsp_obj->Get("errcode").GetInt() == 0) {
int box_num = rsp_obj->Get("box_num").GetInt();
room->GetBoxDrop()->OnAllocOk(box_num);
} else {
room->GetBoxDrop()->OnAllocFail();
}
}
} else {
f8::UdpLog::Instance()->Warning
("RequestAllocBoxNum error room_uuid:%s",
{
room_uuid
});
}
},
url,
url_params
);
}
void BoxDrop::RequestReturnBoxNum()
{
if (alloc_box_num_ <= 0) {
return;
}
if (room_->GetMapModeMeta() && room_->GetMapModeMeta()->mapMode() == mt::kTreasureBoxMode) {
if (returned_) {
return;
}
returned_ = true;
std::string account_id;
std::string session_id;
if (!FillAccountIdSessionId(account_id, session_id)) {
return;
}
std::string url;
JsonDataMgr::Instance()->GetApiUrl(url);
auto url_params = a8::MutableXObject::CreateObject();
url_params->SetVal("c", "Battle");
url_params->SetVal("a", "requestReturnBoxNum");
url_params->SetVal("account_id", account_id);
url_params->SetVal("session_id", session_id);
url_params->SetVal("room_uuid", room_->GetRoomUuid());
url_params->SetVal("used_num", GetUsedBoxNum());
url_params->SetVal("alloc_box_num", alloc_box_num_);
HttpProxy::Instance()->HttpGet
(
[room_uuid = room_->GetRoomUuid()]
(bool ok, a8::XObject* rsp_obj, f8::HttpContext* ctx)
{
if (ok) {
f8::UdpLog::Instance()->Info
("RequestReturnBoxNum ok room_uuid:%s %s",
{
room_uuid,
rsp_obj->ToJsonStr()
});
if (rsp_obj->GetType() != a8::XOT_OBJECT ||
!rsp_obj->HasKey("errcode")) {
return;
}
} else {
f8::UdpLog::Instance()->Warning
("RequestReturnBoxNum error room_uuid:%s",
{
room_uuid
});
}
},
url,
url_params
);
}
}
bool BoxDrop::FillAccountIdSessionId(std::string& account_id, std::string& session_id)
{
bool ok = false;
room_->TraversePlayerList
([&ok, &account_id, &session_id] (Player* hum) -> bool
{
ok = true;
account_id = hum->account_id;
session_id = hum->session_id;
return true;
});
return ok;
}
void BoxDrop::OnAllocOk(int box_num)
{
if (!get_box_num_timer_.expired()) {
room_->xtimer.Delete(get_box_num_timer_);
}
if (alloced_) {
return;
}
alloced_ = true;
alloc_box_num_ = box_num;
AllocBoxToRoom();
}
void BoxDrop::OnAllocFail()
{
if (!get_box_num_timer_.expired()) {
room_->xtimer.Delete(get_box_num_timer_);
}
}
void BoxDrop::AllocBoxToRoom()
{
if (alloc_box_num_ <= 0) {
return;
}
std::vector<Entity*> all_list;
std::vector<Creature*> hero_list;
std::vector<Obstacle*> box_list;
room_->TraverseEntityList
(
[this, &all_list, &hero_list, &box_list] (Entity* e) -> bool
{
if (e->IsCreature(room_) && ((Creature*)e)->IsHero()) {
Hero* hero = (Hero*)e;
if (hero->meta->HasDrop()) {
hero_list.push_back(hero);
all_list.push_back(e);
}
} else if (e->IsRoomObstacle()) {
RoomObstacle* ob = (RoomObstacle*)e;
if (ob->meta->HasDrop()) {
box_list.push_back(ob);
all_list.push_back(e);
}
}
return true;
});
std::shuffle(all_list.begin(),
all_list.end(),
std::default_random_engine(a8::XGetTickCount()));
std::shuffle(hero_list.begin(),
hero_list.end(),
std::default_random_engine(a8::XGetTickCount()));
std::shuffle(box_list.begin(),
box_list.end(),
std::default_random_engine(a8::XGetTickCount()));
#ifdef MYDEBUG
f8::UdpLog::Instance()->Info
("AllocBoxToRoom room_uuid:%s all:%d hero:%d box:%d",
{
room_->GetRoomUuid(),
all_list.size(),
hero_list.size(),
box_list.size()
});
#endif
for (int i = 0; i < alloc_box_num_; ++i) {
if (drop_hash_.size() < all_list.size()) {
drop_hash_[all_list.at(i)->GetUniId()] = 1;
}
}
}
int BoxDrop::GetAndDecObjBoxNum(int uniid)
{
auto itr = drop_hash_.find(uniid);
if (itr != drop_hash_.end()) {
int num = itr->second;
itr->second = 0;
return num;
}
return 0;
}
int BoxDrop::GetUsedBoxNum()
{
int num = 0;
room_->TraverseHumanList
(
[&num] (Human* hum) -> bool
{
num += hum->box_num;
return true;
});
return num;
}
bool BoxDrop::GetNextBoxPos(glm::vec3& pos)
{
for (auto& pair : drop_hash_) {
if (pair.second > 0) {
Entity* e = room_->GetEntityByUniId(pair.first);
if (e) {
pos = e->GetPos().ToGlmVec3();
return true;
}
}
}
return false;
}
void BoxDrop::DropByUuid(int obj_uniid, const glm::vec3& center)
{
int box_num = GetAndDecObjBoxNum(obj_uniid);
if (box_num > 0) {
Drop(box_num, center);
}
}

View File

@ -0,0 +1,41 @@
#pragma once
class Room;
class Hero;
class Obstacle;
class Human;
class BoxDrop : public std::enable_shared_from_this<BoxDrop>
{
public:
BoxDrop(Room* room);
void Init();
void UnInit();
void OnBattleStart();
void OnHeroDeadDrop(Hero* hero);
void OnObstacleDeadDrop(Obstacle* ob);
void OnHumanDeadDrop(Human* hum);
void RequestReturnBoxNum();
bool GetNextBoxPos(glm::vec3& pos);
void DropByUuid(int obj_uniid, const glm::vec3& center);
private:
void Drop(int num, const glm::vec3& center);
void RequestAllocBoxNum();
bool FillAccountIdSessionId(std::string& account_id, std::string& session_id);
void OnAllocOk(int box_num);
void OnAllocFail();
void AllocBoxToRoom();
int GetAndDecObjBoxNum(int uniid);
int GetUsedBoxNum();
private:
Room* room_ = nullptr;
a8::XTimerWp get_box_num_timer_;
int alloc_box_num_ = 0;
bool alloced_ = false;
bool returned_ = false;
std::map<int, int> drop_hash_;
};

View File

@ -3,6 +3,8 @@
#include <math.h>
#include <float.h>
#include <a8/magicenum.h>
#include "buff.h"
#include "human.h"
#include "room.h"
@ -49,10 +51,50 @@ void Buff::Init()
res_scale = meta->GetResScale(this);
res_scale_frameno = owner->room->GetFrameNo();
}
#ifdef MYDEBUG
switch (meta->buff_effect()) {
case kBET_InRescue:
case kBET_Rescuer:
{
a8::XPrintf("add jiuyuan role_name:%s type:%s buff_id:%d buff_effect:%\n",
{
owner->GetName(),
owner->IsPlayer() ? "player" : "android",
meta->buff_id(),
a8::GetEnumName<BuffEffectType_e>(meta->buff_effect())
});
}
break;
default:
{
}
break;
}
#endif
}
void Buff::UnInit()
{
#ifdef MYDEBUG
switch (meta->buff_effect()) {
case kBET_InRescue:
case kBET_Rescuer:
{
a8::XPrintf("remove jiuyuan role_name:%s type:%s buff_id:%d buff_effect:%\n",
{
owner->GetName(),
owner->IsPlayer() ? "player" : "android",
meta->buff_id(),
a8::GetEnumName<BuffEffectType_e>(meta->buff_effect())
});
}
break;
default:
{
}
break;
}
#endif
list_del_init(&effect_entry);
if (!list_empty(&depend_entry)) {
list_del_init(&depend_entry);

View File

@ -37,6 +37,7 @@ class Buff
float res_scale = 1;
long long res_scale_frameno = 0;
std::shared_ptr<std::vector<float>> buff_vars;
std::shared_ptr<std::list<int>> child_buff_uniids;
Buff();
virtual ~Buff();

View File

@ -548,6 +548,12 @@ void CallFuncBuff::ProcAddEnergyShield()
if (dur_time < 0.00001f) {
dur_time = 99999999;
}
#if 1
if (owner->energy_shield > 0) {
owner->energy_shield = 0;
owner->GetTrigger()->DestoryEnergyShield();
}
#endif
if (owner->energy_shield > 0) {
is_valid_ = false;
owner->GetTrigger()->UpdateEnergyShield(hold_param2_, dur_time);

View File

@ -16,6 +16,8 @@
#include "loot.h"
#include "ability.h"
#include "trigger.h"
#include "boxdrop.h"
#include "netdata.h"
#include "cs_proto.pb.h"
@ -25,6 +27,7 @@
#include "mt/Buff.h"
#include "mt/Robot.h"
#include "mt/Hero.h"
#include "mt/MapThing.h"
void Player::_CMExecCommand(f8::MsgHdr* hdr, const cs::CMExecCommand& msg)
{
@ -68,6 +71,13 @@ void Player::_CMExecCommand(f8::MsgHdr* hdr, const cs::CMExecCommand& msg)
room->grid_service->MoveCreature(this);
}
}
} else if (cmd == "goto_box") {
glm::vec3 pos;
if (room->GetBoxDrop()->GetNextBoxPos(pos)) {
GetMutablePos().FromGlmVec3(pos);
GetMovement()->ClearPath();
room->grid_service->MoveCreature(this);
}
} else if (cmd == "additem" && cmds.size() >= 3) {
int item_id = a8::XValue(cmds[1]);
int item_num = a8::XValue(cmds[2]);
@ -236,12 +246,29 @@ void Player::_CMExecCommand(f8::MsgHdr* hdr, const cs::CMExecCommand& msg)
(
[this] (Human* hum) -> bool
{
a8::SetBitFlag(hum->status, CS_NoDie);
//a8::SetBitFlag(hum->status, CS_NoDie);
hum->GetMovement()->ClearPath();
hum->GetMutablePos().FromGlmVec3(GetPos().ToGlmVec3());
room->grid_service->MoveCreature(hum);
return true;
});
} else if (cmd == "dead_teammate") {
GetTeam()->TraverseMembers
(
[this] (Human* hum) -> bool
{
if (hum != this && !hum->dead) {
hum->BeKill(VP_Gas,
TEXT("battle_server_killer_gas", "毒圈"),
VW_Gas,
VP_Gas,
TEXT("battle_server_killer_gas", "毒圈"));
return false;
}
return true;
});
} else if (cmd == "total_lucky") {
SendDebugMsg(a8::Format("total_lucky:%f", {GetNetData()->GetTotalLucky()}));
} else if (cmd == "randomobj" && cmds.size() >= 2) {
int weapon_id = a8::XValue(cmds[1]);
Human* target = nullptr;
@ -410,6 +437,12 @@ void Player::_CMExecCommand(f8::MsgHdr* hdr, const cs::CMExecCommand& msg)
#endif
}
}
} else if (cmd == "create_mapthing") {
int thing_id = a8::XValue(cmds[1]).GetDouble();
const mt::MapThing* thing_meta = mt::MapThing::GetById(thing_id);
if (thing_meta) {
room->CreateObstacle(thing_id, GetPos().GetX(), GetPos().GetY(), GetPos().GetZ());
}
} else if (cmd == "use_skill") {
if (cmds.size() >= 2 && GetCar() && GetCar()->IsDriver(this)) {
int skill_id = a8::XValue(cmds[1]);
@ -504,6 +537,31 @@ void Player::_CMExecCommand(f8::MsgHdr* hdr, const cs::CMExecCommand& msg)
for (auto& str : strings) {
SendDebugMsg("数值: " + str);
}
} else if (cmd == "down_teammate") {
Human* target = nullptr;
GetTeam()->TraverseMembers
(
[this, &target] (Human *hum) -> bool
{
if (!hum->dead && hum != this) {
if (!target) {
target = hum;
} else if (GetPos().Distance2D2(hum->GetPos()) <
GetPos().Distance2D2(target->GetPos())) {
target = hum;
}
}
return true;
});
if (target) {
float dmg_out = 0.0f;
target->DecHP(100000.0f, VP_Gas, TEXT("battle_server_killer_gas", "毒圈"), VW_Gas,
VP_Gas,
TEXT("battle_server_killer_gas", "毒圈"),
dmg_out,
0,
0);
}
} else if (cmd == "moba_pingju" && cmds.size() >= 0) {
if (room->IsMobaModeRoom() && !room->IsGameOver() && room->GetMobaOvertimeRaceFrameNo() <= 0) {
room->TraverseTeams
@ -515,6 +573,12 @@ void Player::_CMExecCommand(f8::MsgHdr* hdr, const cs::CMExecCommand& msg)
});
room->xtimer.ModifyTime(room->moba_over_timer, 0);
}
} else if (cmd == "peace_mode" && cmds.size() >= 0) {
if (cmds[1] == "1") {
room->OpenRoomSwitch(kRoomSwitchPeaceMode);
} else {
room->CloseRoomSwitch(kRoomSwitchPeaceMode);
}
} else if (cmd == "findpath" && cmds.size() >= 3) {
float x = a8::XValue(cmds[1]).GetDouble();
float y = a8::XValue(cmds[2]).GetDouble();

View File

@ -281,6 +281,9 @@ enum PropertyType_e
kPropLevelExp = 55,
kPropLevelUp = 56,
kPropBoxNum = 57,
kPropShowOrHideBigEventBox = 58,
};
enum SkinSlot_e
@ -327,6 +330,7 @@ enum ObstacleType_e
kObstacleStrengthenWall = 12,
kObstacleMedicalStation = 13,
kObstacleFlameSurface = 16,
kObstacleTreasureBox = 18,
};
enum BulletHit_e

View File

@ -398,7 +398,18 @@ int Creature::AddBuff(Creature* caster,
for (int child_buff_id : buff->meta->_child_buff_list) {
const mt::Buff* child_buff_meta = mt::Buff::GetById(child_buff_id);
if (child_buff_meta) {
AddBuff(caster, child_buff_meta, buff_skill_meta, true, init_args, buff_vars);
int child_buff_uniid = AddBuff(caster,
child_buff_meta,
buff_skill_meta,
true,
init_args,
buff_vars);
if (child_buff_uniid) {
if (!buff->child_buff_uniids) {
buff->child_buff_uniids = std::make_shared<std::list<int>>();
}
buff->child_buff_uniids->push_back(child_buff_uniid);
}
}
}
}
@ -537,7 +548,7 @@ void Creature::RemoveBuffById(int buff_id)
void Creature::RemoveBuffByUniId(int buff_uniid)
{
int buff_id = 0;
std::vector<std::tuple<const mt::Buff*, Creature*>> removed_buffs;
std::vector<std::tuple<const mt::Buff*, Creature*, std::shared_ptr<std::list<int>>>> removed_buffs;
std::shared_ptr<Buff> buff;
for (auto itr = buff_list_.begin(); itr != buff_list_.end(); ++itr) {
if ((*itr)->buff_uniid == buff_uniid) {
@ -553,7 +564,7 @@ void Creature::RemoveBuffByUniId(int buff_uniid)
int i = 0;
}
#endif
removed_buffs.push_back(std::make_tuple(buff->meta, buff->GetCaster().Get()));
removed_buffs.push_back(std::make_tuple(buff->meta, buff->GetCaster().Get(), buff->child_buff_uniids));
OnBuffRemove(*buff.get());
buff->UnInit();
#ifdef MYDEBUG
@ -578,10 +589,19 @@ void Creature::RemoveBuffByUniId(int buff_uniid)
for (auto& tuple1 : removed_buffs) {
const mt::Buff* buff_meta = std::get<0>(tuple1);
Creature* caster = std::get<1>(tuple1);
std::shared_ptr<std::list<int>> child_buff_uniids = std::get<2>(tuple1);
#if 1
if (child_buff_uniids) {
for (auto child_buff_uniid : *child_buff_uniids) {
RemoveBuffByUniId(child_buff_uniid);
}
}
#else
for (int child_buff_id : buff_meta->_child_buff_list) {
RemoveBuffById(child_buff_id);
}
#endif
if (!HasBuffEffect(buff_meta->buff_effect()) &&
!list_empty(&depend_effect_[buff_meta->buff_effect()])) {

View File

@ -99,6 +99,7 @@ class Creature : public MoveableEntity
int max_armor_shield = 0;
int revive_count = 0;
CreatureWeakPtr master;
int box_num = 0;
Weapon second_weapon;
glm::vec3 skill_pos;

View File

@ -15,6 +15,7 @@
#include "sandtable.h"
#include "stats.h"
#include "ingamevoice.h"
#include "netdata.h"
#include "mt/AirLine.h"
#include "mt/Hero.h"
@ -627,6 +628,7 @@ void FrameMaker::SerializeVoices(cs::SMUpdate* msg, Room* room, Human* hum, Fram
p->mutable_kill_info()->set_killer_uniid(hum->GetUniId());
p->mutable_kill_info()->set_killer_name(hum->GetName());
p->mutable_kill_info()->set_killer_hero_id(hum->GetHeroMeta()->id());
p->mutable_kill_info()->set_killer_skin_id(hum->GetNetData()->GetSkinId());
}
}
if (v->dead_id) {
@ -635,6 +637,7 @@ void FrameMaker::SerializeVoices(cs::SMUpdate* msg, Room* room, Human* hum, Fram
p->mutable_kill_info()->set_dead_uniid(hum->GetUniId());
p->mutable_kill_info()->set_dead_name(hum->GetName());
p->mutable_kill_info()->set_dead_hero_id(hum->GetHeroMeta()->id());
p->mutable_kill_info()->set_dead_skin_id(hum->GetNetData()->GetSkinId());
}
}
#ifdef MYDEBUG

View File

@ -110,15 +110,6 @@ void HandlerMgr::RegisterNetMsgHandlers()
RegisterNetMsgHandler(&ggmsghandler, &CustomMember::_CMBattlePreSetReady);
#if 0
RegisterNetMsgHandler(&ggmsghandler, &MatchTeam::_CMMatchCancel);
RegisterNetMsgHandler(&ggmsghandler, &MatchTeam::_CMMatchChoose);
RegisterNetMsgHandler(&ggmsghandler, &MatchTeam::_CMMatchStartGame);
RegisterNetMsgHandler(&ggmsghandler, &MatchTeam::_CMMatchCancelStartGame);
RegisterNetMsgHandler(&ggmsghandler, &MatchTeam::_CMMatchSendMsg);
RegisterNetMsgHandler(&ggmsghandler, &MatchTeam::_CMMatchBroadcastMsg);
#endif
RegisterNetMsgHandler(&ggmsghandler, &Player::_CMMove);
RegisterNetMsgHandler(&ggmsghandler, &Player::_CMImmediateMsg);
RegisterNetMsgHandler(&ggmsghandler, &Player::_CMExecCommand);

View File

@ -21,6 +21,7 @@
#include "movement.h"
#include "ability.h"
#include "skill.h"
#include "boxdrop.h"
#include "f8/btmgr.h"
@ -332,6 +333,7 @@ void Hero::BeKill(int killer_id, const std::string& killer_name, int weapon_id)
dead = true;
if (meta->HasDrop() && !room->IsPveRoom()) {
room->ScatterDrop(GetPos().ToGlmVec3(), meta->RandDrop(), false, &items);
room->GetBoxDrop()->OnHeroDeadDrop(this);
}
if (!room->IsPveRoom()) {
for (int id : meta->_drop_list) {

View File

@ -396,6 +396,12 @@ bool HeroAgent::MasterInRange(float range)
behaviac::EBTStatus HeroAgent::SearchEnemy(float range)
{
#ifdef MYDEBUG
if (owner_->room->HasRoomSwitch(kRoomSwitchPeaceMode)
) {
return behaviac::BT_FAILURE;
}
#endif
Creature* myself = owner_;
Creature* target = nullptr;
float last_distance = range + 1;
@ -435,6 +441,12 @@ behaviac::EBTStatus HeroAgent::SearchEnemy(float range)
behaviac::EBTStatus HeroAgent::SearchHumanEnemy(float range)
{
#ifdef MYDEBUG
if (owner_->room->HasRoomSwitch(kRoomSwitchPeaceMode)
) {
return behaviac::BT_FAILURE;
}
#endif
Creature* myself = owner_;
Creature* target = nullptr;
float last_distance = range + 1;

View File

@ -2,6 +2,7 @@
#include <a8/sysutils.h>
#include <a8/mutable_xobject.h>
#include <a8/openssl.h>
#include <f8/udplog.h>
#include <f8/jsonhttprequest.h>
@ -18,7 +19,7 @@ struct HttpProxyRequest
std::string req_id;
f8::HttpProxyCb cb;
std::string url;
a8::XObject url_params;
std::shared_ptr<a8::MutableXObject> url_params;
long long add_tick = 0;
};
@ -63,13 +64,14 @@ void HttpProxy::UnInit()
std::string HttpProxy::HttpGet(
f8::HttpProxyCb cb,
const char* url,
a8::XObject url_params
const std::string& url,
std::shared_ptr<a8::MutableXObject> url_params
)
{
if (f8::App::Instance()->Terminated()) {
return "";
}
AddSignParams(url, url_params, "");
std::shared_ptr<HttpProxyRequest> request = std::make_shared<HttpProxyRequest>();
request->req_id = CreateRequestId();
request->cb = cb;
@ -81,11 +83,10 @@ std::string HttpProxy::HttpGet(
}
request_hash_[request->req_id] = request;
auto proxy_url_params = a8::MutableXObject::CreateObject();
proxy_url_params->SetVal("seq_id", request->req_id);
proxy_url_params->SetVal("target_url", std::string(url));
proxy_url_params->SetVal("params", url_params.ToJsonStr());
proxy_url_params->SetVal("params", url_params->ToJsonStr());
proxy_url_params->SetVal("cb_url", a8::Format("http://%s:%d/webapp/index.php?c=Proxy&a=callback",
{
JsonDataMgr::Instance()->ip,
@ -104,7 +105,7 @@ std::string HttpProxy::HttpGet(
{
cost_time,
request->url,
request->url_params.ToJsonStr(),
request->url_params->ToJsonStr(),
});
#endif
} else {
@ -112,7 +113,7 @@ std::string HttpProxy::HttpGet(
{
cost_time,
request->url,
request->url_params.ToJsonStr(),
request->url_params->ToJsonStr(),
ctx->response
});
request->cb(false, rsp_obj, ctx);
@ -128,14 +129,15 @@ std::string HttpProxy::HttpGet(
std::string HttpProxy::HttpPost(
f8::HttpProxyCb cb,
const char* url,
a8::XObject url_params,
const std::string& url,
std::shared_ptr<a8::MutableXObject> url_params,
const std::string& content
)
{
if (f8::App::Instance()->Terminated()) {
return "";
}
AddSignParams(url, url_params, content);
std::shared_ptr<HttpProxyRequest> request = std::make_shared<HttpProxyRequest>();
request->req_id = CreateRequestId();
request->cb = cb;
@ -151,7 +153,7 @@ std::string HttpProxy::HttpPost(
auto proxy_url_params = a8::MutableXObject::CreateObject();
proxy_url_params->SetVal("seq_id", request->req_id);
proxy_url_params->SetVal("target_url", std::string(url));
proxy_url_params->SetVal("params", url_params.ToJsonStr());
proxy_url_params->SetVal("params", url_params->ToJsonStr());
proxy_url_params->SetVal("cb_url", a8::Format("http://%s:%d/webapp/index.php?c=Proxy&a=callback",
{
JsonDataMgr::Instance()->ip,
@ -172,7 +174,7 @@ std::string HttpProxy::HttpPost(
{
cost_time,
request->url,
request->url_params.ToJsonStr(),
request->url_params->ToJsonStr(),
});
#endif
} else {
@ -180,7 +182,7 @@ std::string HttpProxy::HttpPost(
{
cost_time,
request->url,
request->url_params.ToJsonStr(),
request->url_params->ToJsonStr(),
ctx->response
});
request->cb(false, rsp_obj, ctx);
@ -211,3 +213,29 @@ void HttpProxy::DestoryRequest(std::shared_ptr<HttpProxyRequest> request)
{
request_hash_.erase(request->req_id);
}
void HttpProxy::AddSignParams(const std::string& url,
std::shared_ptr<a8::MutableXObject> url_params, const std::string& post_data)
{
if (url.find('?') != std::string::npos) {
A8_ABORT();
}
std::string sign_data;
sign_data.reserve(1024 * 64);
int nowtime = f8::App::Instance()->GetNowTime();
{
std::vector<std::string> keys;
url_params->GetKeys(keys);
for (auto& key : keys) {
std::string val = url_params->Get(key, "").GetString();
sign_data += key + "=" + val + "&";
}
sign_data += post_data;
}
{
sign_data += a8::XValue(nowtime).GetString() + JsonDataMgr::Instance()->GetApiSecretKey();
}
std::string sign = a8::openssl::md5(sign_data);
url_params->SetVal("_timestamp", a8::XValue(nowtime).GetString());
url_params->SetVal("_sign", sign);
}

View File

@ -19,13 +19,13 @@ class HttpProxy : public a8::Singleton<HttpProxy>
std::string HttpGet(
f8::HttpProxyCb cb,
const char* url,
a8::XObject url_params
const std::string& url,
std::shared_ptr<a8::MutableXObject> url_params
);
std::string HttpPost(
f8::HttpProxyCb cb,
const char* url,
a8::XObject url_params,
const std::string& url,
std::shared_ptr<a8::MutableXObject> url_params,
const std::string& content
);
@ -35,6 +35,8 @@ class HttpProxy : public a8::Singleton<HttpProxy>
private:
std::string CreateRequestId();
void AddSignParams(const std::string& url,
std::shared_ptr<a8::MutableXObject> url_params, const std::string& post_data);
private:
std::map<std::string, std::shared_ptr<HttpProxyRequest>> request_hash_;

View File

@ -44,6 +44,7 @@
#include "hero.h"
#include "bornpoint.h"
#include "ingamevoice.h"
#include "boxdrop.h"
#include "buff/sprint.h"
@ -894,7 +895,7 @@ void Human::UpdateAction()
break;
case AT_Rescue:
{
RemoveBuffByEffectId(kBET_InRescue);
RemoveBuffByEffectId(kBET_Rescuer);
}
break;
default:
@ -1281,6 +1282,9 @@ void Human::OnDie()
return true;
});
}
if (IsPlayer()) {
int i = 0;
}
if (real_dead) {
std::set<Human*> over_humans;
if (!leave_) {
@ -1807,7 +1811,7 @@ void Human::ProcUseItemAction()
void Human::ProcReliveAction()
{
RemoveBuffByEffectId(kBET_Rescuer);
RemoveBuffByEffectId(kBET_InRescue);
Entity* entity = room->GetEntityByUniId(action_target_id);
if (!entity->IsEntityType(ET_Player)) {
return;
@ -3097,6 +3101,7 @@ void Human::InternalBeKill(int killer_id, const std::string& killer_name, int we
}
#endif
if (!dead && !room->IsGameOver() && !real_dead) {
room->GetBoxDrop()->OnHumanDeadDrop(this);
KillInfo info;
{
info.killer_id = killer_id;
@ -3650,11 +3655,8 @@ void Human::SendPersonalBattleReport()
}
std::string url;
JsonDataMgr::Instance()->GetApiUrl(url);
if (url.find('?') != std::string::npos) {
url += "c=Battle&a=personalReport";
} else {
url += "?c=Battle&a=personalReport";
}
params->SetVal("c", "Battle");
params->SetVal("a", "personalReport");
std::string data;
params->ToUrlEncodeStr(data);
HttpProxy::Instance()->HttpGet
@ -3670,8 +3672,8 @@ void Human::SendPersonalBattleReport()
});
}
},
url.c_str(),
*params.get()
url,
params
);
}
@ -3739,3 +3741,13 @@ void Human::SetIpSaddr(long ip_saddr)
{
ip_saddr_ = ip_saddr;
}
int Human::GetHeroQuality()
{
return hero_quality_;
}
void Human::SetHeroQuality(int quality)
{
hero_quality_ = quality;
}

View File

@ -296,6 +296,8 @@ class Human : public Creature
void SetSocketHandle(int socket_handle);
long GetIpSaddr() { return ip_saddr_; };
void SetIpSaddr(long ip_saddr);
int GetHeroQuality();
void SetHeroQuality(int quality);
protected:
void ProcLootWeapon(AddItemDTO& dto);
@ -378,6 +380,7 @@ protected:
private:
int socket_handle_ = 0;
long ip_saddr_ = 0;
int hero_quality_ = 0;
std::shared_ptr<BornPoint> born_point_;
FrameData framedata_;

View File

@ -484,7 +484,7 @@ void Incubator::NextWave()
#if 1
room->TraversePlayerList
(
[this] (Player* hum)
[this] (Player* hum) -> bool
{
int next_wave = hum->room->pve_data.GetWave() + 1 + 1;
int max_wave = room->pve_data.max_wave;

View File

@ -55,6 +55,7 @@ void JsonDataMgr::Init()
if (setting_json_.GetType() == a8::XOT_OBJECT &&
setting_json_.HasKey("api_url")) {
api_url_ = setting_json_.Get("api_url").GetString();
api_secret_key_ = setting_json_.Get("api_secret_key").GetString();
}
ip = GetConf()->At("ip")->AsXValue().GetString();

View File

@ -21,11 +21,13 @@ public:
std::string server_info;
void GetApiUrl(std::string& url);
std::string GetApiSecretKey() { return api_secret_key_; };
void GetHttpGetProxyUrl(std::string& url);
void GetHttpPostProxyUrl(std::string& url);
private:
std::string api_url_;
std::string api_secret_key_;
private:
std::string work_path_ = "../config";

View File

@ -260,7 +260,7 @@ namespace mt
void Map::Init2()
{
{
if (is_open() && !IsPveMap() && !is_moba() && safearea_list.empty()) {
if (IsOpen() && !IsPveMap() && !is_moba() && safearea_list.empty()) {
A8_ABORT();
}
for (const int area_type : safearea_list) {
@ -312,6 +312,9 @@ namespace mt
bool Map::IsOpen() const
{
if (map_id() == 2009) {
return false;
}
return is_open();
}

View File

@ -6,6 +6,7 @@
namespace mt
{
const int kPvpRankMode = 401;
const int kTreasureBoxMode = 501;
DECLARE_ID_TABLE(MapMode, mtb::MapMode,
"mapMode@mapMode.json",

View File

@ -76,6 +76,22 @@ namespace mt
s_.crit_effect_range.push_back(a8::XValue(str).GetDouble());
}
}
{
std::string tmp_str = GetStringParam("performance_score_weight_4V4", "");
std::vector<std::string> strings;
a8::Split(tmp_str, strings, '|');
for (auto& str : strings) {
s_.performance_score_weight_4V4.push_back(a8::XValue(str).GetDouble());
}
}
{
std::string tmp_str = GetStringParam("performance_score_weight_BR", "");
std::vector<std::string> strings;
a8::Split(tmp_str, strings, '|');
for (auto& str : strings) {
s_.performance_score_weight_BR.push_back(a8::XValue(str).GetDouble());
}
}
{
std::string tmp_str = GetStringParam("block_effect_range", "");
std::vector<std::string> strings;
@ -279,6 +295,15 @@ namespace mt
s_.battle_score_param0 = a8::XValue(strings[0]).GetDouble();
s_.battle_score_param1 = a8::XValue(strings[1]).GetDouble();
}
{
std::vector<std::string> strings;
a8::Split(GetStringParam("battle_event_end_loss_rate"), strings, '|');
if (strings.size() >= 3) {
s_.battle_event_end_loss_rate_win = a8::XValue(strings[0]).GetDouble();
s_.battle_event_end_loss_rate_dead = a8::XValue(strings[1]).GetDouble();
s_.battle_event_end_loss_rate_quit = a8::XValue(strings[2]).GetDouble();
}
}
{
{
auto p = std::make_shared<mt::RankMatchConf>();

View File

@ -32,6 +32,8 @@ namespace mt
float max_mount_horse_distance = 100.0f;
int early_parachute_jump = 0;
int pickup_weapon_replace_type = 0;
std::vector<float> performance_score_weight_4V4;
std::vector<float> performance_score_weight_BR;
int downed_relive_recover_hp = 0;
@ -158,6 +160,10 @@ namespace mt
float battle_score_param0 = 0.0f;
float battle_score_param1 = 0.0f;
float battle_event_end_loss_rate_win = 0.0f;
float battle_event_end_loss_rate_dead = 0.5f;
float battle_event_end_loss_rate_quit = 1.0f;
std::vector<float> block_effect_range;
std::vector<float> crit_effect_range;

View File

@ -110,9 +110,9 @@ namespace mt
}
auto itr = _trigger_type_buffs.find(buff_meta->trigger_type());
if (itr != _trigger_type_buffs.end()) {
itr->second.insert(buff_meta);
itr->second.push_back(buff_meta);
} else {
_trigger_type_buffs[buff_meta->trigger_type()] = std::set<const mt::Buff*>({buff_meta});
_trigger_type_buffs[buff_meta->trigger_type()] = std::vector<const mt::Buff*>({buff_meta});
}
}
}

View File

@ -37,7 +37,7 @@ namespace mt
const mt::Skill* _base_skill_meta = nullptr;
float _value_up = 0.0f;
std::set<int> _buff_list;
std::map<int, std::set<const mt::Buff*>> _trigger_type_buffs;
std::map<int, std::vector<const mt::Buff*>> _trigger_type_buffs;
std::vector<mt::SkillPhase> _phases;
std::vector<mt::SkillPhase> _raw_phases;
bool IsTurnOverSkill() const;

View File

@ -526,6 +526,7 @@ void BattleDataContext::ParseResult(a8::XObject& obj)
}
level_ = obj.HasKey("level") ? obj.Get("level").GetInt() : 1;
skin_id_ = obj.HasKey("hero_skin") ? obj.Get("hero_skin").GetInt() : 0;
total_lucky_ = obj.HasKey("total_lucky") ? obj.Get("total_lucky").GetDouble() : 0;
if (obj.HasKey("hero_dto") && obj.At("hero_dto")->IsObject()) {
hero_dto = obj.At("hero_dto");
hero_ability_->hero_uniid_ = hero_dto->Get("hero_uniid", "");
@ -1076,6 +1077,13 @@ void BattleDataContext::Init(Creature* c)
if (weapon2_ability_) {
weapon2_ability_->Init(c);
}
#if 1
{
if (c->IsAndroid() && a8::RandEx(0, 1000) < 100) {
skin_id_ = a8::RandEx(0, 1) + c->GetHeroMeta()->skinlist();
}
}
#endif
if (skin_id_ && c->IsHuman()) {
const mt::Item* item_meta = mt::Item::GetById(skin_id_);
if (item_meta) {
@ -1359,9 +1367,6 @@ void BattleDataContext::RecalcCrit()
bool BattleDataContext::HasWing()
{
#ifdef MYDEBUG
return true;
#endif
if (hero_dto) {
long long token_id = hero_dto->Get("token_id", "");
if (token_id > 6240603010001668 && token_id <= 6240603010002168) {
@ -1373,3 +1378,13 @@ bool BattleDataContext::HasWing()
}
return false;
}
bool BattleDataContext::HideBigEventBox()
{
return GetTotalLucky() < 0.01f;
}
float BattleDataContext::GetTotalLucky()
{
return total_lucky_;
}

View File

@ -94,6 +94,8 @@ struct BattleDataContext
int GetCurrentGetStar();
int GetBattleTimes();
bool HasWing();
bool HideBigEventBox();
float GetTotalLucky();
int GetHonor();
int GetElo() { return elo_; }
@ -109,6 +111,7 @@ private:
CreatureWeakPtr owner_;
int revive_coin_ = 0;
int match_mode_ = 0;
float total_lucky_ = 0.0f;
std::shared_ptr<HeroAbility> hero_ability_;
std::shared_ptr<WeaponAbility> weapon1_ability_;

View File

@ -15,6 +15,7 @@
#include "entityfactory.h"
#include "pbutils.h"
#include "netdata.h"
#include "boxdrop.h"
#include "mt/Equip.h"
#include "mt/MapThing.h"
@ -174,7 +175,10 @@ void Obstacle::OnBulletHit(IBullet* bullet)
}
if (IsDead(bullet->GetRoom())) {
ProcDieExplosion(bullet->GetRoom());
bullet->GetSender().Get()->DropItems(this);
if (meta->HasDrop()) {
bullet->GetSender().Get()->DropItems(this);
bullet->GetRoom()->GetBoxDrop()->OnObstacleDeadDrop(this);
}
if (meta->thing_type() == kObstacleOilBucket) {
const mt::MapThing* bomb_meta = mt::MapThing::GetById(meta->_int_param1);
if (bomb_meta) {
@ -225,6 +229,7 @@ void Obstacle::OnExplosionHit(Explosion* e)
for (int drop_id : drops) {
e->GetRoom()->ScatterDrop(GetPos().ToGlmVec3(), drop_id);
}
e->GetRoom()->GetBoxDrop()->OnObstacleDeadDrop(this);
}
if (meta->thing_type() == kObstacleOilBucket) {
const mt::MapThing* bomb_meta = mt::MapThing::GetById(meta->_int_param1);
@ -293,6 +298,11 @@ bool Obstacle::DoInteraction(Human* sender)
DoHideHouseInteraction(sender);
}
break;
case kObstacleTreasureBox:
{
DoTreasureBoxInteraction(sender);
}
break;
default:
{
if (!IsDead(sender->room) && IsOpenInteraction()) {
@ -308,6 +318,9 @@ bool Obstacle::DoInteraction(Human* sender)
if (a8::TIMER_EXEC_EVENT == event) {
#if 1
sender->DropItems(center, drops);
if (!empty(drops)) {
sender->room->GetBoxDrop()->DropByUuid(obj_uniid, center);
}
#else
Entity* entity = sender->room->GetEntityByUniId(obj_uniid);
if (entity && entity->IsEntityType(ET_Obstacle)) {
@ -481,3 +494,37 @@ void Obstacle::SetRotate(float rotate)
{
rotate_ = rotate;
}
void Obstacle::DoTreasureBoxInteraction(Human* sender)
{
if (!IsDead(sender->room) && sender->GetNetData()->GetTotalLucky() > 0.1f) {
++sender->box_num;
sender->room->frame_event.AddPropChg
(
sender->GetWeakPtrRef(),
kPropPickUp,
0,
GetUniId(),
false);
sender->room->frame_event.AddPropChgEx(sender->GetWeakPtrRef(), kPropBoxNum, 0, sender->box_num,
1, 0, false);
Die(sender->room);
BroadcastFullState(sender->room);
sender->room->xtimer.SetTimeoutEx
(meta->delay_destroy() / FRAME_RATE_MS,
[sender, obj_uniid = GetUniId()] (int event, const a8::Args* args)
{
if (a8::TIMER_EXEC_EVENT == event) {
Entity* entity = sender->room->GetEntityByUniId(obj_uniid);
if (entity && entity->IsEntityType(ET_Obstacle)) {
Obstacle* ob = (Obstacle*)entity;
if (ob->IsRoomObstacle()) {
sender->room->RemoveObjectLater((RoomObstacle*)entity);
}
}
return;
}
},
&sender->xtimer_attacher);
}
}

View File

@ -50,6 +50,7 @@ class Obstacle : public Entity
protected:
Obstacle();
void DoHideHouseInteraction(Human* sender);
void DoTreasureBoxInteraction(Human* sender);
std::tuple<long long, glm::vec3>* GetInteractionData(Human* sender);
void AddObstacleBuff(Creature* c);
void ClearObstacleBuff(Creature* c);

View File

@ -164,6 +164,7 @@ static Player* InternalCreatePlayer(std::shared_ptr<CustomBattle> p,
int quality = 1;
hum->GetNetData()->GetHeroLvQuality(hero_uniid, hero_lv, quality);
hum->hero_uniid = hero_uniid;
hum->SetHeroQuality(quality);
}
if (on_preadd) {
on_preadd(hum);
@ -704,6 +705,7 @@ void Human::FillMFObjectLess(Room* room, Human* hum, cs::MFPlayerFull* full_data
p->set_hero_level(GetHeroLevel());
p->set_hero_exp(GetHeroExp());
p->set_hero_max_exp(GetHeroMaxExp());
p->set_box_num(box_num);
GetCurrWeapon()->ToPB(this, p->mutable_weapon());
PBUtils::Ability_FillMFAttrAdditionList(GetAbility().get(), this, p);
if (GetCar()) {
@ -749,6 +751,7 @@ void Human::FillMFObjectFull(Room* room, Human* hum, cs::MFObjectFull* full_data
p->set_max_energy_shield(max_energy_shield);
p->set_armor_shield(armor_shield);
p->set_max_armor_shield(max_armor_shield);
p->set_box_num(box_num);
if (guild_id != 0) {
p->set_guild_id(guild_id);
}
@ -829,6 +832,7 @@ void Human::FillMFObjectFull(Room* room, Human* hum, cs::MFObjectFull* full_data
p->set_shield_max_hp(shield_max_hp_);
}
p->set_team_id(team_id);
p->set_hero_quality(GetHeroQuality());
}
void Human::FillMFObjectImage(Room* room, Human* hum, cs::MFCharacterImage* image_data)
@ -972,6 +976,7 @@ void Human::FillMFTeamData(Human* hum, cs::MFTeamData* team_data, bool is_game_o
team_data->set_hero_max_exp(GetHeroMaxExp());
team_data->set_score(stats->pve_rank_score);
team_data->set_main_skill_cd(GetMainSkill()->GetLeftTime());
team_data->set_skin_id(GetNetData()->GetSkinId());
if (is_game_over || !real_dead || room->GetFrameNo() - GetRealDeadFrameNo(room) < 4) {
TypeConvert::ToPb(GetPos(), team_data->mutable_pos());
TypeConvert::ToPb(GetAttackDir(), team_data->mutable_dir());
@ -1044,6 +1049,7 @@ void Human::FillMFMobaBattleDataMember(cs::MFMobaBattleDataMember* p)
p->set_avatar_url(avatar_url);
p->set_hero_id(GetNetData()->GetHeroId());
p->set_head_frame(head_frame);
p->set_skin_id(GetNetData()->GetSkinId());
for (auto& inv : GetInventoryData()) {
p->add_inventory(inv.num);
@ -1091,6 +1097,7 @@ void Human::FillMFTeamMemberNew(cs::MFTeamMemberNew* p)
p->set_hero_max_exp(GetHeroMaxExp());
p->set_main_skill_cd(GetMainSkill()->GetLeftTime());
p->set_main_skill_max_cd(GetMainSkill()->GetCd());
p->set_skin_id(GetNetData()->GetSkinId());
}
void Human::FillSMGameOver(cs::SMGameOver& msg)
@ -1115,18 +1122,18 @@ void Human::FillSMGameOver(cs::SMGameOver& msg)
}
#endif
{
auto p = new cs::MFSettlementNew();
GetTeam()->FillMFSettlementNew(p);
auto p = std::make_shared<cs::MFSettlementNew>();
GetTeam()->FillMFSettlementNew(p.get());
*msg.mutable_settlement_new() = *p;
*msg.mutable_common_settlement()->add_team_list() = *p;
}
if (room->IsMobaModeRoom()) {
auto p = new cs::MFSettlementNew();
auto p = std::make_shared<cs::MFSettlementNew>();
if (room->GetMobaTeamA() == GetTeam()) {
room->GetMobaTeamB()->FillMFSettlementNew(p);
room->GetMobaTeamB()->FillMFSettlementNew(p.get());
*msg.mutable_common_settlement()->add_team_list() = *p;
} else {
room->GetMobaTeamB()->FillMFSettlementNew(p);
room->GetMobaTeamA()->FillMFSettlementNew(p.get());
*msg.mutable_common_settlement()->add_team_list() = *p;
}
}
@ -1532,6 +1539,9 @@ void Human::SendUpdateMsg()
void Human::SendGameOver()
{
if (IsPlayer()){
int i = 0;
}
CalcStats();
if (stats->abandon_battle == 1 || (GetTeam()->HasPlayer()) || GetTeam()->MemberHasOb()) {
if (room->IsAlreadyRoomReportBattle()) {
@ -1547,7 +1557,7 @@ void Human::SendGameOver()
} else {
SendNotifyMsg(msg);
}
#ifdef MYDEBUG1
#ifdef MYDEBUG
if (IsPlayer()) {
a8::XPrintf("SMGameOver:%s\n", {f8::PbToJson(&msg)});
}
@ -1558,7 +1568,8 @@ void Human::SendGameOver()
sent_personal_report_ = true;
}
if (GetTeam()->team_rank && GetTeam()->HasPlayer() && !GetTeam()->IsViewTeam() &&
stats->abandon_battle != 1 && !room->IsMobaModeRoom()) {
stats->abandon_battle != 1 && !room->IsMobaModeRoom() &&
!GetTeam()->IsAlreadyReportBattle()) {
GetTeam()->TrySendTeamBattleReport(this);
} else {
cs::SMGameOver msg;
@ -1573,7 +1584,7 @@ void Human::SendGameOver()
} else {
SendNotifyMsg(msg);
}
#ifdef MYDEBUG1
#ifdef MYDEBUG
if (IsPlayer()) {
a8::XPrintf("SMGameOver:%s\n", {f8::PbToJson(&msg)});
}
@ -1662,68 +1673,6 @@ void Human::SendShowCountdown(const std::string& msg, int countdown)
SendNotifyMsg(notifymsg);
}
void Human::SendBattleSettlement()
{
if (!IsPlayer()) {
return;
}
if (room->GetBattleStartFrameNo() <= 0) {
return;
}
Player* p = (Player*)this;
std::shared_ptr<a8::MutableXObject> params = a8::MutableXObject::CreateObject();
{
params->SetVal("account_id", account_id);
params->SetVal("session_id", session_id);
params->SetVal("battle_uuid", GetTeam()->GetBattleUuid());
params->SetVal("__POST", f8::PbToJson(p->settlement.get()));
}
std::string url;
JsonDataMgr::Instance()->GetApiUrl(url);
if (url.find('?') != std::string::npos) {
url += "c=Battle&a=reportSettlement";
} else {
url += "?c=Battle&a=reportSettlement";
}
std::string data;
params->ToUrlEncodeStr(data);
#ifdef MYDEBUG
{
if (!f8::IsTestEnv()) {
a8::XPrintf("reportSettlement %s\n", {data});
}
}
#endif
std::string room_uuid = room->GetRoomUuid();
std::string tmp_account_id = account_id;
HttpProxy::Instance()->HttpGet
(
[room_uuid, tmp_account_id, data]
(bool ok, a8::XObject* rsp_obj, f8::HttpContext* ctx)
{
auto room = RoomMgr::Instance()->GetRoomByUuid(room_uuid);
if (!room) {
return;
}
Player* hum = room->GetPlayerByAccountId(tmp_account_id);
if (!hum) {
return;
}
if (!ok) {
f8::UdpLog::Instance()->Error("reportSettlement error params: %s response: %s",
{
data,
""
});
}
},
url.c_str(),
*params.get()
);
}
void Human::AddItem(int item_id, int item_num)
{
auto itr = items_.find(item_id);
@ -2574,9 +2523,10 @@ void Room::NotifyNewsTicker(int msg_type, std::vector<std::string> msg_content)
}
TraversePlayerList
(
[&notify_msg] (Player* hum)
[&notify_msg] (Player* hum) -> bool
{
hum->SendNotifyMsg(notify_msg);
return true;
});
}
@ -2589,9 +2539,10 @@ void Room::NotifyKillList(const std::vector<int>& uniid_list)
}
TraversePlayerList
(
[&notify_msg] (Player* hum)
[&notify_msg] (Player* hum) -> bool
{
hum->SendNotifyMsg(notify_msg);
return true;
});
}

View File

@ -140,6 +140,14 @@ void Player::Initialize()
{
if (a8::TIMER_EXEC_EVENT == event) {
SyncVolume(-1);
if (GetNetData()->HideBigEventBox()) {
room->frame_event.AddPropChg
(GetWeakPtrRef(),
kPropShowOrHideBigEventBox,
0,
0,
true);
}
}
},
&xtimer_attacher);
@ -1093,7 +1101,7 @@ void Player::_CMMove(f8::MsgHdr* hdr, const cs::CMMove& msg)
a8::XPrintf("moving:%d times:%d\n", {moving ? 1 : 0, GetDisableAttackDirTimes()});
#endif
if (moving && GetDisableAttackDirTimes() <= 0) {
#if 1
#if 0
SetAttackDir(GetMoveDir());
#else
if (!HasBuffEffect(kBET_HoldShield)) {
@ -1316,9 +1324,10 @@ void Player::_CMVoice(f8::MsgHdr* hdr, const cs::CMVoice& msg)
cs::SMVoiceNotify notifymsg;
notifymsg.set_account_id(account_id);
notifymsg.set_download_url(msg.download_url());
auto send_func = [&notifymsg] (Player* hum)
auto send_func = [&notifymsg] (Player* hum) -> bool
{
hum->SendNotifyMsg(notifymsg);
return true;
};
room->TraversePlayerList(send_func);
}
@ -1378,12 +1387,9 @@ void Player::_CMRevive(f8::MsgHdr* hdr, const cs::CMRevive& msg)
{
std::string url;
JsonDataMgr::Instance()->GetApiUrl(url);
if (url.find('?') != std::string::npos) {
url += "&c=Battle&a=decReviveCoin";
} else {
url += "?&c=Battle&a=decReviveCoin";
}
auto url_params = a8::MutableXObject::CreateObject();
url_params->SetVal("c", "Battle");
url_params->SetVal("a", "decReviveCoin");
url_params->SetVal("account_id", account_id);
url_params->SetVal("session_id", session_id);
url_params->SetVal("target_id", hum->account_id);
@ -1427,8 +1433,8 @@ void Player::_CMRevive(f8::MsgHdr* hdr, const cs::CMRevive& msg)
a8::UnSetBitFlag(hum->status, CS_Reviving);
}
},
url.c_str(),
*url_params
url,
url_params
);
}
}
@ -1841,6 +1847,7 @@ void Player::_CMGetSettlementTeamList(f8::MsgHdr* hdr, const cs::CMGetSettlement
m->set_account_id(hum->account_id);
m->set_name(hum->name);
m->set_hero_id(hum->meta->id());
m->set_skin_id(hum->GetNetData()->GetSkinId());
return true;
});
++team_rank;

View File

@ -52,6 +52,7 @@
#include "httpproxy.h"
#include "netdata.h"
#include "stats.h"
#include "boxdrop.h"
#include "mt/Param.h"
#include "mt/Hero.h"
@ -133,6 +134,7 @@ void Room::Init()
incubator_->room = this;
incubator_->Init();
sand_table_ = std::make_shared<SandTable>(this);
box_drop_ = std::make_shared<BoxDrop>(this);
#ifdef MYDEBUG
InitDebugInfo();
#endif
@ -226,6 +228,8 @@ void Room::UnInit()
#ifdef MYDEBUG
UnInitDebugInfo();
#endif
box_drop_->UnInit();
box_drop_ = nullptr;
incubator_ = nullptr;
timer_attacher.ClearTimerList();
xtimer_attacher_.ClearTimerList();
@ -1227,11 +1231,13 @@ std::shared_ptr<Team> Room::NewViewTeam()
return team;
}
void Room::TraversePlayerList(std::function<void (Player*)> cb)
void Room::TraversePlayerList(std::function<bool (Player*)> cb)
{
for (auto& pair : accountid_hash_) {
if (pair.second && !pair.second->IsOb()) {
cb(pair.second);
if (!cb(pair.second)){
break;
}
}
}
}
@ -2232,13 +2238,10 @@ void Room::TryMobaReport(int try_count)
}
std::string url;
JsonDataMgr::Instance()->GetApiUrl(url);
if (url.find('?') != std::string::npos) {
url += "c=Battle&a=mobaTeamReport";
} else {
url += "?c=Battle&a=mobaTeamReport";
}
std::shared_ptr<a8::MutableXObject> params = a8::MutableXObject::CreateObject();
std::shared_ptr<a8::MutableXObject> post_data = a8::MutableXObject::CreateObject();
params->SetVal("c", "Battle");
params->SetVal("a", "mobaTeamReport");
params->SetVal("account_id", player->account_id);
params->SetVal("session_id", player->session_id);
GenBattleMobaReportData(post_data.get());
@ -2261,8 +2264,8 @@ void Room::TryMobaReport(int try_count)
});
}
},
url.c_str(),
*params.get(),
url,
params,
content
);
#ifdef MYDEBUG
@ -3212,6 +3215,7 @@ void Room::OnBattleStart()
}
battle_starting_ = false;
SendSMTeamFull(nullptr);
GetBoxDrop()->OnBattleStart();
}
bool Room::CanAddObstacle(const glm::vec3& pos, int obstacle_id)
@ -3676,7 +3680,7 @@ void Room::GMFastForward()
}
TraversePlayerList
(
[this] (Player* hum)
[this] (Player* hum) -> bool
{
glm::vec3 src_point = glm::vec3(GetGasData().new_area_meta->GetLastArea()->x1(),
6.0f,
@ -3698,6 +3702,7 @@ void Room::GMFastForward()
grid_service->MoveCreature(hum);
}
}
return true;
});
GetIncubator()->Clear(5);
TraverseHumanList
@ -4108,14 +4113,11 @@ void Room::TryRoomReport(int try_count)
}
std::string url;
JsonDataMgr::Instance()->GetApiUrl(url);
if (url.find('?') != std::string::npos) {
url += "c=Battle&a=roomReport";
} else {
url += "?c=Battle&a=roomReport";
}
std::shared_ptr<a8::MutableXObject> params = a8::MutableXObject::CreateObject();
std::shared_ptr<a8::MutableXObject> post_data = a8::MutableXObject::CreateObject();
GenBattleRoomReportData(post_data.get());
params->SetVal("c", "Battle");
params->SetVal("a", "roomReport");
params->SetVal("account_id", player->account_id);
params->SetVal("session_id", player->session_id);
std::string content = post_data->ToJsonStr();
@ -4138,10 +4140,11 @@ void Room::TryRoomReport(int try_count)
room->StartOverTimer();
}
},
url.c_str(),
*params.get(),
url,
params,
content
);
GetBoxDrop()->RequestReturnBoxNum();
#ifdef MYDEBUG
a8::XPrintf("RoomReportLen:%d\n", {params->ToJsonStr().size()});
#endif
@ -4169,12 +4172,21 @@ void Room::CalcMvp()
[this, &max_kill, &max_assist, &max_damage, &max_recover, &max_level, &max_alive]
(Human* hum) mutable -> bool
{
#if 1
max_kill = std::max(max_kill, (float)hum->stats->kills);
max_assist = std::max(max_assist, (float)hum->stats->assist);
max_damage = std::max(max_damage, (float)hum->stats->damage_amount_out);
max_recover = std::max(max_recover, (float)hum->stats->heal_amount);
max_level = std::max(max_level, (float)hum->GetHeroLevel());
max_alive = std::max(max_alive, (float)hum->stats->alive_time / 1000);
#else
max_kill += hum->stats->kills;
max_assist += hum->stats->assist;
max_damage += hum->stats->damage_amount_out;
max_recover += hum->stats->heal_amount;
max_level += hum->GetHeroLevel();
max_alive += hum->stats->alive_time / 1000;
#endif
return true;
});
@ -4190,48 +4202,91 @@ void Room::CalcMvp()
kill_sco = (param1 - param0) / (max_kill - 0) * (kill - 0) + param0;
}
}
float assist_sco = 0.0f;
float assist_sco = param0;
{
if (max_assist > 0) {
float assist = hum->stats->assist;
assist_sco = (param1 - param0) / (max_assist - 0) * (assist - 0) + param0;
}
}
float damage_sco = 0.0f;
float damage_sco = param0;
{
if (max_damage > 0) {
float damage = hum->stats->damage_amount_out;
damage_sco = (param1 - param0) / (max_damage - 0) * (damage - 0) + param0;
}
}
float recover_sco = 0.0f;
float recover_sco = param0;
{
if (max_recover > 0) {
float recover = hum->stats->heal_amount;
recover_sco = (param1 - param0) / (max_recover - 0) * (recover - 0) + param0;
}
}
float level_sco = 0.0f;
float level_sco = param0;
{
if (max_level > 1.00000) {
float level = hum->GetHeroLevel();
level_sco = (param1 - param0) / (max_level - 0) * (level - 0) + param0;
}
}
float alive_sco = 0.0f;
float alive_sco = param0;
{
if (max_alive > 0) {
float alive = hum->stats->alive_time / 1000;
alive_sco = (param1 - param0) / (max_alive - 0) * (alive - 0) + param0;
}
}
#ifdef MYDEBUG
if (hum->IsPlayer()) {
a8::XPrintf("kill_sco:%f assist_sco:%f damage_sco:%f recover_sco:%f alive_sco:%f "
"assist:%f max_assist:%f damage:%f max_damage:%f recover:%f max_recover:%f "
"level:%d max_level:%d""\n",
{
kill_sco,
assist_sco,
damage_sco,
recover_sco,
alive_sco,
hum->stats->assist,
max_assist,
hum->stats->damage_amount_out,
max_damage,
hum->stats->heal_amount,
max_recover,
hum->GetHeroLevel(),
max_level
});
}
#endif
float battle_score = 0.0f;
if (IsMobaModeRoom()) {
if (mt::Param::s().performance_score_weight_4V4.size() >= 5) {
kill_sco *= mt::Param::s().performance_score_weight_4V4.at(0);
assist_sco *= mt::Param::s().performance_score_weight_4V4.at(1);
damage_sco *= mt::Param::s().performance_score_weight_4V4.at(2);
recover_sco *= mt::Param::s().performance_score_weight_4V4.at(3);
level_sco *= mt::Param::s().performance_score_weight_4V4.at(4);
}
battle_score = std::round((kill_sco + assist_sco + damage_sco + recover_sco + level_sco) * 100.0f) / 100.0f;
} else {
if (mt::Param::s().performance_score_weight_BR.size() >= 5) {
kill_sco *= mt::Param::s().performance_score_weight_BR.at(0);
assist_sco *= mt::Param::s().performance_score_weight_BR.at(1);
damage_sco *= mt::Param::s().performance_score_weight_BR.at(2);
recover_sco *= mt::Param::s().performance_score_weight_BR.at(3);
alive_sco *= mt::Param::s().performance_score_weight_BR.at(4);
}
battle_score = std::round((kill_sco + assist_sco + damage_sco + recover_sco + alive_sco) * 100.0f) / 100.0f;
}
#ifdef MYDEBUG
if (hum->IsPlayer()) {
a8::XPrintf("battle_score:%f\n",
{
battle_score
});
}
#endif
hum->stats->battle_score = battle_score;
return true;
});

View File

@ -51,6 +51,7 @@ class CustomMember;
class RoomAgent;
class RoomOb;
class InGameVoice;
class BoxDrop;
struct Plane
{
@ -73,9 +74,10 @@ enum RoomSwitch_e
kRoomSwitchDisableUseSkill,
kRoomSwitchDisableUseItem,
kRoomSwitchDisableShot,
kRoomSwitchPeaceMode,
};
class Room
class Room : public std::enable_shared_from_this<Room>
{
public:
FrameEvent frame_event;
@ -153,7 +155,7 @@ public:
void FillSMJoinedNotify(Human* self_hum, cs::SMJoinedNotify& msg);
void TraversePlayerList(std::function<void (Player*)> cb);
void TraversePlayerList(std::function<bool (Player*)> cb);
void TraverseRawPlayerList(std::function<void (Player*)> cb);
void TraverseHumanList(std::function<bool (Human*)> cb);
void TraverseRawHumanList(std::function<bool (Human*)> cb);
@ -305,6 +307,7 @@ public:
void CalcMvp();
long long GetMobaOvertimeRaceFrameNo () { return moba_overtime_race_frameno_; }
void MobaOver();
std::shared_ptr<BoxDrop> GetBoxDrop() { return box_drop_; }
std::shared_ptr<InGameVoice> GetInGameVoice() { return ingame_voice_; }
@ -472,6 +475,7 @@ private:
RoomAgent* room_agent_;
std::shared_ptr<InGameVoice> ingame_voice_;
std::shared_ptr<BoxDrop> box_drop_;
friend class Incubator;
friend class Team;

View File

@ -58,6 +58,9 @@ void RoomMgr::UnInit()
room_hash_.clear();
room_idx_hash_.clear();
over_room_hash_.clear();
custom_room_hash_.clear();
his_custom_room_hash_.clear();
socket_hash_.clear();
}
void RoomMgr::Update(int delta_time)
@ -603,26 +606,25 @@ void RoomMgr::SendGetCustomBattleData(std::shared_ptr<cs::CMJoin> join_msg,
{
std::string url;
JsonDataMgr::Instance()->GetApiUrl(url);
auto url_params = a8::MutableXObject::CreateObject();
url_params->SetVal("c", "Battle");
if (custom_room_type == CUSTOM_ROOM_CUSTOM) {
if (url.find('?') != std::string::npos) {
url += "&c=Battle&a=getCustomBattleDataNew";
} else {
url += "?&c=Battle&a=getCustomBattleDataNew";
}
url_params->SetVal("a", "getCustomBattleDataNew");
} else if (custom_room_type == CUSTOM_ROOM_NORMAL) {
if (url.find('?') != std::string::npos) {
url += "&c=Battle&a=getNormalBattleData";
} else {
url += "?&c=Battle&a=getNormalBattleData";
}
url_params->SetVal("a", "getNormalBattleData");
} else {
A8_ABORT();
}
auto url_params = a8::MutableXObject::CreateObject();
url_params->SetVal("account_id", join_msg->account_id());
url_params->SetVal("session_id", join_msg->session_id());
url_params->SetVal("version", 1);
url_params->SetVal("__POST", join_msg->payload_data());
std::string post_data;
{
//a8::XObject post_obj;
//post_obj.ReadFromJsonString(join_msg->payload_data());
//post_data = post_obj.ToJsonStr();
}
HttpProxy::Instance()->HttpGet
(
[cb, custom_room_type]
@ -675,8 +677,8 @@ void RoomMgr::SendGetCustomBattleData(std::shared_ptr<cs::CMJoin> join_msg,
cb(1, "custom battle data error", nullptr);
}
},
url.c_str(),
*url_params
url,
url_params
);
}
}

View File

@ -220,7 +220,7 @@ void PlayerStats::Statement(Human* sender)
game_time = f8::App::Instance()->GetNowTime();
if (sender->GetBattleStartTime() <= 0) {
game_duration = 0;
#ifdef MYDEBUG
#ifdef MYDEBUG1
abort();
#endif
} else {

View File

@ -211,15 +211,12 @@ void Team::SendTeamBattleReport(Human* sender)
#endif
std::string url;
JsonDataMgr::Instance()->GetApiUrl(url);
if (url.find('?') != std::string::npos) {
url += "c=Battle&a=teamReport";
} else {
url += "?c=Battle&a=teamReport";
}
std::shared_ptr<a8::MutableXObject> params = a8::MutableXObject::CreateObject();
params->SetVal("c", "Battle");
params->SetVal("a", "teamReport");
params->SetVal("account_id", player->account_id);
params->SetVal("session_id", player->session_id);
params->SetVal("__POST", post_data->ToJsonStr());
//params->SetVal("__POST", post_data->ToJsonStr());
std::string room_uuid = room->GetRoomUuid();
int team_id = GetTeamId();
@ -235,7 +232,7 @@ void Team::SendTeamBattleReport(Human* sender)
});
return;
}
HttpProxy::Instance()->HttpGet
HttpProxy::Instance()->HttpPost
(
[room_uuid, team_id]
(bool ok, a8::XObject* rsp_obj, f8::HttpContext* ctx)
@ -268,8 +265,9 @@ void Team::SendTeamBattleReport(Human* sender)
}
}
},
url.c_str(),
*params.get()
url,
params,
post_data->ToJsonStr()
);
}
@ -407,6 +405,7 @@ void Team::GenBattleReportData(a8::MutableXObject* params)
member_pb->SetVal("max_hero_skill_lv", hum->stats->max_hero_skill_lv);
member_pb->SetVal("abandon_battle", hum->stats->abandon_battle);
member_pb->SetVal("assist", hum->stats->assist);
member_pb->SetVal("box_num", hum->box_num);
{
std::string weapons_type;
std::string weapons_slot;
@ -761,6 +760,7 @@ void Team::GenRoomReportData(a8::MutableXObject* params)
member_pb->SetVal("max_hero_skill_lv", hum->stats->max_hero_skill_lv);
member_pb->SetVal("abandon_battle", hum->stats->abandon_battle);
member_pb->SetVal("assist", hum->stats->assist);
member_pb->SetVal("box_num", hum->box_num);
{
std::string weapons_type;
std::string weapons_slot;

View File

@ -22,7 +22,7 @@
class EventHandler : public std::enable_shared_from_this<EventHandler>
{
public:
a8::CommonCbProc cb;
std::shared_ptr<a8::CommonCbProc> cb;
list_head entry;
std::shared_ptr<EventHandler> holder;
@ -497,7 +497,8 @@ std::weak_ptr<EventHandler> Trigger::AddListener(int event_id, a8::CommonCbProc
INIT_LIST_HEAD(&itr->second);
}
auto p = std::make_shared<EventHandler>();
p->cb = cb;
p->cb = std::make_shared<a8::CommonCbProc>();
*p->cb = cb;
list_add_tail(&p->entry, &itr->second);
p->holder = p;
return p;
@ -520,13 +521,17 @@ void Trigger::RemoveEventHandlers(std::vector<std::weak_ptr<EventHandler>> handl
}
}
/*
!!!
*/
void Trigger::DispatchEvent(int event_id, const std::vector<std::any>& param)
{
auto itr = listeners_hash_.find(event_id);
if (itr != listeners_hash_.end()) {
struct EventHandler *handle = nullptr, *tmp = nullptr;
list_for_each_entry_safe(handle, tmp, &itr->second, entry) {
handle->cb(param);
auto cb = handle->cb;
(*cb)(param);
}
}
}

View File

@ -11,6 +11,7 @@
#include <f8/udplog.h>
#include "app.h"
#include "jsondatamgr.h"
#include "handlermgr.h"
class GCClientSession: public a8::MixedSession
@ -102,8 +103,8 @@ void GGListener::Init()
tcp_listener_->on_error = GSListeneron_error;
tcp_listener_->bind_address = "0.0.0.0";
tcp_listener_->bind_port = 3333;
//tcp_listener_->bind_port = JsonDataMgr::Instance()->GetConf()->At("listen_port")->AsXValue();
//tcp_listener_->bind_port = 3333;
tcp_listener_->bind_port = JsonDataMgr::Instance()->GetConf()->At("listen_port")->AsXValue();
tcp_listener_->Open();
f8::MsgQueue::Instance()->RegisterCallBack

View File

@ -8,6 +8,7 @@
#include <f8/btmgr.h>
#include <f8/udplog.h>
#include <f8/app.h>
#include "android_agent.h"
#include "player.h"
@ -70,15 +71,15 @@ behaviac::EBTStatus AndroidAgent::CoLogin()
{
auto url_params = a8::MutableXObject::CreateObject();
url_params->SetVal("c", "Login");
url_params->SetVal("a", "auth");
url_params->SetVal("gameid", 2006);
url_params->SetVal("channel", 6513);
url_params->SetVal("openid", owner_->GetIdx());
HttpProxy::Instance()->HttpGet
url_params->SetVal("a", "auth2");
auto post_body = a8::MutableXObject::CreateObject();
post_body->SetVal("channel", 2);
post_body->SetVal("data", owner_->GetIdx());
HttpProxy::Instance()->HttpPost
(
[context] (bool ok, a8::XObject* rsp_obj, f8::HttpContext* ctx)
{
#if 0
#if 1
a8::XPrintf("data:%s\n", {rsp_obj->ToJsonStr()});
#endif
if (ok) {
@ -96,21 +97,52 @@ behaviac::EBTStatus AndroidAgent::CoLogin()
}
HttpProxy::Instance()->HttpGet
(
[context] (bool ok, a8::XObject* rsp_obj, f8::HttpContext* ctx)
[context, hum, account_id, session_id]
(bool ok, a8::XObject* rsp_obj, f8::HttpContext* ctx)
{
#if 0
a8::XPrintf("data:%s\n", {rsp_obj->ToJsonStr()});
#endif
if (ok) {
++Perf::Instance()->enter_ok_times;
context->login_ok = true;
auto info = rsp_obj->At("info");
long long hero_uniid = info->Get("hero_uniid", "");
hum->SetHeroUniId(hero_uniid);
if (hum->GetHeroUniId() <= 0) {
auto url_params = a8::MutableXObject::CreateObject();
url_params->SetVal("c", "User");
url_params->SetVal("a", "selectFreeItemS");
url_params->SetVal("account_id", account_id);
url_params->SetVal("session_id", session_id);
url_params->SetVal("itemId", 30100);
HttpProxy::Instance()->HttpGet
(
[context, hum] (bool ok, a8::XObject* rsp_obj, f8::HttpContext* ctx)
{
if (ok) {
auto info = rsp_obj->At("property_chg")->At("user_info");
long long hero_uniid = info->Get("hero_uniid", "");
hum->SetHeroUniId(hero_uniid);
++Perf::Instance()->enter_ok_times;
context->login_ok = true;
} else {
context->login_ok = false;
++Perf::Instance()->enter_fail_times;
}
},
"https://game2006sapi-test.kingsome.cn/sapi/webapp/index.php",
url_params
);
} else {
++Perf::Instance()->enter_ok_times;
context->login_ok = true;
}
} else {
context->login_ok = false;
++Perf::Instance()->enter_fail_times;
}
},
"https://game2006api-test.kingsome.cn/webapp/index.php",
*url_params
url_params
);
} else {
context->login_ok = false;
@ -118,7 +150,8 @@ behaviac::EBTStatus AndroidAgent::CoLogin()
}
},
"https://login-test.kingsome.cn/webapp/index.php",
*url_params
url_params,
post_body->ToJsonStr()
);
}
co->runing_cb =
@ -159,7 +192,7 @@ behaviac::EBTStatus AndroidAgent::CoConnectBattleServer()
owner_->GetWebSocket()->on_connect =
[this, context] (a8::WebSocketClient* )
{
//a8::XPrintf("id:%d WebSocketClient on_connect\n", {context->socket_id});
a8::XPrintf("id:%d WebSocketClient on_connect\n", {context->socket_id});
context->pending = false;
context->connect_ok = true;
};
@ -196,17 +229,37 @@ behaviac::EBTStatus AndroidAgent::CoJoin()
PRE_ENTER_COROUTINE();
cs::CMJoin msg;
msg.set_server_id(6);
msg.set_team_uuid("");
msg.set_team_uuid("ihCQQdNzoYFC^6q4ohsao39br%Ui!C9u2d^qvzek5hOB$3q1");
msg.set_account_id(owner_->GetAccountId());
msg.set_team_mode(2);
msg.set_proto_version(cs::ProtoVersion);
msg.set_auto_fill(1);
msg.set_name("");
msg.set_avatar_url("");
msg.set_mapid(2001);
msg.set_hero_id(30800);
//weapons
msg.set_session_id(owner_->GetSessionId());
msg.set_proto_version(cs::ProtoVersion);
std::string payload_data = "ihCQQdNzoYFC^6q4ohsao39br%Ui!C9u2d^qvzek5hOB$3q1:normal_room|";
{
auto xobj = a8::MutableXObject::CreateObject();
auto team_list = a8::MutableXObject::CreateArray();
{
auto team = a8::MutableXObject::CreateObject();
auto member_list = a8::MutableXObject::CreateArray();
auto member = a8::MutableXObject::CreateObject();
member->SetVal("account_id", owner_->GetAccountId());
member->SetVal("session_id", owner_->GetSessionId());
member->SetVal("hero_uniid", owner_->GetHeroUniId());
if (owner_->GetHeroUniId() <= 0) {
A8_ABORT();
}
member_list->Push(*member.get());
team->SetVal("team_uuid", f8::App::Instance()->NewGlobalUuid());
team->SetVal("members", *member_list.get());
team_list->Push(*team.get());
}
xobj->SetVal("room_uuid", f8::App::Instance()->NewGlobalUuid());
xobj->SetVal("start_time", f8::App::Instance()->GetNowTime());
xobj->SetVal("team_list", *team_list.get());
payload_data += xobj->ToJsonStr();
}
msg.set_payload_data(payload_data);
owner_->SendMsg(msg);
//a8::XPrintf("CoJoin %d\n", {owner_->GetSocketId()});

View File

@ -7,6 +7,7 @@
#include <f8/timer.h>
#include "app.h"
#include "jsondatamgr.h"
#include "handlermgr.h"
#include "player.h"
#include "playermgr.h"
@ -30,6 +31,7 @@ void App::Init()
f8::BtMgr::Instance()->SetLogging(true);
#endif
mt::MetaMgr::Instance()->Init();
JsonDataMgr::Instance()->Init();
IoMgr::Instance()->Init();
HttpProxy::Instance()->Init();
PlayerMgr::Instance()->Init();
@ -41,6 +43,7 @@ void App::UnInit()
GGListener::Instance()->UnInit();
PlayerMgr::Instance()->UnInit();
HttpProxy::Instance()->UnInit();
JsonDataMgr::Instance()->UnInit();
f8::BtMgr::Instance()->UnInit();
IoMgr::Instance()->UnInit();
Perf::Instance()->UnInit();

View File

@ -58,7 +58,6 @@ void HandlerMgr::RegisterNetMsgHandlers()
RegisterNetMsgHandler(&gsmsghandler, &Player::_SMReconnect);
RegisterNetMsgHandler(&gsmsghandler, &Player::_SMWatchWar);
RegisterNetMsgHandler(&gsmsghandler, &Player::_SMLeave);
RegisterNetMsgHandler(&gsmsghandler, &Player::_SMMatchCancel);
RegisterNetMsgHandler(&gsmsghandler, &Player::_SMJoinedNotify);
RegisterNetMsgHandler(&gsmsghandler, &Player::_SMMapInfo);
RegisterNetMsgHandler(&gsmsghandler, &Player::_SMUpdate);
@ -72,9 +71,7 @@ void HandlerMgr::RegisterNetMsgHandlers()
RegisterNetMsgHandler(&gsmsghandler, &Player::_SMSysPiaoMsg);
RegisterNetMsgHandler(&gsmsghandler, &Player::_SMShowCountdown);
RegisterNetMsgHandler(&gsmsghandler, &Player::_SMShowTeamUI);
RegisterNetMsgHandler(&gsmsghandler, &Player::_SMUpdateMatchInfo);
RegisterNetMsgHandler(&gsmsghandler, &Player::_SMGetItemNotify);
RegisterNetMsgHandler(&gsmsghandler, &Player::_SMMatchMemberMsgNotify);
RegisterNetMsgHandler(&gsmsghandler, &Player::_SMPvePassWave);
RegisterNetMsgHandler(&gsmsghandler, &Player::_SMTeamMarkTargetPosList);
RegisterNetMsgHandler(&gsmsghandler, &Player::_SMDebugCmd);

View File

@ -1,200 +0,0 @@
#include "precompile.h"
#include <a8/sysutils.h>
#include <a8/mutable_xobject.h>
#include <a8/awaiter.h>
#include <a8/promise.h>
#include <f8/udplog.h>
#include <f8/jsonhttprequest.h>
#include <f8/utils.h>
#include "httpproxy.h"
#include "app.h"
#include "handlermgr.h"
#include "f8/httpclientpool.h"
struct HttpProxyRequest
{
std::string req_id;
f8::HttpProxyCb cb;
std::string url;
a8::XObject url_params;
long long add_tick = 0;
};
class HttpProxyPromise : public a8::Promise
{
public:
HttpProxyPromise(const char* url, a8::XObject url_params, bool* ret, std::shared_ptr<a8::XObject>* rsp)
{
url_ = url;
url_params_ = url_params;
ret_ = ret;
rsp_ = rsp;
}
protected:
virtual void DoAwait() override
{
f8::HttpClientPool::Instance()->HttpGet
(
[this, _self = shared_from_this()]
(bool ok, a8::XObject* rsp_obj, f8::HttpContext* ctx)
{
*ret_ = ok;
if (ok) {
**rsp_ = *rsp_obj;
}
DoDone();
},
url_.c_str(),
url_params_,
rand() % MAX_SYS_HTTP_NUM
);
}
private:
std::string url_;
a8::XObject url_params_;
bool* ret_ = nullptr;
std::shared_ptr<a8::XObject>* rsp_ = nullptr;
};
static void _ProxyCallback(std::shared_ptr<f8::JsonHttpRequest> request)
{
#ifdef MYDEBUG
#if 0
f8::UdpLog::Instance()->Debug("ProxyCallbBack request:%s",
{
request->GetParams()->ToJsonStr()
});
#endif
#endif
std::string seq_id = request->GetParams()->Get("seq_id");
std::shared_ptr<HttpProxyRequest> req = HttpProxy::Instance()->GetRequest(seq_id);
if (req) {
a8::XObject data;
data.ReadFromJsonString(request->GetParams()->Get("data").GetString());
if (data.GetType() == a8::XOT_SIMPLE) {
data.ReadFromJsonString("{}");
}
f8::HttpContext ctx;
if (request->GetParams()->HasKey("errcode") &&
request->GetParams()->Get("errcode").GetInt() == 0) {
req->cb(true, &data, &ctx);
} else {
req->cb(false, request->GetParams().get(), &ctx);
}
HttpProxy::Instance()->DestoryRequest(req);
}
}
void HttpProxy::Init()
{
request_prefix_ = "robot2006_" + a8::XValue(a8::GetMilliSecond()).GetString() + "_";
HandlerMgr::Instance()->RegisterGMMsgHandler("Proxy@callback", _ProxyCallback);
}
void HttpProxy::UnInit()
{
}
std::string HttpProxy::HttpGet(
f8::HttpProxyCb cb,
const char* url,
a8::XObject url_params
)
{
std::shared_ptr<HttpProxyRequest> request = std::make_shared<HttpProxyRequest>();
request->req_id = CreateRequestId();
request->cb = cb;
request->url = url;
request->url_params = url_params;
request->add_tick = a8::XGetTickCount();
if (request_hash_.find(request->req_id) != request_hash_.end()) {
abort();
}
request_hash_[request->req_id] = request;
std::string local_ip;
a8::GetLocalIp(local_ip);
auto proxy_url_params = a8::MutableXObject::CreateObject();
proxy_url_params->SetVal("seq_id", request->req_id);
proxy_url_params->SetVal("target_url", std::string(url));
proxy_url_params->SetVal("params", url_params.ToJsonStr());
proxy_url_params->SetVal
("cb_url",
a8::Format("http://%s:%d/webapp/index.php?c=Proxy&a=callback",
{
local_ip,
3333
}));
std::string proxy_url = "http://192.168.100.21:8321/webapp/index.php?c=Proxy&a=get";
if (f8::IsTestEnv()) {
proxy_url = "http://127.0.0.1:8321/webapp/index.php?c=Proxy&a=get";
}
f8::HttpClientPool::Instance()->HttpGet
(
[request] (bool ok, a8::XObject* rsp_obj, f8::HttpContext* ctx)
{
long long cost_time = a8::XGetTickCount() - request->add_tick;
if (ok) {
#ifdef MYDEBUG
#if 0
f8::UdpLog::Instance()->Debug("ProxyHttpGet ok cost_time:%d url:%s params:%s",
{
cost_time,
request->url,
request->url_params.ToJsonStr(),
});
#endif
#endif
} else {
f8::UdpLog::Instance()->Warning("ProxyHttpGet error cost_time:%d url:%s params:%s response:%s",
{
cost_time,
request->url,
request->url_params.ToJsonStr(),
ctx->response
});
request->cb(false, rsp_obj, ctx);
HttpProxy::Instance()->DestoryRequest(request);
}
},
proxy_url.c_str(),
*proxy_url_params,
rand() % MAX_SYS_HTTP_NUM
);
return request->req_id;
}
std::string HttpProxy::CreateRequestId()
{
return request_prefix_ + f8::App::Instance()->NewGlobalUuid();
}
std::shared_ptr<HttpProxyRequest> HttpProxy::GetRequest(const std::string& req_id)
{
auto itr = request_hash_.find(req_id);
return itr != request_hash_.end() ? itr->second : nullptr;
}
void HttpProxy::DestoryRequest(std::shared_ptr<HttpProxyRequest> request)
{
request_hash_.erase(request->req_id);
}
std::shared_ptr<a8::Awaiter> HttpProxy::CoHttpGet(const char* url,
a8::XObject url_params,
bool* ret,
std::shared_ptr<a8::XObject>* rsp)
{
*ret = false;
*rsp = std::make_shared<a8::XObject>();
return std::make_shared<HttpProxyPromise>(url, url_params, ret, rsp);
}

View File

@ -0,0 +1 @@
../gameserver/httpproxy.cc

View File

@ -1,46 +0,0 @@
#pragma once
#include <a8/singleton.h>
#include "f8/httpclientpool.h"
namespace a8
{
class Awaiter;
}
struct HttpProxyRequest;
class HttpProxy : public a8::Singleton<HttpProxy>
{
private:
HttpProxy() {};
friend class a8::Singleton<HttpProxy>;
public:
void Init();
void UnInit();
std::string HttpGet(
f8::HttpProxyCb cb,
const char* url,
a8::XObject url_params
);
std::shared_ptr<HttpProxyRequest> GetRequest(const std::string& req_id);
void DestoryRequest(std::shared_ptr<HttpProxyRequest> request);
std::shared_ptr<a8::Awaiter> CoHttpGet(const char* url,
a8::XObject url_params,
bool* ret,
std::shared_ptr<a8::XObject>* rsp);
private:
std::string CreateRequestId();
private:
std::map<std::string, std::shared_ptr<HttpProxyRequest>> request_hash_;
std::string request_prefix_;
};

View File

@ -0,0 +1 @@
../gameserver/httpproxy.h

View File

@ -0,0 +1 @@
../gameserver/jsondatamgr.cc

View File

@ -0,0 +1 @@
../gameserver/jsondatamgr.h

View File

@ -134,11 +134,6 @@ void Player::_SMLeave(f8::MsgHdr* hdr, const cs::SMLeave& msg)
f8::UdpLog::Instance()->Info("%s %s", {msg.GetTypeName(), f8::PbToJson(&msg)});
}
void Player::_SMMatchCancel(f8::MsgHdr* hdr, const cs::SMMatchCancel& msg)
{
f8::UdpLog::Instance()->Info("%s %s", {msg.GetTypeName(), f8::PbToJson(&msg)});
}
void Player::_SMJoinedNotify(f8::MsgHdr* hdr, const cs::SMJoinedNotify& msg)
{
//f8::UdpLog::Instance()->Info("%s %s", {msg.GetTypeName(), f8::PbToJson(&msg)});
@ -206,21 +201,11 @@ void Player::_SMShowTeamUI(f8::MsgHdr* hdr, const cs::SMShowTeamUI& msg)
f8::UdpLog::Instance()->Info("%s %s", {msg.GetTypeName(), f8::PbToJson(&msg)});
}
void Player::_SMUpdateMatchInfo(f8::MsgHdr* hdr, const cs::SMUpdateMatchInfo& msg)
{
f8::UdpLog::Instance()->Info("%s %s", {msg.GetTypeName(), f8::PbToJson(&msg)});
}
void Player::_SMGetItemNotify(f8::MsgHdr* hdr, const cs::SMGetItemNotify& msg)
{
f8::UdpLog::Instance()->Info("%s %s", {msg.GetTypeName(), f8::PbToJson(&msg)});
}
void Player::_SMMatchMemberMsgNotify(f8::MsgHdr* hdr, const cs::SMMatchMemberMsgNotify& msg)
{
f8::UdpLog::Instance()->Info("%s %s", {msg.GetTypeName(), f8::PbToJson(&msg)});
}
void Player::_SMPvePassWave(f8::MsgHdr* hdr, const cs::SMPvePassWave& msg)
{
f8::UdpLog::Instance()->Info("%s %s", {msg.GetTypeName(), f8::PbToJson(&msg)});

View File

@ -32,6 +32,8 @@ public:
const std::string& GetAccountId() { return account_id_; }
const std::string& GetSessionId() { return session_id_; }
void SetSessionId(const std::string& session_id) { session_id_ = session_id; }
void SetHeroUniId(long long hero_uniid) { hero_uniid_ = hero_uniid; }
long long GetHeroUniId() { return hero_uniid_; }
auto GetWebSocket() { return web_socket_; }
int GetIdx() { return idx_; }
void SetLoginSucess();
@ -45,7 +47,6 @@ public:
void _SMReconnect(f8::MsgHdr* hdr, const cs::SMReconnect& msg);
void _SMWatchWar(f8::MsgHdr* hdr, const cs::SMWatchWar& msg);
void _SMLeave(f8::MsgHdr* hdr, const cs::SMLeave& msg);
void _SMMatchCancel(f8::MsgHdr* hdr, const cs::SMMatchCancel& msg);
void _SMJoinedNotify(f8::MsgHdr* hdr, const cs::SMJoinedNotify& msg);
void _SMMapInfo(f8::MsgHdr* hdr, const cs::SMMapInfo& msg);
void _SMUpdate(f8::MsgHdr* hdr, const cs::SMUpdate& msg);
@ -59,9 +60,7 @@ public:
void _SMSysPiaoMsg(f8::MsgHdr* hdr, const cs::SMSysPiaoMsg& msg);
void _SMShowCountdown(f8::MsgHdr* hdr, const cs::SMShowCountdown& msg);
void _SMShowTeamUI(f8::MsgHdr* hdr, const cs::SMShowTeamUI& msg);
void _SMUpdateMatchInfo(f8::MsgHdr* hdr, const cs::SMUpdateMatchInfo& msg);
void _SMGetItemNotify(f8::MsgHdr* hdr, const cs::SMGetItemNotify& msg);
void _SMMatchMemberMsgNotify(f8::MsgHdr* hdr, const cs::SMMatchMemberMsgNotify& msg);
void _SMPvePassWave(f8::MsgHdr* hdr, const cs::SMPvePassWave& msg);
void _SMTeamMarkTargetPosList(f8::MsgHdr* hdr, const cs::SMTeamMarkTargetPosList& msg);
void _SMDebugCmd(f8::MsgHdr* hdr, const cs::SMDebugCmd& msg);
@ -79,6 +78,7 @@ private:
std::string session_id_;
std::string remote_ip_;
int remote_port_ = 0;
long long hero_uniid_ = 0;
bool is_login_success_ = false;
bool net_connected_ = false;

View File

@ -26,13 +26,13 @@ void PlayerMgr::Init()
{
if (et == a8::TIMER_EXEC_EVENT) {
int idx = account_id_hash_.size() + 1;
std::string account_id = a8::Format("6513_2006_%d", {idx});
std::string account_id = a8::Format("2_2006_%d", {idx});
auto hum = std::make_shared<Player>();
hum->Init(idx, account_id);
account_id_hash_[hum->GetAccountId()] = hum;
socket_id_hash_[hum->GetSocketId()] = hum;
++count;
if (count >= 200) {
if (count >= 3) {
f8::Timer::Instance()->DeleteCurrentTimer();
}
}

View File

@ -17,12 +17,6 @@ enum CMMessageId_e
_CMRevive = 210;
_CMCancelRevive = 211;
_CMExecCommand = 217;
_CMMatchCancel = 218;
_CMMatchChoose = 219;
_CMMatchStartGame = 220;
_CMMatchCancelStartGame = 221;
_CMMatchSendMsg = 222;
_CMMatchBroadcastMsg = 223;
_CMRequestBulletDmg = 230;
_CMStowShield = 231;
_CMImmediateMsg = 232;
@ -47,7 +41,6 @@ enum SMMessageId_e
_SMWatchWar = 208;
_SMLeave = 209;
_SMMatchCancel = 218;
_SMGetSettlementTeamList = 238;
_SMWatchTarget = 241;
_SMTeamComamnd = 242;
@ -66,9 +59,7 @@ enum SMMessageId_e
_SMSysPiaoMsg = 1014;
_SMShowCountdown = 1015;
_SMShowTeamUI = 1016;
_SMUpdateMatchInfo = 1017;
_SMGetItemNotify = 1018;
_SMMatchMemberMsgNotify = 1019;
_SMPvePassWave = 1020;
_SMTeamMarkTargetPosList = 1021;
_SMDebugCmd = 1022;

View File

@ -250,6 +250,11 @@ message MFVec3
property_subtype: uniid
value:
value2:
property_type: 57
value:
value2: (>0 <0 ==0)
property_type: 58 /()
value: 0: 1:
*/
message MFPropertyChg
{
@ -341,6 +346,7 @@ message MFSettlementMember2
optional string account_id = 2; //id
optional string name = 3; //
optional int32 hero_id = 4 [default = 0]; //id
optional int32 skin_id = 5 [default = 0]; //id
}
//-
@ -411,6 +417,8 @@ message MFPlayerFull
optional int32 armor_shield = 73; //
optional int32 max_armor_shield = 74; //
optional int32 box_num = 75; //
optional int32 hero_quality = 76; //<=1N阶,12,23
}
//-
@ -725,6 +733,7 @@ message MFTeamData
optional int32 hero_exp = 73; //hero经验
optional int32 hero_max_exp = 74; //hero max经验
optional int32 main_skill_cd = 80 [default = 0]; //cd时间
optional int32 skin_id = 81 [default = 0]; //id()
//
optional string account_id = 10; //id
@ -759,6 +768,7 @@ message MFTeamMemberNew
optional int32 hero_max_exp = 24; //hero max经验
optional int32 main_skill_cd = 25 [default = 0]; //cd时间
optional int32 main_skill_max_cd = 26 [default = 0]; //cd上限时间
optional int32 skin_id = 27 [default = 0]; //
}
//-
@ -1130,27 +1140,6 @@ message MFRichTextElement
optional MFHeroHeadElement union_obj_3 = 4; //
}
message MFMatchTeamMember
{
optional string account_id = 1; //id account_id
optional string name = 2; //
optional string avatar_url = 3; //
optional int32 hero_id = 4; //id
repeated MFWeapon weapons = 5; //
optional bool is_leader = 8; //
optional int32 state = 9; //0: 1:
optional int32 head_frame = 10; //
}
//
message MFMatchInfo
{
repeated MFMatchTeamMember members = 1; //
optional int32 phase = 2; // 1:() 2 3:
optional int32 countdown = 3; //()
optional int32 predict_time = 4; //()
}
//
message MFOverRewardItem
{
@ -1497,6 +1486,7 @@ message MFMobaBattleDataMember
optional string avatar_url = 4; //
optional int32 hero_id = 5; //id
optional int32 head_frame = 6; //
optional int32 skin_id = 7; //skin_id
repeated int32 inventory = 11; //()
optional int32 kill_count = 12; //
@ -1554,10 +1544,12 @@ message MFInGameVoiceKillInfo
optional int32 killer_uniid = 1; //uniid
optional string killer_name = 2; //
optional int32 killer_hero_id = 3; //hero_id
optional int32 killer_skin_id = 4; //
optional int32 dead_uniid = 11; //uniid
optional string dead_name = 12; //
optional int32 dead_hero_id = 13; //hero_id
optional int32 dead_skin_id = 14; //
}
//
@ -1735,46 +1727,6 @@ message CMCancelRevive
{
}
//-
message CMMatchCancel
{
}
//-
message CMMatchChoose
{
optional int32 hero_id = 1; //id
repeated MFWeapon weapons = 2; //
repeated MFPair skill_list = 4; // key:id value:,0
optional string hero_uniid = 7; //id
}
//-
message CMMatchStartGame
{
}
//-
message CMMatchCancelStartGame
{
}
//-
message CMMatchSendMsg
{
//SMMatchMemberMsgNotify消息
repeated string target_list = 1; //,SMMatchMemberMsgNotify消息
optional string content = 2; //
}
//-广
message CMMatchBroadcastMsg
{
//SMMatchMemberMsgNotify消息
optional int32 exclude_self = 1; //include_self!=0
optional string content = 2; //
}
/*
()
*/
@ -2036,11 +1988,6 @@ message SMLeave
{
}
//
message SMMatchCancel
{
}
//线
message SMDisconnectNotify
{
@ -2110,19 +2057,6 @@ message SMShowTeamUI
{
}
//
message SMUpdateMatchInfo
{
optional MFMatchInfo info = 1; //
}
//-
message SMMatchMemberMsgNotify
{
optional string sender = 1; //
optional string content = 2; //
}
//
message SMGetItemNotify
{

2
third_party/f8 vendored

@ -1 +1 @@
Subproject commit cd6c3de96c917d5cc7603e609613531ec93ef339
Subproject commit 9d627653179015b73f4f21c285b065a50e98a59e