/// <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="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 tile description. /// </summary> /// <param name="message">The message.</param> /// <param name="characterSpawn">The character spawn.</param> /// <param name="tile">The tile.</param> /// <param name="tileService">The tile service.</param> /// <param name="creatureSpawnService">The creature spawn service.</param> public static void AddTileDescription(NetworkMessage message, ICharacterSpawn characterSpawn, ITile tile, TileService tileService, CreatureSpawnService creatureSpawnService) { // TODO: This should probably throw an exception if (tile == null) { return; } // Environmental effects // TODO: These magic numbers should not be hard-coded message.AddUInt16(0x00); int count; if (tile.Ground != null) { message.AddItemSpawn(tile.Ground); // TODO: These magic numbers should not be hard-coded count = 1; } else { // TODO: These magic numbers should not be hard-coded count = 0; } foreach (IItemSpawn item in tile.GetItemsBeforeMediumPriority()) { message.AddItemSpawn(item); // TODO: These magic numbers should not be hard-coded if (++count == 10) { return; } } foreach (ICreatureSpawn creature in tileService.GetCreaturesByPosition(tile.Position)) { if (!characterSpawn.CanSee(creature)) { continue; } bool known = characterSpawn.Connection.IsCreatureKnown(creature, creatureSpawnService, out uint removeKnown); AddCreature(message, characterSpawn, creature, known, removeKnown); // TODO: These magic numbers should not be hard-coded if (++count == 10) { return; } } foreach (IItemSpawn item in tile.GetItemsAfterMediumPriority()) { message.AddItemSpawn(item); // TODO: These magic numbers should not be hard-coded if (++count == 10) { return; } } }