Overwrite

Complete Overwrite of the Folder with the free shard. ServUO 57.3 has been added.
This commit is contained in:
Unstable Kitsune
2023-11-28 23:20:26 -05:00
parent 3cd54811de
commit b918192e4e
11608 changed files with 2644205 additions and 47 deletions

View File

@@ -0,0 +1,48 @@
using System;
namespace Server.Items
{
public class AverageImbuingBag : BaseRewardBag
{
[Constructable]
public AverageImbuingBag()
{
switch (Utility.Random(2))
{
case 0:
DropItem(new SpiderCarapace());
break;
case 1:
DropItem(new SilverSnakeSkin());
break;
}
}
public AverageImbuingBag(Serial serial)
: base(serial)
{
}
public override int LabelNumber
{
get
{
return 1113768; //Average Imbuing Bag
}
}
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();
}
}
}

View File

@@ -0,0 +1,55 @@
using System;
namespace Server.Items
{
[Flipable(0xE1C, 0xFAD)]
public class Backgammon : BaseBoard
{
[Constructable]
public Backgammon()
: base(0xE1C)
{
}
public Backgammon(Serial serial)
: base(serial)
{
}
public override void CreatePieces()
{
for (int i = 0; i < 5; i++)
{
this.CreatePiece(new PieceWhiteChecker(this), 42, (17 * i) + 6);
this.CreatePiece(new PieceBlackChecker(this), 42, (17 * i) + 119);
this.CreatePiece(new PieceBlackChecker(this), 142, (17 * i) + 6);
this.CreatePiece(new PieceWhiteChecker(this), 142, (17 * i) + 119);
}
for (int i = 0; i < 3; i++)
{
this.CreatePiece(new PieceBlackChecker(this), 108, (17 * i) + 6);
this.CreatePiece(new PieceWhiteChecker(this), 108, (17 * i) + 153);
}
for (int i = 0; i < 2; i++)
{
this.CreatePiece(new PieceWhiteChecker(this), 223, (17 * i) + 6);
this.CreatePiece(new PieceBlackChecker(this), 223, (17 * i) + 170);
}
}
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();
}
}
}

View File

@@ -0,0 +1,50 @@
using System;
namespace Server.Items
{
public class BagOfAllReagents : Bag
{
[Constructable]
public BagOfAllReagents()
: this(50)
{
}
[Constructable]
public BagOfAllReagents(int amount)
{
this.DropItem(new BlackPearl(amount));
this.DropItem(new Bloodmoss(amount));
this.DropItem(new Garlic(amount));
this.DropItem(new Ginseng(amount));
this.DropItem(new MandrakeRoot(amount));
this.DropItem(new Nightshade(amount));
this.DropItem(new SulfurousAsh(amount));
this.DropItem(new SpidersSilk(amount));
this.DropItem(new BatWing(amount));
this.DropItem(new GraveDust(amount));
this.DropItem(new DaemonBlood(amount));
this.DropItem(new NoxCrystal(amount));
this.DropItem(new PigIron(amount));
}
public BagOfAllReagents(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();
}
}
}

View File

@@ -0,0 +1,42 @@
using System;
namespace Server.Items
{
public class BagOfNecroReagents : Bag
{
[Constructable]
public BagOfNecroReagents()
: this(50)
{
}
[Constructable]
public BagOfNecroReagents(int amount)
{
this.DropItem(new BatWing(amount));
this.DropItem(new GraveDust(amount));
this.DropItem(new DaemonBlood(amount));
this.DropItem(new NoxCrystal(amount));
this.DropItem(new PigIron(amount));
}
public BagOfNecroReagents(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();
}
}
}

View File

@@ -0,0 +1,45 @@
using System;
namespace Server.Items
{
public class BagOfReagents : Bag
{
[Constructable]
public BagOfReagents()
: this(50)
{
}
[Constructable]
public BagOfReagents(int amount)
{
this.DropItem(new BlackPearl(amount));
this.DropItem(new Bloodmoss(amount));
this.DropItem(new Garlic(amount));
this.DropItem(new Ginseng(amount));
this.DropItem(new MandrakeRoot(amount));
this.DropItem(new Nightshade(amount));
this.DropItem(new SulfurousAsh(amount));
this.DropItem(new SpidersSilk(amount));
}
public BagOfReagents(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();
}
}
}

View File

@@ -0,0 +1,39 @@
using System;
namespace Server.Items
{
public class BagOfSmokeBombs : Bag
{
[Constructable]
public BagOfSmokeBombs()
: this(20)
{
}
[Constructable]
public BagOfSmokeBombs(int amount)
{
for (int i = 0; i < amount; ++i)
this.DropItem(new SmokeBomb());
}
public BagOfSmokeBombs(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();
}
}
}

View File

@@ -0,0 +1,187 @@
using System;
using System.Collections.Generic;
using Server.ContextMenus;
using Server.Gumps;
using Server.Multis;
using Server.Network;
namespace Server.Items
{
public abstract class BaseBoard : Container, ISecurable
{
private SecureLevel m_Level;
public BaseBoard(int itemID)
: base(itemID)
{
this.CreatePieces();
this.Weight = 5.0;
}
public BaseBoard(Serial serial)
: base(serial)
{
}
[CommandProperty(AccessLevel.GameMaster)]
public SecureLevel Level
{
get
{
return this.m_Level;
}
set
{
this.m_Level = value;
}
}
public override bool DisplaysContent
{
get
{
return false;
}
}// Do not display (x items, y stones)
public override bool IsDecoContainer
{
get
{
return false;
}
}
public override TimeSpan DecayTime
{
get
{
return TimeSpan.FromDays(1.0);
}
}
public static bool ValidateDefault(Mobile from, BaseBoard board)
{
if (from.AccessLevel >= AccessLevel.GameMaster)
return true;
if (!from.Alive)
return false;
if (board.IsChildOf(from.Backpack))
return true;
object root = board.RootParent;
if (root is Mobile && root != from)
return false;
if (board.Deleted || board.Map != from.Map || !from.InRange(board.GetWorldLocation(), 1))
return false;
BaseHouse house = BaseHouse.FindHouseAt(board);
return (house != null && house.IsOwner(from));
}
public abstract void CreatePieces();
public void Reset()
{
for (int i = this.Items.Count - 1; i >= 0; --i)
{
if (i < this.Items.Count)
this.Items[i].Delete();
}
this.CreatePieces();
}
public void CreatePiece(BasePiece piece, int x, int y)
{
this.AddItem(piece);
piece.Location = new Point3D(x, y, 0);
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write((int)1); // version
writer.Write((int)this.m_Level);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
if (version == 1)
this.m_Level = (SecureLevel)reader.ReadInt();
if (this.Weight == 1.0)
this.Weight = 5.0;
}
public override bool OnDragDrop(Mobile from, Item dropped)
{
BasePiece piece = dropped as BasePiece;
return (piece != null && piece.Board == this && base.OnDragDrop(from, dropped));
}
public override bool OnDragDropInto(Mobile from, Item dropped, Point3D point)
{
BasePiece piece = dropped as BasePiece;
if (piece != null && piece.Board == this && base.OnDragDropInto(from, dropped, point))
{
Packet p = new PlaySound(0x127, this.GetWorldLocation());
p.Acquire();
if (this.RootParent == from)
{
from.Send(p);
}
else
{
foreach (NetState state in this.GetClientsInRange(2))
state.Send(p);
}
p.Release();
return true;
}
else
{
return false;
}
}
public override void GetContextMenuEntries(Mobile from, List<ContextMenuEntry> list)
{
base.GetContextMenuEntries(from, list);
if (ValidateDefault(from, this))
list.Add(new DefaultEntry(from, this));
SetSecureLevelEntry.AddTo(from, this, list);
}
public class DefaultEntry : ContextMenuEntry
{
private readonly Mobile m_From;
private readonly BaseBoard m_Board;
public DefaultEntry(Mobile from, BaseBoard board)
: base(6162, from.AccessLevel >= AccessLevel.GameMaster ? -1 : 1)
{
this.m_From = from;
this.m_Board = board;
}
public override void OnClick()
{
if (BaseBoard.ValidateDefault(this.m_From, this.m_Board))
this.m_Board.Reset();
}
}
}
}

View File

@@ -0,0 +1,132 @@
using Server.Engines.Points;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Server.ContextMenus;
using Server.Mobiles;
namespace Server.Items
{
public class CleanupArray
{
public Mobile mobiles { get; set; }
public Item items { get; set; }
public double points { get; set; }
public bool confirm { get; set; }
public Serial serials { get; set; }
}
public class BaseTrash : Container
{
internal List<CleanupArray> m_Cleanup;
public BaseTrash(int itemID)
: base(itemID)
{
}
public override void GetContextMenuEntries(Mobile from, List<ContextMenuEntry> list)
{
base.GetContextMenuEntries(from, list);
if (CleanUpBritanniaData.Enabled && from is PlayerMobile)
{
list.Add(new AppraiseforCleanup(from));
}
}
private class AppraiseforCleanup : ContextMenuEntry
{
private readonly Mobile m_Mobile;
public AppraiseforCleanup(Mobile mobile)
: base(1151298, 2) //Appraise for Cleanup
{
this.m_Mobile = mobile;
}
public override void OnClick()
{
m_Mobile.Target = new AppraiseforCleanupTarget(m_Mobile);
m_Mobile.SendLocalizedMessage(1151299); //Target items to see how many Clean Up Britannia points you will receive for throwing them away. Continue targeting items until done, then press the ESC key to cancel the targeting cursor.
}
}
public BaseTrash(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 virtual bool AddCleanupItem(Mobile from, Item item)
{
if (!CleanUpBritanniaData.Enabled)
{
return false;
}
double checkbagpoint;
bool added = false;
if (item is BaseContainer)
{
Container c = (Container)item;
List<Item> list = c.FindItemsByType<Item>();
for (int i = list.Count - 1; i >= 0; --i)
{
checkbagpoint = CleanUpBritanniaData.GetPoints(list[i]);
if (checkbagpoint > 0 && m_Cleanup.Find(x => x.serials == list[i].Serial) == null)
{
m_Cleanup.Add(new CleanupArray { mobiles = from, items = list[i], points = checkbagpoint, serials = list[i].Serial });
if(!added)
added = true;
}
}
}
else
{
checkbagpoint = CleanUpBritanniaData.GetPoints(item);
if (checkbagpoint > 0 && m_Cleanup.Find(x => x.serials == item.Serial) == null)
{
m_Cleanup.Add(new CleanupArray { mobiles = from, items = item, points = checkbagpoint, serials = item.Serial });
added = true;
}
}
return added;
}
public void ConfirmCleanupItem(Item item)
{
if (item is BaseContainer)
{
Container c = (Container)item;
List<Item> list = c.FindItemsByType<Item>();
m_Cleanup.Where(r => list.Select(k => k.Serial).Contains(r.items.Serial)).ToList().ForEach(k => k.confirm = true);
}
else
{
m_Cleanup.Where(r => r.items.Serial == item.Serial).ToList().ForEach(k => k.confirm = true);
}
}
}
}

View File

@@ -0,0 +1,246 @@
using System;
namespace Server.Items
{
public class BaseTreasureChest : LockableContainer
{
private TreasureLevel m_TreasureLevel;
private short m_MaxSpawnTime = 60;
private short m_MinSpawnTime = 10;
private TreasureResetTimer m_ResetTimer;
public BaseTreasureChest(int itemID)
: this(itemID, TreasureLevel.Level2)
{
}
public BaseTreasureChest(int itemID, TreasureLevel level)
: base(itemID)
{
this.m_TreasureLevel = level;
this.Locked = true;
this.Movable = false;
this.SetLockLevel();
this.GenerateTreasure();
}
public BaseTreasureChest(Serial serial)
: base(serial)
{
}
public enum TreasureLevel
{
Level1,
Level2,
Level3,
Level4,
Level5,
Level6,
}
[CommandProperty(AccessLevel.GameMaster)]
public TreasureLevel Level
{
get
{
return this.m_TreasureLevel;
}
set
{
this.m_TreasureLevel = value;
}
}
[CommandProperty(AccessLevel.GameMaster)]
public short MaxSpawnTime
{
get
{
return this.m_MaxSpawnTime;
}
set
{
this.m_MaxSpawnTime = value;
}
}
[CommandProperty(AccessLevel.GameMaster)]
public short MinSpawnTime
{
get
{
return this.m_MinSpawnTime;
}
set
{
this.m_MinSpawnTime = value;
}
}
[CommandProperty(AccessLevel.GameMaster)]
public override bool Locked
{
get
{
return base.Locked;
}
set
{
if (base.Locked != value)
{
base.Locked = value;
if (!value)
this.StartResetTimer();
}
}
}
public override bool IsDecoContainer
{
get
{
return false;
}
}
public override string DefaultName
{
get
{
if (this.Locked)
return "a locked treasure chest";
return "a treasure chest";
}
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write((int)0);
writer.Write((byte)this.m_TreasureLevel);
writer.Write(this.m_MinSpawnTime);
writer.Write(this.m_MaxSpawnTime);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
this.m_TreasureLevel = (TreasureLevel)reader.ReadByte();
this.m_MinSpawnTime = reader.ReadShort();
this.m_MaxSpawnTime = reader.ReadShort();
if (!this.Locked)
this.StartResetTimer();
}
public void ClearContents()
{
for (int i = this.Items.Count - 1; i >= 0; --i)
{
if (i < this.Items.Count)
this.Items[i].Delete();
}
}
public void Reset()
{
if (this.m_ResetTimer != null)
{
if (this.m_ResetTimer.Running)
this.m_ResetTimer.Stop();
}
this.Locked = true;
this.ClearContents();
this.GenerateTreasure();
}
protected virtual void SetLockLevel()
{
switch( this.m_TreasureLevel )
{
case TreasureLevel.Level1:
this.RequiredSkill = this.LockLevel = 5;
break;
case TreasureLevel.Level2:
this.RequiredSkill = this.LockLevel = 20;
break;
case TreasureLevel.Level3:
this.RequiredSkill = this.LockLevel = 50;
break;
case TreasureLevel.Level4:
this.RequiredSkill = this.LockLevel = 70;
break;
case TreasureLevel.Level5:
this.RequiredSkill = this.LockLevel = 90;
break;
case TreasureLevel.Level6:
this.RequiredSkill = this.LockLevel = 100;
break;
}
}
protected virtual void GenerateTreasure()
{
int MinGold = 1;
int MaxGold = 2;
switch( this.m_TreasureLevel )
{
case TreasureLevel.Level1:
MinGold = 100;
MaxGold = 300;
break;
case TreasureLevel.Level2:
MinGold = 300;
MaxGold = 600;
break;
case TreasureLevel.Level3:
MinGold = 600;
MaxGold = 900;
break;
case TreasureLevel.Level4:
MinGold = 900;
MaxGold = 1200;
break;
case TreasureLevel.Level5:
MinGold = 1200;
MaxGold = 5000;
break;
case TreasureLevel.Level6:
MinGold = 5000;
MaxGold = 9000;
break;
}
this.DropItem(new Gold(MinGold, MaxGold));
}
private void StartResetTimer()
{
if (this.m_ResetTimer == null)
this.m_ResetTimer = new TreasureResetTimer(this);
else
this.m_ResetTimer.Delay = TimeSpan.FromMinutes(Utility.Random(this.m_MinSpawnTime, this.m_MaxSpawnTime));
this.m_ResetTimer.Start();
}
private class TreasureResetTimer : Timer
{
private readonly BaseTreasureChest m_Chest;
public TreasureResetTimer(BaseTreasureChest chest)
: base(TimeSpan.FromMinutes(Utility.Random(chest.MinSpawnTime, chest.MaxSpawnTime)))
{
this.m_Chest = chest;
this.Priority = TimerPriority.OneMinute;
}
protected override void OnTick()
{
this.m_Chest.Reset();
}
}
;
}
}

View File

@@ -0,0 +1,122 @@
// Treasure Chest Pack - Version 0.99H
// By Nerun
using Server;
using Server.Items;
using Server.Network;
using System;
namespace Server.Items
{
public abstract class BaseTreasureChestMod : LockableContainer
{
private ChestTimer m_DeleteTimer;
//public override bool Decays { get{ return true; } }
//public override TimeSpan DecayTime{ get{ return TimeSpan.FromMinutes( Utility.Random( 10, 15 ) ); } }
public override int DefaultGumpID{ get{ return 0x42; } }
public override int DefaultDropSound{ get{ return 0x42; } }
public override Rectangle2D Bounds{ get{ return new Rectangle2D( 20, 105, 150, 180 ); } }
public override bool IsDecoContainer{get{ return false; }}
public BaseTreasureChestMod( int itemID ) : base ( itemID )
{
Locked = true;
Movable = false;
Key key = (Key)FindItemByType( typeof(Key) );
if( key != null )
key.Delete();
if(Core.SA)
RefinementComponent.Roll(this, 1, 0.08);
}
public BaseTreasureChestMod( 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 version = reader.ReadInt();
if( !Locked )
StartDeleteTimer();
}
public override void OnTelekinesis( Mobile from )
{
if ( CheckLocked( from ) )
{
Effects.SendLocationParticles( EffectItem.Create( Location, Map, EffectItem.DefaultDuration ), 0x376A, 9, 32, 5022 );
Effects.PlaySound( Location, Map, 0x1F5 );
return;
}
base.OnTelekinesis( from );
Name = "a treasure chest";
StartDeleteTimer();
}
public override void OnDoubleClick( Mobile from )
{
if ( CheckLocked( from ) )
return;
base.OnDoubleClick( from );
Name = "a treasure chest";
StartDeleteTimer();
}
protected void AddLoot(Item item)
{
if (item == null)
return;
if (Core.SA && RandomItemGenerator.Enabled)
{
int min, max;
TreasureMapChest.GetRandomItemStat(out min, out max);
RunicReforging.GenerateRandomItem(item, 0, min, max);
}
DropItem(item);
}
private void StartDeleteTimer()
{
if( m_DeleteTimer == null )
m_DeleteTimer = new ChestTimer( this );
else
m_DeleteTimer.Delay = TimeSpan.FromSeconds( Utility.Random( 1, 2 ));
m_DeleteTimer.Start();
}
private class ChestTimer : Timer
{
private BaseTreasureChestMod m_Chest;
public ChestTimer( BaseTreasureChestMod chest ) : base ( TimeSpan.FromMinutes( Utility.Random( 2, 5 ) ) )
{
m_Chest = chest;
Priority = TimerPriority.OneMinute;
}
protected override void OnTick()
{
m_Chest.Delete();
}
}
}
}

View File

@@ -0,0 +1,106 @@
using System;
namespace Server.Items
{
[Flipable(0x2068, 0x207A)]
public class BoilingCauldronAddon : BaseAddonContainer
{
[Constructable]
public BoilingCauldronAddon()
: base(0x2068)
{
this.AddComponent(new LocalizedContainerComponent(0xFAC, 1076267), 0, 0, 0);
this.AddComponent(new LocalizedContainerComponent(0x970, 1076267), 0, 0, 8);
}
public BoilingCauldronAddon(Serial serial)
: base(serial)
{
}
public override BaseAddonContainerDeed Deed
{
get
{
return new BoilingCauldronDeed();
}
}
public override int LabelNumber
{
get
{
return 1076267;
}
}// Boiling Cauldron
public override int DefaultGumpID
{
get
{
return 0x9;
}
}
public override int DefaultDropSound
{
get
{
return 0x42;
}
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.WriteEncodedInt(0); // version
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadEncodedInt();
}
}
public class BoilingCauldronDeed : BaseAddonContainerDeed
{
[Constructable]
public BoilingCauldronDeed()
: base()
{
this.LootType = LootType.Blessed;
}
public BoilingCauldronDeed(Serial serial)
: base(serial)
{
}
public override BaseAddonContainer Addon
{
get
{
return new BoilingCauldronAddon();
}
}
public override int LabelNumber
{
get
{
return 1076267;
}
}// Boiling Cauldron
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();
}
}
}

View File

@@ -0,0 +1,47 @@
using System;
namespace Server.Items
{
[Furniture]
[Flipable(0x9AA, 0xE7D)]
public class BoxOfCrystalItems : BaseContainer
{
public override int LabelNumber { get { return 1076712; } } // A Box of Crystal Items
public override int DefaultGumpID { get { return 0x43; } }
[Constructable]
public BoxOfCrystalItems()
: base(0x9AA)
{
Weight = 4.0;
Hue = 1173;
DropItem(new CrystalAltarDeed());
DropItem(new CrystalBeggarStatueDeed());
DropItem(new CrystalBrazierDeed());
DropItem(new CrystalBullStatueDeed());
DropItem(new CrystalRunnerStatueDeed());
DropItem(new CrystalSupplicantStatueDeed());
DropItem(new CrystalTableDeed());
DropItem(new CrystalThroneDeed());
}
public BoxOfCrystalItems(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();
}
}
}

View File

@@ -0,0 +1,49 @@
using System;
namespace Server.Items
{
[Furniture]
[Flipable(0x9AA, 0xE7D)]
public class BoxOfShadowItems : BaseContainer
{
public override int LabelNumber { get { return 1076713; } } // A Box of Shadow Items
public override int DefaultGumpID { get { return 0x43; } }
[Constructable]
public BoxOfShadowItems()
: base(0x9AA)
{
Weight = 4.0;
Hue = 1902;
DropItem(new FireDemonStatueDeed());
DropItem(new GlobeOfSosariaDeed());
DropItem(new ObsidianPillarDeed());
DropItem(new ObsidianRockDeed());
DropItem(new ShadowAltarDeed());
DropItem(new ShadowBannerDeed());
DropItem(new ShadowFirePitDeed());
DropItem(new ShadowPillarDeed());
DropItem(new SpikeColumnDeed());
DropItem(new SpikePostDeed());
}
public BoxOfShadowItems(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();
}
}
}

View File

@@ -0,0 +1,52 @@
using System;
using Server.SkillHandlers;
namespace Server.Items
{
public class BulgingMuseumBag : BaseRewardBag
{
[Constructable]
public BulgingMuseumBag()
{
DropItem(new Gold(10000));
DropItem(new TerMurQuestRewardBook());
for (int i = 0; i < Utility.RandomMinMax(10, 15); i++)
{
DropItemStacked(Loot.RandomGem());
}
for (int i = 0; i < Utility.RandomMinMax(5, 7); i++)
{
DropItemStacked(Loot.RandomMLResource());
}
}
public BulgingMuseumBag(Serial serial)
: base(serial)
{
}
public override int LabelNumber
{
get
{
return 1112995;
}
}
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();
}
}
}

View File

@@ -0,0 +1,50 @@
using System;
namespace Server.Items
{
public class CheckerBoard : BaseBoard
{
[Constructable]
public CheckerBoard()
: base(0xFA6)
{
}
public CheckerBoard(Serial serial)
: base(serial)
{
}
public override int LabelNumber
{
get
{
return 1016449;
}
}// a checker board
public override void CreatePieces()
{
for (int i = 0; i < 4; i++)
{
this.CreatePiece(new PieceWhiteChecker(this), (50 * i) + 45, 25);
this.CreatePiece(new PieceWhiteChecker(this), (50 * i) + 70, 50);
this.CreatePiece(new PieceWhiteChecker(this), (50 * i) + 45, 75);
this.CreatePiece(new PieceBlackChecker(this), (50 * i) + 70, 150);
this.CreatePiece(new PieceBlackChecker(this), (50 * i) + 45, 175);
this.CreatePiece(new PieceBlackChecker(this), (50 * i) + 70, 200);
}
}
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();
}
}
}

View File

