Inheritance: BaseHairInfo
Example #1
0
        public FacialHairEquipUpdate(Mobile parent)
            : base(0x2E, 15)
        {
            var hue = parent.SolidHueOverride >= 0 ? parent.SolidHueOverride : parent.FacialHairHue;

            Stream.Write(FacialHairInfo.FakeSerial(parent));
            Stream.Write((short)parent.FacialHairItemID);
            Stream.Write((byte)0);
            Stream.Write((byte)Layer.FacialHair);
            Stream.Write(parent.Serial);
            Stream.Write((short)hue);
        }
Example #2
0
		public FacialHairEquipUpdate( Mobile parent )
			: base( 0x2E, 15 )
		{
			int hue = parent.FacialHairHue;

			if( parent.SolidHueOverride >= 0 )
				hue = parent.SolidHueOverride;

			int hairSerial = FacialHairInfo.FakeSerial( parent );

			m_Stream.Write( (int)hairSerial );
			m_Stream.Write( (short)parent.FacialHairItemID );
			m_Stream.Write( (byte)0 );
			m_Stream.Write( (byte)Layer.FacialHair );
			m_Stream.Write( (int)parent.Serial );
			m_Stream.Write( (short)hue );
		}
Example #3
0
 public RemoveFacialHair(Mobile parent)
     : base(0x1D, 5)
 {
     m_Stream.Write((int)FacialHairInfo.FakeSerial(parent));
 }
Example #4
0
        public static Container Mobile_CreateCorpseHandler( Mobile owner, HairInfo hair, FacialHairInfo facialhair, List<Item> initialContent, List<Item> equipItems )
        {
            bool shouldFillCorpse = true;

            //if ( owner is BaseCreature )
            //	shouldFillCorpse = !((BaseCreature)owner).IsBonded;

            Corpse c;
            if( owner is MilitiaFighter )
                c = new MilitiaFighterCorpse( owner, hair, facialhair, shouldFillCorpse ? equipItems : new List<Item>() );
            else
                c = new Corpse( owner, hair, facialhair, shouldFillCorpse ? equipItems : new List<Item>() );

            owner.Corpse = c;

            if ( shouldFillCorpse )
            {
                for ( int i = 0; i < initialContent.Count; ++i )
                {
                    Item item = initialContent[i];

                    if ( Core.AOS && owner.Player && item.Parent == owner.Backpack )
                        c.AddItem( item );
                    else
                        c.DropItem( item );

                    if ( owner.Player && Core.AOS )
                        c.SetRestoreInfo( item, item.Location );
                }

                if ( !owner.Player )
                    c.AssignInstancedLoot();
            }
            else
            {
                c.Carved = true; // TODO: Is it needed?
            }

            Point3D loc = owner.Location;
            Map map = owner.Map;

            if ( map == null || map == Map.Internal )
            {
                loc = owner.LogoutLocation;
                map = owner.LogoutMap;
            }

            c.MoveToWorld( loc, map );

            return c;
        }
Example #5
0
        public Corpse( Mobile owner, HairInfo hair, FacialHairInfo facialhair, List<Item> equipItems )
            : base(0x2006)
        {
            // To supress console warnings, stackable must be true
            Stackable = true;
            Amount = owner.Body; // protocol defines that for itemid 0x2006, amount=body
            Stackable = false;

            Movable = false;
            Hue = owner.Hue;
            Direction = owner.Direction;
            Name = owner.Name;

            m_Owner = owner;

            m_CorpseName = GetCorpseName( owner );

            m_TimeOfDeath = DateTime.Now;

            m_AccessLevel = owner.AccessLevel;
            m_Guild = owner.Guild as Guild;
            m_Kills = owner.Kills;
            SetFlag( CorpseFlag.Criminal, owner.Criminal );

            m_Hair = hair;
            m_FacialHair = facialhair;

            // This corpse does not turn to bones if: the owner is not a player
            SetFlag( CorpseFlag.NoBones, !owner.Player );

            m_Looters = new List<Mobile>();
            m_EquipItems = equipItems;

            m_Aggressors = new List<Mobile>( owner.Aggressors.Count + owner.Aggressed.Count );
            //bool addToAggressors = !( owner is BaseCreature );

            bool isBaseCreature = (owner is BaseCreature);

            TimeSpan lastTime = TimeSpan.MaxValue;

            for ( int i = 0; i < owner.Aggressors.Count; ++i )
            {
                AggressorInfo info = owner.Aggressors[i];

                if ( (DateTime.Now - info.LastCombatTime) < lastTime )
                {
                    m_Killer = info.Attacker;
                    lastTime = (DateTime.Now - info.LastCombatTime);
                }

                if ( !isBaseCreature && !info.CriminalAggression )
                    m_Aggressors.Add( info.Attacker );
            }

            for ( int i = 0; i < owner.Aggressed.Count; ++i )
            {
                AggressorInfo info = owner.Aggressed[i];

                if ( (DateTime.Now - info.LastCombatTime) < lastTime )
                {
                    m_Killer = info.Defender;
                    lastTime = (DateTime.Now - info.LastCombatTime);
                }

                if ( !isBaseCreature )
                    m_Aggressors.Add( info.Defender );
            }

            if ( isBaseCreature )
            {
                BaseCreature bc = (BaseCreature)owner;

                Mobile master = bc.GetMaster();
                if( master != null )
                    m_Aggressors.Add( master );

                List<DamageStore> rights = BaseCreature.GetLootingRights( bc.DamageEntries, bc.HitsMax );
                for ( int i = 0; i < rights.Count; ++i )
                {
                    DamageStore ds = rights[i];

                    if ( ds.m_HasRight )
                        m_Aggressors.Add( ds.m_Mobile );
                }
            }

            BeginDecay( m_DefaultDecayTime );

            DevourCorpse();
        }
