초기커밋
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
using Google.Protobuf;
|
||||
using Google.Protobuf.WellKnownTypes;
|
||||
|
||||
|
||||
using ServerCore;
|
||||
using ServerBase;
|
||||
using ServerCommon;
|
||||
using ServerCommon.BusinessLogDomain;
|
||||
using MetaAssets;
|
||||
|
||||
|
||||
namespace GameServer;
|
||||
|
||||
public class NotifyBanPartyMemberHandler
|
||||
{
|
||||
public async Task recvBanPartyMember(ServerMessage.Types.BanPartyNoti notify)
|
||||
{
|
||||
var player_manager = GameServerApp.getServerLogic().getPlayerManager();
|
||||
if (!player_manager.tryGetUserByPrimaryKey(notify.BanMemberGuid, out var player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var personal_party_action = player.getEntityAction<PersonalPartyAction>();
|
||||
ArgumentNullException.ThrowIfNull(personal_party_action);
|
||||
|
||||
// 1. 파티 정보 체크
|
||||
if (notify.PartyGuid != personal_party_action.getPersonalParty()?.getPartyGuid())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// 2. 파티 정보 정리
|
||||
await personal_party_action.clearPersonalParty();
|
||||
|
||||
// 3. 밴 알림
|
||||
var message = new ClientToGame();
|
||||
message.Message = new();
|
||||
message.Message.NtfBanParty = new();
|
||||
|
||||
PartyHelper.sendToClient(message, player.getHostId());
|
||||
await QuestManager.It.QuestCheck(player, new QuestParty(EQuestEventTargetType.PARTY, EQuestEventNameType.EXITED));
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
using Google.Protobuf;
|
||||
using Google.Protobuf.WellKnownTypes;
|
||||
|
||||
|
||||
using ServerCore;
|
||||
using ServerBase;
|
||||
using ServerCommon;
|
||||
using ServerCommon.BusinessLogDomain;
|
||||
using MetaAssets;
|
||||
|
||||
|
||||
|
||||
namespace GameServer;
|
||||
|
||||
public class NotifyCancelSummonHandler
|
||||
{
|
||||
public async Task recvCancelSummonHandler(ServerMessage.Types.CancelSummonPartyMemberNoti notify)
|
||||
{
|
||||
var global_party = GameServerApp.getServerLogic().findGlobalEntity<GlobalParty>();
|
||||
NullReferenceCheckHelper.throwIfNull(global_party, () => $"global_party is null !!!");
|
||||
var global_party_action = global_party.getEntityAction<GlobalPartyAction>();
|
||||
NullReferenceCheckHelper.throwIfNull(global_party_action, () => $"global_party_action is null !!!");
|
||||
|
||||
// 1. 파티 정보 조회
|
||||
var party = global_party_action.getGlobalPartyDetail(notify.PartyGuid);
|
||||
if (null == party) return;
|
||||
|
||||
// 2. Member 정보 수정
|
||||
var party_member_attribute = party.getEntityAttribute<PartyMemberAttribute>();
|
||||
NullReferenceCheckHelper.throwIfNull(party_member_attribute, () => $"party_member_attribute is null !!!");
|
||||
foreach (var cancel_member in notify.CancelSummonUserGuids)
|
||||
{
|
||||
if (!party_member_attribute.getPartyMembers().TryGetValue(cancel_member, out var member)) continue;
|
||||
member.Summon.clear();
|
||||
|
||||
// 2-2.cache 수정
|
||||
var member_action = party.getEntityAction<GlobalPartyDetailMemberAction>();
|
||||
NullReferenceCheckHelper.throwIfNull(member_action, () => $"member_action is null !!!");
|
||||
_ = await member_action.changeMember(member);
|
||||
}
|
||||
|
||||
// 3. 해당 멤버 전송
|
||||
var client_message = new ClientToGame
|
||||
{
|
||||
Message = new ClientToGameMessage
|
||||
{
|
||||
NtfCancelSummonPartyMember = new()
|
||||
}
|
||||
};
|
||||
|
||||
var player_manger = GameServerApp.getServerLogic().getPlayerManager();
|
||||
ArgumentNullException.ThrowIfNull(player_manger);
|
||||
foreach (var notify_user in notify.CancelSummonUserGuids)
|
||||
{
|
||||
if (!player_manger.tryGetUserByPrimaryKey(notify_user, out var player)) continue;
|
||||
|
||||
PartyHelper.sendToClient(client_message, player.getHostId());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
using Google.Protobuf;
|
||||
using Google.Protobuf.WellKnownTypes;
|
||||
|
||||
|
||||
using ServerCore;
|
||||
using ServerBase;
|
||||
using ServerCommon;
|
||||
using ServerCommon.BusinessLogDomain;
|
||||
using MetaAssets;
|
||||
|
||||
|
||||
|
||||
using USER_GUID = System.String;
|
||||
|
||||
|
||||
namespace GameServer;
|
||||
|
||||
public class NotifyChangePartyLeaderGuidHandler
|
||||
{
|
||||
public async Task recvChangePartyLeaderGuid(ServerMessage.Types.ChangePartyLeaderNoti notify)
|
||||
{
|
||||
// 1. party 정보 조회
|
||||
var global_party = GameServerApp.getServerLogic().findGlobalEntity<GlobalParty>();
|
||||
ArgumentNullException.ThrowIfNull(global_party);
|
||||
|
||||
var party = global_party.getParty(notify.PartyGuid);
|
||||
if (null == party) return;
|
||||
|
||||
// 2. 파티 리더 정보 수정
|
||||
var party_detail_info_action = party.getEntityAction<GlobalPartyDetailInfoAction>();
|
||||
ArgumentNullException.ThrowIfNull(party_detail_info_action);
|
||||
|
||||
var result = await party_detail_info_action.changePartyLeader(notify.NewPartyLeaderGuid, false);
|
||||
if (result.isFail()) return;
|
||||
|
||||
// 3. client 통보
|
||||
var message = new ClientToGame
|
||||
{
|
||||
Message = new()
|
||||
{
|
||||
ChangePartyLeaderNoti = new()
|
||||
{
|
||||
NewPartyLeaderGuid = notify.NewPartyLeaderGuid
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
PartyHelper.BroadcastToClients(party, message, new List<USER_GUID>());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
using Google.Protobuf;
|
||||
using Google.Protobuf.WellKnownTypes;
|
||||
|
||||
|
||||
using ServerCore;
|
||||
using ServerBase;
|
||||
using ServerCommon;
|
||||
using ServerCommon.BusinessLogDomain;
|
||||
using MetaAssets;
|
||||
|
||||
|
||||
namespace GameServer;
|
||||
|
||||
public class NotifyChangePartyMemberMarker
|
||||
{
|
||||
public async Task recvChangePartyMemberMarkerHandler(ServerMessage.Types.ExchangePartyMemberMarkNoti notify)
|
||||
{
|
||||
var global_party = GameServerApp.getServerLogic().findGlobalEntity<GlobalParty>();
|
||||
ArgumentNullException.ThrowIfNull(global_party);
|
||||
|
||||
var party = global_party.getParty(notify.PartyGuid);
|
||||
ArgumentNullException.ThrowIfNull(party);
|
||||
|
||||
var party_member_action = party.getEntityAction<GlobalPartyDetailMemberAction>();
|
||||
ArgumentNullException.ThrowIfNull(party_member_action);
|
||||
|
||||
// 1. 파티원 마커 변경
|
||||
var result = await party_member_action.changeMemberMaker(notify.MemberUserGuid, notify.MarkId, false);
|
||||
if (result.isFail()) return;
|
||||
|
||||
// 2. 변경 알림
|
||||
var client_message = new ClientToGame()
|
||||
{
|
||||
Message = new()
|
||||
{
|
||||
ExchangePartyMemberMarkNoti = new()
|
||||
{
|
||||
MarkId = notify.MarkId,
|
||||
MemberUserGuid = notify.MemberUserGuid
|
||||
}
|
||||
}
|
||||
};
|
||||
PartyHelper.BroadcastToClients(party, client_message, new List<string>());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
using Google.Protobuf;
|
||||
using Google.Protobuf.WellKnownTypes;
|
||||
|
||||
|
||||
using ServerCore;
|
||||
using ServerBase;
|
||||
using ServerCommon;
|
||||
using ServerCommon.BusinessLogDomain;
|
||||
using MetaAssets;
|
||||
|
||||
|
||||
using USER_GUID = System.String;
|
||||
|
||||
|
||||
namespace GameServer;
|
||||
|
||||
public class NotifyChangePartyNameHandler
|
||||
{
|
||||
public async Task recvChangePartyNameHandler(ServerMessage.Types.ExchangePartyNameNoti notify)
|
||||
{
|
||||
var global_party = GameServerApp.getServerLogic().findGlobalEntity<GlobalParty>();
|
||||
ArgumentNullException.ThrowIfNull(global_party);
|
||||
|
||||
var party = global_party.getParty(notify.PartyGuid);
|
||||
ArgumentNullException.ThrowIfNull(party);
|
||||
|
||||
var party_info_action = party.getEntityAction<GlobalPartyDetailInfoAction>();
|
||||
ArgumentNullException.ThrowIfNull(party_info_action);
|
||||
|
||||
// 1. 파티명 변경
|
||||
var result = await party_info_action.changePartyName(notify.NewPartyName, false);
|
||||
if (result.isFail()) return;
|
||||
|
||||
// 2. 파티명 변경 알림
|
||||
var message = new ClientToGame()
|
||||
{
|
||||
Message = new()
|
||||
{
|
||||
ExchangePartyNameNoti = new()
|
||||
{
|
||||
NewPartyName = notify.NewPartyName
|
||||
}
|
||||
}
|
||||
};
|
||||
PartyHelper.BroadcastToClients(party, message, new List<USER_GUID>());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
using Google.Protobuf;
|
||||
using Google.Protobuf.WellKnownTypes;
|
||||
|
||||
|
||||
using ServerCore;
|
||||
using ServerBase;
|
||||
using ServerCommon;
|
||||
using ServerCommon.BusinessLogDomain;
|
||||
using MetaAssets;
|
||||
|
||||
|
||||
namespace GameServer;
|
||||
|
||||
public class NotifyChangePartyServerHandler
|
||||
{
|
||||
public async Task recvChangePartyServer(ServerMessage.Types.ChangePartyServerNameNoti notify)
|
||||
{
|
||||
var global_party = GameServerApp.getServerLogic().findGlobalEntity<GlobalParty>();
|
||||
ArgumentNullException.ThrowIfNull(global_party);
|
||||
|
||||
var party = global_party.getParty(notify.PartyGuid);
|
||||
ArgumentNullException.ThrowIfNull(party);
|
||||
|
||||
var server_action = party.getEntityAction<GlobalPartyDetailServerAction>();
|
||||
ArgumentNullException.ThrowIfNull(server_action);
|
||||
|
||||
if (notify.IsAddition == BoolType.True)
|
||||
{
|
||||
await server_action.addPartyServer(notify.ServerName);
|
||||
}
|
||||
else
|
||||
{
|
||||
await server_action.deletePartyServer(notify.ServerName);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
using Google.Protobuf;
|
||||
using Google.Protobuf.WellKnownTypes;
|
||||
|
||||
|
||||
using ServerCore;
|
||||
using ServerBase;
|
||||
using ServerCommon;
|
||||
using ServerCommon.BusinessLogDomain;
|
||||
using MetaAssets;
|
||||
|
||||
|
||||
namespace GameServer;
|
||||
|
||||
public class NotifyClearPartySummonHandler
|
||||
{
|
||||
public async Task recvClearPartySummon(ServerMessage.Types.GS2GS_NTF_CLEAR_PARTY_SUMMON notify)
|
||||
{
|
||||
var server_logic = GameServerApp.getServerLogic();
|
||||
ArgumentNullException.ThrowIfNull(server_logic);
|
||||
|
||||
var global_party = server_logic.findGlobalEntity<GlobalParty>();
|
||||
ArgumentNullException.ThrowIfNull(global_party);
|
||||
|
||||
var party = global_party.getParty(notify.PartyGuid);
|
||||
if (null == party) return;
|
||||
|
||||
var party_member_action = party.getEntityAction<GlobalPartyDetailMemberAction>();
|
||||
ArgumentNullException.ThrowIfNull(party_member_action);
|
||||
|
||||
_ = await party_member_action.clearSummonMemberAsync(notify.MemberUserGuid, false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
using Google.Protobuf;
|
||||
using Google.Protobuf.WellKnownTypes;
|
||||
|
||||
|
||||
using ServerCore;
|
||||
using ServerBase;
|
||||
using ServerCommon;
|
||||
using ServerCommon.BusinessLogDomain;
|
||||
using MetaAssets;
|
||||
|
||||
|
||||
|
||||
namespace GameServer;
|
||||
|
||||
public class NotifyDeletePartyInviteSendHandler
|
||||
{
|
||||
public async Task recvDeletePartyInviteSend(ServerMessage.Types.GS2GS_NTF_DELETE_PARTY_INVITE_SEND notify)
|
||||
{
|
||||
var result = new Result();
|
||||
|
||||
// 1. party 체크
|
||||
var global_party = GameServerApp.getServerLogic().findGlobalEntity<GlobalParty>();
|
||||
ArgumentNullException.ThrowIfNull(global_party);
|
||||
|
||||
var party = global_party.getParty(notify.PartyGuid);
|
||||
ArgumentNullException.ThrowIfNull(party);
|
||||
|
||||
// 2. send list 삭제
|
||||
var party_send_action = party.getEntityAction<GlobalPartyInvitePartySendAction>();
|
||||
ArgumentNullException.ThrowIfNull(party_send_action);
|
||||
result = await party_send_action.deleteInvitePartySend(notify.InviteUserGuid);
|
||||
if (result.isFail())
|
||||
{
|
||||
Log.getLogger().error(result.toBasicString());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
using Google.Protobuf;
|
||||
using Google.Protobuf.WellKnownTypes;
|
||||
|
||||
|
||||
using ServerCore;
|
||||
using ServerBase;
|
||||
using ServerCommon;
|
||||
using ServerCommon.BusinessLogDomain;
|
||||
using MetaAssets;
|
||||
|
||||
|
||||
namespace GameServer;
|
||||
|
||||
public class NotifyDestroyPartyHandler
|
||||
{
|
||||
public async Task recvDestroyParty(ServerMessage.Types.GS2C_NTF_DESTROY_PARTY notify)
|
||||
{
|
||||
// 1. 파티 조회
|
||||
var global_party = GameServerApp.getServerLogic().findGlobalEntity<GlobalParty>();
|
||||
ArgumentNullException.ThrowIfNull(global_party);
|
||||
|
||||
var global_party_action = global_party.getEntityAction<GlobalPartyAction>();
|
||||
ArgumentNullException.ThrowIfNull(global_party_action);
|
||||
|
||||
// 2. 파티 제거
|
||||
await global_party_action.destroyParty(notify.DestroyPartyGuid, false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
using Google.Protobuf;
|
||||
using Google.Protobuf.WellKnownTypes;
|
||||
|
||||
|
||||
using ServerCore;
|
||||
using ServerBase;
|
||||
using ServerCommon;
|
||||
using ServerCommon.BusinessLogDomain;
|
||||
using MetaAssets;
|
||||
|
||||
|
||||
namespace GameServer;
|
||||
|
||||
public class NotifyInvitePartyRecvResultHandler
|
||||
{
|
||||
public async Task recvInvitePartyRecvResult(ServerMessage.Types.GS2C_NTF_PARTY_INVITE_RESULT notify)
|
||||
{
|
||||
// 0. client login 체크
|
||||
var player_manager = GameServerApp.getServerLogic().getPlayerManager();
|
||||
ArgumentNullException.ThrowIfNull(player_manager);
|
||||
|
||||
if (!player_manager.tryGetUserByPrimaryKey(notify.InviteHostGuid, out var player))
|
||||
{
|
||||
Log.getLogger().error($"Failed to get recv user !! - {notify.InviteUserGuid} / {nameof(recvInvitePartyRecvResult)}");
|
||||
return;
|
||||
}
|
||||
|
||||
ArgumentNullException.ThrowIfNull(player);
|
||||
|
||||
// 1. client 에 파티초대 결과 전송
|
||||
var message = new ClientToGame
|
||||
{
|
||||
Message = new()
|
||||
{
|
||||
InvitePartyResult = new()
|
||||
{
|
||||
ErrorCode = notify.ErrorCode,
|
||||
InviteUserGuid = notify.InviteUserGuid
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
GameServerApp.getServerLogic().onSendPacket(player, message);
|
||||
|
||||
if (notify.ErrorCode == ServerErrorCode.Success) return;
|
||||
|
||||
// 2. 실패시 send list 삭제
|
||||
var global_party = GameServerApp.getServerLogic().findGlobalEntity<GlobalParty>();
|
||||
ArgumentNullException.ThrowIfNull(global_party);
|
||||
|
||||
var party = global_party.getParty(notify.InvitePartyGuid);
|
||||
ArgumentNullException.ThrowIfNull(party);
|
||||
|
||||
var party_send_action = party.getEntityAction<GlobalPartyInvitePartySendAction>();
|
||||
NullReferenceCheckHelper.throwIfNull(party_send_action, () => $"party_send_action is null !!!");
|
||||
_ = await party_send_action.deleteInvitePartySend(notify.InviteUserGuid);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
using Google.Protobuf;
|
||||
using Google.Protobuf.WellKnownTypes;
|
||||
|
||||
|
||||
using ServerCore;
|
||||
using ServerBase;
|
||||
using ServerCommon;
|
||||
using ServerCommon.BusinessLogDomain;
|
||||
using MetaAssets;
|
||||
|
||||
|
||||
namespace GameServer;
|
||||
|
||||
public class NotifyInvitePartyReplyHandler
|
||||
{
|
||||
public async Task recvInvitePartyReply(ServerMessage.Types.ReplyInvitePartyNoti notify)
|
||||
{
|
||||
var result = new Result();
|
||||
|
||||
// 1. party 체크
|
||||
var global_party = GameServerApp.getServerLogic().findGlobalEntity<GlobalParty>();
|
||||
ArgumentNullException.ThrowIfNull(global_party);
|
||||
|
||||
var global_party_action = global_party.getEntityAction<GlobalPartyAction>();
|
||||
ArgumentNullException.ThrowIfNull(global_party_action);
|
||||
|
||||
var party_info = await global_party_action.getPartyLeaderGuidAndMemberCount(notify.InvitePartyGuid);
|
||||
if (string.IsNullOrEmpty(party_info.leader_guid)) return;
|
||||
|
||||
// 2. leader 체크
|
||||
var leader_login_cache = await PartyHelper.getOtherUserLoginCache(party_info.leader_guid);
|
||||
if (null == leader_login_cache) return;
|
||||
|
||||
// 3. 리더가 다른 서버로 이동했으면, 그쪽으로 전송
|
||||
var server_message = new ServerMessage();
|
||||
if (leader_login_cache.CurrentServer != GameServerApp.getServerLogic().getServerName())
|
||||
{
|
||||
server_message = new ServerMessage
|
||||
{
|
||||
ReplyInvitePartyNoti = new ServerMessage.Types.ReplyInvitePartyNoti
|
||||
{
|
||||
InvitePartyGuid = notify.InvitePartyGuid,
|
||||
InviteUserGuid = notify.InviteUserGuid,
|
||||
Result = notify.Result
|
||||
}
|
||||
};
|
||||
|
||||
PartyHelper.sendToServer(server_message, leader_login_cache.CurrentServer);
|
||||
return;
|
||||
}
|
||||
|
||||
// 4. send list 삭제
|
||||
var party = global_party.getParty(notify.InvitePartyGuid);
|
||||
ArgumentNullException.ThrowIfNull(party);
|
||||
|
||||
server_message = new ServerMessage();
|
||||
server_message.NtfDeletePartyInviteSend = new();
|
||||
server_message.NtfDeletePartyInviteSend.PartyGuid = notify.InvitePartyGuid;
|
||||
server_message.NtfDeletePartyInviteSend.InviteUserGuid = notify.InviteUserGuid;
|
||||
|
||||
PartyHelper.BroadcastToServers(party, server_message, false);
|
||||
|
||||
// 5. 승락이면서, member 가 2명이면, leader 는 p2pGroup 에 join해야 한다.
|
||||
if (notify.Result == BoolType.True)
|
||||
{
|
||||
var party_action = party.getEntityAction<GlobalPartyDetailAction>();
|
||||
ArgumentNullException.ThrowIfNull(party_action);
|
||||
|
||||
if (party_info.member_count == 2)
|
||||
{
|
||||
_ = await party_action.joinPartyP2PGroup(party_info.leader_guid);
|
||||
_ = await party_action.checkPartyP2PState(party_info.leader_guid, true, true);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// 6. client 에 전송
|
||||
var player_manager = GameServerApp.getServerLogic().getPlayerManager();
|
||||
ArgumentNullException.ThrowIfNull(player_manager);
|
||||
|
||||
if (!player_manager.tryGetUserByPrimaryKey(party_info.leader_guid, out var player))
|
||||
{
|
||||
Log.getLogger().error($"Failed to get recv user !! - leader[{party_info.leader_guid}] / invite[{notify.InviteUserGuid}] / {nameof(recvInvitePartyReply)}");
|
||||
return;
|
||||
}
|
||||
|
||||
var client_message = new ClientToGame
|
||||
{
|
||||
Message = new ClientToGameMessage
|
||||
{
|
||||
ReplyInvitePartyNoti = new ClientToGameMessage.Types.ReplyInvitePartyNoti
|
||||
{
|
||||
InviteUserGuid = notify.InviteUserGuid,
|
||||
InviteUserNickname = notify.InviteUserNickname,
|
||||
Result = notify.Result
|
||||
}
|
||||
}
|
||||
};
|
||||
PartyHelper.sendToClient(client_message, player.getHostId());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
using Google.Protobuf;
|
||||
using Google.Protobuf.WellKnownTypes;
|
||||
|
||||
|
||||
using ServerCore;
|
||||
using ServerBase;
|
||||
using ServerCommon;
|
||||
using ServerCommon.BusinessLogDomain;
|
||||
using MetaAssets;
|
||||
|
||||
|
||||
namespace GameServer;
|
||||
|
||||
public class NotifyInvitePartySendHandler
|
||||
{
|
||||
public async Task recvInvitePartySend(ServerMessage.Types.InvitePartyNoti notify)
|
||||
{
|
||||
var player_manager = GameServerApp.getServerLogic().getPlayerManager();
|
||||
ArgumentNullException.ThrowIfNull(player_manager);
|
||||
|
||||
// 0. client login 체크
|
||||
if (!player_manager.tryGetUserByPrimaryKey(notify.InviteUserGuid, out var player))
|
||||
{
|
||||
|
||||
// 0-1. login_cache 가져오기
|
||||
var login_cache = await PartyHelper.getOtherUserLoginCache(notify.InviteUserGuid);
|
||||
if (null == login_cache)
|
||||
{
|
||||
await sendMessageToPartyLeader(notify, ServerErrorCode.UserNotLogin);
|
||||
return;
|
||||
}
|
||||
|
||||
// 0-2. 해당 서버로 mq 날리기
|
||||
var server_message = new ServerMessage
|
||||
{
|
||||
InvitePartyNoti = new()
|
||||
{
|
||||
InvitePartyLeaderGuid = notify.InvitePartyLeaderGuid,
|
||||
InvitePartyGuid = notify.InvitePartyGuid,
|
||||
InviteUserGuid = notify.InviteUserGuid
|
||||
}
|
||||
};
|
||||
|
||||
var rabbit_mq = GameServerApp.getServerLogic().getRabbitMqConnector() as RabbitMqConnector;
|
||||
NullReferenceCheckHelper.throwIfNull(rabbit_mq, () => $"rabbit_mq is null !!!");
|
||||
rabbit_mq.SendMessage(login_cache.CurrentServer, server_message);
|
||||
return;
|
||||
}
|
||||
|
||||
// 1. client party 가입 체크
|
||||
var result = await checkJoinPartyCondition(player);
|
||||
if (result.isFail())
|
||||
{
|
||||
await sendMessageToPartyLeader(notify, result.ErrorCode);
|
||||
return;
|
||||
}
|
||||
|
||||
// 2. recv 저장
|
||||
var party_recv_action = player.getEntityAction<PartyInvitePartyRecvAction>();
|
||||
ArgumentNullException.ThrowIfNull(party_recv_action);
|
||||
|
||||
result = await party_recv_action.addInvitePartyRecv(notify.InvitePartyGuid);
|
||||
if (result.isFail())
|
||||
{
|
||||
await sendMessageToPartyLeader(notify, ServerErrorCode.FailToSendInviteMember);
|
||||
return;
|
||||
}
|
||||
|
||||
// 2. client 전달
|
||||
var client_message = new ClientToGame();
|
||||
client_message.Message = new();
|
||||
client_message.Message.InvitePartyNoti = new();
|
||||
client_message.Message.InvitePartyNoti.InviteHostUserGuid = notify.InvitePartyLeaderGuid;
|
||||
client_message.Message.InvitePartyNoti.InviteHostUserNickname =
|
||||
await PartyHelper.getUserNicknameFromGuid(notify.InvitePartyLeaderGuid);
|
||||
|
||||
PartyHelper.sendToClient(client_message, player.getHostId());
|
||||
}
|
||||
|
||||
private async Task sendMessageToPartyLeader(ServerMessage.Types.InvitePartyNoti notify, ServerErrorCode err_code)
|
||||
{
|
||||
var login_cache = await PartyHelper.getOtherUserLoginCache(notify.InvitePartyLeaderGuid);
|
||||
if (null == login_cache) return;
|
||||
|
||||
var message = new ServerMessage
|
||||
{
|
||||
NtfInvitePartyRecvResult = new ServerMessage.Types.GS2C_NTF_PARTY_INVITE_RESULT()
|
||||
{
|
||||
InvitePartyGuid = notify.InvitePartyGuid,
|
||||
InviteHostGuid = notify.InvitePartyLeaderGuid,
|
||||
InviteUserGuid = notify.InviteUserGuid,
|
||||
ErrorCode = err_code
|
||||
}
|
||||
};
|
||||
|
||||
var rabbit_mq = GameServerApp.getServerLogic().getRabbitMqConnector() as RabbitMqConnector;
|
||||
NullReferenceCheckHelper.throwIfNull(rabbit_mq, () => $"rabbit_mq is null !!!");
|
||||
rabbit_mq.SendMessage(login_cache.CurrentServer, message);
|
||||
}
|
||||
|
||||
private async Task<Result> checkJoinPartyCondition(Player player)
|
||||
{
|
||||
var result = new Result();
|
||||
|
||||
var personal_party_action = player.getEntityAction<PersonalPartyAction>();
|
||||
ArgumentNullException.ThrowIfNull(personal_party_action);
|
||||
|
||||
var party_guid = personal_party_action.getPersonalParty()?.getPartyGuid();
|
||||
if (string.IsNullOrEmpty(party_guid)) return result;
|
||||
|
||||
// 1. party 정보 획득
|
||||
var global_party = GameServerApp.getServerLogic().findGlobalEntity<GlobalParty>();
|
||||
ArgumentNullException.ThrowIfNull(global_party);
|
||||
var party = global_party.getParty(party_guid);
|
||||
if (null == party) return result;
|
||||
|
||||
// 2. 파티원 수 체크
|
||||
var party_member_action = party.getEntityAction<GlobalPartyDetailMemberAction>();
|
||||
ArgumentNullException.ThrowIfNull(party_member_action);
|
||||
|
||||
var member_count = party_member_action.getMemberCount();
|
||||
if (member_count < 2) return result;
|
||||
|
||||
result.setFail(ServerErrorCode.AlreadyPartyMember, $"Already Party Member !!! {player.getUserGuid()} / {party_guid}");
|
||||
|
||||
return await Task.FromResult(result);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
using Google.Protobuf;
|
||||
using Google.Protobuf.WellKnownTypes;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
|
||||
using ServerCore;
|
||||
using ServerBase;
|
||||
using ServerCommon;
|
||||
using ServerCommon.BusinessLogDomain;
|
||||
using MetaAssets;
|
||||
|
||||
|
||||
namespace GameServer;
|
||||
|
||||
public class NotifyJoinPartyMemberHandler
|
||||
{
|
||||
public async Task recvJoinPartyMember(ServerMessage.Types.JoinPartyMemberNoti notify)
|
||||
{
|
||||
var join_info = JsonConvert.DeserializeObject<PartyMemberInfo>(notify.JoinPartyMemberInfo);
|
||||
if (null == join_info) return;
|
||||
|
||||
var global_party = GameServerApp.getServerLogic().findGlobalEntity<GlobalParty>();
|
||||
ArgumentNullException.ThrowIfNull(global_party);
|
||||
|
||||
var party = global_party.getParty(notify.PartyGuid);
|
||||
ArgumentNullException.ThrowIfNull(party);
|
||||
|
||||
// 1. join member 등록
|
||||
var member_action = party.getEntityAction<GlobalPartyDetailMemberAction>();
|
||||
NullReferenceCheckHelper.throwIfNull(member_action, () => $"member_action is null !!!");
|
||||
var change = await member_action.changeMember(join_info);
|
||||
if (change.result.isFail()) return;
|
||||
|
||||
// 2. 메시지 전송
|
||||
var client_message = new ClientToGame();
|
||||
client_message.Message = new();
|
||||
client_message.Message.JoinPartyMemberNoti = new();
|
||||
client_message.Message.JoinPartyMemberNoti.JoinPartyMemberGuid = join_info.UserGuid;
|
||||
client_message.Message.JoinPartyMemberNoti.JoinMemberInfo = new PartyMemberState();
|
||||
client_message.Message.JoinPartyMemberNoti.JoinMemberInfo.MarkId = join_info.MarkId;
|
||||
client_message.Message.JoinPartyMemberNoti.JoinMemberInfo.MemberGuid = join_info.UserGuid;
|
||||
client_message.Message.JoinPartyMemberNoti.JoinMemberInfo.MemberNickname = join_info.Nickname;
|
||||
client_message.Message.JoinPartyMemberNoti.JoinMemberInfo.LocationInfo = join_info.LocationInfo;
|
||||
|
||||
PartyHelper.BroadcastToClients(party, client_message, new List<string>());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
using Google.Protobuf;
|
||||
using Google.Protobuf.WellKnownTypes;
|
||||
|
||||
|
||||
using ServerCore;
|
||||
using ServerBase;
|
||||
using ServerCommon;
|
||||
using ServerCommon.BusinessLogDomain;
|
||||
using MetaAssets;
|
||||
|
||||
|
||||
using USER_GUID = System.String;
|
||||
|
||||
|
||||
namespace GameServer;
|
||||
|
||||
public class NotifyLeavePartyMemberHandler
|
||||
{
|
||||
public async Task recvLeavePartyMember(ServerMessage.Types.LeavePartyMemberNoti notify)
|
||||
{
|
||||
// 1. 파티 조회
|
||||
var global_party = GameServerApp.getServerLogic().findGlobalEntity<GlobalParty>();
|
||||
ArgumentNullException.ThrowIfNull(global_party);
|
||||
|
||||
var party = global_party.getParty(notify.PartyGuid);
|
||||
ArgumentNullException.ThrowIfNull(party);
|
||||
|
||||
// 2. 파티원 제거
|
||||
var party_member_action = party.getEntityAction<GlobalPartyDetailMemberAction>();
|
||||
ArgumentNullException.ThrowIfNull(party_member_action);
|
||||
|
||||
var delete_member = await party_member_action.deleteJoinMember(notify.LeavePartyUserGuid, false);
|
||||
if (delete_member.result.isFail()) return;
|
||||
|
||||
// 2. Client 알림
|
||||
var message = new ClientToGame
|
||||
{
|
||||
Message = new()
|
||||
{
|
||||
LeavePartyMemberNoti = new()
|
||||
{
|
||||
LeavePartyUserGuid = notify.LeavePartyUserGuid,
|
||||
IsBan = notify.IsBan
|
||||
}
|
||||
}
|
||||
};
|
||||
PartyHelper.BroadcastToClients(party, message, new List<USER_GUID>());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
using Google.Protobuf;
|
||||
using Google.Protobuf.WellKnownTypes;
|
||||
|
||||
|
||||
using ServerCore;
|
||||
using ServerBase;
|
||||
using ServerCommon;
|
||||
using ServerCommon.BusinessLogDomain;
|
||||
using MetaAssets;
|
||||
|
||||
|
||||
|
||||
using USER_GUID = System.String;
|
||||
|
||||
|
||||
|
||||
namespace GameServer;
|
||||
|
||||
public class NotifyPartyChatHandler
|
||||
{
|
||||
public Task recvPartyChat(ServerMessage.Types.GS2C_NTF_PARTY_CHAT notify)
|
||||
{
|
||||
// 1. 파티 정보 확인
|
||||
var global_party = GameServerApp.getServerLogic().findGlobalEntity<GlobalParty>();
|
||||
NullReferenceCheckHelper.throwIfNull(global_party, () => $"global_party is null !!!");
|
||||
var party = global_party.getParty(notify.PartyGuid);
|
||||
|
||||
ArgumentNullException.ThrowIfNull(party);
|
||||
|
||||
// 2. 메시지 전송 ( to Client )
|
||||
var client_message = ChatNotifyHelper.makeChatMessage(ChatType.Party, notify.PartySenderNickname, string.Empty,
|
||||
PlayerStateType.None, notify.PartySendMessage);
|
||||
ArgumentNullException.ThrowIfNull(client_message);
|
||||
|
||||
PartyHelper.BroadcastToClients(party, client_message, new List<USER_GUID>());
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
using Google.Protobuf;
|
||||
using Google.Protobuf.WellKnownTypes;
|
||||
|
||||
|
||||
using ServerCore;
|
||||
using ServerBase;
|
||||
using ServerCommon;
|
||||
using ServerCommon.BusinessLogDomain;
|
||||
using MetaAssets;
|
||||
|
||||
|
||||
namespace GameServer;
|
||||
|
||||
public class NotifyPartyInstanceHandler
|
||||
{
|
||||
public async Task recvPartyInstance(ServerMessage.Types.PartyInstanceInfoNoti notify)
|
||||
{
|
||||
// 1. party 정보
|
||||
var global_party = GameServerApp.getServerLogic().findGlobalEntity<GlobalParty>();
|
||||
NullReferenceCheckHelper.throwIfNull(global_party, () => $"global_party is null !!!");
|
||||
var party = global_party.getParty(notify.PartyGuid);
|
||||
ArgumentNullException.ThrowIfNull(party);
|
||||
|
||||
// 2. party instance 데이터 로딩
|
||||
var party_instance_action = party.getEntityAction<GlobalPartyDetailInstanceAction>();
|
||||
ArgumentNullException.ThrowIfNull(party_instance_action);
|
||||
|
||||
var result = await party_instance_action.loadPartyInstance();
|
||||
if (result.isFail()) return;
|
||||
|
||||
// 3. party instance 조회
|
||||
var party_instance_attribute = party.getEntityAttribute<PartyInstanceAttribute>();
|
||||
ArgumentNullException.ThrowIfNull(party_instance_attribute);
|
||||
|
||||
// 4. 파티 인스턴스 정보 알림 ( to client )
|
||||
var client_message = new ClientToGame();
|
||||
client_message.Message = new();
|
||||
client_message.Message.PartyInstanceInfoNoti = new();
|
||||
client_message.Message.PartyInstanceInfoNoti.InstanceId = party_instance_attribute.InstanceId;
|
||||
client_message.Message.PartyInstanceInfoNoti.StartTime = party_instance_attribute.StartTime;
|
||||
client_message.Message.PartyInstanceInfoNoti.EndTime = party_instance_attribute.EndTime;
|
||||
client_message.Message.PartyInstanceInfoNoti.JoinMemberCount = party_instance_attribute.JoinMemberCount;
|
||||
client_message.Message.PartyInstanceInfoNoti.IsEnd = party_instance_attribute.InstanceId == 0 ? BoolType.True : BoolType.False;
|
||||
|
||||
PartyHelper.BroadcastToClients(party, client_message, new List<string>());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
using Google.Protobuf;
|
||||
using Google.Protobuf.WellKnownTypes;
|
||||
|
||||
|
||||
using ServerCore;
|
||||
using ServerBase;
|
||||
using ServerCommon;
|
||||
using ServerCommon.BusinessLogDomain;
|
||||
using MetaAssets;
|
||||
|
||||
|
||||
namespace GameServer;
|
||||
|
||||
public class NotifyPartyMemberLocationHandler
|
||||
{
|
||||
public async Task recvPartyMemberLocationHandler(ServerMessage.Types.PartyMemberLocationNoti notify)
|
||||
{
|
||||
var party = GameServerApp.getServerLogic().findGlobalEntity<GlobalParty>()?.getParty(notify.PartyGuid);
|
||||
ArgumentNullException.ThrowIfNull(party);
|
||||
|
||||
// 1. party member 정보 reload
|
||||
var party_member_action = party.getEntityAction<GlobalPartyDetailMemberAction>();
|
||||
ArgumentNullException.ThrowIfNull(party_member_action);
|
||||
|
||||
var result = await party_member_action.loadPartyMember();
|
||||
if (result.isFail()) return;
|
||||
|
||||
// 2. 해당 멤버 정보 변경 전달 ( to Client )
|
||||
var member = party_member_action.getMember(notify.PartyMemberGuid);
|
||||
if (null == member) return;
|
||||
|
||||
var client_message = new ClientToGame();
|
||||
client_message.Message = new();
|
||||
client_message.Message.PartyMemberLocationNoti = new();
|
||||
client_message.Message.PartyMemberLocationNoti.MemberGuid = notify.PartyMemberGuid;
|
||||
client_message.Message.PartyMemberLocationNoti.LocationInfo = member.LocationInfo;
|
||||
|
||||
PartyHelper.BroadcastToClients(party, client_message, new List<string>());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
using Google.Protobuf;
|
||||
using Google.Protobuf.WellKnownTypes;
|
||||
|
||||
|
||||
using ServerCore;
|
||||
using ServerBase;
|
||||
using ServerCommon;
|
||||
using ServerCommon.BusinessLogDomain;
|
||||
using MetaAssets;
|
||||
|
||||
|
||||
namespace GameServer;
|
||||
|
||||
public class NotifyPartyVoteResultHandler
|
||||
{
|
||||
public async Task recvPartyVoteResult(ServerMessage.Types.PartyVoteResultNoti notify)
|
||||
{
|
||||
var global_party = GameServerApp.getServerLogic().findGlobalEntity<GlobalParty>();
|
||||
NullReferenceCheckHelper.throwIfNull(global_party, () => $"global_party is null !!!");
|
||||
var party = global_party.getParty(notify.PartyGuid);
|
||||
ArgumentNullException.ThrowIfNull(party);
|
||||
|
||||
var party_attribute = party.getEntityAttribute<PartyAttribute>();
|
||||
ArgumentNullException.ThrowIfNull(party_attribute);
|
||||
|
||||
// 1. 결과 통보 ( to client )
|
||||
var client_message = new ClientToGame();
|
||||
client_message.Message = new();
|
||||
client_message.Message.PartyVoteResultNoti = new();
|
||||
client_message.Message.PartyVoteResultNoti.VoteTitle = notify.VoteTitle;
|
||||
client_message.Message.PartyVoteResultNoti.ResultTrue = notify.ResultTrue;
|
||||
client_message.Message.PartyVoteResultNoti.ResultFalse = notify.ResultFalse;
|
||||
client_message.Message.PartyVoteResultNoti.Abstain = notify.Abstain;
|
||||
|
||||
PartyHelper.BroadcastToClients(party, client_message, new List<string>());
|
||||
|
||||
// 6. 투표 데이터 삭제
|
||||
party_attribute.PartyVote = null;
|
||||
|
||||
await Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
using Google.Protobuf;
|
||||
using Google.Protobuf.WellKnownTypes;
|
||||
|
||||
|
||||
using ServerCore;
|
||||
using ServerBase;
|
||||
using ServerCommon;
|
||||
using ServerCommon.BusinessLogDomain;
|
||||
using MetaAssets;
|
||||
|
||||
|
||||
namespace GameServer;
|
||||
|
||||
public class NotifyReplyPartyVoteHandler
|
||||
{
|
||||
public async Task recvReplyPartyVote(ServerMessage.Types.ReplyPartyVoteNoti notify)
|
||||
{
|
||||
// 1. party 체크
|
||||
var global_party = GameServerApp.getServerLogic().findGlobalEntity<GlobalParty>();
|
||||
ArgumentNullException.ThrowIfNull(global_party);
|
||||
|
||||
var party = global_party.getParty(notify.PartyGuid);
|
||||
ArgumentNullException.ThrowIfNull(party);
|
||||
|
||||
// 2. 파티원 체크
|
||||
var party_member_action = party.getEntityAction<GlobalPartyDetailMemberAction>();
|
||||
ArgumentNullException.ThrowIfNull(party_member_action);
|
||||
|
||||
var member = party_member_action.getMember(notify.PartyVoterGuid);
|
||||
if (null == member) return;
|
||||
|
||||
// 3. vote 저장
|
||||
var party_info_action = party.getEntityAction<GlobalPartyDetailInfoAction>();
|
||||
ArgumentNullException.ThrowIfNull(party_info_action);
|
||||
|
||||
_ = await party_info_action.VoteParty(notify.Vote, notify.PartyVoterGuid);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
using Google.Protobuf;
|
||||
using Google.Protobuf.WellKnownTypes;
|
||||
|
||||
|
||||
using ServerCore;
|
||||
using ServerBase;
|
||||
using ServerCommon;
|
||||
using ServerCommon.BusinessLogDomain;
|
||||
using MetaAssets;
|
||||
|
||||
|
||||
using USER_GUID = System.String;
|
||||
|
||||
|
||||
namespace GameServer;
|
||||
|
||||
public class NotifyReplySummonPartyMemberHandler
|
||||
{
|
||||
public async Task recvReplySummonPartyMember(ServerMessage.Types.ReplySummonPartyMemberNoti notify)
|
||||
{
|
||||
var server_logic = GameServerApp.getServerLogic();
|
||||
ArgumentNullException.ThrowIfNull(server_logic);
|
||||
|
||||
var global_party = server_logic.findGlobalEntity<GlobalParty>();
|
||||
ArgumentNullException.ThrowIfNull(global_party);
|
||||
|
||||
var party = global_party.getParty(notify.SummonPartyGuid);
|
||||
ArgumentNullException.ThrowIfNull(party);
|
||||
|
||||
// 1. Party Leader 조회
|
||||
var party_info = party.getEntityAction<GlobalPartyDetailAction>();
|
||||
NullReferenceCheckHelper.throwIfNull(party_info, () => $"party_info is null !!!");
|
||||
var leader_guid = party_info.getLeaderGuid();
|
||||
ArgumentNullException.ThrowIfNull(party_info);
|
||||
ArgumentNullException.ThrowIfNull(leader_guid);
|
||||
|
||||
var player_manager = server_logic.getPlayerManager();
|
||||
if (!player_manager.tryGetUserByPrimaryKey(leader_guid, out var leader))
|
||||
{
|
||||
Log.getLogger().error($"Failed to get party leader session !!! : not found leader - {leader_guid}");
|
||||
return;
|
||||
}
|
||||
|
||||
// 2. message 생성
|
||||
var message = new ClientToGame();
|
||||
message.Message = new();
|
||||
message.Message.ReplySummonPartyMemberNoti = new();
|
||||
message.Message.ReplySummonPartyMemberNoti.SummonMemberGuid = notify.SummonUserGuid;
|
||||
message.Message.ReplySummonPartyMemberNoti.Result = notify.Result;
|
||||
|
||||
// 3. 소환 상태 체크
|
||||
var is_summon = checkSummonStatus(party, notify.SummonUserGuid);
|
||||
|
||||
// 4. summon 정보 정리 및 알림
|
||||
var party_member_action = party.getEntityAction<GlobalPartyDetailMemberAction>();
|
||||
NullReferenceCheckHelper.throwIfNull(party_member_action, () => $"party_member_action is null !!!");
|
||||
_ = await party_member_action.clearSummonMemberAsync(notify.SummonUserGuid, true);
|
||||
ArgumentNullException.ThrowIfNull(party_member_action);
|
||||
|
||||
// 3. Client 통보
|
||||
PartyHelper.sendToClient(message, leader.getHostId());
|
||||
}
|
||||
|
||||
private bool checkSummonStatus(GlobalPartyDetail party, USER_GUID summon_user_guid)
|
||||
{
|
||||
var party_member_action = party.getEntityAction<GlobalPartyDetailMemberAction>();
|
||||
ArgumentNullException.ThrowIfNull(party_member_action);
|
||||
|
||||
var summon_members = party_member_action.getSummonMembers();
|
||||
return summon_members.Contains(summon_user_guid);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
using Google.Protobuf;
|
||||
using Google.Protobuf.WellKnownTypes;
|
||||
|
||||
|
||||
using ServerCore;
|
||||
using ServerBase;
|
||||
using ServerCommon;
|
||||
using ServerCommon.BusinessLogDomain;
|
||||
using MetaAssets;
|
||||
|
||||
|
||||
|
||||
using USER_GUID = System.String;
|
||||
|
||||
|
||||
namespace GameServer;
|
||||
|
||||
public class NotifySendPartyInfoHandler
|
||||
{
|
||||
public async Task recvSendPartyInfo(ServerMessage.Types.GS2C_NTF_PARTY_INFO notify)
|
||||
{
|
||||
var party = GameServerApp.getServerLogic().findGlobalEntity<GlobalParty>()?.getParty(notify.PartyGuid);
|
||||
ArgumentNullException.ThrowIfNull(party);
|
||||
|
||||
// 1. 파티 소속 인원 체크
|
||||
var party_member_action = party.getEntityAction<GlobalPartyDetailMemberAction>();
|
||||
ArgumentNullException.ThrowIfNull(party_member_action);
|
||||
|
||||
var sends = (from send in notify.PartyMemberGuids
|
||||
let is_member = party_member_action.isPartyMember(send)
|
||||
where is_member select send).ToList();
|
||||
ArgumentNullException.ThrowIfNull(sends);
|
||||
|
||||
// 2. 파티 정보 전달
|
||||
var party_action = party.getEntityAction<GlobalPartyDetailAction>();
|
||||
ArgumentNullException.ThrowIfNull(party_action);
|
||||
|
||||
_ = await party_action.sendPartyInfo(sends, party_action.getLeaderGuid(), false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
using Google.Protobuf;
|
||||
using Google.Protobuf.WellKnownTypes;
|
||||
|
||||
|
||||
using ServerCore;
|
||||
using ServerBase;
|
||||
using ServerCommon;
|
||||
using ServerCommon.BusinessLogDomain;
|
||||
using MetaAssets;
|
||||
|
||||
|
||||
using USER_GUID = System.String;
|
||||
|
||||
|
||||
namespace GameServer;
|
||||
|
||||
public class NotifyStartPartyVoteHandler
|
||||
{
|
||||
public async Task recvStartPartyVote(ServerMessage.Types.PartyVoteNoti notify)
|
||||
{
|
||||
// 1. party 정보 체크
|
||||
var global_party = GameServerApp.getServerLogic().findGlobalEntity<GlobalParty>();
|
||||
ArgumentNullException.ThrowIfNull(global_party);
|
||||
|
||||
var party = global_party.getParty(notify.PartyGuid);
|
||||
ArgumentNullException.ThrowIfNull(party);
|
||||
|
||||
// 2. party vote 등록
|
||||
var party_info_action = party.getEntityAction<GlobalPartyDetailInfoAction>();
|
||||
ArgumentNullException.ThrowIfNull(party_info_action);
|
||||
|
||||
var register_vote = await party_info_action.registerPartyVote(notify.VoteTitle, notify.VoteStartTime, false);
|
||||
if (register_vote.result.isFail() || null == register_vote.vote) return;
|
||||
|
||||
// 3. 투표 시작 알림 ( to client )
|
||||
var client_message = new ClientToGame();
|
||||
client_message.Message = new();
|
||||
client_message.Message.PartyVoteNoti = new();
|
||||
client_message.Message.PartyVoteNoti.VoteTitle = register_vote.vote.VoteTitle;
|
||||
client_message.Message.PartyVoteNoti.VoteStartTime = register_vote.vote.StartVoteTime;
|
||||
|
||||
PartyHelper.BroadcastToClients(party, client_message, new List<USER_GUID>());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
using Google.Protobuf;
|
||||
using Google.Protobuf.WellKnownTypes;
|
||||
|
||||
|
||||
using ServerCore;
|
||||
using ServerBase;
|
||||
using ServerCommon;
|
||||
using ServerCommon.BusinessLogDomain;
|
||||
using MetaAssets;
|
||||
|
||||
|
||||
using USER_GUID = System.String;
|
||||
|
||||
|
||||
|
||||
namespace GameServer;
|
||||
|
||||
public class NotifySummonPartyMemberHandler
|
||||
{
|
||||
public async Task recvSummonPartyMember(ServerMessage.Types.SummonPartyMemberNoti notify)
|
||||
{
|
||||
var server_logic = GameServerApp.getServerLogic();
|
||||
string err_msg;
|
||||
ArgumentNullException.ThrowIfNull(server_logic);
|
||||
|
||||
// 1. 파티 정보 체크
|
||||
var party = GameServerApp.getServerLogic().findGlobalEntity<GlobalParty>()?.getParty(notify.SummonPartyGuid);
|
||||
if (null == party)
|
||||
{
|
||||
sendReplySummonPartyMemberAsync(notify.SummonPartyGuid, notify.SummonPartyGuid, notify.SummonUserGuid, SummonPartyMemberResultType.NotParty);
|
||||
return;
|
||||
}
|
||||
|
||||
// 1-1. 파티멤버 체크
|
||||
var party_member_action = party.getEntityAction<GlobalPartyDetailMemberAction>();
|
||||
ArgumentNullException.ThrowIfNull(party_member_action);
|
||||
|
||||
await party_member_action.loadPartyMember();
|
||||
|
||||
var member = party_member_action.getMember(notify.SummonUserGuid);
|
||||
if (null == member)
|
||||
{
|
||||
err_msg = $"Failed to summon party member !!! - user is not party member - {notify.SummonUserGuid}";
|
||||
Log.getLogger().error(err_msg);
|
||||
|
||||
sendReplySummonPartyMemberAsync(notify.SummonServerName, notify.SummonPartyGuid, notify.SummonUserGuid, SummonPartyMemberResultType.NotPartyMember);
|
||||
return;
|
||||
}
|
||||
|
||||
// 2. 유저 체크
|
||||
var player_manager = server_logic.getPlayerManager();
|
||||
ArgumentNullException.ThrowIfNull(player_manager);
|
||||
if (!player_manager.tryGetUserByPrimaryKey(notify.SummonUserGuid, out var summon_user))
|
||||
{
|
||||
// 2-1. summon user login cache 체크
|
||||
var login_cache_request = new LoginCacheOtherUserRequest(server_logic, server_logic.getRedisConnector(), notify.SummonUserGuid);
|
||||
var result = await login_cache_request.fetchLogin();
|
||||
if(result.isFail())
|
||||
{
|
||||
err_msg = $"Failed to fetchLogin() !!! : {result.toBasicString()}";
|
||||
Log.getLogger().error(err_msg);
|
||||
return;
|
||||
}
|
||||
|
||||
var login_cache = login_cache_request.getLoginCache();
|
||||
if (null == login_cache)
|
||||
{
|
||||
err_msg = $"Failed to summon party member !!! - user not logged in - {notify.SummonUserGuid}";
|
||||
Log.getLogger().error(err_msg);
|
||||
|
||||
sendReplySummonPartyMemberAsync(notify.SummonServerName, notify.SummonPartyGuid, notify.SummonUserGuid, SummonPartyMemberResultType.LogOut);
|
||||
return;
|
||||
}
|
||||
|
||||
// 2-2. target 서버로 전송
|
||||
var server_message = new ServerMessage();
|
||||
server_message.SummonPartyMemberNoti = new();
|
||||
server_message.SummonPartyMemberNoti.SummonPartyGuid = notify.SummonPartyGuid;
|
||||
server_message.SummonPartyMemberNoti.SummonUserGuid = notify.SummonUserGuid;
|
||||
server_message.SummonPartyMemberNoti.SummonServerName = login_cache.CurrentServer;
|
||||
server_message.SummonPartyMemberNoti.SummonPos = notify.SummonPos;
|
||||
|
||||
PartyHelper.sendToServer(server_message, login_cache.CurrentServer);
|
||||
return;
|
||||
}
|
||||
|
||||
// 3. Summon User 상태 체크
|
||||
var check_summon_user_condition = await checkSummonUserConditionAsync(party, summon_user);
|
||||
if (check_summon_user_condition != SummonPartyMemberResultType.Accept)
|
||||
{
|
||||
sendReplySummonPartyMemberAsync(notify.SummonServerName, notify.SummonPartyGuid, notify.SummonUserGuid, check_summon_user_condition);
|
||||
return;
|
||||
}
|
||||
|
||||
// 3. Summon Message 전송
|
||||
var client_message = new ClientToGame();
|
||||
client_message.Message = new ClientToGameMessage();
|
||||
client_message.Message.SummonPartyMemberNoti = new();
|
||||
|
||||
PartyHelper.sendToClient(client_message, summon_user.getHostId());
|
||||
}
|
||||
|
||||
private async Task<SummonPartyMemberResultType> checkSummonUserConditionAsync(GlobalPartyDetail party, Player summon_user)
|
||||
{
|
||||
// 1. 파티원 체크
|
||||
var party_member_attribute = party.getEntityAttribute<PartyMemberAttribute>();
|
||||
if (null == party_member_attribute) return SummonPartyMemberResultType.NotParty;
|
||||
|
||||
var party_member = party_member_attribute.getPartyMember(summon_user.getUserGuid());
|
||||
if (null == party_member) return SummonPartyMemberResultType.NotParty;
|
||||
|
||||
// 2. 방해 금지 상태 체크
|
||||
var user_attribute = summon_user.getEntityAttribute<UserAttribute>();
|
||||
NullReferenceCheckHelper.throwIfNull(user_attribute, () => $"user_attribute is null !!!");
|
||||
if (user_attribute.PlayerState == PlayerStateType.DontDistrub) return SummonPartyMemberResultType.DoNotDisturb;
|
||||
|
||||
// 3. 소환 상태 체크
|
||||
if(false == party_member.Summon.IsAlreadySummon) return SummonPartyMemberResultType.NotSummon;
|
||||
|
||||
return await Task.FromResult(SummonPartyMemberResultType.Accept);
|
||||
}
|
||||
|
||||
private void sendReplySummonPartyMemberAsync(string summon_server, string summon_party_guid, USER_GUID summon_user_guid, SummonPartyMemberResultType reply)
|
||||
{
|
||||
var server_message = new ServerMessage();
|
||||
server_message.ReplySummonPartyMemberNoti = new();
|
||||
server_message.ReplySummonPartyMemberNoti.SummonPartyGuid = summon_party_guid;
|
||||
server_message.ReplySummonPartyMemberNoti.SummonUserGuid = summon_user_guid;
|
||||
server_message.ReplySummonPartyMemberNoti.Result = reply;
|
||||
|
||||
PartyHelper.sendToServer(server_message, summon_server);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user