@@ -0,0 +1,75 @@
using System;
namespace Server.Items
{
public class Chessboard : BaseBoard
{
[Constructable]
public Chessboard()
: base(0xFA6)
{
}
public Chessboard(Serial serial)
: base(serial)
{
}
public override int LabelNumber
{
get
{
return 1016450;
}
}// a chessboard
public override void CreatePieces()
{
for (int i = 0; i < 8; i++)
{
this.CreatePiece(new PieceBlackPawn(this), 67, (25 * i) + 17);
this.CreatePiece(new PieceWhitePawn(this), 192, (25 * i) + 17);
}
// Rook
this.CreatePiece(new PieceBlackRook(this), 42, 5);
this.CreatePiece(new PieceBlackRook(this), 42, 180);
this.CreatePiece(new PieceWhiteRook(this), 216, 5);
this.CreatePiece(new PieceWhiteRook(this), 216, 180);
// Knight
this.CreatePiece(new PieceBlackKnight(this), 42, 30);
this.CreatePiece(new PieceBlackKnight(this), 42, 155);
this.CreatePiece(new PieceWhiteKnight(this), 216, 30);
this.CreatePiece(new PieceWhiteKnight(this), 216, 155);
// Bishop
this.CreatePiece(new PieceBlackBishop(this), 42, 55);
this.CreatePiece(new PieceBlackBishop(this), 42, 130);
this.CreatePiece(new PieceWhiteBishop(this), 216, 55);
this.CreatePiece(new PieceWhiteBishop(this), 216, 130);
// Queen
this.CreatePiece(new PieceBlackQueen(this), 42, 105);
this.CreatePiece(new PieceWhiteQueen(this), 216, 105);
// King
this.CreatePiece(new PieceBlackKing(this), 42, 80);
this.CreatePiece(new PieceWhiteKing(this), 216, 80);
}
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();
}
}
}

View File

@@ -0,0 +1,139 @@
using System;
using System.Collections.Generic;
using Server.Multis;
using Server.ContextMenus;
using Server.Mobiles;
using Server.Engines.Points;
using System.Linq;
namespace Server.Items
{
public class CleanupTrashBarrel : BaseTrash
{
[Constructable]
public CleanupTrashBarrel()
: base(0xFAE)
{
this.Hue = 2500;
this.Movable = false;
this.Name = "Trash - Keep Britannia Clean";
this.m_Cleanup = new List<CleanupArray>();
}
public CleanupTrashBarrel(Serial serial)
: base(serial)
{
}
public override int DefaultMaxWeight
{
get
{
return 0;
}
}// A value of 0 signals unlimited weight
public override bool IsDecoContainer
{
get
{
return false;
}
}
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();
this.m_Cleanup = new List<CleanupArray>();
}
public override bool OnDragDrop(Mobile from, Item dropped)
{
if (!base.OnDragDrop(from, dropped))
return false;
if (!AddCleanupItem(from, dropped))
{
if (dropped.LootType == LootType.Blessed)
{
this.PublicOverheadMessage(Network.MessageType.Regular, 0x3B2, 1075256); // That is blessed; you cannot throw it away.
}
else
{
this.PublicOverheadMessage(Network.MessageType.Regular, 0x3B2, 1151271); // This item has no turn-in value for Clean Up Britannia.
}
return false;
}
this.PublicOverheadMessage(Network.MessageType.Regular, 0x3B2, Utility.Random(1042891, 8));
Empty();
return true;
}
public override bool OnDragDropInto(Mobile from, Item item, Point3D p)
{
if (!base.OnDragDropInto(from, item, p))
return false;
if (!AddCleanupItem(from, item))
{
if (item.LootType == LootType.Blessed)
{
this.PublicOverheadMessage(Network.MessageType.Regular, 0x3B2, 1075256); // That is blessed; you cannot throw it away.
}
else
{
this.PublicOverheadMessage(Network.MessageType.Regular, 0x3B2, 1151271); // This item has no turn-in value for Clean Up Britannia.
}
return false;
}
this.PublicOverheadMessage(Network.MessageType.Regular, 0x3B2, Utility.Random(1042891, 8));
Empty();
return true;
}
public void Empty()
{
List<Item> items = this.Items;
if (items.Count > 0)
{
for (int i = items.Count - 1; i >= 0; --i)
{
if (i >= items.Count)
continue;
ConfirmCleanupItem(items[i]);
items[i].Delete();
}
if (this.m_Cleanup.Any(x => x.mobiles != null))
{
foreach (var m in this.m_Cleanup.Select(x => x.mobiles).Distinct())
{
if (this.m_Cleanup.Find(x => x.mobiles == m && x.confirm) != null)
{
double point = this.m_Cleanup.Where(x => x.mobiles == m && x.confirm).Sum(x => x.points);
m.SendLocalizedMessage(1151280, String.Format("{0}\t{1}", point.ToString(), this.m_Cleanup.Count(r => r.mobiles == m))); // You have received approximately ~1_VALUE~points for turning in ~2_COUNT~items for Clean Up Britannia.
PointsSystem.CleanUpBritannia.AwardPoints(m, point);
}
}
this.m_Cleanup.Clear();
}
}
}
}
}

View File

@@ -0,0 +1,37 @@
namespace Server.Items
{
class ClosedBarrel : TrapableContainer
{
[Constructable]
public ClosedBarrel()
: base(0x0FAE)
{
}
public ClosedBarrel(Serial serial)
: base(serial)
{
}
public override int DefaultGumpID
{
get
{
return 0x3e;
}
}
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();
}
}
}

View File

