Example #1
0
        public void ParseChests(string chestString)
        {
            this.Chests = new Dictionary <int, ChestDef>();

            string[] chestDefinitions = chestString.Split('|');

            foreach (string def in chestDefinitions)
            {
                string[] chestInfo = def.Split(',');
                if (chestInfo.Length == 3)
                {
                    // A Farm chest
                    ChestDef cd = new ChestDef(Convert.ToInt32(chestInfo[1]), Convert.ToInt32(chestInfo[2]), "Farm");
                    this.Chests.Add(Convert.ToInt32(chestInfo[0]), cd);
                    this.Monitor.Log($"Parsing chest: {cd.X},{cd.Y} for item: {chestInfo[0]}, location: {cd.Location}", LogLevel.Trace);
                }
                else if (chestInfo.Length == 4)
                {
                    // A farm house chest
                    ChestDef cd = new ChestDef(Convert.ToInt32(chestInfo[1]), Convert.ToInt32(chestInfo[2]), chestInfo[3]);
                    this.Chests.Add(Convert.ToInt32(chestInfo[0]), cd);
                    this.Monitor.Log($"Parsing chest: {cd.X},{cd.Y} for item: {chestInfo[0]}, location: {cd.Location}", LogLevel.Trace);
                }
            }
        }
Example #2
0
        public Object GetChest(int itemId)
        {
            ChestDef def = this.GetChestDef(itemId);

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

            GameLocation loc = Game1.getLocationFromName(def.Location);

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

            loc.objects.TryGetValue(def.Tile, out Object chest);
            return(chest as Chest);
        }
Example #3
0
        public void ParseChests(List <string> chestList)
        {
            Chests = new Dictionary <int, ChestDef>();

            foreach (var def in chestList)
            {
                var chestInfo = def.Split(',');
                if (chestInfo.Length == 3)
                {
                    // A Farm chest
                    var cd = new ChestDef(Convert.ToInt32(chestInfo[1]), Convert.ToInt32(chestInfo[2]), "Farm");
                    Chests.Add(Convert.ToInt32(chestInfo[0]), cd);
                    Monitor.Log($"Parsing chest: {cd.X},{cd.Y} for item: {chestInfo[0]}, location: {cd.Location}");
                }
                else if (chestInfo.Length == 4)
                {
                    // Another location.
                    var cd = new ChestDef(Convert.ToInt32(chestInfo[1]), Convert.ToInt32(chestInfo[2]), chestInfo[3]);
                    Chests.Add(Convert.ToInt32(chestInfo[0]), cd);
                    Monitor.Log($"Parsing chest: {cd.X},{cd.Y} for item: {chestInfo[0]}, location: {cd.Location}");
                }
            }
        }
Example #4
0
 public void SetDefault(Vector2 v)
 {
     this.DefaultChest = new ChestDef((int)v.X, (int)v.Y);
 }