Overwrite
Complete Overwrite of the Folder with the free shard. ServUO 57.3 has been added.
This commit is contained in:
@@ -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