@@ -0,0 +1,87 @@
using System;
using Server.Engines.VeteranRewards;
namespace Server.Items
{
[Furniture]
[Flipable(0x9AA, 0xE7D)]
public class CommodityDeedBox : BaseContainer, IRewardItem
{
private bool m_IsRewardItem;
[Constructable]
public CommodityDeedBox()
: base(0x9AA)
{
this.Hue = 0x47;
this.Weight = 4.0;
}
public CommodityDeedBox(Serial serial)
: base(serial)
{
}
public override int LabelNumber
{
get
{
return 1080523;
}
}// Commodity Deed Box
public override int DefaultGumpID
{
get
{
return 0x43;
}
}
[CommandProperty(AccessLevel.GameMaster)]
public bool IsRewardItem
{
get
{
return this.m_IsRewardItem;
}
set
{
this.m_IsRewardItem = value;
this.InvalidateProperties();
}
}
public static CommodityDeedBox Find(Item deed)
{
Item parent = deed;
while (parent != null && !(parent is CommodityDeedBox))
parent = parent.Parent as Item;
return parent as CommodityDeedBox;
}
public override void GetProperties(ObjectPropertyList list)
{
base.GetProperties(list);
if (this.m_IsRewardItem)
list.Add(1076217); // 1st Year Veteran Reward
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.WriteEncodedInt(0); // version
writer.Write((bool)this.m_IsRewardItem);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadEncodedInt();
this.m_IsRewardItem = reader.ReadBool();
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,339 @@
using System;
using Reward = Server.Engines.Quests.BaseReward;
namespace Server.Items
{
public class BaseCraftsmanSatchel : Backpack
{
public BaseCraftsmanSatchel()
: base()
{
Hue = Reward.SatchelHue();
int count = 1;
if (0.015 > Utility.RandomDouble())
count = 2;
bool equipment = false;
bool jewlery = false;
bool talisman = false;
while (Items.Count < count)
{
if (0.33 > Utility.RandomDouble() && !talisman)
{
DropItem(Loot.RandomTalisman());
talisman = true;
}
else if (0.4 > Utility.RandomDouble() && !equipment)
{
DropItem(RandomItem());
equipment = true;
}
else if (0.88 > Utility.RandomDouble() && !jewlery)
{
DropItem(Reward.Jewlery());
jewlery = true;
}
}
}
public BaseCraftsmanSatchel(Serial serial)
: base(serial)
{
}
public virtual Item RandomItem()
{
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();
}
}
public class AlchemistCraftsmanSatchel : BaseCraftsmanSatchel
{
[Constructable]
public AlchemistCraftsmanSatchel()
: base()
{
if (Items.Count < 2)
{
var recipe = Reward.AlchemyRecipe();
if (recipe != null)
{
DropItem(recipe);
}
}
}
public AlchemistCraftsmanSatchel(Serial serial)
: base(serial)
{
}
public override Item RandomItem()
{
return Reward.RangedWeapon();
}
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 FletcherCraftsmanSatchel : BaseCraftsmanSatchel
{
[Constructable]
public FletcherCraftsmanSatchel()
: base()
{
if (Items.Count < 2)
{
var recipe = Reward.FletcherRecipe();
if (recipe != null)
{
DropItem(recipe);
}
}
var runic = Reward.FletcherRunic();
if (runic != null)
{
DropItem(runic);
}
}
public FletcherCraftsmanSatchel(Serial serial)
: base(serial)
{
}
public override Item RandomItem()
{
return Reward.RangedWeapon();
}
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 TailorsCraftsmanSatchel : BaseCraftsmanSatchel
{
[Constructable]
public TailorsCraftsmanSatchel()
: base()
{
if (Items.Count < 2)
{
var recipe = Reward.TailorRecipe();
if (recipe != null)
{
DropItem(recipe);
}
}
}
public TailorsCraftsmanSatchel(Serial serial)
: base(serial)
{
}
public override Item RandomItem()
{
return Reward.Armor();
}
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 SmithsCraftsmanSatchel : BaseCraftsmanSatchel
{
[Constructable]
public SmithsCraftsmanSatchel()
: base()
{
if (Items.Count < 2)
{
var recipe = Reward.SmithRecipe();
if (recipe != null)
{
DropItem(recipe);
}
}
}
public SmithsCraftsmanSatchel(Serial serial)
: base(serial)
{
}
public override Item RandomItem()
{
return Reward.Weapon();
}
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 TinkersCraftsmanSatchel : BaseCraftsmanSatchel
{
[Constructable]
public TinkersCraftsmanSatchel()
: base()
{
if (Items.Count < 2)
{
var recipe = Reward.TinkerRecipe();
if (recipe != null)
{
DropItem(recipe);
}
}
}
public TinkersCraftsmanSatchel(Serial serial)
: base(serial)
{
}
public override Item RandomItem()
{
return Reward.Weapon();
}
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 CarpentersCraftsmanSatchel : BaseCraftsmanSatchel
{
[Constructable]
public CarpentersCraftsmanSatchel()
: base()
{
if (Items.Count < 2)
{
var recipe = Reward.CarpentryRecipe();
if (recipe != null)
{
DropItem(recipe);
}
}
var runic = Reward.CarpenterRunic();
if (runic != null)
{
DropItem(runic);
}
var furniture = Reward.RandomFurniture();
if (furniture != null)
{
DropItem(furniture);
}
}
public CarpentersCraftsmanSatchel(Serial serial)
: base(serial)
{
}
public override Item RandomItem()
{
return Reward.Weapon();
}
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();
}
}
}

View File

@@ -0,0 +1,63 @@
using System;
namespace Server.Items
{
[Furniture]
[Flipable(0x2DF3, 0x2DF4)]
public class DecorativeBox : LockableContainer
{
[Constructable]
public DecorativeBox()
: base(0x2DF3)
{
this.Weight = 1.0;
}
public DecorativeBox(Serial serial)
: base(serial)
{
}
public override int DefaultGumpID
{
get
{
return 0x43;
}
}
public override int DefaultDropSound
{
get
{
return 0x42;
}
}
public override int LabelNumber
{
get
{
return 1073403;
}
}// decorative box
public override Rectangle2D Bounds
{
get
{
return new Rectangle2D(16, 51, 168, 73);
}
}
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();
}
}
}

View File

@@ -0,0 +1,50 @@
using System;
namespace Server.Items
{
public class DustyMuseumBag : BaseRewardBag
{
[Constructable]
public DustyMuseumBag()
{
DropItem(new Gold(6000));
DropItem(new TerMurQuestRewardBook());
for (int i = 0; i < Utility.RandomMinMax(7, 9); i++)
{
DropItemStacked(Loot.RandomGem());
}
for (int i = 0; i < Utility.RandomMinMax(3, 5); i++)
{
DropItemStacked(Loot.RandomMLResource());
}
}
public DustyMuseumBag(Serial serial)
: base(serial)
{
}
public override int LabelNumber
{
get
{
return 1112994;
}
}
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();
}
}
}

View File

@@ -0,0 +1,43 @@
using System;
namespace Server.Items
{
public class EssenceBox : WoodenBox
{
[Constructable]
public EssenceBox()
: base()
{
this.Movable = true;
this.Hue = 2306;
this.DropItem(Loot.RandomEssence());
}
public EssenceBox(Serial serial)
: base(serial)
{
}
public override int LabelNumber
{
get
{
return 1113770;
}
}//Essence Box
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();
}
}
}

View File

@@ -0,0 +1,63 @@
using System;
namespace Server.Items
{
[Furniture]
[Flipable(0x2D07, 0x2D08)]
public class FancyElvenArmoire : BaseContainer
{
[Constructable]
public FancyElvenArmoire()
: base(0x2D07)
{
this.Weight = 1.0;
}
public FancyElvenArmoire(Serial serial)
: base(serial)
{
}
public override int DefaultGumpID
{
get
{
return 0x4E;
}
}
public override int DefaultDropSound
{
get
{
return 0x42;
}
}
public override int LabelNumber
{
get
{
return 1031527;
}
}// fancy elven armoire
public override Rectangle2D Bounds
{
get
{
return new Rectangle2D(30, 30, 90, 150);
}
}
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();
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,731 @@
using System;
using Server.Engines.Craft;
using System.Collections.Generic;
namespace Server.Items
{
public class FurnitureContainer : BaseContainer, IResource, IQuality
{
#region Old Item Serialization Vars
/* DO NOT USE! Only used in serialization of old furniture that originally derived from BaseContainer */
private bool m_InheritsItem;
protected bool InheritsItem
{
get
{
return m_InheritsItem;
}
}
#endregion
private Mobile m_Crafter;
private CraftResource m_Resource;
private ItemQuality m_Quality;
private bool m_PlayerConstructed;
[CommandProperty(AccessLevel.GameMaster)]
public Mobile Crafter
{
get { return m_Crafter; }
set
{
m_Crafter = value;
InvalidateProperties();
}
}
[CommandProperty(AccessLevel.GameMaster)]
public ItemQuality Quality
{
get { return m_Quality; }
set { m_Quality = value; InvalidateProperties(); }
}
[CommandProperty(AccessLevel.GameMaster)]
public CraftResource Resource
{
get { return m_Resource; }
set
{
m_Resource = value;
Hue = CraftResources.GetHue(m_Resource);
InvalidateProperties();
}
}
[CommandProperty(AccessLevel.GameMaster)]
public bool PlayerConstructed
{
get { return m_PlayerConstructed; }
set
{
m_PlayerConstructed = value;
InvalidateProperties();
}
}
public FurnitureContainer(int id) : base(id)
{
}
public override void AddCraftedProperties(ObjectPropertyList list)
{
if (m_Crafter != null)
{
list.Add(1050043, m_Crafter.Name); // crafted by ~1_NAME~
}
if (Quality == ItemQuality.Exceptional)
{
list.Add(1060636); // Exceptional
}
if (m_Resource > CraftResource.Iron)
{
list.Add(1114057, "#{0}", CraftResources.GetLocalizationNumber(m_Resource)); // ~1_val~
}
}
public int OnCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, ITool tool, CraftItem craftItem, int resHue)
{
PlayerConstructed = true;
Quality = (ItemQuality)quality;
if (makersMark)
{
Crafter = from;
}
if (!craftItem.ForceNonExceptional)
{
if (typeRes == null)
{
typeRes = craftItem.Resources.GetAt(0).ItemType;
}
Resource = CraftResources.GetFromType(typeRes);
}
return quality;
}
public FurnitureContainer(Serial serial)
: base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write((int)2); // version
writer.Write(m_PlayerConstructed);
writer.Write((int)m_Resource);
writer.Write((int)m_Quality);
writer.Write(m_Crafter);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
switch (version)
{
case 2:
case 1:
if (version == 1 && this is EmptyBookcase)
{
m_InheritsItem = true;
break;
}
m_PlayerConstructed = reader.ReadBool();
m_Resource = (CraftResource)reader.ReadInt();
m_Quality = (ItemQuality)reader.ReadInt();
m_Crafter = reader.ReadMobile();
break;
case 0:
m_InheritsItem = true;
break;
}
}
}
[Furniture]
[Flipable(0x2815, 0x2816)]
public class TallCabinet : FurnitureContainer
{
[Constructable]
public TallCabinet()
: base(0x2815)
{
Weight = 1.0;
}
public TallCabinet(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 = (InheritsItem ? 0 : reader.ReadInt()); // Required for FurnitureContainer insertion
}
}
[Furniture]
[Flipable(0x2817, 0x2818)]
public class ShortCabinet : FurnitureContainer
{
[Constructable]
public ShortCabinet()
: base(0x2817)
{
Weight = 1.0;
}
public ShortCabinet(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 = (InheritsItem ? 0 : reader.ReadInt()); // Required for FurnitureContainer insertion
}
}
[Furniture]
[Flipable(0x2857, 0x2858)]
public class RedArmoire : FurnitureContainer
{
[Constructable]
public RedArmoire()
: base(0x2857)
{
Weight = 1.0;
}
public RedArmoire(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 = (InheritsItem ? 0 : reader.ReadInt()); // Required for FurnitureContainer insertion
}
}
[Furniture]
[Flipable(0x285D, 0x285E)]
public class CherryArmoire : FurnitureContainer
{
[Constructable]
public CherryArmoire()
: base(0x285D)
{
Weight = 1.0;
}
public CherryArmoire(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 = (InheritsItem ? 0 : reader.ReadInt()); // Required for FurnitureContainer insertion
}
}
[Furniture]
[Flipable(0x285B, 0x285C)]
public class MapleArmoire : FurnitureContainer
{
[Constructable]
public MapleArmoire()
: base(0x285B)
{
Weight = 1.0;
}
public MapleArmoire(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 = (InheritsItem ? 0 : reader.ReadInt()); // Required for FurnitureContainer insertion
}
}
[Furniture]
[Flipable(0x2859, 0x285A)]
public class ElegantArmoire : FurnitureContainer
{
[Constructable]
public ElegantArmoire()
: base(0x2859)
{
Weight = 1.0;
}
public ElegantArmoire(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 = (InheritsItem ? 0 : reader.ReadInt()); // Required for FurnitureContainer insertion
}
}
[Furniture]
[Flipable(0xa97, 0xa99, 0xa98, 0xa9a, 0xa9b, 0xa9c)]
public class FullBookcase : FurnitureContainer
{
[Constructable]
public FullBookcase()
: base(0xA97)
{
Weight = 1.0;
}
public FullBookcase(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 = (InheritsItem ? 0 : reader.ReadInt()); // Required for FurnitureContainer insertion
}
}
[Furniture]
[Flipable(0xa9d, 0xa9e)]
public class EmptyBookcase : FurnitureContainer
{
[Constructable]
public EmptyBookcase()
: base(0xA9D)
{
}
public EmptyBookcase(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 = (InheritsItem ? 0 : reader.ReadInt()); // Required for FurnitureContainer insertion
}
}
[Furniture]
[Flipable(0xa2c, 0xa34)]
public class Drawer : FurnitureContainer
{
[Constructable]
public Drawer()
: base(0xA2C)
{
Weight = 1.0;
}
public Drawer(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 = (InheritsItem ? 0 : reader.ReadInt()); // Required for FurnitureContainer insertion
}
}
[Furniture]
[Flipable(0xa30, 0xa38)]
public class FancyDrawer : FurnitureContainer
{
[Constructable]
public FancyDrawer()
: base(0xA30)
{
Weight = 1.0;
}
public FancyDrawer(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 = (InheritsItem ? 0 : reader.ReadInt()); // Required for FurnitureContainer insertion
}
}
[Furniture]
[Flipable(0xa4f, 0xa53)]
public class Armoire : FurnitureContainer
{
[Constructable]
public Armoire()
: base(0xA4F)
{
Weight = 1.0;
}
public Armoire(Serial serial)
: base(serial)
{
}
public override void DisplayTo(Mobile m)
{
if (DynamicFurniture.Open(this, m))
base.DisplayTo(m);
}
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 = (InheritsItem ? 0 : reader.ReadInt()); // Required for FurnitureContainer insertion
DynamicFurniture.Close(this);
}
}
[Furniture]
[Flipable(0xa4d, 0xa51)]
public class FancyArmoire : FurnitureContainer
{
[Constructable]
public FancyArmoire()
: base(0xA4D)
{
Weight = 1.0;
}
public FancyArmoire(Serial serial)
: base(serial)
{
}
public override void DisplayTo(Mobile m)
{
if (DynamicFurniture.Open(this, m))
base.DisplayTo(m);
}
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 = (InheritsItem ? 0 : reader.ReadInt()); // Required for FurnitureContainer insertion
DynamicFurniture.Close(this);
}
}
public class DynamicFurniture
{
private static readonly Dictionary<Container, Timer> m_Table = new Dictionary<Container, Timer>();
public static bool Open(Container c, Mobile m)
{
if (c is Armoire || c is FancyArmoire)
{
if (!m_Table.ContainsKey(c))
{
m_Table[c] = new FurnitureTimer(c, m);
}
switch (c.ItemID)
{
case 0xA4D:
c.ItemID = 0xA4C;
break;
case 0xA4F:
c.ItemID = 0xA4E;
break;
case 0xA51:
c.ItemID = 0xA50;
break;
case 0xA53:
c.ItemID = 0xA52;
break;
}
}
c.ProcessDelta();
return true;
}
public static void Close(Container c)
{
Timer t = null;
m_Table.TryGetValue(c, out t);
if (t != null)
{
t.Stop();
m_Table.Remove(c);
}
if (c is Armoire || c is FancyArmoire)
{
switch ( c.ItemID )
{
case 0xA4C:
c.ItemID = 0xA4D;
break;
case 0xA4E:
c.ItemID = 0xA4F;
break;
case 0xA50:
c.ItemID = 0xA51;
break;
case 0xA52:
c.ItemID = 0xA53;
break;
}
}
}
}
public class FurnitureTimer : Timer
{
private readonly Container m_Container;
private readonly Mobile m_Mobile;
public FurnitureTimer(Container c, Mobile m)
: base(TimeSpan.FromSeconds(10.0))
{
m_Container = c;
m_Mobile = m;
Start();
}
protected override void OnTick()
{
DynamicFurniture.Close(m_Container);
}
}
[Furniture]
public class ChinaCabinet : FurnitureContainer, IFlipable
{
public override int LabelNumber { get { return 1158974; } } // China Cabinet
public override int DefaultGumpID { get { return 0x4F; } }
[Constructable]
public ChinaCabinet()
: base(0xA29F)
{
Hue = 448;
}
public void OnFlip(Mobile from)
{
switch (ItemID)
{
case 0xA29F:
ItemID = 0xA2A1;
break;
case 0xA2A1:
ItemID = 0xA29F;
break;
case 0xA2A0:
ItemID = 0xA2A2;
break;
case 0xA2A2:
ItemID = 0xA2A0;
break;
}
}
public override void DisplayTo(Mobile m)
{
if (ItemID == 0xA29F || ItemID == 0xA2A1)
ItemID++;
else
ItemID--;
if (DynamicFurniture.Open(this, m))
base.DisplayTo(m);
}
public ChinaCabinet(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();
}
}
[Furniture]
public class PieSafe : FurnitureContainer, IFlipable
{
public override int LabelNumber { get { return 1158973; } } // Pie Safe
public override int DefaultGumpID { get { return 0x4F; } }
[Constructable]
public PieSafe()
: base(0xA29B)
{
Hue = 448;
}
public void OnFlip(Mobile from)
{
switch (ItemID)
{
case 0xA29B:
ItemID = 0xA29D;
break;
case 0xA29D:
ItemID = 0xA29B;
break;
case 0xA29C:
ItemID = 0xA29E;
break;
case 0xA29E:
ItemID = 0xA29C;
break;
}
}
public override void DisplayTo(Mobile m)
{
if (ItemID == 0xA29B || ItemID == 0xA29D)
ItemID++;
else
ItemID--;
if (DynamicFurniture.Open(this, m))
base.DisplayTo(m);
}
public PieSafe(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();
}
}
}

View File

@@ -0,0 +1,39 @@
using System;
namespace Server.Items
{
[Furniture]
[Flipable(0x4025, 0x4026)]
public class GargoyleWoodenChest : LockableContainer
{
[Constructable]
public GargoyleWoodenChest()
: base(0x4025)
{
this.Weight = 2.0;
this.GumpID = 0x42;
}
public GargoyleWoodenChest(Serial serial)
: base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write((int)0); // version
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
if (this.Weight == 15.0)
this.Weight = 2.0;
}
}
}

View File

@@ -0,0 +1,58 @@
using System;
namespace Server.Items
{
public class GemologistsSatchel : Bag
{
public override int LabelNumber { get { return 1113378; } } // Gemologist's Satchel
[Constructable]
public GemologistsSatchel()
{
Hue = 1177;
DropItem(new Amber(Utility.RandomMinMax(10, 25)));
DropItem(new Citrine(Utility.RandomMinMax(10, 25)));
DropItem(new Ruby(Utility.RandomMinMax(10, 25)));
DropItem(new Tourmaline(Utility.RandomMinMax(10, 25)));
DropItem(new Amethyst(Utility.RandomMinMax(10, 25)));
DropItem(new Emerald(Utility.RandomMinMax(10, 25)));
DropItem(new Sapphire(Utility.RandomMinMax(10, 25)));
DropItem(new StarSapphire(Utility.RandomMinMax(10, 25)));
DropItem(new Diamond(Utility.RandomMinMax(10, 25)));
for (int i = 0; i < 5; i++)
{
Type type = Server.SkillHandlers.Imbuing.IngredTypes[Utility.Random(Server.SkillHandlers.Imbuing.IngredTypes.Length)];
if (type != null)
{
Item item = Loot.Construct(type);
if (item != null)
{
item.Amount = Utility.RandomMinMax(5, 12);
DropItem(item);
}
}
}
}
public GemologistsSatchel(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 version = reader.ReadInt();
}
}
}

View File

@@ -0,0 +1,44 @@
using System;
namespace Server.Items
{
[Furniture]
[Flipable(0x232A, 0x232B)]
public class GiftBox : BaseContainer
{
public override int LabelNumber { get { return 1156382; } } // Holiday Giftbox
[Constructable]
public GiftBox()
: this(Utility.RandomDyedHue())
{
}
[Constructable]
public GiftBox(int hue)
: base(Utility.Random(0x232A, 2))
{
this.Weight = 2.0;
this.Hue = hue;
}
public GiftBox(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();
}
}
}

View File

@@ -0,0 +1,49 @@
using System;
namespace Server.Items
{
[Flipable(0x49CC, 0x49D0)]
public class HeartShapedBox : Container
{
public override int LabelNumber { get { return 1097762; } } // heart shaped box
[Constructable]
public HeartShapedBox()
: base(0x49CC)
{
Weight = 1.0;
GumpID = 0x120;
for (int i = 0; i < 6; i++)
{
for (int j = 0; j < 4; j++)
{
PlaceItemIn(new ValentineChocolate(), 60 + (10 * i), 35 + (j * 13));
}
}
}
private void PlaceItemIn(Item item, int x, int y)
{
AddItem(item);
item.Location = new Point3D(x, y, 0);
}
public HeartShapedBox(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();
}
}
}

View File

@@ -0,0 +1,256 @@
using System;
namespace Server.Items
{
public class GiftBoxHues
{
/* there's possibly a couple more, but this is what we could verify on OSI */
private static readonly int[] m_NormalHues =
{
0x672,
0x454,
0x507,
0x4ac,
0x504,
0x84b,
0x495,
0x97c,
0x493,
0x4a8,
0x494,
0x4aa,
0xb8b,
0x84f,
0x491,
0x851,
0x503,
0xb8c,
0x4ab,
0x84B
};
private static readonly int[] m_NeonHues =
{
0x438,
0x424,
0x433,
0x445,
0x42b,
0x448
};
public static int RandomGiftBoxHue
{
get
{
return m_NormalHues[Utility.Random(m_NormalHues.Length)];
}
}
public static int RandomNeonBoxHue
{
get
{
return m_NeonHues[Utility.Random(m_NeonHues.Length)];
}
}
}
[FlipableAttribute(0x46A5, 0x46A6)]
public class GiftBoxRectangle : BaseContainer
{
[Constructable]
public GiftBoxRectangle()
: base(Utility.RandomBool() ? 0x46A5 : 0x46A6)
{
this.Hue = GiftBoxHues.RandomGiftBoxHue;
}
public GiftBoxRectangle(Serial serial)
: base(serial)
{
}
public override int DefaultGumpID
{
get
{
return 0x11E;
}
}
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 GiftBoxCube : BaseContainer
{
[Constructable]
public GiftBoxCube()
: base(0x46A2)
{
this.Hue = GiftBoxHues.RandomGiftBoxHue;
}
public GiftBoxCube(Serial serial)
: base(serial)
{
}
public override int DefaultGumpID
{
get
{
return 0x11B;
}
}
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 GiftBoxCylinder : BaseContainer
{
[Constructable]
public GiftBoxCylinder()
: base(0x46A3)
{
this.Hue = GiftBoxHues.RandomGiftBoxHue;
}
public GiftBoxCylinder(Serial serial)
: base(serial)
{
}
public override int DefaultGumpID
{
get
{
return 0x11C;
}
}
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 GiftBoxOctogon : BaseContainer
{
[Constructable]
public GiftBoxOctogon()
: base(0x46A4)
{
this.Hue = GiftBoxHues.RandomGiftBoxHue;
}
public GiftBoxOctogon(Serial serial)
: base(serial)
{
}
public override int DefaultGumpID
{
get
{
return 0x11D;
}
}
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 GiftBoxAngel : BaseContainer
{
[Constructable]
public GiftBoxAngel()
: base(0x46A7)
{
this.Hue = GiftBoxHues.RandomGiftBoxHue;
}
public GiftBoxAngel(Serial serial)
: base(serial)
{
}
public override int DefaultGumpID
{
get
{
return 0x11F;
}
}
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();
}
}
[Flipable(0x232A, 0x232B)]
public class GiftBoxNeon : BaseContainer
{
[Constructable]
public GiftBoxNeon()
: base(Utility.RandomBool() ? 0x232A : 0x232B)
{
this.Hue = GiftBoxHues.RandomNeonBoxHue;
}
public GiftBoxNeon(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();
}
}
}

View File

@@ -0,0 +1,44 @@
using System;
using Reward = Server.Engines.Quests.BaseReward;
namespace Server.Items
{
public class JaacarBox : WoodenBox
{
[Constructable]
public JaacarBox()
: base()
{
Movable = true;
Hue = 1266;
DropItem(new RecipeScroll(500));
}
public JaacarBox(Serial serial)
: base(serial)
{
}
public override string DefaultName
{
get
{
return "Jaacar Reward Box";
}
}
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();
}
}
}

View File

@@ -0,0 +1,528 @@
using System;
using Server.Engines.Craft;
using Server.Network;
namespace Server.Items
{
public abstract class LockableContainer : TrapableContainer, ILockable, ILockpickable, IShipwreckedItem, IResource, IQuality
{
private bool m_Locked;
private int m_LockLevel, m_MaxLockLevel, m_RequiredSkill;
private uint m_KeyValue;
private Mobile m_Picker;
private Mobile m_Crafter;
private bool m_TrapOnLockpick;
private ItemQuality m_Quality;
private CraftResource m_Resource;
private bool m_PlayerConstructed;
[CommandProperty(AccessLevel.GameMaster)]
public Mobile Crafter
{
get { return m_Crafter; }
set
{
m_Crafter = value;
InvalidateProperties();
}
}
[CommandProperty(AccessLevel.GameMaster)]
public Mobile Picker
{
get
{
return m_Picker;
}
set
{
m_Picker = value;
}
}
[CommandProperty(AccessLevel.GameMaster)]
public int MaxLockLevel
{
get
{
return m_MaxLockLevel;
}
set
{
m_MaxLockLevel = value;
}
}
[CommandProperty(AccessLevel.GameMaster)]
public int LockLevel
{
get
{
return m_LockLevel;
}
set
{
m_LockLevel = value;
}
}
[CommandProperty(AccessLevel.GameMaster)]
public int RequiredSkill
{
get
{
return m_RequiredSkill;
}
set
{
m_RequiredSkill = value;
}
}
[CommandProperty(AccessLevel.GameMaster)]
public virtual bool Locked
{
get
{
return m_Locked;
}
set
{
m_Locked = value;
if (m_Locked)
m_Picker = null;
InvalidateProperties();
}
}
[CommandProperty(AccessLevel.GameMaster)]
public uint KeyValue
{
get
{
return m_KeyValue;
}
set
{
m_KeyValue = value;
}
}
public override bool TrapOnOpen
{
get
{
return !m_TrapOnLockpick;
}
}
[CommandProperty(AccessLevel.GameMaster)]
public bool TrapOnLockpick
{
get
{
return m_TrapOnLockpick;
}
set
{
m_TrapOnLockpick = value;
}
}
[CommandProperty(AccessLevel.GameMaster)]
public ItemQuality Quality
{
get { return m_Quality; }
set { m_Quality = value; InvalidateProperties(); }
}
[CommandProperty(AccessLevel.GameMaster)]
public CraftResource Resource
{
get { return m_Resource; }
set
{
m_Resource = value;
Hue = CraftResources.GetHue(m_Resource);
InvalidateProperties();
}
}
[CommandProperty(AccessLevel.GameMaster)]
public bool PlayerConstructed
{
get { return m_PlayerConstructed; }
set
{
m_PlayerConstructed = value;
InvalidateProperties();
}
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write((int)8); // version
writer.Write(m_PlayerConstructed);
writer.Write((int)m_Resource);
writer.Write((int)m_Quality);
writer.Write(m_Crafter);
writer.Write(m_IsShipwreckedItem);
writer.Write((bool)m_TrapOnLockpick);
writer.Write((int)m_RequiredSkill);
writer.Write((int)m_MaxLockLevel);
writer.Write(m_KeyValue);
writer.Write((int)m_LockLevel);
writer.Write((bool)m_Locked);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
switch ( version )
{
case 8:
{
m_PlayerConstructed = reader.ReadBool();
m_Resource = (CraftResource)reader.ReadInt();
m_Quality = (ItemQuality)reader.ReadInt();
goto case 7;
}
case 7:
{
m_Crafter = reader.ReadMobile();
goto case 6;
}
case 6:
{
m_IsShipwreckedItem = reader.ReadBool();
goto case 5;
}
case 5:
{
m_TrapOnLockpick = reader.ReadBool();
goto case 4;
}
case 4:
{
m_RequiredSkill = reader.ReadInt();
goto case 3;
}
case 3:
{
m_MaxLockLevel = reader.ReadInt();
goto case 2;
}
case 2:
{
m_KeyValue = reader.ReadUInt();
goto case 1;
}
case 1:
{
m_LockLevel = reader.ReadInt();
goto case 0;
}
case 0:
{
if (version < 3)
m_MaxLockLevel = 100;
if (version < 4)
{
if ((m_MaxLockLevel - m_LockLevel) == 40)
{
m_RequiredSkill = m_LockLevel + 6;
m_LockLevel = m_RequiredSkill - 10;
m_MaxLockLevel = m_RequiredSkill + 39;
}
else
{
m_RequiredSkill = m_LockLevel;
}
}
m_Locked = reader.ReadBool();
break;
}
}
}
public LockableContainer(int itemID)
: base(itemID)
{
m_MaxLockLevel = 100;
}
public LockableContainer(Serial serial)
: base(serial)
{
}
public override bool CheckContentDisplay(Mobile from)
{
return !m_Locked && base.CheckContentDisplay(from);
}
public override bool TryDropItem(Mobile from, Item dropped, bool sendFullMessage)
{
if (from.AccessLevel < AccessLevel.GameMaster && m_Locked)
{
from.SendLocalizedMessage(501747); // It appears to be locked.
return false;
}
return base.TryDropItem(from, dropped, sendFullMessage);
}
public override bool OnDragDropInto(Mobile from, Item item, Point3D p)
{
if (from.AccessLevel < AccessLevel.GameMaster && m_Locked)
{
from.SendLocalizedMessage(501747); // It appears to be locked.
return false;
}
return base.OnDragDropInto(from, item, p);
}
public override bool CheckLift(Mobile from, Item item, ref LRReason reject)
{
if (!base.CheckLift(from, item, ref reject))
return false;
if (item != this && from.AccessLevel < AccessLevel.GameMaster && m_Locked)
return false;
return true;
}
public override bool CheckItemUse(Mobile from, Item item)
{
if (!base.CheckItemUse(from, item))
return false;
if (item != this && from.AccessLevel < AccessLevel.GameMaster && m_Locked)
{
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
return false;
}
return true;
}
public override bool DisplaysContent
{
get
{
return !m_Locked;
}
}
public virtual bool CheckLocked(Mobile from)
{
bool inaccessible = false;
if (m_Locked)
{
int number;
if (from.AccessLevel >= AccessLevel.GameMaster)
{
number = 502502; // That is locked, but you open it with your godly powers.
}
else
{
number = 501747; // It appears to be locked.
inaccessible = true;
}
from.Send(new MessageLocalized(Serial, ItemID, MessageType.Regular, 0x3B2, 3, number, "", ""));
}
return inaccessible;
}
public override void OnTelekinesis(Mobile from)
{
if (CheckLocked(from))
{
Effects.SendLocationParticles(EffectItem.Create(Location, Map, EffectItem.DefaultDuration), 0x376A, 9, 32, 5022);
Effects.PlaySound(Location, Map, 0x1F5);
return;
}
base.OnTelekinesis(from);
}
public override void OnDoubleClickSecureTrade(Mobile from)
{
if (CheckLocked(from))
return;
base.OnDoubleClickSecureTrade(from);
}
public override void Open(Mobile from)
{
if (CheckLocked(from))
return;
base.Open(from);
}
public override void OnSnoop(Mobile from)
{
if (CheckLocked(from))
return;
base.OnSnoop(from);
}
public virtual void LockPick(Mobile from)
{
Locked = false;
Picker = from;
if (TrapOnLockpick && ExecuteTrap(from))
{
TrapOnLockpick = false;
}
}
public override void AddCraftedProperties(ObjectPropertyList list)
{
if (m_PlayerConstructed && m_Crafter != null)
{
list.Add(1050043, m_Crafter.Name); // crafted by ~1_NAME~
}
if (m_Quality == ItemQuality.Exceptional)
{
list.Add(1060636); // Exceptional
}
if (m_Resource > CraftResource.Iron && !CraftResources.IsStandard(m_Resource))
{
list.Add(1114057, "#{0}", CraftResources.GetLocalizationNumber(m_Resource)); // ~1_val~
}
if (m_IsShipwreckedItem)
{
list.Add(1041645); // recovered from a shipwreck
}
}
public override void OnSingleClick(Mobile from)
{
base.OnSingleClick(from);
if (m_Crafter != null)
{
LabelTo(from, 1050043, m_Crafter.Name); // crafted by ~1_NAME~
}
if (m_IsShipwreckedItem)
LabelTo(from, 1041645); //recovered from a shipwreck
}
#region ICraftable Members
public int OnCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, ITool tool, CraftItem craftItem, int resHue)
{
Quality = (ItemQuality)quality;
if(makersMark)
{
Crafter = from;
}
if (!craftItem.ForceNonExceptional)
{
if (typeRes == null)
{
typeRes = craftItem.Resources.GetAt(0).ItemType;
}
Resource = CraftResources.GetFromType(typeRes);
}
if (from.CheckSkill(SkillName.Tinkering, -5.0, 15.0))
{
from.SendLocalizedMessage(500636); // Your tinker skill was sufficient to make the item lockable.
Key key = new Key(KeyType.Copper, Key.RandomValue());
KeyValue = key.KeyValue;
DropItem(key);
double tinkering = from.Skills[SkillName.Tinkering].Value;
int level = (int)(tinkering * 0.8);
RequiredSkill = level - 4;
LockLevel = level - 14;
MaxLockLevel = level + 35;
if (LockLevel == 0)
LockLevel = -1;
else if (LockLevel > 95)
LockLevel = 95;
if (RequiredSkill > 95)
RequiredSkill = 95;
if (MaxLockLevel > 95)
MaxLockLevel = 95;
}
else
{
from.SendLocalizedMessage(500637); // Your tinker skill was insufficient to make the item lockable.
}
return quality;
}
#endregion
#region IShipwreckedItem Members
private bool m_IsShipwreckedItem;
[CommandProperty(AccessLevel.GameMaster)]
public bool IsShipwreckedItem
{
get
{
return m_IsShipwreckedItem;
}
set
{
m_IsShipwreckedItem = value;
}
}
#endregion
}
}

View File

@@ -0,0 +1,96 @@
using System;
namespace Server.Engines.Mahjong
{
public class MahjongDealerIndicator
{
private readonly MahjongGame m_Game;
private Point2D m_Position;
private MahjongPieceDirection m_Direction;
private MahjongWind m_Wind;
public MahjongDealerIndicator(MahjongGame game, Point2D position, MahjongPieceDirection direction, MahjongWind wind)
{
this.m_Game = game;
this.m_Position = position;
this.m_Direction = direction;
this.m_Wind = wind;
}
public MahjongDealerIndicator(MahjongGame game, GenericReader reader)
{
this.m_Game = game;
int version = reader.ReadInt();
this.m_Position = reader.ReadPoint2D();
this.m_Direction = (MahjongPieceDirection)reader.ReadInt();
this.m_Wind = (MahjongWind)reader.ReadInt();
}
public MahjongGame Game
{
get
{
return this.m_Game;
}
}
public Point2D Position
{
get
{
return this.m_Position;
}
}
public MahjongPieceDirection Direction
{
get
{
return this.m_Direction;
}
}
public MahjongWind Wind
{
get
{
return this.m_Wind;
}
}
public MahjongPieceDim Dimensions
{
get
{
return GetDimensions(this.m_Position, this.m_Direction);
}
}
public static MahjongPieceDim GetDimensions(Point2D position, MahjongPieceDirection direction)
{
if (direction == MahjongPieceDirection.Up || direction == MahjongPieceDirection.Down)
return new MahjongPieceDim(position, 40, 20);
else
return new MahjongPieceDim(position, 20, 40);
}
public void Move(Point2D position, MahjongPieceDirection direction, MahjongWind wind)
{
MahjongPieceDim dim = GetDimensions(position, direction);
if (!dim.IsValid())
return;
this.m_Position = position;
this.m_Direction = direction;
this.m_Wind = wind;
this.m_Game.Players.SendGeneralPacket(true, true);
}
public void Save(GenericWriter writer)
{
writer.Write((int)0); // version
writer.Write(this.m_Position);
writer.Write((int)this.m_Direction);
writer.Write((int)this.m_Wind);
}
}
}

View File

@@ -0,0 +1,67 @@
using System;
namespace Server.Engines.Mahjong
{
public class MahjongDices
{
private readonly MahjongGame m_Game;
private int m_First;
private int m_Second;
public MahjongDices(MahjongGame game)
{
this.m_Game = game;
this.m_First = Utility.Random(1, 6);
this.m_Second = Utility.Random(1, 6);
}
public MahjongDices(MahjongGame game, GenericReader reader)
{
this.m_Game = game;
int version = reader.ReadInt();
this.m_First = reader.ReadInt();
this.m_Second = reader.ReadInt();
}
public MahjongGame Game
{
get
{
return this.m_Game;
}
}
public int First
{
get
{
return this.m_First;
}
}
public int Second
{
get
{
return this.m_Second;
}
}
public void RollDices(Mobile from)
{
this.m_First = Utility.Random(1, 6);
this.m_Second = Utility.Random(1, 6);
this.m_Game.Players.SendGeneralPacket(true, true);
if (from != null)
this.m_Game.Players.SendLocalizedMessage(1062695, string.Format("{0}\t{1}\t{2}", from.Name, this.m_First, this.m_Second)); // ~1_name~ rolls the dice and gets a ~2_number~ and a ~3_number~!
}
public void Save(GenericWriter writer)
{
writer.Write((int)0); // version
writer.Write(this.m_First);
writer.Write(this.m_Second);
}
}
}

View File

@@ -0,0 +1,58 @@
using System;
namespace Server.Engines.Mahjong
{
public enum MahjongPieceDirection
{
Up,
Left,
Down,
Right
}
public enum MahjongWind
{
North,
East,
South,
West
}
public enum MahjongTileType
{
Dagger1 = 1,
Dagger2,
Dagger3,
Dagger4,
Dagger5,
Dagger6,
Dagger7,
Dagger8,
Dagger9,
Gem1,
Gem2,
Gem3,
Gem4,
Gem5,
Gem6,
Gem7,
Gem8,
Gem9,
Number1,
Number2,
Number3,
Number4,
Number5,
Number6,
Number7,
Number8,
Number9,
North,
East,
South,
West,
Green,
Red,
White
}
}

View File

@@ -0,0 +1,337 @@
using System;
using System.Collections.Generic;
using Server.ContextMenus;
using Server.Gumps;
using Server.Multis;
namespace Server.Engines.Mahjong
{
public class MahjongGame : Item, ISecurable
{
public const int MaxPlayers = 4;
public const int BaseScore = 30000;
private MahjongTile[] m_Tiles;
private MahjongDealerIndicator m_DealerIndicator;
private MahjongWallBreakIndicator m_WallBreakIndicator;
private MahjongDices m_Dices;
private MahjongPlayers m_Players;
private bool m_ShowScores;
private bool m_SpectatorVision;
private DateTime m_LastReset;
private SecureLevel m_Level;
[Constructable]
public MahjongGame()
: base(0xFAA)
{
this.Weight = 5.0;
this.BuildWalls();
this.m_DealerIndicator = new MahjongDealerIndicator(this, new Point2D(300, 300), MahjongPieceDirection.Up, MahjongWind.North);
this.m_WallBreakIndicator = new MahjongWallBreakIndicator(this, new Point2D(335, 335));
this.m_Dices = new MahjongDices(this);
this.m_Players = new MahjongPlayers(this, MaxPlayers, BaseScore);
this.m_LastReset = DateTime.UtcNow;
this.m_Level = SecureLevel.CoOwners;
}
public MahjongGame(Serial serial)
: base(serial)
{
}
public MahjongTile[] Tiles
{
get
{
return this.m_Tiles;
}
}
public MahjongDealerIndicator DealerIndicator
{
get
{
return this.m_DealerIndicator;
}
}
public MahjongWallBreakIndicator WallBreakIndicator
{
get
{
return this.m_WallBreakIndicator;
}
}
public MahjongDices Dices
{
get
{
return this.m_Dices;
}
}
public MahjongPlayers Players
{
get
{
return this.m_Players;
}
}
[CommandProperty(AccessLevel.GameMaster)]
public SecureLevel Level
{
get
{
return this.m_Level;
}
set
{
this.m_Level = value;
}
}
[CommandProperty(AccessLevel.GameMaster)]
public bool ShowScores
{
get
{
return this.m_ShowScores;
}
set
{
if (this.m_ShowScores == value)
return;
this.m_ShowScores = value;
if (value)
this.m_Players.SendPlayersPacket(true, true);
this.m_Players.SendGeneralPacket(true, true);
this.m_Players.SendLocalizedMessage(value ? 1062777 : 1062778); // The dealer has enabled/disabled score display.
}
}
[CommandProperty(AccessLevel.GameMaster)]
public bool SpectatorVision
{
get
{
return this.m_SpectatorVision;
}
set
{
if (this.m_SpectatorVision == value)
return;
this.m_SpectatorVision = value;
if (this.m_Players.IsInGamePlayer(this.m_Players.DealerPosition))
this.m_Players.Dealer.Send(new MahjongGeneralInfo(this));
this.m_Players.SendTilesPacket(false, true);
this.m_Players.SendLocalizedMessage(value ? 1062715 : 1062716); // The dealer has enabled/disabled Spectator Vision.
this.InvalidateProperties();
}
}
public override void GetProperties(ObjectPropertyList list)
{
base.GetProperties(list);
if (this.m_SpectatorVision)
list.Add(1062717); // Spectator Vision Enabled
else
list.Add(1062718); // Spectator Vision Disabled
}
public override void GetContextMenuEntries(Mobile from, List<ContextMenuEntry> list)
{
base.GetContextMenuEntries(from, list);
this.m_Players.CheckPlayers();
if (from.Alive && this.IsAccessibleTo(from) && this.m_Players.GetInGameMobiles(true, false).Count == 0)
list.Add(new ResetGameEntry(this));
SetSecureLevelEntry.AddTo(from, this, list);
}
public override void OnDoubleClick(Mobile from)
{
this.m_Players.CheckPlayers();
this.m_Players.Join(from);
}
public void ResetGame(Mobile from)
{
if (DateTime.UtcNow - this.m_LastReset < TimeSpan.FromSeconds(5.0))
return;
this.m_LastReset = DateTime.UtcNow;
if (from != null)
this.m_Players.SendLocalizedMessage(1062771, from.Name); // ~1_name~ has reset the game.
this.m_Players.SendRelievePacket(true, true);
this.BuildWalls();
this.m_DealerIndicator = new MahjongDealerIndicator(this, new Point2D(300, 300), MahjongPieceDirection.Up, MahjongWind.North);
this.m_WallBreakIndicator = new MahjongWallBreakIndicator(this, new Point2D(335, 335));
this.m_Players = new MahjongPlayers(this, MaxPlayers, BaseScore);
}
public void ResetWalls(Mobile from)
{
if (DateTime.UtcNow - this.m_LastReset < TimeSpan.FromSeconds(5.0))
return;
this.m_LastReset = DateTime.UtcNow;
this.BuildWalls();
this.m_Players.SendTilesPacket(true, true);
if (from != null)
this.m_Players.SendLocalizedMessage(1062696); // The dealer rebuilds the wall.
}
public int GetStackLevel(MahjongPieceDim dim)
{
int level = -1;
foreach (MahjongTile tile in this.m_Tiles)
{
if (tile.StackLevel > level && dim.IsOverlapping(tile.Dimensions))
level = tile.StackLevel;
}
return level;
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write((int)1); // version
writer.Write((int)this.m_Level);
writer.Write(this.m_Tiles.Length);
for (int i = 0; i < this.m_Tiles.Length; i++)
this.m_Tiles[i].Save(writer);
this.m_DealerIndicator.Save(writer);
this.m_WallBreakIndicator.Save(writer);
this.m_Dices.Save(writer);
this.m_Players.Save(writer);
writer.Write(this.m_ShowScores);
writer.Write(this.m_SpectatorVision);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
switch ( version )
{
case 1:
{
this.m_Level = (SecureLevel)reader.ReadInt();
goto case 0;
}
case 0:
{
if (version < 1)
this.m_Level = SecureLevel.CoOwners;
int length = reader.ReadInt();
this.m_Tiles = new MahjongTile[length];
for (int i = 0; i < length; i++)
this.m_Tiles[i] = new MahjongTile(this, reader);
this.m_DealerIndicator = new MahjongDealerIndicator(this, reader);
this.m_WallBreakIndicator = new MahjongWallBreakIndicator(this, reader);
this.m_Dices = new MahjongDices(this, reader);
this.m_Players = new MahjongPlayers(this, reader);
this.m_ShowScores = reader.ReadBool();
this.m_SpectatorVision = reader.ReadBool();
this.m_LastReset = DateTime.UtcNow;
break;
}
}
}
private void BuildHorizontalWall(ref int index, int x, int y, int stackLevel, MahjongPieceDirection direction, MahjongTileTypeGenerator typeGenerator)
{
for (int i = 0; i < 17; i++)
{
Point2D position = new Point2D(x + i * 20, y);
this.m_Tiles[index + i] = new MahjongTile(this, index + i, typeGenerator.Next(), position, stackLevel, direction, false);
}
index += 17;
}
private void BuildVerticalWall(ref int index, int x, int y, int stackLevel, MahjongPieceDirection direction, MahjongTileTypeGenerator typeGenerator)
{
for (int i = 0; i < 17; i++)
{
Point2D position = new Point2D(x, y + i * 20);
this.m_Tiles[index + i] = new MahjongTile(this, index + i, typeGenerator.Next(), position, stackLevel, direction, false);
}
index += 17;
}
private void BuildWalls()
{
this.m_Tiles = new MahjongTile[17 * 8];
MahjongTileTypeGenerator typeGenerator = new MahjongTileTypeGenerator(4);
int i = 0;
this.BuildHorizontalWall(ref i, 165, 110, 0, MahjongPieceDirection.Up, typeGenerator);
this.BuildHorizontalWall(ref i, 165, 115, 1, MahjongPieceDirection.Up, typeGenerator);
this.BuildVerticalWall(ref i, 530, 165, 0, MahjongPieceDirection.Left, typeGenerator);
this.BuildVerticalWall(ref i, 525, 165, 1, MahjongPieceDirection.Left, typeGenerator);
this.BuildHorizontalWall(ref i, 165, 530, 0, MahjongPieceDirection.Down, typeGenerator);
this.BuildHorizontalWall(ref i, 165, 525, 1, MahjongPieceDirection.Down, typeGenerator);
this.BuildVerticalWall(ref i, 110, 165, 0, MahjongPieceDirection.Right, typeGenerator);
this.BuildVerticalWall(ref i, 115, 165, 1, MahjongPieceDirection.Right, typeGenerator);
}
private class ResetGameEntry : ContextMenuEntry
{
private readonly MahjongGame m_Game;
public ResetGameEntry(MahjongGame game)
: base(6162)
{
this.m_Game = game;
}
public override void OnClick()
{
Mobile from = this.Owner.From;
if (from.CheckAlive() && !this.m_Game.Deleted && this.m_Game.IsAccessibleTo(from) && this.m_Game.Players.GetInGameMobiles(true, false).Count == 0)
this.m_Game.ResetGame(from);
}
}
}
}

View File

@@ -0,0 +1,251 @@
using System;
using Server.Network;
namespace Server.Engines.Mahjong
{
public delegate void OnMahjongPacketReceive(MahjongGame game, NetState state, PacketReader pvSrc);
public sealed class MahjongPacketHandlers
{
private static readonly OnMahjongPacketReceive[] m_SubCommandDelegates = new OnMahjongPacketReceive[0x100];
public static void RegisterSubCommand(int subCmd, OnMahjongPacketReceive onReceive)
{
m_SubCommandDelegates[subCmd] = onReceive;
}
public static OnMahjongPacketReceive GetSubCommandDelegate(int cmd)
{
if (cmd >= 0 && cmd < 0x100)
{
return m_SubCommandDelegates[cmd];
}
else
{
return null;
}
}
public static void Initialize()
{
PacketHandlers.Register(0xDA, 0, true, new OnPacketReceive(OnPacket));
RegisterSubCommand(0x6, new OnMahjongPacketReceive(ExitGame));
RegisterSubCommand(0xA, new OnMahjongPacketReceive(GivePoints));
RegisterSubCommand(0xB, new OnMahjongPacketReceive(RollDice));
RegisterSubCommand(0xC, new OnMahjongPacketReceive(BuildWalls));
RegisterSubCommand(0xD, new OnMahjongPacketReceive(ResetScores));
RegisterSubCommand(0xF, new OnMahjongPacketReceive(AssignDealer));
RegisterSubCommand(0x10, new OnMahjongPacketReceive(OpenSeat));
RegisterSubCommand(0x11, new OnMahjongPacketReceive(ChangeOption));
RegisterSubCommand(0x15, new OnMahjongPacketReceive(MoveWallBreakIndicator));
RegisterSubCommand(0x16, new OnMahjongPacketReceive(TogglePublicHand));
RegisterSubCommand(0x17, new OnMahjongPacketReceive(MoveTile));
RegisterSubCommand(0x18, new OnMahjongPacketReceive(MoveDealerIndicator));
}
public static void OnPacket(NetState state, PacketReader pvSrc)
{
MahjongGame game = World.FindItem(pvSrc.ReadInt32()) as MahjongGame;
if (game != null)
game.Players.CheckPlayers();
pvSrc.ReadByte();
int cmd = pvSrc.ReadByte();
OnMahjongPacketReceive onReceive = GetSubCommandDelegate(cmd);
if (onReceive != null)
{
onReceive(game, state, pvSrc);
}
else
{
pvSrc.Trace(state);
}
}
public static void ExitGame(MahjongGame game, NetState state, PacketReader pvSrc)
{
if (game == null)
return;
Mobile from = state.Mobile;
game.Players.LeaveGame(from);
}
public static void GivePoints(MahjongGame game, NetState state, PacketReader pvSrc)
{
if (game == null || !game.Players.IsInGamePlayer(state.Mobile))
return;
int to = pvSrc.ReadByte();
int amount = pvSrc.ReadInt32();
game.Players.TransferScore(state.Mobile, to, amount);
}
public static void RollDice(MahjongGame game, NetState state, PacketReader pvSrc)
{
if (game == null || !game.Players.IsInGamePlayer(state.Mobile))
return;
game.Dices.RollDices(state.Mobile);
}
public static void BuildWalls(MahjongGame game, NetState state, PacketReader pvSrc)
{
if (game == null || !game.Players.IsInGameDealer(state.Mobile))
return;
game.ResetWalls(state.Mobile);
}
public static void ResetScores(MahjongGame game, NetState state, PacketReader pvSrc)
{
if (game == null || !game.Players.IsInGameDealer(state.Mobile))
return;
game.Players.ResetScores(MahjongGame.BaseScore);
}
public static void AssignDealer(MahjongGame game, NetState state, PacketReader pvSrc)
{
if (game == null || !game.Players.IsInGameDealer(state.Mobile))
return;
int position = pvSrc.ReadByte();
game.Players.AssignDealer(position);
}
public static void OpenSeat(MahjongGame game, NetState state, PacketReader pvSrc)
{
if (game == null || !game.Players.IsInGameDealer(state.Mobile))
return;
int position = pvSrc.ReadByte();
if (game.Players.GetPlayer(position) == state.Mobile)
return;
game.Players.OpenSeat(position);
}
public static void ChangeOption(MahjongGame game, NetState state, PacketReader pvSrc)
{
if (game == null || !game.Players.IsInGameDealer(state.Mobile))
return;
pvSrc.ReadInt16();
pvSrc.ReadByte();
int options = pvSrc.ReadByte();
game.ShowScores = (options & 0x1) != 0;
game.SpectatorVision = (options & 0x2) != 0;
}
public static void MoveWallBreakIndicator(MahjongGame game, NetState state, PacketReader pvSrc)
{
if (game == null || !game.Players.IsInGameDealer(state.Mobile))
return;
int y = pvSrc.ReadInt16();
int x = pvSrc.ReadInt16();
game.WallBreakIndicator.Move(new Point2D(x, y));
}
public static void TogglePublicHand(MahjongGame game, NetState state, PacketReader pvSrc)
{
if (game == null || !game.Players.IsInGamePlayer(state.Mobile))
return;
pvSrc.ReadInt16();
pvSrc.ReadByte();
bool publicHand = pvSrc.ReadBoolean();
game.Players.SetPublic(game.Players.GetPlayerIndex(state.Mobile), publicHand);
}
public static void MoveTile(MahjongGame game, NetState state, PacketReader pvSrc)
{
if (game == null || !game.Players.IsInGamePlayer(state.Mobile))
return;
int number = pvSrc.ReadByte();
if (number < 0 || number >= game.Tiles.Length)
return;
pvSrc.ReadByte(); // Current direction
MahjongPieceDirection direction = GetDirection(pvSrc.ReadByte());
pvSrc.ReadByte();
bool flip = pvSrc.ReadBoolean();
pvSrc.ReadInt16(); // Current Y
pvSrc.ReadInt16(); // Current X
pvSrc.ReadByte();
int y = pvSrc.ReadInt16();
int x = pvSrc.ReadInt16();
pvSrc.ReadByte();
game.Tiles[number].Move(new Point2D(x, y), direction, flip, game.Players.GetPlayerIndex(state.Mobile));
}
public static void MoveDealerIndicator(MahjongGame game, NetState state, PacketReader pvSrc)
{
if (game == null || !game.Players.IsInGameDealer(state.Mobile))
return;
MahjongPieceDirection direction = GetDirection(pvSrc.ReadByte());
MahjongWind wind = GetWind(pvSrc.ReadByte());
int y = pvSrc.ReadInt16();
int x = pvSrc.ReadInt16();
game.DealerIndicator.Move(new Point2D(x, y), direction, wind);
}
private static MahjongPieceDirection GetDirection(int value)
{
switch ( value )
{
case 0:
return MahjongPieceDirection.Up;
case 1:
return MahjongPieceDirection.Left;
case 2:
return MahjongPieceDirection.Down;
default:
return MahjongPieceDirection.Right;
}
}
private static MahjongWind GetWind(int value)
{
switch ( value )
{
case 0:
return MahjongWind.North;
case 1:
return MahjongWind.East;
case 2:
return MahjongWind.South;
default:
return MahjongWind.West;
}
}
}
}

View File

@@ -0,0 +1,65 @@
using System;
namespace Server.Engines.Mahjong
{
public struct MahjongPieceDim
{
private readonly Point2D m_Position;
private readonly int m_Width;
private readonly int m_Height;
public MahjongPieceDim(Point2D position, int width, int height)
{
this.m_Position = position;
this.m_Width = width;
this.m_Height = height;
}
public Point2D Position
{
get
{
return this.m_Position;
}
}
public int Width
{
get
{
return this.m_Width;
}
}
public int Height
{
get
{
return this.m_Height;
}
}
public bool IsValid()
{
return this.m_Position.X >= 0 && this.m_Position.Y >= 0 && this.m_Position.X + this.m_Width <= 670 && this.m_Position.Y + this.m_Height <= 670;
}
public bool IsOverlapping(MahjongPieceDim dim)
{
return this.m_Position.X < dim.m_Position.X + dim.m_Width && this.m_Position.Y < dim.m_Position.Y + dim.m_Height && this.m_Position.X + this.m_Width > dim.m_Position.X && this.m_Position.Y + this.m_Height > dim.m_Position.Y;
}
public int GetHandArea()
{
if (this.m_Position.X + this.m_Width > 150 && this.m_Position.X < 520 && this.m_Position.Y < 35)
return 0;
if (this.m_Position.X + this.m_Width > 635 && this.m_Position.Y + this.m_Height > 150 && this.m_Position.Y < 520)
return 1;
if (this.m_Position.X + this.m_Width > 150 && this.m_Position.X < 520 && this.m_Position.Y + this.m_Height > 635)
return 2;
if (this.m_Position.X < 35 && this.m_Position.Y + this.m_Height > 150 && this.m_Position.Y < 520)
return 3;
return -1;
}
}
}

View File

@@ -0,0 +1,573 @@
using System;
using System.Collections;
namespace Server.Engines.Mahjong
{
public class MahjongPlayers
{
private readonly MahjongGame m_Game;
private readonly Mobile[] m_Players;
private readonly bool[] m_InGame;
private readonly bool[] m_PublicHand;
private readonly int[] m_Scores;
private readonly ArrayList m_Spectators;
private int m_DealerPosition;
public MahjongPlayers(MahjongGame game, int maxPlayers, int baseScore)
{
this.m_Game = game;
this.m_Spectators = new ArrayList();
this.m_Players = new Mobile[maxPlayers];
this.m_InGame = new bool[maxPlayers];
this.m_PublicHand = new bool[maxPlayers];
this.m_Scores = new int[maxPlayers];
for (int i = 0; i < this.m_Scores.Length; i++)
this.m_Scores[i] = baseScore;
}
public MahjongPlayers(MahjongGame game, GenericReader reader)
{
this.m_Game = game;
this.m_Spectators = new ArrayList();
int version = reader.ReadInt();
int seats = reader.ReadInt();
this.m_Players = new Mobile[seats];
this.m_InGame = new bool[seats];
this.m_PublicHand = new bool[seats];
this.m_Scores = new int[seats];
for (int i = 0; i < seats; i++)
{
this.m_Players[i] = reader.ReadMobile();
this.m_PublicHand[i] = reader.ReadBool();
this.m_Scores[i] = reader.ReadInt();
}
this.m_DealerPosition = reader.ReadInt();
}
public MahjongGame Game
{
get
{
return this.m_Game;
}
}
public int Seats
{
get
{
return this.m_Players.Length;
}
}
public Mobile Dealer
{
get
{
return this.m_Players[this.m_DealerPosition];
}
}
public int DealerPosition
{
get
{
return this.m_DealerPosition;
}
}
public Mobile GetPlayer(int index)
{
if (index < 0 || index >= this.m_Players.Length)
return null;
else
return this.m_Players[index];
}
public int GetPlayerIndex(Mobile mobile)
{
for (int i = 0; i < this.m_Players.Length; i++)
{
if (this.m_Players[i] == mobile)
return i;
}
return -1;
}
public bool IsInGameDealer(Mobile mobile)
{
if (this.Dealer != mobile)
return false;
else
return this.m_InGame[this.m_DealerPosition];
}
public bool IsInGamePlayer(int index)
{
if (index < 0 || index >= this.m_Players.Length || this.m_Players[index] == null)
return false;
else
return this.m_InGame[index];
}
public bool IsInGamePlayer(Mobile mobile)
{
int index = this.GetPlayerIndex(mobile);
return this.IsInGamePlayer(index);
}
public bool IsSpectator(Mobile mobile)
{
return this.m_Spectators.Contains(mobile);
}
public int GetScore(int index)
{
if (index < 0 || index >= this.m_Scores.Length)
return 0;
else
return this.m_Scores[index];
}
public bool IsPublic(int index)
{
if (index < 0 || index >= this.m_PublicHand.Length)
return false;
else
return this.m_PublicHand[index];
}
public void SetPublic(int index, bool value)
{
if (index < 0 || index >= this.m_PublicHand.Length || this.m_PublicHand[index] == value)
return;
this.m_PublicHand[index] = value;
this.SendTilesPacket(true, !this.m_Game.SpectatorVision);
if (this.IsInGamePlayer(index))
this.m_Players[index].SendLocalizedMessage(value ? 1062775 : 1062776); // Your hand is [not] publicly viewable.
}
public ArrayList GetInGameMobiles(bool players, bool spectators)
{
ArrayList list = new ArrayList();
if (players)
{
for (int i = 0; i < this.m_Players.Length; i++)
{
if (this.IsInGamePlayer(i))
list.Add(this.m_Players[i]);
}
}
if (spectators)
{
list.AddRange(this.m_Spectators);
}
return list;
}
public void CheckPlayers()
{
bool removed = false;
for (int i = 0; i < this.m_Players.Length; i++)
{
Mobile player = this.m_Players[i];
if (player != null)
{
if (player.Deleted)
{
this.m_Players[i] = null;
this.SendPlayerExitMessage(player);
this.UpdateDealer(true);
removed = true;
}
else if (this.m_InGame[i])
{
if (player.NetState == null)
{
this.m_InGame[i] = false;
this.SendPlayerExitMessage(player);
this.UpdateDealer(true);
removed = true;
}
else if (!this.m_Game.IsAccessibleTo(player) || player.Map != this.m_Game.Map || !player.InRange(this.m_Game.GetWorldLocation(), 5))
{
this.m_InGame[i] = false;
player.Send(new MahjongRelieve(this.m_Game));
this.SendPlayerExitMessage(player);
this.UpdateDealer(true);
removed = true;
}
}
}
}
for (int i = 0; i < this.m_Spectators.Count;)
{
Mobile mobile = (Mobile)this.m_Spectators[i];
if (mobile.NetState == null || mobile.Deleted)
{
this.m_Spectators.RemoveAt(i);
}
else if (!this.m_Game.IsAccessibleTo(mobile) || mobile.Map != this.m_Game.Map || !mobile.InRange(this.m_Game.GetWorldLocation(), 5))
{
this.m_Spectators.RemoveAt(i);
mobile.Send(new MahjongRelieve(this.m_Game));
}
else
{
i++;
}
}
if (removed && !this.UpdateSpectators())
this.SendPlayersPacket(true, true);
}
public void Join(Mobile mobile)
{
int index = this.GetPlayerIndex(mobile);
if (index >= 0)
{
this.AddPlayer(mobile, index, true);
}
else
{
int nextSeat = this.GetNextSeat();
if (nextSeat >= 0)
{
this.AddPlayer(mobile, nextSeat, true);
}
else
{
this.AddSpectator(mobile);
}
}
}
public void LeaveGame(Mobile player)
{
int index = this.GetPlayerIndex(player);
if (index >= 0)
{
this.m_InGame[index] = false;
this.SendPlayerExitMessage(player);
this.UpdateDealer(true);
this.SendPlayersPacket(true, true);
}
else
{
this.m_Spectators.Remove(player);
}
}
public void ResetScores(int value)
{
for (int i = 0; i < this.m_Scores.Length; i++)
{
this.m_Scores[i] = value;
}
this.SendPlayersPacket(true, this.m_Game.ShowScores);
this.SendLocalizedMessage(1062697); // The dealer redistributes the score sticks evenly.
}
public void TransferScore(Mobile from, int toPosition, int amount)
{
int fromPosition = this.GetPlayerIndex(from);
Mobile to = this.GetPlayer(toPosition);
if (fromPosition < 0 || to == null || this.m_Scores[fromPosition] < amount)
return;
this.m_Scores[fromPosition] -= amount;
this.m_Scores[toPosition] += amount;
if (this.m_Game.ShowScores)
{
this.SendPlayersPacket(true, true);
}
else
{
from.Send(new MahjongPlayersInfo(this.m_Game, from));
to.Send(new MahjongPlayersInfo(this.m_Game, to));
}
this.SendLocalizedMessage(1062774, string.Format("{0}\t{1}\t{2}", from.Name, to.Name, amount)); // ~1_giver~ gives ~2_receiver~ ~3_number~ points.
}
public void OpenSeat(int index)
{
Mobile player = this.GetPlayer(index);
if (player == null)
return;
if (this.m_InGame[index])
player.Send(new MahjongRelieve(this.m_Game));
this.m_Players[index] = null;
this.SendLocalizedMessage(1062699, player.Name); // ~1_name~ is relieved from the game by the dealer.
this.UpdateDealer(true);
if (!this.UpdateSpectators())
this.SendPlayersPacket(true, true);
}
public void AssignDealer(int index)
{
Mobile to = this.GetPlayer(index);
if (to == null || !this.m_InGame[index])
return;
int oldDealer = this.m_DealerPosition;
this.m_DealerPosition = index;
if (this.IsInGamePlayer(oldDealer))
this.m_Players[oldDealer].Send(new MahjongPlayersInfo(this.m_Game, this.m_Players[oldDealer]));
to.Send(new MahjongPlayersInfo(this.m_Game, to));
this.SendDealerChangedMessage();
}
public void SendPlayersPacket(bool players, bool spectators)
{
foreach (Mobile mobile in this.GetInGameMobiles(players, spectators))
{
mobile.Send(new MahjongPlayersInfo(this.m_Game, mobile));
}
}
public void SendGeneralPacket(bool players, bool spectators)
{
ArrayList mobiles = this.GetInGameMobiles(players, spectators);
if (mobiles.Count == 0)
return;
MahjongGeneralInfo generalInfo = new MahjongGeneralInfo(this.m_Game);
generalInfo.Acquire();
foreach (Mobile mobile in mobiles)
{
mobile.Send(generalInfo);
}
generalInfo.Release();
}
public void SendTilesPacket(bool players, bool spectators)
{
foreach (Mobile mobile in this.GetInGameMobiles(players, spectators))
{
mobile.Send(new MahjongTilesInfo(this.m_Game, mobile));
}
}
public void SendTilePacket(MahjongTile tile, bool players, bool spectators)
{
foreach (Mobile mobile in this.GetInGameMobiles(players, spectators))
{
mobile.Send(new MahjongTileInfo(tile, mobile));
}
}
public void SendRelievePacket(bool players, bool spectators)
{
ArrayList mobiles = this.GetInGameMobiles(players, spectators);
if (mobiles.Count == 0)
return;
MahjongRelieve relieve = new MahjongRelieve(this.m_Game);
relieve.Acquire();
foreach (Mobile mobile in mobiles)
{
mobile.Send(relieve);
}
relieve.Release();
}
public void SendLocalizedMessage(int number)
{
foreach (Mobile mobile in this.GetInGameMobiles(true, true))
{
mobile.SendLocalizedMessage(number);
}
}
public void SendLocalizedMessage(int number, string args)
{
foreach (Mobile mobile in this.GetInGameMobiles(true, true))
{
mobile.SendLocalizedMessage(number, args);
}
}
public void Save(GenericWriter writer)
{
writer.Write((int)0); // version
writer.Write(this.Seats);
for (int i = 0; i < this.Seats; i++)
{
writer.Write(this.m_Players[i]);
writer.Write(this.m_PublicHand[i]);
writer.Write(this.m_Scores[i]);
}
writer.Write(this.m_DealerPosition);
}
private void UpdateDealer(bool message)
{
if (this.IsInGamePlayer(this.m_DealerPosition))
return;
for (int i = this.m_DealerPosition + 1; i < this.m_Players.Length; i++)
{
if (this.IsInGamePlayer(i))
{
this.m_DealerPosition = i;
if (message)
this.SendDealerChangedMessage();
return;
}
}
for (int i = 0; i < this.m_DealerPosition; i++)
{
if (this.IsInGamePlayer(i))
{
this.m_DealerPosition = i;
if (message)
this.SendDealerChangedMessage();
return;
}
}
}
private int GetNextSeat()
{
for (int i = this.m_DealerPosition; i < this.m_Players.Length; i++)
{
if (this.m_Players[i] == null)
return i;
}
for (int i = 0; i < this.m_DealerPosition; i++)
{
if (this.m_Players[i] == null)
return i;
}
return -1;
}
private bool UpdateSpectators()
{
if (this.m_Spectators.Count == 0)
return false;
int nextSeat = this.GetNextSeat();
if (nextSeat >= 0)
{
Mobile newPlayer = (Mobile)this.m_Spectators[0];
this.m_Spectators.RemoveAt(0);
this.AddPlayer(newPlayer, nextSeat, false);
this.UpdateSpectators();
return true;
}
else
{
return false;
}
}
private void AddPlayer(Mobile player, int index, bool sendJoinGame)
{
this.m_Players[index] = player;
this.m_InGame[index] = true;
this.UpdateDealer(false);
if (sendJoinGame)
player.Send(new MahjongJoinGame(this.m_Game));
this.SendPlayersPacket(true, true);
player.Send(new MahjongGeneralInfo(this.m_Game));
player.Send(new MahjongTilesInfo(this.m_Game, player));
if (this.m_DealerPosition == index)
this.SendLocalizedMessage(1062773, player.Name); // ~1_name~ has entered the game as the dealer.
else
this.SendLocalizedMessage(1062772, player.Name); // ~1_name~ has entered the game as a player.
}
private void AddSpectator(Mobile mobile)
{
if (!this.IsSpectator(mobile))
{
this.m_Spectators.Add(mobile);
}
mobile.Send(new MahjongJoinGame(this.m_Game));
mobile.Send(new MahjongPlayersInfo(this.m_Game, mobile));
mobile.Send(new MahjongGeneralInfo(this.m_Game));
mobile.Send(new MahjongTilesInfo(this.m_Game, mobile));
}
private void SendDealerChangedMessage()
{
if (this.Dealer != null)
this.SendLocalizedMessage(1062698, this.Dealer.Name); // ~1_name~ is assigned the dealer.
}
private void SendPlayerExitMessage(Mobile who)
{
this.SendLocalizedMessage(1062762, who.Name); // ~1_name~ has left the game.
}
}
}

View File

@@ -0,0 +1,140 @@
using System;
namespace Server.Engines.Mahjong
{
public class MahjongTile
{
protected Point2D m_Position;
private readonly MahjongGame m_Game;
private readonly int m_Number;
private readonly MahjongTileType m_Value;
private int m_StackLevel;
private MahjongPieceDirection m_Direction;
private bool m_Flipped;
public MahjongTile(MahjongGame game, int number, MahjongTileType value, Point2D position, int stackLevel, MahjongPieceDirection direction, bool flipped)
{
this.m_Game = game;
this.m_Number = number;
this.m_Value = value;
this.m_Position = position;
this.m_StackLevel = stackLevel;
this.m_Direction = direction;
this.m_Flipped = flipped;
}
public MahjongTile(MahjongGame game, GenericReader reader)
{
this.m_Game = game;
int version = reader.ReadInt();
this.m_Number = reader.ReadInt();
this.m_Value = (MahjongTileType)reader.ReadInt();
this.m_Position = reader.ReadPoint2D();
this.m_StackLevel = reader.ReadInt();
this.m_Direction = (MahjongPieceDirection)reader.ReadInt();
this.m_Flipped = reader.ReadBool();
}
public MahjongGame Game
{
get
{
return this.m_Game;
}
}
public int Number
{
get
{
return this.m_Number;
}
}
public MahjongTileType Value
{
get
{
return this.m_Value;
}
}
public Point2D Position
{
get
{
return this.m_Position;
}
}
public int StackLevel
{
get
{
return this.m_StackLevel;
}
}
public MahjongPieceDirection Direction
{
get
{
return this.m_Direction;
}
}
public bool Flipped
{
get
{
return this.m_Flipped;
}
}
public MahjongPieceDim Dimensions
{
get
{
return GetDimensions(this.m_Position, this.m_Direction);
}
}
public bool IsMovable
{
get
{
return this.m_Game.GetStackLevel(this.Dimensions) <= this.m_StackLevel;
}
}
public static MahjongPieceDim GetDimensions(Point2D position, MahjongPieceDirection direction)
{
if (direction == MahjongPieceDirection.Up || direction == MahjongPieceDirection.Down)
return new MahjongPieceDim(position, 20, 30);
else
return new MahjongPieceDim(position, 30, 20);
}
public void Move(Point2D position, MahjongPieceDirection direction, bool flip, int validHandArea)
{
MahjongPieceDim dim = GetDimensions(position, direction);
int curHandArea = this.Dimensions.GetHandArea();
int newHandArea = dim.GetHandArea();
if (!this.IsMovable || !dim.IsValid() || (validHandArea >= 0 && ((curHandArea >= 0 && curHandArea != validHandArea) || (newHandArea >= 0 && newHandArea != validHandArea))))
return;
this.m_Position = position;
this.m_Direction = direction;
this.m_StackLevel = -1; // Avoid self interference
this.m_StackLevel = this.m_Game.GetStackLevel(dim) + 1;
this.m_Flipped = flip;
this.m_Game.Players.SendTilePacket(this, true, true);
}
public void Save(GenericWriter writer)
{
writer.Write((int)0); // version
writer.Write(this.m_Number);
writer.Write((int)this.m_Value);
writer.Write(this.m_Position);
writer.Write(this.m_StackLevel);
writer.Write((int)this.m_Direction);
writer.Write(this.m_Flipped);
}
}
}

View File

@@ -0,0 +1,38 @@
using System;
using System.Collections;
namespace Server.Engines.Mahjong
{
public class MahjongTileTypeGenerator
{
private readonly ArrayList m_LeftTileTypes;
public MahjongTileTypeGenerator(int count)
{
this.m_LeftTileTypes = new ArrayList(34 * count);
for (int i = 1; i <= 34; i++)
{
for (int j = 0; j < count; j++)
{
this.m_LeftTileTypes.Add((MahjongTileType)i);
}
}
}
public ArrayList LeftTileTypes
{
get
{
return this.m_LeftTileTypes;
}
}
public MahjongTileType Next()
{
int random = Utility.Random(this.m_LeftTileTypes.Count);
MahjongTileType next = (MahjongTileType)this.m_LeftTileTypes[random];
this.m_LeftTileTypes.RemoveAt(random);
return next;
}
}
}

View File

@@ -0,0 +1,69 @@
using System;
namespace Server.Engines.Mahjong
{
public class MahjongWallBreakIndicator
{
private readonly MahjongGame m_Game;
private Point2D m_Position;
public MahjongWallBreakIndicator(MahjongGame game, Point2D position)
{
this.m_Game = game;
this.m_Position = position;
}
public MahjongWallBreakIndicator(MahjongGame game, GenericReader reader)
{
this.m_Game = game;
int version = reader.ReadInt();
this.m_Position = reader.ReadPoint2D();
}
public MahjongGame Game
{
get
{
return this.m_Game;
}
}
public Point2D Position
{
get
{
return this.m_Position;
}
}
public MahjongPieceDim Dimensions
{
get
{
return GetDimensions(this.m_Position);
}
}
public static MahjongPieceDim GetDimensions(Point2D position)
{
return new MahjongPieceDim(position, 20, 20);
}
public void Move(Point2D position)
{
MahjongPieceDim dim = GetDimensions(position);
if (!dim.IsValid())
return;
this.m_Position = position;
this.m_Game.Players.SendGeneralPacket(true, true);
}
public void Save(GenericWriter writer)
{
writer.Write((int)0); // version
writer.Write(this.m_Position);
}
}
}

View File

@@ -0,0 +1,213 @@
using System;
using Server.Network;
namespace Server.Engines.Mahjong
{
public sealed class MahjongJoinGame : Packet
{
public MahjongJoinGame(MahjongGame game)
: base(0xDA)
{
this.EnsureCapacity(9);
this.m_Stream.Write((int)game.Serial);
this.m_Stream.Write((byte)0);
this.m_Stream.Write((byte)0x19);
}
}
public sealed class MahjongPlayersInfo : Packet
{
public MahjongPlayersInfo(MahjongGame game, Mobile to)
: base(0xDA)
{
MahjongPlayers players = game.Players;
this.EnsureCapacity(11 + 45 * players.Seats);
this.m_Stream.Write((int)game.Serial);
this.m_Stream.Write((byte)0);
this.m_Stream.Write((byte)0x2);
this.m_Stream.Write((byte)0);
this.m_Stream.Write((byte)players.Seats);
int n = 0;
for (int i = 0; i < players.Seats; i++)
{
Mobile mobile = players.GetPlayer(i);
if (mobile != null)
{
this.m_Stream.Write((int)mobile.Serial);
this.m_Stream.Write(players.DealerPosition == i ? (byte)0x1 : (byte)0x2);
this.m_Stream.Write((byte)i);
if (game.ShowScores || mobile == to)
this.m_Stream.Write((int)players.GetScore(i));
else
this.m_Stream.Write((int)0);
this.m_Stream.Write((short)0);
this.m_Stream.Write((byte)0);
this.m_Stream.Write(players.IsPublic(i));
this.m_Stream.WriteAsciiFixed(mobile.Name, 30);
this.m_Stream.Write(!players.IsInGamePlayer(i));
n++;
}
else if (game.ShowScores)
{
this.m_Stream.Write((int)0);
this.m_Stream.Write((byte)0x2);
this.m_Stream.Write((byte)i);
this.m_Stream.Write((int)players.GetScore(i));
this.m_Stream.Write((short)0);
this.m_Stream.Write((byte)0);
this.m_Stream.Write(players.IsPublic(i));
this.m_Stream.WriteAsciiFixed("", 30);
this.m_Stream.Write(true);
n++;
}
}
if (n != players.Seats)
{
this.m_Stream.Seek(10, System.IO.SeekOrigin.Begin);
this.m_Stream.Write((byte)n);
}
}
}
public sealed class MahjongGeneralInfo : Packet
{
public MahjongGeneralInfo(MahjongGame game)
: base(0xDA)
{
this.EnsureCapacity(13);
this.m_Stream.Write((int)game.Serial);
this.m_Stream.Write((byte)0);
this.m_Stream.Write((byte)0x5);
this.m_Stream.Write((short)0);
this.m_Stream.Write((byte)0);
this.m_Stream.Write((byte)((game.ShowScores ? 0x1 : 0x0) | (game.SpectatorVision ? 0x2 : 0x0)));
this.m_Stream.Write((byte)game.Dices.First);
this.m_Stream.Write((byte)game.Dices.Second);
this.m_Stream.Write((byte)game.DealerIndicator.Wind);
this.m_Stream.Write((short)game.DealerIndicator.Position.Y);
this.m_Stream.Write((short)game.DealerIndicator.Position.X);
this.m_Stream.Write((byte)game.DealerIndicator.Direction);
this.m_Stream.Write((short)game.WallBreakIndicator.Position.Y);
this.m_Stream.Write((short)game.WallBreakIndicator.Position.X);
}
}
public sealed class MahjongTilesInfo : Packet
{
public MahjongTilesInfo(MahjongGame game, Mobile to)
: base(0xDA)
{
MahjongTile[] tiles = game.Tiles;
MahjongPlayers players = game.Players;
this.EnsureCapacity(11 + 9 * tiles.Length);
this.m_Stream.Write((int)game.Serial);
this.m_Stream.Write((byte)0);
this.m_Stream.Write((byte)0x4);
this.m_Stream.Write((short)tiles.Length);
foreach (MahjongTile tile in tiles)
{
this.m_Stream.Write((byte)tile.Number);
if (tile.Flipped)
{
int hand = tile.Dimensions.GetHandArea();
if (hand < 0 || players.IsPublic(hand) || players.GetPlayer(hand) == to || (game.SpectatorVision && players.IsSpectator(to)))
this.m_Stream.Write((byte)tile.Value);
else
this.m_Stream.Write((byte)0);
}
else
{
this.m_Stream.Write((byte)0);
}
this.m_Stream.Write((short)tile.Position.Y);
this.m_Stream.Write((short)tile.Position.X);
this.m_Stream.Write((byte)tile.StackLevel);
this.m_Stream.Write((byte)tile.Direction);
this.m_Stream.Write(tile.Flipped ? (byte)0x10 : (byte)0x0);
}
}
}
public sealed class MahjongTileInfo : Packet
{
public MahjongTileInfo(MahjongTile tile, Mobile to)
: base(0xDA)
{
MahjongGame game = tile.Game;
MahjongPlayers players = game.Players;
this.EnsureCapacity(18);
this.m_Stream.Write((int)tile.Game.Serial);
this.m_Stream.Write((byte)0);
this.m_Stream.Write((byte)0x3);
this.m_Stream.Write((byte)tile.Number);
if (tile.Flipped)
{
int hand = tile.Dimensions.GetHandArea();
if (hand < 0 || players.IsPublic(hand) || players.GetPlayer(hand) == to || (game.SpectatorVision && players.IsSpectator(to)))
this.m_Stream.Write((byte)tile.Value);
else
this.m_Stream.Write((byte)0);
}
else
{
this.m_Stream.Write((byte)0);
}
this.m_Stream.Write((short)tile.Position.Y);
this.m_Stream.Write((short)tile.Position.X);
this.m_Stream.Write((byte)tile.StackLevel);
this.m_Stream.Write((byte)tile.Direction);
this.m_Stream.Write(tile.Flipped ? (byte)0x10 : (byte)0x0);
}
}
public sealed class MahjongRelieve : Packet
{
public MahjongRelieve(MahjongGame game)
: base(0xDA)
{
this.EnsureCapacity(9);
this.m_Stream.Write((int)game.Serial);
this.m_Stream.Write((byte)0);
this.m_Stream.Write((byte)0x1A);
}
}
}

View File

@@ -0,0 +1,327 @@
using System;
using Server.Commands;
namespace Server.Items
{
public class MarkContainer : LockableContainer
{
private bool m_AutoLock;
private InternalTimer m_RelockTimer;
private Map m_TargetMap;
private Point3D m_Target;
private string m_Description;
[Constructable]
public MarkContainer()
: this(false)
{
}
[Constructable]
public MarkContainer(bool bone)
: this(bone, false)
{
}
[Constructable]
public MarkContainer(bool bone, bool locked)
: base(bone ? 0xECA : 0xE79)
{
this.Movable = false;
if (bone)
this.Hue = 1102;
this.m_AutoLock = locked;
this.Locked = locked;
if (locked)
this.LockLevel = -255;
}
public MarkContainer(Serial serial)
: base(serial)
{
}
[CommandProperty(AccessLevel.GameMaster)]
public bool AutoLock
{
get
{
return this.m_AutoLock;
}
set
{
this.m_AutoLock = value;
if (!this.m_AutoLock)
this.StopTimer();
else if (!this.Locked && this.m_RelockTimer == null)
this.m_RelockTimer = new InternalTimer(this);
}
}
[CommandProperty(AccessLevel.GameMaster)]
public Map TargetMap
{
get
{
return this.m_TargetMap;
}
set
{
this.m_TargetMap = value;
}
}
[CommandProperty(AccessLevel.GameMaster)]
public Point3D Target
{
get
{
return this.m_Target;
}
set
{
this.m_Target = value;
}
}
[CommandProperty(AccessLevel.GameMaster)]
public bool Bone
{
get
{
return this.ItemID == 0xECA;
}
set
{
this.ItemID = value ? 0xECA : 0xE79;
this.Hue = value ? 1102 : 0;
}
}
[CommandProperty(AccessLevel.GameMaster)]
public string Description
{
get
{
return this.m_Description;
}
set
{
this.m_Description = value;
}
}
public override bool IsDecoContainer
{
get
{
return false;
}
}
[CommandProperty(AccessLevel.GameMaster)]
public override bool Locked
{
get
{
return base.Locked;
}
set
{
base.Locked = value;
if (this.m_AutoLock)
{
this.StopTimer();
if (!this.Locked)
this.m_RelockTimer = new InternalTimer(this);
}
}
}
public static void Initialize()
{
CommandSystem.Register("SecretLocGen", AccessLevel.Administrator, new CommandEventHandler(SecretLocGen_OnCommand));
CommandSystem.Register("SecretLocDelete", AccessLevel.Administrator, new CommandEventHandler(SecretLocDelete_OnCommand));
}
[Usage("SecretLocDelete")]
[Description("Deletes mark containers to Malas secret locations.")]
public static void SecretLocDelete_OnCommand(CommandEventArgs e)
{
WeakEntityCollection.Delete("malas");
}
[Usage("SecretLocGen")]
[Description("Generates mark containers to Malas secret locations.")]
public static void SecretLocGen_OnCommand(CommandEventArgs e)
{
CreateMalasPassage(951, 546, -70, 1006, 994, -70, false, false);
CreateMalasPassage(914, 192, -79, 1019, 1062, -70, false, false);
CreateMalasPassage(1614, 143, -90, 1214, 1313, -90, false, false);
CreateMalasPassage(2176, 324, -90, 1554, 172, -90, false, false);
CreateMalasPassage(864, 812, -90, 1061, 1161, -70, false, false);
CreateMalasPassage(1051, 1434, -85, 1076, 1244, -70, false, true);
CreateMalasPassage(1326, 523, -87, 1201, 1554, -70, false, false);
CreateMalasPassage(424, 189, -1, 2333, 1501, -90, true, false);
CreateMalasPassage(1313, 1115, -85, 1183, 462, -45, false, false);
e.Mobile.SendMessage("Secret mark containers have been created.");
Server.Engines.GenerateForgottenPyramid.Generate(e.Mobile);
}
public void StopTimer()
{
if (this.m_RelockTimer != null)
this.m_RelockTimer.Stop();
this.m_RelockTimer = null;
}
public void Mark(RecallRune rune)
{
if (this.TargetMap != null)
{
rune.Marked = true;
rune.TargetMap = this.m_TargetMap;
rune.Target = this.m_Target;
rune.Description = this.m_Description;
rune.House = null;
}
}
public override bool OnDragDrop(Mobile from, Item dropped)
{
RecallRune rune = dropped as RecallRune;
if (rune != null && base.OnDragDrop(from, dropped))
{
this.Mark(rune);
return true;
}
else
{
return false;
}
}
public override bool OnDragDropInto(Mobile from, Item dropped, Point3D p)
{
RecallRune rune = dropped as RecallRune;
if (rune != null && base.OnDragDropInto(from, dropped, p))
{
this.Mark(rune);
return true;
}
else
{
return false;
}
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write((int)0); // version
writer.Write(this.m_AutoLock);
if (!this.Locked && this.m_AutoLock)
writer.WriteDeltaTime(this.m_RelockTimer.RelockTime);
writer.Write(this.m_TargetMap);
writer.Write(this.m_Target);
writer.Write(this.m_Description);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
this.m_AutoLock = reader.ReadBool();
if (!this.Locked && this.m_AutoLock)
this.m_RelockTimer = new InternalTimer(this, reader.ReadDeltaTime() - DateTime.UtcNow);
this.m_TargetMap = reader.ReadMap();
this.m_Target = reader.ReadPoint3D();
this.m_Description = reader.ReadString();
}
private static bool FindMarkContainer(Point3D p, Map map)
{
IPooledEnumerable eable = map.GetItemsInRange(p, 0);
foreach (Item item in eable)
{
if (item.Z == p.Z && item is MarkContainer)
{
eable.Free();
return true;
}
}
eable.Free();
return false;
}
private static void CreateMalasPassage(int x, int y, int z, int xTarget, int yTarget, int zTarget, bool bone, bool locked)
{
Point3D location = new Point3D(x, y, z);
if (FindMarkContainer(location, Map.Malas))
return;
MarkContainer cont = new MarkContainer(bone, locked);
WeakEntityCollection.Add("malas", cont);
cont.TargetMap = Map.Malas;
cont.Target = new Point3D(xTarget, yTarget, zTarget);
cont.Description = "strange location";
cont.MoveToWorld(location, Map.Malas);
}
private class InternalTimer : Timer
{
private readonly MarkContainer m_Container;
private readonly DateTime m_RelockTime;
public InternalTimer(MarkContainer container)
: this(container, TimeSpan.FromMinutes(5.0))
{
}
public InternalTimer(MarkContainer container, TimeSpan delay)
: base(delay)
{
this.m_Container = container;
this.m_RelockTime = DateTime.UtcNow + delay;
this.Start();
}
public MarkContainer Container
{
get
{
return this.m_Container;
}
}
public DateTime RelockTime
{
get
{
return this.m_RelockTime;
}
}
protected override void OnTick()
{
this.m_Container.Locked = true;
this.m_Container.LockLevel = -255;
}
}
}
}

View File

@@ -0,0 +1,53 @@
using System;
namespace Server.Items
{
public class MeagerImbuingBag : BaseRewardBag
{
[Constructable]
public MeagerImbuingBag()
{
switch (Utility.Random(4))
{
case 0:
DropItem(new SlithTongue());
break;
case 1:
DropItem(new GoblinBlood());
break;
case 2:
DropItem(new ReflectiveWolfEye());
break;
case 3:
DropItem(new RaptorTeeth());
break;
}
}
public MeagerImbuingBag(Serial serial)
: base(serial)
{
}
public override int LabelNumber
{
get
{
return 1112994;
}
}
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();
}
}
}

View File

@@ -0,0 +1,50 @@
using System;
namespace Server.Items
{
public class MeagerMuseumBag : BaseRewardBag
{
[Constructable]
public MeagerMuseumBag()
{
DropItem(new Gold(3000));
DropItem(new TerMurQuestRewardBook());
for (int i = 0; i < Utility.RandomMinMax(5, 7); i++)
{
DropItemStacked(Loot.RandomGem());
}
for (int i = 0; i < Utility.RandomMinMax(1, 3); i++)
{
DropItemStacked(Loot.RandomMLResource());
}
}
public MeagerMuseumBag(Serial serial)
: base(serial)
{
}
public override int LabelNumber
{
get
{
return 1112993;
}
}
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();
}
}
}

