ace/Source/ACE.Server/WorldObjects/Key.cs
fartwhif 3c6855add1 reduced some code duplication for lockable world objects (#797)
* reduced some code duplication for lockable world objects
added interface for unlocking lockable world objects

* more duplicated code abstracted
more lock implementation

* fixed lockpick success sound not working
2018-05-19 21:32:22 -07:00

44 lines
1.3 KiB
C#

using ACE.Database.Models.Shard;
using ACE.Database.Models.World;
using ACE.Entity;
using ACE.Entity.Enum.Properties;
namespace ACE.Server.WorldObjects
{
public class Key : WorldObject
{
/// <summary>
/// A new biota be created taking all of its values from weenie.
/// </summary>
public Key(Weenie weenie, ObjectGuid guid) : base(weenie, guid)
{
SetEphemeralValues();
}
/// <summary>
/// Restore a WorldObject from the database.
/// </summary>
public Key(Biota biota) : base(biota)
{
SetEphemeralValues();
}
private void SetEphemeralValues()
{
// These shoudl come from the weenie. After confirmation, remove these
//KeyCode = AceObject.KeyCode ?? "";
//Structure = AceObject.Structure ?? AceObject.MaxStructure;
}
public string KeyCode
{
get => GetProperty(PropertyString.KeyCode);
set { if (value == null) RemoveProperty(PropertyString.KeyCode); else SetProperty(PropertyString.KeyCode, value); }
}
public void HandleActionUseOnTarget(Player player, WorldObject target)
{
UnlockerHelper.UseUnlocker(player, this, target);
}
}
}