Overwrite
Complete Overwrite of the Folder with the free shard. ServUO 57.3 has been added.
This commit is contained in:
43
Scripts/Services/18th Anniversary/18th AnniversaryBag.cs
Normal file
43
Scripts/Services/18th Anniversary/18th AnniversaryBag.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class AnniversaryBag18th : Bag
|
||||
{
|
||||
public override int LabelNumber { get { return 1156141; } } // 18th Anniversary Gift Bag
|
||||
|
||||
[Constructable]
|
||||
public AnniversaryBag18th()
|
||||
: this(null)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public AnniversaryBag18th(Mobile m)
|
||||
{
|
||||
Hue = 1164;
|
||||
DropItem(new RecipeScroll(Utility.RandomBool() ? 701 : 702));
|
||||
DropItem(new AnniversaryPlate(m));
|
||||
DropItem(new EnchantedTimepiece());
|
||||
DropItem(new AnniversaryCard(m));
|
||||
}
|
||||
|
||||
public AnniversaryBag18th(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
56
Scripts/Services/18th Anniversary/AnniversaryCard.cs
Normal file
56
Scripts/Services/18th Anniversary/AnniversaryCard.cs
Normal file
@@ -0,0 +1,56 @@
|
||||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
[Flipable(0x9C14, 0x9C15)]
|
||||
public class AnniversaryCard : Item
|
||||
{
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public string Args { get; set; }
|
||||
|
||||
private string[] _Staff = new string[] { Server.Misc.ServerList.ServerName }; // TODO: Get More
|
||||
|
||||
[Constructable]
|
||||
public AnniversaryCard()
|
||||
: this(null)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public AnniversaryCard(Mobile m) : base(0x9C14)
|
||||
{
|
||||
Hue = 124;
|
||||
|
||||
Args = String.Format("{0}\t{1}", _Staff[Utility.Random(_Staff.Length)], m != null ? m.Name : "you");
|
||||
}
|
||||
|
||||
public override void AddNameProperty(ObjectPropertyList list)
|
||||
{
|
||||
list.Add(1156145, Args); // A Personally Written Anniversary Card from ~1_name~ to ~2_name~
|
||||
|
||||
list.Add(1062613, "#1156146");
|
||||
}
|
||||
|
||||
public AnniversaryCard(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
writer.Write( (int) 0 ); // version
|
||||
|
||||
writer.Write(Args);
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
int version = reader.ReadInt();
|
||||
|
||||
Args = reader.ReadString();
|
||||
}
|
||||
}
|
||||
}
|
||||
68
Scripts/Services/18th Anniversary/AnniversaryPlate.cs
Normal file
68
Scripts/Services/18th Anniversary/AnniversaryPlate.cs
Normal file
@@ -0,0 +1,68 @@
|
||||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class AnniversaryPlate : Item
|
||||
{
|
||||
public override int LabelNumber { get { return 1156149; } } // An Ornately Decorated Commemorative Plate
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public TextDefinition LabelType { get; set; }
|
||||
|
||||
[Constructable]
|
||||
public AnniversaryPlate()
|
||||
: this(null)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public AnniversaryPlate(Mobile m) : base(0x9BC8)
|
||||
{
|
||||
if(m != null && .01 > Utility.RandomDouble())
|
||||
LabelType = String.Format("{0} first adventure in Britannia!", m.Name); // No Cliloc???
|
||||
else
|
||||
LabelType = Utility.RandomMinMax(1156150, 1156157);
|
||||
}
|
||||
|
||||
public override void AddNameProperty(ObjectPropertyList list)
|
||||
{
|
||||
list.Add(1156149); // An Ornately Decorated Commemorative Plate
|
||||
|
||||
if (LabelType.Number > 0)
|
||||
list.Add(1062613, String.Format("#{0}", LabelType.Number.ToString()));
|
||||
else if (LabelType.String != null)
|
||||
list.Add(1062613, LabelType.String);
|
||||
}
|
||||
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
if(LabelType.Number > 0)
|
||||
list.Add(LabelType.Number);
|
||||
else if (LabelType.String != null)
|
||||
list.Add(LabelType.String);
|
||||
}
|
||||
|
||||
public AnniversaryPlate(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
writer.Write( (int) 0 ); // version
|
||||
|
||||
TextDefinition.Serialize(writer, LabelType);
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
int version = reader.ReadInt();
|
||||
|
||||
LabelType = TextDefinition.Deserialize(reader);
|
||||
}
|
||||
}
|
||||
}
|
||||
31
Scripts/Services/18th Anniversary/AnniversaryVaseShort.cs
Normal file
31
Scripts/Services/18th Anniversary/AnniversaryVaseShort.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class AnniversaryVaseShort : Item
|
||||
{
|
||||
public override int LabelNumber { get { return 1156148; } } // Short 18th Anniversary Vase
|
||||
|
||||
[Constructable]
|
||||
public AnniversaryVaseShort() : base(0x9BCA)
|
||||
{
|
||||
}
|
||||
|
||||
public AnniversaryVaseShort(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
31
Scripts/Services/18th Anniversary/AnniversaryVaseTall.cs
Normal file
31
Scripts/Services/18th Anniversary/AnniversaryVaseTall.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class AnniversaryVaseTall : Item
|
||||
{
|
||||
public override int LabelNumber { get { return 1156147; } } // Tall 18th Anniversary Vase
|
||||
|
||||
[Constructable]
|
||||
public AnniversaryVaseTall() : base(0x9BC7)
|
||||
{
|
||||
}
|
||||
|
||||
public AnniversaryVaseTall(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
134
Scripts/Services/18th Anniversary/EnchantedTimepiece.cs
Normal file
134
Scripts/Services/18th Anniversary/EnchantedTimepiece.cs
Normal file
@@ -0,0 +1,134 @@
|
||||
using System;
|
||||
using Server;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class EnchantedTimepiece : Item
|
||||
{
|
||||
public override int LabelNumber
|
||||
{
|
||||
get
|
||||
{
|
||||
int hour, min;
|
||||
|
||||
Clock.GetTime(this.Map, GetWorldLocation().X, GetWorldLocation().Y, out hour, out min);
|
||||
|
||||
if (hour > 20 || hour < 4)
|
||||
return 1156199; // Moon Dial
|
||||
|
||||
return 1123890; // Sun Dial
|
||||
//return 1077186;
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public override int ItemID
|
||||
{
|
||||
get
|
||||
{
|
||||
int id = base.ItemID;
|
||||
|
||||
if (id != GetID())
|
||||
return GetID();
|
||||
|
||||
return id;
|
||||
}
|
||||
set
|
||||
{
|
||||
base.ItemID = value;
|
||||
}
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public EnchantedTimepiece() : base(0x9BC6)
|
||||
{
|
||||
_TimePieces.Add(this);
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
int genericNumber;
|
||||
string exactTime;
|
||||
|
||||
Clock.GetTime(from, out genericNumber, out exactTime);
|
||||
|
||||
SendLocalizedMessageTo(from, genericNumber);
|
||||
SendLocalizedMessageTo(from, 1042958, exactTime); // ~1_TIME~ to be exact
|
||||
}
|
||||
|
||||
public void InvalidateID()
|
||||
{
|
||||
int hour, min;
|
||||
|
||||
Clock.GetTime(this.Map, GetWorldLocation().X, GetWorldLocation().Y, out hour, out min);
|
||||
|
||||
if (hour > 12)
|
||||
hour -= 12;
|
||||
|
||||
int id = 0x9BBA + Math.Max(0, (hour - 1));
|
||||
|
||||
if (id != ItemID)
|
||||
ItemID = id;
|
||||
}
|
||||
|
||||
private int GetID()
|
||||
{
|
||||
int id = 0x9BC6;
|
||||
|
||||
if (!Movable && this.Map != Map.Internal)
|
||||
{
|
||||
int hour, min;
|
||||
|
||||
Clock.GetTime(this.Map, GetWorldLocation().X, GetWorldLocation().Y, out hour, out min);
|
||||
|
||||
if (hour > 12)
|
||||
hour -= 12;
|
||||
|
||||
id = 0x9BBA + Math.Max(0, (hour - 1));
|
||||
}
|
||||
|
||||
return id;
|
||||
}
|
||||
|
||||
public override void Delete()
|
||||
{
|
||||
base.Delete();
|
||||
|
||||
if (_TimePieces.Contains(this))
|
||||
_TimePieces.Remove(this);
|
||||
}
|
||||
|
||||
private static List<EnchantedTimepiece> _TimePieces = new List<EnchantedTimepiece>();
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
Timer.DelayCall(TimeSpan.FromMinutes(1), TimeSpan.FromMinutes(1), () =>
|
||||
{
|
||||
foreach (EnchantedTimepiece tp in _TimePieces.Where(t => t != null && !t.Movable && t.Map != Map.Internal))
|
||||
{
|
||||
tp.InvalidateID();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public EnchantedTimepiece(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
int version = reader.ReadInt();
|
||||
|
||||
_TimePieces.Add(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
33
Scripts/Services/18th Anniversary/Giver.cs
Normal file
33
Scripts/Services/18th Anniversary/Giver.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using Server;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.Misc
|
||||
{
|
||||
public class AnniversaryGiver18th : GiftGiver
|
||||
{
|
||||
public static void Initialize()
|
||||
{
|
||||
GiftGiving.Register(new AnniversaryGiver18th());
|
||||
}
|
||||
|
||||
public override DateTime Start { get { return new DateTime(2016, 4, 08); } }
|
||||
public override DateTime Finish { get { return new DateTime(2016, 12, 31); } }
|
||||
public override TimeSpan MinimumAge { get { return TimeSpan.FromHours(12); } }
|
||||
|
||||
public override void GiveGift(Mobile mob)
|
||||
{
|
||||
Bag bag = new AnniversaryBag18th(mob);
|
||||
|
||||
switch (GiveGift(mob, bag))
|
||||
{
|
||||
case GiftResult.Backpack:
|
||||
mob.SendLocalizedMessage(1156142); // Happy 18th Anniversary! We have placed a gift for you in your backpack.
|
||||
break;
|
||||
case GiftResult.BankBox:
|
||||
mob.SendLocalizedMessage(1156143); // Happy 18th Anniversary! We have placed a gift for you in your bank box.
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
142
Scripts/Services/22nd Anniversary/Anniversary22GiftToken.cs
Normal file
142
Scripts/Services/22nd Anniversary/Anniversary22GiftToken.cs
Normal file
@@ -0,0 +1,142 @@
|
||||
using System;
|
||||
using Server;
|
||||
using Server.Gumps;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class Anniversary22GiftToken : Item, IRewardOption
|
||||
{
|
||||
public override int LabelNumber { get { return 1159145; } } // 22nd Anniversary Gift Token
|
||||
|
||||
[Constructable]
|
||||
public Anniversary22GiftToken()
|
||||
: base(0x4BC6)
|
||||
{
|
||||
Hue = 1286;
|
||||
LootType = LootType.Blessed;
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (IsChildOf(from.Backpack))
|
||||
{
|
||||
from.CloseGump(typeof(RewardOptionGump));
|
||||
from.SendGump(new RewardOptionGump(this, 1156888));
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(1062334); // This item must be in your backpack to be used.
|
||||
}
|
||||
}
|
||||
|
||||
public void GetOptions(RewardOptionList list)
|
||||
{
|
||||
list.Add(1, 1159146); // Copper Wings
|
||||
list.Add(2, 1159147); // Copper Portraits
|
||||
list.Add(3, 1159148); // Copper Ship Relief
|
||||
list.Add(4, 1159149); // Copper Sunflower
|
||||
}
|
||||
|
||||
|
||||
public void OnOptionSelected(Mobile from, int choice)
|
||||
{
|
||||
var bag = new Bag();
|
||||
bag.Hue = 1286;
|
||||
|
||||
bool chance = Utility.RandomDouble() < .1;
|
||||
|
||||
Item item;
|
||||
|
||||
switch (choice)
|
||||
{
|
||||
default:
|
||||
bag.Delete();
|
||||
break;
|
||||
case 1:
|
||||
{
|
||||
item = new CopperWings();
|
||||
|
||||
if (chance)
|
||||
{
|
||||
item.Hue = 2951;
|
||||
}
|
||||
|
||||
bag.DropItem(item);
|
||||
from.AddToBackpack(bag);
|
||||
Delete();
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
item = new CopperPortrait1();
|
||||
|
||||
if (chance)
|
||||
{
|
||||
item.Hue = 2951;
|
||||
}
|
||||
|
||||
bag.DropItem(item);
|
||||
|
||||
item = new CopperPortrait2();
|
||||
|
||||
if (chance)
|
||||
{
|
||||
item.Hue = 2951;
|
||||
}
|
||||
|
||||
bag.DropItem(item);
|
||||
|
||||
from.AddToBackpack(bag);
|
||||
Delete();
|
||||
break;
|
||||
}
|
||||
|
||||
case 3:
|
||||
{
|
||||
item = new CopperShipReliefAddonDeed();
|
||||
|
||||
if (chance)
|
||||
{
|
||||
item.Hue = 2951;
|
||||
}
|
||||
|
||||
bag.DropItem(item);
|
||||
|
||||
from.AddToBackpack(bag);
|
||||
Delete();
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
item = new CopperSunflower();
|
||||
|
||||
if (chance)
|
||||
{
|
||||
item.Hue = 2951;
|
||||
}
|
||||
|
||||
bag.DropItem(item);
|
||||
|
||||
from.AddToBackpack(bag);
|
||||
Delete();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public Anniversary22GiftToken(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
33
Scripts/Services/22nd Anniversary/Giver.cs
Normal file
33
Scripts/Services/22nd Anniversary/Giver.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using Server;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.Misc
|
||||
{
|
||||
public class AnniversaryGiver22nd : GiftGiver
|
||||
{
|
||||
public static void Initialize()
|
||||
{
|
||||
GiftGiving.Register(new AnniversaryGiver22nd());
|
||||
}
|
||||
|
||||
public override DateTime Start { get { return new DateTime(2019, 09, 01); } }
|
||||
public override DateTime Finish { get { return new DateTime(2019, 10, 18); } }
|
||||
public override TimeSpan MinimumAge { get { return TimeSpan.FromDays(30); } }
|
||||
|
||||
public override void GiveGift(Mobile mob)
|
||||
{
|
||||
Item token = new Anniversary22GiftToken();
|
||||
|
||||
switch (GiveGift(mob, token))
|
||||
{
|
||||
case GiftResult.Backpack:
|
||||
mob.SendLocalizedMessage(1159142); // Happy 22nd Anniversary! We have placed a gift for you in your backpack.
|
||||
break;
|
||||
case GiftResult.BankBox:
|
||||
mob.SendLocalizedMessage(1159143); // Happy 22nd Anniversary! We have placed a gift for you in your bank box.
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
115
Scripts/Services/22nd Anniversary/Items/CopperPortraits.cs
Normal file
115
Scripts/Services/22nd Anniversary/Items/CopperPortraits.cs
Normal file
@@ -0,0 +1,115 @@
|
||||
using System;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
[Flipable(0xA3E0, 0xA3E4)]
|
||||
public class CopperPortrait1 : Item
|
||||
{
|
||||
private string _DisplayName;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public string DisplayName { get { return _DisplayName; } set { _DisplayName = value; InvalidateProperties(); } }
|
||||
|
||||
public override int LabelNumber { get { return 1159154; } } // Copper Portrait
|
||||
|
||||
[Constructable]
|
||||
public CopperPortrait1()
|
||||
: base(0xA3E0)
|
||||
{
|
||||
_DisplayName = _Names[Utility.Random(_Names.Length)];
|
||||
}
|
||||
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
if (!string.IsNullOrEmpty(_DisplayName))
|
||||
{
|
||||
list.Add(1159151, _DisplayName); // <BASEFONT COLOR=#FFD24D>Relief of ~1_NAME~<BASEFONT COLOR=#FFFFFF>
|
||||
}
|
||||
|
||||
if (Hue == 2951)
|
||||
list.Add(1076187); // Antique
|
||||
}
|
||||
|
||||
public CopperPortrait1(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write(0);
|
||||
|
||||
writer.Write(_DisplayName);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadInt();
|
||||
|
||||
_DisplayName = reader.ReadString();
|
||||
}
|
||||
|
||||
public static string[] _Names =
|
||||
{
|
||||
"Long Tooth Riccia", "Long Leg Topaz", "Glass Tongue Takako", "Iron Fist Riccia", "Fat Eye Takako", "Bloody Back Greg", "Cursed Powder Mercury", "Lone Tongue Erebus", "Mad Powder Sarah", "Long Beard Jim",
|
||||
"Lazy Eye Thrixx", "Cursed Patch Artemis", "Mad Back Aeon", "Glass Tooth Asiantam", "Iron Mouth Artemis", "Stink Back Elizabella", "Lost Blade Mercury", "Lazy Mouth Malachi", "Glass Back Nekomata",
|
||||
"Tooth Silver Fox"
|
||||
};
|
||||
}
|
||||
|
||||
[Flipable(0xA3E3, 0xA3E7)]
|
||||
public class CopperPortrait2 : Item
|
||||
{
|
||||
private string _DisplayName;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public string DisplayName { get { return _DisplayName; } set { _DisplayName = value; InvalidateProperties(); } }
|
||||
|
||||
public override int LabelNumber { get { return 1159154; } } // Copper Portrait
|
||||
|
||||
[Constructable]
|
||||
public CopperPortrait2()
|
||||
: base(0xA3E3)
|
||||
{
|
||||
_DisplayName = CopperPortrait1._Names[Utility.Random(CopperPortrait1._Names.Length)];
|
||||
}
|
||||
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
if (!string.IsNullOrEmpty(_DisplayName))
|
||||
{
|
||||
list.Add(1159151, _DisplayName); // <BASEFONT COLOR=#FFD24D>Relief of ~1_NAME~<BASEFONT COLOR=#FFFFFF>
|
||||
}
|
||||
|
||||
if (Hue == 2951)
|
||||
list.Add(1076187); // Antique
|
||||
}
|
||||
|
||||
public CopperPortrait2(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write(0);
|
||||
|
||||
writer.Write(_DisplayName);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadInt();
|
||||
|
||||
_DisplayName = reader.ReadString();
|
||||
}
|
||||
}
|
||||
}
|
||||
205
Scripts/Services/22nd Anniversary/Items/CopperShipRelief.cs
Normal file
205
Scripts/Services/22nd Anniversary/Items/CopperShipRelief.cs
Normal file
@@ -0,0 +1,205 @@
|
||||
using System;
|
||||
using Server.Gumps;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class CopperShipReliefAddon : BaseAddon
|
||||
{
|
||||
public override BaseAddonDeed Deed { get { return new CopperShipReliefAddonDeed(DisplayName); } }
|
||||
|
||||
private string _DisplayName;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public string DisplayName { get { return _DisplayName; } set { _DisplayName = value; InvalidateProperties(); } }
|
||||
|
||||
public AddonFacing Facing { get; set; }
|
||||
|
||||
[Constructable]
|
||||
public CopperShipReliefAddon(AddonFacing facing, string name)
|
||||
{
|
||||
DisplayName = name;
|
||||
Facing = facing;
|
||||
|
||||
switch (facing)
|
||||
{
|
||||
case AddonFacing.South:
|
||||
AddComponent(new CopperShipReliefComponent(41954), -1, 0, 0);
|
||||
AddComponent(new CopperShipReliefComponent(41953), 1, 0, 0);
|
||||
break;
|
||||
case AddonFacing.East:
|
||||
AddComponent(new CopperShipReliefComponent(41957), 0, 1, 0);
|
||||
AddComponent(new CopperShipReliefComponent(41958), 0, -1, 0);
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private class CopperShipReliefComponent : LocalizedAddonComponent
|
||||
{
|
||||
public override bool ForceShowProperties { get { return true; } }
|
||||
|
||||
public CopperShipReliefComponent(int id)
|
||||
: base(id, 1159148) // Copper Ship Relief
|
||||
{
|
||||
Weight = 0;
|
||||
}
|
||||
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
string name = ((CopperShipReliefAddon)Addon).DisplayName;
|
||||
|
||||
if (!string.IsNullOrEmpty(name))
|
||||
{
|
||||
list.Add(1159152, name); // <BASEFONT COLOR=#FFD24D>Depicting the Maiden Voyage of ~1_NAME~<BASEFONT COLOR=#FFFFFF>
|
||||
}
|
||||
|
||||
if (Hue == 2951)
|
||||
list.Add(1076187); // Antique
|
||||
}
|
||||
|
||||
public CopperShipReliefComponent(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.WriteEncodedInt(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
}
|
||||
|
||||
public CopperShipReliefAddon(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.WriteEncodedInt(1); // version
|
||||
|
||||
writer.Write(_DisplayName);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadEncodedInt();
|
||||
|
||||
if (version == 0)
|
||||
{
|
||||
_DisplayName = CopperShipReliefAddonDeed._Names[Utility.Random(CopperShipReliefAddonDeed._Names.Length)];
|
||||
}
|
||||
else
|
||||
{
|
||||
_DisplayName = reader.ReadString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class CopperShipReliefAddonDeed : BaseAddonDeed, IRewardOption
|
||||
{
|
||||
public override BaseAddon Addon { get { return new CopperShipReliefAddon(Facing, DisplayName); } }
|
||||
|
||||
private string _DisplayName;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public string DisplayName { get { return _DisplayName; } set { _DisplayName = value; InvalidateProperties(); } }
|
||||
|
||||
private AddonFacing Facing { get; set; }
|
||||
|
||||
public override int LabelNumber { get { return 1159148; } } // Copper Ship Relief
|
||||
|
||||
[Constructable]
|
||||
public CopperShipReliefAddonDeed()
|
||||
: this(null)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public CopperShipReliefAddonDeed(string name)
|
||||
{
|
||||
LootType = LootType.Blessed;
|
||||
|
||||
if (name == null)
|
||||
_DisplayName = _Names[Utility.Random(_Names.Length)];
|
||||
else
|
||||
_DisplayName = name;
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (IsChildOf(from.Backpack))
|
||||
{
|
||||
from.CloseGump(typeof(AddonOptionGump));
|
||||
from.SendGump(new AddonOptionGump(this));
|
||||
}
|
||||
else
|
||||
from.SendLocalizedMessage(1062334); // This item must be in your backpack to be used.
|
||||
}
|
||||
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
if (!string.IsNullOrEmpty(_DisplayName))
|
||||
{
|
||||
list.Add(1159152, _DisplayName); // <BASEFONT COLOR=#FFD24D>Depicting the Maiden Voyage of ~1_NAME~<BASEFONT COLOR=#FFFFFF>
|
||||
}
|
||||
|
||||
if (Hue == 2951)
|
||||
list.Add(1076187); // Antique
|
||||
}
|
||||
|
||||
public CopperShipReliefAddonDeed(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write((int)0); // version
|
||||
|
||||
writer.Write(_DisplayName);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadInt();
|
||||
|
||||
_DisplayName = reader.ReadString();
|
||||
}
|
||||
|
||||
public void GetOptions(RewardOptionList list)
|
||||
{
|
||||
list.Add((int)AddonFacing.South, 1075386);
|
||||
list.Add((int)AddonFacing.East, 1075387);
|
||||
}
|
||||
|
||||
|
||||
public void OnOptionSelected(Mobile from, int choice)
|
||||
{
|
||||
Facing = (AddonFacing)choice;
|
||||
|
||||
if (!Deleted)
|
||||
base.OnDoubleClick(from);
|
||||
}
|
||||
|
||||
public static string[] _Names =
|
||||
{
|
||||
"The HMS Cape", "The Mustang", "The Dragon's Breath", "The Crown Jewel", "The Empire", "The Scaly Eel", "The Spartan", "The Beast", "The Ararat", "The Arabella", "The Lusty Wench", "The Golden Ankh",
|
||||
"The Poseidon's Fury", "The Silver Hart"
|
||||
};
|
||||
}
|
||||
}
|
||||
64
Scripts/Services/22nd Anniversary/Items/CopperSunflower.cs
Normal file
64
Scripts/Services/22nd Anniversary/Items/CopperSunflower.cs
Normal file
@@ -0,0 +1,64 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
[Flipable(0xA35D, 0xA35E)]
|
||||
public class CopperSunflower : Item
|
||||
{
|
||||
private string _DisplayName;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public string DisplayName { get { return _DisplayName; } set { _DisplayName = value; InvalidateProperties(); } }
|
||||
|
||||
public override int LabelNumber { get { return 1159149; } } // Copper Sunflower
|
||||
|
||||
[Constructable]
|
||||
public CopperSunflower()
|
||||
: base(0xA35D)
|
||||
{
|
||||
_DisplayName = _Names[Utility.Random(_Names.Length)];
|
||||
}
|
||||
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
if (!string.IsNullOrEmpty(_DisplayName))
|
||||
{
|
||||
list.Add(1159150, _DisplayName); // <BASEFONT COLOR=#FFD24D>Cast from Flowers Grown in The Warm Sun of ~1_NAME~<BASEFONT COLOR=#FFFFFF>
|
||||
}
|
||||
|
||||
if (Hue == 2951)
|
||||
list.Add(1076187); // Antique
|
||||
}
|
||||
|
||||
public CopperSunflower(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write(0);
|
||||
|
||||
writer.Write(_DisplayName);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadInt();
|
||||
|
||||
_DisplayName = reader.ReadString();
|
||||
}
|
||||
|
||||
private static string[] _Names =
|
||||
{
|
||||
"Trinsic", "Jhelom", "Vesper", "Ocllo", "Yew", "Britain", "Minoc", "Moonglow", "Skara Brae", "Delucia"
|
||||
};
|
||||
}
|
||||
}
|
||||
62
Scripts/Services/22nd Anniversary/Items/CopperWings.cs
Normal file
62
Scripts/Services/22nd Anniversary/Items/CopperWings.cs
Normal file
@@ -0,0 +1,62 @@
|
||||
using System;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
[Flipable(0xA3DE, 0xA3DF)]
|
||||
public class CopperWings : Item
|
||||
{
|
||||
private string _DisplayName;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public string DisplayName { get { return _DisplayName; } set { _DisplayName = value; InvalidateProperties(); } }
|
||||
|
||||
public override int LabelNumber { get { return 1159146; } } // Copper Wings
|
||||
|
||||
[Constructable]
|
||||
public CopperWings()
|
||||
: base(0xA3DE)
|
||||
{
|
||||
_DisplayName = _Names[Utility.Random(_Names.Length)];
|
||||
}
|
||||
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
if (!string.IsNullOrEmpty(_DisplayName))
|
||||
{
|
||||
list.Add(1159153, _DisplayName); // <BASEFONT COLOR=#FFD24D>Symbolizing Glory During the ~1_NAME~<BASEFONT COLOR=#FFFFFF>
|
||||
}
|
||||
|
||||
if (Hue == 2951)
|
||||
list.Add(1076187); // Antique
|
||||
}
|
||||
|
||||
public CopperWings(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write(0);
|
||||
|
||||
writer.Write(_DisplayName);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadInt();
|
||||
|
||||
_DisplayName = reader.ReadString();
|
||||
}
|
||||
|
||||
private static string[] _Names =
|
||||
{
|
||||
"Hook's Pirate War", "Endless Struggle Between Platinum And Crimson", "Ophidian War", "Battle Of The Bloody Plains", "Expedition Against Khal Ankur", "Evacuation Of Haven", "Defeat Of Virtuebane", "Siege Of Ver Lor Reg",
|
||||
"Assault On The Temple Of The Abyss", "Fall Of Trinsic", "Despise Onslaught"
|
||||
};
|
||||
}
|
||||
}
|
||||
70
Scripts/Services/Armor Refinement/ArmorRefiner.cs
Normal file
70
Scripts/Services/Armor Refinement/ArmorRefiner.cs
Normal file
@@ -0,0 +1,70 @@
|
||||
using Server;
|
||||
using System;
|
||||
using Server.Items;
|
||||
using System.Collections.Generic;
|
||||
using Server.Gumps;
|
||||
|
||||
namespace Server.Mobiles
|
||||
{
|
||||
public class ArmorRefiner : BaseVendor
|
||||
{
|
||||
private RefinementCraftType m_RefineType;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public RefinementCraftType RefineType { get { return m_RefineType; } set { m_RefineType = value; } }
|
||||
|
||||
private List<SBInfo> m_SBInfos = new List<SBInfo>();
|
||||
protected override List<SBInfo> SBInfos { get { return m_SBInfos; } }
|
||||
|
||||
public override void InitSBInfo()
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public ArmorRefiner(RefinementCraftType type) : base("the armor refiner")
|
||||
{
|
||||
m_RefineType = type;
|
||||
|
||||
SetSkill(SkillName.ArmsLore, 36.0, 68.0);
|
||||
AddItem(new HalfApron());
|
||||
|
||||
switch (m_RefineType)
|
||||
{
|
||||
case RefinementCraftType.Blacksmith:
|
||||
AddItem(new SmithHammer());
|
||||
SetSkill(SkillName.Blacksmith, 65.0, 88.0);
|
||||
break;
|
||||
case RefinementCraftType.Tailor:
|
||||
SetSkill(SkillName.Tailoring, 60.0, 83.0);
|
||||
break;
|
||||
case RefinementCraftType.Carpenter:
|
||||
SetSkill(SkillName.Carpentry, 61.0, 93.0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if(from.InRange(this.Location, 10))
|
||||
from.SendGump(new RefinementHelpGump(m_RefineType));
|
||||
}
|
||||
|
||||
public ArmorRefiner(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write((int)0);
|
||||
writer.Write((int)m_RefineType);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int v = reader.ReadInt();
|
||||
m_RefineType = (RefinementCraftType)reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
313
Scripts/Services/Armor Refinement/Gumps.cs
Normal file
313
Scripts/Services/Armor Refinement/Gumps.cs
Normal file
@@ -0,0 +1,313 @@
|
||||
using System;
|
||||
using Server;
|
||||
using Server.Network;
|
||||
using System.Collections.Generic;
|
||||
using Server.Targeting;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class RefinementGump : Gump
|
||||
{
|
||||
public const int DarkGreen = 10000;
|
||||
public const int White = 0x7FFF;
|
||||
public const int WhiteLabel = 0xFFFFFF;
|
||||
public const int Yellow = 0xFFE0;
|
||||
|
||||
private RefinementItem m_Item;
|
||||
private ModEntry m_Entry;
|
||||
private bool m_CanRefine;
|
||||
|
||||
public RefinementGump(RefinementItem item) : base(50, 50)
|
||||
{
|
||||
m_Item = item;
|
||||
m_Entry = item.Entry;
|
||||
|
||||
if (m_Entry == null)
|
||||
return;
|
||||
|
||||
AddBackground(0, 0, 400, 350, 83);
|
||||
|
||||
int y = 70;
|
||||
m_CanRefine = true;
|
||||
|
||||
AddHtmlLocalized(10, 10, 200, 20, 1154094, DarkGreen, false, false); // Refinement Crafting Options
|
||||
AddHtmlLocalized(10, 35, 200, 20, 1153967, m_Item.GetNameArgs(), DarkGreen, false, false);
|
||||
|
||||
for (int i = 0; i < m_Item.ModAmount; i++)
|
||||
{
|
||||
AddButton(15, y, 4005, 4007, i + 100, GumpButtonType.Reply, 0);
|
||||
|
||||
AddHtmlLocalized(55, y, 150, 16, 1154097 + i, WhiteLabel, false, false); // CHOOSE RESIST #1
|
||||
AddHtmlLocalized(230, y, 150, 16, GetResistanceLabel(m_Entry.Resists[i], m_Entry.Values[i]), WhiteLabel, false, false);
|
||||
|
||||
if (!m_Item.CheckBonus && i == m_Item.ModAmount - 1 && m_Item.GetBonusChance() > 0)
|
||||
{
|
||||
if (Utility.Random(100) <= m_Item.GetBonusChance())
|
||||
m_Item.ModAmount++;
|
||||
|
||||
m_Item.CheckBonus = true;
|
||||
}
|
||||
|
||||
if (m_CanRefine && m_Entry.Values[i] == 0)
|
||||
m_CanRefine = false;
|
||||
|
||||
y += 20;
|
||||
}
|
||||
|
||||
y += 50;
|
||||
|
||||
AddHtmlLocalized(10, y, 150, 16, 1154106, Yellow, false, false); // MODIFICATIONS:
|
||||
AddHtmlLocalized(170, y, 10, 16, 1114057, m_Item.ModAmount.ToString(), Yellow, false, false);
|
||||
|
||||
if (m_CanRefine)
|
||||
{
|
||||
AddHtmlLocalized(230, y, 150, 16, 1154105, WhiteLabel, false, false); // REFINE ITEM
|
||||
AddButton(360, y, 4014, 4016, 1, GumpButtonType.Reply, 0);
|
||||
}
|
||||
else
|
||||
AddHtmlLocalized(230, y, 150, 16, 1154108, WhiteLabel, false, false); // SELECT RESISTS
|
||||
|
||||
y += 25;
|
||||
|
||||
AddHtmlLocalized(10, y, 200, 16, 1154107, WhiteLabel, false, false); // BONUS MOD CHANCE:
|
||||
AddHtmlLocalized(170, y, 15, 16, 1114057, m_Item.GetBonusChance().ToString() + "%", WhiteLabel, false, false);
|
||||
|
||||
AddButton(10, 320, 4017, 4019, 0, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(50, 320, 100, 16, 3002084, WhiteLabel, false, false); // Close
|
||||
|
||||
AddHtmlLocalized(250, 320, 100, 16, 3000391, WhiteLabel, false, false); // Help
|
||||
AddButton(360, 320, 4011, 4013, 2, GumpButtonType.Reply, 0);
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState state, RelayInfo info)
|
||||
{
|
||||
Mobile from = state.Mobile;
|
||||
|
||||
if (info.ButtonID == 1) // Refine Item
|
||||
{
|
||||
if (m_CanRefine)
|
||||
{
|
||||
from.Target = new InternalTarget(m_Item);
|
||||
from.SendLocalizedMessage(1153985); // Target the armor you wish to apply this Refinement.
|
||||
}
|
||||
}
|
||||
else if (info.ButtonID == 2)
|
||||
{
|
||||
from.SendGump(new RefinementHelpGump(m_Item.CraftType));
|
||||
}
|
||||
else if (info.ButtonID >= 100) // Choose Resist
|
||||
{
|
||||
int i = info.ButtonID - 100;
|
||||
ResistanceType oldType = m_Entry.Resists[i];
|
||||
int value = (int)oldType;
|
||||
|
||||
if (value == 4) value = 0;
|
||||
else value++;
|
||||
|
||||
ResistanceType newType = (ResistanceType)value;
|
||||
|
||||
m_Entry.Resists[i] = newType;
|
||||
m_Entry.Values[i] = m_Item.RefinementType == RefinementType.Reinforcing ? 1 : -1;
|
||||
|
||||
for (int idx = 0; idx < m_Entry.Resists.Length; idx++)
|
||||
{
|
||||
if (idx != i && m_Entry.Resists[idx] == newType)
|
||||
{
|
||||
m_Entry.Resists[idx] = oldType;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
from.SendGump(new RefinementGump(m_Item));
|
||||
}
|
||||
}
|
||||
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private RefinementItem m_Item;
|
||||
private ModEntry m_Entry;
|
||||
|
||||
public InternalTarget(RefinementItem item) : base(-1, false, TargetFlags.None)
|
||||
{
|
||||
m_Item = item;
|
||||
m_Entry = item.Entry;
|
||||
}
|
||||
|
||||
protected override void OnTarget(Mobile from, object targeted)
|
||||
{
|
||||
if (m_Item == null || m_Item.Deleted)
|
||||
return;
|
||||
|
||||
if (targeted is BaseArmor)
|
||||
{
|
||||
BaseArmor armor = targeted as BaseArmor;
|
||||
|
||||
if (!armor.IsChildOf(from.Backpack))
|
||||
from.SendLocalizedMessage(1054107); // This item must be in your backpack.
|
||||
else if (armor.ArmorAttributes.MageArmor > 0)
|
||||
from.SendLocalizedMessage(1153986); // You cannot refine this piece of armor!
|
||||
else if (!RefinementGump.CanApplyToArmor(from, armor, m_Item))
|
||||
from.SendLocalizedMessage(1153987); // The type of armor you have selected is not compatible with this Refinement Tool.
|
||||
else if(RefinementItem.CheckForVendor(from, m_Item))
|
||||
{
|
||||
//Resets old refinement if it exists
|
||||
armor.RefinedPhysical = 0;
|
||||
armor.RefinedFire = 0;
|
||||
armor.RefinedCold = 0;
|
||||
armor.RefinedPoison = 0;
|
||||
armor.RefinedEnergy = 0;
|
||||
|
||||
for (int i = 0; i < m_Item.ModAmount; i++)
|
||||
{
|
||||
if (i < 0 || i >= m_Entry.Resists.Length)
|
||||
continue;
|
||||
|
||||
int value = i < m_Entry.Values.Length ? m_Entry.Values[i] : 0;
|
||||
|
||||
switch (m_Entry.Resists[i])
|
||||
{
|
||||
case ResistanceType.Physical: armor.RefinedPhysical += value; break;
|
||||
case ResistanceType.Fire: armor.RefinedFire += value; break;
|
||||
case ResistanceType.Cold: armor.RefinedCold += value; break;
|
||||
case ResistanceType.Poison: armor.RefinedPoison += value; break;
|
||||
case ResistanceType.Energy: armor.RefinedEnergy += value; break;
|
||||
}
|
||||
}
|
||||
|
||||
from.PrivateOverheadMessage(MessageType.Regular, 0, 1153980, from.NetState); // *You carefully apply the Refinement to the armor*
|
||||
m_Item.Delete();
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
from.SendLocalizedMessage(1153991); // You can only refine non-medable armor.
|
||||
|
||||
from.SendGump(new RefinementGump(m_Item));
|
||||
}
|
||||
}
|
||||
|
||||
public int GetResistanceLabel(ResistanceType attr, int value)
|
||||
{
|
||||
if(value == 0)
|
||||
return 1062648; // None Selected
|
||||
|
||||
switch (attr)
|
||||
{
|
||||
default:
|
||||
case ResistanceType.Physical: return 1061158;
|
||||
case ResistanceType.Fire: return 1061159;
|
||||
case ResistanceType.Cold: return 1061160;
|
||||
case ResistanceType.Poison: return 1061161;
|
||||
case ResistanceType.Energy: return 1061162;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool CanApplyToArmor(Mobile from, BaseArmor armor, RefinementItem item)
|
||||
{
|
||||
switch (item.SubCraftType)
|
||||
{
|
||||
case RefinementSubCraftType.StuddedLeather:
|
||||
return armor is StuddedBustierArms || armor is StuddedArms || armor is StuddedChest || armor is StuddedGloves || armor is StuddedGorget || armor is StuddedLegs;
|
||||
case RefinementSubCraftType.StuddedSamurai:
|
||||
return armor is StuddedDo || armor is StuddedHaidate || armor is StuddedHiroSode || armor is StuddedMempo || armor is StuddedSuneate;
|
||||
case RefinementSubCraftType.Hide:
|
||||
return armor is HideChest || armor is HideFemaleChest || armor is HideGloves || armor is HideGorget || armor is HidePants || armor is HidePauldrons;
|
||||
case RefinementSubCraftType.Bone:
|
||||
return armor is BoneArms || armor is BoneChest || armor is BoneGloves || armor is BoneLegs;
|
||||
case RefinementSubCraftType.Ringmail:
|
||||
return armor is RingmailArms || armor is RingmailChest || armor is RingmailGloves || armor is RingmailLegs;
|
||||
case RefinementSubCraftType.Chainmail:
|
||||
return armor is ChainChest || armor is ChainLegs || armor is ChainCoif;
|
||||
case RefinementSubCraftType.Platemail:
|
||||
return armor is FemalePlateChest || armor is PlateArms || armor is PlateChest || armor is PlateGloves || armor is PlateGorget || armor is PlateLegs || armor is PlateHelm || armor is Bascinet || armor is CloseHelm || armor is Helmet;
|
||||
case RefinementSubCraftType.PlatemailSamurai:
|
||||
return armor is DecorativePlateKabuto || armor is HeavyPlateJingasa || armor is LightPlateJingasa || armor is PlateBattleKabuto || armor is PlateDo || armor is PlateHaidate || armor is PlateHatsuburi || armor is PlateHiroSode
|
||||
|| armor is PlateMempo || armor is PlateSuneate || armor is SmallPlateJingasa || armor is StandardPlateKabuto;
|
||||
case RefinementSubCraftType.GargishPlatemail:
|
||||
return armor is GargishPlateArms || armor is GargishPlateChest || armor is GargishPlateKilt || armor is GargishPlateLegs || armor is FemaleGargishPlateArms || armor is FemaleGargishPlateLegs || armor is FemaleGargishPlateChest || armor is FemaleGargishPlateKilt;
|
||||
case RefinementSubCraftType.Dragon:
|
||||
return armor is DragonArms || armor is DragonChest || armor is DragonGloves || armor is DragonHelm || armor is DragonLegs;
|
||||
case RefinementSubCraftType.Woodland:
|
||||
return armor is WoodlandArms || armor is WoodlandChest || armor is WoodlandGloves || armor is WoodlandGorget || armor is WoodlandLegs;
|
||||
case RefinementSubCraftType.GargishStone:
|
||||
return armor is GargishStoneArms || armor is GargishStoneChest || armor is GargishStoneLegs || armor is GargishStoneKilt || armor is FemaleGargishStoneArms || armor is FemaleGargishStoneChest || armor is FemaleGargishStoneLegs || armor is FemaleGargishStoneKilt;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public class RefinementHelpGump : Gump
|
||||
{
|
||||
public RefinementHelpGump(RefinementCraftType type)
|
||||
: base(50, 50)
|
||||
{
|
||||
AddImageTiled(50, 20, 400, 400, 0x1404);
|
||||
AddImageTiled(50, 29, 30, 390, 0x28DC);
|
||||
AddImageTiled(34, 140, 17, 279, 0x242F);
|
||||
AddImage(48, 135, 0x28AB);
|
||||
AddImage(-16, 285, 0x28A2);
|
||||
AddImage(0, 10, 0x28B5);
|
||||
AddImage(25, 0, 0x28B4);
|
||||
AddImageTiled(83, 15, 350, 15, 0x280A);
|
||||
AddImage(34, 419, 0x2842);
|
||||
AddImage(442, 419, 0x2840);
|
||||
AddImageTiled(51, 419, 392, 17, 0x2775);
|
||||
AddImageTiled(415, 29, 44, 390, 0xA2D);
|
||||
AddImageTiled(415, 29, 30, 390, 0x28DC);
|
||||
AddImage(370, 50, 0x589);
|
||||
|
||||
AddImage(379, 60, 0x15A9);
|
||||
AddImage(425, 0, 0x28C9);
|
||||
AddImage(90, 33, 0x232D);
|
||||
AddImageTiled(130, 65, 175, 1, 0x238D);
|
||||
|
||||
AddPage(0);
|
||||
int cliloc = 0;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case RefinementCraftType.Blacksmith: cliloc = 1153992; break;
|
||||
case RefinementCraftType.Tailor: cliloc = 1153993; break;
|
||||
case RefinementCraftType.Carpenter: cliloc = 1153994; break;
|
||||
}
|
||||
|
||||
AddHtmlLocalized(130, 45, 270, 16, 1154001, 0xFFFFFF, false, false); // Armor Refinement
|
||||
|
||||
AddButton( 313, 395, 0x2EEC, 0x2EEE, 0, GumpButtonType.Reply, 0 );
|
||||
|
||||
AddPage(1);
|
||||
|
||||
AddHtmlLocalized(98, 140, 312, 105, cliloc, 0xFFFFFF, false, true);
|
||||
|
||||
AddButton(98, 255, 9904, 9905, 1, GumpButtonType.Page, 2);
|
||||
AddHtmlLocalized(125, 255, 250, 20, 1153995, 0xFFFFFF, false, false); // What is an Armor Refinement?
|
||||
|
||||
AddButton(98, 275, 9904, 9905, 1, GumpButtonType.Page, 3);
|
||||
AddHtmlLocalized(125, 275, 250, 20, 1153996, 0xFFFFFF, false, false); // Where can I find components?
|
||||
|
||||
AddButton(98, 295, 9904, 9905, 1, GumpButtonType.Page, 4);
|
||||
AddHtmlLocalized(125, 295, 250, 20, 1153997, 0xFFFFFF, false, false); // What raw materials do I need to use?
|
||||
|
||||
AddButton(98, 315, 9904, 9905, 1, GumpButtonType.Page, 5);
|
||||
AddHtmlLocalized(125, 315, 250, 20, 1154006, 0xFFFFFF, false, false); // Where can I find raw materials?
|
||||
|
||||
AddPage(2);
|
||||
|
||||
AddHtmlLocalized(98, 140, 312, 205, 1153998, 0xFFFFFF, false, true);
|
||||
|
||||
AddPage(3);
|
||||
|
||||
AddHtmlLocalized(98, 140, 312, 205, 1153999, 0xFFFFFF, false, true);
|
||||
|
||||
AddPage(4);
|
||||
|
||||
AddHtmlLocalized(98, 140, 312, 205, 1154000, 0xFFFFFF, false, true);
|
||||
|
||||
AddPage(5);
|
||||
|
||||
AddHtmlLocalized(98, 140, 312, 205, 1154007, 0xFFFFFF, false, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
705
Scripts/Services/Armor Refinement/Items.cs
Normal file
705
Scripts/Services/Armor Refinement/Items.cs
Normal file
@@ -0,0 +1,705 @@
|
||||
using System;
|
||||
using Server;
|
||||
using Server.Network;
|
||||
using Server.Gumps;
|
||||
using Server.Mobiles;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public enum RefinementType
|
||||
{
|
||||
Reinforcing,
|
||||
Deflecting
|
||||
}
|
||||
|
||||
public enum RefinementCraftType
|
||||
{
|
||||
Blacksmith,
|
||||
Tailor,
|
||||
Carpenter
|
||||
}
|
||||
|
||||
public enum ModType
|
||||
{
|
||||
Defense,
|
||||
Protection,
|
||||
Hardening,
|
||||
Fortification,
|
||||
Invulnerability
|
||||
}
|
||||
|
||||
public enum RefinementSubCraftType
|
||||
{
|
||||
StuddedLeather,
|
||||
StuddedSamurai,
|
||||
Hide,
|
||||
Bone,
|
||||
Ringmail,
|
||||
Chainmail,
|
||||
Platemail,
|
||||
PlatemailSamurai,
|
||||
GargishPlatemail,
|
||||
Dragon,
|
||||
Woodland,
|
||||
GargishStone
|
||||
}
|
||||
|
||||
public class RefinementComponent : Item
|
||||
{
|
||||
private RefinementType m_RefinementType;
|
||||
private RefinementCraftType m_CraftType;
|
||||
private RefinementSubCraftType m_SubCraftType;
|
||||
private ModType m_ModType;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public RefinementType RefinementType
|
||||
{
|
||||
get { return m_RefinementType; }
|
||||
set
|
||||
{
|
||||
m_RefinementType = value;
|
||||
GetItemID();
|
||||
GetHue();
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public RefinementCraftType CraftType
|
||||
{
|
||||
get { return m_CraftType; }
|
||||
set
|
||||
{
|
||||
RefinementCraftType old = m_CraftType;
|
||||
|
||||
m_CraftType = value;
|
||||
|
||||
if (old != m_CraftType)
|
||||
GetSubCraftType();
|
||||
|
||||
GetItemID();
|
||||
GetHue();
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public RefinementSubCraftType SubCraftType { get { return m_SubCraftType; } set { m_SubCraftType = value; } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public ModType ModType { get { return m_ModType; } set { m_ModType = value; InvalidateProperties(); } }
|
||||
|
||||
[Constructable]
|
||||
public RefinementComponent()
|
||||
: this(RefinementType.Reinforcing, RefinementCraftType.Blacksmith, ModType.Defense)
|
||||
{
|
||||
}
|
||||
|
||||
public RefinementComponent(RefinementType type, RefinementCraftType craftType, ModType modType)
|
||||
: base(0)
|
||||
{
|
||||
m_RefinementType = type;
|
||||
m_CraftType = craftType;
|
||||
GetSubCraftType();
|
||||
m_ModType = modType;
|
||||
GetItemID();
|
||||
GetHue();
|
||||
}
|
||||
|
||||
public override void AddNameProperty(ObjectPropertyList list)
|
||||
{
|
||||
list.Add(1153966, String.Format("#{0}\t#{1}", Labels[(int)m_RefinementType][(int)m_CraftType], GetModLabel())); // ~1_OBJTYPE~ ~2_BONUSLEVEL~
|
||||
}
|
||||
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
list.Add(1154002, String.Format("#{0}", 1153954 + (int)m_SubCraftType)); // Armor Type: ~1_TYPE~
|
||||
list.Add(1154124, String.Format("#{0}", m_RefinementType == RefinementType.Reinforcing ? 1154123 : 1154122)); // Bonus Type: ~1_TYPE~
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if(!IsChildOf(from.Backpack) || from.Backpack == null)
|
||||
from.SendLocalizedMessage(1054107); // This item must be in your backpack.
|
||||
else if(!CheckSkill(from))
|
||||
from.SendLocalizedMessage(1153981, m_CraftType.ToString()); // Only a Grandmaster ~1_PROFESSION~ would know what to do with this.
|
||||
else if(!from.Backpack.ConsumeTotal(GetRawMaterial(), 20))
|
||||
from.SendLocalizedMessage(1153978); // You lack the required quantity of raw materials to craft the Armor Refinement.
|
||||
else
|
||||
{
|
||||
from.Backpack.DropItem(new RefinementItem(m_RefinementType, m_CraftType, m_SubCraftType, m_ModType));
|
||||
from.PrivateOverheadMessage(MessageType.Regular, 0, 1153979, from.NetState); // *You carefully and skillfully craft an Armor Refinement* TODO Hue???
|
||||
|
||||
Consume();
|
||||
}
|
||||
}
|
||||
|
||||
private void GetHue()
|
||||
{
|
||||
if (m_RefinementType == RefinementType.Reinforcing)
|
||||
{
|
||||
switch (m_CraftType)
|
||||
{
|
||||
case RefinementCraftType.Blacksmith: Hue = 2967; break;
|
||||
case RefinementCraftType.Tailor: Hue = 2587; break;
|
||||
case RefinementCraftType.Carpenter: Hue = 0; break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (m_CraftType)
|
||||
{
|
||||
case RefinementCraftType.Blacksmith: Hue = 2506; break;
|
||||
case RefinementCraftType.Tailor: Hue = 2952; break;
|
||||
case RefinementCraftType.Carpenter: Hue = 2119; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool CheckSkill(Mobile from)
|
||||
{
|
||||
SkillName check = SkillName.Blacksmith;
|
||||
|
||||
switch (m_CraftType)
|
||||
{
|
||||
case RefinementCraftType.Blacksmith: break;
|
||||
case RefinementCraftType.Tailor: check = SkillName.Tailoring; break;
|
||||
case RefinementCraftType.Carpenter: check = SkillName.Carpentry; break;
|
||||
}
|
||||
|
||||
return from.Skills[check].Value >= 100;
|
||||
}
|
||||
|
||||
private Type GetRawMaterial()
|
||||
{
|
||||
switch (m_CraftType)
|
||||
{
|
||||
default:
|
||||
case RefinementCraftType.Blacksmith: return typeof(MalleableAlloy);
|
||||
case RefinementCraftType.Tailor: return typeof(LeatherBraid);
|
||||
case RefinementCraftType.Carpenter: return typeof(SolventFlask);
|
||||
}
|
||||
}
|
||||
|
||||
public void GetSubCraftType()
|
||||
{
|
||||
switch (m_CraftType)
|
||||
{
|
||||
case RefinementCraftType.Blacksmith:
|
||||
m_SubCraftType = (RefinementSubCraftType)Utility.RandomMinMax(4, 9); break;
|
||||
case RefinementCraftType.Tailor:
|
||||
m_SubCraftType = (RefinementSubCraftType)Utility.RandomMinMax(0, 3); break;
|
||||
case RefinementCraftType.Carpenter:
|
||||
m_SubCraftType = (RefinementSubCraftType)Utility.RandomMinMax(10, 11); break;
|
||||
}
|
||||
}
|
||||
|
||||
private int[][] Labels = new int[][]
|
||||
{
|
||||
//Scour Thread Varnish
|
||||
//Polish Wash Gloss
|
||||
new int[] { 1153951, 1153948, 1153952 },
|
||||
new int[] { 1153950, 1153949, 1153953 }
|
||||
};
|
||||
|
||||
private int GetModLabel()
|
||||
{
|
||||
switch ((int)m_ModType)
|
||||
{
|
||||
default:
|
||||
case 0: return 1153941;
|
||||
case 1: return 1153944;
|
||||
case 2: return 1153945;
|
||||
case 3: return 1153946;
|
||||
case 4: return 1153947;
|
||||
}
|
||||
}
|
||||
|
||||
private int[][] ItemIDs = new int[][]
|
||||
{
|
||||
// Smith Tail Carp
|
||||
new int[] { 19673, 5163, 11617 }, //Reinforcing
|
||||
new int[] { 19672, 5162, 19674 } //Deflecting
|
||||
};
|
||||
|
||||
private void GetItemID()
|
||||
{
|
||||
ItemID = ItemIDs[(int)m_RefinementType][(int)m_CraftType];
|
||||
}
|
||||
|
||||
public static bool Roll(Container c, int rolls, double chance)
|
||||
{
|
||||
for (int i = 0; i < rolls; i++)
|
||||
{
|
||||
if (chance >= Utility.RandomDouble())
|
||||
{
|
||||
c.DropItem(GetRandom());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static RefinementComponent GetRandom()
|
||||
{
|
||||
return new RefinementComponent((RefinementType)Utility.Random(2), (RefinementCraftType)Utility.Random(3), GetRandomMod());
|
||||
}
|
||||
|
||||
private static ModType GetRandomMod()
|
||||
{
|
||||
double ran = Utility.RandomDouble();
|
||||
|
||||
if (ran >= .95) return ModType.Invulnerability;
|
||||
if (ran >= .80) return ModType.Fortification;
|
||||
if (ran >= .70) return ModType.Hardening;
|
||||
if (ran >= .50) return ModType.Protection;
|
||||
|
||||
return ModType.Defense;
|
||||
}
|
||||
|
||||
public RefinementComponent(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write((int)0);
|
||||
|
||||
writer.Write((int)m_RefinementType);
|
||||
writer.Write((int)m_CraftType);
|
||||
writer.Write((int)m_SubCraftType);
|
||||
writer.Write((int)m_ModType);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int v = reader.ReadInt();
|
||||
|
||||
m_RefinementType = (RefinementType)reader.ReadInt();
|
||||
m_CraftType = (RefinementCraftType)reader.ReadInt();
|
||||
m_SubCraftType = (RefinementSubCraftType)reader.ReadInt();
|
||||
m_ModType = (ModType)reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class RefinementItem : Item
|
||||
{
|
||||
private RefinementType m_RefinementType;
|
||||
private RefinementCraftType m_CraftType;
|
||||
private RefinementSubCraftType m_SubCraftType;
|
||||
private ModType m_ModType;
|
||||
private int m_ModAmount;
|
||||
private bool m_CheckBonus;
|
||||
private ModEntry m_Entry;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public RefinementType RefinementType
|
||||
{
|
||||
get { return m_RefinementType; }
|
||||
set
|
||||
{
|
||||
m_RefinementType = value;
|
||||
GetItemID();
|
||||
GetHue();
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public RefinementCraftType CraftType
|
||||
{
|
||||
get { return m_CraftType; }
|
||||
set
|
||||
{
|
||||
RefinementCraftType old = m_CraftType;
|
||||
|
||||
m_CraftType = value;
|
||||
|
||||
if(old != m_CraftType)
|
||||
GetSubCraftType();
|
||||
|
||||
GetItemID();
|
||||
GetHue();
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public RefinementSubCraftType SubCraftType { get { return m_SubCraftType; } set { m_SubCraftType = value; InvalidateProperties(); } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public ModType ModType { get { return m_ModType; } set { m_ModType = value; InvalidateProperties(); ApplyModAmount(); } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int ModAmount { get { return m_ModAmount; } set { m_ModAmount = value; if (m_ModAmount > 5) m_ModAmount = 5; if (m_ModAmount < 1) m_ModAmount = 1; ; } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public bool CheckBonus { get { return m_CheckBonus; } set { m_CheckBonus = value; } }
|
||||
|
||||
public ModEntry Entry { get { return m_Entry; } }
|
||||
|
||||
[Constructable]
|
||||
public RefinementItem()
|
||||
: this(RefinementType.Reinforcing, RefinementCraftType.Blacksmith, RefinementSubCraftType.Ringmail, ModType.Defense)
|
||||
{
|
||||
}
|
||||
|
||||
public RefinementItem(RefinementType type, RefinementCraftType craftType, RefinementSubCraftType srtype, ModType modType)
|
||||
: base(0)
|
||||
{
|
||||
m_RefinementType = type;
|
||||
m_CraftType = craftType;
|
||||
m_SubCraftType = srtype;
|
||||
ModType = modType;
|
||||
GetItemID();
|
||||
GetHue();
|
||||
ApplyModAmount();
|
||||
|
||||
m_Entry = new ModEntry(m_ModAmount);
|
||||
|
||||
m_CheckBonus = false;
|
||||
}
|
||||
|
||||
public void ApplyModAmount()
|
||||
{
|
||||
switch ((int)m_ModType)
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
case 1: m_ModAmount = 1; break;
|
||||
case 2: m_ModAmount = 2; break;
|
||||
case 3: m_ModAmount = 3; break;
|
||||
case 4: m_ModAmount = 4; break;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (!IsChildOf(from.Backpack))
|
||||
from.SendLocalizedMessage(1054107); // This item must be in your backpack.
|
||||
else if (CheckForVendor(from, this))
|
||||
{
|
||||
from.CloseGump(typeof(RefinementGump));
|
||||
from.SendGump(new RefinementGump(this));
|
||||
}
|
||||
}
|
||||
|
||||
public override void AddNameProperty(ObjectPropertyList list)
|
||||
{
|
||||
list.Add(1153967, GetNameArgs()); // ~1_BONUSTYPE~ ~2_OBJTYPE~ ~3_BONUSLEVEL~
|
||||
}
|
||||
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
list.Add(1154002, String.Format("#{0}", (1153954 + (int)m_SubCraftType).ToString())); // Armor Type: ~1_TYPE~
|
||||
list.Add(1154124, m_RefinementType == RefinementType.Reinforcing ? "#1154123" : "#1154122"); // Bonus Type: ~1_TYPE~
|
||||
}
|
||||
|
||||
private void GetHue()
|
||||
{
|
||||
if (m_RefinementType == RefinementType.Reinforcing)
|
||||
Hue = 2970;
|
||||
else
|
||||
Hue = 2953;
|
||||
}
|
||||
|
||||
private bool CheckSkill(Mobile from)
|
||||
{
|
||||
SkillName check = SkillName.Blacksmith;
|
||||
|
||||
switch (m_CraftType)
|
||||
{
|
||||
case RefinementCraftType.Blacksmith: break;
|
||||
case RefinementCraftType.Tailor: check = SkillName.Tailoring; break;
|
||||
case RefinementCraftType.Carpenter: check = SkillName.Carpentry; break;
|
||||
}
|
||||
|
||||
return from.Skills[check].Value >= 100;
|
||||
}
|
||||
|
||||
public virtual int GetBonusChance()
|
||||
{
|
||||
if (m_ModType == ModType.Defense)
|
||||
return 0;
|
||||
|
||||
return 5;
|
||||
}
|
||||
|
||||
private void GetItemID()
|
||||
{
|
||||
ItemID = ItemIDs[(int)m_RefinementType][(int)m_CraftType];
|
||||
}
|
||||
|
||||
public void GetSubCraftType()
|
||||
{
|
||||
switch (m_CraftType)
|
||||
{
|
||||
case RefinementCraftType.Blacksmith:
|
||||
m_SubCraftType = (RefinementSubCraftType)Utility.RandomMinMax(4, 9); break;
|
||||
case RefinementCraftType.Tailor:
|
||||
m_SubCraftType = (RefinementSubCraftType)Utility.RandomMinMax(0, 3); break;
|
||||
case RefinementCraftType.Carpenter:
|
||||
m_SubCraftType = (RefinementSubCraftType)Utility.RandomMinMax(10, 11); break;
|
||||
}
|
||||
}
|
||||
|
||||
public string GetNameArgs()
|
||||
{
|
||||
return String.Format("#{0}\t#{1}\t#{2}", LabelPrefix[(int)m_RefinementType][(int)m_CraftType], LabelSuffix[(int)m_CraftType], GetModLabel());
|
||||
}
|
||||
|
||||
public int[][] LabelPrefix = new int[][]
|
||||
{ //Scoured Cured Varnished
|
||||
//Polished Washed Glazed
|
||||
new int[] { 1153971, 1153968, 1153972 }, // Reinforcing
|
||||
new int[] { 1153970, 1153969, 1153973 } // Deflecting
|
||||
};
|
||||
|
||||
public int[] LabelSuffix = new int[]
|
||||
{
|
||||
//Plating Thread Resin
|
||||
1153975, 1153974, 1153976 //Reinforcing and Deflecting
|
||||
};
|
||||
|
||||
private int GetModLabel()
|
||||
{
|
||||
switch ((int)m_ModType)
|
||||
{
|
||||
default:
|
||||
case 0: return 1153941; // of Defense
|
||||
case 1: return 1153944; // of Protection
|
||||
case 2: return 1153945; // of Hardening
|
||||
case 3: return 1153946; // of Fortification
|
||||
case 4: return 1153947; // of Invulnerability
|
||||
}
|
||||
}
|
||||
|
||||
private int[][] ItemIDs = new int[][]
|
||||
{ // Smith Tail Carp
|
||||
new int[] { 19676, 19675, 19677 }, //Reinforcing
|
||||
new int[] { 19676, 19675, 19677 } //Deflecing
|
||||
};
|
||||
|
||||
public static bool CheckForVendor(Mobile from, RefinementItem item)
|
||||
{
|
||||
IPooledEnumerable eable = from.Map.GetMobilesInRange(from.Location, 12);
|
||||
|
||||
foreach (Mobile m in eable)
|
||||
{
|
||||
if (m is ArmorRefiner && ((ArmorRefiner)m).RefineType == item.CraftType)
|
||||
{
|
||||
eable.Free();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
bool wtf = .5 > Utility.RandomDouble();
|
||||
|
||||
switch (item.CraftType)
|
||||
{
|
||||
case RefinementCraftType.Blacksmith: from.SendLocalizedMessage(wtf ? 1154012 : 1154009); break;
|
||||
case RefinementCraftType.Tailor: from.SendLocalizedMessage(wtf ? 1154011 : 1154008); break;
|
||||
case RefinementCraftType.Carpenter: from.SendLocalizedMessage(wtf ? 1154013 : 1154010); break;
|
||||
}
|
||||
|
||||
eable.Free();
|
||||
return false;
|
||||
}
|
||||
|
||||
public RefinementItem(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write((int)0);
|
||||
|
||||
writer.Write((int)m_RefinementType);
|
||||
writer.Write((int)m_CraftType);
|
||||
writer.Write((int)m_SubCraftType);
|
||||
writer.Write((int)m_ModType);
|
||||
writer.Write(m_ModAmount);
|
||||
writer.Write(m_CheckBonus);
|
||||
|
||||
m_Entry.Serialize(writer);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int v = reader.ReadInt();
|
||||
|
||||
m_RefinementType = (RefinementType)reader.ReadInt();
|
||||
m_CraftType = (RefinementCraftType)reader.ReadInt();
|
||||
m_SubCraftType = (RefinementSubCraftType)reader.ReadInt();
|
||||
m_ModType = (ModType)reader.ReadInt();
|
||||
m_ModAmount = reader.ReadInt();
|
||||
m_CheckBonus = reader.ReadBool();
|
||||
|
||||
m_Entry = new ModEntry(reader);
|
||||
}
|
||||
}
|
||||
|
||||
public class ModEntry
|
||||
{
|
||||
private ResistanceType[] m_Resists = new ResistanceType[5];
|
||||
private int[] m_Values = new int[5];
|
||||
|
||||
public ResistanceType[] Resists { get { return m_Resists; } }
|
||||
public int[] Values { get { return m_Values; } }
|
||||
|
||||
public ModEntry(int count)
|
||||
{
|
||||
for (int i = 0; i < m_Resists.Length; i++)
|
||||
{
|
||||
m_Resists[i] = (ResistanceType)i;
|
||||
m_Values[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public ModEntry(GenericReader reader)
|
||||
{
|
||||
int version = reader.ReadInt();
|
||||
|
||||
int count = reader.ReadInt();
|
||||
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
m_Resists[i] = (ResistanceType)reader.ReadInt();
|
||||
m_Values[i] = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
public void Serialize(GenericWriter writer)
|
||||
{
|
||||
writer.Write((int)0);
|
||||
|
||||
writer.Write(m_Resists.Length);
|
||||
|
||||
for (int i = 0; i < m_Resists.Length; i++)
|
||||
{
|
||||
writer.Write((int)m_Resists[i]);
|
||||
writer.Write(m_Values[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class LeatherBraid : Item
|
||||
{
|
||||
public override int LabelNumber { get { return 1154003; } } // Leather braid
|
||||
|
||||
[Constructable]
|
||||
public LeatherBraid() : this(1)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public LeatherBraid(int amount) : base(5152)
|
||||
{
|
||||
Stackable = true;
|
||||
Amount = amount;
|
||||
Hue = 2968;
|
||||
}
|
||||
|
||||
public LeatherBraid(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write((int)0);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int v = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class MalleableAlloy : Item
|
||||
{
|
||||
public override int LabelNumber { get { return 1154005; } } // Melleable Alloy
|
||||
|
||||
[Constructable]
|
||||
public MalleableAlloy()
|
||||
: this(1)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public MalleableAlloy(int amount)
|
||||
: base(0x1BE9)
|
||||
{
|
||||
Stackable = true;
|
||||
Amount = amount;
|
||||
Hue = 2949;
|
||||
}
|
||||
|
||||
public MalleableAlloy(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write((int)0);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int v = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class SolventFlask : Item
|
||||
{
|
||||
public override int LabelNumber { get { return 1154004; } } // Solvent Flask
|
||||
|
||||
[Constructable]
|
||||
public SolventFlask()
|
||||
: this(1)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public SolventFlask(int amount)
|
||||
: base(7192)
|
||||
{
|
||||
Stackable = true;
|
||||
Amount = amount;
|
||||
Hue = 2969;
|
||||
}
|
||||
|
||||
public SolventFlask(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write((int)0);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int v = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
269
Scripts/Services/Assistants.cs
Normal file
269
Scripts/Services/Assistants.cs
Normal file
@@ -0,0 +1,269 @@
|
||||
#region References
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Server.Gumps;
|
||||
using Server.Network;
|
||||
#endregion
|
||||
|
||||
namespace Server.Misc
|
||||
{
|
||||
public static class Assistants
|
||||
{
|
||||
[Flags]
|
||||
public enum Features : ulong
|
||||
{
|
||||
None = 0,
|
||||
|
||||
FilterWeather = 1 << 0, // Weather Filter
|
||||
FilterLight = 1 << 1, // Light Filter
|
||||
SmartTarget = 1 << 2, // Smart Last Target
|
||||
RangedTarget = 1 << 3, // Range Check Last Target
|
||||
AutoOpenDoors = 1 << 4, // Automatically Open Doors
|
||||
DequipOnCast = 1 << 5, // Unequip Weapon on spell cast
|
||||
AutoPotionEquip = 1 << 6, // Un/Re-equip weapon on potion use
|
||||
PoisonedChecks = 1 << 7, // Block heal If poisoned/Macro If Poisoned condition/Heal or Cure self
|
||||
LoopedMacros = 1 << 8, // Disallow Looping macros, For loops, and macros that call other macros
|
||||
UseOnceAgent = 1 << 9, // The use once agent
|
||||
RestockAgent = 1 << 10, // The restock agent
|
||||
SellAgent = 1 << 11, // The sell agent
|
||||
BuyAgent = 1 << 12, // The buy agent
|
||||
PotionHotkeys = 1 << 13, // All potion hotkeys
|
||||
RandomTargets = 1 << 14, // All random target hotkeys (not target next, last target, target self)
|
||||
ClosestTargets = 1 << 15, // All closest target hotkeys
|
||||
OverheadHealth = 1 << 16, // Health and Mana/Stam messages shown over player's heads
|
||||
|
||||
// AssistUO Only
|
||||
AutolootAgent = 1 << 17, // The autoloot agent
|
||||
BoneCutterAgent = 1 << 18, // The bone cutter agent
|
||||
JScriptMacros = 1 << 19, // Javascript macro engine
|
||||
AutoRemount = 1 << 20, // Auto remount after dismount
|
||||
|
||||
All = UInt64.MaxValue // Every feature possible
|
||||
}
|
||||
|
||||
public class Settings
|
||||
{
|
||||
/// <summary>
|
||||
/// Enable assistant negotiator?
|
||||
/// </summary>
|
||||
public static bool Enabled { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When true, this will cause anyone who does not negotiate.
|
||||
/// (include those not running allowed assistants at all) to be disconnected from the server.
|
||||
/// </summary>
|
||||
public static bool KickOnFailure { get; set; }
|
||||
|
||||
public static Features DisallowedFeatures { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// How long to wait for a handshake response before showing warning and disconnecting.
|
||||
/// </summary>
|
||||
public static TimeSpan HandshakeTimeout { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// How long to show warning message before they are disconnected.
|
||||
/// </summary>
|
||||
public static TimeSpan DisconnectDelay { get; set; }
|
||||
|
||||
public static string WarningMessage { get; set; }
|
||||
|
||||
static Settings()
|
||||
{
|
||||
Enabled = false;
|
||||
KickOnFailure = true;
|
||||
|
||||
DisallowedFeatures = Features.None;
|
||||
|
||||
HandshakeTimeout = TimeSpan.FromSeconds(30.0);
|
||||
DisconnectDelay = TimeSpan.FromSeconds(15.0);
|
||||
|
||||
WarningMessage =
|
||||
"The server was unable to negotiate features with your assistant. You must download and run an updated version of <A HREF='http://www.runuo.com/products/assistuo'>AssistUO</A> or <A HREF='http://www.runuo.com/products/razor'>Razor</A>.<BR><BR>Make sure you've checked the option <B>Negotiate features with server</B>, once you have this box checked you may log in and play normally.<BR><BR>You will be disconnected shortly.";
|
||||
}
|
||||
|
||||
public static void Configure()
|
||||
{
|
||||
//DisallowFeature( Features.FilterLight );
|
||||
}
|
||||
|
||||
public static void DisallowFeature(Features feature)
|
||||
{
|
||||
SetDisallowed(feature, true);
|
||||
}
|
||||
|
||||
public static void AllowFeature(Features feature)
|
||||
{
|
||||
SetDisallowed(feature, false);
|
||||
}
|
||||
|
||||
public static void SetDisallowed(Features feature, bool value)
|
||||
{
|
||||
if (value)
|
||||
{
|
||||
DisallowedFeatures |= feature;
|
||||
}
|
||||
else
|
||||
{
|
||||
DisallowedFeatures &= ~feature;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class Negotiator
|
||||
{
|
||||
private static readonly Dictionary<Mobile, Timer> _Dictionary = new Dictionary<Mobile, Timer>();
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
if (!Settings.Enabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
EventSink.Login += e =>
|
||||
{
|
||||
Mobile m = e.Mobile;
|
||||
NetState ns = m.NetState;
|
||||
|
||||
if (m == null || ns == null || !ns.Running || ns.IsEnhancedClient)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m.Send(new BeginHandshake());
|
||||
|
||||
if (_Dictionary.ContainsKey(m))
|
||||
{
|
||||
Timer t = _Dictionary[m];
|
||||
|
||||
if (t != null && t.Running)
|
||||
{
|
||||
t.Stop();
|
||||
}
|
||||
}
|
||||
|
||||
_Dictionary[m] = Timer.DelayCall(Settings.HandshakeTimeout, OnHandshakeTimeout, m);
|
||||
};
|
||||
|
||||
ProtocolExtensions.Register(
|
||||
0xFF,
|
||||
true,
|
||||
(state, pvSrc) =>
|
||||
{
|
||||
pvSrc.Trace(state);
|
||||
|
||||
if (state == null || state.Mobile == null || !state.Running)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Mobile m = state.Mobile;
|
||||
|
||||
if (!_Dictionary.ContainsKey(m))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Timer t = _Dictionary[m];
|
||||
|
||||
if (t != null)
|
||||
{
|
||||
t.Stop();
|
||||
}
|
||||
|
||||
_Dictionary.Remove(m);
|
||||
});
|
||||
}
|
||||
|
||||
private static void OnHandshakeResponse(NetState state, PacketReader pvSrc)
|
||||
{
|
||||
pvSrc.Trace(state);
|
||||
|
||||
if (state == null || state.Mobile == null || !state.Running)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Mobile m = state.Mobile;
|
||||
|
||||
if (!_Dictionary.ContainsKey(m))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Timer t = _Dictionary[m];
|
||||
|
||||
if (t != null)
|
||||
{
|
||||
t.Stop();
|
||||
}
|
||||
|
||||
_Dictionary.Remove(m);
|
||||
}
|
||||
|
||||
private static void OnHandshakeTimeout(object state)
|
||||
{
|
||||
Mobile m = state as Mobile;
|
||||
|
||||
if (m == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Timer t;
|
||||
|
||||
if (_Dictionary.TryGetValue(m, out t) && t != null)
|
||||
{
|
||||
t.Stop();
|
||||
}
|
||||
|
||||
_Dictionary.Remove(m);
|
||||
|
||||
if (!Settings.KickOnFailure)
|
||||
{
|
||||
Console.WriteLine("Player '{0}' failed to negotiate features.", m);
|
||||
}
|
||||
else if (m.NetState != null && m.NetState.Running)
|
||||
{
|
||||
m.SendGump(new WarningGump(1060635, 30720, Settings.WarningMessage, 0xFFC000, 420, 250, null, null));
|
||||
|
||||
if (m.AccessLevel <= AccessLevel.Player)
|
||||
{
|
||||
_Dictionary[m] = Timer.DelayCall(Settings.DisconnectDelay, OnForceDisconnect, m);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void OnForceDisconnect(object state)
|
||||
{
|
||||
if (!(state is Mobile))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Mobile m = (Mobile)state;
|
||||
|
||||
if (m.NetState != null && m.NetState.Running)
|
||||
{
|
||||
m.NetState.Dispose();
|
||||
}
|
||||
|
||||
_Dictionary.Remove(m);
|
||||
|
||||
Console.WriteLine("Player {0} kicked (Failed assistant handshake)", m);
|
||||
}
|
||||
|
||||
private sealed class BeginHandshake : ProtocolExtension
|
||||
{
|
||||
public BeginHandshake()
|
||||
: base(0xFE, 8)
|
||||
{
|
||||
m_Stream.Write((uint)((ulong)Settings.DisallowedFeatures >> 32));
|
||||
m_Stream.Write((uint)((ulong)Settings.DisallowedFeatures & 0xFFFFFFFF));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
[Flipable(0x9C14, 0x9C15)]
|
||||
public class Anniversary21Card : Item
|
||||
{
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public string Args { get; set; }
|
||||
|
||||
private string[] _Staff = new string[] { Server.Misc.ServerList.ServerName };
|
||||
|
||||
[Constructable]
|
||||
public Anniversary21Card()
|
||||
: this(null)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public Anniversary21Card(Mobile m) : base(0x9C14)
|
||||
{
|
||||
Hue = 85;
|
||||
|
||||
Args = String.Format("{0}\t{1}", _Staff[Utility.Random(_Staff.Length)], m != null ? m.Name : "you");
|
||||
}
|
||||
|
||||
public override void AddNameProperty(ObjectPropertyList list)
|
||||
{
|
||||
list.Add(1156145, Args); // A Personally Written Anniversary Card from ~1_name~ to ~2_name~
|
||||
|
||||
list.Add(1062613, "#1158486");
|
||||
}
|
||||
|
||||
public Anniversary21Card(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
writer.Write( (int) 0 ); // version
|
||||
|
||||
writer.Write(Args);
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
int version = reader.ReadInt();
|
||||
|
||||
Args = reader.ReadString();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
using System;
|
||||
using Server;
|
||||
using Server.Gumps;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class Anniversary21GiftToken : Item, IRewardOption
|
||||
{
|
||||
public override int LabelNumber { get { return 1158485; } } // 21st Anniversary Gift Token
|
||||
|
||||
[Constructable]
|
||||
public Anniversary21GiftToken()
|
||||
: base(19398)
|
||||
{
|
||||
Hue = 2113;
|
||||
LootType = LootType.Blessed;
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (IsChildOf(from.Backpack))
|
||||
{
|
||||
from.CloseGump(typeof(RewardOptionGump));
|
||||
from.SendGump(new RewardOptionGump(this, 1156888));
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(1062334); // This item must be in your backpack to be used.
|
||||
}
|
||||
}
|
||||
|
||||
public void GetOptions(RewardOptionList list)
|
||||
{
|
||||
list.Add(1, 1158479); // Brass Orrery
|
||||
list.Add(2, 1158480); // Brass Telescope
|
||||
}
|
||||
|
||||
|
||||
public void OnOptionSelected(Mobile from, int choice)
|
||||
{
|
||||
var bag = new Bag();
|
||||
bag.Hue = 2720;
|
||||
|
||||
switch(choice)
|
||||
{
|
||||
default:
|
||||
bag.Delete();
|
||||
break;
|
||||
case 1:
|
||||
bag.DropItem(new BrassOrrery());
|
||||
from.AddToBackpack(bag); Delete();
|
||||
break;
|
||||
case 2:
|
||||
bag.DropItem(new PersonalTelescope());
|
||||
from.AddToBackpack(bag);
|
||||
Delete(); break;
|
||||
}
|
||||
}
|
||||
|
||||
public Anniversary21GiftToken(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class AnniversaryBag21st : Backpack
|
||||
{
|
||||
public override int LabelNumber { get { return 1158481; } } // 21st Anniversary Gift Bag
|
||||
|
||||
[Constructable]
|
||||
public AnniversaryBag21st(Mobile m)
|
||||
{
|
||||
Hue = 1151;
|
||||
DropItem(new Anniversary21GiftToken());
|
||||
DropItem(new Anniversary21Card(m));
|
||||
}
|
||||
|
||||
public AnniversaryBag21st(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
33
Scripts/Services/Astronomy/21st Anniversary Gifts/Giver.cs
Normal file
33
Scripts/Services/Astronomy/21st Anniversary Gifts/Giver.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using Server;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.Misc
|
||||
{
|
||||
public class AnniversaryGiver21st : GiftGiver
|
||||
{
|
||||
public static void Initialize()
|
||||
{
|
||||
GiftGiving.Register(new AnniversaryGiver21st());
|
||||
}
|
||||
|
||||
public override DateTime Start { get { return new DateTime(2019, 4, 05); } }
|
||||
public override DateTime Finish { get { return new DateTime(2019, 5, 31); } }
|
||||
public override TimeSpan MinimumAge { get { return TimeSpan.FromHours(12); } }
|
||||
|
||||
public override void GiveGift(Mobile mob)
|
||||
{
|
||||
var bag = new AnniversaryBag21st(mob);
|
||||
|
||||
switch (GiveGift(mob, bag))
|
||||
{
|
||||
case GiftResult.Backpack:
|
||||
mob.SendLocalizedMessage(1158482); // Happy 21st Anniversary! We have placed a gift for you in your backpack.
|
||||
break;
|
||||
case GiftResult.BankBox:
|
||||
mob.SendLocalizedMessage(1158483); // Happy 21st Anniversary! We have placed a gift for you in your bank box.
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
30
Scripts/Services/Astronomy/AstronomerTitleDeed.cs
Normal file
30
Scripts/Services/Astronomy/AstronomerTitleDeed.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class AstronomerTitleDeed : BaseRewardTitleDeed
|
||||
{
|
||||
public override TextDefinition Title { get { return 1158523; } } // Astronomer
|
||||
|
||||
public AstronomerTitleDeed()
|
||||
{
|
||||
}
|
||||
|
||||
public AstronomerTitleDeed(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write(0);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
263
Scripts/Services/Astronomy/AstronomySystem.cs
Normal file
263
Scripts/Services/Astronomy/AstronomySystem.cs
Normal file
@@ -0,0 +1,263 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.IO;
|
||||
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.Engines.Astronomy
|
||||
{
|
||||
public enum TimeCoordinate
|
||||
{
|
||||
FiveToEight,
|
||||
NineToEleven,
|
||||
Midnight,
|
||||
OneToFour,
|
||||
Day
|
||||
}
|
||||
|
||||
public static class AstronomySystem
|
||||
{
|
||||
public static bool Enabled = Core.EJ;
|
||||
public static string FilePath = Path.Combine("Saves/Misc", "Astronomy.bin");
|
||||
|
||||
public static readonly int MaxConstellations = 1000;
|
||||
public static readonly int MaxRA = 24; // zero based 0 - 24, 1 per increment
|
||||
public static readonly double MaxDEC = 90; // zero based 0 - 90, 0.2 per increment
|
||||
|
||||
// testing only. THis needs to be deleted prior to going live.
|
||||
//public static TimeCoordinate ForceTimeCoordinate { get { return PersonalTelescope.ForceTimeCoordinate; } }
|
||||
|
||||
public static int LoadedConstellations { get; set; }
|
||||
public static List<ConstellationInfo> Constellations { get; set; }
|
||||
public static List<Tuple<int, int>> InterstellarObjects { get; set; }
|
||||
|
||||
public static List<int> DiscoveredConstellations { get; set; }
|
||||
|
||||
public static void Configure()
|
||||
{
|
||||
if (Enabled)
|
||||
{
|
||||
EventSink.WorldSave += OnSave;
|
||||
EventSink.WorldLoad += OnLoad;
|
||||
|
||||
Constellations = new List<ConstellationInfo>();
|
||||
InterstellarObjects = new List<Tuple<int, int>>();
|
||||
DiscoveredConstellations = new List<int>();
|
||||
|
||||
// comets
|
||||
for (int i = 0x68D; i <= 0x693; i++)
|
||||
{
|
||||
InterstellarObjects.Add(new Tuple<int, int>(i, 1158514));
|
||||
}
|
||||
|
||||
// felucca
|
||||
for (int i = 0x69F; i <= 0x6A6; i++)
|
||||
{
|
||||
InterstellarObjects.Add(new Tuple<int, int>(i, 1158734));
|
||||
}
|
||||
|
||||
// trammel
|
||||
for (int i = 0x6A7; i <= 0x6AE; i++)
|
||||
{
|
||||
InterstellarObjects.Add(new Tuple<int, int>(i, 1158735));
|
||||
}
|
||||
|
||||
// galaxy
|
||||
for (int i = 0x6AF; i <= 0x6BC; i++)
|
||||
{
|
||||
InterstellarObjects.Add(new Tuple<int, int>(i, 1158736));
|
||||
}
|
||||
|
||||
// planet
|
||||
for (int i = 0x6BD; i <= 0x6CD; i++)
|
||||
{
|
||||
InterstellarObjects.Add(new Tuple<int, int>(i, 1158737));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
if (Enabled && LoadedConstellations < MaxConstellations)
|
||||
{
|
||||
CreateConstellations(MaxConstellations - LoadedConstellations);
|
||||
}
|
||||
}
|
||||
|
||||
private static void CreateConstellations(int amount)
|
||||
{
|
||||
var next = TimeCoordinate.FiveToEight;
|
||||
|
||||
if (LoadedConstellations > 0)
|
||||
{
|
||||
if (Constellations.Where(c => c.TimeCoordinate == TimeCoordinate.FiveToEight).Count() > Constellations.Where(c => c.TimeCoordinate == TimeCoordinate.NineToEleven).Count())
|
||||
next = TimeCoordinate.NineToEleven;
|
||||
else if (Constellations.Where(c => c.TimeCoordinate == TimeCoordinate.NineToEleven).Count() > Constellations.Where(c => c.TimeCoordinate == TimeCoordinate.Midnight).Count())
|
||||
next = TimeCoordinate.Midnight;
|
||||
else if (Constellations.Where(c => c.TimeCoordinate == TimeCoordinate.Midnight).Count() > Constellations.Where(c => c.TimeCoordinate == TimeCoordinate.OneToFour).Count())
|
||||
next = TimeCoordinate.OneToFour;
|
||||
}
|
||||
|
||||
for (int i = 0; i < amount; i++)
|
||||
{
|
||||
int ra = 0;
|
||||
double dec = 0.0;
|
||||
|
||||
do
|
||||
{
|
||||
ra = Utility.RandomMinMax(0, MaxRA);
|
||||
dec = Utility.RandomMinMax(0, (int)MaxDEC) + Utility.RandomList(.2, .4, .6, .8, .0);
|
||||
}
|
||||
while (CheckExists(next, ra, dec));
|
||||
|
||||
var info = new ConstellationInfo(next, ra, dec, ConstellationInfo.RandomStarPositions());
|
||||
Constellations.Add(info);
|
||||
|
||||
info.Identifier = Constellations.Count - 1;
|
||||
|
||||
switch (next)
|
||||
{
|
||||
case TimeCoordinate.FiveToEight: next = TimeCoordinate.NineToEleven; break;
|
||||
case TimeCoordinate.NineToEleven: next = TimeCoordinate.Midnight; break;
|
||||
case TimeCoordinate.Midnight: next = TimeCoordinate.OneToFour; break;
|
||||
case TimeCoordinate.OneToFour: next = TimeCoordinate.FiveToEight; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void ResetConstellations()
|
||||
{
|
||||
ColUtility.Free(Constellations);
|
||||
LoadedConstellations = 0;
|
||||
|
||||
CreateConstellations(MaxConstellations);
|
||||
Console.WriteLine("Reset Constellations!");
|
||||
}
|
||||
|
||||
public static ConstellationInfo GetConstellation(int id)
|
||||
{
|
||||
return Constellations.FirstOrDefault(info => info.Identifier == id);
|
||||
}
|
||||
|
||||
public static ConstellationInfo GetConstellation(TimeCoordinate p, int ra, double dec)
|
||||
{
|
||||
return Constellations.FirstOrDefault(c => c.TimeCoordinate == p && c.CoordRA == ra && c.CoordDEC == dec);
|
||||
}
|
||||
|
||||
private static bool CheckExists(TimeCoordinate p, int ra, double dec)
|
||||
{
|
||||
return Constellations.Any(c => c.TimeCoordinate == p && c.CoordRA == ra && c.CoordDEC == dec);
|
||||
}
|
||||
|
||||
public static bool CheckNameExists(string name)
|
||||
{
|
||||
return Constellations.Any(c => !String.IsNullOrEmpty(c.Name) && c.Name.ToLower() == name.ToLower());
|
||||
}
|
||||
|
||||
public static TimeCoordinate GetTimeCoordinate(IEntity e)
|
||||
{
|
||||
int minutes, hours, totalMinutes;
|
||||
|
||||
Clock.GetTime(e.Map, e.X, e.Y, out hours, out minutes, out totalMinutes);
|
||||
|
||||
if (hours >= 17 && hours < 21)
|
||||
{
|
||||
return TimeCoordinate.FiveToEight;
|
||||
}
|
||||
|
||||
if (hours >= 21 && hours < 24)
|
||||
{
|
||||
return TimeCoordinate.NineToEleven;
|
||||
}
|
||||
|
||||
if ((hours >= 24 && hours < 1) || hours == 0)
|
||||
{
|
||||
return TimeCoordinate.Midnight;
|
||||
}
|
||||
|
||||
if (hours >= 1 && hours <= 4)
|
||||
{
|
||||
return TimeCoordinate.OneToFour;
|
||||
}
|
||||
|
||||
return TimeCoordinate.Day;
|
||||
}
|
||||
|
||||
public static int RandomSkyImage(Mobile m)
|
||||
{
|
||||
return RandomSkyImage(GetTimeCoordinate(m));
|
||||
}
|
||||
|
||||
public static int RandomSkyImage(TimeCoordinate TimeCoordinate)
|
||||
{
|
||||
switch (TimeCoordinate)
|
||||
{
|
||||
default: return 0x67E;
|
||||
case TimeCoordinate.FiveToEight: return 0x67F;
|
||||
case TimeCoordinate.NineToEleven: return Utility.RandomMinMax(0x680, 0x682);
|
||||
case TimeCoordinate.Midnight: return 0x686;
|
||||
case TimeCoordinate.OneToFour: return Utility.RandomMinMax(0x683, 0x685);
|
||||
}
|
||||
}
|
||||
|
||||
public static Tuple<int, int> GetRandomInterstellarObject()
|
||||
{
|
||||
return InterstellarObjects[Utility.Random(InterstellarObjects.Count)];
|
||||
}
|
||||
|
||||
public static int TimeCoordinateLocalization(TimeCoordinate TimeCoordinate)
|
||||
{
|
||||
switch (TimeCoordinate)
|
||||
{
|
||||
default:
|
||||
case TimeCoordinate.FiveToEight: return 1158506;
|
||||
case TimeCoordinate.NineToEleven: return 1158507;
|
||||
case TimeCoordinate.Midnight: return 1158508;
|
||||
case TimeCoordinate.OneToFour: return 1158509;
|
||||
}
|
||||
}
|
||||
|
||||
public static void AddDiscovery(ConstellationInfo info)
|
||||
{
|
||||
if (!DiscoveredConstellations.Contains(info.Identifier))
|
||||
{
|
||||
DiscoveredConstellations.Add(info.Identifier);
|
||||
}
|
||||
}
|
||||
|
||||
public static void OnSave(WorldSaveEventArgs e)
|
||||
{
|
||||
Persistence.Serialize(
|
||||
FilePath,
|
||||
writer =>
|
||||
{
|
||||
writer.Write(0);
|
||||
|
||||
writer.Write(Constellations.Count);
|
||||
|
||||
foreach (var info in Constellations)
|
||||
{
|
||||
info.Serialize(writer);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void OnLoad()
|
||||
{
|
||||
Persistence.Deserialize(
|
||||
FilePath,
|
||||
reader =>
|
||||
{
|
||||
reader.ReadInt();
|
||||
|
||||
LoadedConstellations = reader.ReadInt();
|
||||
|
||||
for (int i = 0; i < LoadedConstellations; i++)
|
||||
{
|
||||
Constellations.Add(new ConstellationInfo(reader));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
63
Scripts/Services/Astronomy/BrassOrrery.cs
Normal file
63
Scripts/Services/Astronomy/BrassOrrery.cs
Normal file
@@ -0,0 +1,63 @@
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class BrassOrrery : Item
|
||||
{
|
||||
public override int LabelNumber { get { return 1125363; } } // orrery
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public bool Active { get; set; }
|
||||
|
||||
[Constructable]
|
||||
public BrassOrrery()
|
||||
: base(0xA17C)
|
||||
{
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile m)
|
||||
{
|
||||
if (m.InRange(GetWorldLocation(), 2))
|
||||
{
|
||||
ToggleActivation(m);
|
||||
}
|
||||
}
|
||||
|
||||
public void ToggleActivation(Mobile m)
|
||||
{
|
||||
if (Active)
|
||||
{
|
||||
ItemID = 0xA17C;
|
||||
m.PlaySound(0x1E2);
|
||||
|
||||
Active = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
ItemID = 0xA17B;
|
||||
m.PlaySound(480);
|
||||
|
||||
Active = true;
|
||||
}
|
||||
}
|
||||
|
||||
public BrassOrrery(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write(0);
|
||||
writer.Write(Active);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadInt();
|
||||
Active = reader.ReadBool();
|
||||
}
|
||||
}
|
||||
}
|
||||
135
Scripts/Services/Astronomy/ConstellationInfo.cs
Normal file
135
Scripts/Services/Astronomy/ConstellationInfo.cs
Normal file
@@ -0,0 +1,135 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
using Server;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Engines.Astronomy
|
||||
{
|
||||
[PropertyObject]
|
||||
public class ConstellationInfo
|
||||
{
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int Identifier { get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public TimeCoordinate TimeCoordinate { get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int CoordRA { get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public double CoordDEC { get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public string Name { get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public Mobile DiscoveredBy { get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public DateTime DiscoveredOn { get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public bool HasBeenDiscovered { get { return DiscoveredOn != DateTime.MinValue; } }
|
||||
|
||||
public StarPosition[] StarPositions { get; set; }
|
||||
|
||||
public ConstellationInfo(TimeCoordinate p, int coordRA, double coordDEC, StarPosition[] starInfo)
|
||||
{
|
||||
TimeCoordinate = p;
|
||||
CoordRA = coordRA;
|
||||
CoordDEC = coordDEC;
|
||||
StarPositions = starInfo;
|
||||
|
||||
Identifier = -1;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return "...";
|
||||
}
|
||||
|
||||
public static StarPosition[] RandomStarPositions()
|
||||
{
|
||||
int amount = Utility.RandomMinMax(4, 7);
|
||||
var positions = new StarPosition[amount];
|
||||
|
||||
for(int i = 0; i < amount; i++)
|
||||
{
|
||||
StarPosition star = new StarPosition();
|
||||
|
||||
star.ImageID = Utility.RandomMinMax(0x668, 0x67D);
|
||||
star.X = Utility.RandomMinMax(180, 450);
|
||||
star.Y = Utility.RandomMinMax(150, 400);
|
||||
|
||||
positions[i] = star;
|
||||
}
|
||||
|
||||
return positions;
|
||||
}
|
||||
|
||||
public struct StarPosition
|
||||
{
|
||||
public int ImageID { get; set; }
|
||||
public int X { get; set; }
|
||||
public int Y { get; set; }
|
||||
}
|
||||
|
||||
public ConstellationInfo(GenericReader reader)
|
||||
{
|
||||
reader.ReadInt();
|
||||
|
||||
Identifier = reader.ReadInt();
|
||||
TimeCoordinate = (TimeCoordinate)reader.ReadInt();
|
||||
|
||||
Name = reader.ReadString();
|
||||
DiscoveredBy = reader.ReadMobile();
|
||||
DiscoveredOn = reader.ReadDateTime();
|
||||
CoordRA = reader.ReadInt();
|
||||
CoordDEC = reader.ReadDouble();
|
||||
|
||||
var count = reader.ReadInt();
|
||||
StarPositions = new StarPosition[count];
|
||||
|
||||
for(int i = 0; i < count; i++)
|
||||
{
|
||||
StarPosition pos = new StarPosition();
|
||||
|
||||
pos.ImageID = reader.ReadInt();
|
||||
pos.X = reader.ReadInt();
|
||||
pos.Y = reader.ReadInt();
|
||||
|
||||
StarPositions[i] = pos;
|
||||
}
|
||||
|
||||
if (HasBeenDiscovered)
|
||||
{
|
||||
AstronomySystem.AddDiscovery(this);
|
||||
}
|
||||
}
|
||||
|
||||
public void Serialize(GenericWriter writer)
|
||||
{
|
||||
writer.Write(0);
|
||||
|
||||
writer.Write(Identifier);
|
||||
writer.Write((int)TimeCoordinate);
|
||||
writer.Write(Name);
|
||||
writer.Write(DiscoveredBy);
|
||||
writer.Write(DiscoveredOn);
|
||||
writer.Write(CoordRA);
|
||||
writer.Write(CoordDEC);
|
||||
|
||||
writer.Write(StarPositions.Length);
|
||||
|
||||
foreach(var pos in StarPositions)
|
||||
{
|
||||
writer.Write(pos.ImageID);
|
||||
writer.Write(pos.X);
|
||||
writer.Write(pos.Y);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
122
Scripts/Services/Astronomy/ConstellationLedger.cs
Normal file
122
Scripts/Services/Astronomy/ConstellationLedger.cs
Normal file
@@ -0,0 +1,122 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
using Server;
|
||||
using Server.Items;
|
||||
using Server.Gumps;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Engines.Astronomy
|
||||
{
|
||||
public class ConstellationLedger : Item
|
||||
{
|
||||
public override int LabelNumber { get { return 1158520; } } // Constellation Ledger
|
||||
|
||||
[Constructable]
|
||||
public ConstellationLedger()
|
||||
: base(0xFF4)
|
||||
{
|
||||
Movable = false;
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile m)
|
||||
{
|
||||
if (m is PlayerMobile && m.InRange(GetWorldLocation(), 3))
|
||||
{
|
||||
BaseGump.SendGump(new ConstellationLedgerGump((PlayerMobile)m));
|
||||
}
|
||||
}
|
||||
|
||||
public class ConstellationLedgerGump : BaseGump
|
||||
{
|
||||
public int Page { get; set; }
|
||||
|
||||
public int Pages { get { return (int)Math.Ceiling((double)AstronomySystem.DiscoveredConstellations.Count / 20.0); } }
|
||||
|
||||
public ConstellationLedgerGump(PlayerMobile pm)
|
||||
: base(pm, 100, 100)
|
||||
{
|
||||
Page = 0;
|
||||
}
|
||||
|
||||
public override void AddGumpLayout()
|
||||
{
|
||||
AddPage(0);
|
||||
|
||||
AddBackground(0, 0, 820, 620, 0x2454);
|
||||
AddHtmlLocalized(10, 28, 800, 18, 1114513, "#1158520", 0x0, false, false); // Constellation Ledger
|
||||
AddHtmlLocalized(295, 55, 515, 36, 1158521, String.Format("{0}\t{1}", AstronomySystem.DiscoveredConstellations.Count, AstronomySystem.MaxConstellations), 0x0, false, false); // Constellations Discovered: ~1_VAL~ / ~2_VAL~
|
||||
|
||||
AddHtmlLocalized(55, 100, 100, 36, 1114513, "#1158522", 0x0, false, false); // Constellation Name
|
||||
AddHtmlLocalized(245, 100, 80, 36, 1114513, "#1158523", 0x0, false, false); // Astronomer
|
||||
AddHtmlLocalized(375, 100, 80, 36, 1114513, "#1158524", 0x0, false, false); // Discovery Date
|
||||
AddHtmlLocalized(505, 100, 80, 36, 1114513, "#1158525", 0x0, false, false); // Night Period
|
||||
AddHtmlLocalized(635, 100, 80, 36, 1114513, "#1158526", 0x0, false, false); // Coordinates
|
||||
|
||||
int start = Page * 20;
|
||||
int y = 145;
|
||||
|
||||
for (int i = start; i < AstronomySystem.DiscoveredConstellations.Count && i <= start + 20; i++)
|
||||
{
|
||||
var info = AstronomySystem.GetConstellation(AstronomySystem.DiscoveredConstellations[i]);
|
||||
|
||||
AddHtml(15, y, 200, 18, Color("#0040FF", info.Name), false, false);
|
||||
AddHtml(240, y, 112, 18, Color("#0040FF", info.DiscoveredBy != null ? info.DiscoveredBy.Name : "Unknown"), false, false);
|
||||
AddHtml(380, y, 112, 18, Color("#0040FF", info.DiscoveredOn.ToShortDateString()), false, false);
|
||||
AddHtmlLocalized(492, y, 130, 18, AstronomySystem.TimeCoordinateLocalization(info.TimeCoordinate), 0x1F, false, false);
|
||||
AddHtmlLocalized(632, y, 150, 18, 1158527, String.Format("{0}\t{1}", info.CoordRA, info.CoordDEC), 0x1F, false, false); // RA ~1_VAL~ DEC ~2_VAL~
|
||||
|
||||
y += 18;
|
||||
}
|
||||
|
||||
AddButton(340, 540, 0x605, 0x606, 1, GumpButtonType.Reply, 0);
|
||||
AddButton(370, 540, 0x609, 0x60A, 2, GumpButtonType.Reply, 0);
|
||||
AddButton(460, 540, 0x607, 0x608, 3, GumpButtonType.Reply, 0);
|
||||
AddButton(484, 540, 0x603, 0x604, 4, GumpButtonType.Reply, 0);
|
||||
|
||||
AddLabel(415, 570, 0, String.Format("{0}/{1}", Page + 1, Pages.ToString()));
|
||||
}
|
||||
|
||||
public override void OnResponse(RelayInfo info)
|
||||
{
|
||||
switch (info.ButtonID)
|
||||
{
|
||||
case 0:
|
||||
return;
|
||||
case 1:
|
||||
Page = 0;
|
||||
break;
|
||||
case 2:
|
||||
Page = Math.Max(0, Page - 1);
|
||||
break;
|
||||
case 3:
|
||||
Page = Math.Min(Page + 1, Math.Max(0, Pages - 1));
|
||||
break;
|
||||
case 4:
|
||||
Page = Math.Max(0, Pages - 1);
|
||||
break;
|
||||
}
|
||||
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
public ConstellationLedger(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write(0);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
73
Scripts/Services/Astronomy/PrimerOnBritannianAstronomy.cs
Normal file
73
Scripts/Services/Astronomy/PrimerOnBritannianAstronomy.cs
Normal file
@@ -0,0 +1,73 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
using Server;
|
||||
using Server.Items;
|
||||
using Server.Gumps;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Engines.Astronomy
|
||||
{
|
||||
public class PrimerOnBritannianAstronomy : Item
|
||||
{
|
||||
public override int LabelNumber { get { return 1158515; } } // Looking to the Heavens: A Primer on Britannian Astronomy
|
||||
|
||||
[Constructable]
|
||||
public PrimerOnBritannianAstronomy()
|
||||
: base(0xFF0)
|
||||
{
|
||||
Hue = 298;
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile m)
|
||||
{
|
||||
if (m is PlayerMobile && m.InRange(GetWorldLocation(), 3))
|
||||
{
|
||||
var gump = new Gump(100, 100);
|
||||
gump.AddImage(0, 0, 0x761C);
|
||||
gump.AddImage(95, 40, 0x69E);
|
||||
gump.AddHtmlLocalized(115, 200, 350, 400, 1158516, "#1158516", 0x1, false, true);
|
||||
/*The study of Britannian astronomy dates back to the appearances of strangers from offwordly realms. When it was learned that
|
||||
* Sosaria exists within a much larger universe, curiosity tilted our heads upwards towards the sky. Before long skilled tinkers
|
||||
* granted the ability to see objects at great distance became a reality - enter the telescope. While the most impressive example
|
||||
* of these contraptions is the one located in Moonglow at 43o 52'N, 122o 4'W, where I have chosen to spend my time deep in
|
||||
* research, recent developments in miniaturization have brought the size of these instruments within the grasp of the casual
|
||||
* observer.<br><br>Using a telescope may appear quite simple, but one would be naive to think there is no more beyond haphazardly
|
||||
* pointing towards the sky to make observations!<br><br>The best viewing hours are during the night between the hours of 5pm
|
||||
* and 4am. Any standard clock is an essential tool in mapping the night sky!<br><br>While there are a variety of objects in the
|
||||
* night sky to observe if one points their telescope at the object as it traverses space, the real search is for constellations
|
||||
* - a unique collection of several stars.<br><br>Constellations appear at various periods during the night. Constellations can
|
||||
* be seen during the early evening (5pm-8pm), late at night (9pm-11pm), midnight (12am), or the middle of the night (1am-4am).
|
||||
* After 4am daylight will drown out any attempt at making meaningful observations.<br><br>Constellations can be observed in
|
||||
* these time periods based on their location in the night sky. Britannian astronomers have adopted a coordinate system that
|
||||
* uses right ascension (RA) and declination (DEC) to pinpoint a constellation's location during night time periods.<br><br>RA
|
||||
* can be measured from 0-24 and DEC can be measured from 0-90. Current Telescopes are capable of resolving increments of 1 hour
|
||||
* of RA and 0.2 degrees of DEC.<br><br>When a time period has been selected and the RA and DEC have been set one need only
|
||||
* initiate a switch conveniently located in the viewfinder, to check that section of the sky! Should you be lucky enough to
|
||||
* see a constellation a standard mapmaking pen can be used to create a star chart. As the potential discoverer of a new
|
||||
* constellation you have the opportunity to name and submit your discovery to the Britannian Astronomical Society, of whom
|
||||
* this author is primary registrar, for documentation.<br><br>Happy skywatching!*/
|
||||
|
||||
m.SendGump(gump);
|
||||
}
|
||||
}
|
||||
|
||||
public PrimerOnBritannianAstronomy(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write(0);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
217
Scripts/Services/Astronomy/StarChart.cs
Normal file
217
Scripts/Services/Astronomy/StarChart.cs
Normal file
@@ -0,0 +1,217 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
using Server;
|
||||
using Server.Mobiles;
|
||||
using Server.Engines.Astronomy;
|
||||
using Server.Targeting;
|
||||
using Server.Engines.Craft;
|
||||
using Server.Gumps;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
[Flipable(0xA1E4, 0xA1E5)]
|
||||
public class StarChart : Item, ICraftable
|
||||
{
|
||||
private int _Constellation;
|
||||
private string _Name;
|
||||
private Mobile _ChartedBy;
|
||||
private DateTime _ChartedOn;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int Constellation
|
||||
{
|
||||
get { return _Constellation; }
|
||||
set
|
||||
{
|
||||
_Constellation = value;
|
||||
|
||||
if (_Constellation < 0)
|
||||
{
|
||||
Hue = 2500;
|
||||
}
|
||||
else
|
||||
{
|
||||
Hue = 0;
|
||||
}
|
||||
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public string ConstellationName { get { return _Name; } set { _Name = value; InvalidateProperties(); } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public Mobile ChartedBy { get { return _ChartedBy; } set { _ChartedBy = value; InvalidateProperties(); } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public DateTime ChartedOn { get { return _ChartedOn; } set { _ChartedOn = value; } }
|
||||
|
||||
public override int LabelNumber { get { return _Constellation == -1 ? 1158743 : 1158493; } } // An Indecipherable Star Chart : Star Chart
|
||||
|
||||
[Constructable]
|
||||
public StarChart()
|
||||
: base(0xA1E4)
|
||||
{
|
||||
_Constellation = -1;
|
||||
Hue = 2500;
|
||||
}
|
||||
|
||||
public int OnCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, ITool tool, CraftItem craftItem, int resHue)
|
||||
{
|
||||
Timer.DelayCall(() => SendTarget(from));
|
||||
|
||||
return quality;
|
||||
}
|
||||
|
||||
public void SendTarget(Mobile m)
|
||||
{
|
||||
m.SendLocalizedMessage(1158494); // Which telescope do you wish to create the star chart from?
|
||||
m.BeginTarget(10, false, TargetFlags.None, (from, targeted) =>
|
||||
{
|
||||
if (!Deleted && IsChildOf(from.Backpack) && targeted is PersonalTelescope)
|
||||
{
|
||||
var tele = (PersonalTelescope)targeted;
|
||||
|
||||
var constellation = AstronomySystem.GetConstellation(tele.TimeCoordinate, tele.RA, tele.DEC);
|
||||
|
||||
if (constellation != null)
|
||||
{
|
||||
from.SendLocalizedMessage(1158496); // You successfully map the time-coordinate of the constellation.
|
||||
|
||||
ChartedBy = from;
|
||||
ChartedOn = DateTime.Now;
|
||||
Constellation = constellation.Identifier;
|
||||
from.PlaySound(0x249);
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(1158495); // There is nothing to chart at these coordinates at this time.
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile m)
|
||||
{
|
||||
if (m is PlayerMobile && IsChildOf(m.Backpack) && _Constellation > -1)
|
||||
{
|
||||
BaseGump.SendGump(new InternalGump((PlayerMobile)m, this));
|
||||
}
|
||||
}
|
||||
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
if (_Constellation > -1)
|
||||
{
|
||||
if (_ChartedBy != null)
|
||||
{
|
||||
list.Add(1158500, _ChartedBy.Name); // Charted By: ~1_NAME~
|
||||
}
|
||||
|
||||
list.Add(1158501, _Name ?? "A Constellation With No Name"); // TODO: Get if null
|
||||
}
|
||||
}
|
||||
|
||||
public class InternalGump : BaseGump
|
||||
{
|
||||
public StarChart Chart { get; set; }
|
||||
|
||||
public InternalGump(PlayerMobile pm, StarChart chart)
|
||||
: base(pm, 50, 50)
|
||||
{
|
||||
pm.CloseGump(typeof(InternalGump));
|
||||
|
||||
Chart = chart;
|
||||
}
|
||||
|
||||
public override void AddGumpLayout()
|
||||
{
|
||||
var info = AstronomySystem.GetConstellation(Chart.Constellation);
|
||||
|
||||
AddPage(0);
|
||||
|
||||
AddBackground(0, 0, 454, 350, 0x24AE);
|
||||
AddHtmlLocalized(32, 68, 112, 36, 1158505, false, false); // Constellation Name:
|
||||
AddHtml(154, 68, 300, 36, Color("#0040FF", String.IsNullOrEmpty(Chart.ConstellationName) ? "This constellation has not yet been named" : Chart.ConstellationName), false, false);
|
||||
|
||||
AddHtmlLocalized(32, 104, 75, 36, 1158502, false, false); // Charted By:
|
||||
AddHtml(112, 104, 50, 36, Color("#0040FF", Chart.ChartedBy == null ? String.Empty : Chart.ChartedBy.Name), false, false);
|
||||
|
||||
AddHtmlLocalized(32, 140, 75, 36, 1158503, false, false); // Charted On:
|
||||
AddHtml(112, 140, 80, 36, Color("#0040FF", Chart.ChartedOn.ToShortDateString()), false, false);
|
||||
|
||||
AddHtmlLocalized(32, 176, 125, 18, 1158504, false, false); // Time-Coordinate:
|
||||
AddHtmlLocalized(47, 199, 60, 36, AstronomySystem.TimeCoordinateLocalization(info.TimeCoordinate), 0x1F, false, false);
|
||||
|
||||
AddHtmlLocalized(157, 199, 20, 36, 1158489, false, false); // RA
|
||||
AddHtml(182, 199, 20, 36, Color("#0040FF", info.CoordRA.ToString()), false, false);
|
||||
|
||||
AddHtmlLocalized(242, 199, 25, 36, 1158490, false, false); // DEC
|
||||
AddHtml(272, 199, 50, 36, Color("#0040FF", info.CoordDEC.ToString()), false, false);
|
||||
|
||||
AddBackground(32, 253, 343, 22, 0x2486);
|
||||
AddTextEntry(34, 255, 339, 18, 0, 1, String.Empty, 34);
|
||||
|
||||
AddButton(375, 245, 0x232C, 0x232D, 1, GumpButtonType.Reply, 0);
|
||||
}
|
||||
|
||||
public override void OnResponse(RelayInfo info)
|
||||
{
|
||||
if (info.ButtonID == 1 && Chart != null && !Chart.Deleted && Chart.Constellation >= 0)
|
||||
{
|
||||
TextRelay relay = info.GetTextEntry(1);
|
||||
|
||||
if (relay != null && relay.Text != null)
|
||||
{
|
||||
var text = relay.Text;
|
||||
|
||||
if (Server.Guilds.BaseGuildGump.CheckProfanity(text) &&
|
||||
!AstronomySystem.CheckNameExists(text) &&
|
||||
text.Length > 0 &&
|
||||
text.Length < 37)
|
||||
{
|
||||
Chart.ConstellationName = text;
|
||||
User.SendLocalizedMessage(1158512); // You record the name of the constellation.
|
||||
}
|
||||
else
|
||||
{
|
||||
User.SendLocalizedMessage(1158511); // You have entered an invalid name. Please try again.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public StarChart(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write(0);
|
||||
|
||||
writer.Write(_Constellation);
|
||||
writer.Write(_Name);
|
||||
writer.Write(_ChartedBy);
|
||||
writer.Write(_ChartedOn);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
reader.ReadInt();
|
||||
|
||||
_Constellation = reader.ReadInt();
|
||||
_Name = reader.ReadString();
|
||||
_ChartedBy = reader.ReadMobile();
|
||||
_ChartedOn = reader.ReadDateTime();
|
||||
}
|
||||
}
|
||||
}
|
||||
416
Scripts/Services/Astronomy/Telescope.cs
Normal file
416
Scripts/Services/Astronomy/Telescope.cs
Normal file
@@ -0,0 +1,416 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
using Server;
|
||||
using Server.Mobiles;
|
||||
using Server.Multis;
|
||||
using Server.Gumps;
|
||||
using Server.Engines.Astronomy;
|
||||
using Server.ContextMenus;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
[Flipable(0xA12C, 0xA12D)]
|
||||
public class PersonalTelescope : Item, ISecurable
|
||||
{
|
||||
private string _DisplayName;
|
||||
private double _DEC;
|
||||
|
||||
//[CommandProperty(AccessLevel.GameMaster)]
|
||||
//public static TimeCoordinate ForceTimeCoordinate { get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public string DisplayName { get { return _DisplayName; } set { _DisplayName = value; InvalidateProperties(); } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public SecureLevel Level { get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int RA { get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public double DEC
|
||||
{
|
||||
get { return _DEC; }
|
||||
set
|
||||
{
|
||||
_DEC = value;
|
||||
|
||||
_DEC = (double)decimal.Round((decimal)_DEC, 2);
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public TimeCoordinate TimeCoordinate { get { return AstronomySystem.GetTimeCoordinate(this); } }
|
||||
|
||||
public DateTime LastUse { get; set; }
|
||||
|
||||
public override int LabelNumber { get { return 1125284; } }
|
||||
|
||||
[Constructable]
|
||||
public PersonalTelescope()
|
||||
: base(0xA12C)
|
||||
{
|
||||
Level = SecureLevel.Owner;
|
||||
|
||||
_DisplayName = _Names[Utility.Random(_Names.Length)];
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile m)
|
||||
{
|
||||
if (!IsLockedDown)
|
||||
{
|
||||
m.SendLocalizedMessage(1114298); // This must be locked down in order to use it.
|
||||
return;
|
||||
}
|
||||
|
||||
if (m.InRange(Location, 2))
|
||||
{
|
||||
var house = BaseHouse.FindHouseAt(this);
|
||||
|
||||
if (house != null && house.HasSecureAccess(m, Level))
|
||||
{
|
||||
if (DateTime.UtcNow - LastUse > TimeSpan.FromMinutes(10))
|
||||
{
|
||||
m.SendLocalizedMessage(1158643); // The telescope is calibrating, try again in a moment.
|
||||
|
||||
LastUse = DateTime.UtcNow;
|
||||
}
|
||||
else
|
||||
{
|
||||
BaseGump.SendGump(new TelescopeGump((PlayerMobile)m, this));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m.LocalOverheadMessage(Server.Network.MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
|
||||
}
|
||||
}
|
||||
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
if (!String.IsNullOrEmpty(_DisplayName))
|
||||
{
|
||||
list.Add(1158477, _DisplayName); // <BASEFONT COLOR=#FFD24D>From the personal study of ~1_NAME~<BASEFONT COLOR=#FFFFFF>
|
||||
}
|
||||
}
|
||||
|
||||
public override void GetContextMenuEntries(Mobile from, List<ContextMenuEntry> list)
|
||||
{
|
||||
base.GetContextMenuEntries(from, list);
|
||||
|
||||
SetSecureLevelEntry.AddTo(from, this, list);
|
||||
}
|
||||
|
||||
public PersonalTelescope(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write(1);
|
||||
|
||||
writer.Write(_DisplayName);
|
||||
|
||||
writer.Write((int)Level);
|
||||
writer.Write(RA);
|
||||
writer.Write(DEC);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch (version)
|
||||
{
|
||||
case 1:
|
||||
_DisplayName = reader.ReadString();
|
||||
goto case 0;
|
||||
case 0:
|
||||
Level = (SecureLevel)reader.ReadInt();
|
||||
RA = reader.ReadInt();
|
||||
DEC = reader.ReadDouble();
|
||||
break;
|
||||
}
|
||||
|
||||
if (version == 0)
|
||||
{
|
||||
_DisplayName = _Names[Utility.Random(_Names.Length)];
|
||||
}
|
||||
}
|
||||
|
||||
private static string[] _Names =
|
||||
{
|
||||
"Adranath", "Aeluva the Arcanist", "Aesthyron", "Anon", "Balaki", "Clanin", "Dexter", "Doctor Spector", "Dryus Doost",
|
||||
"Gilform", "Grizelda the Hag", "Hawkwind", "Heigel of Moonglow", "Intanya", "Juo'Nar", "King Blackthorn", "Koole the Arcanist",
|
||||
"Kronos", "Kyrnia", "Lathiari", "Leoric Gathenwale", "Lysander Gathenwale", "Malabelle", "Mariah", "Melissa", "Minax",
|
||||
"Mondain", "Mordra", "Mythran", "Neira the Necromancer", "Nystul", "Queen Zhah", "Relvinian", "Selsius the Astronomer",
|
||||
"Sutek", "Uzeraan", "Wexton the Apprentice"
|
||||
};
|
||||
}
|
||||
|
||||
public class TelescopeGump : BaseGump
|
||||
{
|
||||
public Tuple<int, int> InterstellarObject { get; set; }
|
||||
public ConstellationInfo Constellation { get; set; }
|
||||
|
||||
public PersonalTelescope Tele { get; set; }
|
||||
public int ImageID { get; set; }
|
||||
|
||||
public TelescopeGump(PlayerMobile pm, PersonalTelescope tele)
|
||||
: base(pm, 200, 200)
|
||||
{
|
||||
Tele = tele;
|
||||
|
||||
pm.CloseGump(typeof(TelescopeGump));
|
||||
}
|
||||
|
||||
public override void AddGumpLayout()
|
||||
{
|
||||
AddPage(0);
|
||||
|
||||
if (ImageID == 0)
|
||||
{
|
||||
ImageID = AstronomySystem.RandomSkyImage(User);
|
||||
}
|
||||
|
||||
AddImage(0, 0, ImageID);
|
||||
|
||||
AddImage(222, 597, 0x694);
|
||||
AddImage(229, 600, GetGumpNumber(GetPlace(Tele.RA, 10)));
|
||||
|
||||
AddButton(222, 584, 0x697, 0x698, 60000, GumpButtonType.Reply, 0);
|
||||
AddButton(222, 631, 0x699, 0x69A, 60001, GumpButtonType.Reply, 0);
|
||||
|
||||
AddImage(256, 597, 0x694);
|
||||
AddImage(263, 600, GetGumpNumber(GetPlace(Tele.RA, 1)));
|
||||
|
||||
AddButton(256, 584, 0x697, 0x698, 60002, GumpButtonType.Reply, 0);
|
||||
AddButton(256, 631, 0x699, 0x69A, 60003, GumpButtonType.Reply, 0);
|
||||
|
||||
AddButton(291, 597, 0x69B, 0x69C, 70000, GumpButtonType.Reply, 0);
|
||||
AddTooltip(1158499); // View Coordinate
|
||||
|
||||
AddImage(332, 597, 0x694);
|
||||
AddImage(339, 600, GetGumpNumber(GetPlace((int)Math.Truncate(Tele.DEC), 10)));
|
||||
|
||||
AddButton(332, 584, 0x697, 0x698, 60004, GumpButtonType.Reply, 0);
|
||||
AddButton(332, 631, 0x699, 0x69A, 60005, GumpButtonType.Reply, 0);
|
||||
|
||||
AddImage(366, 597, 0x694);
|
||||
AddImage(373, 600, GetGumpNumber(GetPlace((int)Math.Truncate(Tele.DEC), 1)));
|
||||
|
||||
AddButton(366, 584, 0x697, 0x698, 60006, GumpButtonType.Reply, 0);
|
||||
AddButton(366, 631, 0x699, 0x69A, 60007, GumpButtonType.Reply, 0);
|
||||
|
||||
AddImage(400, 597, 0x694);
|
||||
AddImage(407, 600, GetGumpNumber(GetDecimalPlace(Tele.DEC)));
|
||||
|
||||
AddButton(400, 584, 0x697, 0x698, 60008, GumpButtonType.Reply, 0);
|
||||
AddButton(400, 631, 0x699, 0x69A, 60009, GumpButtonType.Reply, 0);
|
||||
|
||||
AddImage(397, 623, 0x696);
|
||||
|
||||
AddHtmlLocalized(251, 651, 100, 50, 1158489, 0x6B55, false, false); // RA
|
||||
AddTooltip(1158497); // Right Ascension
|
||||
|
||||
AddHtmlLocalized(371, 651, 100, 50, 1158490, 0x6B55, false, false); // DEC
|
||||
AddTooltip(1158498); // Declination
|
||||
|
||||
if (Constellation != null)
|
||||
{
|
||||
RenderConstellation();
|
||||
}
|
||||
else if (InterstellarObject != null)
|
||||
{
|
||||
RenderInterstellarObject();
|
||||
}
|
||||
}
|
||||
|
||||
private void RenderInterstellarObject()
|
||||
{
|
||||
AddImage(180, 150, InterstellarObject.Item1);
|
||||
}
|
||||
|
||||
private void RenderConstellation()
|
||||
{
|
||||
foreach (var pos in Constellation.StarPositions)
|
||||
{
|
||||
AddImage(pos.X, pos.Y, pos.ImageID);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnResponse(RelayInfo info)
|
||||
{
|
||||
if (!User.InRange(Tele.Location, 2) || User.Map != Tele.Map)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Tele.LastUse = DateTime.UtcNow;
|
||||
|
||||
switch (info.ButtonID)
|
||||
{
|
||||
case 60000: // RA 10's Up
|
||||
if (Tele.RA >= 20)
|
||||
Tele.RA -= 20;
|
||||
else
|
||||
Tele.RA += 10;
|
||||
User.SendSound(0x4A);
|
||||
break;
|
||||
case 60001: // RA 10's Down
|
||||
if (Tele.RA < 10)
|
||||
Tele.RA += 20;
|
||||
else
|
||||
Tele.RA -= 10;
|
||||
User.SendSound(0x4A);
|
||||
break;
|
||||
case 60002: // RA 1's Up
|
||||
int raOnes = GetPlace(Tele.RA, 1);
|
||||
|
||||
if (raOnes >= 9)
|
||||
Tele.RA -= 9;
|
||||
else
|
||||
Tele.RA++;
|
||||
User.SendSound(0x4A);
|
||||
break;
|
||||
case 60003: // RA 1's Down
|
||||
int raOnes1 = GetPlace(Tele.RA, 1);
|
||||
|
||||
if (raOnes1 == 0)
|
||||
Tele.RA += 9;
|
||||
else
|
||||
Tele.RA--;
|
||||
User.SendSound(0x4A);
|
||||
break;
|
||||
case 60004: // DEC 10's Up
|
||||
if (Tele.DEC >= 90)
|
||||
Tele.DEC -= 90;
|
||||
else
|
||||
Tele.DEC += 10;
|
||||
User.SendSound(0x4A);
|
||||
break;
|
||||
case 60005: // DEC 10's Down
|
||||
if (Tele.DEC < 10)
|
||||
Tele.DEC += 90;
|
||||
else
|
||||
Tele.DEC -= 10;
|
||||
User.SendSound(0x4A);
|
||||
break;
|
||||
case 60006: // DEC 1's Up
|
||||
int decOnes = GetPlace((int)Math.Truncate(Tele.DEC), 1);
|
||||
|
||||
if (decOnes >= 9)
|
||||
Tele.DEC -= 9;
|
||||
else
|
||||
Tele.DEC++;
|
||||
User.SendSound(0x4A);
|
||||
break;
|
||||
case 60007: // DEC 1's Down
|
||||
int decOnes1 = GetPlace((int)Math.Truncate(Tele.DEC), 1);
|
||||
|
||||
if (decOnes1 <= 0)
|
||||
Tele.DEC += 9;
|
||||
else
|
||||
Tele.DEC--;
|
||||
User.SendSound(0x4A);
|
||||
break;
|
||||
case 60008: // DEC .2 Up
|
||||
int dec = GetDecimalPlace(Tele.DEC);
|
||||
|
||||
if (dec >= 8)
|
||||
Tele.DEC = Math.Truncate(Tele.DEC);
|
||||
else
|
||||
Tele.DEC += .2;
|
||||
User.SendSound(0x4A);
|
||||
break;
|
||||
case 60009: // DEC .2 Down
|
||||
int dec1 = GetDecimalPlace(Tele.DEC);
|
||||
|
||||
if (dec1 < 2)
|
||||
Tele.DEC += 0.8;
|
||||
else if (dec1 == 2)
|
||||
Tele.DEC = Math.Truncate(Tele.DEC);
|
||||
else
|
||||
Tele.DEC -= 0.2;
|
||||
|
||||
User.SendSound(0x4A);
|
||||
break;
|
||||
case 70000: // View Coord
|
||||
if (Tele.RA > AstronomySystem.MaxRA || Tele.DEC > (double)AstronomySystem.MaxDEC)
|
||||
{
|
||||
User.SendLocalizedMessage(1158488); // You have entered invalid coordinates.
|
||||
User.SendSound(81);
|
||||
}
|
||||
else
|
||||
{
|
||||
InterstellarObject = null;
|
||||
Constellation = null;
|
||||
ImageID = AstronomySystem.RandomSkyImage(User);
|
||||
|
||||
var timeCoord = Tele.TimeCoordinate;
|
||||
|
||||
if (timeCoord == TimeCoordinate.Day)
|
||||
{
|
||||
User.SendLocalizedMessage(1158513); // You won't have much luck seeing the night sky during the day...
|
||||
}
|
||||
else
|
||||
{
|
||||
var constellation = AstronomySystem.GetConstellation(timeCoord, Tele.RA, Tele.DEC);
|
||||
|
||||
if (constellation != null)
|
||||
{
|
||||
Constellation = constellation;
|
||||
|
||||
User.SendLocalizedMessage(1158492, "", 0xBF); // You peer into the heavens and see...a constellation!
|
||||
User.SendSound(User.Female ? 0x32B : 0x43D);
|
||||
}
|
||||
else if (0.2 > Utility.RandomDouble())
|
||||
{
|
||||
InterstellarObject = AstronomySystem.GetRandomInterstellarObject();
|
||||
|
||||
User.SendLocalizedMessage(InterstellarObject.Item2, "", 0xBF); //
|
||||
User.SendSound(User.Female ? 0x32B : 0x43D);
|
||||
}
|
||||
else
|
||||
{
|
||||
User.SendLocalizedMessage(1158491, "", 0xBF); // You peer into the heavens and see...only empty space...
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Refresh();
|
||||
return;
|
||||
}
|
||||
|
||||
if (info.ButtonID != 0)
|
||||
{
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
private int GetPlace(int value, int place)
|
||||
{
|
||||
return ((value % (place * 10)) - (value % place)) / place;
|
||||
}
|
||||
|
||||
private int GetDecimalPlace(double value)
|
||||
{
|
||||
decimal dec = decimal.Round((decimal)(value - Math.Truncate(value)), 2);
|
||||
|
||||
return (int)(dec * 10);
|
||||
}
|
||||
|
||||
private int GetGumpNumber(int v)
|
||||
{
|
||||
return 0x58F + v;
|
||||
}
|
||||
}
|
||||
}
|
||||
291
Scripts/Services/Astronomy/Tent.cs
Normal file
291
Scripts/Services/Astronomy/Tent.cs
Normal file
@@ -0,0 +1,291 @@
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class AstronomyTent : BaseAddon
|
||||
{
|
||||
public override BaseAddonDeed Deed { get { return null; } }
|
||||
|
||||
[Constructable]
|
||||
public AstronomyTent()
|
||||
{
|
||||
// yellow walls
|
||||
int hue = 2721;
|
||||
|
||||
AddonComponent comp = new AddonComponent(0x369);
|
||||
comp.Hue = hue;
|
||||
AddComponent(comp, -1, 3, 0);
|
||||
|
||||
comp = new AddonComponent(0x369);
|
||||
comp.Hue = hue;
|
||||
AddComponent(comp, 2, 3, 0);
|
||||
|
||||
comp = new AddonComponent(0x36A);
|
||||
comp.Hue = hue;
|
||||
AddComponent(comp, 5, 1, 0);
|
||||
|
||||
comp = new AddonComponent(0x36A);
|
||||
comp.Hue = hue;
|
||||
AddComponent(comp, 5, -1, 0);
|
||||
|
||||
comp = new AddonComponent(0x36F);
|
||||
comp.Hue = hue;
|
||||
AddComponent(comp, -4, -1, 0);
|
||||
|
||||
comp = new AddonComponent(0x36F);
|
||||
comp.Hue = hue;
|
||||
AddComponent(comp, -4, 1, 0);
|
||||
|
||||
comp = new AddonComponent(0x36E);
|
||||
comp.Hue = hue;
|
||||
AddComponent(comp, -2, -3, 0);
|
||||
|
||||
comp = new AddonComponent(0x36E);
|
||||
comp.Hue = hue;
|
||||
AddComponent(comp, 2, -3, 0);
|
||||
|
||||
// blue walls
|
||||
hue = 1156;
|
||||
|
||||
comp = new AddonComponent(0x36C);
|
||||
comp.Hue = hue;
|
||||
AddComponent(comp, -4, 3, 0);
|
||||
|
||||
comp = new AddonComponent(0x369);
|
||||
comp.Hue = hue;
|
||||
AddComponent(comp, -3, 3, 0);
|
||||
|
||||
comp = new AddonComponent(0x369);
|
||||
comp.Hue = hue;
|
||||
AddComponent(comp, -2, 3, 0);
|
||||
|
||||
comp = new AddonComponent(0x369);
|
||||
comp.Hue = hue;
|
||||
AddComponent(comp, 3, 3, 0);
|
||||
|
||||
comp = new AddonComponent(0x369);
|
||||
comp.Hue = hue;
|
||||
AddComponent(comp, 4, 3, 0);
|
||||
|
||||
comp = new AddonComponent(0x368);
|
||||
comp.Hue = hue;
|
||||
AddComponent(comp, 5, 3, 0);
|
||||
|
||||
comp = new AddonComponent(0x36A);
|
||||
comp.Hue = hue;
|
||||
AddComponent(comp, 5, 2, 0);
|
||||
|
||||
comp = new AddonComponent(0x36A);
|
||||
comp.Hue = hue;
|
||||
AddComponent(comp, 5, 0, 0);
|
||||
|
||||
comp = new AddonComponent(0x36A);
|
||||
comp.Hue = hue;
|
||||
AddComponent(comp, 5, -2, 0);
|
||||
|
||||
comp = new AddonComponent(0x36D);
|
||||
comp.Hue = hue;
|
||||
AddComponent(comp, 5, -3, 0);
|
||||
|
||||
comp = new AddonComponent(0x36E);
|
||||
comp.Hue = hue;
|
||||
AddComponent(comp, 4, -3, 0);
|
||||
|
||||
comp = new AddonComponent(0x36E);
|
||||
comp.Hue = hue;
|
||||
AddComponent(comp, 3, -3, 0);
|
||||
|
||||
comp = new AddonComponent(0x36E);
|
||||
comp.Hue = hue;
|
||||
AddComponent(comp, -3, -3, 0);
|
||||
|
||||
comp = new AddonComponent(0x36F);
|
||||
comp.Hue = hue;
|
||||
AddComponent(comp, -4, -2, 0);
|
||||
|
||||
comp = new AddonComponent(0x36F);
|
||||
comp.Hue = hue;
|
||||
AddComponent(comp, -4, 0, 0);
|
||||
|
||||
comp = new AddonComponent(0x36F);
|
||||
comp.Hue = hue;
|
||||
AddComponent(comp, -4, 2, 0);
|
||||
|
||||
AddComponent(new AddonComponent(0x36B), -4, -3, 0);
|
||||
|
||||
// South/East Corner
|
||||
comp = new AddonComponent(0x663);
|
||||
comp.Hue = hue;
|
||||
AddComponent(comp, 5, 3, 18);
|
||||
|
||||
comp = new AddonComponent(0x663);
|
||||
comp.Hue = hue;
|
||||
AddComponent(comp, 4, 2, 21);
|
||||
|
||||
comp = new AddonComponent(0x663);
|
||||
comp.Hue = hue;
|
||||
AddComponent(comp, 3, 1, 24);
|
||||
|
||||
// North/East Corner
|
||||
comp = new AddonComponent(0x664);
|
||||
comp.Hue = hue;
|
||||
AddComponent(comp, 5, -3, 18);
|
||||
|
||||
comp = new AddonComponent(0x664);
|
||||
comp.Hue = hue;
|
||||
AddComponent(comp, 4, -2, 21);
|
||||
|
||||
comp = new AddonComponent(0x664);
|
||||
comp.Hue = hue;
|
||||
AddComponent(comp, 3, -1, 24);
|
||||
|
||||
// South/West Corner
|
||||
comp = new AddonComponent(0x666);
|
||||
comp.Hue = hue;
|
||||
AddComponent(comp, -4, 3, 18);
|
||||
|
||||
comp = new AddonComponent(0x666);
|
||||
comp.Hue = hue;
|
||||
AddComponent(comp, -3, 2, 21);
|
||||
|
||||
comp = new AddonComponent(0x666);
|
||||
comp.Hue = hue;
|
||||
AddComponent(comp, -2, 1, 24);
|
||||
|
||||
// North/West Corner
|
||||
comp = new AddonComponent(0x665);
|
||||
comp.Hue = hue;
|
||||
AddComponent(comp, -4, -3, 18);
|
||||
|
||||
comp = new AddonComponent(0x665);
|
||||
comp.Hue = hue;
|
||||
AddComponent(comp, -3, -2, 21);
|
||||
|
||||
comp = new AddonComponent(0x665);
|
||||
comp.Hue = hue;
|
||||
AddComponent(comp, -2, -1, 24);
|
||||
|
||||
// Top - East to West
|
||||
comp = new AddonComponent(0x668);
|
||||
comp.Hue = hue;
|
||||
AddComponent(comp, 2, 0, 27);
|
||||
|
||||
comp = new AddonComponent(0x662);
|
||||
comp.Hue = hue;
|
||||
AddComponent(comp, 1, 0, 27);
|
||||
|
||||
comp = new AddonComponent(0x662);
|
||||
comp.Hue = hue;
|
||||
AddComponent(comp, 0, 0, 27);
|
||||
|
||||
comp = new AddonComponent(0x669);
|
||||
comp.Hue = hue;
|
||||
AddComponent(comp, -1, 0, 27);
|
||||
|
||||
// South Facing
|
||||
for (int x = -3; x <= 4; x++)
|
||||
{
|
||||
comp = new AddonComponent(0x601);
|
||||
comp.Hue = hue;
|
||||
AddComponent(comp, x, 3, 18);
|
||||
}
|
||||
|
||||
for (int x = -2; x <= 3; x++)
|
||||
{
|
||||
comp = new AddonComponent(0x601);
|
||||
comp.Hue = hue;
|
||||
AddComponent(comp, x, 2, 21);
|
||||
}
|
||||
|
||||
for (int x = -1; x <= 2; x++)
|
||||
{
|
||||
comp = new AddonComponent(0x601);
|
||||
comp.Hue = hue;
|
||||
AddComponent(comp, x, 1, 24);
|
||||
}
|
||||
|
||||
// North Facing
|
||||
for (int x = -3; x <= 4; x++)
|
||||
{
|
||||
comp = new AddonComponent(0x600);
|
||||
comp.Hue = hue;
|
||||
AddComponent(comp, x, -3, 18);
|
||||
}
|
||||
|
||||
for (int x = -2; x <= 3; x++)
|
||||
{
|
||||
comp = new AddonComponent(0x600);
|
||||
comp.Hue = hue;
|
||||
AddComponent(comp, x, -2, 21);
|
||||
}
|
||||
|
||||
for (int x = -1; x <= 2; x++)
|
||||
{
|
||||
comp = new AddonComponent(0x600);
|
||||
comp.Hue = hue;
|
||||
AddComponent(comp, x, -1, 24);
|
||||
}
|
||||
|
||||
// West Facing
|
||||
for (int y = -2; y <= 2; y++)
|
||||
{
|
||||
comp = new AddonComponent(0x5FF);
|
||||
comp.Hue = hue;
|
||||
AddComponent(comp, -4, y, 18);
|
||||
}
|
||||
|
||||
for (int y = -1; y <= 1; y++)
|
||||
{
|
||||
comp = new AddonComponent(0x5FF);
|
||||
comp.Hue = hue;
|
||||
AddComponent(comp, -3, y, 21);
|
||||
}
|
||||
|
||||
comp = new AddonComponent(0x5FF);
|
||||
comp.Hue = hue;
|
||||
AddComponent(comp, -2, 0, 24);
|
||||
|
||||
// East Facing
|
||||
for (int y = -2; y <= 2; y++)
|
||||
{
|
||||
comp = new AddonComponent(0x602);
|
||||
comp.Hue = hue;
|
||||
AddComponent(comp, 5, y, 18);
|
||||
}
|
||||
|
||||
for (int y = -1; y <= 1; y++)
|
||||
{
|
||||
comp = new AddonComponent(0x602);
|
||||
comp.Hue = hue;
|
||||
AddComponent(comp, 4, y, 21);
|
||||
}
|
||||
|
||||
comp = new AddonComponent(0x602);
|
||||
comp.Hue = hue;
|
||||
AddComponent(comp, 3, 0, 24);
|
||||
|
||||
AddComponent(new AddonComponent(0xB6B), 2, 0, 0);
|
||||
AddComponent(new AddonComponent(0xB6C), 2, -1, 0);
|
||||
AddComponent(new AddonComponent(0x9CEF), -1, 5, 0);
|
||||
AddComponent(new AddonComponent(0x9CEF), 3, 5, 0);
|
||||
// Center:4707, 1127, 0
|
||||
}
|
||||
|
||||
public AstronomyTent(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write(0);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
189
Scripts/Services/Astronomy/Willebrord.cs
Normal file
189
Scripts/Services/Astronomy/Willebrord.cs
Normal file
@@ -0,0 +1,189 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
using Server;
|
||||
using Server.Mobiles;
|
||||
using Server.Items;
|
||||
using Server.Gumps;
|
||||
|
||||
namespace Server.Engines.Astronomy
|
||||
{
|
||||
public class Willebrord : BaseVendor
|
||||
{
|
||||
public static Willebrord TramInstance { get; set; }
|
||||
|
||||
protected readonly List<SBInfo> m_SBInfos = new List<SBInfo>();
|
||||
protected override List<SBInfo> SBInfos { get { return m_SBInfos; } }
|
||||
public override bool IsActiveVendor { get { return false; } }
|
||||
|
||||
public override void InitSBInfo()
|
||||
{
|
||||
}
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
if (Core.EJ)
|
||||
{
|
||||
if (TramInstance == null)
|
||||
{
|
||||
TramInstance = new Willebrord();
|
||||
TramInstance.MoveToWorld(new Point3D(4706, 1128, 6), Map.Trammel);
|
||||
}
|
||||
|
||||
if (Map.Trammel.FindItem<AstronomyTent>(new Point3D(4707, 1127, 0)) == null)
|
||||
{
|
||||
var tent = new AstronomyTent();
|
||||
tent.MoveToWorld(new Point3D(4707, 1127, 0), Map.Trammel);
|
||||
}
|
||||
|
||||
if (Map.Trammel.FindItem<PersonalTelescope>(new Point3D(4705, 1128, 0)) == null)
|
||||
{
|
||||
var tele = new PersonalTelescope();
|
||||
tele.Movable = false;
|
||||
tele.MoveToWorld(new Point3D(4705, 1128, 0), Map.Trammel);
|
||||
}
|
||||
|
||||
if (Map.Trammel.FindItem<BrassOrrery>(new Point3D(4705, 1126, 0)) == null)
|
||||
{
|
||||
var orrery = new BrassOrrery();
|
||||
orrery.Movable = false;
|
||||
orrery.MoveToWorld(new Point3D(4705, 1126, 0), Map.Trammel);
|
||||
}
|
||||
|
||||
if (Map.Trammel.FindItem<ConstellationLedger>(new Point3D(4709, 1127, 0)) == null)
|
||||
{
|
||||
var ledger = new ConstellationLedger();
|
||||
ledger.Movable = false;
|
||||
ledger.MoveToWorld(new Point3D(4709, 1127, 4), Map.Trammel);
|
||||
}
|
||||
|
||||
if (Map.Trammel.FindItem<PrimerOnBritannianAstronomy>(new Point3D(4709, 1126, 0)) == null)
|
||||
{
|
||||
var book = new PrimerOnBritannianAstronomy();
|
||||
book.Movable = false;
|
||||
book.MoveToWorld(new Point3D(4709, 1126, 4), Map.Trammel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Willebrord()
|
||||
: base("the Astronomer")
|
||||
{
|
||||
}
|
||||
|
||||
public override void InitBody()
|
||||
{
|
||||
InitStats(100, 100, 25);
|
||||
CantWalk = true;
|
||||
Name = "Willebrord";
|
||||
|
||||
Race = Race.Human;
|
||||
Body = Race.MaleBody;
|
||||
|
||||
HairItemID = Race.RandomHair(false);
|
||||
HairHue = Race.RandomHairHue();
|
||||
}
|
||||
|
||||
public override void InitOutfit()
|
||||
{
|
||||
SetWearable(new Kamishimo());
|
||||
SetWearable(new ThighBoots(), 1908);
|
||||
SetWearable(new FancyShirt(), 1255);
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile m)
|
||||
{
|
||||
if (m.InRange(Location, 3) && InLOS(m))
|
||||
{
|
||||
var gump = new Gump(100, 100);
|
||||
gump.AddBackground(0, 0, 720, 270, 0x2454);
|
||||
gump.AddImage(0, 0, 0x69D);
|
||||
|
||||
gump.AddHtmlLocalized(290, 14, 418, 18, 1114513, "#1158517", 0xC63, false, false);
|
||||
gump.AddHtmlLocalized(290, 51, 418, 209, 1158518, 0xC63, false, true);
|
||||
|
||||
m.SendGump(gump);
|
||||
}
|
||||
}
|
||||
|
||||
public override bool OnDragDrop(Mobile m, Item dropped)
|
||||
{
|
||||
if (dropped is StarChart)
|
||||
{
|
||||
var chart = (StarChart)dropped;
|
||||
|
||||
if (chart.Constellation >= 0 && chart.Constellation < AstronomySystem.MaxConstellations)
|
||||
{
|
||||
if (String.IsNullOrEmpty(chart.ConstellationName))
|
||||
{
|
||||
m.SendLocalizedMessage(1158751); // You must name your constellation before submitting it.
|
||||
}
|
||||
else
|
||||
{
|
||||
var info = AstronomySystem.GetConstellation(chart.Constellation);
|
||||
|
||||
if (info != null)
|
||||
{
|
||||
var gump = new Gump(100, 100);
|
||||
gump.AddBackground(0, 0, 720, 270, 0x2454);
|
||||
gump.AddImage(0, 0, 0x69D);
|
||||
gump.AddHtmlLocalized(290, 14, 418, 18, 1114513, "#1158517", 0xC63, false, false); // Willebrord the Astronomer
|
||||
|
||||
if (info.HasBeenDiscovered)
|
||||
{
|
||||
m.SendLocalizedMessage(1158764); // That constellation name has already been chosen, please choose another and resubmit your star chart.
|
||||
gump.AddHtmlLocalized(290, 51, 418, 209, 1158530, 0xC63, false, true);
|
||||
// Sorry to say that constellation has already been discovered! Fix your eyes to the heavens and keep up the searc
|
||||
}
|
||||
else
|
||||
{
|
||||
gump.AddHtmlLocalized(290, 51, 418, 209, 1158519, 0xC63, false, true);
|
||||
// Wow! Would you look at that! Always amazes me how even an amateur can make such profound discoveries!
|
||||
// I've recorded your discovery in the ledger. Here's some items I think you have more than earned! Well done!
|
||||
|
||||
info.DiscoveredBy = chart.ChartedBy;
|
||||
info.Name = chart.ConstellationName;
|
||||
info.DiscoveredOn = chart.ChartedOn;
|
||||
AstronomySystem.AddDiscovery(info);
|
||||
|
||||
m.AddToBackpack(new RecipeScroll(465));
|
||||
m.AddToBackpack(new AstronomerTitleDeed());
|
||||
}
|
||||
|
||||
m.SendGump(gump);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SayTo(m, 1158529, 1163); // What's this? I haven't time for this! Star Charts only please!
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public Willebrord(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write(0);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
reader.ReadInt();
|
||||
|
||||
if (Map == Map.Trammel)
|
||||
{
|
||||
TramInstance = this;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
64
Scripts/Services/BasketWeaving/BasketWeavingBook.cs
Normal file
64
Scripts/Services/BasketWeaving/BasketWeavingBook.cs
Normal file
@@ -0,0 +1,64 @@
|
||||
using System;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class BasketWeavingBook : Item
|
||||
{
|
||||
public override int LabelNumber {get {return 1153529;} } // Making valuables with Basket Weaving
|
||||
|
||||
[Constructable]
|
||||
public BasketWeavingBook()
|
||||
: base(0xFBE)
|
||||
{
|
||||
Weight = 1.0;
|
||||
}
|
||||
|
||||
public BasketWeavingBook(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
PlayerMobile pm = from as PlayerMobile;
|
||||
|
||||
if (pm == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!IsChildOf(pm.Backpack))
|
||||
{
|
||||
pm.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
|
||||
}
|
||||
else if (pm.Skills[SkillName.Tinkering].Base < 100.0)
|
||||
{
|
||||
pm.SendLocalizedMessage(1112255); // Only a Grandmaster Tinker can learn from this book.
|
||||
}
|
||||
else if (pm.BasketWeaving)
|
||||
{
|
||||
pm.SendLocalizedMessage(1080066); // You have already learned this information.
|
||||
}
|
||||
else
|
||||
{
|
||||
pm.BasketWeaving = true;
|
||||
pm.SendLocalizedMessage(1112254); // You have learned to make baskets. You will need gardeners to make reeds out of plants for you to make these items.
|
||||
|
||||
Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
31
Scripts/Services/BasketWeaving/Baskets/BasketCraftable.cs
Normal file
31
Scripts/Services/BasketWeaving/Baskets/BasketCraftable.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class BasketCraftable : BaseContainer
|
||||
{
|
||||
public override int LabelNumber { get { return 1022448; } } //basket
|
||||
|
||||
[Constructable]
|
||||
public BasketCraftable() : base(9431)
|
||||
{
|
||||
}
|
||||
|
||||
public BasketCraftable(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write((int)0);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int v = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
32
Scripts/Services/BasketWeaving/Baskets/PicnicBasket2.cs
Normal file
32
Scripts/Services/BasketWeaving/Baskets/PicnicBasket2.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using Server;
|
||||
using Server.Items;
|
||||
|
||||
public class PicnicBasket2 : BaseContainer
|
||||
{
|
||||
[Constructable]
|
||||
public PicnicBasket2()
|
||||
: base(0xE7A)
|
||||
{
|
||||
this.Weight = 1.0;
|
||||
}
|
||||
|
||||
public PicnicBasket2(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
40
Scripts/Services/BasketWeaving/Baskets/RoundBasket.cs
Normal file
40
Scripts/Services/BasketWeaving/Baskets/RoundBasket.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using Server;
|
||||
using Server.Items;
|
||||
|
||||
public class RoundBasket : BaseContainer
|
||||
{
|
||||
[Constructable]
|
||||
public RoundBasket()
|
||||
: base(0x990)
|
||||
{
|
||||
this.Weight = 1.0;
|
||||
}
|
||||
|
||||
public RoundBasket(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int LabelNumber
|
||||
{
|
||||
get
|
||||
{
|
||||
return 1112293;
|
||||
}
|
||||
}// round basket
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
34
Scripts/Services/BasketWeaving/Baskets/RoundBasketHandles.cs
Normal file
34
Scripts/Services/BasketWeaving/Baskets/RoundBasketHandles.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using Server;
|
||||
using Server.Items;
|
||||
|
||||
public class RoundBasketHandles : BaseContainer
|
||||
{
|
||||
public override int LabelNumber { get { return 1112293; } } // round basket
|
||||
|
||||
[Constructable]
|
||||
public RoundBasketHandles()
|
||||
: base(0x9AC)
|
||||
{
|
||||
Weight = 1.0;
|
||||
}
|
||||
|
||||
public RoundBasketHandles(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
40
Scripts/Services/BasketWeaving/Baskets/SmallBushel.cs
Normal file
40
Scripts/Services/BasketWeaving/Baskets/SmallBushel.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using Server;
|
||||
using Server.Items;
|
||||
|
||||
public class SmallBushel : BaseContainer
|
||||
{
|
||||
[Constructable]
|
||||
public SmallBushel()
|
||||
: base(0x09B1)
|
||||
{
|
||||
this.Weight = 1.0;
|
||||
}
|
||||
|
||||
public SmallBushel(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int LabelNumber
|
||||
{
|
||||
get
|
||||
{
|
||||
return 1112337;
|
||||
}
|
||||
}// small bushel
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
40
Scripts/Services/BasketWeaving/Baskets/SmallRoundBasket.cs
Normal file
40
Scripts/Services/BasketWeaving/Baskets/SmallRoundBasket.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using Server;
|
||||
using Server.Items;
|
||||
|
||||
public class SmallRoundBasket : BaseContainer
|
||||
{
|
||||
[Constructable]
|
||||
public SmallRoundBasket()
|
||||
: base(0x24DD)
|
||||
{
|
||||
this.Weight = 1.0;
|
||||
}
|
||||
|
||||
public SmallRoundBasket(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int LabelNumber
|
||||
{
|
||||
get
|
||||
{
|
||||
return 1112298;
|
||||
}
|
||||
}// small round basket
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
40
Scripts/Services/BasketWeaving/Baskets/SmallSquareBasket.cs
Normal file
40
Scripts/Services/BasketWeaving/Baskets/SmallSquareBasket.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using Server;
|
||||
using Server.Items;
|
||||
|
||||
public class SmallSquareBasket : BaseContainer
|
||||
{
|
||||
[Constructable]
|
||||
public SmallSquareBasket()
|
||||
: base(0x24D9)
|
||||
{
|
||||
this.Weight = 1.0;
|
||||
}
|
||||
|
||||
public SmallSquareBasket(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int LabelNumber
|
||||
{
|
||||
get
|
||||
{
|
||||
return 1112296;
|
||||
}
|
||||
}// small square basket
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
40
Scripts/Services/BasketWeaving/Baskets/SquareBasket.cs
Normal file
40
Scripts/Services/BasketWeaving/Baskets/SquareBasket.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using Server;
|
||||
using Server.Items;
|
||||
|
||||
public class SquareBasket : BaseContainer
|
||||
{
|
||||
[Constructable]
|
||||
public SquareBasket()
|
||||
: base(0x24D5)
|
||||
{
|
||||
this.Weight = 1.0;
|
||||
}
|
||||
|
||||
public SquareBasket(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int LabelNumber
|
||||
{
|
||||
get
|
||||
{
|
||||
return 1112295;
|
||||
}
|
||||
}// square basket
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
40
Scripts/Services/BasketWeaving/Baskets/TallBasket.cs
Normal file
40
Scripts/Services/BasketWeaving/Baskets/TallBasket.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using Server;
|
||||
using Server.Items;
|
||||
|
||||
public class TallBasket : BaseContainer
|
||||
{
|
||||
[Constructable]
|
||||
public TallBasket()
|
||||
: base(0x24DB)
|
||||
{
|
||||
this.Weight = 1.0;
|
||||
}
|
||||
|
||||
public TallBasket(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int LabelNumber
|
||||
{
|
||||
get
|
||||
{
|
||||
return 1112299;
|
||||
}
|
||||
}// tall basket
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
40
Scripts/Services/BasketWeaving/Baskets/TallRoundBasket.cs
Normal file
40
Scripts/Services/BasketWeaving/Baskets/TallRoundBasket.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using Server;
|
||||
using Server.Items;
|
||||
|
||||
public class TallRoundBasket : BaseContainer
|
||||
{
|
||||
[Constructable]
|
||||
public TallRoundBasket()
|
||||
: base(0x24D8)
|
||||
{
|
||||
this.Weight = 1.0;
|
||||
}
|
||||
|
||||
public TallRoundBasket(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int LabelNumber
|
||||
{
|
||||
get
|
||||
{
|
||||
return 1112297;
|
||||
}
|
||||
}//Tall Round Basket
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
32
Scripts/Services/BasketWeaving/Baskets/WinnowingBasket.cs
Normal file
32
Scripts/Services/BasketWeaving/Baskets/WinnowingBasket.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using Server;
|
||||
using Server.Items;
|
||||
|
||||
public class WinnowingBasket : BaseContainer
|
||||
{
|
||||
[Constructable]
|
||||
public WinnowingBasket()
|
||||
: base(0x1882)
|
||||
{
|
||||
Weight = 1.0;
|
||||
}
|
||||
|
||||
public WinnowingBasket(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
380
Scripts/Services/BasketWeaving/Clippers.cs
Normal file
380
Scripts/Services/BasketWeaving/Clippers.cs
Normal file
@@ -0,0 +1,380 @@
|
||||
#region References
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.Gumps;
|
||||
using Server.Network;
|
||||
using Server.ContextMenus;
|
||||
using Server.Engines.Craft;
|
||||
using Server.Engines.Plants;
|
||||
using Server.Mobiles;
|
||||
using Server.Targeting;
|
||||
#endregion
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
[Flipable(0x0DFC, 0x0DFD)]
|
||||
public class Clippers : BaseTool
|
||||
{
|
||||
public override int LabelNumber { get { return 1112117; } } // clippers
|
||||
|
||||
[Constructable]
|
||||
public Clippers()
|
||||
: base(0x0DFC)
|
||||
{
|
||||
Weight = 1.0;
|
||||
Hue = 1168;
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public Clippers(int uses)
|
||||
: base(uses, 0x0DFC)
|
||||
{
|
||||
Weight = 1.0;
|
||||
Hue = 1168;
|
||||
}
|
||||
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
//Makers mark not displayed on OSI
|
||||
if (Crafter != null)
|
||||
{
|
||||
list.Add(1050043, Crafter.TitleName); // crafted by ~1_NAME~
|
||||
}
|
||||
}
|
||||
|
||||
public override void GetContextMenuEntries(Mobile from, List<ContextMenuEntry> list)
|
||||
{
|
||||
base.GetContextMenuEntries(from, list);
|
||||
|
||||
AddContextMenuEntries(from, this, list);
|
||||
}
|
||||
|
||||
public static void AddContextMenuEntries(Mobile from, Item item, List<ContextMenuEntry> list)
|
||||
{
|
||||
if (!item.IsChildOf(from.Backpack) && item.Parent != from)
|
||||
return;
|
||||
|
||||
PlayerMobile pm = from as PlayerMobile;
|
||||
|
||||
if (pm == null)
|
||||
return;
|
||||
|
||||
list.Add(new ToggleClippings(pm, true, false, false, 1112282)); //Set to clip plants
|
||||
list.Add(new ToggleClippings(pm, false, true, false, 1112283)); //Set to cut reeds
|
||||
list.Add(new ToggleClippings(pm, false, false, true, 1150660)); //Set to cut topiaries
|
||||
}
|
||||
|
||||
private class ToggleClippings : ContextMenuEntry
|
||||
{
|
||||
private readonly PlayerMobile m_Mobile;
|
||||
private readonly bool m_Valueclips;
|
||||
private readonly bool m_Valuereeds;
|
||||
private readonly bool m_Valuetopiaries;
|
||||
|
||||
public ToggleClippings(PlayerMobile mobile, bool valueclips, bool valuereeds, bool valuetopiaries, int number)
|
||||
: base(number)
|
||||
{
|
||||
m_Mobile = mobile;
|
||||
m_Valueclips = valueclips;
|
||||
m_Valuereeds = valuereeds;
|
||||
m_Valuetopiaries = valuetopiaries;
|
||||
}
|
||||
|
||||
public override void OnClick()
|
||||
{
|
||||
bool oldValueclips = m_Mobile.ToggleCutClippings;
|
||||
bool oldValuereeds = m_Mobile.ToggleCutReeds;
|
||||
bool oldValuetopiaries = m_Mobile.ToggleCutTopiaries;
|
||||
|
||||
if (m_Valueclips)
|
||||
{
|
||||
if (oldValueclips)
|
||||
{
|
||||
m_Mobile.ToggleCutClippings = true;
|
||||
m_Mobile.ToggleCutReeds = false;
|
||||
m_Mobile.ToggleCutTopiaries = false;
|
||||
m_Mobile.SendLocalizedMessage(1112284); // You are already set to make plant clippings
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Mobile.ToggleCutClippings = true;
|
||||
m_Mobile.ToggleCutReeds = false;
|
||||
m_Mobile.ToggleCutTopiaries = false;
|
||||
m_Mobile.SendLocalizedMessage(1112285); // You are now set to make plant clippings
|
||||
}
|
||||
}
|
||||
else if (m_Valuereeds)
|
||||
{
|
||||
if (oldValuereeds)
|
||||
{
|
||||
m_Mobile.ToggleCutReeds = true;
|
||||
m_Mobile.ToggleCutClippings = false;
|
||||
m_Mobile.ToggleCutTopiaries = false;
|
||||
m_Mobile.SendLocalizedMessage(1112287); // You are already set to cut reeds.
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Mobile.ToggleCutReeds = true;
|
||||
m_Mobile.ToggleCutClippings = false;
|
||||
m_Mobile.ToggleCutTopiaries = false;
|
||||
m_Mobile.SendLocalizedMessage(1112286); // You are now set to cut reeds.
|
||||
}
|
||||
}
|
||||
else if (m_Valuetopiaries)
|
||||
{
|
||||
if (oldValuetopiaries)
|
||||
{
|
||||
m_Mobile.ToggleCutTopiaries = true;
|
||||
m_Mobile.ToggleCutReeds = false;
|
||||
m_Mobile.ToggleCutClippings = false;
|
||||
m_Mobile.SendLocalizedMessage(1150653); // You are already set to cut topiaries!
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Mobile.ToggleCutTopiaries = true;
|
||||
m_Mobile.ToggleCutReeds = false;
|
||||
m_Mobile.ToggleCutClippings = false;
|
||||
m_Mobile.SendLocalizedMessage(1150652); // You are now set to cut topiaries.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Clippers(Serial serial)
|
||||
: base(serial)
|
||||
{ }
|
||||
|
||||
public virtual PlantHue PlantHue { get { return PlantHue.None; } }
|
||||
|
||||
public override CraftSystem CraftSystem
|
||||
{
|
||||
get
|
||||
{
|
||||
return DefTinkering.CraftSystem;
|
||||
}
|
||||
}
|
||||
|
||||
public void ConsumeUse(Mobile from)
|
||||
{
|
||||
if (UsesRemaining > 1)
|
||||
{
|
||||
--UsesRemaining;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (from != null)
|
||||
from.SendLocalizedMessage(1112126); // Your clippers break as you use up the last charge..
|
||||
|
||||
Delete();
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (IsChildOf(from.Backpack))
|
||||
{
|
||||
from.SendLocalizedMessage(1112118); // What plant do you wish to use these clippers on?
|
||||
from.Target = new InternalTarget(this);
|
||||
}
|
||||
}
|
||||
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private readonly Clippers m_Item;
|
||||
|
||||
public InternalTarget(Clippers item)
|
||||
: base(2, false, TargetFlags.None)
|
||||
{
|
||||
m_Item = item;
|
||||
}
|
||||
|
||||
protected override void OnTarget(Mobile from, object targeted)
|
||||
{
|
||||
PlayerMobile pm = from as PlayerMobile;
|
||||
|
||||
if (pm == null || m_Item == null || m_Item.Deleted)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
PlantItem plant = targeted as PlantItem;
|
||||
|
||||
if (null == plant || PlantStatus.DecorativePlant != plant.PlantStatus)
|
||||
{
|
||||
from.SendLocalizedMessage(1112119); // You may only use these clippers on decorative plants.
|
||||
return;
|
||||
}
|
||||
|
||||
if (pm.ToggleCutClippings)
|
||||
{
|
||||
from.PlaySound(0x248);
|
||||
from.AddToBackpack(
|
||||
new PlantClippings
|
||||
{
|
||||
Hue = ((PlantItem)targeted).Hue,
|
||||
PlantHue = plant.PlantHue
|
||||
});
|
||||
plant.Delete();
|
||||
m_Item.ConsumeUse(from);
|
||||
}
|
||||
else if (pm.ToggleCutReeds)
|
||||
{
|
||||
from.PlaySound(0x248);
|
||||
from.AddToBackpack(
|
||||
new DryReeds
|
||||
{
|
||||
Hue = ((PlantItem)targeted).Hue,
|
||||
PlantHue = plant.PlantHue
|
||||
});
|
||||
plant.Delete();
|
||||
m_Item.ConsumeUse(from);
|
||||
}
|
||||
else if (pm.ToggleCutTopiaries)
|
||||
{
|
||||
if (plant.PlantType == PlantType.HedgeTall || plant.PlantType == PlantType.HedgeShort || plant.PlantType == PlantType.JuniperBush)
|
||||
{
|
||||
from.CloseGump(typeof(TopiaryGump));
|
||||
from.SendGump(new TopiaryGump(plant, m_Item));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class TopiaryGump : Gump
|
||||
{
|
||||
PlantItem m_plant;
|
||||
Clippers m_clippers;
|
||||
|
||||
public TopiaryGump(PlantItem plant, Clippers clippers) : base(0, 0)
|
||||
{
|
||||
m_plant = plant;
|
||||
m_clippers = clippers;
|
||||
|
||||
AddPage(0);
|
||||
|
||||
AddBackground(50, 89, 508, 195, 2600);
|
||||
|
||||
AddLabel(103, 114, 0, @"Choose a Topiary:");
|
||||
|
||||
AddButton(92, 155, 1209, 1210, 1, GumpButtonType.Reply, 0);
|
||||
AddItem(75, 178, 18713);
|
||||
|
||||
AddButton(133, 155, 1209, 1210, 2, GumpButtonType.Reply, 0);
|
||||
AddItem(119, 178, 18714);
|
||||
|
||||
AddButton(177, 155, 1209, 1210, 3, GumpButtonType.Reply, 0);
|
||||
AddItem(165, 182, 18715);
|
||||
|
||||
AddButton(217, 155, 1209, 1210, 4, GumpButtonType.Reply, 0);
|
||||
AddItem(205, 182, 18736);
|
||||
|
||||
AddButton(267, 155, 1209, 1210, 5, GumpButtonType.Reply, 0);
|
||||
AddItem(220, 133, 18813);
|
||||
|
||||
AddButton(333, 155, 1209, 1210, 6, GumpButtonType.Reply, 0);
|
||||
AddItem(272, 133, 18814);
|
||||
|
||||
AddButton(388, 155, 1209, 1210, 7, GumpButtonType.Reply, 0);
|
||||
AddItem(374, 178, 18784);
|
||||
|
||||
AddButton(426, 155, 1209, 1210, 8, GumpButtonType.Reply, 0);
|
||||
AddItem(413, 175, 18713);
|
||||
|
||||
AddButton(480, 155, 1209, 1210, 9, GumpButtonType.Reply, 0);
|
||||
AddItem(463, 176, 19369);
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
Mobile from = sender.Mobile;
|
||||
|
||||
switch (info.ButtonID)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
from.PlaySound(0x248);
|
||||
m_plant.ItemID = 18713;
|
||||
m_clippers.ConsumeUse(from);
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
from.PlaySound(0x248);
|
||||
m_plant.ItemID = 18714;
|
||||
m_clippers.ConsumeUse(from);
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
from.PlaySound(0x248);
|
||||
m_plant.ItemID = 18715;
|
||||
m_clippers.ConsumeUse(from);
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
from.PlaySound(0x248);
|
||||
m_plant.ItemID = 18736;
|
||||
m_clippers.ConsumeUse(from);
|
||||
break;
|
||||
}
|
||||
case 5:
|
||||
{
|
||||
from.PlaySound(0x248);
|
||||
m_plant.ItemID = 18813;
|
||||
m_clippers.ConsumeUse(from);
|
||||
break;
|
||||
}
|
||||
case 6:
|
||||
{
|
||||
from.PlaySound(0x248);
|
||||
m_plant.ItemID = 18814;
|
||||
m_clippers.ConsumeUse(from);
|
||||
break;
|
||||
}
|
||||
case 7:
|
||||
{
|
||||
from.PlaySound(0x248);
|
||||
m_plant.ItemID = 18814;
|
||||
m_clippers.ConsumeUse(from);
|
||||
break;
|
||||
}
|
||||
case 8:
|
||||
{
|
||||
from.PlaySound(0x248);
|
||||
m_plant.ItemID = 18713;
|
||||
m_clippers.ConsumeUse(from);
|
||||
break;
|
||||
}
|
||||
case 9:
|
||||
{
|
||||
from.PlaySound(0x248);
|
||||
m_plant.ItemID = 19369;
|
||||
m_clippers.ConsumeUse(from);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
41
Scripts/Services/BasketWeaving/ColorFixative.cs
Normal file
41
Scripts/Services/BasketWeaving/ColorFixative.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using System;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class ColorFixative : Item
|
||||
{
|
||||
[Constructable]
|
||||
public ColorFixative()
|
||||
: base(0x182D)
|
||||
{
|
||||
this.Weight = 1.0;
|
||||
this.Hue = 473; // ...make this the proper shade of green
|
||||
}
|
||||
|
||||
public ColorFixative(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int LabelNumber
|
||||
{
|
||||
get
|
||||
{
|
||||
return 1112135;
|
||||
}
|
||||
}// color fixative
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
227
Scripts/Services/BasketWeaving/MiscSAResources.cs
Normal file
227
Scripts/Services/BasketWeaving/MiscSAResources.cs
Normal file
@@ -0,0 +1,227 @@
|
||||
#region References
|
||||
using Server.Engines.Plants;
|
||||
using Server.Engines.Craft;
|
||||
using System;
|
||||
#endregion
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class DryReeds : Item, IPlantHue
|
||||
{
|
||||
private PlantHue m_PlantHue;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public PlantHue PlantHue { get { return m_PlantHue; } set { m_PlantHue = value; InvalidatePlantHue(); InvalidateProperties(); } }
|
||||
|
||||
public override int LabelNumber { get { return 1112248; } } //dry reeds
|
||||
|
||||
public DryReeds(PlantHue hue)
|
||||
: base(0x1BD5)
|
||||
{
|
||||
PlantHue = hue;
|
||||
Stackable = true;
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public DryReeds()
|
||||
: this(PlantHue.Plain)
|
||||
{
|
||||
}
|
||||
|
||||
public void InvalidatePlantHue()
|
||||
{
|
||||
PlantHueInfo info = PlantHueInfo.GetInfo(m_PlantHue);
|
||||
|
||||
if (info == null)
|
||||
{
|
||||
m_PlantHue = PlantHue.Plain;
|
||||
Hue = 0;
|
||||
}
|
||||
else
|
||||
Hue = info.Hue;
|
||||
|
||||
InvalidateProperties();
|
||||
}
|
||||
|
||||
public override void AddNameProperty(ObjectPropertyList list)
|
||||
{
|
||||
PlantHueInfo info = PlantHueInfo.GetInfo(m_PlantHue);
|
||||
int cliloc;
|
||||
|
||||
if (Amount > 1)
|
||||
{
|
||||
cliloc = info.IsBright() ? 1113273 : 1113275;
|
||||
list.Add(cliloc, String.Format("{0}\t#{1}", Amount.ToString(), info.Name));
|
||||
}
|
||||
else
|
||||
{
|
||||
cliloc = info.IsBright() ? 1112288 : 1112289;
|
||||
list.Add(cliloc, String.Format("#{0}", info.Name));
|
||||
}
|
||||
}
|
||||
|
||||
public override bool WillStack(Mobile from, Item dropped)
|
||||
{
|
||||
return dropped is IPlantHue && ((IPlantHue)dropped).PlantHue == m_PlantHue && base.WillStack(from, dropped);
|
||||
}
|
||||
|
||||
public override void OnAfterDuped(Item newItem)
|
||||
{
|
||||
if (newItem is IPlantHue)
|
||||
((IPlantHue)newItem).PlantHue = this.PlantHue;
|
||||
|
||||
base.OnAfterDuped(newItem);
|
||||
}
|
||||
|
||||
public DryReeds(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write((int)1);
|
||||
|
||||
writer.Write((int)m_PlantHue);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int v = reader.ReadInt();
|
||||
|
||||
if(v > 0)
|
||||
m_PlantHue = (PlantHue)reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class SoftenedReeds : Item, IPlantHue
|
||||
{
|
||||
private PlantHue m_PlantHue;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public PlantHue PlantHue { get { return m_PlantHue; } set { m_PlantHue = value; InvalidatePlantHue(); InvalidateProperties(); } }
|
||||
|
||||
public override int LabelNumber { get { return 1112249; } } //Softened reeds
|
||||
|
||||
[Constructable]
|
||||
public SoftenedReeds()
|
||||
: this(PlantHue.Plain)
|
||||
{
|
||||
}
|
||||
|
||||
public SoftenedReeds(PlantHue hue)
|
||||
: base(0x4006)
|
||||
{
|
||||
m_PlantHue = hue;
|
||||
InvalidatePlantHue();
|
||||
Stackable = true;
|
||||
}
|
||||
|
||||
public void InvalidatePlantHue()
|
||||
{
|
||||
PlantHueInfo info = PlantHueInfo.GetInfo(m_PlantHue);
|
||||
|
||||
if (info == null)
|
||||
{
|
||||
m_PlantHue = PlantHue.Plain;
|
||||
Hue = 0;
|
||||
}
|
||||
else
|
||||
Hue = info.Hue;
|
||||
|
||||
InvalidateProperties();
|
||||
}
|
||||
|
||||
public void InvalidateHue()
|
||||
{
|
||||
PlantHueInfo info = PlantHueInfo.GetInfo(Hue);
|
||||
m_PlantHue = info.PlantHue;
|
||||
}
|
||||
|
||||
public override void AddNameProperty(ObjectPropertyList list)
|
||||
{
|
||||
|
||||
PlantHueInfo info = PlantHueInfo.GetInfo(m_PlantHue);
|
||||
int cliloc;
|
||||
|
||||
if (Amount > 1)
|
||||
{
|
||||
cliloc = info.IsBright() ? 1113273 : 1113275;
|
||||
list.Add(cliloc, String.Format("{0}\t#{1}", Amount.ToString(), info.Name));
|
||||
}
|
||||
else
|
||||
{
|
||||
cliloc = info.IsBright() ? 1112288 : 1112289;
|
||||
list.Add(cliloc, String.Format("#{0}", info.Name));
|
||||
}
|
||||
}
|
||||
|
||||
public override bool WillStack(Mobile from, Item dropped)
|
||||
{
|
||||
return dropped is IPlantHue && ((IPlantHue)dropped).PlantHue == m_PlantHue && base.WillStack(from, dropped);
|
||||
}
|
||||
|
||||
public override void OnAfterDuped(Item newItem)
|
||||
{
|
||||
if (newItem is IPlantHue)
|
||||
((IPlantHue)newItem).PlantHue = this.PlantHue;
|
||||
|
||||
base.OnAfterDuped(newItem);
|
||||
}
|
||||
|
||||
public SoftenedReeds(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write((int)2);
|
||||
|
||||
writer.Write((int)m_PlantHue);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int v = reader.ReadInt();
|
||||
|
||||
if(v > 1)
|
||||
m_PlantHue = (PlantHue)reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class CrystalGranules : Item
|
||||
{
|
||||
public override int LabelNumber { get { return 1112329; } } // crystal granules
|
||||
|
||||
[Constructable]
|
||||
public CrystalGranules()
|
||||
: base(16392)
|
||||
{
|
||||
Hue = 2625;
|
||||
}
|
||||
|
||||
public CrystalGranules(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
223
Scripts/Services/BasketWeaving/NaturalDye.cs
Normal file
223
Scripts/Services/BasketWeaving/NaturalDye.cs
Normal file
@@ -0,0 +1,223 @@
|
||||
using System;
|
||||
using Server.Engines.Plants;
|
||||
using Server.Multis;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class NaturalDye : Item, IPigmentHue
|
||||
{
|
||||
private PlantPigmentHue m_Hue;
|
||||
private int m_UsesRemaining;
|
||||
[Constructable]
|
||||
public NaturalDye()
|
||||
: this(PlantPigmentHue.None)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public NaturalDye(PlantPigmentHue hue)
|
||||
: base(0x182B)
|
||||
{
|
||||
Weight = 1.0;
|
||||
PigmentHue = hue;
|
||||
m_UsesRemaining = 5;
|
||||
}
|
||||
|
||||
public NaturalDye(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public PlantPigmentHue PigmentHue
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Hue;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_Hue = value;
|
||||
// set any invalid pigment hue to Plain
|
||||
if (m_Hue != PlantPigmentHueInfo.GetInfo(m_Hue).PlantPigmentHue)
|
||||
m_Hue = PlantPigmentHue.Plain;
|
||||
Hue = PlantPigmentHueInfo.GetInfo(m_Hue).Hue;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int UsesRemaining
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_UsesRemaining;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_UsesRemaining = value;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
public override int LabelNumber
|
||||
{
|
||||
get
|
||||
{
|
||||
return 1112136;
|
||||
}
|
||||
}// natural dye
|
||||
public bool RetainsColorFrom
|
||||
{
|
||||
get
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
public override bool ForceShowProperties
|
||||
{
|
||||
get
|
||||
{
|
||||
return ObjectPropertyList.Enabled;
|
||||
}
|
||||
}
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
list.Add(1060584, m_UsesRemaining.ToString()); // uses remaining: ~1_val~
|
||||
}
|
||||
|
||||
public override void AddNameProperty(ObjectPropertyList list)
|
||||
{
|
||||
PlantPigmentHueInfo hueInfo = PlantPigmentHueInfo.GetInfo(m_Hue);
|
||||
|
||||
if (Amount > 1)
|
||||
list.Add(PlantPigmentHueInfo.IsBright(m_Hue) ? 1113277 : 1113276, "{0}\t{1}", Amount, "#" + hueInfo.Name); // ~1_COLOR~ Softened Reeds
|
||||
else
|
||||
list.Add(hueInfo.IsBright() ? 1112138 : 1112137, "#" + hueInfo.Name); // ~1_COLOR~ natural dye
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)1); // version
|
||||
|
||||
writer.Write((int)m_Hue);
|
||||
writer.Write((int)m_UsesRemaining);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 1:
|
||||
m_Hue = (PlantPigmentHue)reader.ReadInt();
|
||||
m_UsesRemaining = reader.ReadInt();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
from.SendLocalizedMessage(1112139); // Select the item you wish to dye.
|
||||
from.Target = new InternalTarget(this);
|
||||
}
|
||||
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private readonly NaturalDye m_Item;
|
||||
public InternalTarget(NaturalDye item)
|
||||
: base(1, false, TargetFlags.None)
|
||||
{
|
||||
m_Item = item;
|
||||
}
|
||||
|
||||
protected override void OnTarget(Mobile from, object targeted)
|
||||
{
|
||||
if (m_Item.Deleted)
|
||||
return;
|
||||
|
||||
Item item = targeted as Item;
|
||||
|
||||
if (item != null)
|
||||
{
|
||||
bool valid = (item is IDyable || item is BaseTalisman ||
|
||||
item is BaseBook || item is BaseClothing ||
|
||||
item is BaseJewel || item is BaseStatuette ||
|
||||
item is BaseWeapon || item is Runebook ||
|
||||
item is Spellbook || item is DecorativePlant || item is ShoulderParrot ||
|
||||
item.IsArtifact || BasePigmentsOfTokuno.IsValidItem(item));
|
||||
|
||||
if (item is HoodedShroudOfShadows || item is MonkRobe)
|
||||
{
|
||||
from.SendLocalizedMessage(1042083); // You cannot dye that.
|
||||
return;
|
||||
}
|
||||
|
||||
if (!valid && FurnitureAttribute.Check(item))
|
||||
{
|
||||
if (!from.InRange(m_Item.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
|
||||
{
|
||||
from.SendLocalizedMessage(500446); // That is too far away.
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
BaseHouse house = BaseHouse.FindHouseAt(item);
|
||||
|
||||
if (house == null || (!house.IsLockedDown(item) && !house.IsSecure(item)))
|
||||
{
|
||||
from.SendLocalizedMessage(501022); // Furniture must be locked down to paint it.
|
||||
return;
|
||||
}
|
||||
else if (!house.IsCoOwner(from))
|
||||
{
|
||||
from.SendLocalizedMessage(501023); // You must be the owner to use this item.
|
||||
return;
|
||||
}
|
||||
else
|
||||
valid = true;
|
||||
}
|
||||
}
|
||||
else if (!item.IsChildOf(from.Backpack))
|
||||
{
|
||||
from.SendLocalizedMessage(1060640); // The item must be in your backpack to use it.
|
||||
return;
|
||||
}
|
||||
|
||||
if (!valid && item is BaseArmor)
|
||||
{
|
||||
CraftResourceType restype = CraftResources.GetType(((BaseArmor)item).Resource);
|
||||
if ((CraftResourceType.Leather == restype || CraftResourceType.Metal == restype) &&
|
||||
ArmorMaterialType.Bone != ((BaseArmor)item).MaterialType)
|
||||
{
|
||||
valid = true;
|
||||
}
|
||||
}
|
||||
|
||||
// need to add any bags, chests, boxes, crates not IDyable but dyable by natural dyes
|
||||
|
||||
if (valid)
|
||||
{
|
||||
item.Hue = PlantPigmentHueInfo.GetInfo(m_Item.PigmentHue).Hue;
|
||||
from.PlaySound(0x23E);
|
||||
|
||||
if (--m_Item.UsesRemaining > 0)
|
||||
m_Item.InvalidateProperties();
|
||||
else
|
||||
m_Item.Delete();
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
from.SendLocalizedMessage(1042083); // You cannot dye that.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
185
Scripts/Services/BasketWeaving/PlantPigment.cs
Normal file
185
Scripts/Services/BasketWeaving/PlantPigment.cs
Normal file
@@ -0,0 +1,185 @@
|
||||
using System;
|
||||
using Server.Engines.Plants;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class PlantPigment : Item, IPigmentHue
|
||||
{
|
||||
private PlantPigmentHue m_Hue;
|
||||
[Constructable]
|
||||
public PlantPigment()
|
||||
: this(PlantPigmentHue.None)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public PlantPigment(PlantPigmentHue hue)
|
||||
: base(0x0F02)
|
||||
{
|
||||
Weight = 1.0;
|
||||
PigmentHue = hue;
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public PlantPigment(PlantHue hue)
|
||||
: base(0x0F02)
|
||||
{
|
||||
Weight = 1.0;
|
||||
PigmentHue = PlantPigmentHueInfo.HueFromPlantHue(hue);
|
||||
}
|
||||
|
||||
public PlantPigment(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public bool RetainsColorFrom
|
||||
{
|
||||
get
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public PlantPigmentHue PigmentHue
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Hue;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_Hue = value;
|
||||
//set any invalid pigment hue to Plain
|
||||
if (m_Hue != PlantPigmentHueInfo.GetInfo(m_Hue).PlantPigmentHue)
|
||||
m_Hue = PlantPigmentHue.Plain;
|
||||
Hue = PlantPigmentHueInfo.GetInfo(m_Hue).Hue;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
public override int LabelNumber
|
||||
{
|
||||
get
|
||||
{
|
||||
return 1112132;
|
||||
}
|
||||
}// plant pigment
|
||||
public override void AddNameProperty(ObjectPropertyList list)
|
||||
{
|
||||
PlantPigmentHueInfo info = PlantPigmentHueInfo.GetInfo(m_Hue);
|
||||
int cliloc;
|
||||
|
||||
if (Amount > 1)
|
||||
{
|
||||
cliloc = info.IsBright() ? 1113271 : 1113270;
|
||||
list.Add(cliloc, String.Format("{0}\t#{1}", Amount.ToString(), info.Name));
|
||||
}
|
||||
else
|
||||
{
|
||||
cliloc = info.IsBright() ? 1112134 : 1112133;
|
||||
list.Add(cliloc, String.Format("#{0}", info.Name));
|
||||
}
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)1); // version
|
||||
|
||||
writer.Write((int)m_Hue);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 1:
|
||||
m_Hue = (PlantPigmentHue)reader.ReadInt();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (!PlantPigmentHueInfo.IsMixable(PigmentHue))
|
||||
from.SendLocalizedMessage(1112125); // This pigment is saturated and cannot be mixed further.
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(1112123); // Which plant pigment do you wish to mix this with?
|
||||
|
||||
from.Target = new InternalTarget(this);
|
||||
}
|
||||
}
|
||||
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private readonly PlantPigment m_Item;
|
||||
public InternalTarget(PlantPigment item)
|
||||
: base(2, false, TargetFlags.None)
|
||||
{
|
||||
m_Item = item;
|
||||
}
|
||||
|
||||
protected override void OnTarget(Mobile from, object targeted)
|
||||
{
|
||||
if (m_Item.Deleted)
|
||||
return;
|
||||
|
||||
PlantPigment pigment = targeted as PlantPigment;
|
||||
if (null == pigment)
|
||||
{
|
||||
from.SendLocalizedMessage(1112124); // You may only mix this with another non-saturated plant pigment.
|
||||
return;
|
||||
}
|
||||
|
||||
if (from.Skills[SkillName.Alchemy].Base < 75.0 && from.Skills[SkillName.Cooking].Base < 75.0)
|
||||
{
|
||||
from.SendLocalizedMessage(1112214); // You lack the alchemy or cooking skills to mix plant pigments.
|
||||
}
|
||||
else if ((PlantPigmentHue.White == pigment.PigmentHue || PlantPigmentHue.Black == pigment.PigmentHue ||
|
||||
PlantPigmentHue.White == m_Item.PigmentHue || PlantPigmentHue.Black == m_Item.PigmentHue) &&
|
||||
from.Skills[SkillName.Alchemy].Base < 100.0 &&
|
||||
from.Skills[SkillName.Cooking].Base < 100.0)
|
||||
{
|
||||
from.SendLocalizedMessage(1112213); // You lack the alchemy or cooking skills to mix so unstable a pigment.
|
||||
}
|
||||
else if (m_Item.PigmentHue == pigment.PigmentHue)
|
||||
{
|
||||
from.SendLocalizedMessage(1112242); // You decide not to waste pigments by mixing two identical colors.
|
||||
}
|
||||
else if ((m_Item.PigmentHue & ~(PlantPigmentHue.Bright | PlantPigmentHue.Dark | PlantPigmentHue.Ice)) ==
|
||||
(pigment.PigmentHue & ~(PlantPigmentHue.Bright | PlantPigmentHue.Dark | PlantPigmentHue.Ice)))
|
||||
{
|
||||
from.SendLocalizedMessage(1112243); // You decide not to waste pigments by mixing variations of the same hue.
|
||||
}
|
||||
else if ((PlantPigmentHue.White == m_Item.PigmentHue && PlantPigmentHueInfo.IsBright(pigment.PigmentHue)) ||
|
||||
(PlantPigmentHue.White == pigment.PigmentHue && PlantPigmentHueInfo.IsBright(m_Item.PigmentHue)))
|
||||
{
|
||||
from.SendLocalizedMessage(1112241); // This pigment is too diluted to be faded further.
|
||||
}
|
||||
else if (!PlantPigmentHueInfo.IsMixable(pigment.PigmentHue))
|
||||
from.SendLocalizedMessage(1112125); // This pigment is saturated and cannot be mixed further.
|
||||
else
|
||||
{
|
||||
PlantPigmentHue newHue = PlantPigmentHueInfo.Mix(m_Item.PigmentHue, pigment.PigmentHue);
|
||||
if (PlantPigmentHue.None == newHue)
|
||||
from.SendLocalizedMessage(1112125); // This pigment is saturated and cannot be mixed further.
|
||||
else
|
||||
{
|
||||
pigment.PigmentHue = newHue;
|
||||
Bottle bottle = new Bottle();
|
||||
bottle.MoveToWorld(m_Item.Location, m_Item.Map);
|
||||
m_Item.Delete();
|
||||
from.PlaySound(0x240);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
259
Scripts/Services/BasketWeaving/PlantPigmentHue.cs
Normal file
259
Scripts/Services/BasketWeaving/PlantPigmentHue.cs
Normal file
@@ -0,0 +1,259 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Server.Engines.Plants
|
||||
{
|
||||
public interface IPlantHue
|
||||
{
|
||||
PlantHue PlantHue { get; set; }
|
||||
void InvalidatePlantHue();
|
||||
}
|
||||
|
||||
public interface IPigmentHue
|
||||
{
|
||||
PlantPigmentHue PigmentHue { get; set; }
|
||||
}
|
||||
|
||||
[Flags]
|
||||
public enum PlantPigmentHue
|
||||
{
|
||||
None = 0,
|
||||
|
||||
Plain = 0x1,
|
||||
|
||||
Red = 0x2,
|
||||
Blue = 0x4,
|
||||
Yellow = 0x8,
|
||||
|
||||
Purple = Red | Blue,
|
||||
Green = Blue | Yellow,
|
||||
Orange = Red | Yellow,
|
||||
|
||||
Black = 0x10,
|
||||
White = 0x20,
|
||||
|
||||
Pink = 0x40,
|
||||
Magenta = 0x80,
|
||||
Aqua = 0x100,
|
||||
FireRed = 0x200,
|
||||
|
||||
BrightRed = Red | Bright,
|
||||
BrightBlue = Blue | Bright,
|
||||
BrightYellow = Yellow | Bright,
|
||||
|
||||
BrightPurple = Purple | Bright,
|
||||
BrightGreen = Green | Bright,
|
||||
BrightOrange = Orange | Bright,
|
||||
|
||||
DarkRed = Red | Dark,
|
||||
DarkBlue = Blue | Dark,
|
||||
DarkYellow = Yellow | Dark,
|
||||
|
||||
DarkPurple = Purple | Dark,
|
||||
DarkGreen = Green | Dark,
|
||||
DarkOrange = Orange | Dark,
|
||||
|
||||
IceRed = Red | Ice,
|
||||
IceBlue = Blue | Ice,
|
||||
IceYellow = Yellow | Ice,
|
||||
|
||||
IcePurple = Purple | Ice,
|
||||
IceGreen = Green | Ice,
|
||||
IceOrange = Orange | Ice,
|
||||
|
||||
IceBlack = Black | Ice,
|
||||
OffWhite = White | Bright,
|
||||
Metal = Black | Bright,
|
||||
|
||||
Ice = 0x2000000,
|
||||
Dark = 0x4000000,
|
||||
Bright = 0x8000000,
|
||||
}
|
||||
|
||||
public class PlantPigmentHueInfo
|
||||
{
|
||||
private static Dictionary<PlantPigmentHue, PlantPigmentHueInfo> m_Table;
|
||||
private readonly PlantHue m_PlantHue;
|
||||
private readonly int m_Hue;
|
||||
private readonly int m_Name;
|
||||
private readonly PlantPigmentHue m_PlantPigmentHue;
|
||||
static PlantPigmentHueInfo()
|
||||
{
|
||||
m_Table = new Dictionary<PlantPigmentHue, PlantPigmentHueInfo>();
|
||||
|
||||
m_Table[PlantPigmentHue.Plain] = new PlantPigmentHueInfo(PlantHue.Plain, 2101, 1060813, PlantPigmentHue.Plain);
|
||||
m_Table[PlantPigmentHue.Red] = new PlantPigmentHueInfo(PlantHue.Red, 1652, 1060814, PlantPigmentHue.Red);
|
||||
m_Table[PlantPigmentHue.Blue] = new PlantPigmentHueInfo(PlantHue.Blue, 2122, 1060815, PlantPigmentHue.Blue);
|
||||
m_Table[PlantPigmentHue.Yellow] = new PlantPigmentHueInfo(PlantHue.Yellow, 2125, 1060818, PlantPigmentHue.Yellow);
|
||||
m_Table[PlantPigmentHue.BrightRed] = new PlantPigmentHueInfo(PlantHue.BrightRed, 1646, 1060814, PlantPigmentHue.BrightRed);
|
||||
m_Table[PlantPigmentHue.BrightBlue] = new PlantPigmentHueInfo(PlantHue.BrightBlue, 1310, 1060815, PlantPigmentHue.BrightBlue);
|
||||
m_Table[PlantPigmentHue.BrightYellow] = new PlantPigmentHueInfo(PlantHue.BrightYellow, 253, 1060818, PlantPigmentHue.BrightYellow);
|
||||
m_Table[PlantPigmentHue.DarkRed] = new PlantPigmentHueInfo(PlantHue.Plain, 1141, 1112162, PlantPigmentHue.DarkRed);
|
||||
m_Table[PlantPigmentHue.DarkBlue] = new PlantPigmentHueInfo(PlantHue.Plain, 1317, 1112164, PlantPigmentHue.DarkBlue);
|
||||
m_Table[PlantPigmentHue.DarkYellow] = new PlantPigmentHueInfo(PlantHue.Plain, 2217, 1112165, PlantPigmentHue.DarkYellow);
|
||||
m_Table[PlantPigmentHue.IceRed] = new PlantPigmentHueInfo(PlantHue.Plain, 335, 1112169, PlantPigmentHue.IceRed);
|
||||
m_Table[PlantPigmentHue.IceBlue] = new PlantPigmentHueInfo(PlantHue.Plain, 1154, 1112168, PlantPigmentHue.IceBlue);
|
||||
m_Table[PlantPigmentHue.IceYellow] = new PlantPigmentHueInfo(PlantHue.Plain, 56, 1112171, PlantPigmentHue.IceYellow);
|
||||
m_Table[PlantPigmentHue.Purple] = new PlantPigmentHueInfo(PlantHue.Purple, 15, 1060816, PlantPigmentHue.Purple);
|
||||
m_Table[PlantPigmentHue.Green] = new PlantPigmentHueInfo(PlantHue.Green, 2128, 1060819, PlantPigmentHue.Green);
|
||||
m_Table[PlantPigmentHue.Orange] = new PlantPigmentHueInfo(PlantHue.Orange, 1128, 1060817, PlantPigmentHue.Orange);
|
||||
m_Table[PlantPigmentHue.BrightPurple] = new PlantPigmentHueInfo(PlantHue.BrightPurple, 316, 1060816, PlantPigmentHue.BrightPurple);
|
||||
m_Table[PlantPigmentHue.BrightGreen] = new PlantPigmentHueInfo(PlantHue.BrightGreen, 671, 1060819, PlantPigmentHue.BrightGreen);
|
||||
m_Table[PlantPigmentHue.BrightOrange] = new PlantPigmentHueInfo(PlantHue.BrightOrange, 1501, 1060817, PlantPigmentHue.BrightOrange);
|
||||
m_Table[PlantPigmentHue.DarkPurple] = new PlantPigmentHueInfo(PlantHue.Plain, 1254, 1113166, PlantPigmentHue.DarkPurple);
|
||||
m_Table[PlantPigmentHue.DarkGreen] = new PlantPigmentHueInfo(PlantHue.Plain, 1425, 1112163, PlantPigmentHue.DarkGreen);
|
||||
m_Table[PlantPigmentHue.DarkOrange] = new PlantPigmentHueInfo(PlantHue.Plain, 1509, 1112161, PlantPigmentHue.DarkOrange);
|
||||
m_Table[PlantPigmentHue.IcePurple] = new PlantPigmentHueInfo(PlantHue.Plain, 511, 1112172, PlantPigmentHue.IcePurple);
|
||||
m_Table[PlantPigmentHue.IceGreen] = new PlantPigmentHueInfo(PlantHue.Plain, 261, 1112167, PlantPigmentHue.IceGreen);
|
||||
m_Table[PlantPigmentHue.IceOrange] = new PlantPigmentHueInfo(PlantHue.Plain, 346, 1112170, PlantPigmentHue.IceOrange);
|
||||
m_Table[PlantPigmentHue.Black] = new PlantPigmentHueInfo(PlantHue.Black, 1175, 1060820, PlantPigmentHue.Black);
|
||||
m_Table[PlantPigmentHue.White] = new PlantPigmentHueInfo(PlantHue.White, 1150, 1060821, PlantPigmentHue.White);
|
||||
m_Table[PlantPigmentHue.IceBlack] = new PlantPigmentHueInfo(PlantHue.Plain, 2422, 1112988, PlantPigmentHue.IceBlack);
|
||||
m_Table[PlantPigmentHue.OffWhite] = new PlantPigmentHueInfo(PlantHue.Plain, 746, 1112224, PlantPigmentHue.OffWhite);
|
||||
m_Table[PlantPigmentHue.Metal] = new PlantPigmentHueInfo(PlantHue.Plain, 1105, 1015046, PlantPigmentHue.Metal);
|
||||
m_Table[PlantPigmentHue.Pink] = new PlantPigmentHueInfo(PlantHue.Pink, 341, 1061854, PlantPigmentHue.Pink);
|
||||
m_Table[PlantPigmentHue.Magenta] = new PlantPigmentHueInfo(PlantHue.Magenta, 1163, 1061852, PlantPigmentHue.Magenta);
|
||||
m_Table[PlantPigmentHue.Aqua] = new PlantPigmentHueInfo(PlantHue.Aqua, 391, 1061853, PlantPigmentHue.Aqua);
|
||||
m_Table[PlantPigmentHue.FireRed] = new PlantPigmentHueInfo(PlantHue.FireRed, 1358, 1061855, PlantPigmentHue.FireRed);
|
||||
}
|
||||
|
||||
private PlantPigmentHueInfo(PlantHue planthue, int hue, int name, PlantPigmentHue pigmentHue)
|
||||
{
|
||||
this.m_PlantHue = planthue;
|
||||
this.m_Hue = hue;
|
||||
this.m_Name = name;
|
||||
this.m_PlantPigmentHue = pigmentHue;
|
||||
}
|
||||
|
||||
public PlantHue PlantHue
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_PlantHue;
|
||||
}
|
||||
}
|
||||
public int Hue
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_Hue;
|
||||
}
|
||||
}
|
||||
public int Name
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_Name;
|
||||
}
|
||||
}
|
||||
public PlantPigmentHue PlantPigmentHue
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_PlantPigmentHue;
|
||||
}
|
||||
}
|
||||
public static PlantPigmentHue HueFromPlantHue(PlantHue hue)
|
||||
{
|
||||
if (hue == PlantHue.None || hue == PlantHue.Plain)
|
||||
return PlantPigmentHue.Plain;
|
||||
|
||||
foreach (KeyValuePair<PlantPigmentHue, PlantPigmentHueInfo> kvp in m_Table)
|
||||
{
|
||||
if (kvp.Value.PlantHue == hue)
|
||||
return kvp.Key;
|
||||
}
|
||||
|
||||
return PlantPigmentHue.Plain;
|
||||
}
|
||||
|
||||
public static PlantPigmentHueInfo GetInfo(PlantPigmentHue hue)
|
||||
{
|
||||
if (!m_Table.ContainsKey(hue))
|
||||
return m_Table[PlantPigmentHue.Plain];
|
||||
|
||||
return m_Table[hue];
|
||||
}
|
||||
|
||||
public static bool IsMixable(PlantPigmentHue hue)
|
||||
{
|
||||
return (hue <= PlantPigmentHue.White && hue != PlantPigmentHue.None);
|
||||
}
|
||||
|
||||
public static bool IsBright(PlantPigmentHue hue)
|
||||
{
|
||||
return (hue & PlantPigmentHue.Bright) != PlantPigmentHue.None;
|
||||
}
|
||||
|
||||
public static bool IsPrimary(PlantPigmentHue hue)
|
||||
{
|
||||
return hue == PlantPigmentHue.Red || hue == PlantPigmentHue.Blue || hue == PlantPigmentHue.Yellow;
|
||||
}
|
||||
|
||||
public static PlantPigmentHue Mix(PlantPigmentHue first, PlantPigmentHue second)
|
||||
{
|
||||
if (!IsMixable(first) || !IsMixable(second))
|
||||
return PlantPigmentHue.None;
|
||||
|
||||
if (first == second && (PlantPigmentHue.Plain == first || PlantPigmentHue.Black == first || PlantPigmentHue.White == first))
|
||||
return PlantPigmentHue.None;
|
||||
|
||||
if (first == second)
|
||||
return second | PlantPigmentHue.Bright;
|
||||
|
||||
if (first == PlantPigmentHue.Plain)
|
||||
return second | PlantPigmentHue.Bright;
|
||||
else if (second == PlantPigmentHue.Plain)
|
||||
return first | PlantPigmentHue.Bright;
|
||||
|
||||
if (first == PlantPigmentHue.White)
|
||||
return second | PlantPigmentHue.Ice;
|
||||
else if (second == PlantPigmentHue.White)
|
||||
return first | PlantPigmentHue.Ice;
|
||||
|
||||
if (first == PlantPigmentHue.Black)
|
||||
return second | PlantPigmentHue.Dark;
|
||||
else if (second == PlantPigmentHue.Black)
|
||||
return first | PlantPigmentHue.Dark;
|
||||
|
||||
bool firstPrimary = IsPrimary(first);
|
||||
bool secondPrimary = IsPrimary(second);
|
||||
|
||||
if (firstPrimary && secondPrimary)
|
||||
return first | second;
|
||||
|
||||
//
|
||||
// not sure after this point
|
||||
//
|
||||
// the remaining combinations to precess are (orange,purple,green with
|
||||
// any of red, blue, yellow, orange, purple, green)
|
||||
// the code below is temporary until proper mixed hues can be confirmed
|
||||
//
|
||||
// mixing table on stratics seems incorrect because the table is not symmetrical
|
||||
//
|
||||
|
||||
if (firstPrimary && !secondPrimary)
|
||||
return first;
|
||||
|
||||
if (!firstPrimary && secondPrimary)
|
||||
return second;
|
||||
|
||||
return first & second;
|
||||
}
|
||||
|
||||
public bool IsMixable()
|
||||
{
|
||||
return IsMixable(this.m_PlantPigmentHue);
|
||||
}
|
||||
|
||||
public bool IsBright()
|
||||
{
|
||||
return IsBright(this.m_PlantPigmentHue);
|
||||
}
|
||||
|
||||
public bool IsPrimary()
|
||||
{
|
||||
return IsPrimary(this.m_PlantPigmentHue);
|
||||
}
|
||||
}
|
||||
}
|
||||
126
Scripts/Services/BasketWeaving/SilverSapling.cs
Normal file
126
Scripts/Services/BasketWeaving/SilverSapling.cs
Normal file
@@ -0,0 +1,126 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.ContextMenus;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class SilverSapling : Item
|
||||
{
|
||||
public override int LabelNumber { get { return 1113052; } } // The Silver Sapling
|
||||
|
||||
[Constructable]
|
||||
public SilverSapling()
|
||||
: base(0x0CE3)
|
||||
{
|
||||
Hue = 1150;
|
||||
Movable = false;
|
||||
}
|
||||
|
||||
public SilverSapling(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override bool HandlesOnMovement { get { return true; } }
|
||||
|
||||
public override void OnMovement(Mobile m, Point3D oldLocation)
|
||||
{
|
||||
if (Parent == null && Utility.InRange(Location, m.Location, 1) && !Utility.InRange(Location, oldLocation, 1))
|
||||
Ankhs.Resurrect(m, this);
|
||||
}
|
||||
|
||||
public override void GetContextMenuEntries(Mobile from, List<ContextMenuEntry> list)
|
||||
{
|
||||
base.GetContextMenuEntries(from, list);
|
||||
Ankhs.GetContextMenuEntries(from, this, list);
|
||||
}
|
||||
|
||||
public override void OnDoubleClickDead(Mobile m)
|
||||
{
|
||||
Ankhs.Resurrect(m, this);
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile m)
|
||||
{
|
||||
PlayerMobile pm = m as PlayerMobile;
|
||||
|
||||
if (pm != null && pm.Backpack != null)
|
||||
{
|
||||
if (pm.SSNextSeed > DateTime.UtcNow)
|
||||
{
|
||||
pm.SendLocalizedMessage(1113042); // You must wait a full day before receiving another Seed of the Silver Sapling
|
||||
}
|
||||
else
|
||||
{
|
||||
pm.SendLocalizedMessage(1113043); // The Silver Sapling pulses with light, and a shining seed appears in your hands.
|
||||
pm.SSNextSeed = DateTime.UtcNow + TimeSpan.FromDays(1.0);
|
||||
pm.PlaceInBackpack(new SilverSaplingSeed());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class SilverSaplingSeed : Item
|
||||
{
|
||||
public override int LabelNumber { get { return 1113053; } } // a seed of the Silver Sapling
|
||||
|
||||
[Constructable]
|
||||
public SilverSaplingSeed()
|
||||
: base(0x0DCF)
|
||||
{
|
||||
Hue = 1150;
|
||||
Stackable = true;
|
||||
}
|
||||
|
||||
public SilverSaplingSeed(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile m)
|
||||
{
|
||||
PlayerMobile pm = m as PlayerMobile;
|
||||
|
||||
if (pm == null)
|
||||
return;
|
||||
|
||||
if (pm.Region.IsPartOf("Abyss"))
|
||||
{
|
||||
pm.SendLocalizedMessage(1113056, "", 0x3C); // The seed disappears into the earth and for a brief moment you see a vision of a small sapling growing before you. Should you perish in your adventures in the Abyss, you shall be restored to this place with your possessions.
|
||||
Consume();
|
||||
pm.SSSeedLocation = pm.Location;
|
||||
pm.SSSeedMap = pm.Map;
|
||||
pm.SSSeedExpire = DateTime.UtcNow + TimeSpan.FromDays(1.0);
|
||||
}
|
||||
else
|
||||
{
|
||||
pm.SendLocalizedMessage(1113055, "", 0x23); // The seed of the Silver Sapling can only be planted within the Stygian Abyss...
|
||||
}
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
110
Scripts/Services/BulkOrders/Books/BOBFilter.cs
Normal file
110
Scripts/Services/BulkOrders/Books/BOBFilter.cs
Normal file
@@ -0,0 +1,110 @@
|
||||
using System;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class BOBFilter
|
||||
{
|
||||
private int m_Type;
|
||||
private int m_Quality;
|
||||
private int m_Material;
|
||||
private int m_Quantity;
|
||||
|
||||
public BOBFilter()
|
||||
{
|
||||
}
|
||||
|
||||
public BOBFilter(GenericReader reader)
|
||||
{
|
||||
int version = reader.ReadEncodedInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
this.m_Type = reader.ReadEncodedInt();
|
||||
this.m_Quality = reader.ReadEncodedInt();
|
||||
this.m_Material = reader.ReadEncodedInt();
|
||||
this.m_Quantity = reader.ReadEncodedInt();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsDefault
|
||||
{
|
||||
get
|
||||
{
|
||||
return (this.m_Type == 0 && this.m_Quality == 0 && this.m_Material == 0 && this.m_Quantity == 0);
|
||||
}
|
||||
}
|
||||
public int Type
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_Type;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.m_Type = value;
|
||||
}
|
||||
}
|
||||
public int Quality
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_Quality;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.m_Quality = value;
|
||||
}
|
||||
}
|
||||
public int Material
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_Material;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.m_Material = value;
|
||||
}
|
||||
}
|
||||
public int Quantity
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_Quantity;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.m_Quantity = value;
|
||||
}
|
||||
}
|
||||
public void Clear()
|
||||
{
|
||||
this.m_Type = 0;
|
||||
this.m_Quality = 0;
|
||||
this.m_Material = 0;
|
||||
this.m_Quantity = 0;
|
||||
}
|
||||
|
||||
public void Serialize(GenericWriter writer)
|
||||
{
|
||||
if (this.IsDefault)
|
||||
{
|
||||
writer.WriteEncodedInt(0); // version
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteEncodedInt(1); // version
|
||||
|
||||
writer.WriteEncodedInt(this.m_Type);
|
||||
writer.WriteEncodedInt(this.m_Quality);
|
||||
writer.WriteEncodedInt(this.m_Material);
|
||||
writer.WriteEncodedInt(this.m_Quantity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
316
Scripts/Services/BulkOrders/Books/BOBFilterGump.cs
Normal file
316
Scripts/Services/BulkOrders/Books/BOBFilterGump.cs
Normal file
@@ -0,0 +1,316 @@
|
||||
using System;
|
||||
using Server.Gumps;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class BOBFilterGump : Gump
|
||||
{
|
||||
private static int[,] m_MaterialFilters = new int[,]
|
||||
{
|
||||
{ 1044067, 1 }, // Blacksmithy
|
||||
{ 1062226, 3 }, // Iron
|
||||
{ 1018332, 4 }, // Dull Copper
|
||||
{ 1018333, 5 }, // Shadow Iron
|
||||
{ 1018334, 6 }, // Copper
|
||||
{ 1018335, 7 }, // Bronze
|
||||
|
||||
{ 0, 0 }, // --Blank--
|
||||
{ 1018336, 8 }, // Golden
|
||||
{ 1018337, 9 }, // Agapite
|
||||
{ 1018338, 10 }, // Verite
|
||||
{ 1018339, 11 }, // Valorite
|
||||
{ 0, 0 }, // --Blank--
|
||||
|
||||
{ 1044094, 2 }, // Tailoring
|
||||
{ 1044286, 12 }, // Cloth
|
||||
{ 1062235, 13 }, // Leather
|
||||
{ 1062236, 14 }, // Spined
|
||||
{ 1062237, 15 }, // Horned
|
||||
{ 1062238, 16 } // Barbed
|
||||
};
|
||||
|
||||
private static readonly int[,] m_MaterialFiltersNew = new int[,]
|
||||
{
|
||||
{ 1044067, 1 }, // Blacksmithy
|
||||
{ 1062226, 9 }, // Iron
|
||||
{ 1018332, 10 }, // Dull Copper
|
||||
{ 1018333, 11 }, // Shadow Iron
|
||||
{ 1018334, 12 }, // Copper
|
||||
{ 1018335, 13 }, // Bronze
|
||||
|
||||
{ 0, 0 }, // --Blank--
|
||||
{ 1018336, 14 }, // Golden
|
||||
{ 1018337, 15 }, // Agapite
|
||||
{ 1018338, 16 }, // Verite
|
||||
{ 1018339, 17 }, // Valorite
|
||||
{ 0, 0 }, // --Blank--
|
||||
|
||||
{ 1044094, 2 }, // Tailoring
|
||||
{ 1044286, 18 }, // Cloth
|
||||
{ 1062235, 19 }, // Leather
|
||||
{ 1062236, 20 }, // Spined
|
||||
{ 1062237, 21 }, // Horned
|
||||
{ 1062238, 22 }, // Barbed
|
||||
|
||||
{ 1044097, 3 }, // Tinkering
|
||||
{ 1062226, 23 }, // Iron
|
||||
{ 1018332, 24 }, // Dull Copper
|
||||
{ 1018333, 25 }, // Shadow Iron
|
||||
{ 1018334, 26 }, // Copper
|
||||
{ 1018335, 27 }, // Bronze
|
||||
|
||||
{ 0, 0 }, // --Blank--
|
||||
{ 1018336, 28 }, // Golden
|
||||
{ 1018337, 29 }, // Agapite
|
||||
{ 1018338, 30 }, // Verite
|
||||
{ 1018339, 31 }, // Valorite
|
||||
{ 0, 0 }, // --Blank--
|
||||
|
||||
{ 1044071, 4 }, // Carpentry
|
||||
{ 1079435, 32 }, // Wood
|
||||
{ 1071428, 33 }, // Oak
|
||||
{ 1071429, 34 }, // Ash
|
||||
{ 1071430, 35 }, // Yew
|
||||
{ 0, 0 }, // --Blank--
|
||||
|
||||
{ 0, 0 }, // --Blank--
|
||||
{ 1071431, 36 }, // Bloodwood
|
||||
{ 1071432, 37 }, // Heartwood
|
||||
{ 1071433, 38 }, // Frostwood
|
||||
{ 0, 0 }, // --Blank--
|
||||
{ 0, 0 }, // --Blank--
|
||||
|
||||
{ 1044068, 5 }, // Fletching
|
||||
{ 1079435, 39 }, // Wood
|
||||
{ 1071428, 40 }, // Oak
|
||||
{ 1071429, 41 }, // Ash
|
||||
{ 1071430, 42 }, // Yew
|
||||
{ 0, 0 }, // --Blank--
|
||||
|
||||
{ 0, 0 }, // --Blank--
|
||||
{ 1071431, 43 }, // Bloodwood
|
||||
{ 1071432, 44 }, // Heartwood
|
||||
{ 1071433, 45 }, // Frostwood
|
||||
{ 0, 0 }, // --Blank--
|
||||
{ 0, 0 }, // --Blank--
|
||||
|
||||
{ 1044060, 6 }, // Alchemy
|
||||
{ 0, 0 }, // --Blank--
|
||||
{ 0, 0 }, // --Blank--
|
||||
{ 0, 0 }, // --Blank--
|
||||
{ 0, 0 }, // --Blank--
|
||||
{ 0, 0 }, // --Blank--
|
||||
|
||||
{ 1044083, 7 }, // Inscription
|
||||
{ 0, 0 }, // --Blank--
|
||||
{ 0, 0 }, // --Blank--
|
||||
{ 0, 0 }, // --Blank--
|
||||
{ 0, 0 }, // --Blank--
|
||||
{ 0, 0 }, // --Blank--
|
||||
|
||||
{ 1044073, 8 }, // Cooking
|
||||
{ 0, 0 }, // --Blank--
|
||||
{ 0, 0 }, // --Blank--
|
||||
{ 0, 0 }, // --Blank--
|
||||
{ 0, 0 }, // --Blank--
|
||||
{ 0, 0 }, // --Blank--
|
||||
};
|
||||
|
||||
private static readonly int[,] m_TypeFilters = new int[,]
|
||||
{
|
||||
{ 1062229, 0 }, // All
|
||||
{ 1062224, 1 }, // Small
|
||||
{ 1062225, 2 }// Large
|
||||
};
|
||||
|
||||
private static readonly int[,] m_QualityFilters = new int[,]
|
||||
{
|
||||
{ 1062229, 0 }, // All
|
||||
{ 1011542, 1 }, // Normal
|
||||
{ 1060636, 2 }// Exceptional
|
||||
};
|
||||
|
||||
private static readonly int[,] m_AmountFilters = new int[,]
|
||||
{
|
||||
{ 1062229, 0 }, // All
|
||||
{ 1049706, 1 }, // 10
|
||||
{ 1016007, 2 }, // 15
|
||||
{ 1062239, 3 }// 20
|
||||
};
|
||||
|
||||
private static readonly int[][,] m_Filters = new int[][,]
|
||||
{
|
||||
m_TypeFilters,
|
||||
m_QualityFilters,
|
||||
m_MaterialFilters,
|
||||
m_AmountFilters
|
||||
};
|
||||
|
||||
private static readonly int[][,] m_FiltersNew = new int[][,]
|
||||
{
|
||||
m_TypeFilters,
|
||||
m_QualityFilters,
|
||||
m_MaterialFiltersNew,
|
||||
m_AmountFilters
|
||||
};
|
||||
|
||||
private static readonly int[] m_XOffsets_Type = new int[] { 0, 75, 170 };
|
||||
private static readonly int[] m_XOffsets_Quality = new int[] { 0, 75, 170 };
|
||||
private static readonly int[] m_XOffsets_Amount = new int[] { 0, 75, 180, 275 };
|
||||
private static readonly int[] m_XOffsets_Material = new int[] { 0, 108, 212, 307, 392, 487 };
|
||||
private static readonly int[] m_XWidths_Small = new int[] { 50, 50, 70, 50 };
|
||||
private static readonly int[] m_XWidths_Large = new int[] { 80, 60, 60, 60, 60, 60 };
|
||||
|
||||
private const int LabelColor = 0x7FFF;
|
||||
private readonly PlayerMobile m_From;
|
||||
private readonly BulkOrderBook m_Book;
|
||||
|
||||
public BOBFilterGump(PlayerMobile from, BulkOrderBook book)
|
||||
: base(12, 24)
|
||||
{
|
||||
from.CloseGump(typeof(BOBGump));
|
||||
from.CloseGump(typeof(BOBFilterGump));
|
||||
|
||||
m_From = from;
|
||||
m_Book = book;
|
||||
|
||||
BOBFilter f = (from.UseOwnFilter ? from.BOBFilter : book.Filter);
|
||||
|
||||
AddPage(0);
|
||||
|
||||
AddBackground(10, 10, 600, 695, 5054);
|
||||
|
||||
AddImageTiled(18, 20, 583, 676, 2624);
|
||||
AddAlphaRegion(18, 20, 583, 676);
|
||||
|
||||
AddImage(5, 5, 10460);
|
||||
AddImage(585, 5, 10460);
|
||||
AddImage(5, 690, 10460);
|
||||
AddImage(585, 690, 10460);
|
||||
|
||||
AddHtmlLocalized(270, 32, 200, 32, 1062223, LabelColor, false, false); // Filter Preference
|
||||
|
||||
AddHtmlLocalized(26, 64, 120, 32, 1062228, LabelColor, false, false); // Bulk Order Type
|
||||
AddFilterList(25, 96, m_XOffsets_Type, 40, m_TypeFilters, m_XWidths_Small, f.Type, 0);
|
||||
|
||||
AddHtmlLocalized(320, 64, 50, 32, 1062215, LabelColor, false, false); // Quality
|
||||
AddFilterList(320, 96, m_XOffsets_Quality, 40, m_QualityFilters, m_XWidths_Small, f.Quality, 1);
|
||||
|
||||
AddHtmlLocalized(26, 130, 120, 32, 1062232, LabelColor, false, false); // Material Type
|
||||
AddFilterList(25, 162, m_XOffsets_Material, 35, BulkOrderSystem.NewSystemEnabled ? m_MaterialFiltersNew : m_MaterialFilters, m_XWidths_Large, f.Material, 2);
|
||||
|
||||
AddHtmlLocalized(26, 608, 120, 32, 1062217, LabelColor, false, false); // Amount
|
||||
AddFilterList(25, 640, m_XOffsets_Amount, 40, m_AmountFilters, m_XWidths_Small, f.Quantity, 3);
|
||||
|
||||
AddHtmlLocalized(75, 670, 120, 32, 1062477, (from.UseOwnFilter ? LabelColor : 16927), false, false); // Set Book Filter
|
||||
AddButton(40, 670, 4005, 4007, 1, GumpButtonType.Reply, 0);
|
||||
|
||||
AddHtmlLocalized(235, 670, 120, 32, 1062478, (from.UseOwnFilter ? 16927 : LabelColor), false, false); // Set Your Filter
|
||||
AddButton(200, 670, 4005, 4007, 2, GumpButtonType.Reply, 0);
|
||||
|
||||
AddHtmlLocalized(405, 670, 120, 32, 1062231, LabelColor, false, false); // Clear Filter
|
||||
AddButton(370, 670, 4005, 4007, 3, GumpButtonType.Reply, 0);
|
||||
|
||||
AddHtmlLocalized(540, 670, 50, 32, 1011046, LabelColor, false, false); // APPLY
|
||||
AddButton(505, 670, 4017, 4018, 0, GumpButtonType.Reply, 0);
|
||||
}
|
||||
|
||||
public override void OnResponse(Server.Network.NetState sender, RelayInfo info)
|
||||
{
|
||||
BOBFilter f = (m_From.UseOwnFilter ? m_From.BOBFilter : m_Book.Filter);
|
||||
|
||||
int index = info.ButtonID;
|
||||
|
||||
switch ( index )
|
||||
{
|
||||
case 0: // Apply
|
||||
{
|
||||
m_From.SendGump(new BOBGump(m_From, m_Book));
|
||||
|
||||
break;
|
||||
}
|
||||
case 1: // Set Book Filter
|
||||
{
|
||||
m_From.UseOwnFilter = false;
|
||||
m_From.SendGump(new BOBFilterGump(m_From, m_Book));
|
||||
|
||||
break;
|
||||
}
|
||||
case 2: // Set Your Filter
|
||||
{
|
||||
m_From.UseOwnFilter = true;
|
||||
m_From.SendGump(new BOBFilterGump(m_From, m_Book));
|
||||
|
||||
break;
|
||||
}
|
||||
case 3: // Clear Filter
|
||||
{
|
||||
f.Clear();
|
||||
m_From.SendGump(new BOBFilterGump(m_From, m_Book));
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
index -= 4;
|
||||
|
||||
int type = index % 4;
|
||||
index /= 4;
|
||||
|
||||
int[][,] filter = BulkOrderSystem.NewSystemEnabled ? m_FiltersNew : m_Filters;
|
||||
|
||||
if (type >= 0 && type < filter.Length)
|
||||
{
|
||||
int[,] filters = filter[type];
|
||||
|
||||
if (index >= 0 && index < filters.GetLength(0))
|
||||
{
|
||||
if (filters[index, 0] == 0)
|
||||
break;
|
||||
|
||||
switch ( type )
|
||||
{
|
||||
case 0:
|
||||
f.Type = filters[index, 1];
|
||||
break;
|
||||
case 1:
|
||||
f.Quality = filters[index, 1];
|
||||
break;
|
||||
case 2:
|
||||
f.Material = filters[index, 1];
|
||||
break;
|
||||
case 3:
|
||||
f.Quantity = filters[index, 1];
|
||||
break;
|
||||
}
|
||||
|
||||
m_From.SendGump(new BOBFilterGump(m_From, m_Book));
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void AddFilterList(int x, int y, int[] xOffsets, int yOffset, int[,] filters, int[] xWidths, int filterValue, int filterIndex)
|
||||
{
|
||||
for (int i = 0; i < filters.GetLength(0); ++i)
|
||||
{
|
||||
int number = filters[i, 0];
|
||||
|
||||
if (number == 0)
|
||||
continue;
|
||||
|
||||
bool isSelected = (filters[i, 1] == filterValue);
|
||||
|
||||
if (!isSelected && (i % xOffsets.Length) == 0)
|
||||
isSelected = (filterValue == 0);
|
||||
|
||||
AddHtmlLocalized(x + 35 + xOffsets[i % xOffsets.Length], y + ((i / xOffsets.Length) * yOffset), xWidths[i % xOffsets.Length], 32, number, isSelected ? 16927 : LabelColor, false, false);
|
||||
AddButton(x + xOffsets[i % xOffsets.Length], y + ((i / xOffsets.Length) * yOffset), 4005, 4007, 4 + filterIndex + (i * 4), GumpButtonType.Reply, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
848
Scripts/Services/BulkOrders/Books/BOBGump.cs
Normal file
848
Scripts/Services/BulkOrders/Books/BOBGump.cs
Normal file
@@ -0,0 +1,848 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using Server.Gumps;
|
||||
using Server.Items;
|
||||
using Server.Mobiles;
|
||||
using Server.Prompts;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class BOBGump : Gump
|
||||
{
|
||||
private const int LabelColor = 0x7FFF;
|
||||
private readonly PlayerMobile m_From;
|
||||
private readonly BulkOrderBook m_Book;
|
||||
private readonly ArrayList m_List;
|
||||
private int m_Page;
|
||||
public BOBGump(PlayerMobile from, BulkOrderBook book)
|
||||
: this(from, book, 0, null)
|
||||
{
|
||||
}
|
||||
|
||||
public BOBGump(PlayerMobile from, BulkOrderBook book, int page, ArrayList list)
|
||||
: base(12, 24)
|
||||
{
|
||||
from.CloseGump(typeof(BOBGump));
|
||||
from.CloseGump(typeof(BOBFilterGump));
|
||||
|
||||
m_From = from;
|
||||
m_Book = book;
|
||||
m_Page = page;
|
||||
|
||||
if (list == null)
|
||||
{
|
||||
list = new ArrayList(book.Entries.Count);
|
||||
|
||||
for (int i = 0; i < book.Entries.Count; ++i)
|
||||
{
|
||||
object obj = book.Entries[i];
|
||||
|
||||
if (CheckFilter(obj))
|
||||
list.Add(obj);
|
||||
}
|
||||
}
|
||||
|
||||
m_List = list;
|
||||
|
||||
int index = GetIndexForPage(page);
|
||||
int count = GetCountForIndex(index);
|
||||
|
||||
int tableIndex = 0;
|
||||
|
||||
PlayerVendor pv = book.RootParent as PlayerVendor;
|
||||
|
||||
bool canDrop = book.IsChildOf(from.Backpack);
|
||||
bool canBuy = (pv != null);
|
||||
bool canPrice = (canDrop || canBuy);
|
||||
|
||||
if (canBuy)
|
||||
{
|
||||
VendorItem vi = pv.GetVendorItem(book);
|
||||
|
||||
canBuy = (vi != null && !vi.IsForSale);
|
||||
}
|
||||
|
||||
int width = 600;
|
||||
|
||||
if (!canPrice)
|
||||
width = 516;
|
||||
|
||||
X = (624 - width) / 2;
|
||||
|
||||
AddPage(0);
|
||||
|
||||
AddBackground(10, 10, width, 439, 5054);
|
||||
AddImageTiled(18, 20, width - 17, 420, 2624);
|
||||
|
||||
if (canPrice)
|
||||
{
|
||||
AddImageTiled(573, 64, 24, 352, 200);
|
||||
AddImageTiled(493, 64, 78, 352, 1416);
|
||||
}
|
||||
|
||||
if (canDrop)
|
||||
AddImageTiled(24, 64, 32, 352, 1416);
|
||||
|
||||
AddImageTiled(58, 64, 36, 352, 200);
|
||||
AddImageTiled(96, 64, 133, 352, 1416);
|
||||
AddImageTiled(231, 64, 80, 352, 200);
|
||||
AddImageTiled(313, 64, 100, 352, 1416);
|
||||
AddImageTiled(415, 64, 76, 352, 200);
|
||||
|
||||
for (int i = index; i < (index + count) && i >= 0 && i < list.Count; ++i)
|
||||
{
|
||||
object obj = list[i];
|
||||
|
||||
if (!CheckFilter(obj))
|
||||
continue;
|
||||
|
||||
AddImageTiled(24, 94 + (tableIndex * 32), canPrice ? 573 : 489, 2, 2624);
|
||||
|
||||
if (obj is BOBLargeEntry)
|
||||
tableIndex += ((BOBLargeEntry)obj).Entries.Length;
|
||||
else if (obj is BOBSmallEntry)
|
||||
++tableIndex;
|
||||
}
|
||||
|
||||
AddAlphaRegion(18, 20, width - 17, 420);
|
||||
AddImage(5, 5, 10460);
|
||||
AddImage(width - 15, 5, 10460);
|
||||
AddImage(5, 424, 10460);
|
||||
AddImage(width - 15, 424, 10460);
|
||||
|
||||
AddHtmlLocalized(canPrice ? 266 : 224, 32, 200, 32, 1062220, LabelColor, false, false); // Bulk Order Book
|
||||
AddHtmlLocalized(63, 64, 70, 32, 1062213, LabelColor, false, false); // Type
|
||||
AddHtmlLocalized(147, 64, 70, 32, 1062214, LabelColor, false, false); // Item
|
||||
AddHtmlLocalized(246, 64, 70, 32, 1062215, LabelColor, false, false); // Quality
|
||||
AddHtmlLocalized(336, 64, 70, 32, 1062216, LabelColor, false, false); // Material
|
||||
AddHtmlLocalized(429, 64, 70, 32, 1062217, LabelColor, false, false); // Amount
|
||||
|
||||
AddButton(35, 32, 4005, 4007, 1, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(70, 32, 200, 32, 1062476, LabelColor, false, false); // Set Filter
|
||||
|
||||
BOBFilter f = (from.UseOwnFilter ? from.BOBFilter : book.Filter);
|
||||
|
||||
if (f.IsDefault)
|
||||
AddHtmlLocalized(canPrice ? 470 : 386, 32, 120, 32, 1062475, 16927, false, false); // Using No Filter
|
||||
else if (from.UseOwnFilter)
|
||||
AddHtmlLocalized(canPrice ? 470 : 386, 32, 120, 32, 1062451, 16927, false, false); // Using Your Filter
|
||||
else
|
||||
AddHtmlLocalized(canPrice ? 470 : 386, 32, 120, 32, 1062230, 16927, false, false); // Using Book Filter
|
||||
|
||||
AddButton(375, 416, 4017, 4018, 0, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(410, 416, 120, 20, 1011441, LabelColor, false, false); // EXIT
|
||||
|
||||
if (canDrop)
|
||||
AddHtmlLocalized(26, 64, 50, 32, 1062212, LabelColor, false, false); // Drop
|
||||
|
||||
if (canPrice)
|
||||
{
|
||||
AddHtmlLocalized(516, 64, 200, 32, 1062218, LabelColor, false, false); // Price
|
||||
|
||||
if (canBuy)
|
||||
{
|
||||
AddHtmlLocalized(576, 64, 200, 32, 1062219, LabelColor, false, false); // Buy
|
||||
}
|
||||
else
|
||||
{
|
||||
AddHtmlLocalized(576, 64, 200, 32, 1062227, LabelColor, false, false); // Set
|
||||
|
||||
AddButton(450, 416, 4005, 4007, 4, GumpButtonType.Reply, 0);
|
||||
AddHtml(485, 416, 120, 20, "<BASEFONT COLOR=#FFFFFF>Price all</FONT>", false, false);
|
||||
}
|
||||
}
|
||||
|
||||
tableIndex = 0;
|
||||
|
||||
if (page > 0)
|
||||
{
|
||||
AddButton(75, 416, 4014, 4016, 2, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(110, 416, 150, 20, 1011067, LabelColor, false, false); // Previous page
|
||||
}
|
||||
|
||||
if (GetIndexForPage(page + 1) < list.Count)
|
||||
{
|
||||
AddButton(225, 416, 4005, 4007, 3, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(260, 416, 150, 20, 1011066, LabelColor, false, false); // Next page
|
||||
}
|
||||
|
||||
for (int i = index; i < (index + count) && i >= 0 && i < list.Count; ++i)
|
||||
{
|
||||
object obj = list[i];
|
||||
|
||||
if (!CheckFilter(obj))
|
||||
continue;
|
||||
|
||||
if (obj is BOBLargeEntry)
|
||||
{
|
||||
BOBLargeEntry e = (BOBLargeEntry)obj;
|
||||
|
||||
int y = 96 + (tableIndex * 32);
|
||||
|
||||
if (canDrop)
|
||||
AddButton(35, y + 2, 5602, 5606, 5 + (i * 2), GumpButtonType.Reply, 0);
|
||||
|
||||
if (canDrop || (canBuy && e.Price > 0))
|
||||
{
|
||||
AddButton(579, y + 2, 2117, 2118, 6 + (i * 2), GumpButtonType.Reply, 0);
|
||||
AddLabel(495, y, 1152, e.Price.ToString());
|
||||
}
|
||||
|
||||
AddHtmlLocalized(61, y, 50, 32, 1062225, LabelColor, false, false); // Large
|
||||
|
||||
for (int j = 0; j < e.Entries.Length; ++j)
|
||||
{
|
||||
BOBLargeSubEntry sub = e.Entries[j];
|
||||
|
||||
AddHtmlLocalized(103, y, 130, 32, sub.Number, LabelColor, false, false);
|
||||
|
||||
if (e.RequireExceptional)
|
||||
AddHtmlLocalized(235, y, 80, 20, 1060636, LabelColor, false, false); // exceptional
|
||||
else
|
||||
AddHtmlLocalized(235, y, 80, 20, 1011542, LabelColor, false, false); // normal
|
||||
|
||||
object name = GetMaterialName(e.Material, e.DeedType, sub.ItemType);
|
||||
|
||||
if (name is int)
|
||||
AddHtmlLocalized(316, y, 100, 20, (int)name, LabelColor, false, false);
|
||||
else if (name is string)
|
||||
AddLabel(316, y, 1152, (string)name);
|
||||
|
||||
AddLabel(421, y, 1152, String.Format("{0} / {1}", sub.AmountCur, e.AmountMax));
|
||||
|
||||
++tableIndex;
|
||||
y += 32;
|
||||
}
|
||||
}
|
||||
else if (obj is BOBSmallEntry)
|
||||
{
|
||||
BOBSmallEntry e = (BOBSmallEntry)obj;
|
||||
|
||||
int y = 96 + (tableIndex++ * 32);
|
||||
|
||||
if (canDrop)
|
||||
AddButton(35, y + 2, 5602, 5606, 5 + (i * 2), GumpButtonType.Reply, 0);
|
||||
|
||||
if (canDrop || (canBuy && e.Price > 0))
|
||||
{
|
||||
AddButton(579, y + 2, 2117, 2118, 6 + (i * 2), GumpButtonType.Reply, 0);
|
||||
AddLabel(495, y, 1152, e.Price.ToString());
|
||||
}
|
||||
|
||||
AddHtmlLocalized(61, y, 50, 32, 1062224, LabelColor, false, false); // Small
|
||||
|
||||
AddHtmlLocalized(103, y, 130, 32, e.Number, LabelColor, false, false);
|
||||
|
||||
if (e.RequireExceptional)
|
||||
AddHtmlLocalized(235, y, 80, 20, 1060636, LabelColor, false, false); // exceptional
|
||||
else
|
||||
AddHtmlLocalized(235, y, 80, 20, 1011542, LabelColor, false, false); // normal
|
||||
|
||||
object name = GetMaterialName(e.Material, e.DeedType, e.ItemType);
|
||||
|
||||
if (name is int)
|
||||
AddHtmlLocalized(316, y, 100, 20, (int)name, LabelColor, false, false);
|
||||
else if (name is string)
|
||||
AddLabel(316, y, 1152, (string)name);
|
||||
|
||||
AddLabel(421, y, 1152, String.Format("{0} / {1}", e.AmountCur, e.AmountMax));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Item Reconstruct(object obj)
|
||||
{
|
||||
Item item = null;
|
||||
|
||||
if (obj is BOBLargeEntry)
|
||||
item = ((BOBLargeEntry)obj).Reconstruct();
|
||||
else if (obj is BOBSmallEntry)
|
||||
item = ((BOBSmallEntry)obj).Reconstruct();
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
public bool CheckFilter(object obj)
|
||||
{
|
||||
if (obj is BOBLargeEntry)
|
||||
{
|
||||
BOBLargeEntry e = (BOBLargeEntry)obj;
|
||||
|
||||
return CheckFilter(e.Material, e.AmountMax, true, e.RequireExceptional, e.DeedType, (e.Entries.Length > 0 ? e.Entries[0].ItemType : null));
|
||||
}
|
||||
else if (obj is BOBSmallEntry)
|
||||
{
|
||||
BOBSmallEntry e = (BOBSmallEntry)obj;
|
||||
|
||||
return CheckFilter(e.Material, e.AmountMax, false, e.RequireExceptional, e.DeedType, e.ItemType);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool CheckFilter(BulkMaterialType mat, int amountMax, bool isLarge, bool reqExc, BODType deedType, Type itemType)
|
||||
{
|
||||
BOBFilter f = (m_From.UseOwnFilter ? m_From.BOBFilter : m_Book.Filter);
|
||||
|
||||
if (f.IsDefault)
|
||||
return true;
|
||||
|
||||
if (f.Quality == 1 && reqExc)
|
||||
return false;
|
||||
else if (f.Quality == 2 && !reqExc)
|
||||
return false;
|
||||
|
||||
if (f.Quantity == 1 && amountMax != 10)
|
||||
return false;
|
||||
else if (f.Quantity == 2 && amountMax != 15)
|
||||
return false;
|
||||
else if (f.Quantity == 3 && amountMax != 20)
|
||||
return false;
|
||||
|
||||
if (f.Type == 1 && isLarge)
|
||||
return false;
|
||||
else if (f.Type == 2 && !isLarge)
|
||||
return false;
|
||||
|
||||
if (BulkOrderSystem.NewSystemEnabled)
|
||||
{
|
||||
switch (f.Material)
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
return true;
|
||||
case 1:
|
||||
return deedType == BODType.Smith;
|
||||
case 2:
|
||||
return deedType == BODType.Tailor;
|
||||
case 3:
|
||||
return deedType == BODType.Tinkering;
|
||||
case 4:
|
||||
return deedType == BODType.Carpentry;
|
||||
case 5:
|
||||
return deedType == BODType.Fletching;
|
||||
case 6:
|
||||
return deedType == BODType.Alchemy;
|
||||
case 7:
|
||||
return deedType == BODType.Inscription;
|
||||
case 8:
|
||||
return deedType == BODType.Cooking;
|
||||
case 9:
|
||||
return (mat == BulkMaterialType.None && deedType == BODType.Smith);
|
||||
case 10:
|
||||
return (mat == BulkMaterialType.DullCopper && deedType == BODType.Smith);
|
||||
case 11:
|
||||
return (mat == BulkMaterialType.ShadowIron && deedType == BODType.Smith);
|
||||
case 12:
|
||||
return (mat == BulkMaterialType.Copper && deedType == BODType.Smith);
|
||||
case 13:
|
||||
return (mat == BulkMaterialType.Bronze && deedType == BODType.Smith);
|
||||
case 14:
|
||||
return (mat == BulkMaterialType.Gold && deedType == BODType.Smith);
|
||||
case 15:
|
||||
return (mat == BulkMaterialType.Agapite && deedType == BODType.Smith);
|
||||
case 16:
|
||||
return (mat == BulkMaterialType.Verite && deedType == BODType.Smith);
|
||||
case 17:
|
||||
return (mat == BulkMaterialType.Valorite && deedType == BODType.Smith);
|
||||
|
||||
case 18:
|
||||
return (mat == BulkMaterialType.None && BGTClassifier.Classify(deedType, itemType) == BulkGenericType.Cloth);
|
||||
case 19:
|
||||
return (mat == BulkMaterialType.None && BGTClassifier.Classify(deedType, itemType) == BulkGenericType.Leather);
|
||||
case 20:
|
||||
return (mat == BulkMaterialType.Spined && BGTClassifier.Classify(deedType, itemType) == BulkGenericType.Leather);
|
||||
case 21:
|
||||
return (mat == BulkMaterialType.Horned && BGTClassifier.Classify(deedType, itemType) == BulkGenericType.Leather);
|
||||
case 22:
|
||||
return (mat == BulkMaterialType.Barbed && BGTClassifier.Classify(deedType, itemType) == BulkGenericType.Leather);
|
||||
|
||||
case 23: // Tinkering
|
||||
return (mat == BulkMaterialType.None && deedType == BODType.Tinkering);
|
||||
case 24:
|
||||
return (mat == BulkMaterialType.DullCopper && deedType == BODType.Tinkering);
|
||||
case 25:
|
||||
return (mat == BulkMaterialType.ShadowIron && deedType == BODType.Tinkering);
|
||||
case 26:
|
||||
return (mat == BulkMaterialType.Copper && deedType == BODType.Tinkering);
|
||||
case 27:
|
||||
return (mat == BulkMaterialType.Bronze && deedType == BODType.Tinkering);
|
||||
case 28:
|
||||
return (mat == BulkMaterialType.Gold && deedType == BODType.Tinkering);
|
||||
case 29:
|
||||
return (mat == BulkMaterialType.Agapite && deedType == BODType.Tinkering);
|
||||
case 30:
|
||||
return (mat == BulkMaterialType.Verite && deedType == BODType.Tinkering);
|
||||
case 31:
|
||||
return (mat == BulkMaterialType.Valorite && deedType == BODType.Tinkering);
|
||||
|
||||
case 32: // Carpentry
|
||||
return (mat == BulkMaterialType.None && deedType == BODType.Carpentry);
|
||||
case 33:
|
||||
return (mat == BulkMaterialType.OakWood && deedType == BODType.Carpentry);
|
||||
case 34:
|
||||
return (mat == BulkMaterialType.AshWood && deedType == BODType.Carpentry);
|
||||
case 35:
|
||||
return (mat == BulkMaterialType.YewWood && deedType == BODType.Carpentry);
|
||||
case 36:
|
||||
return (mat == BulkMaterialType.Bloodwood && deedType == BODType.Carpentry);
|
||||
case 37:
|
||||
return (mat == BulkMaterialType.Heartwood && deedType == BODType.Carpentry);
|
||||
case 38:
|
||||
return (mat == BulkMaterialType.Frostwood && deedType == BODType.Carpentry);
|
||||
|
||||
case 39: // Fletching
|
||||
return (mat == BulkMaterialType.None && deedType == BODType.Fletching);
|
||||
case 40:
|
||||
return (mat == BulkMaterialType.OakWood && deedType == BODType.Fletching);
|
||||
case 41:
|
||||
return (mat == BulkMaterialType.AshWood && deedType == BODType.Fletching);
|
||||
case 42:
|
||||
return (mat == BulkMaterialType.YewWood && deedType == BODType.Fletching);
|
||||
case 43:
|
||||
return (mat == BulkMaterialType.Bloodwood && deedType == BODType.Fletching);
|
||||
case 44:
|
||||
return (mat == BulkMaterialType.Heartwood && deedType == BODType.Fletching);
|
||||
case 45:
|
||||
return (mat == BulkMaterialType.Frostwood && deedType == BODType.Fletching);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (f.Material)
|
||||
{
|
||||
default:
|
||||
case 0: return true;
|
||||
case 1: return (deedType == BODType.Smith);
|
||||
case 2: return (deedType == BODType.Tailor);
|
||||
|
||||
case 3: return (mat == BulkMaterialType.None && BGTClassifier.Classify(deedType, itemType) == BulkGenericType.Iron);
|
||||
case 4: return (mat == BulkMaterialType.DullCopper);
|
||||
case 5: return (mat == BulkMaterialType.ShadowIron);
|
||||
case 6: return (mat == BulkMaterialType.Copper);
|
||||
case 7: return (mat == BulkMaterialType.Bronze);
|
||||
case 8: return (mat == BulkMaterialType.Gold);
|
||||
case 9: return (mat == BulkMaterialType.Agapite);
|
||||
case 10: return (mat == BulkMaterialType.Verite);
|
||||
case 11: return (mat == BulkMaterialType.Valorite);
|
||||
|
||||
case 12: return (mat == BulkMaterialType.None && BGTClassifier.Classify(deedType, itemType) == BulkGenericType.Cloth);
|
||||
case 13: return (mat == BulkMaterialType.None && BGTClassifier.Classify(deedType, itemType) == BulkGenericType.Leather);
|
||||
case 14: return (mat == BulkMaterialType.Spined);
|
||||
case 15: return (mat == BulkMaterialType.Horned);
|
||||
case 16: return (mat == BulkMaterialType.Barbed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int GetIndexForPage(int page)
|
||||
{
|
||||
int index = 0;
|
||||
|
||||
while (page-- > 0)
|
||||
index += GetCountForIndex(index);
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
public int GetCountForIndex(int index)
|
||||
{
|
||||
int slots = 0;
|
||||
int count = 0;
|
||||
|
||||
ArrayList list = m_List;
|
||||
|
||||
for (int i = index; i >= 0 && i < list.Count; ++i)
|
||||
{
|
||||
object obj = list[i];
|
||||
|
||||
if (CheckFilter(obj))
|
||||
{
|
||||
int add;
|
||||
|
||||
if (obj is BOBLargeEntry)
|
||||
add = ((BOBLargeEntry)obj).Entries.Length;
|
||||
else
|
||||
add = 1;
|
||||
|
||||
if ((slots + add) > 10)
|
||||
break;
|
||||
|
||||
slots += add;
|
||||
}
|
||||
|
||||
++count;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
public int GetPageForIndex(int index, int sizeDropped)
|
||||
{
|
||||
if (index <= 0)
|
||||
return 0;
|
||||
|
||||
int count = 0;
|
||||
int add = 0;
|
||||
int page = 0;
|
||||
ArrayList list = m_List;
|
||||
int i;
|
||||
object obj;
|
||||
|
||||
for (i = 0; (i < index) && (i < list.Count); i++)
|
||||
{
|
||||
obj = list[i];
|
||||
if (CheckFilter(obj))
|
||||
{
|
||||
if (obj is BOBLargeEntry)
|
||||
add = ((BOBLargeEntry)obj).Entries.Length;
|
||||
else
|
||||
add = 1;
|
||||
count += add;
|
||||
if (count > 10)
|
||||
{
|
||||
page++;
|
||||
count = add;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* now we are on the page of the bod preceeding the dropped one.
|
||||
* next step: checking whether we have to remain where we are.
|
||||
* The counter i needs to be incremented as the bod to this very moment
|
||||
* has not yet been removed from m_List */
|
||||
i++;
|
||||
|
||||
/* if, for instance, a big bod of size 6 has been removed, smaller bods
|
||||
* might fall back into this page. Depending on their sizes, the page eeds
|
||||
* to be adjusted accordingly. This is done now.
|
||||
*/
|
||||
if (count + sizeDropped > 10)
|
||||
{
|
||||
while ((i < list.Count) && (count <= 10))
|
||||
{
|
||||
obj = list[i];
|
||||
if (CheckFilter(obj))
|
||||
{
|
||||
if (obj is BOBLargeEntry)
|
||||
count += ((BOBLargeEntry)obj).Entries.Length;
|
||||
else
|
||||
count += 1;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
if (count > 10)
|
||||
page++;
|
||||
}
|
||||
return page;
|
||||
}
|
||||
|
||||
public object GetMaterialName(BulkMaterialType mat, BODType type, Type itemType)
|
||||
{
|
||||
switch ( type )
|
||||
{
|
||||
case BODType.Tinkering:
|
||||
case BODType.Smith:
|
||||
{
|
||||
if (type == BODType.Tinkering && mat == BulkMaterialType.None && BGTClassifier.Classify(type, itemType) == BulkGenericType.Wood)
|
||||
{
|
||||
return 1079435;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (mat)
|
||||
{
|
||||
case BulkMaterialType.None:
|
||||
return 1062226;
|
||||
case BulkMaterialType.DullCopper:
|
||||
return 1018332;
|
||||
case BulkMaterialType.ShadowIron:
|
||||
return 1018333;
|
||||
case BulkMaterialType.Copper:
|
||||
return 1018334;
|
||||
case BulkMaterialType.Bronze:
|
||||
return 1018335;
|
||||
case BulkMaterialType.Gold:
|
||||
return 1018336;
|
||||
case BulkMaterialType.Agapite:
|
||||
return 1018337;
|
||||
case BulkMaterialType.Verite:
|
||||
return 1018338;
|
||||
case BulkMaterialType.Valorite:
|
||||
return 1018339;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case BODType.Tailor:
|
||||
{
|
||||
switch ( mat )
|
||||
{
|
||||
case BulkMaterialType.None:
|
||||
{
|
||||
if (itemType.IsSubclassOf(typeof(BaseArmor)) || itemType.IsSubclassOf(typeof(BaseShoes)))
|
||||
return 1062235;
|
||||
|
||||
return 1044286;
|
||||
}
|
||||
case BulkMaterialType.Spined:
|
||||
return 1062236;
|
||||
case BulkMaterialType.Horned:
|
||||
return 1062237;
|
||||
case BulkMaterialType.Barbed:
|
||||
return 1062238;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case BODType.Carpentry:
|
||||
case BODType.Fletching:
|
||||
{
|
||||
if (mat == BulkMaterialType.None)
|
||||
return 1079435;
|
||||
|
||||
switch (mat)
|
||||
{
|
||||
default:
|
||||
case BulkMaterialType.OakWood: return 1071428;
|
||||
case BulkMaterialType.AshWood: return 1071429;
|
||||
case BulkMaterialType.YewWood: return 1071430;
|
||||
case BulkMaterialType.Heartwood: return 1071432;
|
||||
case BulkMaterialType.Bloodwood: return 1071431;
|
||||
case BulkMaterialType.Frostwood: return 1071433;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
public override void OnResponse(Server.Network.NetState sender, RelayInfo info)
|
||||
{
|
||||
int index = info.ButtonID;
|
||||
|
||||
switch ( index )
|
||||
{
|
||||
case 0: // EXIT
|
||||
{
|
||||
break;
|
||||
}
|
||||
case 1: // Set Filter
|
||||
{
|
||||
m_From.SendGump(new BOBFilterGump(m_From, m_Book));
|
||||
|
||||
break;
|
||||
}
|
||||
case 2: // Previous page
|
||||
{
|
||||
if (m_Page > 0)
|
||||
m_From.SendGump(new BOBGump(m_From, m_Book, m_Page - 1, m_List));
|
||||
|
||||
return;
|
||||
}
|
||||
case 3: // Next page
|
||||
{
|
||||
if (GetIndexForPage(m_Page + 1) < m_List.Count)
|
||||
m_From.SendGump(new BOBGump(m_From, m_Book, m_Page + 1, m_List));
|
||||
|
||||
break;
|
||||
}
|
||||
case 4: // Price all
|
||||
{
|
||||
if (m_Book.IsChildOf(m_From.Backpack))
|
||||
{
|
||||
m_From.Prompt = new SetPricePrompt(m_Book, null, m_Page, m_List);
|
||||
m_From.SendMessage("Type in a price for all deeds in the book:");
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
bool canDrop = m_Book.IsChildOf(m_From.Backpack);
|
||||
bool canPrice = canDrop || (m_Book.RootParent is PlayerVendor);
|
||||
|
||||
index -= 5;
|
||||
|
||||
int type = index % 2;
|
||||
index /= 2;
|
||||
|
||||
if (index < 0 || index >= m_List.Count)
|
||||
break;
|
||||
|
||||
object obj = m_List[index];
|
||||
|
||||
if (!m_Book.Entries.Contains(obj))
|
||||
{
|
||||
m_From.SendLocalizedMessage(1062382); // The deed selected is not available.
|
||||
break;
|
||||
}
|
||||
|
||||
if (type == 0) // Drop
|
||||
{
|
||||
if (m_Book.IsChildOf(m_From.Backpack))
|
||||
{
|
||||
Item item = Reconstruct(obj);
|
||||
|
||||
if (item != null)
|
||||
{
|
||||
Container pack = m_From.Backpack;
|
||||
if ((pack == null) || ((pack != null) && (!pack.CheckHold(m_From, item, true, true, 0, item.PileWeight + item.TotalWeight))))
|
||||
{
|
||||
m_From.SendLocalizedMessage(503204); // You do not have room in your backpack for this
|
||||
m_From.SendGump(new BOBGump(m_From, m_Book, m_Page, null));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_Book.IsChildOf(m_From.Backpack))
|
||||
{
|
||||
int sizeOfDroppedBod;
|
||||
if (obj is BOBLargeEntry)
|
||||
sizeOfDroppedBod = ((BOBLargeEntry)obj).Entries.Length;
|
||||
else
|
||||
sizeOfDroppedBod = 1;
|
||||
|
||||
m_From.AddToBackpack(item);
|
||||
m_From.SendLocalizedMessage(1045152); // The bulk order deed has been placed in your backpack.
|
||||
m_Book.Entries.Remove(obj);
|
||||
m_Book.InvalidateProperties();
|
||||
|
||||
if (m_Book.Entries.Count / 5 < m_Book.ItemCount)
|
||||
{
|
||||
m_Book.ItemCount--;
|
||||
m_Book.InvalidateItems();
|
||||
}
|
||||
|
||||
if (m_Book.Entries.Count > 0)
|
||||
{
|
||||
m_Page = GetPageForIndex(index, sizeOfDroppedBod);
|
||||
m_From.SendGump(new BOBGump(m_From, m_Book, m_Page, null));
|
||||
}
|
||||
else
|
||||
m_From.SendLocalizedMessage(1062381); // The book is empty.
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_From.SendMessage("Internal error. The bulk order deed could not be reconstructed.");
|
||||
}
|
||||
}
|
||||
}
|
||||
else // Set Price | Buy
|
||||
{
|
||||
if (m_Book.IsChildOf(m_From.Backpack))
|
||||
{
|
||||
m_From.Prompt = new SetPricePrompt(m_Book, obj, m_Page, m_List);
|
||||
m_From.SendLocalizedMessage(1062383); // Type in a price for the deed:
|
||||
}
|
||||
else if (m_Book.RootParent is PlayerVendor)
|
||||
{
|
||||
PlayerVendor pv = (PlayerVendor)m_Book.RootParent;
|
||||
VendorItem vi = pv.GetVendorItem(m_Book);
|
||||
|
||||
if (vi != null && !vi.IsForSale)
|
||||
{
|
||||
int sizeOfDroppedBod;
|
||||
int price = 0;
|
||||
if (obj is BOBLargeEntry)
|
||||
{
|
||||
price = ((BOBLargeEntry)obj).Price;
|
||||
sizeOfDroppedBod = ((BOBLargeEntry)obj).Entries.Length;
|
||||
}
|
||||
else
|
||||
{
|
||||
price = ((BOBSmallEntry)obj).Price;
|
||||
sizeOfDroppedBod = 1;
|
||||
}
|
||||
if (price == 0)
|
||||
m_From.SendLocalizedMessage(1062382); // The deed selected is not available.
|
||||
else
|
||||
{
|
||||
if (m_Book.Entries.Count > 0)
|
||||
{
|
||||
m_Page = GetPageForIndex(index, sizeOfDroppedBod);
|
||||
m_From.SendGump(new BODBuyGump(m_From, m_Book, obj, m_Page, price));
|
||||
}
|
||||
else
|
||||
m_From.SendLocalizedMessage(1062381); // The book is emptz
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class SetPricePrompt : Prompt
|
||||
{
|
||||
public override int MessageCliloc { get { return 1062383; } }
|
||||
private readonly BulkOrderBook m_Book;
|
||||
private readonly object m_Object;
|
||||
private readonly int m_Page;
|
||||
private readonly ArrayList m_List;
|
||||
public SetPricePrompt(BulkOrderBook book, object obj, int page, ArrayList list)
|
||||
{
|
||||
m_Book = book;
|
||||
m_Object = obj;
|
||||
m_Page = page;
|
||||
m_List = list;
|
||||
}
|
||||
|
||||
public override void OnResponse(Mobile from, string text)
|
||||
{
|
||||
if (m_Object != null && !m_Book.Entries.Contains(m_Object))
|
||||
{
|
||||
from.SendLocalizedMessage(1062382); // The deed selected is not available.
|
||||
return;
|
||||
}
|
||||
|
||||
int price = Utility.ToInt32(text);
|
||||
|
||||
if (price < 0 || price > 250000000)
|
||||
{
|
||||
from.SendLocalizedMessage(1062390); // The price you requested is outrageous!
|
||||
}
|
||||
else if (m_Object == null)
|
||||
{
|
||||
for (int i = 0; i < m_List.Count; ++i)
|
||||
{
|
||||
object obj = m_List[i];
|
||||
|
||||
if (!m_Book.Entries.Contains(obj))
|
||||
continue;
|
||||
|
||||
if (obj is BOBLargeEntry)
|
||||
((BOBLargeEntry)obj).Price = price;
|
||||
else if (obj is BOBSmallEntry)
|
||||
((BOBSmallEntry)obj).Price = price;
|
||||
}
|
||||
|
||||
from.SendMessage("Deed prices set.");
|
||||
|
||||
if (from is PlayerMobile)
|
||||
from.SendGump(new BOBGump((PlayerMobile)from, m_Book, m_Page, m_List));
|
||||
}
|
||||
else if (m_Object is BOBLargeEntry)
|
||||
{
|
||||
((BOBLargeEntry)m_Object).Price = price;
|
||||
|
||||
from.SendLocalizedMessage(1062384); // Deed price set.
|
||||
|
||||
if (from is PlayerMobile)
|
||||
from.SendGump(new BOBGump((PlayerMobile)from, m_Book, m_Page, m_List));
|
||||
}
|
||||
else if (m_Object is BOBSmallEntry)
|
||||
{
|
||||
((BOBSmallEntry)m_Object).Price = price;
|
||||
|
||||
from.SendLocalizedMessage(1062384); // Deed price set.
|
||||
|
||||
if (from is PlayerMobile)
|
||||
from.SendGump(new BOBGump((PlayerMobile)from, m_Book, m_Page, m_List));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
179
Scripts/Services/BulkOrders/Books/BOBLargeEntry.cs
Normal file
179
Scripts/Services/BulkOrders/Books/BOBLargeEntry.cs
Normal file
@@ -0,0 +1,179 @@
|
||||
using System;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class BOBLargeEntry
|
||||
{
|
||||
private readonly bool m_RequireExceptional;
|
||||
private readonly BODType m_DeedType;
|
||||
private readonly BulkMaterialType m_Material;
|
||||
private readonly int m_AmountMax;
|
||||
private readonly BOBLargeSubEntry[] m_Entries;
|
||||
private int m_Price;
|
||||
|
||||
private GemType m_GemType;
|
||||
|
||||
public BOBLargeEntry(LargeBOD bod)
|
||||
{
|
||||
m_RequireExceptional = bod.RequireExceptional;
|
||||
|
||||
m_DeedType = bod.BODType;
|
||||
|
||||
m_Material = bod.Material;
|
||||
m_AmountMax = bod.AmountMax;
|
||||
|
||||
m_Entries = new BOBLargeSubEntry[bod.Entries.Length];
|
||||
|
||||
for (int i = 0; i < m_Entries.Length; ++i)
|
||||
m_Entries[i] = new BOBLargeSubEntry(bod.Entries[i]);
|
||||
|
||||
if (bod is LargeTinkerBOD)
|
||||
{
|
||||
m_GemType = ((LargeTinkerBOD)bod).GemType;
|
||||
}
|
||||
}
|
||||
|
||||
public BOBLargeEntry(GenericReader reader)
|
||||
{
|
||||
int version = reader.ReadEncodedInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
m_GemType = (GemType)reader.ReadInt();
|
||||
goto case 0;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
m_RequireExceptional = reader.ReadBool();
|
||||
|
||||
m_DeedType = (BODType)reader.ReadEncodedInt();
|
||||
|
||||
m_Material = (BulkMaterialType)reader.ReadEncodedInt();
|
||||
m_AmountMax = reader.ReadEncodedInt();
|
||||
m_Price = reader.ReadEncodedInt();
|
||||
|
||||
m_Entries = new BOBLargeSubEntry[reader.ReadEncodedInt()];
|
||||
|
||||
for (int i = 0; i < m_Entries.Length; ++i)
|
||||
m_Entries[i] = new BOBLargeSubEntry(reader);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool RequireExceptional
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_RequireExceptional;
|
||||
}
|
||||
}
|
||||
public BODType DeedType
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_DeedType;
|
||||
}
|
||||
}
|
||||
public BulkMaterialType Material
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Material;
|
||||
}
|
||||
}
|
||||
public int AmountMax
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_AmountMax;
|
||||
}
|
||||
}
|
||||
public int Price
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Price;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_Price = value;
|
||||
}
|
||||
}
|
||||
public GemType GemType
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_GemType;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_GemType = value;
|
||||
}
|
||||
}
|
||||
public BOBLargeSubEntry[] Entries
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Entries;
|
||||
}
|
||||
}
|
||||
public Item Reconstruct()
|
||||
{
|
||||
LargeBOD bod = null;
|
||||
|
||||
switch (m_DeedType)
|
||||
{
|
||||
case BODType.Smith: bod = new LargeSmithBOD(m_AmountMax, m_RequireExceptional, m_Material, ReconstructEntries()); break;
|
||||
case BODType.Tailor: bod = new LargeTailorBOD(m_AmountMax, m_RequireExceptional, m_Material, ReconstructEntries()); break;
|
||||
case BODType.Inscription: bod = new LargeInscriptionBOD(m_AmountMax, m_RequireExceptional, m_Material, ReconstructEntries()); break;
|
||||
case BODType.Alchemy: bod = new LargeAlchemyBOD(m_AmountMax, m_RequireExceptional, m_Material, ReconstructEntries()); break;
|
||||
case BODType.Carpentry: bod = new LargeCarpentryBOD(m_AmountMax, m_RequireExceptional, m_Material, ReconstructEntries()); break;
|
||||
case BODType.Fletching: bod = new LargeFletchingBOD(m_AmountMax, m_RequireExceptional, m_Material, ReconstructEntries()); break;
|
||||
case BODType.Tinkering: bod = new LargeTinkerBOD(m_AmountMax, m_RequireExceptional, m_Material, ReconstructEntries(), m_GemType); break;
|
||||
case BODType.Cooking: bod = new LargeCookingBOD(m_AmountMax, m_RequireExceptional, m_Material, ReconstructEntries()); break;
|
||||
}
|
||||
|
||||
for (int i = 0; bod != null && i < bod.Entries.Length; ++i)
|
||||
bod.Entries[i].Owner = bod;
|
||||
|
||||
return bod;
|
||||
}
|
||||
|
||||
public void Serialize(GenericWriter writer)
|
||||
{
|
||||
writer.WriteEncodedInt(1); // version
|
||||
|
||||
writer.Write((int)m_GemType);
|
||||
|
||||
writer.Write((bool)m_RequireExceptional);
|
||||
|
||||
writer.WriteEncodedInt((int)m_DeedType);
|
||||
writer.WriteEncodedInt((int)m_Material);
|
||||
writer.WriteEncodedInt((int)m_AmountMax);
|
||||
writer.WriteEncodedInt((int)m_Price);
|
||||
|
||||
writer.WriteEncodedInt((int)m_Entries.Length);
|
||||
|
||||
for (int i = 0; i < m_Entries.Length; ++i)
|
||||
m_Entries[i].Serialize(writer);
|
||||
}
|
||||
|
||||
private LargeBulkEntry[] ReconstructEntries()
|
||||
{
|
||||
LargeBulkEntry[] entries = new LargeBulkEntry[m_Entries.Length];
|
||||
|
||||
for (int i = 0; i < m_Entries.Length; ++i)
|
||||
{
|
||||
entries[i] = new LargeBulkEntry(null, new SmallBulkEntry(m_Entries[i].ItemType, m_Entries[i].Number, m_Entries[i].Graphic, m_Entries[i].Hue));
|
||||
entries[i].Amount = m_Entries[i].AmountCur;
|
||||
}
|
||||
|
||||
return entries;
|
||||
}
|
||||
}
|
||||
}
|
||||
97
Scripts/Services/BulkOrders/Books/BOBLargeSubEntry.cs
Normal file
97
Scripts/Services/BulkOrders/Books/BOBLargeSubEntry.cs
Normal file
@@ -0,0 +1,97 @@
|
||||
using System;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class BOBLargeSubEntry
|
||||
{
|
||||
private readonly Type m_ItemType;
|
||||
private readonly int m_AmountCur;
|
||||
private readonly int m_Number;
|
||||
private readonly int m_Graphic;
|
||||
private readonly int m_Hue;
|
||||
|
||||
public BOBLargeSubEntry(LargeBulkEntry lbe)
|
||||
{
|
||||
m_ItemType = lbe.Details.Type;
|
||||
m_AmountCur = lbe.Amount;
|
||||
m_Number = lbe.Details.Number;
|
||||
m_Graphic = lbe.Details.Graphic;
|
||||
m_Hue = lbe.Details.Hue;
|
||||
}
|
||||
|
||||
public BOBLargeSubEntry(GenericReader reader)
|
||||
{
|
||||
int version = reader.ReadEncodedInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
m_Hue = reader.ReadEncodedInt();
|
||||
goto case 0;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
string type = reader.ReadString();
|
||||
|
||||
if (type != null)
|
||||
m_ItemType = ScriptCompiler.FindTypeByFullName(type);
|
||||
|
||||
m_AmountCur = reader.ReadEncodedInt();
|
||||
m_Number = reader.ReadEncodedInt();
|
||||
m_Graphic = reader.ReadEncodedInt();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Type ItemType
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_ItemType;
|
||||
}
|
||||
}
|
||||
public int AmountCur
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_AmountCur;
|
||||
}
|
||||
}
|
||||
public int Number
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Number;
|
||||
}
|
||||
}
|
||||
public int Graphic
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Graphic;
|
||||
}
|
||||
}
|
||||
public int Hue
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Hue;
|
||||
}
|
||||
}
|
||||
public void Serialize(GenericWriter writer)
|
||||
{
|
||||
writer.WriteEncodedInt(1); // version
|
||||
|
||||
writer.WriteEncodedInt((int)m_Hue);
|
||||
|
||||
writer.Write(m_ItemType == null ? null : m_ItemType.FullName);
|
||||
|
||||
writer.WriteEncodedInt((int)m_AmountCur);
|
||||
writer.WriteEncodedInt((int)m_Number);
|
||||
writer.WriteEncodedInt((int)m_Graphic);
|
||||
}
|
||||
}
|
||||
}
|
||||
201
Scripts/Services/BulkOrders/Books/BOBSmallEntry.cs
Normal file
201
Scripts/Services/BulkOrders/Books/BOBSmallEntry.cs
Normal file
@@ -0,0 +1,201 @@
|
||||
using System;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class BOBSmallEntry
|
||||
{
|
||||
private readonly Type m_ItemType;
|
||||
private readonly bool m_RequireExceptional;
|
||||
private readonly BODType m_DeedType;
|
||||
private readonly BulkMaterialType m_Material;
|
||||
private readonly int m_AmountCur;
|
||||
private readonly int m_AmountMax;
|
||||
private readonly int m_Number;
|
||||
private readonly int m_Graphic;
|
||||
private readonly int m_Hue;
|
||||
private readonly GemType m_GemType;
|
||||
|
||||
private int m_Price;
|
||||
|
||||
public BOBSmallEntry(SmallBOD bod)
|
||||
{
|
||||
m_ItemType = bod.Type;
|
||||
m_RequireExceptional = bod.RequireExceptional;
|
||||
|
||||
m_DeedType = bod.BODType;
|
||||
|
||||
m_Material = bod.Material;
|
||||
m_AmountCur = bod.AmountCur;
|
||||
m_AmountMax = bod.AmountMax;
|
||||
m_Number = bod.Number;
|
||||
m_Graphic = bod.Graphic;
|
||||
m_Hue = bod.GraphicHue;
|
||||
|
||||
if (bod is SmallTinkerBOD)
|
||||
{
|
||||
m_GemType = ((SmallTinkerBOD)bod).GemType;
|
||||
}
|
||||
}
|
||||
|
||||
public BOBSmallEntry(GenericReader reader)
|
||||
{
|
||||
int version = reader.ReadEncodedInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 2:
|
||||
{
|
||||
m_GemType = (GemType)reader.ReadInt();
|
||||
goto case 1;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
m_Hue = reader.ReadInt();
|
||||
goto case 0;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
string type = reader.ReadString();
|
||||
|
||||
if (type != null)
|
||||
m_ItemType = ScriptCompiler.FindTypeByFullName(type);
|
||||
|
||||
m_RequireExceptional = reader.ReadBool();
|
||||
|
||||
m_DeedType = (BODType)reader.ReadEncodedInt();
|
||||
|
||||
m_Material = (BulkMaterialType)reader.ReadEncodedInt();
|
||||
m_AmountCur = reader.ReadEncodedInt();
|
||||
m_AmountMax = reader.ReadEncodedInt();
|
||||
m_Number = reader.ReadEncodedInt();
|
||||
m_Graphic = reader.ReadEncodedInt();
|
||||
m_Price = reader.ReadEncodedInt();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Type ItemType
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_ItemType;
|
||||
}
|
||||
}
|
||||
public bool RequireExceptional
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_RequireExceptional;
|
||||
}
|
||||
}
|
||||
public BODType DeedType
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_DeedType;
|
||||
}
|
||||
}
|
||||
public BulkMaterialType Material
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Material;
|
||||
}
|
||||
}
|
||||
public int AmountCur
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_AmountCur;
|
||||
}
|
||||
}
|
||||
public int AmountMax
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_AmountMax;
|
||||
}
|
||||
}
|
||||
public int Number
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Number;
|
||||
}
|
||||
}
|
||||
public int Graphic
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Graphic;
|
||||
}
|
||||
}
|
||||
public int Hue
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Hue;
|
||||
}
|
||||
}
|
||||
public GemType GemType
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_GemType;
|
||||
}
|
||||
}
|
||||
public int Price
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Price;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_Price = value;
|
||||
}
|
||||
}
|
||||
public Item Reconstruct()
|
||||
{
|
||||
SmallBOD bod = null;
|
||||
|
||||
switch (m_DeedType)
|
||||
{
|
||||
case BODType.Smith: bod = new SmallSmithBOD(m_AmountCur, m_AmountMax, m_ItemType, m_Number, m_Graphic, m_RequireExceptional, m_Material, m_Hue); break;
|
||||
case BODType.Tailor: bod = new SmallTailorBOD(m_AmountCur, m_AmountMax, m_ItemType, m_Number, m_Graphic, m_RequireExceptional, m_Material, m_Hue); break;
|
||||
case BODType.Inscription: bod = new SmallInscriptionBOD(m_AmountCur, m_AmountMax, m_ItemType, m_Number, m_Graphic, m_RequireExceptional, m_Material, m_Hue); break;
|
||||
case BODType.Alchemy: bod = new SmallAlchemyBOD(m_AmountCur, m_AmountMax, m_ItemType, m_Number, m_Graphic, m_RequireExceptional, m_Material, m_Hue); break;
|
||||
case BODType.Carpentry: bod = new SmallCarpentryBOD(m_AmountCur, m_AmountMax, m_ItemType, m_Number, m_Graphic, m_RequireExceptional, m_Material, m_Hue); break;
|
||||
case BODType.Fletching: bod = new SmallFletchingBOD(m_AmountCur, m_AmountMax, m_ItemType, m_Number, m_Graphic, m_RequireExceptional, m_Material, m_Hue); break;
|
||||
case BODType.Tinkering: bod = new SmallTinkerBOD(m_AmountCur, m_AmountMax, m_ItemType, m_Number, m_Graphic, m_RequireExceptional, m_Material, m_Hue, m_GemType); break;
|
||||
case BODType.Cooking: bod = new SmallCookingBOD(m_AmountCur, m_AmountMax, m_ItemType, m_Number, m_Graphic, m_RequireExceptional, m_Material, m_Hue); break;
|
||||
}
|
||||
|
||||
return bod;
|
||||
}
|
||||
|
||||
public void Serialize(GenericWriter writer)
|
||||
{
|
||||
writer.WriteEncodedInt(2); // version
|
||||
|
||||
writer.Write((int)m_GemType);
|
||||
|
||||
writer.Write(m_Hue);
|
||||
|
||||
writer.Write(m_ItemType == null ? null : m_ItemType.FullName);
|
||||
|
||||
writer.Write((bool)m_RequireExceptional);
|
||||
|
||||
writer.WriteEncodedInt((int)m_DeedType);
|
||||
writer.WriteEncodedInt((int)m_Material);
|
||||
writer.WriteEncodedInt((int)m_AmountCur);
|
||||
writer.WriteEncodedInt((int)m_AmountMax);
|
||||
writer.WriteEncodedInt((int)m_Number);
|
||||
writer.WriteEncodedInt((int)m_Graphic);
|
||||
writer.WriteEncodedInt((int)m_Price);
|
||||
}
|
||||
}
|
||||
}
|
||||
137
Scripts/Services/BulkOrders/Books/BODBuyGump.cs
Normal file
137
Scripts/Services/BulkOrders/Books/BODBuyGump.cs
Normal file
@@ -0,0 +1,137 @@
|
||||
using System;
|
||||
using Server.Gumps;
|
||||
using Server.Items;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class BODBuyGump : Gump
|
||||
{
|
||||
private readonly PlayerMobile m_From;
|
||||
private readonly BulkOrderBook m_Book;
|
||||
private readonly object m_Object;
|
||||
private readonly int m_Price;
|
||||
private readonly int m_Page;
|
||||
public BODBuyGump(PlayerMobile from, BulkOrderBook book, object obj, int page, int price)
|
||||
: base(100, 200)
|
||||
{
|
||||
this.m_From = from;
|
||||
this.m_Book = book;
|
||||
this.m_Object = obj;
|
||||
this.m_Price = price;
|
||||
this.m_Page = page;
|
||||
|
||||
this.AddPage(0);
|
||||
|
||||
this.AddBackground(100, 10, 300, 150, 5054);
|
||||
|
||||
this.AddHtmlLocalized(125, 20, 250, 24, 1019070, false, false); // You have agreed to purchase:
|
||||
this.AddHtmlLocalized(125, 45, 250, 24, 1045151, false, false); // a bulk order deed
|
||||
|
||||
this.AddHtmlLocalized(125, 70, 250, 24, 1019071, false, false); // for the amount of:
|
||||
this.AddLabel(125, 95, 0, price.ToString());
|
||||
|
||||
this.AddButton(250, 130, 4005, 4007, 1, GumpButtonType.Reply, 0);
|
||||
this.AddHtmlLocalized(282, 130, 100, 24, 1011012, false, false); // CANCEL
|
||||
|
||||
this.AddButton(120, 130, 4005, 4007, 2, GumpButtonType.Reply, 0);
|
||||
this.AddHtmlLocalized(152, 130, 100, 24, 1011036, false, false); // OKAY
|
||||
}
|
||||
|
||||
public override void OnResponse(Server.Network.NetState sender, RelayInfo info)
|
||||
{
|
||||
if (info.ButtonID == 2)
|
||||
{
|
||||
PlayerVendor pv = this.m_Book.RootParent as PlayerVendor;
|
||||
|
||||
if (this.m_Book.Entries.Contains(this.m_Object) && pv != null)
|
||||
{
|
||||
int price = 0;
|
||||
|
||||
VendorItem vi = pv.GetVendorItem(this.m_Book);
|
||||
|
||||
if (vi != null && !vi.IsForSale)
|
||||
{
|
||||
if (this.m_Object is BOBLargeEntry)
|
||||
price = ((BOBLargeEntry)this.m_Object).Price;
|
||||
else if (this.m_Object is BOBSmallEntry)
|
||||
price = ((BOBSmallEntry)this.m_Object).Price;
|
||||
}
|
||||
|
||||
if (price != this.m_Price)
|
||||
{
|
||||
pv.SayTo(this.m_From, "The price has been been changed. If you like, you may offer to purchase the item again.");
|
||||
}
|
||||
else if (price == 0)
|
||||
{
|
||||
pv.SayTo(this.m_From, 1062382); // The deed selected is not available.
|
||||
}
|
||||
else
|
||||
{
|
||||
Item item = null;
|
||||
|
||||
if (this.m_Object is BOBLargeEntry)
|
||||
item = ((BOBLargeEntry)this.m_Object).Reconstruct();
|
||||
else if (this.m_Object is BOBSmallEntry)
|
||||
item = ((BOBSmallEntry)this.m_Object).Reconstruct();
|
||||
|
||||
if (item == null)
|
||||
{
|
||||
this.m_From.SendMessage("Internal error. The bulk order deed could not be reconstructed.");
|
||||
}
|
||||
else
|
||||
{
|
||||
pv.Say(this.m_From.Name);
|
||||
|
||||
Container pack = this.m_From.Backpack;
|
||||
|
||||
if ((pack == null) || ((pack != null) && (!pack.CheckHold(this.m_From, item, true, true, 0, item.PileWeight + item.TotalWeight))))
|
||||
{
|
||||
pv.SayTo(this.m_From, 503204); // You do not have room in your backpack for this
|
||||
this.m_From.SendGump(new BOBGump(this.m_From, this.m_Book, this.m_Page, null));
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((pack != null && pack.ConsumeTotal(typeof(Gold), price)) || Banker.Withdraw(this.m_From, price))
|
||||
{
|
||||
this.m_Book.Entries.Remove(this.m_Object);
|
||||
this.m_Book.InvalidateProperties();
|
||||
pv.HoldGold += price;
|
||||
this.m_From.AddToBackpack(item);
|
||||
this.m_From.SendLocalizedMessage(1045152); // The bulk order deed has been placed in your backpack.
|
||||
|
||||
if (this.m_Book.Entries.Count / 5 < this.m_Book.ItemCount)
|
||||
{
|
||||
this.m_Book.ItemCount--;
|
||||
this.m_Book.InvalidateItems();
|
||||
}
|
||||
|
||||
if (this.m_Book.Entries.Count > 0)
|
||||
this.m_From.SendGump(new BOBGump(this.m_From, this.m_Book, this.m_Page, null));
|
||||
else
|
||||
this.m_From.SendLocalizedMessage(1062381); // The book is empty.
|
||||
}
|
||||
else
|
||||
{
|
||||
pv.SayTo(this.m_From, 503205); // You cannot afford this item.
|
||||
item.Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pv == null)
|
||||
this.m_From.SendLocalizedMessage(1062382); // The deed selected is not available.
|
||||
else
|
||||
pv.SayTo(this.m_From, 1062382); // The deed selected is not available.
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.m_From.SendLocalizedMessage(503207); // Cancelled purchase.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
16
Scripts/Services/BulkOrders/Books/BODType.cs
Normal file
16
Scripts/Services/BulkOrders/Books/BODType.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public enum BODType
|
||||
{
|
||||
Smith,
|
||||
Tailor,
|
||||
Alchemy,
|
||||
Inscription,
|
||||
Tinkering,
|
||||
Fletching,
|
||||
Carpentry,
|
||||
Cooking
|
||||
}
|
||||
}
|
||||
358
Scripts/Services/BulkOrders/Books/BulkOrderBook.cs
Normal file
358
Scripts/Services/BulkOrders/Books/BulkOrderBook.cs
Normal file
@@ -0,0 +1,358 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Server.ContextMenus;
|
||||
using Server.Gumps;
|
||||
using Server.Items;
|
||||
using Server.Mobiles;
|
||||
using Server.Multis;
|
||||
using Server.Prompts;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class BulkOrderBook : Item, ISecurable
|
||||
{
|
||||
private ArrayList m_Entries;
|
||||
private BOBFilter m_Filter;
|
||||
private string m_BookName;
|
||||
private SecureLevel m_Level;
|
||||
private int m_ItemCount;
|
||||
[Constructable]
|
||||
public BulkOrderBook()
|
||||
: base(0x2259)
|
||||
{
|
||||
this.Weight = 1.0;
|
||||
this.LootType = LootType.Blessed;
|
||||
|
||||
this.m_Entries = new ArrayList();
|
||||
this.m_Filter = new BOBFilter();
|
||||
|
||||
this.m_Level = SecureLevel.CoOwners;
|
||||
}
|
||||
|
||||
public BulkOrderBook(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public string BookName
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_BookName;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.m_BookName = value;
|
||||
this.InvalidateProperties();
|
||||
}
|
||||
}
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public SecureLevel Level
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_Level;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.m_Level = value;
|
||||
}
|
||||
}
|
||||
public ArrayList Entries
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_Entries;
|
||||
}
|
||||
}
|
||||
public BOBFilter Filter
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_Filter;
|
||||
}
|
||||
}
|
||||
public int ItemCount
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_ItemCount;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.m_ItemCount = value;
|
||||
}
|
||||
}
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (!from.InRange(this.GetWorldLocation(), 2))
|
||||
from.LocalOverheadMessage(Network.MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
|
||||
else if (this.m_Entries.Count == 0)
|
||||
from.SendLocalizedMessage(1062381); // The book is empty.
|
||||
else if (from is PlayerMobile)
|
||||
from.SendGump(new BOBGump((PlayerMobile)from, this));
|
||||
}
|
||||
|
||||
public override void OnDoubleClickSecureTrade(Mobile from)
|
||||
{
|
||||
if (!from.InRange(this.GetWorldLocation(), 2))
|
||||
{
|
||||
from.SendLocalizedMessage(500446); // That is too far away.
|
||||
}
|
||||
else if (this.m_Entries.Count == 0)
|
||||
{
|
||||
from.SendLocalizedMessage(1062381); // The book is empty.
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendGump(new BOBGump((PlayerMobile)from, this));
|
||||
|
||||
SecureTradeContainer cont = this.GetSecureTradeCont();
|
||||
|
||||
if (cont != null)
|
||||
{
|
||||
SecureTrade trade = cont.Trade;
|
||||
|
||||
if (trade != null && trade.From.Mobile == from)
|
||||
trade.To.Mobile.SendGump(new BOBGump((PlayerMobile)(trade.To.Mobile), this));
|
||||
else if (trade != null && trade.To.Mobile == from)
|
||||
trade.From.Mobile.SendGump(new BOBGump((PlayerMobile)(trade.From.Mobile), this));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override bool OnDragDrop(Mobile from, Item dropped)
|
||||
{
|
||||
if (dropped is LargeBOD || dropped is SmallBOD)
|
||||
{
|
||||
if (!this.IsChildOf(from.Backpack))
|
||||
{
|
||||
from.SendLocalizedMessage(1062385); // You must have the book in your backpack to add deeds to it.
|
||||
return false;
|
||||
}
|
||||
else if (!from.Backpack.CheckHold(from, dropped, true, true))
|
||||
return false;
|
||||
else if (this.m_Entries.Count < 500)
|
||||
{
|
||||
if (dropped is LargeBOD)
|
||||
this.m_Entries.Add(new BOBLargeEntry((LargeBOD)dropped));
|
||||
else if (dropped is SmallBOD) // Sanity
|
||||
this.m_Entries.Add(new BOBSmallEntry((SmallBOD)dropped));
|
||||
|
||||
this.InvalidateProperties();
|
||||
|
||||
if (this.m_Entries.Count / 5 > this.m_ItemCount)
|
||||
{
|
||||
this.m_ItemCount++;
|
||||
this.InvalidateItems();
|
||||
}
|
||||
|
||||
from.SendSound(0x42, this.GetWorldLocation());
|
||||
from.SendLocalizedMessage(1062386); // Deed added to book.
|
||||
|
||||
if (from is PlayerMobile)
|
||||
from.SendGump(new BOBGump((PlayerMobile)from, this));
|
||||
|
||||
dropped.Delete();
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(1062387); // The book is full of deeds.
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
from.SendLocalizedMessage(1062388); // That is not a bulk order deed.
|
||||
return false;
|
||||
}
|
||||
|
||||
public override int GetTotal(TotalType type)
|
||||
{
|
||||
int total = base.GetTotal(type);
|
||||
|
||||
if (type == TotalType.Items)
|
||||
total = this.m_ItemCount;
|
||||
|
||||
return total;
|
||||
}
|
||||
|
||||
public void InvalidateItems()
|
||||
{
|
||||
if (this.RootParent is Mobile)
|
||||
{
|
||||
Mobile m = (Mobile)this.RootParent;
|
||||
|
||||
m.UpdateTotals();
|
||||
this.InvalidateContainers(this.Parent);
|
||||
}
|
||||
}
|
||||
|
||||
public void InvalidateContainers(object parent)
|
||||
{
|
||||
if (parent != null && parent is Container)
|
||||
{
|
||||
Container c = (Container)parent;
|
||||
|
||||
c.InvalidateProperties();
|
||||
this.InvalidateContainers(c.Parent);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)2); // version
|
||||
|
||||
writer.Write((int)this.m_ItemCount);
|
||||
|
||||
writer.Write((int)this.m_Level);
|
||||
|
||||
writer.Write(this.m_BookName);
|
||||
|
||||
this.m_Filter.Serialize(writer);
|
||||
|
||||
writer.WriteEncodedInt((int)this.m_Entries.Count);
|
||||
|
||||
for (int i = 0; i < this.m_Entries.Count; ++i)
|
||||
{
|
||||
object obj = this.m_Entries[i];
|
||||
|
||||
if (obj is BOBLargeEntry)
|
||||
{
|
||||
writer.WriteEncodedInt(0);
|
||||
((BOBLargeEntry)obj).Serialize(writer);
|
||||
}
|
||||
else if (obj is BOBSmallEntry)
|
||||
{
|
||||
writer.WriteEncodedInt(1);
|
||||
((BOBSmallEntry)obj).Serialize(writer);
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteEncodedInt(-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 2:
|
||||
{
|
||||
this.m_ItemCount = reader.ReadInt();
|
||||
goto case 1;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
this.m_Level = (SecureLevel)reader.ReadInt();
|
||||
goto case 0;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
this.m_BookName = reader.ReadString();
|
||||
|
||||
this.m_Filter = new BOBFilter(reader);
|
||||
|
||||
int count = reader.ReadEncodedInt();
|
||||
|
||||
this.m_Entries = new ArrayList(count);
|
||||
|
||||
for (int i = 0; i < count; ++i)
|
||||
{
|
||||
int v = reader.ReadEncodedInt();
|
||||
|
||||
switch ( v )
|
||||
{
|
||||
case 0:
|
||||
this.m_Entries.Add(new BOBLargeEntry(reader));
|
||||
break;
|
||||
case 1:
|
||||
this.m_Entries.Add(new BOBSmallEntry(reader));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
list.Add(1062344, this.m_Entries.Count.ToString()); // Deeds in book: ~1_val~
|
||||
|
||||
if (this.m_BookName != null && this.m_BookName.Length > 0)
|
||||
list.Add(1062481, this.m_BookName); // Book Name: ~1_val~
|
||||
}
|
||||
|
||||
public override void GetContextMenuEntries(Mobile from, List<ContextMenuEntry> list)
|
||||
{
|
||||
base.GetContextMenuEntries(from, list);
|
||||
|
||||
if (from.CheckAlive() && this.IsChildOf(from.Backpack))
|
||||
list.Add(new NameBookEntry(from, this));
|
||||
|
||||
SetSecureLevelEntry.AddTo(from, this, list);
|
||||
}
|
||||
|
||||
private class NameBookEntry : ContextMenuEntry
|
||||
{
|
||||
private readonly Mobile m_From;
|
||||
private readonly BulkOrderBook m_Book;
|
||||
public NameBookEntry(Mobile from, BulkOrderBook book)
|
||||
: base(6216)
|
||||
{
|
||||
this.m_From = from;
|
||||
this.m_Book = book;
|
||||
}
|
||||
|
||||
public override void OnClick()
|
||||
{
|
||||
if (this.m_From.CheckAlive() && this.m_Book.IsChildOf(this.m_From.Backpack))
|
||||
{
|
||||
this.m_From.Prompt = new NameBookPrompt(this.m_Book);
|
||||
this.m_From.SendLocalizedMessage(1062479); // Type in the new name of the book:
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class NameBookPrompt : Prompt
|
||||
{
|
||||
public override int MessageCliloc { get { return 1062479; } }
|
||||
private readonly BulkOrderBook m_Book;
|
||||
public NameBookPrompt(BulkOrderBook book)
|
||||
{
|
||||
this.m_Book = book;
|
||||
}
|
||||
|
||||
public override void OnResponse(Mobile from, string text)
|
||||
{
|
||||
if (text.Length > 40)
|
||||
text = text.Substring(0, 40);
|
||||
|
||||
if (from.CheckAlive() && this.m_Book.IsChildOf(from.Backpack))
|
||||
{
|
||||
this.m_Book.BookName = Utility.FixHtml(text.Trim());
|
||||
|
||||
from.SendLocalizedMessage(1062480); // The bulk order book's name has been changed.
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnCancel(Mobile from)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
71
Scripts/Services/BulkOrders/BulkMaterialType.cs
Normal file
71
Scripts/Services/BulkOrders/BulkMaterialType.cs
Normal file
@@ -0,0 +1,71 @@
|
||||
using System;
|
||||
using Server.Items;
|
||||
using Server.Engines.Craft;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public enum BulkMaterialType
|
||||
{
|
||||
None,
|
||||
DullCopper,
|
||||
ShadowIron,
|
||||
Copper,
|
||||
Bronze,
|
||||
Gold,
|
||||
Agapite,
|
||||
Verite,
|
||||
Valorite,
|
||||
Spined,
|
||||
Horned,
|
||||
Barbed,
|
||||
OakWood,
|
||||
AshWood,
|
||||
YewWood,
|
||||
Heartwood,
|
||||
Bloodwood,
|
||||
Frostwood
|
||||
}
|
||||
|
||||
public enum BulkGenericType
|
||||
{
|
||||
Iron,
|
||||
Cloth,
|
||||
Leather,
|
||||
Wood
|
||||
}
|
||||
|
||||
public class BGTClassifier
|
||||
{
|
||||
public static BulkGenericType Classify(BODType deedType, Type itemType)
|
||||
{
|
||||
if (deedType == BODType.Tailor)
|
||||
{
|
||||
if (itemType == null || itemType.IsSubclassOf(typeof(BaseArmor)) || itemType.IsSubclassOf(typeof(BaseShoes)))
|
||||
return BulkGenericType.Leather;
|
||||
|
||||
return BulkGenericType.Cloth;
|
||||
}
|
||||
else if (deedType == BODType.Tinkering && itemType != null)
|
||||
{
|
||||
if(itemType == typeof(Clock) || itemType.IsSubclassOf(typeof(Clock)))
|
||||
return BulkGenericType.Wood;
|
||||
|
||||
CraftItem item = DefTinkering.CraftSystem.CraftItems.SearchFor(itemType);
|
||||
|
||||
if (item != null)
|
||||
{
|
||||
Type typeRes = item.Resources.GetAt(0).ItemType;
|
||||
|
||||
if (typeRes == typeof(Board) || typeRes == typeof(Log))
|
||||
return BulkGenericType.Wood;
|
||||
}
|
||||
}
|
||||
else if (deedType == BODType.Fletching || deedType == BODType.Carpentry)
|
||||
{
|
||||
return BulkGenericType.Wood;
|
||||
}
|
||||
|
||||
return BulkGenericType.Iron;
|
||||
}
|
||||
}
|
||||
}
|
||||
944
Scripts/Services/BulkOrders/BulkOrderSystem.cs
Normal file
944
Scripts/Services/BulkOrders/BulkOrderSystem.cs
Normal file
@@ -0,0 +1,944 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Server;
|
||||
using Server.Mobiles;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public enum PointsMode
|
||||
{
|
||||
Enabled,
|
||||
Disabled,
|
||||
Automatic
|
||||
}
|
||||
|
||||
public interface IBOD
|
||||
{
|
||||
int AmountMax { get; set; }
|
||||
bool RequireExceptional { get; set; }
|
||||
bool Complete { get; }
|
||||
BulkMaterialType Material { get; set; }
|
||||
BODType BODType { get; }
|
||||
}
|
||||
|
||||
public class BulkOrderSystem
|
||||
{
|
||||
// Logic (EA says 3 cached): 2 cached, 1 in the pipe if the last bod > 6 hours = 3
|
||||
public static readonly int MaxCachedDeeds = 2;
|
||||
public static readonly int Delay = 6;
|
||||
|
||||
public static bool NewSystemEnabled = Core.TOL;
|
||||
public static BulkOrderSystem Instance { get; set; }
|
||||
|
||||
public Dictionary<PlayerMobile, BODContext> BODPlayerData { get; set; }
|
||||
|
||||
public BulkOrderSystem()
|
||||
{
|
||||
BODPlayerData = new Dictionary<PlayerMobile, BODContext>();
|
||||
}
|
||||
|
||||
static BulkOrderSystem()
|
||||
{
|
||||
Instance = new BulkOrderSystem();
|
||||
}
|
||||
|
||||
public void Serialize(GenericWriter writer)
|
||||
{
|
||||
writer.Write(0);
|
||||
|
||||
writer.Write(BODPlayerData.Count);
|
||||
foreach (KeyValuePair<PlayerMobile, BODContext> kvp in BODPlayerData)
|
||||
{
|
||||
writer.Write(kvp.Key);
|
||||
kvp.Value.Serialize(writer);
|
||||
}
|
||||
}
|
||||
|
||||
public void Deserialize(GenericReader reader)
|
||||
{
|
||||
int version = reader.ReadInt();
|
||||
|
||||
int count = reader.ReadInt();
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
PlayerMobile player = reader.ReadMobile() as PlayerMobile;
|
||||
BODContext context = new BODContext(reader);
|
||||
|
||||
if (player != null)
|
||||
BODPlayerData[player] = context;
|
||||
}
|
||||
}
|
||||
|
||||
public static BODContext GetContext(Mobile m, bool create = true)
|
||||
{
|
||||
BODContext context = null;
|
||||
|
||||
if (m is PlayerMobile)
|
||||
{
|
||||
PlayerMobile pm = m as PlayerMobile;
|
||||
|
||||
if (Instance.BODPlayerData.ContainsKey(pm))
|
||||
{
|
||||
context = Instance.BODPlayerData[pm];
|
||||
}
|
||||
else if (create)
|
||||
{
|
||||
Instance.BODPlayerData[pm] = context = new BODContext();
|
||||
}
|
||||
}
|
||||
|
||||
return context;
|
||||
}
|
||||
|
||||
public static double GetPoints(Mobile m, BODType type)
|
||||
{
|
||||
BODContext context = GetContext(m);
|
||||
|
||||
if (context != null)
|
||||
{
|
||||
if (context.Entries.ContainsKey(type))
|
||||
{
|
||||
return context.Entries[type].BankedPoints;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static void SetPoints(Mobile m, BODType type, double points)
|
||||
{
|
||||
if (points < 0)
|
||||
points = 0.0;
|
||||
|
||||
BODContext context = GetContext(m);
|
||||
|
||||
if (context != null)
|
||||
{
|
||||
if (context.Entries.ContainsKey(type))
|
||||
{
|
||||
context.Entries[type].BankedPoints += points;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void DeductPoints(Mobile m, BODType type, double points)
|
||||
{
|
||||
if (points < 0)
|
||||
points = 0.0;
|
||||
|
||||
BODContext context = GetContext(m);
|
||||
|
||||
if (context != null)
|
||||
{
|
||||
if (context.Entries.ContainsKey(type))
|
||||
{
|
||||
context.Entries[type].BankedPoints -= points;
|
||||
|
||||
if (context.Entries[type].BankedPoints < 0.0)
|
||||
context.Entries[type].BankedPoints = 0.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static double GetBODSkill(Mobile m, SkillName skill)
|
||||
{
|
||||
return Math.Max(m.Skills[skill].Base, m.GetRacialSkillBonus(skill));
|
||||
}
|
||||
|
||||
public static List<CollectionItem> GetRewardCollection(BODType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
default:
|
||||
case BODType.Smith: return SmithRewardCalculator.Instance.RewardCollection;
|
||||
case BODType.Tailor: return TailorRewardCalculator.Instance.RewardCollection;
|
||||
case BODType.Alchemy: return AlchemyRewardCalculator.Instance.RewardCollection;
|
||||
case BODType.Inscription: return InscriptionRewardCalculator.Instance.RewardCollection;
|
||||
case BODType.Tinkering: return TinkeringRewardCalculator.Instance.RewardCollection;
|
||||
case BODType.Fletching: return FletchingRewardCalculator.Instance.RewardCollection;
|
||||
case BODType.Carpentry: return CarpentryRewardCalculator.Instance.RewardCollection;
|
||||
case BODType.Cooking: return CookingRewardCalculator.Instance.RewardCollection;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool CanGetBulkOrder(Mobile m, BODType type)
|
||||
{
|
||||
BODContext context = GetContext(m);
|
||||
|
||||
if (context != null && context.Entries.ContainsKey(type))
|
||||
{
|
||||
var entry = context.Entries[type];
|
||||
|
||||
if (entry != null)
|
||||
{
|
||||
entry.CheckCache();
|
||||
|
||||
if (entry.LastBulkOrder + TimeSpan.FromHours(Delay) < DateTime.UtcNow)
|
||||
{
|
||||
entry.LastBulkOrder = DateTime.UtcNow;
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (entry.CachedDeeds > 0)
|
||||
{
|
||||
entry.CachedDeeds--;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static TimeSpan GetNextBulkOrder(BODType type, PlayerMobile pm)
|
||||
{
|
||||
BODContext context = GetContext(pm);
|
||||
|
||||
if (context != null)
|
||||
{
|
||||
if (NewSystemEnabled)
|
||||
{
|
||||
DateTime last = context.Entries[type].LastBulkOrder;
|
||||
|
||||
return (last + TimeSpan.FromHours(Delay)) - DateTime.UtcNow;
|
||||
}
|
||||
else if (context.Entries.ContainsKey(type))
|
||||
{
|
||||
DateTime dt = context.Entries[type].NextBulkOrder;
|
||||
|
||||
if (dt < DateTime.UtcNow)
|
||||
return TimeSpan.Zero;
|
||||
|
||||
return DateTime.UtcNow - dt;
|
||||
}
|
||||
}
|
||||
|
||||
return TimeSpan.MaxValue;
|
||||
}
|
||||
|
||||
public static void SetNextBulkOrder(BODType type, PlayerMobile pm, TimeSpan ts)
|
||||
{
|
||||
BODContext context = GetContext(pm);
|
||||
|
||||
if (context != null)
|
||||
{
|
||||
if (NewSystemEnabled)
|
||||
{
|
||||
if (context.Entries.ContainsKey(type))
|
||||
{
|
||||
if (context.Entries[type].LastBulkOrder < DateTime.UtcNow - TimeSpan.FromHours(Delay * MaxCachedDeeds))
|
||||
context.Entries[type].LastBulkOrder = DateTime.UtcNow - TimeSpan.FromHours(Delay * MaxCachedDeeds);
|
||||
else
|
||||
context.Entries[type].LastBulkOrder = (context.Entries[type].LastBulkOrder + ts) - TimeSpan.FromHours(Delay);
|
||||
}
|
||||
}
|
||||
else if (context.Entries.ContainsKey(type))
|
||||
{
|
||||
context.Entries[type].NextBulkOrder = DateTime.UtcNow + ts;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static Item CreateBulkOrder(Mobile m, BODType type, bool fromContextMenu)
|
||||
{
|
||||
PlayerMobile pm = m as PlayerMobile;
|
||||
|
||||
if (pm == null)
|
||||
return null;
|
||||
|
||||
if (pm.AccessLevel > AccessLevel.Player || fromContextMenu || 0.2 > Utility.RandomDouble())
|
||||
{
|
||||
SkillName sk = GetSkillForBOD(type);
|
||||
double theirSkill = pm.Skills[sk].Base;
|
||||
bool doLarge = theirSkill >= 70.1 && ((theirSkill - 40.0) / 300.0) > Utility.RandomDouble();
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case BODType.Smith:
|
||||
if (doLarge) return new LargeSmithBOD();
|
||||
else return SmallSmithBOD.CreateRandomFor(pm);
|
||||
case BODType.Tailor: if (doLarge) return new LargeTailorBOD();
|
||||
else return SmallTailorBOD.CreateRandomFor(pm);
|
||||
case BODType.Alchemy:
|
||||
if (doLarge) return new LargeAlchemyBOD();
|
||||
else return SmallAlchemyBOD.CreateRandomFor(pm);
|
||||
case BODType.Inscription:
|
||||
if (doLarge) return new LargeInscriptionBOD();
|
||||
else return SmallInscriptionBOD.CreateRandomFor(pm);
|
||||
case BODType.Tinkering:
|
||||
if (doLarge) return new LargeTinkerBOD();
|
||||
else return SmallTinkerBOD.CreateRandomFor(pm);
|
||||
case BODType.Cooking:
|
||||
if (doLarge) return new LargeCookingBOD();
|
||||
else return SmallCookingBOD.CreateRandomFor(pm);
|
||||
case BODType.Fletching:
|
||||
if (doLarge) return new LargeFletchingBOD();
|
||||
else return SmallFletchingBOD.CreateRandomFor(pm);
|
||||
case BODType.Carpentry:
|
||||
if (doLarge) return new LargeCarpentryBOD();
|
||||
else return SmallCarpentryBOD.CreateRandomFor(pm);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static SkillName GetSkillForBOD(BODType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
default:
|
||||
case BODType.Smith: return SkillName.Blacksmith;
|
||||
case BODType.Tailor: return SkillName.Tailoring;
|
||||
case BODType.Alchemy: return SkillName.Alchemy;
|
||||
case BODType.Inscription: return SkillName.Inscribe;
|
||||
case BODType.Tinkering: return SkillName.Tinkering;
|
||||
case BODType.Cooking: return SkillName.Cooking;
|
||||
case BODType.Fletching: return SkillName.Fletching;
|
||||
case BODType.Carpentry: return SkillName.Carpentry;
|
||||
}
|
||||
}
|
||||
|
||||
public static int GetBodHue(BODType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
default:
|
||||
case BODType.Smith: return 0x44E;
|
||||
case BODType.Tailor: return 0x483;
|
||||
case BODType.Alchemy: return 2505;
|
||||
case BODType.Inscription: return 2598;
|
||||
case BODType.Tinkering: return 1109;
|
||||
case BODType.Cooking: return 1169;
|
||||
case BODType.Fletching: return 1425;
|
||||
case BODType.Carpentry: return 1512;
|
||||
}
|
||||
}
|
||||
|
||||
public static BOBFilter GetBOBFilter(PlayerMobile pm)
|
||||
{
|
||||
return GetContext(pm).BOBFilter;
|
||||
}
|
||||
|
||||
public static void SetBOBFilter(PlayerMobile pm, BOBFilter filter)
|
||||
{
|
||||
BODContext context = GetContext(pm);
|
||||
context.BOBFilter = filter;
|
||||
}
|
||||
|
||||
public static int ComputePoints(SmallBOD bod)
|
||||
{
|
||||
switch (bod.BODType)
|
||||
{
|
||||
default:
|
||||
case BODType.Smith: return SmithRewardCalculator.Instance.ComputePoints(bod);
|
||||
case BODType.Tailor: return TailorRewardCalculator.Instance.ComputePoints(bod);
|
||||
case BODType.Alchemy: return AlchemyRewardCalculator.Instance.ComputePoints(bod);
|
||||
case BODType.Inscription: return InscriptionRewardCalculator.Instance.ComputePoints(bod);
|
||||
case BODType.Tinkering: return TinkeringRewardCalculator.Instance.ComputePoints(bod);
|
||||
case BODType.Cooking: return CookingRewardCalculator.Instance.ComputePoints(bod);
|
||||
case BODType.Fletching: return FletchingRewardCalculator.Instance.ComputePoints(bod);
|
||||
case BODType.Carpentry: return CarpentryRewardCalculator.Instance.ComputePoints(bod);
|
||||
}
|
||||
}
|
||||
|
||||
public static int ComputePoints(LargeBOD bod)
|
||||
{
|
||||
switch (bod.BODType)
|
||||
{
|
||||
default:
|
||||
case BODType.Smith: return SmithRewardCalculator.Instance.ComputePoints(bod);
|
||||
case BODType.Tailor: return TailorRewardCalculator.Instance.ComputePoints(bod);
|
||||
case BODType.Alchemy: return AlchemyRewardCalculator.Instance.ComputePoints(bod);
|
||||
case BODType.Inscription: return InscriptionRewardCalculator.Instance.ComputePoints(bod);
|
||||
case BODType.Tinkering: return TinkeringRewardCalculator.Instance.ComputePoints(bod);
|
||||
case BODType.Cooking: return CookingRewardCalculator.Instance.ComputePoints(bod);
|
||||
case BODType.Fletching: return FletchingRewardCalculator.Instance.ComputePoints(bod);
|
||||
case BODType.Carpentry: return CarpentryRewardCalculator.Instance.ComputePoints(bod);
|
||||
}
|
||||
}
|
||||
|
||||
public static bool ComputeGold(Type type, int quantity, out int gold)
|
||||
{
|
||||
if (GenericBuyInfo.BuyPrices.ContainsKey(type))
|
||||
{
|
||||
gold = (quantity * GenericBuyInfo.BuyPrices[type]) / 2;
|
||||
return true;
|
||||
}
|
||||
|
||||
gold = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void ComputePoints(SmallBOD bod, out int points, out double banked)
|
||||
{
|
||||
points = 0;
|
||||
banked = 0.0;
|
||||
|
||||
switch (bod.BODType)
|
||||
{
|
||||
default:
|
||||
case BODType.Smith: points = SmithRewardCalculator.Instance.ComputePoints(bod); break;
|
||||
case BODType.Tailor: points = TailorRewardCalculator.Instance.ComputePoints(bod); break;
|
||||
case BODType.Alchemy: points = AlchemyRewardCalculator.Instance.ComputePoints(bod); break;
|
||||
case BODType.Inscription: points = InscriptionRewardCalculator.Instance.ComputePoints(bod); break;
|
||||
case BODType.Tinkering: points = TinkeringRewardCalculator.Instance.ComputePoints(bod); break;
|
||||
case BODType.Cooking: points = CookingRewardCalculator.Instance.ComputePoints(bod); break;
|
||||
case BODType.Fletching: points = FletchingRewardCalculator.Instance.ComputePoints(bod); break;
|
||||
case BODType.Carpentry: points = CarpentryRewardCalculator.Instance.ComputePoints(bod); break;
|
||||
}
|
||||
|
||||
banked = (double)points * 0.02;
|
||||
}
|
||||
|
||||
public static void ComputePoints(LargeBOD bod, out int points, out double banked)
|
||||
{
|
||||
points = 0;
|
||||
banked = 0.0;
|
||||
|
||||
switch (bod.BODType)
|
||||
{
|
||||
default:
|
||||
case BODType.Smith: points = SmithRewardCalculator.Instance.ComputePoints(bod); break;
|
||||
case BODType.Tailor: points = TailorRewardCalculator.Instance.ComputePoints(bod); break;
|
||||
case BODType.Alchemy: points = AlchemyRewardCalculator.Instance.ComputePoints(bod); break;
|
||||
case BODType.Inscription: points = InscriptionRewardCalculator.Instance.ComputePoints(bod); break;
|
||||
case BODType.Tinkering: points = TinkeringRewardCalculator.Instance.ComputePoints(bod); break;
|
||||
case BODType.Cooking: points = CookingRewardCalculator.Instance.ComputePoints(bod); break;
|
||||
case BODType.Fletching: points = FletchingRewardCalculator.Instance.ComputePoints(bod); break;
|
||||
case BODType.Carpentry: points = CarpentryRewardCalculator.Instance.ComputePoints(bod); break;
|
||||
}
|
||||
|
||||
banked = (double)points * .2;
|
||||
}
|
||||
|
||||
public static void AddToPending(Mobile m, BODType type, int points)
|
||||
{
|
||||
BODContext context = GetContext(m);
|
||||
|
||||
if (context != null)
|
||||
{
|
||||
context.AddPending(type, points);
|
||||
}
|
||||
}
|
||||
|
||||
public static void RemovePending(Mobile m, BODType type)
|
||||
{
|
||||
BODContext context = GetContext(m);
|
||||
|
||||
if (context != null)
|
||||
{
|
||||
context.RemovePending(type);
|
||||
}
|
||||
}
|
||||
|
||||
public static bool CanClaimRewards(Mobile m)
|
||||
{
|
||||
BODContext context = GetContext(m);
|
||||
|
||||
if (context != null)
|
||||
{
|
||||
return context.CanClaimRewards();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool CanExchangeBOD(Mobile from, BaseVendor vendor, IBOD bod, int cost)
|
||||
{
|
||||
if (bod.BODType != vendor.BODType)
|
||||
{
|
||||
vendor.SayTo(from, 1152298, 0x3B2); // I don't deal in those goods.
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((bod is SmallBOD && ((SmallBOD)bod).AmountCur > 0) ||
|
||||
(bod is LargeBOD && ((LargeBOD)bod).Entries != null &&
|
||||
((LargeBOD)bod).Entries.FirstOrDefault(e => e.Amount > 0) != null))
|
||||
{
|
||||
vendor.SayTo(from, 1152299, 0x3B2); // I am sorry to say I cannot work with a deed that is even partially filled.
|
||||
return false;
|
||||
}
|
||||
|
||||
if (bod.AmountMax == 20 && (!CanBeExceptional(bod) || bod.RequireExceptional) &&
|
||||
(!CanUseMaterial(bod) ||
|
||||
(bod.Material == BulkMaterialType.Valorite ||
|
||||
bod.Material == BulkMaterialType.Frostwood ||
|
||||
bod.Material == BulkMaterialType.Barbed)))
|
||||
{
|
||||
vendor.SayTo(from, 1152291, 0x3B2); // I won't be able to replace that bulk order with a better one.
|
||||
return false;
|
||||
}
|
||||
|
||||
if (cost > -1 && !Banker.Withdraw(from, cost, true))
|
||||
{
|
||||
vendor.SayTo(from, 1152302, 0x3B2); // I am afraid your bank box does not contain the funds needed to complete this transaction.
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static Type GetTypeFromBOD(IBOD bod)
|
||||
{
|
||||
Type t = null;
|
||||
|
||||
if (bod is SmallBOD)
|
||||
{
|
||||
t = ((SmallBOD)bod).Type;
|
||||
}
|
||||
else if (bod is LargeBOD && ((LargeBOD)bod).Entries != null && ((LargeBOD)bod).Entries.Length > 0)
|
||||
{
|
||||
t = ((LargeBOD)bod).Entries[0].Details.Type;
|
||||
}
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
public static bool CanBeExceptional(IBOD bod)
|
||||
{
|
||||
switch (bod.BODType)
|
||||
{
|
||||
default: return true;
|
||||
case BODType.Alchemy:
|
||||
case BODType.Inscription: return false;
|
||||
case BODType.Tinkering:
|
||||
case BODType.Cooking:
|
||||
case BODType.Fletching:
|
||||
return !IsInExceptionalExcludeList(bod);
|
||||
}
|
||||
}
|
||||
|
||||
private static bool IsInExceptionalExcludeList(IBOD bod)
|
||||
{
|
||||
Type t = GetTypeFromBOD(bod);
|
||||
|
||||
if (t == null)
|
||||
return false;
|
||||
|
||||
return _ExceptionalExcluded.FirstOrDefault(type => type == t) != null;
|
||||
}
|
||||
|
||||
public static bool CanUseMaterial(IBOD bod)
|
||||
{
|
||||
switch (bod.BODType)
|
||||
{
|
||||
default: return true;
|
||||
case BODType.Alchemy:
|
||||
case BODType.Inscription:
|
||||
case BODType.Cooking: return false;
|
||||
case BODType.Tinkering:
|
||||
case BODType.Fletching: return !IsInExceptionalExcludeList(bod);
|
||||
case BODType.Tailor: return BGTClassifier.Classify(BODType.Tailor, GetTypeFromBOD(bod)) == BulkGenericType.Leather;
|
||||
}
|
||||
}
|
||||
|
||||
private static Type[] _ExceptionalExcluded =
|
||||
{
|
||||
typeof(Arrow), typeof(Bolt), typeof(Kindling), typeof(Shaft),
|
||||
|
||||
typeof(EnchantedApple), typeof(TribalPaint), typeof(GrapesOfWrath),
|
||||
typeof(EggBomb), typeof(CookedBird), typeof(FishSteak), typeof(FriedEggs),
|
||||
typeof(LambLeg), typeof(Ribs),
|
||||
|
||||
typeof(Gears), typeof(Axle), typeof(Springs), typeof(AxleGears), typeof(ClockParts),
|
||||
typeof(Clock), typeof(PotionKeg), typeof(ClockFrame), typeof(MetalContainerEngraver)
|
||||
};
|
||||
|
||||
public static void MutateBOD(IBOD bod)
|
||||
{
|
||||
List<int> picker = new List<int>();
|
||||
|
||||
if (!bod.RequireExceptional && CanBeExceptional(bod))
|
||||
{
|
||||
picker.Add(0);
|
||||
}
|
||||
|
||||
if (bod.AmountMax < 20)
|
||||
{
|
||||
picker.Add(1);
|
||||
}
|
||||
|
||||
if (CanUseMaterial(bod) && bod.Material != BulkMaterialType.Frostwood && bod.Material != BulkMaterialType.Barbed && bod.Material != BulkMaterialType.Valorite)
|
||||
{
|
||||
picker.Add(2);
|
||||
}
|
||||
|
||||
if (picker.Count == 0)
|
||||
return;
|
||||
|
||||
switch (picker[Utility.Random(picker.Count)])
|
||||
{
|
||||
case 0: bod.RequireExceptional = true; break;
|
||||
case 1: bod.AmountMax += 5; break;
|
||||
case 2:
|
||||
if (bod.Material == BulkMaterialType.None)
|
||||
{
|
||||
BulkGenericType type = BGTClassifier.Classify(bod.BODType, null);
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case BulkGenericType.Iron: bod.Material = BulkMaterialType.DullCopper; break;
|
||||
case BulkGenericType.Cloth: break;
|
||||
case BulkGenericType.Leather: bod.Material = BulkMaterialType.Spined; break;
|
||||
case BulkGenericType.Wood: bod.Material = BulkMaterialType.OakWood; break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
bod.Material++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
picker.Clear();
|
||||
}
|
||||
|
||||
public static int GetBribe(IBOD bod)
|
||||
{
|
||||
int worth = 0;
|
||||
|
||||
if (bod.RequireExceptional)
|
||||
{
|
||||
worth += 400;
|
||||
}
|
||||
|
||||
switch (bod.Material)
|
||||
{
|
||||
case BulkMaterialType.DullCopper: worth += 25; break;
|
||||
case BulkMaterialType.ShadowIron: worth += 50; break;
|
||||
case BulkMaterialType.Copper: worth += 100; break;
|
||||
case BulkMaterialType.Bronze: worth += 200; break;
|
||||
case BulkMaterialType.Gold: worth += 300; break;
|
||||
case BulkMaterialType.Agapite: worth += 400; break;
|
||||
case BulkMaterialType.Verite: worth += 500; break;
|
||||
case BulkMaterialType.Valorite: worth += 600; break;
|
||||
case BulkMaterialType.Spined: worth += 100; break;
|
||||
case BulkMaterialType.Horned: worth += 250; break;
|
||||
case BulkMaterialType.Barbed: worth += 500; break;
|
||||
case BulkMaterialType.OakWood: worth += 100; break;
|
||||
case BulkMaterialType.AshWood: worth += 200; break;
|
||||
case BulkMaterialType.YewWood: worth += 300; break;
|
||||
case BulkMaterialType.Heartwood: worth += 400; break;
|
||||
case BulkMaterialType.Bloodwood: worth += 500; break;
|
||||
case BulkMaterialType.Frostwood: worth += 600; break;
|
||||
}
|
||||
|
||||
switch (bod.AmountMax)
|
||||
{
|
||||
default:
|
||||
case 10:
|
||||
case 15: worth += 100; break;
|
||||
case 20: worth += 250; break;
|
||||
}
|
||||
|
||||
if (bod is LargeBOD && ((LargeBOD)bod).Entries != null)
|
||||
{
|
||||
worth *= Math.Min(4, ((LargeBOD)bod).Entries.Length);
|
||||
}
|
||||
|
||||
return worth;
|
||||
}
|
||||
|
||||
public static void OnTick()
|
||||
{
|
||||
foreach (var kvp in Instance.BODPlayerData)
|
||||
{
|
||||
kvp.Value.CheckCache();
|
||||
}
|
||||
}
|
||||
|
||||
public static void OnLogin(LoginEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
public static string FilePath = Path.Combine("Saves/CraftContext", "BODs.bin");
|
||||
|
||||
public static void Configure()
|
||||
{
|
||||
EventSink.WorldSave += OnSave;
|
||||
EventSink.WorldLoad += OnLoad;
|
||||
}
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
if (NewSystemEnabled)
|
||||
{
|
||||
Timer.DelayCall(TimeSpan.FromMinutes(1), TimeSpan.FromMinutes(1), OnTick);
|
||||
}
|
||||
}
|
||||
|
||||
public static void OnSave(WorldSaveEventArgs e)
|
||||
{
|
||||
Persistence.Serialize(
|
||||
FilePath,
|
||||
writer =>
|
||||
{
|
||||
writer.Write(0);
|
||||
|
||||
Instance.Serialize(writer);
|
||||
});
|
||||
}
|
||||
|
||||
public static void OnLoad()
|
||||
{
|
||||
Persistence.Deserialize(
|
||||
FilePath,
|
||||
reader =>
|
||||
{
|
||||
int version = reader.ReadInt();
|
||||
|
||||
Instance.Deserialize(reader);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public class BODContext
|
||||
{
|
||||
public Dictionary<BODType, BODEntry> Entries { get; set; }
|
||||
|
||||
public BOBFilter BOBFilter { get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public PointsMode PointsMode { get; set; }
|
||||
|
||||
public BODContext()
|
||||
{
|
||||
BOBFilter = new BOBFilter();
|
||||
|
||||
ConfigEntries();
|
||||
}
|
||||
|
||||
public void AddPending(BODType type, int points)
|
||||
{
|
||||
if (Entries.ContainsKey(type))
|
||||
{
|
||||
Entries[type].PendingRewardPoints = points;
|
||||
}
|
||||
}
|
||||
|
||||
public void RemovePending(BODType type)
|
||||
{
|
||||
if (Entries.ContainsKey(type))
|
||||
{
|
||||
Entries[type].PendingRewardPoints = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public int GetPendingRewardFor(BODType type)
|
||||
{
|
||||
if (Entries.ContainsKey(type))
|
||||
{
|
||||
return Entries[type].PendingRewardPoints;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public bool CanClaimRewards()
|
||||
{
|
||||
foreach (var kvp in Entries)
|
||||
{
|
||||
if (kvp.Value.PendingRewardPoints > 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public BODContext(GenericReader reader)
|
||||
{
|
||||
int version = reader.ReadInt();
|
||||
ConfigEntries();
|
||||
|
||||
this.PointsMode = (PointsMode)reader.ReadInt();
|
||||
BOBFilter = new BOBFilter(reader);
|
||||
|
||||
int count = reader.ReadInt();
|
||||
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
BODType type = (BODType)reader.ReadInt();
|
||||
BODEntry entry = new BODEntry(reader);
|
||||
|
||||
if (Entries.ContainsKey(type))
|
||||
Entries[type] = entry;
|
||||
}
|
||||
}
|
||||
|
||||
public void Serialize(GenericWriter writer)
|
||||
{
|
||||
writer.Write(0);
|
||||
|
||||
writer.Write((int)this.PointsMode);
|
||||
BOBFilter.Serialize(writer);
|
||||
|
||||
// Lets do this dynamically incase we add new bods in the future
|
||||
writer.Write(Entries.Count);
|
||||
foreach (KeyValuePair<BODType, BODEntry> kvp in Entries)
|
||||
{
|
||||
writer.Write((int)kvp.Key);
|
||||
kvp.Value.Serialize(writer);
|
||||
}
|
||||
}
|
||||
|
||||
private void ConfigEntries()
|
||||
{
|
||||
Entries = new Dictionary<BODType, BODEntry>();
|
||||
|
||||
Entries[BODType.Smith] = new BODEntry();
|
||||
Entries[BODType.Tailor] = new BODEntry();
|
||||
Entries[BODType.Tinkering] = new BODEntry();
|
||||
Entries[BODType.Carpentry] = new BODEntry();
|
||||
Entries[BODType.Fletching] = new BODEntry();
|
||||
Entries[BODType.Cooking] = new BODEntry();
|
||||
Entries[BODType.Alchemy] = new BODEntry();
|
||||
Entries[BODType.Inscription] = new BODEntry();
|
||||
}
|
||||
|
||||
public void CheckCache()
|
||||
{
|
||||
foreach (var kvp in Entries)
|
||||
{
|
||||
kvp.Value.CheckCache();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[PropertyObject]
|
||||
public class BODEntry
|
||||
{
|
||||
private int _CachedDeeds;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int CachedDeeds
|
||||
{
|
||||
get { return _CachedDeeds; }
|
||||
set
|
||||
{
|
||||
int old = _CachedDeeds;
|
||||
|
||||
_CachedDeeds = Math.Max(0, Math.Min(BulkOrderSystem.MaxCachedDeeds, value));
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public DateTime LastBulkOrder { get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public double BankedPoints { get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int PendingRewardPoints { get; set; }
|
||||
|
||||
// Legacy System
|
||||
private DateTime _NextBulkOrder;
|
||||
|
||||
public DateTime NextBulkOrder
|
||||
{
|
||||
get
|
||||
{
|
||||
return _NextBulkOrder;
|
||||
}
|
||||
set
|
||||
{
|
||||
_NextBulkOrder = value;
|
||||
}
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return "...";
|
||||
}
|
||||
|
||||
public BODEntry()
|
||||
{
|
||||
_CachedDeeds = BulkOrderSystem.MaxCachedDeeds;
|
||||
}
|
||||
|
||||
public void CheckCache()
|
||||
{
|
||||
if (_CachedDeeds >= BulkOrderSystem.MaxCachedDeeds)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (LastBulkOrder == DateTime.MinValue)
|
||||
{
|
||||
CachedDeeds = BulkOrderSystem.MaxCachedDeeds;
|
||||
LastBulkOrder = DateTime.UtcNow - TimeSpan.FromHours(BulkOrderSystem.Delay);
|
||||
}
|
||||
else if (LastBulkOrder + TimeSpan.FromHours(BulkOrderSystem.Delay) < DateTime.UtcNow)
|
||||
{
|
||||
CachedDeeds++;
|
||||
LastBulkOrder = LastBulkOrder + TimeSpan.FromHours(BulkOrderSystem.Delay);
|
||||
}
|
||||
}
|
||||
|
||||
public BODEntry(GenericReader reader)
|
||||
{
|
||||
int version = reader.ReadInt();
|
||||
|
||||
if (reader.ReadInt() == 0)
|
||||
{
|
||||
switch (version)
|
||||
{
|
||||
case 1:
|
||||
case 0:
|
||||
_CachedDeeds = reader.ReadInt();
|
||||
LastBulkOrder = reader.ReadDateTime();
|
||||
BankedPoints = reader.ReadDouble();
|
||||
PendingRewardPoints = reader.ReadInt();
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_NextBulkOrder = reader.ReadDateTime();
|
||||
}
|
||||
|
||||
if (version == 0 && _CachedDeeds > BulkOrderSystem.MaxCachedDeeds)
|
||||
{
|
||||
_CachedDeeds = BulkOrderSystem.MaxCachedDeeds;
|
||||
}
|
||||
}
|
||||
|
||||
public void Serialize(GenericWriter writer)
|
||||
{
|
||||
writer.Write(1);
|
||||
|
||||
if (BulkOrderSystem.NewSystemEnabled)
|
||||
{
|
||||
writer.Write(0);
|
||||
writer.Write(_CachedDeeds);
|
||||
writer.Write(LastBulkOrder);
|
||||
writer.Write(BankedPoints);
|
||||
writer.Write(PendingRewardPoints);
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.Write(1);
|
||||
writer.Write(_NextBulkOrder);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class PendingBribe
|
||||
{
|
||||
public IBOD BOD { get; set; }
|
||||
public int Amount { get; set; }
|
||||
|
||||
public PendingBribe(IBOD bod, int amount)
|
||||
{
|
||||
BOD = bod;
|
||||
Amount = amount;
|
||||
}
|
||||
}
|
||||
}
|
||||
47
Scripts/Services/BulkOrders/Items/BODRewardTitleDeed.cs
Normal file
47
Scripts/Services/BulkOrders/Items/BODRewardTitleDeed.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
using System;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class BODRewardTitleDeed : BaseRewardTitleDeed
|
||||
{
|
||||
public override int LabelNumber { get { return 1155604; } } // A Deed for a Reward Title
|
||||
public override TextDefinition Title { get { return _Title; } }
|
||||
|
||||
private TextDefinition _Title;
|
||||
|
||||
[Constructable]
|
||||
public BODRewardTitleDeed(int title)
|
||||
{
|
||||
_Title = new TextDefinition(1157181 + title);
|
||||
}
|
||||
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
list.Add(1114057, Title.ToString()); // ~1_NOTHING~
|
||||
}
|
||||
|
||||
public BODRewardTitleDeed(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write((int)0);
|
||||
|
||||
TextDefinition.Serialize(writer, _Title);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int v = reader.ReadInt();
|
||||
|
||||
_Title = TextDefinition.Deserialize(reader);
|
||||
}
|
||||
}
|
||||
}
|
||||
45
Scripts/Services/BulkOrders/Items/DrSpectorsLenses.cs
Normal file
45
Scripts/Services/BulkOrders/Items/DrSpectorsLenses.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
using System;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class DrSpectorsLenses : Glasses
|
||||
{
|
||||
public override int LabelNumber { get { return 1156991; } } // Dr. Spector's lenses
|
||||
public override bool IsArtifact { get { return true; } }
|
||||
|
||||
[Constructable]
|
||||
public DrSpectorsLenses()
|
||||
{
|
||||
Attributes.BonusInt = 8;
|
||||
Attributes.RegenMana = 4;
|
||||
Attributes.SpellDamage = 12;
|
||||
Attributes.LowerManaCost = 8;
|
||||
Attributes.LowerRegCost = 10;
|
||||
}
|
||||
|
||||
public override int BasePhysicalResistance { get { return 5; } }
|
||||
public override int BaseFireResistance { get { return 10; } }
|
||||
public override int BaseColdResistance { get { return 14; } }
|
||||
public override int BasePoisonResistance { get { return 20; } }
|
||||
public override int BaseEnergyResistance { get { return 20; } }
|
||||
public override int InitMinHits { get { return 255; } }
|
||||
public override int InitMaxHits { get { return 255; } }
|
||||
|
||||
public DrSpectorsLenses(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
456
Scripts/Services/BulkOrders/Items/FementationBarrel.cs
Normal file
456
Scripts/Services/BulkOrders/Items/FementationBarrel.cs
Normal file
@@ -0,0 +1,456 @@
|
||||
using System;
|
||||
using Server.Mobiles;
|
||||
using Server.ContextMenus;
|
||||
using System.Collections.Generic;
|
||||
using Server.Gumps;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public enum FruitType
|
||||
{
|
||||
None,
|
||||
Grape,
|
||||
Apple,
|
||||
Peach,
|
||||
Pear,
|
||||
Plum
|
||||
}
|
||||
|
||||
[FlipableAttribute(0x9E36, 0x9E37)]
|
||||
public class FermentationBarrel : Item
|
||||
{
|
||||
private static readonly int MinFruit = 20;
|
||||
private static readonly int MaxFruit = 80;
|
||||
|
||||
private FruitType _FruitType;
|
||||
private int _Fruit;
|
||||
private int _BacterialResistance;
|
||||
|
||||
private bool _Fermenting;
|
||||
private DateTime _FermentingEnds;
|
||||
|
||||
private bool _Fermented;
|
||||
private bool _BadBatch;
|
||||
private int _BottlesRemaining;
|
||||
public string _Vintage;
|
||||
|
||||
public Mobile _Maker;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public FruitType FruitType { get { return _FruitType; } set { _FruitType = value; InvalidateProperties(); } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int Fruit { get { return _Fruit; } set { _Fruit = value; InvalidateProperties(); } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int BacterialResistance { get { return _BacterialResistance; } set { _BacterialResistance = value; InvalidateProperties(); } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public bool Fermenting { get { return _Fermenting; } set { _Fermenting = value; InvalidateProperties(); } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public DateTime FermentingEnds { get { return _FermentingEnds; } set { _FermentingEnds = value; InvalidateProperties(); } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public bool Fermented { get { return _Fermented; } set { _Fermented = value; InvalidateProperties(); } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public bool BadBatch { get { return _BadBatch; } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int BottlesRemaining { get { return _BottlesRemaining; } set { _BottlesRemaining = value; InvalidateProperties(); } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public string Vintage { get { return _Vintage; } set { _Vintage = value; InvalidateProperties(); } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public Mobile Maker { get { return _Maker; } set { _Maker = value; } }
|
||||
|
||||
public bool HasYeast { get { return _BacterialResistance > 0; } }
|
||||
|
||||
public override int LabelNumber { get { return 1124526; } } // Fermentation Barrel
|
||||
|
||||
public override double DefaultWeight
|
||||
{
|
||||
get
|
||||
{
|
||||
if (BottlesRemaining <= 0)
|
||||
return 1.0;
|
||||
|
||||
return (double)BottlesRemaining;
|
||||
}
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public FermentationBarrel()
|
||||
: base(0x9E36)
|
||||
{
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (from.InRange(this.GetWorldLocation(), 2))
|
||||
{
|
||||
if (_Fermenting && _FermentingEnds < DateTime.UtcNow)
|
||||
{
|
||||
_Fermented = true;
|
||||
|
||||
int skill = (int)((from.Skills[SkillName.Cooking].Value + from.Skills[SkillName.Alchemy].Value) / 2);
|
||||
|
||||
skill *= _BacterialResistance / 4;
|
||||
|
||||
_BadBatch = skill < Utility.Random(225);
|
||||
|
||||
if (!_BadBatch)
|
||||
{
|
||||
BottlesRemaining = _Fruit / 4;
|
||||
}
|
||||
}
|
||||
|
||||
if (_Fermented)
|
||||
{
|
||||
if (_BadBatch)
|
||||
{
|
||||
from.PrivateOverheadMessage(Server.Network.MessageType.Regular, 1154, 1157258, from.NetState); // *You gently taste the fermentation...it's spoiled! You should probably empty the barrel*
|
||||
}
|
||||
else if (_BottlesRemaining > 0)
|
||||
{
|
||||
BottleOfWine bottle = new BottleOfWine(_FruitType, _Vintage, _Maker);
|
||||
|
||||
if (from.Backpack != null && from.Backpack.TryDropItem(from, bottle, false))
|
||||
{
|
||||
from.PlaySound(0x240);
|
||||
from.SendMessage("You pour the wine into a bottle and place it in your backpack.");
|
||||
|
||||
BottlesRemaining--;
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(500720); // You don't have enough room in your backpack!
|
||||
bottle.Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override bool OnDragDrop(Mobile from, Item dropped)
|
||||
{
|
||||
if (_Fermented)
|
||||
{
|
||||
from.SendLocalizedMessage(1157245); // The fermentation barrel is not empty. Empty it first to add fruit and yeast.
|
||||
}
|
||||
else if (_Fermenting)
|
||||
{
|
||||
from.SendLocalizedMessage(1157244); // You may not add anything to the fermentation barrel after fermentation has begun.
|
||||
}
|
||||
else if (dropped is Yeast)
|
||||
{
|
||||
if (HasYeast)
|
||||
{
|
||||
from.SendLocalizedMessage(1157256); // You have already added yeast to the barrel.
|
||||
}
|
||||
else
|
||||
{
|
||||
BacterialResistance = ((Yeast)dropped).BacterialResistance;
|
||||
dropped.Delete();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FruitType type = GetFruitType(dropped.GetType());
|
||||
|
||||
if (_FruitType != FruitType.None && _FruitType != type)
|
||||
{
|
||||
from.SendLocalizedMessage(1157243); // You may only put one type of fruit in the fermentation barrel at one time. Empty the barrel first.
|
||||
}
|
||||
else if (type != FruitType.None)
|
||||
{
|
||||
if (_FruitType == FruitType.None)
|
||||
_FruitType = type;
|
||||
|
||||
if (_Fruit + dropped.Amount <= MaxFruit)
|
||||
{
|
||||
Fruit += dropped.Amount;
|
||||
dropped.Delete();
|
||||
}
|
||||
else
|
||||
{
|
||||
dropped.Amount -= MaxFruit - _Fruit;
|
||||
Fruit = MaxFruit;
|
||||
}
|
||||
}
|
||||
else if (!(dropped is Yeast))
|
||||
{
|
||||
from.SendLocalizedMessage(1157246); // You may only put fruit and yeast in the fermentation barrel.
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
if (_Vintage != null)
|
||||
{
|
||||
list.Add(1157254, _Vintage); // <BASEFONT COLOR=#0099cc>~1_VAL~<BASEFONT COLOR=#FFFFFF>
|
||||
}
|
||||
|
||||
if (_FruitType != FruitType.None)
|
||||
{
|
||||
list.Add(1157248 + (int)_FruitType);
|
||||
}
|
||||
|
||||
if (_Fermented)
|
||||
{
|
||||
list.Add(1157259, _BottlesRemaining.ToString()); // Bottles Remaining: ~1_VAL~
|
||||
}
|
||||
}
|
||||
|
||||
public override void GetContextMenuEntries(Mobile from, List<ContextMenuEntry> entries)
|
||||
{
|
||||
base.GetContextMenuEntries(from, entries);
|
||||
|
||||
entries.Add(new SimpleContextMenuEntry(from, 1157231, m => // Begin Fermentation
|
||||
{
|
||||
if (_Fermenting)
|
||||
{
|
||||
m.SendLocalizedMessage(1157237); // The fermentation process has already begun.
|
||||
}
|
||||
else if (!HasYeast || _Fruit < MinFruit)
|
||||
{
|
||||
m.SendLocalizedMessage(1157255); // You do not have enough fruit or yeast to begin fermentation.
|
||||
}
|
||||
else
|
||||
{
|
||||
m.SendGump(new ConfirmCallbackGump(m as PlayerMobile, 1157234, 1157240, null, confirm: StartFermentation, close: CancelFermentation)); // Are you sure you wish to start the fermentation process?
|
||||
}
|
||||
}, 3, !_Fermented && (HasYeast || _Fruit > 0)));
|
||||
|
||||
entries.Add(new SimpleContextMenuEntry(from, 1157232, m => // Empty Barrel
|
||||
{
|
||||
m.SendGump(new ConfirmCallbackGump(m as PlayerMobile, 1157234, 1157235, null, confirm: DoEmpty)); // Are you sure you wish to end the fermentation process? All progress and materials will be lost!
|
||||
}, 3, HasYeast || _Fruit > 0));
|
||||
|
||||
entries.Add(new SimpleContextMenuEntry(from, 1157233, m => // Rename Vintage
|
||||
{
|
||||
if (_Fermenting)
|
||||
{
|
||||
m.SendLocalizedMessage(1157238); // You may not rename the vintage once the fermentation process has begun.
|
||||
}
|
||||
else
|
||||
{
|
||||
m.SendLocalizedMessage(1157242); // What do you wish to call this vintage?
|
||||
m.BeginPrompt((mob, text) =>
|
||||
{
|
||||
if (text != null)
|
||||
{
|
||||
text = text.Trim();
|
||||
text = Utility.FixHtml(text);
|
||||
|
||||
if (text.Length > 15 || !Server.Guilds.BaseGuildGump.CheckProfanity(text))
|
||||
{
|
||||
mob.SendMessage("That label is unacceptable. Please try again.");
|
||||
}
|
||||
else
|
||||
{
|
||||
Vintage = text;
|
||||
}
|
||||
}
|
||||
}, null);
|
||||
}
|
||||
}, 3, !_Fermented));
|
||||
}
|
||||
|
||||
private void StartFermentation(Mobile m, object state)
|
||||
{
|
||||
m.SendLocalizedMessage(1157239); // The fermentation process has begun.
|
||||
|
||||
_Fermenting = true;
|
||||
|
||||
_FermentingEnds = DateTime.UtcNow + TimeSpan.FromHours(24);
|
||||
}
|
||||
|
||||
private void CancelFermentation(Mobile m, object state)
|
||||
{
|
||||
m.SendLocalizedMessage(1157241); // The fermentation process has not been started.
|
||||
}
|
||||
|
||||
private void DoEmpty(Mobile m, object state)
|
||||
{
|
||||
m.SendLocalizedMessage(1157236); // You empty the contents of the barrel.
|
||||
|
||||
Reset();
|
||||
}
|
||||
|
||||
private void Reset()
|
||||
{
|
||||
_FruitType = FruitType.None;
|
||||
_Fruit = 0;
|
||||
_BacterialResistance = 0;
|
||||
|
||||
_Fermenting = false;
|
||||
_FermentingEnds = DateTime.MinValue;
|
||||
|
||||
_Fermented = false;
|
||||
_BottlesRemaining = 0;
|
||||
_Vintage = null;
|
||||
|
||||
_Maker = null;
|
||||
|
||||
InvalidateProperties();
|
||||
}
|
||||
|
||||
private FruitType GetFruitType(Type t)
|
||||
{
|
||||
for(int i = 0; i < _FruitTypes.Length; i++)
|
||||
{
|
||||
foreach (var type in _FruitTypes[i])
|
||||
{
|
||||
if (type == t)
|
||||
return (FruitType)i + 1;
|
||||
}
|
||||
}
|
||||
|
||||
return FruitType.None;
|
||||
}
|
||||
|
||||
private Type[][] _FruitTypes =
|
||||
{
|
||||
new Type[] { typeof(GrapeBunch), typeof(Grapes) },
|
||||
new Type[] { typeof(Apple) },
|
||||
new Type[] { typeof(Peach) },
|
||||
new Type[] { typeof(Pear) },
|
||||
new Type[] { typeof(Plum) }
|
||||
};
|
||||
|
||||
public FermentationBarrel(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
|
||||
writer.Write((int)_FruitType);
|
||||
writer.Write(_Fruit);
|
||||
writer.Write(_BacterialResistance);
|
||||
|
||||
writer.Write(_Fermenting);
|
||||
writer.Write(_FermentingEnds);
|
||||
|
||||
writer.Write(_Fermented);
|
||||
writer.Write(_BadBatch);
|
||||
writer.Write(_BottlesRemaining);
|
||||
writer.Write(_Vintage);
|
||||
|
||||
writer.Write(_Maker);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
_FruitType = (FruitType)reader.ReadInt();
|
||||
_Fruit = reader.ReadInt();
|
||||
_BacterialResistance = reader.ReadInt();
|
||||
|
||||
_Fermenting = reader.ReadBool();
|
||||
_FermentingEnds = reader.ReadDateTime();
|
||||
|
||||
_Fermented = reader.ReadBool();
|
||||
_BadBatch = reader.ReadBool();
|
||||
_BottlesRemaining = reader.ReadInt();
|
||||
_Vintage = reader.ReadString();
|
||||
|
||||
_Maker = reader.ReadMobile();
|
||||
}
|
||||
}
|
||||
|
||||
public class BottleOfWine : BeverageBottle
|
||||
{
|
||||
private FruitType _FruitType;
|
||||
private string _Vintage;
|
||||
private Mobile _Maker;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public FruitType FruitType { get { return _FruitType; } set { _FruitType = value; InvalidateProperties(); } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public string Vintage { get { return _Vintage; } set { _Vintage = value; InvalidateProperties(); } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public Mobile Maker { get { return _Maker; } set { _Maker = value; InvalidateProperties(); } }
|
||||
|
||||
[Constructable]
|
||||
public BottleOfWine()
|
||||
: this(FruitType.Grape, null, null)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public BottleOfWine(FruitType type, string vintage, Mobile maker)
|
||||
: base(BeverageType.Wine)
|
||||
{
|
||||
Quantity = MaxQuantity;
|
||||
|
||||
_FruitType = type;
|
||||
_Vintage = vintage;
|
||||
_Maker = maker;
|
||||
}
|
||||
|
||||
public override void AddNameProperty(ObjectPropertyList list)
|
||||
{
|
||||
list.Add(1049519, String.Format("#{0}", (1157248 + (int)_FruitType).ToString())); // a bottle of ~1_DRINK_NAME~
|
||||
}
|
||||
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
if (_Vintage != null)
|
||||
{
|
||||
list.Add(1157254, _Vintage); // <BASEFONT COLOR=#0099cc>~1_VAL~<BASEFONT COLOR=#FFFFFF>
|
||||
}
|
||||
|
||||
if (_Maker != null)
|
||||
{
|
||||
list.Add(1150679, _Maker.Name); // Distiller: ~1_NAME~
|
||||
}
|
||||
|
||||
list.Add(GetQuantityDescription());
|
||||
}
|
||||
|
||||
public BottleOfWine(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write((int)0);
|
||||
|
||||
writer.Write((int)_FruitType);
|
||||
writer.Write(_Vintage);
|
||||
writer.Write(_Maker);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadInt();
|
||||
|
||||
_FruitType = (FruitType)reader.ReadInt();
|
||||
_Vintage = reader.ReadString();
|
||||
_Maker = reader.ReadMobile();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
using System;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class GuaranteedSpellbookImprovementTalisman : BaseTalisman
|
||||
{
|
||||
[Constructable]
|
||||
public GuaranteedSpellbookImprovementTalisman()
|
||||
: this(10)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public GuaranteedSpellbookImprovementTalisman(int charges)
|
||||
: base(0x9E28)
|
||||
{
|
||||
Charges = charges;
|
||||
|
||||
Skill = TalismanSkill.Inscription;
|
||||
SuccessBonus = BaseTalisman.GetRandomSuccessful();
|
||||
ExceptionalBonus = BaseTalisman.GetRandomExceptional();
|
||||
}
|
||||
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
if (Charges > 0)
|
||||
list.Add(1049116, Charges.ToString()); // [ Charges: ~1_CHARGES~ ]
|
||||
|
||||
list.Add(1157212); // Crafting Failure Protection
|
||||
}
|
||||
|
||||
public GuaranteedSpellbookImprovementTalisman(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
80
Scripts/Services/BulkOrders/Items/KotlBlackRod.cs
Normal file
80
Scripts/Services/BulkOrders/Items/KotlBlackRod.cs
Normal file
@@ -0,0 +1,80 @@
|
||||
using System;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class KotlBlackRod : QuarterStaff
|
||||
{
|
||||
public override int LabelNumber { get { return 1156990; } } // kotl black rod
|
||||
public override bool IsArtifact { get { return true; } }
|
||||
|
||||
[Constructable]
|
||||
public KotlBlackRod()
|
||||
{
|
||||
Hue = 1150;
|
||||
|
||||
WeaponAttributes.MageWeapon = 30;
|
||||
Attributes.SpellChanneling = 1;
|
||||
Attributes.CastSpeed = 2;
|
||||
Attributes.LowerManaCost = 5;
|
||||
Attributes.LowerRegCost = 10;
|
||||
}
|
||||
|
||||
public override int InitMinHits { get { return 255; } }
|
||||
public override int InitMaxHits { get { return 255; } }
|
||||
|
||||
public KotlBlackRod(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class GargishKotlBlackRod : GargishGnarledStaff
|
||||
{
|
||||
public override int LabelNumber { get { return 1156994; } } // gargish kotl black rod
|
||||
public override bool IsArtifact { get { return true; } }
|
||||
|
||||
[Constructable]
|
||||
public GargishKotlBlackRod()
|
||||
{
|
||||
Hue = 1150;
|
||||
|
||||
WeaponAttributes.MageWeapon = 30;
|
||||
Attributes.SpellChanneling = 1;
|
||||
Attributes.CastSpeed = 2;
|
||||
Attributes.LowerManaCost = 5;
|
||||
Attributes.LowerRegCost = 10;
|
||||
}
|
||||
|
||||
public override int InitMinHits { get { return 255; } }
|
||||
public override int InitMaxHits { get { return 255; } }
|
||||
|
||||
public GargishKotlBlackRod(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
54
Scripts/Services/BulkOrders/Items/MasterChefsApron.cs
Normal file
54
Scripts/Services/BulkOrders/Items/MasterChefsApron.cs
Normal file
@@ -0,0 +1,54 @@
|
||||
using System;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class MasterChefsApron : FullApron
|
||||
{
|
||||
private int _Bonus;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int Bonus { get { return _Bonus; } set { _Bonus = value; InvalidateProperties(); } }
|
||||
|
||||
public override int LabelNumber { get { return 1157228; } } // Master Chef's Apron
|
||||
|
||||
[Constructable]
|
||||
public MasterChefsApron()
|
||||
{
|
||||
Hue = 1990;
|
||||
|
||||
while(_Bonus == 0)
|
||||
_Bonus = BaseTalisman.GetRandomExceptional();
|
||||
}
|
||||
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
list.Add(1072395, "#{0}\t{1}", AosSkillBonuses.GetLabel(SkillName.Cooking), _Bonus); // ~1_NAME~ Exceptional Bonus: ~2_val~%
|
||||
}
|
||||
|
||||
public MasterChefsApron(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
|
||||
writer.Write(_Bonus);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
_Bonus = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
82
Scripts/Services/BulkOrders/Items/MasterCraftsmanTalisman.cs
Normal file
82
Scripts/Services/BulkOrders/Items/MasterCraftsmanTalisman.cs
Normal file
@@ -0,0 +1,82 @@
|
||||
using System;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class MasterCraftsmanTalisman : BaseTalisman
|
||||
{
|
||||
public override bool IsArtifact { get { return true; } }
|
||||
|
||||
private int _Type;
|
||||
public virtual int Type { get { return _Type; } }
|
||||
|
||||
[Constructable]
|
||||
public MasterCraftsmanTalisman(int charges, int itemID, TalismanSkill skill)
|
||||
: base(itemID)
|
||||
{
|
||||
Skill = skill;
|
||||
|
||||
SuccessBonus = GetRandomSuccessful();
|
||||
ExceptionalBonus = BaseTalisman.GetRandomExceptional();
|
||||
Blessed = GetRandomBlessed();
|
||||
|
||||
_Type = charges;
|
||||
Charges = charges;
|
||||
}
|
||||
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
list.Add(1157213); // Crafting Failure Protection
|
||||
|
||||
if (Charges > 0)
|
||||
list.Add(1049116, Charges.ToString()); // [ Charges: ~1_CHARGES~ ]
|
||||
}
|
||||
|
||||
public MasterCraftsmanTalisman(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int LabelNumber
|
||||
{
|
||||
get
|
||||
{
|
||||
return 1157217;
|
||||
}
|
||||
}// MasterCraftsmanTalisman
|
||||
public override bool ForceShowName
|
||||
{
|
||||
get
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)1); // version
|
||||
|
||||
writer.Write(_Type);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch (version)
|
||||
{
|
||||
case 1:
|
||||
_Type = reader.ReadInt();
|
||||
break;
|
||||
case 0:
|
||||
_Type = 10;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
74
Scripts/Services/BulkOrders/Items/PlumTreeAddon.cs
Normal file
74
Scripts/Services/BulkOrders/Items/PlumTreeAddon.cs
Normal file
@@ -0,0 +1,74 @@
|
||||
using System;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class PlumTreeAddon : BaseFruitTreeAddon
|
||||
{
|
||||
public override BaseAddonDeed Deed { get { return new PlumTreeAddonDeed(); } }
|
||||
|
||||
[Constructable]
|
||||
public PlumTreeAddon()
|
||||
{
|
||||
AddComponent(new LocalizedAddonComponent(0x9E38, 1029965), 0, 0, 0);
|
||||
AddComponent(new LocalizedAddonComponent(0x9E39, 1029965), 0, 0, 0);
|
||||
}
|
||||
|
||||
public override Item Fruit
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Plum();
|
||||
}
|
||||
}
|
||||
|
||||
public PlumTreeAddon(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class PlumTreeAddonDeed : BaseAddonDeed
|
||||
{
|
||||
public override int LabelNumber { get { return 1157312; } } // Plum Tree
|
||||
public override BaseAddon Addon { get { return new PlumTreeAddon(); } }
|
||||
|
||||
[Constructable]
|
||||
public PlumTreeAddonDeed()
|
||||
{
|
||||
}
|
||||
|
||||
public PlumTreeAddonDeed(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
155
Scripts/Services/BulkOrders/Items/PowderOfFortKeg.cs
Normal file
155
Scripts/Services/BulkOrders/Items/PowderOfFortKeg.cs
Normal file
@@ -0,0 +1,155 @@
|
||||
using System;
|
||||
using Server.Mobiles;
|
||||
using Server.Items;
|
||||
using Server.Engines.Harvest;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class PowderOfFortKeg : Item
|
||||
{
|
||||
private int _Charges;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int Charges { get { return _Charges; } set { _Charges = value; InvalidateProperties(); } }
|
||||
|
||||
public override int LabelNumber { get { return 1157221; } } // A specially lined keg for powder of fortification.
|
||||
|
||||
[Constructable]
|
||||
public PowderOfFortKeg()
|
||||
: this(0)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public PowderOfFortKeg(int uses)
|
||||
: base(0x1940)
|
||||
{
|
||||
_Charges = uses;
|
||||
|
||||
Hue = 2419;
|
||||
this.Weight = 15.0;
|
||||
}
|
||||
|
||||
public override bool OnDragDrop(Mobile m, Item dropped)
|
||||
{
|
||||
if (dropped is PowderOfTemperament)
|
||||
{
|
||||
var powder = dropped as PowderOfTemperament;
|
||||
|
||||
if (_Charges < 250)
|
||||
{
|
||||
if (powder.UsesRemaining + _Charges > 250)
|
||||
{
|
||||
int add = 250 - _Charges;
|
||||
|
||||
powder.UsesRemaining -= add;
|
||||
|
||||
Charges = 250;
|
||||
}
|
||||
else
|
||||
{
|
||||
Charges += powder.UsesRemaining;
|
||||
powder.Delete();
|
||||
}
|
||||
|
||||
m.PlaySound(0x247);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (from.Backpack != null && IsChildOf(from.Backpack) && Charges > 0)
|
||||
{
|
||||
PowderOfTemperament powder = from.Backpack.FindItemByType(typeof(PowderOfTemperament)) as PowderOfTemperament;
|
||||
|
||||
if (powder != null)
|
||||
{
|
||||
powder.UsesRemaining++;
|
||||
Charges--;
|
||||
}
|
||||
else
|
||||
{
|
||||
powder = new PowderOfTemperament(1);
|
||||
|
||||
if (!from.Backpack.TryDropItem(from, powder, false))
|
||||
{
|
||||
from.SendLocalizedMessage(1080016); // That container cannot hold more weight.
|
||||
powder.Delete();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Charges--;
|
||||
}
|
||||
|
||||
from.PlaySound(0x247);
|
||||
}
|
||||
}
|
||||
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
list.Add(1060584, _Charges.ToString());
|
||||
|
||||
int perc = (int)(((double)_Charges / 250) * 100);
|
||||
int number = 0;
|
||||
|
||||
if (perc <= 0)
|
||||
number = 502246; // The keg is empty.
|
||||
else if (perc < 5)
|
||||
number = 502248; // The keg is nearly empty.
|
||||
else if (perc < 20)
|
||||
number = 502249; // The keg is not very full.
|
||||
else if (perc < 30)
|
||||
number = 502250; // The keg is about one quarter full.
|
||||
else if (perc < 40)
|
||||
number = 502251; // The keg is about one third full.
|
||||
else if (perc < 47)
|
||||
number = 502252; // The keg is almost half full.
|
||||
else if (perc < 54)
|
||||
number = 502254; // The keg is approximately half full.
|
||||
else if (perc < 70)
|
||||
number = 502253; // The keg is more than half full.
|
||||
else if (perc < 80)
|
||||
number = 502255; // The keg is about three quarters full.
|
||||
else if (perc < 90)
|
||||
number = 502256; // The keg is very full.
|
||||
else if (perc < 100)
|
||||
number = 502257; // The liquid is almost to the top of the keg.
|
||||
else
|
||||
number = 502258; // The keg is completely full.
|
||||
|
||||
list.Add(number);
|
||||
}
|
||||
|
||||
public PowderOfFortKeg(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)1); // version
|
||||
|
||||
writer.Write(_Charges);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
_Charges = reader.ReadInt();
|
||||
|
||||
if (version == 0)
|
||||
ItemID = 0x1940;
|
||||
}
|
||||
}
|
||||
}
|
||||
51
Scripts/Services/BulkOrders/Items/RockHammer.cs
Normal file
51
Scripts/Services/BulkOrders/Items/RockHammer.cs
Normal file
@@ -0,0 +1,51 @@
|
||||
using System;
|
||||
using Server.Mobiles;
|
||||
using Server.Engines.Harvest;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
[FlipableAttribute(0x9E7E, 0x9E7F)]
|
||||
public class RockHammer : BaseHarvestTool
|
||||
{
|
||||
public override int LabelNumber { get { return 1124598; } }
|
||||
|
||||
[Constructable]
|
||||
public RockHammer()
|
||||
: this(500)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public RockHammer(int uses)
|
||||
: base(uses, 0x9E7E)
|
||||
{
|
||||
this.Weight = 5.0;
|
||||
}
|
||||
|
||||
public RockHammer(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override HarvestSystem HarvestSystem
|
||||
{
|
||||
get
|
||||
{
|
||||
return Mining.System;
|
||||
}
|
||||
}
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
268
Scripts/Services/BulkOrders/Items/SpecialNaturalDye.cs
Normal file
268
Scripts/Services/BulkOrders/Items/SpecialNaturalDye.cs
Normal file
@@ -0,0 +1,268 @@
|
||||
using System;
|
||||
using Server.Engines.Plants;
|
||||
using Server.Multis;
|
||||
using Server.Targeting;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public enum DyeType
|
||||
{
|
||||
None,
|
||||
WindAzul,
|
||||
DullRuby,
|
||||
PoppieWhite,
|
||||
ZentoOrchid,
|
||||
UmbranViolet
|
||||
}
|
||||
|
||||
public class SpecialNaturalDye : Item
|
||||
{
|
||||
private DyeType m_DyeType;
|
||||
private int m_UsesRemaining;
|
||||
private bool m_BooksOnly;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public DyeType DyeType
|
||||
{
|
||||
get { return m_DyeType; }
|
||||
set
|
||||
{
|
||||
DyeType old = m_DyeType;
|
||||
m_DyeType = value;
|
||||
|
||||
if (m_DyeType != old)
|
||||
ValidateHue();
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int UsesRemaining
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_UsesRemaining;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.m_UsesRemaining = value;
|
||||
this.InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public bool BooksOnly
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_BooksOnly;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.m_BooksOnly = value;
|
||||
this.InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public SpecialNaturalDye(DyeType type)
|
||||
: this(type, false)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public SpecialNaturalDye(DyeType type, bool booksonly)
|
||||
: base(0x182B)
|
||||
{
|
||||
Weight = 1.0;
|
||||
DyeType = type;
|
||||
UsesRemaining = 5;
|
||||
|
||||
BooksOnly = booksonly;
|
||||
}
|
||||
|
||||
public void ValidateHue()
|
||||
{
|
||||
if (HueInfo.ContainsKey(this.DyeType))
|
||||
{
|
||||
Hue = HueInfo[this.DyeType].Item1;
|
||||
}
|
||||
}
|
||||
|
||||
public SpecialNaturalDye(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int LabelNumber
|
||||
{
|
||||
get
|
||||
{
|
||||
return 1112136;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool ForceShowProperties
|
||||
{
|
||||
get
|
||||
{
|
||||
return ObjectPropertyList.Enabled;
|
||||
}
|
||||
}
|
||||
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
list.Add(1060584, this.m_UsesRemaining.ToString()); // uses remaining: ~1_val~
|
||||
|
||||
if (m_BooksOnly)
|
||||
list.Add(1157205); // Spellbook Only Dye
|
||||
}
|
||||
|
||||
public override void AddNameProperty(ObjectPropertyList list)
|
||||
{
|
||||
if (this.DyeType == DyeType.None)
|
||||
{
|
||||
base.AddNameProperty(list);
|
||||
}
|
||||
else if (this.Amount > 1)
|
||||
{
|
||||
list.Add(1113276, "{0}\t{1}", this.Amount, String.Format("#{0}", HueInfo[this.DyeType].Item2)); // ~1_AMOUNT~ ~2_COLOR~ natural dyes
|
||||
}
|
||||
else
|
||||
{
|
||||
list.Add(1112137, String.Format("#{0}", HueInfo[this.DyeType].Item2)); // ~1_COLOR~ natural dye
|
||||
}
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
|
||||
writer.Write((int)this.m_DyeType);
|
||||
writer.Write((int)this.m_UsesRemaining);
|
||||
writer.Write(m_BooksOnly);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
this.m_DyeType = (DyeType)reader.ReadInt();
|
||||
this.m_UsesRemaining = reader.ReadInt();
|
||||
this.m_BooksOnly = reader.ReadBool();
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
from.SendLocalizedMessage(1112139); // Select the item you wish to dye.
|
||||
from.Target = new InternalTarget(this);
|
||||
}
|
||||
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private readonly SpecialNaturalDye m_Item;
|
||||
|
||||
public InternalTarget(SpecialNaturalDye item)
|
||||
: base(1, false, TargetFlags.None)
|
||||
{
|
||||
this.m_Item = item;
|
||||
}
|
||||
|
||||
protected override void OnTarget(Mobile from, object targeted)
|
||||
{
|
||||
if (this.m_Item.Deleted)
|
||||
return;
|
||||
|
||||
Item item = targeted as Item;
|
||||
bool valid = false;
|
||||
|
||||
if (item != null)
|
||||
{
|
||||
if (m_Item.BooksOnly && !(item is Spellbook))
|
||||
{
|
||||
valid = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
valid = (item is IDyable ||
|
||||
item is BaseBook || item is BaseClothing ||
|
||||
item is BaseJewel || item is BaseStatuette ||
|
||||
item is BaseWeapon || item is Runebook ||
|
||||
item is BaseTalisman || item is Spellbook ||
|
||||
item.IsArtifact || BasePigmentsOfTokuno.IsValidItem(item));
|
||||
|
||||
if (!valid && item is BaseArmor)
|
||||
{
|
||||
CraftResourceType restype = CraftResources.GetType(((BaseArmor)item).Resource);
|
||||
if ((CraftResourceType.Leather == restype || CraftResourceType.Metal == restype) &&
|
||||
ArmorMaterialType.Bone != ((BaseArmor)item).MaterialType)
|
||||
{
|
||||
valid = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!valid && FurnitureAttribute.Check(item))
|
||||
{
|
||||
if (!from.InRange(this.m_Item.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
|
||||
{
|
||||
from.SendLocalizedMessage(500446); // That is too far away.
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
BaseHouse house = BaseHouse.FindHouseAt(item);
|
||||
|
||||
if (house == null || (!house.IsLockedDown(item) && !house.IsSecure(item)))
|
||||
{
|
||||
from.SendLocalizedMessage(501022); // Furniture must be locked down to paint it.
|
||||
return;
|
||||
}
|
||||
else if (!house.IsCoOwner(from))
|
||||
{
|
||||
from.SendLocalizedMessage(501023); // You must be the owner to use this item.
|
||||
return;
|
||||
}
|
||||
else
|
||||
valid = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (valid)
|
||||
{
|
||||
item.Hue = m_Item.Hue;
|
||||
from.PlaySound(0x23E);
|
||||
|
||||
if (--this.m_Item.UsesRemaining > 0)
|
||||
this.m_Item.InvalidateProperties();
|
||||
else
|
||||
this.m_Item.Delete();
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
from.SendLocalizedMessage(1042083); // You cannot dye that.
|
||||
}
|
||||
}
|
||||
|
||||
public static Dictionary<DyeType, Tuple<int, int>> HueInfo;
|
||||
|
||||
public static void Configure()
|
||||
{
|
||||
HueInfo = new Dictionary<DyeType, Tuple<int, int>>();
|
||||
|
||||
HueInfo[DyeType.WindAzul] = new Tuple<int, int>(2741, 1157277);
|
||||
HueInfo[DyeType.DullRuby] = new Tuple<int, int>(2731, 1157267);
|
||||
HueInfo[DyeType.PoppieWhite] = new Tuple<int, int>(2735, 1157271);
|
||||
HueInfo[DyeType.ZentoOrchid] = new Tuple<int, int>(2732, 1157268);
|
||||
HueInfo[DyeType.UmbranViolet] = new Tuple<int, int>(2740, 1157276);
|
||||
}
|
||||
}
|
||||
}
|
||||
115
Scripts/Services/BulkOrders/LargeBODs/LargeAlchemyBOD.cs
Normal file
115
Scripts/Services/BulkOrders/LargeBODs/LargeAlchemyBOD.cs
Normal file
@@ -0,0 +1,115 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class LargeAlchemyBOD : LargeBOD
|
||||
{
|
||||
public override BODType BODType { get { return BODType.Alchemy; } }
|
||||
|
||||
[Constructable]
|
||||
public LargeAlchemyBOD()
|
||||
{
|
||||
LargeBulkEntry[] entries;
|
||||
|
||||
switch ( Utility.Random(5) )
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeExplosive);
|
||||
break;
|
||||
case 1:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeGreater);
|
||||
break;
|
||||
case 2:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeLesser);
|
||||
break;
|
||||
case 3:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeRegular);
|
||||
break;
|
||||
case 4:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeToxic);
|
||||
break;
|
||||
}
|
||||
|
||||
int amountMax = Utility.RandomList(10, 15, 20, 20);
|
||||
|
||||
this.Hue = 2505;
|
||||
this.AmountMax = amountMax;
|
||||
this.Entries = entries;
|
||||
}
|
||||
|
||||
public LargeAlchemyBOD(int amountMax, bool reqExceptional, BulkMaterialType mat, LargeBulkEntry[] entries)
|
||||
{
|
||||
this.Hue = 2505;
|
||||
this.AmountMax = amountMax;
|
||||
this.Entries = entries;
|
||||
this.RequireExceptional = reqExceptional;
|
||||
this.Material = mat;
|
||||
}
|
||||
|
||||
public LargeAlchemyBOD(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int ComputeFame()
|
||||
{
|
||||
return AlchemyRewardCalculator.Instance.ComputeFame(this);
|
||||
}
|
||||
|
||||
public override int ComputeGold()
|
||||
{
|
||||
return AlchemyRewardCalculator.Instance.ComputeGold(this);
|
||||
}
|
||||
|
||||
public override List<Item> ComputeRewards(bool full)
|
||||
{
|
||||
List<Item> list = new List<Item>();
|
||||
|
||||
RewardGroup rewardGroup = AlchemyRewardCalculator.Instance.LookupRewards(AlchemyRewardCalculator.Instance.ComputePoints(this));
|
||||
|
||||
if (rewardGroup != null)
|
||||
{
|
||||
if (full)
|
||||
{
|
||||
for (int i = 0; i < rewardGroup.Items.Length; ++i)
|
||||
{
|
||||
Item item = rewardGroup.Items[i].Construct();
|
||||
|
||||
if (item != null)
|
||||
list.Add(item);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RewardItem rewardItem = rewardGroup.AcquireItem();
|
||||
|
||||
if (rewardItem != null)
|
||||
{
|
||||
Item item = rewardItem.Construct();
|
||||
|
||||
if (item != null)
|
||||
list.Add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
335
Scripts/Services/BulkOrders/LargeBODs/LargeBOD.cs
Normal file
335
Scripts/Services/BulkOrders/LargeBODs/LargeBOD.cs
Normal file
@@ -0,0 +1,335 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
[TypeAlias("Scripts.Engines.BulkOrders.LargeBOD")]
|
||||
public abstract class LargeBOD : Item, IBOD
|
||||
{
|
||||
public abstract BODType BODType { get; }
|
||||
|
||||
private int m_AmountMax;
|
||||
private bool m_RequireExceptional;
|
||||
private BulkMaterialType m_Material;
|
||||
private LargeBulkEntry[] m_Entries;
|
||||
|
||||
public LargeBOD(int hue, int amountMax, bool requireExeptional, BulkMaterialType material, LargeBulkEntry[] entries)
|
||||
: base(Core.AOS ? 0x2258 : 0x14EF)
|
||||
{
|
||||
Weight = 1.0;
|
||||
Hue = hue; // Blacksmith: 0x44E; Tailoring: 0x483
|
||||
LootType = LootType.Blessed;
|
||||
|
||||
m_AmountMax = amountMax;
|
||||
m_RequireExceptional = requireExeptional;
|
||||
m_Material = material;
|
||||
m_Entries = entries;
|
||||
}
|
||||
|
||||
public LargeBOD()
|
||||
: base(Core.AOS ? 0x2258 : 0x14EF)
|
||||
{
|
||||
Weight = 1.0;
|
||||
LootType = LootType.Blessed;
|
||||
}
|
||||
|
||||
public LargeBOD(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int AmountMax
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_AmountMax;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_AmountMax = value;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public bool RequireExceptional
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_RequireExceptional;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_RequireExceptional = value;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public BulkMaterialType Material
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Material;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_Material = value;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
public LargeBulkEntry[] Entries
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Entries;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_Entries = value;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public bool Complete
|
||||
{
|
||||
get
|
||||
{
|
||||
for (int i = 0; i < m_Entries.Length; ++i)
|
||||
{
|
||||
if (m_Entries[i].Amount < m_AmountMax)
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value)
|
||||
{
|
||||
for (int i = 0; i < m_Entries.Length; ++i)
|
||||
{
|
||||
m_Entries[i].Amount = m_AmountMax;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public override int LabelNumber
|
||||
{
|
||||
get
|
||||
{
|
||||
return 1045151;
|
||||
}
|
||||
}// a bulk order deed
|
||||
public static BulkMaterialType GetRandomMaterial(BulkMaterialType start, double[] chances)
|
||||
{
|
||||
double random = Utility.RandomDouble();
|
||||
|
||||
for (int i = 0; i < chances.Length; ++i)
|
||||
{
|
||||
if (random < chances[i])
|
||||
return (i == 0 ? BulkMaterialType.None : start + (i - 1));
|
||||
|
||||
random -= chances[i];
|
||||
}
|
||||
|
||||
return BulkMaterialType.None;
|
||||
}
|
||||
|
||||
public abstract List<Item> ComputeRewards(bool full);
|
||||
|
||||
public abstract int ComputeGold();
|
||||
|
||||
public abstract int ComputeFame();
|
||||
|
||||
public virtual void GetRewards(out Item reward, out int gold, out int fame)
|
||||
{
|
||||
reward = null;
|
||||
gold = ComputeGold();
|
||||
fame = ComputeFame();
|
||||
|
||||
if (!BulkOrderSystem.NewSystemEnabled)
|
||||
{
|
||||
List<Item> rewards = ComputeRewards(false);
|
||||
|
||||
if (rewards.Count > 0)
|
||||
{
|
||||
reward = rewards[Utility.Random(rewards.Count)];
|
||||
|
||||
for (int i = 0; i < rewards.Count; ++i)
|
||||
{
|
||||
if (rewards[i] != reward)
|
||||
rewards[i].Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
list.Add(1060655); // large bulk order
|
||||
|
||||
if (m_RequireExceptional)
|
||||
list.Add(1045141); // All items must be exceptional.
|
||||
|
||||
if (m_Material != BulkMaterialType.None)
|
||||
list.Add(SmallBODGump.GetMaterialNumberFor(m_Material)); // All items must be made with x material.
|
||||
|
||||
list.Add(1060656, m_AmountMax.ToString()); // amount to make: ~1_val~
|
||||
|
||||
for (int i = 0; i < m_Entries.Length; ++i)
|
||||
list.Add(1060658 + i, "#{0}\t{1}", m_Entries[i].Details.Number, m_Entries[i].Amount); // ~1_val~: ~2_val~
|
||||
}
|
||||
|
||||
public override void OnDoubleClickNotAccessible(Mobile from)
|
||||
{
|
||||
OnDoubleClick(from);
|
||||
}
|
||||
|
||||
public override void OnDoubleClickSecureTrade(Mobile from)
|
||||
{
|
||||
OnDoubleClick(from);
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (IsChildOf(from.Backpack) || InSecureTrade || RootParent is PlayerVendor)
|
||||
{
|
||||
EventSink.InvokeBODUsed(new BODUsedEventArgs(from, this));
|
||||
from.SendGump(new LargeBODGump(from, this));
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(1045156); // You must have the deed in your backpack to use it.
|
||||
}
|
||||
}
|
||||
|
||||
public void BeginCombine(Mobile from)
|
||||
{
|
||||
if (!Complete)
|
||||
from.Target = new LargeBODTarget(this);
|
||||
else
|
||||
from.SendLocalizedMessage(1045166); // The maximum amount of requested items have already been combined to this deed.
|
||||
}
|
||||
|
||||
public void EndCombine(Mobile from, object o)
|
||||
{
|
||||
if (o is Item && ((Item)o).IsChildOf(from.Backpack))
|
||||
{
|
||||
if (o is SmallBOD)
|
||||
{
|
||||
SmallBOD small = (SmallBOD)o;
|
||||
|
||||
LargeBulkEntry entry = null;
|
||||
|
||||
for (int i = 0; entry == null && i < m_Entries.Length; ++i)
|
||||
{
|
||||
if (CheckType(small, m_Entries[i].Details.Type))
|
||||
entry = m_Entries[i];
|
||||
}
|
||||
|
||||
if (entry == null)
|
||||
{
|
||||
from.SendLocalizedMessage(1045160); // That is not a bulk order for this large request.
|
||||
}
|
||||
else if (m_RequireExceptional && !small.RequireExceptional)
|
||||
{
|
||||
from.SendLocalizedMessage(1045161); // Both orders must be of exceptional quality.
|
||||
}
|
||||
else if (small.Material != m_Material && m_Material != BulkMaterialType.None)
|
||||
{
|
||||
from.SendLocalizedMessage(1157311); // Both orders must use the same resource type.
|
||||
}
|
||||
else if (m_AmountMax != small.AmountMax)
|
||||
{
|
||||
from.SendLocalizedMessage(1045163); // The two orders have different requested amounts and cannot be combined.
|
||||
}
|
||||
else if (small.AmountCur < small.AmountMax)
|
||||
{
|
||||
from.SendLocalizedMessage(1045164); // The order to combine with is not completed.
|
||||
}
|
||||
else if (entry.Amount >= m_AmountMax)
|
||||
{
|
||||
from.SendLocalizedMessage(1045166); // The maximum amount of requested items have already been combined to this deed.
|
||||
}
|
||||
else
|
||||
{
|
||||
entry.Amount += small.AmountCur;
|
||||
small.Delete();
|
||||
|
||||
from.SendLocalizedMessage(1045165); // The orders have been combined.
|
||||
|
||||
from.SendGump(new LargeBODGump(from, this));
|
||||
|
||||
if (!Complete)
|
||||
BeginCombine(from);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(1045159); // That is not a bulk order.
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(1045158); // You must have the item in your backpack to target it.
|
||||
}
|
||||
}
|
||||
|
||||
public virtual bool CheckType(SmallBOD small, Type type)
|
||||
{
|
||||
return small.CheckType(type);
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)1); // version
|
||||
|
||||
writer.Write(m_AmountMax);
|
||||
writer.Write(m_RequireExceptional);
|
||||
writer.Write((int)m_Material);
|
||||
|
||||
writer.Write((int)m_Entries.Length);
|
||||
|
||||
for (int i = 0; i < m_Entries.Length; ++i)
|
||||
m_Entries[i].Serialize(writer);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 1:
|
||||
case 0:
|
||||
{
|
||||
m_AmountMax = reader.ReadInt();
|
||||
m_RequireExceptional = reader.ReadBool();
|
||||
m_Material = (BulkMaterialType)reader.ReadInt();
|
||||
|
||||
m_Entries = new LargeBulkEntry[reader.ReadInt()];
|
||||
|
||||
for (int i = 0; i < m_Entries.Length; ++i)
|
||||
m_Entries[i] = new LargeBulkEntry(this, reader, version);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (Weight == 0.0)
|
||||
Weight = 1.0;
|
||||
|
||||
if (Core.AOS && ItemID == 0x14EF)
|
||||
ItemID = 0x2258;
|
||||
|
||||
if (Parent == null && Map == Map.Internal && Location == Point3D.Zero)
|
||||
Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
106
Scripts/Services/BulkOrders/LargeBODs/LargeBODAcceptGump.cs
Normal file
106
Scripts/Services/BulkOrders/LargeBODs/LargeBODAcceptGump.cs
Normal file
@@ -0,0 +1,106 @@
|
||||
using System;
|
||||
using Server.Gumps;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class LargeBODAcceptGump : Gump
|
||||
{
|
||||
private readonly LargeBOD m_Deed;
|
||||
private readonly Mobile m_From;
|
||||
public LargeBODAcceptGump(Mobile from, LargeBOD deed)
|
||||
: base(50, 50)
|
||||
{
|
||||
m_From = from;
|
||||
m_Deed = deed;
|
||||
|
||||
m_From.CloseGump(typeof(LargeBODAcceptGump));
|
||||
m_From.CloseGump(typeof(SmallBODAcceptGump));
|
||||
|
||||
LargeBulkEntry[] entries = deed.Entries;
|
||||
|
||||
AddPage(0);
|
||||
|
||||
AddBackground(25, 10, 430, 240 + (entries.Length * 24), 5054);
|
||||
|
||||
AddImageTiled(33, 20, 413, 221 + (entries.Length * 24), 2624);
|
||||
AddAlphaRegion(33, 20, 413, 221 + (entries.Length * 24));
|
||||
|
||||
AddImage(20, 5, 10460);
|
||||
AddImage(430, 5, 10460);
|
||||
AddImage(20, 225 + (entries.Length * 24), 10460);
|
||||
AddImage(430, 225 + (entries.Length * 24), 10460);
|
||||
|
||||
AddHtmlLocalized(180, 25, 120, 20, 1045134, 0x7FFF, false, false); // A large bulk order
|
||||
|
||||
AddHtmlLocalized(40, 48, 350, 20, 1045135, 0x7FFF, false, false); // Ah! Thanks for the goods! Would you help me out?
|
||||
|
||||
AddHtmlLocalized(40, 72, 210, 20, 1045138, 0x7FFF, false, false); // Amount to make:
|
||||
AddLabel(250, 72, 1152, deed.AmountMax.ToString());
|
||||
|
||||
AddHtmlLocalized(40, 96, 120, 20, 1045137, 0x7FFF, false, false); // Items requested:
|
||||
|
||||
int y = 120;
|
||||
|
||||
for (int i = 0; i < entries.Length; ++i, y += 24)
|
||||
AddHtmlLocalized(40, y, 210, 20, entries[i].Details.Number, 0x7FFF, false, false);
|
||||
|
||||
if (deed.RequireExceptional || deed.Material != BulkMaterialType.None)
|
||||
{
|
||||
AddHtmlLocalized(40, y, 210, 20, 1045140, 0x7FFF, false, false); // Special requirements to meet:
|
||||
y += 24;
|
||||
|
||||
if (deed.RequireExceptional)
|
||||
{
|
||||
AddHtmlLocalized(40, y, 350, 20, 1045141, 0x7FFF, false, false); // All items must be exceptional.
|
||||
y += 24;
|
||||
}
|
||||
|
||||
if (deed.Material != BulkMaterialType.None)
|
||||
{
|
||||
AddHtmlLocalized(40, y, 350, 20, SmallBODGump.GetMaterialNumberFor(deed.Material), 0x7FFF, false, false); // All items must be made with x material.
|
||||
y += 24;
|
||||
}
|
||||
}
|
||||
|
||||
AddHtmlLocalized(40, 192 + (entries.Length * 24), 350, 20, 1045139, 0x7FFF, false, false); // Do you want to accept this order?
|
||||
|
||||
AddButton(100, 216 + (entries.Length * 24), 4005, 4007, 1, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(135, 216 + (entries.Length * 24), 120, 20, 1006044, 0x7FFF, false, false); // Ok
|
||||
|
||||
AddButton(275, 216 + (entries.Length * 24), 4005, 4007, 0, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(310, 216 + (entries.Length * 24), 120, 20, 1011012, 0x7FFF, false, false); // CANCEL
|
||||
}
|
||||
|
||||
public override void OnServerClose(NetState owner)
|
||||
{
|
||||
Timer.DelayCall(() =>
|
||||
{
|
||||
if (m_Deed.Map == null || m_Deed.Map == Map.Internal)
|
||||
{
|
||||
m_Deed.Delete();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
if (info.ButtonID == 1) // Ok
|
||||
{
|
||||
if (m_From.PlaceInBackpack(m_Deed))
|
||||
{
|
||||
m_From.SendLocalizedMessage(1045152); // The bulk order deed has been placed in your backpack.
|
||||
}
|
||||
else
|
||||
{
|
||||
m_From.SendLocalizedMessage(1045150); // There is not enough room in your backpack for the deed.
|
||||
m_Deed.Delete();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Deed.Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
173
Scripts/Services/BulkOrders/LargeBODs/LargeBODGump.cs
Normal file
173
Scripts/Services/BulkOrders/LargeBODs/LargeBODGump.cs
Normal file
@@ -0,0 +1,173 @@
|
||||
using System;
|
||||
using Server.Gumps;
|
||||
using Server.Network;
|
||||
using Server.Mobiles;
|
||||
using Server.Items;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class LargeBODGump : Gump
|
||||
{
|
||||
private readonly LargeBOD m_Deed;
|
||||
private readonly Mobile m_From;
|
||||
public LargeBODGump(Mobile from, LargeBOD deed)
|
||||
: base(25, 25)
|
||||
{
|
||||
m_From = from;
|
||||
m_Deed = deed;
|
||||
|
||||
m_From.CloseGump(typeof(LargeBODGump));
|
||||
m_From.CloseGump(typeof(SmallBODGump));
|
||||
|
||||
LargeBulkEntry[] entries = deed.Entries;
|
||||
|
||||
AddPage(0);
|
||||
|
||||
int height = 0;
|
||||
|
||||
if (BulkOrderSystem.NewSystemEnabled)
|
||||
{
|
||||
if (deed.RequireExceptional || deed.Material != BulkMaterialType.None)
|
||||
height += 24;
|
||||
|
||||
if (deed.RequireExceptional)
|
||||
height += 24;
|
||||
|
||||
if (deed.Material != BulkMaterialType.None)
|
||||
height += 24;
|
||||
}
|
||||
|
||||
AddBackground(50, 10, 455, 218 + height + (entries.Length * 24), 5054);
|
||||
|
||||
AddImageTiled(58, 20, 438, 200 + height + (entries.Length * 24), 2624);
|
||||
AddAlphaRegion(58, 20, 438, 200 + height + (entries.Length * 24));
|
||||
|
||||
AddImage(45, 5, 10460);
|
||||
AddImage(480, 5, 10460);
|
||||
AddImage(45, 203 + height + (entries.Length * 24), 10460);
|
||||
AddImage(480, 203 + height + (entries.Length * 24), 10460);
|
||||
|
||||
AddHtmlLocalized(225, 25, 120, 20, 1045134, 0x7FFF, false, false); // A large bulk order
|
||||
|
||||
AddHtmlLocalized(75, 48, 250, 20, 1045138, 0x7FFF, false, false); // Amount to make:
|
||||
AddLabel(275, 48, 1152, deed.AmountMax.ToString());
|
||||
|
||||
AddHtmlLocalized(75, 72, 120, 20, 1045137, 0x7FFF, false, false); // Items requested:
|
||||
AddHtmlLocalized(275, 76, 200, 20, 1045153, 0x7FFF, false, false); // Amount finished:
|
||||
|
||||
int y = 96;
|
||||
|
||||
for (int i = 0; i < entries.Length; ++i)
|
||||
{
|
||||
LargeBulkEntry entry = entries[i];
|
||||
SmallBulkEntry details = entry.Details;
|
||||
|
||||
AddHtmlLocalized(75, y, 210, 20, details.Number, 0x7FFF, false, false);
|
||||
AddLabel(275, y, 0x480, entry.Amount.ToString());
|
||||
|
||||
y += 24;
|
||||
}
|
||||
|
||||
if (deed.RequireExceptional || deed.Material != BulkMaterialType.None)
|
||||
{
|
||||
AddHtmlLocalized(75, y, 200, 20, 1045140, 0x7FFF, false, false); // Special requirements to meet:
|
||||
y += 24;
|
||||
}
|
||||
|
||||
if (deed.RequireExceptional)
|
||||
{
|
||||
AddHtmlLocalized(75, y, 300, 20, 1045141, 0x7FFF, false, false); // All items must be exceptional.
|
||||
y += 24;
|
||||
}
|
||||
|
||||
if (deed.Material != BulkMaterialType.None)
|
||||
{
|
||||
AddHtmlLocalized(75, y, 300, 20, SmallBODGump.GetMaterialNumberFor(deed.Material), 0x7FFF, false, false); // All items must be made with x material.
|
||||
y += 24;
|
||||
}
|
||||
|
||||
if (BulkOrderSystem.NewSystemEnabled)
|
||||
{
|
||||
BODContext c = BulkOrderSystem.GetContext((PlayerMobile)from);
|
||||
|
||||
int points = 0;
|
||||
double banked = 0.0;
|
||||
|
||||
BulkOrderSystem.ComputePoints(deed, out points, out banked);
|
||||
|
||||
AddHtmlLocalized(75, y, 300, 20, 1157301, String.Format("{0}\t{1}", points, banked.ToString("0.000000")), 0x7FFF, false, false); // Worth ~1_POINTS~ turn in points and ~2_POINTS~ bank points.
|
||||
y += 24;
|
||||
|
||||
AddButton(125, y, 4005, 4007, 3, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(160, y, 300, 20, c.PointsMode == PointsMode.Enabled ? 1157302 : c.PointsMode == PointsMode.Disabled ? 1157303 : 1157309, 0x7FFF, false, false); // Banking Points Enabled/Disabled/Automatic
|
||||
y += 24;
|
||||
|
||||
AddButton(125, y, 4005, 4007, 2, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(160, y, 300, 20, 1045154, 0x7FFF, false, false); // Combine this deed with the item requested.
|
||||
y += 24;
|
||||
|
||||
AddButton(125, y, 4005, 4007, 4, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(160, y, 300, 20, 1157304, 0x7FFF, false, false); // Combine this deed with contained items.
|
||||
y += 24;
|
||||
|
||||
AddButton(125, y, 4005, 4007, 1, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(160, y, 120, 20, 1011441, 0x7FFF, false, false); // EXIT
|
||||
}
|
||||
else
|
||||
{
|
||||
AddButton(125, 168 + (entries.Length * 24), 4005, 4007, 2, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(160, 168 + (entries.Length * 24), 300, 20, 1045155, 0x7FFF, false, false); // Combine this deed with another deed.
|
||||
|
||||
AddButton(125, 192 + (entries.Length * 24), 4005, 4007, 1, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(160, 192 + (entries.Length * 24), 120, 20, 1011441, 0x7FFF, false, false); // EXIT
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
if (m_Deed.Deleted || !m_Deed.IsChildOf(m_From.Backpack))
|
||||
return;
|
||||
|
||||
if (info.ButtonID == 2) // Combine
|
||||
{
|
||||
m_From.SendGump(new LargeBODGump(m_From, m_Deed));
|
||||
m_Deed.BeginCombine(m_From);
|
||||
}
|
||||
else if (info.ButtonID == 3) // bank button
|
||||
{
|
||||
BODContext c = BulkOrderSystem.GetContext(m_From);
|
||||
|
||||
if (c != null)
|
||||
{
|
||||
switch (c.PointsMode)
|
||||
{
|
||||
case PointsMode.Enabled: c.PointsMode = PointsMode.Disabled; break;
|
||||
case PointsMode.Disabled: c.PointsMode = PointsMode.Automatic; break;
|
||||
case PointsMode.Automatic: c.PointsMode = PointsMode.Enabled; break;
|
||||
}
|
||||
}
|
||||
|
||||
m_From.SendGump(new LargeBODGump(m_From, m_Deed));
|
||||
}
|
||||
else if (info.ButtonID == 4) // combine from container
|
||||
{
|
||||
m_From.BeginTarget(-1, false, Server.Targeting.TargetFlags.None, (m, targeted) =>
|
||||
{
|
||||
if (!m_Deed.Deleted && targeted is Container)
|
||||
{
|
||||
List<SmallBOD> list = ((Container)targeted).Items.OfType<SmallBOD>().ToList();
|
||||
|
||||
foreach (SmallBOD item in list)
|
||||
{
|
||||
m_Deed.EndCombine(m_From, item);
|
||||
}
|
||||
|
||||
list.Clear();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
23
Scripts/Services/BulkOrders/LargeBODs/LargeBODTarget.cs
Normal file
23
Scripts/Services/BulkOrders/LargeBODs/LargeBODTarget.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class LargeBODTarget : Target
|
||||
{
|
||||
private readonly LargeBOD m_Deed;
|
||||
public LargeBODTarget(LargeBOD deed)
|
||||
: base(18, false, TargetFlags.None)
|
||||
{
|
||||
this.m_Deed = deed;
|
||||
}
|
||||
|
||||
protected override void OnTarget(Mobile from, object targeted)
|
||||
{
|
||||
if (this.m_Deed.Deleted || !this.m_Deed.IsChildOf(from.Backpack))
|
||||
return;
|
||||
|
||||
this.m_Deed.EndCombine(from, targeted);
|
||||
}
|
||||
}
|
||||
}
|
||||
527
Scripts/Services/BulkOrders/LargeBODs/LargeBulkEntry.cs
Normal file
527
Scripts/Services/BulkOrders/LargeBODs/LargeBulkEntry.cs
Normal file
@@ -0,0 +1,527 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class LargeBulkEntry
|
||||
{
|
||||
private static Hashtable m_Cache;
|
||||
private readonly SmallBulkEntry m_Details;
|
||||
private LargeBOD m_Owner;
|
||||
private int m_Amount;
|
||||
|
||||
public LargeBulkEntry(LargeBOD owner, SmallBulkEntry details)
|
||||
{
|
||||
this.m_Owner = owner;
|
||||
this.m_Details = details;
|
||||
}
|
||||
|
||||
public static SmallBulkEntry[] LargeRing
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Blacksmith", "largering");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargePlate
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Blacksmith", "largeplate");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargeChain
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Blacksmith", "largechain");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargeAxes
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Blacksmith", "largeaxes");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargeFencing
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Blacksmith", "largefencing");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargeMaces
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Blacksmith", "largemaces");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargePolearms
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Blacksmith", "largepolearms");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargeSwords
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Blacksmith", "largeswords");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] BoneSet
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Tailoring", "boneset");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] Farmer
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Tailoring", "farmer");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] FemaleLeatherSet
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Tailoring", "femaleleatherset");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] FisherGirl
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Tailoring", "fishergirl");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] Gypsy
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Tailoring", "gypsy");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] HatSet
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Tailoring", "hatset");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] Jester
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Tailoring", "jester");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] Lady
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Tailoring", "lady");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] MaleLeatherSet
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Tailoring", "maleleatherset");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] Pirate
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Tailoring", "pirate");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] ShoeSet
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Tailoring", "shoeset");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] StuddedSet
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Tailoring", "studdedset");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] TownCrier
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Tailoring", "towncrier");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] Wizard
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Tailoring", "wizard");
|
||||
}
|
||||
}
|
||||
#region Publics 95 BODs
|
||||
public static SmallBulkEntry[] LargeCircle1
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Inscription", "LargeCircle1");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargeCircle1and2
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Inscription", "LargeCircle1and2");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargeNecromancy1
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Inscription", "LargeNecromancy1");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargeNecromancy2
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Inscription", "LargeNecromancy2");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargeNecromancy3
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Inscription", "LargeNecromancy3");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargeCircle4
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Inscription", "LargeCircle4");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargeCircle5
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Inscription", "LargeCircle5");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargeCircle7
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Inscription", "LargeCircle7");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargeCircle8
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Inscription", "LargeCircle8");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargeBooks
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Inscription", "LargeBooks");
|
||||
}
|
||||
}
|
||||
|
||||
public static SmallBulkEntry[] LargeWeapons
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Carpentry", "LargeWeapons");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargeWoodFurniture
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Carpentry", "LargeWoodFurniture");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargeCabinets
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Carpentry", "LargeCabinets");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargeArmoire
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Carpentry", "LargeArmoire");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargeInstruments
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Carpentry", "LargeInstruments");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargeChests
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Carpentry", "LargeChests");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargeElvenWeapons
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Carpentry", "LargeElvenWeapons");
|
||||
}
|
||||
}
|
||||
|
||||
public static SmallBulkEntry[] LargeAmmunition
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Fletching", "LargeAmmunition");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargeHumanBows1
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Fletching", "LargeHumanBows1");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargeHumanBows2
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Fletching", "LargeHumanBows2");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargeElvenBows1
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Fletching", "LargeElvenBows1");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargeElvenBows2
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Fletching", "LargeElvenBows2");
|
||||
}
|
||||
}
|
||||
|
||||
public static SmallBulkEntry[] LargeExplosive
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Alchemy", "largeexplosive");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargeGreater
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Alchemy", "largegreater");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargeLesser
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Alchemy", "largelesser");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargeRegular
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Alchemy", "largeregular");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargeToxic
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Alchemy", "largetoxic");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargeKeyGlobe
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Tinkering", "LargeKeyGlobe");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargeTools
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Tinkering", "LargeTools");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargeJewelry
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Tinkering", "LargeJewelry");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargeDining
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Tinkering", "LargeDining");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargeBarbeque
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Cooking", "LargeBarbeque");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargeDough
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Cooking", "LargeDough");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargeFruits
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Cooking", "LargeFruits");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargeMiso
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Cooking", "LargeMiso");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargeSushi
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Cooking", "LargeSushi");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargeSweets
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Cooking", "LargeSweets");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] LargeUnbakedPies
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Cooking", "LargeUnbakedPies");
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
public LargeBOD Owner
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_Owner;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.m_Owner = value;
|
||||
}
|
||||
}
|
||||
public int Amount
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_Amount;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.m_Amount = value;
|
||||
if (this.m_Owner != null)
|
||||
this.m_Owner.InvalidateProperties();
|
||||
}
|
||||
}
|
||||
public SmallBulkEntry Details
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_Details;
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] GetEntries(string type, string name)
|
||||
{
|
||||
if (m_Cache == null)
|
||||
m_Cache = new Hashtable();
|
||||
|
||||
Hashtable table = (Hashtable)m_Cache[type];
|
||||
|
||||
if (table == null)
|
||||
m_Cache[type] = table = new Hashtable();
|
||||
|
||||
SmallBulkEntry[] entries = (SmallBulkEntry[])table[name];
|
||||
|
||||
if (entries == null)
|
||||
table[name] = entries = SmallBulkEntry.LoadEntries(type, name);
|
||||
|
||||
return entries;
|
||||
}
|
||||
|
||||
public static LargeBulkEntry[] ConvertEntries(LargeBOD owner, SmallBulkEntry[] small)
|
||||
{
|
||||
LargeBulkEntry[] large = new LargeBulkEntry[small.Length];
|
||||
|
||||
for (int i = 0; i < small.Length; ++i)
|
||||
large[i] = new LargeBulkEntry(owner, small[i]);
|
||||
|
||||
return large;
|
||||
}
|
||||
|
||||
public LargeBulkEntry(LargeBOD owner, GenericReader reader, int version)
|
||||
{
|
||||
this.m_Owner = owner;
|
||||
this.m_Amount = reader.ReadInt();
|
||||
|
||||
Type realType = null;
|
||||
|
||||
string type = reader.ReadString();
|
||||
|
||||
if (type != null)
|
||||
realType = ScriptCompiler.FindTypeByFullName(type);
|
||||
|
||||
this.m_Details = new SmallBulkEntry(realType, reader.ReadInt(), reader.ReadInt(), version == 0 ? 0 : reader.ReadInt());
|
||||
}
|
||||
|
||||
public void Serialize(GenericWriter writer)
|
||||
{
|
||||
writer.Write(this.m_Amount);
|
||||
writer.Write(this.m_Details.Type == null ? null : this.m_Details.Type.FullName);
|
||||
writer.Write(this.m_Details.Number);
|
||||
writer.Write(this.m_Details.Graphic);
|
||||
writer.Write(this.m_Details.Hue);
|
||||
}
|
||||
}
|
||||
}
|
||||
144
Scripts/Services/BulkOrders/LargeBODs/LargeCarpentryBOD.cs
Normal file
144
Scripts/Services/BulkOrders/LargeBODs/LargeCarpentryBOD.cs
Normal file
@@ -0,0 +1,144 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class LargeCarpentryBOD : LargeBOD
|
||||
{
|
||||
public override BODType BODType { get { return BODType.Carpentry; } }
|
||||
|
||||
public static double[] m_CarpentryingMaterialChances = new double[]
|
||||
{
|
||||
0.513718750, // None
|
||||
0.292968750, // Oak
|
||||
0.117187500, // Ash
|
||||
0.046875000, // Yew
|
||||
0.018750000, // Heartwood
|
||||
0.007500000, // Bloodwood
|
||||
0.003000000 // Frostwood
|
||||
};
|
||||
|
||||
[Constructable]
|
||||
public LargeCarpentryBOD()
|
||||
{
|
||||
LargeBulkEntry[] entries;
|
||||
bool useMaterials = true;
|
||||
|
||||
switch (Utility.Random(7))
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeArmoire);
|
||||
break;
|
||||
case 1:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeCabinets);
|
||||
break;
|
||||
case 2:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeChests);
|
||||
break;
|
||||
case 3:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeElvenWeapons);
|
||||
break;
|
||||
case 4:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeInstruments);
|
||||
break;
|
||||
case 5:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeWeapons);
|
||||
break;
|
||||
case 6:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeWoodFurniture);
|
||||
break;
|
||||
}
|
||||
|
||||
int hue = 1512;
|
||||
int amountMax = Utility.RandomList(10, 15, 20, 20);
|
||||
bool reqExceptional = (0.825 > Utility.RandomDouble());
|
||||
|
||||
BulkMaterialType material;
|
||||
|
||||
if (useMaterials)
|
||||
material = GetRandomMaterial(BulkMaterialType.OakWood, m_CarpentryingMaterialChances);
|
||||
else
|
||||
material = BulkMaterialType.None;
|
||||
|
||||
this.Hue = hue;
|
||||
this.AmountMax = amountMax;
|
||||
this.Entries = entries;
|
||||
this.RequireExceptional = reqExceptional;
|
||||
this.Material = material;
|
||||
}
|
||||
|
||||
public LargeCarpentryBOD(int amountMax, bool reqExceptional, BulkMaterialType mat, LargeBulkEntry[] entries)
|
||||
{
|
||||
this.Hue = 1512;
|
||||
this.AmountMax = amountMax;
|
||||
this.Entries = entries;
|
||||
this.RequireExceptional = reqExceptional;
|
||||
this.Material = mat;
|
||||
}
|
||||
|
||||
public LargeCarpentryBOD(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int ComputeFame()
|
||||
{
|
||||
return CarpentryRewardCalculator.Instance.ComputeFame(this);
|
||||
}
|
||||
|
||||
public override int ComputeGold()
|
||||
{
|
||||
return CarpentryRewardCalculator.Instance.ComputeGold(this);
|
||||
}
|
||||
|
||||
public override List<Item> ComputeRewards(bool full)
|
||||
{
|
||||
List<Item> list = new List<Item>();
|
||||
|
||||
RewardGroup rewardGroup = CarpentryRewardCalculator.Instance.LookupRewards(CarpentryRewardCalculator.Instance.ComputePoints(this));
|
||||
|
||||
if (rewardGroup != null)
|
||||
{
|
||||
if (full)
|
||||
{
|
||||
for (int i = 0; i < rewardGroup.Items.Length; ++i)
|
||||
{
|
||||
Item item = rewardGroup.Items[i].Construct();
|
||||
|
||||
if (item != null)
|
||||
list.Add(item);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RewardItem rewardItem = rewardGroup.AcquireItem();
|
||||
|
||||
if (rewardItem != null)
|
||||
{
|
||||
Item item = rewardItem.Construct();
|
||||
|
||||
if (item != null)
|
||||
list.Add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
123
Scripts/Services/BulkOrders/LargeBODs/LargeCookingBOD.cs
Normal file
123
Scripts/Services/BulkOrders/LargeBODs/LargeCookingBOD.cs
Normal file
@@ -0,0 +1,123 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class LargeCookingBOD : LargeBOD
|
||||
{
|
||||
public override BODType BODType { get { return BODType.Cooking; } }
|
||||
|
||||
[Constructable]
|
||||
public LargeCookingBOD()
|
||||
{
|
||||
LargeBulkEntry[] entries;
|
||||
bool nonexceptional = false;
|
||||
|
||||
switch (Utility.Random(7))
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeBarbeque);
|
||||
nonexceptional = true;
|
||||
break;
|
||||
case 1:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeDough);
|
||||
break;
|
||||
case 2:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeFruits);
|
||||
nonexceptional = true;
|
||||
break;
|
||||
case 3:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeMiso);
|
||||
break;
|
||||
case 4:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeSushi);
|
||||
break;
|
||||
case 5:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeSweets);
|
||||
break;
|
||||
case 6:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeUnbakedPies);
|
||||
break;
|
||||
}
|
||||
|
||||
this.Hue = 1169;
|
||||
this.AmountMax = Utility.RandomList(10, 15, 20, 20);
|
||||
this.Entries = entries;
|
||||
this.RequireExceptional = !nonexceptional && 0.825 > Utility.RandomDouble();
|
||||
}
|
||||
|
||||
public LargeCookingBOD(int amountMax, bool reqExceptional, BulkMaterialType mat, LargeBulkEntry[] entries)
|
||||
{
|
||||
this.Hue = 1169;
|
||||
this.AmountMax = amountMax;
|
||||
this.Entries = entries;
|
||||
this.RequireExceptional = reqExceptional;
|
||||
this.Material = mat;
|
||||
}
|
||||
|
||||
public LargeCookingBOD(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int ComputeFame()
|
||||
{
|
||||
return CookingRewardCalculator.Instance.ComputeFame(this);
|
||||
}
|
||||
|
||||
public override int ComputeGold()
|
||||
{
|
||||
return CookingRewardCalculator.Instance.ComputeGold(this);
|
||||
}
|
||||
|
||||
public override List<Item> ComputeRewards(bool full)
|
||||
{
|
||||
List<Item> list = new List<Item>();
|
||||
|
||||
RewardGroup rewardGroup = CookingRewardCalculator.Instance.LookupRewards(CookingRewardCalculator.Instance.ComputePoints(this));
|
||||
|
||||
if (rewardGroup != null)
|
||||
{
|
||||
if (full)
|
||||
{
|
||||
for (int i = 0; i < rewardGroup.Items.Length; ++i)
|
||||
{
|
||||
Item item = rewardGroup.Items[i].Construct();
|
||||
|
||||
if (item != null)
|
||||
list.Add(item);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RewardItem rewardItem = rewardGroup.AcquireItem();
|
||||
|
||||
if (rewardItem != null)
|
||||
{
|
||||
Item item = rewardItem.Construct();
|
||||
|
||||
if (item != null)
|
||||
list.Add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
139
Scripts/Services/BulkOrders/LargeBODs/LargeFletchingBOD.cs
Normal file
139
Scripts/Services/BulkOrders/LargeBODs/LargeFletchingBOD.cs
Normal file
@@ -0,0 +1,139 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class LargeFletchingBOD : LargeBOD
|
||||
{
|
||||
public override BODType BODType { get { return BODType.Fletching; } }
|
||||
|
||||
public static double[] m_FletchingingMaterialChances = new double[]
|
||||
{
|
||||
0.513718750, // None
|
||||
0.292968750, // Oak
|
||||
0.117187500, // Ash
|
||||
0.046875000, // Yew
|
||||
0.018750000, // Heartwood
|
||||
0.007500000, // Bloodwood
|
||||
0.003000000 // Frostwood
|
||||
};
|
||||
|
||||
[Constructable]
|
||||
public LargeFletchingBOD()
|
||||
{
|
||||
LargeBulkEntry[] entries;
|
||||
bool useMaterials = true;
|
||||
|
||||
switch (Utility.Random(5))
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeHumanBows1);
|
||||
break;
|
||||
case 1:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeHumanBows2);
|
||||
break;
|
||||
case 2:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeAmmunition);
|
||||
useMaterials = false;
|
||||
break;
|
||||
case 3:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeElvenBows1);
|
||||
break;
|
||||
case 4:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeElvenBows2);
|
||||
break;
|
||||
}
|
||||
|
||||
int hue = 1425;
|
||||
int amountMax = Utility.RandomList(10, 15, 20, 20);
|
||||
bool reqExceptional = useMaterials && 0.825 > Utility.RandomDouble();
|
||||
|
||||
BulkMaterialType material;
|
||||
|
||||
if (useMaterials)
|
||||
material = GetRandomMaterial(BulkMaterialType.OakWood, m_FletchingingMaterialChances);
|
||||
else
|
||||
material = BulkMaterialType.None;
|
||||
|
||||
this.Hue = hue;
|
||||
this.AmountMax = amountMax;
|
||||
this.Entries = entries;
|
||||
this.RequireExceptional = reqExceptional;
|
||||
this.Material = material;
|
||||
}
|
||||
|
||||
public LargeFletchingBOD(int amountMax, bool reqExceptional, BulkMaterialType mat, LargeBulkEntry[] entries)
|
||||
{
|
||||
this.Hue = 1425;
|
||||
this.AmountMax = amountMax;
|
||||
this.Entries = entries;
|
||||
this.RequireExceptional = reqExceptional;
|
||||
this.Material = mat;
|
||||
}
|
||||
|
||||
public LargeFletchingBOD(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int ComputeFame()
|
||||
{
|
||||
return FletchingRewardCalculator.Instance.ComputeFame(this);
|
||||
}
|
||||
|
||||
public override int ComputeGold()
|
||||
{
|
||||
return FletchingRewardCalculator.Instance.ComputeGold(this);
|
||||
}
|
||||
|
||||
public override List<Item> ComputeRewards(bool full)
|
||||
{
|
||||
List<Item> list = new List<Item>();
|
||||
|
||||
RewardGroup rewardGroup = FletchingRewardCalculator.Instance.LookupRewards(FletchingRewardCalculator.Instance.ComputePoints(this));
|
||||
|
||||
if (rewardGroup != null)
|
||||
{
|
||||
if (full)
|
||||
{
|
||||
for (int i = 0; i < rewardGroup.Items.Length; ++i)
|
||||
{
|
||||
Item item = rewardGroup.Items[i].Construct();
|
||||
|
||||
if (item != null)
|
||||
list.Add(item);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RewardItem rewardItem = rewardGroup.AcquireItem();
|
||||
|
||||
if (rewardItem != null)
|
||||
{
|
||||
Item item = rewardItem.Construct();
|
||||
|
||||
if (item != null)
|
||||
list.Add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
130
Scripts/Services/BulkOrders/LargeBODs/LargeInscriptionBOD.cs
Normal file
130
Scripts/Services/BulkOrders/LargeBODs/LargeInscriptionBOD.cs
Normal file
@@ -0,0 +1,130 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class LargeInscriptionBOD : LargeBOD
|
||||
{
|
||||
public override BODType BODType { get { return BODType.Inscription; } }
|
||||
|
||||
[Constructable]
|
||||
public LargeInscriptionBOD()
|
||||
{
|
||||
LargeBulkEntry[] entries;
|
||||
|
||||
switch (Utility.Random(10))
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeBooks);
|
||||
break;
|
||||
case 1:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeCircle1);
|
||||
break;
|
||||
case 2:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeCircle1and2);
|
||||
break;
|
||||
case 3:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeCircle4);
|
||||
break;
|
||||
case 4:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeCircle5);
|
||||
break;
|
||||
case 5:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeCircle7);
|
||||
break;
|
||||
case 6:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeCircle8);
|
||||
break;
|
||||
case 7:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeNecromancy1);
|
||||
break;
|
||||
case 8:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeNecromancy2);
|
||||
break;
|
||||
case 9:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeNecromancy3);
|
||||
break;
|
||||
}
|
||||
|
||||
int amountMax = Utility.RandomList(10, 15, 20, 20);
|
||||
|
||||
this.Hue = 2598;
|
||||
this.AmountMax = amountMax;
|
||||
this.Entries = entries;
|
||||
}
|
||||
|
||||
public LargeInscriptionBOD(int amountMax, bool reqExceptional, BulkMaterialType mat, LargeBulkEntry[] entries)
|
||||
{
|
||||
this.Hue = 2598;
|
||||
this.AmountMax = amountMax;
|
||||
this.Entries = entries;
|
||||
this.RequireExceptional = reqExceptional;
|
||||
this.Material = mat;
|
||||
}
|
||||
|
||||
public LargeInscriptionBOD(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int ComputeFame()
|
||||
{
|
||||
return InscriptionRewardCalculator.Instance.ComputeFame(this);
|
||||
}
|
||||
|
||||
public override int ComputeGold()
|
||||
{
|
||||
return InscriptionRewardCalculator.Instance.ComputeGold(this);
|
||||
}
|
||||
|
||||
public override List<Item> ComputeRewards(bool full)
|
||||
{
|
||||
List<Item> list = new List<Item>();
|
||||
|
||||
RewardGroup rewardGroup = InscriptionRewardCalculator.Instance.LookupRewards(InscriptionRewardCalculator.Instance.ComputePoints(this));
|
||||
|
||||
if (rewardGroup != null)
|
||||
{
|
||||
if (full)
|
||||
{
|
||||
for (int i = 0; i < rewardGroup.Items.Length; ++i)
|
||||
{
|
||||
Item item = rewardGroup.Items[i].Construct();
|
||||
|
||||
if (item != null)
|
||||
list.Add(item);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RewardItem rewardItem = rewardGroup.AcquireItem();
|
||||
|
||||
if (rewardItem != null)
|
||||
{
|
||||
Item item = rewardItem.Construct();
|
||||
|
||||
if (item != null)
|
||||
list.Add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
154
Scripts/Services/BulkOrders/LargeBODs/LargeSmithBOD.cs
Normal file
154
Scripts/Services/BulkOrders/LargeBODs/LargeSmithBOD.cs
Normal file
@@ -0,0 +1,154 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
[TypeAlias("Scripts.Engines.BulkOrders.LargeSmithBOD")]
|
||||
public class LargeSmithBOD : LargeBOD
|
||||
{
|
||||
public override BODType BODType { get { return BODType.Smith; } }
|
||||
|
||||
public static double[] m_BlacksmithMaterialChances = new double[]
|
||||
{
|
||||
0.501953125, // None
|
||||
0.250000000, // Dull Copper
|
||||
0.125000000, // Shadow Iron
|
||||
0.062500000, // Copper
|
||||
0.031250000, // Bronze
|
||||
0.015625000, // Gold
|
||||
0.007812500, // Agapite
|
||||
0.003906250, // Verite
|
||||
0.001953125 // Valorite
|
||||
};
|
||||
[Constructable]
|
||||
public LargeSmithBOD()
|
||||
{
|
||||
LargeBulkEntry[] entries;
|
||||
bool useMaterials = true;
|
||||
|
||||
int rand = Utility.Random(8);
|
||||
|
||||
switch ( rand )
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeRing);
|
||||
break;
|
||||
case 1:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargePlate);
|
||||
break;
|
||||
case 2:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeChain);
|
||||
break;
|
||||
case 3:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeAxes);
|
||||
break;
|
||||
case 4:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeFencing);
|
||||
break;
|
||||
case 5:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeMaces);
|
||||
break;
|
||||
case 6:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargePolearms);
|
||||
break;
|
||||
case 7:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeSwords);
|
||||
break;
|
||||
}
|
||||
|
||||
if (rand > 2 && rand < 8)
|
||||
useMaterials = false;
|
||||
|
||||
int hue = 0x44E;
|
||||
int amountMax = Utility.RandomList(10, 15, 20, 20);
|
||||
bool reqExceptional = (0.825 > Utility.RandomDouble());
|
||||
|
||||
BulkMaterialType material;
|
||||
|
||||
if (useMaterials)
|
||||
material = GetRandomMaterial(BulkMaterialType.DullCopper, m_BlacksmithMaterialChances);
|
||||
else
|
||||
material = BulkMaterialType.None;
|
||||
|
||||
this.Hue = hue;
|
||||
this.AmountMax = amountMax;
|
||||
this.Entries = entries;
|
||||
this.RequireExceptional = reqExceptional;
|
||||
this.Material = material;
|
||||
}
|
||||
|
||||
public LargeSmithBOD(int amountMax, bool reqExceptional, BulkMaterialType mat, LargeBulkEntry[] entries)
|
||||
{
|
||||
this.Hue = 0x44E;
|
||||
this.AmountMax = amountMax;
|
||||
this.Entries = entries;
|
||||
this.RequireExceptional = reqExceptional;
|
||||
this.Material = mat;
|
||||
}
|
||||
|
||||
public LargeSmithBOD(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int ComputeFame()
|
||||
{
|
||||
return SmithRewardCalculator.Instance.ComputeFame(this);
|
||||
}
|
||||
|
||||
public override int ComputeGold()
|
||||
{
|
||||
return SmithRewardCalculator.Instance.ComputeGold(this);
|
||||
}
|
||||
|
||||
public override List<Item> ComputeRewards(bool full)
|
||||
{
|
||||
List<Item> list = new List<Item>();
|
||||
|
||||
RewardGroup rewardGroup = SmithRewardCalculator.Instance.LookupRewards(SmithRewardCalculator.Instance.ComputePoints(this));
|
||||
|
||||
if (rewardGroup != null)
|
||||
{
|
||||
if (full)
|
||||
{
|
||||
for (int i = 0; i < rewardGroup.Items.Length; ++i)
|
||||
{
|
||||
Item item = rewardGroup.Items[i].Construct();
|
||||
|
||||
if (item != null)
|
||||
list.Add(item);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RewardItem rewardItem = rewardGroup.AcquireItem();
|
||||
|
||||
if (rewardItem != null)
|
||||
{
|
||||
Item item = rewardItem.Construct();
|
||||
|
||||
if (item != null)
|
||||
list.Add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
166
Scripts/Services/BulkOrders/LargeBODs/LargeTailorBOD.cs
Normal file
166
Scripts/Services/BulkOrders/LargeBODs/LargeTailorBOD.cs
Normal file
@@ -0,0 +1,166 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class LargeTailorBOD : LargeBOD
|
||||
{
|
||||
public override BODType BODType { get { return BODType.Tailor; } }
|
||||
|
||||
public static double[] m_TailoringMaterialChances = new double[]
|
||||
{
|
||||
0.857421875, // None
|
||||
0.125000000, // Spined
|
||||
0.015625000, // Horned
|
||||
0.001953125 // Barbed
|
||||
};
|
||||
[Constructable]
|
||||
public LargeTailorBOD()
|
||||
{
|
||||
LargeBulkEntry[] entries;
|
||||
bool useMaterials = false;
|
||||
|
||||
switch ( Utility.Random(14) )
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.Farmer);
|
||||
break;
|
||||
case 1:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.FemaleLeatherSet);
|
||||
useMaterials = true;
|
||||
break;
|
||||
case 2:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.FisherGirl);
|
||||
break;
|
||||
case 3:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.Gypsy);
|
||||
break;
|
||||
case 4:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.HatSet);
|
||||
break;
|
||||
case 5:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.Jester);
|
||||
break;
|
||||
case 6:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.Lady);
|
||||
break;
|
||||
case 7:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.MaleLeatherSet);
|
||||
useMaterials = true;
|
||||
break;
|
||||
case 8:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.Pirate);
|
||||
break;
|
||||
case 9:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.ShoeSet);
|
||||
useMaterials = Core.ML;
|
||||
break;
|
||||
case 10:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.StuddedSet);
|
||||
useMaterials = true;
|
||||
break;
|
||||
case 11:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.TownCrier);
|
||||
break;
|
||||
case 12:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.Wizard);
|
||||
break;
|
||||
case 13:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.BoneSet);
|
||||
useMaterials = true;
|
||||
break;
|
||||
}
|
||||
|
||||
int hue = 0x483;
|
||||
int amountMax = Utility.RandomList(10, 15, 20, 20);
|
||||
bool reqExceptional = (0.825 > Utility.RandomDouble());
|
||||
|
||||
BulkMaterialType material;
|
||||
|
||||
if (useMaterials)
|
||||
material = GetRandomMaterial(BulkMaterialType.Spined, m_TailoringMaterialChances);
|
||||
else
|
||||
material = BulkMaterialType.None;
|
||||
|
||||
this.Hue = hue;
|
||||
this.AmountMax = amountMax;
|
||||
this.Entries = entries;
|
||||
this.RequireExceptional = reqExceptional;
|
||||
this.Material = material;
|
||||
}
|
||||
|
||||
public LargeTailorBOD(int amountMax, bool reqExceptional, BulkMaterialType mat, LargeBulkEntry[] entries)
|
||||
{
|
||||
this.Hue = 0x483;
|
||||
this.AmountMax = amountMax;
|
||||
this.Entries = entries;
|
||||
this.RequireExceptional = reqExceptional;
|
||||
this.Material = mat;
|
||||
}
|
||||
|
||||
public LargeTailorBOD(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int ComputeFame()
|
||||
{
|
||||
return TailorRewardCalculator.Instance.ComputeFame(this);
|
||||
}
|
||||
|
||||
public override int ComputeGold()
|
||||
{
|
||||
return TailorRewardCalculator.Instance.ComputeGold(this);
|
||||
}
|
||||
|
||||
public override List<Item> ComputeRewards(bool full)
|
||||
{
|
||||
List<Item> list = new List<Item>();
|
||||
|
||||
RewardGroup rewardGroup = TailorRewardCalculator.Instance.LookupRewards(TailorRewardCalculator.Instance.ComputePoints(this));
|
||||
|
||||
if (rewardGroup != null)
|
||||
{
|
||||
if (full)
|
||||
{
|
||||
for (int i = 0; i < rewardGroup.Items.Length; ++i)
|
||||
{
|
||||
Item item = rewardGroup.Items[i].Construct();
|
||||
|
||||
if (item != null)
|
||||
list.Add(item);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RewardItem rewardItem = rewardGroup.AcquireItem();
|
||||
|
||||
if (rewardItem != null)
|
||||
{
|
||||
Item item = rewardItem.Construct();
|
||||
|
||||
if (item != null)
|
||||
list.Add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
235
Scripts/Services/BulkOrders/LargeBODs/LargeTinkerBOD.cs
Normal file
235
Scripts/Services/BulkOrders/LargeBODs/LargeTinkerBOD.cs
Normal file
@@ -0,0 +1,235 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class LargeTinkerBOD : LargeBOD
|
||||
{
|
||||
public override BODType BODType { get { return BODType.Tinkering; } }
|
||||
|
||||
private GemType _GemType;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public GemType GemType
|
||||
{
|
||||
get { return _GemType; }
|
||||
set
|
||||
{
|
||||
if (Entries.Length > 0 && Entries[0].Details != null && Entries[0].Details.Type != null && Entries[0].Details.Type.IsSubclassOf(typeof(BaseJewel)))
|
||||
{
|
||||
_GemType = value;
|
||||
AssignGemNumbers();
|
||||
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static double[] m_BlackTinkerMaterialChances = new double[]
|
||||
{
|
||||
0.501953125, // None
|
||||
0.250000000, // Dull Copper
|
||||
0.125000000, // Shadow Iron
|
||||
0.062500000, // Copper
|
||||
0.031250000, // Bronze
|
||||
0.015625000, // Gold
|
||||
0.007812500, // Agapite
|
||||
0.003906250, // Verite
|
||||
0.001953125 // Valorite
|
||||
};
|
||||
|
||||
[Constructable]
|
||||
public LargeTinkerBOD()
|
||||
{
|
||||
LargeBulkEntry[] entries;
|
||||
bool useMaterials = true;
|
||||
bool jewelry = false;
|
||||
|
||||
int rand = Utility.Random(4);
|
||||
|
||||
switch ( rand )
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeDining);
|
||||
break;
|
||||
case 1:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeJewelry);
|
||||
useMaterials = false;
|
||||
jewelry = true;
|
||||
break;
|
||||
case 2:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeKeyGlobe);
|
||||
break;
|
||||
case 3:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.LargeTools);
|
||||
useMaterials = false;
|
||||
break;
|
||||
}
|
||||
|
||||
int amountMax = Utility.RandomList(10, 15, 20, 20);
|
||||
bool reqExceptional = (0.825 > Utility.RandomDouble());
|
||||
|
||||
BulkMaterialType material;
|
||||
|
||||
if (useMaterials)
|
||||
material = GetRandomMaterial(BulkMaterialType.DullCopper, m_BlackTinkerMaterialChances);
|
||||
else
|
||||
material = BulkMaterialType.None;
|
||||
|
||||
Hue = 1109;
|
||||
AmountMax = amountMax;
|
||||
Entries = entries;
|
||||
RequireExceptional = reqExceptional;
|
||||
Material = material;
|
||||
|
||||
if (jewelry)
|
||||
{
|
||||
AssignGemType();
|
||||
}
|
||||
}
|
||||
|
||||
public LargeTinkerBOD(int amountMax, bool reqExceptional, BulkMaterialType mat, LargeBulkEntry[] entries, GemType gemType)
|
||||
{
|
||||
Hue = 1109;
|
||||
AmountMax = amountMax;
|
||||
Entries = entries;
|
||||
RequireExceptional = reqExceptional;
|
||||
Material = mat;
|
||||
_GemType = gemType;
|
||||
}
|
||||
|
||||
public override bool CheckType(SmallBOD small, Type type)
|
||||
{
|
||||
if (_GemType != GemType.None && (!(small is SmallTinkerBOD) || ((SmallTinkerBOD)small).GemType != _GemType))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return base.CheckType(small, type);
|
||||
}
|
||||
|
||||
public LargeTinkerBOD(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int ComputeFame()
|
||||
{
|
||||
return TinkeringRewardCalculator.Instance.ComputeFame(this);
|
||||
}
|
||||
|
||||
public override int ComputeGold()
|
||||
{
|
||||
return TinkeringRewardCalculator.Instance.ComputeGold(this);
|
||||
}
|
||||
|
||||
public override List<Item> ComputeRewards(bool full)
|
||||
{
|
||||
List<Item> list = new List<Item>();
|
||||
|
||||
RewardGroup rewardGroup = TinkeringRewardCalculator.Instance.LookupRewards(TinkeringRewardCalculator.Instance.ComputePoints(this));
|
||||
|
||||
if (rewardGroup != null)
|
||||
{
|
||||
if (full)
|
||||
{
|
||||
for (int i = 0; i < rewardGroup.Items.Length; ++i)
|
||||
{
|
||||
Item item = rewardGroup.Items[i].Construct();
|
||||
|
||||
if (item != null)
|
||||
list.Add(item);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RewardItem rewardItem = rewardGroup.AcquireItem();
|
||||
|
||||
if (rewardItem != null)
|
||||
{
|
||||
Item item = rewardItem.Construct();
|
||||
|
||||
if (item != null)
|
||||
list.Add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public void AssignGemType()
|
||||
{
|
||||
_GemType = (GemType)Utility.RandomMinMax(1, 9);
|
||||
AssignGemNumbers();
|
||||
}
|
||||
|
||||
public void AssignGemNumbers()
|
||||
{
|
||||
foreach (var entry in Entries)
|
||||
{
|
||||
Type jewelType = entry.Details.Type;
|
||||
|
||||
int offset = (int)GemType - 1;
|
||||
int loc = 0;
|
||||
|
||||
if (jewelType == typeof(GoldRing) || jewelType == typeof(SilverRing))
|
||||
{
|
||||
loc = 1044176;
|
||||
}
|
||||
else if (jewelType == typeof(GoldBracelet) || jewelType == typeof(SilverBracelet))
|
||||
{
|
||||
loc = 1044221;
|
||||
}
|
||||
else
|
||||
{
|
||||
loc = 1044203;
|
||||
}
|
||||
|
||||
entry.Details.Number = loc + offset;
|
||||
}
|
||||
|
||||
//this.Number = loc + (int)gemType - 1;
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)1); // version
|
||||
|
||||
writer.Write((int)_GemType);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch (version)
|
||||
{
|
||||
case 1:
|
||||
_GemType = (GemType)reader.ReadInt();
|
||||
break;
|
||||
}
|
||||
|
||||
if (version < 1 && Entries != null && Entries.Length > 0 && Entries[0].Details != null)
|
||||
{
|
||||
Type t = Entries[0].Details.Type;
|
||||
|
||||
if (SmallTinkerBOD.CannotAssignMaterial(t) && Material != BulkMaterialType.None)
|
||||
{
|
||||
Material = BulkMaterialType.None;
|
||||
}
|
||||
|
||||
if (t.IsSubclassOf(typeof(BaseJewel)))
|
||||
{
|
||||
AssignGemType();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
51
Scripts/Services/BulkOrders/Rewards/ConfirmBankPointsGump.cs
Normal file
51
Scripts/Services/BulkOrders/Rewards/ConfirmBankPointsGump.cs
Normal file
@@ -0,0 +1,51 @@
|
||||
using System;
|
||||
using Server.Gumps;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class ConfirmBankPointsGump : ConfirmCallbackGump
|
||||
{
|
||||
public int Points { get; set; }
|
||||
public double Banked { get; set; }
|
||||
|
||||
public Mobile Owner { get; set; }
|
||||
public BODType BODType { get; set; }
|
||||
|
||||
public ConfirmBankPointsGump(PlayerMobile user, Mobile owner, BODType type, int points, double banked)
|
||||
: base(user, 1157076, 1157077, new object[] { points, banked, type, owner }, String.Format("{0}\t{1}", banked.ToString("0.000000"), points.ToString()), OnSave, OnClaim)
|
||||
{
|
||||
Closable = false;
|
||||
user.CloseGump(typeof(ConfirmBankPointsGump));
|
||||
|
||||
Points = points;
|
||||
Banked = banked;
|
||||
this.BODType = type;
|
||||
|
||||
Owner = owner;
|
||||
|
||||
Rectangle2D rec = ItemBounds.Table[0x2258];
|
||||
|
||||
AddItem(115 + rec.Width / 2 - rec.X, 110 + rec.Height / 2 - rec.Y, 0x2258, BulkOrderSystem.GetBodHue(this.BODType));
|
||||
}
|
||||
|
||||
private static void OnSave(Mobile m, object state)
|
||||
{
|
||||
object[] ohs = (object[])state;
|
||||
|
||||
BulkOrderSystem.SetPoints(m, (BODType)ohs[2], (double)ohs[1]);
|
||||
BulkOrderSystem.RemovePending(m, (BODType)ohs[2]);
|
||||
|
||||
if (m is PlayerMobile)
|
||||
m.SendGump(new RewardsGump((Mobile)ohs[3], (PlayerMobile)m, (BODType)ohs[2]));
|
||||
}
|
||||
|
||||
private static void OnClaim(Mobile m, object state)
|
||||
{
|
||||
object[] ohs = (object[])state;
|
||||
|
||||
if (m is PlayerMobile)
|
||||
m.SendGump(new RewardsGump((Mobile)ohs[3], (PlayerMobile)m, (BODType)ohs[2], (int)ohs[0]));
|
||||
}
|
||||
}
|
||||
}
|
||||
1949
Scripts/Services/BulkOrders/Rewards/Rewards.cs
Normal file
1949
Scripts/Services/BulkOrders/Rewards/Rewards.cs
Normal file
File diff suppressed because it is too large
Load Diff
80
Scripts/Services/BulkOrders/Rewards/RewardsGump.cs
Normal file
80
Scripts/Services/BulkOrders/Rewards/RewardsGump.cs
Normal file
@@ -0,0 +1,80 @@
|
||||
using System;
|
||||
using Server.Engines.BulkOrders;
|
||||
using Server.Gumps;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class RewardsGump : BaseRewardGump
|
||||
{
|
||||
public BODType BODType { get; private set; }
|
||||
|
||||
public bool UsingBanked { get; set; }
|
||||
|
||||
public RewardsGump(Mobile owner, PlayerMobile user, BODType type, int points = 0)
|
||||
: base(owner, user, BulkOrderSystem.GetRewardCollection(type), 1157082, points == 0 ? BulkOrderSystem.GetPoints(user, type) : points)
|
||||
{
|
||||
BODType = type;
|
||||
UsingBanked = points == 0;
|
||||
|
||||
var entry = new GumpLabel(230, 65, 0x64, GetPoints(user).ToString("0.000000"));
|
||||
entry.Parent = this;
|
||||
|
||||
Entries.Insert(10, entry);
|
||||
}
|
||||
|
||||
public override int GetYOffset(int id)
|
||||
{
|
||||
if (id == 0x182B)
|
||||
{
|
||||
return 34;
|
||||
}
|
||||
|
||||
return 15;
|
||||
}
|
||||
|
||||
protected override void AddPoints()
|
||||
{
|
||||
}
|
||||
|
||||
public override double GetPoints(Mobile m)
|
||||
{
|
||||
if (Points > 0)
|
||||
return Points;
|
||||
|
||||
return BulkOrderSystem.GetPoints(m, this.BODType);
|
||||
}
|
||||
|
||||
public override void OnConfirmed(CollectionItem citem, int index)
|
||||
{
|
||||
BODCollectionItem item = citem as BODCollectionItem;
|
||||
|
||||
if (item != null && GetPoints(User) >= item.Points && item.Constructor != null)
|
||||
{
|
||||
Item i = item.Constructor(item.RewardType);
|
||||
|
||||
if (User.Backpack == null || !User.Backpack.TryDropItem(User, i, false))
|
||||
{
|
||||
User.SendLocalizedMessage(1074361); // The reward could not be given. Make sure you have room in your pack.
|
||||
i.Delete();
|
||||
|
||||
User.SendGump(new RewardsGump(Owner, User, this.BODType, (int)Points));
|
||||
}
|
||||
else
|
||||
{
|
||||
User.SendLocalizedMessage(1073621); // Your reward has been placed in your backpack.
|
||||
User.PlaySound(0x5A7);
|
||||
|
||||
if (UsingBanked)
|
||||
{
|
||||
BulkOrderSystem.DeductPoints(User, this.BODType, item.Points);
|
||||
}
|
||||
else
|
||||
{
|
||||
BulkOrderSystem.RemovePending(User, this.BODType);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
177
Scripts/Services/BulkOrders/SmallBODs/SmallAlchemyBOD.cs
Normal file
177
Scripts/Services/BulkOrders/SmallBODs/SmallAlchemyBOD.cs
Normal file
@@ -0,0 +1,177 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.Engines.Craft;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
// carp 1512
|
||||
// bow 1425
|
||||
// cook 1169
|
||||
// scribe 2598
|
||||
// tink 1109
|
||||
public class SmallAlchemyBOD : SmallBOD
|
||||
{
|
||||
public override BODType BODType { get { return BODType.Alchemy; } }
|
||||
|
||||
[Constructable]
|
||||
public SmallAlchemyBOD()
|
||||
{
|
||||
SmallBulkEntry[] entries = SmallBulkEntry.AlchemySmalls;
|
||||
|
||||
if (entries.Length > 0)
|
||||
{
|
||||
int amountMax = Utility.RandomList(10, 15, 20);
|
||||
|
||||
BulkMaterialType material;
|
||||
material = BulkMaterialType.None;
|
||||
|
||||
SmallBulkEntry entry = entries[Utility.Random(entries.Length)];
|
||||
|
||||
this.Hue = 2505;
|
||||
this.AmountMax = amountMax;
|
||||
this.Type = entry.Type;
|
||||
this.Number = entry.Number;
|
||||
this.Graphic = entry.Graphic;
|
||||
this.Material = material;
|
||||
this.GraphicHue = entry.Hue;
|
||||
}
|
||||
}
|
||||
|
||||
public SmallAlchemyBOD(int amountCur, int amountMax, Type type, int number, int graphic, bool reqExceptional, BulkMaterialType mat, int hue)
|
||||
{
|
||||
this.Hue = 2505;
|
||||
this.AmountMax = amountMax;
|
||||
this.AmountCur = amountCur;
|
||||
this.Type = type;
|
||||
this.Number = number;
|
||||
this.Graphic = graphic;
|
||||
this.RequireExceptional = reqExceptional;
|
||||
this.Material = mat;
|
||||
this.GraphicHue = hue;
|
||||
}
|
||||
|
||||
public SmallAlchemyBOD(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
private SmallAlchemyBOD(SmallBulkEntry entry, int amountMax)
|
||||
{
|
||||
this.Hue = 2505;
|
||||
this.AmountMax = amountMax;
|
||||
this.Type = entry.Type;
|
||||
this.Number = entry.Number;
|
||||
this.Graphic = entry.Graphic;
|
||||
this.GraphicHue = entry.Hue;
|
||||
}
|
||||
|
||||
public static SmallAlchemyBOD CreateRandomFor(Mobile m)
|
||||
{
|
||||
SmallBulkEntry[] entries;
|
||||
|
||||
double theirSkill = BulkOrderSystem.GetBODSkill(m, SkillName.Alchemy);
|
||||
|
||||
entries = SmallBulkEntry.AlchemySmalls;
|
||||
|
||||
if (entries.Length > 0)
|
||||
{
|
||||
int amountMax;
|
||||
|
||||
if (theirSkill >= 70.1)
|
||||
amountMax = Utility.RandomList(10, 15, 20, 20);
|
||||
else if (theirSkill >= 50.1)
|
||||
amountMax = Utility.RandomList(10, 15, 15, 20);
|
||||
else
|
||||
amountMax = Utility.RandomList(10, 10, 15, 20);
|
||||
|
||||
CraftSystem system = DefAlchemy.CraftSystem;
|
||||
|
||||
List<SmallBulkEntry> validEntries = new List<SmallBulkEntry>();
|
||||
|
||||
for (int i = 0; i < entries.Length; ++i)
|
||||
{
|
||||
CraftItem item = system.CraftItems.SearchFor(entries[i].Type);
|
||||
|
||||
if (item != null)
|
||||
{
|
||||
bool allRequiredSkills = true;
|
||||
double chance = item.GetSuccessChance(m, null, system, false, ref allRequiredSkills);
|
||||
|
||||
if (allRequiredSkills && chance >= 0.0)
|
||||
{
|
||||
if (chance > 0.0)
|
||||
validEntries.Add(entries[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (validEntries.Count > 0)
|
||||
{
|
||||
SmallBulkEntry entry = validEntries[Utility.Random(validEntries.Count)];
|
||||
return new SmallAlchemyBOD(entry, amountMax);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public override int ComputeFame()
|
||||
{
|
||||
return AlchemyRewardCalculator.Instance.ComputeFame(this);
|
||||
}
|
||||
|
||||
public override int ComputeGold()
|
||||
{
|
||||
return AlchemyRewardCalculator.Instance.ComputeGold(this);
|
||||
}
|
||||
|
||||
public override List<Item> ComputeRewards(bool full)
|
||||
{
|
||||
List<Item> list = new List<Item>();
|
||||
|
||||
RewardGroup rewardGroup = AlchemyRewardCalculator.Instance.LookupRewards(AlchemyRewardCalculator.Instance.ComputePoints(this));
|
||||
|
||||
if (rewardGroup != null)
|
||||
{
|
||||
if (full)
|
||||
{
|
||||
for (int i = 0; i < rewardGroup.Items.Length; ++i)
|
||||
{
|
||||
Item item = rewardGroup.Items[i].Construct();
|
||||
|
||||
if (item != null)
|
||||
list.Add(item);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RewardItem rewardItem = rewardGroup.AcquireItem();
|
||||
|
||||
if (rewardItem != null)
|
||||
{
|
||||
Item item = rewardItem.Construct();
|
||||
|
||||
if (item != null)
|
||||
list.Add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
501
Scripts/Services/BulkOrders/SmallBODs/SmallBOD.cs
Normal file
501
Scripts/Services/BulkOrders/SmallBODs/SmallBOD.cs
Normal file
@@ -0,0 +1,501 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.Items;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
[TypeAlias("Scripts.Engines.BulkOrders.SmallBOD")]
|
||||
public abstract class SmallBOD : Item, IBOD
|
||||
{
|
||||
public abstract BODType BODType { get; }
|
||||
|
||||
private int m_AmountCur, m_AmountMax;
|
||||
private Type m_Type;
|
||||
private int m_Number;
|
||||
private int m_Graphic;
|
||||
private int m_GraphicHue;
|
||||
private bool m_RequireExceptional;
|
||||
private BulkMaterialType m_Material;
|
||||
|
||||
[Constructable]
|
||||
public SmallBOD(int hue, int amountMax, Type type, int number, int graphic, bool requireExeptional, BulkMaterialType material, int graphichue = 0)
|
||||
: base(Core.AOS ? 0x2258 : 0x14EF)
|
||||
{
|
||||
Weight = 1.0;
|
||||
Hue = hue; // Blacksmith: 0x44E; Tailoring: 0x483
|
||||
LootType = LootType.Blessed;
|
||||
|
||||
m_AmountMax = amountMax;
|
||||
m_Type = type;
|
||||
m_Number = number;
|
||||
m_Graphic = graphic;
|
||||
m_GraphicHue = graphichue;
|
||||
m_RequireExceptional = requireExeptional;
|
||||
m_Material = material;
|
||||
}
|
||||
|
||||
public SmallBOD()
|
||||
: base(Core.AOS ? 0x2258 : 0x14EF)
|
||||
{
|
||||
Weight = 1.0;
|
||||
LootType = LootType.Blessed;
|
||||
}
|
||||
|
||||
public SmallBOD(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int AmountCur
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_AmountCur;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_AmountCur = value;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int AmountMax
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_AmountMax;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_AmountMax = value;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public virtual Type Type
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Type;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_Type = value;
|
||||
}
|
||||
}
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int Number
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Number;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_Number = value;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int Graphic
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Graphic;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_Graphic = value;
|
||||
}
|
||||
}
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int GraphicHue
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_GraphicHue;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_GraphicHue = value;
|
||||
}
|
||||
}
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public bool RequireExceptional
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_RequireExceptional;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_RequireExceptional = value;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public BulkMaterialType Material
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Material;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_Material = value;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public bool Complete
|
||||
{
|
||||
get
|
||||
{
|
||||
return (m_AmountCur == m_AmountMax);
|
||||
}
|
||||
}
|
||||
public override int LabelNumber
|
||||
{
|
||||
get
|
||||
{
|
||||
return 1045151;
|
||||
}
|
||||
}// a bulk order deed
|
||||
public static BulkMaterialType GetRandomMaterial(BulkMaterialType start, double[] chances)
|
||||
{
|
||||
double random = Utility.RandomDouble();
|
||||
|
||||
for (int i = 0; i < chances.Length; ++i)
|
||||
{
|
||||
if (random < chances[i])
|
||||
return (i == 0 ? BulkMaterialType.None : start + (i - 1));
|
||||
|
||||
random -= chances[i];
|
||||
}
|
||||
|
||||
return BulkMaterialType.None;
|
||||
}
|
||||
|
||||
public static BulkMaterialType GetMaterial(CraftResource resource)
|
||||
{
|
||||
switch ( resource )
|
||||
{
|
||||
case CraftResource.DullCopper:
|
||||
return BulkMaterialType.DullCopper;
|
||||
case CraftResource.ShadowIron:
|
||||
return BulkMaterialType.ShadowIron;
|
||||
case CraftResource.Copper:
|
||||
return BulkMaterialType.Copper;
|
||||
case CraftResource.Bronze:
|
||||
return BulkMaterialType.Bronze;
|
||||
case CraftResource.Gold:
|
||||
return BulkMaterialType.Gold;
|
||||
case CraftResource.Agapite:
|
||||
return BulkMaterialType.Agapite;
|
||||
case CraftResource.Verite:
|
||||
return BulkMaterialType.Verite;
|
||||
case CraftResource.Valorite:
|
||||
return BulkMaterialType.Valorite;
|
||||
case CraftResource.SpinedLeather:
|
||||
return BulkMaterialType.Spined;
|
||||
case CraftResource.HornedLeather:
|
||||
return BulkMaterialType.Horned;
|
||||
case CraftResource.BarbedLeather:
|
||||
return BulkMaterialType.Barbed;
|
||||
case CraftResource.OakWood:
|
||||
return BulkMaterialType.OakWood;
|
||||
case CraftResource.YewWood:
|
||||
return BulkMaterialType.YewWood;
|
||||
case CraftResource.AshWood:
|
||||
return BulkMaterialType.AshWood;
|
||||
case CraftResource.Heartwood:
|
||||
return BulkMaterialType.Heartwood;
|
||||
case CraftResource.Bloodwood:
|
||||
return BulkMaterialType.Bloodwood;
|
||||
case CraftResource.Frostwood:
|
||||
return BulkMaterialType.Frostwood;
|
||||
}
|
||||
|
||||
return BulkMaterialType.None;
|
||||
}
|
||||
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
list.Add(1060654); // small bulk order
|
||||
|
||||
if (m_RequireExceptional)
|
||||
list.Add(1045141); // All items must be exceptional.
|
||||
|
||||
if (m_Material != BulkMaterialType.None)
|
||||
list.Add(SmallBODGump.GetMaterialNumberFor(m_Material)); // All items must be made with x material.
|
||||
|
||||
list.Add(1060656, m_AmountMax.ToString()); // amount to make: ~1_val~
|
||||
list.Add(1060658, "#{0}\t{1}", m_Number, m_AmountCur); // ~1_val~: ~2_val~
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (IsChildOf(from.Backpack) || InSecureTrade || RootParent is PlayerVendor)
|
||||
{
|
||||
EventSink.InvokeBODUsed(new BODUsedEventArgs(from, this));
|
||||
from.SendGump(new SmallBODGump(from, this));
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(1045156); // You must have the deed in your backpack to use it.
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnDoubleClickNotAccessible(Mobile from)
|
||||
{
|
||||
OnDoubleClick(from);
|
||||
}
|
||||
|
||||
public override void OnDoubleClickSecureTrade(Mobile from)
|
||||
{
|
||||
OnDoubleClick(from);
|
||||
}
|
||||
|
||||
public void BeginCombine(Mobile from)
|
||||
{
|
||||
if (m_AmountCur < m_AmountMax)
|
||||
from.Target = new SmallBODTarget(this);
|
||||
else
|
||||
from.SendLocalizedMessage(1045166); // The maximum amount of requested items have already been combined to this deed.
|
||||
}
|
||||
|
||||
public abstract List<Item> ComputeRewards(bool full);
|
||||
|
||||
public abstract int ComputeGold();
|
||||
|
||||
public abstract int ComputeFame();
|
||||
|
||||
public virtual void GetRewards(out Item reward, out int gold, out int fame)
|
||||
{
|
||||
reward = null;
|
||||
gold = ComputeGold();
|
||||
fame = ComputeFame();
|
||||
|
||||
if (!BulkOrderSystem.NewSystemEnabled)
|
||||
{
|
||||
List<Item> rewards = ComputeRewards(false);
|
||||
|
||||
if (rewards.Count > 0)
|
||||
{
|
||||
reward = rewards[Utility.Random(rewards.Count)];
|
||||
|
||||
for (int i = 0; i < rewards.Count; ++i)
|
||||
{
|
||||
if (rewards[i] != reward)
|
||||
rewards[i].Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public virtual bool CheckType(Item item)
|
||||
{
|
||||
return CheckType(item.GetType());
|
||||
}
|
||||
|
||||
public virtual bool CheckType(Type itemType)
|
||||
{
|
||||
return m_Type != null && (itemType == m_Type || itemType.IsSubclassOf(m_Type));
|
||||
}
|
||||
|
||||
public void EndCombine(Mobile from, object o)
|
||||
{
|
||||
if (o is Item && ((Item)o).IsChildOf(from.Backpack))
|
||||
{
|
||||
Type objectType = o.GetType();
|
||||
Item item = o as Item;
|
||||
|
||||
if (m_AmountCur >= m_AmountMax)
|
||||
{
|
||||
from.SendLocalizedMessage(1045166); // The maximum amount of requested items have already been combined to this deed.
|
||||
}
|
||||
else if (!CheckType((Item)o))
|
||||
{
|
||||
from.SendLocalizedMessage(1045169); // The item is not in the request.
|
||||
}
|
||||
else
|
||||
{
|
||||
BulkMaterialType material = BulkMaterialType.None;
|
||||
|
||||
if (o is IResource)
|
||||
material = GetMaterial(((IResource)o).Resource);
|
||||
|
||||
if (material != m_Material && m_Material != BulkMaterialType.None)
|
||||
{
|
||||
from.SendLocalizedMessage(1157310); // The item is not made from the requested resource.
|
||||
}
|
||||
else
|
||||
{
|
||||
bool isExceptional = false;
|
||||
|
||||
if (o is IQuality)
|
||||
isExceptional = (((IQuality)o).Quality == ItemQuality.Exceptional);
|
||||
|
||||
if (m_RequireExceptional && !isExceptional)
|
||||
{
|
||||
from.SendLocalizedMessage(1045167); // The item must be exceptional.
|
||||
}
|
||||
else
|
||||
{
|
||||
if (item.Amount > 1)
|
||||
{
|
||||
if (AmountCur + item.Amount > AmountMax)
|
||||
{
|
||||
from.SendLocalizedMessage(1157222); // You have provided more than which has been requested by this deed.
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
AmountCur += item.Amount;
|
||||
item.Delete();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
item.Delete();
|
||||
++AmountCur;
|
||||
}
|
||||
|
||||
from.SendLocalizedMessage(1045170); // The item has been combined with the deed.
|
||||
|
||||
from.SendGump(new SmallBODGump(from, this));
|
||||
|
||||
if (m_AmountCur < m_AmountMax)
|
||||
BeginCombine(from);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(1045158); // You must have the item in your backpack to target it.
|
||||
}
|
||||
}
|
||||
|
||||
public static double GetRequiredSkill(BulkMaterialType type)
|
||||
{
|
||||
double skillReq = 0.0;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case BulkMaterialType.DullCopper:
|
||||
skillReq = 65.0;
|
||||
break;
|
||||
case BulkMaterialType.ShadowIron:
|
||||
skillReq = 70.0;
|
||||
break;
|
||||
case BulkMaterialType.Copper:
|
||||
skillReq = 75.0;
|
||||
break;
|
||||
case BulkMaterialType.Bronze:
|
||||
skillReq = 80.0;
|
||||
break;
|
||||
case BulkMaterialType.Gold:
|
||||
skillReq = 85.0;
|
||||
break;
|
||||
case BulkMaterialType.Agapite:
|
||||
skillReq = 90.0;
|
||||
break;
|
||||
case BulkMaterialType.Verite:
|
||||
skillReq = 95.0;
|
||||
break;
|
||||
case BulkMaterialType.Valorite:
|
||||
skillReq = 100.0;
|
||||
break;
|
||||
case BulkMaterialType.Spined:
|
||||
skillReq = 65.0;
|
||||
break;
|
||||
case BulkMaterialType.Horned:
|
||||
skillReq = 80.0;
|
||||
break;
|
||||
case BulkMaterialType.Barbed:
|
||||
skillReq = 99.0;
|
||||
break;
|
||||
case BulkMaterialType.OakWood:
|
||||
skillReq = 65.0;
|
||||
break;
|
||||
case BulkMaterialType.AshWood:
|
||||
skillReq = 75.0;
|
||||
break;
|
||||
case BulkMaterialType.YewWood:
|
||||
skillReq = 85.0;
|
||||
break;
|
||||
case BulkMaterialType.Heartwood:
|
||||
case BulkMaterialType.Bloodwood:
|
||||
case BulkMaterialType.Frostwood:
|
||||
skillReq = 95.0;
|
||||
break;
|
||||
}
|
||||
|
||||
return skillReq;
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)1); // version
|
||||
|
||||
writer.Write(m_GraphicHue);
|
||||
|
||||
writer.Write(m_AmountCur);
|
||||
writer.Write(m_AmountMax);
|
||||
writer.Write(m_Type == null ? null : m_Type.FullName);
|
||||
writer.Write(m_Number);
|
||||
writer.Write(m_Graphic);
|
||||
writer.Write(m_RequireExceptional);
|
||||
writer.Write((int)m_Material);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
m_GraphicHue = reader.ReadInt();
|
||||
goto case 0;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
m_AmountCur = reader.ReadInt();
|
||||
m_AmountMax = reader.ReadInt();
|
||||
|
||||
string type = reader.ReadString();
|
||||
|
||||
if (type != null)
|
||||
m_Type = ScriptCompiler.FindTypeByFullName(type);
|
||||
|
||||
m_Number = reader.ReadInt();
|
||||
m_Graphic = reader.ReadInt();
|
||||
m_RequireExceptional = reader.ReadBool();
|
||||
m_Material = (BulkMaterialType)reader.ReadInt();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (Weight == 0.0)
|
||||
Weight = 1.0;
|
||||
|
||||
if (Core.AOS && ItemID == 0x14EF)
|
||||
ItemID = 0x2258;
|
||||
|
||||
if (Parent == null && Map == Map.Internal && Location == Point3D.Zero)
|
||||
Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
93
Scripts/Services/BulkOrders/SmallBODs/SmallBODAcceptGump.cs
Normal file
93
Scripts/Services/BulkOrders/SmallBODs/SmallBODAcceptGump.cs
Normal file
@@ -0,0 +1,93 @@
|
||||
using System;
|
||||
using Server.Gumps;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class SmallBODAcceptGump : Gump
|
||||
{
|
||||
private readonly SmallBOD m_Deed;
|
||||
private readonly Mobile m_From;
|
||||
public SmallBODAcceptGump(Mobile from, SmallBOD deed)
|
||||
: base(50, 50)
|
||||
{
|
||||
m_From = from;
|
||||
m_Deed = deed;
|
||||
|
||||
m_From.CloseGump(typeof(LargeBODAcceptGump));
|
||||
m_From.CloseGump(typeof(SmallBODAcceptGump));
|
||||
|
||||
AddPage(0);
|
||||
|
||||
AddBackground(25, 10, 430, 264, 5054);
|
||||
|
||||
AddImageTiled(33, 20, 413, 245, 2624);
|
||||
AddAlphaRegion(33, 20, 413, 245);
|
||||
|
||||
AddImage(20, 5, 10460);
|
||||
AddImage(430, 5, 10460);
|
||||
AddImage(20, 249, 10460);
|
||||
AddImage(430, 249, 10460);
|
||||
|
||||
AddHtmlLocalized(190, 25, 120, 20, 1045133, 0x7FFF, false, false); // A bulk order
|
||||
AddHtmlLocalized(40, 48, 350, 20, 1045135, 0x7FFF, false, false); // Ah! Thanks for the goods! Would you help me out?
|
||||
|
||||
AddHtmlLocalized(40, 72, 210, 20, 1045138, 0x7FFF, false, false); // Amount to make:
|
||||
AddLabel(250, 72, 1152, deed.AmountMax.ToString());
|
||||
|
||||
AddHtmlLocalized(40, 96, 120, 20, 1045136, 0x7FFF, false, false); // Item requested:
|
||||
AddItem(385, 96, deed.Graphic, deed.GraphicHue);
|
||||
AddHtmlLocalized(40, 120, 210, 20, deed.Number, 0xFFFFFF, false, false);
|
||||
|
||||
if (deed.RequireExceptional || deed.Material != BulkMaterialType.None)
|
||||
{
|
||||
AddHtmlLocalized(40, 144, 210, 20, 1045140, 0x7FFF, false, false); // Special requirements to meet:
|
||||
|
||||
if (deed.RequireExceptional)
|
||||
AddHtmlLocalized(40, 168, 350, 20, 1045141, 0x7FFF, false, false); // All items must be exceptional.
|
||||
|
||||
if (deed.Material != BulkMaterialType.None)
|
||||
AddHtmlLocalized(40, deed.RequireExceptional ? 192 : 168, 350, 20, SmallBODGump.GetMaterialNumberFor(deed.Material), 0x7FFF, false, false); // All items must be made with x material.
|
||||
}
|
||||
|
||||
AddHtmlLocalized(40, 216, 350, 20, 1045139, 0x7FFF, false, false); // Do you want to accept this order?
|
||||
|
||||
AddButton(100, 240, 4005, 4007, 1, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(135, 240, 120, 20, 1006044, 0x7FFF, false, false); // Ok
|
||||
|
||||
AddButton(275, 240, 4005, 4007, 0, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(310, 240, 120, 20, 1011012, 0x7FFF, false, false); // CANCEL
|
||||
}
|
||||
|
||||
public override void OnServerClose(NetState owner)
|
||||
{
|
||||
Timer.DelayCall(() =>
|
||||
{
|
||||
if (m_Deed.Map == null || m_Deed.Map == Map.Internal)
|
||||
{
|
||||
m_Deed.Delete();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
if (info.ButtonID == 1) // Ok
|
||||
{
|
||||
if (m_From.PlaceInBackpack(m_Deed))
|
||||
{
|
||||
m_From.SendLocalizedMessage(1045152); // The bulk order deed has been placed in your backpack.
|
||||
}
|
||||
else
|
||||
{
|
||||
m_From.SendLocalizedMessage(1045150); // There is not enough room in your backpack for the deed.
|
||||
m_Deed.Delete();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Deed.Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
187
Scripts/Services/BulkOrders/SmallBODs/SmallBODGump.cs
Normal file
187
Scripts/Services/BulkOrders/SmallBODs/SmallBODGump.cs
Normal file
@@ -0,0 +1,187 @@
|
||||
using System;
|
||||
using Server.Gumps;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
using System.Collections.Generic;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class SmallBODGump : Gump
|
||||
{
|
||||
private readonly SmallBOD m_Deed;
|
||||
private readonly Mobile m_From;
|
||||
|
||||
public SmallBODGump(Mobile from, SmallBOD deed)
|
||||
: base(25, 25)
|
||||
{
|
||||
this.m_From = from;
|
||||
this.m_Deed = deed;
|
||||
|
||||
this.m_From.CloseGump(typeof(LargeBODGump));
|
||||
this.m_From.CloseGump(typeof(SmallBODGump));
|
||||
|
||||
this.AddPage(0);
|
||||
|
||||
int height = 0;
|
||||
|
||||
if (BulkOrderSystem.NewSystemEnabled)
|
||||
{
|
||||
if (deed.RequireExceptional || deed.Material != BulkMaterialType.None)
|
||||
height += 24;
|
||||
|
||||
if (deed.RequireExceptional)
|
||||
height += 24;
|
||||
|
||||
if (deed.Material != BulkMaterialType.None)
|
||||
height += 24;
|
||||
}
|
||||
|
||||
this.AddBackground(50, 10, 455, 245 + height, 5054);
|
||||
this.AddImageTiled(58, 20, 438, 226 + height, 2624);
|
||||
this.AddAlphaRegion(58, 20, 438, 226 + height);
|
||||
|
||||
this.AddImage(45, 5, 10460);
|
||||
this.AddImage(480, 5, 10460);
|
||||
this.AddImage(45, 230 + height, 10460);
|
||||
this.AddImage(480, 230 + height, 10460);
|
||||
|
||||
this.AddHtmlLocalized(225, 25, 120, 20, 1045133, 0x7FFF, false, false); // A bulk order
|
||||
|
||||
this.AddHtmlLocalized(75, 48, 250, 20, 1045138, 0x7FFF, false, false); // Amount to make:
|
||||
this.AddLabel(275, 48, 1152, deed.AmountMax.ToString());
|
||||
|
||||
this.AddHtmlLocalized(275, 76, 200, 20, 1045153, 0x7FFF, false, false); // Amount finished:
|
||||
this.AddHtmlLocalized(75, 72, 120, 20, 1045136, 0x7FFF, false, false); // Item requested:
|
||||
|
||||
this.AddItem(410, 72, deed.Graphic, deed.GraphicHue);
|
||||
|
||||
this.AddHtmlLocalized(75, 96, 210, 20, deed.Number, 0x7FFF, false, false);
|
||||
this.AddLabel(275, 96, 0x480, deed.AmountCur.ToString());
|
||||
|
||||
int y = 120;
|
||||
|
||||
if (deed.RequireExceptional || deed.Material != BulkMaterialType.None)
|
||||
{
|
||||
this.AddHtmlLocalized(75, y, 200, 20, 1045140, 0x7FFF, false, false); // Special requirements to meet:
|
||||
y += 24;
|
||||
}
|
||||
|
||||
if (deed.RequireExceptional)
|
||||
{
|
||||
this.AddHtmlLocalized(75, y, 300, 20, 1045141, 0x7FFF, false, false); // All items must be exceptional.
|
||||
y += 24;
|
||||
}
|
||||
|
||||
if (deed.Material != BulkMaterialType.None)
|
||||
{
|
||||
this.AddHtmlLocalized(75, y, 300, 20, GetMaterialNumberFor(deed.Material), 0x7FFF, false, false); // All items must be made with x material.
|
||||
y += 24;
|
||||
}
|
||||
|
||||
if (from is PlayerMobile && BulkOrderSystem.NewSystemEnabled)
|
||||
{
|
||||
BODContext c = BulkOrderSystem.GetContext((PlayerMobile)from);
|
||||
|
||||
int points = 0;
|
||||
double banked = 0.0;
|
||||
|
||||
BulkOrderSystem.ComputePoints(deed, out points, out banked);
|
||||
|
||||
AddHtmlLocalized(75, y, 300, 20, 1157301, String.Format("{0}\t{1}", points, banked.ToString("0.000000")), 0x7FFF, false, false); // Worth ~1_POINTS~ turn in points and ~2_POINTS~ bank points.
|
||||
y += 24;
|
||||
|
||||
AddButton(125, y, 4005, 4007, 3, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(160, y, 300, 20, c.PointsMode == PointsMode.Enabled ? 1157302 : c.PointsMode == PointsMode.Disabled ? 1157303 : 1157309, 0x7FFF, false, false); // Banking Points Enabled/Disabled/Automatic
|
||||
y += 24;
|
||||
|
||||
AddButton(125, y, 4005, 4007, 2, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(160, y, 300, 20, 1045154, 0x7FFF, false, false); // Combine this deed with the item requested.
|
||||
y += 24;
|
||||
|
||||
this.AddButton(125, y, 4005, 4007, 4, GumpButtonType.Reply, 0);
|
||||
this.AddHtmlLocalized(160, y, 300, 20, 1157304, 0x7FFF, false, false); // Combine this deed with contained items.
|
||||
y += 24;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.AddButton(125, y, 4005, 4007, 2, GumpButtonType.Reply, 0);
|
||||
this.AddHtmlLocalized(160, y, 300, 20, 1045154, 0x7FFF, false, false); // Combine this deed with the item requested.
|
||||
y += 24;
|
||||
}
|
||||
|
||||
this.AddButton(125, y, 4005, 4007, 1, GumpButtonType.Reply, 0);
|
||||
this.AddHtmlLocalized(160, y, 120, 20, 1011441, 0x7FFF, false, false); // EXIT
|
||||
}
|
||||
|
||||
public static int GetMaterialNumberFor(BulkMaterialType material)
|
||||
{
|
||||
if (material >= BulkMaterialType.DullCopper && material <= BulkMaterialType.Valorite)
|
||||
return 1045142 + (int)(material - BulkMaterialType.DullCopper);
|
||||
else if (material >= BulkMaterialType.Spined && material <= BulkMaterialType.Barbed)
|
||||
return 1049348 + (int)(material - BulkMaterialType.Spined);
|
||||
else if (material >= BulkMaterialType.OakWood && material <= BulkMaterialType.Frostwood)
|
||||
{
|
||||
switch (material)
|
||||
{
|
||||
case BulkMaterialType.OakWood: return 1071428;
|
||||
case BulkMaterialType.AshWood: return 1071429;
|
||||
case BulkMaterialType.YewWood: return 1071430;
|
||||
case BulkMaterialType.Heartwood: return 1071432;
|
||||
case BulkMaterialType.Bloodwood: return 1071431;
|
||||
case BulkMaterialType.Frostwood: return 1071433;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
if (this.m_Deed.Deleted || !this.m_Deed.IsChildOf(this.m_From.Backpack))
|
||||
return;
|
||||
|
||||
switch (info.ButtonID)
|
||||
{
|
||||
case 2: // Combine
|
||||
{
|
||||
this.m_From.SendGump(new SmallBODGump(this.m_From, this.m_Deed));
|
||||
this.m_Deed.BeginCombine(this.m_From);
|
||||
break;
|
||||
}
|
||||
case 3: // points mode
|
||||
{
|
||||
BODContext c = BulkOrderSystem.GetContext(m_From);
|
||||
|
||||
if (c != null)
|
||||
{
|
||||
switch (c.PointsMode)
|
||||
{
|
||||
case PointsMode.Enabled: c.PointsMode = PointsMode.Disabled; break;
|
||||
case PointsMode.Disabled: c.PointsMode = PointsMode.Automatic; break;
|
||||
case PointsMode.Automatic: c.PointsMode = PointsMode.Enabled; break;
|
||||
}
|
||||
}
|
||||
|
||||
m_From.SendGump(new SmallBODGump(this.m_From, this.m_Deed));
|
||||
break;
|
||||
}
|
||||
case 4: // combine from container
|
||||
{
|
||||
m_From.BeginTarget(-1, false, Server.Targeting.TargetFlags.None, (m, targeted) =>
|
||||
{
|
||||
if (!m_Deed.Deleted && targeted is Container)
|
||||
{
|
||||
List<Item> list = new List<Item>(((Container)targeted).Items);
|
||||
|
||||
foreach (Item item in list)
|
||||
{
|
||||
m_Deed.EndCombine(m_From, item);
|
||||
}
|
||||
}
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
23
Scripts/Services/BulkOrders/SmallBODs/SmallBODTarget.cs
Normal file
23
Scripts/Services/BulkOrders/SmallBODs/SmallBODTarget.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class SmallBODTarget : Target
|
||||
{
|
||||
private readonly SmallBOD m_Deed;
|
||||
public SmallBODTarget(SmallBOD deed)
|
||||
: base(18, false, TargetFlags.None)
|
||||
{
|
||||
this.m_Deed = deed;
|
||||
}
|
||||
|
||||
protected override void OnTarget(Mobile from, object targeted)
|
||||
{
|
||||
if (this.m_Deed.Deleted || !this.m_Deed.IsChildOf(from.Backpack))
|
||||
return;
|
||||
|
||||
this.m_Deed.EndCombine(from, targeted);
|
||||
}
|
||||
}
|
||||
}
|
||||
252
Scripts/Services/BulkOrders/SmallBODs/SmallBulkEntry.cs
Normal file
252
Scripts/Services/BulkOrders/SmallBODs/SmallBulkEntry.cs
Normal file
@@ -0,0 +1,252 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class SmallBulkEntry
|
||||
{
|
||||
private static Hashtable m_Cache;
|
||||
private Type m_Type;
|
||||
private int m_Number;
|
||||
private int m_Graphic;
|
||||
private int m_Hue;
|
||||
|
||||
public SmallBulkEntry(Type type, int number, int graphic, int hue)
|
||||
{
|
||||
m_Type = type;
|
||||
m_Number = number;
|
||||
m_Graphic = graphic;
|
||||
m_Hue = hue;
|
||||
}
|
||||
|
||||
public static SmallBulkEntry[] BlacksmithWeapons
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Blacksmith", "weapons");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] BlacksmithArmor
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Blacksmith", "armor");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] TailorCloth
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Tailoring", "cloth");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] TailorLeather
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Tailoring", "leather");
|
||||
}
|
||||
}
|
||||
#region Publish 95 BODs
|
||||
public static SmallBulkEntry[] TinkeringSmalls
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Tinkering", "smalls");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] TinkeringSmallsRegular
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Tinkering", "smallsregular");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] CarpentrySmalls
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Carpentry", "smalls");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] InscriptionSmalls
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Inscription", "smalls");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] CookingSmalls
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Cooking", "smalls");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] CookingSmallsRegular
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Cooking", "smallsregular");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] FletchingSmalls
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Fletching", "smalls");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] FletchingSmallsRegular
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Fletching", "smallsregular");
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] AlchemySmalls
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetEntries("Alchemy", "smalls");
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
public Type Type
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Type;
|
||||
}
|
||||
}
|
||||
public int Number
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Number;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_Number = value;
|
||||
}
|
||||
}
|
||||
public int Graphic
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Graphic;
|
||||
}
|
||||
}
|
||||
public int Hue
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Hue;
|
||||
}
|
||||
}
|
||||
public static SmallBulkEntry[] GetEntries(string type, string name)
|
||||
{
|
||||
if (m_Cache == null)
|
||||
m_Cache = new Hashtable();
|
||||
|
||||
Hashtable table = (Hashtable)m_Cache[type];
|
||||
|
||||
if (table == null)
|
||||
m_Cache[type] = table = new Hashtable();
|
||||
|
||||
SmallBulkEntry[] entries = (SmallBulkEntry[])table[name];
|
||||
|
||||
if (entries == null)
|
||||
table[name] = entries = LoadEntries(type, name);
|
||||
|
||||
return entries;
|
||||
}
|
||||
|
||||
public static SmallBulkEntry[] LoadEntries(string type, string name)
|
||||
{
|
||||
return LoadEntries(String.Format("Data/Bulk Orders/{0}/{1}.cfg", type, name));
|
||||
}
|
||||
|
||||
public static SmallBulkEntry[] LoadEntries(string path)
|
||||
{
|
||||
path = Path.Combine(Core.BaseDirectory, path);
|
||||
|
||||
List<SmallBulkEntry> list = new List<SmallBulkEntry>();
|
||||
|
||||
if (File.Exists(path))
|
||||
{
|
||||
using (StreamReader ip = new StreamReader(path))
|
||||
{
|
||||
string line;
|
||||
|
||||
while ((line = ip.ReadLine()) != null)
|
||||
{
|
||||
/* arg 1 - Type
|
||||
* arg 2 - ItemID
|
||||
* arg 3 - Cliloc
|
||||
* arg 4 - hue
|
||||
*/
|
||||
|
||||
if (line.Length == 0 || line.StartsWith("#"))
|
||||
continue;
|
||||
|
||||
try
|
||||
{
|
||||
string[] split = line.Split(',');
|
||||
|
||||
if (split.Length <= 2)
|
||||
{
|
||||
Type type = ScriptCompiler.FindTypeByName(split[0]);
|
||||
int graphic = Utility.ToInt32(split[1]);
|
||||
|
||||
if (type != null && graphic > 0)
|
||||
{
|
||||
list.Add(new SmallBulkEntry(type, graphic < 0x4000 ? 1020000 + graphic : 1078872 + graphic, graphic, 0));
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Error Loading BOD Entry at {2}, [Type: {0}], [graphic: {1}]", split[0], graphic.ToString(), path);
|
||||
}
|
||||
}
|
||||
else if (split.Length >= 3)
|
||||
{
|
||||
int name, hue;
|
||||
|
||||
Type type = ScriptCompiler.FindTypeByName(split[0]);
|
||||
int graphic = Utility.ToInt32(split[1]);
|
||||
|
||||
name = Utility.ToInt32(split[2]);
|
||||
|
||||
if (split.Length >= 4)
|
||||
{
|
||||
hue = Utility.ToInt32(split[3]);
|
||||
}
|
||||
else
|
||||
{
|
||||
hue = 0;
|
||||
}
|
||||
|
||||
if (type != null && graphic > 0)
|
||||
{
|
||||
list.Add(new SmallBulkEntry(type, name, graphic, hue));
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Error Loading BOD Entry at {2}, [Type: {0}], [graphic: {1}]", split[0], graphic.ToString(), path);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
Console.WriteLine(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return list.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
190
Scripts/Services/BulkOrders/SmallBODs/SmallCarpentryBOD.cs
Normal file
190
Scripts/Services/BulkOrders/SmallBODs/SmallCarpentryBOD.cs
Normal file
@@ -0,0 +1,190 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.Engines.Craft;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class SmallCarpentryBOD : SmallBOD
|
||||
{
|
||||
public static double[] m_CarpentryMaterialChances = new double[]
|
||||
{
|
||||
0.513718750, // None
|
||||
0.292968750, // Oak
|
||||
0.117187500, // Ash
|
||||
0.046875000, // Yew
|
||||
0.018750000, // Heartwood
|
||||
0.007500000, // Bloodwood
|
||||
0.003000000 // Frostwood
|
||||
};
|
||||
|
||||
public override BODType BODType { get { return BODType.Carpentry; } }
|
||||
|
||||
[Constructable]
|
||||
public SmallCarpentryBOD()
|
||||
{
|
||||
SmallBulkEntry[] entries;
|
||||
bool useMaterials = Utility.RandomBool();
|
||||
|
||||
entries = SmallBulkEntry.CarpentrySmalls;
|
||||
|
||||
if (entries.Length > 0)
|
||||
{
|
||||
int amountMax = Utility.RandomList(10, 15, 20);
|
||||
|
||||
BulkMaterialType material = BulkMaterialType.None;
|
||||
|
||||
if(useMaterials)
|
||||
material = GetRandomMaterial(BulkMaterialType.OakWood, m_CarpentryMaterialChances);
|
||||
|
||||
bool reqExceptional = Utility.RandomBool() || (material == BulkMaterialType.None);
|
||||
|
||||
SmallBulkEntry entry = entries[Utility.Random(entries.Length)];
|
||||
|
||||
this.Hue = 1512;
|
||||
this.AmountMax = amountMax;
|
||||
this.Type = entry.Type;
|
||||
this.Number = entry.Number;
|
||||
this.Graphic = entry.Graphic;
|
||||
this.RequireExceptional = reqExceptional;
|
||||
this.Material = material;
|
||||
this.GraphicHue = entry.Hue;
|
||||
}
|
||||
}
|
||||
|
||||
public SmallCarpentryBOD(int amountCur, int amountMax, Type type, int number, int graphic, bool reqExceptional, BulkMaterialType mat, int hue)
|
||||
{
|
||||
this.Hue = 1512;
|
||||
this.AmountMax = amountMax;
|
||||
this.AmountCur = amountCur;
|
||||
this.Type = type;
|
||||
this.Number = number;
|
||||
this.Graphic = graphic;
|
||||
this.RequireExceptional = reqExceptional;
|
||||
this.Material = mat;
|
||||
this.GraphicHue = hue;
|
||||
}
|
||||
|
||||
public SmallCarpentryBOD(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
private SmallCarpentryBOD(SmallBulkEntry entry, BulkMaterialType material, int amountMax, bool reqExceptional)
|
||||
{
|
||||
this.Hue = 1512;
|
||||
this.AmountMax = amountMax;
|
||||
this.Type = entry.Type;
|
||||
this.Number = entry.Number;
|
||||
this.Graphic = entry.Graphic;
|
||||
this.RequireExceptional = reqExceptional;
|
||||
this.Material = material;
|
||||
}
|
||||
|
||||
public static SmallCarpentryBOD CreateRandomFor(Mobile m)
|
||||
{
|
||||
SmallBulkEntry[] entries;
|
||||
bool useMaterials = Utility.RandomBool();
|
||||
|
||||
double theirSkill = BulkOrderSystem.GetBODSkill(m, SkillName.Carpentry);
|
||||
|
||||
entries = SmallBulkEntry.CarpentrySmalls;
|
||||
|
||||
if (entries.Length > 0)
|
||||
{
|
||||
int amountMax;
|
||||
|
||||
if (theirSkill >= 70.1)
|
||||
amountMax = Utility.RandomList(10, 15, 20, 20);
|
||||
else if (theirSkill >= 50.1)
|
||||
amountMax = Utility.RandomList(10, 15, 15, 20);
|
||||
else
|
||||
amountMax = Utility.RandomList(10, 10, 15, 20);
|
||||
|
||||
BulkMaterialType material = BulkMaterialType.None;
|
||||
|
||||
if (useMaterials && theirSkill >= 70.1)
|
||||
{
|
||||
for (int i = 0; i < 20; ++i)
|
||||
{
|
||||
BulkMaterialType check = GetRandomMaterial(BulkMaterialType.OakWood, m_CarpentryMaterialChances);
|
||||
double skillReq = GetRequiredSkill(check);
|
||||
|
||||
if (theirSkill >= skillReq)
|
||||
{
|
||||
material = check;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
double excChance = 0.0;
|
||||
|
||||
if (theirSkill >= 70.1)
|
||||
excChance = (theirSkill + 80.0) / 200.0;
|
||||
|
||||
bool reqExceptional = (excChance > Utility.RandomDouble());
|
||||
|
||||
CraftSystem system = DefCarpentry.CraftSystem;
|
||||
|
||||
List<SmallBulkEntry> validEntries = new List<SmallBulkEntry>();
|
||||
|
||||
for (int i = 0; i < entries.Length; ++i)
|
||||
{
|
||||
CraftItem item = system.CraftItems.SearchFor(entries[i].Type);
|
||||
|
||||
if (item != null)
|
||||
{
|
||||
bool allRequiredSkills = true;
|
||||
double chance = item.GetSuccessChance(m, null, system, false, ref allRequiredSkills);
|
||||
|
||||
if (allRequiredSkills && chance >= 0.0)
|
||||
{
|
||||
if (reqExceptional)
|
||||
chance = item.GetExceptionalChance(system, chance, m);
|
||||
|
||||
if (chance > 0.0)
|
||||
validEntries.Add(entries[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (validEntries.Count > 0)
|
||||
{
|
||||
SmallBulkEntry entry = validEntries[Utility.Random(validEntries.Count)];
|
||||
return new SmallCarpentryBOD(entry, material, amountMax, reqExceptional);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public override int ComputeFame()
|
||||
{
|
||||
return CarpentryRewardCalculator.Instance.ComputeFame(this);
|
||||
}
|
||||
|
||||
public override int ComputeGold()
|
||||
{
|
||||
return CarpentryRewardCalculator.Instance.ComputeGold(this);
|
||||
}
|
||||
|
||||
public override List<Item> ComputeRewards(bool full)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
211
Scripts/Services/BulkOrders/SmallBODs/SmallCookingBOD.cs
Normal file
211
Scripts/Services/BulkOrders/SmallBODs/SmallCookingBOD.cs
Normal file
@@ -0,0 +1,211 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.Engines.Craft;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class SmallCookingBOD : SmallBOD
|
||||
{
|
||||
public override BODType BODType { get { return BODType.Cooking; } }
|
||||
|
||||
[Constructable]
|
||||
public SmallCookingBOD()
|
||||
{
|
||||
SmallBulkEntry[] entries;
|
||||
bool nonexceptional = false;
|
||||
|
||||
if (0.20 > Utility.RandomDouble())
|
||||
{
|
||||
nonexceptional = true;
|
||||
entries = SmallBulkEntry.CookingSmallsRegular;
|
||||
}
|
||||
else
|
||||
{
|
||||
entries = SmallBulkEntry.CookingSmalls;
|
||||
}
|
||||
|
||||
if (entries.Length > 0)
|
||||
{
|
||||
int amountMax = Utility.RandomList(10, 15, 20);
|
||||
|
||||
BulkMaterialType material;
|
||||
material = BulkMaterialType.None;
|
||||
|
||||
SmallBulkEntry entry = entries[Utility.Random(entries.Length)];
|
||||
|
||||
Hue = 1169;
|
||||
AmountMax = amountMax;
|
||||
Type = entry.Type;
|
||||
Number = entry.Number;
|
||||
Graphic = entry.Graphic;
|
||||
Material = material;
|
||||
RequireExceptional = !nonexceptional && Utility.RandomBool();
|
||||
GraphicHue = entry.Hue;
|
||||
}
|
||||
}
|
||||
|
||||
public SmallCookingBOD(int amountCur, int amountMax, Type type, int number, int graphic, bool reqExceptional, BulkMaterialType mat, int hue)
|
||||
{
|
||||
Hue = 1169;
|
||||
AmountMax = amountMax;
|
||||
AmountCur = amountCur;
|
||||
Type = type;
|
||||
Number = number;
|
||||
Graphic = graphic;
|
||||
RequireExceptional = reqExceptional;
|
||||
Material = mat;
|
||||
GraphicHue = hue;
|
||||
}
|
||||
|
||||
public SmallCookingBOD(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
private SmallCookingBOD(SmallBulkEntry entry, int amountMax)
|
||||
{
|
||||
Hue = 1169;
|
||||
AmountMax = amountMax;
|
||||
Type = entry.Type;
|
||||
Number = entry.Number;
|
||||
Graphic = entry.Graphic;
|
||||
GraphicHue = entry.Hue;
|
||||
}
|
||||
|
||||
private SmallCookingBOD(SmallBulkEntry entry, int amountMax, bool reqExceptional)
|
||||
{
|
||||
Hue = 1169;
|
||||
AmountMax = amountMax;
|
||||
Type = entry.Type;
|
||||
Number = entry.Number;
|
||||
Graphic = entry.Graphic;
|
||||
GraphicHue = entry.Hue;
|
||||
RequireExceptional = reqExceptional;
|
||||
}
|
||||
|
||||
public static SmallCookingBOD CreateRandomFor(Mobile m)
|
||||
{
|
||||
SmallBulkEntry[] entries;
|
||||
|
||||
double theirSkill = BulkOrderSystem.GetBODSkill(m, SkillName.Cooking);
|
||||
bool nonexceptional = false;
|
||||
|
||||
if (0.20 > Utility.RandomDouble())
|
||||
{
|
||||
nonexceptional = true;
|
||||
entries = SmallBulkEntry.CookingSmallsRegular;
|
||||
}
|
||||
else
|
||||
{
|
||||
entries = SmallBulkEntry.CookingSmalls;
|
||||
}
|
||||
|
||||
if (entries.Length > 0)
|
||||
{
|
||||
int amountMax;
|
||||
|
||||
if (theirSkill >= 70.1)
|
||||
amountMax = Utility.RandomList(10, 15, 20, 20);
|
||||
else if (theirSkill >= 50.1)
|
||||
amountMax = Utility.RandomList(10, 15, 15, 20);
|
||||
else
|
||||
amountMax = Utility.RandomList(10, 10, 15, 20);
|
||||
|
||||
double excChance = 0.0;
|
||||
|
||||
if (theirSkill >= 70.1)
|
||||
excChance = (theirSkill + 80.0) / 200.0;
|
||||
|
||||
bool reqExceptional = !nonexceptional && excChance > Utility.RandomDouble();
|
||||
|
||||
CraftSystem system = DefCooking.CraftSystem;
|
||||
|
||||
List<SmallBulkEntry> validEntries = new List<SmallBulkEntry>();
|
||||
|
||||
for (int i = 0; i < entries.Length; ++i)
|
||||
{
|
||||
CraftItem item = system.CraftItems.SearchFor(entries[i].Type);
|
||||
|
||||
if (item != null)
|
||||
{
|
||||
bool allRequiredSkills = true;
|
||||
double chance = item.GetSuccessChance(m, null, system, false, ref allRequiredSkills);
|
||||
|
||||
if (allRequiredSkills && chance >= 0.0)
|
||||
{
|
||||
if (chance > 0.0)
|
||||
validEntries.Add(entries[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (validEntries.Count > 0)
|
||||
{
|
||||
SmallBulkEntry entry = validEntries[Utility.Random(validEntries.Count)];
|
||||
return new SmallCookingBOD(entry, amountMax, reqExceptional);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public override int ComputeFame()
|
||||
{
|
||||
return CookingRewardCalculator.Instance.ComputeFame(this);
|
||||
}
|
||||
|
||||
public override int ComputeGold()
|
||||
{
|
||||
return CookingRewardCalculator.Instance.ComputeGold(this);
|
||||
}
|
||||
|
||||
public override List<Item> ComputeRewards(bool full)
|
||||
{
|
||||
List<Item> list = new List<Item>();
|
||||
|
||||
RewardGroup rewardGroup = CookingRewardCalculator.Instance.LookupRewards(CookingRewardCalculator.Instance.ComputePoints(this));
|
||||
|
||||
if (rewardGroup != null)
|
||||
{
|
||||
if (full)
|
||||
{
|
||||
for (int i = 0; i < rewardGroup.Items.Length; ++i)
|
||||
{
|
||||
Item item = rewardGroup.Items[i].Construct();
|
||||
|
||||
if (item != null)
|
||||
list.Add(item);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RewardItem rewardItem = rewardGroup.AcquireItem();
|
||||
|
||||
if (rewardItem != null)
|
||||
{
|
||||
Item item = rewardItem.Construct();
|
||||
|
||||
if (item != null)
|
||||
list.Add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
242
Scripts/Services/BulkOrders/SmallBODs/SmallFletchingBOD.cs
Normal file
242
Scripts/Services/BulkOrders/SmallBODs/SmallFletchingBOD.cs
Normal file
@@ -0,0 +1,242 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.Engines.Craft;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class SmallFletchingBOD : SmallBOD
|
||||
{
|
||||
public static double[] m_FletchingMaterialChances = new double[]
|
||||
{
|
||||
0.513718750, // None
|
||||
0.292968750, // Oak
|
||||
0.117187500, // Ash
|
||||
0.046875000, // Yew
|
||||
0.018750000, // Heartwood
|
||||
0.007500000, // Bloodwood
|
||||
0.003000000 // Frostwood
|
||||
};
|
||||
|
||||
public override BODType BODType { get { return BODType.Fletching; } }
|
||||
|
||||
[Constructable]
|
||||
public SmallFletchingBOD()
|
||||
{
|
||||
SmallBulkEntry[] entries;
|
||||
bool useMaterials = false;
|
||||
|
||||
if (0.20 > Utility.RandomDouble())
|
||||
{
|
||||
entries = SmallBulkEntry.FletchingSmallsRegular;
|
||||
}
|
||||
else
|
||||
{
|
||||
useMaterials = true;
|
||||
entries = SmallBulkEntry.FletchingSmalls;
|
||||
}
|
||||
|
||||
if (entries.Length > 0)
|
||||
{
|
||||
SmallBulkEntry entry = entries[Utility.Random(entries.Length)];
|
||||
|
||||
int amountMax = Utility.RandomList(10, 15, 20);
|
||||
|
||||
BulkMaterialType material;
|
||||
|
||||
if (useMaterials)
|
||||
material = GetRandomMaterial(BulkMaterialType.OakWood, m_FletchingMaterialChances);
|
||||
else
|
||||
material = BulkMaterialType.None;
|
||||
|
||||
bool reqExceptional = false;
|
||||
|
||||
if(useMaterials)
|
||||
reqExceptional = Utility.RandomBool() || (material == BulkMaterialType.None);
|
||||
|
||||
this.Hue = 1425;
|
||||
this.AmountMax = amountMax;
|
||||
this.Type = entry.Type;
|
||||
this.Number = entry.Number;
|
||||
this.Graphic = entry.Graphic;
|
||||
this.RequireExceptional = reqExceptional;
|
||||
this.Material = material;
|
||||
this.GraphicHue = entry.Hue;
|
||||
}
|
||||
}
|
||||
|
||||
public SmallFletchingBOD(int amountCur, int amountMax, Type type, int number, int graphic, bool reqExceptional, BulkMaterialType mat, int hue)
|
||||
{
|
||||
this.Hue = 1425;
|
||||
this.AmountMax = amountMax;
|
||||
this.AmountCur = amountCur;
|
||||
this.Type = type;
|
||||
this.Number = number;
|
||||
this.Graphic = graphic;
|
||||
this.RequireExceptional = reqExceptional;
|
||||
this.Material = mat;
|
||||
this.GraphicHue = hue;
|
||||
}
|
||||
|
||||
public SmallFletchingBOD(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
private SmallFletchingBOD(SmallBulkEntry entry, BulkMaterialType material, int amountMax, bool reqExceptional)
|
||||
{
|
||||
this.Hue = 1425;
|
||||
this.AmountMax = amountMax;
|
||||
this.Type = entry.Type;
|
||||
this.Number = entry.Number;
|
||||
this.Graphic = entry.Graphic;
|
||||
this.RequireExceptional = reqExceptional;
|
||||
this.Material = material;
|
||||
}
|
||||
|
||||
public static SmallFletchingBOD CreateRandomFor(Mobile m)
|
||||
{
|
||||
SmallBulkEntry[] entries;
|
||||
|
||||
double theirSkill = BulkOrderSystem.GetBODSkill(m, SkillName.Fletching);
|
||||
bool useMaterials = false;
|
||||
|
||||
if (theirSkill < 30.0 || .20 > Utility.RandomDouble())
|
||||
{
|
||||
entries = SmallBulkEntry.FletchingSmallsRegular;
|
||||
}
|
||||
else
|
||||
{
|
||||
useMaterials = true;
|
||||
entries = SmallBulkEntry.FletchingSmalls;
|
||||
}
|
||||
|
||||
if (entries.Length > 0)
|
||||
{
|
||||
int amountMax;
|
||||
|
||||
if (theirSkill >= 70.1)
|
||||
amountMax = Utility.RandomList(10, 15, 20, 20);
|
||||
else if (theirSkill >= 50.1)
|
||||
amountMax = Utility.RandomList(10, 15, 15, 20);
|
||||
else
|
||||
amountMax = Utility.RandomList(10, 10, 15, 20);
|
||||
|
||||
BulkMaterialType material = BulkMaterialType.None;
|
||||
|
||||
if (useMaterials && theirSkill >= 70.1)
|
||||
{
|
||||
for (int i = 0; i < 20; ++i)
|
||||
{
|
||||
BulkMaterialType check = GetRandomMaterial(BulkMaterialType.OakWood, m_FletchingMaterialChances);
|
||||
double skillReq = GetRequiredSkill(check);
|
||||
|
||||
if (theirSkill >= skillReq)
|
||||
{
|
||||
material = check;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
double excChance = 0.0;
|
||||
|
||||
if (theirSkill >= 70.1)
|
||||
excChance = (theirSkill + 80.0) / 200.0;
|
||||
|
||||
bool reqExceptional = useMaterials && excChance > Utility.RandomDouble();
|
||||
|
||||
CraftSystem system = DefBowFletching.CraftSystem;
|
||||
|
||||
List<SmallBulkEntry> validEntries = new List<SmallBulkEntry>();
|
||||
|
||||
for (int i = 0; i < entries.Length; ++i)
|
||||
{
|
||||
CraftItem item = system.CraftItems.SearchFor(entries[i].Type);
|
||||
|
||||
if (item != null)
|
||||
{
|
||||
bool allRequiredSkills = true;
|
||||
double chance = item.GetSuccessChance(m, null, system, false, ref allRequiredSkills);
|
||||
|
||||
if (allRequiredSkills && chance >= 0.0)
|
||||
{
|
||||
if (reqExceptional)
|
||||
chance = item.GetExceptionalChance(system, chance, m);
|
||||
|
||||
if (chance > 0.0)
|
||||
validEntries.Add(entries[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (validEntries.Count > 0)
|
||||
{
|
||||
SmallBulkEntry entry = validEntries[Utility.Random(validEntries.Count)];
|
||||
return new SmallFletchingBOD(entry, material, amountMax, reqExceptional);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public override int ComputeFame()
|
||||
{
|
||||
return FletchingRewardCalculator.Instance.ComputeFame(this);
|
||||
}
|
||||
|
||||
public override int ComputeGold()
|
||||
{
|
||||
return FletchingRewardCalculator.Instance.ComputeGold(this);
|
||||
}
|
||||
|
||||
public override List<Item> ComputeRewards(bool full)
|
||||
{
|
||||
List<Item> list = new List<Item>();
|
||||
|
||||
RewardGroup rewardGroup = FletchingRewardCalculator.Instance.LookupRewards(FletchingRewardCalculator.Instance.ComputePoints(this));
|
||||
|
||||
if (rewardGroup != null)
|
||||
{
|
||||
if (full)
|
||||
{
|
||||
for (int i = 0; i < rewardGroup.Items.Length; ++i)
|
||||
{
|
||||
Item item = rewardGroup.Items[i].Construct();
|
||||
|
||||
if (item != null)
|
||||
list.Add(item);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RewardItem rewardItem = rewardGroup.AcquireItem();
|
||||
|
||||
if (rewardItem != null)
|
||||
{
|
||||
Item item = rewardItem.Construct();
|
||||
|
||||
if (item != null)
|
||||
list.Add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
172
Scripts/Services/BulkOrders/SmallBODs/SmallInscriptionBOD.cs
Normal file
172
Scripts/Services/BulkOrders/SmallBODs/SmallInscriptionBOD.cs
Normal file
@@ -0,0 +1,172 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.Engines.Craft;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class SmallInscriptionBOD : SmallBOD
|
||||
{
|
||||
public override BODType BODType { get { return BODType.Inscription; } }
|
||||
|
||||
[Constructable]
|
||||
public SmallInscriptionBOD()
|
||||
{
|
||||
SmallBulkEntry[] entries = SmallBulkEntry.InscriptionSmalls;
|
||||
|
||||
if (entries.Length > 0)
|
||||
{
|
||||
int amountMax = Utility.RandomList(10, 15, 20);
|
||||
|
||||
BulkMaterialType material;
|
||||
material = BulkMaterialType.None;
|
||||
|
||||
SmallBulkEntry entry = entries[Utility.Random(entries.Length)];
|
||||
|
||||
this.Hue = 2598;
|
||||
this.AmountMax = amountMax;
|
||||
this.Type = entry.Type;
|
||||
this.Number = entry.Number;
|
||||
this.Graphic = entry.Graphic;
|
||||
this.Material = material;
|
||||
this.GraphicHue = entry.Hue;
|
||||
}
|
||||
}
|
||||
|
||||
public SmallInscriptionBOD(int amountCur, int amountMax, Type type, int number, int graphic, bool reqExceptional, BulkMaterialType mat, int hue)
|
||||
{
|
||||
this.Hue = 2598;
|
||||
this.AmountMax = amountMax;
|
||||
this.AmountCur = amountCur;
|
||||
this.Type = type;
|
||||
this.Number = number;
|
||||
this.Graphic = graphic;
|
||||
this.RequireExceptional = reqExceptional;
|
||||
this.Material = mat;
|
||||
this.GraphicHue = hue;
|
||||
}
|
||||
|
||||
public SmallInscriptionBOD(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
private SmallInscriptionBOD(SmallBulkEntry entry, int amountMax)
|
||||
{
|
||||
this.Hue = 2598;
|
||||
this.AmountMax = amountMax;
|
||||
this.Type = entry.Type;
|
||||
this.Number = entry.Number;
|
||||
this.Graphic = entry.Graphic;
|
||||
this.GraphicHue = entry.Hue;
|
||||
}
|
||||
|
||||
public static SmallInscriptionBOD CreateRandomFor(Mobile m)
|
||||
{
|
||||
SmallBulkEntry[] entries;
|
||||
|
||||
double theirSkill = BulkOrderSystem.GetBODSkill(m, SkillName.Inscribe);
|
||||
|
||||
entries = SmallBulkEntry.InscriptionSmalls;
|
||||
|
||||
if (entries.Length > 0)
|
||||
{
|
||||
int amountMax;
|
||||
|
||||
if (theirSkill >= 70.1)
|
||||
amountMax = Utility.RandomList(10, 15, 20, 20);
|
||||
else if (theirSkill >= 50.1)
|
||||
amountMax = Utility.RandomList(10, 15, 15, 20);
|
||||
else
|
||||
amountMax = Utility.RandomList(10, 10, 15, 20);
|
||||
|
||||
CraftSystem system = DefInscription.CraftSystem;
|
||||
|
||||
List<SmallBulkEntry> validEntries = new List<SmallBulkEntry>();
|
||||
|
||||
for (int i = 0; i < entries.Length; ++i)
|
||||
{
|
||||
CraftItem item = system.CraftItems.SearchFor(entries[i].Type);
|
||||
|
||||
if (item != null)
|
||||
{
|
||||
bool allRequiredSkills = true;
|
||||
double chance = item.GetSuccessChance(m, null, system, false, ref allRequiredSkills);
|
||||
|
||||
if (allRequiredSkills && chance >= 0.0)
|
||||
{
|
||||
if (chance > 0.0)
|
||||
validEntries.Add(entries[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (validEntries.Count > 0)
|
||||
{
|
||||
SmallBulkEntry entry = validEntries[Utility.Random(validEntries.Count)];
|
||||
return new SmallInscriptionBOD(entry, amountMax);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public override int ComputeFame()
|
||||
{
|
||||
return InscriptionRewardCalculator.Instance.ComputeFame(this);
|
||||
}
|
||||
|
||||
public override int ComputeGold()
|
||||
{
|
||||
return InscriptionRewardCalculator.Instance.ComputeGold(this);
|
||||
}
|
||||
|
||||
public override List<Item> ComputeRewards(bool full)
|
||||
{
|
||||
List<Item> list = new List<Item>();
|
||||
|
||||
RewardGroup rewardGroup = InscriptionRewardCalculator.Instance.LookupRewards(InscriptionRewardCalculator.Instance.ComputePoints(this));
|
||||
|
||||
if (rewardGroup != null)
|
||||
{
|
||||
if (full)
|
||||
{
|
||||
for (int i = 0; i < rewardGroup.Items.Length; ++i)
|
||||
{
|
||||
Item item = rewardGroup.Items[i].Construct();
|
||||
|
||||
if (item != null)
|
||||
list.Add(item);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RewardItem rewardItem = rewardGroup.AcquireItem();
|
||||
|
||||
if (rewardItem != null)
|
||||
{
|
||||
Item item = rewardItem.Construct();
|
||||
|
||||
if (item != null)
|
||||
list.Add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
230
Scripts/Services/BulkOrders/SmallBODs/SmallSmithBOD.cs
Normal file
230
Scripts/Services/BulkOrders/SmallBODs/SmallSmithBOD.cs
Normal file
@@ -0,0 +1,230 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.Engines.Craft;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
[TypeAlias("Scripts.Engines.BulkOrders.SmallSmithBOD")]
|
||||
public class SmallSmithBOD : SmallBOD
|
||||
{
|
||||
public override BODType BODType { get { return BODType.Smith; } }
|
||||
|
||||
public static double[] m_BlacksmithMaterialChances = new double[]
|
||||
{
|
||||
0.501953125, // None
|
||||
0.250000000, // Dull Copper
|
||||
0.125000000, // Shadow Iron
|
||||
0.062500000, // Copper
|
||||
0.031250000, // Bronze
|
||||
0.015625000, // Gold
|
||||
0.007812500, // Agapite
|
||||
0.003906250, // Verite
|
||||
0.001953125 // Valorite
|
||||
};
|
||||
[Constructable]
|
||||
public SmallSmithBOD()
|
||||
{
|
||||
SmallBulkEntry[] entries;
|
||||
bool useMaterials;
|
||||
|
||||
if (useMaterials = Utility.RandomBool())
|
||||
entries = SmallBulkEntry.BlacksmithArmor;
|
||||
else
|
||||
entries = SmallBulkEntry.BlacksmithWeapons;
|
||||
|
||||
if (entries.Length > 0)
|
||||
{
|
||||
int hue = 0x44E;
|
||||
int amountMax = Utility.RandomList(10, 15, 20);
|
||||
|
||||
BulkMaterialType material;
|
||||
|
||||
if (useMaterials)
|
||||
material = GetRandomMaterial(BulkMaterialType.DullCopper, m_BlacksmithMaterialChances);
|
||||
else
|
||||
material = BulkMaterialType.None;
|
||||
|
||||
bool reqExceptional = Utility.RandomBool() || (material == BulkMaterialType.None);
|
||||
|
||||
SmallBulkEntry entry = entries[Utility.Random(entries.Length)];
|
||||
|
||||
Hue = hue;
|
||||
AmountMax = amountMax;
|
||||
Type = entry.Type;
|
||||
Number = entry.Number;
|
||||
Graphic = entry.Graphic;
|
||||
RequireExceptional = reqExceptional;
|
||||
Material = material;
|
||||
GraphicHue = entry.Hue;
|
||||
}
|
||||
}
|
||||
|
||||
public SmallSmithBOD(int amountCur, int amountMax, Type type, int number, int graphic, bool reqExceptional, BulkMaterialType mat, int hue)
|
||||
{
|
||||
Hue = 0x44E;
|
||||
AmountMax = amountMax;
|
||||
AmountCur = amountCur;
|
||||
Type = type;
|
||||
Number = number;
|
||||
Graphic = graphic;
|
||||
RequireExceptional = reqExceptional;
|
||||
Material = mat;
|
||||
GraphicHue = hue;
|
||||
}
|
||||
|
||||
public SmallSmithBOD(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
private SmallSmithBOD(SmallBulkEntry entry, BulkMaterialType material, int amountMax, bool reqExceptional)
|
||||
{
|
||||
Hue = 0x44E;
|
||||
AmountMax = amountMax;
|
||||
Type = entry.Type;
|
||||
Number = entry.Number;
|
||||
Graphic = entry.Graphic;
|
||||
RequireExceptional = reqExceptional;
|
||||
Material = material;
|
||||
}
|
||||
|
||||
public static SmallSmithBOD CreateRandomFor(Mobile m)
|
||||
{
|
||||
SmallBulkEntry[] entries;
|
||||
bool useMaterials;
|
||||
|
||||
if (useMaterials = Utility.RandomBool())
|
||||
entries = SmallBulkEntry.BlacksmithArmor;
|
||||
else
|
||||
entries = SmallBulkEntry.BlacksmithWeapons;
|
||||
|
||||
if (entries.Length > 0)
|
||||
{
|
||||
double theirSkill = BulkOrderSystem.GetBODSkill(m, SkillName.Blacksmith);
|
||||
int amountMax;
|
||||
|
||||
if (theirSkill >= 70.1)
|
||||
amountMax = Utility.RandomList(10, 15, 20, 20);
|
||||
else if (theirSkill >= 50.1)
|
||||
amountMax = Utility.RandomList(10, 15, 15, 20);
|
||||
else
|
||||
amountMax = Utility.RandomList(10, 10, 15, 20);
|
||||
|
||||
BulkMaterialType material = BulkMaterialType.None;
|
||||
|
||||
if (useMaterials && theirSkill >= 70.1)
|
||||
{
|
||||
for (int i = 0; i < 20; ++i)
|
||||
{
|
||||
BulkMaterialType check = GetRandomMaterial(BulkMaterialType.DullCopper, m_BlacksmithMaterialChances);
|
||||
double skillReq = GetRequiredSkill(check);
|
||||
|
||||
if (theirSkill >= skillReq)
|
||||
{
|
||||
material = check;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
double excChance = 0.0;
|
||||
|
||||
if (theirSkill >= 70.1)
|
||||
excChance = (theirSkill + 80.0) / 200.0;
|
||||
|
||||
bool reqExceptional = (excChance > Utility.RandomDouble());
|
||||
|
||||
CraftSystem system = DefBlacksmithy.CraftSystem;
|
||||
|
||||
List<SmallBulkEntry> validEntries = new List<SmallBulkEntry>();
|
||||
|
||||
for (int i = 0; i < entries.Length; ++i)
|
||||
{
|
||||
CraftItem item = system.CraftItems.SearchFor(entries[i].Type);
|
||||
|
||||
if (item != null)
|
||||
{
|
||||
bool allRequiredSkills = true;
|
||||
double chance = item.GetSuccessChance(m, null, system, false, ref allRequiredSkills);
|
||||
|
||||
if (allRequiredSkills && chance >= 0.0)
|
||||
{
|
||||
if (reqExceptional)
|
||||
chance = item.GetExceptionalChance(system, chance, m);
|
||||
|
||||
if (chance > 0.0)
|
||||
validEntries.Add(entries[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (validEntries.Count > 0)
|
||||
{
|
||||
SmallBulkEntry entry = validEntries[Utility.Random(validEntries.Count)];
|
||||
return new SmallSmithBOD(entry, material, amountMax, reqExceptional);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public override int ComputeFame()
|
||||
{
|
||||
return SmithRewardCalculator.Instance.ComputeFame(this);
|
||||
}
|
||||
|
||||
public override int ComputeGold()
|
||||
{
|
||||
return SmithRewardCalculator.Instance.ComputeGold(this);
|
||||
}
|
||||
|
||||
public override List<Item> ComputeRewards(bool full)
|
||||
{
|
||||
List<Item> list = new List<Item>();
|
||||
|
||||
RewardGroup rewardGroup = SmithRewardCalculator.Instance.LookupRewards(SmithRewardCalculator.Instance.ComputePoints(this));
|
||||
|
||||
if (rewardGroup != null)
|
||||
{
|
||||
if (full)
|
||||
{
|
||||
for (int i = 0; i < rewardGroup.Items.Length; ++i)
|
||||
{
|
||||
Item item = rewardGroup.Items[i].Construct();
|
||||
|
||||
if (item != null)
|
||||
list.Add(item);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RewardItem rewardItem = rewardGroup.AcquireItem();
|
||||
|
||||
if (rewardItem != null)
|
||||
{
|
||||
Item item = rewardItem.Construct();
|
||||
|
||||
if (item != null)
|
||||
list.Add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
224
Scripts/Services/BulkOrders/SmallBODs/SmallTailorBOD.cs
Normal file
224
Scripts/Services/BulkOrders/SmallBODs/SmallTailorBOD.cs
Normal file
@@ -0,0 +1,224 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.Engines.Craft;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class SmallTailorBOD : SmallBOD
|
||||
{
|
||||
public override BODType BODType { get { return BODType.Tailor; } }
|
||||
|
||||
public static double[] m_TailoringMaterialChances = new double[]
|
||||
{
|
||||
0.857421875, // None
|
||||
0.125000000, // Spined
|
||||
0.015625000, // Horned
|
||||
0.001953125 // Barbed
|
||||
};
|
||||
[Constructable]
|
||||
public SmallTailorBOD()
|
||||
{
|
||||
SmallBulkEntry[] entries;
|
||||
bool useMaterials;
|
||||
|
||||
if (useMaterials = Utility.RandomBool())
|
||||
entries = SmallBulkEntry.TailorLeather;
|
||||
else
|
||||
entries = SmallBulkEntry.TailorCloth;
|
||||
|
||||
if (entries.Length > 0)
|
||||
{
|
||||
int hue = 0x483;
|
||||
int amountMax = Utility.RandomList(10, 15, 20);
|
||||
|
||||
BulkMaterialType material;
|
||||
|
||||
if (useMaterials)
|
||||
material = GetRandomMaterial(BulkMaterialType.Spined, m_TailoringMaterialChances);
|
||||
else
|
||||
material = BulkMaterialType.None;
|
||||
|
||||
bool reqExceptional = Utility.RandomBool() || (material == BulkMaterialType.None);
|
||||
|
||||
SmallBulkEntry entry = entries[Utility.Random(entries.Length)];
|
||||
|
||||
this.Hue = hue;
|
||||
this.AmountMax = amountMax;
|
||||
this.Type = entry.Type;
|
||||
this.Number = entry.Number;
|
||||
this.Graphic = entry.Graphic;
|
||||
this.RequireExceptional = reqExceptional;
|
||||
this.Material = material;
|
||||
this.GraphicHue = entry.Hue;
|
||||
}
|
||||
}
|
||||
|
||||
public SmallTailorBOD(int amountCur, int amountMax, Type type, int number, int graphic, bool reqExceptional, BulkMaterialType mat, int hue)
|
||||
{
|
||||
this.Hue = 0x483;
|
||||
this.AmountMax = amountMax;
|
||||
this.AmountCur = amountCur;
|
||||
this.Type = type;
|
||||
this.Number = number;
|
||||
this.Graphic = graphic;
|
||||
this.RequireExceptional = reqExceptional;
|
||||
this.Material = mat;
|
||||
this.GraphicHue = hue;
|
||||
}
|
||||
|
||||
public SmallTailorBOD(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
private SmallTailorBOD(SmallBulkEntry entry, BulkMaterialType material, int amountMax, bool reqExceptional)
|
||||
{
|
||||
this.Hue = 0x483;
|
||||
this.AmountMax = amountMax;
|
||||
this.Type = entry.Type;
|
||||
this.Number = entry.Number;
|
||||
this.Graphic = entry.Graphic;
|
||||
this.RequireExceptional = reqExceptional;
|
||||
this.Material = material;
|
||||
}
|
||||
|
||||
public static SmallTailorBOD CreateRandomFor(Mobile m)
|
||||
{
|
||||
SmallBulkEntry[] entries;
|
||||
bool useMaterials = Utility.RandomBool();
|
||||
|
||||
double theirSkill = BulkOrderSystem.GetBODSkill(m, SkillName.Tailoring);
|
||||
if (useMaterials && theirSkill >= 6.2) // Ugly, but the easiest leather BOD is Leather Cap which requires at least 6.2 skill.
|
||||
entries = SmallBulkEntry.TailorLeather;
|
||||
else
|
||||
entries = SmallBulkEntry.TailorCloth;
|
||||
|
||||
if (entries.Length > 0)
|
||||
{
|
||||
int amountMax;
|
||||
|
||||
if (theirSkill >= 70.1)
|
||||
amountMax = Utility.RandomList(10, 15, 20, 20);
|
||||
else if (theirSkill >= 50.1)
|
||||
amountMax = Utility.RandomList(10, 15, 15, 20);
|
||||
else
|
||||
amountMax = Utility.RandomList(10, 10, 15, 20);
|
||||
|
||||
BulkMaterialType material = BulkMaterialType.None;
|
||||
|
||||
if (useMaterials && theirSkill >= 70.1)
|
||||
{
|
||||
for (int i = 0; i < 20; ++i)
|
||||
{
|
||||
BulkMaterialType check = GetRandomMaterial(BulkMaterialType.Spined, m_TailoringMaterialChances);
|
||||
double skillReq = GetRequiredSkill(check);
|
||||
|
||||
if (theirSkill >= skillReq)
|
||||
{
|
||||
material = check;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
double excChance = 0.0;
|
||||
|
||||
if (theirSkill >= 70.1)
|
||||
excChance = (theirSkill + 80.0) / 200.0;
|
||||
|
||||
bool reqExceptional = (excChance > Utility.RandomDouble());
|
||||
|
||||
CraftSystem system = DefTailoring.CraftSystem;
|
||||
|
||||
List<SmallBulkEntry> validEntries = new List<SmallBulkEntry>();
|
||||
|
||||
for (int i = 0; i < entries.Length; ++i)
|
||||
{
|
||||
CraftItem item = system.CraftItems.SearchFor(entries[i].Type);
|
||||
|
||||
if (item != null)
|
||||
{
|
||||
bool allRequiredSkills = true;
|
||||
double chance = item.GetSuccessChance(m, null, system, false, ref allRequiredSkills);
|
||||
|
||||
if (allRequiredSkills && chance >= 0.0)
|
||||
{
|
||||
if (reqExceptional)
|
||||
chance = item.GetExceptionalChance(system, chance, m);
|
||||
|
||||
if (chance > 0.0)
|
||||
validEntries.Add(entries[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (validEntries.Count > 0)
|
||||
{
|
||||
SmallBulkEntry entry = validEntries[Utility.Random(validEntries.Count)];
|
||||
return new SmallTailorBOD(entry, material, amountMax, reqExceptional);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public override int ComputeFame()
|
||||
{
|
||||
return TailorRewardCalculator.Instance.ComputeFame(this);
|
||||
}
|
||||
|
||||
public override int ComputeGold()
|
||||
{
|
||||
return TailorRewardCalculator.Instance.ComputeGold(this);
|
||||
}
|
||||
|
||||
public override List<Item> ComputeRewards(bool full)
|
||||
{
|
||||
List<Item> list = new List<Item>();
|
||||
|
||||
RewardGroup rewardGroup = TailorRewardCalculator.Instance.LookupRewards(TailorRewardCalculator.Instance.ComputePoints(this));
|
||||
|
||||
if (rewardGroup != null)
|
||||
{
|
||||
if (full)
|
||||
{
|
||||
for (int i = 0; i < rewardGroup.Items.Length; ++i)
|
||||
{
|
||||
Item item = rewardGroup.Items[i].Construct();
|
||||
|
||||
if (item != null)
|
||||
list.Add(item);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RewardItem rewardItem = rewardGroup.AcquireItem();
|
||||
|
||||
if (rewardItem != null)
|
||||
{
|
||||
Item item = rewardItem.Construct();
|
||||
|
||||
if (item != null)
|
||||
list.Add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user