Adds assemblies config, fixes crash bugs. (#134)
This commit is contained in:
parent
0140eb73b4
commit
8ec166bcd0
3223 changed files with 191 additions and 191 deletions
|
|
@ -1,113 +0,0 @@
|
|||
using System;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public enum TrophyRank
|
||||
{
|
||||
Bronze,
|
||||
Silver,
|
||||
Gold
|
||||
}
|
||||
|
||||
[Flippable(5020, 4647)]
|
||||
public class Trophy : Item
|
||||
{
|
||||
private TrophyRank m_Rank;
|
||||
|
||||
[Constructible]
|
||||
public Trophy(string title, TrophyRank rank) : base(5020)
|
||||
{
|
||||
Title = title;
|
||||
m_Rank = rank;
|
||||
Date = DateTime.UtcNow;
|
||||
|
||||
LootType = LootType.Blessed;
|
||||
|
||||
UpdateStyle();
|
||||
}
|
||||
|
||||
public Trophy(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public string Title { get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public TrophyRank Rank
|
||||
{
|
||||
get => m_Rank;
|
||||
set
|
||||
{
|
||||
m_Rank = value;
|
||||
UpdateStyle();
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public Mobile Owner { get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public DateTime Date { get; private set; }
|
||||
|
||||
public override void Serialize(IGenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(1); // version
|
||||
|
||||
writer.Write(Title);
|
||||
writer.Write((int)m_Rank);
|
||||
writer.Write(Owner);
|
||||
writer.Write(Date);
|
||||
}
|
||||
|
||||
public override void Deserialize(IGenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
Title = reader.ReadString();
|
||||
m_Rank = (TrophyRank)reader.ReadInt();
|
||||
Owner = reader.ReadMobile();
|
||||
Date = reader.ReadDateTime();
|
||||
|
||||
if (version == 0)
|
||||
LootType = LootType.Blessed;
|
||||
}
|
||||
|
||||
public override void OnAdded(IEntity parent)
|
||||
{
|
||||
base.OnAdded(parent);
|
||||
|
||||
Owner ??= RootParent as Mobile;
|
||||
}
|
||||
|
||||
public override void OnSingleClick(Mobile from)
|
||||
{
|
||||
base.OnSingleClick(from);
|
||||
|
||||
if (Owner != null)
|
||||
LabelTo(from, "{0} -- {1}", Title, Owner.RawName);
|
||||
else if (Title != null)
|
||||
LabelTo(from, Title);
|
||||
|
||||
if (Date != DateTime.MinValue)
|
||||
LabelTo(from, Date.ToString("d"));
|
||||
}
|
||||
|
||||
public void UpdateStyle()
|
||||
{
|
||||
Name = $"{m_Rank.ToString().ToLower()} trophy";
|
||||
|
||||
Hue = m_Rank switch
|
||||
{
|
||||
TrophyRank.Gold => 2213,
|
||||
TrophyRank.Silver => 0,
|
||||
TrophyRank.Bronze => 2206,
|
||||
_ => Hue
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue