Overwrite
Complete Overwrite of the Folder with the free shard. ServUO 57.3 has been added.
This commit is contained in:
31
Scripts/Items/Equipment/Instruments/AudChar.cs
Normal file
31
Scripts/Items/Equipment/Instruments/AudChar.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class AudChar : BaseInstrument
|
||||
{
|
||||
[Constructable]
|
||||
public AudChar()
|
||||
: base(0x403B, 0x392, 0x44)
|
||||
{
|
||||
Weight = 10.0;
|
||||
}
|
||||
|
||||
public AudChar(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
36
Scripts/Items/Equipment/Instruments/BambooFlute.cs
Normal file
36
Scripts/Items/Equipment/Instruments/BambooFlute.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class BambooFlute : BaseInstrument
|
||||
{
|
||||
[Constructable]
|
||||
public BambooFlute()
|
||||
: base(0x2805, 0x504, 0x503)
|
||||
{
|
||||
this.Weight = 2.0;
|
||||
}
|
||||
|
||||
public BambooFlute(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
if (this.Weight == 3.0)
|
||||
this.Weight = 2.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
746
Scripts/Items/Equipment/Instruments/BaseInstrument.cs
Normal file
746
Scripts/Items/Equipment/Instruments/BaseInstrument.cs
Normal file
@@ -0,0 +1,746 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using Server.Engines.Craft;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public delegate void InstrumentPickedCallback(Mobile from, BaseInstrument instrument);
|
||||
|
||||
public abstract class BaseInstrument : Item, ISlayer, IQuality, IResource
|
||||
{
|
||||
public static readonly double MaxBardingDifficulty = 160.0;
|
||||
|
||||
private int m_WellSound, m_BadlySound;
|
||||
private SlayerName m_Slayer, m_Slayer2;
|
||||
private ItemQuality m_Quality;
|
||||
private Mobile m_Crafter;
|
||||
private int m_UsesRemaining;
|
||||
private CraftResource m_Resource;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int SuccessSound
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_WellSound;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_WellSound = value;
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int FailureSound
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_BadlySound;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_BadlySound = value;
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public SlayerName Slayer
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Slayer;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_Slayer = value;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public SlayerName Slayer2
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Slayer2;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_Slayer2 = value;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public ItemQuality Quality
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Quality;
|
||||
}
|
||||
set
|
||||
{
|
||||
UnscaleUses();
|
||||
m_Quality = value;
|
||||
InvalidateProperties();
|
||||
ScaleUses();
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public bool PlayerConstructed { get { return m_Crafter != null; } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public Mobile Crafter
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Crafter;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_Crafter = value;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public CraftResource Resource
|
||||
{
|
||||
get { return m_Resource; }
|
||||
set
|
||||
{
|
||||
m_Resource = value;
|
||||
Hue = CraftResources.GetHue(m_Resource);
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
public virtual int InitMinUses
|
||||
{
|
||||
get
|
||||
{
|
||||
return 350;
|
||||
}
|
||||
}
|
||||
public virtual int InitMaxUses
|
||||
{
|
||||
get
|
||||
{
|
||||
return 450;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual TimeSpan ChargeReplenishRate
|
||||
{
|
||||
get
|
||||
{
|
||||
return TimeSpan.FromMinutes(5.0);
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int UsesRemaining
|
||||
{
|
||||
get
|
||||
{
|
||||
CheckReplenishUses();
|
||||
return m_UsesRemaining;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_UsesRemaining = value;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
private DateTime m_LastReplenished;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public DateTime LastReplenished
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_LastReplenished;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_LastReplenished = value;
|
||||
CheckReplenishUses();
|
||||
}
|
||||
}
|
||||
|
||||
private bool m_ReplenishesCharges;
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public bool ReplenishesCharges
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_ReplenishesCharges;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value != m_ReplenishesCharges && value)
|
||||
m_LastReplenished = DateTime.UtcNow;
|
||||
|
||||
m_ReplenishesCharges = value;
|
||||
}
|
||||
}
|
||||
|
||||
public void RandomInstrument()
|
||||
{
|
||||
switch (Utility.Random(3))
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
ItemID = 0xEB2;
|
||||
SuccessSound = 0x45;
|
||||
FailureSound = 0x46;
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
ItemID = 0xEB3;
|
||||
SuccessSound = 0x4C;
|
||||
FailureSound = 0x4D;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
ItemID = 0xE9C;
|
||||
SuccessSound = 0x38;
|
||||
FailureSound = 0x39;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void CheckReplenishUses()
|
||||
{
|
||||
CheckReplenishUses(true);
|
||||
}
|
||||
|
||||
public void CheckReplenishUses(bool invalidate)
|
||||
{
|
||||
if (!m_ReplenishesCharges || m_UsesRemaining >= InitMaxUses)
|
||||
return;
|
||||
|
||||
if (m_LastReplenished + ChargeReplenishRate < DateTime.UtcNow)
|
||||
{
|
||||
TimeSpan timeDifference = DateTime.UtcNow - m_LastReplenished;
|
||||
|
||||
m_UsesRemaining = Math.Min(m_UsesRemaining + (int)(timeDifference.Ticks / ChargeReplenishRate.Ticks), InitMaxUses); //How rude of TimeSpan to not allow timespan division.
|
||||
m_LastReplenished = DateTime.UtcNow;
|
||||
|
||||
if (invalidate)
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
public void ScaleUses()
|
||||
{
|
||||
UsesRemaining = (UsesRemaining * GetUsesScalar()) / 100;
|
||||
//InvalidateProperties();
|
||||
}
|
||||
|
||||
public void UnscaleUses()
|
||||
{
|
||||
UsesRemaining = (UsesRemaining * 100) / GetUsesScalar();
|
||||
}
|
||||
|
||||
public int GetUsesScalar()
|
||||
{
|
||||
if (m_Quality == ItemQuality.Exceptional)
|
||||
return 200;
|
||||
|
||||
return 100;
|
||||
}
|
||||
|
||||
public void ConsumeUse(Mobile from)
|
||||
{
|
||||
// TODO: Confirm what must happen here?
|
||||
if (UsesRemaining > 1)
|
||||
{
|
||||
--UsesRemaining;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (from != null)
|
||||
from.SendLocalizedMessage(502079); // The instrument played its last tune.
|
||||
|
||||
Delete();
|
||||
}
|
||||
}
|
||||
|
||||
private static readonly Hashtable m_Instruments = new Hashtable();
|
||||
|
||||
public static BaseInstrument GetInstrument(Mobile from)
|
||||
{
|
||||
BaseInstrument item = m_Instruments[from] as BaseInstrument;
|
||||
|
||||
if (item == null)
|
||||
return null;
|
||||
|
||||
if (!item.IsChildOf(from.Backpack))
|
||||
{
|
||||
m_Instruments.Remove(from);
|
||||
return null;
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
public static int GetBardRange(Mobile bard, SkillName skill)
|
||||
{
|
||||
return 8 + (int)(bard.Skills[skill].Value / 15);
|
||||
}
|
||||
|
||||
public static void PickInstrument(Mobile from, InstrumentPickedCallback callback)
|
||||
{
|
||||
BaseInstrument instrument = GetInstrument(from);
|
||||
|
||||
if (instrument != null)
|
||||
{
|
||||
if (callback != null)
|
||||
callback(from, instrument);
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(500617); // What instrument shall you play?
|
||||
from.BeginTarget(1, false, TargetFlags.None, new TargetStateCallback(OnPickedInstrument), callback);
|
||||
}
|
||||
}
|
||||
|
||||
public static void OnPickedInstrument(Mobile from, object targeted, object state)
|
||||
{
|
||||
BaseInstrument instrument = targeted as BaseInstrument;
|
||||
|
||||
if (instrument == null)
|
||||
{
|
||||
from.SendLocalizedMessage(500619); // That is not a musical instrument.
|
||||
}
|
||||
else
|
||||
{
|
||||
SetInstrument(from, instrument);
|
||||
|
||||
InstrumentPickedCallback callback = state as InstrumentPickedCallback;
|
||||
|
||||
if (callback != null)
|
||||
callback(from, instrument);
|
||||
}
|
||||
}
|
||||
|
||||
public static bool IsMageryCreature(BaseCreature bc)
|
||||
{
|
||||
return (bc != null && bc.AI == AIType.AI_Mage && bc.Skills[SkillName.Magery].Base > 5.0);
|
||||
}
|
||||
|
||||
public static bool IsFireBreathingCreature(BaseCreature bc)
|
||||
{
|
||||
if (bc == null)
|
||||
return false;
|
||||
|
||||
var profile = bc.AbilityProfile;
|
||||
|
||||
if (profile != null)
|
||||
{
|
||||
return profile.HasAbility(SpecialAbility.DragonBreath);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool IsPoisonImmune(BaseCreature bc)
|
||||
{
|
||||
return (bc != null && bc.PoisonImmune != null);
|
||||
}
|
||||
|
||||
public static int GetPoisonLevel(BaseCreature bc)
|
||||
{
|
||||
if (bc == null)
|
||||
return 0;
|
||||
|
||||
Poison p = bc.HitPoison;
|
||||
|
||||
if (p == null)
|
||||
return 0;
|
||||
|
||||
return p.Level + 1;
|
||||
}
|
||||
|
||||
public static double GetBaseDifficulty(Mobile targ)
|
||||
{
|
||||
/* Difficulty TODO: Add another 100 points for each of the following abilities:
|
||||
- Radiation or Aura Damage (Heat, Cold etc.)
|
||||
- Summoning Undead
|
||||
*/
|
||||
double val = (targ.HitsMax * 1.6) + targ.StamMax + targ.ManaMax;
|
||||
|
||||
val += targ.SkillsTotal / 10;
|
||||
|
||||
BaseCreature bc = targ as BaseCreature;
|
||||
|
||||
if (IsMageryCreature(bc))
|
||||
val += 100;
|
||||
|
||||
if (IsFireBreathingCreature(bc))
|
||||
val += 100;
|
||||
|
||||
if (IsPoisonImmune(bc))
|
||||
val += 100;
|
||||
|
||||
if (targ is VampireBat || targ is VampireBatFamiliar)
|
||||
val += 100;
|
||||
|
||||
val += GetPoisonLevel(bc) * 20;
|
||||
|
||||
if (val > 700)
|
||||
val = 700 + (int)((val - 700) * (3.0 / 11));
|
||||
|
||||
val /= 10;
|
||||
|
||||
if (bc != null && bc.IsParagon)
|
||||
val += 40.0;
|
||||
|
||||
if (Core.SE && val > MaxBardingDifficulty)
|
||||
val = MaxBardingDifficulty;
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
public double GetDifficultyFor(Mobile targ)
|
||||
{
|
||||
double val = GetBaseDifficulty(targ);
|
||||
|
||||
if (m_Quality == ItemQuality.Exceptional)
|
||||
val -= 5.0; // 10%
|
||||
|
||||
if (m_Slayer != SlayerName.None)
|
||||
{
|
||||
SlayerEntry entry = SlayerGroup.GetEntryByName(m_Slayer);
|
||||
|
||||
if (entry != null)
|
||||
{
|
||||
if (entry.Slays(targ))
|
||||
val -= 10.0; // 20%
|
||||
else if (entry.Group.OppositionSuperSlays(targ))
|
||||
val += 10.0; // -20%
|
||||
}
|
||||
}
|
||||
|
||||
if (m_Slayer2 != SlayerName.None)
|
||||
{
|
||||
SlayerEntry entry = SlayerGroup.GetEntryByName(m_Slayer2);
|
||||
|
||||
if (entry != null)
|
||||
{
|
||||
if (entry.Slays(targ))
|
||||
val -= 10.0; // 20%
|
||||
else if (entry.Group.OppositionSuperSlays(targ))
|
||||
val += 10.0; // -20%
|
||||
}
|
||||
}
|
||||
|
||||
if (m_Slayer == SlayerName.None && m_Slayer2 == SlayerName.None)
|
||||
{
|
||||
SlayerEntry entry = SlayerGroup.GetEntryByName(SlayerSocket.GetSlayer(this));
|
||||
|
||||
if (entry != null)
|
||||
{
|
||||
if (entry.Slays(targ))
|
||||
val -= 10.0; // 20%
|
||||
else if (entry.Group.OppositionSuperSlays(targ))
|
||||
val += 10.0; // -20%
|
||||
}
|
||||
}
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
public static void SetInstrument(Mobile from, BaseInstrument item)
|
||||
{
|
||||
m_Instruments[from] = item;
|
||||
}
|
||||
|
||||
public BaseInstrument()
|
||||
{
|
||||
RandomInstrument();
|
||||
|
||||
UsesRemaining = Utility.RandomMinMax(InitMinUses, InitMaxUses);
|
||||
}
|
||||
|
||||
public BaseInstrument(int itemID, int wellSound, int badlySound)
|
||||
: base(itemID)
|
||||
{
|
||||
m_WellSound = wellSound;
|
||||
m_BadlySound = badlySound;
|
||||
|
||||
UsesRemaining = Utility.RandomMinMax(InitMinUses, InitMaxUses);
|
||||
}
|
||||
|
||||
public override void AddCraftedProperties(ObjectPropertyList list)
|
||||
{
|
||||
if (m_Crafter != null)
|
||||
list.Add(1050043, m_Crafter.TitleName); // crafted by ~1_NAME~
|
||||
|
||||
if (m_Quality == ItemQuality.Exceptional)
|
||||
list.Add(1060636); // exceptional
|
||||
}
|
||||
|
||||
public override void AddUsesRemainingProperties(ObjectPropertyList list)
|
||||
{
|
||||
list.Add(1060584, UsesRemaining.ToString()); // uses remaining: ~1_val~
|
||||
}
|
||||
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
int oldUses = m_UsesRemaining;
|
||||
CheckReplenishUses(false);
|
||||
|
||||
base.GetProperties(list);
|
||||
|
||||
if (m_ReplenishesCharges)
|
||||
list.Add(1070928); // Replenish Charges
|
||||
|
||||
if (m_Slayer != SlayerName.None)
|
||||
{
|
||||
SlayerEntry entry = SlayerGroup.GetEntryByName(m_Slayer);
|
||||
if (entry != null)
|
||||
list.Add(entry.Title);
|
||||
}
|
||||
|
||||
if (m_Slayer2 != SlayerName.None)
|
||||
{
|
||||
SlayerEntry entry = SlayerGroup.GetEntryByName(m_Slayer2);
|
||||
if (entry != null)
|
||||
list.Add(entry.Title);
|
||||
}
|
||||
|
||||
if (!CraftResources.IsStandard(m_Resource))
|
||||
{
|
||||
int num = CraftResources.GetLocalizationNumber(m_Resource);
|
||||
|
||||
if (num > 0)
|
||||
list.Add(num);
|
||||
else
|
||||
list.Add(CraftResources.GetName(m_Resource));
|
||||
}
|
||||
|
||||
if (m_UsesRemaining != oldUses)
|
||||
Timer.DelayCall(TimeSpan.Zero, new TimerCallback(InvalidateProperties));
|
||||
}
|
||||
|
||||
public override void OnSingleClick(Mobile from)
|
||||
{
|
||||
ArrayList attrs = new ArrayList();
|
||||
|
||||
if (DisplayLootType)
|
||||
{
|
||||
if (LootType == LootType.Blessed)
|
||||
attrs.Add(new EquipInfoAttribute(1038021)); // blessed
|
||||
else if (LootType == LootType.Cursed)
|
||||
attrs.Add(new EquipInfoAttribute(1049643)); // cursed
|
||||
}
|
||||
|
||||
if (m_Quality == ItemQuality.Exceptional)
|
||||
attrs.Add(new EquipInfoAttribute(1018305 - (int)m_Quality));
|
||||
|
||||
if (m_ReplenishesCharges)
|
||||
attrs.Add(new EquipInfoAttribute(1070928)); // Replenish Charges
|
||||
|
||||
// TODO: Must this support item identification?
|
||||
if (m_Slayer != SlayerName.None)
|
||||
{
|
||||
SlayerEntry entry = SlayerGroup.GetEntryByName(m_Slayer);
|
||||
if (entry != null)
|
||||
attrs.Add(new EquipInfoAttribute(entry.Title));
|
||||
}
|
||||
|
||||
if (m_Slayer2 != SlayerName.None)
|
||||
{
|
||||
SlayerEntry entry = SlayerGroup.GetEntryByName(m_Slayer2);
|
||||
if (entry != null)
|
||||
attrs.Add(new EquipInfoAttribute(entry.Title));
|
||||
}
|
||||
|
||||
int number;
|
||||
|
||||
if (Name == null)
|
||||
{
|
||||
number = LabelNumber;
|
||||
}
|
||||
else
|
||||
{
|
||||
LabelTo(from, Name);
|
||||
number = 1041000;
|
||||
}
|
||||
|
||||
if (attrs.Count == 0 && Crafter == null && Name != null)
|
||||
return;
|
||||
|
||||
EquipmentInfo eqInfo = new EquipmentInfo(number, m_Crafter, false, (EquipInfoAttribute[])attrs.ToArray(typeof(EquipInfoAttribute)));
|
||||
|
||||
from.Send(new DisplayEquipmentInfo(this, eqInfo));
|
||||
}
|
||||
|
||||
public BaseInstrument(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)4); // version
|
||||
|
||||
writer.Write((int)m_Resource);
|
||||
|
||||
writer.Write(m_ReplenishesCharges);
|
||||
if (m_ReplenishesCharges)
|
||||
writer.Write(m_LastReplenished);
|
||||
|
||||
writer.Write(m_Crafter);
|
||||
|
||||
writer.WriteEncodedInt((int)m_Quality);
|
||||
writer.WriteEncodedInt((int)m_Slayer);
|
||||
writer.WriteEncodedInt((int)m_Slayer2);
|
||||
|
||||
writer.WriteEncodedInt((int)UsesRemaining);
|
||||
|
||||
writer.WriteEncodedInt((int)m_WellSound);
|
||||
writer.WriteEncodedInt((int)m_BadlySound);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 4:
|
||||
{
|
||||
m_Resource = (CraftResource)reader.ReadInt();
|
||||
goto case 3;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
m_ReplenishesCharges = reader.ReadBool();
|
||||
|
||||
if (m_ReplenishesCharges)
|
||||
m_LastReplenished = reader.ReadDateTime();
|
||||
|
||||
goto case 2;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
m_Crafter = reader.ReadMobile();
|
||||
|
||||
m_Quality = (ItemQuality)reader.ReadEncodedInt();
|
||||
m_Slayer = (SlayerName)reader.ReadEncodedInt();
|
||||
m_Slayer2 = (SlayerName)reader.ReadEncodedInt();
|
||||
|
||||
UsesRemaining = reader.ReadEncodedInt();
|
||||
|
||||
m_WellSound = reader.ReadEncodedInt();
|
||||
m_BadlySound = reader.ReadEncodedInt();
|
||||
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
m_Crafter = reader.ReadMobile();
|
||||
|
||||
m_Quality = (ItemQuality)reader.ReadEncodedInt();
|
||||
m_Slayer = (SlayerName)reader.ReadEncodedInt();
|
||||
|
||||
UsesRemaining = reader.ReadEncodedInt();
|
||||
|
||||
m_WellSound = reader.ReadEncodedInt();
|
||||
m_BadlySound = reader.ReadEncodedInt();
|
||||
|
||||
break;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
m_WellSound = reader.ReadInt();
|
||||
m_BadlySound = reader.ReadInt();
|
||||
UsesRemaining = Utility.RandomMinMax(InitMinUses, InitMaxUses);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
CheckReplenishUses();
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (!from.InRange(GetWorldLocation(), 1))
|
||||
{
|
||||
from.SendLocalizedMessage(500446); // That is too far away.
|
||||
}
|
||||
else if (from.BeginAction(typeof(BaseInstrument)))
|
||||
{
|
||||
SetInstrument(from, this);
|
||||
|
||||
Timer.DelayCall(TimeSpan.FromMilliseconds(1000), () =>
|
||||
{
|
||||
from.EndAction(typeof(BaseInstrument));
|
||||
});
|
||||
|
||||
if (CheckMusicianship(from))
|
||||
PlayInstrumentWell(from);
|
||||
else
|
||||
PlayInstrumentBadly(from);
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(500119); // You must wait to perform another action
|
||||
}
|
||||
}
|
||||
|
||||
public static bool CheckMusicianship(Mobile m)
|
||||
{
|
||||
m.CheckSkill(SkillName.Musicianship, 0.0, 120.0);
|
||||
|
||||
return ((m.Skills[SkillName.Musicianship].Value / 100) > Utility.RandomDouble());
|
||||
}
|
||||
|
||||
public void PlayInstrumentWell(Mobile from)
|
||||
{
|
||||
from.PlaySound(m_WellSound);
|
||||
}
|
||||
|
||||
public void PlayInstrumentBadly(Mobile from)
|
||||
{
|
||||
from.PlaySound(m_BadlySound);
|
||||
}
|
||||
|
||||
#region ICraftable Members
|
||||
|
||||
public virtual int OnCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, ITool tool, CraftItem craftItem, int resHue)
|
||||
{
|
||||
Quality = (ItemQuality)quality;
|
||||
|
||||
if (makersMark)
|
||||
Crafter = from;
|
||||
|
||||
if (!craftItem.ForceNonExceptional)
|
||||
{
|
||||
if (typeRes == null)
|
||||
typeRes = craftItem.Resources.GetAt(0).ItemType;
|
||||
|
||||
Resource = CraftResources.GetFromType(typeRes);
|
||||
}
|
||||
|
||||
return quality;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
90
Scripts/Items/Equipment/Instruments/Cello.cs
Normal file
90
Scripts/Items/Equipment/Instruments/Cello.cs
Normal file
@@ -0,0 +1,90 @@
|
||||
using System;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
[Flipable(0x4C3E, 0x4C3F)]
|
||||
public class CelloComponent : InstrumentedAddonComponent
|
||||
{
|
||||
public override int LabelNumber { get { return 1098390; } } // cello
|
||||
|
||||
public CelloComponent()
|
||||
: base(0x4C3E, 0x66D)
|
||||
{
|
||||
}
|
||||
|
||||
public CelloComponent(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.WriteEncodedInt(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class CelloDeed : BaseAddonDeed
|
||||
{
|
||||
public override int LabelNumber { get { return 1098390; } } // cello
|
||||
|
||||
[Constructable]
|
||||
public CelloDeed()
|
||||
{
|
||||
}
|
||||
|
||||
public CelloDeed(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override BaseAddon Addon { get { return new CelloAddon(); } }
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.WriteEncodedInt(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class CelloAddon : BaseAddon
|
||||
{
|
||||
public override BaseAddonDeed Deed { get { return new CelloDeed(); } }
|
||||
public override bool RetainDeedHue { get { return true; } }
|
||||
|
||||
[Constructable]
|
||||
public CelloAddon()
|
||||
{
|
||||
AddComponent(new CelloComponent(), 0, 0, 0);
|
||||
}
|
||||
|
||||
public CelloAddon(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.WriteEncodedInt(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
90
Scripts/Items/Equipment/Instruments/Cowbell.cs
Normal file
90
Scripts/Items/Equipment/Instruments/Cowbell.cs
Normal file
@@ -0,0 +1,90 @@
|
||||
using System;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
[Flipable(0x4C5A, 0x4C5B)]
|
||||
public class CowBellComponent : InstrumentedAddonComponent
|
||||
{
|
||||
public override int LabelNumber { get { return 1098418; } } // cowbell
|
||||
|
||||
public CowBellComponent()
|
||||
: base(0x4C5A, 0x66E)
|
||||
{
|
||||
}
|
||||
|
||||
public CowBellComponent(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.WriteEncodedInt(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class CowBellDeed : BaseAddonDeed
|
||||
{
|
||||
public override int LabelNumber { get { return 1098418; } } // cowbell
|
||||
|
||||
[Constructable]
|
||||
public CowBellDeed()
|
||||
{
|
||||
}
|
||||
|
||||
public CowBellDeed(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override BaseAddon Addon { get { return new CowBellAddon(); } }
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.WriteEncodedInt(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class CowBellAddon : BaseAddon
|
||||
{
|
||||
public override BaseAddonDeed Deed { get { return new CowBellDeed(); } }
|
||||
public override bool RetainDeedHue { get { return true; } }
|
||||
|
||||
[Constructable]
|
||||
public CowBellAddon()
|
||||
{
|
||||
AddComponent(new CowBellComponent(), 0, 0, 0);
|
||||
}
|
||||
|
||||
public CowBellAddon(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.WriteEncodedInt(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
36
Scripts/Items/Equipment/Instruments/Drums.cs
Normal file
36
Scripts/Items/Equipment/Instruments/Drums.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class Drums : BaseInstrument
|
||||
{
|
||||
[Constructable]
|
||||
public Drums()
|
||||
: base(0xE9C, 0x38, 0x39)
|
||||
{
|
||||
this.Weight = 4.0;
|
||||
}
|
||||
|
||||
public Drums(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
if (this.Weight == 3.0)
|
||||
this.Weight = 4.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
216
Scripts/Items/Equipment/Instruments/FireHorn.cs
Normal file
216
Scripts/Items/Equipment/Instruments/FireHorn.cs
Normal file
@@ -0,0 +1,216 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Linq;
|
||||
|
||||
using Server.Network;
|
||||
using Server.Spells;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class FireHorn : Item
|
||||
{
|
||||
[Constructable]
|
||||
public FireHorn()
|
||||
: base(0xFC7)
|
||||
{
|
||||
this.Hue = 0x466;
|
||||
this.Weight = 1.0;
|
||||
}
|
||||
|
||||
public FireHorn(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int LabelNumber
|
||||
{
|
||||
get
|
||||
{
|
||||
return 1060456;
|
||||
}
|
||||
}// fire horn
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (this.CheckUse(from))
|
||||
{
|
||||
from.SendLocalizedMessage(1049620); // Select an area to incinerate.
|
||||
from.Target = new InternalTarget(this);
|
||||
}
|
||||
}
|
||||
|
||||
public void Use(Mobile from, IPoint3D loc)
|
||||
{
|
||||
if (!this.CheckUse(from))
|
||||
return;
|
||||
|
||||
from.BeginAction(typeof(FireHorn));
|
||||
Timer.DelayCall(Core.AOS ? TimeSpan.FromSeconds(6.0) : TimeSpan.FromSeconds(12.0), new TimerStateCallback(EndAction), from);
|
||||
|
||||
int music = from.Skills[SkillName.Musicianship].Fixed;
|
||||
|
||||
int sucChance = 500 + (music - 775) * 2;
|
||||
double dSucChance = ((double)sucChance) / 1000.0;
|
||||
|
||||
if (!from.CheckSkill(SkillName.Musicianship, dSucChance))
|
||||
{
|
||||
from.SendLocalizedMessage(1049618); // The horn emits a pathetic squeak.
|
||||
from.PlaySound(0x18A);
|
||||
return;
|
||||
}
|
||||
|
||||
int sulfAsh = Core.AOS ? 4 : 15;
|
||||
from.Backpack.ConsumeUpTo(typeof(SulfurousAsh), sulfAsh);
|
||||
|
||||
from.PlaySound(0x15F);
|
||||
Effects.SendPacket(from, from.Map, new HuedEffect(EffectType.Moving, from.Serial, Serial.Zero, 0x36D4, from.Location, loc, 5, 0, false, true, 0, 0));
|
||||
|
||||
var targets = SpellHelper.AcquireIndirectTargets(from, loc, from.Map, 2).OfType<Mobile>().ToList();
|
||||
var count = targets.Count;
|
||||
bool playerVsPlayer = targets.Any(t => t.Player);
|
||||
|
||||
if (count > 0)
|
||||
{
|
||||
int prov = from.Skills[SkillName.Provocation].Fixed;
|
||||
int disc = from.Skills[SkillName.Discordance].Fixed;
|
||||
int peace = from.Skills[SkillName.Peacemaking].Fixed;
|
||||
|
||||
int minDamage, maxDamage;
|
||||
|
||||
if (Core.AOS)
|
||||
{
|
||||
int musicScaled = music + Math.Max(0, music - 900) * 2;
|
||||
int provScaled = prov + Math.Max(0, prov - 900) * 2;
|
||||
int discScaled = disc + Math.Max(0, disc - 900) * 2;
|
||||
int peaceScaled = peace + Math.Max(0, peace - 900) * 2;
|
||||
|
||||
int weightAvg = (musicScaled + provScaled * 3 + discScaled * 3 + peaceScaled) / 80;
|
||||
|
||||
int avgDamage;
|
||||
if (playerVsPlayer)
|
||||
avgDamage = weightAvg / 3;
|
||||
else
|
||||
avgDamage = weightAvg / 2;
|
||||
|
||||
minDamage = (avgDamage * 9) / 10;
|
||||
maxDamage = (avgDamage * 10) / 9;
|
||||
}
|
||||
else
|
||||
{
|
||||
int total = prov + disc / 5 + peace / 5;
|
||||
|
||||
if (playerVsPlayer)
|
||||
total /= 3;
|
||||
|
||||
maxDamage = (total * 2) / 30;
|
||||
minDamage = (maxDamage * 7) / 10;
|
||||
}
|
||||
|
||||
double damage = Utility.RandomMinMax(minDamage, maxDamage);
|
||||
|
||||
if (Core.AOS && count > 1)
|
||||
damage = (damage * 2) / count;
|
||||
else if (!Core.AOS)
|
||||
damage /= count;
|
||||
|
||||
foreach(var m in targets)
|
||||
{
|
||||
double toDeal = damage;
|
||||
|
||||
if (!Core.AOS && m.CheckSkill(SkillName.MagicResist, 0.0, 120.0))
|
||||
{
|
||||
toDeal *= 0.5;
|
||||
m.SendLocalizedMessage(501783); // You feel yourself resisting magical energy.
|
||||
}
|
||||
|
||||
from.DoHarmful(m);
|
||||
SpellHelper.Damage(TimeSpan.Zero, m, from, toDeal, 0, 100, 0, 0, 0);
|
||||
|
||||
Effects.SendTargetEffect(m, 0x3709, 10, 30);
|
||||
}
|
||||
}
|
||||
|
||||
ColUtility.Free(targets);
|
||||
|
||||
double breakChance = Core.AOS ? 0.01 : 0.16;
|
||||
if (Utility.RandomDouble() < breakChance)
|
||||
{
|
||||
from.SendLocalizedMessage(1049619); // The fire horn crumbles in your hands.
|
||||
this.Delete();
|
||||
}
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.WriteEncodedInt(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
|
||||
private static void EndAction(object state)
|
||||
{
|
||||
Mobile m = (Mobile)state;
|
||||
|
||||
m.EndAction(typeof(FireHorn));
|
||||
m.SendLocalizedMessage(1049621); // You catch your breath.
|
||||
}
|
||||
|
||||
private bool CheckUse(Mobile from)
|
||||
{
|
||||
if (!this.IsAccessibleTo(from))
|
||||
return false;
|
||||
|
||||
if (from.Map != this.Map || !from.InRange(this.GetWorldLocation(), 2))
|
||||
{
|
||||
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!from.CanBeginAction(typeof(FireHorn)))
|
||||
{
|
||||
from.SendLocalizedMessage(1049615); // You must take a moment to catch your breath.
|
||||
return false;
|
||||
}
|
||||
|
||||
int sulfAsh = Core.AOS ? 4 : 15;
|
||||
if (from.Backpack == null || from.Backpack.GetAmount(typeof(SulfurousAsh)) < sulfAsh)
|
||||
{
|
||||
from.SendLocalizedMessage(1049617); // You do not have enough sulfurous ash.
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private readonly FireHorn m_Horn;
|
||||
public InternalTarget(FireHorn horn)
|
||||
: base(Core.AOS ? 3 : 2, true, TargetFlags.Harmful)
|
||||
{
|
||||
this.m_Horn = horn;
|
||||
}
|
||||
|
||||
protected override void OnTarget(Mobile from, object targeted)
|
||||
{
|
||||
if (this.m_Horn.Deleted)
|
||||
return;
|
||||
|
||||
IPoint3D loc;
|
||||
if (targeted is Item)
|
||||
loc = ((Item)targeted).GetWorldLocation();
|
||||
else
|
||||
loc = targeted as IPoint3D;
|
||||
|
||||
this.m_Horn.Use(from, loc);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
36
Scripts/Items/Equipment/Instruments/Harp.cs
Normal file
36
Scripts/Items/Equipment/Instruments/Harp.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class Harp : BaseInstrument
|
||||
{
|
||||
[Constructable]
|
||||
public Harp()
|
||||
: base(0xEB1, 0x43, 0x44)
|
||||
{
|
||||
this.Weight = 35.0;
|
||||
}
|
||||
|
||||
public Harp(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
if (this.Weight == 3.0)
|
||||
this.Weight = 35.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
36
Scripts/Items/Equipment/Instruments/LapHarp.cs
Normal file
36
Scripts/Items/Equipment/Instruments/LapHarp.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class LapHarp : BaseInstrument
|
||||
{
|
||||
[Constructable]
|
||||
public LapHarp()
|
||||
: base(0xEB2, 0x45, 0x46)
|
||||
{
|
||||
this.Weight = 10.0;
|
||||
}
|
||||
|
||||
public LapHarp(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
if (this.Weight == 3.0)
|
||||
this.Weight = 10.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
36
Scripts/Items/Equipment/Instruments/Lute.cs
Normal file
36
Scripts/Items/Equipment/Instruments/Lute.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class Lute : BaseInstrument
|
||||
{
|
||||
[Constructable]
|
||||
public Lute()
|
||||
: base(0xEB3, 0x4C, 0x4D)
|
||||
{
|
||||
this.Weight = 5.0;
|
||||
}
|
||||
|
||||
public Lute(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
if (this.Weight == 3.0)
|
||||
this.Weight = 5.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
168
Scripts/Items/Equipment/Instruments/SnakeCharmerFlute.cs
Normal file
168
Scripts/Items/Equipment/Instruments/SnakeCharmerFlute.cs
Normal file
@@ -0,0 +1,168 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
using Server;
|
||||
using Server.Network;
|
||||
using Server.Mobiles;
|
||||
using Server.Targeting;
|
||||
using Server.Engines.Craft;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class SnakeCharmerFlute : BambooFlute
|
||||
{
|
||||
public override int LabelNumber { get { return 1112174; } } // snake charmer flute
|
||||
|
||||
public override int InitMinUses
|
||||
{
|
||||
get
|
||||
{
|
||||
return 50;
|
||||
}
|
||||
}
|
||||
public override int InitMaxUses
|
||||
{
|
||||
get
|
||||
{
|
||||
return 80;
|
||||
}
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public SnakeCharmerFlute()
|
||||
{
|
||||
this.Hue = 0x187;
|
||||
}
|
||||
|
||||
public SnakeCharmerFlute(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (!from.CanBeginAction(typeof(SnakeCharmerFlute)))
|
||||
{
|
||||
from.SendLocalizedMessage(1072306); // You must wait a moment for it to recharge.
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(1112175); // Target the serpent you wish to entice.
|
||||
from.Target = new CharmTarget(this);
|
||||
}
|
||||
}
|
||||
|
||||
private class CharmTarget : Target
|
||||
{
|
||||
private SnakeCharmerFlute m_Flute;
|
||||
|
||||
public CharmTarget(SnakeCharmerFlute flute)
|
||||
: base(12, false, TargetFlags.None)
|
||||
{
|
||||
m_Flute = flute;
|
||||
}
|
||||
|
||||
protected override void OnTarget(Mobile from, object targeted)
|
||||
{
|
||||
BaseCreature bc = targeted as BaseCreature;
|
||||
|
||||
if (bc != null && IsSnake(bc))
|
||||
{
|
||||
if (bc.CharmMaster != null)
|
||||
{
|
||||
bc.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502802, from.NetState); // Someone else is already taming this.
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(502475); // Click where you wish the animal to go.
|
||||
from.Target = new InternalTarget(bc, m_Flute);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(1112176); // That is not a snake or serpent.
|
||||
}
|
||||
}
|
||||
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private BaseCreature m_Snake;
|
||||
private SnakeCharmerFlute m_Flute;
|
||||
|
||||
public InternalTarget(BaseCreature snake, SnakeCharmerFlute flute)
|
||||
: base(10, true, TargetFlags.None)
|
||||
{
|
||||
m_Snake = snake;
|
||||
m_Flute = flute;
|
||||
}
|
||||
|
||||
protected override void OnTarget(Mobile from, object targ)
|
||||
{
|
||||
if (targ is IPoint2D)
|
||||
{
|
||||
Point2D p = new Point2D((IPoint2D)targ);
|
||||
|
||||
if (!m_Snake.InRange(p, 10))
|
||||
{
|
||||
from.SendLocalizedMessage(500643); // Target is too far away.
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Snake.BeginCharm(from, p);
|
||||
|
||||
from.SendLocalizedMessage(502479); // The animal walks where it was instructed to.
|
||||
|
||||
from.BeginAction(typeof(SnakeCharmerFlute));
|
||||
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(5.0), new TimerCallback(
|
||||
delegate { from.EndAction(typeof(SnakeCharmerFlute)); }));
|
||||
|
||||
m_Flute.PlayInstrumentWell(from);
|
||||
m_Flute.UsesRemaining--;
|
||||
|
||||
if (m_Flute.UsesRemaining == 0)
|
||||
{
|
||||
from.SendLocalizedMessage(1112177); // You broke your snake charmer flute.
|
||||
|
||||
m_Flute.Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static bool IsSnake(BaseCreature bc)
|
||||
{
|
||||
return m_SnakeTypes.Any(t => t == bc.GetType());
|
||||
}
|
||||
|
||||
private static Type[] m_SnakeTypes = new Type[]
|
||||
{
|
||||
typeof(LavaSnake), typeof(Snake),
|
||||
typeof(CoralSnake), typeof(GiantSerpent),
|
||||
typeof(SilverSerpent)
|
||||
};
|
||||
|
||||
public override int OnCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, ITool tool, CraftItem craftItem, int resHue)
|
||||
{
|
||||
base.OnCraft(quality, makersMark, from, craftSystem, typeRes, tool, craftItem, resHue);
|
||||
|
||||
Hue = 0x187;
|
||||
|
||||
return quality;
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
36
Scripts/Items/Equipment/Instruments/Tambourine.cs
Normal file
36
Scripts/Items/Equipment/Instruments/Tambourine.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class Tambourine : BaseInstrument
|
||||
{
|
||||
[Constructable]
|
||||
public Tambourine()
|
||||
: base(0xE9D, 0x52, 0x53)
|
||||
{
|
||||
this.Weight = 1.0;
|
||||
}
|
||||
|
||||
public Tambourine(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
if (this.Weight == 2.0)
|
||||
this.Weight = 1.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
36
Scripts/Items/Equipment/Instruments/TambourineTassel.cs
Normal file
36
Scripts/Items/Equipment/Instruments/TambourineTassel.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class TambourineTassel : BaseInstrument
|
||||
{
|
||||
[Constructable]
|
||||
public TambourineTassel()
|
||||
: base(0xE9E, 0x52, 0x53)
|
||||
{
|
||||
this.Weight = 1.0;
|
||||
}
|
||||
|
||||
public TambourineTassel(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
if (this.Weight == 2.0)
|
||||
this.Weight = 1.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
90
Scripts/Items/Equipment/Instruments/Trumpet.cs
Normal file
90
Scripts/Items/Equipment/Instruments/Trumpet.cs
Normal file
@@ -0,0 +1,90 @@
|
||||
using System;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
[Flipable(0x4C3C, 0x4C3D)]
|
||||
public class TrumpetComponent : InstrumentedAddonComponent
|
||||
{
|
||||
public override int LabelNumber { get { return 1098388; } } // trumpet
|
||||
|
||||
public TrumpetComponent()
|
||||
: base(0x4C3C, 0x66F)
|
||||
{
|
||||
}
|
||||
|
||||
public TrumpetComponent(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.WriteEncodedInt(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class TrumpetDeed : BaseAddonDeed
|
||||
{
|
||||
public override int LabelNumber { get { return 1098388; } } // trumpet
|
||||
|
||||
[Constructable]
|
||||
public TrumpetDeed()
|
||||
{
|
||||
}
|
||||
|
||||
public TrumpetDeed(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override BaseAddon Addon { get { return new TrumpetAddon(); } }
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.WriteEncodedInt(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class TrumpetAddon : BaseAddon
|
||||
{
|
||||
public override BaseAddonDeed Deed { get { return new TrumpetDeed(); } }
|
||||
public override bool RetainDeedHue { get { return true; } }
|
||||
|
||||
[Constructable]
|
||||
public TrumpetAddon()
|
||||
{
|
||||
AddComponent(new TrumpetComponent(), 0, 0, 0);
|
||||
}
|
||||
|
||||
public TrumpetAddon(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.WriteEncodedInt(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
120
Scripts/Items/Equipment/Instruments/WallMountedBell.cs
Normal file
120
Scripts/Items/Equipment/Instruments/WallMountedBell.cs
Normal file
@@ -0,0 +1,120 @@
|
||||
using System;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class WallMountedBellSouthDeed : BaseAddonDeed
|
||||
{
|
||||
public override int LabelNumber { get { return 1154162; } } // Wall Mounted Bell (South)
|
||||
|
||||
[Constructable]
|
||||
public WallMountedBellSouthDeed()
|
||||
{
|
||||
}
|
||||
|
||||
public WallMountedBellSouthDeed(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override BaseAddon Addon { get { return new WallMountedBellSouthAddon(); } }
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.WriteEncodedInt(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class WallMountedBellSouthAddon : BaseAddon
|
||||
{
|
||||
public override BaseAddonDeed Deed { get { return new WallMountedBellSouthDeed(); } }
|
||||
public override bool RetainDeedHue { get { return true; } }
|
||||
|
||||
[Constructable]
|
||||
public WallMountedBellSouthAddon()
|
||||
{
|
||||
AddComponent(new InstrumentedAddonComponent(0x4C5C, 0x66C), 0, 0, 10);
|
||||
}
|
||||
|
||||
public WallMountedBellSouthAddon(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.WriteEncodedInt(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class WallMountedBellEastDeed : BaseAddonDeed
|
||||
{
|
||||
public override int LabelNumber { get { return 1154163; } } // Wall Mounted Bell (East)
|
||||
|
||||
[Constructable]
|
||||
public WallMountedBellEastDeed()
|
||||
{
|
||||
}
|
||||
|
||||
public WallMountedBellEastDeed(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override BaseAddon Addon { get { return new WallMountedBellEastAddon(); } }
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.WriteEncodedInt(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class WallMountedBellEastAddon : BaseAddon
|
||||
{
|
||||
public override BaseAddonDeed Deed { get { return new WallMountedBellEastDeed(); } }
|
||||
public override bool RetainDeedHue { get { return true; } }
|
||||
|
||||
[Constructable]
|
||||
public WallMountedBellEastAddon()
|
||||
{
|
||||
AddComponent(new InstrumentedAddonComponent(0x4C5D, 0x66C), 0, 0, 10);
|
||||
}
|
||||
|
||||
public WallMountedBellEastAddon(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.WriteEncodedInt(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user