RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

[RunUO 2.0 Svn][OSI] Veteran Rewards

MalGanis

Sorceror
[RunUO 2.0 Svn][OSI] Veteran Rewards

Veteran Rewards

The Ultima Online Rewards program is designed to reward our long-term players for loyalty to the UO community. It is our way of thanking you and showing our appreciation for your long-term support of UO, and for your contribution to making UO the most popular virtual world in existence today. Screenshots for most of the rewards can be found at the end of this guide.

Each month an account is active, credits are given which can be used to select rewards. In the beginning, there were only rewards for accounts up to 3 months old. This has been expanded all the way up to 10 month old accounts. Rewards may be traded and sold, but only accounts old enough can wear and use them. All Veteran Rewards are Blessed.

Features
  • Plain Dress
  • Mini House: Contest Winning House. This miniature house won a contest in 2003 for the best house design in UO. This works as a house add-on.
  • Mini House: Contest 2004 Winning House. This miniature house won a contest in 2004 for the best holiday house design. This works as a house add-on.
  • Commodity Deed Box
  • Banners
  • Flaming Skull
  • Minotaur Statue
  • Potted Cactus
  • Decorative Shields Wall Hanging
  • Decorative Ankh
  • Bloody Pentagram
  • Player Statue Maker
  • Brazier
  • Decorative Cannon
  • Tree Stumps
  • Weapon Engraving Tool
  • Rideable Polar Bear
  • Wall Banners
  • Ethereal Cu Sidhe Mount
  • Ankh of Sacrifice
  • The Mining Cart
  • Harrower Statuette
  • Efreet Statuette

You can find more info here:

Installation
  • Copy 'Veteran Rewards' folder somewhere in Scripts folder
  • Merge everything else in Distro folder with appropriate files in Scripts
  • Most changes are marked with #region Veteran Rewards

Version 1.08 - 5.16.2009
  • Fixed glitch that would allow player to duplicate player statues.


Downloads
 

PappaSmurf

Knight
Great Scripts, just it seems this has a few compatibility issues with the ML package that need to tweaked out. Hopefully one of the ML package releases will include this.
 

PappaSmurf

Knight
MalGanis;780900 said:
You mean character statues?

I've got the ML Package and the Heritage Tokens also, getting conflicts with BaseAddonContainerdeed.cs AddonContainerComponent.cs and BaseAddonContainer.cs. Something about them being already defined .....

Code:
Errors:
 + Customs/AddonContainerComponent.cs:
    CS0101: Line 9: The namespace 'Server.Items' already contains a definition f
or 'AddonContainerComponent'
    CS0101: Line 132: The namespace 'Server.Items' already contains a definition
 for 'LocalizedContainerComponent'
 + Customs/BaseAddonContainer.cs:
    CS0101: Line 11: The namespace 'Server.Items' already contains a definition
for 'BaseAddonContainer'
 + Customs/BaseAddonContainerDeed.cs:
    CS0101: Line 11: The namespace 'Server.Items' already contains a definition
for 'BaseAddonContainerDeed'
    CS0102: Line 104: The type 'Server.Items.BaseAddonContainerDeed' already con
tains a definition for 'InternalTarget'
 

MalGanis

Sorceror
Yeah those should be the same. You can keep the ml ones. I included them for those who dont have ML.
 

PappaSmurf

Knight
MalGanis;780902 said:
Yeah those should be the same. You can keep the ml ones. I included them for those who dont have ML.

Oh one more thing when you use the Brazier deed it doesn't delete...should just give a random brazier....
 

Erica

Knight
PappaSmurf;780904 said:
Oh one more thing when you use the Brazier deed it doesn't delete...should just give a random brazier....

Easy fix just add this on line 151 in red

Code:
[COLOR="Red"]else
    Delete();
[/COLOR]

Should look like this in red is the fix.

Code:
public override void OnDoubleClick( Mobile from )
		{
			if ( m_IsRewardItem && !RewardSystem.CheckIsUsableBy( from, this, null ) )
				return;
			
			if ( IsChildOf( from.Backpack ) )
			{
				RewardBrazier brazier = new RewardBrazier();
				brazier.IsRewardItem = m_IsRewardItem;

				if ( !from.PlaceInBackpack( brazier ) )
				{
					brazier.Delete();
					from.SendLocalizedMessage( 500722 ); // You don't have enough room in your backpack!
				}
                               [COLOR="Red"] else
                                    Delete();[/COLOR]
            
                        }
			else
				from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
		   }
 

PappaSmurf

Knight
System.NullReferenceException: Object reference not set to an instance of an object.
at Server.Engines.VeteranRewards.RewardSystem.CheckIsUsableBy(Mobile from, Item item, Object[] args)
at Server.Items.ContestMiniHouseDeed.OnDoubleClick(Mobile from)
at Server.Mobile.Use(Item item)
at Server.Engines.XmlSpawner2.XmlAttach.UseReq(NetState state, PacketReader pvSrc)
at Server.Network.MessagePump.HandleReceive(NetState ns)
at Server.Network.MessagePump.Slice()
at Server.Core.Main(String[] args)



Any idea on this one?
 

kat20

Sorceror
hey Im a big admirer of your work i have the full ml installation thanks to you and have been waiting for your next big release I have downloaded your vet reward system and installed however i am having these error's and i will check into yhis myself however i wondered if you knew what may be causing this, my thinking is that i dont need to install the distro files from your vet system because i already have them, however that theory is just that. Thanks for all your great work and any help is much appreciated Once again your work is great

also here is the error thank you

RunUO - [www.runuo.com] Version 2.0, Build 2949.24683
Core: Running on .NET Framework Version 2.0.50727
Scripts: Compiling C# scripts...failed (34 errors, 1 warnings)
Warnings:
+ Customs/ShardEvent.cs:
CS0114: Line 470: 'Server.Custom.ShardEvent.Location' hides inherited member
'Server.Item.Location'. To make the current member override that implementation
, add the override keyword. Otherwise add the new keyword.
CS0108: Line 472: 'Server.Custom.ShardEvent.Map' hides inherited member 'Ser
ver.Item.Map'. Use the new keyword if hiding was intended.
Errors:
+ Items/Resources/Arrows/Arrow.cs:
CS0535: Line 5: 'Server.Items.Arrow' does not implement interface member 'Se
rver.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Arrows/Bolt.cs:
CS0535: Line 5: 'Server.Items.Bolt' does not implement interface member 'Ser
ver.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Arrows/Feather.cs:
CS0535: Line 6: 'Server.Items.Feather' does not implement interface member '
Server.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Arrows/Shaft.cs:
CS0535: Line 6: 'Server.Items.Shaft' does not implement interface member 'Se
rver.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Blacksmithing/Ingots.cs:
CS0535: Line 7: 'Server.Items.BaseIngot' does not implement interface member
'Server.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Blacksmithing/Ore.cs:
CS0535: Line 9: 'Server.Items.BaseOre' does not implement interface member '
Server.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Blacksmithing/Scales.cs:
CS0535: Line 7: 'Server.Items.BaseScales' does not implement interface membe
r 'Server.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Masonry/Granite.cs:
CS0535: Line 7: 'Server.Items.BaseGranite' does not implement interface memb
er 'Server.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Reagents/BatWing.cs:
CS0535: Line 7: 'Server.Items.BatWing' does not implement interface member '
Server.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Reagents/BlackPearl.cs:
CS0535: Line 7: 'Server.Items.BlackPearl' does not implement interface membe
r 'Server.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Reagents/Bloodmoss.cs:
CS0535: Line 7: 'Server.Items.Bloodmoss' does not implement interface member
'Server.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Reagents/DaemonBlood.cs:
CS0535: Line 7: 'Server.Items.DaemonBlood' does not implement interface memb
er 'Server.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Reagents/DeadWood.cs:
CS0535: Line 7: 'Server.Items.DeadWood' does not implement interface member
'Server.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Reagents/Garlic.cs:
CS0535: Line 7: 'Server.Items.Garlic' does not implement interface member 'S
erver.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Reagents/Ginseng.cs:
CS0535: Line 7: 'Server.Items.Ginseng' does not implement interface member '
Server.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Reagents/GraveDust.cs:
CS0535: Line 7: 'Server.Items.GraveDust' does not implement interface member
'Server.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Reagents/MandrakeRoot.cs:
CS0535: Line 7: 'Server.Items.MandrakeRoot' does not implement interface mem
ber 'Server.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Reagents/Nightshade.cs:
CS0535: Line 7: 'Server.Items.Nightshade' does not implement interface membe
r 'Server.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Reagents/NoxCrystal.cs:
CS0535: Line 7: 'Server.Items.NoxCrystal' does not implement interface membe
r 'Server.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Reagents/PigIron.cs:
CS0535: Line 7: 'Server.Items.PigIron' does not implement interface member '
Server.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Reagents/SpidersSilk.cs:
CS0535: Line 7: 'Server.Items.SpidersSilk' does not implement interface memb
er 'Server.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Reagents/SulfurousAsh.cs:
CS0535: Line 7: 'Server.Items.SulfurousAsh' does not implement interface mem
ber 'Server.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Tailor/BoltOfCloth.cs:
CS0535: Line 8: 'Server.Items.BoltOfCloth' does not implement interface memb
er 'Server.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Tailor/Bone.cs:
CS0535: Line 6: 'Server.Items.Bone' does not implement interface member 'Ser
ver.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Tailor/Cloth.cs:
CS0535: Line 8: 'Server.Items.Cloth' does not implement interface member 'Se
rver.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Tailor/Hides.cs:
CS0535: Line 7: 'Server.Items.BaseHides' does not implement interface member
'Server.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Tailor/Leathers.cs:
CS0535: Line 7: 'Server.Items.BaseLeather' does not implement interface memb
er 'Server.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Tailor/UncutCloth.cs:
CS0535: Line 8: 'Server.Items.UncutCloth' does not implement interface membe
r 'Server.Items.ICommodity.DescriptionNumber'
+ Items/Skill Items/Carpenter Items/Board.cs:
CS0535: Line 6: 'Server.Items.BaseBoards' does not implement interface membe
r 'Server.Items.ICommodity.DescriptionNumber'
+ Items/Skill Items/Lumberjack/Log.cs:
CS0535: Line 6: 'Server.Items.BaseLog' does not implement interface member '
Server.Items.ICommodity.DescriptionNumber'
+ Items/Skill Items/Specialized/Sand.cs:
CS0535: Line 7: 'Server.Items.Sand' does not implement interface member 'Ser
ver.Items.ICommodity.DescriptionNumber'
+ Mondain's Legacy/Items/Armor/Juggernaut Set Armor/Evocaricus.cs:
CS0115: Line 11: 'Server.Items.Evocaricus.SetID': no suitable method found t
o override
CS0115: Line 12: 'Server.Items.Evocaricus.Pieces': no suitable method found
to override
+ Mondain's Legacy/Items/Armor/Marksman Set Armor/Swiftflight.cs:
CS0115: Line 11: 'Server.Items.Swiftflight.SetID': no suitable method found
to override
CS0115: Line 12: 'Server.Items.Swiftflight.Pieces': no suitable method found
to override
+ Mondain's Legacy/Items/Talismans/Items/Switch.cs:
CS0535: Line 5: 'Server.Items.Switch' does not implement interface member 'S
erver.Items.ICommodity.DescriptionNumber'
Scripts: One or more scripts failed to compile or no script files were found.
- Press return to exit, or R to try again.
 

ineedhelp

Sorceror
kat20;780919 said:
hey Im a big admirer of your work i have the full ml installation thanks to you and have been waiting for your next big release I have downloaded your vet reward system and installed however i am having these error's and i will check into yhis myself however i wondered if you knew what may be causing this, my thinking is that i dont need to install the distro files from your vet system because i already have them, however that theory is just that. Thanks for all your great work and any help is much appreciated Once again your work is great

also here is the error thank you

RunUO - [www.runuo.com] Version 2.0, Build 2949.24683
Core: Running on .NET Framework Version 2.0.50727
Scripts: Compiling C# scripts...failed (34 errors, 1 warnings)
Warnings:
+ Customs/ShardEvent.cs:
CS0114: Line 470: 'Server.Custom.ShardEvent.Location' hides inherited member
'Server.Item.Location'. To make the current member override that implementation
, add the override keyword. Otherwise add the new keyword.
CS0108: Line 472: 'Server.Custom.ShardEvent.Map' hides inherited member 'Ser
ver.Item.Map'. Use the new keyword if hiding was intended.
Errors:
+ Items/Resources/Arrows/Arrow.cs:
CS0535: Line 5: 'Server.Items.Arrow' does not implement interface member 'Se
rver.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Arrows/Bolt.cs:
CS0535: Line 5: 'Server.Items.Bolt' does not implement interface member 'Ser
ver.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Arrows/Feather.cs:
CS0535: Line 6: 'Server.Items.Feather' does not implement interface member '
Server.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Arrows/Shaft.cs:
CS0535: Line 6: 'Server.Items.Shaft' does not implement interface member 'Se
rver.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Blacksmithing/Ingots.cs:
CS0535: Line 7: 'Server.Items.BaseIngot' does not implement interface member
'Server.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Blacksmithing/Ore.cs:
CS0535: Line 9: 'Server.Items.BaseOre' does not implement interface member '
Server.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Blacksmithing/Scales.cs:
CS0535: Line 7: 'Server.Items.BaseScales' does not implement interface membe
r 'Server.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Masonry/Granite.cs:
CS0535: Line 7: 'Server.Items.BaseGranite' does not implement interface memb
er 'Server.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Reagents/BatWing.cs:
CS0535: Line 7: 'Server.Items.BatWing' does not implement interface member '
Server.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Reagents/BlackPearl.cs:
CS0535: Line 7: 'Server.Items.BlackPearl' does not implement interface membe
r 'Server.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Reagents/Bloodmoss.cs:
CS0535: Line 7: 'Server.Items.Bloodmoss' does not implement interface member
'Server.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Reagents/DaemonBlood.cs:
CS0535: Line 7: 'Server.Items.DaemonBlood' does not implement interface memb
er 'Server.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Reagents/DeadWood.cs:
CS0535: Line 7: 'Server.Items.DeadWood' does not implement interface member
'Server.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Reagents/Garlic.cs:
CS0535: Line 7: 'Server.Items.Garlic' does not implement interface member 'S
erver.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Reagents/Ginseng.cs:
CS0535: Line 7: 'Server.Items.Ginseng' does not implement interface member '
Server.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Reagents/GraveDust.cs:
CS0535: Line 7: 'Server.Items.GraveDust' does not implement interface member
'Server.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Reagents/MandrakeRoot.cs:
CS0535: Line 7: 'Server.Items.MandrakeRoot' does not implement interface mem
ber 'Server.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Reagents/Nightshade.cs:
CS0535: Line 7: 'Server.Items.Nightshade' does not implement interface membe
r 'Server.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Reagents/NoxCrystal.cs:
CS0535: Line 7: 'Server.Items.NoxCrystal' does not implement interface membe
r 'Server.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Reagents/PigIron.cs:
CS0535: Line 7: 'Server.Items.PigIron' does not implement interface member '
Server.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Reagents/SpidersSilk.cs:
CS0535: Line 7: 'Server.Items.SpidersSilk' does not implement interface memb
er 'Server.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Reagents/SulfurousAsh.cs:
CS0535: Line 7: 'Server.Items.SulfurousAsh' does not implement interface mem
ber 'Server.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Tailor/BoltOfCloth.cs:
CS0535: Line 8: 'Server.Items.BoltOfCloth' does not implement interface memb
er 'Server.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Tailor/Bone.cs:
CS0535: Line 6: 'Server.Items.Bone' does not implement interface member 'Ser
ver.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Tailor/Cloth.cs:
CS0535: Line 8: 'Server.Items.Cloth' does not implement interface member 'Se
rver.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Tailor/Hides.cs:
CS0535: Line 7: 'Server.Items.BaseHides' does not implement interface member
'Server.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Tailor/Leathers.cs:
CS0535: Line 7: 'Server.Items.BaseLeather' does not implement interface memb
er 'Server.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Tailor/UncutCloth.cs:
CS0535: Line 8: 'Server.Items.UncutCloth' does not implement interface membe
r 'Server.Items.ICommodity.DescriptionNumber'
+ Items/Skill Items/Carpenter Items/Board.cs:
CS0535: Line 6: 'Server.Items.BaseBoards' does not implement interface membe
r 'Server.Items.ICommodity.DescriptionNumber'
+ Items/Skill Items/Lumberjack/Log.cs:
CS0535: Line 6: 'Server.Items.BaseLog' does not implement interface member '
Server.Items.ICommodity.DescriptionNumber'
+ Items/Skill Items/Specialized/Sand.cs:
CS0535: Line 7: 'Server.Items.Sand' does not implement interface member 'Ser
ver.Items.ICommodity.DescriptionNumber'
+ Mondain's Legacy/Items/Armor/Juggernaut Set Armor/Evocaricus.cs:
CS0115: Line 11: 'Server.Items.Evocaricus.SetID': no suitable method found t
o override
CS0115: Line 12: 'Server.Items.Evocaricus.Pieces': no suitable method found
to override
+ Mondain's Legacy/Items/Armor/Marksman Set Armor/Swiftflight.cs:
CS0115: Line 11: 'Server.Items.Swiftflight.SetID': no suitable method found
to override
CS0115: Line 12: 'Server.Items.Swiftflight.Pieces': no suitable method found
to override
+ Mondain's Legacy/Items/Talismans/Items/Switch.cs:
CS0535: Line 5: 'Server.Items.Switch' does not implement interface member 'S
erver.Items.ICommodity.DescriptionNumber'
Scripts: One or more scripts failed to compile or no script files were found.
- Press return to exit, or R to try again.

when you merged your commoditydeed.cs you added the
int DescriptionNumber{ get; }

remove that line and should fix your problem
 

kat20

Sorceror
Thank you for the help I do beleive that removing that line did help however I am now getting this error:

RunUO - [www.runuo.com] Version 2.0, Build 2949.24683
Core: Running on .NET Framework Version 2.0.50727
Scripts: Compiling C# scripts...failed (2 errors, 1 warnings)
Warnings:
+ Customs/ShardEvent.cs:
CS0114: Line 470: 'Server.Custom.ShardEvent.Location' hides inherited member
'Server.Item.Location'. To make the current member override that implementation
, add the override keyword. Otherwise add the new keyword.
CS0108: Line 472: 'Server.Custom.ShardEvent.Map' hides inherited member 'Ser
ver.Item.Map'. Use the new keyword if hiding was intended.
Errors:
+ Mondain's Legacy/Items/Armor/Juggernaut Set Armor/Evocaricus.cs:
CS0115: Line 11: 'Server.Items.Evocaricus.SetID': no suitable method found t
o override
CS0115: Line 12: 'Server.Items.Evocaricus.Pieces': no suitable method found
to override
+ Mondain's Legacy/Items/Armor/Marksman Set Armor/Swiftflight.cs:
CS0115: Line 11: 'Server.Items.Swiftflight.SetID': no suitable method found
to override
CS0115: Line 12: 'Server.Items.Swiftflight.Pieces': no suitable method found
to override
Scripts: One or more scripts failed to compile or no script files were found.
- Press return to exit, or R to try again.


If you could once again point me in the right direction I would appreciate it. Thanks very much
 

MalGanis

Sorceror
@ PappaSmurf
No idea. Does it happen everytime u 2x click the deed?

@ kat20
Use WinMerge to add changes in BaseWeapon.cs from this script to yours. But just add changes marked with #region Veteran Rewards
 

PappaSmurf

Knight
MalGanis;780934 said:
@ PappaSmurf
No idea. Does it happen everytime u 2x click the deed?

@ kat20
Use WinMerge to add changes in BaseWeapon.cs from this script to yours. But just add changes marked with #region Veteran Rewards

Got the deed issue fixed, but...I'm using pretty much the ML Heritage token and the vet reward package, I've gotten something wrong in my merging of baseweapon.cs and just can't figure it out....I'll post the code below maybe you can point out my error in the serialization so I quit getting all these stupid errors on restart.....

Code:
using System;
using System.Text;
using System.Collections;
using Server.Network;
using Server.Targeting;
using Server.Mobiles;
using Server.Spells;
using Server.Spells.Necromancy;
using Server.Spells.Bushido;
using Server.Spells.Ninjitsu;
using Server.Factions;
using Server.Engines.Craft;
using System.Collections.Generic;
using Server.Spells.Spellweaving;

namespace Server.Items
{
    public interface ISlayer
    {
        SlayerName Slayer { get; set; }
        SlayerName Slayer2 { get; set; }
    }

    public abstract class BaseWeapon : Item, IWeapon, IFactionItem, ICraftable, ISlayer, IDurability, ISetItem
    {
        #region Veteran Rewards
        private string m_EngravedText;
        
        [CommandProperty( AccessLevel.GameMaster )]
        public string EngravedText
        {
            get{ return m_EngravedText; }
            set{ m_EngravedText = value; InvalidateProperties(); }
        }        
        #endregion
    
        #region Factions
        private FactionItem m_FactionState;

        public FactionItem FactionItemState
        {
            get{ return m_FactionState; }
            set
            {
                m_FactionState = value;

                if ( m_FactionState == null )
                    Hue = CraftResources.GetHue( Resource );

                LootType = ( m_FactionState == null ? LootType.Regular : LootType.Blessed );
            }
        }
        #endregion

        /* Weapon internals work differently now (Mar 13 2003)
         * 
         * The attributes defined below default to -1.
         * If the value is -1, the corresponding virtual 'Aos/Old' property is used.
         * If not, the attribute value itself is used. Here's the list:
         *  - MinDamage
         *  - MaxDamage
         *  - Speed
         *  - HitSound
         *  - MissSound
         *  - StrRequirement, DexRequirement, IntRequirement
         *  - WeaponType
         *  - WeaponAnimation
         *  - MaxRange
         */

        #region Var declarations

        // Instance values. These values are unique to each weapon.
        private WeaponDamageLevel m_DamageLevel;
        private WeaponAccuracyLevel m_AccuracyLevel;
        private WeaponDurabilityLevel m_DurabilityLevel;
        private WeaponQuality m_Quality;
        private Mobile m_Crafter;
        private Poison m_Poison;
        private int m_PoisonCharges;
        private bool m_Identified;
        private int m_Hits;
        private int m_MaxHits;
        private SlayerName m_Slayer;
        private SlayerName m_Slayer2;
        private SkillMod m_SkillMod, m_MageMod;
        private CraftResource m_Resource;
        private bool m_PlayerConstructed;

        private bool m_Cursed; // Is this weapon cursed via Curse Weapon necromancer spell? Temporary; not serialized.
        private bool m_Consecrated; // Is this weapon blessed via Consecrate Weapon paladin ability? Temporary; not serialized.

        private AosAttributes m_AosAttributes;
        private AosWeaponAttributes m_AosWeaponAttributes;
        private AosSkillBonuses m_AosSkillBonuses;
        private AosElementAttributes m_AosElementDamages;

        // Overridable values. These values are provided to override the defaults which get defined in the individual weapon scripts.
        private int m_StrReq, m_DexReq, m_IntReq;
        private int m_MinDamage, m_MaxDamage;
        private int m_HitSound, m_MissSound;
        private int m_Speed;
        private int m_MaxRange;
        private SkillName m_Skill;
        private WeaponType m_Type;
        private WeaponAnimation m_Animation;
        #endregion

        #region Virtual Properties
        public virtual WeaponAbility PrimaryAbility{ get{ return null; } }
        public virtual WeaponAbility SecondaryAbility{ get{ return null; } }

        public virtual int DefMaxRange{ get{ return 1; } }
        public virtual int DefHitSound{ get{ return 0; } }
        public virtual int DefMissSound{ get{ return 0; } }
        public virtual SkillName DefSkill{ get{ return SkillName.Swords; } }
        public virtual WeaponType DefType{ get{ return WeaponType.Slashing; } }
        public virtual WeaponAnimation DefAnimation{ get{ return WeaponAnimation.Slash1H; } }

        public virtual int AosStrengthReq{ get{ return 0; } }
        public virtual int AosDexterityReq{ get{ return 0; } }
        public virtual int AosIntelligenceReq{ get{ return 0; } }
        public virtual int AosMinDamage{ get{ return 0; } }
        public virtual int AosMaxDamage{ get{ return 0; } }
        public virtual int AosSpeed{ get{ return 0; } }
        public virtual int AosMaxRange{ get{ return DefMaxRange; } }
        public virtual int AosHitSound{ get{ return DefHitSound; } }
        public virtual int AosMissSound{ get{ return DefMissSound; } }
        public virtual SkillName AosSkill{ get{ return DefSkill; } }
        public virtual WeaponType AosType{ get{ return DefType; } }
        public virtual WeaponAnimation AosAnimation{ get{ return DefAnimation; } }

        public virtual int OldStrengthReq{ get{ return 0; } }
        public virtual int OldDexterityReq{ get{ return 0; } }
        public virtual int OldIntelligenceReq{ get{ return 0; } }
        public virtual int OldMinDamage{ get{ return 0; } }
        public virtual int OldMaxDamage{ get{ return 0; } }
        public virtual int OldSpeed{ get{ return 0; } }
        public virtual int OldMaxRange{ get{ return DefMaxRange; } }
        public virtual int OldHitSound{ get{ return DefHitSound; } }
        public virtual int OldMissSound{ get{ return DefMissSound; } }
        public virtual SkillName OldSkill{ get{ return DefSkill; } }
        public virtual WeaponType OldType{ get{ return DefType; } }
        public virtual WeaponAnimation OldAnimation{ get{ return DefAnimation; } }

        public virtual int InitMinHits{ get{ return 0; } }
        public virtual int InitMaxHits{ get{ return 0; } }

        // Mondain's Legacy Mod
        public override int PhysicalResistance{ get{ return m_AosWeaponAttributes.ResistPhysicalBonus + ( IsSetItem && m_SetEquipped ? m_SetWeaponAttributes.ResistPhysicalBonus : 0 ); } }
        public override int FireResistance{ get{ return m_AosWeaponAttributes.ResistFireBonus + ( IsSetItem && m_SetEquipped ? m_SetWeaponAttributes.ResistFireBonus : 0 ); } }
        public override int ColdResistance{ get{ return m_AosWeaponAttributes.ResistColdBonus + ( IsSetItem && m_SetEquipped ? m_SetWeaponAttributes.ResistColdBonus : 0 ); } }
        public override int PoisonResistance{ get{ return m_AosWeaponAttributes.ResistPoisonBonus + ( IsSetItem && m_SetEquipped ? m_SetWeaponAttributes.ResistPoisonBonus : 0 ); } }
        public override int EnergyResistance{ get{ return m_AosWeaponAttributes.ResistEnergyBonus + ( IsSetItem && m_SetEquipped ? m_SetWeaponAttributes.ResistEnergyBonus : 0 ); } }

        public virtual SkillName AccuracySkill { get { return SkillName.Tactics; } }
        #endregion

        #region Getters & Setters
        [CommandProperty( AccessLevel.GameMaster )]
        public AosAttributes Attributes
        {
            get{ return m_AosAttributes; }
            set{}
        }

        [CommandProperty( AccessLevel.GameMaster )]
        public AosWeaponAttributes WeaponAttributes
        {
            get{ return m_AosWeaponAttributes; }
            set{}
        }

        [CommandProperty( AccessLevel.GameMaster )]
        public AosSkillBonuses SkillBonuses
        {
            get{ return m_AosSkillBonuses; }
            set{}
        }

        [CommandProperty( AccessLevel.GameMaster )]
        public AosElementAttributes AosElementDamages
        {
            get { return m_AosElementDamages; }
            set { }
        }

        [CommandProperty( AccessLevel.GameMaster )]
        public bool Cursed
        {
            get{ return m_Cursed; }
            set{ m_Cursed = value; }
        }

        [CommandProperty( AccessLevel.GameMaster )]
        public bool Consecrated
        {
            get{ return m_Consecrated; }
            set{ m_Consecrated = value; }
        }

        [CommandProperty( AccessLevel.GameMaster )]
        public bool Identified
        {
            get{ return m_Identified; }
            set{ m_Identified = value; InvalidateProperties(); }
        }

        [CommandProperty( AccessLevel.GameMaster )]
        public int HitPoints
        {
            get{ return m_Hits; }
            set
            {
                if ( m_Hits == value )
                    return;

                if ( value > m_MaxHits )
                    value = m_MaxHits;

                m_Hits = value;

                InvalidateProperties();
            }
        }

        [CommandProperty( AccessLevel.GameMaster )]
        public int MaxHitPoints
        {
            get{ return m_MaxHits; }
            set{ m_MaxHits = value; InvalidateProperties(); }
        }

        [CommandProperty( AccessLevel.GameMaster )]
        public int PoisonCharges
        {
            get{ return m_PoisonCharges; }
            set{ m_PoisonCharges = value; InvalidateProperties(); }
        }

        [CommandProperty( AccessLevel.GameMaster )]
        public Poison Poison
        {
            get{ return m_Poison; }
            set{ m_Poison = value; InvalidateProperties(); }
        }

        [CommandProperty( AccessLevel.GameMaster )]
        public WeaponQuality Quality
        {
            get{ return m_Quality; }
            set{ UnscaleDurability(); m_Quality = value; ScaleDurability(); InvalidateProperties(); }
        }

        [CommandProperty( AccessLevel.GameMaster )]
        public Mobile Crafter
        {
            get{ return m_Crafter; }
            set{ m_Crafter = value; InvalidateProperties(); }
        }

        [CommandProperty( AccessLevel.GameMaster )]
        public SlayerName Slayer
        {
            get{ return m_Slayer; }
            set{ m_Slayer = value; InvalidateProperties(); }
        }

        [CommandProperty( AccessLevel.GameMaster )]
        public SlayerName Slayer2
        {
            get { return m_Slayer2; }
            set { m_Slayer2 = value; InvalidateProperties(); }
        }

        [CommandProperty( AccessLevel.GameMaster )]
        public CraftResource Resource
        {
            get{ return m_Resource; }
            set{ UnscaleDurability(); m_Resource = value; Hue = CraftResources.GetHue( m_Resource ); InvalidateProperties(); ScaleDurability(); }
        }

        [CommandProperty( AccessLevel.GameMaster )]
        public WeaponDamageLevel DamageLevel
        {
            get{ return m_DamageLevel; }
            set{ m_DamageLevel = value; InvalidateProperties(); }
        }

        [CommandProperty( AccessLevel.GameMaster )]
        public WeaponDurabilityLevel DurabilityLevel
        {
            get{ return m_DurabilityLevel; }
            set{ UnscaleDurability(); m_DurabilityLevel = value; InvalidateProperties(); ScaleDurability(); }
        }

        [CommandProperty( AccessLevel.GameMaster )]
        public bool PlayerConstructed
        {
            get{ return m_PlayerConstructed; }
            set{ m_PlayerConstructed = value; }
        }

        [CommandProperty( AccessLevel.GameMaster )]
        public int MaxRange
        {
            get{ return ( m_MaxRange == -1 ? Core.AOS ? AosMaxRange : OldMaxRange : m_MaxRange ); }
            set{ m_MaxRange = value; InvalidateProperties(); }
        }

        [CommandProperty( AccessLevel.GameMaster )]
        public WeaponAnimation Animation
        {
            get{ return ( m_Animation == (WeaponAnimation)(-1) ? Core.AOS ? AosAnimation : OldAnimation : m_Animation ); } 
            set{ m_Animation = value; }
        }

        [CommandProperty( AccessLevel.GameMaster )]
        public WeaponType Type
        {
            get{ return ( m_Type == (WeaponType)(-1) ? Core.AOS ? AosType : OldType : m_Type ); }
            set{ m_Type = value; }
        }

        [CommandProperty( AccessLevel.GameMaster )]
        public SkillName Skill
        {
            get{ return ( m_Skill == (SkillName)(-1) ? Core.AOS ? AosSkill : OldSkill : m_Skill ); }
            set{ m_Skill = value; InvalidateProperties(); }
        }

        [CommandProperty( AccessLevel.GameMaster )]
        public int HitSound
        {
            get{ return ( m_HitSound == -1 ? Core.AOS ? AosHitSound : OldHitSound : m_HitSound ); }
            set{ m_HitSound = value; }
        }

        [CommandProperty( AccessLevel.GameMaster )]
        public int MissSound
        {
            get{ return ( m_MissSound == -1 ? Core.AOS ? AosMissSound : OldMissSound : m_MissSound ); }
            set{ m_MissSound = value; }
        }

        [CommandProperty( AccessLevel.GameMaster )]
        public int MinDamage
        {
            get{ return ( m_MinDamage == -1 ? Core.AOS ? AosMinDamage : OldMinDamage : m_MinDamage ); }
            set{ m_MinDamage = value; InvalidateProperties(); }
        }

        [CommandProperty( AccessLevel.GameMaster )]
        public int MaxDamage
        {
            get{ return ( m_MaxDamage == -1 ? Core.AOS ? AosMaxDamage : OldMaxDamage : m_MaxDamage ); }
            set{ m_MaxDamage = value; InvalidateProperties(); }
        }

        [CommandProperty( AccessLevel.GameMaster )]
        public int Speed
        {
            get{ return ( m_Speed == -1 ? Core.AOS ? AosSpeed : OldSpeed : m_Speed ); }
            set{ m_Speed = value; InvalidateProperties(); }
        }

        [CommandProperty( AccessLevel.GameMaster )]
        public int StrRequirement
        {
            get{ return ( m_StrReq == -1 ? Core.AOS ? AosStrengthReq : OldStrengthReq : m_StrReq ); }
            set{ m_StrReq = value; InvalidateProperties(); }
        }

        [CommandProperty( AccessLevel.GameMaster )]
        public int DexRequirement
        {
            get{ return ( m_DexReq == -1 ? Core.AOS ? AosDexterityReq : OldDexterityReq : m_DexReq ); }
            set{ m_DexReq = value; }
        }

        [CommandProperty( AccessLevel.GameMaster )]
        public int IntRequirement
        {
            get{ return ( m_IntReq == -1 ? Core.AOS ? AosIntelligenceReq : OldIntelligenceReq : m_IntReq ); }
            set{ m_IntReq = value; }
        }

        [CommandProperty( AccessLevel.GameMaster )]
        public WeaponAccuracyLevel AccuracyLevel
        {
            get
            {
                return m_AccuracyLevel;
            }
            set
            {
                if ( m_AccuracyLevel != value )
                {
                    m_AccuracyLevel = value;

                    if ( UseSkillMod )
                    {
                        if ( m_AccuracyLevel == WeaponAccuracyLevel.Regular )
                        {
                            if ( m_SkillMod != null )
                                m_SkillMod.Remove();

                            m_SkillMod = null;
                        }
                        else if ( m_SkillMod == null && Parent is Mobile )
                        {
                            m_SkillMod = new DefaultSkillMod( AccuracySkill, true, (int)m_AccuracyLevel * 5 );
                            ((Mobile)Parent).AddSkillMod( m_SkillMod );
                        }
                        else if ( m_SkillMod != null )
                        {
                            m_SkillMod.Value = (int)m_AccuracyLevel * 5;
                        }
                    }

                    InvalidateProperties();
                }
            }
        }

        #endregion

        public virtual void UnscaleDurability()
        {
            int scale = 100 + GetDurabilityBonus();

            m_Hits = ((m_Hits * 100) + (scale - 1)) / scale;
            m_MaxHits = ((m_MaxHits * 100) + (scale - 1)) / scale;
            InvalidateProperties();
        }

        public virtual void ScaleDurability()
        {
            int scale = 100 + GetDurabilityBonus();

            m_Hits = ((m_Hits * scale) + 99) / 100;
            m_MaxHits = ((m_MaxHits * scale) + 99) / 100;
            InvalidateProperties();
        }

        public int GetDurabilityBonus()
        {
            int bonus = 0;

            if ( m_Quality == WeaponQuality.Exceptional )
                bonus += 20;

            switch ( m_DurabilityLevel )
            {
                case WeaponDurabilityLevel.Durable: bonus += 20; break;
                case WeaponDurabilityLevel.Substantial: bonus += 50; break;
                case WeaponDurabilityLevel.Massive: bonus += 70; break;
                case WeaponDurabilityLevel.Fortified: bonus += 100; break;
                case WeaponDurabilityLevel.Indestructible: bonus += 120; break;
            }

            if ( Core.AOS )
            {
                bonus += m_AosWeaponAttributes.DurabilityBonus;

                #region Mondain's Legacy                                    
                if ( m_Resource == CraftResource.Heartwood )
                    return bonus;
                #endregion

                CraftResourceInfo resInfo = CraftResources.GetInfo( m_Resource );
                CraftAttributeInfo attrInfo = null;

                if ( resInfo != null )
                    attrInfo = resInfo.AttributeInfo;

                if ( attrInfo != null )
                    bonus += attrInfo.WeaponDurability;
            }

            return bonus;
        }

        public int GetLowerStatReq()
        {
            if ( !Core.AOS )
                return 0;

            int v = m_AosWeaponAttributes.LowerStatReq;

            #region Mondain's Legacy                        
            if ( m_Resource == CraftResource.Heartwood )
                return v;
            #endregion

            CraftResourceInfo info = CraftResources.GetInfo( m_Resource );

            if ( info != null )
            {
                CraftAttributeInfo attrInfo = info.AttributeInfo;

                if ( attrInfo != null )
                    v += attrInfo.WeaponLowerRequirements;
            }

            if ( v > 100 )
                v = 100;

            return v;
        }

        public static void BlockEquip( Mobile m, TimeSpan duration )
        {
            if ( m.BeginAction( typeof( BaseWeapon ) ) )
                new ResetEquipTimer( m, duration ).Start();
        }

        private class ResetEquipTimer : Timer
        {
            private Mobile m_Mobile;

            public ResetEquipTimer( Mobile m, TimeSpan duration ) : base( duration )
            {
                m_Mobile = m;
            }

            protected override void OnTick()
            {
                m_Mobile.EndAction( typeof( BaseWeapon ) );
            }
        }

        public override bool CheckConflictingLayer( Mobile m, Item item, Layer layer )
        {
            if ( base.CheckConflictingLayer( m, item, layer ) )
                return true;

            if ( this.Layer == Layer.TwoHanded && layer == Layer.OneHanded )
            {
                m.SendLocalizedMessage( 500214 ); // You already have something in both hands.
                return true;
            }
            else if ( this.Layer == Layer.OneHanded && layer == Layer.TwoHanded && !(item is BaseShield) && !(item is BaseEquipableLight) )
            {
                m.SendLocalizedMessage( 500215 ); // You can only wield one weapon at a time.
                return true;
            }

            return false;
        }

        public override bool AllowSecureTrade( Mobile from, Mobile to, Mobile newOwner, bool accepted )
        {
            if ( !Ethics.Ethic.CheckTrade( from, to, newOwner, this ) )
                return false;

            return base.AllowSecureTrade( from, to, newOwner, accepted );
        }

        public virtual Race RequiredRace { get { return null; } }    //On OSI, there are no weapons with race requirements, this is for custom stuff

        public override bool CanEquip( Mobile from )
        {
            if ( !Ethics.Ethic.CheckEquip( from, this ) )
                return false;

            if( RequiredRace != null && from.Race != RequiredRace )
            {
                if( RequiredRace == Race.Elf )
                    from.SendLocalizedMessage( 1072203 ); // Only Elves may use this.
                else
                    from.SendMessage( "Only {0} may use this.", RequiredRace.PluralName );

                return false;
            }
            else if ( from.Dex < DexRequirement )
            {
                from.SendMessage( "You are not nimble enough to equip that." );
                return false;
            } 
            else if ( from.Str < AOS.Scale( StrRequirement, 100 - GetLowerStatReq() ) )
            {
                from.SendLocalizedMessage( 500213 ); // You are not strong enough to equip that.
                return false;
            }
            else if ( from.Int < IntRequirement )
            {
                from.SendMessage( "You are not smart enough to equip that." );
                return false;
            }
            else if ( !from.CanBeginAction( typeof( BaseWeapon ) ) )
            {
                return false;
            }
            else
            {
                return base.CanEquip( from );
            }
        }

        public virtual bool UseSkillMod{ get{ return !Core.AOS; } }

        public override bool OnEquip( Mobile from )
        {
            int strBonus = m_AosAttributes.BonusStr;
            int dexBonus = m_AosAttributes.BonusDex;
            int intBonus = m_AosAttributes.BonusInt;

            if ( (strBonus != 0 || dexBonus != 0 || intBonus != 0) )
            {
                Mobile m = from;

                string modName = this.Serial.ToString();

                if ( strBonus != 0 )
                    m.AddStatMod( new StatMod( StatType.Str, modName + "Str", strBonus, TimeSpan.Zero ) );

                if ( dexBonus != 0 )
                    m.AddStatMod( new StatMod( StatType.Dex, modName + "Dex", dexBonus, TimeSpan.Zero ) );

                if ( intBonus != 0 )
                    m.AddStatMod( new StatMod( StatType.Int, modName + "Int", intBonus, TimeSpan.Zero ) );
            }

            from.NextCombatTime = DateTime.Now + GetDelay( from );

            if ( UseSkillMod && m_AccuracyLevel != WeaponAccuracyLevel.Regular )
            {
                if ( m_SkillMod != null )
                    m_SkillMod.Remove();

                m_SkillMod = new DefaultSkillMod( AccuracySkill, true, (int)m_AccuracyLevel * 5 );
                from.AddSkillMod( m_SkillMod );
            }

            if ( Core.AOS && m_AosWeaponAttributes.MageWeapon != 0 && m_AosWeaponAttributes.MageWeapon != 30 )
            {
                if ( m_MageMod != null )
                    m_MageMod.Remove();

                m_MageMod = new DefaultSkillMod( SkillName.Magery, true, -30 + m_AosWeaponAttributes.MageWeapon );
                from.AddSkillMod( m_MageMod );
            }

            return true;
        }

        public override void OnAdded( object parent )
        {
            base.OnAdded( parent );

            if ( parent is Mobile )
            {
                Mobile from = (Mobile)parent;

                if ( Core.AOS )
                    m_AosSkillBonuses.AddTo( from );

                #region Mondain's Legacy                        
                if ( IsSetItem )
                    m_SetEquipped = SetHelper.FullSetPresent( from, SetID, Pieces );
                
                if ( m_SetEquipped )
                {
                    m_LastEquipped = true;                
                    
                    SetHelper.AddSetBonus( from, SetID );
                }
                #endregion

                from.CheckStatTimers();
                from.Delta( MobileDelta.WeaponDamage );
            }
        }

        public override void OnRemoved( object parent )
        {
            if ( parent is Mobile )
            {
                Mobile m = (Mobile)parent;
                BaseWeapon weapon = m.Weapon as BaseWeapon;

                string modName = this.Serial.ToString();

                m.RemoveStatMod( modName + "Str" );
                m.RemoveStatMod( modName + "Dex" );
                m.RemoveStatMod( modName + "Int" );

                if ( weapon != null )
                    m.NextCombatTime = DateTime.Now + weapon.GetDelay( m );

                if ( UseSkillMod && m_SkillMod != null )
                {
                    m_SkillMod.Remove();
                    m_SkillMod = null;
                }

                if ( m_MageMod != null )
                {
                    m_MageMod.Remove();
                    m_MageMod = null;
                }

                if ( Core.AOS )
                    m_AosSkillBonuses.Remove();

                m.CheckStatTimers();

                m.Delta( MobileDelta.WeaponDamage );
                
                if ( IsSetItem ? m_SetEquipped : false )
                    SetHelper.RemoveSetBonus( m, SetID, this );
            }
            
            InvalidateProperties();
        }

        public virtual SkillName GetUsedSkill( Mobile m, bool checkSkillAttrs )
        {
            SkillName sk;

            // Mondain's Legacy Mod
            if ( checkSkillAttrs && m_AosWeaponAttributes.UseBestSkill + ( IsSetItem && m_SetEquipped ? m_SetWeaponAttributes.UseBestSkill : 0 ) != 0 )
            {
                double swrd = m.Skills[SkillName.Swords].Value;
                double fenc = m.Skills[SkillName.Fencing].Value;
                double mcng = m.Skills[SkillName.Macing].Value;
                double val;

                sk = SkillName.Swords;
                val = swrd;

                if ( fenc > val ){ sk = SkillName.Fencing; val = fenc; }
                if ( mcng > val ){ sk = SkillName.Macing; val = mcng; }
            }
            // Mondain's Legacy Mod
            else if ( m_AosWeaponAttributes.MageWeapon + ( IsSetItem && m_SetEquipped ? m_SetWeaponAttributes.MageWeapon : 0 ) != 0 )
            {
                if ( m.Skills[SkillName.Magery].Value > m.Skills[Skill].Value )
                    sk = SkillName.Magery;
                else
                    sk = Skill;
            }
            else
            {
                sk = Skill;

                if ( sk != SkillName.Wrestling && !m.Player && !m.Body.IsHuman && m.Skills[SkillName.Wrestling].Value > m.Skills[sk].Value )
                    sk = SkillName.Wrestling;
            }

            return sk;
        }

        public virtual double GetAttackSkillValue( Mobile attacker, Mobile defender )
        {
            return attacker.Skills[GetUsedSkill( attacker, true )].Value;
        }

        public virtual double GetDefendSkillValue( Mobile attacker, Mobile defender )
        {
            return defender.Skills[GetUsedSkill( defender, true )].Value;
        }

        private static bool CheckAnimal( Mobile m, Type type )
        {
            return AnimalForm.UnderTransformation( m, type );
        }

        public virtual bool CheckHit( Mobile attacker, Mobile defender )
        {
            BaseWeapon atkWeapon = attacker.Weapon as BaseWeapon;
            BaseWeapon defWeapon = defender.Weapon as BaseWeapon;

            Skill atkSkill = attacker.Skills[atkWeapon.Skill];
            Skill defSkill = defender.Skills[defWeapon.Skill];

            double atkValue = atkWeapon.GetAttackSkillValue( attacker, defender );
            double defValue = defWeapon.GetDefendSkillValue( attacker, defender );

            //attacker.CheckSkill( atkSkill.SkillName, defValue - 20.0, 120.0 );
            //defender.CheckSkill( defSkill.SkillName, atkValue - 20.0, 120.0 );

            double ourValue, theirValue;

            int bonus = GetHitChanceBonus();

            if ( Core.AOS )
            {
                if ( atkValue <= -20.0 )
                    atkValue = -19.9;

                if ( defValue <= -20.0 )
                    defValue = -19.9;

                // Hit Chance Increase = 45%
                int atkChance = AosAttributes.GetValue( attacker, AosAttribute.AttackChance );
                if ( atkChance > 45 )
                    atkChance = 45;

                bonus += atkChance;

                if ( Spells.Chivalry.DivineFurySpell.UnderEffect( attacker ) )
                    bonus += 10; // attacker gets 10% bonus when they're under divine fury

                if ( CheckAnimal( attacker, typeof( GreyWolf ) ) || CheckAnimal( attacker, typeof( BakeKitsune ) ) )
                    bonus += 20; // attacker gets 20% bonus when under Wolf or Bake Kitsune form

                if ( HitLower.IsUnderAttackEffect( attacker ) )
                    bonus -= 25; // Under Hit Lower Attack effect -> 25% malus

                ourValue = (atkValue + 20.0) * (100 + bonus);

                // Defense Chance Increase = 45%
                bonus = AosAttributes.GetValue( defender, AosAttribute.DefendChance );
                if ( bonus > 45 )
                    bonus = 45;

                if ( Spells.Chivalry.DivineFurySpell.UnderEffect( defender ) )
                    bonus -= 20; // defender loses 20% bonus when they're under divine fury

                if ( HitLower.IsUnderDefenseEffect( defender ) )
                    bonus -= 25; // Under Hit Lower Defense effect -> 25% malus
                    
                int blockBonus = 0;

                if ( Block.GetBonus( defender, ref blockBonus ) )
                    bonus += blockBonus;

                int surpriseMalus = 0;

                if ( SurpriseAttack.GetMalus( defender, ref surpriseMalus ) )
                    bonus -= surpriseMalus;

                int discordanceEffect = 0;

                // Defender loses -0/-28% if under the effect of Discordance.
                if ( SkillHandlers.Discordance.GetEffect( attacker, ref discordanceEffect ) )
                    bonus -= discordanceEffect;

                theirValue = (defValue + 20.0) * (100 + bonus);

                bonus = 0;
            }
            else
            {
                if ( atkValue <= -50.0 )
                    atkValue = -49.9;

                if ( defValue <= -50.0 )
                    defValue = -49.9;

                ourValue = (atkValue + 50.0);
                theirValue = (defValue + 50.0);
            }

            double chance = ourValue / (theirValue * 2.0);

            chance *= 1.0 + ((double)bonus / 100);

            if ( Core.AOS && chance < 0.02 )
                chance = 0.02;

            WeaponAbility ability = WeaponAbility.GetCurrentAbility( attacker );

            if ( ability != null )
                chance *= ability.AccuracyScalar;

            SpecialMove move = SpecialMove.GetCurrentMove( attacker );

            if ( move != null )
                chance *= move.GetAccuracyScalar( attacker );

            return attacker.CheckSkill( atkSkill.SkillName, chance );

            //return ( chance >= Utility.RandomDouble() );
        }

        public virtual TimeSpan GetDelay( Mobile m )
        {
            int speed = this.Speed;

            if ( speed == 0 )
                return TimeSpan.FromHours( 1.0 );

            double delayInSeconds;

            if ( Core.SE )
            {
                /*
                 * This is likely true for Core.AOS as well... both guides report the same
                 * formula, and both are wrong.
                 * The old formula left in for AOS for legacy & because we aren't quite 100%
                 * Sure that AOS has THIS formula
                 */
                int bonus = AosAttributes.GetValue( m, AosAttribute.WeaponSpeed );

                if ( Spells.Chivalry.DivineFurySpell.UnderEffect( m ) )
                    bonus += 10;

                // Bonus granted by successful use of Honorable Execution.
                bonus += HonorableExecution.GetSwingBonus( m );

                if( DualWield.Registry.Contains( m ) )
                    bonus += ((DualWield.DualWieldTimer)DualWield.Registry[m]).BonusSwingSpeed;

                if( Feint.Registry.Contains( m ) )
                    bonus -= ((Feint.FeintTimer)Feint.Registry[m]).SwingSpeedReduction;

                TransformContext context = TransformationSpellHelper.GetContext( m );

                if( context != null && context.Spell is ReaperFormSpell )
                    bonus += ((ReaperFormSpell)context.Spell).SwingSpeedBonus;

                int discordanceEffect = 0;

                // Discordance gives a malus of -0/-28% to swing speed.
                if ( SkillHandlers.Discordance.GetEffect( m, ref discordanceEffect ) )
                    bonus -= discordanceEffect;

                if( EssenceOfWindSpell.IsDebuffed( m ) )
                    bonus -= EssenceOfWindSpell.GetSSIMalus( m );

                if ( bonus > 60 )
                    bonus = 60;

                speed = (int)Math.Floor( speed * (bonus + 100.0) / 100.0 );

                if ( speed <= 0 )
                    speed = 1;

                int ticks = (int)Math.Floor( (80000.0 / ((m.Stam + 100) * speed)) - 2 );

                // Swing speed currently capped at one swing every 1.25 seconds (5 ticks).
                if ( ticks < 5 )
                    ticks = 5;

                delayInSeconds = ticks * 0.25;
            }
            else if ( Core.AOS )
            {
                int v = (m.Stam + 100) * speed;

                int bonus = AosAttributes.GetValue( m, AosAttribute.WeaponSpeed );

                if ( Spells.Chivalry.DivineFurySpell.UnderEffect( m ) )
                    bonus += 10;

                int discordanceEffect = 0;

                // Discordance gives a malus of -0/-28% to swing speed.
                if ( SkillHandlers.Discordance.GetEffect( m, ref discordanceEffect ) )
                    bonus -= discordanceEffect;

                v += AOS.Scale( v, bonus );

                if ( v <= 0 )
                    v = 1;

                delayInSeconds = Math.Floor( 40000.0 / v ) * 0.5;

                // Maximum swing rate capped at one swing per second 
                // OSI dev said that it has and is supposed to be 1.25
                if ( delayInSeconds < 1.25 )
                    delayInSeconds = 1.25;
            }
            else
            {
                int v = (m.Stam + 100) * speed;

                if ( v <= 0 )
                    v = 1;

                delayInSeconds = 15000.0 / v;
            }

            return TimeSpan.FromSeconds( delayInSeconds );
        }

        public virtual void OnBeforeSwing( Mobile attacker, Mobile defender )
        {
            WeaponAbility a = WeaponAbility.GetCurrentAbility( attacker );

            if( a != null && !a.OnBeforeSwing( attacker, defender ) )
                WeaponAbility.ClearCurrentAbility( attacker );

            SpecialMove move = SpecialMove.GetCurrentMove( attacker );

            if( move != null && !move.OnBeforeSwing( attacker, defender ) )
                SpecialMove.ClearCurrentMove( attacker );
        }

        public virtual TimeSpan OnSwing( Mobile attacker, Mobile defender )
        {
            return OnSwing( attacker, defender, 1.0 );
        }

        public virtual TimeSpan OnSwing( Mobile attacker, Mobile defender, double damageBonus )
        {
            bool canSwing = true;

            if ( Core.AOS )
            {
                canSwing = ( !attacker.Paralyzed && !attacker.Frozen );

                if ( canSwing )
                {
                    Spell sp = attacker.Spell as Spell;

                    canSwing = ( sp == null || !sp.IsCasting || !sp.BlocksMovement );
                }
            }

            if ( canSwing && attacker.HarmfulCheck( defender ) )
            {
                attacker.DisruptiveAction();

                if ( attacker.NetState != null )
                    attacker.Send( new Swing( 0, attacker, defender ) );

                if ( attacker is BaseCreature )
                {
                    BaseCreature bc = (BaseCreature)attacker;
                    WeaponAbility ab = bc.GetWeaponAbility();

                    if ( ab != null )
                    {
                        if ( bc.WeaponAbilityChance > Utility.RandomDouble() )
                            WeaponAbility.SetCurrentAbility( bc, ab );
                        else
                            WeaponAbility.ClearCurrentAbility( bc );
                    }
                }

                if ( CheckHit( attacker, defender ) )
                    OnHit( attacker, defender, damageBonus );
                else
                    OnMiss( attacker, defender );
            }

            return GetDelay( attacker );
        }

        #region Sounds
        public virtual int GetHitAttackSound( Mobile attacker, Mobile defender )
        {
            int sound = attacker.GetAttackSound();

            if ( sound == -1 )
                sound = HitSound;

            return sound;
        }

        public virtual int GetHitDefendSound( Mobile attacker, Mobile defender )
        {
            return defender.GetHurtSound();
        }

        public virtual int GetMissAttackSound( Mobile attacker, Mobile defender )
        {
            if ( attacker.GetAttackSound() == -1 )
                return MissSound;
            else
                return -1;
        }

        public virtual int GetMissDefendSound( Mobile attacker, Mobile defender )
        {
            return -1;
        }
        #endregion

        public static bool CheckParry( Mobile defender )
        {
            if ( defender == null )
                return false;

            BaseShield shield = defender.FindItemOnLayer( Layer.TwoHanded ) as BaseShield;

            double parry = defender.Skills[SkillName.Parry].Value;
            double bushidoNonRacial = defender.Skills[SkillName.Bushido].NonRacialValue;
            double bushido = defender.Skills[SkillName.Bushido].Value;

            if ( shield != null )
            {
                double chance = (parry - bushidoNonRacial) / 400.0;    //As per OSI, no negitive effect from the Racial stuffs, ie, 120 parry and '0' bushido with humans


                // Parry over 100 grants a 5% bonus.
                if ( parry >= 100.0 )
                    chance += 0.05;

                // Evasion grants a variable bonus post ML. 50% prior.
                if ( Evasion.IsEvading( defender ) )
                    chance *= Evasion.GetParryScalar( defender );

                // Low dexterity lowers the chance.
                if ( defender.Dex < 80 )
                    chance = chance * (20 + defender.Dex) / 100;

                return defender.CheckSkill( SkillName.Parry, chance );
            }
            else if ( !(defender.Weapon is Fists) && !(defender.Weapon is BaseRanged) )
            {
                BaseWeapon weapon = defender.Weapon as BaseWeapon;

                double divisor = (weapon.Layer == Layer.OneHanded) ? 48000.0 : 41140.0;

                double chance = (parry * bushido) / divisor;

                double aosChance = parry / 800.0;

                // Parry or Bushido over 100 grant a 5% bonus.
                if( parry >= 100.0 )
                {
                    chance += 0.05;
                    aosChance += 0.05;
                }
                else if( bushido >= 100.0 )
                {
                    chance += 0.05;
                }

                // Evasion grants a variable bonus post ML. 50% prior.
                if( Evasion.IsEvading( defender ) )
                    chance *= Evasion.GetParryScalar( defender );

                // Low dexterity lowers the chance.
                if( defender.Dex < 80 )
                    chance = chance * (20 + defender.Dex) / 100;

                if ( chance > aosChance )
                    return defender.CheckSkill( SkillName.Parry, chance );
                else
                    return (aosChance > Utility.RandomDouble()); // Only skillcheck if wielding a shield & there's no effect from Bushido
            }

            return false;
        }

        public virtual int AbsorbDamageAOS( Mobile attacker, Mobile defender, int damage )
        {
            bool blocked = false;

            if ( defender.Player || defender.Body.IsHuman )
            {
                blocked = CheckParry( defender );

                if ( blocked )
                {
                    defender.FixedEffect( 0x37B9, 10, 16 );
                    damage = 0;

                    // Successful block removes the Honorable Execution penalty.
                    HonorableExecution.RemovePenalty( defender );

                    if ( CounterAttack.IsCountering( defender ) )
                    {
                        BaseWeapon weapon = defender.Weapon as BaseWeapon;

                        if ( weapon != null )
                            weapon.OnSwing( defender, attacker );

                        CounterAttack.StopCountering( defender );
                    }

                    if ( Confidence.IsConfident( defender ) )
                    {
                        defender.SendLocalizedMessage( 1063117 ); // Your confidence reassures you as you successfully block your opponent's blow.

                        double bushido = defender.Skills.Bushido.Value;

                        defender.Hits += Utility.RandomMinMax( 1, (int)(bushido / 12) );
                        defender.Stam += Utility.RandomMinMax( 1, (int)(bushido / 5) );
                    }

                    BaseShield shield = defender.FindItemOnLayer( Layer.TwoHanded ) as BaseShield;

                    if ( shield != null )
                    {
                        shield.OnHit( this, damage );
                    }
                }
            }

            if ( !blocked )
            {
                double positionChance = Utility.RandomDouble();

                Item armorItem;

                if( positionChance < 0.07 )
                    armorItem = defender.NeckArmor;
                else if( positionChance < 0.14 )
                    armorItem = defender.HandArmor;
                else if( positionChance < 0.28 )
                    armorItem = defender.ArmsArmor;
                else if( positionChance < 0.43 )
                    armorItem = defender.HeadArmor;
                else if( positionChance < 0.65 )
                    armorItem = defender.LegsArmor;
                else
                    armorItem = defender.ChestArmor;

                IWearableDurability armor = armorItem as IWearableDurability;

                if ( armor != null )
                    armor.OnHit( this, damage ); // call OnHit to lose durability
            }

            return damage;
        }

        public virtual int AbsorbDamage( Mobile attacker, Mobile defender, int damage )
        {
            if ( Core.AOS )
                return AbsorbDamageAOS( attacker, defender, damage );

            double chance = Utility.RandomDouble();

            Item armorItem;

            if( chance < 0.07 )
                armorItem = defender.NeckArmor;
            else if( chance < 0.14 )
                armorItem = defender.HandArmor;
            else if( chance < 0.28 )
                armorItem = defender.ArmsArmor;
            else if( chance < 0.43 )
                armorItem = defender.HeadArmor;
            else if( chance < 0.65 )
                armorItem = defender.LegsArmor;
            else
                armorItem = defender.ChestArmor;

            IWearableDurability armor = armorItem as IWearableDurability;

            if ( armor != null )
                damage = armor.OnHit( this, damage );

            BaseShield shield = defender.FindItemOnLayer( Layer.TwoHanded ) as BaseShield;
            if ( shield != null )
                damage = shield.OnHit( this, damage );

            int virtualArmor = defender.VirtualArmor + defender.VirtualArmorMod;

            if ( virtualArmor > 0 )
            {
                double scalar;

                if ( chance < 0.14 )
                    scalar = 0.07;
                else if ( chance < 0.28 )
                    scalar = 0.14;
                else if ( chance < 0.43 )
                    scalar = 0.15;
                else if ( chance < 0.65 )
                    scalar = 0.22;
                else
                    scalar = 0.35;

                int from = (int)(virtualArmor * scalar) / 2;
                int to = (int)(virtualArmor * scalar);

                damage -= Utility.Random( from, (to - from) + 1 );
            }

            return damage;
        }

        public virtual int GetPackInstinctBonus( Mobile attacker, Mobile defender )
        {
            if ( attacker.Player || defender.Player )
                return 0;

            BaseCreature bc = attacker as BaseCreature;

            if ( bc == null || bc.PackInstinct == PackInstinct.None || (!bc.Controlled && !bc.Summoned) )
                return 0;

            Mobile master = bc.ControlMaster;

            if ( master == null )
                master = bc.SummonMaster;

            if ( master == null )
                return 0;

            int inPack = 1;

            foreach ( Mobile m in defender.GetMobilesInRange( 1 ) )
            {
                if ( m != attacker && m is BaseCreature )
                {
                    BaseCreature tc = (BaseCreature)m;

                    if ( (tc.PackInstinct & bc.PackInstinct) == 0 || (!tc.Controlled && !tc.Summoned) )
                        continue;

                    Mobile theirMaster = tc.ControlMaster;

                    if ( theirMaster == null )
                        theirMaster = tc.SummonMaster;

                    if ( master == theirMaster && tc.Combatant == defender )
                        ++inPack;
                }
            }

            if ( inPack >= 5 )
                return 100;
            else if ( inPack >= 4 )
                return 75;
            else if ( inPack >= 3 )
                return 50;
            else if ( inPack >= 2 )
                return 25;

            return 0;
        }

        private static bool m_InDoubleStrike;

        public static bool InDoubleStrike
        {
            get{ return m_InDoubleStrike; }
            set{ m_InDoubleStrike = value; }
        }

        public void OnHit( Mobile attacker, Mobile defender )
        {
            OnHit( attacker, defender, 1.0 );
        }

        public virtual void OnHit( Mobile attacker, Mobile defender, double damageBonus )
        {
            if ( MirrorImage.HasClone( defender ) && (defender.Skills.Ninjitsu.Value / 150.0) > Utility.RandomDouble() )
            {
                Clone bc;

                foreach ( Mobile m in defender.GetMobilesInRange( 4 ) )
                {
                    bc = m as Clone;

                    if ( bc != null && bc.Summoned && bc.SummonMaster == defender )
                    {
                        attacker.SendLocalizedMessage( 1063141 ); // Your attack has been diverted to a nearby mirror image of your target!
                        defender.SendLocalizedMessage( 1063140 ); // You manage to divert the attack onto one of your nearby mirror images.

                        /*
                         * TODO: What happens if the Clone parries a blow?
                         * And what about if the attacker is using Honorable Execution
                         * and kills it?
                         */

                        defender = m;
                        break;
                    }
                }
            }

            PlaySwingAnimation( attacker );
            PlayHurtAnimation( defender );

            attacker.PlaySound( GetHitAttackSound( attacker, defender ) );
            defender.PlaySound( GetHitDefendSound( attacker, defender ) );

            int damage = ComputeDamage( attacker, defender );

            #region Damage Multipliers
            /*
             * The following damage bonuses multiply damage by a factor.
             * Capped at x3 (300%).
             */
            //double factor = 1.0;
            int percentageBonus = 0;

            WeaponAbility a = WeaponAbility.GetCurrentAbility( attacker );
            SpecialMove move = SpecialMove.GetCurrentMove( attacker );

            if( a != null )
            {
                //factor *= a.DamageScalar;
                percentageBonus += (int)(a.DamageScalar * 100) - 100;
            }

            if( move != null )
            {
                //factor *= move.GetDamageScalar( attacker, defender );
                percentageBonus += (int)(move.GetDamageScalar( attacker, defender ) * 100) - 100;
            }

            //factor *= damageBonus;
            percentageBonus += (int)(damageBonus * 100) - 100;

            CheckSlayerResult cs = CheckSlayers( attacker, defender );

            if ( cs != CheckSlayerResult.None )
            {
                if ( cs == CheckSlayerResult.Slayer )
                    defender.FixedEffect( 0x37B9, 10, 5 );

                //factor *= 2.0;
                percentageBonus += 100;
            }

            if ( !attacker.Player )
            {
                if ( defender is PlayerMobile )
                {
                    PlayerMobile pm = (PlayerMobile)defender;

                    if( pm.EnemyOfOneType != null && pm.EnemyOfOneType != attacker.GetType() )
                    {
                        //factor *= 2.0;
                        percentageBonus += 100;
                    }
                }
            }
            else if ( !defender.Player )
            {
                if ( attacker is PlayerMobile )
                {
                    PlayerMobile pm = (PlayerMobile)attacker;

                    if ( pm.WaitingForEnemy )
                    {
                        pm.EnemyOfOneType = defender.GetType();
                        pm.WaitingForEnemy = false;
                    }

                    if ( pm.EnemyOfOneType == defender.GetType() )
                    {
                        defender.FixedEffect( 0x37B9, 10, 5, 1160, 0 );
                        //factor *= 1.5;
                        percentageBonus += 50;
                    }
                }
            }

            int packInstinctBonus = GetPackInstinctBonus( attacker, defender );

            if( packInstinctBonus != 0 )
            {
                //factor *= 1.0 + (double)packInstinctBonus / 100.0;
                percentageBonus += packInstinctBonus;
            }

            if( m_InDoubleStrike )
            {
                //factor *= 0.9; // 10% loss when attacking with double-strike
                percentageBonus -= 10;
            }

            TransformContext context = TransformationSpellHelper.GetContext( defender );

            if( (m_Slayer == SlayerName.Silver || m_Slayer2 == SlayerName.Silver) && context != null && context.Spell is NecromancerSpell && context.Type != typeof( HorrificBeastSpell ) )
            {
                //factor *= 1.25; // Every necromancer transformation other than horrific beast takes an additional 25% damage
                percentageBonus += 25;
            }

            if ( attacker is PlayerMobile && !(Core.ML && defender is PlayerMobile ))
            {
                PlayerMobile pmAttacker = (PlayerMobile) attacker;

                if( pmAttacker.HonorActive && pmAttacker.InRange( defender, 1 ) )
                {
                    //factor *= 1.25;
                    percentageBonus += 25;
                }

                if( pmAttacker.SentHonorContext != null && pmAttacker.SentHonorContext.Target == defender )
                {
                    //pmAttacker.SentHonorContext.ApplyPerfectionDamageBonus( ref factor );
                    percentageBonus += pmAttacker.SentHonorContext.PerfectionDamageBonus;
                }
            }

            //if ( factor > 3.0 )
            //    factor = 3.0;
            
            #region Mondain's Legacy
            if ( Core.ML )
            {
                if ( this is ButchersWarCleaver )
                {
                    if ( defender is Bull || defender is Cow || defender is Gaman )
                        percentageBonus += 100;
                }
                
                if ( defender.Poison == Poison.Darkglow && attacker.InRange( defender.Location, 1 ) )
                    percentageBonus += 10;
            }
            #endregion

            percentageBonus = Math.Min( percentageBonus, 300 );

            //damage = (int)(damage * factor);
            damage = AOS.Scale( damage, 100 + percentageBonus );
            
            #endregion

            if ( attacker is BaseCreature )
                ((BaseCreature)attacker).AlterMeleeDamageTo( defender, ref damage );

            if ( defender is BaseCreature )
                ((BaseCreature)defender).AlterMeleeDamageFrom( attacker, ref damage );

            damage = AbsorbDamage( attacker, defender, damage );

            if ( !Core.AOS && damage < 1 )
                damage = 1;
            else if ( Core.AOS && damage == 0 ) // parried
            {
                if ( a != null && a.Validate( attacker ) /*&& a.CheckMana( attacker, true )*/ ) // Parried special moves have no mana cost 
                {
                    a = null;
                    WeaponAbility.ClearCurrentAbility( attacker );

                    attacker.SendLocalizedMessage( 1061140 ); // Your attack was parried!
                }
            }

            AddBlood( attacker, defender, damage );

            // Mondain's Legacy mod
            int phys, fire, cold, pois, nrgy, chaos, direct;

            GetDamageTypes( attacker, out phys, out fire, out cold, out pois, out nrgy, out chaos, out direct );

            if ( m_Consecrated )
            {
                phys = defender.PhysicalResistance;
                fire = defender.FireResistance;
                cold = defender.ColdResistance;
                pois = defender.PoisonResistance;
                nrgy = defender.EnergyResistance;

                int low = phys, type = 0;

                if ( fire < low ){ low = fire; type = 1; }
                if ( cold < low ){ low = cold; type = 2; }
                if ( pois < low ){ low = pois; type = 3; }
                if ( nrgy < low ){ low = nrgy; type = 4; }

                phys = fire = cold = pois = nrgy = 0;

                if ( type == 0 ) phys = 100;
                else if ( type == 1 ) fire = 100;
                else if ( type == 2 ) cold = 100;
                else if ( type == 3 ) pois = 100;
                else if ( type == 4 ) nrgy = 100;
            }

            int damageGiven = damage;

            if ( a != null && !a.OnBeforeDamage( attacker, defender ) )
            {
                WeaponAbility.ClearCurrentAbility( attacker );
                a = null;
            }

            if ( move != null && !move.OnBeforeDamage( attacker, defender ) )
            {
                SpecialMove.ClearCurrentMove( attacker );
                move = null;
            }

            bool ignoreArmor = ( a is ArmorIgnore || (move != null && move.IgnoreArmor( attacker )) );
            
            // damage increase after resists applied
            int damageIncrease = 0;
            
            BaseQuiver quiver = attacker.FindItemOnLayer( Layer.Cloak ) as BaseQuiver;
            
            if ( quiver != null )
                damageIncrease = quiver.DamageIncrease;

            // Mondain's Legacy Mod
            damageGiven = AOS.Damage( defender, attacker, damage, ignoreArmor, phys, fire, cold, pois, nrgy, chaos, direct, damageIncrease );

            double propertyBonus = ( move == null ) ? 1.0 : move.GetPropertyBonus( attacker );

            if ( Core.AOS )
            {
                int lifeLeech = 0;
                int stamLeech = 0;
                int manaLeech = 0;
                int wraithLeech = 0;

                // Mondain's Legacy Mod
                if ( (int)(AosWeaponAttributes.GetValue( attacker, AosWeaponAttribute.HitLeechHits ) * propertyBonus) > Utility.Random( 100 ) )
                    lifeLeech += 30; // HitLeechHits% chance to leech 30% of damage as hit points

                // Mondain's Legacy Mod
                if ( (int)(AosWeaponAttributes.GetValue( attacker, AosWeaponAttribute.HitLeechStam ) * propertyBonus) > Utility.Random( 100 ) )
                    stamLeech += 100; // HitLeechStam% chance to leech 100% of damage as stamina

                // Mondain's Legacy Mod
                if ( (int)(AosWeaponAttributes.GetValue( attacker, AosWeaponAttribute.HitLeechMana ) * propertyBonus) > Utility.Random( 100 ) )
                    manaLeech += 40; // HitLeechMana% chance to leech 40% of damage as mana

                if ( m_Cursed )
                    lifeLeech += 50; // Additional 50% life leech for cursed weapons (necro spell)

                context = TransformationSpellHelper.GetContext( attacker );

                if ( context != null && context.Type == typeof( VampiricEmbraceSpell ) )
                    lifeLeech += 20; // Vampiric embrace gives an additional 20% life leech

                if ( context != null && context.Type == typeof( WraithFormSpell ) )
                {
                    wraithLeech = (5 + (int)((15 * attacker.Skills.SpiritSpeak.Value) / 100)); // Wraith form gives an additional 5-20% mana leech

                    // Mana leeched by the Wraith Form spell is actually stolen, not just leeched.
                    defender.Mana -= AOS.Scale( damageGiven, wraithLeech );

                    manaLeech += wraithLeech;
                }

                if ( lifeLeech != 0 )
                    attacker.Hits += AOS.Scale( damageGiven, lifeLeech );

                if ( stamLeech != 0 )
                    attacker.Stam += AOS.Scale( damageGiven, stamLeech );

                if ( manaLeech != 0 )
                    attacker.Mana += AOS.Scale( damageGiven, manaLeech );

                if ( lifeLeech != 0 || stamLeech != 0 || manaLeech != 0 )
                    attacker.PlaySound( 0x44D );
            }

            if ( m_MaxHits > 0 && ((MaxRange <= 1 && (defender is Slime || defender is ToxicElemental)) || Utility.Random( 25 ) == 0) ) // Stratics says 50% chance, seems more like 4%..
            {
                if ( MaxRange <= 1 && (defender is Slime || defender is ToxicElemental) )
                    attacker.LocalOverheadMessage( MessageType.Regular, 0x3B2, 500263 ); // *Acid blood scars your weapon!*
                // Mondain's Legacy Mod
                if ( Core.AOS && m_AosWeaponAttributes.SelfRepair + ( IsSetItem && m_SetEquipped ? m_SetWeaponAttributes.SelfRepair : 0 ) > Utility.Random( 10 ) )
                {
                    HitPoints += 2;
                }
                else
                {
                    if ( m_Hits > 0 )
                    {
                        --HitPoints;
                    }
                    else if ( m_MaxHits > 1 )
                    {
                        --MaxHitPoints;

                        if ( Parent is Mobile )
                            ((Mobile)Parent).LocalOverheadMessage( MessageType.Regular, 0x3B2, 1061121 ); // Your equipment is severely damaged.
                    }
                    else
                    {
                        Delete();
                    }
                }
            }

            if ( attacker is VampireBatFamiliar )
            {
                BaseCreature bc = (BaseCreature)attacker;
                Mobile caster = bc.ControlMaster;

                if ( caster == null )
                    caster = bc.SummonMaster;

                if ( caster != null && caster.Map == bc.Map && caster.InRange( bc, 2 ) )
                    caster.Hits += damage;
                else
                    bc.Hits += damage;
            }

            if ( Core.AOS )
            {
                // Mondain's Legacy Mod
                int physChance = (int)(AosWeaponAttributes.GetValue( attacker, AosWeaponAttribute.HitPhysicalArea ) * propertyBonus);
                int fireChance = (int)(AosWeaponAttributes.GetValue( attacker, AosWeaponAttribute.HitFireArea ) * propertyBonus);
                int coldChance = (int)(AosWeaponAttributes.GetValue( attacker, AosWeaponAttribute.HitColdArea ) * propertyBonus);
                int poisChance = (int)(AosWeaponAttributes.GetValue( attacker, AosWeaponAttribute.HitPoisonArea ) * propertyBonus);
                int nrgyChance = (int)(AosWeaponAttributes.GetValue( attacker, AosWeaponAttribute.HitEnergyArea ) * propertyBonus);

                if ( physChance != 0 && physChance > Utility.Random( 100 ) )
                    DoAreaAttack( attacker, defender, 0x10E,   50, 100, 0, 0, 0, 0 );

                if ( fireChance != 0 && fireChance > Utility.Random( 100 ) )
                    DoAreaAttack( attacker, defender, 0x11D, 1160, 0, 100, 0, 0, 0 );

                if ( coldChance != 0 && coldChance > Utility.Random( 100 ) )
                    DoAreaAttack( attacker, defender, 0x0FC, 2100, 0, 0, 100, 0, 0 );

                if ( poisChance != 0 && poisChance > Utility.Random( 100 ) )
                    DoAreaAttack( attacker, defender, 0x205, 1166, 0, 0, 0, 100, 0 );

                if ( nrgyChance != 0 && nrgyChance > Utility.Random( 100 ) )
                    DoAreaAttack( attacker, defender, 0x1F1,  120, 0, 0, 0, 0, 100 );

                // Mondain's Legacy Mod
                int maChance = (int)(AosWeaponAttributes.GetValue( attacker, AosWeaponAttribute.HitMagicArrow ) * propertyBonus);
                int harmChance = (int)(AosWeaponAttributes.GetValue(attacker,  AosWeaponAttribute.HitHarm ) * propertyBonus);
                int fireballChance = (int)(AosWeaponAttributes.GetValue( attacker, AosWeaponAttribute.HitFireball ) * propertyBonus);
                int lightningChance = (int)(AosWeaponAttributes.GetValue( attacker, AosWeaponAttribute.HitLightning ) * propertyBonus);
                int dispelChance = (int)(AosWeaponAttributes.GetValue( attacker, AosWeaponAttribute.HitDispel ) * propertyBonus);

                if ( maChance != 0 && maChance > Utility.Random( 100 ) )
                    DoMagicArrow( attacker, defender );

                if ( harmChance != 0 && harmChance > Utility.Random( 100 ) )
                    DoHarm( attacker, defender );

                if ( fireballChance != 0 && fireballChance > Utility.Random( 100 ) )
                    DoFireball( attacker, defender );

                if ( lightningChance != 0 && lightningChance > Utility.Random( 100 ) )
                    DoLightning( attacker, defender );

                if ( dispelChance != 0 && dispelChance > Utility.Random( 100 ) )
                    DoDispel( attacker, defender );

                // Mondain's Legacy Mod
                int laChance = (int)(AosWeaponAttributes.GetValue( attacker, AosWeaponAttribute.HitLowerAttack ) * propertyBonus);
                int ldChance = (int)(AosWeaponAttributes.GetValue( attacker, AosWeaponAttribute.HitLowerDefend ) * propertyBonus);

                if ( laChance != 0 && laChance > Utility.Random( 100 ) )
                    DoLowerAttack( attacker, defender );

                if ( ldChance != 0 && ldChance > Utility.Random( 100 ) )
                    DoLowerDefense( attacker, defender );
            }

            if ( attacker is BaseCreature )
                ((BaseCreature)attacker).OnGaveMeleeAttack( defender );

            if ( defender is BaseCreature )
                ((BaseCreature)defender).OnGotMeleeAttack( attacker );

            if ( a != null )
                a.OnHit( attacker, defender, damage );

            if ( move != null )
                move.OnHit( attacker, defender, damage );

            if ( defender is IHonorTarget && ((IHonorTarget)defender).ReceivedHonorContext != null )
                ((IHonorTarget)defender).ReceivedHonorContext.OnTargetHit( attacker );

            if ( !(this is BaseRanged) )
            {
                if ( AnimalForm.UnderTransformation( attacker, typeof( GiantSerpent ) ) )
                    defender.ApplyPoison( attacker, Poison.Lesser );

                if ( AnimalForm.UnderTransformation( defender, typeof( BullFrog ) ) )
                    attacker.ApplyPoison( defender, Poison.Regular );
            }
        }

        public virtual double GetAosDamage( Mobile attacker, int bonus, int dice, int sides )
        {
            int damage = Utility.Dice( dice, sides, bonus ) * 100;
            int damageBonus = 0;

            // Inscription bonus
            int inscribeSkill = attacker.Skills[SkillName.Inscribe].Fixed;

            damageBonus += inscribeSkill / 200;

            if ( inscribeSkill >= 1000 )
                damageBonus += 5;

            if ( attacker.Player )
            {
                // Int bonus
                damageBonus += (attacker.Int / 10);

                // SDI bonus
                damageBonus += AosAttributes.GetValue( attacker, AosAttribute.SpellDamage );

                TransformContext context = TransformationSpellHelper.GetContext( attacker );

                if( context != null && context.Spell is ReaperFormSpell )
                    damageBonus += ((ReaperFormSpell)context.Spell).SpellDamageBonus;
            }

            damage = AOS.Scale( damage, 100 + damageBonus );

            return damage / 100;
        }

        #region Do<AoSEffect>
        public virtual void DoMagicArrow( Mobile attacker, Mobile defender )
        {
            if ( !attacker.CanBeHarmful( defender, false ) )
                return;

            attacker.DoHarmful( defender );

            double damage = GetAosDamage( attacker, 10, 1, 4 );

            attacker.MovingParticles( defender, 0x36E4, 5, 0, false, true, 3006, 4006, 0 );
            attacker.PlaySound( 0x1E5 );

            SpellHelper.Damage( TimeSpan.FromSeconds( 1.0 ), defender, attacker, damage, 0, 100, 0, 0, 0 );
        }

        public virtual void DoHarm( Mobile attacker, Mobile defender )
        {
            if ( !attacker.CanBeHarmful( defender, false ) )
                return;

            attacker.DoHarmful( defender );

            double damage = GetAosDamage( attacker, 17, 1, 5 );

            if ( !defender.InRange( attacker, 2 ) )
                damage *= 0.25; // 1/4 damage at > 2 tile range
            else if ( !defender.InRange( attacker, 1 ) )
                damage *= 0.50; // 1/2 damage at 2 tile range

            defender.FixedParticles( 0x374A, 10, 30, 5013, 1153, 2, EffectLayer.Waist );
            defender.PlaySound( 0x0FC );

            SpellHelper.Damage( TimeSpan.Zero, defender, attacker, damage, 0, 0, 100, 0, 0 );
        }

        public virtual void DoFireball( Mobile attacker, Mobile defender )
        {
            if ( !attacker.CanBeHarmful( defender, false ) )
                return;

            attacker.DoHarmful( defender );

            double damage = GetAosDamage( attacker, 19, 1, 5 );

            attacker.MovingParticles( defender, 0x36D4, 7, 0, false, true, 9502, 4019, 0x160 );
            attacker.PlaySound( 0x15E );

            SpellHelper.Damage( TimeSpan.FromSeconds( 1.0 ), defender, attacker, damage, 0, 100, 0, 0, 0 );
        }

        public virtual void DoLightning( Mobile attacker, Mobile defender )
        {
            if ( !attacker.CanBeHarmful( defender, false ) )
                return;

            attacker.DoHarmful( defender );

            double damage = GetAosDamage( attacker, 23, 1, 4 );

            defender.BoltEffect( 0 );

            SpellHelper.Damage( TimeSpan.Zero, defender, attacker, damage, 0, 0, 0, 0, 100 );
        }

        public virtual void DoDispel( Mobile attacker, Mobile defender )
        {
            bool dispellable = false;

            if ( defender is BaseCreature )
                dispellable = ((BaseCreature)defender).Summoned && !((BaseCreature)defender).IsAnimatedDead;

            if ( !dispellable )
                return;

            if ( !attacker.CanBeHarmful( defender, false ) )
                return;

            attacker.DoHarmful( defender );

            Spells.MagerySpell sp = new Spells.Sixth.DispelSpell( attacker, null );

            if ( sp.CheckResisted( defender ) )
            {
                defender.FixedEffect( 0x3779, 10, 20 );
            }
            else
            {
                Effects.SendLocationParticles( EffectItem.Create( defender.Location, defender.Map, EffectItem.DefaultDuration ), 0x3728, 8, 20, 5042 );
                Effects.PlaySound( defender, defender.Map, 0x201 );

                defender.Delete();
            }
        }

        public virtual void DoLowerAttack( Mobile from, Mobile defender )
        {
            if ( HitLower.ApplyAttack( defender ) )
            {
                defender.PlaySound( 0x28E );
                Effects.SendTargetEffect( defender, 0x37BE, 1, 4, 0xA, 3 );
            }
        }

        public virtual void DoLowerDefense( Mobile from, Mobile defender )
        {
            if ( HitLower.ApplyDefense( defender ) )
            {
                defender.PlaySound( 0x28E );
                Effects.SendTargetEffect( defender, 0x37BE, 1, 4, 0x23, 3 );
            }
        }

        public virtual void DoAreaAttack( Mobile from, Mobile defender, int sound, int hue, int phys, int fire, int cold, int pois, int nrgy )
        {
            Map map = from.Map;

            if ( map == null )
                return;

            List<Mobile> list = new List<Mobile>();

            foreach ( Mobile m in from.GetMobilesInRange( 10 ) )
            {
                if ( from != m && defender != m && SpellHelper.ValidIndirectTarget( from, m ) && from.CanBeHarmful( m, false ) && ( !Core.ML || from.InLOS( m ) ) )
                    list.Add( m );
            }

            if ( list.Count == 0 )
                return;

            Effects.PlaySound( from.Location, map, sound );

            // TODO: What is the damage calculation?

            for ( int i = 0; i < list.Count; ++i )
            {
                Mobile m = list[i];

                double scalar = (11 - from.GetDistanceToSqrt( m )) / 10;

                if ( scalar > 1.0 )
                    scalar = 1.0;
                else if ( scalar < 0.0 )
                    continue;

                from.DoHarmful( m, true );
                m.FixedEffect( 0x3779, 1, 15, hue, 0 );
                AOS.Damage( m, from, (int)(GetBaseDamage( from ) * scalar), phys, fire, cold, pois, nrgy );
            }
        }
        #endregion

        public virtual CheckSlayerResult CheckSlayers( Mobile attacker, Mobile defender )
        {
            BaseWeapon atkWeapon = attacker.Weapon as BaseWeapon;
            SlayerEntry atkSlayer = SlayerGroup.GetEntryByName( atkWeapon.Slayer );
            SlayerEntry atkSlayer2 = SlayerGroup.GetEntryByName( atkWeapon.Slayer2 );

            if ( atkSlayer != null && atkSlayer.Slays( defender )  || atkSlayer2 != null && atkSlayer2.Slays( defender ) )
                return CheckSlayerResult.Slayer;

            if ( !Core.SE )
            {
                ISlayer defISlayer = Spellbook.FindEquippedSpellbook( defender );

                if( defISlayer == null )
                    defISlayer = defender.Weapon as ISlayer;

                if( defISlayer != null )
                {
                    SlayerEntry defSlayer = SlayerGroup.GetEntryByName( defISlayer.Slayer );
                    SlayerEntry defSlayer2 = SlayerGroup.GetEntryByName( defISlayer.Slayer2 );

                    if( defSlayer != null && defSlayer.Group.OppositionSuperSlays( attacker ) || defSlayer2 != null && defSlayer2.Group.OppositionSuperSlays( attacker ) )
                        return CheckSlayerResult.Opposition;
                }
            }

            return CheckSlayerResult.None;
        }

        public virtual void AddBlood( Mobile attacker, Mobile defender, int damage )
        {
            if ( damage > 0 )
            {
                new Blood().MoveToWorld( defender.Location, defender.Map );

                int extraBlood = (Core.SE ? Utility.RandomMinMax( 3, 4 ) : Utility.RandomMinMax( 0, 1 ) );

                for( int i = 0; i < extraBlood; i++ )
                {
                    new Blood().MoveToWorld( new Point3D(
                        defender.X + Utility.RandomMinMax( -1, 1 ),
                        defender.Y + Utility.RandomMinMax( -1, 1 ),
                        defender.Z ), defender.Map );
                }
            }
        }

        // Mondain's Legacy mod
        public virtual void GetDamageTypes( Mobile wielder, out int phys, out int fire, out int cold, out int pois, out int nrgy )
        {
            int dummy;
            
            GetDamageTypes( wielder, out phys, out fire, out cold, out pois, out nrgy, out dummy, out dummy );
        }
        
        public virtual void GetDamageTypes( Mobile wielder, out int phys, out int fire, out int cold, out int pois, out int nrgy, out int chaos, out int direct )
        {
            if( wielder is BaseCreature )
            {
                BaseCreature bc = (BaseCreature)wielder;

                phys = bc.PhysicalDamage;
                fire = bc.FireDamage;
                cold = bc.ColdDamage;
                pois = bc.PoisonDamage;
                nrgy = bc.EnergyDamage;
                chaos = 0;
                direct = 0;
            }
            else
            {
                fire = m_AosElementDamages.Fire;
                cold = m_AosElementDamages.Cold;
                pois = m_AosElementDamages.Poison;
                nrgy = m_AosElementDamages.Energy;
                                
                #region Mondain's Legacy
                chaos = m_AosElementDamages.Chaos;
                direct = m_AosElementDamages.Direct;
                #endregion
                
                phys = 100 - fire - cold - pois - nrgy - chaos - direct;

                CraftResourceInfo resInfo = CraftResources.GetInfo( m_Resource );

                if( resInfo != null )
                {
                    CraftAttributeInfo attrInfo = resInfo.AttributeInfo;

                    if( attrInfo != null )
                    {
                        int left = phys;

                        left = ApplyCraftAttributeElementDamage( attrInfo.WeaponColdDamage,        ref cold, left );
                        left = ApplyCraftAttributeElementDamage( attrInfo.WeaponEnergyDamage,    ref nrgy, left );
                        left = ApplyCraftAttributeElementDamage( attrInfo.WeaponFireDamage,        ref fire, left );
                        left = ApplyCraftAttributeElementDamage( attrInfo.WeaponPoisonDamage,    ref pois, left );

                        phys = left;
                    }
                }
            }
        }

        private int ApplyCraftAttributeElementDamage( int attrDamage, ref int element, int totalRemaining )
        {
            if( totalRemaining <= 0 )
                return 0;

            if ( attrDamage <= 0 )
                return totalRemaining;

            int appliedDamage = attrDamage;

            if ( (appliedDamage + element) > 100 )
                appliedDamage = 100 - element;

            if( appliedDamage > totalRemaining )
                appliedDamage = totalRemaining;

            element += appliedDamage;

            return totalRemaining - appliedDamage;
        }

        public virtual void OnMiss( Mobile attacker, Mobile defender )
        {
            PlaySwingAnimation( attacker );
            attacker.PlaySound( GetMissAttackSound( attacker, defender ) );
            defender.PlaySound( GetMissDefendSound( attacker, defender ) );

            WeaponAbility ability = WeaponAbility.GetCurrentAbility( attacker );

            if ( ability != null )
                ability.OnMiss( attacker, defender );

            SpecialMove move = SpecialMove.GetCurrentMove( attacker );

            if ( move != null )
                move.OnMiss( attacker, defender );

            if ( defender is IHonorTarget && ((IHonorTarget)defender).ReceivedHonorContext != null )
                ((IHonorTarget)defender).ReceivedHonorContext.OnTargetMissed( attacker );
        }

        public virtual void GetBaseDamageRange( Mobile attacker, out int min, out int max )
        {
            if ( attacker is BaseCreature )
            {
                BaseCreature c = (BaseCreature)attacker;

                if ( c.DamageMin >= 0 )
                {
                    min = c.DamageMin;
                    max = c.DamageMax;
                    return;
                }

                if ( this is Fists && !attacker.Body.IsHuman )
                {
                    min = attacker.Str / 28;
                    max = attacker.Str / 28;
                    return;
                }
            }

            min = MinDamage;
            max = MaxDamage;
        }

        public virtual double GetBaseDamage( Mobile attacker )
        {
            int min, max;

            GetBaseDamageRange( attacker, out min, out max );

            return Utility.RandomMinMax( min, max );
        }

        public virtual double GetBonus( double value, double scalar, double threshold, double offset )
        {
            double bonus = value * scalar;

            if ( value >= threshold )
                bonus += offset;

            return bonus / 100;
        }

        public virtual int GetHitChanceBonus()
        {
            if ( !Core.AOS )
                return 0;

            int bonus = 0;

            switch ( m_AccuracyLevel )
            {
                case WeaponAccuracyLevel.Accurate:        bonus += 02; break;
                case WeaponAccuracyLevel.Surpassingly:    bonus += 04; break;
                case WeaponAccuracyLevel.Eminently:        bonus += 06; break;
                case WeaponAccuracyLevel.Exceedingly:    bonus += 08; break;
                case WeaponAccuracyLevel.Supremely:        bonus += 10; break;
            }

            return bonus;
        }

        public virtual int GetDamageBonus()
        {
            int bonus = VirtualDamageBonus;

            switch ( m_Quality )
            {
                case WeaponQuality.Low:            bonus -= 20; break;
                case WeaponQuality.Exceptional:    bonus += 20; break;
            }

            switch ( m_DamageLevel )
            {
                case WeaponDamageLevel.Ruin:    bonus += 15; break;
                case WeaponDamageLevel.Might:    bonus += 20; break;
                case WeaponDamageLevel.Force:    bonus += 25; break;
                case WeaponDamageLevel.Power:    bonus += 30; break;
                case WeaponDamageLevel.Vanq:    bonus += 35; break;
            }

            return bonus;
        }

        public virtual void GetStatusDamage( Mobile from, out int min, out int max )
        {
            int baseMin, baseMax;

            GetBaseDamageRange( from, out baseMin, out baseMax );

            if ( Core.AOS )
            {
                min = Math.Max( (int)ScaleDamageAOS( from, baseMin, false ), 1 );
                max = Math.Max( (int)ScaleDamageAOS( from, baseMax, false ), 1 );
            }
            else
            {
                min = Math.Max( (int)ScaleDamageOld( from, baseMin, false ), 1 );
                max = Math.Max( (int)ScaleDamageOld( from, baseMax, false ), 1 );
            }
        }

        public virtual double ScaleDamageAOS( Mobile attacker, double damage, bool checkSkills )
        {
            if ( checkSkills )
            {
                attacker.CheckSkill( SkillName.Tactics, 0.0, 120.0 ); // Passively check tactics for gain
                attacker.CheckSkill( SkillName.Anatomy, 0.0, 120.0 ); // Passively check Anatomy for gain

                if ( Type == WeaponType.Axe )
                    attacker.CheckSkill( SkillName.Lumberjacking, 0.0, 100.0 ); // Passively check Lumberjacking for gain
            }

            #region Physical bonuses
            /*
             * These are the bonuses given by the physical characteristics of the mobile.
             * No caps apply.
             */
            double strengthBonus = GetBonus( attacker.Str,                                        0.300, 100.0,  5.00 );
            double  anatomyBonus = GetBonus( attacker.Skills[SkillName.Anatomy].Value,            0.500, 100.0,  5.00 );
            double  tacticsBonus = GetBonus( attacker.Skills[SkillName.Tactics].Value,            0.625, 100.0,  6.25 );
            double   lumberBonus = GetBonus( attacker.Skills[SkillName.Lumberjacking].Value,    0.200, 100.0, 10.00 );

            if ( Type != WeaponType.Axe )
                lumberBonus = 0.0;
            #endregion

            #region Modifiers
            /*
             * The following are damage modifiers whose effect shows on the status bar.
             * Capped at 100% total.
             */
            int damageBonus = AosAttributes.GetValue( attacker, AosAttribute.WeaponDamage );

            // Horrific Beast transformation gives a +25% bonus to damage.
            if( TransformationSpellHelper.UnderTransformation( attacker, typeof( HorrificBeastSpell ) ) )
                damageBonus += 25;

            // Divine Fury gives a +10% bonus to damage.
            if ( Spells.Chivalry.DivineFurySpell.UnderEffect( attacker ) )
                damageBonus += 10;

            int defenseMasteryMalus = 0;

            // Defense Mastery gives a -50%/-80% malus to damage.
            if ( Server.Items.DefenseMastery.GetMalus( attacker, ref defenseMasteryMalus ) )
                damageBonus -= defenseMasteryMalus;

            int discordanceEffect = 0;

            // Discordance gives a -2%/-48% malus to damage.
            if ( SkillHandlers.Discordance.GetEffect( attacker, ref discordanceEffect ) )
                damageBonus -= discordanceEffect * 2;

            if ( damageBonus > 100 )
                damageBonus = 100;
            #endregion

            double totalBonus = strengthBonus + anatomyBonus + tacticsBonus + lumberBonus + ((double)(GetDamageBonus() + damageBonus) / 100.0);

            return damage + (int)(damage * totalBonus);
        }

        public virtual int VirtualDamageBonus{ get{ return 0; } }

        public virtual int ComputeDamageAOS( Mobile attacker, Mobile defender )
        {
            return (int)ScaleDamageAOS( attacker, GetBaseDamage( attacker ), true );
        }

        public virtual double ScaleDamageOld( Mobile attacker, double damage, bool checkSkills )
        {
            if ( checkSkills )
            {
                attacker.CheckSkill( SkillName.Tactics, 0.0, 120.0 ); // Passively check tactics for gain
                attacker.CheckSkill( SkillName.Anatomy, 0.0, 120.0 ); // Passively check Anatomy for gain

                if ( Type == WeaponType.Axe )
                    attacker.CheckSkill( SkillName.Lumberjacking, 0.0, 100.0 ); // Passively check Lumberjacking for gain
            }

            /* Compute tactics modifier
             * :   0.0 = 50% loss
             * :  50.0 = unchanged
             * : 100.0 = 50% bonus
             */
            double tacticsBonus = (attacker.Skills[SkillName.Tactics].Value - 50.0) / 100.0;

            /* Compute strength modifier
             * : 1% bonus for every 5 strength
             */
            double strBonus = (attacker.Str / 5.0) / 100.0;

            /* Compute anatomy modifier
             * : 1% bonus for every 5 points of anatomy
             * : +10% bonus at Grandmaster or higher
             */
            double anatomyValue = attacker.Skills[SkillName.Anatomy].Value;
            double anatomyBonus = (anatomyValue / 5.0) / 100.0;

            if ( anatomyValue >= 100.0 )
                anatomyBonus += 0.1;

            /* Compute lumberjacking bonus
             * : 1% bonus for every 5 points of lumberjacking
             * : +10% bonus at Grandmaster or higher
             */
            double lumberBonus;

            if ( Type == WeaponType.Axe )
            {
                double lumberValue = attacker.Skills[SkillName.Lumberjacking].Value;

                lumberBonus = (lumberValue / 5.0) / 100.0;

                if ( lumberValue >= 100.0 )
                    lumberBonus += 0.1;
            }
            else
            {
                lumberBonus = 0.0;
            }

            // New quality bonus:
            double qualityBonus = ((int)m_Quality - 1) * 0.2;

            // Apply bonuses
            damage += (damage * tacticsBonus) + (damage * strBonus) + (damage * anatomyBonus) + (damage * lumberBonus) + (damage * qualityBonus) + ((damage * VirtualDamageBonus) / 100);

            // Old quality bonus:
#if false
            /* Apply quality offset
             * : Low         : -4
             * : Regular     :  0
             * : Exceptional : +4
             */
            damage += ((int)m_Quality - 1) * 4.0;
#endif

            /* Apply damage level offset
             * : Regular : 0
             * : Ruin    : 1
             * : Might   : 3
             * : Force   : 5
             * : Power   : 7
             * : Vanq    : 9
             */
            if ( m_DamageLevel != WeaponDamageLevel.Regular )
                damage += (2.0 * (int)m_DamageLevel) - 1.0;

            // Halve the computed damage and return
            damage /= 2.0;

            return ScaleDamageByDurability( (int)damage );
        }

        public virtual int ScaleDamageByDurability( int damage )
        {
            int scale = 100;

            if ( m_MaxHits > 0 && m_Hits < m_MaxHits )
                scale = 50 + ((50 * m_Hits) / m_MaxHits);

            return AOS.Scale( damage, scale );
        }

        public virtual int ComputeDamage( Mobile attacker, Mobile defender )
        {
            if ( Core.AOS )
                return ComputeDamageAOS( attacker, defender );

            return (int)ScaleDamageOld( attacker, GetBaseDamage( attacker ), true );
        }

        public virtual void PlayHurtAnimation( Mobile from )
        {
            int action;
            int frames;

            switch ( from.Body.Type )
            {
                case BodyType.Sea:
                case BodyType.Animal:
                {
                    action = 7;
                    frames = 5;
                    break;
                }
                case BodyType.Monster:
                {
                    action = 10;
                    frames = 4;
                    break;
                }
                case BodyType.Human:
                {
                    action = 20;
                    frames = 5;
                    break;
                }
                default: return;
            }

            if ( from.Mounted )
                return;

            from.Animate( action, frames, 1, true, false, 0 );
        }

        public virtual void PlaySwingAnimation( Mobile from )
        {
            int action;

            switch ( from.Body.Type )
            {
                case BodyType.Sea:
                case BodyType.Animal:
                {
                    action = Utility.Random( 5, 2 );
                    break;
                }
                case BodyType.Monster:
                {
                    switch ( Animation )
                    {
                        default:
                        case WeaponAnimation.Wrestle:
                        case WeaponAnimation.Bash1H:
                        case WeaponAnimation.Pierce1H:
                        case WeaponAnimation.Slash1H:
                        case WeaponAnimation.Bash2H:
                        case WeaponAnimation.Pierce2H:
                        case WeaponAnimation.Slash2H: action = Utility.Random( 4, 3 ); break;
                        case WeaponAnimation.ShootBow:  return; // 7
                        case WeaponAnimation.ShootXBow: return; // 8
                    }

                    break;
                }
                case BodyType.Human:
                {
                    if ( !from.Mounted )
                    {
                        action = (int)Animation;
                    }
                    else
                    {
                        switch ( Animation )
                        {
                            default:
                            case WeaponAnimation.Wrestle:
                            case WeaponAnimation.Bash1H:
                            case WeaponAnimation.Pierce1H:
                            case WeaponAnimation.Slash1H: action = 26; break;
                            case WeaponAnimation.Bash2H:
                            case WeaponAnimation.Pierce2H:
                            case WeaponAnimation.Slash2H: action = 29; break;
                            case WeaponAnimation.ShootBow: action = 27; break;
                            case WeaponAnimation.ShootXBow: action = 28; break;
                        }
                    }

                    break;
                }
                default: return;
            }

            from.Animate( action, 7, 1, true, false, 0 );
        }

        #region Serialization/Deserialization
        private static void SetSaveFlag( ref SaveFlag flags, SaveFlag toSet, bool setIf )
        {
            if ( setIf )
                flags |= toSet;
        }

        private static bool GetSaveFlag( SaveFlag flags, SaveFlag toGet )
        {
            return ( (flags & toGet) != 0 );
        }

        public override void Serialize( GenericWriter writer )
        {
            base.Serialize( writer );

            writer.Write( (int) 9 ); // version
            
            #region Mondain's Legacy version 9
            SetFlag sflags = SetFlag.None;
            
            SetSaveFlag( ref sflags, SetFlag.Attributes,        !m_SetAttributes.IsEmpty );
            SetSaveFlag( ref sflags, SetFlag.WeaponAttributes,    !m_SetWeaponAttributes.IsEmpty );
            SetSaveFlag( ref sflags, SetFlag.SkillBonuses,        !m_SetSkillBonuses.IsEmpty );
            SetSaveFlag( ref sflags, SetFlag.SetHue,            m_SetHue != 0 );
            SetSaveFlag( ref sflags, SetFlag.LastEquipped,        true );
            SetSaveFlag( ref sflags, SetFlag.SetEquipped,        true );
            
            writer.WriteEncodedInt( (int) sflags );
            writer.Write( (string) m_EngravedText );
            if ( GetSaveFlag( sflags, SetFlag.Attributes ) )
                m_SetAttributes.Serialize( writer );

            if ( GetSaveFlag( sflags, SetFlag.WeaponAttributes ) )
                m_SetWeaponAttributes.Serialize( writer );        

            if ( GetSaveFlag( sflags, SetFlag.SkillBonuses ) )
                m_SetSkillBonuses.Serialize( writer );
                
            if ( GetSaveFlag( sflags, SetFlag.SetHue ) )
                writer.Write( (int) m_SetHue );
                
            if ( GetSaveFlag( sflags, SetFlag.LastEquipped ) )
                writer.Write( (bool) m_LastEquipped );
                
            if ( GetSaveFlag( sflags, SetFlag.SetEquipped ) )
                writer.Write( (bool) m_SetEquipped );
            #endregion

            SaveFlag flags = SaveFlag.None;

            SetSaveFlag( ref flags, SaveFlag.DamageLevel,        m_DamageLevel != WeaponDamageLevel.Regular );
            SetSaveFlag( ref flags, SaveFlag.AccuracyLevel,        m_AccuracyLevel != WeaponAccuracyLevel.Regular );
            SetSaveFlag( ref flags, SaveFlag.DurabilityLevel,    m_DurabilityLevel != WeaponDurabilityLevel.Regular );
            SetSaveFlag( ref flags, SaveFlag.Quality,            m_Quality != WeaponQuality.Regular );
            SetSaveFlag( ref flags, SaveFlag.Hits,                m_Hits != 0 );
            SetSaveFlag( ref flags, SaveFlag.MaxHits,            m_MaxHits != 0 );
            SetSaveFlag( ref flags, SaveFlag.Slayer,            m_Slayer != SlayerName.None );
            SetSaveFlag( ref flags, SaveFlag.Poison,            m_Poison != null );
            SetSaveFlag( ref flags, SaveFlag.PoisonCharges,        m_PoisonCharges != 0 );
            SetSaveFlag( ref flags, SaveFlag.Crafter,            m_Crafter != null );
            SetSaveFlag( ref flags, SaveFlag.Identified,        m_Identified != false );
            SetSaveFlag( ref flags, SaveFlag.StrReq,            m_StrReq != -1 );
            SetSaveFlag( ref flags, SaveFlag.DexReq,            m_DexReq != -1 );
            SetSaveFlag( ref flags, SaveFlag.IntReq,            m_IntReq != -1 );
            SetSaveFlag( ref flags, SaveFlag.MinDamage,            m_MinDamage != -1 );
            SetSaveFlag( ref flags, SaveFlag.MaxDamage,            m_MaxDamage != -1 );
            SetSaveFlag( ref flags, SaveFlag.HitSound,            m_HitSound != -1 );
            SetSaveFlag( ref flags, SaveFlag.MissSound,            m_MissSound != -1 );
            SetSaveFlag( ref flags, SaveFlag.Speed,                m_Speed != -1 );
            SetSaveFlag( ref flags, SaveFlag.MaxRange,            m_MaxRange != -1 );
            SetSaveFlag( ref flags, SaveFlag.Skill,                m_Skill != (SkillName)(-1) );
            SetSaveFlag( ref flags, SaveFlag.Type,                m_Type != (WeaponType)(-1) );
            SetSaveFlag( ref flags, SaveFlag.Animation,            m_Animation != (WeaponAnimation)(-1) );
            SetSaveFlag( ref flags, SaveFlag.Resource,            m_Resource != CraftResource.Iron );
            SetSaveFlag( ref flags, SaveFlag.xAttributes,        !m_AosAttributes.IsEmpty );
            SetSaveFlag( ref flags, SaveFlag.xWeaponAttributes,    !m_AosWeaponAttributes.IsEmpty );
            SetSaveFlag( ref flags, SaveFlag.PlayerConstructed,    m_PlayerConstructed );
            SetSaveFlag( ref flags, SaveFlag.SkillBonuses,        !m_AosSkillBonuses.IsEmpty );
            SetSaveFlag( ref flags, SaveFlag.Slayer2,            m_Slayer2 != SlayerName.None );
            SetSaveFlag( ref flags, SaveFlag.ElementalDamages,    !m_AosElementDamages.IsEmpty );

            writer.Write( (int) flags );

            if ( GetSaveFlag( flags, SaveFlag.DamageLevel ) )
                writer.Write( (int) m_DamageLevel );

            if ( GetSaveFlag( flags, SaveFlag.AccuracyLevel ) )
                writer.Write( (int) m_AccuracyLevel );

            if ( GetSaveFlag( flags, SaveFlag.DurabilityLevel ) )
                writer.Write( (int) m_DurabilityLevel );

            if ( GetSaveFlag( flags, SaveFlag.Quality ) )
                writer.Write( (int) m_Quality );

            if ( GetSaveFlag( flags, SaveFlag.Hits ) )
                writer.Write( (int) m_Hits );

            if ( GetSaveFlag( flags, SaveFlag.MaxHits ) )
                writer.Write( (int) m_MaxHits );

            if ( GetSaveFlag( flags, SaveFlag.Slayer ) )
                writer.Write( (int) m_Slayer );

            if ( GetSaveFlag( flags, SaveFlag.Poison ) )
                Poison.Serialize( m_Poison, writer );

            if ( GetSaveFlag( flags, SaveFlag.PoisonCharges ) )
                writer.Write( (int) m_PoisonCharges );

            if ( GetSaveFlag( flags, SaveFlag.Crafter ) )
                writer.Write( (Mobile) m_Crafter );

            if ( GetSaveFlag( flags, SaveFlag.StrReq ) )
                writer.Write( (int) m_StrReq );

            if ( GetSaveFlag( flags, SaveFlag.DexReq ) )
                writer.Write( (int) m_DexReq );

            if ( GetSaveFlag( flags, SaveFlag.IntReq ) )
                writer.Write( (int) m_IntReq );

            if ( GetSaveFlag( flags, SaveFlag.MinDamage ) )
                writer.Write( (int) m_MinDamage );

            if ( GetSaveFlag( flags, SaveFlag.MaxDamage ) )
                writer.Write( (int) m_MaxDamage );

            if ( GetSaveFlag( flags, SaveFlag.HitSound ) )
                writer.Write( (int) m_HitSound );

            if ( GetSaveFlag( flags, SaveFlag.MissSound ) )
                writer.Write( (int) m_MissSound );

            if ( GetSaveFlag( flags, SaveFlag.Speed ) )
                writer.Write( (int) m_Speed );

            if ( GetSaveFlag( flags, SaveFlag.MaxRange ) )
                writer.Write( (int) m_MaxRange );

            if ( GetSaveFlag( flags, SaveFlag.Skill ) )
                writer.Write( (int) m_Skill );

            if ( GetSaveFlag( flags, SaveFlag.Type ) )
                writer.Write( (int) m_Type );

            if ( GetSaveFlag( flags, SaveFlag.Animation ) )
                writer.Write( (int) m_Animation );

            if ( GetSaveFlag( flags, SaveFlag.Resource ) )
                writer.Write( (int) m_Resource );

            if ( GetSaveFlag( flags, SaveFlag.xAttributes ) )
                m_AosAttributes.Serialize( writer );

            if ( GetSaveFlag( flags, SaveFlag.xWeaponAttributes ) )
                m_AosWeaponAttributes.Serialize( writer );

            if ( GetSaveFlag( flags, SaveFlag.SkillBonuses ) )
                m_AosSkillBonuses.Serialize( writer );

            if ( GetSaveFlag( flags, SaveFlag.Slayer2 ) )
                writer.Write( (int)m_Slayer2 );

            if( GetSaveFlag( flags, SaveFlag.ElementalDamages ) )
                m_AosElementDamages.Serialize( writer );
        }

        [Flags]
        private enum SaveFlag
        {
            None                    = 0x00000000,
            DamageLevel                = 0x00000001,
            AccuracyLevel            = 0x00000002,
            DurabilityLevel            = 0x00000004,
            Quality                    = 0x00000008,
            Hits                    = 0x00000010,
            MaxHits                    = 0x00000020,
            Slayer                    = 0x00000040,
            Poison                    = 0x00000080,
            PoisonCharges            = 0x00000100,
            Crafter                    = 0x00000200,
            Identified                = 0x00000400,
            StrReq                    = 0x00000800,
            DexReq                    = 0x00001000,
            IntReq                    = 0x00002000,
            MinDamage                = 0x00004000,
            MaxDamage                = 0x00008000,
            HitSound                = 0x00010000,
            MissSound                = 0x00020000,
            Speed                    = 0x00040000,
            MaxRange                = 0x00080000,
            Skill                    = 0x00100000,
            Type                    = 0x00200000,
            Animation                = 0x00400000,
            Resource                = 0x00800000,
            xAttributes                = 0x01000000,
            xWeaponAttributes        = 0x02000000,
            PlayerConstructed        = 0x04000000,
            SkillBonuses            = 0x08000000,
            Slayer2                    = 0x10000000,
            ElementalDamages        = 0x20000000
        }

        #region Mondain's Legacy        
        private static void SetSaveFlag( ref SetFlag flags, SetFlag toSet, bool setIf )
        {
            if ( setIf )
                flags |= toSet;
        }

        private static bool GetSaveFlag( SetFlag flags, SetFlag toGet )
        {
            return ( (flags & toGet) != 0 );
        }
        
        [Flags]
        private enum SetFlag
        {
            None                = 0x00000000,
            Attributes            = 0x00000001,
            WeaponAttributes    = 0x00000002,
            SkillBonuses        = 0x00000004,
            SetHue                = 0x00000008,
            LastEquipped        = 0x00000010,
            SetEquipped            = 0x00000020,
        }
        #endregion

        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

            int version = reader.ReadInt();

            switch ( version )
            {
                #region Mondain's Legacy
                case 9:
                m_EngravedText = reader.ReadString();
                {
                    SetFlag flags = (SetFlag) reader.ReadEncodedInt();
                    
                    if ( GetSaveFlag( flags, SetFlag.Attributes ) )
                        m_SetAttributes = new AosAttributes( this, reader );
                    else
                        m_SetAttributes = new AosAttributes( this );

                    if ( GetSaveFlag( flags, SetFlag.WeaponAttributes ) )
                        m_SetWeaponAttributes = new AosWeaponAttributes( this, reader );
                    else
                        m_SetWeaponAttributes = new AosWeaponAttributes( this );
                        
                    if ( GetSaveFlag( flags, SetFlag.SkillBonuses ) )
                        m_SetSkillBonuses = new AosSkillBonuses( this, reader );
                    else
                        m_SetSkillBonuses =  new AosSkillBonuses( this );
                        
                    if ( GetSaveFlag( flags, SetFlag.SetHue ) )
                        m_SetHue = reader.ReadInt();
                        
                    if ( GetSaveFlag( flags, SetFlag.LastEquipped ) )
                        m_LastEquipped = reader.ReadBool();
                        
                    if ( GetSaveFlag( flags, SetFlag.SetEquipped ) )
                        m_SetEquipped = reader.ReadBool();
                
                    goto case 8;
                }
                #endregion
                case 8:
                case 7:
                case 6:
                case 5:
                {
                    SaveFlag flags = (SaveFlag)reader.ReadInt();

                    if ( GetSaveFlag( flags, SaveFlag.DamageLevel ) )
                    {
                        m_DamageLevel = (WeaponDamageLevel)reader.ReadInt();

                        if ( m_DamageLevel > WeaponDamageLevel.Vanq )
                            m_DamageLevel = WeaponDamageLevel.Ruin;
                    }

                    if ( GetSaveFlag( flags, SaveFlag.AccuracyLevel ) )
                    {
                        m_AccuracyLevel = (WeaponAccuracyLevel)reader.ReadInt();

                        if ( m_AccuracyLevel > WeaponAccuracyLevel.Supremely )
                            m_AccuracyLevel = WeaponAccuracyLevel.Accurate;
                    }

                    if ( GetSaveFlag( flags, SaveFlag.DurabilityLevel ) )
                    {
                        m_DurabilityLevel = (WeaponDurabilityLevel)reader.ReadInt();

                        if ( m_DurabilityLevel > WeaponDurabilityLevel.Indestructible )
                            m_DurabilityLevel = WeaponDurabilityLevel.Durable;
                    }

                    if ( GetSaveFlag( flags, SaveFlag.Quality ) )
                        m_Quality = (WeaponQuality)reader.ReadInt();
                    else
                        m_Quality = WeaponQuality.Regular;

                    if ( GetSaveFlag( flags, SaveFlag.Hits ) )
                        m_Hits = reader.ReadInt();

                    if ( GetSaveFlag( flags, SaveFlag.MaxHits ) )
                        m_MaxHits = reader.ReadInt();

                    if ( GetSaveFlag( flags, SaveFlag.Slayer ) )
                        m_Slayer = (SlayerName)reader.ReadInt();

                    if ( GetSaveFlag( flags, SaveFlag.Poison ) )
                        m_Poison = Poison.Deserialize( reader );

                    if ( GetSaveFlag( flags, SaveFlag.PoisonCharges ) )
                        m_PoisonCharges = reader.ReadInt();

                    if ( GetSaveFlag( flags, SaveFlag.Crafter ) )
                        m_Crafter = reader.ReadMobile();

                    if ( GetSaveFlag( flags, SaveFlag.Identified ) )
                        m_Identified = ( version >= 6 || reader.ReadBool() );

                    if ( GetSaveFlag( flags, SaveFlag.StrReq ) )
                        m_StrReq = reader.ReadInt();
                    else
                        m_StrReq = -1;

                    if ( GetSaveFlag( flags, SaveFlag.DexReq ) )
                        m_DexReq = reader.ReadInt();
                    else
                        m_DexReq = -1;

                    if ( GetSaveFlag( flags, SaveFlag.IntReq ) )
                        m_IntReq = reader.ReadInt();
                    else
                        m_IntReq = -1;

                    if ( GetSaveFlag( flags, SaveFlag.MinDamage ) )
                        m_MinDamage = reader.ReadInt();
                    else
                        m_MinDamage = -1;

                    if ( GetSaveFlag( flags, SaveFlag.MaxDamage ) )
                        m_MaxDamage = reader.ReadInt();
                    else
                        m_MaxDamage = -1;

                    if ( GetSaveFlag( flags, SaveFlag.HitSound ) )
                        m_HitSound = reader.ReadInt();
                    else
                        m_HitSound = -1;

                    if ( GetSaveFlag( flags, SaveFlag.MissSound ) )
                        m_MissSound = reader.ReadInt();
                    else
                        m_MissSound = -1;

                    if ( GetSaveFlag( flags, SaveFlag.Speed ) )
                        m_Speed = reader.ReadInt();
                    else
                        m_Speed = -1;

                    if ( GetSaveFlag( flags, SaveFlag.MaxRange ) )
                        m_MaxRange = reader.ReadInt();
                    else
                        m_MaxRange = -1;

                    if ( GetSaveFlag( flags, SaveFlag.Skill ) )
                        m_Skill = (SkillName)reader.ReadInt();
                    else
                        m_Skill = (SkillName)(-1);

                    if ( GetSaveFlag( flags, SaveFlag.Type ) )
                        m_Type = (WeaponType)reader.ReadInt();
                    else
                        m_Type = (WeaponType)(-1);

                    if ( GetSaveFlag( flags, SaveFlag.Animation ) )
                        m_Animation = (WeaponAnimation)reader.ReadInt();
                    else
                        m_Animation = (WeaponAnimation)(-1);

                    if ( GetSaveFlag( flags, SaveFlag.Resource ) )
                        m_Resource = (CraftResource)reader.ReadInt();
                    else
                        m_Resource = CraftResource.Iron;

                    if ( GetSaveFlag( flags, SaveFlag.xAttributes ) )
                        m_AosAttributes = new AosAttributes( this, reader );
                    else
                        m_AosAttributes = new AosAttributes( this );

                    if ( GetSaveFlag( flags, SaveFlag.xWeaponAttributes ) )
                        m_AosWeaponAttributes = new AosWeaponAttributes( this, reader );
                    else
                        m_AosWeaponAttributes = new AosWeaponAttributes( this );

                    if ( UseSkillMod && m_AccuracyLevel != WeaponAccuracyLevel.Regular && Parent is Mobile )
                    {
                        m_SkillMod = new DefaultSkillMod( AccuracySkill, true, (int)m_AccuracyLevel * 5 );
                        ((Mobile)Parent).AddSkillMod( m_SkillMod );
                    }

                    if ( version < 7 && m_AosWeaponAttributes.MageWeapon != 0 )
                        m_AosWeaponAttributes.MageWeapon = 30 - m_AosWeaponAttributes.MageWeapon;

                    if ( Core.AOS && m_AosWeaponAttributes.MageWeapon != 0 && m_AosWeaponAttributes.MageWeapon != 30 && Parent is Mobile )
                    {
                        m_MageMod = new DefaultSkillMod( SkillName.Magery, true, -30 + m_AosWeaponAttributes.MageWeapon );
                        ((Mobile)Parent).AddSkillMod( m_MageMod );
                    }

                    if ( GetSaveFlag( flags, SaveFlag.PlayerConstructed ) )
                        m_PlayerConstructed = true;

                    if( GetSaveFlag( flags, SaveFlag.SkillBonuses ) )
                        m_AosSkillBonuses = new AosSkillBonuses( this, reader );
                    else
                        m_AosSkillBonuses = new AosSkillBonuses( this );

                    if( GetSaveFlag( flags, SaveFlag.Slayer2 ) )
                        m_Slayer2 = (SlayerName)reader.ReadInt();

                    if( GetSaveFlag( flags, SaveFlag.ElementalDamages ) )
                        m_AosElementDamages = new AosElementAttributes( this, reader );
                    else
                        m_AosElementDamages = new AosElementAttributes( this );

                    break;
                }
                case 4:
                {
                    m_Slayer = (SlayerName)reader.ReadInt();

                    goto case 3;
                }
                case 3:
                {
                    m_StrReq = reader.ReadInt();
                    m_DexReq = reader.ReadInt();
                    m_IntReq = reader.ReadInt();

                    goto case 2;
                }
                case 2:
                {
                    m_Identified = reader.ReadBool();

                    goto case 1;
                }
                case 1:
                {
                    m_MaxRange = reader.ReadInt();

                    goto case 0;
                }
                case 0:
                {
                    if ( version == 0 )
                        m_MaxRange = 1; // default

                    if ( version < 5 )
                    {
                        m_Resource = CraftResource.Iron;
                        m_AosAttributes = new AosAttributes( this );
                        m_AosWeaponAttributes = new AosWeaponAttributes( this );
                        m_AosElementDamages = new AosElementAttributes( this );
                        m_AosSkillBonuses = new AosSkillBonuses( this );
                    }

                    m_MinDamage = reader.ReadInt();
                    m_MaxDamage = reader.ReadInt();

                    m_Speed = reader.ReadInt();

                    m_HitSound = reader.ReadInt();
                    m_MissSound = reader.ReadInt();

                    m_Skill = (SkillName)reader.ReadInt();
                    m_Type = (WeaponType)reader.ReadInt();
                    m_Animation = (WeaponAnimation)reader.ReadInt();
                    m_DamageLevel = (WeaponDamageLevel)reader.ReadInt();
                    m_AccuracyLevel = (WeaponAccuracyLevel)reader.ReadInt();
                    m_DurabilityLevel = (WeaponDurabilityLevel)reader.ReadInt();
                    m_Quality = (WeaponQuality)reader.ReadInt();

                    m_Crafter = reader.ReadMobile();

                    m_Poison = Poison.Deserialize( reader );
                    m_PoisonCharges = reader.ReadInt();

                    if ( m_StrReq == OldStrengthReq )
                        m_StrReq = -1;

                    if ( m_DexReq == OldDexterityReq )
                        m_DexReq = -1;

                    if ( m_IntReq == OldIntelligenceReq )
                        m_IntReq = -1;

                    if ( m_MinDamage == OldMinDamage )
                        m_MinDamage = -1;

                    if ( m_MaxDamage == OldMaxDamage )
                        m_MaxDamage = -1;

                    if ( m_HitSound == OldHitSound )
                        m_HitSound = -1;

                    if ( m_MissSound == OldMissSound )
                        m_MissSound = -1;

                    if ( m_Speed == OldSpeed )
                        m_Speed = -1;

                    if ( m_MaxRange == OldMaxRange )
                        m_MaxRange = -1;

                    if ( m_Skill == OldSkill )
                        m_Skill = (SkillName)(-1);

                    if ( m_Type == OldType )
                        m_Type = (WeaponType)(-1);

                    if ( m_Animation == OldAnimation )
                        m_Animation = (WeaponAnimation)(-1);

                    if ( UseSkillMod && m_AccuracyLevel != WeaponAccuracyLevel.Regular && Parent is Mobile )
                    {
                        m_SkillMod = new DefaultSkillMod( AccuracySkill, true, (int)m_AccuracyLevel * 5);
                        ((Mobile)Parent).AddSkillMod( m_SkillMod );
                    }

                    break;
                }
            }

            #region Mondain's Legacy
            if ( m_SetAttributes == null )
                m_SetAttributes = new AosAttributes( this );
    
            if ( m_SetWeaponAttributes == null )
                m_SetWeaponAttributes = new AosWeaponAttributes( this );
                
            if ( m_SetSkillBonuses == null )
                m_SetSkillBonuses =  new AosSkillBonuses( this );    
            #endregion

            if ( Core.AOS && Parent is Mobile )
                m_AosSkillBonuses.AddTo( (Mobile)Parent );

            int strBonus = m_AosAttributes.BonusStr;
            int dexBonus = m_AosAttributes.BonusDex;
            int intBonus = m_AosAttributes.BonusInt;

            if ( this.Parent is Mobile && (strBonus != 0 || dexBonus != 0 || intBonus != 0) )
            {
                Mobile m = (Mobile)this.Parent;

                string modName = this.Serial.ToString();

                if ( strBonus != 0 )
                    m.AddStatMod( new StatMod( StatType.Str, modName + "Str", strBonus, TimeSpan.Zero ) );

                if ( dexBonus != 0 )
                    m.AddStatMod( new StatMod( StatType.Dex, modName + "Dex", dexBonus, TimeSpan.Zero ) );

                if ( intBonus != 0 )
                    m.AddStatMod( new StatMod( StatType.Int, modName + "Int", intBonus, TimeSpan.Zero ) );
            }

            if ( Parent is Mobile )
                ((Mobile)Parent).CheckStatTimers();

            if ( m_Hits <= 0 && m_MaxHits <= 0 )
            {
                m_Hits = m_MaxHits = Utility.RandomMinMax( InitMinHits, InitMaxHits );
            }

            if ( version < 6 )
                m_PlayerConstructed = true; // we don't know, so, assume it's crafted
        }
        #endregion

        public BaseWeapon( int itemID ) : base( itemID )
        {
            Layer = (Layer)ItemData.Quality;

            m_Quality = WeaponQuality.Regular;
            m_StrReq = -1;
            m_DexReq = -1;
            m_IntReq = -1;
            m_MinDamage = -1;
            m_MaxDamage = -1;
            m_HitSound = -1;
            m_MissSound = -1;
            m_Speed = -1;
            m_MaxRange = -1;
            m_Skill = (SkillName)(-1);
            m_Type = (WeaponType)(-1);
            m_Animation = (WeaponAnimation)(-1);

            m_Hits = m_MaxHits = Utility.RandomMinMax( InitMinHits, InitMaxHits );

            m_Resource = CraftResource.Iron;

            m_AosAttributes = new AosAttributes( this );
            m_AosWeaponAttributes = new AosWeaponAttributes( this );
            m_AosSkillBonuses = new AosSkillBonuses( this );
            m_AosElementDamages = new AosElementAttributes( this );
            
            #region Mondain's Legacy
            m_SetAttributes = new AosAttributes( this );
            m_SetWeaponAttributes = new AosWeaponAttributes( this );
            m_SetSkillBonuses = new AosSkillBonuses( this );
            
            m_LastEquipped = false;
            #endregion
        }

        public BaseWeapon( Serial serial ) : base( serial )
        {
        }

        private string GetNameString()
        {
            string name = this.Name;

            if ( name == null )
                name = String.Format( "#{0}", LabelNumber );

            return name;
        }

        [Hue, CommandProperty( AccessLevel.GameMaster )]
        public override int Hue
        {
            get{ return base.Hue; }
            set{ base.Hue = value; InvalidateProperties(); }
        }

        public int GetElementalDamageHue()
        {
            int phys, fire, cold, pois, nrgy;
            GetDamageTypes( null, out phys, out fire, out cold, out pois, out nrgy );
            //Order is Cold, Energy, Fire, Poison, Physical left

            int currentMax = 50;
            int hue = 0;

            if( pois >= currentMax )
            {
                hue = 1267 + (pois - 50) / 10;
                currentMax = pois;
            }

            if( fire >= currentMax )
            {
                hue = 1255 + (fire - 50) / 10;
                currentMax = fire;
            }

            if( nrgy >= currentMax )
            {
                hue = 1273 + (nrgy - 50) / 10;
                currentMax = nrgy;
            }

            if( cold >= currentMax )
            {
                hue = 1261 + (cold - 50) / 10;
                currentMax = cold;
            }

            return hue;
        }

        public override void AddNameProperty( ObjectPropertyList list )
        {
            int oreType;

            switch ( m_Resource )
            {
                case CraftResource.DullCopper:        oreType = 1053108; break; // dull copper
                case CraftResource.ShadowIron:        oreType = 1053107; break; // shadow iron
                case CraftResource.Copper:            oreType = 1053106; break; // copper
                case CraftResource.Bronze:            oreType = 1053105; break; // bronze
                case CraftResource.Gold:            oreType = 1053104; break; // golden
                case CraftResource.Agapite:            oreType = 1053103; break; // agapite
                case CraftResource.Verite:            oreType = 1053102; break; // verite
                case CraftResource.Valorite:        oreType = 1053101; break; // valorite
                case CraftResource.SpinedLeather:    oreType = 1061118; break; // spined
                case CraftResource.HornedLeather:    oreType = 1061117; break; // horned
                case CraftResource.BarbedLeather:    oreType = 1061116; break; // barbed
                case CraftResource.RedScales:        oreType = 1060814; break; // red
                case CraftResource.YellowScales:    oreType = 1060818; break; // yellow
                case CraftResource.BlackScales:        oreType = 1060820; break; // black
                case CraftResource.GreenScales:        oreType = 1060819; break; // green
                case CraftResource.WhiteScales:        oreType = 1060821; break; // white
                case CraftResource.BlueScales:        oreType = 1060815; break; // blue
                
                #region Mondain's Legacy
                case CraftResource.OakWood:            oreType = 1072533; break; // oak
                case CraftResource.AshWood:            oreType = 1072534; break; // ash
                case CraftResource.YewWood:            oreType = 1072535; break; // yew
                case CraftResource.Heartwood:        oreType = 1072536; break; // heartwood
                case CraftResource.Bloodwood:        oreType = 1072538; break; // bloodwood
                case CraftResource.Frostwood:        oreType = 1072539; break; // frostwood
                #endregion
                
                default: oreType = 0; break;
            }

            if ( oreType != 0 )
                list.Add( 1053099, "#{0}\t{1}", oreType, GetNameString() ); // ~1_oretype~ ~2_armortype~
            else if ( Name == null )
                list.Add( LabelNumber );
            else
                list.Add( Name );
                
            #region Veteran Rewards
            if ( !String.IsNullOrEmpty( m_EngravedText ) )
                list.Add( 1062613, m_EngravedText );
            #endregion
        }

        public override bool AllowEquipedCast( Mobile from )
        {
            if ( base.AllowEquipedCast( from ) )
                return true;

            return ( m_AosAttributes.SpellChanneling != 0 );
        }

        public virtual int ArtifactRarity
        {
            get{ return 0; }
        }

        public virtual int GetLuckBonus()
        {
            #region Mondain's Legacy
            if ( m_Resource == CraftResource.Heartwood )
                return 0;
            #endregion
        
            CraftResourceInfo resInfo = CraftResources.GetInfo( m_Resource );

            if ( resInfo == null )
                return 0;

            CraftAttributeInfo attrInfo = resInfo.AttributeInfo;

            if ( attrInfo == null )
                return 0;

            return attrInfo.WeaponLuck;
        }

        public override void GetProperties( ObjectPropertyList list )
        {
            base.GetProperties( list );

            if ( m_Crafter != null )
                list.Add( 1050043, m_Crafter.Name ); // crafted by ~1_NAME~

            #region Factions
            if ( m_FactionState != null )
                list.Add( 1041350 ); // faction item
            #endregion

            #region Mondain's Legacy
            if ( IsSetItem )
            {
                // always mixed
                list.Add( 1073491, Pieces.ToString() ); // Part of a Weapon/Armor Set (~1_val~ pieces)
                    
                if ( m_SetEquipped )
                {
                    list.Add( 1073492 ); // Full Weapon/Armor Set Present
                
                    GetSetProperties( list );
                }
            }
            #endregion

            if ( m_AosSkillBonuses != null )
                m_AosSkillBonuses.GetProperties( list );

            if ( m_Quality == WeaponQuality.Exceptional )
                list.Add( 1060636 ); // exceptional

            if( RequiredRace == Race.Elf )
                list.Add( 1075086 ); // Elves Only

            if ( ArtifactRarity > 0 )
                list.Add( 1061078, ArtifactRarity.ToString() ); // artifact rarity ~1_val~

            if ( this is IUsesRemaining && ((IUsesRemaining)this).ShowUsesRemaining )
                list.Add( 1060584, ((IUsesRemaining)this).UsesRemaining.ToString() ); // uses remaining: ~1_val~

            if ( m_Poison != null && m_PoisonCharges > 0 )
            {
                
                if ( m_Poison == Poison.GetPoison( "Darkglow" ) )
                    list.Add( 1072853, m_PoisonCharges.ToString() ); // darkglow poison charges: ~1_val~
                else if ( m_Poison == Poison.GetPoison( "Parasitic" ) )
                    list.Add( 1072852, m_PoisonCharges.ToString() ); // parasitic poison charges: ~1_val~
                else
                list.Add( 1062412 + m_Poison.Level, m_PoisonCharges.ToString() );
            }

            if( m_Slayer != SlayerName.None )
            {
                SlayerEntry entry = SlayerGroup.GetEntryByName( m_Slayer );
                if( entry != null )
                    list.Add( entry.Title );
            }

            if( m_Slayer2 != SlayerName.None )
            {
                SlayerEntry entry = SlayerGroup.GetEntryByName( m_Slayer2 );
                if( entry != null )
                    list.Add( entry.Title );
            }


            base.AddResistanceProperties( list );

            int prop;

            if ( (prop = m_AosWeaponAttributes.UseBestSkill) != 0 )
                list.Add( 1060400 ); // use best weapon skill

            if ( (prop = (GetDamageBonus() + m_AosAttributes.WeaponDamage)) != 0 )
                list.Add( 1060401, prop.ToString() ); // damage increase ~1_val~%

            if ( (prop = m_AosAttributes.DefendChance) != 0 )
                list.Add( 1060408, prop.ToString() ); // defense chance increase ~1_val~%

            if ( (prop = m_AosAttributes.EnhancePotions) != 0 )
                list.Add( 1060411, prop.ToString() ); // enhance potions ~1_val~%

            if ( (prop = m_AosAttributes.CastRecovery) != 0 )
                list.Add( 1060412, prop.ToString() ); // faster cast recovery ~1_val~

            if ( (prop = m_AosAttributes.CastSpeed) != 0 )
                list.Add( 1060413, prop.ToString() ); // faster casting ~1_val~

            if ( (prop = (GetHitChanceBonus() + m_AosAttributes.AttackChance)) != 0 )
                list.Add( 1060415, prop.ToString() ); // hit chance increase ~1_val~%

            if ( (prop = m_AosWeaponAttributes.HitColdArea) != 0 )
                list.Add( 1060416, prop.ToString() ); // hit cold area ~1_val~%

            if ( (prop = m_AosWeaponAttributes.HitDispel) != 0 )
                list.Add( 1060417, prop.ToString() ); // hit dispel ~1_val~%

            if ( (prop = m_AosWeaponAttributes.HitEnergyArea) != 0 )
                list.Add( 1060418, prop.ToString() ); // hit energy area ~1_val~%

            if ( (prop = m_AosWeaponAttributes.HitFireArea) != 0 )
                list.Add( 1060419, prop.ToString() ); // hit fire area ~1_val~%

            if ( (prop = m_AosWeaponAttributes.HitFireball) != 0 )
                list.Add( 1060420, prop.ToString() ); // hit fireball ~1_val~%

            if ( (prop = m_AosWeaponAttributes.HitHarm) != 0 )
                list.Add( 1060421, prop.ToString() ); // hit harm ~1_val~%

            if ( (prop = m_AosWeaponAttributes.HitLeechHits) != 0 )
                list.Add( 1060422, prop.ToString() ); // hit life leech ~1_val~%

            if ( (prop = m_AosWeaponAttributes.HitLightning) != 0 )
                list.Add( 1060423, prop.ToString() ); // hit lightning ~1_val~%

            if ( (prop = m_AosWeaponAttributes.HitLowerAttack) != 0 )
                list.Add( 1060424, prop.ToString() ); // hit lower attack ~1_val~%

            if ( (prop = m_AosWeaponAttributes.HitLowerDefend) != 0 )
                list.Add( 1060425, prop.ToString() ); // hit lower defense ~1_val~%

            if ( (prop = m_AosWeaponAttributes.HitMagicArrow) != 0 )
                list.Add( 1060426, prop.ToString() ); // hit magic arrow ~1_val~%

            if ( (prop = m_AosWeaponAttributes.HitLeechMana) != 0 )
                list.Add( 1060427, prop.ToString() ); // hit mana leech ~1_val~%

            if ( (prop = m_AosWeaponAttributes.HitPhysicalArea) != 0 )
                list.Add( 1060428, prop.ToString() ); // hit physical area ~1_val~%

            if ( (prop = m_AosWeaponAttributes.HitPoisonArea) != 0 )
                list.Add( 1060429, prop.ToString() ); // hit poison area ~1_val~%

            if ( (prop = m_AosWeaponAttributes.HitLeechStam) != 0 )
                list.Add( 1060430, prop.ToString() ); // hit stamina leech ~1_val~%

            if ( (prop = m_AosAttributes.BonusDex) != 0 )
                list.Add( 1060409, prop.ToString() ); // dexterity bonus ~1_val~

            if ( (prop = m_AosAttributes.BonusHits) != 0 )
                list.Add( 1060431, prop.ToString() ); // hit point increase ~1_val~

            if ( (prop = m_AosAttributes.BonusInt) != 0 )
                list.Add( 1060432, prop.ToString() ); // intelligence bonus ~1_val~

            if ( (prop = m_AosAttributes.LowerManaCost) != 0 )
                list.Add( 1060433, prop.ToString() ); // lower mana cost ~1_val~%

            if ( (prop = m_AosAttributes.LowerRegCost) != 0 )
                list.Add( 1060434, prop.ToString() ); // lower reagent cost ~1_val~%

            if ( (prop = GetLowerStatReq()) != 0 )
                list.Add( 1060435, prop.ToString() ); // lower requirements ~1_val~%

            if ( (prop = (GetLuckBonus() + m_AosAttributes.Luck)) != 0 )
                list.Add( 1060436, prop.ToString() ); // luck ~1_val~

            if ( (prop = m_AosWeaponAttributes.MageWeapon) != 0 )
                list.Add( 1060438, (30 - prop).ToString() ); // mage weapon -~1_val~ skill

            if ( (prop = m_AosAttributes.BonusMana) != 0 )
                list.Add( 1060439, prop.ToString() ); // mana increase ~1_val~

            if ( (prop = m_AosAttributes.RegenMana) != 0 )
                list.Add( 1060440, prop.ToString() ); // mana regeneration ~1_val~

            if ( (prop = m_AosAttributes.NightSight) != 0 )
                list.Add( 1060441 ); // night sight

            if ( (prop = m_AosAttributes.ReflectPhysical) != 0 )
                list.Add( 1060442, prop.ToString() ); // reflect physical damage ~1_val~%

            if ( (prop = m_AosAttributes.RegenStam) != 0 )
                list.Add( 1060443, prop.ToString() ); // stamina regeneration ~1_val~

            if ( (prop = m_AosAttributes.RegenHits) != 0 )
                list.Add( 1060444, prop.ToString() ); // hit point regeneration ~1_val~

            if ( (prop = m_AosWeaponAttributes.SelfRepair) != 0 )
                list.Add( 1060450, prop.ToString() ); // self repair ~1_val~

            if ( (prop = m_AosAttributes.SpellChanneling) != 0 )
                list.Add( 1060482 ); // spell channeling

            if ( (prop = m_AosAttributes.SpellDamage) != 0 )
                list.Add( 1060483, prop.ToString() ); // spell damage increase ~1_val~%

            if ( (prop = m_AosAttributes.BonusStam) != 0 )
                list.Add( 1060484, prop.ToString() ); // stamina increase ~1_val~

            if ( (prop = m_AosAttributes.BonusStr) != 0 )
                list.Add( 1060485, prop.ToString() ); // strength bonus ~1_val~

            if ( (prop = m_AosAttributes.WeaponSpeed) != 0 )
                list.Add( 1060486, prop.ToString() ); // swing speed increase ~1_val~%

            int phys, fire, cold, pois, nrgy, chaos, direct;

            GetDamageTypes( null, out phys, out fire, out cold, out pois, out nrgy, out chaos, out direct );

            #region Mondain's Legacy
            if ( chaos != 0 )
                list.Add( 1072846, chaos.ToString() ); // chaos damage ~1_val~%
            
            if ( direct != 0 )
                list.Add( 1079978, direct.ToString() ); // Direct Damage: ~1_PERCENT~%
            #endregion

            if ( phys != 0 )
                list.Add( 1060403, phys.ToString() ); // physical damage ~1_val~%

            if ( fire != 0 )
                list.Add( 1060405, fire.ToString() ); // fire damage ~1_val~%

            if ( cold != 0 )
                list.Add( 1060404, cold.ToString() ); // cold damage ~1_val~%

            if ( pois != 0 )
                list.Add( 1060406, pois.ToString() ); // poison damage ~1_val~%

            if ( nrgy != 0 )
                list.Add( 1060407, nrgy.ToString() ); // energy damage ~1_val~%

            list.Add( 1061168, "{0}\t{1}", MinDamage.ToString(), MaxDamage.ToString() ); // weapon damage ~1_val~ - ~2_val~
            list.Add( 1061167, Speed.ToString() ); // weapon speed ~1_val~

            if ( MaxRange > 1 )
                list.Add( 1061169, MaxRange.ToString() ); // range ~1_val~

            int strReq = AOS.Scale( StrRequirement, 100 - GetLowerStatReq() );

            if ( strReq > 0 )
                list.Add( 1061170, strReq.ToString() ); // strength requirement ~1_val~

            if ( Layer == Layer.TwoHanded )
                list.Add( 1061171 ); // two-handed weapon
            else
                list.Add( 1061824 ); // one-handed weapon

            if ( Core.SE || m_AosWeaponAttributes.UseBestSkill == 0 )
            {
                switch ( Skill )
                {
                    case SkillName.Swords:  list.Add( 1061172 ); break; // skill required: swordsmanship
                    case SkillName.Macing:  list.Add( 1061173 ); break; // skill required: mace fighting
                    case SkillName.Fencing: list.Add( 1061174 ); break; // skill required: fencing
                    case SkillName.Archery: list.Add( 1061175 ); break; // skill required: archery
                }
            }

            if ( m_Hits >= 0 && m_MaxHits > 0 )
                list.Add( 1060639, "{0}\t{1}", m_Hits, m_MaxHits ); // durability ~1_val~ / ~2_val~
                
            #region Mondain's Legacy
            if ( IsSetItem && !m_SetEquipped )
            {
                list.Add( 1072378 ); // <br>Only when full set is present:
                
                GetSetProperties( list );
            }
            #endregion
        }

        public override void OnSingleClick( Mobile from )
        {
            List<EquipInfoAttribute> attrs = new List<EquipInfoAttribute>();

            if ( DisplayLootType )
            {
                if ( LootType == LootType.Blessed )
                    attrs.Add( new EquipInfoAttribute( 1038021 ) ); // blessed
                else if ( LootType == LootType.Cursed )
                    attrs.Add( new EquipInfoAttribute( 1049643 ) ); // cursed
            }

            #region Factions
            if ( m_FactionState != null )
                attrs.Add( new EquipInfoAttribute( 1041350 ) ); // faction item
            #endregion

            if ( m_Quality == WeaponQuality.Exceptional )
                attrs.Add( new EquipInfoAttribute( 1018305 - (int)m_Quality ) );

            if ( m_Identified || from.AccessLevel >= AccessLevel.GameMaster )
            {
                if( m_Slayer != SlayerName.None )
                {
                    SlayerEntry entry = SlayerGroup.GetEntryByName( m_Slayer );
                    if( entry != null )
                        attrs.Add( new EquipInfoAttribute( entry.Title ) );
                }

                if( m_Slayer2 != SlayerName.None )
                {
                    SlayerEntry entry = SlayerGroup.GetEntryByName( m_Slayer2 );
                    if( entry != null )
                        attrs.Add( new EquipInfoAttribute( entry.Title ) );
                }

                if ( m_DurabilityLevel != WeaponDurabilityLevel.Regular )
                    attrs.Add( new EquipInfoAttribute( 1038000 + (int)m_DurabilityLevel ) );

                if ( m_DamageLevel != WeaponDamageLevel.Regular )
                    attrs.Add( new EquipInfoAttribute( 1038015 + (int)m_DamageLevel ) );

                if ( m_AccuracyLevel != WeaponAccuracyLevel.Regular )
                    attrs.Add( new EquipInfoAttribute( 1038010 + (int)m_AccuracyLevel ) );
            }
            else if( m_Slayer != SlayerName.None || m_Slayer2 != SlayerName.None || m_DurabilityLevel != WeaponDurabilityLevel.Regular || m_DamageLevel != WeaponDamageLevel.Regular || m_AccuracyLevel != WeaponAccuracyLevel.Regular )
                attrs.Add( new EquipInfoAttribute( 1038000 ) ); // Unidentified

            if ( m_Poison != null && m_PoisonCharges > 0 )
                attrs.Add( new EquipInfoAttribute( 1017383, m_PoisonCharges ) );

            int number;

            if ( Name == null )
            {
                number = LabelNumber;
            }
            else
            {
                this.LabelTo( from, Name );
                number = 1041000;
            }

            if ( attrs.Count == 0 && Crafter == null && Name != null )
                return;

            EquipmentInfo eqInfo = new EquipmentInfo( number, m_Crafter, false, attrs.ToArray() );

            from.Send( new DisplayEquipmentInfo( this, eqInfo ) );
        }

        private static BaseWeapon m_Fists; // This value holds the default--fist--weapon

        public static BaseWeapon Fists
        {
            get{ return m_Fists; }
            set{ m_Fists = value; }
        }

        #region ICraftable Members

        public virtual int OnCraft( int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CraftItem craftItem, int resHue )
        {
            Quality = (WeaponQuality)quality;

            if ( makersMark )
                Crafter = from;

            PlayerConstructed = true;

            Type resourceType = typeRes;

            if ( resourceType == null )
                resourceType = craftItem.Ressources.GetAt( 0 ).ItemType;

            if ( Core.AOS )
            {
                Resource = CraftResources.GetFromType( resourceType );

                CraftContext context = craftSystem.GetContext( from );

                if ( context != null && context.DoNotColor )
                    Hue = 0;

                // Mondain's Legacy Mod
                if ( craftItem != null && !craftItem.ForceNonExceptional )
                {
                    if ( tool is BaseRunicTool )
                        ((BaseRunicTool)tool).ApplyAttributesTo( this );
                }

                if ( Quality == WeaponQuality.Exceptional )
                {
                    if ( Attributes.WeaponDamage > 35 )
                        Attributes.WeaponDamage -= 20;
                    else
                        Attributes.WeaponDamage = 15;

                    if( Core.ML )
                    {
                        Attributes.WeaponDamage += (int)(from.Skills.ArmsLore.Value / 20);
                        from.CheckSkill( SkillName.ArmsLore, 0, 100 );
                    }
                }
            }
            else if ( tool is BaseRunicTool )
            {
                // Mondain's Legacy Mod
                if ( craftItem != null && !craftItem.ForceNonExceptional )
                {
                    CraftResource thisResource = CraftResources.GetFromType( resourceType );
    
                    if ( thisResource == ((BaseRunicTool)tool).Resource )
                    {
                        Resource = thisResource;
    
                        CraftContext context = craftSystem.GetContext( from );
    
                        if ( context != null && context.DoNotColor )
                            Hue = 0;
    
                        switch ( thisResource )
                        {
                            case CraftResource.DullCopper:
                            {
                                Identified = true;
                                DurabilityLevel = WeaponDurabilityLevel.Durable;
                                AccuracyLevel = WeaponAccuracyLevel.Accurate;
                                break;
                            }
                            case CraftResource.ShadowIron:
                            {
                                Identified = true;
                                DurabilityLevel = WeaponDurabilityLevel.Durable;
                                DamageLevel = WeaponDamageLevel.Ruin;
                                break;
                            }
                            case CraftResource.Copper:
                            {
                                Identified = true;
                                DurabilityLevel = WeaponDurabilityLevel.Fortified;
                                DamageLevel = WeaponDamageLevel.Ruin;
                                AccuracyLevel = WeaponAccuracyLevel.Surpassingly;
                                break;
                            }
                            case CraftResource.Bronze:
                            {
                                Identified = true;
                                DurabilityLevel = WeaponDurabilityLevel.Fortified;
                                DamageLevel = WeaponDamageLevel.Might;
                                AccuracyLevel = WeaponAccuracyLevel.Surpassingly;
                                break;
                            }
                            case CraftResource.Gold:
                            {
                                Identified = true;
                                DurabilityLevel = WeaponDurabilityLevel.Indestructible;
                                DamageLevel = WeaponDamageLevel.Force;
                                AccuracyLevel = WeaponAccuracyLevel.Eminently;
                                break;
                            }
                            case CraftResource.Agapite:
                            {
                                Identified = true;
                                DurabilityLevel = WeaponDurabilityLevel.Indestructible;
                                DamageLevel = WeaponDamageLevel.Power;
                                AccuracyLevel = WeaponAccuracyLevel.Eminently;
                                break;
                            }
                            case CraftResource.Verite:
                            {
                                Identified = true;
                                DurabilityLevel = WeaponDurabilityLevel.Indestructible;
                                DamageLevel = WeaponDamageLevel.Power;
                                AccuracyLevel = WeaponAccuracyLevel.Exceedingly;
                                break;
                            }
                            case CraftResource.Valorite:
                            {
                                Identified = true;
                                DurabilityLevel = WeaponDurabilityLevel.Indestructible;
                                DamageLevel = WeaponDamageLevel.Vanq;
                                AccuracyLevel = WeaponAccuracyLevel.Supremely;
                                break;
                            }
                        }
                    }
                }
            }

            #region Mondain's Legacy                
            if ( craftItem != null && !craftItem.ForceNonExceptional )
            {
                CraftResourceInfo resInfo = CraftResources.GetInfo( m_Resource );
    
                if ( resInfo == null )
                return quality;
    
                CraftAttributeInfo attrInfo = resInfo.AttributeInfo;
    
                if ( attrInfo == null )
                    return quality;        
                    
                if ( m_Resource != CraftResource.Heartwood )
                {
                    m_AosAttributes.WeaponDamage += attrInfo.WeaponDamage;
                    m_AosAttributes.WeaponSpeed += attrInfo.WeaponSwingSpeed;
                    m_AosAttributes.AttackChance += attrInfo.WeaponHitChance;
                    m_AosAttributes.RegenHits += attrInfo.WeaponRegenHits;            
                    m_AosWeaponAttributes.HitLeechHits += attrInfo.WeaponHitLifeLeech;
                }
                else
                {
                    switch ( Utility.Random( 6 ) )
                    {
                        case 0: m_AosAttributes.WeaponDamage += attrInfo.WeaponDamage; break;
                        case 1: m_AosAttributes.WeaponSpeed += attrInfo.WeaponSwingSpeed; break;
                        case 2: m_AosAttributes.AttackChance += attrInfo.WeaponHitChance; break;
                        case 3: m_AosAttributes.Luck += attrInfo.WeaponLuck; break;
                        case 4: m_AosWeaponAttributes.LowerStatReq += attrInfo.WeaponLowerRequirements; break;
                        case 5: m_AosWeaponAttributes.HitLeechHits += attrInfo.WeaponHitLifeLeech; break;
                    }
                }
            }
            #endregion

            return quality;
        }

        #endregion
        
        #region Mondain's Legacy Set Armor
        public override bool OnDragLift( Mobile from )
        {
            if ( Parent is Mobile && from == Parent )
            {
                Mobile m = (Mobile) Parent;
                
                if ( IsSetItem ? m_SetEquipped : false )
                    SetHelper.RemoveSetBonus( from, SetID, this );            
            }
            
            return base.OnDragLift( from );
        }
        
        public virtual SetItem SetID{ get{ return SetItem.None; } }
        public virtual int Pieces{ get{ return 0; } }
                
        public bool IsSetItem{ get{ return SetID == SetItem.None ? false : true; } }
        
        private int m_SetHue;
        private bool m_SetEquipped;
        private bool m_LastEquipped;
        
        [CommandProperty( AccessLevel.GameMaster )]
        public int SetHue
        {
            get{ return m_SetHue; }
            set{ m_SetHue = value; InvalidateProperties(); }
        }
        
        public bool SetEquipped
        {
            get{ return m_SetEquipped; }
            set{ m_SetEquipped = value; }
        }
        
        public bool LastEquipped
        {
            get{ return m_LastEquipped; }
            set{ m_LastEquipped = value; }
        }        
        
        private AosAttributes m_SetAttributes;
        private AosWeaponAttributes m_SetWeaponAttributes;
        private AosSkillBonuses m_SetSkillBonuses;
        
        [CommandProperty( AccessLevel.GameMaster )]
        public AosAttributes SetAttributes
        {
            get{ return m_SetAttributes; }
            set{}
        }

        [CommandProperty( AccessLevel.GameMaster )]
        public AosWeaponAttributes SetWeaponAttributes
        {
            get{ return m_SetWeaponAttributes; }
            set{}
        }

        [CommandProperty( AccessLevel.GameMaster )]
        public AosSkillBonuses SetSkillBonuses
        {
            get{ return m_SetSkillBonuses; }
            set{}
        }    
        
        public virtual void GetSetProperties( ObjectPropertyList list )
        {                        
            int prop;
            
            if ( !SetEquipped )    
            {
                if ( (prop = m_SetWeaponAttributes.ResistPhysicalBonus) != 0 )
                    list.Add( 1072382, prop.ToString() ); // physical resist +~1_val~%
                    
                if ( (prop = m_SetWeaponAttributes.ResistFireBonus) != 0 )
                    list.Add( 1072383, prop.ToString() ); // fire resist +~1_val~%
                    
                if ( (prop = m_SetWeaponAttributes.ResistColdBonus) != 0 )
                    list.Add( 1072384, prop.ToString() ); // cold resist +~1_val~%
                    
                if ( (prop = m_SetWeaponAttributes.ResistPoisonBonus) != 0 )
                    list.Add( 1072385, prop.ToString() ); // poison resist +~1_val~%
                    
                if ( (prop = m_SetWeaponAttributes.ResistEnergyBonus) != 0 )
                    list.Add( 1072386, prop.ToString() ); // energy resist +~1_val~%                
            }                        
    
            if ( (prop = m_SetWeaponAttributes.UseBestSkill) != 0 && WeaponAttributes.UseBestSkill == 0 )
                list.Add( 1060400 ); // use best weapon skill
                
            if ( (prop = m_SetWeaponAttributes.DurabilityBonus) != 0 && GetDurabilityBonus() == 0 )
                list.Add( 1060410, prop.ToString() ); // durability ~1_val~%
                
            if ( (prop = m_SetWeaponAttributes.LowerStatReq) != 0 && GetLowerStatReq() == 0 )
                list.Add( 1060435, prop.ToString() ); // lower requirements ~1_val~%
                
            if ( (prop = m_SetWeaponAttributes.MageWeapon) != 0 && WeaponAttributes.MageWeapon == 0 )
                list.Add( 1060438, (30 - prop).ToString() ); // mage weapon -~1_val~ skill
                
            if ( (prop = m_SetWeaponAttributes.SelfRepair) != 0 && WeaponAttributes.SelfRepair == 0 )
                list.Add( 1060450, prop.ToString() ); // self repair ~1_val~    
                        
            if ( m_AosSkillBonuses.Skill_1_Value != 0 )
                list.Add( 1072502, "{0}\t{1}", "#" + ( 1044060 + (int) m_AosSkillBonuses.Skill_1_Name ), m_AosSkillBonuses.Skill_1_Value ); // ~1_skill~ ~2_val~ (total)
            
            SetHelper.GetSetProperties( list, Attributes, m_SetAttributes, m_SetEquipped );
            
            if ( (prop = m_SetWeaponAttributes.HitColdArea) != 0 && WeaponAttributes.HitColdArea == 0 )
                list.Add( 1060416, prop.ToString() ); // hit cold area ~1_val~%

            if ( (prop = m_SetWeaponAttributes.HitDispel) != 0 && WeaponAttributes.HitDispel == 0 )
                list.Add( 1060417, prop.ToString() ); // hit dispel ~1_val~%

            if ( (prop = m_SetWeaponAttributes.HitEnergyArea) != 0 && WeaponAttributes.HitEnergyArea == 0 )
                list.Add( 1060418, prop.ToString() ); // hit energy area ~1_val~%

            if ( (prop = m_SetWeaponAttributes.HitFireArea) != 0 && WeaponAttributes.HitFireArea == 0 )
                list.Add( 1060419, prop.ToString() ); // hit fire area ~1_val~%

            if ( (prop = m_SetWeaponAttributes.HitFireball) != 0 && WeaponAttributes.HitFireball == 0 )
                list.Add( 1060420, prop.ToString() ); // hit fireball ~1_val~%

            if ( (prop = m_SetWeaponAttributes.HitHarm) != 0 && WeaponAttributes.HitHarm == 0 )
                list.Add( 1060421, prop.ToString() ); // hit harm ~1_val~%

            if ( (prop = m_SetWeaponAttributes.HitLeechHits) != 0 && WeaponAttributes.HitLeechHits == 0 )
                list.Add( 1060422, prop.ToString() ); // hit life leech ~1_val~%

            if ( (prop = m_SetWeaponAttributes.HitLightning) != 0 && WeaponAttributes.HitLightning == 0 )
                list.Add( 1060423, prop.ToString() ); // hit lightning ~1_val~%

            if ( (prop = m_SetWeaponAttributes.HitLowerAttack) != 0 && WeaponAttributes.HitLowerAttack == 0 )
                list.Add( 1060424, prop.ToString() ); // hit lower attack ~1_val~%

            if ( (prop = m_SetWeaponAttributes.HitLowerDefend) != 0 && WeaponAttributes.HitLowerDefend == 0 )
                list.Add( 1060425, prop.ToString() ); // hit lower defense ~1_val~%

            if ( (prop = m_SetWeaponAttributes.HitMagicArrow) != 0 && WeaponAttributes.HitMagicArrow == 0 )
                list.Add( 1060426, prop.ToString() ); // hit magic arrow ~1_val~%

            if ( (prop = m_SetWeaponAttributes.HitLeechMana) != 0 && WeaponAttributes.HitLeechMana == 0 )
                list.Add( 1060427, prop.ToString() ); // hit mana leech ~1_val~%

            if ( (prop = m_SetWeaponAttributes.HitPhysicalArea) != 0 && WeaponAttributes.HitPhysicalArea == 0 )
                list.Add( 1060428, prop.ToString() ); // hit physical area ~1_val~%

            if ( (prop = m_SetWeaponAttributes.HitPoisonArea) != 0 && WeaponAttributes.HitPoisonArea == 0 )
                list.Add( 1060429, prop.ToString() ); // hit poison area ~1_val~%

            if ( (prop = m_SetWeaponAttributes.HitLeechStam) != 0 && WeaponAttributes.HitLeechStam == 0 )
                list.Add( 1060430, prop.ToString() ); // hit stamina leech ~1_val~%
        }
        #endregion
    }

    public enum CheckSlayerResult
    {
        None,
        Slayer,
        Opposition
    }
}
 

kat20

Sorceror
Im having some problems, I merged all (vet rewards distro files) with my own but I am still geting the following errors,

RunUO - [www.runuo.com] Version 2.0, Build 2949.24683
Core: Running on .NET Framework Version 2.0.50727
Scripts: Compiling C# scripts...failed (32 errors, 1 warnings)
Warnings:
+ Customs/ShardEvent.cs:
CS0114: Line 470: 'Server.Custom.ShardEvent.Location' hides inherited member
'Server.Item.Location'. To make the current member override that implementation
, add the override keyword. Otherwise add the new keyword.
CS0108: Line 472: 'Server.Custom.ShardEvent.Map' hides inherited member 'Ser
ver.Item.Map'. Use the new keyword if hiding was intended.
Errors:
+ Items/Resources/Arrows/Arrow.cs:
CS0535: Line 5: 'Server.Items.Arrow' does not implement interface member 'Se
rver.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Arrows/Bolt.cs:
CS0535: Line 5: 'Server.Items.Bolt' does not implement interface member 'Ser
ver.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Arrows/Feather.cs:
CS0535: Line 6: 'Server.Items.Feather' does not implement interface member '
Server.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Arrows/Shaft.cs:
CS0535: Line 6: 'Server.Items.Shaft' does not implement interface member 'Se
rver.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Blacksmithing/Ingots.cs:
CS0535: Line 7: 'Server.Items.BaseIngot' does not implement interface member
'Server.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Blacksmithing/Ore.cs:
CS0535: Line 9: 'Server.Items.BaseOre' does not implement interface member '
Server.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Blacksmithing/Scales.cs:
CS0535: Line 7: 'Server.Items.BaseScales' does not implement interface membe
r 'Server.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Masonry/Granite.cs:
CS0535: Line 7: 'Server.Items.BaseGranite' does not implement interface memb
er 'Server.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Reagents/BatWing.cs:
CS0535: Line 7: 'Server.Items.BatWing' does not implement interface member '
Server.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Reagents/BlackPearl.cs:
CS0535: Line 7: 'Server.Items.BlackPearl' does not implement interface membe
r 'Server.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Reagents/Bloodmoss.cs:
CS0535: Line 7: 'Server.Items.Bloodmoss' does not implement interface member
'Server.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Reagents/DaemonBlood.cs:
CS0535: Line 7: 'Server.Items.DaemonBlood' does not implement interface memb
er 'Server.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Reagents/DeadWood.cs:
CS0535: Line 7: 'Server.Items.DeadWood' does not implement interface member
'Server.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Reagents/Garlic.cs:
CS0535: Line 7: 'Server.Items.Garlic' does not implement interface member 'S
erver.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Reagents/Ginseng.cs:
CS0535: Line 7: 'Server.Items.Ginseng' does not implement interface member '
Server.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Reagents/GraveDust.cs:
CS0535: Line 7: 'Server.Items.GraveDust' does not implement interface member
'Server.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Reagents/MandrakeRoot.cs:
CS0535: Line 7: 'Server.Items.MandrakeRoot' does not implement interface mem
ber 'Server.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Reagents/Nightshade.cs:
CS0535: Line 7: 'Server.Items.Nightshade' does not implement interface membe
r 'Server.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Reagents/NoxCrystal.cs:
CS0535: Line 7: 'Server.Items.NoxCrystal' does not implement interface membe
r 'Server.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Reagents/PigIron.cs:
CS0535: Line 7: 'Server.Items.PigIron' does not implement interface member '
Server.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Reagents/SpidersSilk.cs:
CS0535: Line 7: 'Server.Items.SpidersSilk' does not implement interface memb
er 'Server.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Reagents/SulfurousAsh.cs:
CS0535: Line 7: 'Server.Items.SulfurousAsh' does not implement interface mem
ber 'Server.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Tailor/BoltOfCloth.cs:
CS0535: Line 8: 'Server.Items.BoltOfCloth' does not implement interface memb
er 'Server.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Tailor/Bone.cs:
CS0535: Line 6: 'Server.Items.Bone' does not implement interface member 'Ser
ver.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Tailor/Cloth.cs:
CS0535: Line 8: 'Server.Items.Cloth' does not implement interface member 'Se
rver.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Tailor/Hides.cs:
CS0535: Line 7: 'Server.Items.BaseHides' does not implement interface member
'Server.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Tailor/Leathers.cs:
CS0535: Line 7: 'Server.Items.BaseLeather' does not implement interface memb
er 'Server.Items.ICommodity.DescriptionNumber'
+ Items/Resources/Tailor/UncutCloth.cs:
CS0535: Line 8: 'Server.Items.UncutCloth' does not implement interface membe
r 'Server.Items.ICommodity.DescriptionNumber'
+ Items/Skill Items/Carpenter Items/Board.cs:
CS0535: Line 6: 'Server.Items.BaseBoards' does not implement interface membe
r 'Server.Items.ICommodity.DescriptionNumber'
+ Items/Skill Items/Lumberjack/Log.cs:
CS0535: Line 6: 'Server.Items.BaseLog' does not implement interface member '
Server.Items.ICommodity.DescriptionNumber'
+ Items/Skill Items/Specialized/Sand.cs:
CS0535: Line 7: 'Server.Items.Sand' does not implement interface member 'Ser
ver.Items.ICommodity.DescriptionNumber'
+ Mondain's Legacy/Items/Talismans/Items/Switch.cs:
CS0535: Line 5: 'Server.Items.Switch' does not implement interface member 'S
erver.Items.ICommodity.DescriptionNumber'
Scripts: One or more scripts failed to compile or no script files were found.
- Press return to exit, or R to try again.

Im not sure if I am merging them wrong or if it is because of some other problem. I hope Im at least headed in the right direction, also just so you know my shard does not have lots of custom things I have added your ML package, a jail system, avent gate, and the doom puzzle. The reason I think this is important is I realoze that if you do an extreme custom shard it may make it hard to add other things without a total overhaul. also I do not use xml spawner. I am interested in osi ONLY, thanks for all the help I will need more in the future im sure and any help is appreciated, thanks again
 

PappaSmurf

Knight
kat20;781030 said:
Im having some problems, I merged all (vet rewards distro files) with my own but I am still geting the following errors,



Im not sure if I am merging them wrong or if it is because of some other problem. I hope Im at least headed in the right direction, also just so you know my shard does not have lots of custom things I have added your ML package, a jail system, avent gate, and the doom puzzle. The reason I think this is important is I realoze that if you do an extreme custom shard it may make it hard to add other things without a total overhaul. also I do not use xml spawner. I am interested in osi ONLY, thanks for all the help I will need more in the future im sure and any help is appreciated, thanks again

It's an issue with the CommodityDeed.cs Somewhere you had a bad merger...

That list is of every item that a commodity deed works for... since the ICommodity interface is established in that script. If you'll post your CommodityDeed.cs, it should make it easier to find the issue.
 

kat20

Sorceror
PappaSmurf;781045 said:
It's an issue with the CommodityDeed.cs Somewhere you had a bad merger...

That list is of every item that a commodity deed works for... since the ICommodity interface is established in that script. If you'll post your CommodityDeed.cs, it should make it easier to find the issue.


I thought that it might be, thank you for the continued help I figured out the problem there however now I am having this error which has something to do with the playermobile.cs, here is the error.............



RunUO - [www.runuo.com] Version 2.0, Build 2949.24683
Core: Running on .NET Framework Version 2.0.50727
Scripts: Compiling C# scripts...failed (35 errors, 1 warnings)
Warnings:
+ Customs/ShardEvent.cs:
CS0114: Line 470: 'Server.Custom.ShardEvent.Location' hides inherited member
'Server.Item.Location'. To make the current member override that implementation
, add the override keyword. Otherwise add the new keyword.
CS0108: Line 472: 'Server.Custom.ShardEvent.Map' hides inherited member 'Ser
ver.Item.Map'. Use the new keyword if hiding was intended.
CS0472: Line 271: The result of the expression is always 'true' since a valu
e of type 'int' is never equal to 'null' of type 'int?'
Errors:
+ Customs/Veteran Rewards/ContestMiniHouse.cs:
CS0117: Line 30: 'Server.Items.MiniHouseType' does not contain a definition
for 'MalasMountainPass'
CS0117: Line 85: 'Server.Items.MiniHouseType' does not contain a definition
for 'MalasMountainPass'
+ Spells/Base/Spell.cs:
CS0117: Line 486: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Peaced'
+ Engines/VeteranRewards/RewardChoiceGump.cs:
CS1501: Line 93: No overload for method 'RenderCategory' takes '3' arguments

+ Engines/VeteranRewards/RewardSystem.cs:
CS0117: Line 288: 'Server.Items.MiniHouseType' does not contain a definition
for 'MalasMountainPass'
CS0117: Line 289: 'Server.Items.MiniHouseType' does not contain a definition
for 'ChurchAtNight'
+ Items/Deeds/CommodityDeed.cs:
CS0117: Line 103: 'Server.Items.ICommodity' does not contain a definition fo
r 'DescriptionNumber'
+ Mondain's Legacy/Engines/Community Collections/BaseCollectionMobile.cs:
CS0117: Line 259: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'AddCollectionPoints'
CS0117: Line 279: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'AddCollectionPoints'
+ Mondain's Legacy/Engines/Community Collections/Britain Library/ArtsSection.cs
:
CS0117: Line 103: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'LibraryFriend'
+ Mondain's Legacy/Engines/Community Collections/Britain Library/BritanniaWater
s.cs:
CS0117: Line 99: 'Server.Mobiles.PlayerMobile' does not contain a definition
for 'LibraryFriend'
+ Mondain's Legacy/Engines/Community Collections/Britain Library/FoldedSteel.cs
:
CS0117: Line 99: 'Server.Mobiles.PlayerMobile' does not contain a definition
for 'LibraryFriend'
+ Mondain's Legacy/Engines/Community Collections/Britain Library/LightAndMight.
cs:
CS0117: Line 116: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'LibraryFriend'
+ Mondain's Legacy/Engines/Community Collections/Britain Library/MaceAndBlade.c
s:
CS0117: Line 98: 'Server.Mobiles.PlayerMobile' does not contain a definition
for 'LibraryFriend'
+ Mondain's Legacy/Engines/Community Collections/Britain Library/OilAndOubliett
e.cs:
CS0117: Line 99: 'Server.Mobiles.PlayerMobile' does not contain a definition
for 'LibraryFriend'
+ Mondain's Legacy/Engines/Community Collections/Britain Library/PastTreasures.
cs:
CS0117: Line 104: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'LibraryFriend'
+ Mondain's Legacy/Engines/Community Collections/Britain Library/SkeletonKey.cs
:
CS0117: Line 100: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'LibraryFriend'
+ Mondain's Legacy/Engines/Community Collections/Britain Library/SongsOfNote.cs
:
CS0117: Line 94: 'Server.Mobiles.PlayerMobile' does not contain a definition
for 'LibraryFriend'
+ Mondain's Legacy/Engines/Community Collections/Britain Library/Trades.cs:
CS0117: Line 109: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'LibraryFriend'
+ Mondain's Legacy/Engines/Community Collections/Britain Library/UnderstandingA
nimals.cs:
CS0117: Line 96: 'Server.Mobiles.PlayerMobile' does not contain a definition
for 'LibraryFriend'
+ Mondain's Legacy/Engines/Community Collections/Britain Library/WizardsCompend
ium.cs:
CS0117: Line 103: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'LibraryFriend'
+ Mondain's Legacy/Engines/Community Collections/BaseCollectionItem.cs:
CS0117: Line 222: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'AddCollectionPoints'
CS0117: Line 242: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'AddCollectionPoints'
+ Mondain's Legacy/Engines/Community Collections/CollectionItem.cs:
CS0117: Line 85: 'Server.Mobiles.PlayerMobile' does not contain a definition
for 'AddCollectionTitle'
CS0117: Line 92: 'Server.Mobiles.PlayerMobile' does not contain a definition
for 'AddCollectionPoints'
+ Mondain's Legacy/Engines/Community Collections/ComunityCollectionGump.cs:
CS0117: Line 179: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'GetCollectionPoints'
CS0117: Line 236: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'GetCollectionPoints'
CS0117: Line 299: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'GetCollectionPoints'
+ Mondain's Legacy/Engines/Community Collections/SelectTitleGump.cs:
CS0117: Line 36: 'Server.Mobiles.PlayerMobile' does not contain a definition
for 'CollectionTitles'
CS0117: Line 38: 'Server.Mobiles.PlayerMobile' does not contain a definition
for 'CollectionTitles'
CS0117: Line 39: 'Server.Mobiles.PlayerMobile' does not contain a definition
for 'CollectionTitles'
CS0117: Line 40: 'Server.Mobiles.PlayerMobile' does not contain a definition
for 'CollectionTitles'
CS0117: Line 41: 'Server.Mobiles.PlayerMobile' does not contain a definition
for 'CollectionTitles'
CS0117: Line 58: 'Server.Mobiles.PlayerMobile' does not contain a definition
for 'SelectCollectionTitle'
CS0117: Line 60: 'Server.Mobiles.PlayerMobile' does not contain a definition
for 'CollectionTitles'
CS0117: Line 62: 'Server.Mobiles.PlayerMobile' does not contain a definition
for 'CollectionTitles'
+ Mondain's Legacy/Engines/Quests/Gumps/MondainQuestGump.cs:
CS0117: Line 130: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Quests'
CS0117: Line 132: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Quests'
CS0117: Line 582: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Quests'
CS0117: Line 585: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Quests'
+ Mondain's Legacy/Engines/Quests/Helpers/QuestHelper.cs:
CS0117: Line 64: 'Server.Mobiles.PlayerMobile' does not contain a definition
for 'Chains'
CS0117: Line 77: 'Server.Mobiles.PlayerMobile' does not contain a definition
for 'Quests'
CS0117: Line 79: 'Server.Mobiles.PlayerMobile' does not contain a definition
for 'Quests'
CS0117: Line 150: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Quests'
CS0117: Line 152: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Quests'
CS0117: Line 173: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Quests'
CS0117: Line 175: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Quests'
CS0117: Line 214: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Quests'
CS0117: Line 216: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Quests'
CS0117: Line 252: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Quests'
CS0117: Line 508: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Quests'
CS0117: Line 510: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Quests'
CS0117: Line 545: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Quests'
CS0117: Line 547: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Quests'
CS0117: Line 573: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Quests'
CS0117: Line 575: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Quests'
CS0117: Line 603: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Quests'
CS0117: Line 605: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Quests'
CS0117: Line 634: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Quests'
CS0117: Line 636: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Quests'
CS0117: Line 675: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Quests'
CS0117: Line 678: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Quests'
CS0117: Line 679: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Quests'
CS0117: Line 684: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Quests'
CS0117: Line 687: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Quests'
CS0117: Line 688: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Quests'
CS0117: Line 725: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Quests'
CS0117: Line 727: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Quests'
+ Mondain's Legacy/Engines/Quests/Regions/ApprenticeRegion.cs:
CS0117: Line 32: 'Server.Mobiles.PlayerMobile' does not contain a definition
for 'Quests'
CS0117: Line 34: 'Server.Mobiles.PlayerMobile' does not contain a definition
for 'Quests'
CS0117: Line 69: 'Server.Mobiles.PlayerMobile' does not contain a definition
for 'Quests'
CS0117: Line 71: 'Server.Mobiles.PlayerMobile' does not contain a definition
for 'Quests'
+ Mondain's Legacy/Engines/Quests/MondainQuester.cs:
CS0117: Line 65: 'Server.Mobiles.PlayerMobile' does not contain a definition
for 'Chains'
+ Mondain's Legacy/Engines/Quests/BaseQuest.cs:
CS0117: Line 169: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Chains'
CS0117: Line 171: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Chains'
CS0117: Line 188: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Chains'
CS0117: Line 207: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Quests'
CS0117: Line 380: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Chains'
CS0117: Line 394: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Quests'
CS0117: Line 396: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Quests'
CS0117: Line 398: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Quests'
+ Mondain's Legacy/Engines/Quests/BaseQuestItem.cs:
CS0117: Line 63: 'Server.Mobiles.PlayerMobile' does not contain a definition
for 'Chains'
+ Mondain's Legacy/Items/Misc/Bedlam/Teleporters.cs:
CS0117: Line 40: 'Server.Mobiles.PlayerMobile' does not contain a definition
for 'Bedlam'
+ Mondain's Legacy/Mobiles/Twisted Weald/DryadA.cs:
CS0117: Line 73: 'Server.Mobiles.PlayerMobile' does not contain a definition
for 'PeacedUntil'
CS0117: Line 75: 'Server.Mobiles.PlayerMobile' does not contain a definition
for 'PeacedUntil'
+ Mondain's Legacy/Quests/Bedlam/Mistaken Identity/Quests.cs:
CS0117: Line 200: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Bedlam'
+ Mondain's Legacy/Quests/Heartwood/Spellweaving/Quests.cs:
CS0117: Line 254: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Spellweaving'
+ Mondain's Legacy/Quests/Sanctuary/Spellweaving/Quests.cs:
CS0117: Line 244: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Spellweaving'
+ Mondain's Legacy/Quests/Trammel/Friends of the Library/Quests.cs:
CS0117: Line 242: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'LibraryFriend'
+ Spells/Spellweaving/ArcanistSpell.cs:
CS0117: Line 77: 'Server.Mobiles.PlayerMobile' does not contain a definition
for 'Spellweaving'
Scripts: One or more scripts failed to compile or no script files were found.
- Press return to exit, or R to try again.




also the minihouse.cs looks as though it may have issues as well. Here are the playermobile and minihouse.cs scripts that I have. Thanks very much for your time.


using System;
using System.Collections;
using System.Collections.Generic;
using Server;
using Server.Misc;
using Server.Items;
using Server.Gumps;
using Server.Multis;
using Server.Engines.Help;
using Server.ContextMenus;
using Server.Network;
using Server.Spells;
using Server.Spells.Fifth;
using Server.Spells.Sixth;
using Server.Spells.Seventh;
using Server.Spells.Necromancy;
using Server.Spells.Ninjitsu;
using Server.Spells.Bushido;
using Server.Targeting;
using Server.Engines.Quests;
using Server.Factions;
using Server.Regions;
using Server.Accounting;
using Server.Engines.CannedEvil;
using Server.Engines.Craft;
using Server.Spells.Spellweaving;

namespace Server.Mobiles
{
#region Enums
[Flags]
public enum PlayerFlag // First 16 bits are reserved for default-distro use, start custom flags at 0x00010000
{
None = 0x00000000,
Glassblowing = 0x00000001,
Masonry = 0x00000002,
SandMining = 0x00000004,
StoneMining = 0x00000008,
ToggleMiningStone = 0x00000010,
KarmaLocked = 0x00000020,
AutoRenewInsurance = 0x00000040,
UseOwnFilter = 0x00000080,
PublicMyRunUO = 0x00000100,
PagingSquelched = 0x00000200,
Young = 0x00000400,
AcceptGuildInvites = 0x00000800,
DisplayChampionTitle= 0x00001000
}

public enum NpcGuild
{
None,
MagesGuild,
WarriorsGuild,
ThievesGuild,
RangersGuild,
HealersGuild,
MinersGuild,
MerchantsGuild,
TinkersGuild,
TailorsGuild,
FishermensGuild,
BardsGuild,
BlacksmithsGuild
}

public enum SolenFriendship
{
None,
Red,
Black
}
#endregion

public class PlayerMobile : Mobile, IHonorTarget
{
private class CountAndTimeStamp
{
private int m_Count;
private DateTime m_Stamp;

public CountAndTimeStamp()
{
}

public DateTime TimeStamp { get{ return m_Stamp; } }
public int Count
{
get { return m_Count; }
set { m_Count = value; m_Stamp = DateTime.Now; }
}
}

private DesignContext m_DesignContext;

private NpcGuild m_NpcGuild;
private DateTime m_NpcGuildJoinTime;
private TimeSpan m_NpcGuildGameTime;
private PlayerFlag m_Flags;
private int m_StepsTaken;
private int m_Profession;

private DateTime m_LastOnline;
private Server.Guilds.RankDefinition m_GuildRank;

private int m_GuildMessageHue, m_AllianceMessageHue;

#region Getters & Setters
public Server.Guilds.RankDefinition GuildRank
{
get
{
if( this.AccessLevel >= AccessLevel.GameMaster )
return Server.Guilds.RankDefinition.Leader;
else
return m_GuildRank;
}
set{ m_GuildRank = value; }
}

[CommandProperty( AccessLevel.GameMaster )]
public int GuildMessageHue
{
get{ return m_GuildMessageHue; }
set{ m_GuildMessageHue = value; }
}

[CommandProperty( AccessLevel.GameMaster )]
public int AllianceMessageHue
{
get { return m_AllianceMessageHue; }
set { m_AllianceMessageHue = value; }
}

[CommandProperty( AccessLevel.GameMaster )]
public int Profession
{
get{ return m_Profession; }
set{ m_Profession = value; }
}

public int StepsTaken
{
get{ return m_StepsTaken; }
set{ m_StepsTaken = value; }
}

[CommandProperty( AccessLevel.GameMaster )]
public NpcGuild NpcGuild
{
get{ return m_NpcGuild; }
set{ m_NpcGuild = value; }
}

[CommandProperty( AccessLevel.GameMaster )]
public DateTime NpcGuildJoinTime
{
get{ return m_NpcGuildJoinTime; }
set{ m_NpcGuildJoinTime = value; }
}

[CommandProperty( AccessLevel.GameMaster )]
public DateTime LastOnline
{
get{ return m_LastOnline; }
set{ m_LastOnline = value; }
}

[CommandProperty( AccessLevel.GameMaster )]
public TimeSpan NpcGuildGameTime
{
get{ return m_NpcGuildGameTime; }
set{ m_NpcGuildGameTime = value; }
}

private int m_ToTItemsTurnedIn;

[CommandProperty( AccessLevel.GameMaster )]
public int ToTItemsTurnedIn
{
get { return m_ToTItemsTurnedIn; }
set { m_ToTItemsTurnedIn = value; }
}

private int m_ToTTotalMonsterFame;

[CommandProperty( AccessLevel.GameMaster )]
public int ToTTotalMonsterFame
{
get { return m_ToTTotalMonsterFame; }
set { m_ToTTotalMonsterFame = value; }
}

#endregion

#region PlayerFlags
public PlayerFlag Flags
{
get{ return m_Flags; }
set{ m_Flags = value; }
}

[CommandProperty( AccessLevel.GameMaster )]
public bool PagingSquelched
{
get{ return GetFlag( PlayerFlag.PagingSquelched ); }
set{ SetFlag( PlayerFlag.PagingSquelched, value ); }
}

[CommandProperty( AccessLevel.GameMaster )]
public bool Glassblowing
{
get{ return GetFlag( PlayerFlag.Glassblowing ); }
set{ SetFlag( PlayerFlag.Glassblowing, value ); }
}

[CommandProperty( AccessLevel.GameMaster )]
public bool Masonry
{
get{ return GetFlag( PlayerFlag.Masonry ); }
set{ SetFlag( PlayerFlag.Masonry, value ); }
}

[CommandProperty( AccessLevel.GameMaster )]
public bool SandMining
{
get{ return GetFlag( PlayerFlag.SandMining ); }
set{ SetFlag( PlayerFlag.SandMining, value ); }
}

[CommandProperty( AccessLevel.GameMaster )]
public bool StoneMining
{
get{ return GetFlag( PlayerFlag.StoneMining ); }
set{ SetFlag( PlayerFlag.StoneMining, value ); }
}

[CommandProperty( AccessLevel.GameMaster )]
public bool ToggleMiningStone
{
get{ return GetFlag( PlayerFlag.ToggleMiningStone ); }
set{ SetFlag( PlayerFlag.ToggleMiningStone, value ); }
}

[CommandProperty( AccessLevel.GameMaster )]
public bool KarmaLocked
{
get{ return GetFlag( PlayerFlag.KarmaLocked ); }
set{ SetFlag( PlayerFlag.KarmaLocked, value ); }
}

[CommandProperty( AccessLevel.GameMaster )]
public bool AutoRenewInsurance
{
get{ return GetFlag( PlayerFlag.AutoRenewInsurance ); }
set{ SetFlag( PlayerFlag.AutoRenewInsurance, value ); }
}

[CommandProperty( AccessLevel.GameMaster )]
public bool UseOwnFilter
{
get{ return GetFlag( PlayerFlag.UseOwnFilter ); }
set{ SetFlag( PlayerFlag.UseOwnFilter, value ); }
}

[CommandProperty( AccessLevel.GameMaster )]
public bool PublicMyRunUO
{
get{ return GetFlag( PlayerFlag.PublicMyRunUO ); }
set{ SetFlag( PlayerFlag.PublicMyRunUO, value ); InvalidateMyRunUO(); }
}

[CommandProperty( AccessLevel.GameMaster )]
public bool AcceptGuildInvites
{
get{ return GetFlag( PlayerFlag.AcceptGuildInvites ); }
set{ SetFlag( PlayerFlag.AcceptGuildInvites, value ); }
}
#endregion

#region Veteran Rewards
private DateTime m_AnkhNextUse;

[CommandProperty( AccessLevel.GameMaster )]
public DateTime AnkhNextUse
{
get{ return m_AnkhNextUse; }
set{ m_AnkhNextUse = value; }
}
#endregion


public static Direction GetDirection4( Point3D from, Point3D to )
{
int dx = from.X - to.X;
int dy = from.Y - to.Y;

int rx = dx - dy;
int ry = dx + dy;

Direction ret;

if ( rx >= 0 && ry >= 0 )
ret = Direction.West;
else if ( rx >= 0 && ry < 0 )
ret = Direction.South;
else if ( rx < 0 && ry < 0 )
ret = Direction.East;
else
ret = Direction.North;

return ret;
}

public override bool OnDroppedItemToWorld( Item item, Point3D location )
{
if ( !base.OnDroppedItemToWorld( item, location ) )
return false;

BounceInfo bi = item.GetBounce();

if ( bi != null )
{
Type type = item.GetType();

if ( type.IsDefined( typeof( FurnitureAttribute ), true ) || type.IsDefined( typeof( DynamicFlipingAttribute ), true ) )
{
object[] objs = type.GetCustomAttributes( typeof( FlipableAttribute ), true );

if ( objs != null && objs.Length > 0 )
{
FlipableAttribute fp = objs[0] as FlipableAttribute;

if ( fp != null )
{
int[] itemIDs = fp.ItemIDs;

Point3D oldWorldLoc = bi.m_WorldLoc;
Point3D newWorldLoc = location;

if ( oldWorldLoc.X != newWorldLoc.X || oldWorldLoc.Y != newWorldLoc.Y )
{
Direction dir = GetDirection4( oldWorldLoc, newWorldLoc );

if ( itemIDs.Length == 2 )
{
switch ( dir )
{
case Direction.North:
case Direction.South: item.ItemID = itemIDs[0]; break;
case Direction.East:
case Direction.West: item.ItemID = itemIDs[1]; break;
}
}
else if ( itemIDs.Length == 4 )
{
switch ( dir )
{
case Direction.South: item.ItemID = itemIDs[0]; break;
case Direction.East: item.ItemID = itemIDs[1]; break;
case Direction.North: item.ItemID = itemIDs[2]; break;
case Direction.West: item.ItemID = itemIDs[3]; break;
}
}
}
}
}
}
}

return true;
}

public bool GetFlag( PlayerFlag flag )
{
return ( (m_Flags & flag) != 0 );
}

public void SetFlag( PlayerFlag flag, bool value )
{
if ( value )
m_Flags |= flag;
else
m_Flags &= ~flag;
}

public DesignContext DesignContext
{
get{ return m_DesignContext; }
set{ m_DesignContext = value; }
}

public static void Initialize()
{
if ( FastwalkPrevention )
PacketHandlers.RegisterThrottler( 0x02, new ThrottlePacketCallback( MovementThrottle_Callback ) );

EventSink.Login += new LoginEventHandler( OnLogin );
EventSink.Logout += new LogoutEventHandler( OnLogout );
EventSink.Connected += new ConnectedEventHandler( EventSink_Connected );
EventSink.Disconnected += new DisconnectedEventHandler( EventSink_Disconnected );
}

public override void OnSkillInvalidated( Skill skill )
{
if ( Core.AOS && skill.SkillName == SkillName.MagicResist )
UpdateResistances();
}

public override int GetMaxResistance( ResistanceType type )
{
if ( AccessLevel > AccessLevel.Player )
return int.MaxValue;

int max = base.GetMaxResistance( type );

if ( type != ResistanceType.Physical && 60 < max && Spells.Fourth.CurseSpell.UnderEffect( this ) )
max = 60;

if( Core.ML && this.Race == Race.Elf && type == ResistanceType.Energy )
max += 5; //Intended to go after the 60 max from curse

return max;
}

protected override void OnRaceChange( Race oldRace )
{
ValidateEquipment();
UpdateResistances();
}

public override int MaxWeight { get { return (((Core.ML && this.Race == Race.Human) ? 100 : 40) + (int)(3.5 * this.Str)); } }

private int m_LastGlobalLight = -1, m_LastPersonalLight = -1;

public override void OnNetStateChanged()
{
m_LastGlobalLight = -1;
m_LastPersonalLight = -1;
}

public override void ComputeBaseLightLevels( out int global, out int personal )
{
global = LightCycle.ComputeLevelFor( this );

bool racialNightSight = (Core.ML && this.Race == Race.Elf);

if ( this.LightLevel < 21 && ( AosAttributes.GetValue( this, AosAttribute.NightSight ) > 0 || racialNightSight ))
personal = 21;
else
personal = this.LightLevel;
}

public override void CheckLightLevels( bool forceResend )
{
NetState ns = this.NetState;

if ( ns == null )
return;

int global, personal;

ComputeLightLevels( out global, out personal );

if ( !forceResend )
forceResend = ( global != m_LastGlobalLight || personal != m_LastPersonalLight );

if ( !forceResend )
return;

m_LastGlobalLight = global;
m_LastPersonalLight = personal;

ns.Send( GlobalLightLevel.Instantiate( global ) );
ns.Send( new PersonalLightLevel( this, personal ) );
}

public override int GetMinResistance( ResistanceType type )
{
int magicResist = (int)(Skills[SkillName.MagicResist].Value * 10);
int min = int.MinValue;

if ( magicResist >= 1000 )
min = 40 + ((magicResist - 1000) / 50);
else if ( magicResist >= 400 )
min = (magicResist - 400) / 15;

if ( min > MaxPlayerResistance )
min = MaxPlayerResistance;

int baseMin = base.GetMinResistance( type );

if ( min < baseMin )
min = baseMin;

return min;
}

private static void OnLogin( LoginEventArgs e )
{
Mobile from = e.Mobile;

CheckAtrophies( from );

if ( AccountHandler.LockdownLevel > AccessLevel.Player )
{
string notice;

Accounting.Account acct = from.Account as Accounting.Account;

if ( acct == null || !acct.HasAccess( from.NetState ) )
{
if ( from.AccessLevel == AccessLevel.Player )
notice = "The server is currently under lockdown. No players are allowed to log in at this time.";
else
notice = "The server is currently under lockdown. You do not have sufficient access level to connect.";

Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), new TimerStateCallback( Disconnect ), from );
}
else if ( from.AccessLevel >= AccessLevel.Administrator )
{
notice = "The server is currently under lockdown. As you are an administrator, you may change this from the [Admin gump.";
}
else
{
notice = "The server is currently under lockdown. You have sufficient access level to connect.";
}

from.SendGump( new NoticeGump( 1060637, 30720, notice, 0xFFC000, 300, 140, null, null ) );
}
}

private bool m_NoDeltaRecursion;

public void ValidateEquipment()
{
if ( m_NoDeltaRecursion || Map == null || Map == Map.Internal )
return;

if ( this.Items == null )
return;

m_NoDeltaRecursion = true;
Timer.DelayCall( TimeSpan.Zero, new TimerCallback( ValidateEquipment_Sandbox ) );
}

private void ValidateEquipment_Sandbox()
{
try
{
if ( Map == null || Map == Map.Internal )
return;

List<Item> items = this.Items;

if ( items == null )
return;

bool moved = false;

int str = this.Str;
int dex = this.Dex;
int intel = this.Int;

#region Factions
int factionItemCount = 0;
#endregion

Mobile from = this;

#region Ethics
Ethics.Ethic ethic = Ethics.Ethic.Find( from );
#endregion

for ( int i = items.Count - 1; i >= 0; --i )
{
if ( i >= items.Count )
continue;

Item item = items;

#region Ethics
if ( ( item.SavedFlags & 0x100 ) != 0 )
{
if ( item.Hue != Ethics.Ethic.Hero.Definition.PrimaryHue )
{
item.SavedFlags &= ~0x100;
}
else if ( ethic != Ethics.Ethic.Hero )
{
from.AddToBackpack( item );
moved = true;
continue;
}
}
else if ( ( item.SavedFlags & 0x200 ) != 0 )
{
if ( item.Hue != Ethics.Ethic.Evil.Definition.PrimaryHue )
{
item.SavedFlags &= ~0x200;
}
else if ( ethic != Ethics.Ethic.Evil )
{
from.AddToBackpack( item );
moved = true;
continue;
}
}
#endregion

if ( item is BaseWeapon )
{
BaseWeapon weapon = (BaseWeapon)item;

bool drop = false;

if( dex < weapon.DexRequirement )
drop = true;
else if( str < AOS.Scale( weapon.StrRequirement, 100 - weapon.GetLowerStatReq() ) )
drop = true;
else if( intel < weapon.IntRequirement )
drop = true;
else if( weapon.RequiredRace != null && weapon.RequiredRace != this.Race )
drop = true;

if ( drop )
{
string name = weapon.Name;

if ( name == null )
name = String.Format( "#{0}", weapon.LabelNumber );

from.SendLocalizedMessage( 1062001, name ); // You can no longer wield your ~1_WEAPON~
from.AddToBackpack( weapon );
moved = true;
}
}
else if ( item is BaseArmor )
{
BaseArmor armor = (BaseArmor)item;

bool drop = false;

if ( !armor.AllowMaleWearer && !from.Female && from.AccessLevel < AccessLevel.GameMaster )
{
drop = true;
}
else if ( !armor.AllowFemaleWearer && from.Female && from.AccessLevel < AccessLevel.GameMaster )
{
drop = true;
}
else if( armor.RequiredRace != null && armor.RequiredRace != this.Race )
{
drop = true;
}
else
{
int strBonus = armor.ComputeStatBonus( StatType.Str ), strReq = armor.ComputeStatReq( StatType.Str );
int dexBonus = armor.ComputeStatBonus( StatType.Dex ), dexReq = armor.ComputeStatReq( StatType.Dex );
int intBonus = armor.ComputeStatBonus( StatType.Int ), intReq = armor.ComputeStatReq( StatType.Int );

if( dex < dexReq || (dex + dexBonus) < 1 )
drop = true;
else if( str < strReq || (str + strBonus) < 1 )
drop = true;
else if( intel < intReq || (intel + intBonus) < 1 )
drop = true;
}

if ( drop )
{
string name = armor.Name;

if ( name == null )
name = String.Format( "#{0}", armor.LabelNumber );

if ( armor is BaseShield )
from.SendLocalizedMessage( 1062003, name ); // You can no longer equip your ~1_SHIELD~
else
from.SendLocalizedMessage( 1062002, name ); // You can no longer wear your ~1_ARMOR~

from.AddToBackpack( armor );
moved = true;
}
}
else if ( item is BaseClothing )
{
BaseClothing clothing = (BaseClothing)item;

bool drop = false;

if ( !clothing.AllowMaleWearer && !from.Female && from.AccessLevel < AccessLevel.GameMaster )
{
drop = true;
}
else if ( !clothing.AllowFemaleWearer && from.Female && from.AccessLevel < AccessLevel.GameMaster )
{
drop = true;
}
else if( clothing.RequiredRace != null && clothing.RequiredRace != this.Race )
{
drop = true;
}
else
{
int strBonus = clothing.ComputeStatBonus( StatType.Str );
int strReq = clothing.ComputeStatReq( StatType.Str );

if( str < strReq || (str + strBonus) < 1 )
drop = true;
}

if ( drop )
{
string name = clothing.Name;

if ( name == null )
name = String.Format( "#{0}", clothing.LabelNumber );

from.SendLocalizedMessage( 1062002, name ); // You can no longer wear your ~1_ARMOR~

from.AddToBackpack( clothing );
moved = true;
}
}

FactionItem factionItem = FactionItem.Find( item );

if ( factionItem != null )
{
bool drop = false;

Faction ourFaction = Faction.Find( this );

if ( ourFaction == null || ourFaction != factionItem.Faction )
drop = true;
else if ( ++factionItemCount > FactionItem.GetMaxWearables( this ) )
drop = true;

if ( drop )
{
from.AddToBackpack( item );
moved = true;
}
}
}

if ( moved )
from.SendLocalizedMessage( 500647 ); // Some equipment has been moved to your backpack.
}
catch ( Exception e )
{
Console.WriteLine( e );
}
finally
{
m_NoDeltaRecursion = false;
}
}

public override void Delta( MobileDelta flag )
{
base.Delta( flag );

if ( (flag & MobileDelta.Stat) != 0 )
ValidateEquipment();

if ( (flag & (MobileDelta.Name | MobileDelta.Hue)) != 0 )
InvalidateMyRunUO();
}

private static void Disconnect( object state )
{
NetState ns = ((Mobile)state).NetState;

if ( ns != null )
ns.Dispose();
}

private static void OnLogout( LogoutEventArgs e )
{
}

private static void EventSink_Connected( ConnectedEventArgs e )
{
PlayerMobile pm = e.Mobile as PlayerMobile;

if ( pm != null )
{
pm.m_SessionStart = DateTime.Now;

if ( pm.m_Quest != null )
pm.m_Quest.StartTimer();

pm.BedrollLogout = false;
pm.LastOnline = DateTime.Now;
}

Timer.DelayCall( TimeSpan.Zero, new TimerStateCallback( ClearSpecialMovesCallback ), e.Mobile );
}

private static void ClearSpecialMovesCallback( object state )
{
Mobile from = (Mobile)state;

SpecialMove.ClearAllMoves( from );
}

private static void EventSink_Disconnected( DisconnectedEventArgs e )
{
Mobile from = e.Mobile;
DesignContext context = DesignContext.Find( from );

if ( context != null )
{
/* Client disconnected
* - Remove design context
* - Eject all from house
* - Restore relocated entities
*/

// Remove design context
DesignContext.Remove( from );

// Eject all from house
from.RevealingAction();

foreach ( Item item in context.Foundation.GetItems() )
item.Location = context.Foundation.BanLocation;

foreach ( Mobile mobile in context.Foundation.GetMobiles() )
mobile.Location = context.Foundation.BanLocation;

// Restore relocated entities
context.Foundation.RestoreRelocatedEntities();
}

PlayerMobile pm = e.Mobile as PlayerMobile;

if ( pm != null )
{
pm.m_GameTime += (DateTime.Now - pm.m_SessionStart);

if ( pm.m_Quest != null )
pm.m_Quest.StopTimer();

pm.m_SpeechLog = null;
pm.LastOnline = DateTime.Now;
}
}

public override void RevealingAction()
{
if ( m_DesignContext != null )
return;

Spells.Sixth.InvisibilitySpell.RemoveTimer( this );

base.RevealingAction();
}

[CommandProperty( AccessLevel.GameMaster )]
public override bool Hidden
{
get
{
return base.Hidden;
}
set
{
base.Hidden = value;

RemoveBuff( BuffIcon.Invisibility ); //Always remove, default to the hiding icon EXCEPT in the invis spell where it's explicitly set

if( !Hidden )
{
RemoveBuff( BuffIcon.HidingAndOrStealth );
}
else// if( !InvisibilitySpell.HasTimer( this ) )
{
BuffInfo.AddBuff( this, new BuffInfo( BuffIcon.HidingAndOrStealth, 1075655 ) ); //Hidden/Stealthing & You Are Hidden
}
}
}

public override void OnSubItemAdded( Item item )
{
if ( AccessLevel < AccessLevel.GameMaster && item.IsChildOf( this.Backpack ) )
{
int maxWeight = WeightOverloading.GetMaxWeight( this );
int curWeight = Mobile.BodyWeight + this.TotalWeight;

if ( curWeight > maxWeight )
this.SendLocalizedMessage( 1019035, true, String.Format( " : {0} / {1}", curWeight, maxWeight ) );
}
}

public override bool CanBeHarmful( Mobile target, bool message, bool ignoreOurBlessedness )
{
if ( m_DesignContext != null || (target is PlayerMobile && ((PlayerMobile)target).m_DesignContext != null) )
return false;

if ( (target is BaseVendor && ((BaseVendor)target).IsInvulnerable) || target is PlayerVendor || target is TownCrier )
{
if ( message )
{
if ( target.Title == null )
SendMessage( "{0} the vendor cannot be harmed.", target.Name );
else
SendMessage( "{0} {1} cannot be harmed.", target.Name, target.Title );
}

return false;
}

return base.CanBeHarmful( target, message, ignoreOurBlessedness );
}

public override bool CanBeBeneficial( Mobile target, bool message, bool allowDead )
{
if ( m_DesignContext != null || (target is PlayerMobile && ((PlayerMobile)target).m_DesignContext != null) )
return false;

return base.CanBeBeneficial( target, message, allowDead );
}

public override bool CheckContextMenuDisplay( IEntity target )
{
return ( m_DesignContext == null );
}

public override void OnItemAdded( Item item )
{
base.OnItemAdded( item );

if ( item is BaseArmor || item is BaseWeapon )
{
Hits=Hits; Stam=Stam; Mana=Mana;
}

if ( this.NetState != null )
CheckLightLevels( false );

InvalidateMyRunUO();
}

public override void OnItemRemoved( Item item )
{
base.OnItemRemoved( item );

if ( item is BaseArmor || item is BaseWeapon )
{
Hits=Hits; Stam=Stam; Mana=Mana;
}

if ( this.NetState != null )
CheckLightLevels( false );

InvalidateMyRunUO();
}

public override double ArmorRating
{
get
{
//BaseArmor ar;
double rating = 0.0;

AddArmorRating( ref rating, NeckArmor );
AddArmorRating( ref rating, HandArmor );
AddArmorRating( ref rating, HeadArmor );
AddArmorRating( ref rating, ArmsArmor );
AddArmorRating( ref rating, LegsArmor );
AddArmorRating( ref rating, ChestArmor );
AddArmorRating( ref rating, ShieldArmor );

return VirtualArmor + VirtualArmorMod + rating;
}
}

private void AddArmorRating( ref double rating, Item armor )
{
BaseArmor ar = armor as BaseArmor;

if( ar != null && ( !Core.AOS || ar.ArmorAttributes.MageArmor == 0 ))
rating += ar.ArmorRatingScaled;
}

#region [Stats]Max
[CommandProperty( AccessLevel.GameMaster )]
public override int HitsMax
{
get
{
int strBase;
int strOffs = GetStatOffset( StatType.Str );

if ( Core.AOS )
{
strBase = this.Str; //this.Str already includes GetStatOffset/str
strOffs = AosAttributes.GetValue( this, AosAttribute.BonusHits );

if ( AnimalForm.UnderTransformation( this, typeof( BakeKitsune ) ) || AnimalForm.UnderTransformation( this, typeof( GreyWolf ) ) )
strOffs += 20;
}
else
{
strBase = this.RawStr;
}

return (strBase / 2) + 50 + strOffs;
}
}

[CommandProperty( AccessLevel.GameMaster )]
public override int StamMax
{
get{ return base.StamMax + AosAttributes.GetValue( this, AosAttribute.BonusStam ); }
}

[CommandProperty( AccessLevel.GameMaster )]
public override int ManaMax
{
get{ return base.ManaMax + AosAttributes.GetValue( this, AosAttribute.BonusMana ) + ((Core.ML && Race == Race.Elf) ? 20 : 0); }
}
#endregion

#region Stat Getters/Setters

[CommandProperty( AccessLevel.GameMaster )]
public override int Str
{
get
{
if( Core.ML && this.AccessLevel == AccessLevel.Player )
return Math.Min( base.Str, 150 );

return base.Str;
}
set
{
base.Str = value;
}
}

[CommandProperty( AccessLevel.GameMaster )]
public override int Int
{
get
{
if( Core.ML && this.AccessLevel == AccessLevel.Player )
return Math.Min( base.Int, 150 );

return base.Int;
}
set
{
base.Int = value;
}
}

[CommandProperty( AccessLevel.GameMaster )]
public override int Dex
{
get
{
if( Core.ML && this.AccessLevel == AccessLevel.Player )
return Math.Min( base.Dex, 150 );

return base.Dex;
}
set
{
base.Dex = value;
}
}

#endregion

public override bool Move( Direction d )
{
NetState ns = this.NetState;

if ( ns != null )
{
if ( HasGump( typeof( ResurrectGump ) ) ) {
if ( Alive ) {
CloseGump( typeof( ResurrectGump ) );
} else {
SendLocalizedMessage( 500111 ); // You are frozen and cannot move.
return false;
}
}
}

TimeSpan speed = ComputeMovementSpeed( d );

bool res;

if ( !Alive )
Server.Movement.MovementImpl.IgnoreMovableImpassables = true;

res = base.Move( d );

Server.Movement.MovementImpl.IgnoreMovableImpassables = false;

if ( !res )
return false;

m_NextMovementTime += speed;

return true;
}

public override bool CheckMovement( Direction d, out int newZ )
{
DesignContext context = m_DesignContext;

if ( context == null )
return base.CheckMovement( d, out newZ );

HouseFoundation foundation = context.Foundation;

newZ = foundation.Z + HouseFoundation.GetLevelZ( context.Level, context.Foundation );

int newX = this.X, newY = this.Y;
Movement.Movement.Offset( d, ref newX, ref newY );

int startX = foundation.X + foundation.Components.Min.X + 1;
int startY = foundation.Y + foundation.Components.Min.Y + 1;
int endX = startX + foundation.Components.Width - 1;
int endY = startY + foundation.Components.Height - 2;

return ( newX >= startX && newY >= startY && newX < endX && newY < endY && Map == foundation.Map );
}

public override bool AllowItemUse( Item item )
{
return DesignContext.Check( this );
}

public SkillName[] AnimalFormRestrictedSkills{ get{ return m_AnimalFormRestrictedSkills; } }

private SkillName[] m_AnimalFormRestrictedSkills = new SkillName[]
{
SkillName.ArmsLore, SkillName.Begging, SkillName.Discordance, SkillName.Forensics,
SkillName.Inscribe, SkillName.ItemID, SkillName.Meditation, SkillName.Peacemaking,
SkillName.Provocation, SkillName.RemoveTrap, SkillName.SpiritSpeak, SkillName.Stealing,
SkillName.TasteID
};

public override bool AllowSkillUse( SkillName skill )
{
if ( AnimalForm.UnderTransformation( this ) )
{
for( int i = 0; i < m_AnimalFormRestrictedSkills.Length; i++ )
{
if( m_AnimalFormRestrictedSkills == skill )
{
SendLocalizedMessage( 1070771 ); // You cannot use that skill in this form.
return false;
}
}
}

return DesignContext.Check( this );
}

private bool m_LastProtectedMessage;
private int m_NextProtectionCheck = 10;

public virtual void RecheckTownProtection()
{
m_NextProtectionCheck = 10;

Regions.GuardedRegion reg = (Regions.GuardedRegion) this.Region.GetRegion( typeof( Regions.GuardedRegion ) );
bool isProtected = ( reg != null && !reg.IsDisabled() );

if ( isProtected != m_LastProtectedMessage )
{
if ( isProtected )
SendLocalizedMessage( 500112 ); // You are now under the protection of the town guards.
else
SendLocalizedMessage( 500113 ); // You have left the protection of the town guards.

m_LastProtectedMessage = isProtected;
}
}

public override void MoveToWorld( Point3D loc, Map map )
{
base.MoveToWorld( loc, map );

RecheckTownProtection();
}

public override void SetLocation( Point3D loc, bool isTeleport )
{
if ( !isTeleport && AccessLevel == AccessLevel.Player )
{
// moving, not teleporting
int zDrop = ( this.Location.Z - loc.Z );

if ( zDrop > 20 ) // we fell more than one story
Hits -= ((zDrop / 20) * 10) - 5; // deal some damage; does not kill, disrupt, etc
}

base.SetLocation( loc, isTeleport );

if ( isTeleport || --m_NextProtectionCheck == 0 )
RecheckTownProtection();
}

public override void GetContextMenuEntries( Mobile from, List<ContextMenuEntry> list )
{
base.GetContextMenuEntries( from, list );

if ( from == this )
{
if ( m_Quest != null )
m_Quest.GetContextMenuEntries( list );

if ( Alive && InsuranceEnabled )
{
list.Add( new CallbackEntry( 6201, new ContextCallback( ToggleItemInsurance ) ) );

if ( AutoRenewInsurance )
list.Add( new CallbackEntry( 6202, new ContextCallback( CancelRenewInventoryInsurance ) ) );
else
list.Add( new CallbackEntry( 6200, new ContextCallback( AutoRenewInventoryInsurance ) ) );
}

BaseHouse house = BaseHouse.FindHouseAt( this );

if ( house != null )
{
if ( Alive && house.InternalizedVendors.Count > 0 && house.IsOwner( this ) )
list.Add( new CallbackEntry( 6204, new ContextCallback( GetVendor ) ) );

if ( house.IsAosRules )
list.Add( new CallbackEntry( 6207, new ContextCallback( LeaveHouse ) ) );
}

if ( m_JusticeProtectors.Count > 0 )
list.Add( new CallbackEntry( 6157, new ContextCallback( CancelProtection ) ) );

if( Alive )
list.Add( new CallbackEntry( 6210, new ContextCallback( ToggleChampionTitleDisplay ) ) );
}
}

private void CancelProtection()
{
for ( int i = 0; i < m_JusticeProtectors.Count; ++i )
{
Mobile prot = m_JusticeProtectors;

string args = String.Format( "{0}\t{1}", this.Name, prot.Name );

prot.SendLocalizedMessage( 1049371, args ); // The protective relationship between ~1_PLAYER1~ and ~2_PLAYER2~ has been ended.
this.SendLocalizedMessage( 1049371, args ); // The protective relationship between ~1_PLAYER1~ and ~2_PLAYER2~ has been ended.
}

m_JusticeProtectors.Clear();
}

#region Insurance

private void ToggleItemInsurance()
{
if ( !CheckAlive() )
return;

BeginTarget( -1, false, TargetFlags.None, new TargetCallback( ToggleItemInsurance_Callback ) );
SendLocalizedMessage( 1060868 ); // Target the item you wish to toggle insurance status on <ESC> to cancel
}

private bool CanInsure( Item item )
{
if ( item is Container || item is BagOfSending || item is KeyRing )
return false;

if ( (item is Spellbook && item.LootType == LootType.Blessed)|| item is Runebook || item is PotionKeg || item is Sigil )
return false;

if ( item.Stackable )
return false;

if ( item.LootType == LootType.Cursed )
return false;

if ( item.ItemID == 0x204E ) // death shroud
return false;

return true;
}

private void ToggleItemInsurance_Callback( Mobile from, object obj )
{
if ( !CheckAlive() )
return;

Item item = obj as Item;

if ( item == null || !item.IsChildOf( this ) )
{
BeginTarget( -1, false, TargetFlags.None, new TargetCallback( ToggleItemInsurance_Callback ) );
SendLocalizedMessage( 1060871, "", 0x23 ); // You can only insure items that you have equipped or that are in your backpack
}
else if ( item.Insured )
{
item.Insured = false;

SendLocalizedMessage( 1060874, "", 0x35 ); // You cancel the insurance on the item

BeginTarget( -1, false, TargetFlags.None, new TargetCallback( ToggleItemInsurance_Callback ) );
SendLocalizedMessage( 1060868, "", 0x23 ); // Target the item you wish to toggle insurance status on <ESC> to cancel
}
else if ( !CanInsure( item ) )
{
BeginTarget( -1, false, TargetFlags.None, new TargetCallback( ToggleItemInsurance_Callback ) );
SendLocalizedMessage( 1060869, "", 0x23 ); // You cannot insure that
}
else if ( item.LootType == LootType.Blessed || item.LootType == LootType.Newbied || item.BlessedFor == from )
{
BeginTarget( -1, false, TargetFlags.None, new TargetCallback( ToggleItemInsurance_Callback ) );
SendLocalizedMessage( 1060870, "", 0x23 ); // That item is blessed and does not need to be insured
SendLocalizedMessage( 1060869, "", 0x23 ); // You cannot insure that
}
else
{
if ( !item.PayedInsurance )
{
if ( Banker.Withdraw( from, 600 ) )
{
SendLocalizedMessage( 1060398, "600" ); // ~1_AMOUNT~ gold has been withdrawn from your bank box.
item.PayedInsurance = true;
}
else
{
SendLocalizedMessage( 1061079, "", 0x23 ); // You lack the funds to purchase the insurance
return;
}
}

item.Insured = true;

SendLocalizedMessage( 1060873, "", 0x23 ); // You have insured the item

BeginTarget( -1, false, TargetFlags.None, new TargetCallback( ToggleItemInsurance_Callback ) );
SendLocalizedMessage( 1060868, "", 0x23 ); // Target the item you wish to toggle insurance status on <ESC> to cancel
}
}

private void AutoRenewInventoryInsurance()
{
if ( !CheckAlive() )
return;

SendLocalizedMessage( 1060881, "", 0x23 ); // You have selected to automatically reinsure all insured items upon death
AutoRenewInsurance = true;
}

private void CancelRenewInventoryInsurance()
{
if ( !CheckAlive() )
return;

if( Core.SE )
{
if( !HasGump( typeof( CancelRenewInventoryInsuranceGump ) ) )
SendGump( new CancelRenewInventoryInsuranceGump( this ) );
}
else
{
SendLocalizedMessage( 1061075, "", 0x23 ); // You have cancelled automatically reinsuring all insured items upon death
AutoRenewInsurance = false;
}
}

private class CancelRenewInventoryInsuranceGump : Gump
{
private PlayerMobile m_Player;

public CancelRenewInventoryInsuranceGump( PlayerMobile player ) : base( 250, 200 )
{
m_Player = player;

AddBackground( 0, 0, 240, 142, 0x13BE );
AddImageTiled( 6, 6, 228, 100, 0xA40 );
AddImageTiled( 6, 116, 228, 20, 0xA40 );
AddAlphaRegion( 6, 6, 228, 142 );

AddHtmlLocalized( 8, 8, 228, 100, 1071021, 0x7FFF, false, false ); // You are about to disable inventory insurance auto-renewal.

AddButton( 6, 116, 0xFB1, 0xFB2, 0, GumpButtonType.Reply, 0 );
AddHtmlLocalized( 40, 118, 450, 20, 1060051, 0x7FFF, false, false ); // CANCEL

AddButton( 114, 116, 0xFA5, 0xFA7, 1, GumpButtonType.Reply, 0 );
AddHtmlLocalized( 148, 118, 450, 20, 1071022, 0x7FFF, false, false ); // DISABLE IT!
}

public override void OnResponse( NetState sender, RelayInfo info )
{
if ( !m_Player.CheckAlive() )
return;

if ( info.ButtonID == 1 )
{
m_Player.SendLocalizedMessage( 1061075, "", 0x23 ); // You have cancelled automatically reinsuring all insured items upon death
m_Player.AutoRenewInsurance = false;
}
else
{
m_Player.SendLocalizedMessage( 1042021 ); // Cancelled.
}
}
}
#endregion

private void GetVendor()
{
BaseHouse house = BaseHouse.FindHouseAt( this );

if ( CheckAlive() && house != null && house.IsOwner( this ) && house.InternalizedVendors.Count > 0 )
{
CloseGump( typeof( ReclaimVendorGump ) );
SendGump( new ReclaimVendorGump( house ) );
}
}

private void LeaveHouse()
{
BaseHouse house = BaseHouse.FindHouseAt( this );

if ( house != null )
this.Location = house.BanLocation;
}

private delegate void ContextCallback();

private class CallbackEntry : ContextMenuEntry
{
private ContextCallback m_Callback;

public CallbackEntry( int number, ContextCallback callback ) : this( number, -1, callback )
{
}

public CallbackEntry( int number, int range, ContextCallback callback ) : base( number, range )
{
m_Callback = callback;
}

public override void OnClick()
{
if ( m_Callback != null )
m_Callback();
}
}

public override void DisruptiveAction()
{
if( Meditating )
{
RemoveBuff( BuffIcon.ActiveMeditation );
}

base.DisruptiveAction();
}
public override void OnDoubleClick( Mobile from )
{
if ( this == from && !Warmode )
{
IMount mount = Mount;

if ( mount != null && !DesignContext.Check( this ) )
return;
}

base.OnDoubleClick( from );
}

public override void DisplayPaperdollTo( Mobile to )
{
if ( DesignContext.Check( this ) )
base.DisplayPaperdollTo( to );
}

private static bool m_NoRecursion;

public override bool CheckEquip( Item item )
{
if ( !base.CheckEquip( item ) )
return false;

#region Factions
FactionItem factionItem = FactionItem.Find( item );

if ( factionItem != null )
{
Faction faction = Faction.Find( this );

if ( faction == null )
{
SendLocalizedMessage( 1010371 ); // You cannot equip a faction item!
return false;
}
else if ( faction != factionItem.Faction )
{
SendLocalizedMessage( 1010372 ); // You cannot equip an opposing faction's item!
return false;
}
else
{
int maxWearables = FactionItem.GetMaxWearables( this );

for ( int i = 0; i < Items.Count; ++i )
{
Item equiped = Items;

if ( item != equiped && FactionItem.Find( equiped ) != null )
{
if ( --maxWearables == 0 )
{
SendLocalizedMessage( 1010373 ); // You do not have enough rank to equip more faction items!
return false;
}
}
}
}
}
#endregion

if ( this.AccessLevel < AccessLevel.GameMaster && item.Layer != Layer.Mount && this.HasTrade )
{
BounceInfo bounce = item.GetBounce();

if ( bounce != null )
{
if ( bounce.m_Parent is Item )
{
Item parent = (Item) bounce.m_Parent;

if ( parent == this.Backpack || parent.IsChildOf( this.Backpack ) )
return true;
}
else if ( bounce.m_Parent == this )
{
return true;
}
}

SendLocalizedMessage( 1004042 ); // You can only equip what you are already carrying while you have a trade pending.
return false;
}

return true;
}

public override bool CheckTrade( Mobile to, Item item, SecureTradeContainer cont, bool message, bool checkItems, int plusItems, int plusWeight )
{
int msgNum = 0;

if ( cont == null )
{
if ( to.Holding != null )
msgNum = 1062727; // You cannot trade with someone who is dragging something.
else if ( this.HasTrade )
msgNum = 1062781; // You are already trading with someone else!
else if ( to.HasTrade )
msgNum = 1062779; // That person is already involved in a trade
}

if ( msgNum == 0 )
{
if ( cont != null )
{
plusItems += cont.TotalItems;
plusWeight += cont.TotalWeight;
}

if ( this.Backpack == null || !this.Backpack.CheckHold( this, item, false, checkItems, plusItems, plusWeight ) )
msgNum = 1004040; // You would not be able to hold this if the trade failed.
else if ( to.Backpack == null || !to.Backpack.CheckHold( to, item, false, checkItems, plusItems, plusWeight ) )
msgNum = 1004039; // The recipient of this trade would not be able to carry this.
else
msgNum = CheckContentForTrade( item );
}

if ( msgNum != 0 )
{
if ( message )
this.SendLocalizedMessage( msgNum );

return false;
}

return true;
}

private static int CheckContentForTrade( Item item )
{
if ( item is TrapableContainer && ((TrapableContainer)item).TrapType != TrapType.None )
return 1004044; // You may not trade trapped items.

if ( SkillHandlers.StolenItem.IsStolen( item ) )
return 1004043; // You may not trade recently stolen items.

if ( item is Container )
{
foreach ( Item subItem in item.Items )
{
int msg = CheckContentForTrade( subItem );

if ( msg != 0 )
return msg;
}
}

return 0;
}

public override bool CheckNonlocalDrop( Mobile from, Item item, Item target )
{
if ( !base.CheckNonlocalDrop( from, item, target ) )
return false;

if ( from.AccessLevel >= AccessLevel.GameMaster )
return true;

Container pack = this.Backpack;
if ( from == this && this.HasTrade && ( target == pack || target.IsChildOf( pack ) ) )
{
BounceInfo bounce = item.GetBounce();

if ( bounce != null && bounce.m_Parent is Item )
{
Item parent = (Item) bounce.m_Parent;

if ( parent == pack || parent.IsChildOf( pack ) )
return true;
}

SendLocalizedMessage( 1004041 ); // You can't do that while you have a trade pending.
return false;
}

return true;
}

protected override void OnLocationChange( Point3D oldLocation )
{
CheckLightLevels( false );

DesignContext context = m_DesignContext;

if ( context == null || m_NoRecursion )
return;

m_NoRecursion = true;

HouseFoundation foundation = context.Foundation;

int newX = this.X, newY = this.Y;
int newZ = foundation.Z + HouseFoundation.GetLevelZ( context.Level, context.Foundation );

int startX = foundation.X + foundation.Components.Min.X + 1;
int startY = foundation.Y + foundation.Components.Min.Y + 1;
int endX = startX + foundation.Components.Width - 1;
int endY = startY + foundation.Components.Height - 2;

if ( newX >= startX && newY >= startY && newX < endX && newY < endY && Map == foundation.Map )
{
if ( Z != newZ )
Location = new Point3D( X, Y, newZ );

m_NoRecursion = false;
return;
}

Location = new Point3D( foundation.X, foundation.Y, newZ );
Map = foundation.Map;

m_NoRecursion = false;
}

public override bool OnMoveOver( Mobile m )
{
if ( m is BaseCreature && !((BaseCreature)m).Controlled )
return false;

return base.OnMoveOver( m );
}

public override bool CheckShove( Mobile shoved )
{
if( TransformationSpellHelper.UnderTransformation( this, typeof( WraithFormSpell ) ) )
return true;
else
return base.CheckShove( shoved );
}


protected override void OnMapChange( Map oldMap )
{
if ( (Map != Faction.Facet && oldMap == Faction.Facet) || (Map == Faction.Facet && oldMap != Faction.Facet) )
InvalidateProperties();

DesignContext context = m_DesignContext;

if ( context == null || m_NoRecursion )
return;

m_NoRecursion = true;

HouseFoundation foundation = context.Foundation;

if ( Map != foundation.Map )
Map = foundation.Map;

m_NoRecursion = false;
}

public override void OnBeneficialAction( Mobile target, bool isCriminal )
{
if ( m_SentHonorContext != null )
m_SentHonorContext.OnSourceBeneficialAction( target );

base.OnBeneficialAction( target, isCriminal );
}

public override void OnDamage( int amount, Mobile from, bool willKill )
{
int disruptThreshold;

if ( !Core.AOS )
disruptThreshold = 0;
else if ( from != null && from.Player )
disruptThreshold = 18;
else
disruptThreshold = 25;

if ( amount > disruptThreshold )
{
BandageContext c = BandageContext.GetContext( this );

if ( c != null )
c.Slip();
}

if( Confidence.IsRegenerating( this ) )
Confidence.StopRegenerating( this );

WeightOverloading.FatigueOnDamage( this, amount );

if ( m_ReceivedHonorContext != null )
m_ReceivedHonorContext.OnTargetDamaged( from, amount );
if ( m_SentHonorContext != null )
m_SentHonorContext.OnSourceDamaged( from, amount );

base.OnDamage( amount, from, willKill );
}

public override void Resurrect()
{
bool wasAlive = this.Alive;

base.Resurrect();

if ( this.Alive && !wasAlive )
{
Item deathRobe = new DeathRobe();

if ( !EquipItem( deathRobe ) )
deathRobe.Delete();
}
}

public override double RacialSkillBonus
{
get
{
if( Core.ML && this.Race == Race.Human )
return 20.0;

return 0;
}
}

private Mobile m_InsuranceAward;
private int m_InsuranceCost;
private int m_InsuranceBonus;

public override bool OnBeforeDeath()
{
m_InsuranceCost = 0;
m_InsuranceAward = base.FindMostRecentDamager( false );

if ( m_InsuranceAward is BaseCreature )
{
Mobile master = ((BaseCreature)m_InsuranceAward).GetMaster();

if ( master != null )
m_InsuranceAward = master;
}

if ( m_InsuranceAward != null && (!m_InsuranceAward.Player || m_InsuranceAward == this) )
m_InsuranceAward = null;

if ( m_InsuranceAward is PlayerMobile )
((PlayerMobile)m_InsuranceAward).m_InsuranceBonus = 0;

if ( m_ReceivedHonorContext != null )
m_ReceivedHonorContext.OnTargetKilled();
if ( m_SentHonorContext != null )
m_SentHonorContext.OnSourceKilled();

return base.OnBeforeDeath();
}

private bool CheckInsuranceOnDeath( Item item )
{
if ( InsuranceEnabled && item.Insured )
{
if ( AutoRenewInsurance )
{
int cost = ( m_InsuranceAward == null ? 600 : 300 );

if ( Banker.Withdraw( this, cost ) )
{
m_InsuranceCost += cost;
item.PayedInsurance = true;
}
else
{
SendLocalizedMessage( 1061079, "", 0x23 ); // You lack the funds to purchase the insurance
item.PayedInsurance = false;
item.Insured = false;
}
}
else
{
item.PayedInsurance = false;
item.Insured = false;
}

if ( m_InsuranceAward != null )
{
if ( Banker.Deposit( m_InsuranceAward, 300 ) )
{
if ( m_InsuranceAward is PlayerMobile )
((PlayerMobile)m_InsuranceAward).m_InsuranceBonus += 300;
}
}

return true;
}

return false;
}

public override DeathMoveResult GetParentMoveResultFor( Item item )
{
if ( CheckInsuranceOnDeath( item ) )
return DeathMoveResult.MoveToBackpack;

DeathMoveResult res = base.GetParentMoveResultFor( item );

if ( res == DeathMoveResult.MoveToCorpse && item.Movable && this.Young )
res = DeathMoveResult.MoveToBackpack;

return res;
}

public override DeathMoveResult GetInventoryMoveResultFor( Item item )
{
if ( CheckInsuranceOnDeath( item ) )
return DeathMoveResult.MoveToBackpack;

DeathMoveResult res = base.GetInventoryMoveResultFor( item );

if ( res == DeathMoveResult.MoveToCorpse && item.Movable && this.Young )
res = DeathMoveResult.MoveToBackpack;

return res;
}

public override void OnDeath( Container c )
{
base.OnDeath( c );

HueMod = -1;
NameMod = null;
SavagePaintExpiration = TimeSpan.Zero;

SetHairMods( -1, -1 );

PolymorphSpell.StopTimer( this );
IncognitoSpell.StopTimer( this );
DisguiseGump.StopTimer( this );

EndAction( typeof( PolymorphSpell ) );
EndAction( typeof( IncognitoSpell ) );

MeerMage.StopEffect( this, false );

SkillHandlers.StolenItem.ReturnOnDeath( this, c );

if ( m_PermaFlags.Count > 0 )
{
m_PermaFlags.Clear();

if ( c is Corpse )
((Corpse)c).Criminal = true;

if ( SkillHandlers.Stealing.ClassicMode )
Criminal = true;
}

if ( this.Kills >= 5 && DateTime.Now >= m_NextJustAward )
{
Mobile m = FindMostRecentDamager( false );

if( m is BaseCreature )
m = ((BaseCreature)m).GetMaster();

if ( m != null && m is PlayerMobile && m != this )
{
bool gainedPath = false;

int pointsToGain = 0;

pointsToGain += (int) Math.Sqrt( this.GameTime.TotalSeconds * 4 );
pointsToGain *= 5;
pointsToGain += (int) Math.Pow( this.Skills.Total / 250, 2 );

if ( VirtueHelper.Award( m, VirtueName.Justice, pointsToGain, ref gainedPath ) )
{
if ( gainedPath )
m.SendLocalizedMessage( 1049367 ); // You have gained a path in Justice!
else
m.SendLocalizedMessage( 1049363 ); // You have gained in Justice.

m.FixedParticles( 0x375A, 9, 20, 5027, EffectLayer.Waist );
m.PlaySound( 0x1F7 );

m_NextJustAward = DateTime.Now + TimeSpan.FromMinutes( pointsToGain / 3 );
}
}
}

if ( m_InsuranceCost > 0 )
SendLocalizedMessage( 1060398, m_InsuranceCost.ToString() ); // ~1_AMOUNT~ gold has been withdrawn from your bank box.

if ( m_InsuranceAward is PlayerMobile )
{
PlayerMobile pm = (PlayerMobile)m_InsuranceAward;

if ( pm.m_InsuranceBonus > 0 )
pm.SendLocalizedMessage( 1060397, pm.m_InsuranceBonus.ToString() ); // ~1_AMOUNT~ gold has been deposited into your bank box.
}

Mobile killer = this.FindMostRecentDamager( true );

if ( killer is BaseCreature )
{
BaseCreature bc = (BaseCreature)killer;

Mobile master = bc.GetMaster();
if( master != null )
killer = master;
}

if ( this.Young )
{
if ( YoungDeathTeleport() )
Timer.DelayCall( TimeSpan.FromSeconds( 2.5 ), new TimerCallback( SendYoungDeathNotice ) );
}

Faction.HandleDeath( this, killer );

Server.Guilds.Guild.HandleDeath( this, killer );

if( m_BuffTable != null )
{
List<BuffInfo> list = new List<BuffInfo>();

foreach( BuffInfo buff in m_BuffTable.Values )
{
if( !buff.RetainThroughDeath )
{
list.Add( buff );
}
}

for( int i = 0; i < list.Count; i++ )
{
RemoveBuff( list );
}
}
}

private List<Mobile> m_PermaFlags;
private List<Mobile> m_VisList;
private Hashtable m_AntiMacroTable;
private TimeSpan m_GameTime;
private TimeSpan m_ShortTermElapse;
private TimeSpan m_LongTermElapse;
private DateTime m_SessionStart;
private DateTime m_LastEscortTime;
private DateTime m_NextSmithBulkOrder;
private DateTime m_NextTailorBulkOrder;
private DateTime m_SavagePaintExpiration;
private SkillName m_Learning = (SkillName)(-1);

public SkillName Learning
{
get{ return m_Learning; }
set{ m_Learning = value; }
}

[CommandProperty( AccessLevel.GameMaster )]
public TimeSpan SavagePaintExpiration
{
get
{
TimeSpan ts = m_SavagePaintExpiration - DateTime.Now;

if ( ts < TimeSpan.Zero )
ts = TimeSpan.Zero;

return ts;
}
set
{
m_SavagePaintExpiration = DateTime.Now + value;
}
}

[CommandProperty( AccessLevel.GameMaster )]
public TimeSpan NextSmithBulkOrder
{
get
{
TimeSpan ts = m_NextSmithBulkOrder - DateTime.Now;

if ( ts < TimeSpan.Zero )
ts = TimeSpan.Zero;

return ts;
}
set
{
try{ m_NextSmithBulkOrder = DateTime.Now + value; }
catch{}
}
}

[CommandProperty( AccessLevel.GameMaster )]
public TimeSpan NextTailorBulkOrder
{
get
{
TimeSpan ts = m_NextTailorBulkOrder - DateTime.Now;

if ( ts < TimeSpan.Zero )
ts = TimeSpan.Zero;

return ts;
}
set
{
try{ m_NextTailorBulkOrder = DateTime.Now + value; }
catch{}
}
}

[CommandProperty( AccessLevel.GameMaster )]
public DateTime LastEscortTime
{
get{ return m_LastEscortTime; }
set{ m_LastEscortTime = value; }
}

public PlayerMobile()
{
m_VisList = new List<Mobile>();
m_PermaFlags = new List<Mobile>();
m_AntiMacroTable = new Hashtable();

m_BOBFilter = new Engines.BulkOrders.BOBFilter();

m_GameTime = TimeSpan.Zero;
m_ShortTermElapse = TimeSpan.FromHours( 8.0 );
m_LongTermElapse = TimeSpan.FromHours( 40.0 );

m_JusticeProtectors = new List<Mobile>();
m_GuildRank = Guilds.RankDefinition.Lowest;

m_ChampionTitles = new ChampionTitleInfo();

InvalidateMyRunUO();
}

public override bool MutateSpeech( List<Mobile> hears, ref string text, ref object context )
{
if ( Alive )
return false;

if ( Core.AOS )
{
for ( int i = 0; i < hears.Count; ++i )
{
Mobile m = hears;

if ( m != this && m.Skills[SkillName.SpiritSpeak].Value >= 100.0 )
return false;
}
}

return base.MutateSpeech( hears, ref text, ref context );
}

public override void DoSpeech( string text, int[] keywords, MessageType type, int hue )
{
if( Guilds.Guild.NewGuildSystem && (type == MessageType.Guild || type == MessageType.Alliance) )
{
Guilds.Guild g = this.Guild as Guilds.Guild;
if( g == null )
{
SendLocalizedMessage( 1063142 ); // You are not in a guild!
}
else if( type == MessageType.Alliance )
{
if( g.Alliance != null && g.Alliance.IsMember( g ) )
{
//g.Alliance.AllianceTextMessage( hue, "[Alliance][{0}]: {1}", this.Name, text );
g.Alliance.AllianceChat( this, text );
SendToStaffMessage( this, "[Alliance]: {0}", text );

m_AllianceMessageHue = hue;
}
else
{
SendLocalizedMessage( 1071020 ); // You are not in an alliance!
}
}
else //Type == MessageType.Guild
{
m_GuildMessageHue = hue;

g.GuildChat( this, text );
SendToStaffMessage( this, "[Guild]: {0}", text );
}
}
else
{
base.DoSpeech( text, keywords, type, hue );
}
}

private static void SendToStaffMessage( Mobile from, string text )
{
Packet p = null;

foreach( NetState ns in from.GetClientsInRange( 8 ) )
{
Mobile mob = ns.Mobile;

if( mob != null && mob.AccessLevel >= AccessLevel.GameMaster && mob.AccessLevel > from.AccessLevel )
{
if( p == null )
p = Packet.Acquire( new UnicodeMessage( from.Serial, from.Body, MessageType.Regular, from.SpeechHue, 3, from.Language, from.Name, text ) );

ns.Send( p );
}
}

Packet.Release( p );
}
private static void SendToStaffMessage( Mobile from, string format, params object[] args )
{
SendToStaffMessage( from, String.Format( format, args ) );
}

public override void Damage( int amount, Mobile from )
{
if ( Spells.Necromancy.EvilOmenSpell.CheckEffect( this ) )
amount = (int)(amount * 1.25);

Mobile oath = Spells.Necromancy.BloodOathSpell.GetBloodOath( from );

if ( oath == this )
{
amount = (int)(amount * 1.1);
from.Damage( amount, from );
}

base.Damage( amount, from );
}

#region Poison
public override ApplyPoisonResult ApplyPoison( Mobile from, Poison poison )
{
if ( !Alive )
return ApplyPoisonResult.Immune;

if ( Spells.Necromancy.EvilOmenSpell.CheckEffect( this ) )
poison = PoisonImpl.IncreaseLevel( poison );

ApplyPoisonResult result = base.ApplyPoison( from, poison );

if ( from != null && result == ApplyPoisonResult.Poisoned && PoisonTimer is PoisonImpl.PoisonTimer )
(PoisonTimer as PoisonImpl.PoisonTimer).From = from;

return result;
}

public override bool CheckPoisonImmunity( Mobile from, Poison poison )
{
if ( this.Young )
return true;

return base.CheckPoisonImmunity( from, poison );
}

public override void OnPoisonImmunity( Mobile from, Poison poison )
{
if ( this.Young )
SendLocalizedMessage( 502808 ); // You would have been poisoned, were you not new to the land of Britannia. Be careful in the future.
else
base.OnPoisonImmunity( from, poison );
}
#endregion

public PlayerMobile( Serial s ) : base( s )
{
m_VisList = new List<Mobile>();
m_AntiMacroTable = new Hashtable();
InvalidateMyRunUO();
}

public List<Mobile> VisibilityList
{
get{ return m_VisList; }
}

public List<Mobile> PermaFlags
{
get{ return m_PermaFlags; }
}

public override int Luck{ get{ return AosAttributes.GetValue( this, AosAttribute.Luck ); } }

public override bool IsHarmfulCriminal( Mobile target )
{
if ( SkillHandlers.Stealing.ClassicMode && target is PlayerMobile && ((PlayerMobile)target).m_PermaFlags.Count > 0 )
{
int noto = Notoriety.Compute( this, target );

if ( noto == Notoriety.Innocent )
target.Delta( MobileDelta.Noto );

return false;
}

if ( target is BaseCreature && ((BaseCreature)target).InitialInnocent && !((BaseCreature)target).Controlled )
return false;

return base.IsHarmfulCriminal( target );
}

public bool AntiMacroCheck( Skill skill, object obj )
{
if ( obj == null || m_AntiMacroTable == null || this.AccessLevel != AccessLevel.Player )
return true;

Hashtable tbl = (Hashtable)m_AntiMacroTable[skill];
if ( tbl == null )
m_AntiMacroTable[skill] = tbl = new Hashtable();

CountAndTimeStamp count = (CountAndTimeStamp)tbl[obj];
if ( count != null )
{
if ( count.TimeStamp + SkillCheck.AntiMacroExpire <= DateTime.Now )
{
count.Count = 1;
return true;
}
else
{
++count.Count;
if ( count.Count <= SkillCheck.Allowance )
return true;
else
return false;
}
}
else
{
tbl[obj] = count = new CountAndTimeStamp();
count.Count = 1;

return true;
}
}

private void RevertHair()
{
SetHairMods( -1, -1 );
}

private Engines.BulkOrders.BOBFilter m_BOBFilter;

public Engines.BulkOrders.BOBFilter BOBFilter
{
get{ return m_BOBFilter; }
}



public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();

switch ( version )
{
#region Mondain's Legacy
case 26:
{
m_AnkhNextUse = reader.ReadDateTime();

goto case 25;
}
#endregion
case 25:
{
int recipeCount = reader.ReadInt();

if( recipeCount > 0 )
{
m_AcquiredRecipes = new Dictionary<int, bool>();

for( int i = 0; i < recipeCount; i++ )
{
int r = reader.ReadInt();
if( reader.ReadBool() ) //Don't add in recipies which we haven't gotten or have been removed
m_AcquiredRecipes.Add( r, true );
}
}
goto case 24;
}
case 24:
{
m_LastHonorLoss = reader.ReadDeltaTime();
goto case 23;
}
case 23:
{
m_ChampionTitles = new ChampionTitleInfo( reader );
goto case 22;
}
case 22:
{
m_LastValorLoss = reader.ReadDateTime();
goto case 21;
}
case 21:
{
m_ToTItemsTurnedIn = reader.ReadEncodedInt();
m_ToTTotalMonsterFame = reader.ReadInt();
goto case 20;
}
case 20:
{
m_AllianceMessageHue = reader.ReadEncodedInt();
m_GuildMessageHue = reader.ReadEncodedInt();

goto case 19;
}
case 19:
{
int rank = reader.ReadEncodedInt();
int maxRank = Guilds.RankDefinition.Ranks.Length -1;
if( rank > maxRank )
rank = maxRank;

m_GuildRank = Guilds.RankDefinition.Ranks[rank];
m_LastOnline = reader.ReadDateTime();
goto case 18;
}
case 18:
{
m_SolenFriendship = (SolenFriendship) reader.ReadEncodedInt();

goto case 17;
}
case 17: // changed how DoneQuests is serialized
case 16:
{
m_Quest = QuestSerializer.DeserializeQuest( reader );

if ( m_Quest != null )
m_Quest.From = this;

int count = reader.ReadEncodedInt();

if ( count > 0 )
{
m_DoneQuests = new List<QuestRestartInfo>();

for ( int i = 0; i < count; ++i )
{
Type questType = QuestSerializer.ReadType( QuestSystem.QuestTypes, reader );
DateTime restartTime;

if ( version < 17 )
restartTime = DateTime.MaxValue;
else
restartTime = reader.ReadDateTime();

m_DoneQuests.Add( new QuestRestartInfo( questType, restartTime ) );
}
}

m_Profession = reader.ReadEncodedInt();
goto case 15;
}
case 15:
{
m_LastCompassionLoss = reader.ReadDeltaTime();
goto case 14;
}
case 14:
{
m_CompassionGains = reader.ReadEncodedInt();

if ( m_CompassionGains > 0 )
m_NextCompassionDay = reader.ReadDeltaTime();

goto case 13;
}
case 13: // just removed m_PayedInsurance list
case 12:
{
m_BOBFilter = new Engines.BulkOrders.BOBFilter( reader );
goto case 11;
}
case 11:
{
if ( version < 13 )
{
List<Item> payed = reader.ReadStrongItemList();

for ( int i = 0; i < payed.Count; ++i )
payed.PayedInsurance = true;
}

goto case 10;
}
case 10:
{
if ( reader.ReadBool() )
{
m_HairModID = reader.ReadInt();
m_HairModHue = reader.ReadInt();
m_BeardModID = reader.ReadInt();
m_BeardModHue = reader.ReadInt();

// We cannot call SetHairMods( -1, -1 ) here because the items have not yet loaded
Timer.DelayCall( TimeSpan.Zero, new TimerCallback( RevertHair ) );
}

goto case 9;
}
case 9:
{
SavagePaintExpiration = reader.ReadTimeSpan();

if ( SavagePaintExpiration > TimeSpan.Zero )
{
BodyMod = ( Female ? 184 : 183 );
HueMod = 0;
}

goto case 8;
}
case 8:
{
m_NpcGuild = (NpcGuild)reader.ReadInt();
m_NpcGuildJoinTime = reader.ReadDateTime();
m_NpcGuildGameTime = reader.ReadTimeSpan();
goto case 7;
}
case 7:
{
m_PermaFlags = reader.ReadStrongMobileList();
goto case 6;
}
case 6:
{
NextTailorBulkOrder = reader.ReadTimeSpan();
goto case 5;
}
case 5:
{
NextSmithBulkOrder = reader.ReadTimeSpan();
goto case 4;
}
case 4:
{
m_LastJusticeLoss = reader.ReadDeltaTime();
m_JusticeProtectors = reader.ReadStrongMobileList();
goto case 3;
}
case 3:
{
m_LastSacrificeGain = reader.ReadDeltaTime();
m_LastSacrificeLoss = reader.ReadDeltaTime();
m_AvailableResurrects = reader.ReadInt();
goto case 2;
}
case 2:
{
m_Flags = (PlayerFlag)reader.ReadInt();
goto case 1;
}
case 1:
{
m_LongTermElapse = reader.ReadTimeSpan();
m_ShortTermElapse = reader.ReadTimeSpan();
m_GameTime = reader.ReadTimeSpan();
goto case 0;
}
case 0:
{
break;
}
}

// Professions weren't verified on 1.0 RC0
if ( !CharacterCreation.VerifyProfession( m_Profession ) )
m_Profession = 0;

if ( m_PermaFlags == null )
m_PermaFlags = new List<Mobile>();

if ( m_JusticeProtectors == null )
m_JusticeProtectors = new List<Mobile>();

if ( m_BOBFilter == null )
m_BOBFilter = new Engines.BulkOrders.BOBFilter();

if( m_GuildRank == null )
m_GuildRank = Guilds.RankDefinition.Member; //Default to member if going from older verstion to new version (only time it should be null)

if( m_LastOnline == DateTime.MinValue && Account != null )
m_LastOnline = ((Account)Account).LastLogin;

if( m_ChampionTitles == null )
m_ChampionTitles = new ChampionTitleInfo();

List<Mobile> list = this.Stabled;

for ( int i = 0; i < list.Count; ++i )
{
BaseCreature bc = list as BaseCreature;

if ( bc != null )
bc.IsStabled = true;
}

CheckAtrophies( this );


if( Hidden ) //Hiding is the only buff where it has an effect that's serialized.
AddBuff( new BuffInfo( BuffIcon.HidingAndOrStealth, 1075655 ) );
}

public override void Serialize( GenericWriter writer )
{
//cleanup our anti-macro table
foreach ( Hashtable t in m_AntiMacroTable.Values )
{
ArrayList remove = new ArrayList();
foreach ( CountAndTimeStamp time in t.Values )
{
if ( time.TimeStamp + SkillCheck.AntiMacroExpire <= DateTime.Now )
remove.Add( time );
}

for (int i=0;i<remove.Count;++i)
t.Remove( remove );
}

//decay our kills
if ( m_ShortTermElapse < this.GameTime )
{
m_ShortTermElapse += TimeSpan.FromHours( 8 );
if ( ShortTermMurders > 0 )
--ShortTermMurders;
}

if ( m_LongTermElapse < this.GameTime )
{
m_LongTermElapse += TimeSpan.FromHours( 40 );
if ( Kills > 0 )
--Kills;
}

CheckAtrophies( this );

base.Serialize( writer );

writer.Write( (int) 26 ); // version

#region Veteran Rewards
writer.Write( (DateTime) m_AnkhNextUse );
#endregion

if ( m_AcquiredRecipes == null )
{
writer.Write( (int)0 );
}
else
{
writer.Write( m_AcquiredRecipes.Count );

foreach( KeyValuePair<int, bool> kvp in m_AcquiredRecipes )
{
writer.Write( kvp.Key );
writer.Write( kvp.Value );
}
}

writer.WriteDeltaTime( m_LastHonorLoss );

ChampionTitleInfo.Serialize( writer, m_ChampionTitles );

writer.Write( m_LastValorLoss );
writer.WriteEncodedInt( m_ToTItemsTurnedIn );
writer.Write( m_ToTTotalMonsterFame ); //This ain't going to be a small #.

writer.WriteEncodedInt( m_AllianceMessageHue );
writer.WriteEncodedInt( m_GuildMessageHue );

writer.WriteEncodedInt( m_GuildRank.Rank );
writer.Write( m_LastOnline );

writer.WriteEncodedInt( (int) m_SolenFriendship );

QuestSerializer.Serialize( m_Quest, writer );

if ( m_DoneQuests == null )
{
writer.WriteEncodedInt( (int) 0 );
}
else
{
writer.WriteEncodedInt( (int) m_DoneQuests.Count );

for ( int i = 0; i < m_DoneQuests.Count; ++i )
{
QuestRestartInfo restartInfo = m_DoneQuests;

QuestSerializer.Write( (Type) restartInfo.QuestType, QuestSystem.QuestTypes, writer );
writer.Write( (DateTime) restartInfo.RestartTime );
}
}

writer.WriteEncodedInt( (int) m_Profession );

writer.WriteDeltaTime( m_LastCompassionLoss );

writer.WriteEncodedInt( m_CompassionGains );

if ( m_CompassionGains > 0 )
writer.WriteDeltaTime( m_NextCompassionDay );

m_BOBFilter.Serialize( writer );

bool useMods = ( m_HairModID != -1 || m_BeardModID != -1 );

writer.Write( useMods );

if ( useMods )
{
writer.Write( (int) m_HairModID );
writer.Write( (int) m_HairModHue );
writer.Write( (int) m_BeardModID );
writer.Write( (int) m_BeardModHue );
}

writer.Write( SavagePaintExpiration );

writer.Write( (int) m_NpcGuild );
writer.Write( (DateTime) m_NpcGuildJoinTime );
writer.Write( (TimeSpan) m_NpcGuildGameTime );

writer.Write( m_PermaFlags, true );

writer.Write( NextTailorBulkOrder );

writer.Write( NextSmithBulkOrder );

writer.WriteDeltaTime( m_LastJusticeLoss );
writer.Write( m_JusticeProtectors, true );

writer.WriteDeltaTime( m_LastSacrificeGain );
writer.WriteDeltaTime( m_LastSacrificeLoss );
writer.Write( m_AvailableResurrects );

writer.Write( (int) m_Flags );

writer.Write( m_LongTermElapse );
writer.Write( m_ShortTermElapse );
writer.Write( this.GameTime );
}



public static void CheckAtrophies( Mobile m )
{
SacrificeVirtue.CheckAtrophy( m );
JusticeVirtue.CheckAtrophy( m );
CompassionVirtue.CheckAtrophy( m );
ValorVirtue.CheckAtrophy( m );
HonorVirtue.CheckAtrophy( m );

if( m is PlayerMobile )
ChampionTitleInfo.CheckAtrophy( (PlayerMobile)m );
}

public void ResetKillTime()
{
m_ShortTermElapse = this.GameTime + TimeSpan.FromHours( 8 );
m_LongTermElapse = this.GameTime + TimeSpan.FromHours( 40 );
}

[CommandProperty( AccessLevel.GameMaster )]
public DateTime SessionStart
{
get{ return m_SessionStart; }
}

[CommandProperty( AccessLevel.GameMaster )]
public TimeSpan GameTime
{
get
{
if ( NetState != null )
return m_GameTime + (DateTime.Now - m_SessionStart);
else
return m_GameTime;
}
}

public override bool CanSee( Mobile m )
{
#region Veteran Rewards
if ( m is CharacterStatue )
((CharacterStatue) m).OnRequestedAnimation( this );
#endregion

if ( m is PlayerMobile && ((PlayerMobile)m).m_VisList.Contains( this ) )
return true;

return base.CanSee( m );
}

public override bool CanSee( Item item )
{
if ( m_DesignContext != null && m_DesignContext.Foundation.IsHiddenToCustomizer( item ) )
return false;

return base.CanSee( item );
}

public override void OnAfterDelete()
{
base.OnAfterDelete();

Faction faction = Faction.Find( this );

if ( faction != null )
faction.RemoveMember( this );

BaseHouse.HandleDeletion( this );
}

public override bool NewGuildDisplay { get { return Server.Guilds.Guild.NewGuildSystem; } }

public override void GetProperties( ObjectPropertyList list )
{
base.GetProperties( list );

if ( Map == Faction.Facet )
{
PlayerState pl = PlayerState.Find( this );

if ( pl != null )
{
Faction faction = pl.Faction;

if ( faction.Commander == this )
list.Add( 1042733, faction.Definition.PropName ); // Commanding Lord of the ~1_FACTION_NAME~
else if ( pl.Sheriff != null )
list.Add( 1042734, "{0}\t{1}", pl.Sheriff.Definition.FriendlyName, faction.Definition.PropName ); // The Sheriff of ~1_CITY~, ~2_FACTION_NAME~
else if ( pl.Finance != null )
list.Add( 1042735, "{0}\t{1}", pl.Finance.Definition.FriendlyName, faction.Definition.PropName ); // The Finance Minister of ~1_CITY~, ~2_FACTION_NAME~
else if ( pl.MerchantTitle != MerchantTitle.None )
list.Add( 1060776, "{0}\t{1}", MerchantTitles.GetInfo( pl.MerchantTitle ).Title, faction.Definition.PropName ); // ~1_val~, ~2_val~
else
list.Add( 1060776, "{0}\t{1}", pl.Rank.Title, faction.Definition.PropName ); // ~1_val~, ~2_val~
}
}
}

public override void OnSingleClick( Mobile from )
{
if ( Map == Faction.Facet )
{
PlayerState pl = PlayerState.Find( this );

if ( pl != null )
{
string text;
bool ascii = false;

Faction faction = pl.Faction;

if ( faction.Commander == this )
text = String.Concat( this.Female ? "(Commanding Lady of the " : "(Commanding Lord of the ", faction.Definition.FriendlyName, ")" );
else if ( pl.Sheriff != null )
text = String.Concat( "(The Sheriff of ", pl.Sheriff.Definition.FriendlyName, ", ", faction.Definition.FriendlyName, ")" );
else if ( pl.Finance != null )
text = String.Concat( "(The Finance Minister of ", pl.Finance.Definition.FriendlyName, ", ", faction.Definition.FriendlyName, ")" );
else
{
ascii = true;

if ( pl.MerchantTitle != MerchantTitle.None )
text = String.Concat( "(", MerchantTitles.GetInfo( pl.MerchantTitle ).Title.String, ", ", faction.Definition.FriendlyName, ")" );
else
text = String.Concat( "(", pl.Rank.Title.String, ", ", faction.Definition.FriendlyName, ")" );
}

int hue = ( Faction.Find( from ) == faction ? 98 : 38 );

PrivateOverheadMessage( MessageType.Label, hue, ascii, text, from.NetState );
}
}

base.OnSingleClick( from );
}

protected override bool OnMove( Direction d )
{
if( !Core.SE )
return base.OnMove( d );

if( AccessLevel != AccessLevel.Player )
return true;

if( Hidden && DesignContext.Find( this ) == null ) //Hidden & NOT customizing a house
{
if( !Mounted && Skills.Stealth.Value >= 25.0 )
{
bool running = (d & Direction.Running) != 0;

if( running )
{
if( (AllowedStealthSteps -= 2) <= 0 )
RevealingAction();
}
else if( AllowedStealthSteps-- <= 0 )
{
Server.SkillHandlers.Stealth.OnUse( this );
}
}
else
{
RevealingAction();
}
}

return true;
}

private bool m_BedrollLogout;

public bool BedrollLogout
{
get{ return m_BedrollLogout; }
set{ m_BedrollLogout = value; }
}

[CommandProperty( AccessLevel.GameMaster )]
public override bool Paralyzed
{
get
{
return base.Paralyzed;
}
set
{
base.Paralyzed = value;

if( value )
AddBuff( new BuffInfo( BuffIcon.Paralyze, 1075827 ) ); //Paralyze/You are frozen and can not move
else
RemoveBuff( BuffIcon.Paralyze );
}
}

#region Ethics
private Ethics.Player m_EthicPlayer;

[CommandProperty( AccessLevel.GameMaster )]
public Ethics.Player EthicPlayer
{
get { return m_EthicPlayer; }
set { m_EthicPlayer = value; }
}
#endregion

#region Factions
private PlayerState m_FactionPlayerState;

public PlayerState FactionPlayerState
{
get{ return m_FactionPlayerState; }
set{ m_FactionPlayerState = value; }
}
#endregion

#region Quests
private QuestSystem m_Quest;
private List<QuestRestartInfo> m_DoneQuests;
private SolenFriendship m_SolenFriendship;

public QuestSystem Quest
{
get{ return m_Quest; }
set{ m_Quest = value; }
}

public List<QuestRestartInfo> DoneQuests
{
get{ return m_DoneQuests; }
set{ m_DoneQuests = value; }
}

[CommandProperty( AccessLevel.GameMaster )]
public SolenFriendship SolenFriendship
{
get{ return m_SolenFriendship; }
set{ m_SolenFriendship = value; }
}
#endregion

#region MyRunUO Invalidation
private bool m_ChangedMyRunUO;

public bool ChangedMyRunUO
{
get{ return m_ChangedMyRunUO; }
set{ m_ChangedMyRunUO = value; }
}

public void InvalidateMyRunUO()
{
if ( !Deleted && !m_ChangedMyRunUO )
{
m_ChangedMyRunUO = true;
Engines.MyRunUO.MyRunUO.QueueMobileUpdate( this );
}
}

public override void OnKillsChange( int oldValue )
{
if ( this.Young && this.Kills > oldValue )
{
Account acc = this.Account as Account;

if ( acc != null )
acc.RemoveYoungStatus( 0 );
}

InvalidateMyRunUO();
}

public override void OnGenderChanged( bool oldFemale )
{
InvalidateMyRunUO();
}

public override void OnGuildChange( Server.Guilds.BaseGuild oldGuild )
{
InvalidateMyRunUO();
}

public override void OnGuildTitleChange( string oldTitle )
{
InvalidateMyRunUO();
}

public override void OnKarmaChange( int oldValue )
{
InvalidateMyRunUO();
}

public override void OnFameChange( int oldValue )
{
InvalidateMyRunUO();
}

public override void OnSkillChange( SkillName skill, double oldBase )
{
if ( this.Young && this.SkillsTotal >= 4500 )
{
Account acc = this.Account as Account;

if ( acc != null )
acc.RemoveYoungStatus( 1019036 ); // You have successfully obtained a respectable skill level, and have outgrown your status as a young player!
}

InvalidateMyRunUO();
}

public override void OnAccessLevelChanged( AccessLevel oldLevel )
{
InvalidateMyRunUO();
}

public override void OnRawStatChange( StatType stat, int oldValue )
{
InvalidateMyRunUO();
}

public override void OnDelete()
{
if ( m_ReceivedHonorContext != null )
m_ReceivedHonorContext.Cancel();
if ( m_SentHonorContext != null )
m_SentHonorContext.Cancel();

InvalidateMyRunUO();
}
#endregion

#region Fastwalk Prevention
private static bool FastwalkPrevention = true; // Is fastwalk prevention enabled?
private static TimeSpan FastwalkThreshold = TimeSpan.FromSeconds( 0.4 ); // Fastwalk prevention will become active after 0.4 seconds

private DateTime m_NextMovementTime;

public virtual bool UsesFastwalkPrevention{ get{ return ( AccessLevel < AccessLevel.Counselor ); } }

public override TimeSpan ComputeMovementSpeed( Direction dir, bool checkTurning )
{
if ( checkTurning && (dir & Direction.Mask) != (this.Direction & Direction.Mask) )
return TimeSpan.FromSeconds( 0.1 ); // We are NOT actually moving (just a direction change)

TransformContext context = TransformationSpellHelper.GetContext( this );

if ( context != null && context.Type == typeof( ReaperFormSpell ) )
return Mobile.WalkFoot;

bool running = ( (dir & Direction.Running) != 0 );

bool onHorse = ( this.Mount != null );

AnimalFormContext animalContext = AnimalForm.GetContext( this );

if( onHorse || (animalContext != null && animalContext.SpeedBoost) )
return ( running ? Mobile.RunMount : Mobile.WalkMount );

return ( running ? Mobile.RunFoot : Mobile.WalkFoot );
}

public static bool MovementThrottle_Callback( NetState ns )
{
PlayerMobile pm = ns.Mobile as PlayerMobile;

if ( pm == null || !pm.UsesFastwalkPrevention )
return true;

if ( pm.m_NextMovementTime == DateTime.MinValue )
{
// has not yet moved
pm.m_NextMovementTime = DateTime.Now;
return true;
}

TimeSpan ts = pm.m_NextMovementTime - DateTime.Now;

if ( ts < TimeSpan.Zero )
{
// been a while since we've last moved
pm.m_NextMovementTime = DateTime.Now;
return true;
}

return ( ts < FastwalkThreshold );
}
#endregion

#region Enemy of One
private Type m_EnemyOfOneType;
private bool m_WaitingForEnemy;

public Type EnemyOfOneType
{
get{ return m_EnemyOfOneType; }
set
{
Type oldType = m_EnemyOfOneType;
Type newType = value;

if ( oldType == newType )
return;

m_EnemyOfOneType = value;

DeltaEnemies( oldType, newType );
}
}

public bool WaitingForEnemy
{
get{ return m_WaitingForEnemy; }
set{ m_WaitingForEnemy = value; }
}

private void DeltaEnemies( Type oldType, Type newType )
{
foreach ( Mobile m in this.GetMobilesInRange( 18 ) )
{
Type t = m.GetType();

if ( t == oldType || t == newType )
Send( new MobileMoving( m, Notoriety.Compute( this, m ) ) );
}
}
#endregion

#region Hair and beard mods
private int m_HairModID = -1, m_HairModHue;
private int m_BeardModID = -1, m_BeardModHue;

public void SetHairMods( int hairID, int beardID )
{
if ( hairID == -1 )
InternalRestoreHair( true, ref m_HairModID, ref m_HairModHue );
else if ( hairID != -2 )
InternalChangeHair( true, hairID, ref m_HairModID, ref m_HairModHue );

if ( beardID == -1 )
InternalRestoreHair( false, ref m_BeardModID, ref m_BeardModHue );
else if ( beardID != -2 )
InternalChangeHair( false, beardID, ref m_BeardModID, ref m_BeardModHue );
}

private void CreateHair( bool hair, int id, int hue )
{
if( hair )
{
//TODO Verification?
HairItemID = id;
HairHue = hue;
}
else
{
FacialHairItemID = id;
FacialHairHue = hue;
}
}

private void InternalRestoreHair( bool hair, ref int id, ref int hue )
{
if ( id == -1 )
return;

if ( hair )
HairItemID = 0;
else
FacialHairItemID = 0;

//if( id != 0 )
CreateHair( hair, id, hue );

id = -1;
hue = 0;
}

private void InternalChangeHair( bool hair, int id, ref int storeID, ref int storeHue )
{
if ( storeID == -1 )
{
storeID = hair ? HairItemID : FacialHairItemID;
storeHue = hair ? HairHue : FacialHairHue;
}
CreateHair( hair, id, 0 );
}
#endregion

#region Virtues
private DateTime m_LastSacrificeGain;
private DateTime m_LastSacrificeLoss;
private int m_AvailableResurrects;

public DateTime LastSacrificeGain{ get{ return m_LastSacrificeGain; } set{ m_LastSacrificeGain = value; } }
public DateTime LastSacrificeLoss{ get{ return m_LastSacrificeLoss; } set{ m_LastSacrificeLoss = value; } }

[CommandProperty( AccessLevel.GameMaster )]
public int AvailableResurrects{ get{ return m_AvailableResurrects; } set{ m_AvailableResurrects = value; } }

private DateTime m_NextJustAward;
private DateTime m_LastJusticeLoss;
private List<Mobile> m_JusticeProtectors;

public DateTime LastJusticeLoss{ get{ return m_LastJusticeLoss; } set{ m_LastJusticeLoss = value; } }
public List<Mobile> JusticeProtectors { get { return m_JusticeProtectors; } set { m_JusticeProtectors = value; } }

private DateTime m_LastCompassionLoss;
private DateTime m_NextCompassionDay;
private int m_CompassionGains;

public DateTime LastCompassionLoss{ get{ return m_LastCompassionLoss; } set{ m_LastCompassionLoss = value; } }
public DateTime NextCompassionDay{ get{ return m_NextCompassionDay; } set{ m_NextCompassionDay = value; } }
public int CompassionGains{ get{ return m_CompassionGains; } set{ m_CompassionGains = value; } }

private DateTime m_LastValorLoss;

public DateTime LastValorLoss { get { return m_LastValorLoss; } set { m_LastValorLoss = value; } }

private DateTime m_LastHonorLoss;
private DateTime m_LastHonorUse;
private bool m_HonorActive;
private HonorContext m_ReceivedHonorContext;
private HonorContext m_SentHonorContext;

public DateTime LastHonorLoss{ get{ return m_LastHonorLoss; } set{ m_LastHonorLoss = value; } }
public DateTime LastHonorUse{ get{ return m_LastHonorUse; } set{ m_LastHonorUse = value; } }
public bool HonorActive{ get{ return m_HonorActive; } set{ m_HonorActive = value; } }
public HonorContext ReceivedHonorContext{ get{ return m_ReceivedHonorContext; } set{ m_ReceivedHonorContext = value; } }
public HonorContext SentHonorContext{ get{ return m_SentHonorContext; } set{ m_SentHonorContext = value; } }
#endregion

#region Young system
[CommandProperty( AccessLevel.GameMaster )]
public bool Young
{
get{ return GetFlag( PlayerFlag.Young ); }
set{ SetFlag( PlayerFlag.Young, value ); InvalidateProperties(); }
}

public override string ApplyNameSuffix( string suffix )
{
if ( Young )
{
if ( suffix.Length == 0 )
suffix = "(Young)";
else
suffix = String.Concat( suffix, " (Young)" );
}

#region Ethics
if ( m_EthicPlayer != null )
{
if ( suffix.Length == 0 )
suffix = m_EthicPlayer.Ethic.Definition.Adjunct.String;
else
suffix = String.Concat( suffix, " ", m_EthicPlayer.Ethic.Definition.Adjunct.String );
}
#endregion

return base.ApplyNameSuffix( suffix );
}


public override TimeSpan GetLogoutDelay()
{
if ( Young || BedrollLogout || TestCenter.Enabled )
return TimeSpan.Zero;

return base.GetLogoutDelay();
}

private DateTime m_LastYoungMessage = DateTime.MinValue;

public bool CheckYoungProtection( Mobile from )
{
if ( !this.Young )
return false;

if ( Region.IsPartOf( typeof( DungeonRegion ) ) )
return false;

if( from is BaseCreature && ((BaseCreature)from).IgnoreYoungProtection )
return false;

if ( this.Quest != null && this.Quest.IgnoreYoungProtection( from ) )
return false;

if ( DateTime.Now - m_LastYoungMessage > TimeSpan.FromMinutes( 1.0 ) )
{
m_LastYoungMessage = DateTime.Now;
SendLocalizedMessage( 1019067 ); // A monster looks at you menacingly but does not attack. You would be under attack now if not for your status as a new citizen of Britannia.
}

return true;
}

private DateTime m_LastYoungHeal = DateTime.MinValue;

public bool CheckYoungHealTime()
{
if ( DateTime.Now - m_LastYoungHeal > TimeSpan.FromMinutes( 5.0 ) )
{
m_LastYoungHeal = DateTime.Now;
return true;
}

return false;
}

private static Point3D[] m_TrammelDeathDestinations = new Point3D[]
{
new Point3D( 1481, 1612, 20 ),
new Point3D( 2708, 2153, 0 ),
new Point3D( 2249, 1230, 0 ),
new Point3D( 5197, 3994, 37 ),
new Point3D( 1412, 3793, 0 ),
new Point3D( 3688, 2232, 20 ),
new Point3D( 2578, 604, 0 ),
new Point3D( 4397, 1089, 0 ),
new Point3D( 5741, 3218, -2 ),
new Point3D( 2996, 3441, 15 ),
new Point3D( 624, 2225, 0 ),
new Point3D( 1916, 2814, 0 ),
new Point3D( 2929, 854, 0 ),
new Point3D( 545, 967, 0 ),
new Point3D( 3665, 2587, 0 )
};

private static Point3D[] m_IlshenarDeathDestinations = new Point3D[]
{
new Point3D( 1216, 468, -13 ),
new Point3D( 723, 1367, -60 ),
new Point3D( 745, 725, -28 ),
new Point3D( 281, 1017, 0 ),
new Point3D( 986, 1011, -32 ),
new Point3D( 1175, 1287, -30 ),
new Point3D( 1533, 1341, -3 ),
new Point3D( 529, 217, -44 ),
new Point3D( 1722, 219, 96 )
};

private static Point3D[] m_MalasDeathDestinations = new Point3D[]
{
new Point3D( 2079, 1376, -70 ),
new Point3D( 944, 519, -71 )
};

private static Point3D[] m_TokunoDeathDestinations = new Point3D[]
{
new Point3D( 1166, 801, 27 ),
new Point3D( 782, 1228, 25 ),
new Point3D( 268, 624, 15 )
};

public bool YoungDeathTeleport()
{
if ( this.Region.IsPartOf( typeof( Jail ) )
|| this.Region.IsPartOf( "Samurai start location" )
|| this.Region.IsPartOf( "Ninja start location" )
|| this.Region.IsPartOf( "Ninja cave" ) )
return false;

Point3D loc;
Map map;

DungeonRegion dungeon = (DungeonRegion) this.Region.GetRegion( typeof( DungeonRegion ) );
if ( dungeon != null && dungeon.EntranceLocation != Point3D.Zero )
{
loc = dungeon.EntranceLocation;
map = dungeon.EntranceMap;
}
else
{
loc = this.Location;
map = this.Map;
}

Point3D[] list;

if ( map == Map.Trammel )
list = m_TrammelDeathDestinations;
else if ( map == Map.Ilshenar )
list = m_IlshenarDeathDestinations;
else if ( map == Map.Malas )
list = m_MalasDeathDestinations;
else if ( map == Map.Tokuno )
list = m_TokunoDeathDestinations;
else
return false;

Point3D dest = Point3D.Zero;
int sqDistance = int.MaxValue;

for ( int i = 0; i < list.Length; i++ )
{
Point3D curDest = list;

int width = loc.X - curDest.X;
int height = loc.Y - curDest.Y;
int curSqDistance = width * width + height * height;

if ( curSqDistance < sqDistance )
{
dest = curDest;
sqDistance = curSqDistance;
}
}

this.MoveToWorld( dest, map );
return true;
}

private void SendYoungDeathNotice()
{
this.SendGump( new YoungDeathNotice() );
}
#endregion

#region Speech log
private SpeechLog m_SpeechLog;

public SpeechLog SpeechLog{ get{ return m_SpeechLog; } }

public override void OnSpeech( SpeechEventArgs e )
{
if ( SpeechLog.Enabled && this.NetState != null )
{
if ( m_SpeechLog == null )
m_SpeechLog = new SpeechLog();

m_SpeechLog.Add( e.Mobile, e.Speech );
}
}
#endregion

#region Champion Titles
[CommandProperty( AccessLevel.GameMaster )]
public bool DisplayChampionTitle
{
get { return GetFlag( PlayerFlag.DisplayChampionTitle ); }
set { SetFlag( PlayerFlag.DisplayChampionTitle, value ); }
}

private ChampionTitleInfo m_ChampionTitles;

[CommandProperty( AccessLevel.GameMaster )]
public ChampionTitleInfo ChampionTitles { get { return m_ChampionTitles; } set { } }

private void ToggleChampionTitleDisplay()
{
if( !CheckAlive() )
return;

if( DisplayChampionTitle )
SendLocalizedMessage( 1062419, "", 0x23 ); // You have chosen to hide your monster kill title.
else
SendLocalizedMessage( 1062418, "", 0x23 ); // You have chosen to display your monster kill title.

DisplayChampionTitle = !DisplayChampionTitle;
}

[PropertyObject]
public class ChampionTitleInfo
{
public static TimeSpan LossDelay = TimeSpan.FromDays( 1.0 );
public const int LossAmount = 90;

private class TitleInfo
{
private int m_Value;
private DateTime m_LastDecay;

public int Value { get { return m_Value; } set { m_Value = value; } }
public DateTime LastDecay { get { return m_LastDecay; } set { m_LastDecay = value; } }

public TitleInfo()
{
}

public TitleInfo( GenericReader reader )
{
int version = reader.ReadEncodedInt();

switch( version )
{
case 0:
{
m_Value = reader.ReadEncodedInt();
m_LastDecay = reader.ReadDateTime();
break;
}
}
}

public static void Serialize( GenericWriter writer, TitleInfo info )
{
writer.WriteEncodedInt( (int)0 ); // version

writer.WriteEncodedInt( info.m_Value );
writer.Write( info.m_LastDecay );
}

}
private TitleInfo[] m_Values;

private int m_Harrower; //Harrower titles do NOT decay


public int GetValue( ChampionSpawnType type )
{
return GetValue( (int)type );
}

public void SetValue( ChampionSpawnType type, int value )
{
SetValue( (int)type, value );
}

public void Award( ChampionSpawnType type, int value )
{
Award( (int)type, value );
}

public int GetValue( int index )
{
if( m_Values == null || index < 0 || index >= m_Values.Length )
return 0;

if( m_Values[index] == null )
m_Values[index] = new TitleInfo();

return m_Values[index].Value;
}

public DateTime GetLastDecay( int index )
{
if( m_Values == null || index < 0 || index >= m_Values.Length )
return DateTime.MinValue;

if( m_Values[index] == null )
m_Values[index] = new TitleInfo();

return m_Values[index].LastDecay;
}

public void SetValue( int index, int value )
{
if( m_Values == null )
m_Values = new TitleInfo[ChampionSpawnInfo.Table.Length];

if( value < 0 )
value = 0;

if( index < 0 || index >= m_Values.Length )
return;

if( m_Values[index] == null )
m_Values[index] = new TitleInfo();

m_Values[index].Value = value;
}

public void Award( int index, int value )
{
if( m_Values == null )
m_Values = new TitleInfo[ChampionSpawnInfo.Table.Length];

if( index < 0 || index >= m_Values.Length || value <= 0 )
return;

if( m_Values[index] == null )
m_Values[index] = new TitleInfo();

m_Values[index].Value += value;
}

public void Atrophy( int index, int value )
{
if( m_Values == null )
m_Values = new TitleInfo[ChampionSpawnInfo.Table.Length];

if( index < 0 || index >= m_Values.Length || value <= 0 )
return;

if( m_Values[index] == null )
m_Values[index] = new TitleInfo();

int before = m_Values[index].Value;

if( (m_Values[index].Value - value) < 0 )
m_Values[index].Value = 0;
else
m_Values[index].Value -= value;

if( before != m_Values[index].Value )
m_Values[index].LastDecay = DateTime.Now;
}

public override string ToString()
{
return "...";
}

[CommandProperty( AccessLevel.GameMaster )]
public int Abyss { get { return GetValue( ChampionSpawnType.Abyss ); } set { SetValue( ChampionSpawnType.Abyss, value ); } }

[CommandProperty( AccessLevel.GameMaster )]
public int Arachnid { get { return GetValue( ChampionSpawnType.Arachnid ); } set { SetValue( ChampionSpawnType.Arachnid, value ); } }

[CommandProperty( AccessLevel.GameMaster )]
public int ColdBlood { get { return GetValue( ChampionSpawnType.ColdBlood ); } set { SetValue( ChampionSpawnType.ColdBlood, value ); } }

[CommandProperty( AccessLevel.GameMaster )]
public int ForestLord { get { return GetValue( ChampionSpawnType.ForestLord ); } set { SetValue( ChampionSpawnType.ForestLord, value ); } }

[CommandProperty( AccessLevel.GameMaster )]
public int SleepingDragon { get { return GetValue( ChampionSpawnType.SleepingDragon ); } set { SetValue( ChampionSpawnType.SleepingDragon, value ); } }

[CommandProperty( AccessLevel.GameMaster )]
public int UnholyTerror { get { return GetValue( ChampionSpawnType.UnholyTerror ); } set { SetValue( ChampionSpawnType.UnholyTerror, value ); } }

[CommandProperty( AccessLevel.GameMaster )]
public int VerminHorde { get { return GetValue( ChampionSpawnType.VerminHorde ); } set { SetValue( ChampionSpawnType.VerminHorde, value ); } }

[CommandProperty( AccessLevel.GameMaster )]
public int Harrower { get { return m_Harrower; } set { m_Harrower = value; } }

public ChampionTitleInfo()
{
}

public ChampionTitleInfo( GenericReader reader )
{
int version = reader.ReadEncodedInt();

switch( version )
{
case 0:
{
m_Harrower = reader.ReadEncodedInt();

int length = reader.ReadEncodedInt();
m_Values = new TitleInfo[length];

for( int i = 0; i < length; i++ )
{
m_Values = new TitleInfo( reader );
}

if( m_Values.Length != ChampionSpawnInfo.Table.Length )
{
TitleInfo[] oldValues = m_Values;
m_Values = new TitleInfo[ChampionSpawnInfo.Table.Length];

for( int i = 0; i < m_Values.Length && i < oldValues.Length; i++ )
{
m_Values = oldValues;
}
}
break;
}
}
}

public static void Serialize( GenericWriter writer, ChampionTitleInfo titles )
{
writer.WriteEncodedInt( (int)0 ); // version

writer.WriteEncodedInt( titles.m_Harrower );

int length = titles.m_Values.Length;
writer.WriteEncodedInt( length );

for( int i = 0; i < length; i++ )
{
if( titles.m_Values == null )
titles.m_Values = new TitleInfo();

TitleInfo.Serialize( writer, titles.m_Values );
}
}

public static void CheckAtrophy( PlayerMobile pm )
{
ChampionTitleInfo t = pm.m_ChampionTitles;
if( t == null )
return;

if( t.m_Values == null )
t.m_Values = new TitleInfo[ChampionSpawnInfo.Table.Length];

for( int i = 0; i < t.m_Values.Length; i++ )
{
if( (t.GetLastDecay( i ) + LossDelay) < DateTime.Now )
{
t.Atrophy( i, LossAmount );
}
}
}

public static void AwardHarrowerTitle( PlayerMobile pm ) //Called when killing a harrower. Will give a minimum of 1 point.
{
ChampionTitleInfo t = pm.m_ChampionTitles;
if( t == null )
return;

if( t.m_Values == null )
t.m_Values = new TitleInfo[ChampionSpawnInfo.Table.Length];

int count = 1;

for( int i = 0; i < t.m_Values.Length; i++ )
{
if( t.m_Values.Value > 900 )
count++;
}

t.m_Harrower = Math.Max( count, t.m_Harrower ); //Harrower titles never decay.
}
}
#endregion

#region Recipes

private Dictionary<int, bool> m_AcquiredRecipes;

public virtual bool HasRecipe( Recipe r )
{
if( r == null )
return false;

return HasRecipe( r.ID );
}

public virtual bool HasRecipe( int recipeID )
{
if( m_AcquiredRecipes != null && m_AcquiredRecipes.ContainsKey( recipeID ) )
return m_AcquiredRecipes[recipeID];

return false;
}

public virtual void AcquireRecipe( Recipe r )
{
if( r != null )
AcquireRecipe( r.ID );
}

public virtual void AcquireRecipe( int recipeID )
{
if( m_AcquiredRecipes == null )
m_AcquiredRecipes = new Dictionary<int, bool>();

m_AcquiredRecipes[recipeID] = true;
}

public virtual void ResetRecipes()
{
m_AcquiredRecipes = null;
}

[CommandProperty( AccessLevel.GameMaster )]
public int KnownRecipes
{
get
{
if( m_AcquiredRecipes == null )
return 0;

return m_AcquiredRecipes.Count;
}
}


#endregion

#region Buff Icons

public void ResendBuffs()
{
if( !BuffInfo.Enabled || m_BuffTable == null )
return;

NetState state = this.NetState;

if( state != null && state.Version >= BuffInfo.RequiredClient )
{
foreach( BuffInfo info in m_BuffTable.Values )
{
state.Send( new AddBuffPacket( this, info ) );
}
}
}

private Dictionary<BuffIcon, BuffInfo> m_BuffTable;

public void AddBuff( BuffInfo b )
{
if( !BuffInfo.Enabled || b == null )
return;

RemoveBuff( b ); //Check & subsequently remove the old one.

if( m_BuffTable == null )
m_BuffTable = new Dictionary<BuffIcon, BuffInfo>();

m_BuffTable.Add( b.ID, b );

NetState state = this.NetState;

if( state != null && state.Version >= BuffInfo.RequiredClient )
{
state.Send( new AddBuffPacket( this, b ) );
}
}

public void RemoveBuff( BuffInfo b )
{
if( b == null )
return;

RemoveBuff( b.ID );
}

public void RemoveBuff( BuffIcon b )
{
if( m_BuffTable == null || !m_BuffTable.ContainsKey( b ) )
return;

BuffInfo info = m_BuffTable;

if( info.Timer != null && info.Timer.Running )
info.Timer.Stop();

m_BuffTable.Remove( b );

NetState state = this.NetState;

if( state != null && state.Version >= BuffInfo.RequiredClient )
{
state.Send( new RemoveBuffPacket( this, b ) );
}

if( m_BuffTable.Count <= 0 )
m_BuffTable = null;
}
#endregion
}
}



here is minihouse.cs



using System;
using Server;

namespace Server.Items
{
public class MiniHouseAddon : BaseAddon
{
private MiniHouseType m_Type;

[CommandProperty( AccessLevel.GameMaster )]
public MiniHouseType Type
{
get{ return m_Type; }
set{ m_Type = value; Construct(); }
}

public override BaseAddonDeed Deed{ get{ return new MiniHouseDeed( m_Type ); } }

[Constructable]
public MiniHouseAddon() : this( MiniHouseType.StoneAndPlaster )
{
}

[Constructable]
public MiniHouseAddon( MiniHouseType type )
{
m_Type = type;

Construct();
}

public void Construct()
{
#region Veteran Rewards
foreach ( AddonComponent c in Components )
{
c.Addon = null;
c.Delete();
}
#endregion

Components.Clear();

MiniHouseInfo info = MiniHouseInfo.GetInfo( m_Type );

int size = (int)Math.Sqrt( info.Graphics.Length );
int num = 0;

for ( int y = 0; y < size; ++y )
for ( int x = 0; x < size; ++x )
if ( info.Graphics[num] != 0x1 ) // Veteran Rewards Mod
AddComponent( new AddonComponent( info.Graphics[num++] ), size - x - 1, size - y - 1, 0 );
}

public MiniHouseAddon( Serial serial ) : base( serial )
{
}

public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );

writer.Write( (int) 0 ); // version

writer.Write( (int) m_Type );
}

public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );

int version = reader.ReadInt();

switch ( version )
{
case 0:
{
m_Type = (MiniHouseType)reader.ReadInt();
break;
}
}
}
}

public class MiniHouseDeed : BaseAddonDeed
{
private MiniHouseType m_Type;

[CommandProperty( AccessLevel.GameMaster )]
public MiniHouseType Type
{
get{ return m_Type; }
set{ m_Type = value; InvalidateProperties(); }
}

public override BaseAddon Addon{ get{ return new MiniHouseAddon( m_Type ); } }
public override int LabelNumber{ get{ return 1062096; } } // a mini house deed

public override void GetProperties( ObjectPropertyList list )
{
base.GetProperties( list );

list.Add( MiniHouseInfo.GetInfo( m_Type ).LabelNumber );
}

[Constructable]
public MiniHouseDeed() : this( MiniHouseType.StoneAndPlaster )
{
}

[Constructable]
public MiniHouseDeed( MiniHouseType type )
{
m_Type = type;

Weight = 1.0;
LootType = LootType.Blessed;
}

public MiniHouseDeed( Serial serial ) : base( serial )
{
}

public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );

writer.Write( (int) 0 ); // version

writer.Write( (int) m_Type );
}

public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );

int version = reader.ReadInt();

switch ( version )
{
case 0:
{
m_Type = (MiniHouseType)reader.ReadInt();
break;
}
}

if ( Weight == 0.0 )
Weight = 1.0;
}
}

public enum MiniHouseType
{
StoneAndPlaster,
FieldStone,
SmallBrick,
Wooden,
WoodAndPlaster,
ThatchedRoof,
Brick,
TwoStoryWoodAndPlaster,
TwoStoryStoneAndPlaster,
Tower,
SmallStoneKeep,
Castle,
LargeHouseWithPatio,
MarbleHouseWithPatio,
SmallStoneTower,
TwoStoryLogCabin,
TwoStoryVilla,
SandstoneHouseWithPatio,
SmallStoneWorkshop,
SmallMarbleWorkshop
}

public class MiniHouseInfo
{
private int[] m_Graphics;
private int m_LabelNumber;

public int[] Graphics{ get{ return m_Graphics; } }
public int LabelNumber{ get{ return m_LabelNumber; } }

public MiniHouseInfo( int start, int count, int labelNumber )
{
m_Graphics = new int[count];

for ( int i = 0; i < count; ++i )
m_Graphics = start + i;

m_LabelNumber = labelNumber;
}

public MiniHouseInfo( int labelNumber, params int[] graphics )
{
m_LabelNumber = labelNumber;
m_Graphics = graphics;
}

private static MiniHouseInfo[] m_Info = new MiniHouseInfo[]
{
/* Stone and plaster house */ new MiniHouseInfo( 0x22C4, 1, 1011303 ),
/* Field stone house */ new MiniHouseInfo( 0x22DE, 1, 1011304 ),
/* Small brick house */ new MiniHouseInfo( 0x22DF, 1, 1011305 ),
/* Wooden house */ new MiniHouseInfo( 0x22C9, 1, 1011306 ),
/* Wood and plaster house */ new MiniHouseInfo( 0x22E0, 1, 1011307 ),
/* Thatched-roof cottage */ new MiniHouseInfo( 0x22E1, 1, 1011308 ),
/* Brick house */ new MiniHouseInfo( 1011309, 0x22CD, 0x22CB, 0x22CC, 0x22CA ),
/* Two-story wood and plaster house */ new MiniHouseInfo( 1011310, 0x2301, 0x2302, 0x2304, 0x2303 ),
/* Two-story stone and plaster house */ new MiniHouseInfo( 1011311, 0x22FC, 0x22FD, 0x22FF, 0x22FE ),
/* Tower */ new MiniHouseInfo( 1011312, 0x22F7, 0x22F8, 0x22FA, 0x22F9 ),
/* Small stone keep */ new MiniHouseInfo( 0x22E6, 9, 1011313 ),
/* Castle */ new MiniHouseInfo( 1011314, 0x22CE, 0x22D0, 0x22D2, 0x22D7, 0x22CF, 0x22D1, 0x22D4, 0x22D9, 0x22D3, 0x22D5, 0x22D6, 0x22DB, 0x22D8, 0x22DA, 0x22DC, 0x22DD ),
/* Large house with patio */ new MiniHouseInfo( 0x22E2, 4, 1011315 ),
/* Marble house with patio */ new MiniHouseInfo( 0x22EF, 4, 1011316 ),
/* Small stone tower */ new MiniHouseInfo( 0x22F5, 1, 1011317 ),
/* Two-story log cabin */ new MiniHouseInfo( 0x22FB, 1, 1011318 ),
/* Two-story villa */ new MiniHouseInfo( 0x2300, 1, 1011319 ),
/* Sandstone house with patio */ new MiniHouseInfo( 0x22F3, 1, 1011320 ),
/* Small stone workshop */ new MiniHouseInfo( 0x22F6, 1, 1011321 ),
/* Small marble workshop */ new MiniHouseInfo( 0x22F4, 1, 1011322 )
};

public static MiniHouseInfo GetInfo( MiniHouseType type )
{
int v = (int)type;

if ( v < 0 || v >= m_Info.Length )
v = 0;

return m_Info[v];
}
}
}



Thanks again
 

PappaSmurf

Knight
kat20;781093 said:
I thought that it might be, thank you for the continued help I figured out the problem there however now I am having this error which has something to do with the playermobile.cs, here is the error.............



RunUO - [www.runuo.com] Version 2.0, Build 2949.24683
Core: Running on .NET Framework Version 2.0.50727
Scripts: Compiling C# scripts...failed (35 errors, 1 warnings)
Warnings:
+ Customs/ShardEvent.cs:
CS0114: Line 470: 'Server.Custom.ShardEvent.Location' hides inherited member
'Server.Item.Location'. To make the current member override that implementation
, add the override keyword. Otherwise add the new keyword.
CS0108: Line 472: 'Server.Custom.ShardEvent.Map' hides inherited member 'Ser
ver.Item.Map'. Use the new keyword if hiding was intended.
CS0472: Line 271: The result of the expression is always 'true' since a valu
e of type 'int' is never equal to 'null' of type 'int?'
Errors:
+ Customs/Veteran Rewards/ContestMiniHouse.cs:
CS0117: Line 30: 'Server.Items.MiniHouseType' does not contain a definition
for 'MalasMountainPass'
CS0117: Line 85: 'Server.Items.MiniHouseType' does not contain a definition
for 'MalasMountainPass'
+ Spells/Base/Spell.cs:
CS0117: Line 486: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Peaced'
+ Engines/VeteranRewards/RewardChoiceGump.cs:
CS1501: Line 93: No overload for method 'RenderCategory' takes '3' arguments

+ Engines/VeteranRewards/RewardSystem.cs:
CS0117: Line 288: 'Server.Items.MiniHouseType' does not contain a definition
for 'MalasMountainPass'
CS0117: Line 289: 'Server.Items.MiniHouseType' does not contain a definition
for 'ChurchAtNight'
+ Items/Deeds/CommodityDeed.cs:
CS0117: Line 103: 'Server.Items.ICommodity' does not contain a definition fo
r 'DescriptionNumber'
+ Mondain's Legacy/Engines/Community Collections/BaseCollectionMobile.cs:
CS0117: Line 259: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'AddCollectionPoints'
CS0117: Line 279: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'AddCollectionPoints'
+ Mondain's Legacy/Engines/Community Collections/Britain Library/ArtsSection.cs
:
CS0117: Line 103: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'LibraryFriend'
+ Mondain's Legacy/Engines/Community Collections/Britain Library/BritanniaWater
s.cs:
CS0117: Line 99: 'Server.Mobiles.PlayerMobile' does not contain a definition
for 'LibraryFriend'
+ Mondain's Legacy/Engines/Community Collections/Britain Library/FoldedSteel.cs
:
CS0117: Line 99: 'Server.Mobiles.PlayerMobile' does not contain a definition
for 'LibraryFriend'
+ Mondain's Legacy/Engines/Community Collections/Britain Library/LightAndMight.
cs:
CS0117: Line 116: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'LibraryFriend'
+ Mondain's Legacy/Engines/Community Collections/Britain Library/MaceAndBlade.c
s:
CS0117: Line 98: 'Server.Mobiles.PlayerMobile' does not contain a definition
for 'LibraryFriend'
+ Mondain's Legacy/Engines/Community Collections/Britain Library/OilAndOubliett
e.cs:
CS0117: Line 99: 'Server.Mobiles.PlayerMobile' does not contain a definition
for 'LibraryFriend'
+ Mondain's Legacy/Engines/Community Collections/Britain Library/PastTreasures.
cs:
CS0117: Line 104: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'LibraryFriend'
+ Mondain's Legacy/Engines/Community Collections/Britain Library/SkeletonKey.cs
:
CS0117: Line 100: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'LibraryFriend'
+ Mondain's Legacy/Engines/Community Collections/Britain Library/SongsOfNote.cs
:
CS0117: Line 94: 'Server.Mobiles.PlayerMobile' does not contain a definition
for 'LibraryFriend'
+ Mondain's Legacy/Engines/Community Collections/Britain Library/Trades.cs:
CS0117: Line 109: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'LibraryFriend'
+ Mondain's Legacy/Engines/Community Collections/Britain Library/UnderstandingA
nimals.cs:
CS0117: Line 96: 'Server.Mobiles.PlayerMobile' does not contain a definition
for 'LibraryFriend'
+ Mondain's Legacy/Engines/Community Collections/Britain Library/WizardsCompend
ium.cs:
CS0117: Line 103: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'LibraryFriend'
+ Mondain's Legacy/Engines/Community Collections/BaseCollectionItem.cs:
CS0117: Line 222: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'AddCollectionPoints'
CS0117: Line 242: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'AddCollectionPoints'
+ Mondain's Legacy/Engines/Community Collections/CollectionItem.cs:
CS0117: Line 85: 'Server.Mobiles.PlayerMobile' does not contain a definition
for 'AddCollectionTitle'
CS0117: Line 92: 'Server.Mobiles.PlayerMobile' does not contain a definition
for 'AddCollectionPoints'
+ Mondain's Legacy/Engines/Community Collections/ComunityCollectionGump.cs:
CS0117: Line 179: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'GetCollectionPoints'
CS0117: Line 236: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'GetCollectionPoints'
CS0117: Line 299: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'GetCollectionPoints'
+ Mondain's Legacy/Engines/Community Collections/SelectTitleGump.cs:
CS0117: Line 36: 'Server.Mobiles.PlayerMobile' does not contain a definition
for 'CollectionTitles'
CS0117: Line 38: 'Server.Mobiles.PlayerMobile' does not contain a definition
for 'CollectionTitles'
CS0117: Line 39: 'Server.Mobiles.PlayerMobile' does not contain a definition
for 'CollectionTitles'
CS0117: Line 40: 'Server.Mobiles.PlayerMobile' does not contain a definition
for 'CollectionTitles'
CS0117: Line 41: 'Server.Mobiles.PlayerMobile' does not contain a definition
for 'CollectionTitles'
CS0117: Line 58: 'Server.Mobiles.PlayerMobile' does not contain a definition
for 'SelectCollectionTitle'
CS0117: Line 60: 'Server.Mobiles.PlayerMobile' does not contain a definition
for 'CollectionTitles'
CS0117: Line 62: 'Server.Mobiles.PlayerMobile' does not contain a definition
for 'CollectionTitles'
+ Mondain's Legacy/Engines/Quests/Gumps/MondainQuestGump.cs:
CS0117: Line 130: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Quests'
CS0117: Line 132: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Quests'
CS0117: Line 582: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Quests'
CS0117: Line 585: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Quests'
+ Mondain's Legacy/Engines/Quests/Helpers/QuestHelper.cs:
CS0117: Line 64: 'Server.Mobiles.PlayerMobile' does not contain a definition
for 'Chains'
CS0117: Line 77: 'Server.Mobiles.PlayerMobile' does not contain a definition
for 'Quests'
CS0117: Line 79: 'Server.Mobiles.PlayerMobile' does not contain a definition
for 'Quests'
CS0117: Line 150: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Quests'
CS0117: Line 152: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Quests'
CS0117: Line 173: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Quests'
CS0117: Line 175: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Quests'
CS0117: Line 214: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Quests'
CS0117: Line 216: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Quests'
CS0117: Line 252: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Quests'
CS0117: Line 508: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Quests'
CS0117: Line 510: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Quests'
CS0117: Line 545: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Quests'
CS0117: Line 547: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Quests'
CS0117: Line 573: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Quests'
CS0117: Line 575: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Quests'
CS0117: Line 603: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Quests'
CS0117: Line 605: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Quests'
CS0117: Line 634: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Quests'
CS0117: Line 636: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Quests'
CS0117: Line 675: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Quests'
CS0117: Line 678: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Quests'
CS0117: Line 679: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Quests'
CS0117: Line 684: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Quests'
CS0117: Line 687: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Quests'
CS0117: Line 688: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Quests'
CS0117: Line 725: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Quests'
CS0117: Line 727: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Quests'
+ Mondain's Legacy/Engines/Quests/Regions/ApprenticeRegion.cs:
CS0117: Line 32: 'Server.Mobiles.PlayerMobile' does not contain a definition
for 'Quests'
CS0117: Line 34: 'Server.Mobiles.PlayerMobile' does not contain a definition
for 'Quests'
CS0117: Line 69: 'Server.Mobiles.PlayerMobile' does not contain a definition
for 'Quests'
CS0117: Line 71: 'Server.Mobiles.PlayerMobile' does not contain a definition
for 'Quests'
+ Mondain's Legacy/Engines/Quests/MondainQuester.cs:
CS0117: Line 65: 'Server.Mobiles.PlayerMobile' does not contain a definition
for 'Chains'
+ Mondain's Legacy/Engines/Quests/BaseQuest.cs:
CS0117: Line 169: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Chains'
CS0117: Line 171: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Chains'
CS0117: Line 188: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Chains'
CS0117: Line 207: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Quests'
CS0117: Line 380: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Chains'
CS0117: Line 394: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Quests'
CS0117: Line 396: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Quests'
CS0117: Line 398: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Quests'
+ Mondain's Legacy/Engines/Quests/BaseQuestItem.cs:
CS0117: Line 63: 'Server.Mobiles.PlayerMobile' does not contain a definition
for 'Chains'
+ Mondain's Legacy/Items/Misc/Bedlam/Teleporters.cs:
CS0117: Line 40: 'Server.Mobiles.PlayerMobile' does not contain a definition
for 'Bedlam'
+ Mondain's Legacy/Mobiles/Twisted Weald/DryadA.cs:
CS0117: Line 73: 'Server.Mobiles.PlayerMobile' does not contain a definition
for 'PeacedUntil'
CS0117: Line 75: 'Server.Mobiles.PlayerMobile' does not contain a definition
for 'PeacedUntil'
+ Mondain's Legacy/Quests/Bedlam/Mistaken Identity/Quests.cs:
CS0117: Line 200: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Bedlam'
+ Mondain's Legacy/Quests/Heartwood/Spellweaving/Quests.cs:
CS0117: Line 254: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Spellweaving'
+ Mondain's Legacy/Quests/Sanctuary/Spellweaving/Quests.cs:
CS0117: Line 244: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'Spellweaving'
+ Mondain's Legacy/Quests/Trammel/Friends of the Library/Quests.cs:
CS0117: Line 242: 'Server.Mobiles.PlayerMobile' does not contain a definitio
n for 'LibraryFriend'
+ Spells/Spellweaving/ArcanistSpell.cs:
CS0117: Line 77: 'Server.Mobiles.PlayerMobile' does not contain a definition
for 'Spellweaving'
Scripts: One or more scripts failed to compile or no script files were found.
- Press return to exit, or R to try again.




also the minihouse.cs looks as though it may have issues as well. Here are the playermobile and minihouse.cs scripts that I have. Thanks very much for your time.

Code:
[COLOR=Blue]using System;
using System.Collections;
using System.Collections.Generic;
using Server;
using Server.Misc;
using Server.Items;
using Server.Gumps;
using Server.Multis;
using Server.Engines.Help;
using Server.ContextMenus;
using Server.Network;
using Server.Spells;
using Server.Spells.Fifth;
using Server.Spells.Sixth;
using Server.Spells.Seventh;
using Server.Spells.Necromancy;
using Server.Spells.Ninjitsu;
using Server.Spells.Bushido;
using Server.Targeting;
using Server.Engines.Quests;
using Server.Factions;
using Server.Regions;
using Server.Accounting;
using Server.Engines.CannedEvil;
using Server.Engines.Craft;
using Server.Spells.Spellweaving;

namespace Server.Mobiles
{
    #region Enums
    [Flags]
    public enum PlayerFlag // First 16 bits are reserved for default-distro use, start custom flags at 0x00010000
    {
        None                = 0x00000000,
        Glassblowing        = 0x00000001,
        Masonry                = 0x00000002,
        SandMining            = 0x00000004,
        StoneMining            = 0x00000008,
        ToggleMiningStone    = 0x00000010,
        KarmaLocked            = 0x00000020,
        AutoRenewInsurance    = 0x00000040,
        UseOwnFilter        = 0x00000080,
        PublicMyRunUO        = 0x00000100,
        PagingSquelched        = 0x00000200,
        Young                = 0x00000400,
        AcceptGuildInvites    = 0x00000800,
        DisplayChampionTitle= 0x00001000
    }

    public enum NpcGuild
    {
        None,
        MagesGuild,
        WarriorsGuild,
        ThievesGuild,
        RangersGuild,
        HealersGuild,
        MinersGuild,
        MerchantsGuild,
        TinkersGuild,
        TailorsGuild,
        FishermensGuild,
        BardsGuild,
        BlacksmithsGuild
    }

    public enum SolenFriendship
    {
        None,
        Red,
        Black
    }
    #endregion

    public class PlayerMobile : Mobile, IHonorTarget
    {
        private class CountAndTimeStamp
        {
            private int m_Count;
            private DateTime m_Stamp;

            public CountAndTimeStamp()
            {
            }

            public DateTime TimeStamp { get{ return m_Stamp; } }
            public int Count 
            { 
                get { return m_Count; } 
                set    { m_Count = value; m_Stamp = DateTime.Now; } 
            }
        }

        private DesignContext m_DesignContext;

        private NpcGuild m_NpcGuild;
        private DateTime m_NpcGuildJoinTime;
        private TimeSpan m_NpcGuildGameTime;
        private PlayerFlag m_Flags;
        private int m_StepsTaken;
        private int m_Profession;

        private DateTime m_LastOnline;
        private Server.Guilds.RankDefinition m_GuildRank;

        private int m_GuildMessageHue, m_AllianceMessageHue;

        #region Getters & Setters
        public Server.Guilds.RankDefinition GuildRank
        {
            get
            {
                if( this.AccessLevel >= AccessLevel.GameMaster )
                    return Server.Guilds.RankDefinition.Leader;
                else
                    return m_GuildRank; 
            }
            set{ m_GuildRank = value; }
        }

        [CommandProperty( AccessLevel.GameMaster )]
        public int GuildMessageHue
        {
            get{ return m_GuildMessageHue; }
            set{ m_GuildMessageHue = value; }
        }

        [CommandProperty( AccessLevel.GameMaster )]
        public int AllianceMessageHue
        {
            get { return m_AllianceMessageHue; }
            set { m_AllianceMessageHue = value; }
        }

        [CommandProperty( AccessLevel.GameMaster )]
        public int Profession
        {
            get{ return m_Profession; }
            set{ m_Profession = value; }
        }

        public int StepsTaken
        {
            get{ return m_StepsTaken; }
            set{ m_StepsTaken = value; }
        }

        [CommandProperty( AccessLevel.GameMaster )]
        public NpcGuild NpcGuild
        {
            get{ return m_NpcGuild; }
            set{ m_NpcGuild = value; }
        }

        [CommandProperty( AccessLevel.GameMaster )]
        public DateTime NpcGuildJoinTime
        {
            get{ return m_NpcGuildJoinTime; }
            set{ m_NpcGuildJoinTime = value; }
        }

        [CommandProperty( AccessLevel.GameMaster )]
        public DateTime LastOnline
        {
            get{ return m_LastOnline; }
            set{ m_LastOnline = value; }
        }

        [CommandProperty( AccessLevel.GameMaster )]
        public TimeSpan NpcGuildGameTime
        {
            get{ return m_NpcGuildGameTime; }
            set{ m_NpcGuildGameTime = value; }
        }

        private int m_ToTItemsTurnedIn;

        [CommandProperty( AccessLevel.GameMaster )]
        public int ToTItemsTurnedIn
        {
            get { return m_ToTItemsTurnedIn; }
            set { m_ToTItemsTurnedIn = value; }
        }

        private int m_ToTTotalMonsterFame;

        [CommandProperty( AccessLevel.GameMaster )]
        public int ToTTotalMonsterFame
        {
            get { return m_ToTTotalMonsterFame; }
            set { m_ToTTotalMonsterFame = value; }
        }

        #endregion

        #region PlayerFlags
        public PlayerFlag Flags
        {
            get{ return m_Flags; }
            set{ m_Flags = value; }
        }

        [CommandProperty( AccessLevel.GameMaster )]
        public bool PagingSquelched
        {
            get{ return GetFlag( PlayerFlag.PagingSquelched ); }
            set{ SetFlag( PlayerFlag.PagingSquelched, value ); }
        }

        [CommandProperty( AccessLevel.GameMaster )]
        public bool Glassblowing
        {
            get{ return GetFlag( PlayerFlag.Glassblowing ); }
            set{ SetFlag( PlayerFlag.Glassblowing, value ); }
        }

        [CommandProperty( AccessLevel.GameMaster )]
        public bool Masonry
        {
            get{ return GetFlag( PlayerFlag.Masonry ); }
            set{ SetFlag( PlayerFlag.Masonry, value ); }
        }

        [CommandProperty( AccessLevel.GameMaster )]
        public bool SandMining
        {
            get{ return GetFlag( PlayerFlag.SandMining ); }
            set{ SetFlag( PlayerFlag.SandMining, value ); }
        }

        [CommandProperty( AccessLevel.GameMaster )]
        public bool StoneMining
        {
            get{ return GetFlag( PlayerFlag.StoneMining ); }
            set{ SetFlag( PlayerFlag.StoneMining, value ); }
        }

        [CommandProperty( AccessLevel.GameMaster )]
        public bool ToggleMiningStone
        {
            get{ return GetFlag( PlayerFlag.ToggleMiningStone ); }
            set{ SetFlag( PlayerFlag.ToggleMiningStone, value ); }
        }

        [CommandProperty( AccessLevel.GameMaster )]
        public bool KarmaLocked
        {
            get{ return GetFlag( PlayerFlag.KarmaLocked ); }
            set{ SetFlag( PlayerFlag.KarmaLocked, value ); }
        }

        [CommandProperty( AccessLevel.GameMaster )]
        public bool AutoRenewInsurance
        {
            get{ return GetFlag( PlayerFlag.AutoRenewInsurance ); }
            set{ SetFlag( PlayerFlag.AutoRenewInsurance, value ); }
        }

        [CommandProperty( AccessLevel.GameMaster )]
        public bool UseOwnFilter
        {
            get{ return GetFlag( PlayerFlag.UseOwnFilter ); }
            set{ SetFlag( PlayerFlag.UseOwnFilter, value ); }
        }

        [CommandProperty( AccessLevel.GameMaster )]
        public bool PublicMyRunUO
        {
            get{ return GetFlag( PlayerFlag.PublicMyRunUO ); }
            set{ SetFlag( PlayerFlag.PublicMyRunUO, value ); InvalidateMyRunUO(); }
        }

        [CommandProperty( AccessLevel.GameMaster )]
        public bool AcceptGuildInvites
        {
            get{ return GetFlag( PlayerFlag.AcceptGuildInvites ); }
            set{ SetFlag( PlayerFlag.AcceptGuildInvites, value ); }
        }
        #endregion

        #region Veteran Rewards
        private DateTime m_AnkhNextUse;

        [CommandProperty( AccessLevel.GameMaster )]
        public DateTime AnkhNextUse
        {
            get{ return m_AnkhNextUse; }
            set{ m_AnkhNextUse = value; }
        }
        #endregion


        public static Direction GetDirection4( Point3D from, Point3D to )
        {
            int dx = from.X - to.X;
            int dy = from.Y - to.Y;

            int rx = dx - dy;
            int ry = dx + dy;

            Direction ret;

            if ( rx >= 0 && ry >= 0 )
                ret = Direction.West;
            else if ( rx >= 0 && ry < 0 )
                ret = Direction.South;
            else if ( rx < 0 && ry < 0 )
                ret = Direction.East;
            else
                ret = Direction.North;

            return ret;
        }

        public override bool OnDroppedItemToWorld( Item item, Point3D location )
        {
            if ( !base.OnDroppedItemToWorld( item, location ) )
                return false;

            BounceInfo bi = item.GetBounce();

            if ( bi != null )
            {
                Type type = item.GetType();

                if ( type.IsDefined( typeof( FurnitureAttribute ), true ) || type.IsDefined( typeof( DynamicFlipingAttribute ), true ) )
                {
                    object[] objs = type.GetCustomAttributes( typeof( FlipableAttribute ), true );

                    if ( objs != null && objs.Length > 0 )
                    {
                        FlipableAttribute fp = objs[0] as FlipableAttribute;

                        if ( fp != null )
                        {
                            int[] itemIDs = fp.ItemIDs;

                            Point3D oldWorldLoc = bi.m_WorldLoc;
                            Point3D newWorldLoc = location;

                            if ( oldWorldLoc.X != newWorldLoc.X || oldWorldLoc.Y != newWorldLoc.Y )
                            {
                                Direction dir = GetDirection4( oldWorldLoc, newWorldLoc );

                                if ( itemIDs.Length == 2 )
                                {
                                    switch ( dir )
                                    {
                                        case Direction.North:
                                        case Direction.South: item.ItemID = itemIDs[0]; break;
                                        case Direction.East:
                                        case Direction.West: item.ItemID = itemIDs[1]; break;
                                    }
                                }
                                else if ( itemIDs.Length == 4 )
                                {
                                    switch ( dir )
                                    {
                                        case Direction.South: item.ItemID = itemIDs[0]; break;
                                        case Direction.East: item.ItemID = itemIDs[1]; break;
                                        case Direction.North: item.ItemID = itemIDs[2]; break;
                                        case Direction.West: item.ItemID = itemIDs[3]; break;
                                    }
                                }
                            }
                        }
                    }
                }
            }

            return true;
        }

        public bool GetFlag( PlayerFlag flag )
        {
            return ( (m_Flags & flag) != 0 );
        }

        public void SetFlag( PlayerFlag flag, bool value )
        {
            if ( value )
                m_Flags |= flag;
            else
                m_Flags &= ~flag;
        }

        public DesignContext DesignContext
        {
            get{ return m_DesignContext; }
            set{ m_DesignContext = value; }
        }

        public static void Initialize()
        {
            if ( FastwalkPrevention )
                PacketHandlers.RegisterThrottler( 0x02, new ThrottlePacketCallback( MovementThrottle_Callback ) );

            EventSink.Login += new LoginEventHandler( OnLogin );
            EventSink.Logout += new LogoutEventHandler( OnLogout );
            EventSink.Connected += new ConnectedEventHandler( EventSink_Connected );
            EventSink.Disconnected += new DisconnectedEventHandler( EventSink_Disconnected );
        }

        public override void OnSkillInvalidated( Skill skill )
        {
            if ( Core.AOS && skill.SkillName == SkillName.MagicResist )
                UpdateResistances();
        }

        public override int GetMaxResistance( ResistanceType type )
        {
            if ( AccessLevel > AccessLevel.Player )
                return int.MaxValue;

            int max = base.GetMaxResistance( type );

            if ( type != ResistanceType.Physical && 60 < max && Spells.Fourth.CurseSpell.UnderEffect( this ) )
                max = 60;

            if( Core.ML && this.Race == Race.Elf && type == ResistanceType.Energy )
                max += 5; //Intended to go after the 60 max from curse

            return max;
        }

        protected override void OnRaceChange( Race oldRace )
        {
            ValidateEquipment();
            UpdateResistances();
        }

        public override int MaxWeight { get { return (((Core.ML && this.Race == Race.Human) ? 100 : 40) + (int)(3.5 * this.Str)); } }

        private int m_LastGlobalLight = -1, m_LastPersonalLight = -1;

        public override void OnNetStateChanged()
        {
            m_LastGlobalLight = -1;
            m_LastPersonalLight = -1;
        }

        public override void ComputeBaseLightLevels( out int global, out int personal )
        {
            global = LightCycle.ComputeLevelFor( this );

            bool racialNightSight = (Core.ML && this.Race == Race.Elf);

            if ( this.LightLevel < 21 && ( AosAttributes.GetValue( this, AosAttribute.NightSight ) > 0 || racialNightSight ))
                personal = 21;
            else
                personal = this.LightLevel;
        }

        public override void CheckLightLevels( bool forceResend )
        {
            NetState ns = this.NetState;

            if ( ns == null )
                return;

            int global, personal;

            ComputeLightLevels( out global, out personal );

            if ( !forceResend )
                forceResend = ( global != m_LastGlobalLight || personal != m_LastPersonalLight );

            if ( !forceResend )
                return;

            m_LastGlobalLight = global;
            m_LastPersonalLight = personal;

            ns.Send( GlobalLightLevel.Instantiate( global ) );
            ns.Send( new PersonalLightLevel( this, personal ) );
        }

        public override int GetMinResistance( ResistanceType type )
        {
            int magicResist = (int)(Skills[SkillName.MagicResist].Value * 10);
            int min = int.MinValue;

            if ( magicResist >= 1000 )
                min = 40 + ((magicResist - 1000) / 50);
            else if ( magicResist >= 400 )
                min = (magicResist - 400) / 15;

            if ( min > MaxPlayerResistance )
                min = MaxPlayerResistance;

            int baseMin = base.GetMinResistance( type );

            if ( min < baseMin )
                min = baseMin;

            return min;
        }

        private static void OnLogin( LoginEventArgs e )
        {
            Mobile from = e.Mobile;

            CheckAtrophies( from );

            if ( AccountHandler.LockdownLevel > AccessLevel.Player )
            {
                string notice;

                Accounting.Account acct = from.Account as Accounting.Account;

                if ( acct == null || !acct.HasAccess( from.NetState ) )
                {
                    if ( from.AccessLevel == AccessLevel.Player )
                        notice = "The server is currently under lockdown. No players are allowed to log in at this time.";
                    else
                        notice = "The server is currently under lockdown. You do not have sufficient access level to connect.";

                    Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), new TimerStateCallback( Disconnect ), from );
                }
                else if ( from.AccessLevel >= AccessLevel.Administrator )
                {
                    notice = "The server is currently under lockdown. As you are an administrator, you may change this from the [Admin gump.";
                }
                else
                {
                    notice = "The server is currently under lockdown. You have sufficient access level to connect.";
                }

                from.SendGump( new NoticeGump( 1060637, 30720, notice, 0xFFC000, 300, 140, null, null ) );
            }
        }

        private bool m_NoDeltaRecursion;

        public void ValidateEquipment()
        {
            if ( m_NoDeltaRecursion || Map == null || Map == Map.Internal )
                return;

            if ( this.Items == null )
                return;

            m_NoDeltaRecursion = true;
            Timer.DelayCall( TimeSpan.Zero, new TimerCallback( ValidateEquipment_Sandbox ) );
        }

        private void ValidateEquipment_Sandbox()
        {
            try
            {
                if ( Map == null || Map == Map.Internal )
                    return;

                List<Item> items = this.Items;

                if ( items == null )
                    return;

                bool moved = false;

                int str = this.Str;
                int dex = this.Dex;
                int intel = this.Int;

                #region Factions
                int factionItemCount = 0;
                #endregion

                Mobile from = this;

                #region Ethics
                Ethics.Ethic ethic = Ethics.Ethic.Find( from );
                #endregion

                for ( int i = items.Count - 1; i >= 0; --i )
                {
                    if ( i >= items.Count )
                        continue;

                    Item item = items[i];

                    #region Ethics
                    if ( ( item.SavedFlags & 0x100 ) != 0 )
                    {
                        if ( item.Hue != Ethics.Ethic.Hero.Definition.PrimaryHue )
                        {
                            item.SavedFlags &= ~0x100;
                        }
                        else if ( ethic != Ethics.Ethic.Hero )
                        {
                            from.AddToBackpack( item );
                            moved = true;
                            continue;
                        }
                    }
                    else if ( ( item.SavedFlags & 0x200 ) != 0 )
                    {
                        if ( item.Hue != Ethics.Ethic.Evil.Definition.PrimaryHue )
                        {
                            item.SavedFlags &= ~0x200;
                        }
                        else if ( ethic != Ethics.Ethic.Evil )
                        {
                            from.AddToBackpack( item );
                            moved = true;
                            continue;
                        }
                    }
                    #endregion

                    if ( item is BaseWeapon )
                    {
                        BaseWeapon weapon = (BaseWeapon)item;

                        bool drop = false;

                        if( dex < weapon.DexRequirement )
                            drop = true;
                        else if( str < AOS.Scale( weapon.StrRequirement, 100 - weapon.GetLowerStatReq() ) )
                            drop = true;
                        else if( intel < weapon.IntRequirement )
                            drop = true;
                        else if( weapon.RequiredRace != null && weapon.RequiredRace != this.Race )
                            drop = true;

                        if ( drop )
                        {
                            string name = weapon.Name;

                            if ( name == null )
                                name = String.Format( "#{0}", weapon.LabelNumber );

                            from.SendLocalizedMessage( 1062001, name ); // You can no longer wield your ~1_WEAPON~
                            from.AddToBackpack( weapon );
                            moved = true;
                        }
                    }
                    else if ( item is BaseArmor )
                    {
                        BaseArmor armor = (BaseArmor)item;

                        bool drop = false;

                        if ( !armor.AllowMaleWearer && !from.Female && from.AccessLevel < AccessLevel.GameMaster )
                        {
                            drop = true;
                        }
                        else if ( !armor.AllowFemaleWearer && from.Female && from.AccessLevel < AccessLevel.GameMaster )
                        {
                            drop = true;
                        }
                        else if( armor.RequiredRace != null && armor.RequiredRace != this.Race )
                        {
                            drop = true;
                        }
                        else
                        {
                            int strBonus = armor.ComputeStatBonus( StatType.Str ), strReq = armor.ComputeStatReq( StatType.Str );
                            int dexBonus = armor.ComputeStatBonus( StatType.Dex ), dexReq = armor.ComputeStatReq( StatType.Dex );
                            int intBonus = armor.ComputeStatBonus( StatType.Int ), intReq = armor.ComputeStatReq( StatType.Int );

                            if( dex < dexReq || (dex + dexBonus) < 1 )
                                drop = true;
                            else if( str < strReq || (str + strBonus) < 1 )
                                drop = true;
                            else if( intel < intReq || (intel + intBonus) < 1 )
                                drop = true;
                        }

                        if ( drop )
                        {
                            string name = armor.Name;

                            if ( name == null )
                                name = String.Format( "#{0}", armor.LabelNumber );

                            if ( armor is BaseShield )
                                from.SendLocalizedMessage( 1062003, name ); // You can no longer equip your ~1_SHIELD~
                            else
                                from.SendLocalizedMessage( 1062002, name ); // You can no longer wear your ~1_ARMOR~

                            from.AddToBackpack( armor );
                            moved = true;
                        }
                    }
                    else if ( item is BaseClothing )
                    {
                        BaseClothing clothing = (BaseClothing)item;

                        bool drop = false;

                        if ( !clothing.AllowMaleWearer && !from.Female && from.AccessLevel < AccessLevel.GameMaster )
                        {
                            drop = true;
                        }
                        else if ( !clothing.AllowFemaleWearer && from.Female && from.AccessLevel < AccessLevel.GameMaster )
                        {
                            drop = true;
                        }
                        else if( clothing.RequiredRace != null && clothing.RequiredRace != this.Race )
                        {
                            drop = true;
                        }
                        else
                        {
                            int strBonus = clothing.ComputeStatBonus( StatType.Str );
                            int strReq = clothing.ComputeStatReq( StatType.Str );

                            if( str < strReq || (str + strBonus) < 1 )
                                drop = true;
                        }

                        if ( drop )
                        {
                            string name = clothing.Name;

                            if ( name == null )
                                name = String.Format( "#{0}", clothing.LabelNumber );

                            from.SendLocalizedMessage( 1062002, name ); // You can no longer wear your ~1_ARMOR~

                            from.AddToBackpack( clothing );
                            moved = true;
                        }
                    }

                    FactionItem factionItem = FactionItem.Find( item );

                    if ( factionItem != null )
                    {
                        bool drop = false;

                        Faction ourFaction = Faction.Find( this );

                        if ( ourFaction == null || ourFaction != factionItem.Faction )
                            drop = true;
                        else if ( ++factionItemCount > FactionItem.GetMaxWearables( this ) )
                            drop = true;

                        if ( drop )
                        {
                            from.AddToBackpack( item );
                            moved = true;
                        }
                    }
                }

                if ( moved )
                    from.SendLocalizedMessage( 500647 ); // Some equipment has been moved to your backpack.
            }
            catch ( Exception e )
            {
                Console.WriteLine( e );
            }
            finally
            {
                m_NoDeltaRecursion = false;
            }
        }

        public override void Delta( MobileDelta flag )
        {
            base.Delta( flag );

            if ( (flag & MobileDelta.Stat) != 0 )
                ValidateEquipment();

            if ( (flag & (MobileDelta.Name | MobileDelta.Hue)) != 0 )
                InvalidateMyRunUO();
        }

        private static void Disconnect( object state )
        {
            NetState ns = ((Mobile)state).NetState;

            if ( ns != null )
                ns.Dispose();
        }

        private static void OnLogout( LogoutEventArgs e )
        {
        }

        private static void EventSink_Connected( ConnectedEventArgs e )
        {
            PlayerMobile pm = e.Mobile as PlayerMobile;

            if ( pm != null )
            {
                pm.m_SessionStart = DateTime.Now;

                if ( pm.m_Quest != null )
                    pm.m_Quest.StartTimer();

                pm.BedrollLogout = false;
                pm.LastOnline = DateTime.Now;
            }

            Timer.DelayCall( TimeSpan.Zero, new TimerStateCallback( ClearSpecialMovesCallback ), e.Mobile );
        }

        private static void ClearSpecialMovesCallback( object state )
        {
            Mobile from = (Mobile)state;

            SpecialMove.ClearAllMoves( from );
        }

        private static void EventSink_Disconnected( DisconnectedEventArgs e )
        {
            Mobile from = e.Mobile;
            DesignContext context = DesignContext.Find( from );

            if ( context != null )
            {
                /* Client disconnected
                 *  - Remove design context
                 *  - Eject all from house
                 *  - Restore relocated entities
                 */

                // Remove design context
                DesignContext.Remove( from );

                // Eject all from house
                from.RevealingAction();

                foreach ( Item item in context.Foundation.GetItems() )
                    item.Location = context.Foundation.BanLocation;

                foreach ( Mobile mobile in context.Foundation.GetMobiles() )
                    mobile.Location = context.Foundation.BanLocation;

                // Restore relocated entities
                context.Foundation.RestoreRelocatedEntities();
            }

            PlayerMobile pm = e.Mobile as PlayerMobile;

            if ( pm != null )
            {
                pm.m_GameTime += (DateTime.Now - pm.m_SessionStart);

                if ( pm.m_Quest != null )
                    pm.m_Quest.StopTimer();

                pm.m_SpeechLog = null;
                pm.LastOnline = DateTime.Now;
            }
        }

        public override void RevealingAction()
        {
            if ( m_DesignContext != null )
                return;

            Spells.Sixth.InvisibilitySpell.RemoveTimer( this );

            base.RevealingAction();
        }

        [CommandProperty( AccessLevel.GameMaster )]
        public override bool Hidden
        {
            get
            {
                return base.Hidden;
            }
            set
            {
                base.Hidden = value;

                RemoveBuff( BuffIcon.Invisibility );    //Always remove, default to the hiding icon EXCEPT in the invis spell where it's explicitly set

                if( !Hidden )
                {
                    RemoveBuff( BuffIcon.HidingAndOrStealth );
                }
                else// if( !InvisibilitySpell.HasTimer( this ) )
                {
                    BuffInfo.AddBuff( this, new BuffInfo( BuffIcon.HidingAndOrStealth, 1075655 ) );    //Hidden/Stealthing & You Are Hidden
                }
            }
        }

        public override void OnSubItemAdded( Item item )
        {
            if ( AccessLevel < AccessLevel.GameMaster && item.IsChildOf( this.Backpack ) )
            {
                int maxWeight = WeightOverloading.GetMaxWeight( this );
                int curWeight = Mobile.BodyWeight + this.TotalWeight;

                if ( curWeight > maxWeight )
                    this.SendLocalizedMessage( 1019035, true, String.Format( " : {0} / {1}", curWeight, maxWeight ) );
            }
        }

        public override bool CanBeHarmful( Mobile target, bool message, bool ignoreOurBlessedness )
        {
            if ( m_DesignContext != null || (target is PlayerMobile && ((PlayerMobile)target).m_DesignContext != null) )
                return false;

            if ( (target is BaseVendor && ((BaseVendor)target).IsInvulnerable) || target is PlayerVendor || target is TownCrier )
            {
                if ( message )
                {
                    if ( target.Title == null )
                        SendMessage( "{0} the vendor cannot be harmed.", target.Name );
                    else
                        SendMessage( "{0} {1} cannot be harmed.", target.Name, target.Title );
                }

                return false;
            }

            return base.CanBeHarmful( target, message, ignoreOurBlessedness );
        }

        public override bool CanBeBeneficial( Mobile target, bool message, bool allowDead )
        {
            if ( m_DesignContext != null || (target is PlayerMobile && ((PlayerMobile)target).m_DesignContext != null) )
                return false;

            return base.CanBeBeneficial( target, message, allowDead );
        }

        public override bool CheckContextMenuDisplay( IEntity target )
        {
            return ( m_DesignContext == null );
        }

        public override void OnItemAdded( Item item )
        {
            base.OnItemAdded( item );

            if ( item is BaseArmor || item is BaseWeapon )
            {
                Hits=Hits; Stam=Stam; Mana=Mana;
            }

            if ( this.NetState != null )
                CheckLightLevels( false );

            InvalidateMyRunUO();
        }

        public override void OnItemRemoved( Item item )
        {
            base.OnItemRemoved( item );

            if ( item is BaseArmor || item is BaseWeapon )
            {
                Hits=Hits; Stam=Stam; Mana=Mana;
            }

            if ( this.NetState != null )
                CheckLightLevels( false );

            InvalidateMyRunUO();
        }

        public override double ArmorRating
        {
            get
            {
                //BaseArmor ar;
                double rating = 0.0;

                AddArmorRating( ref rating, NeckArmor );
                AddArmorRating( ref rating, HandArmor );
                AddArmorRating( ref rating, HeadArmor );
                AddArmorRating( ref rating, ArmsArmor );
                AddArmorRating( ref rating, LegsArmor );
                AddArmorRating( ref rating, ChestArmor );
                AddArmorRating( ref rating, ShieldArmor );

                return VirtualArmor + VirtualArmorMod + rating;
            }
        }

        private void AddArmorRating( ref double rating, Item armor )
        {
            BaseArmor ar = armor as BaseArmor;

            if( ar != null && ( !Core.AOS || ar.ArmorAttributes.MageArmor == 0 ))
                rating += ar.ArmorRatingScaled;
        }

        #region [Stats]Max
        [CommandProperty( AccessLevel.GameMaster )]
        public override int HitsMax
        {
            get
            {
                int strBase;
                int strOffs = GetStatOffset( StatType.Str );

                if ( Core.AOS )
                {
                    strBase = this.Str;    //this.Str already includes GetStatOffset/str
                    strOffs = AosAttributes.GetValue( this, AosAttribute.BonusHits );

                    if ( AnimalForm.UnderTransformation( this, typeof( BakeKitsune ) ) || AnimalForm.UnderTransformation( this, typeof( GreyWolf ) ) )
                        strOffs += 20;
                }
                else
                {
                    strBase = this.RawStr;
                }

                return (strBase / 2) + 50 + strOffs;
            }
        }

        [CommandProperty( AccessLevel.GameMaster )]
        public override int StamMax
        {
            get{ return base.StamMax + AosAttributes.GetValue( this, AosAttribute.BonusStam ); }
        }

        [CommandProperty( AccessLevel.GameMaster )]
        public override int ManaMax
        {
            get{ return base.ManaMax + AosAttributes.GetValue( this, AosAttribute.BonusMana ) + ((Core.ML && Race == Race.Elf) ? 20 : 0); }
        }
        #endregion

        #region Stat Getters/Setters

        [CommandProperty( AccessLevel.GameMaster )]
        public override int Str
        {
            get
            {
                if( Core.ML && this.AccessLevel == AccessLevel.Player )
                    return Math.Min( base.Str, 150 );

                return base.Str;
            }
            set
            {
                base.Str = value;
            }
        }

        [CommandProperty( AccessLevel.GameMaster )]
        public override int Int
        {
            get
            {
                if( Core.ML && this.AccessLevel == AccessLevel.Player )
                    return Math.Min( base.Int, 150 );

                return base.Int;
            }
            set
            {
                base.Int = value;
            }
        }

        [CommandProperty( AccessLevel.GameMaster )]
        public override int Dex
        {
            get
            {
                if( Core.ML && this.AccessLevel == AccessLevel.Player )
                    return Math.Min( base.Dex, 150 );

                return base.Dex;
            }
            set
            {
                base.Dex = value;
            }
        }

        #endregion

        public override bool Move( Direction d )
        {
            NetState ns = this.NetState;

            if ( ns != null )
            {
                if ( HasGump( typeof( ResurrectGump ) ) ) {
                    if ( Alive ) {
                        CloseGump( typeof( ResurrectGump ) );
                    } else {
                        SendLocalizedMessage( 500111 ); // You are frozen and cannot move.
                        return false;
                    }
                }
            }

            TimeSpan speed = ComputeMovementSpeed( d );

            bool res;

            if ( !Alive )
                Server.Movement.MovementImpl.IgnoreMovableImpassables = true;

            res = base.Move( d );

            Server.Movement.MovementImpl.IgnoreMovableImpassables = false;

            if ( !res )
                return false;

            m_NextMovementTime += speed;

            return true;
        }

        public override bool CheckMovement( Direction d, out int newZ )
        {
            DesignContext context = m_DesignContext;

            if ( context == null )
                return base.CheckMovement( d, out newZ );

            HouseFoundation foundation = context.Foundation;

            newZ = foundation.Z + HouseFoundation.GetLevelZ( context.Level, context.Foundation );

            int newX = this.X, newY = this.Y;
            Movement.Movement.Offset( d, ref newX, ref newY );

            int startX = foundation.X + foundation.Components.Min.X + 1;
            int startY = foundation.Y + foundation.Components.Min.Y + 1;
            int endX = startX + foundation.Components.Width - 1;
            int endY = startY + foundation.Components.Height - 2;

            return ( newX >= startX && newY >= startY && newX < endX && newY < endY && Map == foundation.Map );
        }

        public override bool AllowItemUse( Item item )
        {
            return DesignContext.Check( this );
        }

        public SkillName[] AnimalFormRestrictedSkills{ get{ return m_AnimalFormRestrictedSkills; } }

        private SkillName[] m_AnimalFormRestrictedSkills = new SkillName[]
        {
            SkillName.ArmsLore,    SkillName.Begging, SkillName.Discordance, SkillName.Forensics,
            SkillName.Inscribe, SkillName.ItemID, SkillName.Meditation, SkillName.Peacemaking,
            SkillName.Provocation, SkillName.RemoveTrap, SkillName.SpiritSpeak, SkillName.Stealing,    
            SkillName.TasteID
        };

        public override bool AllowSkillUse( SkillName skill )
        {
            if ( AnimalForm.UnderTransformation( this ) )
            {
                for( int i = 0; i < m_AnimalFormRestrictedSkills.Length; i++ )
                {
                    if( m_AnimalFormRestrictedSkills[i] == skill )
                    {
                        SendLocalizedMessage( 1070771 ); // You cannot use that skill in this form.
                        return false;
                    }
                }
            }

            return DesignContext.Check( this );
        }

        private bool m_LastProtectedMessage;
        private int m_NextProtectionCheck = 10;

        public virtual void RecheckTownProtection()
        {
            m_NextProtectionCheck = 10;

            Regions.GuardedRegion reg = (Regions.GuardedRegion) this.Region.GetRegion( typeof( Regions.GuardedRegion ) );
            bool isProtected = ( reg != null && !reg.IsDisabled() );

            if ( isProtected != m_LastProtectedMessage )
            {
                if ( isProtected )
                    SendLocalizedMessage( 500112 ); // You are now under the protection of the town guards.
                else
                    SendLocalizedMessage( 500113 ); // You have left the protection of the town guards.

                m_LastProtectedMessage = isProtected;
            }
        }

        public override void MoveToWorld( Point3D loc, Map map )
        {
            base.MoveToWorld( loc, map );

            RecheckTownProtection();
        }

        public override void SetLocation( Point3D loc, bool isTeleport )
        {
            if ( !isTeleport && AccessLevel == AccessLevel.Player )
            {
                // moving, not teleporting
                int zDrop = ( this.Location.Z - loc.Z );

                if ( zDrop > 20 ) // we fell more than one story
                    Hits -= ((zDrop / 20) * 10) - 5; // deal some damage; does not kill, disrupt, etc
            }

            base.SetLocation( loc, isTeleport );

            if ( isTeleport || --m_NextProtectionCheck == 0 )
                RecheckTownProtection();
        }

        public override void GetContextMenuEntries( Mobile from, List<ContextMenuEntry> list )
        {
            base.GetContextMenuEntries( from, list );

            if ( from == this )
            {
                if ( m_Quest != null )
                    m_Quest.GetContextMenuEntries( list );

                if ( Alive && InsuranceEnabled )
                {
                    list.Add( new CallbackEntry( 6201, new ContextCallback( ToggleItemInsurance ) ) );

                    if ( AutoRenewInsurance )
                        list.Add( new CallbackEntry( 6202, new ContextCallback( CancelRenewInventoryInsurance ) ) );
                    else
                        list.Add( new CallbackEntry( 6200, new ContextCallback( AutoRenewInventoryInsurance ) ) );
                }

                BaseHouse house = BaseHouse.FindHouseAt( this );

                if ( house != null )
                {
                    if ( Alive && house.InternalizedVendors.Count > 0 && house.IsOwner( this ) )
                        list.Add( new CallbackEntry( 6204, new ContextCallback( GetVendor ) ) );

                    if ( house.IsAosRules )
                        list.Add( new CallbackEntry( 6207, new ContextCallback( LeaveHouse ) ) );
                }

                if ( m_JusticeProtectors.Count > 0 )
                    list.Add( new CallbackEntry( 6157, new ContextCallback( CancelProtection ) ) );

                if( Alive )
                    list.Add( new CallbackEntry( 6210, new ContextCallback( ToggleChampionTitleDisplay ) ) );
            }
        }

        private void CancelProtection()
        {
            for ( int i = 0; i < m_JusticeProtectors.Count; ++i )
            {
                Mobile prot = m_JusticeProtectors[i];

                string args = String.Format( "{0}\t{1}", this.Name, prot.Name );

                prot.SendLocalizedMessage( 1049371, args ); // The protective relationship between ~1_PLAYER1~ and ~2_PLAYER2~ has been ended.
                this.SendLocalizedMessage( 1049371, args ); // The protective relationship between ~1_PLAYER1~ and ~2_PLAYER2~ has been ended.
            }

            m_JusticeProtectors.Clear();
        }

        #region Insurance

        private void ToggleItemInsurance()
        {
            if ( !CheckAlive() )
                return;

            BeginTarget( -1, false, TargetFlags.None, new TargetCallback( ToggleItemInsurance_Callback ) );
            SendLocalizedMessage( 1060868 ); // Target the item you wish to toggle insurance status on <ESC> to cancel
        }

        private bool CanInsure( Item item )
        {
            if ( item is Container || item is BagOfSending || item is KeyRing )
                return false;

            if ( (item is Spellbook && item.LootType == LootType.Blessed)|| item is Runebook || item is PotionKeg || item is Sigil )
                return false;

            if ( item.Stackable )
                return false;

            if ( item.LootType == LootType.Cursed )
                return false;

            if ( item.ItemID == 0x204E ) // death shroud
                return false;

            return true;
        }

        private void ToggleItemInsurance_Callback( Mobile from, object obj )
        {
            if ( !CheckAlive() )
                return;

            Item item = obj as Item;

            if ( item == null || !item.IsChildOf( this ) )
            {
                BeginTarget( -1, false, TargetFlags.None, new TargetCallback( ToggleItemInsurance_Callback ) );
                SendLocalizedMessage( 1060871, "", 0x23 ); // You can only insure items that you have equipped or that are in your backpack
            }
            else if ( item.Insured )
            {
                item.Insured = false;

                SendLocalizedMessage( 1060874, "", 0x35 ); // You cancel the insurance on the item

                BeginTarget( -1, false, TargetFlags.None, new TargetCallback( ToggleItemInsurance_Callback ) );
                SendLocalizedMessage( 1060868, "", 0x23 ); // Target the item you wish to toggle insurance status on <ESC> to cancel
            }
            else if ( !CanInsure( item ) )
            {
                BeginTarget( -1, false, TargetFlags.None, new TargetCallback( ToggleItemInsurance_Callback ) );
                SendLocalizedMessage( 1060869, "", 0x23 ); // You cannot insure that
            }
            else if ( item.LootType == LootType.Blessed || item.LootType == LootType.Newbied || item.BlessedFor == from )
            {
                BeginTarget( -1, false, TargetFlags.None, new TargetCallback( ToggleItemInsurance_Callback ) );
                SendLocalizedMessage( 1060870, "", 0x23 ); // That item is blessed and does not need to be insured
                SendLocalizedMessage( 1060869, "", 0x23 ); // You cannot insure that
            }
            else
            {
                if ( !item.PayedInsurance )
                {
                    if ( Banker.Withdraw( from, 600 ) )
                    {
                        SendLocalizedMessage( 1060398, "600" ); // ~1_AMOUNT~ gold has been withdrawn from your bank box.
                        item.PayedInsurance = true;
                    }
                    else
                    {
                        SendLocalizedMessage( 1061079, "", 0x23 ); // You lack the funds to purchase the insurance
                        return;
                    }
                }

                item.Insured = true;

                SendLocalizedMessage( 1060873, "", 0x23 ); // You have insured the item

                BeginTarget( -1, false, TargetFlags.None, new TargetCallback( ToggleItemInsurance_Callback ) );
                SendLocalizedMessage( 1060868, "", 0x23 ); // Target the item you wish to toggle insurance status on <ESC> to cancel
            }
        }

        private void AutoRenewInventoryInsurance()
        {
            if ( !CheckAlive() )
                return;

            SendLocalizedMessage( 1060881, "", 0x23 ); // You have selected to automatically reinsure all insured items upon death
            AutoRenewInsurance = true;
        }

        private void CancelRenewInventoryInsurance()
        {
            if ( !CheckAlive() )
                return;

            if( Core.SE )
            {
                if( !HasGump( typeof( CancelRenewInventoryInsuranceGump ) ) )
                    SendGump( new CancelRenewInventoryInsuranceGump( this ) );
            }
            else
            {
                SendLocalizedMessage( 1061075, "", 0x23 ); // You have cancelled automatically reinsuring all insured items upon death
                AutoRenewInsurance = false;
            }
        }

        private class CancelRenewInventoryInsuranceGump : Gump
        {
            private PlayerMobile m_Player;

            public CancelRenewInventoryInsuranceGump( PlayerMobile player ) : base( 250, 200 )
            {
                m_Player = player;

                AddBackground( 0, 0, 240, 142, 0x13BE );
                AddImageTiled( 6, 6, 228, 100, 0xA40 );
                AddImageTiled( 6, 116, 228, 20, 0xA40 );
                AddAlphaRegion( 6, 6, 228, 142 );

                AddHtmlLocalized( 8, 8, 228, 100, 1071021, 0x7FFF, false, false ); // You are about to disable inventory insurance auto-renewal.

                AddButton( 6, 116, 0xFB1, 0xFB2, 0, GumpButtonType.Reply, 0 );
                AddHtmlLocalized( 40, 118, 450, 20, 1060051, 0x7FFF, false, false ); // CANCEL

                AddButton( 114, 116, 0xFA5, 0xFA7, 1, GumpButtonType.Reply, 0 );
                AddHtmlLocalized( 148, 118, 450, 20, 1071022, 0x7FFF, false, false ); // DISABLE IT!
            }

            public override void OnResponse( NetState sender, RelayInfo info )
            {
                if ( !m_Player.CheckAlive() )
                    return;

                if ( info.ButtonID == 1 )
                {
                    m_Player.SendLocalizedMessage( 1061075, "", 0x23 ); // You have cancelled automatically reinsuring all insured items upon death
                    m_Player.AutoRenewInsurance = false;
                }
                else
                {
                    m_Player.SendLocalizedMessage( 1042021 ); // Cancelled.
                }
            }
        }
        #endregion

        private void GetVendor()
        {
            BaseHouse house = BaseHouse.FindHouseAt( this );

            if ( CheckAlive() && house != null && house.IsOwner( this ) && house.InternalizedVendors.Count > 0 )
            {
                CloseGump( typeof( ReclaimVendorGump ) );
                SendGump( new ReclaimVendorGump( house ) );
            }
        }

        private void LeaveHouse()
        {
            BaseHouse house = BaseHouse.FindHouseAt( this );

            if ( house != null )
                this.Location = house.BanLocation;
        }

        private delegate void ContextCallback();

        private class CallbackEntry : ContextMenuEntry
        {
            private ContextCallback m_Callback;

            public CallbackEntry( int number, ContextCallback callback ) : this( number, -1, callback )
            {
            }

            public CallbackEntry( int number, int range, ContextCallback callback ) : base( number, range )
            {
                m_Callback = callback;
            }

            public override void OnClick()
            {
                if ( m_Callback != null )
                    m_Callback();
            }
        }

        public override void DisruptiveAction()
        {
            if( Meditating )
            {
                RemoveBuff( BuffIcon.ActiveMeditation );
            }

            base.DisruptiveAction();
        }
        public override void OnDoubleClick( Mobile from )
        {
            if ( this == from && !Warmode )
            {
                IMount mount = Mount;

                if ( mount != null && !DesignContext.Check( this ) )
                    return;
            }

            base.OnDoubleClick( from );
        }

        public override void DisplayPaperdollTo( Mobile to )
        {
            if ( DesignContext.Check( this ) )
                base.DisplayPaperdollTo( to );
        }

        private static bool m_NoRecursion;

        public override bool CheckEquip( Item item )
        {
            if ( !base.CheckEquip( item ) )
                return false;

            #region Factions
            FactionItem factionItem = FactionItem.Find( item );

            if ( factionItem != null )
            {
                Faction faction = Faction.Find( this );

                if ( faction == null )
                {
                    SendLocalizedMessage( 1010371 ); // You cannot equip a faction item!
                    return false;
                }
                else if ( faction != factionItem.Faction )
                {
                    SendLocalizedMessage( 1010372 ); // You cannot equip an opposing faction's item!
                    return false;
                }
                else
                {
                    int maxWearables = FactionItem.GetMaxWearables( this );

                    for ( int i = 0; i < Items.Count; ++i )
                    {
                        Item equiped = Items[i];

                        if ( item != equiped && FactionItem.Find( equiped ) != null )
                        {
                            if ( --maxWearables == 0 )
                            {
                                SendLocalizedMessage( 1010373 ); // You do not have enough rank to equip more faction items!
                                return false;
                            }
                        }
                    }
                }
            }
            #endregion

            if ( this.AccessLevel < AccessLevel.GameMaster && item.Layer != Layer.Mount && this.HasTrade )
            {
                BounceInfo bounce = item.GetBounce();

                if ( bounce != null )
                {
                    if ( bounce.m_Parent is Item )
                    {
                        Item parent = (Item) bounce.m_Parent;

                        if ( parent == this.Backpack || parent.IsChildOf( this.Backpack ) )
                            return true;
                    }
                    else if ( bounce.m_Parent == this )
                    {
                        return true;
                    }
                }

                SendLocalizedMessage( 1004042 ); // You can only equip what you are already carrying while you have a trade pending.
                return false;
            }

            return true;
        }

        public override bool CheckTrade( Mobile to, Item item, SecureTradeContainer cont, bool message, bool checkItems, int plusItems, int plusWeight )
        {
            int msgNum = 0;

            if ( cont == null )
            {
                if ( to.Holding != null )
                    msgNum = 1062727; // You cannot trade with someone who is dragging something.
                else if ( this.HasTrade )
                    msgNum = 1062781; // You are already trading with someone else!
                else if ( to.HasTrade )
                    msgNum = 1062779; // That person is already involved in a trade
            }

            if ( msgNum == 0 )
            {
                if ( cont != null )
                {
                    plusItems += cont.TotalItems;
                    plusWeight += cont.TotalWeight;
                }

                if ( this.Backpack == null || !this.Backpack.CheckHold( this, item, false, checkItems, plusItems, plusWeight ) )
                    msgNum = 1004040; // You would not be able to hold this if the trade failed.
                else if ( to.Backpack == null || !to.Backpack.CheckHold( to, item, false, checkItems, plusItems, plusWeight ) )
                    msgNum = 1004039; // The recipient of this trade would not be able to carry this.
                else
                    msgNum = CheckContentForTrade( item );
            }

            if ( msgNum != 0 )
            {
                if ( message )
                    this.SendLocalizedMessage( msgNum );

                return false;
            }

            return true;
        }

        private static int CheckContentForTrade( Item item )
        {
            if ( item is TrapableContainer && ((TrapableContainer)item).TrapType != TrapType.None )
                return 1004044; // You may not trade trapped items.

            if ( SkillHandlers.StolenItem.IsStolen( item ) )
                return 1004043; // You may not trade recently stolen items.

            if ( item is Container )
            {
                foreach ( Item subItem in item.Items )
                {
                    int msg = CheckContentForTrade( subItem );

                    if ( msg != 0 )
                        return msg;
                }
            }

            return 0;
        }

        public override bool CheckNonlocalDrop( Mobile from, Item item, Item target )
        {
            if ( !base.CheckNonlocalDrop( from, item, target ) )
                return false;

            if ( from.AccessLevel >= AccessLevel.GameMaster )
                return true;

            Container pack = this.Backpack;
            if ( from == this && this.HasTrade && ( target == pack || target.IsChildOf( pack ) ) )
            {
                BounceInfo bounce = item.GetBounce();

                if ( bounce != null && bounce.m_Parent is Item )
                {
                    Item parent = (Item) bounce.m_Parent;

                    if ( parent == pack || parent.IsChildOf( pack ) )
                        return true;
                }

                SendLocalizedMessage( 1004041 ); // You can't do that while you have a trade pending.
                return false;
            }

            return true;
        }

        protected override void OnLocationChange( Point3D oldLocation )
        {
            CheckLightLevels( false );

            DesignContext context = m_DesignContext;

            if ( context == null || m_NoRecursion )
                return;

            m_NoRecursion = true;

            HouseFoundation foundation = context.Foundation;

            int newX = this.X, newY = this.Y;
            int newZ = foundation.Z + HouseFoundation.GetLevelZ( context.Level, context.Foundation );

            int startX = foundation.X + foundation.Components.Min.X + 1;
            int startY = foundation.Y + foundation.Components.Min.Y + 1;
            int endX = startX + foundation.Components.Width - 1;
            int endY = startY + foundation.Components.Height - 2;

            if ( newX >= startX && newY >= startY && newX < endX && newY < endY && Map == foundation.Map )
            {
                if ( Z != newZ )
                    Location = new Point3D( X, Y, newZ );

                m_NoRecursion = false;
                return;
            }

            Location = new Point3D( foundation.X, foundation.Y, newZ );
            Map = foundation.Map;

            m_NoRecursion = false;
        }

        public override bool OnMoveOver( Mobile m )
        {
            if ( m is BaseCreature && !((BaseCreature)m).Controlled )
                return false;

            return base.OnMoveOver( m );
        }

        public override bool CheckShove( Mobile shoved )
        {
            if( TransformationSpellHelper.UnderTransformation( this, typeof( WraithFormSpell ) ) )
                return true;
            else
                return base.CheckShove( shoved );
        }


        protected override void OnMapChange( Map oldMap )
        {
            if ( (Map != Faction.Facet && oldMap == Faction.Facet) || (Map == Faction.Facet && oldMap != Faction.Facet) )
                InvalidateProperties();

            DesignContext context = m_DesignContext;

            if ( context == null || m_NoRecursion )
                return;

            m_NoRecursion = true;

            HouseFoundation foundation = context.Foundation;

            if ( Map != foundation.Map )
                Map = foundation.Map;

            m_NoRecursion = false;
        }

        public override void OnBeneficialAction( Mobile target, bool isCriminal )
        {
            if ( m_SentHonorContext != null )
                m_SentHonorContext.OnSourceBeneficialAction( target );

            base.OnBeneficialAction( target, isCriminal );
        }

        public override void OnDamage( int amount, Mobile from, bool willKill )
        {
            int disruptThreshold;

            if ( !Core.AOS )
                disruptThreshold = 0;
            else if ( from != null && from.Player )
                disruptThreshold = 18;
            else
                disruptThreshold = 25;

            if ( amount > disruptThreshold )
            {
                BandageContext c = BandageContext.GetContext( this );

                if ( c != null )
                    c.Slip();
            }

            if( Confidence.IsRegenerating( this ) )
                Confidence.StopRegenerating( this );

            WeightOverloading.FatigueOnDamage( this, amount );

            if ( m_ReceivedHonorContext != null )
                m_ReceivedHonorContext.OnTargetDamaged( from, amount );
            if ( m_SentHonorContext != null )
                m_SentHonorContext.OnSourceDamaged( from, amount );

            base.OnDamage( amount, from, willKill );
        }

        public override void Resurrect()
        {
            bool wasAlive = this.Alive;

            base.Resurrect();

            if ( this.Alive && !wasAlive )
            {
                Item deathRobe = new DeathRobe();

                if ( !EquipItem( deathRobe ) )
                    deathRobe.Delete();
            }
        }

        public override double RacialSkillBonus
        {
            get
            {
                if( Core.ML && this.Race == Race.Human )
                    return 20.0;

                return 0;
            }
        }

        private Mobile m_InsuranceAward;
        private int m_InsuranceCost;
        private int m_InsuranceBonus;

        public override bool OnBeforeDeath()
        {
            m_InsuranceCost = 0;
            m_InsuranceAward = base.FindMostRecentDamager( false );

            if ( m_InsuranceAward is BaseCreature )
            {
                Mobile master = ((BaseCreature)m_InsuranceAward).GetMaster();

                if ( master != null )
                    m_InsuranceAward = master;
            }

            if ( m_InsuranceAward != null && (!m_InsuranceAward.Player || m_InsuranceAward == this) )
                m_InsuranceAward = null;

            if ( m_InsuranceAward is PlayerMobile )
                ((PlayerMobile)m_InsuranceAward).m_InsuranceBonus = 0;

            if ( m_ReceivedHonorContext != null )
                m_ReceivedHonorContext.OnTargetKilled();
            if ( m_SentHonorContext != null )
                m_SentHonorContext.OnSourceKilled();

            return base.OnBeforeDeath();
        }

        private bool CheckInsuranceOnDeath( Item item )
        {
            if ( InsuranceEnabled && item.Insured )
            {
                if ( AutoRenewInsurance )
                {
                    int cost = ( m_InsuranceAward == null ? 600 : 300 );

                    if ( Banker.Withdraw( this, cost ) )
                    {
                        m_InsuranceCost += cost;
                        item.PayedInsurance = true;
                    }
                    else
                    {
                        SendLocalizedMessage( 1061079, "", 0x23 ); // You lack the funds to purchase the insurance
                        item.PayedInsurance = false;
                        item.Insured = false;
                    }
                }
                else
                {
                    item.PayedInsurance = false;
                    item.Insured = false;
                }

                if ( m_InsuranceAward != null )
                {
                    if ( Banker.Deposit( m_InsuranceAward, 300 ) )
                    {
                        if ( m_InsuranceAward is PlayerMobile )
                            ((PlayerMobile)m_InsuranceAward).m_InsuranceBonus += 300;
                    }
                }

                return true;
            }

            return false;
        }

        public override DeathMoveResult GetParentMoveResultFor( Item item )
        {
            if ( CheckInsuranceOnDeath( item ) )
                return DeathMoveResult.MoveToBackpack;

            DeathMoveResult res = base.GetParentMoveResultFor( item );

            if ( res == DeathMoveResult.MoveToCorpse && item.Movable && this.Young )
                res = DeathMoveResult.MoveToBackpack;

            return res;
        }

        public override DeathMoveResult GetInventoryMoveResultFor( Item item )
        {
            if ( CheckInsuranceOnDeath( item ) )
                return DeathMoveResult.MoveToBackpack;

            DeathMoveResult res = base.GetInventoryMoveResultFor( item );

            if ( res == DeathMoveResult.MoveToCorpse && item.Movable && this.Young )
                res = DeathMoveResult.MoveToBackpack;

            return res;
        }

        public override void OnDeath( Container c )
        {
            base.OnDeath( c );

            HueMod = -1;
            NameMod = null;
            SavagePaintExpiration = TimeSpan.Zero;

            SetHairMods( -1, -1 );

            PolymorphSpell.StopTimer( this );
            IncognitoSpell.StopTimer( this );
            DisguiseGump.StopTimer( this );

            EndAction( typeof( PolymorphSpell ) );
            EndAction( typeof( IncognitoSpell ) );

            MeerMage.StopEffect( this, false );

            SkillHandlers.StolenItem.ReturnOnDeath( this, c );

            if ( m_PermaFlags.Count > 0 )
            {
                m_PermaFlags.Clear();

                if ( c is Corpse )
                    ((Corpse)c).Criminal = true;

                if ( SkillHandlers.Stealing.ClassicMode )
                    Criminal = true;
            }

            if ( this.Kills >= 5 && DateTime.Now >= m_NextJustAward )
            {
                Mobile m = FindMostRecentDamager( false );

                if( m is BaseCreature )
                    m = ((BaseCreature)m).GetMaster();

                if ( m != null && m is PlayerMobile && m != this )
                {
                    bool gainedPath = false;

                    int pointsToGain = 0;

                    pointsToGain += (int) Math.Sqrt( this.GameTime.TotalSeconds * 4 );
                    pointsToGain *= 5;
                    pointsToGain += (int) Math.Pow( this.Skills.Total / 250, 2 );

                    if ( VirtueHelper.Award( m, VirtueName.Justice, pointsToGain, ref gainedPath ) )
                    {
                        if ( gainedPath )
                            m.SendLocalizedMessage( 1049367 ); // You have gained a path in Justice!
                        else
                            m.SendLocalizedMessage( 1049363 ); // You have gained in Justice.

                        m.FixedParticles( 0x375A, 9, 20, 5027, EffectLayer.Waist );
                        m.PlaySound( 0x1F7 );

                        m_NextJustAward = DateTime.Now + TimeSpan.FromMinutes( pointsToGain / 3 );
                    }
                }
            }

            if ( m_InsuranceCost > 0 )
                SendLocalizedMessage( 1060398, m_InsuranceCost.ToString() ); // ~1_AMOUNT~ gold has been withdrawn from your bank box.

            if ( m_InsuranceAward is PlayerMobile )
            {
                PlayerMobile pm = (PlayerMobile)m_InsuranceAward;

                if ( pm.m_InsuranceBonus > 0 )
                    pm.SendLocalizedMessage( 1060397, pm.m_InsuranceBonus.ToString() ); // ~1_AMOUNT~ gold has been deposited into your bank box.
            }

            Mobile killer = this.FindMostRecentDamager( true );

            if ( killer is BaseCreature )
            {
                BaseCreature bc = (BaseCreature)killer;

                Mobile master = bc.GetMaster();
                if( master != null )
                    killer = master;
            }

            if ( this.Young )
            {
                if ( YoungDeathTeleport() )
                    Timer.DelayCall( TimeSpan.FromSeconds( 2.5 ), new TimerCallback( SendYoungDeathNotice ) );
            }

            Faction.HandleDeath( this, killer );

            Server.Guilds.Guild.HandleDeath( this, killer );

            if( m_BuffTable != null )
            {
                List<BuffInfo> list = new List<BuffInfo>();

                foreach( BuffInfo buff in m_BuffTable.Values )
                {
                    if( !buff.RetainThroughDeath )
                    {
                        list.Add( buff );
                    }
                }

                for( int i = 0; i < list.Count; i++ )
                {
                    RemoveBuff( list[i] );
                }
            }
        }

        private List<Mobile> m_PermaFlags;
        private List<Mobile> m_VisList;
        private Hashtable m_AntiMacroTable;
        private TimeSpan m_GameTime;
        private TimeSpan m_ShortTermElapse;
        private TimeSpan m_LongTermElapse;
        private DateTime m_SessionStart;
        private DateTime m_LastEscortTime;
        private DateTime m_NextSmithBulkOrder;
        private DateTime m_NextTailorBulkOrder;
        private DateTime m_SavagePaintExpiration;
        private SkillName m_Learning = (SkillName)(-1);

        public SkillName Learning
        {
            get{ return m_Learning; }
            set{ m_Learning = value; }
        }

        [CommandProperty( AccessLevel.GameMaster )]
        public TimeSpan SavagePaintExpiration
        {
            get
            {
                TimeSpan ts = m_SavagePaintExpiration - DateTime.Now;

                if ( ts < TimeSpan.Zero )
                    ts = TimeSpan.Zero;

                return ts;
            }
            set
            {
                m_SavagePaintExpiration = DateTime.Now + value;
            }
        }

        [CommandProperty( AccessLevel.GameMaster )]
        public TimeSpan NextSmithBulkOrder
        {
            get
            {
                TimeSpan ts = m_NextSmithBulkOrder - DateTime.Now;

                if ( ts < TimeSpan.Zero )
                    ts = TimeSpan.Zero;

                return ts;
            }
            set
            {
                try{ m_NextSmithBulkOrder = DateTime.Now + value; }
                catch{}
            }
        }

        [CommandProperty( AccessLevel.GameMaster )]
        public TimeSpan NextTailorBulkOrder
        {
            get
            {
                TimeSpan ts = m_NextTailorBulkOrder - DateTime.Now;

                if ( ts < TimeSpan.Zero )
                    ts = TimeSpan.Zero;

                return ts;
            }
            set
            {
                try{ m_NextTailorBulkOrder = DateTime.Now + value; }
                catch{}
            }
        }

        [CommandProperty( AccessLevel.GameMaster )]
        public DateTime LastEscortTime
        {
            get{ return m_LastEscortTime; }
            set{ m_LastEscortTime = value; }
        }

        public PlayerMobile()
        {
            m_VisList = new List<Mobile>();
            m_PermaFlags = new List<Mobile>();
            m_AntiMacroTable = new Hashtable();

            m_BOBFilter = new Engines.BulkOrders.BOBFilter();

            m_GameTime = TimeSpan.Zero;
            m_ShortTermElapse = TimeSpan.FromHours( 8.0 );
            m_LongTermElapse = TimeSpan.FromHours( 40.0 );

            m_JusticeProtectors = new List<Mobile>();
            m_GuildRank = Guilds.RankDefinition.Lowest;

            m_ChampionTitles = new ChampionTitleInfo();

            InvalidateMyRunUO();
        }

        public override bool MutateSpeech( List<Mobile> hears, ref string text, ref object context )
        {
            if ( Alive )
                return false;

            if ( Core.AOS )
            {
                for ( int i = 0; i < hears.Count; ++i )
                {
                    Mobile m = hears[i];

                    if ( m != this && m.Skills[SkillName.SpiritSpeak].Value >= 100.0 )
                        return false;
                }
            }

            return base.MutateSpeech( hears, ref text, ref context );
        }

        public override void DoSpeech( string text, int[] keywords, MessageType type, int hue )
        {
            if( Guilds.Guild.NewGuildSystem && (type == MessageType.Guild || type == MessageType.Alliance) )
            {
                Guilds.Guild g = this.Guild as Guilds.Guild;
                if( g == null )
                {
                    SendLocalizedMessage( 1063142 ); // You are not in a guild!
                }
                else if( type == MessageType.Alliance )
                {
                    if( g.Alliance != null && g.Alliance.IsMember( g ) )
                    {
                        //g.Alliance.AllianceTextMessage( hue, "[Alliance][{0}]: {1}", this.Name, text );
                        g.Alliance.AllianceChat( this, text );
                        SendToStaffMessage( this, "[Alliance]: {0}", text );

                        m_AllianceMessageHue = hue;
                    }
                    else
                    {
                        SendLocalizedMessage( 1071020 ); // You are not in an alliance!
                    }
                }
                else    //Type == MessageType.Guild
                {
                    m_GuildMessageHue = hue;

                    g.GuildChat( this, text );
                    SendToStaffMessage( this, "[Guild]: {0}", text );
                }
            }
            else
            {
                base.DoSpeech( text, keywords, type, hue );
            }
        }

        private static void SendToStaffMessage( Mobile from, string text )
        {
            Packet p = null;

            foreach( NetState ns in from.GetClientsInRange( 8 ) )
            {
                Mobile mob = ns.Mobile;

                if( mob != null && mob.AccessLevel >= AccessLevel.GameMaster && mob.AccessLevel > from.AccessLevel )
                {
                    if( p == null )
                        p = Packet.Acquire( new UnicodeMessage( from.Serial, from.Body, MessageType.Regular, from.SpeechHue, 3, from.Language, from.Name, text ) );

                    ns.Send( p );
                }
            }

            Packet.Release( p );
        }
        private static void SendToStaffMessage( Mobile from, string format, params object[] args )
        {
            SendToStaffMessage( from, String.Format( format, args ) );
        }

        public override void Damage( int amount, Mobile from )
        {
            if ( Spells.Necromancy.EvilOmenSpell.CheckEffect( this ) )
                amount = (int)(amount * 1.25);

            Mobile oath = Spells.Necromancy.BloodOathSpell.GetBloodOath( from );

            if ( oath == this )
            {
                amount = (int)(amount * 1.1);
                from.Damage( amount, from );
            }

            base.Damage( amount, from );
        }

        #region Poison
        public override ApplyPoisonResult ApplyPoison( Mobile from, Poison poison )
        {
            if ( !Alive )
                return ApplyPoisonResult.Immune;

            if ( Spells.Necromancy.EvilOmenSpell.CheckEffect( this ) )
                poison = PoisonImpl.IncreaseLevel( poison );

            ApplyPoisonResult result = base.ApplyPoison( from, poison );

            if ( from != null && result == ApplyPoisonResult.Poisoned && PoisonTimer is PoisonImpl.PoisonTimer )
                (PoisonTimer as PoisonImpl.PoisonTimer).From = from;

            return result;
        }

        public override bool CheckPoisonImmunity( Mobile from, Poison poison )
        {
            if ( this.Young )
                return true;

            return base.CheckPoisonImmunity( from, poison );
        }

        public override void OnPoisonImmunity( Mobile from, Poison poison )
        {
            if ( this.Young )
                SendLocalizedMessage( 502808 ); // You would have been poisoned, were you not new to the land of Britannia. Be careful in the future.
            else
                base.OnPoisonImmunity( from, poison );
        }
        #endregion

        public PlayerMobile( Serial s ) : base( s )
        {
            m_VisList = new List<Mobile>();
            m_AntiMacroTable = new Hashtable();
            InvalidateMyRunUO();
        }

        public List<Mobile> VisibilityList
        {
            get{ return m_VisList; }
        }

        public List<Mobile> PermaFlags
        {
            get{ return m_PermaFlags; }
        }

        public override int Luck{ get{ return AosAttributes.GetValue( this, AosAttribute.Luck ); } }

        public override bool IsHarmfulCriminal( Mobile target )
        {
            if ( SkillHandlers.Stealing.ClassicMode && target is PlayerMobile && ((PlayerMobile)target).m_PermaFlags.Count > 0 )
            {
                int noto = Notoriety.Compute( this, target );

                if ( noto == Notoriety.Innocent )
                    target.Delta( MobileDelta.Noto );

                return false;
            }

            if ( target is BaseCreature && ((BaseCreature)target).InitialInnocent && !((BaseCreature)target).Controlled )
                return false;

            return base.IsHarmfulCriminal( target );
        }

        public bool AntiMacroCheck( Skill skill, object obj )
        {
            if ( obj == null || m_AntiMacroTable == null || this.AccessLevel != AccessLevel.Player )
                return true;

            Hashtable tbl = (Hashtable)m_AntiMacroTable[skill];
            if ( tbl == null )
                m_AntiMacroTable[skill] = tbl = new Hashtable();

            CountAndTimeStamp count = (CountAndTimeStamp)tbl[obj];
            if ( count != null )
            {
                if ( count.TimeStamp + SkillCheck.AntiMacroExpire <= DateTime.Now )
                {
                    count.Count = 1;
                    return true;
                }
                else
                {
                    ++count.Count;
                    if ( count.Count <= SkillCheck.Allowance )
                        return true;
                    else
                        return false;
                }
            }
            else
            {
                tbl[obj] = count = new CountAndTimeStamp();
                count.Count = 1;

                return true;
            }
        }

        private void RevertHair()
        {
            SetHairMods( -1, -1 );
        }

        private Engines.BulkOrders.BOBFilter m_BOBFilter;

        public Engines.BulkOrders.BOBFilter BOBFilter
        {
            get{ return m_BOBFilter; }
        }



        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );
            int version = reader.ReadInt();

            switch ( version )
            {
                #region Mondain's Legacy
                case 26: 
                    {
                        m_AnkhNextUse = reader.ReadDateTime();

                        goto case 25;
                    }
                #endregion
                case 25:
                {
                    int recipeCount = reader.ReadInt();

                    if( recipeCount > 0 )
                    {
                        m_AcquiredRecipes = new Dictionary<int, bool>();

                        for( int i = 0; i < recipeCount; i++ )
                        {
                            int r = reader.ReadInt();
                            if( reader.ReadBool() )    //Don't add in recipies which we haven't gotten or have been removed
                                m_AcquiredRecipes.Add( r, true );
                        }
                    }
                    goto case 24;
                }
                case 24:
                {
                    m_LastHonorLoss = reader.ReadDeltaTime();
                    goto case 23;
                }
                case 23:
                {
                    m_ChampionTitles = new ChampionTitleInfo( reader );
                    goto case 22;
                }
                case 22:
                {
                    m_LastValorLoss = reader.ReadDateTime();
                    goto case 21;
                }
                case 21:
                {
                    m_ToTItemsTurnedIn = reader.ReadEncodedInt();
                    m_ToTTotalMonsterFame = reader.ReadInt();
                    goto case 20;
                }
                case 20:
                {
                    m_AllianceMessageHue = reader.ReadEncodedInt();
                    m_GuildMessageHue = reader.ReadEncodedInt();

                    goto case 19;
                }
                case 19:
                {
                    int rank = reader.ReadEncodedInt();
                    int maxRank = Guilds.RankDefinition.Ranks.Length -1;
                    if( rank > maxRank )
                        rank = maxRank;

                    m_GuildRank = Guilds.RankDefinition.Ranks[rank];
                    m_LastOnline = reader.ReadDateTime();
                    goto case 18;
                }
                case 18:
                {
                    m_SolenFriendship = (SolenFriendship) reader.ReadEncodedInt();

                    goto case 17;
                }
                case 17: // changed how DoneQuests is serialized
                case 16:
                {
                    m_Quest = QuestSerializer.DeserializeQuest( reader );

                    if ( m_Quest != null )
                        m_Quest.From = this;

                    int count = reader.ReadEncodedInt();

                    if ( count > 0 )
                    {
                        m_DoneQuests = new List<QuestRestartInfo>();

                        for ( int i = 0; i < count; ++i )
                        {
                            Type questType = QuestSerializer.ReadType( QuestSystem.QuestTypes, reader );
                            DateTime restartTime;

                            if ( version < 17 )
                                restartTime = DateTime.MaxValue;
                            else
                                restartTime = reader.ReadDateTime();

                            m_DoneQuests.Add( new QuestRestartInfo( questType, restartTime ) );
                        }
                    }

                    m_Profession = reader.ReadEncodedInt();
                    goto case 15;
                }
                case 15:
                {
                    m_LastCompassionLoss = reader.ReadDeltaTime();
                    goto case 14;
                }
                case 14:
                {
                    m_CompassionGains = reader.ReadEncodedInt();

                    if ( m_CompassionGains > 0 )
                        m_NextCompassionDay = reader.ReadDeltaTime();

                    goto case 13;
                }
                case 13: // just removed m_PayedInsurance list
                case 12:
                {
                    m_BOBFilter = new Engines.BulkOrders.BOBFilter( reader );
                    goto case 11;
                }
                case 11:
                {
                    if ( version < 13 )
                    {
                        List<Item> payed = reader.ReadStrongItemList();

                        for ( int i = 0; i < payed.Count; ++i )
                            payed[i].PayedInsurance = true;
                    }

                    goto case 10;
                }
                case 10:
                {
                    if ( reader.ReadBool() )
                    {
                        m_HairModID = reader.ReadInt();
                        m_HairModHue = reader.ReadInt();
                        m_BeardModID = reader.ReadInt();
                        m_BeardModHue = reader.ReadInt();

                        // We cannot call SetHairMods( -1, -1 ) here because the items have not yet loaded
                        Timer.DelayCall( TimeSpan.Zero, new TimerCallback( RevertHair ) );
                    }

                    goto case 9;
                }
                case 9:
                {
                    SavagePaintExpiration = reader.ReadTimeSpan();

                    if ( SavagePaintExpiration > TimeSpan.Zero )
                    {
                        BodyMod = ( Female ? 184 : 183 );
                        HueMod = 0;
                    }

                    goto case 8;
                }
                case 8:
                {
                    m_NpcGuild = (NpcGuild)reader.ReadInt();
                    m_NpcGuildJoinTime = reader.ReadDateTime();
                    m_NpcGuildGameTime = reader.ReadTimeSpan();
                    goto case 7;
                }
                case 7:
                {
                    m_PermaFlags = reader.ReadStrongMobileList();
                    goto case 6;
                }
                case 6:
                {
                    NextTailorBulkOrder = reader.ReadTimeSpan();
                    goto case 5;
                }
                case 5:
                {
                    NextSmithBulkOrder = reader.ReadTimeSpan();
                    goto case 4;
                }
                case 4:
                {
                    m_LastJusticeLoss = reader.ReadDeltaTime();
                    m_JusticeProtectors = reader.ReadStrongMobileList();
                    goto case 3;
                }
                case 3:
                {
                    m_LastSacrificeGain = reader.ReadDeltaTime();
                    m_LastSacrificeLoss = reader.ReadDeltaTime();
                    m_AvailableResurrects = reader.ReadInt();
                    goto case 2;
                }
                case 2:
                {
                    m_Flags = (PlayerFlag)reader.ReadInt();
                    goto case 1;
                }
                case 1:
                {
                    m_LongTermElapse = reader.ReadTimeSpan();
                    m_ShortTermElapse = reader.ReadTimeSpan();
                    m_GameTime = reader.ReadTimeSpan();
                    goto case 0;
                }
                case 0:
                {
                    break;
                }
            }

            // Professions weren't verified on 1.0 RC0
            if ( !CharacterCreation.VerifyProfession( m_Profession ) )
                m_Profession = 0;

            if ( m_PermaFlags == null )
                m_PermaFlags = new List<Mobile>();

            if ( m_JusticeProtectors == null )
                m_JusticeProtectors = new List<Mobile>();

            if ( m_BOBFilter == null )
                m_BOBFilter = new Engines.BulkOrders.BOBFilter();

            if( m_GuildRank == null )
                m_GuildRank = Guilds.RankDefinition.Member;    //Default to member if going from older verstion to new version (only time it should be null)

            if( m_LastOnline == DateTime.MinValue && Account != null )
                m_LastOnline = ((Account)Account).LastLogin;

            if( m_ChampionTitles == null )
                m_ChampionTitles = new ChampionTitleInfo();

            List<Mobile> list = this.Stabled;

            for ( int i = 0; i < list.Count; ++i )
            {
                BaseCreature bc = list[i] as BaseCreature;

                if ( bc != null )
                    bc.IsStabled = true;
            }

            CheckAtrophies( this );


            if( Hidden )    //Hiding is the only buff where it has an effect that's serialized.
                AddBuff( new BuffInfo( BuffIcon.HidingAndOrStealth, 1075655 ) );
        }
        
        public override void Serialize( GenericWriter writer )
        {
            //cleanup our anti-macro table 
            foreach ( Hashtable t in m_AntiMacroTable.Values )
            {
                ArrayList remove = new ArrayList();
                foreach ( CountAndTimeStamp time in t.Values )
                {
                    if ( time.TimeStamp + SkillCheck.AntiMacroExpire <= DateTime.Now )
                        remove.Add( time );
                }

                for (int i=0;i<remove.Count;++i)
                    t.Remove( remove[i] );
            }

            //decay our kills
            if ( m_ShortTermElapse < this.GameTime )
            {
                m_ShortTermElapse += TimeSpan.FromHours( 8 );
                if ( ShortTermMurders > 0 )
                    --ShortTermMurders;
            }

            if ( m_LongTermElapse < this.GameTime )
            {
                m_LongTermElapse += TimeSpan.FromHours( 40 );
                if ( Kills > 0 )
                    --Kills;
            }

            CheckAtrophies( this );

            base.Serialize( writer );
            
            writer.Write( (int) 26 ); // version

            #region Veteran Rewards
            writer.Write( (DateTime) m_AnkhNextUse );
            #endregion

            if ( m_AcquiredRecipes == null )
            {
                writer.Write( (int)0 );
            }
            else
            {
                writer.Write( m_AcquiredRecipes.Count );

                foreach( KeyValuePair<int, bool> kvp in m_AcquiredRecipes )
                {
                    writer.Write( kvp.Key );
                    writer.Write( kvp.Value );
                }
            }

            writer.WriteDeltaTime( m_LastHonorLoss );

            ChampionTitleInfo.Serialize( writer, m_ChampionTitles );

            writer.Write( m_LastValorLoss );
            writer.WriteEncodedInt( m_ToTItemsTurnedIn );
            writer.Write( m_ToTTotalMonsterFame );    //This ain't going to be a small #.

            writer.WriteEncodedInt( m_AllianceMessageHue );
            writer.WriteEncodedInt( m_GuildMessageHue );

            writer.WriteEncodedInt( m_GuildRank.Rank );
            writer.Write( m_LastOnline );

            writer.WriteEncodedInt( (int) m_SolenFriendship );

            QuestSerializer.Serialize( m_Quest, writer );

            if ( m_DoneQuests == null )
            {
                writer.WriteEncodedInt( (int) 0 );
            }
            else
            {
                writer.WriteEncodedInt( (int) m_DoneQuests.Count );

                for ( int i = 0; i < m_DoneQuests.Count; ++i )
                {
                    QuestRestartInfo restartInfo = m_DoneQuests[i];

                    QuestSerializer.Write( (Type) restartInfo.QuestType, QuestSystem.QuestTypes, writer );
                    writer.Write( (DateTime) restartInfo.RestartTime );
                }
            }

            writer.WriteEncodedInt( (int) m_Profession );

            writer.WriteDeltaTime( m_LastCompassionLoss );

            writer.WriteEncodedInt( m_CompassionGains );

            if ( m_CompassionGains > 0 )
                writer.WriteDeltaTime( m_NextCompassionDay );

            m_BOBFilter.Serialize( writer );

            bool useMods = ( m_HairModID != -1 || m_BeardModID != -1 );

            writer.Write( useMods );

            if ( useMods )
            {
                writer.Write( (int) m_HairModID );
                writer.Write( (int) m_HairModHue );
                writer.Write( (int) m_BeardModID );
                writer.Write( (int) m_BeardModHue );
            }

            writer.Write( SavagePaintExpiration );

            writer.Write( (int) m_NpcGuild );
            writer.Write( (DateTime) m_NpcGuildJoinTime );
            writer.Write( (TimeSpan) m_NpcGuildGameTime );

            writer.Write( m_PermaFlags, true );

            writer.Write( NextTailorBulkOrder );

            writer.Write( NextSmithBulkOrder );

            writer.WriteDeltaTime( m_LastJusticeLoss );
            writer.Write( m_JusticeProtectors, true );

            writer.WriteDeltaTime( m_LastSacrificeGain );
            writer.WriteDeltaTime( m_LastSacrificeLoss );
            writer.Write( m_AvailableResurrects );

            writer.Write( (int) m_Flags );

            writer.Write( m_LongTermElapse );
            writer.Write( m_ShortTermElapse );
            writer.Write( this.GameTime );
        }



        public static void CheckAtrophies( Mobile m )
        {
            SacrificeVirtue.CheckAtrophy( m );
            JusticeVirtue.CheckAtrophy( m );
            CompassionVirtue.CheckAtrophy( m );
            ValorVirtue.CheckAtrophy( m );
            HonorVirtue.CheckAtrophy( m );

            if( m is PlayerMobile )
                ChampionTitleInfo.CheckAtrophy( (PlayerMobile)m );
        }

        public void ResetKillTime()
        {
            m_ShortTermElapse = this.GameTime + TimeSpan.FromHours( 8 );
            m_LongTermElapse = this.GameTime + TimeSpan.FromHours( 40 );
        }

        [CommandProperty( AccessLevel.GameMaster )]
        public DateTime SessionStart
        {
            get{ return m_SessionStart; }
        }

        [CommandProperty( AccessLevel.GameMaster )]
        public TimeSpan GameTime
        {
            get
            {
                if ( NetState != null )
                    return m_GameTime + (DateTime.Now - m_SessionStart);
                else
                    return m_GameTime;
            }
        }

        public override bool CanSee( Mobile m )
        {
            #region Veteran Rewards
            if ( m is CharacterStatue )
                ((CharacterStatue) m).OnRequestedAnimation( this );
            #endregion

            if ( m is PlayerMobile && ((PlayerMobile)m).m_VisList.Contains( this ) )
                return true;

            return base.CanSee( m );
        }

        public override bool CanSee( Item item )
        {
            if ( m_DesignContext != null && m_DesignContext.Foundation.IsHiddenToCustomizer( item ) )
                return false;

            return base.CanSee( item );
        }

        public override void OnAfterDelete()
        {
            base.OnAfterDelete();

            Faction faction = Faction.Find( this );

            if ( faction != null )
                faction.RemoveMember( this );

            BaseHouse.HandleDeletion( this );
        }

        public override bool NewGuildDisplay { get { return Server.Guilds.Guild.NewGuildSystem; } }

        public override void GetProperties( ObjectPropertyList list )
        {
            base.GetProperties( list );

            if ( Map == Faction.Facet )
            {
                PlayerState pl = PlayerState.Find( this );

                if ( pl != null )
                {
                    Faction faction = pl.Faction;

                    if ( faction.Commander == this )
                        list.Add( 1042733, faction.Definition.PropName ); // Commanding Lord of the ~1_FACTION_NAME~
                    else if ( pl.Sheriff != null )
                        list.Add( 1042734, "{0}\t{1}", pl.Sheriff.Definition.FriendlyName, faction.Definition.PropName ); // The Sheriff of  ~1_CITY~, ~2_FACTION_NAME~
                    else if ( pl.Finance != null )
                        list.Add( 1042735, "{0}\t{1}", pl.Finance.Definition.FriendlyName, faction.Definition.PropName ); // The Finance Minister of ~1_CITY~, ~2_FACTION_NAME~
                    else if ( pl.MerchantTitle != MerchantTitle.None )
                        list.Add( 1060776, "{0}\t{1}", MerchantTitles.GetInfo( pl.MerchantTitle ).Title, faction.Definition.PropName ); // ~1_val~, ~2_val~
                    else
                        list.Add( 1060776, "{0}\t{1}", pl.Rank.Title, faction.Definition.PropName ); // ~1_val~, ~2_val~
                }
            }
        }

        public override void OnSingleClick( Mobile from )
        {
            if ( Map == Faction.Facet )
            {
                PlayerState pl = PlayerState.Find( this );

                if ( pl != null )
                {
                    string text;
                    bool ascii = false;

                    Faction faction = pl.Faction;

                    if ( faction.Commander == this )
                        text = String.Concat( this.Female ? "(Commanding Lady of the " : "(Commanding Lord of the ", faction.Definition.FriendlyName, ")" );
                    else if ( pl.Sheriff != null )
                        text = String.Concat( "(The Sheriff of ", pl.Sheriff.Definition.FriendlyName, ", ", faction.Definition.FriendlyName, ")" );
                    else if ( pl.Finance != null )
                        text = String.Concat( "(The Finance Minister of ", pl.Finance.Definition.FriendlyName, ", ", faction.Definition.FriendlyName, ")" );
                    else
                    {
                        ascii = true;

                        if ( pl.MerchantTitle != MerchantTitle.None )
                            text = String.Concat( "(", MerchantTitles.GetInfo( pl.MerchantTitle ).Title.String, ", ", faction.Definition.FriendlyName, ")" );
                        else
                            text = String.Concat( "(", pl.Rank.Title.String, ", ", faction.Definition.FriendlyName, ")" );
                    }

                    int hue = ( Faction.Find( from ) == faction ? 98 : 38 );

                    PrivateOverheadMessage( MessageType.Label, hue, ascii, text, from.NetState );
                }
            }

            base.OnSingleClick( from );
        }

        protected override bool OnMove( Direction d )
        {
            if( !Core.SE )
                return base.OnMove( d );

            if( AccessLevel != AccessLevel.Player )
                return true;

            if( Hidden && DesignContext.Find( this ) == null )    //Hidden & NOT customizing a house
            {
                if( !Mounted && Skills.Stealth.Value >= 25.0 )
                {
                    bool running = (d & Direction.Running) != 0;

                    if( running )
                    {
                        if( (AllowedStealthSteps -= 2) <= 0 )
                            RevealingAction();
                    }
                    else if( AllowedStealthSteps-- <= 0 )
                    {
                        Server.SkillHandlers.Stealth.OnUse( this );
                    }            
                }
                else
                {
                    RevealingAction();
                }
            }

            return true;
        }

        private bool m_BedrollLogout;

        public bool BedrollLogout
        {
            get{ return m_BedrollLogout; }
            set{ m_BedrollLogout = value; }
        }

        [CommandProperty( AccessLevel.GameMaster )]
        public override bool Paralyzed
        {
            get
            {
                return base.Paralyzed;
            }
            set
            {
                base.Paralyzed = value;

                if( value )
                    AddBuff( new BuffInfo( BuffIcon.Paralyze, 1075827 ) );    //Paralyze/You are frozen and can not move
                else
                    RemoveBuff( BuffIcon.Paralyze );
            }
        }

        #region Ethics
        private Ethics.Player m_EthicPlayer;

        [CommandProperty( AccessLevel.GameMaster )]
        public Ethics.Player EthicPlayer
        {
            get { return m_EthicPlayer; }
            set { m_EthicPlayer = value; }
        }
        #endregion

        #region Factions
        private PlayerState m_FactionPlayerState;

        public PlayerState FactionPlayerState
        {
            get{ return m_FactionPlayerState; }
            set{ m_FactionPlayerState = value; }
        }
        #endregion

        #region Quests
        private QuestSystem m_Quest;
        private List<QuestRestartInfo> m_DoneQuests;
        private SolenFriendship m_SolenFriendship;

        public QuestSystem Quest
        {
            get{ return m_Quest; }
            set{ m_Quest = value; }
        }

        public List<QuestRestartInfo> DoneQuests
        {
            get{ return m_DoneQuests; }
            set{ m_DoneQuests = value; }
        }

        [CommandProperty( AccessLevel.GameMaster )]
        public SolenFriendship SolenFriendship
        {
            get{ return m_SolenFriendship; }
            set{ m_SolenFriendship = value; }
        }
        #endregion

        #region MyRunUO Invalidation
        private bool m_ChangedMyRunUO;

        public bool ChangedMyRunUO
        {
            get{ return m_ChangedMyRunUO; }
            set{ m_ChangedMyRunUO = value; }
        }

        public void InvalidateMyRunUO()
        {
            if ( !Deleted && !m_ChangedMyRunUO )
            {
                m_ChangedMyRunUO = true;
                Engines.MyRunUO.MyRunUO.QueueMobileUpdate( this );
            }
        }

        public override void OnKillsChange( int oldValue )
        {
            if ( this.Young && this.Kills > oldValue )
            {
                Account acc = this.Account as Account;

                if ( acc != null )
                    acc.RemoveYoungStatus( 0 );
            }

            InvalidateMyRunUO();
        }

        public override void OnGenderChanged( bool oldFemale )
        {
            InvalidateMyRunUO();
        }

        public override void OnGuildChange( Server.Guilds.BaseGuild oldGuild )
        {
            InvalidateMyRunUO();
        }

        public override void OnGuildTitleChange( string oldTitle )
        {
            InvalidateMyRunUO();
        }

        public override void OnKarmaChange( int oldValue )
        {
            InvalidateMyRunUO();
        }

        public override void OnFameChange( int oldValue )
        {
            InvalidateMyRunUO();
        }

        public override void OnSkillChange( SkillName skill, double oldBase )
        {
            if ( this.Young && this.SkillsTotal >= 4500 )
            {
                Account acc = this.Account as Account;

                if ( acc != null )
                    acc.RemoveYoungStatus( 1019036 ); // You have successfully obtained a respectable skill level, and have outgrown your status as a young player!
            }

            InvalidateMyRunUO();
        }

        public override void OnAccessLevelChanged( AccessLevel oldLevel )
        {
            InvalidateMyRunUO();
        }

        public override void OnRawStatChange( StatType stat, int oldValue )
        {
            InvalidateMyRunUO();
        }

        public override void OnDelete()
        {
            if ( m_ReceivedHonorContext != null )
                m_ReceivedHonorContext.Cancel();
            if ( m_SentHonorContext != null )
                m_SentHonorContext.Cancel();

            InvalidateMyRunUO();
        }
        #endregion

        #region Fastwalk Prevention
        private static bool FastwalkPrevention = true; // Is fastwalk prevention enabled?
        private static TimeSpan FastwalkThreshold = TimeSpan.FromSeconds( 0.4 ); // Fastwalk prevention will become active after 0.4 seconds

        private DateTime m_NextMovementTime;

        public virtual bool UsesFastwalkPrevention{ get{ return ( AccessLevel < AccessLevel.Counselor ); } }

        public override TimeSpan ComputeMovementSpeed( Direction dir, bool checkTurning )
        {
            if ( checkTurning && (dir & Direction.Mask) != (this.Direction & Direction.Mask) )
                return TimeSpan.FromSeconds( 0.1 );    // We are NOT actually moving (just a direction change)

            TransformContext context = TransformationSpellHelper.GetContext( this );

            if ( context != null && context.Type == typeof( ReaperFormSpell ) )
                return Mobile.WalkFoot;

            bool running = ( (dir & Direction.Running) != 0 );

            bool onHorse = ( this.Mount != null );

            AnimalFormContext animalContext = AnimalForm.GetContext( this );

            if( onHorse || (animalContext != null && animalContext.SpeedBoost) )
                return ( running ? Mobile.RunMount : Mobile.WalkMount );

            return ( running ? Mobile.RunFoot : Mobile.WalkFoot );
        }

        public static bool MovementThrottle_Callback( NetState ns )
        {
            PlayerMobile pm = ns.Mobile as PlayerMobile;

            if ( pm == null || !pm.UsesFastwalkPrevention )
                return true;

            if ( pm.m_NextMovementTime == DateTime.MinValue )
            {
                // has not yet moved
                pm.m_NextMovementTime = DateTime.Now;
                return true;
            }

            TimeSpan ts = pm.m_NextMovementTime - DateTime.Now;

            if ( ts < TimeSpan.Zero )
            {
                // been a while since we've last moved
                pm.m_NextMovementTime = DateTime.Now;
                return true;
            }

            return ( ts < FastwalkThreshold );
        }
        #endregion

        #region Enemy of One
        private Type m_EnemyOfOneType;
        private bool m_WaitingForEnemy;

        public Type EnemyOfOneType
        {
            get{ return m_EnemyOfOneType; }
            set
            {
                Type oldType = m_EnemyOfOneType;
                Type newType = value;

                if ( oldType == newType )
                    return;

                m_EnemyOfOneType = value;

                DeltaEnemies( oldType, newType );
            }
        }

        public bool WaitingForEnemy
        {
            get{ return m_WaitingForEnemy; }
            set{ m_WaitingForEnemy = value; }
        }

        private void DeltaEnemies( Type oldType, Type newType )
        {
            foreach ( Mobile m in this.GetMobilesInRange( 18 ) )
            {
                Type t = m.GetType();

                if ( t == oldType || t == newType )
                    Send( new MobileMoving( m, Notoriety.Compute( this, m ) ) );
            }
        }
        #endregion

        #region Hair and beard mods
        private int m_HairModID = -1, m_HairModHue;
        private int m_BeardModID = -1, m_BeardModHue;

        public void SetHairMods( int hairID, int beardID )
        {
            if ( hairID == -1 )
                InternalRestoreHair( true, ref m_HairModID, ref m_HairModHue );
            else if ( hairID != -2 )
                InternalChangeHair( true, hairID, ref m_HairModID, ref m_HairModHue );

            if ( beardID == -1 )
                InternalRestoreHair( false, ref m_BeardModID, ref m_BeardModHue );
            else if ( beardID != -2 )
                InternalChangeHair( false, beardID, ref m_BeardModID, ref m_BeardModHue );
        }

        private void CreateHair( bool hair, int id, int hue )
        {
            if( hair )
            {
                //TODO Verification?
                HairItemID = id;
                HairHue = hue;
            }
            else
            {
                FacialHairItemID = id;
                FacialHairHue = hue;
            }
        }

        private void InternalRestoreHair( bool hair, ref int id, ref int hue )
        {
            if ( id == -1 )
                return;

            if ( hair )
                HairItemID = 0;
            else
                FacialHairItemID = 0;

            //if( id != 0 )
            CreateHair( hair, id, hue );

            id = -1;
            hue = 0;
        }

        private void InternalChangeHair( bool hair, int id, ref int storeID, ref int storeHue )
        {
            if ( storeID == -1 )
            {
                storeID = hair ? HairItemID : FacialHairItemID;
                storeHue = hair ? HairHue : FacialHairHue;
            }
            CreateHair( hair, id, 0 );
        }
        #endregion

        #region Virtues
        private DateTime m_LastSacrificeGain;
        private DateTime m_LastSacrificeLoss;
        private int m_AvailableResurrects;

        public DateTime LastSacrificeGain{ get{ return m_LastSacrificeGain; } set{ m_LastSacrificeGain = value; } }
        public DateTime LastSacrificeLoss{ get{ return m_LastSacrificeLoss; } set{ m_LastSacrificeLoss = value; } }

        [CommandProperty( AccessLevel.GameMaster )]
        public int AvailableResurrects{ get{ return m_AvailableResurrects; } set{ m_AvailableResurrects = value; } }

        private DateTime m_NextJustAward;
        private DateTime m_LastJusticeLoss;
        private List<Mobile> m_JusticeProtectors;

        public DateTime LastJusticeLoss{ get{ return m_LastJusticeLoss; } set{ m_LastJusticeLoss = value; } }
        public List<Mobile> JusticeProtectors { get { return m_JusticeProtectors; } set { m_JusticeProtectors = value; } }

        private DateTime m_LastCompassionLoss;
        private DateTime m_NextCompassionDay;
        private int m_CompassionGains;

        public DateTime LastCompassionLoss{ get{ return m_LastCompassionLoss; } set{ m_LastCompassionLoss = value; } }
        public DateTime NextCompassionDay{ get{ return m_NextCompassionDay; } set{ m_NextCompassionDay = value; } }
        public int CompassionGains{ get{ return m_CompassionGains; } set{ m_CompassionGains = value; } }

        private DateTime m_LastValorLoss;

        public DateTime LastValorLoss { get { return m_LastValorLoss; } set { m_LastValorLoss = value; } }

        private DateTime m_LastHonorLoss;
        private DateTime m_LastHonorUse;
        private bool m_HonorActive;
        private HonorContext m_ReceivedHonorContext;
        private HonorContext m_SentHonorContext;

        public DateTime LastHonorLoss{ get{ return m_LastHonorLoss; } set{ m_LastHonorLoss = value; } }
        public DateTime LastHonorUse{ get{ return m_LastHonorUse; } set{ m_LastHonorUse = value; } }
        public bool HonorActive{ get{ return m_HonorActive; } set{ m_HonorActive = value; } }
        public HonorContext ReceivedHonorContext{ get{ return m_ReceivedHonorContext; } set{ m_ReceivedHonorContext = value; } }
        public HonorContext SentHonorContext{ get{ return m_SentHonorContext; } set{ m_SentHonorContext = value; } }
        #endregion

        #region Young system
        [CommandProperty( AccessLevel.GameMaster )]
        public bool Young
        {
            get{ return GetFlag( PlayerFlag.Young ); }
            set{ SetFlag( PlayerFlag.Young, value ); InvalidateProperties(); }
        }

        public override string ApplyNameSuffix( string suffix )
        {
            if ( Young )
            {
                if ( suffix.Length == 0 )
                    suffix = "(Young)";
                else
                    suffix = String.Concat( suffix, " (Young)" );
            }

            #region Ethics
            if ( m_EthicPlayer != null )
            {
                if ( suffix.Length == 0 )
                    suffix = m_EthicPlayer.Ethic.Definition.Adjunct.String;
                else
                    suffix = String.Concat( suffix, " ", m_EthicPlayer.Ethic.Definition.Adjunct.String );
            }
            #endregion

            return base.ApplyNameSuffix( suffix );
        }


        public override TimeSpan GetLogoutDelay()
        {
            if ( Young || BedrollLogout || TestCenter.Enabled )
                return TimeSpan.Zero;

            return base.GetLogoutDelay();
        }

        private DateTime m_LastYoungMessage = DateTime.MinValue;

        public bool CheckYoungProtection( Mobile from )
        {
            if ( !this.Young )
                return false;

            if ( Region.IsPartOf( typeof( DungeonRegion ) ) )
                return false;

            if( from is BaseCreature && ((BaseCreature)from).IgnoreYoungProtection )
                return false;

            if ( this.Quest != null && this.Quest.IgnoreYoungProtection( from ) )
                return false;

            if ( DateTime.Now - m_LastYoungMessage > TimeSpan.FromMinutes( 1.0 ) )
            {
                m_LastYoungMessage = DateTime.Now;
                SendLocalizedMessage( 1019067 ); // A monster looks at you menacingly but does not attack.  You would be under attack now if not for your status as a new citizen of Britannia.
            }

            return true;
        }

        private DateTime m_LastYoungHeal = DateTime.MinValue;

        public bool CheckYoungHealTime()
        {
            if ( DateTime.Now - m_LastYoungHeal > TimeSpan.FromMinutes( 5.0 ) )
            {
                m_LastYoungHeal = DateTime.Now;
                return true;
            }

            return false;
        }

        private static Point3D[] m_TrammelDeathDestinations = new Point3D[]
            {
                new Point3D( 1481, 1612, 20 ),
                new Point3D( 2708, 2153,  0 ),
                new Point3D( 2249, 1230,  0 ),
                new Point3D( 5197, 3994, 37 ),
                new Point3D( 1412, 3793,  0 ),
                new Point3D( 3688, 2232, 20 ),
                new Point3D( 2578,  604,  0 ),
                new Point3D( 4397, 1089,  0 ),
                new Point3D( 5741, 3218, -2 ),
                new Point3D( 2996, 3441, 15 ),
                new Point3D(  624, 2225,  0 ),
                new Point3D( 1916, 2814,  0 ),
                new Point3D( 2929,  854,  0 ),
                new Point3D(  545,  967,  0 ),
                new Point3D( 3665, 2587,  0 )
            };

        private static Point3D[] m_IlshenarDeathDestinations = new Point3D[]
            {
                new Point3D( 1216,  468, -13 ),
                new Point3D(  723, 1367, -60 ),
                new Point3D(  745,  725, -28 ),
                new Point3D(  281, 1017,   0 ),
                new Point3D(  986, 1011, -32 ),
                new Point3D( 1175, 1287, -30 ),
                new Point3D( 1533, 1341,  -3 ),
                new Point3D(  529,  217, -44 ),
                new Point3D( 1722,  219,  96 )
            };

        private static Point3D[] m_MalasDeathDestinations = new Point3D[]
            {
                new Point3D( 2079, 1376, -70 ),
                new Point3D(  944,  519, -71 )
            };

        private static Point3D[] m_TokunoDeathDestinations = new Point3D[]
            {
                new Point3D( 1166,  801, 27 ),
                new Point3D(  782, 1228, 25 ),
                new Point3D(  268,  624, 15 )
            };

        public bool YoungDeathTeleport()
        {
            if ( this.Region.IsPartOf( typeof( Jail ) )
                || this.Region.IsPartOf( "Samurai start location" )
                || this.Region.IsPartOf( "Ninja start location" )
                || this.Region.IsPartOf( "Ninja cave" ) )
                return false;

            Point3D loc;
            Map map;

            DungeonRegion dungeon = (DungeonRegion) this.Region.GetRegion( typeof( DungeonRegion ) );
            if ( dungeon != null && dungeon.EntranceLocation != Point3D.Zero )
            {
                loc = dungeon.EntranceLocation;
                map = dungeon.EntranceMap;
            }
            else
            {
                loc = this.Location;
                map = this.Map;
            }

            Point3D[] list;

            if ( map == Map.Trammel )
                list = m_TrammelDeathDestinations;
            else if ( map == Map.Ilshenar )
                list = m_IlshenarDeathDestinations;
            else if ( map == Map.Malas )
                list = m_MalasDeathDestinations;
            else if ( map == Map.Tokuno )
                list = m_TokunoDeathDestinations;
            else
                return false;

            Point3D dest = Point3D.Zero;
            int sqDistance = int.MaxValue;

            for ( int i = 0; i < list.Length; i++ )
            {
                Point3D curDest = list[i];

                int width = loc.X - curDest.X;
                int height = loc.Y - curDest.Y;
                int curSqDistance = width * width + height * height;

                if ( curSqDistance < sqDistance )
                {
                    dest = curDest;
                    sqDistance = curSqDistance;
                }
            }

            this.MoveToWorld( dest, map );
            return true;
        }

        private void SendYoungDeathNotice()
        {
            this.SendGump( new YoungDeathNotice() );
        }
        #endregion

        #region Speech log
        private SpeechLog m_SpeechLog;

        public SpeechLog SpeechLog{ get{ return m_SpeechLog; } }

        public override void OnSpeech( SpeechEventArgs e )
        {
            if ( SpeechLog.Enabled && this.NetState != null )
            {
                if ( m_SpeechLog == null )
                    m_SpeechLog = new SpeechLog();

                m_SpeechLog.Add( e.Mobile, e.Speech );
            }
        }
        #endregion

        #region Champion Titles
        [CommandProperty( AccessLevel.GameMaster )]
        public bool DisplayChampionTitle
        {
            get { return GetFlag( PlayerFlag.DisplayChampionTitle ); }
            set { SetFlag( PlayerFlag.DisplayChampionTitle, value ); }
        }

        private ChampionTitleInfo m_ChampionTitles;

        [CommandProperty( AccessLevel.GameMaster )]
        public ChampionTitleInfo ChampionTitles { get { return m_ChampionTitles; } set { } }

        private void ToggleChampionTitleDisplay()
        {
            if( !CheckAlive() )
                return;

            if( DisplayChampionTitle )
                SendLocalizedMessage( 1062419, "", 0x23 ); // You have chosen to hide your monster kill title.
            else
                SendLocalizedMessage( 1062418, "", 0x23 ); // You have chosen to display your monster kill title.

            DisplayChampionTitle = !DisplayChampionTitle;
        }

        [PropertyObject]
        public class ChampionTitleInfo
        {
            public static TimeSpan LossDelay = TimeSpan.FromDays( 1.0 );
            public const int LossAmount = 90;

            private class TitleInfo
            {
                private int m_Value;
                private DateTime m_LastDecay;

                public int Value { get { return m_Value; } set { m_Value = value; } }
                public DateTime LastDecay { get { return m_LastDecay; } set { m_LastDecay = value; } }

                public TitleInfo()
                {
                }

                public TitleInfo( GenericReader reader )
                {
                    int version = reader.ReadEncodedInt();

                    switch( version )
                    {
                        case 0:
                        {
                            m_Value = reader.ReadEncodedInt();
                            m_LastDecay = reader.ReadDateTime();
                            break;
                        }
                    }
                }

                public static void Serialize( GenericWriter writer, TitleInfo info )
                {
                    writer.WriteEncodedInt( (int)0 ); // version

                    writer.WriteEncodedInt( info.m_Value );
                    writer.Write( info.m_LastDecay );
                }

            }
            private TitleInfo[] m_Values;

            private int m_Harrower;    //Harrower titles do NOT decay


            public int GetValue( ChampionSpawnType type )
            {
                return GetValue( (int)type );
            }

            public void SetValue( ChampionSpawnType type, int value )
            {
                SetValue( (int)type, value );
            }

            public void Award( ChampionSpawnType type, int value )
            {
                Award( (int)type, value );
            }

            public int GetValue( int index )
            {
                if( m_Values == null || index < 0 || index >= m_Values.Length )
                    return 0;

                if( m_Values[index] == null )
                    m_Values[index] = new TitleInfo();

                return m_Values[index].Value;
            }

            public DateTime GetLastDecay( int index )
            {
                if( m_Values == null || index < 0 || index >= m_Values.Length )
                    return DateTime.MinValue;

                if( m_Values[index] == null )
                    m_Values[index] = new TitleInfo();

                return m_Values[index].LastDecay;
            }

            public void SetValue( int index, int value )
            {
                if( m_Values == null )
                    m_Values = new TitleInfo[ChampionSpawnInfo.Table.Length];

                if( value < 0 )
                    value = 0;

                if( index < 0 || index >= m_Values.Length )
                    return;

                if( m_Values[index] == null )
                    m_Values[index] = new TitleInfo();

                m_Values[index].Value = value;
            }

            public void Award( int index, int value )
            {
                if( m_Values == null )
                    m_Values = new TitleInfo[ChampionSpawnInfo.Table.Length];

                if( index < 0 || index >= m_Values.Length || value <= 0 )
                    return;

                if( m_Values[index] == null )
                    m_Values[index] = new TitleInfo();

                m_Values[index].Value += value;
            }

            public void Atrophy( int index, int value )
            {
                if( m_Values == null )
                    m_Values = new TitleInfo[ChampionSpawnInfo.Table.Length];

                if( index < 0 || index >= m_Values.Length || value <= 0 )
                    return;

                if( m_Values[index] == null )
                    m_Values[index] = new TitleInfo();

                int before = m_Values[index].Value;

                if( (m_Values[index].Value - value) < 0 )
                    m_Values[index].Value = 0;
                else
                    m_Values[index].Value -= value;

                if( before != m_Values[index].Value )
                    m_Values[index].LastDecay = DateTime.Now;
            }

            public override string ToString()
            {
                return "...";
            }

            [CommandProperty( AccessLevel.GameMaster )]
            public int Abyss { get { return GetValue( ChampionSpawnType.Abyss ); } set { SetValue( ChampionSpawnType.Abyss, value ); } }

            [CommandProperty( AccessLevel.GameMaster )]
            public int Arachnid { get { return GetValue( ChampionSpawnType.Arachnid ); } set { SetValue( ChampionSpawnType.Arachnid, value ); } }

            [CommandProperty( AccessLevel.GameMaster )]
            public int ColdBlood { get { return GetValue( ChampionSpawnType.ColdBlood ); } set { SetValue( ChampionSpawnType.ColdBlood, value ); } }

            [CommandProperty( AccessLevel.GameMaster )]
            public int ForestLord { get { return GetValue( ChampionSpawnType.ForestLord ); } set { SetValue( ChampionSpawnType.ForestLord, value ); } }

            [CommandProperty( AccessLevel.GameMaster )]
            public int SleepingDragon { get { return GetValue( ChampionSpawnType.SleepingDragon ); } set { SetValue( ChampionSpawnType.SleepingDragon, value ); } }

            [CommandProperty( AccessLevel.GameMaster )]
            public int UnholyTerror { get { return GetValue( ChampionSpawnType.UnholyTerror ); } set { SetValue( ChampionSpawnType.UnholyTerror, value ); } }

            [CommandProperty( AccessLevel.GameMaster )]
            public int VerminHorde { get { return GetValue( ChampionSpawnType.VerminHorde ); } set { SetValue( ChampionSpawnType.VerminHorde, value ); } }
            
            [CommandProperty( AccessLevel.GameMaster )]
            public int Harrower { get { return m_Harrower; } set { m_Harrower = value; } }

            public ChampionTitleInfo()
            {
            }

            public ChampionTitleInfo( GenericReader reader )
            {
                int version = reader.ReadEncodedInt();

                switch( version )
                {
                    case 0:
                    {
                        m_Harrower = reader.ReadEncodedInt();

                        int length = reader.ReadEncodedInt();
                        m_Values = new TitleInfo[length];

                        for( int i = 0; i < length; i++ )
                        {
                            m_Values[i] = new TitleInfo( reader );
                        }

                        if( m_Values.Length != ChampionSpawnInfo.Table.Length )
                        {
                            TitleInfo[] oldValues = m_Values;
                            m_Values = new TitleInfo[ChampionSpawnInfo.Table.Length];

                            for( int i = 0; i < m_Values.Length && i < oldValues.Length; i++ )
                            {
                                m_Values[i] = oldValues[i];
                            }
                        }
                        break;
                    }
                }
            }

            public static void Serialize( GenericWriter writer, ChampionTitleInfo titles )
            {
                writer.WriteEncodedInt( (int)0 ); // version

                writer.WriteEncodedInt( titles.m_Harrower );

                int length = titles.m_Values.Length;
                writer.WriteEncodedInt( length );

                for( int i = 0; i < length; i++ )
                {
                    if( titles.m_Values[i] == null )
                        titles.m_Values[i] = new TitleInfo();

                    TitleInfo.Serialize( writer, titles.m_Values[i] );
                }
            }

            public static void CheckAtrophy( PlayerMobile pm )
            {
                ChampionTitleInfo t = pm.m_ChampionTitles;
                if( t == null )
                    return;

                if( t.m_Values == null )
                    t.m_Values = new TitleInfo[ChampionSpawnInfo.Table.Length];

                for( int i = 0; i < t.m_Values.Length; i++ )
                {
                    if( (t.GetLastDecay( i ) + LossDelay) < DateTime.Now )
                    {
                        t.Atrophy( i, LossAmount );
                    }
                }
            }

            public static void AwardHarrowerTitle( PlayerMobile pm )    //Called when killing a harrower.  Will give a minimum of 1 point.
            {
                ChampionTitleInfo t = pm.m_ChampionTitles;
                if( t == null )
                    return;

                if( t.m_Values == null )
                    t.m_Values = new TitleInfo[ChampionSpawnInfo.Table.Length];

                int count = 1;

                for( int i = 0; i < t.m_Values.Length; i++ )
                {
                    if( t.m_Values[i].Value > 900 )
                        count++;
                }

                t.m_Harrower = Math.Max( count, t.m_Harrower );    //Harrower titles never decay.
            }
        }
        #endregion

        #region Recipes

        private Dictionary<int, bool> m_AcquiredRecipes;
        
        public virtual bool HasRecipe( Recipe r )
        {
            if( r == null ) 
                return false;

            return HasRecipe( r.ID );
        }

        public virtual bool HasRecipe( int recipeID )
        {
            if( m_AcquiredRecipes != null && m_AcquiredRecipes.ContainsKey( recipeID ) )
                return m_AcquiredRecipes[recipeID];

            return false;
        }

        public virtual void AcquireRecipe( Recipe r )
        {
            if( r != null )
                AcquireRecipe( r.ID );
        }

        public virtual void AcquireRecipe( int recipeID )
        {
            if( m_AcquiredRecipes == null )
                m_AcquiredRecipes = new Dictionary<int, bool>();

            m_AcquiredRecipes[recipeID] = true;
        }

        public virtual void ResetRecipes()
        {
            m_AcquiredRecipes = null;
        }
    
        [CommandProperty( AccessLevel.GameMaster )]
        public int KnownRecipes
        {
            get 
            {
                if( m_AcquiredRecipes == null )
                    return 0;

                return m_AcquiredRecipes.Count;
            }
        }
    

        #endregion

        #region Buff Icons

        public void ResendBuffs()
        {
            if( !BuffInfo.Enabled || m_BuffTable == null )
                return;

            NetState state = this.NetState;

            if( state != null && state.Version >= BuffInfo.RequiredClient )
            {
                foreach( BuffInfo info in m_BuffTable.Values )
                {
                    state.Send( new AddBuffPacket( this, info ) );
                }
            }
        }

        private Dictionary<BuffIcon, BuffInfo> m_BuffTable;

        public void AddBuff( BuffInfo b )
        {
            if( !BuffInfo.Enabled || b == null )
                return;

            RemoveBuff( b );    //Check & subsequently remove the old one.

            if( m_BuffTable == null )
                m_BuffTable = new Dictionary<BuffIcon, BuffInfo>();

            m_BuffTable.Add( b.ID, b );

            NetState state = this.NetState;

            if( state != null && state.Version >= BuffInfo.RequiredClient )
            {
                state.Send( new AddBuffPacket( this, b ) );
            }
        }

        public void RemoveBuff( BuffInfo b )
        {
            if( b == null )
                return;

            RemoveBuff( b.ID );
        }

        public void RemoveBuff( BuffIcon b )
        {
            if( m_BuffTable == null || !m_BuffTable.ContainsKey( b ) )
                return;

            BuffInfo info = m_BuffTable[b];

            if( info.Timer != null && info.Timer.Running )
                info.Timer.Stop();

            m_BuffTable.Remove( b );

            NetState state = this.NetState;

            if( state != null && state.Version >= BuffInfo.RequiredClient )
            {
                state.Send( new RemoveBuffPacket( this, b ) );
            }

            if( m_BuffTable.Count <= 0 )
                m_BuffTable = null;
        }
        #endregion
    }
}[/COLOR]

here is minihouse.cs


Code:
[COLOR=RoyalBlue]using System;
using Server;

namespace Server.Items
{
    public class MiniHouseAddon : BaseAddon
    {
        private MiniHouseType m_Type;

        [CommandProperty( AccessLevel.GameMaster )]
        public MiniHouseType Type
        {
            get{ return m_Type; }
            set{ m_Type = value; Construct(); }
        }

        public override BaseAddonDeed Deed{ get{ return new MiniHouseDeed( m_Type ); } }

        [Constructable]
        public MiniHouseAddon() : this( MiniHouseType.StoneAndPlaster )
        {
        }

        [Constructable]
        public MiniHouseAddon( MiniHouseType type )
        {
            m_Type = type;

            Construct();
        }

        public void Construct()
        {                    
            #region Veteran Rewards
            foreach ( AddonComponent c in Components )
            {
                c.Addon = null;
                c.Delete();
            }
            #endregion
            
            Components.Clear();

            MiniHouseInfo info = MiniHouseInfo.GetInfo( m_Type );

            int size = (int)Math.Sqrt( info.Graphics.Length );
            int num = 0;

            for ( int y = 0; y < size; ++y )
                for ( int x = 0; x < size; ++x )
                    if ( info.Graphics[num] != 0x1 ) // Veteran Rewards Mod
                        AddComponent( new AddonComponent( info.Graphics[num++] ), size - x - 1, size - y - 1, 0 );
        }

        public MiniHouseAddon( Serial serial ) : base( serial )
        {
        }

        public override void Serialize( GenericWriter writer )
        {
            base.Serialize( writer );

            writer.Write( (int) 0 ); // version

            writer.Write( (int) m_Type );
        }

        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

            int version = reader.ReadInt();

            switch ( version )
            {
                case 0:
                {
                    m_Type = (MiniHouseType)reader.ReadInt();
                    break;
                }
            }
        }
    }

    public class MiniHouseDeed : BaseAddonDeed
    {
        private MiniHouseType m_Type;

        [CommandProperty( AccessLevel.GameMaster )]
        public MiniHouseType Type
        {
            get{ return m_Type; }
            set{ m_Type = value; InvalidateProperties(); }
        }

        public override BaseAddon Addon{ get{ return new MiniHouseAddon( m_Type ); } }
        public override int LabelNumber{ get{ return 1062096; } } // a mini house deed

        public override void GetProperties( ObjectPropertyList list )
        {
            base.GetProperties( list );

            list.Add( MiniHouseInfo.GetInfo( m_Type ).LabelNumber );
        }

        [Constructable]
        public MiniHouseDeed() : this( MiniHouseType.StoneAndPlaster )
        {
        }

        [Constructable]
        public MiniHouseDeed( MiniHouseType type )
        {
            m_Type = type;

            Weight = 1.0;
            LootType = LootType.Blessed;
        }

        public MiniHouseDeed( Serial serial ) : base( serial )
        {
        }

        public override void Serialize( GenericWriter writer )
        {
            base.Serialize( writer );

            writer.Write( (int) 0 ); // version

            writer.Write( (int) m_Type );
        }

        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

            int version = reader.ReadInt();

            switch ( version )
            {
                case 0:
                {
                    m_Type = (MiniHouseType)reader.ReadInt();
                    break;
                }
            }

            if ( Weight == 0.0 )
                Weight = 1.0;
        }
    }

    public enum MiniHouseType
    {
        StoneAndPlaster,
        FieldStone,
        SmallBrick,
        Wooden,
        WoodAndPlaster,
        ThatchedRoof,
        Brick,
        TwoStoryWoodAndPlaster,
        TwoStoryStoneAndPlaster,
        Tower,
        SmallStoneKeep,
        Castle,
        LargeHouseWithPatio,
        MarbleHouseWithPatio,
        SmallStoneTower,
        TwoStoryLogCabin,
        TwoStoryVilla,
        SandstoneHouseWithPatio,
        SmallStoneWorkshop, 
        SmallMarbleWorkshop

[COLOR=Red]    #region Veteran Rewards        
        MalasMountainPass,
        ChurchAtNight
        #endregion[/COLOR]
    }

    public class MiniHouseInfo
    {
        private int[] m_Graphics;
        private int m_LabelNumber;

        public int[] Graphics{ get{ return m_Graphics; } }
        public int LabelNumber{ get{ return m_LabelNumber; } }

        public MiniHouseInfo( int start, int count, int labelNumber )
        {
            m_Graphics = new int[count];

            for ( int i = 0; i < count; ++i )
                m_Graphics[i] = start + i;

            m_LabelNumber = labelNumber;
        }

        public MiniHouseInfo( int labelNumber, params int[] graphics )
        {
            m_LabelNumber = labelNumber;
            m_Graphics = graphics;
        }

        private static MiniHouseInfo[] m_Info = new MiniHouseInfo[]
            {
                /* Stone and plaster house           */ new MiniHouseInfo( 0x22C4, 1, 1011303 ),
                /* Field stone house                 */ new MiniHouseInfo( 0x22DE, 1, 1011304 ),
                /* Small brick house                 */ new MiniHouseInfo( 0x22DF, 1, 1011305 ),
                /* Wooden house                      */ new MiniHouseInfo( 0x22C9, 1, 1011306 ),
                /* Wood and plaster house            */ new MiniHouseInfo( 0x22E0, 1, 1011307 ),
                /* Thatched-roof cottage             */ new MiniHouseInfo( 0x22E1, 1, 1011308 ),
                /* Brick house                       */ new MiniHouseInfo( 1011309, 0x22CD, 0x22CB, 0x22CC, 0x22CA ),
                /* Two-story wood and plaster house  */ new MiniHouseInfo( 1011310, 0x2301, 0x2302, 0x2304, 0x2303 ),
                /* Two-story stone and plaster house */ new MiniHouseInfo( 1011311, 0x22FC, 0x22FD, 0x22FF, 0x22FE ),
                /* Tower                             */ new MiniHouseInfo( 1011312, 0x22F7, 0x22F8, 0x22FA, 0x22F9 ),
                /* Small stone keep                  */ new MiniHouseInfo( 0x22E6, 9, 1011313 ),
                /* Castle                            */ new MiniHouseInfo( 1011314, 0x22CE, 0x22D0, 0x22D2, 0x22D7, 0x22CF, 0x22D1, 0x22D4, 0x22D9, 0x22D3, 0x22D5, 0x22D6, 0x22DB, 0x22D8, 0x22DA, 0x22DC, 0x22DD ),
                /* Large house with patio            */ new MiniHouseInfo( 0x22E2, 4, 1011315 ),
                /* Marble house with patio           */ new MiniHouseInfo( 0x22EF, 4, 1011316 ),
                /* Small stone tower                 */ new MiniHouseInfo( 0x22F5, 1, 1011317 ),
                /* Two-story log cabin               */ new MiniHouseInfo( 0x22FB, 1, 1011318 ),
                /* Two-story villa                   */ new MiniHouseInfo( 0x2300, 1, 1011319 ),
                /* Sandstone house with patio        */ new MiniHouseInfo( 0x22F3, 1, 1011320 ),
                /* Small stone workshop              */ new MiniHouseInfo( 0x22F6, 1, 1011321 ),
                /* Small marble workshop             */ new MiniHouseInfo( 0x22F4, 1, 1011322 )
  [COLOR=Red]  #region Veteran Rewards
                /* Malas Mountain Pass               */ new MiniHouseInfo( 1062691, 0x2316, 0x2315, 0x2314, 0x2313 ),
                /* Church At Night                   */ new MiniHouseInfo( 1072214, 0x2318, 0x2317, 0x2319, 0x1 )
                #endregion[/COLOR]
            };

        public static MiniHouseInfo GetInfo( MiniHouseType type )
        {
            int v = (int)type;

            if ( v < 0 || v >= m_Info.Length )
                v = 0;

            return m_Info[v];
        }
    }
}[/COLOR]
Thanks again

Your missing the mergers to the MiniHouse.cs file for that issue.

You need to add the parts in Red.

For Playermobile.cs Mine's heavily modified as it is so I'm not sure what's going on there..
 

MalGanis

Sorceror
@ PappaSmurf
Your weapon serialization should look like this:

Code:
public override void Serialize( GenericWriter writer )
{
	base.Serialize( writer );

	writer.Write( (int) 10 ); // version

	#region Veteran Rewards version 10
	writer.Write( (string) m_EngravedText );
	#endregion
            
	#region Mondain's Legacy version 9
	....

 public override void Deserialize( GenericReader reader )
{
	base.Deserialize( reader );

	int version = reader.ReadInt();

	switch ( version )
	{
		#region Veteran Rewards
		case 10: 
		{
                	m_EngravedText = reader.ReadString();
			break;
		}
		#endregion
		#region Mondain's Legacy
                case 9: ....

@ kat
You forgot to merge MiniHouse.cs. And again, dont just overwrite your PlayerMobile.cs. Merge it. Same with every other file in Distro folder.
 

kat20

Sorceror
Thanks guys Im at work at the moment however as soon as I get home I will again be hard at work. Thanks for the continued help.
 
Top