338 lines
8.1 KiB
C++
338 lines
8.1 KiB
C++
|
|
|
|
#include "stdafx.h"
|
|
#include "SUIAuthorityChecker.h"
|
|
#include "SMessengerMgr.h"
|
|
#include "SUIPartyTypes.h"
|
|
#include "SPlayerInfoMgr.h"
|
|
#include <mmo/ArType.h>
|
|
#include "SNetMessage.h"
|
|
#include "Arena\\ArenaSystem.h"
|
|
#include "SGameSystem.h"
|
|
|
|
extern SGameSystem* g_pCurrentGameSystem;
|
|
|
|
void sAuthorityList::set(bool is)
|
|
{
|
|
m_whisper = is;
|
|
m_friend = (is) ? 1 : 0; /// is = true일 때, 친구 추가로 설정해 준다
|
|
m_block = (is) ? 1 : 0; /// is = true일 때, 차단 추가로 설정해 준다
|
|
m_trade = is;
|
|
m_challenge = is;
|
|
m_invite = is;
|
|
m_kick = is;
|
|
m_leave = is;
|
|
m_dismiss = is;
|
|
m_takeOver = is;
|
|
m_follow = is;
|
|
m_reportDive = is;
|
|
m_itemPrivateDistribution = is;
|
|
m_itemRandomDistribution = is;
|
|
m_itemOrderDistribution = is;
|
|
}
|
|
|
|
void checkAuthority(sAuthorityList& authorityList,
|
|
CPartyListMgr* partyMgr,
|
|
SRaidMgr* raidMgr,
|
|
SFriendMgr* friendMgr,
|
|
SCutMgr* cutMgr,
|
|
SPlayerInfoMgr* playerMgr,
|
|
bool targetLogin)
|
|
{
|
|
checkAuthority(authorityList, partyMgr, raidMgr, friendMgr, cutMgr, playerMgr, playerMgr->GetTargetName(), targetLogin);
|
|
}
|
|
|
|
void checkAuthority(sAuthorityList& authorityList,
|
|
CPartyListMgr* partyMgr,
|
|
SRaidMgr* raidMgr,
|
|
SFriendMgr* friendMgr,
|
|
SCutMgr* cutMgr,
|
|
SPlayerInfoMgr* playerMgr,
|
|
char const* _targetName,
|
|
bool targetLogin)
|
|
{
|
|
authorityList.set(false);
|
|
|
|
std::string localName = g_pCurrentGameSystem->getLocalPlayerName();
|
|
std::string targetName = _targetName;
|
|
bool targetIsMe = (localName == targetName);
|
|
|
|
/// 타겟이 플레이어가 아니면 무시한다
|
|
if (playerMgr->GetTarget() && playerMgr->GetGameObjType() != TS_ENTER::GAME_PLAYER)
|
|
targetName.clear();
|
|
|
|
bool isParty = partyMgr->IsExist();
|
|
int partyType = partyMgr->GetPartyType();
|
|
|
|
bool targetIsMyPartyMember = false;
|
|
|
|
/// 파티 중일 때
|
|
if (isParty)
|
|
{
|
|
/// 자신이 파티장인지 체크
|
|
bool localIsPartyLeader = partyMgr->IsLeader();
|
|
/// 타겟이 자신의 전체 파티 멤버인지 체크
|
|
bool targetIsAllPartyMember = partyMgr->IsExistMember(targetName.c_str());
|
|
/// 자신이 속한 파티
|
|
SPartyMgr* localPartyMgr = partyMgr->FindPartyByPlayerName(&localName);
|
|
if (!localPartyMgr)
|
|
return ;
|
|
/// 타겟이 자신이 속한 파티 멤버인지 체크
|
|
std::string localPartyName = localPartyMgr->GetPartyName();
|
|
targetIsMyPartyMember = partyMgr->IsExistMember(targetName.c_str(), &localPartyName);
|
|
/// 레이드/시즈 파티인지 체크
|
|
bool attackUnitParty = false;
|
|
/// 일반 아레나 경기는 해당 안된다
|
|
if (PARTY_DUNGEON_RAID == partyType ||
|
|
PARTY_SIEGE == partyType ||
|
|
PARTY_SIEGE_OTHER == partyType ||
|
|
(PARTY_ARENA == partyType && g_pCurrentGameSystem->isArenaExercise()))
|
|
attackUnitParty = true;
|
|
|
|
/// 공대장 인지체크
|
|
bool localIsAttackUnitLeader = (localPartyMgr->GetPartyID() == raidMgr->GetMainPartyID()) ? true : false;
|
|
/// 타겟이 파티장인지 체크
|
|
SPartyMgr* targetPartyMgr = partyMgr->FindPartyByPlayerName(&targetName);
|
|
bool targetIsPartyLeader = false;
|
|
if (targetPartyMgr)
|
|
targetIsPartyLeader = (::strcmp(targetPartyMgr->GetPartyLeaderName(), targetName.c_str()) == 0);
|
|
|
|
if (targetLogin)
|
|
{
|
|
/// 타겟이 파티 멤버 일 때
|
|
if (targetIsAllPartyMember)
|
|
{
|
|
/// 레이드/시즈 파티 일 때
|
|
if (attackUnitParty)
|
|
{
|
|
/// 자신이 파티장일 때
|
|
if (localIsPartyLeader)
|
|
{
|
|
authorityList.m_dismiss = true;
|
|
|
|
/// 자신이 공대장 일 때
|
|
if (localIsAttackUnitLeader)
|
|
{
|
|
/// 타겟이 공대 파티장 일 때
|
|
if (targetIsPartyLeader)
|
|
{
|
|
}
|
|
else
|
|
{
|
|
/// 타겟이 자신의 파티 멤버일 때
|
|
if (targetIsMyPartyMember)
|
|
{
|
|
authorityList.m_kick = true;
|
|
}
|
|
else
|
|
{
|
|
if (targetName.empty())
|
|
authorityList.m_kick = true;
|
|
}
|
|
}
|
|
}
|
|
/// 자신이 공대 파티장일 때
|
|
else
|
|
{
|
|
/// 타겟이 공대장 일 때
|
|
if (targetIsPartyLeader)
|
|
{
|
|
}
|
|
else
|
|
{
|
|
if (targetIsMyPartyMember)
|
|
{
|
|
authorityList.m_kick = true;
|
|
}
|
|
else
|
|
{
|
|
authorityList.m_invite = true;
|
|
if (targetName.empty())
|
|
authorityList.m_kick = true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
//// 자신이 파티장이 아닐 때
|
|
else
|
|
{
|
|
}
|
|
}
|
|
/// 일반 파티 일 때
|
|
else
|
|
{
|
|
/// 자신이 파티장 일 때
|
|
if (localIsPartyLeader)
|
|
{
|
|
authorityList.m_dismiss = true;
|
|
|
|
if (targetIsMyPartyMember)
|
|
{
|
|
authorityList.m_kick = true;
|
|
authorityList.m_takeOver = true;
|
|
}
|
|
else
|
|
{
|
|
authorityList.m_invite = true;
|
|
if (targetName.empty())
|
|
{
|
|
authorityList.m_kick = true;
|
|
authorityList.m_takeOver = true;
|
|
}
|
|
}
|
|
}
|
|
/// 자신이 파티장이 아닐 때
|
|
else
|
|
{
|
|
}
|
|
}
|
|
}
|
|
/// 타겟이 파티 멤버가 아닐 때
|
|
else
|
|
{
|
|
/// 레이드/시즈 파티 일 때
|
|
if (attackUnitParty)
|
|
{
|
|
/// 자신이 파티장일 때
|
|
if (localIsPartyLeader)
|
|
{
|
|
authorityList.m_dismiss = true;
|
|
authorityList.m_invite = true;
|
|
if (targetName.empty())
|
|
{
|
|
authorityList.m_kick = true;
|
|
}
|
|
/// 자신이 공대장 일 때
|
|
if (localIsAttackUnitLeader)
|
|
{
|
|
}
|
|
else
|
|
{
|
|
}
|
|
}
|
|
else
|
|
{
|
|
}
|
|
}
|
|
/// 일반 파티 일 때
|
|
else
|
|
{
|
|
/// 자신이 파티장일 때
|
|
if (localIsPartyLeader)
|
|
{
|
|
authorityList.m_dismiss = true;
|
|
authorityList.m_invite = true;
|
|
if (targetName.empty())
|
|
{
|
|
authorityList.m_kick = true;
|
|
authorityList.m_takeOver = true;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
}
|
|
}
|
|
}
|
|
}
|
|
/// 타겟이 로그 오프 일 때
|
|
else
|
|
{
|
|
if (localIsPartyLeader && targetIsMyPartyMember)
|
|
authorityList.m_kick = true;
|
|
}
|
|
|
|
if (!localIsPartyLeader)
|
|
authorityList.m_leave = true;
|
|
}
|
|
/// 파티중이 아닐 때
|
|
else
|
|
{
|
|
}
|
|
|
|
if (targetIsMe)
|
|
{
|
|
authorityList.m_invite = false;
|
|
authorityList.m_kick = false;
|
|
authorityList.m_takeOver = false;
|
|
}
|
|
|
|
if (!targetIsMe && !targetName.empty())
|
|
{
|
|
if (targetLogin)
|
|
{
|
|
/// 귓말
|
|
authorityList.m_whisper = true;
|
|
/// 따라가기
|
|
authorityList.m_follow = true;
|
|
/// 대전
|
|
authorityList.m_challenge = true;
|
|
/// 거래
|
|
authorityList.m_trade = true;
|
|
}
|
|
/// add friend
|
|
if (friendMgr->IsExistMember(targetName.c_str()))
|
|
{
|
|
authorityList.m_friend = 2; /// 친구 삭제
|
|
}
|
|
else
|
|
{
|
|
authorityList.m_friend = 1; /// 친구 추가
|
|
}
|
|
/// block
|
|
if (cutMgr->IsExistMember(targetName.c_str()))
|
|
{
|
|
authorityList.m_block = 2; /// 차단 해제
|
|
}
|
|
else
|
|
{
|
|
authorityList.m_block = 1; /// 차단 추가
|
|
}
|
|
}
|
|
|
|
/// 아레나 에서는 분배 방식 비 활성화
|
|
if (g_pCurrentGameSystem->isInArena() || PARTY_ARENA == partyType)
|
|
{
|
|
/// 테스트로 우선 모든 곳에서 가능하게
|
|
//if (g_pCurrentGameSystem->isInArena() && targetIsMyPartyMember)
|
|
if (!targetIsMe && targetIsMyPartyMember)
|
|
authorityList.m_reportDive = true;
|
|
|
|
authorityList.m_itemPrivateDistribution = false;
|
|
authorityList.m_itemRandomDistribution = false;
|
|
authorityList.m_itemOrderDistribution = false;
|
|
|
|
authorityList.m_trade = false;
|
|
authorityList.m_challenge = false;
|
|
authorityList.m_dismiss = false;
|
|
authorityList.m_leave = false;
|
|
|
|
if (g_pCurrentGameSystem->isInArena() || !g_pCurrentGameSystem->isArenaExercise())
|
|
{
|
|
authorityList.m_kick = false;
|
|
authorityList.m_invite = false;
|
|
authorityList.m_takeOver = false;
|
|
}
|
|
else if (g_pCurrentGameSystem->isArenaExercise())
|
|
{
|
|
///레뒤 상태면 초대는 불가
|
|
sArenaSystem* arenaSystem = g_pCurrentGameSystem->getArenaSystem();
|
|
int myTeam = arenaSystem->getMyTeam();
|
|
if (arenaSystem->isReady(myTeam))
|
|
{
|
|
authorityList.m_invite = false;
|
|
}
|
|
if (partyMgr->IsLeader())
|
|
authorityList.m_takeOver = true;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (partyMgr->IsLeader())
|
|
{
|
|
/// 아이템 분배 방식
|
|
authorityList.m_itemPrivateDistribution = true;
|
|
authorityList.m_itemRandomDistribution = true;
|
|
authorityList.m_itemOrderDistribution = true;
|
|
}
|
|
}
|
|
} |