/// <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; } } }