Esempio n. 1
0
        public ChestKey CanOpenChest(ChestSpawnMapEntity chest)
        {
            ChestKey permission = chest.Key;

            EIFRecord rec;

            switch (permission) //note - it would be nice to be able to send the Item IDs of the keys in the welcome packet or something
            {
            case ChestKey.Normal:
                rec = OldWorld.Instance.EIF.Data.Single(_rec => _rec.Name != null && _rec.Name.ToLower() == "normal key");
                break;

            case ChestKey.Crystal:
                rec = OldWorld.Instance.EIF.Data.Single(_rec => _rec.Name != null && _rec.Name.ToLower() == "crystal key");
                break;

            case ChestKey.Silver:
                rec = OldWorld.Instance.EIF.Data.Single(_rec => _rec.Name != null && _rec.Name.ToLower() == "silver key");
                break;

            case ChestKey.Wraith:
                rec = OldWorld.Instance.EIF.Data.Single(_rec => _rec.Name != null && _rec.Name.ToLower() == "wraith key");
                break;

            default:
                return(permission);
            }

            if (rec != null && Inventory.FindIndex(_ii => _ii.ItemID == rec.ID) >= 0)
            {
                permission = ChestKey.None;
            }
            else if (rec == null) //show a warning saying that this chest is perma-locked. Non-standard pub files will cause this.
            {
                EOMessageBox.Show(
                    $"Unable to find key for {Enum.GetName(typeof(ChestKey), permission)} in EIF. This chest will never be opened!", "Warning", EODialogButtons.Ok, EOMessageBoxStyle.SmallDialogSmallHeader);
            }

            return(permission);
        }
Esempio n. 2
0
 public Chest(ChestSpawnMapEntity chest)
 {
 }
Esempio n. 3
0
 private static ChestSpawnMapEntity MakeCopy(ChestSpawnMapEntity src)
 {
     return(new ChestSpawnMapEntity(
                src.X, src.Y, src.Key, src.Slot, src.ItemID, src.RespawnTime, src.Amount));
 }