1
This commit is contained in:
parent
d69810c96c
commit
c2d8811b73
0
server/gameserver/mobabattle.cc
Normal file
0
server/gameserver/mobabattle.cc
Normal file
43
server/gameserver/mobabattle.h
Normal file
43
server/gameserver/mobabattle.h
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
class Room;
|
||||||
|
class MobaTeam;
|
||||||
|
class MobaMember;
|
||||||
|
class MobaBattle
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
void Init();
|
||||||
|
void UnInit();
|
||||||
|
|
||||||
|
bool GetParseOk() { return parse_ok_; }
|
||||||
|
Room* GetRoom() { return room_; }
|
||||||
|
void SetRoom(Room* room) { room_ = room; }
|
||||||
|
const std::string& GetRoomUuid() { return room_uuid_; }
|
||||||
|
const std::string& GetSign() { return sign_; }
|
||||||
|
const std::shared_ptr<a8::XObject>& GetRawData() { return raw_data_; }
|
||||||
|
int GetZoneId() { return zone_id_; }
|
||||||
|
int GetNodeId() { return zone_id_; }
|
||||||
|
int GetStartTime() { return start_time_; }
|
||||||
|
void ParseResult(a8::XObject& obj);
|
||||||
|
bool CanAdd(const std::string& account_id, const std::string& session_id);
|
||||||
|
std::shared_ptr<MobaTeam> GetTeamByAccountId(const std::string& account_id);
|
||||||
|
std::shared_ptr<MobaMember> GetMemberByAccountId(const std::string& account_id);
|
||||||
|
std::shared_ptr<MobaTeam> GetTeamByTeamUuid(const std::string& team_uuid);
|
||||||
|
bool AllIsJoined();
|
||||||
|
int GetMemberNum();
|
||||||
|
void TraverseMemberList(std::function<bool (MobaMember*)> func);
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool parse_ok_ = false;
|
||||||
|
Room *room_ = nullptr;
|
||||||
|
std::string room_uuid_;
|
||||||
|
int zone_id_ = 0;
|
||||||
|
int node_id_ = 0;
|
||||||
|
int start_time_ = 0;
|
||||||
|
std::string sign_;
|
||||||
|
std::shared_ptr<a8::XObject> raw_data_;
|
||||||
|
std::map<std::string, std::shared_ptr<MobaTeam>> uuid_hash_;
|
||||||
|
std::map<std::string, std::shared_ptr<MobaTeam>> account_hash_;
|
||||||
|
std::map<std::string, std::shared_ptr<MobaMember>> member_id_hash_;
|
||||||
|
};
|
@ -1158,8 +1158,13 @@ void RoomMgr::_CMJoinMoba(f8::MsgHdr* hdr, const cs::CMJoin& msg)
|
|||||||
auto socket_handle = hdr->socket_handle;
|
auto socket_handle = hdr->socket_handle;
|
||||||
auto cb =
|
auto cb =
|
||||||
[join_msg, ip_saddr, socket_handle]
|
[join_msg, ip_saddr, socket_handle]
|
||||||
(int errcode, const std::string errmsg, std::shared_ptr<MobaTeam> p)
|
(int errcode, const std::string errmsg, std::shared_ptr<MobaBattle> p)
|
||||||
{
|
{
|
||||||
|
auto& msg = *join_msg;
|
||||||
|
if (errcode) {
|
||||||
|
RoomMgr::Instance()->JoinErrorHandle(*join_msg, 2, socket_handle);
|
||||||
|
return;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
SendGetMobaBattleData(join_msg, cb);
|
SendGetMobaBattleData(join_msg, cb);
|
||||||
}
|
}
|
||||||
@ -1194,7 +1199,7 @@ void RoomMgr::DispatchSpecRoom(f8::MsgHdr* hdr, const cs::CMJoin& msg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void RoomMgr::SendGetMobaBattleData(std::shared_ptr<cs::CMJoin> join_msg,
|
void RoomMgr::SendGetMobaBattleData(std::shared_ptr<cs::CMJoin> join_msg,
|
||||||
std::function<void(int, const std::string, std::shared_ptr<MobaTeam>)> cb)
|
std::function<void(int, const std::string, std::shared_ptr<MobaBattle>)> cb)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ class MapService;
|
|||||||
class MapInstance;
|
class MapInstance;
|
||||||
class Building;
|
class Building;
|
||||||
class CustomBattle;
|
class CustomBattle;
|
||||||
class MobaTeam;
|
class MobaBattle;
|
||||||
struct RoomInitInfo
|
struct RoomInitInfo
|
||||||
{
|
{
|
||||||
int room_idx = 0;
|
int room_idx = 0;
|
||||||
@ -126,7 +126,7 @@ class RoomMgr : public a8::Singleton<RoomMgr>
|
|||||||
void SendGetCustomBattleData(std::shared_ptr<cs::CMJoin> join_msg,
|
void SendGetCustomBattleData(std::shared_ptr<cs::CMJoin> join_msg,
|
||||||
std::function<void(int, const std::string, std::shared_ptr<CustomBattle>)> cb);
|
std::function<void(int, const std::string, std::shared_ptr<CustomBattle>)> cb);
|
||||||
void SendGetMobaBattleData(std::shared_ptr<cs::CMJoin> join_msg,
|
void SendGetMobaBattleData(std::shared_ptr<cs::CMJoin> join_msg,
|
||||||
std::function<void(int, const std::string, std::shared_ptr<MobaTeam>)> cb);
|
std::function<void(int, const std::string, std::shared_ptr<MobaBattle>)> cb);
|
||||||
void DispatchSpecRoom(f8::MsgHdr* hdr, const cs::CMJoin& msg);
|
void DispatchSpecRoom(f8::MsgHdr* hdr, const cs::CMJoin& msg);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -142,4 +142,6 @@ class RoomMgr : public a8::Singleton<RoomMgr>
|
|||||||
std::map<std::string, std::map<std::string, std::string>> team_room_hash_;
|
std::map<std::string, std::map<std::string, std::string>> team_room_hash_;
|
||||||
std::map<std::string, std::shared_ptr<CustomBattle>> custom_room_hash_;
|
std::map<std::string, std::shared_ptr<CustomBattle>> custom_room_hash_;
|
||||||
std::map<std::string, std::shared_ptr<CustomBattle>> his_custom_room_hash_;
|
std::map<std::string, std::shared_ptr<CustomBattle>> his_custom_room_hash_;
|
||||||
|
std::map<std::string, std::shared_ptr<MobaBattle>> moba_room_hash_;
|
||||||
|
std::map<std::string, std::shared_ptr<MobaBattle>> his_moba_room_hash_;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user