/// <summary> /// Creates a new <see cref="SetQuestPacket"/> object. /// </summary> /// <param name="packet">Incoming packet</param> public SetQuestPacket(INetPacketStream packet) { this.QuestId = packet.Read <int>(); this.State = packet.Read <int>(); }
public override INetPacketStream Handle(NetUser connection, INetPacketStream stream) { var ctx = ContextBase.GetInstance <LoginContext>(); var gameServer = new GameServer { VirtualGameServerId = stream.Read <int>(), GameServerId = stream.Read <int>(), GroupId = stream.Read <int>(), DisplayNo = stream.Read <int>(), Name = stream.Read <string>(), ApiUrl = stream.Read <string>(), ProxyGameServerIp = stream.Read <string>(), ProxyGameServerPort = stream.Read <int>(), IsMaintenance = stream.Read <bool>(), PkEnabled = stream.Read <bool>(), TimeZone = stream.Read <string>(), StateCode = stream.Read <int>(), IsRecommend = stream.Read <bool>() }; var packet = new NetPacket(); packet.Write((short)OpCode.REGISTER_GS); if (ctx.GameServers.Values.Any(g => g.GameServerId == gameServer.GameServerId || g.VirtualGameServerId == gameServer.VirtualGameServerId)) { packet.Write(false); Logger.Get <RegisterGameServerHandler>().LogWarning($"GameServer registration for {gameServer.Name} with id {gameServer.GameServerId} was rejected."); } else { ctx.GameServers.Add(connection, gameServer); packet.Write(true); Logger.Get <RegisterGameServerHandler>().LogInformation($"GameServer registration for {gameServer.Name} with id {gameServer.GameServerId} was granted."); } return(packet); }
/// <inheritdoc /> public void Deserialize(INetPacketStream packet) { Slot = packet.Read <byte>(); Id = packet.Read <byte>(); ItemNumber = packet.Read <short>(); }
/// <summary> /// Creates a new <see cref="QueryGetMailGoldPacket"/> instance. /// </summary> /// <param name="packet">Incoming packet</param> public QueryGetMailGoldPacket(INetPacketStream packet) { this.MailId = packet.Read <int>(); }
/// <inheritdoc /> public void Deserialize(INetPacketStream packet) { PlayerId = packet.Read <uint>(); ExperienceMode = packet.Read <int>(); }
/// <summary> /// Creates a new <see cref="PartyMemberRequestCancelPacket"/> object. /// </summary> /// <param name="packet">Incoming packet</param> public PartyMemberRequestCancelPacket(INetPacketStream packet) { this.LeaderId = packet.Read <uint>(); this.MemberId = packet.Read <uint>(); this.Mode = packet.Read <int>(); }
/// <summary> /// Creates a new <see cref="SellItemPacket"/> instance. /// </summary> /// <param name="packet"></param> public SellItemPacket(INetPacketStream packet) { this.ItemUniqueId = packet.Read <byte>(); this.Quantity = packet.Read <short>(); }
/// <inheritdoc /> public void Deserialize(INetPacketStream packet) { Angle = packet.Read <float>(); AngleX = packet.Read <float>(); }
/// <summary> /// Creates a new <see cref="PutItemBankPacket"/> object. /// </summary> /// <param name="packet">Incoming packet</param> public PutItemBankPacket(INetPacketStream packet) { this.Slot = packet.Read <byte>(); this.Id = packet.Read <byte>(); this.ItemNumber = packet.Read <short>(); }
public static void OnAuthenticate(ISCClient client, INetPacketStream packet) { var id = packet.Read <int>(); var host = packet.Read <string>(); var name = packet.Read <string>(); var type = packet.Read <byte>(); client.Type = (ISCServerType)type; if (client.Type == ISCServerType.Cluster) { if (client.IcsServer.HasClusterWithId(id)) { Logger.Warn("Cluster Server '{0}' incoming connection from {1} refused. Reason: An other Cluster server with id '{2}' is already connected.", name, client.RemoteEndPoint, id); ISCPacketFactory.SendAuthenticationResult(client, ISCPacketCode.AUTH_FAILED_CLUSTER_EXISTS); client.IcsServer.DisconnectClient(client.Id); return; } client.ServerInfo = new ClusterServerInfo(id, host, name); ISCPacketFactory.SendAuthenticationResult(client, ISCPacketCode.AUTH_SUCCESS); Logger.Info("Cluster server '{0}' connected to ISC server from {1}.", name, client.RemoteEndPoint); } else if (client.Type == ISCServerType.World) { var clusterId = packet.Read <int>(); client.ServerInfo = new WorldServerInfo(id, host, name, clusterId); // TODO: read more informations about world server if needed if (!client.IcsServer.HasClusterWithId(clusterId)) { // No cluster for this server Logger.Warn("World server '{0}' incoming connection from {1} refused. Reason: Cluster server with id '{2}' is not connected.", name, client.RemoteEndPoint, clusterId); ISCPacketFactory.SendAuthenticationResult(client, ISCPacketCode.AUTH_FAILED_NO_CLUSTER); client.IcsServer.DisconnectClient(client.Id); return; } ISCClient parentCluster = client.IcsServer.GetCluster(clusterId); var clusterInfo = parentCluster.GetServerInfo <ClusterServerInfo>(); if (client.IcsServer.HasWorldInCluster(clusterId, id)) { // World already exists in cluster Logger.Warn("World server '{0}' incoming connection from {1} refused. Reason: An other World server with id '{2}' is already connected to Cluster Server '{3}'.", name, client.RemoteEndPoint, id, clusterInfo.Name); ISCPacketFactory.SendAuthenticationResult(client, ISCPacketCode.AUTH_FAILED_WORLD_EXISTS); client.IcsServer.DisconnectClient(client.Id); return; } clusterInfo.WorldServers.Add(client.ServerInfo as WorldServerInfo); ISCPacketFactory.SendAuthenticationResult(client, ISCPacketCode.AUTH_SUCCESS); ISCPacketFactory.SendUpdateWorldList(parentCluster, clusterInfo.WorldServers); Logger.Info("World server '{0}' join cluster '{1}' and is connected to ISC server from {2}.", name, clusterInfo.Name, client.RemoteEndPoint); } else { Logger.Warn("Incoming ISC connection from {0} refused. Reason: server type is unknown.", client.RemoteEndPoint); ISCPacketFactory.SendAuthenticationResult(client, ISCPacketCode.AUTH_FAILED_UNKNOWN_SERVER); client.IcsServer.DisconnectClient(client.Id); } }
/// <summary> /// Creates a new <see cref="MoveItemPacket"/> instance. /// </summary> /// <param name="packet"></param> public MoveItemPacket(INetPacketStream packet) { this.ItemType = packet.Read <byte>(); this.SourceSlot = packet.Read <byte>(); this.DestinationSlot = packet.Read <byte>(); }
/// <summary> /// Creates a new <see cref="PartyChangeLeaderPacket"/> object. /// </summary> /// <param name="packet">Incoming packet</param> public PartyChangeLeaderPacket(INetPacketStream packet) { this.LeaderId = packet.Read <uint>(); this.NewLeaderId = packet.Read <uint>(); }
public QueryTickCountPacket(INetPacketStream packet) { this.Time = packet.Read <uint>(); }
/// <summary> /// Creates a new <see cref="MoveBankItemPacket"/> object. /// </summary> /// <param name="packet">Incoming packet</param> public MoveBankItemPacket(INetPacketStream packet) { this.SourceIndex = packet.Read <int>(); this.Destinationindex = packet.Read <int>(); }
/// <inheritdoc /> public void Deserialize(INetPacketStream packet) { Message = packet.Read <string>(); }
/// <summary> /// Creates a new <see cref="TeleSkillPacket"/> object. /// </summary> /// <param name="packet">Incoming packet</param> public TeleSkillPacket(INetPacketStream packet) { this.Position = new Vector3(packet.Read <float>(), packet.Read <float>(), packet.Read <float>()); }
public TradeRequestPacket(INetPacketStream packet) { this.Target = packet.Read <uint>(); }
/// <inheritdoc /> public void Deserialize(INetPacketStream packet) { ItemId = packet.Read <uint>(); Option = packet.Read <int>(); }
/// <inheritdoc /> public override void Deserialize(INetPacketStream packet) { SlotLevelIndex = packet.Read <byte>(); base.Deserialize(packet); }
/// <inheritdoc /> public void Deserialize(INetPacketStream packet) { MailId = packet.Read <int>(); }
/// <summary> /// Creates a new <see cref="PartyRemoveMemberPacket"/> object. /// </summary> /// <param name="packet">Incoming packet</param> public PartyRemoveMemberPacket(INetPacketStream packet) { this.LeaderId = packet.Read <uint>(); this.MemberId = packet.Read <uint>(); }
/// <inheritdoc /> public void Deserialize(INetPacketStream packet) { LocalPosition = new Vector3(packet.Read <float>(), packet.Read <float>(), packet.Read <float>()); IAId = packet.Read <uint>(); }
/// <summary> /// Creates a new <see cref="PartyChangeNamePacket"/> object. /// </summary> /// <param name="packet">Incoming packet</param> public PartyChangeNamePacket(INetPacketStream packet) { this.PlayerId = packet.Read <uint>(); this.Name = packet.Read <string>(); }
/// <summary> /// Creates a new <see cref="SetDestPositionPacket"/> instance. /// </summary> /// <param name="packet">Incoming packet</param> public PlayerMovedPacket(INetPacketStream packet) { this.BeginPosition = new Vector3(packet.Read <float>(), packet.Read <float>(), packet.Read <float>()); this.DestinationPosition = new Vector3(packet.Read <float>(), packet.Read <float>(), packet.Read <float>()); this.Angle = packet.Read <float>(); this.State = packet.Read <uint>(); this.StateFlag = packet.Read <uint>(); this.Motion = packet.Read <uint>(); this.MotionEx = packet.Read <int>(); this.Loop = packet.Read <int>(); this.MotionOption = packet.Read <uint>(); this.TickCount = packet.Read <long>(); }
/// <summary> /// Creates a new <see cref="PutItemGuildBankPacket"/> object. /// </summary> /// <param name="packet">Incoming packet</param> public PutItemGuildBankPacket(INetPacketStream packet) { this.Id = packet.Read <byte>(); this.ItemId = packet.Read <uint>(); this.Mode = packet.Read <byte>(); }
/// <summary> /// Creates a new <see cref="ReadMailPacket"/> instance. /// </summary> /// <param name="packet">Incoming packet</param> public ReadMailPacket(INetPacketStream packet) { this.MailId = packet.Read <int>(); }
/// <inheritdoc /> public void Deserialize(INetPacketStream packet) { PlayerId = packet.Read <uint>(); }
/// <inheritdoc /> public void Deserialize(INetPacketStream packet) { Code = packet.Read <int>(); Data = packet.Read <int>(); }
/// <summary> /// Creates a new <see cref="QueryPlayerDataPacket"/> instance. /// </summary> /// <param name="packet">Incoming packet</param> public QueryPlayerDataPacket(INetPacketStream packet) { this.PlayerId = packet.Read <uint>(); this.Version = packet.Read <int>(); }
/// <summary> /// Creates a new <see cref="ScriptEquipItemPacket"/> object. /// </summary> /// <param name="packet">Incoming packet</param> public ScriptEquipItemPacket(INetPacketStream packet) { this.ItemId = packet.Read <uint>(); this.Option = packet.Read <int>(); }