Reorganizes Project (#41)
This commit is contained in:
parent
08bf44af9a
commit
3614a66aee
3499 changed files with 79 additions and 55 deletions
|
|
@ -0,0 +1,319 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.ContextMenus;
|
||||
using Server.Gumps;
|
||||
using Server.Multis;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public sealed class StopMusic : Packet
|
||||
{
|
||||
public static readonly Packet Instance = SetStatic(new StopMusic());
|
||||
|
||||
public StopMusic() : base(0x6D, 3)
|
||||
{
|
||||
m_Stream.Write((short)0x1FFF);
|
||||
}
|
||||
}
|
||||
|
||||
[Flippable(0x2AF9, 0x2AFD)]
|
||||
public class DawnsMusicBox : Item, ISecurable
|
||||
{
|
||||
private static Dictionary<MusicName, DawnsMusicInfo> m_Info;
|
||||
|
||||
public static MusicName[] m_CommonTracks =
|
||||
{
|
||||
MusicName.Samlethe, MusicName.Sailing, MusicName.Britain2, MusicName.Britain1,
|
||||
MusicName.Bucsden, MusicName.Forest_a, MusicName.Cove, MusicName.Death,
|
||||
MusicName.Dungeon9, MusicName.Dungeon2, MusicName.Cave01, MusicName.Combat3,
|
||||
MusicName.Combat1, MusicName.Combat2, MusicName.Jhelom, MusicName.Linelle,
|
||||
MusicName.LBCastle, MusicName.Minoc, MusicName.Moonglow, MusicName.Magincia,
|
||||
MusicName.Nujelm, MusicName.BTCastle, MusicName.Tavern04, MusicName.Skarabra,
|
||||
MusicName.Stones2, MusicName.Serpents, MusicName.Taiko, MusicName.Tavern01,
|
||||
MusicName.Tavern02, MusicName.Tavern03, MusicName.TokunoDungeon, MusicName.Trinsic,
|
||||
MusicName.OldUlt01, MusicName.Ocllo, MusicName.Vesper, MusicName.Victory,
|
||||
MusicName.Mountn_a, MusicName.Wind, MusicName.Yew, MusicName.Zento
|
||||
};
|
||||
|
||||
public static MusicName[] m_UncommonTracks =
|
||||
{
|
||||
MusicName.GwennoConversation, MusicName.DreadHornArea, MusicName.ElfCity,
|
||||
MusicName.GoodEndGame, MusicName.GoodVsEvil, MusicName.GreatEarthSerpents,
|
||||
MusicName.GrizzleDungeon, MusicName.Humanoids_U9, MusicName.MelisandesLair,
|
||||
MusicName.MinocNegative, MusicName.ParoxysmusLair, MusicName.Paws
|
||||
};
|
||||
|
||||
public static MusicName[] m_RareTracks =
|
||||
{
|
||||
MusicName.SelimsBar, MusicName.SerpentIsleCombat_U7, MusicName.ValoriaShips
|
||||
};
|
||||
|
||||
private int m_Count;
|
||||
private int m_ItemID;
|
||||
|
||||
private Timer m_Timer;
|
||||
|
||||
[Constructible]
|
||||
public DawnsMusicBox() : base(0x2AF9)
|
||||
{
|
||||
Weight = 1.0;
|
||||
|
||||
Tracks = new List<MusicName>();
|
||||
|
||||
while (Tracks.Count < 4)
|
||||
{
|
||||
MusicName name = RandomTrack(DawnsMusicRarity.Common);
|
||||
|
||||
if (!Tracks.Contains(name))
|
||||
Tracks.Add(name);
|
||||
}
|
||||
}
|
||||
|
||||
public DawnsMusicBox(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int LabelNumber => 1075198; // Dawn<77>s Music Box
|
||||
|
||||
public List<MusicName> Tracks{ get; private set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public SecureLevel Level{ get; set; }
|
||||
|
||||
public override void OnAfterDuped(Item newItem)
|
||||
{
|
||||
if (!(newItem is DawnsMusicBox box))
|
||||
return;
|
||||
|
||||
box.Tracks = new List<MusicName>();
|
||||
box.Tracks.AddRange(Tracks);
|
||||
}
|
||||
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
int commonSongs = 0;
|
||||
int uncommonSongs = 0;
|
||||
int rareSongs = 0;
|
||||
|
||||
for (int i = 0; i < Tracks.Count; i++)
|
||||
{
|
||||
DawnsMusicInfo info = GetInfo(Tracks[i]);
|
||||
|
||||
switch (info.Rarity)
|
||||
{
|
||||
case DawnsMusicRarity.Common:
|
||||
commonSongs++;
|
||||
break;
|
||||
case DawnsMusicRarity.Uncommon:
|
||||
uncommonSongs++;
|
||||
break;
|
||||
case DawnsMusicRarity.Rare:
|
||||
rareSongs++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (commonSongs > 0)
|
||||
list.Add(1075234, commonSongs.ToString()); // ~1_NUMBER~ Common Tracks
|
||||
if (uncommonSongs > 0)
|
||||
list.Add(1075235, uncommonSongs.ToString()); // ~1_NUMBER~ Uncommon Tracks
|
||||
if (rareSongs > 0)
|
||||
list.Add(1075236, rareSongs.ToString()); // ~1_NUMBER~ Rare Tracks
|
||||
}
|
||||
|
||||
public override void GetContextMenuEntries(Mobile from, List<ContextMenuEntry> list)
|
||||
{
|
||||
base.GetContextMenuEntries(from, list);
|
||||
|
||||
SetSecureLevelEntry.AddTo(from, this, list); // Set secure level
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (!IsChildOf(from.Backpack) && !IsLockedDown)
|
||||
{
|
||||
from.SendLocalizedMessage(
|
||||
1061856); // You must have the item in your backpack or locked down in order to use it.
|
||||
}
|
||||
else if (IsLockedDown && !HasAccces(from))
|
||||
{
|
||||
from.SendLocalizedMessage(502436); // That is not accessible.
|
||||
}
|
||||
else
|
||||
{
|
||||
from.CloseGump<DawnsMusicBoxGump>();
|
||||
from.SendGump(new DawnsMusicBoxGump(this));
|
||||
}
|
||||
}
|
||||
|
||||
public bool HasAccces(Mobile m)
|
||||
{
|
||||
return m.AccessLevel >= AccessLevel.GameMaster || BaseHouse.FindHouseAt(this)?.HasAccess(m) == true;
|
||||
}
|
||||
|
||||
public void PlayMusic(Mobile m, MusicName music)
|
||||
{
|
||||
if (m_Timer?.Running == true)
|
||||
EndMusic(m);
|
||||
else
|
||||
m_ItemID = ItemID;
|
||||
|
||||
m.Send(new PlayMusic(music));
|
||||
m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(0.5), TimeSpan.FromSeconds(0.5), 4, Animate);
|
||||
}
|
||||
|
||||
public void EndMusic(Mobile m)
|
||||
{
|
||||
if (m_Timer?.Running == true)
|
||||
m_Timer.Stop();
|
||||
|
||||
m.Send(StopMusic.Instance);
|
||||
|
||||
if (m_Count > 0)
|
||||
ItemID = m_ItemID;
|
||||
|
||||
m_Count = 0;
|
||||
}
|
||||
|
||||
private void Animate()
|
||||
{
|
||||
m_Count++;
|
||||
|
||||
if (m_Count >= 4)
|
||||
{
|
||||
m_Count = 0;
|
||||
ItemID = m_ItemID;
|
||||
}
|
||||
else
|
||||
{
|
||||
ItemID++;
|
||||
}
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.WriteEncodedInt(0); // version
|
||||
|
||||
writer.Write(Tracks.Count);
|
||||
|
||||
for (int i = 0; i < Tracks.Count; i++)
|
||||
writer.Write((int)Tracks[i]);
|
||||
|
||||
writer.Write((int)Level);
|
||||
writer.Write(m_ItemID);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
|
||||
int count = reader.ReadInt();
|
||||
Tracks = new List<MusicName>();
|
||||
|
||||
for (int i = 0; i < count; i++)
|
||||
Tracks.Add((MusicName)reader.ReadInt());
|
||||
|
||||
Level = (SecureLevel)reader.ReadInt();
|
||||
m_ItemID = reader.ReadInt();
|
||||
}
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
m_Info = new Dictionary<MusicName, DawnsMusicInfo>
|
||||
{
|
||||
{ MusicName.Samlethe, new DawnsMusicInfo(1075152, DawnsMusicRarity.Common) },
|
||||
{ MusicName.Sailing, new DawnsMusicInfo(1075163, DawnsMusicRarity.Common) },
|
||||
{ MusicName.Britain2, new DawnsMusicInfo(1075145, DawnsMusicRarity.Common) },
|
||||
{ MusicName.Britain1, new DawnsMusicInfo(1075144, DawnsMusicRarity.Common) },
|
||||
{ MusicName.Bucsden, new DawnsMusicInfo(1075146, DawnsMusicRarity.Common) },
|
||||
{ MusicName.Forest_a, new DawnsMusicInfo(1075161, DawnsMusicRarity.Common) },
|
||||
{ MusicName.Cove, new DawnsMusicInfo(1075176, DawnsMusicRarity.Common) },
|
||||
{ MusicName.Death, new DawnsMusicInfo(1075171, DawnsMusicRarity.Common) },
|
||||
{ MusicName.Dungeon9, new DawnsMusicInfo(1075160, DawnsMusicRarity.Common) },
|
||||
{ MusicName.Dungeon2, new DawnsMusicInfo(1075175, DawnsMusicRarity.Common) },
|
||||
{ MusicName.Cave01, new DawnsMusicInfo(1075159, DawnsMusicRarity.Common) },
|
||||
{ MusicName.Combat3, new DawnsMusicInfo(1075170, DawnsMusicRarity.Common) },
|
||||
{ MusicName.Combat1, new DawnsMusicInfo(1075168, DawnsMusicRarity.Common) },
|
||||
{ MusicName.Combat2, new DawnsMusicInfo(1075169, DawnsMusicRarity.Common) },
|
||||
{ MusicName.Jhelom, new DawnsMusicInfo(1075147, DawnsMusicRarity.Common) },
|
||||
{ MusicName.Linelle, new DawnsMusicInfo(1075185, DawnsMusicRarity.Common) },
|
||||
{ MusicName.LBCastle, new DawnsMusicInfo(1075148, DawnsMusicRarity.Common) },
|
||||
{ MusicName.Minoc, new DawnsMusicInfo(1075150, DawnsMusicRarity.Common) },
|
||||
{ MusicName.Moonglow, new DawnsMusicInfo(1075177, DawnsMusicRarity.Common) },
|
||||
{ MusicName.Magincia, new DawnsMusicInfo(1075149, DawnsMusicRarity.Common) },
|
||||
{ MusicName.Nujelm, new DawnsMusicInfo(1075174, DawnsMusicRarity.Common) },
|
||||
{ MusicName.BTCastle, new DawnsMusicInfo(1075173, DawnsMusicRarity.Common) },
|
||||
{ MusicName.Tavern04, new DawnsMusicInfo(1075167, DawnsMusicRarity.Common) },
|
||||
{ MusicName.Skarabra, new DawnsMusicInfo(1075154, DawnsMusicRarity.Common) },
|
||||
{ MusicName.Stones2, new DawnsMusicInfo(1075143, DawnsMusicRarity.Common) },
|
||||
{ MusicName.Serpents, new DawnsMusicInfo(1075153, DawnsMusicRarity.Common) },
|
||||
{ MusicName.Taiko, new DawnsMusicInfo(1075180, DawnsMusicRarity.Common) },
|
||||
{ MusicName.Tavern01, new DawnsMusicInfo(1075164, DawnsMusicRarity.Common) },
|
||||
{ MusicName.Tavern02, new DawnsMusicInfo(1075165, DawnsMusicRarity.Common) },
|
||||
{ MusicName.Tavern03, new DawnsMusicInfo(1075166, DawnsMusicRarity.Common) },
|
||||
{ MusicName.TokunoDungeon, new DawnsMusicInfo(1075179, DawnsMusicRarity.Common) },
|
||||
{ MusicName.Trinsic, new DawnsMusicInfo(1075155, DawnsMusicRarity.Common) },
|
||||
{ MusicName.OldUlt01, new DawnsMusicInfo(1075142, DawnsMusicRarity.Common) },
|
||||
{ MusicName.Ocllo, new DawnsMusicInfo(1075151, DawnsMusicRarity.Common) },
|
||||
{ MusicName.Vesper, new DawnsMusicInfo(1075156, DawnsMusicRarity.Common) },
|
||||
{ MusicName.Victory, new DawnsMusicInfo(1075172, DawnsMusicRarity.Common) },
|
||||
{ MusicName.Mountn_a, new DawnsMusicInfo(1075162, DawnsMusicRarity.Common) },
|
||||
{ MusicName.Wind, new DawnsMusicInfo(1075157, DawnsMusicRarity.Common) },
|
||||
{ MusicName.Yew, new DawnsMusicInfo(1075158, DawnsMusicRarity.Common) },
|
||||
{ MusicName.Zento, new DawnsMusicInfo(1075178, DawnsMusicRarity.Common) },
|
||||
{ MusicName.GwennoConversation, new DawnsMusicInfo(1075131, DawnsMusicRarity.Uncommon) },
|
||||
{ MusicName.DreadHornArea, new DawnsMusicInfo(1075181, DawnsMusicRarity.Uncommon) },
|
||||
{ MusicName.ElfCity, new DawnsMusicInfo(1075182, DawnsMusicRarity.Uncommon) },
|
||||
{ MusicName.GoodEndGame, new DawnsMusicInfo(1075132, DawnsMusicRarity.Uncommon) },
|
||||
{ MusicName.GoodVsEvil, new DawnsMusicInfo(1075133, DawnsMusicRarity.Uncommon) },
|
||||
{ MusicName.GreatEarthSerpents, new DawnsMusicInfo(1075134, DawnsMusicRarity.Uncommon) },
|
||||
{ MusicName.GrizzleDungeon, new DawnsMusicInfo(1075186, DawnsMusicRarity.Uncommon) },
|
||||
{ MusicName.Humanoids_U9, new DawnsMusicInfo(1075135, DawnsMusicRarity.Uncommon) },
|
||||
{ MusicName.MelisandesLair, new DawnsMusicInfo(1075183, DawnsMusicRarity.Uncommon) },
|
||||
{ MusicName.MinocNegative, new DawnsMusicInfo(1075136, DawnsMusicRarity.Uncommon) },
|
||||
{ MusicName.ParoxysmusLair, new DawnsMusicInfo(1075184, DawnsMusicRarity.Uncommon) },
|
||||
{ MusicName.Paws, new DawnsMusicInfo(1075137, DawnsMusicRarity.Uncommon) },
|
||||
{ MusicName.SelimsBar, new DawnsMusicInfo(1075138, DawnsMusicRarity.Rare) },
|
||||
{ MusicName.SerpentIsleCombat_U7, new DawnsMusicInfo(1075139, DawnsMusicRarity.Rare) },
|
||||
{ MusicName.ValoriaShips, new DawnsMusicInfo(1075140, DawnsMusicRarity.Rare) }
|
||||
};
|
||||
}
|
||||
|
||||
public static DawnsMusicInfo GetInfo(MusicName name)
|
||||
{
|
||||
if (m_Info == null) // sanity
|
||||
return null;
|
||||
|
||||
m_Info.TryGetValue(name, out DawnsMusicInfo info);
|
||||
return info;
|
||||
}
|
||||
|
||||
public static MusicName RandomTrack(DawnsMusicRarity rarity)
|
||||
{
|
||||
MusicName[] list;
|
||||
|
||||
switch (rarity)
|
||||
{
|
||||
default:
|
||||
case DawnsMusicRarity.Common:
|
||||
list = m_CommonTracks;
|
||||
break;
|
||||
case DawnsMusicRarity.Uncommon:
|
||||
list = m_UncommonTracks;
|
||||
break;
|
||||
case DawnsMusicRarity.Rare:
|
||||
list = m_RareTracks;
|
||||
break;
|
||||
}
|
||||
|
||||
return list[Utility.Random(list.Length)];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,138 @@
|
|||
using Server.Targeting;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
[Flippable(0x1053, 0x1054)]
|
||||
public class DawnsMusicGear : Item
|
||||
{
|
||||
[Constructible]
|
||||
public DawnsMusicGear() : this(DawnsMusicBox.RandomTrack(DawnsMusicRarity.Common))
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public DawnsMusicGear(MusicName music) : base(0x1053)
|
||||
{
|
||||
Music = music;
|
||||
|
||||
Weight = 1.0;
|
||||
}
|
||||
|
||||
public DawnsMusicGear(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public static DawnsMusicGear RandomCommon => new DawnsMusicGear(DawnsMusicBox.RandomTrack(DawnsMusicRarity.Common));
|
||||
|
||||
public static DawnsMusicGear RandomUncommon =>
|
||||
new DawnsMusicGear(DawnsMusicBox.RandomTrack(DawnsMusicRarity.Uncommon));
|
||||
|
||||
public static DawnsMusicGear RandomRare => new DawnsMusicGear(DawnsMusicBox.RandomTrack(DawnsMusicRarity.Rare));
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public MusicName Music{ get; set; }
|
||||
|
||||
public override void AddNameProperty(ObjectPropertyList list)
|
||||
{
|
||||
DawnsMusicInfo info = DawnsMusicBox.GetInfo(Music);
|
||||
|
||||
if (info != null)
|
||||
{
|
||||
if (info.Rarity == DawnsMusicRarity.Common)
|
||||
list.Add(1075204); // Gear for Dawn's Music Box (Common)
|
||||
else if (info.Rarity == DawnsMusicRarity.Uncommon)
|
||||
list.Add(1075205); // Gear for Dawn's Music Box (Uncommon)
|
||||
else if (info.Rarity == DawnsMusicRarity.Rare)
|
||||
list.Add(1075206); // Gear for Dawn's Music Box (Rare)
|
||||
|
||||
list.Add(info.Name);
|
||||
}
|
||||
else
|
||||
{
|
||||
base.AddNameProperty(list);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
from.Target = new InternalTarget(this);
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.WriteEncodedInt(1); // version
|
||||
|
||||
writer.Write((int)Music);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
|
||||
switch (version)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
Music = (MusicName)reader.ReadInt();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (version == 0) // Music wasn't serialized in version 0, pick a new track of random rarity
|
||||
{
|
||||
DawnsMusicRarity rarity;
|
||||
double rand = Utility.RandomDouble();
|
||||
|
||||
if (rand < 0.025)
|
||||
rarity = DawnsMusicRarity.Rare;
|
||||
else if (rand < 0.225)
|
||||
rarity = DawnsMusicRarity.Uncommon;
|
||||
else
|
||||
rarity = DawnsMusicRarity.Common;
|
||||
|
||||
Music = DawnsMusicBox.RandomTrack(rarity);
|
||||
}
|
||||
}
|
||||
|
||||
public class InternalTarget : Target
|
||||
{
|
||||
private DawnsMusicGear m_Gear;
|
||||
|
||||
public InternalTarget(DawnsMusicGear gear) : base(2, false, TargetFlags.None)
|
||||
{
|
||||
m_Gear = gear;
|
||||
}
|
||||
|
||||
protected override void OnTarget(Mobile from, object targeted)
|
||||
{
|
||||
if (m_Gear?.Deleted != false)
|
||||
return;
|
||||
|
||||
if (targeted is DawnsMusicBox box)
|
||||
{
|
||||
if (!box.Tracks.Contains(m_Gear.Music))
|
||||
{
|
||||
box.Tracks.Add(m_Gear.Music);
|
||||
box.InvalidateProperties();
|
||||
|
||||
m_Gear.Delete();
|
||||
|
||||
from.SendLocalizedMessage(1071961); // This song has been added to the musicbox.
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(1071962); // This song track is already in the musicbox.
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(1071964); // Gears can only be put into a musicbox.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
namespace Server.Items
|
||||
{
|
||||
public enum DawnsMusicRarity
|
||||
{
|
||||
Common,
|
||||
Uncommon,
|
||||
Rare
|
||||
}
|
||||
|
||||
public class DawnsMusicInfo
|
||||
{
|
||||
public DawnsMusicInfo(int name, DawnsMusicRarity rarity)
|
||||
{
|
||||
Name = name;
|
||||
Rarity = rarity;
|
||||
}
|
||||
|
||||
public int Name{ get; }
|
||||
|
||||
public DawnsMusicRarity Rarity{ get; }
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
namespace Server.Items
|
||||
{
|
||||
public class DupresShield : BaseShield, ITokunoDyable
|
||||
{
|
||||
[Constructible]
|
||||
public DupresShield() : base(0x2B01)
|
||||
{
|
||||
LootType = LootType.Blessed;
|
||||
Weight = 6.0;
|
||||
|
||||
Attributes.BonusHits = 5;
|
||||
Attributes.RegenHits = 1;
|
||||
|
||||
SkillBonuses.SetValues(0, SkillName.Parry, 5);
|
||||
}
|
||||
|
||||
public DupresShield(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int LabelNumber => 1075196; // Dupre<72>s Shield
|
||||
|
||||
public override int BasePhysicalResistance => 1;
|
||||
public override int BaseFireResistance => 0;
|
||||
public override int BaseColdResistance => 0;
|
||||
public override int BasePoisonResistance => 0;
|
||||
public override int BaseEnergyResistance => 1;
|
||||
|
||||
public override int InitMinHits => 255;
|
||||
public override int InitMaxHits => 255;
|
||||
|
||||
public override int AosStrReq => 50;
|
||||
|
||||
public override int ArmorBase => 15;
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,256 @@
|
|||
using System;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class EnhancedBandage : Bandage
|
||||
{
|
||||
[Constructible]
|
||||
public EnhancedBandage(int amount = 1)
|
||||
: base(amount)
|
||||
{
|
||||
Hue = 0x8A5;
|
||||
}
|
||||
|
||||
public EnhancedBandage(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public static int HealingBonus => 10;
|
||||
|
||||
public override int LabelNumber => 1152441; // enhanced bandage
|
||||
|
||||
public override bool Dye(Mobile from, DyeTub sender)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void AddNameProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.AddNameProperties(list);
|
||||
|
||||
list.Add(1075216); // these bandages have been enhanced
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
[Flippable(0x2AC0, 0x2AC3)]
|
||||
public class FountainOfLife : BaseAddonContainer
|
||||
{
|
||||
private int m_Charges;
|
||||
|
||||
private Timer m_Timer;
|
||||
|
||||
[Constructible]
|
||||
public FountainOfLife(int charges = 10)
|
||||
: base(0x2AC0)
|
||||
{
|
||||
m_Charges = charges;
|
||||
|
||||
m_Timer = Timer.DelayCall(RechargeTime, RechargeTime, Recharge);
|
||||
}
|
||||
|
||||
public FountainOfLife(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override BaseAddonContainerDeed Deed => new FountainOfLifeDeed(m_Charges);
|
||||
|
||||
public virtual TimeSpan RechargeTime => TimeSpan.FromDays(1);
|
||||
|
||||
public override int LabelNumber => 1075197; // Fountain of Life
|
||||
public override int DefaultGumpID => 0x484;
|
||||
public override int DefaultDropSound => 66;
|
||||
public override int DefaultMaxItems => 125;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int Charges
|
||||
{
|
||||
get => m_Charges;
|
||||
set
|
||||
{
|
||||
m_Charges = Math.Min(value, 10);
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
public override bool OnDragLift(Mobile from)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool OnDragDrop(Mobile from, Item dropped)
|
||||
{
|
||||
if (dropped is Bandage)
|
||||
{
|
||||
bool allow = base.OnDragDrop(from, dropped);
|
||||
|
||||
if (allow)
|
||||
Enhance(from);
|
||||
|
||||
return allow;
|
||||
}
|
||||
|
||||
from.SendLocalizedMessage(1075209); // Only bandages may be dropped into the fountain.
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool OnDragDropInto(Mobile from, Item item, Point3D p)
|
||||
{
|
||||
if (item is Bandage)
|
||||
{
|
||||
bool allow = base.OnDragDropInto(from, item, p);
|
||||
|
||||
if (allow)
|
||||
Enhance(from);
|
||||
|
||||
return allow;
|
||||
}
|
||||
|
||||
from.SendLocalizedMessage(1075209); // Only bandages may be dropped into the fountain.
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void AddNameProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.AddNameProperties(list);
|
||||
|
||||
list.Add(1075217, m_Charges.ToString()); // ~1_val~ charges remaining
|
||||
}
|
||||
|
||||
public override void OnDelete()
|
||||
{
|
||||
m_Timer?.Stop();
|
||||
|
||||
base.OnDelete();
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.WriteEncodedInt(0); //version
|
||||
|
||||
writer.Write(m_Charges);
|
||||
writer.Write(m_Timer.Next);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
|
||||
m_Charges = reader.ReadInt();
|
||||
|
||||
DateTime next = reader.ReadDateTime();
|
||||
|
||||
if (next < DateTime.UtcNow)
|
||||
m_Timer = Timer.DelayCall(TimeSpan.Zero, RechargeTime, Recharge);
|
||||
else
|
||||
m_Timer = Timer.DelayCall(next - DateTime.UtcNow, RechargeTime, Recharge);
|
||||
}
|
||||
|
||||
public void Recharge()
|
||||
{
|
||||
m_Charges = 10;
|
||||
|
||||
Enhance(null);
|
||||
}
|
||||
|
||||
public void Enhance(Mobile from)
|
||||
{
|
||||
for (int i = Items.Count - 1; i >= 0 && m_Charges > 0; --i)
|
||||
{
|
||||
if (Items[i] is EnhancedBandage)
|
||||
continue;
|
||||
|
||||
if (Items[i] is Bandage bandage)
|
||||
{
|
||||
Item enhanced;
|
||||
|
||||
if (bandage.Amount > m_Charges)
|
||||
{
|
||||
bandage.Amount -= m_Charges;
|
||||
enhanced = new EnhancedBandage(m_Charges);
|
||||
m_Charges = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
enhanced = new EnhancedBandage(bandage.Amount);
|
||||
m_Charges -= bandage.Amount;
|
||||
bandage.Delete();
|
||||
}
|
||||
|
||||
if (from == null || !TryDropItem(from, enhanced, false)) // try stacking first
|
||||
DropItem(enhanced);
|
||||
}
|
||||
}
|
||||
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
public class FountainOfLifeDeed : BaseAddonContainerDeed
|
||||
{
|
||||
private int m_Charges;
|
||||
|
||||
[Constructible]
|
||||
public FountainOfLifeDeed(int charges = 10)
|
||||
{
|
||||
LootType = LootType.Blessed;
|
||||
m_Charges = charges;
|
||||
}
|
||||
|
||||
public FountainOfLifeDeed(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int LabelNumber => 1075197; // Fountain of Life
|
||||
public override BaseAddonContainer Addon => new FountainOfLife(m_Charges);
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int Charges
|
||||
{
|
||||
get => m_Charges;
|
||||
set
|
||||
{
|
||||
m_Charges = Math.Min(value, 10);
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.WriteEncodedInt(0); //version
|
||||
|
||||
writer.Write(m_Charges);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
|
||||
m_Charges = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
namespace Server.Items
|
||||
{
|
||||
public class OssianGrimoire : NecromancerSpellbook, ITokunoDyable
|
||||
{
|
||||
[Constructible]
|
||||
public OssianGrimoire()
|
||||
{
|
||||
LootType = LootType.Blessed;
|
||||
|
||||
SkillBonuses.SetValues(0, SkillName.Necromancy, 10.0);
|
||||
Attributes.RegenMana = 1;
|
||||
Attributes.CastSpeed = 1;
|
||||
Attributes.IncreasedKarmaLoss = 5;
|
||||
}
|
||||
|
||||
public OssianGrimoire(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int LabelNumber => 1078148; // Ossian Grimoire
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.WriteEncodedInt(1); //version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
|
||||
if (version == 0)
|
||||
Attributes.IncreasedKarmaLoss = 5;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
namespace Server.Items
|
||||
{
|
||||
public class QuiverOfInfinity : BaseQuiver, ITokunoDyable
|
||||
{
|
||||
[Constructible]
|
||||
public QuiverOfInfinity() : base(0x2B02)
|
||||
{
|
||||
LootType = LootType.Blessed;
|
||||
Weight = 8.0;
|
||||
|
||||
WeightReduction = 30;
|
||||
LowerAmmoCost = 20;
|
||||
|
||||
Attributes.DefendChance = 5;
|
||||
}
|
||||
|
||||
public QuiverOfInfinity(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int LabelNumber => 1075201; // Quiver of Infinity
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.WriteEncodedInt(2); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
|
||||
if (version < 1 && DamageIncrease == 0)
|
||||
DamageIncrease = 10;
|
||||
|
||||
if (version < 2 && Attributes.WeaponDamage == 10)
|
||||
Attributes.WeaponDamage = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,182 @@
|
|||
using System;
|
||||
using Server.Mobiles;
|
||||
using Server.Spells.Ninjitsu;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public enum TalismanForm
|
||||
{
|
||||
Ferret = 1031672,
|
||||
Squirrel = 1031671,
|
||||
CuSidhe = 1031670,
|
||||
Reptalon = 1075202
|
||||
}
|
||||
|
||||
public class BaseFormTalisman : Item, ITokunoDyable
|
||||
{
|
||||
public BaseFormTalisman() : base(0x2F59)
|
||||
{
|
||||
LootType = LootType.Blessed;
|
||||
Layer = Layer.Talisman;
|
||||
Weight = 1.0;
|
||||
}
|
||||
|
||||
public BaseFormTalisman(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public virtual TalismanForm Form => TalismanForm.Squirrel;
|
||||
|
||||
public override void AddNameProperty(ObjectPropertyList list)
|
||||
{
|
||||
list.Add(1075200, $"#{(int)Form}");
|
||||
}
|
||||
|
||||
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 override void OnRemoved(IEntity parent)
|
||||
{
|
||||
base.OnRemoved(parent);
|
||||
|
||||
if (parent is Mobile m) AnimalForm.RemoveContext(m, true);
|
||||
}
|
||||
|
||||
public static bool EntryEnabled(Mobile m, Type type)
|
||||
{
|
||||
if (type == typeof(Squirrel))
|
||||
return m.Talisman is SquirrelFormTalisman;
|
||||
if (type == typeof(Ferret))
|
||||
return m.Talisman is FerretFormTalisman;
|
||||
if (type == typeof(CuSidhe))
|
||||
return m.Talisman is CuSidheFormTalisman;
|
||||
if (type == typeof(Reptalon))
|
||||
return m.Talisman is ReptalonFormTalisman;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public class FerretFormTalisman : BaseFormTalisman
|
||||
{
|
||||
[Constructible]
|
||||
public FerretFormTalisman()
|
||||
{
|
||||
}
|
||||
|
||||
public FerretFormTalisman(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override TalismanForm Form => TalismanForm.Ferret;
|
||||
|
||||
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 SquirrelFormTalisman : BaseFormTalisman
|
||||
{
|
||||
[Constructible]
|
||||
public SquirrelFormTalisman()
|
||||
{
|
||||
}
|
||||
|
||||
public SquirrelFormTalisman(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override TalismanForm Form => TalismanForm.Squirrel;
|
||||
|
||||
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 CuSidheFormTalisman : BaseFormTalisman
|
||||
{
|
||||
[Constructible]
|
||||
public CuSidheFormTalisman()
|
||||
{
|
||||
}
|
||||
|
||||
public CuSidheFormTalisman(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override TalismanForm Form => TalismanForm.CuSidhe;
|
||||
|
||||
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 ReptalonFormTalisman : BaseFormTalisman
|
||||
{
|
||||
[Constructible]
|
||||
public ReptalonFormTalisman()
|
||||
{
|
||||
}
|
||||
|
||||
public ReptalonFormTalisman(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override TalismanForm Form => TalismanForm.Reptalon;
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue