98 lines
3.4 KiB
C++
98 lines
3.4 KiB
C++
#pragma once
|
|
|
|
// _NA_005026_20120527_CHAOS_ZONE_BATTLE_GROUND
|
|
#include <atltime.h>
|
|
class GameServerSession;
|
|
class InstanceDungeon;
|
|
struct BattleGroundMemberInfo;
|
|
typedef STLX_VECTOR<BattleGroundMemberInfo*> BattleGroundMemberList;
|
|
|
|
enum MatchinGroupState
|
|
{
|
|
kStateNone = 0,
|
|
kWaitCreateRoom,
|
|
kCreatedRoom,
|
|
kStartBattleGround
|
|
};
|
|
|
|
struct MatchingGroup
|
|
{
|
|
MatchinGroupState matching_state;
|
|
CTime matching_time;
|
|
KEYTYPE group_key;
|
|
BattleGroundMemberList matching_group_list;
|
|
|
|
//
|
|
struct {
|
|
MAPCODE map_code;
|
|
KEYTYPE zone_key;
|
|
};
|
|
};
|
|
|
|
//_NA_007065_20140217_BATTLEGROUND_REFACTORYING
|
|
class BattleGroundMatchingSystem
|
|
{
|
|
public:
|
|
BattleGroundMatchingSystem() {}
|
|
~BattleGroundMatchingSystem() {}
|
|
|
|
void Init();
|
|
void Release();
|
|
void Update();
|
|
|
|
bool ProcessMatching(const MAPCODE map_code); // 매칭 그룹 생성
|
|
bool RemoveMatchigGroup(const KEYTYPE group_key); // 매칭 그룹 제거
|
|
MatchingGroup* FindMatchingGroup(const KEYTYPE group_key); // 매칭 그룹 찾기
|
|
MatchingGroup* FindMatchingGroupByZoneKey(const KEYTYPE zone_key); // 매칭 그룹 찾기
|
|
|
|
bool CreateInstanceRoom(const KEYTYPE group_key, const MAPCODE map_code); // 전장(인스턴트 룸) 생성
|
|
bool OnTeamMatching(MatchingGroup* const matching_group); // team매칭(2차매칭)
|
|
bool SendMembersToBattleGround(MatchingGroup* const matching_group); // 전장(인스턴트 룸)으로 이동
|
|
bool OnCreateParty(MatchingGroup* const matching_group); // 강제 파티 생성
|
|
bool EnterTeam(const BattleGroundMemberList member_list); // GameServer에 팀정보 셋팅
|
|
|
|
bool MatchingGroupCancel(const KEYTYPE group_key); // 매칭 취소
|
|
bool ReturnUserInsertStandbyGroupList(MatchingGroup* const matching_group); // 전장 대기열로 이동
|
|
bool RemoveMemberMatchingGroup(const BattleGroundMemberInfo* member); // 매칭그룹내 멤버 제거
|
|
|
|
//bool CheckMatching(const MAPCODE map_code); //매칭 확인
|
|
|
|
#ifdef _NA_008679_20160202_REWORK_BATTLEGROUND
|
|
BOOL StartBattleGround();
|
|
|
|
private:
|
|
BOOL _ProcessMatching(const MAPCODE map_code,BattleGroundMemberList* member_list); // 매칭(1차매칭)
|
|
|
|
BOOL _CreateMatchingGroups(const MAPCODE& map_code, BattleGroundMemberList* member_list);
|
|
BOOL _CreateFailedGroup(const MAPCODE& map_code, const BattleGroundMemberList* member_list);
|
|
VOID _RequestMismatchingReward();
|
|
#else
|
|
bool CanCreateMatchingGroup(const MAPCODE map_code); // 매칭 조건 확인
|
|
private:
|
|
MatchingGroup* _ProcessMatching(const MAPCODE map_code,const BattleGroundMemberList* member_list); // 매칭(1차매칭)
|
|
#endif //_NA_008679_20160202_REWORK_BATTLEGROUND
|
|
|
|
VOID _CreateBattlegroundParty(InstanceDungeon* instance_dungeon, BattleGroundMemberList& team_list);
|
|
private:
|
|
inline KEYTYPE _AllocKey()
|
|
{
|
|
return static_cast<KEYTYPE>(ObjKeyGender::Instance()->GetKey(OBJKEYTYPE_BATTLE_GROUND_ROOM_KEY));
|
|
}
|
|
inline void _FreeKey(KEYTYPE Key)
|
|
{
|
|
ObjKeyGender::Instance()->RestoreKey(OBJKEYTYPE_BATTLE_GROUND_ROOM_KEY, Key);
|
|
}
|
|
|
|
private:
|
|
typedef STLX_HASH_MAP<KEYTYPE,MatchingGroup*> MatchingGroupMap;
|
|
typedef util::CMemoryPoolFactory<MatchingGroup> MatchingGroupPool;
|
|
|
|
private:
|
|
MatchingGroupPool* matching_group_pool_;
|
|
MatchingGroupMap matching_groups_map_; // 매칭 그룹 리스트
|
|
#ifdef _NA_008679_20160202_REWORK_BATTLEGROUND
|
|
BattleGroundMemberList failed_members_list_; // 매칭 실패한 멤버들의 그룹
|
|
#endif //_NA_008679_20160202_REWORK_BATTLEGROUND
|
|
ITimerBase update_timer_;
|
|
|
|
}; |