View File

@@ -0,0 +1,262 @@
using System;
namespace Server.Items
{
[Flipable]
public class ParagonChest : LockableContainer
{
private static readonly int[] m_ItemIDs = new int[]
{
0x9AB, 0xE40, 0xE41, 0xE7C
};
private static readonly int[] m_Hues = new int[]
{
0x0, 0x455, 0x47E, 0x89F, 0x8A5, 0x8AB,
0x966, 0x96D, 0x972, 0x973, 0x979
};
private string m_Name;
[Constructable]
public ParagonChest(string name, int level)
: base(Utility.RandomList(m_ItemIDs))
{
m_Name = name;
Hue = Utility.RandomList(m_Hues);
Fill(level);
}
public ParagonChest(Serial serial)
: base(serial)
{
}
public override void OnSingleClick(Mobile from)
{
LabelTo(from, 1063449, m_Name);
}
public override void GetProperties(ObjectPropertyList list)
{
base.GetProperties(list);
list.Add(1063449, m_Name);
}
public void Flip()
{
switch ( ItemID )
{
case 0x9AB :
ItemID = 0xE7C;
break;
case 0xE7C :
ItemID = 0x9AB;
break;
case 0xE40 :
ItemID = 0xE41;
break;
case 0xE41 :
ItemID = 0xE40;
break;
}
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write((int)0); // version
writer.Write(m_Name);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
m_Name = Utility.Intern(reader.ReadString());
}
private static void GetRandomAOSStats(out int attributeCount, out int min, out int max)
{
int rnd = Utility.Random(15);
if (rnd < 1)
{
attributeCount = Utility.RandomMinMax(2, 6);
min = 20;
max = 70;
}
else if (rnd < 3)
{
attributeCount = Utility.RandomMinMax(2, 4);
min = 20;
max = 50;
}
else if (rnd < 6)
{
attributeCount = Utility.RandomMinMax(2, 3);
min = 20;
max = 40;
}
else if (rnd < 10)
{
attributeCount = Utility.RandomMinMax(1, 2);
min = 10;
max = 30;
}
else
{
attributeCount = 1;
min = 10;
max = 20;
}
}
private void Fill(int level)
{
TrapType = TrapType.ExplosionTrap;
TrapPower = level * 25;
TrapLevel = level;
Locked = true;
switch ( level )
{
case 1:
RequiredSkill = 36;
break;
case 2:
RequiredSkill = 76;
break;
case 3:
RequiredSkill = 84;
break;
case 4:
RequiredSkill = 92;
break;
case 5:
RequiredSkill = 100;
break;
case 6:
RequiredSkill = 100;
break;
}
LockLevel = RequiredSkill - 10;
MaxLockLevel = RequiredSkill + 40;
DropItem(new Gold(level * 200));
for (int i = 0; i < level; ++i)
DropItem(Loot.RandomScroll(0, 63, SpellbookType.Regular));
for (int i = 0; i < level * 2; ++i)
{
Item item;
if (Core.AOS)
item = Loot.RandomArmorOrShieldOrWeaponOrJewelry();
else
item = Loot.RandomArmorOrShieldOrWeapon();
if (item != null && Core.HS && RandomItemGenerator.Enabled)
{
int min, max;
TreasureMapChest.GetRandomItemStat(out min, out max);
RunicReforging.GenerateRandomItem(item, 0, min, max);
DropItem(item);
continue;
}
if (item is BaseWeapon)
{
BaseWeapon weapon = (BaseWeapon)item;
if (Core.AOS)
{
int attributeCount;
int min, max;
GetRandomAOSStats(out attributeCount, out min, out max);
BaseRunicTool.ApplyAttributesTo(weapon, attributeCount, min, max);
}
else
{
weapon.DamageLevel = (WeaponDamageLevel)Utility.Random(6);
weapon.AccuracyLevel = (WeaponAccuracyLevel)Utility.Random(6);
weapon.DurabilityLevel = (WeaponDurabilityLevel)Utility.Random(6);
}
DropItem(item);
}
else if (item is BaseArmor)
{
BaseArmor armor = (BaseArmor)item;
if (Core.AOS)
{
int attributeCount;
int min, max;
GetRandomAOSStats(out attributeCount, out min, out max);
BaseRunicTool.ApplyAttributesTo(armor, attributeCount, min, max);
}
else
{
armor.ProtectionLevel = (ArmorProtectionLevel)Utility.Random(6);
armor.Durability = (ArmorDurabilityLevel)Utility.Random(6);
}
DropItem(item);
}
else if (item is BaseHat)
{
BaseHat hat = (BaseHat)item;
if (Core.AOS)
{
int attributeCount;
int min, max;
GetRandomAOSStats(out attributeCount, out min, out max);
BaseRunicTool.ApplyAttributesTo(hat, attributeCount, min, max);
}
DropItem(item);
}
else if (item is BaseJewel)
{
int attributeCount;
int min, max;
GetRandomAOSStats(out attributeCount, out min, out max);
BaseRunicTool.ApplyAttributesTo((BaseJewel)item, attributeCount, min, max);
DropItem(item);
}
}
for (int i = 0; i < level; i++)
{
Item item = Loot.RandomPossibleReagent();
item.Amount = Utility.RandomMinMax(40, 60);
DropItem(item);
}
for (int i = 0; i < level; i++)
{
Item item = Loot.RandomGem();
DropItem(item);
}
DropItem(new TreasureMap(TreasureMapInfo.ConvertLevel(level + 1), (Siege.SiegeShard ? Map.Felucca : Utility.RandomBool() ? Map.Felucca : Map.Trammel)));
}
}
}

