public ChestSpawnMapEntity WithKey(ChestKey key) { var newEntity = MakeCopy(this); newEntity.Key = key; return(newEntity); }
private ChestSpawnMapEntity(int x, int y, ChestKey key, byte slot, short itemID, short respawnTime, int amount) { X = x; Y = y; Key = key; Slot = slot; ItemID = itemID; RespawnTime = respawnTime; Amount = amount; }
public ChestKey CanOpenChest(MapChest chest) { ChestKey permission = chest.key; ItemRecord 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 = (ItemRecord)World.Instance.EIF.Data.Find(_rec => ((ItemRecord)_rec).Name != null && ((ItemRecord)_rec).Name.ToLower() == "normal key"); break; case ChestKey.Crystal: rec = (ItemRecord)World.Instance.EIF.Data.Find(_rec => ((ItemRecord)_rec).Name != null && ((ItemRecord)_rec).Name.ToLower() == "crystal key"); break; case ChestKey.Silver: rec = (ItemRecord)World.Instance.EIF.Data.Find(_rec => ((ItemRecord)_rec).Name != null && ((ItemRecord)_rec).Name.ToLower() == "silver key"); break; case ChestKey.Wraith: rec = (ItemRecord)World.Instance.EIF.Data.Find(_rec => ((ItemRecord)_rec).Name != null && ((ItemRecord)_rec).Name.ToLower() == "wraith key"); break; default: return(permission); } if (rec != null && Inventory.FindIndex(_ii => _ii.id == 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. { EODialog.Show( string.Format("Unable to find key for {0} in EIF. This chest will never be opened!", Enum.GetName(typeof(ChestKey), permission)), "Warning", XNADialogButtons.Ok, EODialogStyle.SmallDialogSmallHeader); } return(permission); }