/// <summary> /// Adds the specified message. /// </summary> /// <param name="message">The message.</param> /// <param name="characterSpawn">The character spawn.</param> /// <param name="sourcePosition">The source position.</param> /// <param name="targetPosition">The target position.</param> /// <param name="creatureSpawnService">The creature spawn service.</param> /// <param name="tileService">The tile service.</param> public static void Add(NetworkMessage message, ICharacterSpawn characterSpawn, IVector3 sourcePosition, IVector3 targetPosition, CreatureSpawnService creatureSpawnService, TileService tileService) { if (sourcePosition.Y > targetPosition.Y) { // North, for old X message.AddPacketType(GamePacketType.MapSliceNorth); AddMapDescription(message, characterSpawn, new Vector3(sourcePosition.X - 8, targetPosition.Y - 6, targetPosition.Z), 18, 1, creatureSpawnService, tileService); } else if (sourcePosition.Y < targetPosition.Y) { // South, for old X message.AddPacketType(GamePacketType.MapSliceSouth); AddMapDescription(message, characterSpawn, new Vector3(sourcePosition.X - 8, targetPosition.Y + 7, targetPosition.Z), 18, 1, creatureSpawnService, tileService); } if (sourcePosition.X < targetPosition.X) { // East, with new Y message.AddPacketType(GamePacketType.MapSliceEast); AddMapDescription(message, characterSpawn, new Vector3(targetPosition.X + 9, targetPosition.Y - 6, targetPosition.Z), 1, 14, creatureSpawnService, tileService); } else if (sourcePosition.X > targetPosition.X) { // West, with new Y message.AddPacketType(GamePacketType.MapSliceWest); AddMapDescription(message, characterSpawn, new Vector3(targetPosition.X - 8, targetPosition.Y - 6, targetPosition.Z), 1, 14, creatureSpawnService, tileService); } }
/// <summary> /// Adds the specified message. /// </summary> /// <param name="message">The message.</param> /// <param name="inventoryItem">The inventory item.</param> /// <param name="slotType">Type of the slot.</param> public static void Add(NetworkMessage message, IItemSpawn inventoryItem, SlotType slotType) { if (inventoryItem != null) { message.AddPacketType(GamePacketType.InventoryItem); message.AddSlotType(slotType); message.AddItemSpawn(inventoryItem); } else { message.AddPacketType(GamePacketType.InventoryItemEmpty); message.AddSlotType(slotType); } }
/// <summary> /// Adds the specified message. /// </summary> /// <param name="message">The message.</param> /// <param name="channels">The channels.</param> public static void Add(NetworkMessage message, ICollection <IChannel> channels) { message.AddPacketType(GamePacketType.ChannelsList); message.AddByte((byte)channels.Count); foreach (IChannel channel in channels) { switch (channel) { case IPrivateChannel privateChannel: // TODO: WARNING! Casting CharacterSpawn.Id to UInt16 is BAD design. FIX ASAP! message.AddUInt16((ushort)privateChannel.Owner.Id); break; case IGuildChannel guildChannel: message.AddUInt16(guildChannel.Guild.Id); break; case IPartyChannel partyChannel: message.AddUInt16(partyChannel.Party.Id); break; case IPublicChannel publicChannel: message.AddChannelType(publicChannel.Type); break; default: message.AddUInt16(channel.Id); break; } message.AddString(channel.Name); } }
/// <summary> /// Adds the specified message. /// </summary> /// <param name="message">The message.</param> /// <param name="userName">The user name.</param> /// <param name="password">The password.</param> public static void Add(NetworkMessage message, string userName, string password) { string sessionKey = $"{userName}\n{password}"; message.AddPacketType(LoginPacketType.SessionKey); message.AddString(sessionKey); }
/// <summary> /// Adds the specified message. /// </summary> /// <param name="message">The message.</param> /// <param name="characterSpawn">The character spawn.</param> public static void Add(NetworkMessage message, ICharacterSpawn characterSpawn) { message.AddPacketType(GamePacketType.SelfStats); message.AddUInt16((ushort)characterSpawn.Health.Current); message.AddUInt16((ushort)characterSpawn.Health.Maximum); message.AddUInt32(characterSpawn.FreeCapacity); message.AddUInt32(characterSpawn.Capacity); message.AddUInt64(characterSpawn.Level.Experience); message.AddUInt16((ushort)characterSpawn.Level.Current); message.AddPercent(characterSpawn.Level.ToPercent()); // TODO: Experience bonus message.AddDouble(0, 3); message.AddUInt16((ushort)characterSpawn.Mana.Current); message.AddUInt16((ushort)characterSpawn.Mana.Maximum); message.AddByte(characterSpawn.MagicLevel.Base); message.AddByte(characterSpawn.MagicLevel.Current); message.AddPercent(characterSpawn.MagicLevel.ToPercent()); message.AddByte(characterSpawn.Soul); message.AddUInt16(characterSpawn.Stamina); // TODO: Improve protocol to provide BonusSpeed in this packet message.AddUInt16(characterSpawn.Speed.WalkSpeed); // TODO: var condition = characterSpawn.getCondition(ConditionType.CONDITION_REGENERATION); message.AddUInt16(/*(ushort)(condition != null ? condition.getTicks() / 1000 : */ 0x00 /*)*/); message.AddUInt16((ushort)(characterSpawn.OfflineTraining.Elapsed.Ticks / 60 / 1000)); }
/// <summary> /// Adds the specified message. /// </summary> /// <param name="message">The message.</param> /// <param name="vector3">The vector3.</param> /// <param name="stackPosition">The stack position.</param> /// <param name="itemSpawn">The item spawn.</param> public static void Add(NetworkMessage message, Vector3 vector3, byte stackPosition, ItemSpawn itemSpawn) { message.AddPacketType(GamePacketType.TileArtifactTransform); message.AddVector3(vector3); message.AddByte(stackPosition); message.AddItemSpawn(itemSpawn); }
/// <summary> /// Adds the specified message. /// </summary> /// <param name="message">The message.</param> /// <param name="channel">The channel.</param> public static void Add(NetworkMessage message, IChannel channel) { message.AddPacketType(GamePacketType.ChannelOpen); switch (channel) { case IPrivateChannel privateChannel: AddPrivateChannel(message, privateChannel); break; case IGuildChannel guildChannel: AddGuildChannel(message, guildChannel); break; case IPartyChannel partyChannel: AddPartyChannel(message, partyChannel); break; case IPublicChannel publicChannel: AddPublicChannel(message, publicChannel); break; default: AddChannel(message, channel); break; } }
/// <summary> /// Adds the specified message. /// </summary> /// <param name="message">The message.</param> /// <param name="sourcePosition">The source position.</param> /// <param name="sourceStackPosition">The source stack position.</param> /// <param name="targetPosition">The target position.</param> public static void Add(NetworkMessage message, IVector3 sourcePosition, byte sourceStackPosition, IVector3 targetPosition) { message.AddPacketType(GamePacketType.CreatureMove); message.AddVector3(sourcePosition); message.AddByte(sourceStackPosition); message.AddVector3(targetPosition); }
/// <summary> /// Adds the specified message. /// </summary> /// <param name="message">The message.</param> /// <param name="character">The character.</param> /// <param name="position">The position.</param> /// <param name="stackPosition">The stack position.</param> /// <param name="creature">The creature.</param> /// <param name="known">if set to <c>true</c> [known].</param> /// <param name="removeKnown">The remove known.</param> public static void Add(NetworkMessage message, ICharacterSpawn character, IVector3 position, byte stackPosition, ICreatureSpawn creature, bool known, uint removeKnown) { message.AddPacketType(GamePacketType.TileAddArtifact); message.AddVector3(position); message.AddByte(stackPosition); AddCreature(message, character, creature, known, removeKnown); }
/// <summary> /// Adds the specified message. /// </summary> /// <param name="message">The message.</param> /// <param name="creatureId">The creature identifier.</param> /// <param name="speedInfo">The speed information.</param> public static void Add(NetworkMessage message, uint creatureId, SpeedInfo speedInfo) { message.AddPacketType(GamePacketType.CreatureChangeSpeed); message.AddUInt32(creatureId); message.AddUInt16(speedInfo.WalkSpeed); message.AddUInt16(speedInfo.BonusSpeed); }
/// <summary> /// Adds the specified message. /// </summary> /// <param name="message">The message.</param> /// <param name="currentOutfit">The current outfit.</param> /// <param name="currentMount">The current mount.</param> /// <param name="outfits">The outfits.</param> /// <param name="mounts">The mounts.</param> public static void Add(NetworkMessage message, IOutfit currentOutfit, IMount currentMount, ICollection <IOutfit> outfits, ICollection <IMount> mounts) { message.AddPacketType(GamePacketType.AppearanceWindow); message.AddAppearance(currentOutfit, currentMount); AddOutfits(message, outfits); AddMounts(message, mounts); }
/// <summary> /// Adds the specified message. /// </summary> /// <param name="message">The message.</param> /// <param name="creatureSpawn">The creature spawn.</param> /// <param name="channelId">The channel identifier.</param> /// <param name="type">The type.</param> /// <param name="statementId">The statement identifier.</param> /// <param name="text">The text.</param> public static void Add(NetworkMessage message, ICreatureSpawn creatureSpawn, ushort channelId, SpeechType type, uint statementId, string text) { message.AddPacketType(GamePacketType.CreatureSpeech); message.AddUInt32(statementId); if (creatureSpawn == null) { message.AddUInt32(0x00); } else if (type == SpeechType.ChannelR2) { message.AddUInt32(0x00); type = SpeechType.Red; } else { message.AddString(creatureSpawn.Creature.Name); // Add level only for characters if (creatureSpawn is ICharacterSpawn characterSpawn) { message.AddUInt16((ushort)characterSpawn.Level.Current); } else { message.AddUInt16(0x00); } } message.AddSpeechType(type); message.AddUInt16(channelId); message.AddString(text); }
/// <summary> /// Adds the specified message. /// </summary> /// <param name="message">The message.</param> /// <param name="onlineTime">The online time.</param> public static void Add(NetworkMessage message, TimeSpan onlineTime) { message.AddPacketType(GamePacketType.Connect); message.AddUInt32((uint)onlineTime.Seconds); // TODO: Research this byte. Is it fractional time? message.AddByte(0x10); }
/// <summary> /// Adds the specified message. /// </summary> /// <param name="message">The message.</param> /// <param name="channelId">The channel identifier.</param> /// <param name="channelName">Name of the channel.</param> /// <param name="channelEventType">Type of the channel event.</param> public static void Add(NetworkMessage message, ushort channelId, string channelName, ChannelEventType channelEventType) { message.AddPacketType(GamePacketType.ChannelEvent); message.AddUInt16(channelId); message.AddString(channelName); message.AddChannelEventType(channelEventType); }
/// <summary> /// Adds the specified message. /// </summary> /// <param name="message">The message.</param> /// <param name="characterSpawn">The character spawn.</param> /// <param name="sourcePosition">The source position.</param> /// <param name="sourceStackPosition">The source stack position.</param> /// <param name="targetPosition">The target position.</param> /// <param name="creatureSpawnService">The creature spawn service.</param> /// <param name="tileService">The tile service.</param> public static void Add(NetworkMessage message, ICharacterSpawn characterSpawn, IVector3 sourcePosition, byte sourceStackPosition, IVector3 targetPosition, CreatureSpawnService creatureSpawnService, TileService tileService) { // Floor change up message.AddPacketType(GamePacketType.FloorChangeUp); // Going to surface if (targetPosition.Z == 7) { int skip = -1; // Floor 7 and 6 already set AddFloorDescription(message, characterSpawn, new Vector3(sourcePosition.X - 8, sourcePosition.Y - 6, 5), 18, 14, 3, creatureSpawnService, tileService, ref skip); AddFloorDescription(message, characterSpawn, new Vector3(sourcePosition.X - 8, sourcePosition.Y - 6, 4), 18, 14, 4, creatureSpawnService, tileService, ref skip); AddFloorDescription(message, characterSpawn, new Vector3(sourcePosition.X - 8, sourcePosition.Y - 6, 3), 18, 14, 5, creatureSpawnService, tileService, ref skip); AddFloorDescription(message, characterSpawn, new Vector3(sourcePosition.X - 8, sourcePosition.Y - 6, 2), 18, 14, 6, creatureSpawnService, tileService, ref skip); AddFloorDescription(message, characterSpawn, new Vector3(sourcePosition.X - 8, sourcePosition.Y - 6, 1), 18, 14, 7, creatureSpawnService, tileService, ref skip); AddFloorDescription(message, characterSpawn, new Vector3(sourcePosition.X - 8, sourcePosition.Y - 6, 0), 18, 14, 8, creatureSpawnService, tileService, ref skip); if (skip >= 0) { message.AddByte((byte)skip); message.AddByte(0xFF); } } // Underground, going one floor up (still underground) else if (targetPosition.Z > 7) { int skip = -1; AddFloorDescription(message, characterSpawn, new Vector3(sourcePosition.X - 8, sourcePosition.Y - 6, sourcePosition.Z - 3), 18, 14, 3, creatureSpawnService, tileService, ref skip); if (skip >= 0) { message.AddByte((byte)skip); message.AddByte(0xFF); } } // Moving up a floor up makes us out of sync // Eest message.AddPacketType(GamePacketType.MapSliceWest); AddMapDescription(message, characterSpawn, new Vector3(sourcePosition.X - 8, sourcePosition.Y + 1 - 6, targetPosition.Z), 1, 14, creatureSpawnService, tileService); // North message.AddPacketType(GamePacketType.MapSliceNorth); AddMapDescription(message, characterSpawn, new Vector3(sourcePosition.X - 8, sourcePosition.Y - 6, targetPosition.Z), 18, 1, creatureSpawnService, tileService); }
/// <summary> /// Adds the specified message. /// </summary> /// <param name="message">The message.</param> /// <param name="characterSpawn">The character spawn.</param> /// <param name="position">The position.</param> /// <param name="creatureSpawnService">The creature spawn service.</param> /// <param name="tileService">The tile service.</param> public static void Add(NetworkMessage message, ICharacterSpawn characterSpawn, IVector3 position, CreatureSpawnService creatureSpawnService, TileService tileService) { message.AddPacketType(GamePacketType.MapDescription); message.AddVector3(position); // TODO: These magic numbers should not be hard-coded AddMapDescription(message, characterSpawn, new Vector3(position.X - 8, position.Y - 6, position.Z), 18, 14, creatureSpawnService, tileService); }
/// <summary> /// Adds the specified message. /// </summary> /// <param name="message">The message.</param> /// <param name="premiumTimeLeft">The premium time left.</param> /// <param name="vocation">The vocation.</param> /// <param name="spells">The spells.</param> public static void Add(NetworkMessage message, TimeSpan premiumTimeLeft, IVocation vocation, ICollection <ISpell> spells) { message.AddPacketType(GamePacketType.SelfBasicData); message.AddBoolean(premiumTimeLeft > TimeSpan.Zero); message.AddTimeSpan(premiumTimeLeft); message.AddByte(vocation.Id); AddSpells(message, spells); }
/// <summary> /// Adds the specified message. /// </summary> /// <param name="message">The message.</param> /// <param name="characterSpawn">The character spawn.</param> /// <param name="sourcePosition">The source position.</param> /// <param name="sourceStackPosition">The source stack position.</param> /// <param name="targetPosition">The target position.</param> /// <param name="creatureSpawnService">The creature spawn service.</param> /// <param name="tileService">The tile service.</param> public static void Add(NetworkMessage message, ICharacterSpawn characterSpawn, IVector3 sourcePosition, byte sourceStackPosition, IVector3 targetPosition, CreatureSpawnService creatureSpawnService, TileService tileService) { message.AddPacketType(GamePacketType.FloorChangeDown); if (targetPosition.Z == 8) { // Going from surface to underground // TODO: These magic numbers should not be hard-coded int skip = -1; AddFloorDescription(message, characterSpawn, new Vector3(sourcePosition.X - 8, sourcePosition.Y - 6, targetPosition.Z), 18, 14, -1, creatureSpawnService, tileService, ref skip); AddFloorDescription(message, characterSpawn, new Vector3(sourcePosition.X - 8, sourcePosition.Y - 6, targetPosition.Z + 1), 18, 14, -2, creatureSpawnService, tileService, ref skip); AddFloorDescription(message, characterSpawn, new Vector3(sourcePosition.X - 8, sourcePosition.Y - 6, targetPosition.Z + 2), 18, 14, -3, creatureSpawnService, tileService, ref skip); if (skip >= 0) { message.AddByte((byte)skip); message.AddByte(0xFF); } } else if (targetPosition.Z > sourcePosition.Z && targetPosition.Z > 8 && targetPosition.Z < 14) { // Going further down // TODO: These magic numbers should not be hard-coded int skip = -1; AddFloorDescription(message, characterSpawn, new Vector3(sourcePosition.X - 8, sourcePosition.Y - 6, targetPosition.Z + 2), 18, 14, -3, creatureSpawnService, tileService, ref skip); if (skip >= 0) { message.AddByte((byte)skip); message.AddByte(0xFF); } } // Moving down a floor makes us out of sync // East // TODO: These magic numbers should not be hard-coded message.AddPacketType(GamePacketType.MapSliceEast); AddMapDescription(message, characterSpawn, new Vector3(sourcePosition.X + 9, sourcePosition.Y - 1 - 6, targetPosition.Z), 1, 14, creatureSpawnService, tileService); // South // TODO: These magic numbers should not be hard-coded message.AddPacketType(GamePacketType.MapSliceSouth); AddMapDescription(message, characterSpawn, new Vector3(sourcePosition.X - 8, sourcePosition.Y + 7, targetPosition.Z), 18, 1, creatureSpawnService, tileService); }
/// <summary> /// Adds the specified message. /// </summary> /// <param name="message">The message.</param> /// <param name="friend">The friend.</param> public static void Add(NetworkMessage message, IFriend friend) { message.AddPacketType(GamePacketType.FriendEntry); message.AddUInt32(friend.Character.Id); message.AddString(friend.Character.Name); message.AddString(friend.Description); message.AddUInt32(friend.Icon); message.AddBoolean(friend.NotifyOnLogin); message.AddSessionStatus(friend.Character.Status); }
/// <summary> /// Adds the specified message. /// </summary> /// <param name="message">The message.</param> /// <param name="position">The position.</param> /// <param name="stackPosition">The stack position.</param> public static void Add(NetworkMessage message, IVector3 position, byte stackPosition) { // TODO: This magic number should not exist here... // TODO: Alternatively, we could throw an exception, handle the case before adding this packet, etc. if (stackPosition >= 10) { return; } message.AddPacketType(GamePacketType.TileRemoveArtifact); message.AddVector3(position); message.AddByte(stackPosition); }
/// <summary> /// Adds the specified message. /// </summary> /// <param name="message">The message.</param> /// <param name="creatureSpawn">The creature spawn.</param> public static void Add(NetworkMessage message, ICreatureSpawn creatureSpawn) { message.AddPacketType(GamePacketType.TileArtifactTransform); message.AddVector3(creatureSpawn.Tile.Position); message.AddByte(creatureSpawn.StackPosition); // TODO: Find out what this value means message.AddUInt16(0x63); message.AddUInt32(creatureSpawn.Id); message.AddDirection(creatureSpawn.Direction); // TODO: characterSpawn.CanWalkThrough(creatureSpawn) message.AddBoolean(false); }
/// <summary> /// Adds the specified message. /// </summary> /// <param name="message">The message.</param> /// <param name="characterSpawn">The character spawn.</param> public static void Add(NetworkMessage message, ICharacterSpawn characterSpawn) { message.AddPacketType(GamePacketType.SelfSkills); // Fist // TODO: message.AddUInt16(characterSpawn.FistSkill.Current); message.AddUInt16(characterSpawn.FistSkill.Base); message.AddUInt16(characterSpawn.FistSkill.Base); message.AddPercent(characterSpawn.FistSkill.ToPercent()); // Club // TODO: message.AddUInt16(characterSpawn.ClubSkill.Current); message.AddUInt16(characterSpawn.ClubSkill.Base); message.AddUInt16(characterSpawn.ClubSkill.Base); message.AddPercent(characterSpawn.ClubSkill.ToPercent()); // Sword // TODO: message.AddUInt16(characterSpawn.SwordSkill.Current); message.AddUInt16(characterSpawn.SwordSkill.Base); message.AddUInt16(characterSpawn.SwordSkill.Base); message.AddPercent(characterSpawn.SwordSkill.ToPercent()); // Axe // TODO: message.AddUInt16(characterSpawn.AxeSkill.Current); message.AddUInt16(characterSpawn.AxeSkill.Base); message.AddUInt16(characterSpawn.AxeSkill.Base); message.AddPercent(characterSpawn.AxeSkill.ToPercent()); // Distance // TODO: message.AddUInt16(characterSpawn.DistanceSkill.Current); message.AddUInt16(characterSpawn.DistanceSkill.Base); message.AddUInt16(characterSpawn.DistanceSkill.Base); message.AddPercent(characterSpawn.DistanceSkill.ToPercent()); // Shield // TODO: message.AddUInt16(characterSpawn.ShieldSkill.Current); message.AddUInt16(characterSpawn.ShieldSkill.Base); message.AddUInt16(characterSpawn.ShieldSkill.Base); message.AddPercent(characterSpawn.ShieldSkill.ToPercent()); // Fishing // TODO: message.AddUInt16(characterSpawn.FishingSkill.Current); message.AddUInt16(characterSpawn.FishingSkill.Base); message.AddUInt16(characterSpawn.FishingSkill.Base); message.AddPercent(characterSpawn.FishingSkill.ToPercent()); }
/// <summary> /// Adds the specified message. /// </summary> /// <param name="message">The message.</param> /// <param name="messageOfTheDay">The message of the day.</param> public static void Add(NetworkMessage message, INotification messageOfTheDay) { if (messageOfTheDay == null) { return; } if (string.IsNullOrWhiteSpace(messageOfTheDay.Value)) { return; } // TODO: MotD should have an ID that allows to flag it as 'read' for each player individually string motd = $"0\n{messageOfTheDay.Value}"; message.AddPacketType(LoginPacketType.MessageOfTheDay); message.AddString(motd); }
/// <summary> /// Adds the specified message. /// </summary> /// <param name="message">The message.</param> /// <param name="characterSpawn">The character spawn.</param> /// <param name="type">The type.</param> /// <param name="statementId">The statement identifier.</param> /// <param name="text">The text.</param> public static void Add(NetworkMessage message, CharacterSpawn characterSpawn, SpeechType type, uint statementId, string text) { message.AddPacketType(GamePacketType.CreatureSpeech); message.AddUInt32(statementId); if (characterSpawn != null) { message.AddString(characterSpawn.Character.Name); message.AddUInt16((ushort)characterSpawn.Level.Current); } else { // TODO: Is this a magic number? message.AddUInt32(0x00); } message.AddSpeechType(type); message.AddString(text); }
/// <summary> /// Adds the specified message. /// </summary> /// <param name="message">The message.</param> /// <param name="creatureSpawn">The creature spawn.</param> /// <param name="type">The type.</param> /// <param name="statementId">The statement identifier.</param> /// <param name="text">The text.</param> /// <param name="position">The position.</param> public static void Add(NetworkMessage message, ICreatureSpawn creatureSpawn, SpeechType type, uint statementId, string text, IVector3 position) { message.AddPacketType(GamePacketType.CreatureSpeech); message.AddUInt32(statementId); message.AddString(creatureSpawn.Creature.Name); // Add level only for characters if (creatureSpawn is ICharacterSpawn characterSpawn) { message.AddUInt16((ushort)characterSpawn.Level.Current); } else { message.AddUInt16(0x00); } message.AddSpeechType(type); message.AddVector3(position ?? creatureSpawn.Tile.Position); message.AddString(text); }
/// <summary> /// Adds the specified message. /// </summary> /// <param name="message">The message.</param> /// <param name="characterSpawn">The character spawn.</param> /// <param name="canReportBugs">if set to <c>true</c> [can report bugs].</param> public static void Add(NetworkMessage message, ICharacterSpawn characterSpawn, bool canReportBugs) { message.AddPacketType(GamePacketType.SelfAppear); message.AddUInt32(characterSpawn.Id); // TODO: Beat duration (50) message.AddUInt16(0x32); // TODO: Remove base speeds message.AddDouble(857.36, 3); message.AddDouble(261.29, 3); message.AddDouble(-4795.01, 3); message.AddBoolean(canReportBugs); // TODO: Can change pvp framing option message.AddByte(0x00); // TODO: Expert mode button enabled message.AddByte(0x00); }
/// <summary> /// Adds the specified message. /// </summary> /// <param name="message">The message.</param> /// <param name="creatureSpawn">The creature spawn.</param> public static void Add(NetworkMessage message, CreatureSpawn creatureSpawn) { message.AddPacketType(GamePacketType.CreatureHealth); message.AddUInt32(creatureSpawn.Id); message.AddPercent(creatureSpawn.Health.ToPercent()); }
/// <summary> /// Adds the specified message. /// </summary> /// <param name="message">The message.</param> /// <param name="friendId">The friend identifier.</param> /// <param name="status">The status.</param> public static void Add(NetworkMessage message, uint friendId, SessionStatus status) { message.AddPacketType(GamePacketType.FriendStatus); message.AddUInt32(friendId); message.AddSessionStatus(status); }
/// <summary> /// Adds the specified message. /// </summary> /// <param name="message">The message.</param> /// <param name="type">The type.</param> /// <param name="text">The text.</param> /// <param name="position">The position.</param> /// <param name="primaryValue">The primary value.</param> /// <param name="primaryColor">Color of the primary.</param> /// <param name="secondaryValue">The secondary value.</param> /// <param name="secondaryColor">Color of the secondary.</param> /// <exception cref="ArgumentNullException"></exception> public static void Add(NetworkMessage message, TextMessageType type, string text, IVector3 position, uint?primaryValue, byte?primaryColor, uint?secondaryValue, byte?secondaryColor) { message.AddPacketType(GamePacketType.TextMessage); message.AddTextMessageType(type); switch (type) { case TextMessageType.DamageDealt: case TextMessageType.DamageReceived: case TextMessageType.DamageOthers: { if (position == null) { throw new ArgumentNullException(nameof(position)); } if (primaryValue == null) { throw new ArgumentNullException(nameof(primaryValue)); } if (primaryColor == null) { throw new ArgumentNullException(nameof(primaryColor)); } if (secondaryValue == null) { throw new ArgumentNullException(nameof(secondaryValue)); } if (secondaryColor == null) { throw new ArgumentNullException(nameof(secondaryColor)); } message.AddVector3(position); message.AddUInt32(primaryValue.Value); message.AddByte(primaryColor.Value); message.AddUInt32(secondaryValue.Value); message.AddByte(secondaryColor.Value); break; } case TextMessageType.Heal: case TextMessageType.HealOthers: case TextMessageType.Experience: case TextMessageType.ExperienceOthers: { if (position == null) { throw new ArgumentNullException(nameof(position)); } if (primaryValue == null) { throw new ArgumentNullException(nameof(primaryValue)); } if (primaryColor == null) { throw new ArgumentNullException(nameof(primaryColor)); } message.AddVector3(position); message.AddUInt32(primaryValue.Value); message.AddByte(primaryColor.Value); break; } } message.AddString(text); }
/// <summary> /// Adds the specified message. /// </summary> /// <param name="message">The message.</param> /// <param name="reason">The reason.</param> public static void Add(NetworkMessage message, string reason) { message.AddPacketType(LoginPacketType.Disconnect); message.AddString(reason); }