View File

@@ -0,0 +1,214 @@
using System;
using System.Collections.Generic;
namespace Server.Items
{
public class PlagueBeastBackpack : BaseContainer
{
private static readonly int[,,] m_Positions = new int[,,]
{
{ { 275, 85 }, { 360, 111 }, { 375, 184 }, { 332, 228 }, { 141, 105 }, { 189, 75 } },
{ { 274, 34 }, { 327, 89 }, { 354, 168 }, { 304, 225 }, { 113, 86 }, { 189, 75 } },
{ { 276, 79 }, { 369, 117 }, { 372, 192 }, { 336, 230 }, { 141, 116 }, { 189, 75 } },
};
private static readonly int[] m_BrainHues = new int[]
{
0x2B, 0x42, 0x54, 0x60
};
public PlagueBeastBackpack()
: base(0x261B)
{
this.Layer = Layer.Backpack;
}
public PlagueBeastBackpack(Serial serial)
: base(serial)
{
}
public override int DefaultMaxWeight
{
get
{
return 0;
}
}
public override int DefaultMaxItems
{
get
{
return 0;
}
}
public override int DefaultGumpID
{
get
{
return 0x2A63;
}
}
public override int DefaultDropSound
{
get
{
return 0x23F;
}
}
public void Initialize()
{
this.AddInnard(0x1CF6, 0x0, 227, 128);
this.AddInnard(0x1D10, 0x0, 251, 128);
this.AddInnard(0x1FBE, 0x21, 240, 83);
this.AddInnard(new PlagueBeastHeart(), 229, 104);
this.AddInnard(0x1D06, 0x0, 283, 91);
this.AddInnard(0x1FAF, 0x21, 315, 107);
this.AddInnard(0x1FB9, 0x21, 289, 87);
this.AddInnard(0x9E7, 0x21, 304, 96);
this.AddInnard(0x1B1A, 0x66D, 335, 102);
this.AddInnard(0x1D10, 0x0, 338, 146);
this.AddInnard(0x1FB3, 0x21, 358, 167);
this.AddInnard(0x1D0B, 0x0, 357, 155);
this.AddInnard(0x9E7, 0x21, 339, 184);
this.AddInnard(0x1B1A, 0x66D, 157, 172);
this.AddInnard(0x1D11, 0x0, 147, 157);
this.AddInnard(0x1FB9, 0x21, 121, 131);
this.AddInnard(0x9E7, 0x21, 166, 176);
this.AddInnard(0x1D0B, 0x0, 122, 138);
this.AddInnard(0x1D0D, 0x0, 118, 150);
this.AddInnard(0x1FB3, 0x21, 97, 123);
this.AddInnard(0x1D08, 0x0, 115, 113);
this.AddInnard(0x9E7, 0x21, 109, 109);
this.AddInnard(0x9E7, 0x21, 91, 122);
this.AddInnard(0x9E7, 0x21, 94, 160);
this.AddInnard(0x1B19, 0x66D, 170, 121);
this.AddInnard(0x1FAF, 0x21, 161, 111);
this.AddInnard(0x1D0B, 0x0, 158, 112);
this.AddInnard(0x9E7, 0x21, 159, 101);
this.AddInnard(0x1D10, 0x0, 132, 177);
this.AddInnard(0x1D0E, 0x0, 110, 178);
this.AddInnard(0x1FB3, 0x21, 95, 194);
this.AddInnard(0x1FAF, 0x21, 154, 203);
this.AddInnard(0x1B1A, 0x66D, 110, 237);
this.AddInnard(0x9E7, 0x21, 111, 171);
this.AddInnard(0x9E7, 0x21, 90, 197);
this.AddInnard(0x9E7, 0x21, 166, 205);
this.AddInnard(0x9E7, 0x21, 96, 242);
this.AddInnard(0x1D10, 0x0, 334, 196);
this.AddInnard(0x1D0B, 0x0, 322, 270);
List<PlagueBeastOrgan> organs = new List<PlagueBeastOrgan>();
PlagueBeastOrgan organ;
for (int i = 0; i < 6; i++)
{
int random = Utility.Random(3);
if (i == 5)
random = 0;
switch ( random )
{
default:
case 0:
organ = new PlagueBeastRockOrgan();
break;
case 1:
organ = new PlagueBeastMaidenOrgan();
break;
case 2:
organ = new PlagueBeastRubbleOrgan();
break;
}
organs.Add(organ);
this.AddInnard(organ, m_Positions[random, i, 0], m_Positions[random, i, 1]);
}
organ = new PlagueBeastBackupOrgan();
organs.Add(organ);
this.AddInnard(organ, 129, 214);
for (int i = 0; i < m_BrainHues.Length; i++)
{
int random = Utility.Random(organs.Count);
organ = organs[random];
organ.BrainHue = m_BrainHues[i];
organs.RemoveAt(random);
}
organs.Clear();
this.AddInnard(new PlagueBeastMainOrgan(), 240, 161);
}
public override bool TryDropItem(Mobile from, Item dropped, bool sendFullMessage)
{
if (dropped is PlagueBeastInnard || dropped is PlagueBeastGland)
return base.TryDropItem(from, dropped, sendFullMessage);
return false;
}
public override bool OnDragDropInto(Mobile from, Item item, Point3D p)
{
if (this.IsAccessibleTo(from) && (item is PlagueBeastInnard || item is PlagueBeastGland))
{
Rectangle2D ir = ItemBounds.Table[item.ItemID];
int x, y;
int cx = p.X + ir.X + ir.Width / 2;
int cy = p.Y + ir.Y + ir.Height / 2;
for (int i = this.Items.Count - 1; i >= 0; i--)
{
PlagueBeastComponent innard = this.Items[i] as PlagueBeastComponent;
if (innard != null)
{
Rectangle2D r = ItemBounds.Table[innard.ItemID];
x = innard.X + r.X;
y = innard.Y + r.Y;
if (cx >= x && cx <= x + r.Width && cy >= y && cy <= y + r.Height)
{
innard.OnDragDrop(from, item);
break;
}
}
}
return base.OnDragDropInto(from, item, p);
}
return false;
}
public void AddInnard(int itemID, int hue, int x, int y)
{
this.AddInnard(new PlagueBeastInnard(itemID, hue), x, y);
}
public void AddInnard(PlagueBeastInnard innard, int x, int y)
{
this.AddItem(innard);
innard.Location = new Point3D(x, y, 0);
innard.Map = this.Map;
}
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();
}
}
}