Example #6
0
 public MilitiaFighterCorpse( Mobile owner, HairInfo hair, FacialHairInfo facialhair, List<Item> equipItems )
     : base(owner, hair, facialhair, equipItems)
 {
 }
Example #7
0
        public void Kill()
        {
            if ( !CanBeDamaged() )
                return;
            else if ( !Alive || IsDeadBondedPet )
                return;
            else if ( m_Deleted )
                return;
            else if ( !Region.OnBeforeDeath( this ) )
                return;
            else if ( !OnBeforeDeath() )
                return;

            BankBox box = FindBankNoCreate();

            if ( box != null && box.Opened )
                box.Close();

            if ( m_Client != null )
                m_Client.CancelAllTrades();

            if ( m_Spell != null )
                m_Spell.OnCasterKilled();

            if ( m_Target != null )
                m_Target.Cancel( this, TargetCancelType.Canceled );

            DisruptiveAction();

            Warmode = false;

            this.DropHolding();

            Hits = 0;
            Stam = 0;
            Mana = 0;

            Poison = null;
            Combatant = null;

            if ( Paralyzed )
            {
                Paralyzed = false;

                if ( m_ParaTimer != null )
                    m_ParaTimer.Stop();
            }

            if ( Frozen )
            {
                Frozen = false;

                if ( m_FrozenTimer != null )
                    m_FrozenTimer.Stop();
            }

            List<Item> content = new List<Item>();
            List<Item> equip = new List<Item>();
            List<Item> moveToPack = new List<Item>();

            List<Item> itemsCopy = new List<Item>( m_EquippedItems );

            Container pack = this.Backpack;

            for ( int i = 0; i < itemsCopy.Count; ++i )
            {
                Item item = itemsCopy[i];

                if ( item == pack )
                    continue;

                DeathMoveResult res = GetParentMoveResultFor( item );

                switch ( res )
                {
                    case DeathMoveResult.MoveToCorpse:
                        {
                            content.Add( item );
                            equip.Add( item );
                            break;
                        }
                    case DeathMoveResult.MoveToBackpack:
                        {
                            moveToPack.Add( item );
                            break;
                        }
                }
            }

            if ( pack != null )
            {
                List<Item> packCopy = pack.Items;

                for ( int i = 0; i < packCopy.Count; ++i )
                {
                    Item item = packCopy[i];

                    DeathMoveResult res = GetInventoryMoveResultFor( item );

                    if ( res == DeathMoveResult.MoveToCorpse )
                        content.Add( item );
                    else
                        moveToPack.Add( item );
                }

                for ( int i = 0; i < moveToPack.Count; ++i )
                {
                    Item item = moveToPack[i];

                    if ( RetainPackLocsOnDeath && item.Parent == pack )
                        continue;

                    pack.DropItem( item );
                }
            }

            HairInfo hair = null;
            if ( m_Hair != null )
                hair = new HairInfo( m_Hair.ItemID, m_Hair.Hue );

            FacialHairInfo facialhair = null;
            if ( m_FacialHair != null )
                facialhair = new FacialHairInfo( m_FacialHair.ItemID, m_FacialHair.Hue );

            Container c = ( m_CreateCorpse == null ? null : m_CreateCorpse( this, hair, facialhair, content, equip ) );

            if ( !m_DeathList.Contains( this ) )
            {
                if ( DoEffectTimerOnDeath )
                {
                    m_DeathList.Add( this );
                    Timer.DelayCall( TimeSpan.FromSeconds( 1.25 ), new TimerStateCallback( DelFromDeathList ), this );
                }

                InvokeDead( new DeadEventArgs( c ) );
            }

            OnAfterDeath( c );
        }
