예제 #1
0
        public SandboxTile UpgradeTile(SandboxTile tile)
        {
            TileSchematic ts = TileSchematics.GetSchem(tile.type, tile.tier + 1);

            tile.Upgrade(this, ts);
            return(tile);
        }
예제 #2
0
        public SandboxTile Build(SandboxTile.TileType type)
        {
            TileSchematic ts   = TileSchematics.GetSchem(type, 0);
            SandboxTile   tile = ts.Build(this);

            tiles.Add(tile);

            return(tile);
        }
예제 #3
0
        internal static async Task ProduceAmount(Player player, Sandbox sb, string source, int tileIndex, int productIndex, int amount, ISocketMessageChannel channel)
        {
            SandboxTile      tile   = sb.tiles[tileIndex];
            ProductionRecipe recipe = ProductionRecipes.Get(tile.type, tile.productionOptions[productIndex]);

            await player.EditUI(null, DUtils.BuildEmbed($"Product {recipe} from {tile.Name}", null, null, player.userSettings.Color,
                                                        DUtils.NewField("Select Amount",
                                                                        $"{EUI.ok} Produce **[{amount}]**" + Environment.NewLine +
                                                                        $"{EUI.prev}|{EUI.lowerthan}|{EUI.greaterthan}|{EUI.next}"
                                                                        + Environment.NewLine +
                                                                        $" -5 | -1 | +1 | +5 |" + Environment.NewLine +
                                                                        $"Or `amount` command: `amount 10`"),
                                                        recipe.ToField(amount)
                                                        ).Build(), channel, MsgType.TileProduce, $"{source};{tileIndex};{productIndex};{amount}");
        }
예제 #4
0
        internal static async Task ProductSelection(Player player, Sandbox sb, string source, int tileIndex, int page, ISocketMessageChannel channel)
        {
            SandboxTile tile = sb.tiles[tileIndex];

            int count = tile.productionOptions.Count;
            int max   = count / RECIPE_PERP;

            if (page < 0)
            {
                page = max;
            }
            else if (page > max)
            {
                page = max;
            }

            int start    = page * RECIPE_PERP;
            var products = tile.productionOptions.GetRange(start, Math.Min(RECIPE_PERP, count - start));

            await player.EditUI(null, DUtils.BuildEmbed($"{tile.Name} Productions",
                                                        products.Join(Environment.NewLine, (name, i) => $"{EUI.GetNum(i + 1)} {name}"),
                                                        null, player.userSettings.Color).Build(), channel,
                                MsgType.TileProductions, $"{source};{tileIndex};{products.Count};{page}");
        }
예제 #5
0
 internal static async Task InspectTile(Player player, Sandbox sb, string source, int index, ISocketMessageChannel channel)
 {
     SandboxTile tile = sb.tiles[index];
     await player.EditUI(null, tile.ToEmbed(sb.tier, player.userSettings.Color), channel,
                         MsgType.TileControls, $"{source};{index};{(tile.production != null ? tile.AmountReady.ToString() : "null")}");
 }