#W# Initial Commit: Avatars Conquest

This commit is contained in:
WarrentyExpired 2026-07-04 10:35:30 -04:00
commit 5df497787a
7510 changed files with 416048 additions and 0 deletions

View file

@ -0,0 +1,630 @@
using System;
using System.IO;
using System.Reflection;
using Server;
using Server.Items;
namespace Server
{
public class Loot
{
#region List definitions
private static Type[] m_WeaponTypes = new Type[]
{
typeof( Axe ), typeof( BattleAxe ), typeof( DoubleAxe ),
typeof( GreatAxe ), typeof( Hatchet ), typeof( LargeBattleAxe ),
typeof( TwoHandedAxe ), typeof( WarAxe ), typeof( Club ),
typeof( Mace ), typeof( Maul ), typeof( WarHammer ),
typeof( WarMace ), typeof( Bardiche ), typeof( Halberd ),
typeof( Spear ), typeof( Rapier ), typeof( Pitchfork ),
typeof( WarFork ), typeof( BlackStaff ), typeof( GnarledStaff ),
typeof( QuarterStaff ), typeof( Broadsword ), typeof( Cutlass ),
typeof( Katana ), typeof( Kryss ), typeof( Longsword ),
typeof( Scimitar ), typeof( VikingSword ), typeof( Pickaxe ),
typeof( HammerPick ), typeof( ButcherKnife ), typeof( Cleaver ),
typeof( Dagger ), typeof( SkinningKnife ), typeof( ShepherdsCrook ),
typeof( Scythe ), typeof( Pike ), typeof( Whip )
};
public static Type[] WeaponTypes{ get{ return m_WeaponTypes; } }
private static Type[] m_RangedWeaponTypes = new Type[]
{
typeof( Bow ), typeof( Crossbow ), typeof( HeavyCrossbow )
};
public static Type[] RangedWeaponTypes{ get{ return m_RangedWeaponTypes; } }
private static Type[] m_ArmorTypes = new Type[]
{
typeof( BoneArms ), typeof( BoneChest ), typeof( BoneGloves ),
typeof( BoneLegs ), typeof( BoneHelm ), typeof( ChainChest ),
typeof( ChainLegs ), typeof( ChainCoif ), typeof( Bascinet ),
typeof( CloseHelm ), typeof( Helmet ), typeof( NorseHelm ),
typeof( OrcHelm ), typeof( FemaleLeatherChest ), typeof( LeatherArms ),
typeof( LeatherBustierArms ), typeof( LeatherChest ), typeof( LeatherGloves ),
typeof( LeatherGorget ), typeof( LeatherLegs ), typeof( LeatherShorts ),
typeof( LeatherSkirt ), typeof( LeatherCap ), typeof( FemalePlateChest ),
typeof( PlateArms ), typeof( PlateChest ), typeof( PlateGloves ),
typeof( PlateGorget ), typeof( PlateHelm ), typeof( PlateLegs ),
typeof( RingmailArms ), typeof( RingmailChest ), typeof( RingmailGloves ),
typeof( RingmailLegs ), typeof( FemaleStuddedChest ), typeof( StuddedArms ),
typeof( StuddedBustierArms ), typeof( StuddedChest ), typeof( StuddedGloves ),
typeof( StuddedGorget ), typeof( StuddedLegs )
};
public static Type[] ArmorTypes{ get{ return m_ArmorTypes; } }
private static Type[] m_ShieldTypes = new Type[]
{
typeof( BronzeShield ), typeof( Buckler ), typeof( HeaterShield ),
typeof( MetalShield ), typeof( MetalKiteShield ), typeof( WoodenKiteShield ),
typeof( WoodenShield ), typeof( ChaosShield ), typeof( OrderShield )
};
public static Type[] ShieldTypes{ get{ return m_ShieldTypes; } }
private static Type[] m_GemTypes = new Type[]
{
typeof( Amber ), typeof( Amethyst ), typeof( Citrine ),
typeof( Diamond ), typeof( Emerald ), typeof( Ruby ),
typeof( Sapphire ), typeof( StarSapphire ), typeof( Tourmaline )
};
public static Type[] GemTypes{ get{ return m_GemTypes; } }
private static Type[] m_JewelryTypes = new Type[]
{
typeof( GoldRing ), typeof( GoldBracelet ),
typeof( SilverRing ), typeof( SilverBracelet )
};
public static Type[] JewelryTypes{ get{ return m_JewelryTypes; } }
private static Type[] m_RegTypes = new Type[]
{
typeof( BlackPearl ), typeof( Bloodmoss ), typeof( Garlic ),
typeof( Ginseng ), typeof( MandrakeRoot ), typeof( Nightshade ),
typeof( SulfurousAsh ), typeof( SpidersSilk )
};
public static Type[] RegTypes{ get{ return m_RegTypes; } }
private static Type[] m_LowPotionTypes = new Type[]
{
typeof( LesserHealPotion ), typeof( LesserCurePotion ), typeof( LesserPoisonPotion ),
typeof( RefreshPotion ), typeof( StrengthPotion ), typeof( AgilityPotion ),
typeof( LesserExplosionPotion ), typeof( NightSightPotion )
};
public static Type[] LowPotionTypes{ get{ return m_LowPotionTypes; } }
private static Type[] m_MedPotionTypes = new Type[]
{
typeof( HealPotion ), typeof( PoisonPotion ), typeof( CurePotion ),
typeof( ExplosionPotion ), typeof( GreaterAgilityPotion ), typeof( GreaterStrengthPotion ),
typeof( TotalRefreshPotion )
};
public static Type[] MedPotionTypes{ get{ return m_MedPotionTypes; } }
private static Type[] m_HighPotionTypes = new Type[]
{
typeof( GreaterCurePotion ), typeof( GreaterExplosionPotion ), typeof( GreaterHealPotion ),
typeof( GreaterCurePotion ), typeof( GreaterExplosionPotion ), typeof( GreaterHealPotion ),
typeof( GreaterPoisonPotion ), typeof( DeadlyPoisonPotion )
};
public static Type[] HighPotionTypes{ get{ return m_HighPotionTypes; } }
private static Type[] m_InstrumentTypes = new Type[]
{
typeof( Drums ), typeof( Harp ), typeof( LapHarp ),
typeof( Lute ), typeof( Tambourine ), typeof( TambourineTassel ),
typeof( Horn ), typeof( Flute ), typeof( Pipes )
};
public static Type[] InstrumentTypes{ get{ return m_InstrumentTypes; } }
private static Type[] m_RegularScrollTypes = new Type[]
{
typeof( ReactiveArmorScroll ), typeof( ClumsyScroll ), typeof( CreateFoodScroll ), typeof( FeeblemindScroll ),
typeof( HealScroll ), typeof( MagicArrowScroll ), typeof( NightSightScroll ), typeof( WeakenScroll ),
typeof( AgilityScroll ), typeof( CunningScroll ), typeof( CureScroll ), typeof( HarmScroll ),
typeof( MagicTrapScroll ), typeof( MagicUnTrapScroll ), typeof( ProtectionScroll ), typeof( StrengthScroll ),
typeof( BlessScroll ), typeof( FireballScroll ), typeof( MagicLockScroll ), typeof( PoisonScroll ),
typeof( TelekinisisScroll ), typeof( TeleportScroll ), typeof( UnlockScroll ), typeof( WallOfStoneScroll ),
typeof( ArchCureScroll ), typeof( ArchProtectionScroll ), typeof( CurseScroll ), typeof( FireFieldScroll ),
typeof( GreaterHealScroll ), typeof( LightningScroll ), typeof( ManaDrainScroll ), typeof( RecallScroll ),
typeof( BladeSpiritsScroll ), typeof( DispelFieldScroll ), typeof( IncognitoScroll ), typeof( MagicReflectScroll ),
typeof( MindBlastScroll ), typeof( ParalyzeScroll ), typeof( PoisonFieldScroll ), typeof( SummonCreatureScroll ),
typeof( DispelScroll ), typeof( EnergyBoltScroll ), typeof( ExplosionScroll ), typeof( InvisibilityScroll ),
typeof( MarkScroll ), typeof( MassCurseScroll ), typeof( ParalyzeFieldScroll ), typeof( RevealScroll ),
typeof( ChainLightningScroll ), typeof( EnergyFieldScroll ), typeof( FlamestrikeScroll ), typeof( GateTravelScroll ),
typeof( ManaVampireScroll ), typeof( MassDispelScroll ), typeof( MeteorSwarmScroll ), typeof( PolymorphScroll ),
typeof( EarthquakeScroll ), typeof( EnergyVortexScroll ), typeof( ResurrectionScroll ), typeof( SummonAirElementalScroll ),
typeof( SummonDaemonScroll ), typeof( SummonEarthElementalScroll ), typeof( SummonFireElementalScroll ), typeof( SummonWaterElementalScroll )
};
public static Type[] RegularScrollTypes{ get{ return m_RegularScrollTypes; } }
private static Type[] m_WandTypes = new Type[]
{
typeof( ClumsyWand ), typeof( FeebleWand ), typeof( FireballWand ),
typeof( GreaterHealWand ), typeof( HarmWand ), typeof( HealWand ),
typeof( LightningWand ), typeof( MagicArrowWand ), typeof( RecallWand ),
typeof( ManaDrainWand ), typeof( WeaknessWand ), typeof( MarkWand ),
typeof( RemoveTrapWand ), typeof( UnlockWand ),
typeof( ClumsyWand ), typeof( FeebleWand ), typeof( FireballWand ),
typeof( GreaterHealWand ), typeof( HarmWand ), typeof( HealWand ),
typeof( LightningWand ), typeof( MagicArrowWand ), typeof( RecallWand ),
typeof( ManaDrainWand ), typeof( WeaknessWand ), typeof( MarkWand ),
typeof( RemoveTrapWand ), typeof( UnlockWand ),
typeof( ResurrectionWand )
};
public static Type[] WandTypes{ get{ return m_WandTypes; } }
private static Type[] m_ClothingTypes = new Type[]
{
typeof( Bonnet ), typeof( Cap ), typeof( FeatheredHat ),
typeof( FloppyHat ), typeof( JesterHat ), typeof( Surcoat ),
typeof( SkullCap ), typeof( StrawHat ), typeof( TallStrawHat ),
typeof( TricorneHat ), typeof( WideBrimHat ), typeof( WizardsHat ),
typeof( Bandana ), typeof( BearMask ), typeof( DeerMask ),
typeof( Hood ),
typeof( Boots ), typeof( Shoes ), typeof( ThighBoots ),
typeof( Sandals ),
typeof( Boots ), typeof( Shoes ), typeof( ThighBoots ),
typeof( Sandals ),
typeof( Boots ), typeof( Shoes ), typeof( ThighBoots ),
typeof( Sandals ),
typeof( ShortPants ), typeof( LongPants ), typeof( Kilt ),
typeof( Skirt ),
typeof( ShortPants ), typeof( LongPants ), typeof( Kilt ),
typeof( Skirt ),
typeof( ShortPants ), typeof( LongPants ), typeof( Kilt ),
typeof( Skirt ),
typeof( Doublet ), typeof( JesterSuit ), typeof( Tunic ),
typeof( Shirt ), typeof( FancyShirt ),
typeof( Doublet ), typeof( JesterSuit ), typeof( Tunic ),
typeof( Shirt ), typeof( FancyShirt ),
typeof( Doublet ), typeof( JesterSuit ), typeof( Tunic ),
typeof( Shirt ), typeof( FancyShirt ),
typeof( FancyDress ), typeof( PlainDress ), typeof( Robe ),
typeof( Robe ), typeof( Cloak ), typeof( BodySash ),
typeof( FancyDress ), typeof( PlainDress ), typeof( Robe ),
typeof( Robe ), typeof( Cloak ), typeof( BodySash ),
typeof( FullApron ), typeof( HalfApron )
};
public static Type[] ClothingTypes{ get{ return m_ClothingTypes; } }
private static Type[] m_BookTypes = new Type[]
{
typeof( BlueBook ),
typeof( BrownBook ),
typeof( Codex ),
typeof( Diary ),
typeof( Grimoire ),
typeof( Journal ),
typeof( Lexicon ),
typeof( RedBook ),
typeof( Spellbook ),
typeof( TanBook ),
typeof( Tome )
};
public static Type[] BookTypes{ get{ return m_BookTypes; } }
private static Type[] m_ToolTypes = new Type[]
{
typeof( Shovel ),
typeof( Shovel ),
typeof( Shovel ),
typeof( Shovel ),
typeof( Shovel ),
typeof( Shovel ),
typeof( Shovel ),
typeof( Shovel ),
typeof( Shovel ),
typeof( Shovel ),
typeof( Shovel ),
typeof( FletcherTools ), typeof( FletcherTools ), typeof( FletcherTools ), typeof( FletcherTools ), typeof( FletcherTools ), typeof( FletcherTools ), typeof( FletcherTools ), typeof( FletcherTools ), typeof( FletcherTools ), typeof( FletcherTools ), typeof( FletcherTools ),
typeof( MapmakersPen ), typeof( MapmakersPen ), typeof( MapmakersPen ), typeof( MapmakersPen ), typeof( MapmakersPen ), typeof( MapmakersPen ), typeof( MapmakersPen ), typeof( MapmakersPen ), typeof( MapmakersPen ), typeof( MapmakersPen ), typeof( MapmakersPen ),
typeof( MortarPestle ), typeof( MortarPestle ), typeof( MortarPestle ), typeof( MortarPestle ), typeof( MortarPestle ), typeof( MortarPestle ), typeof( MortarPestle ), typeof( MortarPestle ), typeof( MortarPestle ), typeof( MortarPestle ), typeof( MortarPestle ),
typeof( ScribesPen ), typeof( ScribesPen ), typeof( ScribesPen ), typeof( ScribesPen ), typeof( ScribesPen ), typeof( ScribesPen ), typeof( ScribesPen ), typeof( ScribesPen ), typeof( ScribesPen ), typeof( ScribesPen ), typeof( ScribesPen ),
typeof( SewingKit ), typeof( SewingKit ), typeof( SewingKit ), typeof( SewingKit ), typeof( SewingKit ), typeof( SewingKit ), typeof( SewingKit ), typeof( SewingKit ), typeof( SewingKit ), typeof( SewingKit ), typeof( SewingKit ),
typeof( TinkerTools ), typeof( TinkerTools ), typeof( TinkerTools ), typeof( TinkerTools ), typeof( TinkerTools ), typeof( TinkerTools ), typeof( TinkerTools ), typeof( TinkerTools ), typeof( TinkerTools ), typeof( TinkerTools ), typeof( TinkerTools ),
typeof( Skillet ),
typeof( FlourSifter ),
typeof( RollingPin ),
typeof( Skillet ),
typeof( FlourSifter ),
typeof( RollingPin ),
typeof( Skillet ),
typeof( FlourSifter ),
typeof( RollingPin ),
typeof( Skillet ),
typeof( FlourSifter ),
typeof( SmoothingPlane ),
typeof( DovetailSaw ),
typeof( DrawKnife ),
typeof( Froe ),
typeof( Hammer ),
typeof( Inshave ),
typeof( JointingPlane ),
typeof( MouldingPlane ),
typeof( Nails ),
typeof( Saw ),
typeof( Scorp ),
typeof( Tongs ),
typeof( SledgeHammer ),
typeof( SmithHammer ),
typeof( Tongs ),
typeof( SledgeHammer ),
typeof( SmithHammer ),
typeof( Tongs ),
typeof( SledgeHammer ),
typeof( SmithHammer ),
typeof( Tongs ),
typeof( SmithHammer )
};
public static Type[] ToolTypes{ get{ return m_ToolTypes; } }
private static Type[] m_CraftTypes = new Type[]
{
typeof( Beeswax ),
typeof( BlankScroll ),
typeof( BoltOfCloth ),
typeof( Bottle ),
typeof( Cloth ),
typeof( DarkYarn ),
typeof( Feather ),
typeof( IronIngot ),
typeof( Leather ),
typeof( LightYarn ),
typeof( Shaft ),
typeof( SpoolOfThread ),
typeof( UncutCloth ),
typeof( WoodBoard )
};
public static Type[] CraftTypes{ get{ return m_CraftTypes; } }
private static Type[] m_MiscTypes = new Type[]
{
typeof( Arrow ), typeof( Arrow ), typeof( Arrow ), typeof( Arrow ),
typeof( BigBag ), typeof( Backpack ), typeof( Backpack ), typeof( Backpack ),
typeof( BigBag ), typeof( Bag ), typeof( Bag ), typeof( Bag ),
typeof( Bandage ), typeof( Bandage ), typeof( Bandage ), typeof( Bandage ),
typeof( BedRolled ), typeof( BedRolled ), typeof( BedRolled ), typeof( BedRolled ),
typeof( Bolt ), typeof( Bolt ), typeof( Bolt ), typeof( Bolt ),
typeof( Sausage ), typeof( FrenchBread ), typeof( BreadLoaf ), typeof( Ribs ),
typeof( Candle ), typeof( Candle ), typeof( Candle ), typeof( Candle ),
typeof( SlabOfBacon ), typeof( CheeseWedge ), typeof( FishSteak ), typeof( CheeseWheel ),
typeof( Ham ), typeof( CookedBird ),
typeof( FishingPole ), typeof( FishingPole ), typeof( FishingPole ), typeof( FishingPole ),
typeof( Kindling ), typeof( Kindling ), typeof( Kindling ), typeof( Kindling ),
typeof( Lantern ), typeof( Lantern ), typeof( Lantern ), typeof( Lantern ),
typeof( Lockpick ), typeof( Lockpick ), typeof( Lockpick ), typeof( Lockpick ),
typeof( OilCloth ), typeof( OilCloth ), typeof( OilCloth ), typeof( OilCloth ),
typeof( BigBag ), typeof( Pouch ), typeof( Pouch ), typeof( Pouch ),
typeof( Scissors ), typeof( Scissors ), typeof( Scissors ), typeof( Scissors ),
typeof( Sextant ), typeof( Sextant ), typeof( Sextant ), typeof( Sextant ),
typeof( SmallCrate ), typeof( SmallCrate ), typeof( SmallCrate ), typeof( SmallCrate ),
typeof( Spyglass ), typeof( Spyglass ), typeof( Spyglass ), typeof( Spyglass ),
typeof( Torch ), typeof( Torch ), typeof( Torch ), typeof( Torch ),
typeof( WoodenBox ), typeof( WoodenBox ), typeof( WoodenBox ), typeof( WoodenBox ),
typeof( Axle ),
typeof( AxleGears ),
typeof( ClockFrame ),
typeof( ClockParts ),
typeof( ClockRight ),
typeof( ClockLeft ),
typeof( Gears ),
typeof( Hinge ),
typeof( SextantParts ),
typeof( Springs ),
typeof( Fork ),
typeof( Spoon ),
typeof( Knife ),
typeof( Plate ),
typeof( CeramicMug ),
typeof( PewterMug ),
typeof( Goblet ),
typeof( Glass ),
typeof( GlassBottle ),
typeof( GlassMug ),
typeof( Pitcher )
};
public static Type[] MiscTypes{ get{ return m_MiscTypes; } }
private static Type[] m_Rares = new Type[]
{
typeof( BottleOfAcid ), typeof( SkeletonKeys )
};
public static Type[] Rares{ get{ return m_Rares; } }
// ------------------------------------------------------------------------------------------------
private static Type[] m_CategoryA = new Type[]
{
typeof( IronBrazierShort ), typeof( IronBrazier ), typeof( IronBrazierStand ),
typeof( IronCandle ), typeof( IronCandelabra ), typeof( IronCandelabraStand )
};
public static Type[] CategoryA{ get{ return m_CategoryA; } }
private static Type[] m_CategoryB = new Type[]
{
typeof( TrophyFish ), typeof( TrophyKodiak ), typeof( TrophyGargoyle ),
typeof( TrophyBear ), typeof( TrophyLizard ), typeof( TrophyMinotaur ),
typeof( TrophyDeer ), typeof( TrophyLizardman ), typeof( TrophyGoblin ),
typeof( TrophyApe ), typeof( TrophyNightmare ), typeof( TrophyMinotaurLord ),
typeof( TrophyOrc ), typeof( TrophyOgre ), typeof( TrophyDragon ),
typeof( TrophyPolarBear ), typeof( TrophyRatman ), typeof( TrophyDaemon ),
typeof( TrophyTroll ), typeof( TrophyEttin ), typeof( TrophyBoard ),
typeof( TrophySnowBear ), typeof( TrophyOgreLord ), typeof( TrophyBoard ),
typeof( TrophyCaveBear ), typeof( TrophyCyclops ), typeof( TrophyBoard )
};
public static Type[] CategoryB{ get{ return m_CategoryB; } }
// ------------------------------------------------------------------------------------------------
#endregion
#region Accessors
public static BaseWand RandomWand()
{
return Construct( m_WandTypes ) as BaseWand;
}
public static BaseClothing RandomClothing()
{
return Construct( m_ClothingTypes ) as BaseClothing;
}
public static BaseWeapon RandomRangedWeapon()
{
return Construct( m_RangedWeaponTypes ) as BaseWeapon;
}
public static BaseWeapon RandomWeapon()
{
return Construct( m_WeaponTypes ) as BaseWeapon;
}
public static BaseJewel RandomJewelry()
{
return Construct( m_JewelryTypes ) as BaseJewel;
}
public static BaseArmor RandomArmor()
{
return Construct( m_ArmorTypes ) as BaseArmor;
}
public static BaseShield RandomShield()
{
return Construct( m_ShieldTypes ) as BaseShield;
}
public static BaseArmor RandomArmorOrShield()
{
return Construct( m_ArmorTypes, m_ShieldTypes ) as BaseArmor;
}
public static Item RandomArmorOrShieldOrWeapon()
{
return Construct( m_WeaponTypes, m_RangedWeaponTypes, m_ArmorTypes, m_ShieldTypes );
}
public static Item RandomLowPotion()
{
return Construct( m_LowPotionTypes );
}
public static Item RandomMedPotion()
{
return Construct( m_MedPotionTypes );
}
public static Item RandomHighPotion()
{
return Construct( m_HighPotionTypes );
}
public static Item RandomTool()
{
return Construct( m_ToolTypes );
}
public static Item RandomBook()
{
return Construct( m_BookTypes );
}
public static Item RandomRare()
{
return Construct( m_Rares );
}
public static Item RandomProvisions()
{
Item item = null;
switch ( Utility.Random( 32 ) )
{
case 0:
case 1: item = new Bandage(); break;
case 2:
case 3: item = new Arrow(); break;
case 4:
case 5: item = new Bolt(); break;
case 6:
case 7: item = new Candle(); break;
case 8:
case 9: item = new Torch(); break;
case 10:
case 11: item = new Lantern(); break;
case 12: item = new Sausage(); break;
case 13: item = new FrenchBread(); break;
case 14: item = new BreadLoaf(); break;
case 15: item = new Ribs(); break;
case 16: item = new SlabOfBacon(); break;
case 17: item = new CheeseWedge(); break;
case 18: item = new FishSteak(); break;
case 19: item = new CheeseWheel(); break;
case 20: item = new Ham(); break;
case 21: item = new CookedBird(); break;
case 22:
case 23:
case 24: item = new BeverageBottle( BeverageType.Ale ); break;
case 25:
case 26:
case 27: item = new BeverageBottle( BeverageType.Wine ); break;
case 28:
case 29: item = new BeverageBottle( BeverageType.Liquor ); break;
case 30:
case 31: item = new Jug( BeverageType.Cider ); break;
}
DungeonFood( item );
return item;
}
public static Item RandomCraft()
{
return Construct( m_CraftTypes );
}
public static Item RandomMisc()
{
Item item = Construct( m_MiscTypes );
DungeonFood( item );
return item;
}
public static Item RandomOdd()
{
Item item = null;
switch ( Utility.Random( 2 ) )
{
case 0: item = Construct( m_CategoryA ); break;
case 1: item = Construct( m_CategoryB ); break;
}
return item;
}
public static Item RandomGem()
{
return Construct( m_GemTypes );
}
public static Item RandomReagent()
{
return Construct( m_RegTypes );
}
public static BaseInstrument RandomInstrument()
{
return Construct( m_InstrumentTypes ) as BaseInstrument;
}
public static SpellScroll RandomScroll( int minIndex, int maxIndex, SpellbookType type )
{
Type[] types = m_RegularScrollTypes;
return Construct( types, Utility.RandomMinMax( minIndex, maxIndex ) ) as SpellScroll;
}
#endregion
public static void DungeonFood( Item item )
{
if ( item is Sausage ){ item.Name = "smoked sausage"; item.Hue = 0x4A2; }
else if ( item is FrenchBread ){ item.Name = "stale bread"; item.Hue = 0x4A2; }
else if ( item is BreadLoaf ){ item.Name = "stale bread"; item.Hue = 0x4A2; }
else if ( item is Ribs ){ item.Name = "smoked ribs"; item.Hue = 0x4A2; item.ItemID = 0x9F1; }
else if ( item is SlabOfBacon ){ item.Name = "smoked bacon"; item.Hue = 0x4A2; }
else if ( item is CheeseWedge ){ item.Name = "moldy cheese"; item.Hue = 0x49A; }
else if ( item is FishSteak ){ item.Name = "smoked fish"; item.Hue = 0x96D; }
else if ( item is CheeseWheel ){ item.Name = "moldy cheese"; item.Hue = 0x49A; }
else if ( item is Ham ){ item.Name = "smoked ham"; item.Hue = 0x49C; item.ItemID = 0x96F; }
else if ( item is CookedBird ){ item.Name = "smoked bird"; item.Hue = 0x49E; }
}
#region Construction methods
public static Item Construct( Type type )
{
try
{
return Activator.CreateInstance( type ) as Item;
}
catch
{
return null;
}
}
public static Item Construct( Type[] types )
{
if ( types.Length > 0 )
return Construct( types, Utility.Random( types.Length ) );
return null;
}
public static Item Construct( Type[] types, int index )
{
if ( index >= 0 && index < types.Length )
return Construct( types[index] );
return null;
}
public static Item Construct( params Type[][] types )
{
int totalLength = 0;
for ( int i = 0; i < types.Length; ++i )
totalLength += types[i].Length;
if ( totalLength > 0 )
{
int index = Utility.Random( totalLength );
for ( int i = 0; i < types.Length; ++i )
{
if ( index >= 0 && index < types[i].Length )
return Construct( types[i][index] );
index -= types[i].Length;
}
}
return null;
}
#endregion
}
}