Example #8
0
        public virtual void Deserialize( GenericReader reader )
        {
            int version = reader.ReadInt();

            switch ( version )
            {
                case 36:
                case 35:
                case 34:
                    {
                        byte hairflag = reader.ReadByte();

                        if ( ( hairflag & 0x01 ) != 0 )
                            m_Hair = new HairInfo( reader );

                        if ( ( hairflag & 0x02 ) != 0 )
                            m_FacialHair = new FacialHairInfo( reader );

                        m_InstanceID = reader.ReadInt();

                        m_Race = reader.ReadRace();

                        if ( version < 36 )
                            reader.ReadDeltaTime();

                        m_TithingPoints = reader.ReadInt();

                        m_Corpse = reader.ReadItem() as Container;

                        m_CreationTime = reader.ReadDateTime();

                        m_Stabled = reader.ReadStrongMobileList();

                        m_CantWalk = reader.ReadBool();

                        m_Virtues = new VirtueInfo( reader );

                        m_Thirst = reader.ReadInt();
                        m_BAC = reader.ReadInt();

                        m_ShortTermMurders = reader.ReadInt();

                        if ( version < 35 )
                            reader.ReadInt();

                        m_MagicDamageAbsorb = reader.ReadInt();

                        m_GuildFealty = reader.ReadMobile();
                        m_Guild = reader.ReadGuild();
                        m_DisplayGuildTitle = reader.ReadBool();

                        m_CanSwim = reader.ReadBool();

                        m_Squelched = reader.ReadBool();

                        m_Holding = reader.ReadItem();

                        m_BaseSoundID = reader.ReadInt();

                        m_DisarmReady = reader.ReadBool();
                        m_StunReady = reader.ReadBool();

                        m_StatCap = reader.ReadInt();

                        m_NameHue = reader.ReadInt();

                        m_Hunger = reader.ReadInt();

                        m_Location = reader.ReadPoint3D();
                        m_Body = new Body( reader.ReadInt() );
                        m_Name = reader.ReadString();
                        if ( m_Name != null )
                            m_Name = string.Intern( m_Name );
                        m_GuildTitle = reader.ReadString();
                        m_Criminal = reader.ReadBool();
                        m_Kills = reader.ReadInt();
                        m_SpeechHue = reader.ReadInt();
                        m_EmoteHue = reader.ReadInt();
                        m_WhisperHue = reader.ReadInt();
                        m_YellHue = reader.ReadInt();
                        m_Language = reader.ReadString();
                        if ( m_Language != null )
                            m_Language = string.Intern( m_Language );
                        m_Female = reader.ReadBool();
                        m_Warmode = reader.ReadBool();
                        m_Hidden = reader.ReadBool();
                        m_Direction = (Direction) reader.ReadByte();
                        m_Hue = reader.ReadInt();
                        m_Str = reader.ReadInt();
                        m_Dex = reader.ReadInt();
                        m_Int = reader.ReadInt();
                        m_Hits = reader.ReadInt();
                        m_Stam = reader.ReadInt();
                        m_Mana = reader.ReadInt();
                        m_Map = reader.ReadMap();
                        m_Blessed = reader.ReadBool();
                        m_Fame = reader.ReadInt();
                        m_Karma = reader.ReadInt();
                        m_AccessLevel = (AccessLevel) reader.ReadByte();

                        m_Skills = new Skills( this, reader );

                        int itemCount = reader.ReadInt();

                        m_EquippedItems = new List<Item>( itemCount );

                        for ( int i = 0; i < itemCount; ++i )
                        {
                            Item item = reader.ReadItem();

                            if ( item != null )
                                m_EquippedItems.Add( item );
                        }

                        m_IsPlayer = reader.ReadBool();
                        m_Title = reader.ReadString();
                        if ( m_Title != null )
                            m_Title = string.Intern( m_Title );
                        m_Profile = reader.ReadString();
                        m_ProfileLocked = reader.ReadBool();

                        m_AutoPageNotify = reader.ReadBool();

                        m_LogoutLocation = reader.ReadPoint3D();
                        m_LogoutMap = reader.ReadMap();

                        m_StrLock = (StatLockType) reader.ReadByte();
                        m_DexLock = (StatLockType) reader.ReadByte();
                        m_IntLock = (StatLockType) reader.ReadByte();

                        m_StatMods = new List<StatMod>();

                        if ( reader.ReadBool() )
                        {
                            m_StuckMenuUses = new DateTime[reader.ReadInt()];

                            for ( int i = 0; i < m_StuckMenuUses.Length; ++i )
                            {
                                m_StuckMenuUses[i] = reader.ReadDateTime();
                            }
                        }
                        else
                        {
                            m_StuckMenuUses = null;
                        }

                        if ( m_IsPlayer && m_Map != Map.Internal )
                        {
                            m_LogoutLocation = m_Location;
                            m_LogoutMap = m_Map;

                            m_Map = Map.Internal;
                        }

                        if ( m_Map != null )
                            m_Map.OnEnter( this );

                        if ( m_Criminal )
                        {
                            if ( m_ExpireCriminal == null )
                                m_ExpireCriminal = new ExpireCriminalTimer( this );

                            m_ExpireCriminal.Start();
                        }

                        if ( ShouldCheckStatTimers )
                            CheckStatTimers();

                        UpdateRegion();

                        UpdateResistances();

                        break;
                    }
            }
        }