View File

@@ -0,0 +1,74 @@
using System;
/*
* Simply add this box with param true to create the entire valentine's 2007 package.
* Adding it with no params or false will create an empty box.
*/
namespace Server.Items
{
public class RedVelvetGiftBox : BaseContainer
{
[Constructable]
public RedVelvetGiftBox()
: this(false)
{
}
[Constructable]
public RedVelvetGiftBox(bool fill)
: base(0xE7A)
{
this.Hue = 0x20;
if (fill)
{
for (int i = 0; i < 5; i++)
{
this.AddToBox(new ValentinesCardSouth(), new Point3D(60 + (i * 10), 47, 0));
this.AddToBox(new ValentinesCardEast(), new Point3D(20 + (i * 10), 72, 0));
}
this.AddToBox(new Bacon(), new Point3D(90, 85, 0));
this.AddToBox(new RoseInAVase(), new Point3D(130, 55, 0));
}
}
public RedVelvetGiftBox(Serial serial)
: base(serial)
{
}
public override int DefaultGumpID
{
get
{
return 0x3f;
}
}
public override int LabelNumber
{
get
{
return 1077596;
}
}// A Red Velvet Box
public virtual void AddToBox(Item item, Point3D loc)
{
this.DropItem(item);
item.Location = loc;
}
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();
}
}
}

View File

@@ -0,0 +1,171 @@
using System;
using Server.Engines.Quests;
namespace Server.Items
{
public class BaseRewardBackpack : Backpack
{
public virtual int Level { get { return 1; } }
public BaseRewardBackpack()
: base()
{
Hue = 1127;
DropItem(new Gold(Level * 2000));
DropItem(new TerMurQuestRewardBook());
int itemDrop;
switch (Level)
{
case 3: itemDrop = 5; break;
default: itemDrop = 3; break;
}
for (int i = 0; i < itemDrop; i++)
{
Item item = Loot.RandomArmorOrShieldOrWeaponOrJewelry(false, false, true);
if (item != null)
{
BaseReward.ApplyMods(item);
DropItem(item);
}
}
itemDrop = Utility.RandomMinMax(2, 3);
for (int i = 0; i < itemDrop; i++)
{
if (Level == 1)
{
DropItemStacked(Loot.RandomGem());
}
else
{
DropItemStacked(Loot.RandomRareGem());
}
}
switch (Level)
{
case 1: DropItem(new MagicalResidue(20)); break;
case 2: DropItem(new EnchantedEssence(10)); break;
case 3: DropItem(new RelicFragment()); break;
}
}
public BaseRewardBackpack(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);
reader.ReadInt();
}
}
public class DustyAdventurersBackpack : BaseRewardBackpack
{
public override int LabelNumber { get { return 1113189; } } // Dusty Adventurer's Backpack
[Constructable]
public DustyAdventurersBackpack()
: base()
{
}
public DustyAdventurersBackpack(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);
reader.ReadInt();
}
}
public class DustyExplorersBackpack : BaseRewardBackpack
{
public override int LabelNumber { get { return 1113190; } } // Dusty Explorer's Backpack
public override int Level { get { return 2; } }
[Constructable]
public DustyExplorersBackpack()
: base()
{
}
public DustyExplorersBackpack(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);
reader.ReadInt();
}
}
public class DustyHuntersBackpack : BaseRewardBackpack
{
public override int LabelNumber { get { return 1113191; } } // Dusty Hunter's Backpack
public override int Level { get { return 3; } }
[Constructable]
public DustyHuntersBackpack()
: base()
{
}
public DustyHuntersBackpack(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);
reader.ReadInt();
}
}
}

View File

@@ -0,0 +1,204 @@
using System;
using Reward = Server.Engines.Quests.BaseReward;
namespace Server.Items
{
public class BaseRewardBag : Bag
{
public BaseRewardBag()
: base()
{
Hue = Reward.RewardBagHue();
while (Items.Count < ItemAmount)
{
if (0.05 > Utility.RandomDouble()) // check
DropItem(Loot.RandomTalisman());
else
{
switch ( Utility.Random(4) )
{
case 0:
DropItem(Reward.Armor());
break;
case 1:
DropItem(Reward.RangedWeapon());
break;
case 2:
DropItem(Reward.Weapon());
break;
case 3:
DropItem(Reward.Jewlery());
break;
}
}
}
}
public BaseRewardBag(Serial serial)
: base(serial)
{
}
public virtual int ItemAmount
{
get
{
return 0;
}
}
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 SmallTrinketBag : BaseRewardBag
{
[Constructable]
public SmallTrinketBag()
: base()
{
}
public SmallTrinketBag(Serial serial)
: base(serial)
{
}
public override int ItemAmount
{
get
{
return 1;
}
}
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 TrinketBag : BaseRewardBag
{
[Constructable]
public TrinketBag()
: base()
{
}
public TrinketBag(Serial serial)
: base(serial)
{
}
public override int ItemAmount
{
get
{
return 2;
}
}
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 TreasureBag : BaseRewardBag
{
[Constructable]
public TreasureBag()
: base()
{
}
public TreasureBag(Serial serial)
: base(serial)
{
}
public override int ItemAmount
{
get
{
return 3;
}
}
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 LargeTreasureBag : BaseRewardBag
{
[Constructable]
public LargeTreasureBag()
: base()
{
}
public LargeTreasureBag(Serial serial)
: base(serial)
{
}
public override int ItemAmount
{
get
{
return 4;
}
}
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();
}
}
}

View File

@@ -0,0 +1,63 @@
using System;
using Reward = Server.Engines.Quests.BaseReward;
namespace Server.Items
{
public class RewardBox : WoodenBox
{
[Constructable]
public RewardBox()
: base()
{
this.Hue = Reward.StrongboxHue();
while (this.Items.Count < this.Amount)
{
switch ( Utility.Random(4) )
{
case 0:
this.DropItem(Reward.Armor());
break;
case 1:
this.DropItem(Reward.RangedWeapon());
break;
case 2:
this.DropItem(Reward.Weapon());
break;
case 3:
this.DropItem(Reward.Jewlery());
break;
}
}
if (0.25 > Utility.RandomDouble()) // check
this.DropItem(Loot.RandomTalisman());
}
public RewardBox(Serial serial)
: base(serial)
{
}
public virtual int ItemAmount
{
get
{
return 6;
}
}
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();
}
}
}

View File

@@ -0,0 +1,394 @@
using System;
using System.Collections.Generic;
using Server.ContextMenus;
using Server.Engines.Craft;
using Server.Network;
using System.Linq;
namespace Server.Items
{
public class SalvageBag : Bag
{
private bool m_Failure;
public override int LabelNumber
{
get
{
return 1079931;
}
}// Salvage Bag
[Constructable]
public SalvageBag()
: this(Utility.RandomBlueHue())
{
}
[Constructable]
public SalvageBag(int hue)
{
Weight = 2.0;
Hue = hue;
m_Failure = false;
}
public override void GetContextMenuEntries(Mobile from, List<ContextMenuEntry> list)
{
base.GetContextMenuEntries(from, list);
if (from.Alive)
{
list.Add(new SalvageIngotsEntry(this, IsChildOf(from.Backpack) && Resmeltables()));
list.Add(new SalvageClothEntry(this, IsChildOf(from.Backpack) && Scissorables()));
list.Add(new SalvageAllEntry(this, IsChildOf(from.Backpack) && Resmeltables() && Scissorables()));
}
}
#region Checks
private bool Resmeltables() //Where context menu checks for metal items and dragon barding deeds
{
foreach (Item i in Items)
{
if (i != null && !i.Deleted)
{
if (i is BaseWeapon)
{
if (CraftResources.GetType(((BaseWeapon)i).Resource) == CraftResourceType.Metal)
return true;
}
if (i is BaseArmor)
{
if (CraftResources.GetType(((BaseArmor)i).Resource) == CraftResourceType.Metal)
return true;
}
if (i is DragonBardingDeed)
return true;
}
}
return false;
}
private bool Scissorables() //Where context menu checks for Leather items and cloth items
{
return Items.Any(i => (i != null) && (!i.Deleted) && (i is IScissorable) && (i is Item));
}
#endregion
#region Resmelt.cs
private bool Resmelt(Mobile from, Item item, CraftResource resource)
{
try
{
if (CraftResources.GetType(resource) != CraftResourceType.Metal)
return false;
CraftResourceInfo info = CraftResources.GetInfo(resource);
if (info == null || info.ResourceTypes.Length == 0)
return false;
CraftItem craftItem = DefBlacksmithy.CraftSystem.CraftItems.SearchFor(item.GetType());
if (craftItem == null || craftItem.Resources.Count == 0)
return false;
CraftRes craftResource = craftItem.Resources.GetAt(0);
if (craftResource.Amount < 2)
return false; // Not enough metal to resmelt
double difficulty = 0.0;
switch ( resource )
{
case CraftResource.DullCopper:
difficulty = 65.0;
break;
case CraftResource.ShadowIron:
difficulty = 70.0;
break;
case CraftResource.Copper:
difficulty = 75.0;
break;
case CraftResource.Bronze:
difficulty = 80.0;
break;
case CraftResource.Gold:
difficulty = 85.0;
break;
case CraftResource.Agapite:
difficulty = 90.0;
break;
case CraftResource.Verite:
difficulty = 95.0;
break;
case CraftResource.Valorite:
difficulty = 99.0;
break;
}
Type resourceType = info.ResourceTypes[0];
Item ingot = (Item)Activator.CreateInstance(resourceType);
double skill = Math.Max(from.Skills[SkillName.Mining].Value, from.Skills[SkillName.Blacksmith].Value);
if (item is DragonBardingDeed || (item is BaseArmor && ((BaseArmor)item).PlayerConstructed) || (item is BaseWeapon && ((BaseWeapon)item).PlayerConstructed) || (item is BaseClothing && ((BaseClothing)item).PlayerConstructed))
{
if (skill > 100.0)
skill = 100.0;
double amount = (((4 + skill) * craftResource.Amount - 4) * 0.0068);
if (amount < 2)
ingot.Amount = 2;
else
ingot.Amount = (int)amount;
}
else
{
ingot.Amount = 2;
}
if (difficulty > skill)
{
m_Failure = true;
ingot.Delete();
}
else
item.Delete();
from.AddToBackpack(ingot);
from.PlaySound(0x2A);
from.PlaySound(0x240);
return true;
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
return false;
}
#endregion
#region Salvaging
private void SalvageIngots(Mobile from)
{
bool ToolFound = from.Backpack.Items.Any(i => i is ITool && ((ITool)i).CraftSystem == DefBlacksmithy.CraftSystem);
if (!ToolFound)
{
from.SendLocalizedMessage(1079822); // You need a blacksmithing tool in order to salvage ingots.
return;
}
bool anvil, forge;
DefBlacksmithy.CheckAnvilAndForge(from, 2, out anvil, out forge);
if (!forge)
{
from.SendLocalizedMessage(1044265); // You must be near a forge.
return;
}
int salvaged = 0;
int notSalvaged = 0;
Container sBag = this;
List<Item> Smeltables = sBag.FindItemsByType<Item>();
for (int i = Smeltables.Count - 1; i >= 0; i--)
{
Item item = Smeltables[i];
if (item is BaseArmor)
{
if (Resmelt(from, item, ((BaseArmor)item).Resource))
salvaged++;
else
notSalvaged++;
}
else if (item is BaseWeapon)
{
if (Resmelt(from, item, ((BaseWeapon)item).Resource))
salvaged++;
else
notSalvaged++;
}
else if (item is DragonBardingDeed)
{
if (Resmelt(from, item, ((DragonBardingDeed)item).Resource))
salvaged++;
else
notSalvaged++;
}
}
if (m_Failure)
{
from.SendLocalizedMessage(1079975); // You failed to smelt some metal for lack of skill.
m_Failure = false;
}
else
from.SendLocalizedMessage(1079973, String.Format("{0}\t{1}", salvaged, salvaged + notSalvaged)); // Salvaged: ~1_COUNT~/~2_NUM~ blacksmithed items
}
private void SalvageCloth(Mobile from)
{
Scissors scissors = from.Backpack.FindItemByType(typeof(Scissors)) as Scissors;
if (scissors == null)
{
from.SendLocalizedMessage(1079823); // You need scissors in order to salvage cloth.
return;
}
int salvaged = 0;
int notSalvaged = 0;
Container sBag = this;
List<Item> Scissorables = sBag.FindItemsByType<Item>();
for (int i = Scissorables.Count - 1; i >= 0; i--)
{
Item item = Scissorables[i];
if (item is IScissorable)
{
if (((IScissorable)item).Scissor(from, scissors))
{
salvaged++;
}
else
{
notSalvaged++;
}
}
}
from.SendLocalizedMessage(1079974, String.Format("{0}\t{1}", salvaged, salvaged + notSalvaged)); // Salvaged: ~1_COUNT~/~2_NUM~ tailored items
Container pack = from.Backpack;
foreach (Item i in ((Container)this).FindItemsByType(typeof(Item), true))
{
if ((i is Leather) || (i is Cloth) || (i is SpinedLeather) || (i is HornedLeather) || (i is BarbedLeather) || (i is Bandage) || (i is Bone))
{
from.AddToBackpack(i);
}
}
}
private void SalvageAll(Mobile from)
{
SalvageIngots(from);
SalvageCloth(from);
}
#endregion
#region ContextMenuEntries
private class SalvageAllEntry : ContextMenuEntry
{
private readonly SalvageBag m_Bag;
public SalvageAllEntry(SalvageBag bag, bool enabled)
: base(6276)
{
m_Bag = bag;
if (!enabled)
Flags |= CMEFlags.Disabled;
}
public override void OnClick()
{
if (m_Bag.Deleted)
return;
Mobile from = Owner.From;
if (from.CheckAlive())
m_Bag.SalvageAll(from);
}
}
private class SalvageIngotsEntry : ContextMenuEntry
{
private readonly SalvageBag m_Bag;
public SalvageIngotsEntry(SalvageBag bag, bool enabled)
: base(6277)
{
m_Bag = bag;
if (!enabled)
Flags |= CMEFlags.Disabled;
}
public override void OnClick()
{
if (m_Bag.Deleted)
return;
Mobile from = Owner.From;
if (from.CheckAlive())
m_Bag.SalvageIngots(from);
}
}
private class SalvageClothEntry : ContextMenuEntry
{
private readonly SalvageBag m_Bag;
public SalvageClothEntry(SalvageBag bag, bool enabled)
: base(6278)
{
m_Bag = bag;
if (!enabled)
Flags |= CMEFlags.Disabled;
}
public override void OnClick()
{
if (m_Bag.Deleted)
return;
Mobile from = Owner.From;
if (from.CheckAlive())
m_Bag.SalvageCloth(from);
}
}
#endregion
#region Serialization
public SalvageBag(Serial serial)
: base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.WriteEncodedInt((int)0); // version
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadEncodedInt();
}
#endregion
}
}

View File

@@ -0,0 +1,99 @@
using System;
namespace Server.Items
{
public class ScrollBox : WoodenBox
{
[Constructable]
public ScrollBox()
: base()
{
this.Movable = true;
this.Hue = 1151;
DropItem(new PowerScroll(SkillName.Imbuing, 115.0));
if (0.05 >= Utility.RandomDouble())
{
double runictype = Utility.RandomDouble();
CraftResource res;
int charges;
if (runictype <= .25)
{
res = CraftResource.DullCopper;
charges = 50;
}
else if (runictype <= .40)
{
res = CraftResource.ShadowIron;
charges = 45;
}
else if (runictype <= .55)
{
res = CraftResource.Copper;
charges = 40;
}
else if (runictype <= .65)
{
res = CraftResource.Bronze;
charges = 35;
}
else if (runictype <= .75)
{
res = CraftResource.Gold;
charges = 30;
}
else if (runictype <= .85)
{
res = CraftResource.Agapite;
charges = 25;
}
else if (runictype <= .98)
{
res = CraftResource.Verite;
charges = 20;
}
else
{
res = CraftResource.Valorite;
charges = 15;
}
DropItem(new RunicMalletAndChisel(res, charges));
}
}
public ScrollBox(Serial serial)
: base(serial)
{
}
public override string DefaultName
{
get
{
return "Reward Scroll Box";
}
}
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();
}
private static void PlaceItemIn(Container parent, int x, int y, Item item)
{
parent.AddItem(item);
item.Location = new Point3D(x, y, 0);
}
}
}

View File

@@ -0,0 +1,99 @@
using System;
namespace Server.Items
{
public class ScrollBox2 : WoodenBox
{
[Constructable]
public ScrollBox2()
: base()
{
this.Movable = true;
this.Hue = 1266;
DropItem(new PowerScroll(SkillName.Imbuing, 120.0));
if (0.05 >= Utility.RandomDouble())
{
double runictype = Utility.RandomDouble();
CraftResource res;
int charges;
if (runictype <= .25)
{
res = CraftResource.DullCopper;
charges = 50;
}
else if (runictype <= .40)
{
res = CraftResource.ShadowIron;
charges = 45;
}
else if (runictype <= .55)
{
res = CraftResource.Copper;
charges = 40;
}
else if (runictype <= .65)
{
res = CraftResource.Bronze;
charges = 35;
}
else if (runictype <= .75)
{
res = CraftResource.Gold;
charges = 30;
}
else if (runictype <= .85)
{
res = CraftResource.Agapite;
charges = 25;
}
else if (runictype <= .98)
{
res = CraftResource.Verite;
charges = 20;
}
else
{
res = CraftResource.Valorite;
charges = 15;
}
DropItem(new RunicMalletAndChisel(res, charges));
}
}
public ScrollBox2(Serial serial)
: base(serial)
{
}
public override string DefaultName
{
get
{
return "Reward Scroll Box";
}
}
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();
}
private static void PlaceItemIn(Container parent, int x, int y, Item item)
{
parent.AddItem(item);
item.Location = new Point3D(x, y, 0);
}
}
}

