초기커밋
This commit is contained in:
@@ -0,0 +1,83 @@
|
||||
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.PacketHandler;
|
||||
|
||||
|
||||
[PacketHandler(typeof(ClientToGameReq), typeof(ClientToGameReq.Types.ReplyPartyVoteReq), typeof(ReplyPartyVotePacketHandler), typeof(GameLoginListener))]
|
||||
public class ReplyPartyVotePacketHandler : PacketRecvHandler
|
||||
{
|
||||
private static void send_S2C_ACK_REPLY_PARTY_VOTE(Player owner, Result result)
|
||||
{
|
||||
var ack_packet = new ClientToGame
|
||||
{
|
||||
Response = new ClientToGameRes
|
||||
{
|
||||
ErrorCode = result.ErrorCode,
|
||||
ReplyPartyVoteRes = new()
|
||||
}
|
||||
};
|
||||
|
||||
GameServerApp.getServerLogic().onSendPacket(owner, ack_packet);
|
||||
}
|
||||
|
||||
public override async Task<Result> onProcessPacket(ISession entityWithSession, IMessage recvMessage)
|
||||
{
|
||||
var result = new Result();
|
||||
string err_msg;
|
||||
var entity_player = entityWithSession as Player;
|
||||
NullReferenceCheckHelper.throwIfNull(entity_player, () => $"entity_player is null !!!");
|
||||
|
||||
// 1. 기본 정보 체크
|
||||
var request = (recvMessage as ClientToGame)?.Request.ReplyPartyVoteReq;
|
||||
if (null == request)
|
||||
{
|
||||
err_msg = $"Failed to get request type !!! : {nameof(ClientToGame.Request.ReplyPartyVoteReq)}";
|
||||
result.setFail(ServerErrorCode.InvalidArgument, err_msg);
|
||||
Log.getLogger().error(result.toBasicString());
|
||||
|
||||
send_S2C_ACK_REPLY_PARTY_VOTE(entity_player, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
// 2. 소속 파티 Guid 조회
|
||||
var personal_party_action = entity_player.getEntityAction<PersonalPartyAction>();
|
||||
|
||||
var personal_party = personal_party_action.getPersonalParty();
|
||||
if (null == personal_party)
|
||||
{
|
||||
err_msg = $"Failed to get party info !!! - not party member - {entity_player.getUserGuid()}";
|
||||
result.setFail(ServerErrorCode.NotParty, err_msg);
|
||||
Log.getLogger().error(err_msg);
|
||||
|
||||
send_S2C_ACK_REPLY_PARTY_VOTE(entity_player, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
var global_party = GameServerApp.getServerLogic().findGlobalEntity<GlobalParty>();
|
||||
NullReferenceCheckHelper.throwIfNull(global_party, () => $"global_party is null !!! - {entity_player.toBasicString()}");
|
||||
|
||||
var party = global_party.getParty(personal_party.getPartyGuid());
|
||||
NullReferenceCheckHelper.throwIfNull(party, () => $"party is null !!! - {entity_player.toBasicString()}");
|
||||
|
||||
// 3. Reply Vote 등록
|
||||
var party_info_action = party.getEntityAction<GlobalPartyDetailInfoAction>();
|
||||
NullReferenceCheckHelper.throwIfNull(party_info_action, () => $"party_info_action is null !!! - {entity_player.toBasicString()}");
|
||||
|
||||
var vote = (request.Vote != VoteType.None) ? request.Vote : VoteType.Abstain;
|
||||
result = await party_info_action.VoteParty(vote, entity_player.getUserGuid());
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user