Example #9
0
        public virtual void Delete()
        {
            if ( m_Deleted )
                return;
            else if ( !World.Instance.OnDelete( this ) )
                return;

            if ( m_Client != null )
                m_Client.CancelAllTrades();

            if ( m_Client != null )
                m_Client.Dispose();

            this.DropHolding();

            Region.OnRegionChange( this, m_Region, null );

            m_Region = null;
            //Is the above line REALLY needed?  The old Region system did NOT have said line
            //and worked fine, because of this a LOT of extra checks have to be done everywhere...
            //I guess this should be there for Garbage collection purposes, but, still, is it /really/ needed?

            if ( m_Spawner != null )
            {
                m_Spawner.Remove( this );
                m_Spawner = null;
            }

            OnDelete();

            for ( int i = m_EquippedItems.Count - 1; i >= 0; --i )
                if ( i < m_EquippedItems.Count )
                    m_EquippedItems[i].OnParentDeleted( this );

            this.SendRemovePacket();

            if ( m_Guild != null )
                m_Guild.OnDelete( this );

            m_Deleted = true;

            if ( m_Map != null )
            {
                m_Map.OnLeave( this );
                m_Map = null;
            }

            m_Hair = null;
            m_FacialHair = null;

            m_MountItem = null;

            World.Instance.RemoveMobile( this );

            EventSink.Instance.InvokeDeleted( new DeletedEventArgs( this ) );

            StopAggrExpire();

            CheckAggrExpire();

            if ( m_PoisonTimer != null )
                m_PoisonTimer.Stop();

            if ( m_HitsTimer != null )
                m_HitsTimer.Stop();

            if ( m_StamTimer != null )
                m_StamTimer.Stop();

            if ( m_ManaTimer != null )
                m_ManaTimer.Stop();

            if ( m_LogoutTimer != null )
                m_LogoutTimer.Stop();

            if ( m_ExpireCriminal != null )
                m_ExpireCriminal.Stop();

            if ( m_WarmodeTimer != null )
                m_WarmodeTimer.Stop();

            if ( m_ParaTimer != null )
                m_ParaTimer.Stop();

            if ( m_FrozenTimer != null )
                m_FrozenTimer.Stop();

            if ( m_AutoManifestTimer != null )
                m_AutoManifestTimer.Stop();

            OnAfterDelete();

            FreeCache();
        }
Example #10
0
        public static Container Mobile_CreateCorpseHandler( Mobile owner, HairInfo hair, FacialHairInfo facialhair, List<Item> initialContent, List<Item> equipItems )
        {
            Corpse c = new Corpse( owner, hair, facialhair, equipItems );
            owner.Corpse = c;

            for ( int i = 0; i < initialContent.Count; ++i )
            {
                Item item = (Item) initialContent[i];

                if ( owner.IsPlayer && item.Parent == owner.Backpack )
                    c.AddItem( item );
                else
                    c.DropItem( item );

                if ( owner.IsPlayer )
                    c.SetRestoreInfo( item, item.Location );
            }

            Point3D loc = owner.Location;
            Map map = owner.Map;

            if ( map == null || map == Map.Internal )
            {
                loc = owner.LogoutLocation;
                map = owner.LogoutMap;
            }

            c.MoveToWorld( loc, map );

            return c;
        }