View file

@ -0,0 +1,373 @@
using System;
using System.Collections.Generic;
using Server;
using Server.ContextMenus;
using Server.Engines.PartySystem;
using Server.Gumps;
using Server.Multis;
using Server.Network;
namespace Server.Items
{
public class LootChest : LockableContainer
{
private int m_Level;
private int m_Category;
private DateTime m_ResetTime;
private Mobile m_LastLooter;
[CommandProperty( AccessLevel.GameMaster )]
public int Level{ get{ return m_Level; } set{ m_Level = value; } }
[CommandProperty( AccessLevel.GameMaster )]
public int Category{ get{ return m_Category; } set{ m_Category = value; } }
[CommandProperty( AccessLevel.GameMaster )]
public Mobile LastLooter{ get{ return m_LastLooter; } set{ m_LastLooter = value; } }
[CommandProperty( AccessLevel.GameMaster )]
public DateTime ResetTime{ get{ return m_ResetTime; } }
[Constructable]
public LootChest() : base( 0xE40 )
{
m_ResetTime = DateTime.Now;
Movable = false;
m_Level = 1;
m_Category = 1;
/* Level 1 Level 2 Level 3 Thief 4
------------+-------------------- --------------------- ------------------- --------------------- --------
Type |ID ID Hue ID ID Hue ID ID Hue ID ID Hue Category
------------+-------------------- --------------------- ------------------- --------------------- --------
Crate |0xE3E 0xE3F 0 0xE3C 0xE3D 0 0x645 0x646 0 0x0E99 0x0E9A 0 1
Wood Chest |0x52D 0x52E 0x96D 0x5ED 0x5EE 0x96D 0xE42 0xE43 0 0x481 0x488 0 2
Metal Chest |0x9AB 0xE7C 0 0xE54 0xE55 0 0xE40 0xE41 0 0xE52 0xE53 0x4A5 3
--------------------------------------------------------------------------------------------------------------------
*/
}
public override void OnDoubleClick( Mobile from )
{
if ( from.AccessLevel > AccessLevel.Player || from.InRange( this.GetWorldLocation(), 2 ) )
{
if ( !(this is SunkenShip) )
Setup();
Fill( from );
Open( from );
}
else
from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that.
}
public override bool CheckLift( Mobile from, Item item, ref LRReason reject )
{
if ( m_Level > 3 )
{
int steal = m_Category * 33;
if ( from.CheckSkill( SkillName.Stealing, (steal-38), (steal+11) ) )
{
from.SendMessage( "Your nimble fingers help you steal the item." );
return base.CheckLift( from, item, ref reject );
}
else
{
from.SendMessage( "You try to steal the item, but you were not nimble enough so you lost it!" );
item.Delete();
return false;
}
}
return base.CheckLift( from, item, ref reject );
}
public override bool OnDragDropInto( Mobile from, Item item, Point3D p )
{
if ( m_Level > 3 )
{
from.SendMessage( "You try to put the item in there, but somehow lose it!" );
item.Delete();
return false;
}
return base.OnDragDropInto( from, item, p );
}
public override bool TryDropItem( Mobile from, Item dropped, bool sendFullMessage )
{
if ( m_Level > 3 )
{
from.SendMessage( "You try to put the item in there, but somehow lose it!" );
dropped.Delete();
return false;
}
return base.TryDropItem( from, dropped, sendFullMessage );
}
public bool NeverLock()
{
if ( m_Category == 1 && m_Level < 4 )
return true;
return false;
}
public void Setup()
{
if ( DateTime.Now >= m_ResetTime )
{
m_ResetTime = DateTime.Now + TimeSpan.FromMinutes( ((double)(Utility.RandomMinMax(45,60))) );
List<Item> o = new List<Item>();
foreach( Item i in this.Items )
{
o.Add(i);
}
foreach ( Item g in o )
{
g.Delete();
}
Locked = false;
TrapType = TrapType.None;
TrapPower = 0;
TrapLevel = 0;
m_LastLooter = null;
int i_Difficulty = ( m_Level * 18 ) + ( m_Category * 10 );
if ( Utility.RandomMinMax(1,100) < i_Difficulty && !NeverLock() )
{
Locked = true;
RequiredSkill = i_Difficulty;
LockLevel = RequiredSkill - 10;
MaxLockLevel = RequiredSkill + 30;
}
if ( Utility.RandomMinMax(1,100) < i_Difficulty )
{
switch ( Utility.Random( 4 ) )
{
case 0: TrapType = TrapType.MagicTrap; break;
case 1: TrapType = TrapType.ExplosionTrap; break;
case 2: TrapType = TrapType.DartTrap; break;
case 3: TrapType = TrapType.PoisonTrap; break;
}
TrapPower = i_Difficulty;
TrapLevel = 0;
}
}
}
public static int WepArmQuality( int level, int lvl, int cat )
{
if ( Utility.Random(8) < ( lvl + cat ) )
{
if ( level >= Utility.Random(1320) )
return 6;
else if ( level >= Utility.Random(1100) )
return 5;
else if ( level >= Utility.Random(880) )
return 4;
else if ( level >= Utility.Random(660) )
return 3;
else if ( level >= Utility.Random(440) )
return 2;
}
return 1;
}
public static int PotionQuality( int level, int lvl, int cat )
{
if ( Utility.Random(8) < ( lvl + cat ) )
{
if ( level >= Utility.Random(660) )
return 3;
else if ( level >= Utility.Random(440) )
return 2;
}
return 1;
}
public static int ScrollQuality( int level, int lvl, int cat )
{
int scroll = 24;
if ( Utility.Random(8) < ( lvl + cat ) )
{
if ( level >= Utility.Random(800) )
scroll = 64;
else if ( level >= Utility.Random(400) )
scroll = 56;
else if ( level >= Utility.Random(200) )
scroll = 48;
else if ( level >= Utility.Random(100) )
scroll = 40;
else if ( level >= Utility.Random(50) )
scroll = 32;
}
return scroll-1;
}
public Item TreasureItem( int level )
{
Item item = null;
switch ( Utility.Random( 30 ) )
{
case 0:
case 1:
int pot = PotionQuality( level, m_Level, m_Category );
switch ( Utility.Random( pot ) )
{
case 0: item = Loot.RandomLowPotion(); break;
case 1: item = Loot.RandomMedPotion(); break;
case 2: item = Loot.RandomHighPotion(); break;
}
break;
case 2:
case 3:
case 4: item = Loot.RandomTool(); break;
case 5:
case 6:
case 7: item = Loot.RandomMisc(); break;
case 8:
case 9:
case 10: item = Loot.RandomCraft();
if ( item is Cloth ){ item.Hue = Utility.RandomHue(); item.ItemID = Utility.RandomList( 0x1766, 0x1768 ); }
else if ( item is BoltOfCloth ){ item.Hue = Utility.RandomHue(); item.ItemID = Utility.RandomList( 0xF95, 0xF96, 0xF97, 0xF98, 0xF99, 0xF9A, 0xF9B, 0xF9C ); }
break;
case 11:
case 12:
case 13:
case 14:
case 15: item = Loot.RandomProvisions(); break;
case 16:
case 17: item = Loot.RandomGem(); break;
case 18:
case 19: item = Loot.RandomReagent(); item.Amount = Utility.Random((int)(level/2))+5; break;
case 20: item = Loot.RandomWand(); break;
case 21: item = Loot.RandomClothing(); break;
case 22: item = Loot.RandomRangedWeapon(); break;
case 23: item = Loot.RandomWeapon(); break;
case 24: item = Loot.RandomJewelry(); break;
case 25: item = Loot.RandomArmor(); break;
case 26: item = Loot.RandomShield(); break;
case 27: item = Loot.RandomInstrument(); break;
case 28:
case 29: Loot.RandomScroll( 0, ScrollQuality( level, m_Level, m_Category ), SpellbookType.Regular ); break;
}
return item;
}
public void Fill( Mobile m )
{
if ( m_LastLooter == null )
{
int level = ( ( m_Level + m_Category ) * 10 ) + Server.SkillHandlers.Searching.TotalSearchSkill( m );
int rank = m_Category + m_Level;
/* *********** SEARCH SKILL PER TREASURE **********
Box None Night Light Skill Skill+Ns-Lt
Lvl -------------------------------------------
Cat 0 25 50 100 125 150
---------------------------------------------------
2 20 45 70 120 145 170
3 30 55 80 130 155 180
4 40 65 90 140 165 190
5 50 75 100 150 175 200
6 60 85 110 160 185 210
7 70 95 120 170 195 220
---------------------------------------------------
*/
m_LastLooter = m;
// --------------------------------------------------------------------------------
int gold = level * Utility.RandomMinMax(5,10);
double w = gold * (Server.Misc.Settings.GoldCutRate() * .01);
gold = (int)w;
DropItem( new Gold( gold ) );
// --------------------------------------------------------------------------------
if ( Utility.Random(2000) < level )
DropItem( new TreasureMap( Utility.RandomMinMax(1,m_Level), Map.Britannia ) );
// --------------------------------------------------------------------------------
int numberItems = (int)( Utility.RandomMinMax( rank, ((level / 20)+rank) ) );
for ( int i = 0; i < numberItems; ++i )
{
Item item = TreasureItem( level );
if ( item != null )
{
MakeMagical( item, level, m_Level, m_Category );
DropItem( item );
}
}
}
}
public static void MakeMagical( Item item, int level, int lvl, int cat )
{
if ( item != null )
{
if ( item is BaseWeapon && !(item is BaseWand) )
{
BaseWeapon weapon = (BaseWeapon)item;
weapon.DamageLevel = (WeaponDamageLevel)Utility.Random( WepArmQuality( level, lvl, cat ) );
weapon.AccuracyLevel = (WeaponAccuracyLevel)Utility.Random( WepArmQuality( level, lvl, cat ) );
weapon.DurabilityLevel = (WeaponDurabilityLevel)Utility.Random( WepArmQuality( level, lvl, cat ) );
}
else if ( item is BaseArmor )
{
BaseArmor armor = (BaseArmor)item;
armor.ProtectionLevel = (ArmorProtectionLevel)Utility.Random( WepArmQuality( level, lvl, cat ) );
armor.Durability = (ArmorDurabilityLevel)Utility.Random( WepArmQuality( level, lvl, cat ) );
}
else if ( item is BaseClothing )
{
BaseClothing cloth = (BaseClothing)item;
}
}
}
public LootChest( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 );
writer.Write( m_LastLooter );
writer.Write( (int) m_Level );
writer.Write( (int) m_Category );
writer.Write( m_ResetTime );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
m_LastLooter = reader.ReadMobile();
m_Level = reader.ReadInt();
m_Category = reader.ReadInt();
m_ResetTime = reader.ReadDateTime();
}
}
}

