113 lines
4.6 KiB
C#
113 lines
4.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
using Google.Protobuf.WellKnownTypes;
|
|
|
|
|
|
using ServerCore; using ServerBase;
|
|
using ServerCommon;
|
|
|
|
|
|
using static ClientToGameMessage.Types;
|
|
|
|
|
|
namespace GameServer
|
|
{
|
|
internal static class SocialActionNotifyHelper
|
|
{
|
|
public static bool send_S2C_NTF_OWNED_SOCIAL_ACTION(this Player player)
|
|
{
|
|
ArgumentNullReferenceCheckHelper.throwIfNull(player, () => $"player is null !!!");
|
|
|
|
var social_action_agent_action = player.getEntityAction<SocialActionLoadAction>();
|
|
NullReferenceCheckHelper.throwIfNull(social_action_agent_action, () => $"social_action_agent_action is null !!! - {player.toBasicString()}");
|
|
|
|
var ntf_packet = new ClientToGame();
|
|
ntf_packet.Message = new ClientToGameMessage();
|
|
ntf_packet.Message.OwnedSocialActionNoti = new OwnedSocialActionNoti();
|
|
|
|
var social_actions = social_action_agent_action.getSocialActions();
|
|
foreach (var social_action in social_actions)
|
|
{
|
|
var social_action_attribute = social_action.getEntityAttribute<UserSocialActionAttribute>();
|
|
NullReferenceCheckHelper.throwIfNull(social_action_attribute, () => $"social_action_attribute is null !!! - {player.toBasicString()}");
|
|
|
|
ntf_packet.Message.OwnedSocialActionNoti.OwnedList.Add((int)social_action_attribute.SocialActionMetaId);
|
|
|
|
if (social_action_attribute.EquipedPos != 0)
|
|
{
|
|
var slot_info = new SlotInfo();
|
|
|
|
slot_info.Slot = social_action_attribute.EquipedPos - 1; // 인덱스가 클라는 0번부터 서버는 1번부터
|
|
slot_info.Id = (int)social_action_attribute.SocialActionMetaId;
|
|
|
|
ntf_packet.Message.OwnedSocialActionNoti.EquipList.Add(slot_info);
|
|
}
|
|
}
|
|
|
|
if (false == GameServerApp.getServerLogic().onSendPacket(player, ntf_packet))
|
|
{
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
public static bool send_S2C_NTF_PLAY_SOCIAL_ACTION(this Player player)
|
|
{
|
|
ArgumentNullReferenceCheckHelper.throwIfNull(player, () => $"player is null !!!");
|
|
|
|
var user_social_action_executor_action = player.getEntityAction<UserSocialActionExecutorAction>();
|
|
NullReferenceCheckHelper.throwIfNull(user_social_action_executor_action, () => $"$user_social_action_executor_action is null - {player.toBasicString()}");
|
|
|
|
var game_zone_action = player.getEntityAction<GameZoneAction>();
|
|
NullReferenceCheckHelper.throwIfNull(game_zone_action, () => $"game_zone_action is null - {player.toBasicString()}");
|
|
|
|
var ntf_packet = new ClientToGame();
|
|
ntf_packet.Message = new ClientToGameMessage();
|
|
ntf_packet.Message.PlaySocialActionNoti = new PlaySocialActionNoti();
|
|
|
|
ntf_packet.Message.PlaySocialActionNoti.ActorGuid = player.getUserGuid();
|
|
ntf_packet.Message.PlaySocialActionNoti.SocialActionId = user_social_action_executor_action.getPlayingSocialActionMetaId();
|
|
ntf_packet.Message.PlaySocialActionNoti.StartTime = user_social_action_executor_action.getPlayingSocialActionStartTime().ToTimestamp();
|
|
|
|
game_zone_action.broadcast(player, ntf_packet);
|
|
|
|
return true;
|
|
}
|
|
|
|
public static bool send_S2C_NTF_STOP_SOCIAL_ACTION(this Player player)
|
|
{
|
|
ArgumentNullReferenceCheckHelper.throwIfNull(player, () => $"player is null !!!");
|
|
|
|
var game_zone_action = player.getEntityAction<GameZoneAction>();
|
|
NullReferenceCheckHelper.throwIfNull(game_zone_action, () => $"game_zone_action is null - {player.toBasicString()}");
|
|
|
|
var ntf_packet = new ClientToGame();
|
|
ntf_packet.Message = new ClientToGameMessage();
|
|
ntf_packet.Message.StopSocialActionNoti = new StopSocialActionNoti();
|
|
|
|
ntf_packet.Message.StopSocialActionNoti.ActorGuid = player.getUserGuid();
|
|
|
|
game_zone_action.broadcast(player, ntf_packet);
|
|
|
|
return true;
|
|
}
|
|
|
|
public static ClientToGame makeNtfSocialActionAddPacket(int social_action_meta_id)
|
|
{
|
|
var ntf_packet = new ClientToGame();
|
|
ntf_packet.Message = new ClientToGameMessage();
|
|
ntf_packet.Message.SocialActionAddNoti = new SocialActionAddNoti();
|
|
|
|
ntf_packet.Message.SocialActionAddNoti.SocialActionId = social_action_meta_id;
|
|
|
|
return ntf_packet;
|
|
}
|
|
}
|
|
}
|