Overwrite
Complete Overwrite of the Folder with the free shard. ServUO 57.3 has been added.
This commit is contained in:
336
Scripts/Items/Addons/DawnsMusicBox/DawnsMusicBox.cs
Normal file
336
Scripts/Items/Addons/DawnsMusicBox/DawnsMusicBox.cs
Normal file
@@ -0,0 +1,336 @@
|
||||
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 = Packet.SetStatic(new StopMusic());
|
||||
public StopMusic()
|
||||
: base(0x6D, 3)
|
||||
{
|
||||
this.m_Stream.Write((short)0x1FFF);
|
||||
}
|
||||
}
|
||||
|
||||
[Flipable(0x2AF9, 0x2AFD)]
|
||||
public class DawnsMusicBox : Item, ISecurable
|
||||
{
|
||||
public static MusicName[] m_CommonTracks = new MusicName[]
|
||||
{
|
||||
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 = new MusicName[]
|
||||
{
|
||||
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 = new MusicName[]
|
||||
{
|
||||
MusicName.SelimsBar, MusicName.SerpentIsleCombat_U7, MusicName.ValoriaShips
|
||||
};
|
||||
private static readonly Dictionary<MusicName, DawnsMusicInfo> m_Info = new Dictionary<MusicName, DawnsMusicInfo>();
|
||||
private List<MusicName> m_Tracks;
|
||||
private SecureLevel m_Level;
|
||||
private Timer m_Timer;
|
||||
private int m_ItemID = 0;
|
||||
private int m_Count = 0;
|
||||
[Constructable]
|
||||
public DawnsMusicBox()
|
||||
: base(0x2AF9)
|
||||
{
|
||||
this.Weight = 1.0;
|
||||
|
||||
this.m_Tracks = new List<MusicName>();
|
||||
|
||||
while (this.m_Tracks.Count < 4)
|
||||
{
|
||||
MusicName name = RandomTrack(DawnsMusicRarity.Common);
|
||||
|
||||
if (!this.m_Tracks.Contains(name))
|
||||
this.m_Tracks.Add(name);
|
||||
}
|
||||
}
|
||||
|
||||
public DawnsMusicBox(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int LabelNumber
|
||||
{
|
||||
get
|
||||
{
|
||||
return 1075198;
|
||||
}
|
||||
}// Dawn<77>s Music Box
|
||||
public List<MusicName> Tracks
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_Tracks;
|
||||
}
|
||||
}
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public SecureLevel Level
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_Level;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.m_Level = value;
|
||||
}
|
||||
}
|
||||
public static void Initialize()
|
||||
{
|
||||
m_Info.Add(MusicName.Samlethe, new DawnsMusicInfo(1075152, DawnsMusicRarity.Common));
|
||||
m_Info.Add(MusicName.Sailing, new DawnsMusicInfo(1075163, DawnsMusicRarity.Common));
|
||||
m_Info.Add(MusicName.Britain2, new DawnsMusicInfo(1075145, DawnsMusicRarity.Common));
|
||||
m_Info.Add(MusicName.Britain1, new DawnsMusicInfo(1075144, DawnsMusicRarity.Common));
|
||||
m_Info.Add(MusicName.Bucsden, new DawnsMusicInfo(1075146, DawnsMusicRarity.Common));
|
||||
m_Info.Add(MusicName.Forest_a, new DawnsMusicInfo(1075161, DawnsMusicRarity.Common));
|
||||
m_Info.Add(MusicName.Cove, new DawnsMusicInfo(1075176, DawnsMusicRarity.Common));
|
||||
m_Info.Add(MusicName.Death, new DawnsMusicInfo(1075171, DawnsMusicRarity.Common));
|
||||
m_Info.Add(MusicName.Dungeon9, new DawnsMusicInfo(1075160, DawnsMusicRarity.Common));
|
||||
m_Info.Add(MusicName.Dungeon2, new DawnsMusicInfo(1075175, DawnsMusicRarity.Common));
|
||||
m_Info.Add(MusicName.Cave01, new DawnsMusicInfo(1075159, DawnsMusicRarity.Common));
|
||||
m_Info.Add(MusicName.Combat3, new DawnsMusicInfo(1075170, DawnsMusicRarity.Common));
|
||||
m_Info.Add(MusicName.Combat1, new DawnsMusicInfo(1075168, DawnsMusicRarity.Common));
|
||||
m_Info.Add(MusicName.Combat2, new DawnsMusicInfo(1075169, DawnsMusicRarity.Common));
|
||||
m_Info.Add(MusicName.Jhelom, new DawnsMusicInfo(1075147, DawnsMusicRarity.Common));
|
||||
m_Info.Add(MusicName.Linelle, new DawnsMusicInfo(1075185, DawnsMusicRarity.Common));
|
||||
m_Info.Add(MusicName.LBCastle, new DawnsMusicInfo(1075148, DawnsMusicRarity.Common));
|
||||
m_Info.Add(MusicName.Minoc, new DawnsMusicInfo(1075150, DawnsMusicRarity.Common));
|
||||
m_Info.Add(MusicName.Moonglow, new DawnsMusicInfo(1075177, DawnsMusicRarity.Common));
|
||||
m_Info.Add(MusicName.Magincia, new DawnsMusicInfo(1075149, DawnsMusicRarity.Common));
|
||||
m_Info.Add(MusicName.Nujelm, new DawnsMusicInfo(1075174, DawnsMusicRarity.Common));
|
||||
m_Info.Add(MusicName.BTCastle, new DawnsMusicInfo(1075173, DawnsMusicRarity.Common));
|
||||
m_Info.Add(MusicName.Tavern04, new DawnsMusicInfo(1075167, DawnsMusicRarity.Common));
|
||||
m_Info.Add(MusicName.Skarabra, new DawnsMusicInfo(1075154, DawnsMusicRarity.Common));
|
||||
m_Info.Add(MusicName.Stones2, new DawnsMusicInfo(1075143, DawnsMusicRarity.Common));
|
||||
m_Info.Add(MusicName.Serpents, new DawnsMusicInfo(1075153, DawnsMusicRarity.Common));
|
||||
m_Info.Add(MusicName.Taiko, new DawnsMusicInfo(1075180, DawnsMusicRarity.Common));
|
||||
m_Info.Add(MusicName.Tavern01, new DawnsMusicInfo(1075164, DawnsMusicRarity.Common));
|
||||
m_Info.Add(MusicName.Tavern02, new DawnsMusicInfo(1075165, DawnsMusicRarity.Common));
|
||||
m_Info.Add(MusicName.Tavern03, new DawnsMusicInfo(1075166, DawnsMusicRarity.Common));
|
||||
m_Info.Add(MusicName.TokunoDungeon, new DawnsMusicInfo(1075179, DawnsMusicRarity.Common));
|
||||
m_Info.Add(MusicName.Trinsic, new DawnsMusicInfo(1075155, DawnsMusicRarity.Common));
|
||||
m_Info.Add(MusicName.OldUlt01, new DawnsMusicInfo(1075142, DawnsMusicRarity.Common));
|
||||
m_Info.Add(MusicName.Ocllo, new DawnsMusicInfo(1075151, DawnsMusicRarity.Common));
|
||||
m_Info.Add(MusicName.Vesper, new DawnsMusicInfo(1075156, DawnsMusicRarity.Common));
|
||||
m_Info.Add(MusicName.Victory, new DawnsMusicInfo(1075172, DawnsMusicRarity.Common));
|
||||
m_Info.Add(MusicName.Mountn_a, new DawnsMusicInfo(1075162, DawnsMusicRarity.Common));
|
||||
m_Info.Add(MusicName.Wind, new DawnsMusicInfo(1075157, DawnsMusicRarity.Common));
|
||||
m_Info.Add(MusicName.Yew, new DawnsMusicInfo(1075158, DawnsMusicRarity.Common));
|
||||
m_Info.Add(MusicName.Zento, new DawnsMusicInfo(1075178, DawnsMusicRarity.Common));
|
||||
|
||||
m_Info.Add(MusicName.GwennoConversation, new DawnsMusicInfo(1075131, DawnsMusicRarity.Uncommon));
|
||||
m_Info.Add(MusicName.DreadHornArea, new DawnsMusicInfo(1075181, DawnsMusicRarity.Uncommon));
|
||||
m_Info.Add(MusicName.ElfCity, new DawnsMusicInfo(1075182, DawnsMusicRarity.Uncommon));
|
||||
m_Info.Add(MusicName.GoodEndGame, new DawnsMusicInfo(1075132, DawnsMusicRarity.Uncommon));
|
||||
m_Info.Add(MusicName.GoodVsEvil, new DawnsMusicInfo(1075133, DawnsMusicRarity.Uncommon));
|
||||
m_Info.Add(MusicName.GreatEarthSerpents, new DawnsMusicInfo(1075134, DawnsMusicRarity.Uncommon));
|
||||
m_Info.Add(MusicName.GrizzleDungeon, new DawnsMusicInfo(1075186, DawnsMusicRarity.Uncommon));
|
||||
m_Info.Add(MusicName.Humanoids_U9, new DawnsMusicInfo(1075135, DawnsMusicRarity.Uncommon));
|
||||
m_Info.Add(MusicName.MelisandesLair, new DawnsMusicInfo(1075183, DawnsMusicRarity.Uncommon));
|
||||
m_Info.Add(MusicName.MinocNegative, new DawnsMusicInfo(1075136, DawnsMusicRarity.Uncommon));
|
||||
m_Info.Add(MusicName.ParoxysmusLair, new DawnsMusicInfo(1075184, DawnsMusicRarity.Uncommon));
|
||||
m_Info.Add(MusicName.Paws, new DawnsMusicInfo(1075137, DawnsMusicRarity.Uncommon));
|
||||
|
||||
m_Info.Add(MusicName.SelimsBar, new DawnsMusicInfo(1075138, DawnsMusicRarity.Rare));
|
||||
m_Info.Add(MusicName.SerpentIsleCombat_U7, new DawnsMusicInfo(1075139, DawnsMusicRarity.Rare));
|
||||
m_Info.Add(MusicName.ValoriaShips, new DawnsMusicInfo(1075140, DawnsMusicRarity.Rare));
|
||||
}
|
||||
|
||||
public static DawnsMusicInfo GetInfo(MusicName name)
|
||||
{
|
||||
if (m_Info.ContainsKey(name))
|
||||
return m_Info[name];
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static MusicName RandomTrack(DawnsMusicRarity rarity)
|
||||
{
|
||||
MusicName[] list = null;
|
||||
|
||||
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)];
|
||||
}
|
||||
|
||||
public override void OnAfterDuped(Item newItem)
|
||||
{
|
||||
DawnsMusicBox box = newItem as DawnsMusicBox;
|
||||
|
||||
if (box == null)
|
||||
return;
|
||||
|
||||
box.m_Tracks = new List<MusicName>();
|
||||
box.m_Tracks.AddRange(this.m_Tracks);
|
||||
|
||||
base.OnAfterDuped(newItem);
|
||||
}
|
||||
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
int commonSongs = 0;
|
||||
int uncommonSongs = 0;
|
||||
int rareSongs = 0;
|
||||
|
||||
for (int i = 0; i < this.m_Tracks.Count; i++)
|
||||
{
|
||||
DawnsMusicInfo info = GetInfo(this.m_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 (!this.IsChildOf(from.Backpack) && !this.IsLockedDown)
|
||||
from.SendLocalizedMessage(1061856); // You must have the item in your backpack or locked down in order to use it.
|
||||
else if (this.IsLockedDown && !this.HasAccces(from))
|
||||
from.SendLocalizedMessage(502436); // That is not accessible.
|
||||
else
|
||||
{
|
||||
from.CloseGump(typeof(DawnsMusicBoxGump));
|
||||
from.SendGump(new DawnsMusicBoxGump(this));
|
||||
}
|
||||
}
|
||||
|
||||
public bool HasAccces(Mobile m)
|
||||
{
|
||||
if (m.AccessLevel >= AccessLevel.GameMaster)
|
||||
return true;
|
||||
|
||||
BaseHouse house = BaseHouse.FindHouseAt(this);
|
||||
|
||||
return (house != null && house.HasAccess(m));
|
||||
}
|
||||
|
||||
public void PlayMusic(Mobile m, MusicName music)
|
||||
{
|
||||
if (this.m_Timer != null && this.m_Timer.Running)
|
||||
this.EndMusic(m);
|
||||
else
|
||||
this.m_ItemID = this.ItemID;
|
||||
|
||||
m.Send(new PlayMusic(music));
|
||||
this.m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(0.5), TimeSpan.FromSeconds(0.5), 4, new TimerCallback(Animate));
|
||||
}
|
||||
|
||||
public void EndMusic(Mobile m)
|
||||
{
|
||||
if (this.m_Timer != null && this.m_Timer.Running)
|
||||
this.m_Timer.Stop();
|
||||
|
||||
m.Send(StopMusic.Instance);
|
||||
|
||||
if (this.m_Count > 0)
|
||||
this.ItemID = this.m_ItemID;
|
||||
|
||||
this.m_Count = 0;
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.WriteEncodedInt(0); // version
|
||||
|
||||
writer.Write((int)this.m_Tracks.Count);
|
||||
|
||||
for (int i = 0; i < this.m_Tracks.Count; i++)
|
||||
writer.Write((int)this.m_Tracks[i]);
|
||||
|
||||
writer.Write((int)this.m_Level);
|
||||
writer.Write((int)this.m_ItemID);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
|
||||
int count = reader.ReadInt();
|
||||
this.m_Tracks = new List<MusicName>();
|
||||
|
||||
for (int i = 0; i < count; i++)
|
||||
this.m_Tracks.Add((MusicName)reader.ReadInt());
|
||||
|
||||
this.m_Level = (SecureLevel)reader.ReadInt();
|
||||
this.m_ItemID = reader.ReadInt();
|
||||
}
|
||||
|
||||
private void Animate()
|
||||
{
|
||||
this.m_Count++;
|
||||
|
||||
if (this.m_Count >= 4)
|
||||
{
|
||||
this.m_Count = 0;
|
||||
this.ItemID = this.m_ItemID;
|
||||
}
|
||||
else
|
||||
this.ItemID++;
|
||||
}
|
||||
}
|
||||
}
|
||||
162
Scripts/Items/Addons/DawnsMusicBox/DawnsMusicGear.cs
Normal file
162
Scripts/Items/Addons/DawnsMusicBox/DawnsMusicGear.cs
Normal file
@@ -0,0 +1,162 @@
|
||||
using System;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
[Flipable(0x1053, 0x1054)]
|
||||
public class DawnsMusicGear : Item
|
||||
{
|
||||
private MusicName m_Music;
|
||||
[Constructable]
|
||||
public DawnsMusicGear()
|
||||
: this(DawnsMusicBox.RandomTrack(DawnsMusicRarity.Common))
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public DawnsMusicGear(MusicName music)
|
||||
: base(0x1053)
|
||||
{
|
||||
this.m_Music = music;
|
||||
|
||||
this.Weight = 1.0;
|
||||
}
|
||||
|
||||
public DawnsMusicGear(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public static DawnsMusicGear RandomCommon
|
||||
{
|
||||
get
|
||||
{
|
||||
return new DawnsMusicGear(DawnsMusicBox.RandomTrack(DawnsMusicRarity.Common));
|
||||
}
|
||||
}
|
||||
public static DawnsMusicGear RandomUncommon
|
||||
{
|
||||
get
|
||||
{
|
||||
return new DawnsMusicGear(DawnsMusicBox.RandomTrack(DawnsMusicRarity.Uncommon));
|
||||
}
|
||||
}
|
||||
public static DawnsMusicGear RandomRare
|
||||
{
|
||||
get
|
||||
{
|
||||
return new DawnsMusicGear(DawnsMusicBox.RandomTrack(DawnsMusicRarity.Rare));
|
||||
}
|
||||
}
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public MusicName Music
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_Music;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.m_Music = value;
|
||||
}
|
||||
}
|
||||
public override void AddNameProperty(ObjectPropertyList list)
|
||||
{
|
||||
DawnsMusicInfo info = DawnsMusicBox.GetInfo(this.m_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((int)1); // version
|
||||
|
||||
writer.Write((int)this.m_Music);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
this.m_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;
|
||||
|
||||
this.m_Music = DawnsMusicBox.RandomTrack(rarity);
|
||||
}
|
||||
}
|
||||
|
||||
public class InternalTarget : Target
|
||||
{
|
||||
private readonly DawnsMusicGear m_Gear;
|
||||
public InternalTarget(DawnsMusicGear gear)
|
||||
: base(2, false, TargetFlags.None)
|
||||
{
|
||||
this.m_Gear = gear;
|
||||
}
|
||||
|
||||
protected override void OnTarget(Mobile from, object targeted)
|
||||
{
|
||||
if (this.m_Gear == null || this.m_Gear.Deleted)
|
||||
return;
|
||||
|
||||
DawnsMusicBox box = targeted as DawnsMusicBox;
|
||||
|
||||
if (box != null)
|
||||
{
|
||||
if (!box.Tracks.Contains(this.m_Gear.Music))
|
||||
{
|
||||
box.Tracks.Add(this.m_Gear.Music);
|
||||
box.InvalidateProperties();
|
||||
|
||||
this.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.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
37
Scripts/Items/Addons/DawnsMusicBox/DawnsMusicInfo.cs
Normal file
37
Scripts/Items/Addons/DawnsMusicBox/DawnsMusicInfo.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public enum DawnsMusicRarity
|
||||
{
|
||||
Common,
|
||||
Uncommon,
|
||||
Rare,
|
||||
}
|
||||
|
||||
public class DawnsMusicInfo
|
||||
{
|
||||
private readonly int m_Name;
|
||||
private readonly DawnsMusicRarity m_Rarity;
|
||||
public DawnsMusicInfo(int name, DawnsMusicRarity rarity)
|
||||
{
|
||||
this.m_Name = name;
|
||||
this.m_Rarity = rarity;
|
||||
}
|
||||
|
||||
public int Name
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_Name;
|
||||
}
|
||||
}
|
||||
public DawnsMusicRarity Rarity
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_Rarity;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,479 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.ContextMenus;
|
||||
using Server.Engines.VeteranRewards;
|
||||
using Server.Gumps;
|
||||
using Server.Multis;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items.MusicBox
|
||||
{
|
||||
[Flipable(0x2AF9, 0x2AFD)]
|
||||
public class DawnsMusicBox : Item, ISecurable, IRewardItem
|
||||
{
|
||||
public static readonly int MusicRange = 10;
|
||||
private List<MusicName> m_Tracks;
|
||||
private Timer m_PlayingTimer;
|
||||
private MusicName m_ActualSong;
|
||||
private SecureLevel m_Level;
|
||||
private bool m_IsRewardItem;
|
||||
[Constructable]
|
||||
public DawnsMusicBox()
|
||||
: base(0x2AF9)
|
||||
{
|
||||
this.Weight = 1.0;
|
||||
|
||||
this.m_Tracks = new List<MusicName>();
|
||||
this.m_ActualSong = MusicName.Invalid;
|
||||
|
||||
while (this.Tracks.Count < 4)
|
||||
this.AddSong(TrackInfo.RandomSong(TrackRarity.Common));
|
||||
}
|
||||
|
||||
public DawnsMusicBox(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int LabelNumber
|
||||
{
|
||||
get
|
||||
{
|
||||
return 1075198;
|
||||
}
|
||||
}// Dawn<77>s Music Box
|
||||
[CommandProperty(AccessLevel.GameMaster, AccessLevel.Developer)]
|
||||
public bool IsPlaying
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_PlayingTimer != null;
|
||||
}
|
||||
}
|
||||
public List<MusicName> Tracks
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_Tracks;
|
||||
}
|
||||
}
|
||||
[CommandProperty(AccessLevel.GameMaster, AccessLevel.Developer)]
|
||||
public MusicName ActualSong
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_ActualSong;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.m_ActualSong = value;
|
||||
this.InvalidateProperties();
|
||||
}
|
||||
}
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public SecureLevel Level
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_Level;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.m_Level = value;
|
||||
}
|
||||
}
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public bool IsRewardItem
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_IsRewardItem;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.m_IsRewardItem = value;
|
||||
}
|
||||
}
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
int commonSongs = 0;
|
||||
int unCommonSongs = 0;
|
||||
int rareSongs = 0;
|
||||
|
||||
for (int i = 0; i < this.m_Tracks.Count; i++)
|
||||
{
|
||||
TrackInfo ti = TrackInfo.GetInfo(this.m_Tracks[i]);
|
||||
switch( ti.Rarity )
|
||||
{
|
||||
case TrackRarity.Common:
|
||||
commonSongs++;
|
||||
break;
|
||||
case TrackRarity.UnCommon:
|
||||
unCommonSongs++;
|
||||
break;
|
||||
case TrackRarity.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 (this.m_Tracks.Count < 1)
|
||||
{
|
||||
from.SendMessage("This music box is empty.");
|
||||
}
|
||||
else if (this.IsOwner(from))
|
||||
{
|
||||
if (!this.IsLockedDown)
|
||||
from.SendLocalizedMessage(502692); // This must be in a house and be locked down to work.
|
||||
else
|
||||
{
|
||||
if (from.HasGump(typeof(MusicGump)))
|
||||
from.CloseGump(typeof(MusicGump));
|
||||
|
||||
from.SendGump(new MusicGump(this));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(502691); // You must be the owner to use this.
|
||||
}
|
||||
}
|
||||
|
||||
public bool AddSong(MusicName song)
|
||||
{
|
||||
if (this.m_Tracks.Contains(song))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.m_Tracks.Add(song);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public void Animate()
|
||||
{
|
||||
switch( this.ItemID )
|
||||
{
|
||||
case 0x2AF9:
|
||||
this.ItemID = 0x2AFB;
|
||||
break;
|
||||
// case 0x2AFA: ItemID = 0x2AFB; break;
|
||||
case 0x2AFB:
|
||||
this.ItemID = 0x2AFC;
|
||||
break;
|
||||
case 0x2AFC:
|
||||
this.ItemID = 0x2AF9;
|
||||
break;
|
||||
case 0x2AFD:
|
||||
this.ItemID = 0x2AFF;
|
||||
break;
|
||||
// case 0x2AFE: ItemID = 0x2AFF; break;
|
||||
case 0x2AFF:
|
||||
this.ItemID = 0x2B00;
|
||||
break;
|
||||
case 0x2B00:
|
||||
this.ItemID = 0x2AFD;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsOwner(Mobile mob)
|
||||
{
|
||||
if (mob.AccessLevel >= AccessLevel.GameMaster)
|
||||
return true;
|
||||
|
||||
BaseHouse house = BaseHouse.FindHouseAt(this);
|
||||
|
||||
return (house != null && house.IsOwner(mob));
|
||||
}
|
||||
|
||||
public void ToggleMusic(Mobile m, bool play)
|
||||
{
|
||||
if (this.m_ActualSong != MusicName.Invalid && m.NetState != null)
|
||||
{
|
||||
m.Send(PlayMusic.InvalidInstance); // Stop actual music
|
||||
|
||||
if (play)
|
||||
m.Send(PlayMusic.GetInstance(this.m_ActualSong));
|
||||
}
|
||||
}
|
||||
|
||||
public void TogglePlaying(bool hasToStart)
|
||||
{
|
||||
this.ToggleTimer(hasToStart);
|
||||
|
||||
string message = hasToStart ? "* The musix box starts playing a song *" : "* The musix box stops *";
|
||||
|
||||
this.PublicOverheadMessage(MessageType.Regular, 0x5D, true, message);
|
||||
this.StopBoxesInRange();
|
||||
Map boxMap = this.Map;
|
||||
|
||||
if (boxMap != Map.Internal)
|
||||
{
|
||||
Point3D boxLoc = this.Location;
|
||||
IPooledEnumerable mobsEable = boxMap.GetMobilesInRange(boxLoc, MusicRange);
|
||||
|
||||
foreach (Mobile m in mobsEable)
|
||||
{
|
||||
if (m is Mobiles.PlayerMobile)
|
||||
this.ToggleMusic(m, hasToStart);
|
||||
}
|
||||
|
||||
mobsEable.Free();
|
||||
}
|
||||
}
|
||||
|
||||
public void ToggleTimer(bool hasToStart)
|
||||
{
|
||||
if (this.IsPlaying && !hasToStart)
|
||||
{
|
||||
if (this.m_PlayingTimer != null && this.m_PlayingTimer.Running) // remove correctly the timer...
|
||||
this.m_PlayingTimer.Stop();
|
||||
this.m_PlayingTimer = null;
|
||||
}
|
||||
else if (!this.IsPlaying && hasToStart)
|
||||
{
|
||||
TrackInfo ti = TrackInfo.GetInfo(this.m_ActualSong);
|
||||
|
||||
this.m_PlayingTimer = new PlayingTimer((double)ti.Duration, this); // add a new timer
|
||||
this.m_PlayingTimer.Start();
|
||||
}
|
||||
}
|
||||
|
||||
public void StopBoxesInRange()
|
||||
{
|
||||
Map boxMap = this.Map;
|
||||
|
||||
if (boxMap != Map.Internal)
|
||||
{
|
||||
Point3D boxLoc = this.Location;
|
||||
IPooledEnumerable itemsEable = boxMap.GetItemsInRange(boxLoc, MusicRange);
|
||||
|
||||
foreach (Item i in itemsEable)
|
||||
{
|
||||
if (i is DawnsMusicBox && i != this)
|
||||
{
|
||||
DawnsMusicBox mb = (DawnsMusicBox)i;
|
||||
if (mb.IsPlaying)
|
||||
{
|
||||
mb.ToggleTimer(false);
|
||||
mb.PublicOverheadMessage(MessageType.Regular, 0x5D, true, "* The musix box stops *");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
itemsEable.Free();
|
||||
}
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
|
||||
writer.Write(this.m_Tracks.Count);
|
||||
|
||||
for (int i = 0; i < this.m_Tracks.Count; i++)
|
||||
writer.Write((int)this.m_Tracks[i]);
|
||||
|
||||
writer.Write((int)this.m_Level);
|
||||
writer.Write(this.m_IsRewardItem);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch( version )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
if (this.m_Tracks == null)
|
||||
this.m_Tracks = new List<MusicName>();
|
||||
|
||||
int numSongs = reader.ReadInt();
|
||||
for (int i = 0; i < numSongs; i++)
|
||||
this.m_Tracks.Add((MusicName)reader.ReadInt());
|
||||
|
||||
this.m_Level = (SecureLevel)reader.ReadInt();
|
||||
this.m_IsRewardItem = reader.ReadBool();
|
||||
|
||||
this.ToggleTimer(false);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal class PlayingTimer : Timer
|
||||
{
|
||||
private readonly DawnsMusicBox m_Box;
|
||||
private readonly DateTime m_Until;
|
||||
public PlayingTimer(double duration, DawnsMusicBox box)
|
||||
: base(TimeSpan.FromSeconds(1.0), TimeSpan.FromSeconds(1.0))
|
||||
{
|
||||
this.m_Box = box;
|
||||
this.m_Until = DateTime.UtcNow + TimeSpan.FromSeconds(duration);
|
||||
|
||||
this.Priority = TimerPriority.TwoFiftyMS;
|
||||
}
|
||||
|
||||
protected override void OnTick()
|
||||
{
|
||||
if (DateTime.UtcNow > this.m_Until)
|
||||
{
|
||||
if (this.m_Box != null && !this.m_Box.Deleted)
|
||||
this.m_Box.TogglePlaying(false);
|
||||
else
|
||||
this.Stop();
|
||||
}
|
||||
else if (this.m_Box != null && !this.m_Box.Deleted)
|
||||
this.m_Box.Animate();
|
||||
}
|
||||
}
|
||||
|
||||
private class MusicGump : Gump
|
||||
{
|
||||
private static readonly int m_Fields = 9;
|
||||
private static readonly int m_HueTit = 32767;
|
||||
private static readonly int m_HueEnt = 32767;
|
||||
private static readonly int m_DeltaBut = 2;
|
||||
private static readonly int m_FieldsDist = 25;
|
||||
private readonly DawnsMusicBox m_Box;
|
||||
private readonly List<int> m_Songs;
|
||||
private readonly bool m_HasStopSongEntry;
|
||||
private int m_Page;
|
||||
public MusicGump(DawnsMusicBox box)
|
||||
: this(box, null, 1)
|
||||
{
|
||||
}
|
||||
|
||||
public MusicGump(DawnsMusicBox box, List<int> songs, int page)
|
||||
: base(50, 50)
|
||||
{
|
||||
this.Closable = false;
|
||||
this.Disposable = true;
|
||||
this.Dragable = true;
|
||||
this.Resizable = false;
|
||||
|
||||
this.m_Box = box;
|
||||
this.m_Songs = songs;
|
||||
this.m_Page = page;
|
||||
|
||||
this.m_HasStopSongEntry = this.m_Box.IsPlaying;
|
||||
|
||||
if (this.m_Songs == null)
|
||||
this.m_Songs = BuildList(box, this.m_HasStopSongEntry);
|
||||
|
||||
this.Initialize();
|
||||
}
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
this.AddPage(0);
|
||||
|
||||
this.AddBackground(0, 0, 275, 325, 9200);
|
||||
|
||||
this.AddImageTiled(10, 10, 255, 25, 2624);
|
||||
this.AddImageTiled(10, 45, 255, 240, 2624);
|
||||
this.AddImageTiled(40, 295, 225, 20, 2624);
|
||||
|
||||
this.AddButton(10, 295, 4017, 4018, 0, GumpButtonType.Reply, 0);
|
||||
this.AddHtmlLocalized(45, 295, 75, 20, 1011012, m_HueTit, false, false); // CANCEL
|
||||
|
||||
this.AddAlphaRegion(10, 10, 255, 285);
|
||||
this.AddAlphaRegion(40, 295, 225, 20);
|
||||
|
||||
this.AddHtmlLocalized(14, 12, 255, 25, 1075130, m_HueTit, false, false); // Choose a track to play
|
||||
|
||||
if (this.m_Page > 1)
|
||||
this.AddButton(225, 297, 5603, 5607, 200, GumpButtonType.Reply, 0); // Previous page
|
||||
|
||||
if (this.m_Page < Math.Ceiling(this.m_Songs.Count / (double)m_Fields))
|
||||
this.AddButton(245, 297, 5601, 5605, 300, GumpButtonType.Reply, 0); // Next Page
|
||||
|
||||
int IndMax = (this.m_Page * m_Fields) - 1;
|
||||
int IndMin = (this.m_Page * m_Fields) - m_Fields;
|
||||
int IndTemp = 0;
|
||||
|
||||
for (int i = 0; i < this.m_Songs.Count; i++)
|
||||
{
|
||||
if (i >= IndMin && i <= IndMax)
|
||||
{
|
||||
this.AddHtmlLocalized(35, 52 + (IndTemp * m_FieldsDist), 225, 20, this.m_Songs[i], m_HueEnt, false, false);
|
||||
this.AddButton(15, 52 + m_DeltaBut + (IndTemp * m_FieldsDist), 1209, 1210, i + 1, GumpButtonType.Reply, 0);
|
||||
IndTemp++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
Mobile from = sender.Mobile;
|
||||
|
||||
if (info.ButtonID == 0)
|
||||
return;
|
||||
else if (info.ButtonID == 200) // Previous page
|
||||
{
|
||||
this.m_Page--;
|
||||
from.SendGump(new MusicGump(this.m_Box, this.m_Songs, this.m_Page));
|
||||
}
|
||||
else if (info.ButtonID == 300) // Next Page
|
||||
{
|
||||
this.m_Page++;
|
||||
from.SendGump(new MusicGump(this.m_Box, this.m_Songs, this.m_Page));
|
||||
}
|
||||
else if (this.m_HasStopSongEntry && info.ButtonID == this.m_Songs.Count)
|
||||
{
|
||||
this.m_Box.TogglePlaying(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
TrackInfo ti = TrackInfo.GetInfo(this.m_Songs[info.ButtonID - 1]);
|
||||
this.m_Box.ActualSong = ti.Name;
|
||||
this.m_Box.TogglePlaying(true);
|
||||
}
|
||||
}
|
||||
|
||||
private static List<int> BuildList(DawnsMusicBox box, bool hasStopSongEntry)
|
||||
{
|
||||
List<int> list = new List<int>();
|
||||
|
||||
for (int i = 0; i < box.Tracks.Count; i++)
|
||||
{
|
||||
TrackInfo ti = TrackInfo.GetInfo(box.Tracks[i]);
|
||||
list.Add(ti.Label);
|
||||
}
|
||||
|
||||
if (hasStopSongEntry)
|
||||
list.Add(1075207); // Stop Song
|
||||
|
||||
return list;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
using System;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Items.MusicBox
|
||||
{
|
||||
[Flipable(0x1053, 0x1054)]
|
||||
public class MusicBoxGears : Item
|
||||
{
|
||||
private readonly MusicName m_Music;
|
||||
[Constructable]
|
||||
public MusicBoxGears()
|
||||
: this(TrackInfo.RandomSong())
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public MusicBoxGears(MusicName music)
|
||||
: base(0x1053)
|
||||
{
|
||||
this.m_Music = music;
|
||||
this.Weight = 1.0;
|
||||
}
|
||||
|
||||
public MusicBoxGears(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public MusicName Music
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_Music;
|
||||
}
|
||||
}
|
||||
public static MusicBoxGears RandomMusixBoxGears(TrackRarity rarity)
|
||||
{
|
||||
return new MusicBoxGears(TrackInfo.RandomSong(rarity));
|
||||
}
|
||||
|
||||
public static MusicBoxGears RandomMusixBoxGears()
|
||||
{
|
||||
return new MusicBoxGears(TrackInfo.RandomSong());
|
||||
}
|
||||
|
||||
public override void AddNameProperty(ObjectPropertyList list)
|
||||
{
|
||||
TrackInfo ti = TrackInfo.GetInfo(this.m_Music);
|
||||
switch( ti.Rarity )
|
||||
{
|
||||
case TrackRarity.Common:
|
||||
list.Add(1075204);
|
||||
break; // Gear for Dawn's Music Box (Common)
|
||||
case TrackRarity.UnCommon:
|
||||
list.Add(1075205);
|
||||
break; // Gear for Dawn's Music Box (Uncommon)
|
||||
case TrackRarity.Rare:
|
||||
list.Add(1075206);
|
||||
break; // Gear for Dawn's Music Box (Rare)
|
||||
}
|
||||
}
|
||||
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
TrackInfo ti = TrackInfo.GetInfo(this.m_Music);
|
||||
list.Add(ti.Label);
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (this.IsChildOf(from.Backpack))
|
||||
{
|
||||
from.BeginTarget(3, false, TargetFlags.None, new TargetCallback(OnTarget));
|
||||
from.SendMessage("Select a Dawn's music box to add this gears to.");
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void OnTarget(Mobile from, object obj)
|
||||
{
|
||||
if (this.Deleted)
|
||||
return;
|
||||
|
||||
DawnsMusicBox mb = obj as DawnsMusicBox;
|
||||
|
||||
if (mb == null)
|
||||
{
|
||||
from.SendMessage("That is not a Dawn's music box.");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mb.AddSong(this.m_Music))
|
||||
{
|
||||
from.SendMessage("You have added this gear to the music box.");
|
||||
this.Delete();
|
||||
}
|
||||
else
|
||||
from.SendMessage("This gear is already present in this box.");
|
||||
}
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
|
||||
writer.Write((int)this.m_Music);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
MusicName m_Music = (MusicName)reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
199
Scripts/Items/Addons/DawnsMusicBox/RewardVersion/TrackInfo.cs
Normal file
199
Scripts/Items/Addons/DawnsMusicBox/RewardVersion/TrackInfo.cs
Normal file
@@ -0,0 +1,199 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Server.Items.MusicBox
|
||||
{
|
||||
public enum TrackRarity
|
||||
{
|
||||
Common,
|
||||
UnCommon,
|
||||
Rare
|
||||
}
|
||||
|
||||
public class TrackInfo
|
||||
{
|
||||
private static readonly TrackInfo[] m_Table = new TrackInfo[]
|
||||
{
|
||||
// There are currently 40 Common Music Box Gears
|
||||
new TrackInfo(56, 1075152, MusicName.Samlethe, TrackRarity.Common),
|
||||
new TrackInfo(18, 1075163, MusicName.Sailing, TrackRarity.Common),
|
||||
new TrackInfo(39, 1075145, MusicName.Britain2, TrackRarity.Common),
|
||||
new TrackInfo(53, 1075144, MusicName.Britain1, TrackRarity.Common),
|
||||
new TrackInfo(59, 1075146, MusicName.Bucsden, TrackRarity.Common),
|
||||
new TrackInfo(240, 1075161, MusicName.Forest_a, TrackRarity.Common),
|
||||
new TrackInfo(58, 1075176, MusicName.Cove, TrackRarity.Common),
|
||||
new TrackInfo(20, 1075171, MusicName.Death, TrackRarity.Common),
|
||||
new TrackInfo(50, 1075160, MusicName.Dungeon9, TrackRarity.Common),
|
||||
new TrackInfo(58, 1075175, MusicName.Dungeon2, TrackRarity.Common),
|
||||
new TrackInfo(58, 1075159, MusicName.Cave01, TrackRarity.Common),
|
||||
new TrackInfo(52, 1075170, MusicName.Combat3, TrackRarity.Common),
|
||||
new TrackInfo(50, 1075168, MusicName.Combat1, TrackRarity.Common),
|
||||
new TrackInfo(63, 1075169, MusicName.Combat2, TrackRarity.Common),
|
||||
new TrackInfo(36, 1075147, MusicName.Jhelom, TrackRarity.Common),
|
||||
new TrackInfo(36, 1075185, MusicName.Linelle, TrackRarity.Common),
|
||||
new TrackInfo(17, 1075148, MusicName.LBCastle, TrackRarity.Common),
|
||||
new TrackInfo(66, 1075150, MusicName.Minoc, TrackRarity.Common),
|
||||
new TrackInfo(60, 1075177, MusicName.Moonglow, TrackRarity.Common),
|
||||
new TrackInfo(62, 1075149, MusicName.Magincia, TrackRarity.Common),
|
||||
new TrackInfo(54, 1075174, MusicName.Nujelm, TrackRarity.Common),
|
||||
new TrackInfo(98, 1075173, MusicName.BTCastle, TrackRarity.Common),
|
||||
new TrackInfo(48, 1075167, MusicName.Tavern04, TrackRarity.Common),
|
||||
new TrackInfo(48, 1075154, MusicName.Skarabra, TrackRarity.Common),
|
||||
new TrackInfo(76, 1075143, MusicName.Stones2, TrackRarity.Common),
|
||||
new TrackInfo(135, 1075153, MusicName.Serpents, TrackRarity.Common),
|
||||
new TrackInfo(227, 1075180, MusicName.Taiko, TrackRarity.Common),
|
||||
new TrackInfo(22, 1075164, MusicName.Tavern01, TrackRarity.Common),
|
||||
new TrackInfo(18, 1075165, MusicName.Tavern02, TrackRarity.Common),
|
||||
new TrackInfo(18, 1075166, MusicName.Tavern03, TrackRarity.Common),
|
||||
new TrackInfo(88, 1075179, MusicName.TokunoDungeon, TrackRarity.Common),
|
||||
new TrackInfo(61, 1075155, MusicName.Trinsic, TrackRarity.Common),
|
||||
new TrackInfo(48, 1075142, MusicName.OldUlt01, TrackRarity.Common),
|
||||
new TrackInfo(56, 1075151, MusicName.Ocllo, TrackRarity.Common),
|
||||
new TrackInfo(36, 1075156, MusicName.Vesper, TrackRarity.Common),
|
||||
new TrackInfo(17, 1075172, MusicName.Victory, TrackRarity.Common),
|
||||
new TrackInfo(343, 1075162, MusicName.Mountn_a, TrackRarity.Common),
|
||||
new TrackInfo(35, 1075157, MusicName.Wind, TrackRarity.Common),
|
||||
new TrackInfo(60, 1075158, MusicName.Yew, TrackRarity.Common),
|
||||
new TrackInfo(148, 1075178, MusicName.Zento, TrackRarity.Common),
|
||||
|
||||
// There are currently 12 Uncommon Music Box Gears
|
||||
new TrackInfo(106, 1075131, MusicName.GwennoConversation, TrackRarity.UnCommon),
|
||||
new TrackInfo(120, 1075181, MusicName.DreadHornArea, TrackRarity.UnCommon),
|
||||
new TrackInfo(321, 1075182, MusicName.ElfCity, TrackRarity.UnCommon),
|
||||
new TrackInfo(128, 1075132, MusicName.GoodEndGame, TrackRarity.UnCommon),
|
||||
new TrackInfo(114, 1075133, MusicName.GoodVsEvil, TrackRarity.UnCommon),
|
||||
new TrackInfo(126, 1075134, MusicName.GreatEarthSerpents, TrackRarity.UnCommon),
|
||||
new TrackInfo(120, 1075186, MusicName.GrizzleDungeon, TrackRarity.UnCommon),
|
||||
new TrackInfo(74, 1075135, MusicName.Humanoids_U9, TrackRarity.UnCommon),
|
||||
new TrackInfo(120, 1075183, MusicName.MelisandesLair, TrackRarity.UnCommon),
|
||||
new TrackInfo(68, 1075136, MusicName.MinocNegative, TrackRarity.UnCommon),
|
||||
new TrackInfo(120, 1075184, MusicName.ParoxysmusLair, TrackRarity.UnCommon),
|
||||
new TrackInfo(114, 1075137, MusicName.Paws, TrackRarity.UnCommon),
|
||||
|
||||
// There are currently 4 Rare Music Box Gears.
|
||||
// "The Wanderer" was only available during the "Book of Truth" quest in early spring 2007.
|
||||
// So there are only 3 TrackInfo
|
||||
new TrackInfo(219, 1075138, MusicName.SelimsBar, TrackRarity.Rare),
|
||||
new TrackInfo(285, 1075139, MusicName.SerpentIsleCombat_U7, TrackRarity.Rare),
|
||||
new TrackInfo(118, 1075140, MusicName.ValoriaShips, TrackRarity.Rare)
|
||||
};
|
||||
private int m_Duration;
|
||||
private int m_Label;
|
||||
private MusicName m_Name;
|
||||
private TrackRarity m_Rarity;
|
||||
public TrackInfo(int duration, int label, MusicName name, TrackRarity rarity)
|
||||
{
|
||||
this.m_Duration = duration;
|
||||
this.m_Label = label;
|
||||
this.m_Name = name;
|
||||
this.m_Rarity = rarity;
|
||||
}
|
||||
|
||||
public int Duration
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_Duration;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.m_Duration = value;
|
||||
}
|
||||
}
|
||||
public int Label
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_Label;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.m_Label = value;
|
||||
}
|
||||
}
|
||||
public MusicName Name
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_Name;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.m_Name = value;
|
||||
}
|
||||
}
|
||||
public TrackRarity Rarity
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_Rarity;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.m_Rarity = value;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Static. Method to obtain a TrackInfo from a MusicName.
|
||||
/// </summary>
|
||||
/// <param name="name"></param> MusicName to retrieve its TrackInfo</param>
|
||||
/// <returns>a TrackInfo if name is valid; first TrackInfo in the list otherwise.</returns>
|
||||
public static TrackInfo GetInfo(MusicName name)
|
||||
{
|
||||
foreach (TrackInfo ti in m_Table)
|
||||
{
|
||||
if (ti.Name == name)
|
||||
return ti;
|
||||
}
|
||||
|
||||
return m_Table[0];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Static. Method to obtain a TrackInfo from a label.
|
||||
/// </summary>
|
||||
/// <param name="name"></param> MusicName to retrieve its TrackInfo</param>
|
||||
/// <returns>a TrackInfo if label is valid; first TrackInfo in the list otherwise.</returns>
|
||||
public static TrackInfo GetInfo(int label)
|
||||
{
|
||||
foreach (TrackInfo ti in m_Table)
|
||||
{
|
||||
if (ti.Label == label)
|
||||
return ti;
|
||||
}
|
||||
|
||||
return m_Table[0];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Static. Method to obtain a MusicName with a choosen TrackRarity.
|
||||
/// </summary>
|
||||
/// <param name="rarity"></param>TrackRarity for the MusicName</param>
|
||||
/// <returns>a random MusicName available in the Dawn's music box with appropriate rarity.</returns>
|
||||
public static MusicName RandomSong(TrackRarity rarity)
|
||||
{
|
||||
List<MusicName> list = new List<MusicName>();
|
||||
|
||||
foreach (TrackInfo ti in m_Table)
|
||||
{
|
||||
if (ti.Rarity == rarity)
|
||||
list.Add(ti.Name);
|
||||
}
|
||||
|
||||
int random = Utility.Random(list.Count);
|
||||
|
||||
return list[random];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Static. Method to obtain a random MusicName.
|
||||
/// </summary>
|
||||
/// <returns>a random MusicName available in the Dawn's music box.</returns>
|
||||
public static MusicName RandomSong()
|
||||
{
|
||||
int random = Utility.Random(m_Table.Length);
|
||||
|
||||
return m_Table[random].Name;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user