View File

@@ -0,0 +1,93 @@
using System;
namespace Server.Items
{
public class ScrollBox3 : WoodenBox
{
[Constructable]
public ScrollBox3()
: base()
{
this.Movable = true;
this.Hue = 1159;
DropItem(new PowerScroll(SkillName.Imbuing, Utility.RandomBool() ? 105.0 : 110.0));
if (0.05 >= Utility.RandomDouble())
{
double runictype = Utility.RandomDouble();
CraftResource res;
int charges;
if (runictype <= .25)
{
res = CraftResource.DullCopper;
charges = 50;
}
else if (runictype <= .40)
{
res = CraftResource.ShadowIron;
charges = 45;
}
else if (runictype <= .55)
{
res = CraftResource.Copper;
charges = 40;
}
else if (runictype <= .65)
{
res = CraftResource.Bronze;
charges = 35;
}
else if (runictype <= .75)
{
res = CraftResource.Gold;
charges = 30;
}
else if (runictype <= .85)
{
res = CraftResource.Agapite;
charges = 25;
}
else if (runictype <= .98)
{
res = CraftResource.Verite;
charges = 20;
}
else
{
res = CraftResource.Valorite;
charges = 15;
}
DropItem(new RunicMalletAndChisel(res, charges));
}
}
public ScrollBox3(Serial serial)
: base(serial)
{
}
public override string DefaultName
{
get
{
return "Reward Scroll Box";
}
}
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();
}
}
}

View File

@@ -0,0 +1,77 @@
using System;
using System.Collections.Generic;
using Server.Multis;
namespace Server.Items
{
[FlipableAttribute(0xE80, 0x9A8)]
public class ShipsStrongbox : LockableContainer
{
[Constructable]
public ShipsStrongbox()
: this (Utility.RandomMinMax(1, 3))
{
}
[Constructable]
public ShipsStrongbox(int level)
: base(0xE80)
{
Hue = level >= 4 ? 0x481 : 0x836;
level = Math.Min(4, Math.Max(1, level));
DropItem(new Gold(10000 * level));
for (int i = 0; i < level * 20; i++)
{
DropItemStacked(Loot.RandomGem());
}
for (int i = 0; i < (level * 5) + Utility.Random(5); i++)
{
switch (Utility.Random(8))
{
case 0: DropItemStacked(new BlueDiamond()); break;
case 1: DropItemStacked(new FireRuby()); break;
case 2: DropItemStacked(new BrilliantAmber()); break;
case 3: DropItemStacked(new PerfectEmerald()); break;
case 4: DropItemStacked(new DarkSapphire()); break;
case 5: DropItemStacked(new Turquoise()); break;
case 6: DropItemStacked(new EcruCitrine()); break;
case 7: DropItemStacked(new WhitePearl()); break;
}
}
if (Utility.RandomBool())
{
DropItem(new GoldIngot(level * 100));
}
else
{
DropItem(new CopperIngot(level * 100));
}
}
public ShipsStrongbox(Serial serial)
: base(serial)
{
}
public override int LabelNumber { get { return 1149959; } }// A ship's strongbox
public override int DefaultMaxWeight { get { return 400; } }
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();
}
}
}

View File

@@ -0,0 +1,63 @@
using System;
namespace Server.Items
{
[Furniture]
[Flipable(0x2D05, 0x2D06)]
public class SimpleElvenArmoire : BaseContainer
{
[Constructable]
public SimpleElvenArmoire()
: base(0x2D05)
{
this.Weight = 1.0;
}
public SimpleElvenArmoire(Serial serial)
: base(serial)
{
}
public override int DefaultGumpID
{
get
{
return 0x4F;
}
}
public override int DefaultDropSound
{
get
{
return 0x42;
}
}
public override int LabelNumber
{
get
{
return 1031525;
}
}// simple elven armoire
public override Rectangle2D Bounds
{
get
{
return new Rectangle2D(30, 30, 90, 150);
}
}
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();
}
}
}

View File

@@ -0,0 +1,92 @@
using System;
namespace Server.Items
{
[Furniture]
[FlipableAttribute(0x2bd9, 0x2bda)]
public class GreenStocking : BaseContainer
{
[Constructable]
public GreenStocking()
: base(Utility.Random(0x2BD9, 2))
{
}
public GreenStocking(Serial serial)
: base(serial)
{
}
public override int DefaultGumpID
{
get
{
return 0x103;
}
}
public override int DefaultDropSound
{
get
{
return 0x42;
}
}
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();
}
}
[Furniture]
[FlipableAttribute(0x2bdb, 0x2bdc)]
public class RedStocking : BaseContainer
{
[Constructable]
public RedStocking()
: base(Utility.Random(0x2BDB, 2))
{
}
public RedStocking(Serial serial)
: base(serial)
{
}
public override int DefaultGumpID
{
get
{
return 0x103;
}
}
public override int DefaultDropSound
{
get
{
return 0x42;
}
}
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();
}
}
}

View File

@@ -0,0 +1,182 @@
using System;
using System.Collections.Generic;
using Server.Multis;
namespace Server.Items
{
[FlipableAttribute(0xE80, 0x9A8)]
public class StrongBox : BaseContainer, IChopable
{
private Mobile m_Owner;
private BaseHouse m_House;
public StrongBox(Mobile owner, BaseHouse house)
: base(0xE80)
{
this.m_Owner = owner;
this.m_House = house;
this.MaxItems = 25;
}
public StrongBox(Serial serial)
: base(serial)
{
}
public override double DefaultWeight
{
get
{
return 100;
}
}
public override int LabelNumber
{
get
{
return 1023712;
}
}
[CommandProperty(AccessLevel.GameMaster)]
public Mobile Owner
{
get
{
return this.m_Owner;
}
set
{
this.m_Owner = value;
this.InvalidateProperties();
}
}
public override int DefaultMaxWeight
{
get
{
return 0;
}
}
public override bool Decays
{
get
{
if (this.m_House != null && this.m_Owner != null && !this.m_Owner.Deleted)
return !this.m_House.IsCoOwner(this.m_Owner);
else
return true;
}
}
public override TimeSpan DecayTime
{
get
{
return TimeSpan.FromMinutes(30.0);
}
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write((int)0); // version
writer.Write(this.m_Owner);
writer.Write(this.m_House);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
switch ( version )
{
case 0:
{
this.m_Owner = reader.ReadMobile();
this.m_House = reader.ReadItem() as BaseHouse;
break;
}
}
Timer.DelayCall(TimeSpan.FromSeconds(1.0), new TimerCallback(Validate));
}
public override void AddNameProperty(ObjectPropertyList list)
{
if (this.m_Owner != null)
list.Add(1042887, this.m_Owner.Name); // a strong box owned by ~1_OWNER_NAME~
else
base.AddNameProperty(list);
}
public override void OnSingleClick(Mobile from)
{
if (this.m_Owner != null)
{
this.LabelTo(from, 1042887, this.m_Owner.Name); // a strong box owned by ~1_OWNER_NAME~
if (this.CheckContentDisplay(from))
this.LabelTo(from, "({0} items, {1} stones)", this.TotalItems, this.TotalWeight);
}
else
{
base.OnSingleClick(from);
}
}
public override bool IsAccessibleTo(Mobile m)
{
if (this.m_Owner == null || this.m_Owner.Deleted || this.m_House == null || this.m_House.Deleted || m.AccessLevel >= AccessLevel.GameMaster)
return true;
return m == this.m_Owner && this.m_House.IsCoOwner(m) && base.IsAccessibleTo(m);
}
public void OnChop(Mobile from)
{
if (this.m_House != null && !this.m_House.Deleted && this.m_Owner != null && !this.m_Owner.Deleted)
{
if (from == this.m_Owner || this.m_House.IsOwner(from))
this.Chop(from);
}
else
{
this.Chop(from);
}
}
public Container ConvertToStandardContainer()
{
Container metalBox = new MetalBox();
List<Item> subItems = new List<Item>(this.Items);
foreach (Item subItem in subItems)
{
metalBox.AddItem(subItem);
}
this.Delete();
return metalBox;
}
private void Validate()
{
if (this.m_Owner != null && this.m_House != null && !this.m_House.IsCoOwner(this.m_Owner))
{
Console.WriteLine("Warning: Destroying strongbox of {0}", this.m_Owner.Name);
this.Destroy();
}
}
private void Chop(Mobile from)
{
Effects.PlaySound(this.Location, this.Map, 0x3B3);
from.SendLocalizedMessage(500461); // You destroy the item.
this.Destroy();
}
}
}

View File

@@ -0,0 +1,263 @@
using System;
namespace Server.Items
{
public enum TrapType
{
None,
MagicTrap,
ExplosionTrap,
DartTrap,
PoisonTrap
}
public abstract class TrapableContainer : BaseContainer, ITelekinesisable
{
private TrapType m_TrapType;
private int m_TrapPower;
private int m_TrapLevel;
public TrapableContainer(int itemID)
: base(itemID)
{
}
public TrapableContainer(Serial serial)
: base(serial)
{
}
[CommandProperty(AccessLevel.GameMaster)]
public TrapType TrapType
{
get
{
return m_TrapType;
}
set
{
m_TrapType = value;
}
}
[CommandProperty(AccessLevel.GameMaster)]
public int TrapPower
{
get
{
return m_TrapPower;
}
set
{
m_TrapPower = value;
}
}
[CommandProperty(AccessLevel.GameMaster)]
public int TrapLevel
{
get
{
return m_TrapLevel;
}
set
{
m_TrapLevel = value;
}
}
public virtual bool TrapOnOpen
{
get
{
return true;
}
}
public virtual bool ExecuteTrap(Mobile from)
{
if (m_TrapType != TrapType.None)
{
Point3D loc = GetWorldLocation();
Map facet = Map;
if (from.AccessLevel >= AccessLevel.GameMaster)
{
SendMessageTo(from, "That is trapped, but you open it with your godly powers.", 0x3B2);
return false;
}
switch ( m_TrapType )
{
case TrapType.ExplosionTrap:
{
SendMessageTo(from, 502999, 0x3B2); // You set off a trap!
if (from.InRange(loc, 3))
{
int damage;
if (m_TrapLevel > 0)
damage = Utility.RandomMinMax(10, 30) * m_TrapLevel;
else
damage = m_TrapPower;
AOS.Damage(from, damage, 0, 100, 0, 0, 0);
// Your skin blisters from the heat!
from.LocalOverheadMessage(Network.MessageType.Regular, 0x2A, 503000);
}
Effects.SendLocationEffect(loc, facet, 0x36BD, 15, 10);
Effects.PlaySound(loc, facet, 0x307);
break;
}
case TrapType.MagicTrap:
{
if (from.InRange(loc, 1))
from.Damage(m_TrapPower);
//AOS.Damage( from, m_TrapPower, 0, 100, 0, 0, 0 );
Effects.PlaySound(loc, Map, 0x307);
Effects.SendLocationEffect(new Point3D(loc.X - 1, loc.Y, loc.Z), Map, 0x36BD, 15);
Effects.SendLocationEffect(new Point3D(loc.X + 1, loc.Y, loc.Z), Map, 0x36BD, 15);
Effects.SendLocationEffect(new Point3D(loc.X, loc.Y - 1, loc.Z), Map, 0x36BD, 15);
Effects.SendLocationEffect(new Point3D(loc.X, loc.Y + 1, loc.Z), Map, 0x36BD, 15);
Effects.SendLocationEffect(new Point3D(loc.X + 1, loc.Y + 1, loc.Z + 11), Map, 0x36BD, 15);
break;
}
case TrapType.DartTrap:
{
SendMessageTo(from, 502999, 0x3B2); // You set off a trap!
if (from.InRange(loc, 3))
{
int damage;
if (m_TrapLevel > 0)
damage = Utility.RandomMinMax(5, 15) * m_TrapLevel;
else
damage = m_TrapPower;
AOS.Damage(from, damage, 100, 0, 0, 0, 0);
// A dart imbeds itself in your flesh!
from.LocalOverheadMessage(Network.MessageType.Regular, 0x62, 502998);
}
Effects.PlaySound(loc, facet, 0x223);
break;
}
case TrapType.PoisonTrap:
{
SendMessageTo(from, 502999, 0x3B2); // You set off a trap!
if (from.InRange(loc, 3))
{
Poison poison;
if (m_TrapLevel > 0)
{
poison = Poison.GetPoison(Math.Max(0, Math.Min(4, m_TrapLevel - 1)));
}
else
{
AOS.Damage(from, m_TrapPower, 0, 0, 0, 100, 0);
poison = Poison.Greater;
}
from.ApplyPoison(from, poison);
// You are enveloped in a noxious green cloud!
from.LocalOverheadMessage(Network.MessageType.Regular, 0x44, 503004);
}
Effects.SendLocationEffect(loc, facet, 0x113A, 10, 20);
Effects.PlaySound(loc, facet, 0x231);
break;
}
}
m_TrapType = TrapType.None;
m_TrapPower = 0;
m_TrapLevel = 0;
return true;
}
return false;
}
public virtual void OnTelekinesis(Mobile from)
{
Effects.SendLocationParticles(EffectItem.Create(Location, Map, EffectItem.DefaultDuration), 0x376A, 9, 32, 5022);
Effects.PlaySound(Location, Map, 0x1F5);
if (TrapOnOpen)
{
ExecuteTrap(from);
}
}
public override void Open(Mobile from)
{
if (from.AccessLevel > AccessLevel.Player || !TrapOnOpen || !ExecuteTrap(from))
base.Open(from);
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write((int)2); // version
writer.Write((int)m_TrapLevel);
writer.Write((int)m_TrapPower);
writer.Write((int)m_TrapType);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
switch ( version )
{
case 2:
{
m_TrapLevel = reader.ReadInt();
goto case 1;
}
case 1:
{
m_TrapPower = reader.ReadInt();
goto case 0;
}
case 0:
{
m_TrapType = (TrapType)reader.ReadInt();
break;
}
}
}
private void SendMessageTo(Mobile to, int number, int hue)
{
if (Deleted || !to.CanSee(this))
return;
to.Send(new Network.MessageLocalized(Serial, ItemID, Network.MessageType.Regular, hue, 3, number, "", ""));
}
private void SendMessageTo(Mobile to, string text, int hue)
{
if (Deleted || !to.CanSee(this))
return;
to.Send(new Network.UnicodeMessage(Serial, ItemID, Network.MessageType.Regular, hue, 3, "ENU", "", text));
}
}
}

View File

@@ -0,0 +1,224 @@
using System;
using System.Collections.Generic;
using Server.Multis;
using Server.ContextMenus;
using Server.Mobiles;
using Server.Engines.Points;
using System.Linq;
namespace Server.Items
{
public class TrashBarrel : BaseTrash, IChopable
{
private Timer m_Timer;
[Constructable]
public TrashBarrel()
: base(0xE77)
{
Hue = 0x3B2;
Movable = false;
m_Cleanup = new List<CleanupArray>();
}
public TrashBarrel(Serial serial)
: base(serial)
{
}
public override int LabelNumber
{
get
{
return 1041064;
}
}// a trash barrel
public override int DefaultMaxWeight
{
get
{
return 0;
}
}// A value of 0 signals unlimited weight
public override bool IsDecoContainer
{
get
{
return false;
}
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write((int)0); // version
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
if (Items.Count > 0)
{
m_Timer = new EmptyTimer(this);
m_Timer.Start();
}
m_Cleanup = new List<CleanupArray>();
}
public override bool OnDragDrop(Mobile from, Item dropped)
{
if (!base.OnDragDrop(from, dropped))
return false;
AddCleanupItem(from, dropped);
if (TotalItems >= 50)
{
Empty(501478); // The trash is full! Emptying!
}
else
{
SendLocalizedMessageTo(from, 1010442); // The item will be deleted in three minutes
if (m_Timer != null)
m_Timer.Stop();
else
m_Timer = new EmptyTimer(this);
m_Timer.Start();
}
return true;
}
public override bool OnDragDropInto(Mobile from, Item item, Point3D p)
{
if (!base.OnDragDropInto(from, item, p))
return false;
AddCleanupItem(from, item);
if (TotalItems >= 50)
{
Empty(501478); // The trash is full! Emptying!
}
else
{
SendLocalizedMessageTo(from, 1010442); // The item will be deleted in three minutes
if (m_Timer != null)
m_Timer.Stop();
else
m_Timer = new EmptyTimer(this);
m_Timer.Start();
}
return true;
}
public void OnChop(Mobile from)
{
BaseHouse house = BaseHouse.FindHouseAt(from);
if (house != null && house.IsCoOwner(from))
{
Effects.PlaySound(Location, Map, 0x3B3);
from.SendLocalizedMessage(500461); // You destroy the item.
Destroy();
}
}
public void Empty(int message)
{
List<Item> items = Items;
if (items.Count > 0)
{
PublicOverheadMessage(Network.MessageType.Regular, 0x3B2, message, "");
for (int i = items.Count - 1; i >= 0; --i)
{
if (i >= items.Count)
continue;
ConfirmCleanupItem(items[i]);
#region SA
if (.01 > Utility.RandomDouble())
DropToCavernOfDiscarded(items[i]);
else
items[i].Delete();
#endregion
}
if (m_Cleanup.Any(x => x.mobiles != null))
{
foreach (var m in m_Cleanup.Select(x => x.mobiles).Distinct())
{
if (m_Cleanup.Find(x => x.mobiles == m && x.confirm) != null)
{
double point = m_Cleanup.Where(x => x.mobiles == m && x.confirm).Sum(x => x.points);
m.SendLocalizedMessage(1151280, String.Format("{0}\t{1}", point.ToString(), m_Cleanup.Count(r => r.mobiles == m))); // You have received approximately ~1_VALUE~points for turning in ~2_COUNT~items for Clean Up Britannia.
PointsSystem.CleanUpBritannia.AwardPoints(m, point);
}
}
m_Cleanup.Clear();
}
}
if (m_Timer != null)
m_Timer.Stop();
m_Timer = null;
}
private class EmptyTimer : Timer
{
private readonly TrashBarrel m_Barrel;
public EmptyTimer(TrashBarrel barrel)
: base(TimeSpan.FromMinutes(3.0))
{
m_Barrel = barrel;
Priority = TimerPriority.FiveSeconds;
}
protected override void OnTick()
{
m_Barrel.Empty(501479); // Emptying the trashcan!
}
}
#region SA
public static void DropToCavernOfDiscarded(Item item)
{
if (item == null || item.Deleted)
return;
Rectangle2D rec = new Rectangle2D(901, 482, 40, 27);
Map map = Map.TerMur;
for (int i = 0; i < 50; i++)
{
int x = Utility.RandomMinMax(rec.X, rec.X + rec.Width);
int y = Utility.RandomMinMax(rec.Y, rec.Y + rec.Height);
int z = map.GetAverageZ(x, y);
Point3D p = new Point3D(x, y, z);
if (map.CanSpawnMobile(p))
{
item.MoveToWorld(p, map);
return;
}
}
item.Delete();
}
#endregion
}
}

