Esempio n. 1
0
 public Item(string name)
 {
     this.name    = name;
     tier         = Tier.common;
     lootCategory = LootCategory.foraging;
     buyValue     = 0;
     sellValue    = 0;
 }
Esempio n. 2
0
        public Item GetRandomItem(string fieldName, LootCategory lootCategory)
        {
            Field field = GetField(fieldName);

            if (field == null)
            {
                return(null);
            }

            return(GetRandomItem(field.loot, lootCategory, 0));
        }
Esempio n. 3
0
    public LootConfig GetLootConfig(LootCategory cat)
    {
        List <LootConfig> configs = LootConfigs.Where(lc => lc.Category == cat).ToList();

        /*      List<WeightedRegion> configs = Regions.Where( r =>  ..... ) ).ToList();
         *
         *      WeightedRegion wr = WeightableFactory.GetWeighted(configs);*/
        LootConfig conf = M_Math.GetRandomObject(configs);

        return(conf);
    }
Esempio n. 4
0
 public static void AddLoot(Tile target, LootCategory Category)
 {
     if (target.GetComponent <Tile_Loot>() == null)
     {
         target.gameObject.AddComponent <Tile_Loot>().SetLoot(LootBalance.GetBalance().GetLootConfig(Category));
     }
     else
     {
         Debug.LogWarning("Tile already has a loot " + target.name);
     }
 }
Esempio n. 5
0
        private PlayerTask GetTask(LootCategory category)
        {
            switch (category)
            {
            case LootCategory.fishing: return(new Fishing());

            case LootCategory.foraging: return(new Foraging());

            case LootCategory.hunting: return(new Hunting());

            case LootCategory.mining: return(new Mining());
            }
            return(null);
        }
Esempio n. 6
0
    void ToggleLoot(Tile t, LootCategory loot)
    {
        AddLootOnSpawn l = t.GetComponent <AddLootOnSpawn>();

        if (l == null)
        {
            t.gameObject.AddComponent <AddLootOnSpawn>().Category = loot;
        }
        else
        {
            DestroyImmediate(l);
            EditorGUIUtility.ExitGUI();
        }
    }
Esempio n. 7
0
        private async Task Gather(LootCategory category)
        {
            Player player;
            string log;

            if (CheckIfBusy(out player, out log))
            {
                PlayerTask task = GetTask(category);
                player.SetTask(task);

                log = $"{Context.User.Mention} {task.Description()}";
                PlayerData.Instance.SavePlayer(player.id);
            }

            await ReplyAsync(log);
        }
Esempio n. 8
0
        protected void RandomLoot(string username, Player player, EmbedBuilder builder, LootCategory category)
        {
            Dictionary <string, InventoryItem> loot = new Dictionary <string, InventoryItem>();

            Random random = new Random();

            if (hoursPassed >= 1)
            {
                for (double i = 0; i < hoursPassed; i++)
                {
                    Item item = GameData.Instance.GetRandomItem(player.field, category);
                    if (item != null)
                    {
                        if (!loot.ContainsKey(item.name))
                        {
                            loot.Add(item.name, new InventoryItem(item, 0));
                        }

                        int count = random.Next(1, (int)item.tier);
                        if (count > 0)
                        {
                            loot[item.name].amount += count;
                            player.inventory.AddItem(item, count);
                        }
                    }
                }
            }

            if (builder == null)
            {
                return;
            }
            builder.WithTitle($"Items added to {username}'s Inventory!")
            .WithCurrentTimestamp();
            foreach (KeyValuePair <string, InventoryItem> l in loot)
            {
                builder.AddField(l.Key + $" x{l.Value.amount}", l.Value.item.Description);
            }
        }