1
This commit is contained in:
parent
76c7ace206
commit
e47ab524b8
@ -332,8 +332,7 @@ void BattleDataContext::ParseResult(a8::XObject& obj)
|
|||||||
errmsg = obj.Get("errmsg").GetString();
|
errmsg = obj.Get("errmsg").GetString();
|
||||||
if (errcode == 0) {
|
if (errcode == 0) {
|
||||||
revive_coin_ = obj.Get("revive_coin");
|
revive_coin_ = obj.Get("revive_coin");
|
||||||
int match_mode = obj.Get("match_mode");
|
match_mode_ = obj.Get("match_mode");
|
||||||
RoomMgr::Instance()->SetMatchMode(match_mode ? 1 : 0);
|
|
||||||
}
|
}
|
||||||
if (obj.HasKey("hero_dto") && obj.At("hero_dto")->IsObject()) {
|
if (obj.HasKey("hero_dto") && obj.At("hero_dto")->IsObject()) {
|
||||||
hero_dto = obj.At("hero_dto");
|
hero_dto = obj.At("hero_dto");
|
||||||
@ -771,3 +770,13 @@ int BattleDataContext::GetReviveCoin()
|
|||||||
{
|
{
|
||||||
return revive_coin_;
|
return revive_coin_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BattleDataContext::SetMatchMode(int match_mode)
|
||||||
|
{
|
||||||
|
match_mode_ = match_mode;
|
||||||
|
}
|
||||||
|
|
||||||
|
int BattleDataContext::GetMatchMode()
|
||||||
|
{
|
||||||
|
return match_mode_;
|
||||||
|
}
|
||||||
|
@ -73,6 +73,8 @@ struct BattleDataContext
|
|||||||
|
|
||||||
void SetReviveCoin(int num);
|
void SetReviveCoin(int num);
|
||||||
int GetReviveCoin();
|
int GetReviveCoin();
|
||||||
|
void SetMatchMode(int match_mode);
|
||||||
|
int GetMatchMode();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void Clear();
|
void Clear();
|
||||||
@ -89,6 +91,7 @@ private:
|
|||||||
private:
|
private:
|
||||||
CreatureWeakPtr owner_;
|
CreatureWeakPtr owner_;
|
||||||
int revive_coin_ = 0;
|
int revive_coin_ = 0;
|
||||||
|
int match_mode_ = 0;
|
||||||
|
|
||||||
std::shared_ptr<HeroAbility> hero_ability_;
|
std::shared_ptr<HeroAbility> hero_ability_;
|
||||||
std::shared_ptr<WeaponAbility> weapon1_ability_;
|
std::shared_ptr<WeaponAbility> weapon1_ability_;
|
||||||
|
@ -4526,3 +4526,8 @@ void Human::InternalBeKill(int killer_id, const std::string& killer_name, int we
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Human::GetTeamMode()
|
||||||
|
{
|
||||||
|
return GetTeam()->GetMemberNum() <= 1 ? 0 : 1;
|
||||||
|
}
|
||||||
|
@ -169,6 +169,7 @@ class Human : public Creature
|
|||||||
MetaData::Equip* helmet_meta = nullptr;
|
MetaData::Equip* helmet_meta = nullptr;
|
||||||
MetaData::Equip* chest_meta = nullptr;
|
MetaData::Equip* chest_meta = nullptr;
|
||||||
xtimer_list* dead_timer = nullptr;
|
xtimer_list* dead_timer = nullptr;
|
||||||
|
int match_mode = 0;
|
||||||
|
|
||||||
std::string name;
|
std::string name;
|
||||||
std::string avatar_url;
|
std::string avatar_url;
|
||||||
@ -356,6 +357,7 @@ class Human : public Creature
|
|||||||
void AddOxygen(int val);
|
void AddOxygen(int val);
|
||||||
void DecOxygen(int val);
|
void DecOxygen(int val);
|
||||||
void WinPveScore(int score);
|
void WinPveScore(int score);
|
||||||
|
int GetTeamMode();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void _InternalUpdateMove(float speed);
|
void _InternalUpdateMove(float speed);
|
||||||
|
@ -1167,13 +1167,15 @@ void Player::_CMRevive(f8::MsgHdr& hdr, const cs::CMRevive& msg)
|
|||||||
std::string url;
|
std::string url;
|
||||||
JsonDataMgr::Instance()->GetApiUrl(url);
|
JsonDataMgr::Instance()->GetApiUrl(url);
|
||||||
if (url.find('?') != std::string::npos) {
|
if (url.find('?') != std::string::npos) {
|
||||||
url += "&c=Bag&a=decReviveCoin";
|
url += "&c=Battle&a=decReviveCoin";
|
||||||
} else {
|
} else {
|
||||||
url += "?&c=Bag&a=decReviveCoin";
|
url += "?&c=Battle&a=decReviveCoin";
|
||||||
}
|
}
|
||||||
auto url_params = a8::MutableXObject::CreateObject();
|
auto url_params = a8::MutableXObject::CreateObject();
|
||||||
url_params->SetVal("account_id", account_id);
|
url_params->SetVal("account_id", account_id);
|
||||||
url_params->SetVal("session_id", session_id);
|
url_params->SetVal("session_id", session_id);
|
||||||
|
url_params->SetVal("target_id", hum->account_id);
|
||||||
|
url_params->SetVal("num", 1);
|
||||||
HttpProxy::Instance()->HttpGet
|
HttpProxy::Instance()->HttpGet
|
||||||
(
|
(
|
||||||
a8::XParams()
|
a8::XParams()
|
||||||
@ -1193,7 +1195,6 @@ void Player::_CMRevive(f8::MsgHdr& hdr, const cs::CMRevive& msg)
|
|||||||
if (room->IsGameOver()) {
|
if (room->IsGameOver()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
a8::UnSetBitFlag(hum->status, CS_Reviving);
|
|
||||||
if (data.GetType() == a8::XOT_OBJECT &&
|
if (data.GetType() == a8::XOT_OBJECT &&
|
||||||
data.Get("errcode").GetInt() == 0) {
|
data.Get("errcode").GetInt() == 0) {
|
||||||
int revive_coin = data.Get("revive_coin");
|
int revive_coin = data.Get("revive_coin");
|
||||||
@ -1207,6 +1208,7 @@ void Player::_CMRevive(f8::MsgHdr& hdr, const cs::CMRevive& msg)
|
|||||||
[] (const a8::XParams& param)
|
[] (const a8::XParams& param)
|
||||||
{
|
{
|
||||||
Player* hum = (Player*)param.sender.GetUserData();
|
Player* hum = (Player*)param.sender.GetUserData();
|
||||||
|
a8::UnSetBitFlag(hum->status, CS_Reviving);
|
||||||
hum->InternalRevive(param.param1, param.param2);
|
hum->InternalRevive(param.param1, param.param2);
|
||||||
},
|
},
|
||||||
&hum->xtimer_attacher.timer_list_);
|
&hum->xtimer_attacher.timer_list_);
|
||||||
@ -1331,6 +1333,8 @@ void Player::PushJoinRoomMsg()
|
|||||||
notifymsg.set_player_id(GetUniId());
|
notifymsg.set_player_id(GetUniId());
|
||||||
notifymsg.set_started(false);
|
notifymsg.set_started(false);
|
||||||
notifymsg.set_room_uuid(a8::XValue(room->GetRoomUuid()).GetString());
|
notifymsg.set_room_uuid(a8::XValue(room->GetRoomUuid()).GetString());
|
||||||
|
notifymsg.set_team_mode(GetTeamMode());
|
||||||
|
notifymsg.set_match_mode(GetBattleContext()->GetMatchMode());
|
||||||
GGListener::Instance()->SendToClient(socket_handle, 0, notifymsg);
|
GGListener::Instance()->SendToClient(socket_handle, 0, notifymsg);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
a8::XPrintf("PushJoinRooMmsg %d\n", {GetUniId()});
|
a8::XPrintf("PushJoinRooMmsg %d\n", {GetUniId()});
|
||||||
@ -1502,6 +1506,7 @@ void Player::InternalRevive(int target_uniid, int revive_coin)
|
|||||||
|
|
||||||
Human* hum = room->GetHumanByUniId(target_uniid);
|
Human* hum = room->GetHumanByUniId(target_uniid);
|
||||||
if (hum) {
|
if (hum) {
|
||||||
|
++stats.revive;
|
||||||
hum->dead = false;
|
hum->dead = false;
|
||||||
hum->real_dead = false;
|
hum->real_dead = false;
|
||||||
hum->downed = false;
|
hum->downed = false;
|
||||||
|
@ -810,6 +810,8 @@ void RoomMgr::SendGetBattleData(int mode,
|
|||||||
void(std::vector<std::shared_ptr<BattleDataContext>>&)>*)param.param1.GetUserData();
|
void(std::vector<std::shared_ptr<BattleDataContext>>&)>*)param.param1.GetUserData();
|
||||||
|
|
||||||
if (data.GetType() == a8::XOT_OBJECT) {
|
if (data.GetType() == a8::XOT_OBJECT) {
|
||||||
|
int match_mode = data.Get("match_mode");
|
||||||
|
RoomMgr::Instance()->SetMatchMode(match_mode ? 1 : 0);
|
||||||
if (data.HasKey("members")) {
|
if (data.HasKey("members")) {
|
||||||
auto members = data.At("members");
|
auto members = data.At("members");
|
||||||
if (members->GetType() == a8::XOT_ARRAY && members->Size() == (*result->get()).size()) {
|
if (members->GetType() == a8::XOT_ARRAY && members->Size() == (*result->get()).size()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user