View File

@@ -0,0 +1,133 @@
using Server.ContextMenus;
using Server.Engines.Points;
using Server.Mobiles;
using System;
using System.Collections.Generic;
using System.Linq;
namespace Server.Items
{
[FlipableAttribute(0xE41, 0xE40)]
public class TrashChest : BaseTrash
{
[Constructable]
public TrashChest()
: base(0xE41)
{
Movable = false;
m_Cleanup = new List<CleanupArray>();
}
public TrashChest(Serial serial)
: base(serial)
{
}
public override int DefaultMaxWeight
{
get
{
return 0;
}
}// A value of 0 signals unlimited weight
public override bool IsDecoContainer
{
get
{
return false;
}
}
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();
m_Cleanup = new List<CleanupArray>();
}
public override bool OnDragDrop(Mobile from, Item dropped)
{
if (!base.OnDragDrop(from, dropped))
return false;
if (CleanUpBritanniaData.Enabled && !AddCleanupItem(from, dropped))
{
if (dropped.LootType == LootType.Blessed)
{
from.SendLocalizedMessage(1075256); // That is blessed; you cannot throw it away.
return false;
}
}
PublicOverheadMessage(Network.MessageType.Regular, 0x3B2, Utility.Random(1042891, 8));
Empty();
return true;
}
public override bool OnDragDropInto(Mobile from, Item item, Point3D p)
{
if (!base.OnDragDropInto(from, item, p))
return false;
if (CleanUpBritanniaData.Enabled && !AddCleanupItem(from, item))
{
if (item.LootType == LootType.Blessed)
{
from.SendLocalizedMessage(1075256); // That is blessed; you cannot throw it away.
return false;
}
}
PublicOverheadMessage(Network.MessageType.Regular, 0x3B2, Utility.Random(1042891, 8));
Empty();
return true;
}
public void Empty()
{
List<Item> items = Items;
if (items.Count > 0)
{
for (int i = items.Count - 1; i >= 0; --i)
{
if (i >= items.Count)
continue;
ConfirmCleanupItem(items[i]);
#region SA
if (Core.SA && .01 > Utility.RandomDouble())
TrashBarrel.DropToCavernOfDiscarded(items[i]);
else
items[i].Delete();
#endregion
}
if (m_Cleanup.Any(x => x.mobiles != null))
{
foreach (var m in m_Cleanup.Select(x => x.mobiles).Distinct())
{
if (m_Cleanup.Find(x => x.mobiles == m && x.confirm) != null)
{
double point = m_Cleanup.Where(x => x.mobiles == m && x.confirm).Sum(x => x.points);
m.SendLocalizedMessage(1151280, String.Format("{0}\t{1}", point.ToString(), m_Cleanup.Count(r => r.mobiles == m))); // You have received approximately ~1_VALUE~points for turning in ~2_COUNT~items for Clean Up Britannia.
PointsSystem.CleanUpBritannia.AwardPoints(m, point);
}
}
m_Cleanup.Clear();
}
}
}
}
}

View File

@@ -0,0 +1,91 @@
using System;
namespace Server.Items
{
[FlipableAttribute(0xe43, 0xe42)]
public class WoodenTreasureChest : BaseTreasureChest
{
[Constructable]
public WoodenTreasureChest()
: base(0xE43)
{
}
public WoodenTreasureChest(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();
}
}
[FlipableAttribute(0xe41, 0xe40)]
public class MetalGoldenTreasureChest : BaseTreasureChest
{
[Constructable]
public MetalGoldenTreasureChest()
: base(0xE41)
{
}
public MetalGoldenTreasureChest(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();
}
}
[FlipableAttribute(0x9ab, 0xe7c)]
public class MetalTreasureChest : BaseTreasureChest
{
[Constructable]
public MetalTreasureChest()
: base(0x9AB)
{
}
public MetalTreasureChest(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();
}
}
}

View File

@@ -0,0 +1,352 @@
// Treasure Chest Pack - Version 0.99I
// By Nerun
using Server;
using Server.Items;
using Server.Multis;
using Server.Network;
using System;
namespace Server.Items
{
// ---------- [Level 1] ----------
// Large, Medium and Small Crate
[FlipableAttribute( 0xe3e, 0xe3f )]
public class TreasureLevel1 : BaseTreasureChestMod
{
public override int DefaultGumpID{ get{ return 0x49; } }
[Constructable]
public TreasureLevel1() : base( Utility.RandomList( 0xE3C, 0xE3E, 0x9a9 ) )
{
RequiredSkill = 52;
LockLevel = this.RequiredSkill - Utility.Random( 1, 10 );
MaxLockLevel = this.RequiredSkill;
TrapType = TrapType.MagicTrap;
TrapPower = 1 * Utility.Random( 1, 25 );
DropItem(new Gold(30, 100));
DropItem(new Bolt(10));
DropItem(Loot.RandomClothing());
AddLoot(Loot.RandomWeapon());
AddLoot(Loot.RandomArmorOrShield());
AddLoot(Loot.RandomJewelry());
for (int i = Utility.Random(3) + 1; i > 0; i--) // random 1 to 3
DropItem( Loot.RandomGem() );
}
public TreasureLevel1( 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();
}
}
// ---------- [Level 1 Hybrid] ----------
// Large, Medium and Small Crate
[FlipableAttribute( 0xe3e, 0xe3f )]
public class TreasureLevel1h : BaseTreasureChestMod
{
public override int DefaultGumpID{ get{ return 0x49; } }
[Constructable]
public TreasureLevel1h() : base( Utility.RandomList( 0xE3C, 0xE3E, 0x9a9 ) )
{
RequiredSkill = 56;
LockLevel = this.RequiredSkill - Utility.Random( 1, 10 );
MaxLockLevel = this.RequiredSkill;
TrapType = TrapType.MagicTrap;
TrapPower = 1 * Utility.Random( 1, 25 );
DropItem( new Gold( 10, 40 ) );
DropItem( new Bolt( 5 ) );
switch ( Utility.Random( 2 ))
{
case 0: DropItem( new Shoes( Utility.Random( 1, 2 ) ) ); break;
case 1: DropItem( new Sandals( Utility.Random( 1, 2 ) ) ); break;
}
switch ( Utility.Random( 3 ))
{
case 0: DropItem( new BeverageBottle(BeverageType.Ale) ); break;
case 1: DropItem( new BeverageBottle(BeverageType.Liquor) ); break;
case 2: DropItem( new Jug(BeverageType.Cider) ); break;
}
}
public TreasureLevel1h( 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();
}
}
// ---------- [Level 2] ----------
// Large, Medium and Small Crate
// Wooden, Metal and Metal Golden Chest
// Keg and Barrel
[FlipableAttribute( 0xe43, 0xe42 )]
public class TreasureLevel2 : BaseTreasureChestMod
{
[Constructable]
public TreasureLevel2() : base( Utility.RandomList( 0xe3c, 0xE3E, 0x9a9, 0xe42, 0x9ab, 0xe40, 0xe7f, 0xe77 ) )
{
RequiredSkill = 72;
LockLevel = this.RequiredSkill - Utility.Random( 1, 10 );
MaxLockLevel = this.RequiredSkill;
TrapType = TrapType.MagicTrap;
TrapPower = 2 * Utility.Random( 1, 25 );
DropItem( new Gold( 70, 100 ) );
DropItem( new Arrow( 10 ) );
DropItem( Loot.RandomPotion() );
for( int i = Utility.Random( 1, 2 ); i > 1; i-- )
{
Item ReagentLoot = Loot.RandomReagent();
ReagentLoot.Amount = Utility.Random( 1, 2 );
DropItem( ReagentLoot );
}
if (Utility.RandomBool()) //50% chance
for (int i = Utility.Random(8) + 1; i > 0; i--)
DropItem(Loot.RandomScroll(0, 39, SpellbookType.Regular));
if (Utility.RandomBool()) //50% chance
for (int i = Utility.Random(6) + 1; i > 0; i--)
DropItem( Loot.RandomGem() );
}
public TreasureLevel2( 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();
}
}
// ---------- [Level 3] ----------
// Wooden, Metal and Metal Golden Chest
[FlipableAttribute( 0x9ab, 0xe7c )]
public class TreasureLevel3 : BaseTreasureChestMod
{
public override int DefaultGumpID{ get{ return 0x4A; } }
[Constructable]
public TreasureLevel3() : base( Utility.RandomList( 0x9ab, 0xe40, 0xe42 ) )
{
RequiredSkill = 84;
LockLevel = this.RequiredSkill - Utility.Random( 1, 10 );
MaxLockLevel = this.RequiredSkill;
TrapType = TrapType.MagicTrap;
TrapPower = 3 * Utility.Random( 1, 25 );
DropItem( new Gold( 180, 240 ) );
DropItem( new Arrow( 10 ) );
for( int i = Utility.Random( 1, 3 ); i > 1; i-- )
{
Item ReagentLoot = Loot.RandomReagent();
ReagentLoot.Amount = Utility.Random( 1, 9 );
DropItem( ReagentLoot );
}
for ( int i = Utility.Random( 1, 3 ); i > 1; i-- )
DropItem( Loot.RandomPotion() );
if ( 0.67 > Utility.RandomDouble() ) //67% chance = 2/3
for (int i = Utility.Random(12) + 1; i > 0; i--)
DropItem(Loot.RandomScroll(0, 47, SpellbookType.Regular));
if ( 0.67 > Utility.RandomDouble() ) //67% chance = 2/3
for (int i = Utility.Random(9) + 1; i > 0; i--)
DropItem( Loot.RandomGem() );
for( int i = Utility.Random( 1, 3 ); i > 1; i-- )
DropItem( Loot.RandomWand() );
// Magical ArmorOrWeapon
for( int i = Utility.Random( 1, 3 ); i > 1; i-- )
{
Item item = Loot.RandomArmorOrShieldOrWeapon();
if (!Core.AOS)
{
if (item is BaseWeapon)
{
BaseWeapon weapon = (BaseWeapon)item;
weapon.DamageLevel = (WeaponDamageLevel)Utility.Random(3);
weapon.AccuracyLevel = (WeaponAccuracyLevel)Utility.Random(3);
weapon.DurabilityLevel = (WeaponDurabilityLevel)Utility.Random(3);
weapon.Quality = ItemQuality.Normal;
}
else if (item is BaseArmor)
{
BaseArmor armor = (BaseArmor)item;
armor.ProtectionLevel = (ArmorProtectionLevel)Utility.Random(3);
armor.Durability = (ArmorDurabilityLevel)Utility.Random(3);
armor.Quality = ItemQuality.Normal;
}
}
else
AddLoot(item);
}
for( int i = Utility.Random( 1, 2 ); i > 1; i-- )
AddLoot( Loot.RandomClothing() );
for( int i = Utility.Random( 1, 2 ); i > 1; i-- )
AddLoot(Loot.RandomJewelry());
// Magic clothing (not implemented)
// Magic jewelry (not implemented)
}
public TreasureLevel3( 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();
}
}
// ---------- [Level 4] ----------
// Wooden, Metal and Metal Golden Chest
[FlipableAttribute( 0xe41, 0xe40 )]
public class TreasureLevel4 : BaseTreasureChestMod
{
[Constructable]
public TreasureLevel4() : base( Utility.RandomList( 0xe40, 0xe42, 0x9ab ) )
{
RequiredSkill = 92;
LockLevel = this.RequiredSkill - Utility.Random( 1, 10 );
MaxLockLevel = this.RequiredSkill;
TrapType = TrapType.MagicTrap;
TrapPower = 4 * Utility.Random( 1, 25 );
DropItem( new Gold( 200, 400 ) );
DropItem( new BlankScroll( Utility.Random( 1, 4 ) ) );
for( int i = Utility.Random( 1, 4 ); i > 1; i-- )
{
Item ReagentLoot = Loot.RandomReagent();
ReagentLoot.Amount = Utility.Random( 6, 12 );
DropItem( ReagentLoot );
}
for ( int i = Utility.Random( 1, 4 ); i > 1; i-- )
DropItem( Loot.RandomPotion() );
if ( 0.75 > Utility.RandomDouble() ) //75% chance = 3/4
for (int i = Utility.RandomMinMax(8,16); i > 0; i--)
DropItem(Loot.RandomScroll(0, 47, SpellbookType.Regular));
if ( 0.75 > Utility.RandomDouble() ) //75% chance = 3/4
for (int i = Utility.RandomMinMax(6,12) + 1; i > 0; i--)
DropItem( Loot.RandomGem() );
for( int i = Utility.Random( 1, 4 ); i > 1; i-- )
DropItem( Loot.RandomWand() );
// Magical ArmorOrWeapon
for( int i = Utility.Random( 1, 4 ); i > 1; i-- )
{
Item item = Loot.RandomArmorOrShieldOrWeapon();
if (!Core.AOS)
{
if (item is BaseWeapon)
{
BaseWeapon weapon = (BaseWeapon)item;
weapon.DamageLevel = (WeaponDamageLevel)Utility.Random(4);
weapon.AccuracyLevel = (WeaponAccuracyLevel)Utility.Random(4);
weapon.DurabilityLevel = (WeaponDurabilityLevel)Utility.Random(4);
weapon.Quality = ItemQuality.Normal;
}
else if (item is BaseArmor)
{
BaseArmor armor = (BaseArmor)item;
armor.ProtectionLevel = (ArmorProtectionLevel)Utility.Random(4);
armor.Durability = (ArmorDurabilityLevel)Utility.Random(4);
armor.Quality = ItemQuality.Normal;
}
}
else
AddLoot(item);
}
for( int i = Utility.Random( 1, 2 ); i > 1; i-- )
AddLoot( Loot.RandomClothing() );
for( int i = Utility.Random( 1, 2 ); i > 1; i-- )
AddLoot( Loot.RandomJewelry() );
}
public TreasureLevel4( 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();
}
}
}

View File

@@ -0,0 +1,169 @@
using System;
using Server;
namespace Server.Items
{
public class UnknownBardSkeleton : BaseContainer
{
public override int DefaultGumpID { get { return 0x9; } }
[Constructable]
public UnknownBardSkeleton()
: base(0xECA + Utility.Random(9))
{
Name = "An Unknown Bard's Skeleton";
Weight = 35.0;
DropItem(new Gold(Utility.RandomMinMax(200, 400)));
DropItem(new Doublet(Utility.RandomNondyedHue()));
DropItem(new JesterHat(Utility.RandomNondyedHue()));
DropItem(new Bandage(Utility.RandomMinMax(10, 20)));
switch (Utility.Random(2))
{
case 0: DropItem(new Kilt(Utility.RandomNondyedHue())); break;
case 1: DropItem(new ShortPants(Utility.RandomNondyedHue())); break;
}
switch (Utility.Random(3))
{
case 0: DropItem(new BeverageBottle(BeverageType.Ale)); break;
case 1: DropItem(new BeverageBottle(BeverageType.Wine)); break;
case 2: DropItem(new BeverageBottle(BeverageType.Liquor)); break;
}
DropItem(Loot.RandomInstrument());
}
public UnknownBardSkeleton(Serial serial)
: base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.WriteEncodedInt(0); // version
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadEncodedInt();
}
}
public class UnknownRogueSkeleton : BaseContainer
{
public override int DefaultGumpID { get { return 0x9; } }
[Constructable]
public UnknownRogueSkeleton()
: base(0xECA + Utility.Random(9))
{
Name = "An Unknown Rogue's Skeleton";
Weight = 35.0;
DropItem(new LeatherChest());
DropItem(new LeatherGloves());
DropItem(new LeatherArms());
DropItem(new Dagger());
DropItem(new Shovel(50));
DropItem(new Lockpick(Utility.RandomMinMax(1, 4)));
if (Utility.RandomBool())
DropItem(new Torch());
else
DropItem(new Lantern());
if (0.1 >= Utility.RandomDouble())
DropItem(Loot.RandomRangedWeapon());
else
DropItem(Loot.RandomWeapon());
DropItem(new TreasureMap(Utility.RandomMinMax(3, 5), Map.Felucca));
}
public UnknownRogueSkeleton(Serial serial)
: base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.WriteEncodedInt(0); // version
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadEncodedInt();
}
}
public class UnknownMageSkeleton : BaseContainer
{
public override int DefaultGumpID { get { return 0x9; } }
[Constructable]
public UnknownMageSkeleton()
: base(0xECA + Utility.Random(9))
{
Name = "An Unknown Mage's Skeleton";
Weight = 35.0;
DropItem(new Robe(Utility.RandomNondyedHue()));
DropItem(new Sandals());
DropItem(Loot.RandomJewelry());
if (Utility.RandomBool())
DropItem(new QuarterStaff());
else
DropItem(new GnarledStaff());
Item item;
for (int i = 0; i < 3; i++)
{
item = Loot.RandomReagent();
item.Amount = Utility.RandomMinMax(15, 20);
DropItem(item);
}
for (int i = 0; i < 3; i++)
{
if (0.25 >= Utility.RandomDouble())
item = Loot.RandomScroll(0, Loot.NecromancyScrollTypes.Length, SpellbookType.Necromancer);
else
item = Loot.RandomScroll(0, Loot.RegularScrollTypes.Length, SpellbookType.Regular);
item.Amount = Utility.RandomMinMax(1, 2);
DropItem(item);
}
}
public UnknownMageSkeleton(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();
}
}
}

View File

@@ -0,0 +1,60 @@
using System;
namespace Server.Items
{
public class ValuableImbuingBag : BaseRewardBag
{
[Constructable]
public ValuableImbuingBag()
{
switch (Utility.Random(2))
{
case 0:
DropItem(new UndyingFlesh());
break;
case 1:
DropItem(new DaemonClaw());
break;
/* case 2:
DropItem(new SpiderCarapace());
break;
case 3:
DropItem(new VialOfVitriol());
break;
case 4:
DropItem(new LavaSerpenCrust());
break;
case 5:
DropItem(new GoblinBlood());
break;*/
}
}
public ValuableImbuingBag(Serial serial)
: base(serial)
{
}
public override int LabelNumber
{
get
{
return 1113769; //Valuable Imbuing Bag
}
}
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();
}
}
}

View File

@@ -0,0 +1,167 @@
using System;
using Server.Gumps;
using Server.Network;
namespace Server.Items
{
public class VanityAddon : BaseAddonContainer
{
[Constructable]
public VanityAddon(bool east)
: base(east ? 0xA44 : 0xA3C)
{
if (east) // east
{
this.AddComponent(new AddonContainerComponent(0xA45), 0, -1, 0);
}
else // south
{
this.AddComponent(new AddonContainerComponent(0xA3D), -1, 0, 0);
}
}
public VanityAddon(Serial serial)
: base(serial)
{
}
public override BaseAddonContainerDeed Deed
{
get
{
return new VanityDeed();
}
}
public override int LabelNumber
{
get
{
return 1074027;
}
}// Vanity
public override int DefaultGumpID
{
get
{
return 0x51;
}
}
public override int DefaultDropSound
{
get
{
return 0x42;
}
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.WriteEncodedInt(0); // version
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadEncodedInt();
}
}
public class VanityDeed : BaseAddonContainerDeed
{
private bool m_East;
[Constructable]
public VanityDeed()
: base()
{
this.LootType = LootType.Blessed;
}
public VanityDeed(Serial serial)
: base(serial)
{
}
public override BaseAddonContainer Addon
{
get
{
return new VanityAddon(this.m_East);
}
}
public override int LabelNumber
{
get
{
return 1074027;
}
}// Vanity
public override void OnDoubleClick(Mobile from)
{
if (this.IsChildOf(from.Backpack))
{
from.CloseGump(typeof(InternalGump));
from.SendGump(new InternalGump(this));
}
else
from.SendLocalizedMessage(1062334); // This item must be in your backpack to be used.
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.WriteEncodedInt(0); // version
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadEncodedInt();
}
private void SendTarget(Mobile m)
{
base.OnDoubleClick(m);
}
private class InternalGump : Gump
{
private readonly VanityDeed m_Deed;
public InternalGump(VanityDeed deed)
: base(60, 36)
{
this.m_Deed = deed;
this.AddPage(0);
this.AddBackground(0, 0, 273, 324, 0x13BE);
this.AddImageTiled(10, 10, 253, 20, 0xA40);
this.AddImageTiled(10, 40, 253, 244, 0xA40);
this.AddImageTiled(10, 294, 253, 20, 0xA40);
this.AddAlphaRegion(10, 10, 253, 304);
this.AddButton(10, 294, 0xFB1, 0xFB2, 0, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(45, 296, 450, 20, 1060051, 0x7FFF, false, false); // CANCEL
this.AddHtmlLocalized(14, 12, 273, 20, 1076744, 0x7FFF, false, false); // Please select your vanity position.
this.AddPage(1);
this.AddButton(19, 49, 0x845, 0x846, 1, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(44, 47, 213, 20, 1075386, 0x7FFF, false, false); // South
this.AddButton(19, 73, 0x845, 0x846, 2, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(44, 71, 213, 20, 1075387, 0x7FFF, false, false); // East
}
public override void OnResponse(NetState sender, RelayInfo info)
{
if (this.m_Deed == null || this.m_Deed.Deleted || info.ButtonID == 0)
return;
this.m_Deed.m_East = (info.ButtonID != 1);
this.m_Deed.SendTarget(sender.Mobile);
}
}
}
}

View File

@@ -0,0 +1,36 @@
using System;
namespace Server.Items
{
[Flipable(0x232A, 0x232B)]
public class WinterGiftPackage2003 : GiftBox
{
[Constructable]
public WinterGiftPackage2003()
{
this.DropItem(new Snowman());
this.DropItem(new WreathDeed());
this.DropItem(new BlueSnowflake());
this.DropItem(new RedPoinsettia());
}
public WinterGiftPackage2003(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();
}
}
}