Overwrite
Complete Overwrite of the Folder with the free shard. ServUO 57.3 has been added.
This commit is contained in:
88
Scripts/Spells/Spellweaving/Items/ArcaneFocus.cs
Normal file
88
Scripts/Spells/Spellweaving/Items/ArcaneFocus.cs
Normal file
@@ -0,0 +1,88 @@
|
||||
using System;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class ArcaneFocus : TransientItem
|
||||
{
|
||||
private int m_StrengthBonus;
|
||||
[Constructable]
|
||||
public ArcaneFocus()
|
||||
: this(TimeSpan.FromHours(1), 1)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public ArcaneFocus(int lifeSpan, int strengthBonus)
|
||||
: this(TimeSpan.FromSeconds(lifeSpan), strengthBonus)
|
||||
{
|
||||
}
|
||||
|
||||
public ArcaneFocus(TimeSpan lifeSpan, int strengthBonus)
|
||||
: base(0x3155, lifeSpan)
|
||||
{
|
||||
this.LootType = LootType.Blessed;
|
||||
this.m_StrengthBonus = strengthBonus;
|
||||
}
|
||||
|
||||
public ArcaneFocus(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int LabelNumber
|
||||
{
|
||||
get
|
||||
{
|
||||
return 1032629;
|
||||
}
|
||||
}// Arcane Focus
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int StrengthBonus
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_StrengthBonus;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.m_StrengthBonus = value;
|
||||
}
|
||||
}
|
||||
public override TextDefinition InvalidTransferMessage
|
||||
{
|
||||
get
|
||||
{
|
||||
return 1073480;
|
||||
}
|
||||
}// Your arcane focus disappears.
|
||||
public override bool Nontransferable
|
||||
{
|
||||
get
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
list.Add(1060485, this.m_StrengthBonus.ToString()); // strength bonus ~1_val~
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write((int)0);
|
||||
|
||||
writer.Write(this.m_StrengthBonus);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadInt();
|
||||
|
||||
this.m_StrengthBonus = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
131
Scripts/Spells/Spellweaving/Items/TransientItem.cs
Normal file
131
Scripts/Spells/Spellweaving/Items/TransientItem.cs
Normal file
@@ -0,0 +1,131 @@
|
||||
using System;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class TransientItem : Item
|
||||
{
|
||||
private TimeSpan m_LifeSpan;
|
||||
private DateTime m_CreationTime;
|
||||
private Timer m_Timer;
|
||||
[Constructable]
|
||||
public TransientItem(int itemID, TimeSpan lifeSpan)
|
||||
: base(itemID)
|
||||
{
|
||||
this.m_CreationTime = DateTime.UtcNow;
|
||||
this.m_LifeSpan = lifeSpan;
|
||||
|
||||
this.m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(5), new TimerCallback(CheckExpiry));
|
||||
}
|
||||
|
||||
public TransientItem(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public TimeSpan LifeSpan
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_LifeSpan;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.m_LifeSpan = value;
|
||||
}
|
||||
}
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public DateTime CreationTime
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_CreationTime;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.m_CreationTime = value;
|
||||
}
|
||||
}
|
||||
public override bool Nontransferable
|
||||
{
|
||||
get
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
public virtual TextDefinition InvalidTransferMessage
|
||||
{
|
||||
get
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
public override void HandleInvalidTransfer(Mobile from)
|
||||
{
|
||||
if (this.InvalidTransferMessage != null)
|
||||
TextDefinition.SendMessageTo(from, this.InvalidTransferMessage);
|
||||
|
||||
this.Delete();
|
||||
}
|
||||
|
||||
public virtual void Expire(Mobile parent)
|
||||
{
|
||||
if (parent != null)
|
||||
parent.SendLocalizedMessage(1072515, (this.Name == null ? String.Format("#{0}", this.LabelNumber) : this.Name)); // The ~1_name~ expired...
|
||||
|
||||
Effects.PlaySound(this.GetWorldLocation(), this.Map, 0x201);
|
||||
|
||||
this.Delete();
|
||||
}
|
||||
|
||||
public virtual void SendTimeRemainingMessage(Mobile to)
|
||||
{
|
||||
to.SendLocalizedMessage(1072516, String.Format("{0}\t{1}", (this.Name == null ? String.Format("#{0}", this.LabelNumber) : this.Name), (int)this.m_LifeSpan.TotalSeconds)); // ~1_name~ will expire in ~2_val~ seconds!
|
||||
}
|
||||
|
||||
public override void OnDelete()
|
||||
{
|
||||
if (this.m_Timer != null)
|
||||
this.m_Timer.Stop();
|
||||
|
||||
base.OnDelete();
|
||||
}
|
||||
|
||||
public virtual void CheckExpiry()
|
||||
{
|
||||
if ((this.m_CreationTime + this.m_LifeSpan) < DateTime.UtcNow)
|
||||
this.Expire(this.RootParent as Mobile);
|
||||
else
|
||||
this.InvalidateProperties();
|
||||
}
|
||||
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
TimeSpan remaining = ((this.m_CreationTime + this.m_LifeSpan) - DateTime.UtcNow);
|
||||
|
||||
list.Add(1072517, ((int)remaining.TotalSeconds).ToString()); // Lifespan: ~1_val~ seconds
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write((int)0);
|
||||
|
||||
writer.Write(this.m_LifeSpan);
|
||||
writer.Write(this.m_CreationTime);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadInt();
|
||||
|
||||
this.m_LifeSpan = reader.ReadTimeSpan();
|
||||
this.m_CreationTime = reader.ReadDateTime();
|
||||
|
||||
this.m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(5), new TimerCallback(CheckExpiry));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user