Overwrite
Complete Overwrite of the Folder with the free shard. ServUO 57.3 has been added.
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
using Server;
|
||||
using System;
|
||||
using Server.Mobiles;
|
||||
using Server.Engines.VoidPool;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class BestWaveBoard : Item
|
||||
{
|
||||
public override bool ForceShowProperties { get { return true; } }
|
||||
|
||||
[Constructable]
|
||||
public BestWaveBoard() : base(7774)
|
||||
{
|
||||
Name = "Void Pool - Best Wave";
|
||||
Movable = false;
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile m)
|
||||
{
|
||||
if(m is PlayerMobile && m.InRange(this.Location, 3))
|
||||
m.SendGump(new ScoresGump(m.Map == Map.Felucca ? VoidPoolController.InstanceFel : VoidPoolController.InstanceTram, m as PlayerMobile, ScoreType.BestWave));
|
||||
}
|
||||
|
||||
public BestWaveBoard(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write(0);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
using Server;
|
||||
using System;
|
||||
using Server.Engines.Craft;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
[Alterable(typeof(DefBlacksmithy), typeof(GargishBlightOfTheTundra))]
|
||||
public class BlightOfTheTundra : CompositeBow
|
||||
{
|
||||
public override int LabelNumber { get { return 1152727; } } // Blight of the Tundra
|
||||
public override bool IsArtifact { get { return true; } }
|
||||
|
||||
[Constructable]
|
||||
public BlightOfTheTundra() : this(true)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public BlightOfTheTundra(bool antique)
|
||||
{
|
||||
Attributes.BonusStr = 5;
|
||||
Attributes.RegenStam = 10;
|
||||
Attributes.AttackChance = 15;
|
||||
Attributes.WeaponSpeed = 45;
|
||||
Attributes.WeaponDamage = 50;
|
||||
|
||||
Slayer = BaseRunicTool.GetRandomSlayer();
|
||||
|
||||
WeaponAttributes.ResistColdBonus = 15;
|
||||
AosElementDamages.Fire = 100;
|
||||
Hue = 1165;
|
||||
|
||||
if (antique)
|
||||
{
|
||||
MaxHitPoints = 250;
|
||||
NegativeAttributes.Antique = 1;
|
||||
}
|
||||
else
|
||||
MaxHitPoints = 255;
|
||||
|
||||
HitPoints = MaxHitPoints;
|
||||
}
|
||||
|
||||
public BlightOfTheTundra(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write(0);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class GargishBlightOfTheTundra : SoulGlaive
|
||||
{
|
||||
public override int LabelNumber { get { return 1152727; } } // Blight of the Tundra
|
||||
public override bool IsArtifact { get { return true; } }
|
||||
|
||||
[Constructable]
|
||||
public GargishBlightOfTheTundra() : this(true)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public GargishBlightOfTheTundra(bool antique)
|
||||
{
|
||||
Attributes.BonusStr = 5;
|
||||
Attributes.RegenStam = 10;
|
||||
Attributes.AttackChance = 15;
|
||||
Attributes.WeaponSpeed = 45;
|
||||
Attributes.WeaponDamage = 50;
|
||||
|
||||
Slayer = BaseRunicTool.GetRandomSlayer();
|
||||
|
||||
WeaponAttributes.ResistColdBonus = 15;
|
||||
AosElementDamages.Fire = 100;
|
||||
Hue = 1165;
|
||||
|
||||
if (antique)
|
||||
{
|
||||
MaxHitPoints = 250;
|
||||
NegativeAttributes.Antique = 1;
|
||||
}
|
||||
else
|
||||
MaxHitPoints = 255;
|
||||
|
||||
HitPoints = MaxHitPoints;
|
||||
}
|
||||
|
||||
public GargishBlightOfTheTundra(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write(0);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
using Server;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class BraceletOfProtection : GoldBracelet
|
||||
{
|
||||
public override int LabelNumber { get { return 1152730; } } // Bracelet of Protection
|
||||
public override bool IsArtifact { get { return true; } }
|
||||
|
||||
[Constructable]
|
||||
public BraceletOfProtection()
|
||||
: this(true)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public BraceletOfProtection(bool antique)
|
||||
{
|
||||
Hue = 1157;
|
||||
Attributes.BonusHits = 5;
|
||||
Attributes.RegenHits = 10;
|
||||
Attributes.DefendChance = 5;
|
||||
|
||||
switch (Utility.Random(6))
|
||||
{
|
||||
case 0: AbsorptionAttributes.EaterKinetic = 15; break;
|
||||
case 1: AbsorptionAttributes.EaterFire = 15; break;
|
||||
case 2: AbsorptionAttributes.EaterCold = 15; break;
|
||||
case 3: AbsorptionAttributes.EaterPoison = 15; break;
|
||||
case 4: AbsorptionAttributes.EaterEnergy = 15; break;
|
||||
case 5: AbsorptionAttributes.EaterDamage = 15; break;
|
||||
}
|
||||
|
||||
if (antique)
|
||||
{
|
||||
MaxHitPoints = 250;
|
||||
NegativeAttributes.Antique = 1;
|
||||
}
|
||||
else
|
||||
MaxHitPoints = 255;
|
||||
|
||||
HitPoints = MaxHitPoints;
|
||||
}
|
||||
|
||||
public BraceletOfProtection(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write(0);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
using Server;
|
||||
using System;
|
||||
using Server.Engines.Craft;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
[Alterable(typeof(DefBlacksmithy), typeof(GargishBrightblade))]
|
||||
public class Brightblade : Katana
|
||||
{
|
||||
public override int LabelNumber { get { return 1152732; } } // Brightblade
|
||||
public override bool IsArtifact { get { return true; } }
|
||||
|
||||
[Constructable]
|
||||
public Brightblade()
|
||||
{
|
||||
WeaponAttributes.HitLeechStam = 100;
|
||||
WeaponAttributes.SplinteringWeapon = 20;
|
||||
Attributes.RegenStam = 3;
|
||||
Attributes.AttackChance = 10;
|
||||
Attributes.CastSpeed = 1;
|
||||
Attributes.WeaponSpeed = 40;
|
||||
Attributes.WeaponDamage = 50;
|
||||
AosElementDamages.Fire = 100;
|
||||
Hue = 1756;
|
||||
}
|
||||
|
||||
public Brightblade(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int InitMinHits { get { return 255; } }
|
||||
public override int InitMaxHits { get { return 255; } }
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write(0);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class GargishBrightblade : GargishKatana
|
||||
{
|
||||
public override int LabelNumber { get { return 1152732; } } // Brightblade
|
||||
public override bool IsArtifact { get { return true; } }
|
||||
|
||||
[Constructable]
|
||||
public GargishBrightblade()
|
||||
{
|
||||
WeaponAttributes.HitLeechStam = 100;
|
||||
WeaponAttributes.SplinteringWeapon = 20;
|
||||
Attributes.RegenStam = 3;
|
||||
Attributes.AttackChance = 10;
|
||||
Attributes.CastSpeed = 1;
|
||||
Attributes.WeaponSpeed = 40;
|
||||
Attributes.WeaponDamage = 50;
|
||||
AosElementDamages.Fire = 100;
|
||||
Hue = 1756;
|
||||
}
|
||||
|
||||
public GargishBrightblade(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int InitMinHits { get { return 255; } }
|
||||
public override int InitMaxHits { get { return 255; } }
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write(0);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,388 @@
|
||||
using Server;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.Mobiles;
|
||||
using Server.Targeting;
|
||||
using Server.Multis;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class CauldronOfTransmutation : BaseAddon
|
||||
{
|
||||
public const int DecayPeriod = 4;
|
||||
private int _Charges;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int Charges
|
||||
{
|
||||
get { return _Charges; }
|
||||
set
|
||||
{
|
||||
_Charges = value;
|
||||
|
||||
if (_Charges <= 0 && this.RootParent is Mobile)
|
||||
((Mobile)RootParent).SendLocalizedMessage(1152635); // The cauldron's magic is exhausted
|
||||
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public DateTime Expires { get; set; }
|
||||
|
||||
public Timer DecayTimer { get; private set; }
|
||||
|
||||
public override bool RetainDeedHue { get { return true; } }
|
||||
|
||||
public CauldronOfTransmutation()
|
||||
{
|
||||
Charges = 5000;
|
||||
|
||||
AddComponent(new InternalComponent(2421), 0, 0, 0);
|
||||
|
||||
Expires = DateTime.UtcNow + TimeSpan.FromHours(DecayPeriod);
|
||||
BeginTimer();
|
||||
}
|
||||
|
||||
public void BeginTimer()
|
||||
{
|
||||
EndTimer();
|
||||
|
||||
DecayTimer = Timer.DelayCall(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(10), CheckDecay);
|
||||
DecayTimer.Start();
|
||||
}
|
||||
|
||||
public void EndTimer()
|
||||
{
|
||||
if (DecayTimer != null)
|
||||
{
|
||||
DecayTimer.Stop();
|
||||
DecayTimer = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void CheckDecay()
|
||||
{
|
||||
if (Expires < DateTime.UtcNow)
|
||||
Decay();
|
||||
else
|
||||
InvalidateProperties();
|
||||
}
|
||||
|
||||
public void Decay()
|
||||
{
|
||||
if (RootParent is Mobile)
|
||||
{
|
||||
Mobile parent = (Mobile)RootParent;
|
||||
|
||||
if (Name == null)
|
||||
parent.SendLocalizedMessage(1072515, "#" + LabelNumber); // The ~1_name~ expired...
|
||||
else
|
||||
parent.SendLocalizedMessage(1072515, Name); // The ~1_name~ expired...
|
||||
|
||||
Effects.SendLocationParticles(EffectItem.Create(parent.Location, parent.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042);
|
||||
Effects.PlaySound(parent.Location, parent.Map, 0x201);
|
||||
}
|
||||
else
|
||||
{
|
||||
Effects.SendLocationParticles(EffectItem.Create(this.Location, this.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042);
|
||||
Effects.PlaySound(this.Location, this.Map, 0x201);
|
||||
}
|
||||
|
||||
Delete();
|
||||
}
|
||||
|
||||
public override void Delete()
|
||||
{
|
||||
base.Delete();
|
||||
|
||||
EndTimer();
|
||||
}
|
||||
|
||||
public override void OnComponentUsed(AddonComponent c, Mobile from)
|
||||
{
|
||||
if (from.InRange(c.Location, 3))
|
||||
{
|
||||
BaseHouse house = BaseHouse.FindHouseAt(from);
|
||||
|
||||
if (house != null && house.IsCoOwner(from))
|
||||
{
|
||||
from.Target = new InternalTarget(this);
|
||||
from.SendLocalizedMessage(1152738); // Target ingots in your backpack to transmute them.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool TryTransmutate(Mobile from, Item dropped)
|
||||
{
|
||||
BaseHouse house = BaseHouse.FindHouseAt(from);
|
||||
|
||||
if (house != null && house.IsOwner(from))
|
||||
{
|
||||
CraftResource res = CraftResources.GetFromType(dropped.GetType());
|
||||
|
||||
if (res == Resource)
|
||||
{
|
||||
if (dropped.Amount < 3)
|
||||
from.SendLocalizedMessage(1152634); // There is not enough to transmute
|
||||
else if (Charges <= 0)
|
||||
from.SendLocalizedMessage(1152635); // The cauldron's magic is exhausted
|
||||
else
|
||||
{
|
||||
CraftResourceInfo info = CraftResources.GetInfo(Resource + 1);
|
||||
|
||||
if (info != null && info.ResourceTypes.Length > 0)
|
||||
{
|
||||
int toDrop = Math.Min(Charges * 3, dropped.Amount);
|
||||
CraftResource newRes = (CraftResource)(int)res + 1;
|
||||
|
||||
while (toDrop % 3 != 0)
|
||||
toDrop--;
|
||||
|
||||
int newAmount = toDrop / 3;
|
||||
|
||||
if (toDrop < dropped.Amount)
|
||||
dropped.Amount -= toDrop;
|
||||
else
|
||||
dropped.Delete();
|
||||
|
||||
Item item = Loot.Construct(info.ResourceTypes[0]);
|
||||
|
||||
if (item != null)
|
||||
{
|
||||
item.Amount = newAmount;
|
||||
from.AddToBackpack(item);
|
||||
|
||||
from.SendLocalizedMessage(1152636); // The cauldron transmutes the material
|
||||
|
||||
from.PlaySound(Utility.RandomList(0x22, 0x23));
|
||||
|
||||
Charges -= newAmount;
|
||||
Components.ForEach(c => c.InvalidateProperties());
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
from.SendLocalizedMessage(1152633); // The cauldron cannot transmute that
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
from.SendLocalizedMessage(1152632); // That is not yours!
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
public CauldronOfTransmutation Addon { get; set; }
|
||||
|
||||
public InternalTarget(CauldronOfTransmutation addon)
|
||||
: base(-1, false, TargetFlags.None)
|
||||
{
|
||||
Addon = addon;
|
||||
}
|
||||
|
||||
protected override void OnTarget(Mobile from, object targeted)
|
||||
{
|
||||
if (Addon == null || !from.InRange(Addon.Location, 3))
|
||||
from.SendLocalizedMessage(500295); // You are too far away to do that.
|
||||
|
||||
if (targeted is Item)
|
||||
Addon.TryTransmutate(from, (Item)targeted);
|
||||
}
|
||||
}
|
||||
|
||||
private class InternalComponent : AddonComponent
|
||||
{
|
||||
public override bool ForceShowProperties { get { return true; } }
|
||||
|
||||
public InternalComponent(int id)
|
||||
: base(id)
|
||||
{
|
||||
}
|
||||
|
||||
public override void AddNameProperty(ObjectPropertyList list)
|
||||
{
|
||||
if (Addon != null && Addon.Resource != CraftResource.None)
|
||||
list.Add(1152600, String.Format("#{0}", CraftResources.GetLocalizationNumber(Addon.Resource).ToString())); // ~1_RES~ Cauldron of Transmutation
|
||||
else
|
||||
base.AddNameProperty(list);
|
||||
}
|
||||
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
if (Addon == null || !(Addon is CauldronOfTransmutation) || Addon.Resource == CraftResource.None)
|
||||
return;
|
||||
|
||||
int left = 0;
|
||||
if (DateTime.UtcNow < ((CauldronOfTransmutation)Addon).Expires)
|
||||
left = (int)(((CauldronOfTransmutation)Addon).Expires - DateTime.UtcNow).TotalSeconds;
|
||||
|
||||
list.Add(1072517, left.ToString()); // Lifespan: ~1_val~ seconds
|
||||
|
||||
CraftResource res = Addon.Resource;
|
||||
CraftResource res2 = (CraftResource)(int)res + 1;
|
||||
|
||||
list.Add(1152630, String.Format("#{0}\t#{1}", CraftResources.GetLocalizationNumber(Addon.Resource), CraftResources.GetLocalizationNumber(res2))); // transmutes ~1_SOURCE~ to ~2_DEST~
|
||||
list.Add(1152631, String.Format("3\t1")); // ratio ~1_INPUT~ to ~2_OUTPUT~
|
||||
list.Add(1060584, ((CauldronOfTransmutation)Addon).Charges.ToString()); // uses remaining: ~1_val~
|
||||
|
||||
}
|
||||
|
||||
public InternalComponent(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write(0);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
public CauldronOfTransmutation(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write(0);
|
||||
|
||||
writer.Write(Expires);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadInt();
|
||||
|
||||
Expires = reader.ReadDateTime();
|
||||
|
||||
if (Expires < DateTime.UtcNow)
|
||||
Decay();
|
||||
else
|
||||
BeginTimer();
|
||||
}
|
||||
}
|
||||
|
||||
public class CauldronOfTransmutationDeed : BaseAddonDeed
|
||||
{
|
||||
public override BaseAddon Addon { get { return new CauldronOfTransmutation(); } }
|
||||
|
||||
public const int DecayPeriod = 24;
|
||||
|
||||
private Timer m_Timer;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public DateTime Expires { get; set; }
|
||||
|
||||
[Constructable]
|
||||
public CauldronOfTransmutationDeed(CraftResource resource)
|
||||
{
|
||||
Resource = resource;
|
||||
|
||||
Expires = DateTime.UtcNow + TimeSpan.FromHours(DecayPeriod);
|
||||
m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(10), CheckDecay);
|
||||
}
|
||||
|
||||
public void CheckDecay()
|
||||
{
|
||||
if (Expires < DateTime.UtcNow)
|
||||
Decay();
|
||||
else
|
||||
InvalidateProperties();
|
||||
}
|
||||
|
||||
public void Decay()
|
||||
{
|
||||
if (RootParent is Mobile)
|
||||
{
|
||||
Mobile parent = (Mobile)RootParent;
|
||||
|
||||
if (Name == null)
|
||||
parent.SendLocalizedMessage(1072515, "#" + LabelNumber); // The ~1_name~ expired...
|
||||
else
|
||||
parent.SendLocalizedMessage(1072515, Name); // The ~1_name~ expired...
|
||||
|
||||
Effects.SendLocationParticles(EffectItem.Create(parent.Location, parent.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042);
|
||||
Effects.PlaySound(parent.Location, parent.Map, 0x201);
|
||||
}
|
||||
else
|
||||
{
|
||||
Effects.SendLocationParticles(EffectItem.Create(this.Location, this.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042);
|
||||
Effects.PlaySound(this.Location, this.Map, 0x201);
|
||||
}
|
||||
|
||||
Delete();
|
||||
}
|
||||
|
||||
public override void Delete()
|
||||
{
|
||||
base.Delete();
|
||||
|
||||
if (m_Timer != null)
|
||||
{
|
||||
m_Timer.Stop();
|
||||
m_Timer = null;
|
||||
}
|
||||
}
|
||||
|
||||
public override void AddNameProperty(ObjectPropertyList list)
|
||||
{
|
||||
list.Add(1152600, String.Format("#{0}", CraftResources.GetLocalizationNumber(Resource))); // ~1_RES~ Cauldron of Transmutation
|
||||
}
|
||||
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
int left = 0;
|
||||
if (DateTime.UtcNow < Expires)
|
||||
left = (int)(Expires - DateTime.UtcNow).TotalSeconds;
|
||||
|
||||
list.Add(1072517, left.ToString()); // Lifespan: ~1_val~ seconds
|
||||
list.Add(1152628); // cannot re-deed
|
||||
list.Add(1152629, CauldronOfTransmutation.DecayPeriod.ToString()); // lasts ~1_count~ hours
|
||||
}
|
||||
|
||||
public CauldronOfTransmutationDeed(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write(0);
|
||||
|
||||
writer.Write(Expires);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadInt();
|
||||
|
||||
Expires = reader.ReadDateTime();
|
||||
|
||||
if (Expires < DateTime.UtcNow)
|
||||
Decay();
|
||||
else
|
||||
m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(10), CheckDecay);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,302 @@
|
||||
using Server;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.Mobiles;
|
||||
using System.IO;
|
||||
using Server.Engines.Harvest;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class HarvestMap : Item, IUsesRemaining
|
||||
{
|
||||
public const int DecayPeriod = 24;
|
||||
|
||||
private CraftResource _Resource;
|
||||
private int _UsesRemaining;
|
||||
private Timer m_Timer;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public CraftResource Resource
|
||||
{
|
||||
get { return _Resource; }
|
||||
set
|
||||
{
|
||||
if (_Resource != value)
|
||||
{
|
||||
_Resource = value;
|
||||
Hue = CraftResources.GetHue(_Resource);
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int UsesRemaining
|
||||
{
|
||||
get { return _UsesRemaining; }
|
||||
set
|
||||
{
|
||||
_UsesRemaining = value;
|
||||
|
||||
if (_UsesRemaining <= 0 && this.RootParent is Mobile)
|
||||
((Mobile)RootParent).SendMessage("Your map's magic is exhausted.");
|
||||
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public bool ShowUsesRemaining { get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public DateTime Expires { get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public Point2D Target { get; private set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public Map TargetMap { get; private set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public bool IsMinerMap { get { return _Resource >= CraftResource.Iron && _Resource <= CraftResource.Valorite; } }
|
||||
|
||||
[Constructable]
|
||||
public HarvestMap(CraftResource resource)
|
||||
: base(0x14EC)
|
||||
{
|
||||
Resource = resource;
|
||||
GetRandomLocation();
|
||||
|
||||
UsesRemaining = Utility.RandomMinMax(235, 255);
|
||||
ShowUsesRemaining = true;
|
||||
|
||||
Expires = DateTime.UtcNow + TimeSpan.FromHours(DecayPeriod);
|
||||
m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(10), CheckDecay);
|
||||
}
|
||||
|
||||
public void CheckDecay()
|
||||
{
|
||||
if (Expires < DateTime.UtcNow)
|
||||
Decay();
|
||||
else
|
||||
InvalidateProperties();
|
||||
}
|
||||
|
||||
public void Decay()
|
||||
{
|
||||
if (RootParent is Mobile)
|
||||
{
|
||||
Mobile parent = (Mobile)RootParent;
|
||||
|
||||
if (Name == null)
|
||||
parent.SendLocalizedMessage(1072515, "#" + LabelNumber); // The ~1_name~ expired...
|
||||
else
|
||||
parent.SendLocalizedMessage(1072515, Name); // The ~1_name~ expired...
|
||||
|
||||
Effects.SendLocationParticles(EffectItem.Create(parent.Location, parent.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042);
|
||||
Effects.PlaySound(parent.Location, parent.Map, 0x201);
|
||||
}
|
||||
else
|
||||
{
|
||||
Effects.SendLocationParticles(EffectItem.Create(this.Location, this.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042);
|
||||
Effects.PlaySound(this.Location, this.Map, 0x201);
|
||||
}
|
||||
|
||||
Delete();
|
||||
}
|
||||
|
||||
public override void Delete()
|
||||
{
|
||||
base.Delete();
|
||||
|
||||
if (m_Timer != null)
|
||||
{
|
||||
m_Timer.Stop();
|
||||
m_Timer = null;
|
||||
}
|
||||
}
|
||||
|
||||
public override void AddNameProperty(ObjectPropertyList list)
|
||||
{
|
||||
list.Add(1152598, String.Format("#{0}\t#{1}", CraftResources.GetLocalizationNumber(Resource), IsMinerMap ? "1152604" : "1152605")); // ~1_RES~ ~2_TYPE~ Map
|
||||
}
|
||||
|
||||
public override void AddUsesRemainingProperties(ObjectPropertyList list)
|
||||
{
|
||||
list.Add(1060584, UsesRemaining.ToString()); // uses remaining: ~1_val~
|
||||
}
|
||||
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
int left = 0;
|
||||
if (DateTime.UtcNow < Expires)
|
||||
left = (int)(Expires - DateTime.UtcNow).TotalSeconds;
|
||||
|
||||
list.Add(1072517, left.ToString()); // Lifespan: ~1_val~ seconds
|
||||
list.Add(1061114, GetSextantLocation()); // Location: ~1_val~
|
||||
|
||||
if (TargetMap == null || TargetMap == Map.Internal)
|
||||
list.Add(1060800); // unknown
|
||||
else
|
||||
list.Add(TargetMap.MapID + 1150548);
|
||||
}
|
||||
|
||||
private string GetSextantLocation()
|
||||
{
|
||||
if (TargetMap == null)
|
||||
return "Unknown";
|
||||
|
||||
int x = Target.X;
|
||||
int y = Target.Y;
|
||||
|
||||
int xLong = 0, yLat = 0;
|
||||
int xMins = 0, yMins = 0;
|
||||
bool xEast = false, ySouth = false;
|
||||
|
||||
if (Sextant.Format(new Point3D(x, y, TargetMap.GetAverageZ(x, y)), TargetMap, ref xLong, ref yLat, ref xMins, ref yMins, ref xEast, ref ySouth))
|
||||
{
|
||||
return String.Format("{0}° {1}'{2}, {3}° {4}'{5}", yLat, yMins, ySouth ? "S" : "N", xLong, xMins, xEast ? "E" : "W");
|
||||
}
|
||||
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
public void GetRandomLocation()
|
||||
{
|
||||
Map map;
|
||||
|
||||
switch (Utility.Random(6))
|
||||
{
|
||||
default:
|
||||
case 0: map = Map.Felucca; break;
|
||||
case 1: map = Map.Trammel; break;
|
||||
case 2: map = Map.Ilshenar; break;
|
||||
case 3: map = Map.Malas; break;
|
||||
case 4: map = Map.Tokuno; break;
|
||||
case 5: map = Map.TerMur; break;
|
||||
}
|
||||
|
||||
TargetMap = map;
|
||||
Dictionary<Map, List<Point2D>> table;
|
||||
|
||||
if (IsMinerMap)
|
||||
table = MinerTable;
|
||||
else
|
||||
table = LumberTable;
|
||||
|
||||
if (!table.ContainsKey(map))
|
||||
table[map] = LoadLocsFor(map, this);
|
||||
else if (table[map] == null)
|
||||
table[map] = LoadLocsFor(map, this);
|
||||
|
||||
Target = table[map][Utility.Random(table[map].Count)];
|
||||
}
|
||||
|
||||
public static HarvestMap CheckMapOnHarvest(Mobile from, object harvested, HarvestDefinition def)
|
||||
{
|
||||
Map map = from.Map;
|
||||
|
||||
if (harvested is IPoint3D && from.Backpack != null)
|
||||
{
|
||||
IPoint3D p = harvested as IPoint3D;
|
||||
|
||||
Item[] items = from.Backpack.FindItemsByType(typeof(HarvestMap));
|
||||
|
||||
foreach (Item item in items)
|
||||
{
|
||||
HarvestMap harvestmap = item as HarvestMap;
|
||||
|
||||
if (harvestmap != null && harvestmap.TargetMap == map && harvestmap.UsesRemaining > 0
|
||||
&& def.GetBank(map, p.X, p.Y) == def.GetBank(harvestmap.TargetMap, harvestmap.Target.X, harvestmap.Target.Y))
|
||||
{
|
||||
return harvestmap;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static Dictionary<Map, List<Point2D>> MinerTable;
|
||||
public static Dictionary<Map, List<Point2D>> LumberTable;
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
MinerTable = new Dictionary<Map, List<Point2D>>();
|
||||
LumberTable = new Dictionary<Map, List<Point2D>>();
|
||||
}
|
||||
|
||||
public static List<Point2D> LoadLocsFor(Map map, HarvestMap hMap)
|
||||
{
|
||||
string path = String.Format("Data/HarvestLocs/{0}_{1}.cfg", hMap.IsMinerMap ? "MinerLocs" : "LumberLocs", map.ToString());
|
||||
|
||||
if (!File.Exists(path))
|
||||
{
|
||||
Console.WriteLine("Warning! {0} does not exist for harvest maps...", path);
|
||||
return null;
|
||||
}
|
||||
|
||||
List<Point2D> list = new List<Point2D>();
|
||||
|
||||
using (StreamReader ip = new StreamReader(path))
|
||||
{
|
||||
string line;
|
||||
|
||||
while ((line = ip.ReadLine()) != null)
|
||||
{
|
||||
if (line.Length == 0 || line.StartsWith("#"))
|
||||
continue;
|
||||
|
||||
var split = line.Split('\t');
|
||||
|
||||
int x, y = 0;
|
||||
|
||||
if (int.TryParse(split[0], out x) && int.TryParse(split[1], out y) && (x > 0 || y > 0))
|
||||
{
|
||||
list.Add(new Point2D(x, y));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public HarvestMap(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write(0);
|
||||
|
||||
writer.Write((int)Resource);
|
||||
writer.Write(Expires);
|
||||
writer.Write(UsesRemaining);
|
||||
|
||||
writer.Write(Target);
|
||||
writer.Write(TargetMap);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadInt();
|
||||
|
||||
Resource = (CraftResource)reader.ReadInt();
|
||||
Expires = reader.ReadDateTime();
|
||||
UsesRemaining = reader.ReadInt();
|
||||
|
||||
Target = reader.ReadPoint2D();
|
||||
TargetMap = reader.ReadMap();
|
||||
|
||||
if (Expires < DateTime.UtcNow)
|
||||
Decay();
|
||||
else
|
||||
m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(10), CheckDecay);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
using Server;
|
||||
using System;
|
||||
using Server.Engines.Craft;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
[Alterable(typeof(DefBlacksmithy), typeof(GargishHephaestus))]
|
||||
public class Hephaestus : HeaterShield
|
||||
{
|
||||
public override int LabelNumber { get { return 1152909; } } // Hephaestus
|
||||
public override bool IsArtifact { get { return true; } }
|
||||
|
||||
[Constructable]
|
||||
public Hephaestus() : this(true)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public Hephaestus(bool antique)
|
||||
{
|
||||
Hue = 1910;
|
||||
Attributes.SpellChanneling = 1;
|
||||
Attributes.ReflectPhysical = 15;
|
||||
Attributes.DefendChance = 15;
|
||||
Attributes.CastSpeed = 1;
|
||||
Attributes.LowerManaCost = 8;
|
||||
|
||||
PhysicalBonus = 15;
|
||||
ArmorAttributes.SelfRepair = 5;
|
||||
|
||||
SkillBonuses.SetValues(0, SkillName.Parry, 10.0);
|
||||
|
||||
if (antique)
|
||||
{
|
||||
MaxHitPoints = 250;
|
||||
NegativeAttributes.Antique = 1;
|
||||
}
|
||||
else
|
||||
MaxHitPoints = 255;
|
||||
|
||||
HitPoints = MaxHitPoints;
|
||||
}
|
||||
|
||||
public Hephaestus(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write(0);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class GargishHephaestus : LargePlateShield
|
||||
{
|
||||
public override int LabelNumber { get { return 1152909; } } // Hephaestus
|
||||
public override bool IsArtifact { get { return true; } }
|
||||
|
||||
[Constructable]
|
||||
public GargishHephaestus() : this(true)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public GargishHephaestus(bool antique)
|
||||
{
|
||||
Hue = 1910;
|
||||
Attributes.SpellChanneling = 1;
|
||||
Attributes.ReflectPhysical = 15;
|
||||
Attributes.DefendChance = 15;
|
||||
Attributes.CastSpeed = 1;
|
||||
Attributes.LowerManaCost = 8;
|
||||
|
||||
PhysicalBonus = 15;
|
||||
ArmorAttributes.SelfRepair = 5;
|
||||
|
||||
SkillBonuses.SetValues(0, SkillName.Parry, 10.0);
|
||||
|
||||
if (antique)
|
||||
{
|
||||
MaxHitPoints = 250;
|
||||
NegativeAttributes.Antique = 1;
|
||||
}
|
||||
else
|
||||
MaxHitPoints = 255;
|
||||
|
||||
HitPoints = MaxHitPoints;
|
||||
}
|
||||
|
||||
public GargishHephaestus(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write(0);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,281 @@
|
||||
using Server;
|
||||
using System;
|
||||
using Server.Mobiles;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Server.Commands;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class MagicalFishFinder : Item
|
||||
{
|
||||
public const int DecayPeriod = 4;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public DateTime Expires { get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public DateTime LastUpdate { get; set; }
|
||||
|
||||
private Timer m_Timer;
|
||||
|
||||
public override int LabelNumber { get { return 1152602; } } // Magical Fish Finder
|
||||
|
||||
[Constructable]
|
||||
public MagicalFishFinder() : base(5366)
|
||||
{
|
||||
Hue = 2500;
|
||||
|
||||
Expires = DateTime.UtcNow + TimeSpan.FromHours(DecayPeriod);
|
||||
m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(10), CheckDecay);
|
||||
}
|
||||
|
||||
public void CheckDecay()
|
||||
{
|
||||
if (Expires < DateTime.UtcNow)
|
||||
Decay();
|
||||
else
|
||||
InvalidateProperties();
|
||||
}
|
||||
|
||||
public void Decay()
|
||||
{
|
||||
if (RootParent is Mobile)
|
||||
{
|
||||
Mobile parent = (Mobile)RootParent;
|
||||
|
||||
if (Name == null)
|
||||
parent.SendLocalizedMessage(1072515, "#" + LabelNumber); // The ~1_name~ expired...
|
||||
else
|
||||
parent.SendLocalizedMessage(1072515, Name); // The ~1_name~ expired...
|
||||
|
||||
Effects.SendLocationParticles(EffectItem.Create(parent.Location, parent.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042);
|
||||
Effects.PlaySound(parent.Location, parent.Map, 0x201);
|
||||
}
|
||||
else
|
||||
{
|
||||
Effects.SendLocationParticles(EffectItem.Create(this.Location, this.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042);
|
||||
Effects.PlaySound(this.Location, this.Map, 0x201);
|
||||
}
|
||||
|
||||
Delete();
|
||||
}
|
||||
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
int left = 0;
|
||||
|
||||
if (DateTime.UtcNow < Expires)
|
||||
left = (int)(Expires - DateTime.UtcNow).TotalSeconds;
|
||||
|
||||
list.Add(1072517, left.ToString()); // Lifespan: ~1_val~ seconds
|
||||
}
|
||||
|
||||
public override void Delete()
|
||||
{
|
||||
base.Delete();
|
||||
|
||||
if (m_Timer != null)
|
||||
{
|
||||
m_Timer.Stop();
|
||||
m_Timer = null;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile m)
|
||||
{
|
||||
if (IsChildOf(m.Backpack))
|
||||
CheckUpdate(m);
|
||||
}
|
||||
|
||||
public void CheckUpdate(Mobile m)
|
||||
{
|
||||
if (Schools.ContainsKey(m.Map))
|
||||
{
|
||||
SchoolEntry entry = Schools[m.Map].FirstOrDefault(e => m.InRange(e.Location, SchoolRange));
|
||||
|
||||
if (entry != null)
|
||||
{
|
||||
m.SendLocalizedMessage(1152647); // Fish are schooling right here!
|
||||
return;
|
||||
}
|
||||
|
||||
entry = Schools[m.Map].FirstOrDefault(e => m.InRange(e.Location, MessageRange));
|
||||
|
||||
if (entry != null)
|
||||
{
|
||||
m.SendLocalizedMessage(1152638, GetDirectionString(Utility.GetDirection(m, entry.Location))); // The fish finder pulls you to the ~1_DIRECTION~.
|
||||
}
|
||||
else
|
||||
{
|
||||
m.SendLocalizedMessage(1152637); // The fish finder shows you nothing.
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m.SendLocalizedMessage(1152637); // The fish finder shows you nothing.
|
||||
}
|
||||
}
|
||||
|
||||
public string GetDirectionString(Direction d)
|
||||
{
|
||||
return String.Format("#{0}", 1152639 + (int)d);
|
||||
}
|
||||
|
||||
public static bool HasSchool(Mobile m)
|
||||
{
|
||||
if (m == null || !m.Alive || m.Backpack == null)
|
||||
return false;
|
||||
|
||||
MagicalFishFinder finder = m.Backpack.FindItemByType<MagicalFishFinder>();
|
||||
|
||||
if (finder != null && Schools.ContainsKey(m.Map))
|
||||
{
|
||||
SchoolEntry entry = Schools[m.Map].FirstOrDefault(e => m.InRange(e.Location, SchoolRange));
|
||||
|
||||
if (entry != null)
|
||||
{
|
||||
entry.OnFish();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public MagicalFishFinder(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write(0);
|
||||
|
||||
writer.Write(Expires);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadInt();
|
||||
|
||||
Expires = reader.ReadDateTime();
|
||||
|
||||
if (Expires < DateTime.UtcNow)
|
||||
Decay();
|
||||
else
|
||||
m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(10), CheckDecay);
|
||||
}
|
||||
|
||||
public static int MessageRange = 100;
|
||||
public static int SchoolRange = 20;
|
||||
|
||||
public static Dictionary<Map, List<SchoolEntry>> Schools { get; set; }
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
Schools = new Dictionary<Map, List<SchoolEntry>>();
|
||||
|
||||
Schools[Map.Trammel] = new List<SchoolEntry>();
|
||||
Schools[Map.Felucca] = new List<SchoolEntry>();
|
||||
Schools[Map.Ilshenar] = new List<SchoolEntry>();
|
||||
Schools[Map.Tokuno] = new List<SchoolEntry>();
|
||||
|
||||
foreach (var kvp in Schools)
|
||||
{
|
||||
int amount = 150;
|
||||
|
||||
if (kvp.Key == Map.Ilshenar || kvp.Key == Map.Tokuno)
|
||||
amount = 50;
|
||||
|
||||
for (int i = 0; i < amount; i++)
|
||||
{
|
||||
Point3D p;
|
||||
int failsafe = 0;
|
||||
|
||||
do
|
||||
{
|
||||
p = SOS.FindLocation(kvp.Key);
|
||||
failsafe++;
|
||||
}
|
||||
while (p == Point3D.Zero && failsafe < 10);
|
||||
|
||||
kvp.Value.Add(new SchoolEntry(kvp.Key, new Point2D(p.X, p.Y)));
|
||||
}
|
||||
|
||||
if(kvp.Value.Count == 0)
|
||||
Console.WriteLine("Warning: {0} has 0 School entries!", kvp.Key);
|
||||
}
|
||||
|
||||
CommandSystem.Register("MoveToSchool", AccessLevel.GameMaster, e =>
|
||||
{
|
||||
Mobile m = e.Mobile;
|
||||
|
||||
if (Schools.ContainsKey(m.Map))
|
||||
{
|
||||
SchoolEntry entry = Schools[m.Map][Utility.Random(Schools[m.Map].Count)];
|
||||
|
||||
if (entry != null)
|
||||
{
|
||||
m.MoveToWorld(new Point3D(entry.Location.X, entry.Location.Y, m.Map.GetAverageZ(entry.Location.X, entry.Location.Y)), m.Map);
|
||||
}
|
||||
else
|
||||
m.SendMessage("Bad entry");
|
||||
}
|
||||
else
|
||||
m.SendMessage("Bad map");
|
||||
});
|
||||
}
|
||||
|
||||
public static void ExpireSchool(Map map, SchoolEntry entry)
|
||||
{
|
||||
if (Schools.ContainsKey(map) && Schools[map].Contains(entry))
|
||||
{
|
||||
Schools[map].Remove(entry);
|
||||
|
||||
Point3D p;
|
||||
int failsafe = 0;
|
||||
|
||||
do
|
||||
{
|
||||
p = SOS.FindLocation(map);
|
||||
failsafe++;
|
||||
}
|
||||
while (p == Point3D.Zero && failsafe < 10);
|
||||
|
||||
Schools[map].Add(new SchoolEntry(map, new Point2D(p.X, p.Y)));
|
||||
}
|
||||
}
|
||||
|
||||
public class SchoolEntry
|
||||
{
|
||||
public Point2D Location { get; set; }
|
||||
public bool HasFished { get; set; }
|
||||
public Map Map { get; set; }
|
||||
|
||||
public SchoolEntry(Map map, Point2D location)
|
||||
{
|
||||
Map = map;
|
||||
Location = location;
|
||||
}
|
||||
|
||||
public void OnFish()
|
||||
{
|
||||
if (!HasFished)
|
||||
{
|
||||
HasFished = true;
|
||||
Timer.DelayCall(TimeSpan.FromMinutes(Utility.RandomMinMax(5, 8)), Expire);
|
||||
}
|
||||
}
|
||||
|
||||
public void Expire()
|
||||
{
|
||||
MagicalFishFinder.ExpireSchool(Map, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
using Server;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.Mobiles;
|
||||
using Server.Engines.Craft;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
[Alterable(typeof(DefTinkering), typeof(GargishPrismaticLenses))]
|
||||
public class PrismaticLenses : Glasses
|
||||
{
|
||||
public override int LabelNumber { get { return 1152716; } } // Prismatic Lenses
|
||||
public override int InitMinHits { get { return 255; } }
|
||||
public override int InitMaxHits { get { return 255; } }
|
||||
|
||||
public override int BasePhysicalResistance { get { return 18; } }
|
||||
public override int BaseFireResistance { get { return 4; } }
|
||||
public override int BaseColdResistance { get { return 7; } }
|
||||
public override int BasePoisonResistance { get { return 17; } }
|
||||
public override int BaseEnergyResistance { get { return 6; } }
|
||||
|
||||
public override bool IsArtifact { get { return true; } }
|
||||
|
||||
[Constructable]
|
||||
public PrismaticLenses()
|
||||
{
|
||||
Hue = 2068;
|
||||
WeaponAttributes.HitLowerDefend = 30;
|
||||
Attributes.RegenHits = 2;
|
||||
Attributes.RegenStam = 3;
|
||||
Attributes.WeaponDamage = 25;
|
||||
}
|
||||
|
||||
public PrismaticLenses(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write(0);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class GargishPrismaticLenses : GargishGlasses
|
||||
{
|
||||
public override int LabelNumber { get { return 1152716; } } // Prismatic Lenses
|
||||
|
||||
public override int InitMinHits { get { return 255; } }
|
||||
public override int InitMaxHits { get { return 255; } }
|
||||
|
||||
public override int BasePhysicalResistance { get { return 18; } }
|
||||
public override int BaseFireResistance { get { return 4; } }
|
||||
public override int BaseColdResistance { get { return 7; } }
|
||||
public override int BasePoisonResistance { get { return 17; } }
|
||||
public override int BaseEnergyResistance { get { return 6; } }
|
||||
|
||||
public override bool IsArtifact { get { return true; } }
|
||||
|
||||
[Constructable]
|
||||
public GargishPrismaticLenses()
|
||||
{
|
||||
Hue = 2068;
|
||||
WeaponAttributes.HitLowerDefend = 30;
|
||||
Attributes.RegenHits = 2;
|
||||
Attributes.RegenStam = 3;
|
||||
Attributes.WeaponDamage = 25;
|
||||
}
|
||||
|
||||
public GargishPrismaticLenses(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write(0);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,158 @@
|
||||
using Server;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class SmeltersTalisman : BaseTalisman, IUsesRemaining
|
||||
{
|
||||
public const int DecayPeriod = 24;
|
||||
|
||||
private CraftResource _Resource;
|
||||
private int _UsesRemaining;
|
||||
private Timer m_Timer;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public CraftResource Resource
|
||||
{
|
||||
get { return _Resource; }
|
||||
set
|
||||
{
|
||||
if (_Resource != value)
|
||||
{
|
||||
_Resource = value;
|
||||
Hue = CraftResources.GetHue(_Resource);
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int UsesRemaining
|
||||
{
|
||||
get { return _UsesRemaining; }
|
||||
set
|
||||
{
|
||||
_UsesRemaining = value;
|
||||
|
||||
if (_UsesRemaining <= 0 && this.RootParent is Mobile)
|
||||
((Mobile)RootParent).SendLocalizedMessage(1152621); // Your talisman's magic is exhausted.
|
||||
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public bool ShowUsesRemaining { get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public DateTime Expires { get; set; }
|
||||
|
||||
[Constructable]
|
||||
public SmeltersTalisman(CraftResource resource)
|
||||
: base(0x2F5B)
|
||||
{
|
||||
Resource = resource;
|
||||
|
||||
UsesRemaining = 6000;
|
||||
ShowUsesRemaining = true;
|
||||
|
||||
Expires = DateTime.UtcNow + TimeSpan.FromHours(DecayPeriod);
|
||||
m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(10), CheckDecay);
|
||||
}
|
||||
|
||||
public void CheckDecay()
|
||||
{
|
||||
if (Expires < DateTime.UtcNow)
|
||||
Decay();
|
||||
else
|
||||
InvalidateProperties();
|
||||
}
|
||||
|
||||
public void Decay()
|
||||
{
|
||||
if (RootParent is Mobile)
|
||||
{
|
||||
Mobile parent = (Mobile)RootParent;
|
||||
|
||||
if (Name == null)
|
||||
parent.SendLocalizedMessage(1072515, "#" + LabelNumber); // The ~1_name~ expired...
|
||||
else
|
||||
parent.SendLocalizedMessage(1072515, Name); // The ~1_name~ expired...
|
||||
|
||||
Effects.SendLocationParticles(EffectItem.Create(parent.Location, parent.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042);
|
||||
Effects.PlaySound(parent.Location, parent.Map, 0x201);
|
||||
}
|
||||
else
|
||||
{
|
||||
Effects.SendLocationParticles(EffectItem.Create(this.Location, this.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042);
|
||||
Effects.PlaySound(this.Location, this.Map, 0x201);
|
||||
}
|
||||
|
||||
Delete();
|
||||
}
|
||||
|
||||
public override void Delete()
|
||||
{
|
||||
base.Delete();
|
||||
|
||||
if (m_Timer != null)
|
||||
{
|
||||
m_Timer.Stop();
|
||||
m_Timer = null;
|
||||
}
|
||||
}
|
||||
|
||||
public override void AddNameProperty(ObjectPropertyList list)
|
||||
{
|
||||
list.Add(1152599, String.Format("#{0}\t#1152606", CraftResources.GetLocalizationNumber(_Resource))); // ~1_RES~ ~2_TYPE~ Talisman
|
||||
}
|
||||
|
||||
public override void AddUsesRemainingProperties(ObjectPropertyList list)
|
||||
{
|
||||
list.Add(1060584, UsesRemaining.ToString()); // uses remaining: ~1_val~
|
||||
}
|
||||
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
int left = 0;
|
||||
if (DateTime.UtcNow < Expires)
|
||||
left = (int)(Expires - DateTime.UtcNow).TotalSeconds;
|
||||
|
||||
list.Add(1072517, left.ToString()); // Lifespan: ~1_val~ seconds
|
||||
}
|
||||
|
||||
public SmeltersTalisman(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write(0);
|
||||
|
||||
writer.Write((int)Resource);
|
||||
writer.Write(Expires);
|
||||
writer.Write(UsesRemaining);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadInt();
|
||||
|
||||
Resource = (CraftResource)reader.ReadInt();
|
||||
Expires = reader.ReadDateTime();
|
||||
UsesRemaining = reader.ReadInt();
|
||||
|
||||
if (Expires < DateTime.UtcNow)
|
||||
Decay();
|
||||
else
|
||||
m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(10), CheckDecay);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,343 @@
|
||||
using Server;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.Mobiles;
|
||||
using Server.Multis;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class TemporaryForge : BaseAddon
|
||||
{
|
||||
public const int DecayPeriod = 4;
|
||||
private Timer m_Timer;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public DateTime Expires { get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public Mobile Owner { get; set; }
|
||||
|
||||
public TemporaryForge()
|
||||
{
|
||||
AddComponent(new InternalComponent(), 0, 0, 0);
|
||||
|
||||
Expires = DateTime.UtcNow + TimeSpan.FromHours(DecayPeriod);
|
||||
m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(10), CheckDecay);
|
||||
}
|
||||
|
||||
public override void OnChop(Mobile from)
|
||||
{
|
||||
if (BaseHouse.FindHouseAt(this) == null && Owner == from)
|
||||
{
|
||||
Effects.PlaySound(GetWorldLocation(), Map, 0x3B3);
|
||||
from.SendLocalizedMessage(500461); // You destroy the item.
|
||||
Delete();
|
||||
return;
|
||||
}
|
||||
|
||||
base.OnChop(from);
|
||||
}
|
||||
|
||||
public void CheckDecay()
|
||||
{
|
||||
if (Expires < DateTime.UtcNow)
|
||||
Decay();
|
||||
else
|
||||
InvalidateProperties();
|
||||
}
|
||||
|
||||
public void Decay()
|
||||
{
|
||||
if (RootParent is Mobile)
|
||||
{
|
||||
Mobile parent = (Mobile)RootParent;
|
||||
|
||||
if (Name == null)
|
||||
parent.SendLocalizedMessage(1072515, "#" + LabelNumber); // The ~1_name~ expired...
|
||||
else
|
||||
parent.SendLocalizedMessage(1072515, Name); // The ~1_name~ expired...
|
||||
|
||||
Effects.SendLocationParticles(EffectItem.Create(parent.Location, parent.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042);
|
||||
Effects.PlaySound(parent.Location, parent.Map, 0x201);
|
||||
}
|
||||
else
|
||||
{
|
||||
Effects.SendLocationParticles(EffectItem.Create(this.Location, this.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042);
|
||||
Effects.PlaySound(this.Location, this.Map, 0x201);
|
||||
}
|
||||
|
||||
Delete();
|
||||
}
|
||||
|
||||
public override void Delete()
|
||||
{
|
||||
base.Delete();
|
||||
|
||||
if (m_Timer != null)
|
||||
{
|
||||
m_Timer.Stop();
|
||||
m_Timer = null;
|
||||
}
|
||||
}
|
||||
|
||||
private class InternalComponent : ForgeComponent
|
||||
{
|
||||
public override bool ForceShowProperties { get { return true; } }
|
||||
public override int LabelNumber { get { return 1152601; } } //Temporary forge
|
||||
|
||||
public InternalComponent() : base(0xFB1)
|
||||
{
|
||||
}
|
||||
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
if (Addon == null || !(Addon is TemporaryForge))
|
||||
return;
|
||||
|
||||
int left = 0;
|
||||
if (DateTime.UtcNow < ((TemporaryForge)Addon).Expires)
|
||||
left = (int)(((TemporaryForge)Addon).Expires - DateTime.UtcNow).TotalSeconds;
|
||||
|
||||
list.Add(1072517, left.ToString()); // Lifespan: ~1_val~ seconds
|
||||
}
|
||||
|
||||
public InternalComponent(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write(0);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
public TemporaryForge(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write(0);
|
||||
|
||||
writer.Write(Expires);
|
||||
writer.Write(Owner);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadInt();
|
||||
|
||||
Expires = reader.ReadDateTime();
|
||||
Owner = reader.ReadMobile();
|
||||
|
||||
if (Expires < DateTime.UtcNow)
|
||||
Decay();
|
||||
else
|
||||
m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(10), CheckDecay);
|
||||
}
|
||||
}
|
||||
|
||||
public class TemporaryForgeDeed : BaseAddonDeed
|
||||
{
|
||||
public override BaseAddon Addon { get { return new TemporaryForge(); } }
|
||||
|
||||
public const int DecayPeriod = 24;
|
||||
|
||||
private Timer m_Timer;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public DateTime Expires { get; set; }
|
||||
|
||||
[Constructable]
|
||||
public TemporaryForgeDeed()
|
||||
{
|
||||
Expires = DateTime.UtcNow + TimeSpan.FromHours(DecayPeriod);
|
||||
m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(10), CheckDecay);
|
||||
}
|
||||
|
||||
public void CheckDecay()
|
||||
{
|
||||
if (Expires < DateTime.UtcNow)
|
||||
Decay();
|
||||
else
|
||||
InvalidateProperties();
|
||||
}
|
||||
|
||||
public void Decay()
|
||||
{
|
||||
if (RootParent is Mobile)
|
||||
{
|
||||
Mobile parent = (Mobile)RootParent;
|
||||
|
||||
if (Name == null)
|
||||
parent.SendLocalizedMessage(1072515, "#" + LabelNumber); // The ~1_name~ expired...
|
||||
else
|
||||
parent.SendLocalizedMessage(1072515, Name); // The ~1_name~ expired...
|
||||
|
||||
Effects.SendLocationParticles(EffectItem.Create(parent.Location, parent.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042);
|
||||
Effects.PlaySound(parent.Location, parent.Map, 0x201);
|
||||
}
|
||||
else
|
||||
{
|
||||
Effects.SendLocationParticles(EffectItem.Create(this.Location, this.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042);
|
||||
Effects.PlaySound(this.Location, this.Map, 0x201);
|
||||
}
|
||||
|
||||
Delete();
|
||||
}
|
||||
|
||||
public override void Delete()
|
||||
{
|
||||
base.Delete();
|
||||
|
||||
if (m_Timer != null)
|
||||
{
|
||||
m_Timer.Stop();
|
||||
m_Timer = null;
|
||||
}
|
||||
}
|
||||
|
||||
public override void AddNameProperty(ObjectPropertyList list)
|
||||
{
|
||||
list.Add(1152601); // Temporary Forge
|
||||
}
|
||||
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
int left = 0;
|
||||
if (DateTime.UtcNow < Expires)
|
||||
left = (int)(Expires - DateTime.UtcNow).TotalSeconds;
|
||||
|
||||
list.Add(1072517, left.ToString()); // Lifespan: ~1_val~ seconds
|
||||
list.Add(1152627); // no house required
|
||||
list.Add(1152628); // cannot re-deed
|
||||
list.Add(1152629, TemporaryForge.DecayPeriod.ToString()); // lasts ~1_count~ hours
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
//TODO: Finish the ontaret stuff and clilocs.
|
||||
if (!IsChildOf(from.Backpack))
|
||||
from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
|
||||
else
|
||||
{
|
||||
BaseHouse house = BaseHouse.FindHouseAt(from);
|
||||
|
||||
if (house != null)
|
||||
base.OnDoubleClick(from);
|
||||
else
|
||||
{
|
||||
from.BeginTarget(10, true, Server.Targeting.TargetFlags.None, (m, targeted) =>
|
||||
{
|
||||
if (targeted is IPoint3D)
|
||||
{
|
||||
Point3D p = new Point3D((IPoint3D)targeted);
|
||||
int dist = (int)from.GetDistanceToSqrt(p);
|
||||
|
||||
if (dist < 2 || dist > 5)
|
||||
from.SendLocalizedMessage(1152736); // You must stand between 2 and 5 tiles away from the targeted location to attempt to build this.
|
||||
else if (!from.InLOS(p))
|
||||
from.SendLocalizedMessage(500237); // Target cannot be seen.
|
||||
else if (!ValidateLocation(p, from.Map))
|
||||
from.SendLocalizedMessage(1152735); // The targeted location has at least one impassable tile adjacent to the structure.
|
||||
else
|
||||
{
|
||||
BaseHouse checkHouse = BaseHouse.FindHouseAt(from);
|
||||
|
||||
if (checkHouse != null)
|
||||
from.SendLocalizedMessage(500269); // You cannot build that there.
|
||||
else
|
||||
{
|
||||
IPoint3D point = (IPoint3D)targeted;
|
||||
Server.Spells.SpellHelper.GetSurfaceTop(ref point);
|
||||
|
||||
BaseAddon addon = this.Addon;
|
||||
addon.MoveToWorld(new Point3D(point), m.Map);
|
||||
|
||||
if (addon is TemporaryForge)
|
||||
((TemporaryForge)addon).Owner = from;
|
||||
|
||||
this.Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool ValidateLocation(Point3D p, Map map)
|
||||
{
|
||||
if (!TreasureMap.ValidateLocation(p.X, p.Y, map))
|
||||
return false;
|
||||
|
||||
for (int x = p.X - 1; x <= p.X + 1; x++)
|
||||
{
|
||||
for (int y = p.Y - 1; y <= p.Y + 1; y++)
|
||||
{
|
||||
if(TreasureMap.ValidateLocation(x, y, map))
|
||||
{
|
||||
int z = map.GetAverageZ(x, y);
|
||||
IPooledEnumerable eable = map.GetItemsInRange(new Point3D(x, y, z), 0);
|
||||
foreach (Item item in eable)
|
||||
{
|
||||
ItemData id = TileData.ItemTable[item.ItemID & TileData.MaxItemValue];
|
||||
|
||||
if (item.Z + id.CalcHeight >= z)
|
||||
{
|
||||
eable.Free();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
eable.Free();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public TemporaryForgeDeed(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write(0);
|
||||
|
||||
writer.Write(Expires);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadInt();
|
||||
|
||||
Expires = reader.ReadDateTime();
|
||||
|
||||
if (Expires < DateTime.UtcNow)
|
||||
Decay();
|
||||
else
|
||||
m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(10), CheckDecay);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
using Server;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.Mobiles;
|
||||
using Server.Items;
|
||||
using System.Linq;
|
||||
using Server.Targeting;
|
||||
using Server.Engines.Quests;
|
||||
using Server.Multis;
|
||||
|
||||
namespace Server.Engines.VoidPool
|
||||
{
|
||||
public static class VoidPoolRewards
|
||||
{
|
||||
public static List<CollectionItem> Rewards { get; set; }
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
Rewards = new List<CollectionItem>();
|
||||
|
||||
Rewards.Add(new CollectionItem(typeof(CauldronOfTransmutationDeed), 0x9ED, 1152656, (int)CraftResource.Bronze, 100)); //Bronze
|
||||
Rewards.Add(new CollectionItem(typeof(CauldronOfTransmutationDeed), 0x9ED, 1152657, (int)CraftResource.Gold, 200)); //Gold
|
||||
Rewards.Add(new CollectionItem(typeof(CauldronOfTransmutationDeed), 0x9ED, 1152658, (int)CraftResource.Agapite, 500)); //Agapite
|
||||
Rewards.Add(new CollectionItem(typeof(CauldronOfTransmutationDeed), 0x9ED, 1152659, (int)CraftResource.Verite, 1000)); //Verite
|
||||
|
||||
Rewards.Add(new CollectionItem(typeof(CauldronOfTransmutationDeed), 0x9ED, 1152660, (int)CraftResource.AshWood, 100)); //Ash
|
||||
Rewards.Add(new CollectionItem(typeof(CauldronOfTransmutationDeed), 0x9ED, 1152661, (int)CraftResource.YewWood, 200)); //Yew
|
||||
Rewards.Add(new CollectionItem(typeof(CauldronOfTransmutationDeed), 0x9ED, 1152662, (int)CraftResource.Heartwood, 500)); // Heartwood
|
||||
Rewards.Add(new CollectionItem(typeof(CauldronOfTransmutationDeed), 0x9ED, 1152663, (int)CraftResource.Bloodwood, 1000)); // Bloodwood
|
||||
|
||||
Rewards.Add(new CollectionItem(typeof(HarvestMap), 0x14EC, 1152665, (int)CraftResource.Gold, 250)); //Gold
|
||||
Rewards.Add(new CollectionItem(typeof(HarvestMap), 0x14EC, 1152666, (int)CraftResource.Agapite, 500)); //Agapite
|
||||
Rewards.Add(new CollectionItem(typeof(HarvestMap), 0x14EC, 1152667, (int)CraftResource.Verite, 1000)); //Verite
|
||||
Rewards.Add(new CollectionItem(typeof(HarvestMap), 0x14EC, 1152668, (int)CraftResource.Valorite, 2000)); //Valorite
|
||||
|
||||
Rewards.Add(new CollectionItem(typeof(HarvestMap), 0x14EC, 1152669, (int)CraftResource.YewWood, 250)); //Yew
|
||||
Rewards.Add(new CollectionItem(typeof(HarvestMap), 0x14EC, 1152670, (int)CraftResource.Heartwood, 500)); //Heartwood
|
||||
Rewards.Add(new CollectionItem(typeof(HarvestMap), 0x14EC, 1152671, (int)CraftResource.Bloodwood, 1000)); //Bloodwood
|
||||
Rewards.Add(new CollectionItem(typeof(HarvestMap), 0x14EC, 1152672, (int)CraftResource.Frostwood, 2000)); //Frostwood
|
||||
|
||||
Rewards.Add(new CollectionItem(typeof(SmeltersTalisman), 0x2F5B, 1152674, (int)CraftResource.Gold, 50)); // Gold
|
||||
Rewards.Add(new CollectionItem(typeof(SmeltersTalisman), 0x2F5B, 1152675, (int)CraftResource.Agapite, 100)); // Agapite
|
||||
Rewards.Add(new CollectionItem(typeof(SmeltersTalisman), 0x2F5B, 1152676, (int)CraftResource.Verite, 200)); // Verite
|
||||
Rewards.Add(new CollectionItem(typeof(SmeltersTalisman), 0x2F5B, 1152677, (int)CraftResource.Valorite, 500)); // Valorite
|
||||
|
||||
Rewards.Add(new CollectionItem(typeof(WoodsmansTalisman), 0x2F5A, 1152678, (int)CraftResource.YewWood, 50)); // Yew
|
||||
Rewards.Add(new CollectionItem(typeof(WoodsmansTalisman), 0x2F5A, 1152679, (int)CraftResource.Heartwood, 100));// Heartwood
|
||||
Rewards.Add(new CollectionItem(typeof(WoodsmansTalisman), 0x2F5A, 1152680, (int)CraftResource.Bloodwood, 200));// Bloodwood
|
||||
Rewards.Add(new CollectionItem(typeof(WoodsmansTalisman), 0x2F5A, 1152681, (int)CraftResource.Frostwood, 500));// Frostwood
|
||||
|
||||
Rewards.Add(new CollectionItem(typeof(TemporaryForgeDeed), 0xFB1, 1152682, 0, 250));
|
||||
Rewards.Add(new CollectionItem(typeof(MagicalFishFinder), 0x14F6, 1152683, 2500, 250));
|
||||
|
||||
//TODO: Hues for below
|
||||
Rewards.Add(new CollectionItem(typeof(BraceletOfProtection), 0x1086, 1152730, 1157, 1840));
|
||||
Rewards.Add(new CollectionItem(typeof(Hephaestus), 0x1B76, 1152909, 1910, 2000));
|
||||
Rewards.Add(new CollectionItem(typeof(GargishHephaestus), 0x4204, 1152909, 1910, 2000));
|
||||
Rewards.Add(new CollectionItem(typeof(BlightOfTheTundra), 0x26C2, 1152910, 1165, 2515));
|
||||
Rewards.Add(new CollectionItem(typeof(GargishBlightOfTheTundra), 0x090A, 1152910, 1165, 2515));
|
||||
}
|
||||
|
||||
public static Item DropRandomArtifact()
|
||||
{
|
||||
switch (Utility.Random(5))
|
||||
{
|
||||
case 0: return new PrismaticLenses();
|
||||
case 1: return new Brightblade();
|
||||
case 2: return new BraceletOfProtection(false);
|
||||
case 3: return new BlightOfTheTundra(false);
|
||||
case 4: return new Hephaestus(false);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,177 @@
|
||||
using Server;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.Mobiles;
|
||||
using Server.Engines.Harvest;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class WoodsmansTalisman : BaseTalisman, IUsesRemaining
|
||||
{
|
||||
public const int DecayPeriod = 24;
|
||||
|
||||
private CraftResource _Resource;
|
||||
private int _UsesRemaining;
|
||||
private Timer m_Timer;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public CraftResource Resource
|
||||
{
|
||||
get { return _Resource; }
|
||||
set
|
||||
{
|
||||
if (_Resource != value)
|
||||
{
|
||||
_Resource = value;
|
||||
Hue = CraftResources.GetHue(_Resource);
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int UsesRemaining
|
||||
{
|
||||
get { return _UsesRemaining; }
|
||||
set
|
||||
{
|
||||
_UsesRemaining = value;
|
||||
|
||||
if (_UsesRemaining <= 0 && this.RootParent is Mobile)
|
||||
((Mobile)RootParent).SendLocalizedMessage(1152621); // Your talisman's magic is exhausted.
|
||||
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public bool ShowUsesRemaining { get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public DateTime Expires { get; set; }
|
||||
|
||||
[Constructable]
|
||||
public WoodsmansTalisman(CraftResource resource)
|
||||
: base(0x2F5A)
|
||||
{
|
||||
Resource = resource;
|
||||
|
||||
UsesRemaining = 300;
|
||||
ShowUsesRemaining = true;
|
||||
|
||||
Expires = DateTime.UtcNow + TimeSpan.FromHours(DecayPeriod);
|
||||
m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(10), CheckDecay);
|
||||
}
|
||||
|
||||
public void CheckDecay()
|
||||
{
|
||||
if (Expires < DateTime.UtcNow)
|
||||
Decay();
|
||||
else
|
||||
InvalidateProperties();
|
||||
}
|
||||
|
||||
public void Decay()
|
||||
{
|
||||
if (RootParent is Mobile)
|
||||
{
|
||||
Mobile parent = (Mobile)RootParent;
|
||||
|
||||
if (Name == null)
|
||||
parent.SendLocalizedMessage(1072515, "#" + LabelNumber); // The ~1_name~ expired...
|
||||
else
|
||||
parent.SendLocalizedMessage(1072515, Name); // The ~1_name~ expired...
|
||||
|
||||
Effects.SendLocationParticles(EffectItem.Create(parent.Location, parent.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042);
|
||||
Effects.PlaySound(parent.Location, parent.Map, 0x201);
|
||||
}
|
||||
else
|
||||
{
|
||||
Effects.SendLocationParticles(EffectItem.Create(this.Location, this.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042);
|
||||
Effects.PlaySound(this.Location, this.Map, 0x201);
|
||||
}
|
||||
|
||||
Delete();
|
||||
}
|
||||
|
||||
public override void Delete()
|
||||
{
|
||||
base.Delete();
|
||||
|
||||
if (m_Timer != null)
|
||||
{
|
||||
m_Timer.Stop();
|
||||
m_Timer = null;
|
||||
}
|
||||
}
|
||||
|
||||
public static int CheckHarvest(Mobile from, Type type, HarvestSystem system)
|
||||
{
|
||||
if (system != Lumberjacking.System)
|
||||
return 0;
|
||||
|
||||
CraftResource res = CraftResources.GetFromType(type);
|
||||
WoodsmansTalisman talisman = from.FindItemOnLayer(Layer.Talisman) as WoodsmansTalisman;
|
||||
|
||||
if (talisman != null && talisman.UsesRemaining > 0 && res == talisman.Resource)
|
||||
{
|
||||
talisman.UsesRemaining--;
|
||||
from.SendLocalizedMessage(1152625); // The magic of your talisman guides your hands as you cut the wood.
|
||||
return Utility.RandomMinMax(2, 5);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public override void AddNameProperty(ObjectPropertyList list)
|
||||
{
|
||||
list.Add(1152599, String.Format("#{0}\t#1152605", CraftResources.GetLocalizationNumber(_Resource))); // ~1_RES~ ~2_TYPE~ Talisman
|
||||
}
|
||||
|
||||
public override void AddUsesRemainingProperties(ObjectPropertyList list)
|
||||
{
|
||||
list.Add(1060584, UsesRemaining.ToString()); // uses remaining: ~1_val~
|
||||
}
|
||||
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
int left = 0;
|
||||
if (DateTime.UtcNow < Expires)
|
||||
left = (int)(Expires - DateTime.UtcNow).TotalSeconds;
|
||||
|
||||
list.Add(1072517, left.ToString()); // Lifespan: ~1_val~ seconds
|
||||
}
|
||||
|
||||
public WoodsmansTalisman(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write(0);
|
||||
|
||||
writer.Write((int)Resource);
|
||||
writer.Write(Expires);
|
||||
writer.Write(UsesRemaining);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadInt();
|
||||
|
||||
Resource = (CraftResource)reader.ReadInt();
|
||||
Expires = reader.ReadDateTime();
|
||||
UsesRemaining = reader.ReadInt();
|
||||
|
||||
if (Expires < DateTime.UtcNow)
|
||||
Decay();
|
||||
else
|
||||
m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(10), CheckDecay);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user