View file

@ -0,0 +1,350 @@
using System;
using System.Collections.Generic;
using Server;
using Server.ContextMenus;
using Server.Engines.PartySystem;
using Server.Gumps;
using Server.Multis;
using Server.Network;
namespace Server.Items
{
[Flipable( 0xE3E, 0xE3F )]
public class LootCrate1 : LootChest
{
[Constructable]
public LootCrate1()
{
Name = "crate";
ItemID = 0xE3E;
Level = 1;
Category = 1;
}
public LootCrate1( 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();
}
}
[Flipable( 0xE3C, 0xE3D )]
public class LootCrate2 : LootChest
{
[Constructable]
public LootCrate2()
{
Name = "crate";
ItemID = 0xE3C;
Level = 2;
Category = 1;
}
public LootCrate2( 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();
}
}
[Flipable( 0x645, 0x646 )]
public class LootCrate3 : LootChest
{
[Constructable]
public LootCrate3()
{
Name = "crate";
ItemID = 0x645;
Level = 3;
Category = 1;
}
public LootCrate3( 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();
}
}
[Flipable( 0x0E99, 0x0E9A )]
public class LootCrate4 : LootChest
{
[Constructable]
public LootCrate4()
{
Name = "crate";
ItemID = 0x0E99;
Level = 4;
Category = 1;
}
public LootCrate4( 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();
}
}
[Flipable( 0x52D, 0x52E )]
public class LootBox1 : LootChest
{
[Constructable]
public LootBox1()
{
Name = "wooden chest";
ItemID = 0x52D;
Level = 1;
Category = 2;
Hue = 0x96D;
}
public LootBox1( 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();
}
}
[Flipable( 0x5ED, 0x5EE )]
public class LootBox2 : LootChest
{
[Constructable]
public LootBox2()
{
Name = "wooden chest";
ItemID = 0x5ED;
Level = 2;
Category = 2;
Hue = 0x96D;
}
public LootBox2( 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();
}
}
[Flipable( 0xE42, 0xE43 )]
public class LootBox3 : LootChest
{
[Constructable]
public LootBox3()
{
Name = "wooden chest";
ItemID = 0xE42;
Level = 3;
Category = 2;
}
public LootBox3( 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();
}
}
[Flipable( 0x481, 0x488 )]
public class LootBox4 : LootChest
{
[Constructable]
public LootBox4()
{
Name = "wooden chest";
ItemID = 0x481;
Level = 4;
Category = 2;
}
public LootBox4( 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();
}
}
[Flipable( 0x9AB, 0xE7C )]
public class LootChest1 : LootChest
{
[Constructable]
public LootChest1()
{
Name = "metal chest";
ItemID = 0x9AB;
Level = 1;
Category = 3;
}
public LootChest1( 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();
}
}
[Flipable( 0xE54, 0xE55 )]
public class LootChest2 : LootChest
{
[Constructable]
public LootChest2()
{
Name = "metal chest";
ItemID = 0xE54;
Level = 2;
Category = 3;
}
public LootChest2( 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();
}
}
[Flipable( 0xE40, 0xE41 )]
public class LootChest3 : LootChest
{
[Constructable]
public LootChest3()
{
Name = "metal chest";
ItemID = 0xE40;
Level = 3;
Category = 3;
}
public LootChest3( 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();
}
}
[Flipable( 0xE52, 0xE53 )]
public class LootChest4 : LootChest
{
[Constructable]
public LootChest4()
{
Name = "metal chest";
ItemID = 0xE52;
Level = 4;
Category = 3;
}
public LootChest4( 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,631 @@
using System;
using System.Collections;
using Server;
using Server.Items;
using Server.Mobiles;
using System.Collections.Generic;
namespace Server
{
public class LootPack
{
private LootPackEntry[] m_Entries;
public LootPack( LootPackEntry[] entries )
{
m_Entries = entries;
}
public void Generate( Mobile from, Container cont, bool spawning )
{
if ( cont == null )
return;
for ( int i = 0; i < m_Entries.Length; ++i )
{
LootPackEntry entry = m_Entries[i];
bool shouldAdd = ( entry.Chance > Utility.Random( 10000 ) );
if ( !shouldAdd )
continue;
Item item = entry.Construct( from, spawning );
if ( item != null )
{
if ( !item.Stackable || !cont.TryDropItem( from, item, false ) )
cont.DropItem( item );
}
}
}
public static readonly LootPackItem[] Gold = new LootPackItem[]
{
new LootPackItem( typeof( Gold ), 1 )
};
public static readonly LootPackItem[] Instruments = new LootPackItem[]
{
new LootPackItem( typeof( BaseInstrument ), 1 )
};
public static readonly LootPackItem[] LowPotionItems = new LootPackItem[]
{
new LootPackItem( typeof( LesserHealPotion ), 1 )
};
public static readonly LootPackItem[] MedPotionItems = new LootPackItem[]
{
new LootPackItem( typeof( HealPotion ), 1 )
};
public static readonly LootPackItem[] HighPotionItems = new LootPackItem[]
{
new LootPackItem( typeof( GreaterHealPotion ), 1 )
};
public static readonly LootPackItem[] LowScrollItems = new LootPackItem[]
{
new LootPackItem( typeof( ClumsyScroll ), 1 )
};
public static readonly LootPackItem[] MedScrollItems = new LootPackItem[]
{
new LootPackItem( typeof( ArchCureScroll ), 1 )
};
public static readonly LootPackItem[] HighScrollItems = new LootPackItem[]
{
new LootPackItem( typeof( SummonAirElementalScroll ), 1 )
};
public static readonly LootPackItem[] GemItems = new LootPackItem[]
{
new LootPackItem( typeof( Amber ), 1 )
};
public static readonly LootPackItem[] PotionItems = new LootPackItem[]
{
new LootPackItem( typeof( AgilityPotion ), 1 ),
new LootPackItem( typeof( StrengthPotion ), 1 ),
new LootPackItem( typeof( RefreshPotion ), 1 ),
new LootPackItem( typeof( LesserCurePotion ), 1 ),
new LootPackItem( typeof( LesserHealPotion ), 1 ),
new LootPackItem( typeof( LesserPoisonPotion ), 1 )
};
#region Old Magic Items
public static readonly LootPackItem[] LootMagicItems = new LootPackItem[]
{
new LootPackItem( typeof( BaseJewel ), 1 ),
new LootPackItem( typeof( BaseArmor ), 4 ),
new LootPackItem( typeof( BaseWeapon ), 3 ),
new LootPackItem( typeof( BaseRanged ), 1 ),
new LootPackItem( typeof( BaseShield ), 1 ),
new LootPackItem( typeof( BaseClothing ), 1 )
};
#endregion
#region definitions
public static readonly LootPack LootPoor = new LootPack( new LootPackEntry[]
{
new LootPackEntry( true, Gold, 100.00, "1d25" ),
new LootPackEntry( false, Instruments, 0.02, 1 )
} );
public static readonly LootPack LootMeager = new LootPack( new LootPackEntry[]
{
new LootPackEntry( true, Gold, 100.00, "5d10+25" ),
new LootPackEntry( false, Instruments, 0.10, 1 ),
new LootPackEntry( false, LootMagicItems, 1.00, 1, 1, 0, 60 ),
new LootPackEntry( false, LootMagicItems, 0.20, 1, 1, 10, 70 )
} );
public static readonly LootPack LootAverage = new LootPack( new LootPackEntry[]
{
new LootPackEntry( true, Gold, 100.00, "10d10+50" ),
new LootPackEntry( false, Instruments, 0.40, 1 ),
new LootPackEntry( false, LootMagicItems, 5.00, 1, 1, 20, 80 ),
new LootPackEntry( false, LootMagicItems, 2.00, 1, 1, 30, 90 ),
new LootPackEntry( false, LootMagicItems, 0.50, 1, 1, 40, 100 )
} );
public static readonly LootPack LootRich = new LootPack( new LootPackEntry[]
{
new LootPackEntry( true, Gold, 100.00, "10d10+250" ),
new LootPackEntry( false, Instruments, 1.00, 1 ),
new LootPackEntry( false, LootMagicItems, 20.00, 1, 1, 60, 100 ),
new LootPackEntry( false, LootMagicItems, 10.00, 1, 1, 65, 100 ),
new LootPackEntry( false, LootMagicItems, 1.00, 1, 1, 70, 100 )
} );
public static readonly LootPack LootFilthyRich = new LootPack( new LootPackEntry[]
{
new LootPackEntry( true, Gold, 100.00, "2d125+400" ),
new LootPackEntry( false, Instruments, 2.00, 1 ),
new LootPackEntry( false, LootMagicItems, 33.00, 1, 1, 50, 100 ),
new LootPackEntry( false, LootMagicItems, 33.00, 1, 1, 60, 100 ),
new LootPackEntry( false, LootMagicItems, 20.00, 1, 1, 70, 100 ),
new LootPackEntry( false, LootMagicItems, 5.00, 1, 1, 80, 100 )
} );
public static readonly LootPack LootUltraRich = new LootPack( new LootPackEntry[]
{
new LootPackEntry( true, Gold, 100.00, "5d100+500" ),
new LootPackEntry( false, Instruments, 2.00, 1 ),
new LootPackEntry( false, LootMagicItems, 100.00, 1, 1, 40, 100 ),
new LootPackEntry( false, LootMagicItems, 100.00, 1, 1, 40, 100 ),
new LootPackEntry( false, LootMagicItems, 100.00, 1, 1, 50, 100 ),
new LootPackEntry( false, LootMagicItems, 100.00, 1, 1, 50, 100 ),
new LootPackEntry( false, LootMagicItems, 100.00, 1, 1, 60, 100 ),
new LootPackEntry( false, LootMagicItems, 100.00, 1, 1, 60, 100 )
} );
public static readonly LootPack LootSuperBoss = new LootPack( new LootPackEntry[]
{
new LootPackEntry( true, Gold, 100.00, "5d100+500" ),
new LootPackEntry( false, Instruments, 2.00, 1 ),
new LootPackEntry( false, LootMagicItems, 100.00, 1, 1, 40, 100 ),
new LootPackEntry( false, LootMagicItems, 100.00, 1, 1, 40, 100 ),
new LootPackEntry( false, LootMagicItems, 100.00, 1, 1, 40, 100 ),
new LootPackEntry( false, LootMagicItems, 100.00, 1, 1, 50, 100 ),
new LootPackEntry( false, LootMagicItems, 100.00, 1, 1, 50, 100 ),
new LootPackEntry( false, LootMagicItems, 100.00, 1, 1, 50, 100 ),
new LootPackEntry( false, LootMagicItems, 100.00, 1, 1, 60, 100 ),
new LootPackEntry( false, LootMagicItems, 100.00, 1, 1, 60, 100 ),
new LootPackEntry( false, LootMagicItems, 100.00, 1, 1, 60, 100 ),
new LootPackEntry( false, LootMagicItems, 100.00, 1, 1, 70, 100 )
} );
#endregion
#region Generic accessors
public static LootPack Poor{ get{ return LootPoor; } }
public static LootPack Meager{ get{ return LootMeager; } }
public static LootPack Average{ get{ return LootAverage; } }
public static LootPack Rich{ get{ return LootRich; } }
public static LootPack FilthyRich{ get{ return LootFilthyRich; } }
public static LootPack UltraRich{ get{ return LootUltraRich; } }
public static LootPack SuperBoss{ get{ return LootSuperBoss; } }
#endregion
public static readonly LootPack LowPotions = new LootPack( new LootPackEntry[]
{
new LootPackEntry( false, LowPotionItems, 100.00, 1 )
} );
public static readonly LootPack MedPotions = new LootPack( new LootPackEntry[]
{
new LootPackEntry( false, MedPotionItems, 100.00, 1 )
} );
public static readonly LootPack HighPotions = new LootPack( new LootPackEntry[]
{
new LootPackEntry( false, HighPotionItems, 100.00, 1 )
} );
public static readonly LootPack LowScrolls = new LootPack( new LootPackEntry[]
{
new LootPackEntry( false, LowScrollItems, 100.00, 1 )
} );
public static readonly LootPack MedScrolls = new LootPack( new LootPackEntry[]
{
new LootPackEntry( false, MedScrollItems, 100.00, 1 )
} );
public static readonly LootPack HighScrolls = new LootPack( new LootPackEntry[]
{
new LootPackEntry( false, HighScrollItems, 100.00, 1 )
} );
public static readonly LootPack Gems = new LootPack( new LootPackEntry[]
{
new LootPackEntry( false, GemItems, 100.00, 1 )
} );
}
public class LootPackEntry
{
private int m_Chance;
private LootPackDice m_Quantity;
private int m_MaxProps, m_MinIntensity, m_MaxIntensity;
private bool m_AtSpawnTime;
private LootPackItem[] m_Items;
public int Chance
{
get{ return m_Chance; }
set{ m_Chance = value; }
}
public LootPackDice Quantity
{
get{ return m_Quantity; }
set{ m_Quantity = value; }
}
public int MaxProps
{
get{ return m_MaxProps; }
set{ m_MaxProps = value; }
}
public int MinIntensity
{
get{ return m_MinIntensity; }
set{ m_MinIntensity = value; }
}
public int MaxIntensity
{
get{ return m_MaxIntensity; }
set{ m_MaxIntensity = value; }
}
public LootPackItem[] Items
{
get{ return m_Items; }
set{ m_Items = value; }
}
public Item Construct( Mobile from, bool spawning )
{
if ( m_AtSpawnTime != spawning )
return null;
int totalChance = 0;
for ( int i = 0; i < m_Items.Length; ++i )
totalChance += m_Items[i].Chance;
int rnd = Utility.Random( totalChance );
for ( int i = 0; i < m_Items.Length; ++i )
{
LootPackItem item = m_Items[i];
if ( rnd < item.Chance )
return Mutate( from, item.Construct() );
rnd -= item.Chance;
}
return null;
}
private int GetRandomOldBonus()
{
int rnd = Utility.RandomMinMax( m_MinIntensity, m_MaxIntensity );
if ( 50 > rnd )
return 1;
else
rnd -= 50;
if ( 25 > rnd )
return 2;
else
rnd -= 25;
if ( 14 > rnd )
return 3;
else
rnd -= 14;
if ( 8 > rnd )
return 4;
return 5;
}
public Item Mutate( Mobile from, Item item )
{
if ( item != null )
{
if ( item is BaseWeapon && 1 > Utility.Random( 100 ) )
{
item.Delete();
item = new FireHorn();
return item;
}
if ( item is BaseWeapon || item is BaseArmor || item is BaseJewel || item is BaseHat )
{
if ( item is BaseWeapon )
{
BaseWeapon weapon = (BaseWeapon)item;
if ( 80 > Utility.Random( 100 ) )
weapon.AccuracyLevel = (WeaponAccuracyLevel)GetRandomOldBonus();
if ( 60 > Utility.Random( 100 ) )
weapon.DamageLevel = (WeaponDamageLevel)GetRandomOldBonus();
if ( 40 > Utility.Random( 100 ) )
weapon.DurabilityLevel = (WeaponDurabilityLevel)GetRandomOldBonus();
if ( 5 > Utility.Random( 100 ) )
weapon.Slayer = SlayerGroup.GetLootSlayerType();
if ( from != null && weapon.AccuracyLevel == 0 && weapon.DamageLevel == 0 && weapon.DurabilityLevel == 0 && weapon.Slayer == SlayerName.None && 5 > Utility.Random( 100 ) )
weapon.Slayer = SlayerGroup.GetLootSlayerType();
}
else if ( item is BaseArmor )
{
BaseArmor armor = (BaseArmor)item;
if ( 80 > Utility.Random( 100 ) )
armor.ProtectionLevel = (ArmorProtectionLevel)GetRandomOldBonus();
if ( 40 > Utility.Random( 100 ) )
armor.Durability = (ArmorDurabilityLevel)GetRandomOldBonus();
}
}
else if ( item is BaseInstrument )
{
SlayerName slayer = SlayerGroup.GetLootSlayerType();
if ( slayer == SlayerName.None )
{
item.Delete();
return null;
}
BaseInstrument instr = (BaseInstrument)item;
instr.Quality = InstrumentQuality.Regular;
instr.Slayer = slayer;
}
if ( item.Stackable )
item.Amount = m_Quantity.Roll();
}
return item;
}
public LootPackEntry( bool atSpawnTime, LootPackItem[] items, double chance, string quantity ) : this( atSpawnTime, items, chance, new LootPackDice( quantity ), 0, 0, 0 )
{
}
public LootPackEntry( bool atSpawnTime, LootPackItem[] items, double chance, int quantity ) : this( atSpawnTime, items, chance, new LootPackDice( 0, 0, quantity ), 0, 0, 0 )
{
}
public LootPackEntry( bool atSpawnTime, LootPackItem[] items, double chance, string quantity, int maxProps, int minIntensity, int maxIntensity ) : this( atSpawnTime, items, chance, new LootPackDice( quantity ), maxProps, minIntensity, maxIntensity )
{
}
public LootPackEntry( bool atSpawnTime, LootPackItem[] items, double chance, int quantity, int maxProps, int minIntensity, int maxIntensity ) : this( atSpawnTime, items, chance, new LootPackDice( 0, 0, quantity ), maxProps, minIntensity, maxIntensity )
{
}
public LootPackEntry( bool atSpawnTime, LootPackItem[] items, double chance, LootPackDice quantity, int maxProps, int minIntensity, int maxIntensity )
{
m_AtSpawnTime = atSpawnTime;
m_Items = items;
m_Chance = (int)(100 * chance);
m_Quantity = quantity;
m_MaxProps = maxProps;
m_MinIntensity = minIntensity;
m_MaxIntensity = maxIntensity;
}
public int GetBonusProperties()
{
int p0=0, p1=0, p2=0, p3=0, p4=0, p5=0;
switch ( m_MaxProps )
{
case 1: p0= 3; p1= 1; break;
case 2: p0= 6; p1= 3; p2= 1; break;
case 3: p0=10; p1= 6; p2= 3; p3= 1; break;
case 4: p0=16; p1=12; p2= 6; p3= 5; p4=1; break;
case 5: p0=30; p1=25; p2=20; p3=15; p4=9; p5=1; break;
}
int pc = p0+p1+p2+p3+p4+p5;
int rnd = Utility.Random( pc );
if ( rnd < p5 )
return 5;
else
rnd -= p5;
if ( rnd < p4 )
return 4;
else
rnd -= p4;
if ( rnd < p3 )
return 3;
else
rnd -= p3;
if ( rnd < p2 )
return 2;
else
rnd -= p2;
if ( rnd < p1 )
return 1;
return 0;
}
}
public class LootPackItem
{
private Type m_Type;
private int m_Chance;
public Type Type
{
get{ return m_Type; }
set{ m_Type = value; }
}
public int Chance
{
get{ return m_Chance; }
set{ m_Chance = value; }
}
private static Type[] m_BlankTypes = new Type[]{ typeof( BlankScroll ) };
public static Item RandomScroll( int index, int minCircle, int maxCircle )
{
--minCircle;
--maxCircle;
int scrollCount = ((maxCircle - minCircle) + 1) * 8;
if ( index == 0 )
scrollCount += m_BlankTypes.Length;
int rnd = Utility.Random( scrollCount );
if ( index == 0 && rnd < m_BlankTypes.Length )
return Loot.Construct( m_BlankTypes );
else if ( index == 0 )
rnd -= m_BlankTypes.Length;
return Loot.RandomScroll( minCircle * 8, (maxCircle * 8) + 7, SpellbookType.Regular );
}
public Item Construct()
{
try
{
Item item;
if ( m_Type == typeof( BaseRanged ) )
item = Loot.RandomRangedWeapon();
else if ( m_Type == typeof( BaseWeapon ) )
item = Loot.RandomWeapon();
else if ( m_Type == typeof( BaseArmor ) )
item = Loot.RandomArmor();
else if ( m_Type == typeof( BaseClothing ) )
item = Loot.RandomClothing();
else if ( m_Type == typeof( BaseShield ) )
item = Loot.RandomShield();
else if ( m_Type == typeof( BaseJewel ) )
item = Loot.RandomJewelry();
else if ( m_Type == typeof( BaseInstrument ) )
item = Loot.RandomInstrument();
else if ( m_Type == typeof( Amber ) ) // gem
item = Loot.RandomGem();
else if ( m_Type == typeof( LesserHealPotion ) ) // low potions
item = Loot.RandomLowPotion();
else if ( m_Type == typeof( HealPotion ) ) // med potions
item = Loot.RandomMedPotion();
else if ( m_Type == typeof( GreaterHealPotion ) ) // high potions
item = Loot.RandomHighPotion();
else if ( m_Type == typeof( ClumsyScroll ) ) // low scroll
item = RandomScroll( 0, 1, 3 );
else if ( m_Type == typeof( ArchCureScroll ) ) // med scroll
item = RandomScroll( 1, 4, 7 );
else if ( m_Type == typeof( SummonAirElementalScroll ) ) // high scroll
item = RandomScroll( 2, 8, 8 );
else
item = Activator.CreateInstance( m_Type ) as Item;
return item;
}
catch
{
}
return null;
}
public LootPackItem( Type type, int chance )
{
m_Type = type;
m_Chance = chance;
}
}
public class LootPackDice
{
private int m_Count, m_Sides, m_Bonus;
public int Count
{
get{ return m_Count; }
set{ m_Count = value; }
}
public int Sides
{
get{ return m_Sides; }
set{ m_Sides = value; }
}
public int Bonus
{
get{ return m_Bonus; }
set{ m_Bonus = value; }
}
public int Roll()
{
int v = m_Bonus;
double w;
for ( int i = 0; i < m_Count; ++i )
v += Utility.Random( 1, m_Sides );
w = v * (Server.Misc.Settings.GoldCutRate() * .01);
return (int)w;
}
public LootPackDice( string str )
{
int start = 0;
int index = str.IndexOf( 'd', start );
if ( index < start )
return;
m_Count = Utility.ToInt32( str.Substring( start, index-start ) );
bool negative;
start = index + 1;
index = str.IndexOf( '+', start );
if ( negative = (index < start) )
index = str.IndexOf( '-', start );
if ( index < start )
index = str.Length;
m_Sides = Utility.ToInt32( str.Substring( start, index-start ) );
if ( index == str.Length )
return;
start = index + 1;
index = str.Length;
m_Bonus = Utility.ToInt32( str.Substring( start, index-start ) );
if ( negative )
m_Bonus *= -1;
}
public LootPackDice( int count, int sides, int bonus )
{
m_Count = count;
m_Sides = sides;
m_Bonus = bonus;
}
}
}

View file

@ -0,0 +1,63 @@
using System;
using System.Collections.Generic;
using Server.Multis;
using Server.Mobiles;
using Server.Network;
using Server.ContextMenus;
namespace Server.Items
{
[DynamicFliping]
[Flipable( 0x088E, 0x088F )]
public class SunkenChest : LockableContainer
{
[Constructable]
public SunkenChest() : base( 0x088E )
{
Name = "sunken chest";
}
public SunkenChest( 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();
}
}
[DynamicFliping]
[Flipable( 0x088C, 0x088D )]
public class AncientChest : LockableContainer
{
[Constructable]
public AncientChest() : base( 0x088C )
{
Name = "ancient sunken chest";
}
public AncientChest( 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,74 @@
using System;
using Server;
namespace Server.Items
{
[Furniture]
public class SunkenShip : LootChest
{
[Constructable]
public SunkenShip()
{
Weight = -2.0;
Name = "shipwreck";
ItemID = Utility.RandomList( 0x48F, 0x490 );
Level = Utility.RandomMinMax(1,3);
Category = Utility.RandomMinMax(1,3);
}
public override void Open( Mobile from )
{
Timer.DelayCall( TimeSpan.FromSeconds( 60.0 ), new TimerCallback( Delete ) );
Weight = 5;
base.Open( from );
}
public override void OnDelete()
{
Effects.PlaySound( Location, Map, 0x026 );
int x = Location.X;
int y = Location.Y;
int z = Location.Z;
Point3D p0 = new Point3D( x, y-1, z );
Point3D p1 = new Point3D( x, y, z );
Point3D p2 = new Point3D( x, y+1, z );
Point3D p3 = new Point3D( x-1, y-1, z );
Point3D p4 = new Point3D( x-1, y, z );
Point3D p5 = new Point3D( x-1, y+1, z );
Point3D p6 = new Point3D( x+1, y-1, z );
Point3D p7 = new Point3D( x+1, y, z );
Point3D p8 = new Point3D( x+1, y+1, z );
Effects.SendLocationEffect( p0, Map, 0x352D, 16 );
Effects.SendLocationEffect( p1, Map, 0x352D, 16 );
Effects.SendLocationEffect( p2, Map, 0x352D, 16 );
Effects.SendLocationEffect( p3, Map, 0x352D, 16 );
Effects.SendLocationEffect( p4, Map, 0x352D, 16 );
Effects.SendLocationEffect( p5, Map, 0x352D, 16 );
Effects.SendLocationEffect( p6, Map, 0x352D, 16 );
Effects.SendLocationEffect( p7, Map, 0x352D, 16 );
Effects.SendLocationEffect( p8, Map, 0x352D, 16 );
}
public SunkenShip( 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 ( Weight < 10 )
Timer.DelayCall( TimeSpan.FromSeconds( 5.0 ), new TimerCallback( Delete ) );
}
}
}

View file

@ -0,0 +1,426 @@
using System;
using System.Collections.Generic;
using Server;
using Server.ContextMenus;
using Server.Engines.PartySystem;
using Server.Gumps;
using Server.Multis;
using Server.Network;
namespace Server.Items
{
public class TreasureMapChest : LockableContainer
{
public override int LabelNumber{ get{ return 3000541; } }
private int m_Level;
private DateTime m_DeleteTime;
private Timer m_Timer;
private Mobile m_Owner;
private bool m_Temporary;
private List<Mobile> m_Guardians;
[CommandProperty( AccessLevel.GameMaster )]
public int Level{ get{ return m_Level; } set{ m_Level = value; } }
[CommandProperty( AccessLevel.GameMaster )]
public Mobile Owner{ get{ return m_Owner; } set{ m_Owner = value; } }
[CommandProperty( AccessLevel.GameMaster )]
public DateTime DeleteTime{ get{ return m_DeleteTime; } }
[CommandProperty( AccessLevel.GameMaster )]
public bool Temporary{ get{ return m_Temporary; } set{ m_Temporary = value; } }
public List<Mobile> Guardians { get { return m_Guardians; } }
[Constructable]
public TreasureMapChest( int level ) : this( null, level, false )
{
}
public TreasureMapChest( Mobile owner, int level, bool temporary ) : base( 0xE40 )
{
m_Owner = owner;
m_Level = level;
m_DeleteTime = DateTime.Now + TimeSpan.FromHours( 3.0 );
m_Temporary = temporary;
m_Guardians = new List<Mobile>();
m_Timer = new DeleteTimer( this, m_DeleteTime );
m_Timer.Start();
Fill( this, level );
}
public static void Fill( LockableContainer cont, int level )
{
cont.Movable = false;
cont.Locked = true;
int numberItems;
if ( level == 0 )
{
cont.LockLevel = 0; // Can't be unlocked
cont.DropItem( new Gold( Utility.RandomMinMax( 50, 100 ) ) );
if ( Utility.RandomDouble() < 0.75 )
cont.DropItem( new TreasureMap( 0, Map.Britannia ) );
}
else
{
cont.TrapType = TrapType.ExplosionTrap;
cont.TrapPower = level * 25;
cont.TrapLevel = level;
switch ( level )
{
case 1: cont.RequiredSkill = 36; break;
case 2: cont.RequiredSkill = 76; break;
case 3: cont.RequiredSkill = 84; break;
case 4: cont.RequiredSkill = 92; break;
case 5: cont.RequiredSkill = 100; break;
case 6: cont.RequiredSkill = 100; break;
}
cont.LockLevel = cont.RequiredSkill - 10;
cont.MaxLockLevel = cont.RequiredSkill + 40;
cont.DropItem( new Gold( level * 1000 ) );
for ( int i = 0; i < level * 5; ++i )
cont.DropItem( Loot.RandomScroll( 0, 63, SpellbookType.Regular ) );
numberItems = level * 6;
for ( int i = 0; i < numberItems; ++i )
{
Item item = Loot.RandomArmorOrShieldOrWeapon();
if ( item is BaseWeapon )
{
BaseWeapon weapon = (BaseWeapon)item;
weapon.DamageLevel = (WeaponDamageLevel)Utility.Random( 6 );
weapon.AccuracyLevel = (WeaponAccuracyLevel)Utility.Random( 6 );
weapon.DurabilityLevel = (WeaponDurabilityLevel)Utility.Random( 6 );
cont.DropItem( item );
}
else if ( item is BaseArmor )
{
BaseArmor armor = (BaseArmor)item;
armor.ProtectionLevel = (ArmorProtectionLevel)Utility.Random( 6 );
armor.Durability = (ArmorDurabilityLevel)Utility.Random( 6 );
cont.DropItem( item );
}
else
{
cont.DropItem( item );
}
}
}
int reagents;
if ( level == 0 )
reagents = 12;
else
reagents = level * 3;
for ( int i = 0; i < reagents; i++ )
{
Item item = Loot.RandomReagent();
item.Amount = Utility.RandomMinMax( 40, 60 );
cont.DropItem( item );
}
int gems;
if ( level == 0 )
gems = 2;
else
gems = level * 3;
for ( int i = 0; i < gems; i++ )
{
Item item = Loot.RandomGem();
cont.DropItem( item );
}
}
public override bool CheckLocked( Mobile from )
{
if ( !this.Locked )
return false;
if ( this.Level == 0 && from.AccessLevel < AccessLevel.GameMaster )
{
foreach ( Mobile m in this.Guardians )
{
if ( m.Alive )
{
from.SendLocalizedMessage( 1046448 ); // You must first kill the guardians before you may open this chest.
return true;
}
}
LockPick( from );
return false;
}
else
{
return base.CheckLocked( from );
}
}
private List<Item> m_Lifted = new List<Item>();
private bool CheckLoot( Mobile m, bool criminalAction )
{
if ( m_Temporary )
return false;
if ( m.AccessLevel >= AccessLevel.GameMaster || m_Owner == null || m == m_Owner )
return true;
Party p = Party.Get( m_Owner );
if ( p != null && p.Contains( m ) )
return true;
Map map = this.Map;
if ( map != null && (map.Rules & MapRules.HarmfulRestrictions) == 0 )
{
if ( criminalAction )
m.CriminalAction( true );
else
m.SendLocalizedMessage( 1010630 ); // Taking someone else's treasure is a criminal offense!
return true;
}
m.SendLocalizedMessage( 1010631 ); // You did not discover this chest!
return false;
}
public override bool IsDecoContainer
{
get{ return false; }
}
public override bool CheckItemUse( Mobile from, Item item )
{
return CheckLoot( from, item != this ) && base.CheckItemUse( from, item );
}
public override bool CheckLift( Mobile from, Item item, ref LRReason reject )
{
return CheckLoot( from, true ) && base.CheckLift( from, item, ref reject );
}
public override void OnItemLifted( Mobile from, Item item )
{
bool notYetLifted = !m_Lifted.Contains( item );
from.RevealingAction();
if ( notYetLifted )
{
m_Lifted.Add( item );
if ( 0.1 >= Utility.RandomDouble() ) // 10% chance to spawn a new monster
TreasureMap.Spawn( m_Level, GetWorldLocation(), Map, from, false );
}
base.OnItemLifted( from, item );
}
public override bool CheckHold( Mobile m, Item item, bool message, bool checkItems, int plusItems, int plusWeight )
{
if ( m.AccessLevel < AccessLevel.GameMaster )
{
m.SendLocalizedMessage( 1048122, "", 0x8A5 ); // The chest refuses to be filled with treasure again.
return false;
}
return base.CheckHold( m, item, message, checkItems, plusItems, plusWeight );
}
public TreasureMapChest( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 2 ); // version
writer.Write( m_Guardians, true );
writer.Write( (bool) m_Temporary );
writer.Write( m_Owner );
writer.Write( (int) m_Level );
writer.WriteDeltaTime( m_DeleteTime );
writer.Write( m_Lifted, true );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
switch ( version )
{
case 2:
{
m_Guardians = reader.ReadStrongMobileList();
m_Temporary = reader.ReadBool();
goto case 1;
}
case 1:
{
m_Owner = reader.ReadMobile();
goto case 0;
}
case 0:
{
m_Level = reader.ReadInt();
m_DeleteTime = reader.ReadDeltaTime();
m_Lifted = reader.ReadStrongItemList();
if ( version < 2 )
m_Guardians = new List<Mobile>();
break;
}
}
if ( !m_Temporary )
{
m_Timer = new DeleteTimer( this, m_DeleteTime );
m_Timer.Start();
}
else
{
Delete();
}
}
public override void OnAfterDelete()
{
if ( m_Timer != null )
m_Timer.Stop();
m_Timer = null;
base.OnAfterDelete();
}
public override void GetContextMenuEntries( Mobile from, List<ContextMenuEntry> list )
{
base.GetContextMenuEntries( from, list );
if ( from.Alive )
list.Add( new RemoveEntry( from, this ) );
}
public void BeginRemove( Mobile from )
{
if ( !from.Alive )
return;
from.CloseGump( typeof( RemoveGump ) );
from.SendGump( new RemoveGump( from, this ) );
}
public void EndRemove( Mobile from )
{
if ( Deleted || from != m_Owner || !from.InRange( GetWorldLocation(), 3 ) )
return;
from.SendLocalizedMessage( 1048124, "", 0x8A5 ); // The old, rusted chest crumbles when you hit it.
this.Delete();
}
private class RemoveGump : Gump
{
private Mobile m_From;
private TreasureMapChest m_Chest;
public RemoveGump( Mobile from, TreasureMapChest chest ) : base( 15, 15 )
{
m_From = from;
m_Chest = chest;
Closable = false;
Disposable = false;
AddPage( 0 );
AddBackground( 30, 0, 240, 240, 2620 );
AddHtmlLocalized( 45, 15, 200, 80, 1048125, 0xFFFFFF, false, false ); // When this treasure chest is removed, any items still inside of it will be lost.
AddHtmlLocalized( 45, 95, 200, 60, 1048126, 0xFFFFFF, false, false ); // Are you certain you're ready to remove this chest?
AddButton( 40, 153, 4005, 4007, 1, GumpButtonType.Reply, 0 );
AddHtmlLocalized( 75, 155, 180, 40, 1048127, 0xFFFFFF, false, false ); // Remove the Treasure Chest
AddButton( 40, 195, 4005, 4007, 2, GumpButtonType.Reply, 0 );
AddHtmlLocalized( 75, 197, 180, 35, 1006045, 0xFFFFFF, false, false ); // Cancel
}
public override void OnResponse( NetState sender, RelayInfo info )
{
if ( info.ButtonID == 1 )
m_Chest.EndRemove( m_From );
}
}
private class RemoveEntry : ContextMenuEntry
{
private Mobile m_From;
private TreasureMapChest m_Chest;
public RemoveEntry( Mobile from, TreasureMapChest chest ) : base( 6149, 3 )
{
m_From = from;
m_Chest = chest;
Enabled = ( from == chest.Owner );
}
public override void OnClick()
{
if ( m_Chest.Deleted || m_From != m_Chest.Owner || !m_From.CheckAlive() )
return;
m_Chest.BeginRemove( m_From );
}
}
private class DeleteTimer : Timer
{
private Item m_Item;
public DeleteTimer( Item item, DateTime time ) : base( time - DateTime.Now )
{
m_Item = item;
Priority = TimerPriority.OneMinute;
}
protected override void OnTick()
{
m_Item.Delete();
}
}
}
}