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!

Problem with CannedEvil/ChampionSpawn.CS

hermi

Sorceror
I check all the ones that come up on RunUo for using daat99; and all of them have it at the end i didn't have to add it to any...here's Spells.cs


Code:
using System;
using Server.Items;
using Server.Network;
using Server.Targeting;
using Server.Mobiles;
using Server.Spells.Second;
using Server.Spells.Necromancy;
using Server.Spells.Ninjitsu;
using System.Collections.Generic;
using Server.Spells.Spellweaving;
using Server.Spells.Bushido;
using daat99;
 
namespace Server.Spells
{
    public abstract class Spell : ISpell
    {
        private Mobile m_Caster;
        private Item m_Scroll;
        private SpellInfo m_Info;
        private SpellState m_State;
 

Hammerhand

Knight
The Server.daat99; is from the older version of OWLTR. OWLTR ver 3.01.00 doesnt use it. Post your Spell.cs & GenericSell.cs please.
 

Mikey

Sorceror
The Server.daat99; is from the older version of OWLTR. OWLTR ver 3.01.00 doesnt use it. Post your Spell.cs & GenericSell.cs please.
Gotcha, didn't realize, I haven't used that system for a long time, didn't realize it changed, just assumed it used the old namespace's name.
 

hermi

Sorceror
Spell.cs

Code:
using System;
using Server.Items;
using Server.Network;
using Server.Targeting;
using Server.Mobiles;
using Server.Spells.Second;
using Server.Spells.Necromancy;
using Server.Spells.Ninjitsu;
using System.Collections.Generic;
using Server.Spells.Spellweaving;
using Server.Spells.Bushido;
using Server.daat99;
 
namespace Server.Spells
{
    public abstract class Spell : ISpell
    {
        private Mobile m_Caster;
        private Item m_Scroll;
        private SpellInfo m_Info;
        private SpellState m_State;
        private DateTime m_StartCastTime;
 
        public SpellState State{ get{ return m_State; } set{ m_State = value; } }
        public Mobile Caster{ get{ return m_Caster; } }
        public SpellInfo Info{ get{ return m_Info; } }
        public string Name{ get{ return m_Info.Name; } }
        public string Mantra{ get{ return m_Info.Mantra; } }
        public Type[] Reagents{ get{ return m_Info.Reagents; } }
        public Item Scroll{ get{ return m_Scroll; } }
        public DateTime StartCastTime { get { return m_StartCastTime; } }
 
        private static TimeSpan NextSpellDelay = TimeSpan.FromSeconds( 0.75 );
        private static TimeSpan AnimateDelay = TimeSpan.FromSeconds( 1.5 );
 
        public virtual SkillName CastSkill{ get{ return SkillName.Magery; } }
        public virtual SkillName DamageSkill{ get{ return SkillName.EvalInt; } }
 
        public virtual bool RevealOnCast{ get{ return true; } }
        public virtual bool ClearHandsOnCast{ get{ return true; } }
        public virtual bool ShowHandMovement{ get{ return true; } }
 
        public virtual bool DelayedDamage{ get{ return false; } }
 
        public virtual bool DelayedDamageStacking { get { return true; } }
        //In reality, it's ANY delayed Damage spell Post-AoS that can't stack, but, only
        //Expo & Magic Arrow have enough delay and a short enough cast time to bring up
        //the possibility of stacking 'em.  Note that a MA & an Explosion will stack, but
        //of course, two MA's won't.
 
        private static Dictionary<Type, DelayedDamageContextWrapper> m_ContextTable = new Dictionary<Type, DelayedDamageContextWrapper>();
 
        private class DelayedDamageContextWrapper
        {
            private Dictionary<Mobile, Timer> m_Contexts = new Dictionary<Mobile, Timer>();
 
            public void Add( Mobile m, Timer t )
            {
                Timer oldTimer;
                if( m_Contexts.TryGetValue( m, out oldTimer ) )
                {
                    oldTimer.Stop();
                    m_Contexts.Remove( m );
                }
 
                m_Contexts.Add( m, t );
            }
 
            public void Remove( Mobile m )
            {
                m_Contexts.Remove( m );
            }
        }
 
        public void StartDelayedDamageContext( Mobile m, Timer t )
        {
            if( DelayedDamageStacking )
                return; //Sanity
 
            DelayedDamageContextWrapper contexts;
 
            if( !m_ContextTable.TryGetValue( GetType(), out contexts ) )
            {
                contexts = new DelayedDamageContextWrapper();
                m_ContextTable.Add( GetType(), contexts );
            }
 
            contexts.Add( m, t );
        }
 
        public void RemoveDelayedDamageContext( Mobile m )
        {
            DelayedDamageContextWrapper contexts;
 
            if( !m_ContextTable.TryGetValue( GetType(), out contexts ) )
                return;
 
            contexts.Remove( m );
        }
 
        public void HarmfulSpell( Mobile m )
        {
            if ( m is BaseCreature )
                ((BaseCreature)m).OnHarmfulSpell( m_Caster );
        }
 
        public Spell( Mobile caster, Item scroll, SpellInfo info )
        {
            m_Caster = caster;
            m_Scroll = scroll;
            m_Info = info;
        }
 
        public virtual int GetNewAosDamage( int bonus, int dice, int sides, Mobile singleTarget )
        {
            if( singleTarget != null )
            {
                return GetNewAosDamage( bonus, dice, sides, (Caster.Player && singleTarget.Player), GetDamageScalar( singleTarget ) );
            }
            else
            {
                return GetNewAosDamage( bonus, dice, sides, false );
            }
        }
 
        public virtual int GetNewAosDamage( int bonus, int dice, int sides, bool playerVsPlayer )
        {
            return GetNewAosDamage( bonus, dice, sides, playerVsPlayer, 1.0 );
        }
 
        public virtual int GetNewAosDamage( int bonus, int dice, int sides, bool playerVsPlayer, double scalar )
        {
            int damage = Utility.Dice( dice, sides, bonus ) * 100;
            int damageBonus = 0;
 
            int inscribeSkill = GetInscribeFixed( m_Caster );
            int inscribeBonus = (inscribeSkill + (1000 * (inscribeSkill / 1000))) / 200;
            damageBonus += inscribeBonus;
 
            int intBonus = Caster.Int / 10;
            damageBonus += intBonus;
 
            int sdiBonus = AosAttributes.GetValue( m_Caster, AosAttribute.SpellDamage );
            // PvP spell damage increase cap of 15% from an item’s magic property
            if ( playerVsPlayer && sdiBonus > 15 )
                sdiBonus = 15;
 
            damageBonus += sdiBonus;
 
            TransformContext context = TransformationSpellHelper.GetContext( Caster );
 
            if( context != null && context.Spell is ReaperFormSpell )
                damageBonus += ((ReaperFormSpell)context.Spell).SpellDamageBonus;
 
            damage = AOS.Scale( damage, 100 + damageBonus );
 
            int evalSkill = GetDamageFixed( m_Caster );
            int evalScale = 30 + ((9 * evalSkill) / 100);
 
            damage = AOS.Scale( damage, evalScale );
 
            damage = AOS.Scale( damage, (int)(scalar*100) );
 
            return damage / 100;
        }
 
        public virtual bool IsCasting{ get{ return m_State == SpellState.Casting; } }
 
        public virtual void OnCasterHurt()
        {
            //Confirm: Monsters and pets cannot be disturbed.
            if ( !Caster.Player )
                return;
 
            if ( IsCasting )
            {
                object o = ProtectionSpell.Registry[m_Caster];
                bool disturb = true;
 
                if ( o != null && o is double )
                {
                    if ( ((double)o) > Utility.RandomDouble()*100.0 )
                        disturb = false;
                }
 
                if ( disturb )
                    Disturb( DisturbType.Hurt, false, true );
            }
        }
 
        public virtual void OnCasterKilled()
        {
            Disturb( DisturbType.Kill );
        }
 
        public virtual void OnConnectionChanged()
        {
            FinishSequence();
        }
 
        public virtual bool OnCasterMoving( Direction d )
        {
            if ( IsCasting && BlocksMovement )
            {
                m_Caster.SendLocalizedMessage( 500111 ); // You are frozen and can not move.
                return false;
            }
 
            return true;
        }
 
        public virtual bool OnCasterEquiping( Item item )
        {
            if ( IsCasting )
                Disturb( DisturbType.EquipRequest );
 
            return true;
        }
 
        public virtual bool OnCasterUsingObject( object o )
        {
            if ( m_State == SpellState.Sequencing )
                Disturb( DisturbType.UseRequest );
 
            return true;
        }
 
        public virtual bool OnCastInTown( Region r )
        {
            return m_Info.AllowTown;
        }
 
        public virtual bool ConsumeReagents()
        {
            if ( m_Scroll != null || !m_Caster.Player )
                return true;
 
            if ( AosAttributes.GetValue( m_Caster, AosAttribute.LowerRegCost ) > Utility.Random( 100 ) )
                return true;
 
            if ( Engines.ConPVP.DuelContext.IsFreeConsume( m_Caster ) )
                return true;
 
            Container pack = m_Caster.Backpack;
 
            if ( pack == null )
                return false;
 
            if ( pack.ConsumeTotal( m_Info.Reagents, m_Info.Amounts ) == -1 )
                return true;
 
            //daat99 OWLTR start - use SpellCastersKey
            if (OWLTROptionsManager.IsEnabled(OWLTROptionsManager.OPTIONS_ENUM.USE_STORAGE_RESOURCES) && MasterStorageUtils.ConsumePlayersStorageItems(m_Caster as PlayerMobile, m_Info.Reagents, m_Info.Amounts))
                return true;
            //daat99 OWLTR end - use SpellCastersKey
            return false;
        }
 
        public virtual double GetInscribeSkill( Mobile m )
        {
            // There is no chance to gain
            // m.CheckSkill( SkillName.Inscribe, 0.0, 120.0 );
 
            return m.Skills[SkillName.Inscribe].Value;
        }
 
        public virtual int GetInscribeFixed( Mobile m )
        {
            // There is no chance to gain
            // m.CheckSkill( SkillName.Inscribe, 0.0, 120.0 );
 
            return m.Skills[SkillName.Inscribe].Fixed;
        }
 
        public virtual int GetDamageFixed( Mobile m )
        {
            //m.CheckSkill( DamageSkill, 0.0, m.Skills[DamageSkill].Cap );
 
            return m.Skills[DamageSkill].Fixed;
        }
 
        public virtual double GetDamageSkill( Mobile m )
        {
            //m.CheckSkill( DamageSkill, 0.0, m.Skills[DamageSkill].Cap );
 
            return m.Skills[DamageSkill].Value;
        }
 
        public virtual double GetResistSkill( Mobile m )
        {
            return m.Skills[SkillName.MagicResist].Value;
        }
 
        public virtual double GetDamageScalar( Mobile target )
        {
            double scalar = 1.0;
 
            if( !Core.AOS )    //EvalInt stuff for AoS is handled elsewhere
            {
                double casterEI = m_Caster.Skills[DamageSkill].Value;
                double targetRS = target.Skills[SkillName.MagicResist].Value;
 
                /*
                if( Core.AOS )
                    targetRS = 0;
                */
 
                //m_Caster.CheckSkill( DamageSkill, 0.0, 120.0 );
 
                if( casterEI > targetRS )
                    scalar = (1.0 + ((casterEI - targetRS) / 500.0));
                else
                    scalar = (1.0 + ((casterEI - targetRS) / 200.0));
 
                // magery damage bonus, -25% at 0 skill, +0% at 100 skill, +5% at 120 skill
                scalar += (m_Caster.Skills[CastSkill].Value - 100.0) / 400.0;
 
                if( !target.Player && !target.Body.IsHuman /*&& !Core.AOS*/ )
                    scalar *= 2.0; // Double magery damage to monsters/animals if not AOS
            }
 
            if ( target is BaseCreature )
                ((BaseCreature)target).AlterDamageScalarFrom( m_Caster, ref scalar );
 
            if ( m_Caster is BaseCreature )
                ((BaseCreature)m_Caster).AlterDamageScalarTo( target, ref scalar );
 
            if( Core.SE )
                scalar *= GetSlayerDamageScalar( target );
 
            target.Region.SpellDamageScalar( m_Caster, target, ref scalar );
 
            if( Evasion.CheckSpellEvasion( target ) )    //Only single target spells an be evaded
                scalar = 0;
 
            return scalar;
        }
 
        public virtual double GetSlayerDamageScalar( Mobile defender )
        {
            Spellbook atkBook = Spellbook.FindEquippedSpellbook( m_Caster );
 
            double scalar = 1.0;
            if( atkBook != null )
            {
                SlayerEntry atkSlayer = SlayerGroup.GetEntryByName( atkBook.Slayer );
                SlayerEntry atkSlayer2 = SlayerGroup.GetEntryByName( atkBook.Slayer2 );
 
                if( atkSlayer != null && atkSlayer.Slays( defender ) || atkSlayer2 != null && atkSlayer2.Slays( defender ) )
                {
                    defender.FixedEffect( 0x37B9, 10, 5 );    //TODO: Confirm this displays on OSIs
                    scalar = 2.0;
                }
 
 
                TransformContext context = TransformationSpellHelper.GetContext( defender );
 
                if( (atkBook.Slayer == SlayerName.Silver || atkBook.Slayer2 == SlayerName.Silver) && context != null && context.Type != typeof( HorrificBeastSpell ) )
                    scalar +=.25; // Every necromancer transformation other than horrific beast take an additional 25% damage
 
                if( scalar != 1.0 )
                    return scalar;
            }
 
            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( m_Caster ) || defSlayer2 != null && defSlayer2.Group.OppositionSuperSlays( m_Caster ) )
                    scalar = 2.0;
            }
 
            return scalar;
        }
 
        public virtual void DoFizzle()
        {
            m_Caster.LocalOverheadMessage( MessageType.Regular, 0x3B2, 502632 ); // The spell fizzles.
 
            if ( m_Caster.Player )
            {
                if ( Core.AOS )
                    m_Caster.FixedParticles( 0x3735, 1, 30, 9503, EffectLayer.Waist );
                else
                    m_Caster.FixedEffect( 0x3735, 6, 30 );
 
                m_Caster.PlaySound( 0x5C );
            }
        }
 
        private CastTimer m_CastTimer;
        private AnimTimer m_AnimTimer;
 
        public void Disturb( DisturbType type )
        {
            Disturb( type, true, false );
        }
 
        public virtual bool CheckDisturb( DisturbType type, bool firstCircle, bool resistable )
        {
            if ( resistable && m_Scroll is BaseWand )
                return false;
 
            return true;
        }
 
        public void Disturb( DisturbType type, bool firstCircle, bool resistable )
        {
            if ( !CheckDisturb( type, firstCircle, resistable ) )
                return;
 
            if ( m_State == SpellState.Casting )
            {
                if( !firstCircle && !Core.AOS && this is MagerySpell && ((MagerySpell)this).Circle == SpellCircle.First )
                    return;
 
                m_State = SpellState.None;
                m_Caster.Spell = null;
 
                OnDisturb( type, true );
 
                if ( m_CastTimer != null )
                    m_CastTimer.Stop();
 
                if ( m_AnimTimer != null )
                    m_AnimTimer.Stop();
 
                if ( Core.AOS && m_Caster.Player && type == DisturbType.Hurt )
                    DoHurtFizzle();
 
                m_Caster.NextSpellTime = DateTime.Now + GetDisturbRecovery();
            }
            else if ( m_State == SpellState.Sequencing )
            {
                if( !firstCircle && !Core.AOS && this is MagerySpell && ((MagerySpell)this).Circle == SpellCircle.First )
                    return;
 
                m_State = SpellState.None;
                m_Caster.Spell = null;
 
                OnDisturb( type, false );
 
                Targeting.Target.Cancel( m_Caster );
 
                if ( Core.AOS && m_Caster.Player && type == DisturbType.Hurt )
                    DoHurtFizzle();
            }
        }
 
        public virtual void DoHurtFizzle()
        {
            m_Caster.FixedEffect( 0x3735, 6, 30 );
            m_Caster.PlaySound( 0x5C );
        }
 
        public virtual void OnDisturb( DisturbType type, bool message )
        {
            if ( message )
                m_Caster.SendLocalizedMessage( 500641 ); // Your concentration is disturbed, thus ruining thy spell.
        }
 
        public virtual bool CheckCast()
        {
            return true;
        }
 
        public virtual void SayMantra()
        {
            if ( m_Scroll is BaseWand )
                return;
 
            if ( m_Info.Mantra != null && m_Info.Mantra.Length > 0 && m_Caster.Player )
                m_Caster.PublicOverheadMessage( MessageType.Spell, m_Caster.SpeechHue, true, m_Info.Mantra, false );
        }
 
        public virtual bool BlockedByHorrificBeast{ get{ return true; } }
        public virtual bool BlockedByAnimalForm{ get{ return true; } }
        public virtual bool BlocksMovement{ get{ return true; } }
 
        public virtual bool CheckNextSpellTime{ get{ return !(m_Scroll is BaseWand); } }
 
        public bool Cast()
        {
            m_StartCastTime = DateTime.Now;
 
            if ( Core.AOS && m_Caster.Spell is Spell && ((Spell)m_Caster.Spell).State == SpellState.Sequencing )
                ((Spell)m_Caster.Spell).Disturb( DisturbType.NewCast );
 
            if ( !m_Caster.CheckAlive() )
            {
                return false;
            }
            else if ( m_Scroll is BaseWand && m_Caster.Spell != null && m_Caster.Spell.IsCasting )
            {
                m_Caster.SendLocalizedMessage( 502643 ); // You can not cast a spell while frozen.
            }
            else if ( m_Caster.Spell != null && m_Caster.Spell.IsCasting )
            {
                m_Caster.SendLocalizedMessage( 502642 ); // You are already casting a spell.
            }
            else if ( BlockedByHorrificBeast && TransformationSpellHelper.UnderTransformation( m_Caster, typeof( HorrificBeastSpell ) ) || ( BlockedByAnimalForm && AnimalForm.UnderTransformation( m_Caster ) ))
            {
                m_Caster.SendLocalizedMessage( 1061091 ); // You cannot cast that spell in this form.
            }
            else if ( !(m_Scroll is BaseWand) && (m_Caster.Paralyzed || m_Caster.Frozen) )
            {
                m_Caster.SendLocalizedMessage( 502643 ); // You can not cast a spell while frozen.
            }
            else if ( CheckNextSpellTime && DateTime.Now < m_Caster.NextSpellTime )
            {
                m_Caster.SendLocalizedMessage( 502644 ); // You have not yet recovered from casting a spell.
            }
            else if ( m_Caster is PlayerMobile && ( (PlayerMobile) m_Caster ).PeacedUntil > DateTime.Now )
            {
                m_Caster.SendLocalizedMessage( 1072060 ); // You cannot cast a spell while calmed.
            }
            #region Dueling
            else if ( m_Caster is PlayerMobile && ((PlayerMobile)m_Caster).DuelContext != null && !((PlayerMobile)m_Caster).DuelContext.AllowSpellCast( m_Caster, this ) )
            {
            }
            #endregion
            else if ( m_Caster.Mana >= ScaleMana( GetMana() ) )
            {
                if ( m_Caster.Spell == null && m_Caster.CheckSpellCast( this ) && CheckCast() && m_Caster.Region.OnBeginSpellCast( m_Caster, this ) )
                {
                    m_State = SpellState.Casting;
                    m_Caster.Spell = this;
 
                    if ( !( m_Scroll is BaseWand ) && RevealOnCast )
                        m_Caster.RevealingAction();
 
                    SayMantra();
 
                    TimeSpan castDelay = this.GetCastDelay();
 
                    if ( ShowHandMovement && ( m_Caster.Body.IsHuman || ( m_Caster.Player && m_Caster.Body.IsMonster ) ) )
                    {
                        int count = (int)Math.Ceiling( castDelay.TotalSeconds / AnimateDelay.TotalSeconds );
 
                        if ( count != 0 )
                        {
                            m_AnimTimer = new AnimTimer( this, count );
                            m_AnimTimer.Start();
                        }
 
                        if ( m_Info.LeftHandEffect > 0 )
                            Caster.FixedParticles( 0, 10, 5, m_Info.LeftHandEffect, EffectLayer.LeftHand );
 
                        if ( m_Info.RightHandEffect > 0 )
                            Caster.FixedParticles( 0, 10, 5, m_Info.RightHandEffect, EffectLayer.RightHand );
                    }
 
                    if ( ClearHandsOnCast )
                        m_Caster.ClearHands();
 
                    if ( Core.ML )
                        WeaponAbility.ClearCurrentAbility( m_Caster );
 
                    m_CastTimer = new CastTimer( this, castDelay );
                    //m_CastTimer.Start();
 
                    OnBeginCast();
 
                    if ( castDelay > TimeSpan.Zero ) {
                        m_CastTimer.Start();
                    } else {
                        m_CastTimer.Tick();
                    }
 
                    return true;
                }
                else
                {
                    return false;
                }
            }
            else
            {
                m_Caster.LocalOverheadMessage( MessageType.Regular, 0x22, 502625 ); // Insufficient mana
            }
 
            return false;
        }
 
        public abstract void OnCast();
 
        public virtual void OnBeginCast()
        {
        }
 
        public virtual void GetCastSkills( out double min, out double max )
        {
            min = max = 0;    //Intended but not required for overriding.
        }
 
        public virtual bool CheckFizzle()
        {
            if ( m_Scroll is BaseWand )
                return true;
 
            double minSkill, maxSkill;
 
            GetCastSkills( out minSkill, out maxSkill );
 
            if ( DamageSkill != CastSkill )
                Caster.CheckSkill( DamageSkill, 0.0, Caster.Skills[ DamageSkill ].Cap );
 
            return Caster.CheckSkill( CastSkill, minSkill, maxSkill );
        }
 
        public abstract int GetMana();
 
        public virtual int ScaleMana( int mana )
        {
            double scalar = 1.0;
 
            if ( !Necromancy.MindRotSpell.GetMindRotScalar( Caster, ref scalar ) )
                scalar = 1.0;
 
            // Lower Mana Cost = 40%
            int lmc = AosAttributes.GetValue( m_Caster, AosAttribute.LowerManaCost );
            if ( lmc > 40 )
                lmc = 40;
 
            scalar -= (double)lmc / 100;
 
            return (int)(mana * scalar);
        }
 
        public virtual TimeSpan GetDisturbRecovery()
        {
            if ( Core.AOS )
                return TimeSpan.Zero;
 
            double delay = 1.0 - Math.Sqrt( (DateTime.Now - m_StartCastTime).TotalSeconds / GetCastDelay().TotalSeconds );
 
            if ( delay < 0.2 )
                delay = 0.2;
 
            return TimeSpan.FromSeconds( delay );
        }
 
        public virtual int CastRecoveryBase{ get{ return 6; } }
        public virtual int CastRecoveryFastScalar{ get{ return 1; } }
        public virtual int CastRecoveryPerSecond{ get{ return 4; } }
        public virtual int CastRecoveryMinimum{ get{ return 0; } }
 
        public virtual TimeSpan GetCastRecovery()
        {
            if ( !Core.AOS )
                return NextSpellDelay;
 
            int fcr = AosAttributes.GetValue( m_Caster, AosAttribute.CastRecovery );
 
            fcr -= ThunderstormSpell.GetCastRecoveryMalus( m_Caster );
 
            int fcrDelay = -(CastRecoveryFastScalar * fcr);
 
            int delay = CastRecoveryBase + fcrDelay;
 
            if ( delay < CastRecoveryMinimum )
                delay = CastRecoveryMinimum;
 
            return TimeSpan.FromSeconds( (double)delay / CastRecoveryPerSecond );
        }
 
        public abstract TimeSpan CastDelayBase { get; }
 
        public virtual double CastDelayFastScalar { get { return 1; } }
        public virtual double CastDelaySecondsPerTick { get { return 0.25; } }
        public virtual TimeSpan CastDelayMinimum { get { return TimeSpan.FromSeconds( 0.25 ); } }
 
        //public virtual int CastDelayBase{ get{ return 3; } }
        //public virtual int CastDelayFastScalar{ get{ return 1; } }
        //public virtual int CastDelayPerSecond{ get{ return 4; } }
        //public virtual int CastDelayMinimum{ get{ return 1; } }
 
        public virtual TimeSpan GetCastDelay()
        {
            if ( m_Scroll is BaseWand )
                return Core.ML ? CastDelayBase : TimeSpan.Zero; // TODO: Should FC apply to wands?
 
            // Faster casting cap of 2 (if not using the protection spell)
            // Faster casting cap of 0 (if using the protection spell)
            // Paladin spells are subject to a faster casting cap of 4
            // Paladins with magery of 70.0 or above are subject to a faster casting cap of 2
            int fcMax = 4;
 
            if ( CastSkill == SkillName.Magery || CastSkill == SkillName.Necromancy || ( CastSkill == SkillName.Chivalry && m_Caster.Skills[SkillName.Magery].Value >= 70.0 ) )
                fcMax = 2;
 
            int fc = AosAttributes.GetValue( m_Caster, AosAttribute.CastSpeed );
 
            if ( fc > fcMax )
                fc = fcMax;
 
            if ( ProtectionSpell.Registry.Contains( m_Caster ) )
                fc -= 2;
 
            if( EssenceOfWindSpell.IsDebuffed( m_Caster ) )
                fc -= EssenceOfWindSpell.GetFCMalus( m_Caster );
 
            TimeSpan baseDelay = CastDelayBase;
 
            TimeSpan fcDelay = TimeSpan.FromSeconds( -(CastDelayFastScalar * fc * CastDelaySecondsPerTick) );
 
            //int delay = CastDelayBase + circleDelay + fcDelay;
            TimeSpan delay = baseDelay + fcDelay;
 
            if ( delay < CastDelayMinimum )
                delay = CastDelayMinimum;
 
            //return TimeSpan.FromSeconds( (double)delay / CastDelayPerSecond );
            return delay;
        }
 
        public virtual void FinishSequence()
        {
            m_State = SpellState.None;
 
            if ( m_Caster.Spell == this )
                m_Caster.Spell = null;
        }
 
        public virtual int ComputeKarmaAward()
        {
            return 0;
        }
 
        public virtual bool CheckSequence()
        {
            int mana = ScaleMana( GetMana() );
 
            if ( m_Caster.Deleted || !m_Caster.Alive || m_Caster.Spell != this || m_State != SpellState.Sequencing )
            {
                DoFizzle();
            }
            else if ( m_Scroll != null && !(m_Scroll is Runebook) && (m_Scroll.Amount <= 0 || m_Scroll.Deleted || m_Scroll.RootParent != m_Caster || (m_Scroll is BaseWand && (((BaseWand)m_Scroll).Charges <= 0 || m_Scroll.Parent != m_Caster))) )
            {
                DoFizzle();
            }
            else if ( !ConsumeReagents() )
            {
                m_Caster.LocalOverheadMessage( MessageType.Regular, 0x22, 502630 ); // More reagents are needed for this spell.
            }
            else if ( m_Caster.Mana < mana )
            {
                m_Caster.LocalOverheadMessage( MessageType.Regular, 0x22, 502625 ); // Insufficient mana for this spell.
            }
            else if ( Core.AOS && (m_Caster.Frozen || m_Caster.Paralyzed) )
            {
                m_Caster.SendLocalizedMessage( 502646 ); // You cannot cast a spell while frozen.
                DoFizzle();
            }
            else if ( m_Caster is PlayerMobile && ((PlayerMobile) m_Caster).PeacedUntil > DateTime.Now )
            {
                m_Caster.SendLocalizedMessage( 1072060 ); // You cannot cast a spell while calmed.
                DoFizzle();
            }
            else if ( CheckFizzle() )
            {
                m_Caster.Mana -= mana;
 
                if ( m_Scroll is SpellScroll )
                    m_Scroll.Consume();
                else if ( m_Scroll is BaseWand )
                {
                    ((BaseWand)m_Scroll).ConsumeCharge( m_Caster );
                    m_Caster.RevealingAction();
                }
 
                if ( m_Scroll is BaseWand )
                {
                    bool m = m_Scroll.Movable;
 
                    m_Scroll.Movable = false;
 
                    if ( ClearHandsOnCast )
                        m_Caster.ClearHands();
 
                    m_Scroll.Movable = m;
                }
                else
                {
                    if ( ClearHandsOnCast )
                        m_Caster.ClearHands();
                }
 
                int karma = ComputeKarmaAward();
 
                if ( karma != 0 )
                    Misc.Titles.AwardKarma( Caster, karma, true );
 
                if( TransformationSpellHelper.UnderTransformation( m_Caster, typeof( VampiricEmbraceSpell ) ) )
                {
                    bool garlic = false;
 
                    for ( int i = 0; !garlic && i < m_Info.Reagents.Length; ++i )
                        garlic = ( m_Info.Reagents[i] == Reagent.Garlic );
 
                    if ( garlic )
                    {
                        m_Caster.SendLocalizedMessage( 1061651 ); // The garlic burns you!
                        AOS.Damage( m_Caster, Utility.RandomMinMax( 17, 23 ), 100, 0, 0, 0, 0 );
                    }
                }
 
                return true;
            }
            else
            {
                DoFizzle();
            }
 
            return false;
        }
 
        public bool CheckBSequence( Mobile target )
        {
            return CheckBSequence( target, false );
        }
 
        public bool CheckBSequence( Mobile target, bool allowDead )
        {
            if ( !target.Alive && !allowDead )
            {
                m_Caster.SendLocalizedMessage( 501857 ); // This spell won't work on that!
                return false;
            }
            else if ( Caster.CanBeBeneficial( target, true, allowDead ) && CheckSequence() )
            {
                Caster.DoBeneficial( target );
                return true;
            }
            else
            {
                return false;
            }
        }
 
        public bool CheckHSequence( Mobile target )
        {
            if ( !target.Alive )
            {
                m_Caster.SendLocalizedMessage( 501857 ); // This spell won't work on that!
                return false;
            }
            else if ( Caster.CanBeHarmful( target ) && CheckSequence() )
            {
                Caster.DoHarmful( target );
                return true;
            }
            else
            {
                return false;
            }
        }
 
        private class AnimTimer : Timer
        {
            private Spell m_Spell;
 
            public AnimTimer( Spell spell, int count ) : base( TimeSpan.Zero, AnimateDelay, count )
            {
                m_Spell = spell;
 
                Priority = TimerPriority.FiftyMS;
            }
 
            protected override void OnTick()
            {
                if ( m_Spell.State != SpellState.Casting || m_Spell.m_Caster.Spell != m_Spell )
                {
                    Stop();
                    return;
                }
 
                if ( !m_Spell.Caster.Mounted && m_Spell.m_Info.Action >= 0 )
                {
                    if ( m_Spell.Caster.Body.IsHuman )
                        m_Spell.Caster.Animate( m_Spell.m_Info.Action, 7, 1, true, false, 0 );
                    else if ( m_Spell.Caster.Player && m_Spell.Caster.Body.IsMonster )
                        m_Spell.Caster.Animate( 12, 7, 1, true, false, 0 );
                }
 
                if ( !Running )
                    m_Spell.m_AnimTimer = null;
            }
        }
 
        private class CastTimer : Timer
        {
            private Spell m_Spell;
 
            public CastTimer( Spell spell, TimeSpan castDelay ) : base( castDelay )
            {
                m_Spell = spell;
 
                Priority = TimerPriority.TwentyFiveMS;
            }
 
            protected override void OnTick()
            {
                if ( m_Spell == null || m_Spell.m_Caster == null )
                {
                    return;
                }
                else if ( m_Spell.m_State == SpellState.Casting && m_Spell.m_Caster.Spell == m_Spell )
                {
                    m_Spell.m_State = SpellState.Sequencing;
                    m_Spell.m_CastTimer = null;
                    m_Spell.m_Caster.OnSpellCast( m_Spell );
                    if ( m_Spell.m_Caster.Region != null )
                        m_Spell.m_Caster.Region.OnSpellCast( m_Spell.m_Caster, m_Spell );
                    m_Spell.m_Caster.NextSpellTime = DateTime.Now + m_Spell.GetCastRecovery();// Spell.NextSpellDelay;
 
                    Target originalTarget = m_Spell.m_Caster.Target;
 
                    m_Spell.OnCast();
 
                    if ( m_Spell.m_Caster.Player && m_Spell.m_Caster.Target != originalTarget && m_Spell.Caster.Target != null )
                        m_Spell.m_Caster.Target.BeginTimeout( m_Spell.m_Caster, TimeSpan.FromSeconds( 30.0 ) );
 
                    m_Spell.m_CastTimer = null;
                }
            }
 
            public void Tick() {
                OnTick();
            }
        }
    }
}
 

hermi

Sorceror
Code:
using System;
using System.Collections.Generic;
using Server.Items;
using daat99;
 
namespace Server.Mobiles
{
    public class GenericSellInfo : IShopSellInfo
    {
        private Dictionary<Type, int> m_Table = new Dictionary<Type, int>();
        private Type[] m_Types;
 
        public GenericSellInfo()
        {
        }
 
        public void Add( Type type, int price )
        {
            m_Table[type] = price;
            m_Types = null;
        }
 
        public int GetSellPriceFor( Item item )
        {
            int price = 0;
            m_Table.TryGetValue( item.GetType(), out price );
 
            if ( item is BaseArmor ) {
                BaseArmor armor = (BaseArmor)item;
 
                if ( armor.Quality == ArmorQuality.Low )
                    price = (int)( price * 0.60 );
                else if ( armor.Quality == ArmorQuality.Exceptional )
                    price = (int)( price * 1.25 );
 
                price += 100 * (int)armor.Durability;
 
                price += 100 * (int)armor.ProtectionLevel;
 
                //daat99 OWLTR start - resources cost more
                if ( OWLTROptionsManager.IsEnabled(OWLTROptionsManager.OPTIONS_ENUM.RESOURCE_COST) )
                {
                    double d_Mult = (int)armor.Resource;
                    if ( d_Mult > 1 && d_Mult < 101 )
                        d_Mult = 10+(d_Mult - 1);
                    else if ( d_Mult > 101 && d_Mult < 201 )
                        d_Mult = 10+(d_Mult - 101);
                    else if ( d_Mult > 201 && d_Mult < 300 )
                        d_Mult = 10+(d_Mult - 201);
                    else
                        d_Mult = 10;
                    price = (int)((d_Mult*price)/10);
                }
                //daat99 OWLTR end - resources cost more
 
                if ( price < 1 )
                    price = 1;
            }
            else if ( item is BaseWeapon ) {
                BaseWeapon weapon = (BaseWeapon)item;
 
                if ( weapon.Quality == WeaponQuality.Low )
                    price = (int)( price * 0.60 );
                else if ( weapon.Quality == WeaponQuality.Exceptional )
                    price = (int)( price * 1.25 );
 
                price += 100 * (int)weapon.DurabilityLevel;
 
                //daat99 OWLTR start - resources cost more
                if ( OWLTROptionsManager.IsEnabled(OWLTROptionsManager.OPTIONS_ENUM.RESOURCE_COST) )
                {
                    double d_Mult = (int)weapon.Resource;
                    if ( d_Mult > 1 && d_Mult < 101 )
                        d_Mult = 10+(d_Mult - 1);
                    else if ( d_Mult > 300 && d_Mult < 400 )
                        d_Mult = 10+(d_Mult - 300);
                    else
                        d_Mult = 10;
                    price = (int)((d_Mult*price)/10);
                }
                //daat99 OWLTR end - resources cost more
 
                if ( price < 1 )
                    price = 1;
            }
            else if ( item is BaseBeverage ) {
                int price1 = price, price2 = price;
 
                if ( item is Pitcher )
                { price1 = 3; price2 = 5; }
                else if ( item is BeverageBottle )
                { price1 = 3; price2 = 3; }
                else if ( item is Jug )
                { price1 = 6; price2 = 6; }
 
                BaseBeverage bev = (BaseBeverage)item;
 
                if ( bev.IsEmpty || bev.Content == BeverageType.Milk )
                    price = price1;
                else
                    price = price2;
            }
 
            return price;
        }
 
        public int GetBuyPriceFor( Item item )
        {
            return (int)( 1.90 * GetSellPriceFor( item ) );
        }
 
        public Type[] Types
        {
            get
            {
                if ( m_Types == null )
                {
                    m_Types = new Type[m_Table.Keys.Count];
                    m_Table.Keys.CopyTo( m_Types, 0 );
                }
 
                return m_Types;
            }
        }
 
        public string GetNameFor( Item item )
        {
            if ( item.Name != null )
                return item.Name;
            else
                return item.LabelNumber.ToString();
        }
 
        public bool IsSellable( Item item )
        {
            if ( item.Nontransferable )
                return false;
 
            //if ( item.Hue != 0 )
                //return false;
 
            return IsInList( item.GetType() );
        }
   
        public bool IsResellable( Item item )
        {
            if ( item.Nontransferable )
                return false;
 
            //if ( item.Hue != 0 )
                //return false;
 
            return IsInList( item.GetType() );
        }
 
        public bool IsInList( Type type )
        {
            return m_Table.ContainsKey( type );
        }
    }
}
 

Hammerhand

Knight
On Spell.cs, just use using daat99; instead of the using Server.daat99; Other than that, you have the edits correct. Its almost as if you dont have the OWLTR system itself present..
 

hermi

Sorceror
I have tried this with RunUO 2.2 Run UO 2.3 and RunUO 2.3

the 2.2 one works but the maps are all off like i said. i cant get the others to load at all. just don't understand it. i have tried meany time to merge the files..i cant say what im doing wrong. the last time i did here with RunUO Svn...i took more than 2 hours...going over everything...reading each line...:( Still errors. just dont know.
 

Hammerhand

Knight
Just what exactly are you trying to set up? The map issue could just have been your client patch. It could very well have been either to high or to low.
 

hermi

Sorceror
Umm...want Fel, Tram, Mal, Ish, and TerMer. Want to be able to edit spawns, like i want to have Lizard men and rat men in Cov again...but still have new content. going to only be playing with a hand full of people that i know of at first..but they have friends that might play too. Want to be able to set up houses in places that can have them. Fishing and minnig all that good stuff... running 7.0.29.3 then says (patch unknown).
 

Hammerhand

Knight
The SA content & spawns for TerMur isnt available with the RunUO servers. You'll need to go to CraftUO or ServUO to get that. As for the rest, thats the easy stuff. You can manually add spawners anywhere you want with whatever mobs you want on them.
 

hermi

Sorceror
OK will look up on hose to add spawners. one thing i wanted was Joekus tool bar but i cant find that for download. would just make a few thing easyer for me. editing loot that monsters come with...is that hard?

Going to try to not ad nero distro and just go with OWLTR and see if i can get that working. then try to find more info on spawns. any helpful link you might know would be great!

Again...you have been a great help with this, thank you very much!!!!!!
 

Hammerhand

Knight
On the toolbar... here ya' go.. straight from Neruns latest Distro. Just drop it into your 2.3 & startup the server. Just tested it & it loads fine. As for editing mob loot, that depends on just what loot you mean. If it's the AddLoot( LootPack.***** ); part, then you can change the level of the loot by changing the Meager to Average to Rich to FilthyRich.. but if you're talking about the loot IN the loot pack, then you have to edit the Loot.cs & LootPack.cs & thats more complicated.
 

Attachments

  • Toolbar.cs
    35.4 KB · Views: 3

hermi

Sorceror
tool bar is great! thx... As for loot i wants to make it easier to get gold to start. Just a bit... then later want to add thing like artis and house deco items to drop from things like stone harpy's. things along that line.

You said you have not used this system in a while...what do you use if you don't mind me asking. is there soothing out there better than RunUO?
 

Hammerhand

Knight
I've always used RunUO. As for adding artis & such, thats fairly easy as well..
Code:
        public override bool OnBeforeDeath()
        {
            switch (Utility.Random(3))
            {
                case 0: PackItem(new YourItemHere()); break;
            }
 
            return base.OnBeforeDeath();
        }
Just add coding like this into the mobs script. The switch (Utility.Random (3)) would basically give a 1 in 3 chance of getting said item & the OnBeforeDeath makes sure the item isnt spawned BEFORE the mob dies & can also be used for Blessed items. The 3 can be changed to different numbers & you can add more than 1 item..


Code:
        public override bool OnBeforeDeath()
 
        {
 
            switch (Utility.Random(9))
 
            {
 
                case 0: PackItem(new YourItemHere()); break;
                case 1: PackItem(new YourNextItem()); break;
                case 2: PackItem(new AndAnotherItem()); break;
 
            }
 
 
            return base.OnBeforeDeath();
        }
This would give the same 1 in 3 chance of getting 1 of the 3 items. But pay attention to the case numbers. Always start with 0, so for 3 cases it would be 0,1 & 2.. 5 cases would be 0,1,2,3 & 4. You can look at released monster scripts in the archives to get ideas of various ways to do loot. It takes patience, practice & study.... and a bit, or sometimes a LOT of luck. Especially when first starting out. For getting more gold when starting out, you can do like a newbie dungeon for training & gold harvesting with low to medium level mobs.
 

hermi

Sorceror
Have your ever made a pack with the OWLTR working? i just cant seam to get it. im using the 2.3 download right off RunUo and i cant get this to work...i just don't understand what im doing wrong. Im going to try again and will keep trying till i get it..but i may be ready for the grave before i get it LOL....

Just not sure what im doing wrong...will try again a list errors and see what you think im doing wrong..or the list of things im doing wrong ;)
If you wants too...don't want to sound like i expect you to help me! im very grateful for any help you give!
 

Hammerhand

Knight
Post your errors.. and 1 or 2 of the scripts involved.. I have OWLTR 3.01.0 working just fine on a 2.3 w/ Neruns Distro. And if I took the time, I could have it working on a stock 2.3 because its compatable. It just requires careful merging is all.
 

hermi

Sorceror
will post scripts to follow :)


Code:
RunUO - [www.runuo.com] Version 2.2, Build 4782.3756
Core: Running on .NET Framework Version 2.0.50727
Core: Optimizing for 2 processors
Scripts: Compiling C# scripts...failed (2 errors, 0 warnings)
Errors:
+ Items/Resources/Blacksmithing/Scales.cs:
    CS1520: Line 275: Class, struct, or interface method must have a return type
 
    CS1002: Line 275: ; expected
    CS1519: Line 275: Invalid token ',' in class, struct, or interface member de
claration
    CS1519: Line 275: Invalid token ')' in class, struct, or interface member de
claration
    CS1519: Line 277: Invalid token '=' in class, struct, or interface member de
claration
    CS1518: Line 280: Expected class, delegate, enum, interface, or struct
    CS1518: Line 284: Expected class, delegate, enum, interface, or struct
    CS1518: Line 291: Expected class, delegate, enum, interface, or struct
    CS1022: Line 360: Type or namespace definition, or end-of-file expected
+ Items/Resources/Tailor/Hides.cs:
    CS1520: Line 617: Class, struct, or interface method must have a return type
 
    CS1002: Line 617: ; expected
    CS1519: Line 617: Invalid token ',' in class, struct, or interface member de
claration
    CS1519: Line 617: Invalid token ')' in class, struct, or interface member de
claration
    CS1520: Line 621: Class, struct, or interface method must have a return type
 
    CS1002: Line 621: ; expected
    CS1519: Line 621: Invalid token ')' in class, struct, or interface member de
claration
Scripts: One or more scripts failed to compile or no script files were found.
- Press return to exit, or R to try again.
 

hermi

Sorceror
scales.cs


Code:
using System;
using Server.Items;
using Server.Network;
 
namespace Server.Items
{
    public abstract class BaseScales : Item, ICommodity
    {
        public override int LabelNumber{ get{ return 1053139; } } // dragon scales
 
        private CraftResource m_Resource;
 
        [CommandProperty( AccessLevel.GameMaster )]
        public CraftResource Resource
        {
            get{ return m_Resource; }
            set{ m_Resource = value; InvalidateProperties(); }
        }
 
        public override double DefaultWeight
        {
            get { return 0.1; }
        }
       
        int ICommodity.DescriptionNumber { get { return LabelNumber; } }
        bool ICommodity.IsDeedable { get { return true; } }
 
        public override void Serialize( GenericWriter writer )
        {
            base.Serialize( writer );
 
            writer.Write( (int) 0 ); // version
 
            writer.Write( (int) m_Resource );
        }
 
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );
 
            int version = reader.ReadInt();
 
            switch ( version )
            {
                case 0:
                {
                    m_Resource = (CraftResource)reader.ReadInt();
                    break;
                }
            }
        }
 
        public BaseScales( CraftResource resource ) : this( resource, 1 )
        {
        }
 
        public BaseScales( CraftResource resource, int amount ) : base( 0x26B4 )
        {
            Stackable = true;
            Amount = amount;
            Hue = CraftResources.GetHue( resource );
 
            m_Resource = resource;
        }
 
        public BaseScales( Serial serial ) : base( serial )
        {
        }
    }
 
    public class RedScales : BaseScales
    {
        [Constructable]
        public RedScales() : this( 1 )
        {
        }
 
        [Constructable]
        public RedScales( int amount ) : base( CraftResource.RedScales, amount )
        {
            Name = "Red Scales"; //daat99 OWLTR - custom resource name
        }
 
        public RedScales( Serial serial ) : base( serial )
        {
        }
 
        public override void Serialize( GenericWriter writer )
        {
            base.Serialize( writer );
 
            writer.Write( (int) 0 ); // version
        }
 
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );
 
            int version = reader.ReadInt();
        }
 
       
    }
 
    public class YellowScales : BaseScales
    {
        [Constructable]
        public YellowScales() : this( 1 )
        {
        }
 
        [Constructable]
        public YellowScales( int amount ) : base( CraftResource.YellowScales, amount )
        {
            Name = "Yellow Scales"; //daat99 OWLTR - custom resource name
        }
 
        public YellowScales( Serial serial ) : base( serial )
        {
        }
 
        public override void Serialize( GenericWriter writer )
        {
            base.Serialize( writer );
 
            writer.Write( (int) 0 ); // version
        }
 
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );
 
            int version = reader.ReadInt();
        }
 
       
    }
 
    public class BlackScales : BaseScales
    {
        [Constructable]
        public BlackScales() : this( 1 )
        {
        }
 
        [Constructable]
        public BlackScales( int amount ) : base( CraftResource.BlackScales, amount )
        {
            Name = "Black Scales"; //daat99 OWLTR - custom resource name
        }
 
        public BlackScales( Serial serial ) : base( serial )
        {
        }
 
        public override void Serialize( GenericWriter writer )
        {
            base.Serialize( writer );
 
            writer.Write( (int) 0 ); // version
        }
 
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );
 
            int version = reader.ReadInt();
        }
 
       
    }
 
    public class GreenScales : BaseScales
    {
        [Constructable]
        public GreenScales() : this( 1 )
        {
        }
 
        [Constructable]
        public GreenScales( int amount ) : base( CraftResource.GreenScales, amount )
        {
            Name = "Green Scales"; //daat99 OWLTR - custom resource name
        }
 
        public GreenScales( Serial serial ) : base( serial )
        {
        }
 
        public override void Serialize( GenericWriter writer )
        {
            base.Serialize( writer );
 
            writer.Write( (int) 0 ); // version
        }
 
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );
 
            int version = reader.ReadInt();
        }
 
       
    }
 
    public class WhiteScales : BaseScales
    {
        [Constructable]
        public WhiteScales() : this( 1 )
        {
        }
 
        [Constructable]
        public WhiteScales( int amount ) : base( CraftResource.WhiteScales, amount )
        {
            Name = "White Scales"; //daat99 OWLTR - custom resource name
        }
 
        public WhiteScales( Serial serial ) : base( serial )
        {
        }
 
        public override void Serialize( GenericWriter writer )
        {
            base.Serialize( writer );
 
            writer.Write( (int) 0 ); // version
        }
 
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );
 
            int version = reader.ReadInt();
        }
 
       
    }
 
    public class BlueScales : BaseScales
    {
        public override int LabelNumber{ get{ return 1053140; } } // sea serpent scales
 
        [Constructable]
        public BlueScales() : this( 1 )
        {
        }
 
        [Constructable]
        public BlueScales( int amount ) : base( CraftResource.BlueScales, amount )
        {
            Name = "Blue Scales"; //daat99 OWLTR - custom resource name
        }
 
        public BlueScales( Serial serial ) : base( serial )
        {
        }
 
        public override void Serialize( GenericWriter writer )
        {
            base.Serialize( writer );
 
            writer.Write( (int) 0 ); // version
        }
 
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );
 
            int version = reader.ReadInt();
        }
 
        [Constructable]
        public CopperScales( int amount ) : base( CraftResource.CopperScales, amount )
        {
            Name = "Copper Scales"; //daat99 OWLTR - custom resource name
        }
 
        public CopperScales( Serial serial ) : base( serial )
        {
        }
 
        public override void Serialize( GenericWriter writer )
        {
            base.Serialize( writer );
 
            writer.Write( (int) 0 ); // version
        }
 
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );
 
            int version = reader.ReadInt();
        }
    }
    public class SilverScales : BaseScales
    {
        [Constructable]
        public SilverScales() : this( 1 )
        {
        }
 
        [Constructable]
        public SilverScales( int amount ) : base( CraftResource.SilverScales, amount )
        {
            Name = "Silver Scales"; //daat99 OWLTR - custom resource name
        }
 
        public SilverScales( Serial serial ) : base( serial )
        {
        }
 
        public override void Serialize( GenericWriter writer )
        {
            base.Serialize( writer );
 
            writer.Write( (int) 0 ); // version
        }
 
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );
 
            int version = reader.ReadInt();
        }
    }
    public class GoldScales : BaseScales
    {
        [Constructable]
        public GoldScales() : this( 1 )
        {
        }
 
        [Constructable]
        public GoldScales( int amount ) : base( CraftResource.GoldScales, amount )
        {
            Name = "Gold Scales"; //daat99 OWLTR - custom resource name
        }
 
        public GoldScales( Serial serial ) : base( serial )
        {
        }
 
        public override void Serialize( GenericWriter writer )
        {
            base.Serialize( writer );
 
            writer.Write( (int) 0 ); // version
        }
 
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );
 
            int version = reader.ReadInt();
        }
    }
}
 

hermi

Sorceror
Hides.cs


Code:
using System;
using Server.Items;
using Server.Network;
 
namespace Server.Items
{
    public abstract class BaseHides : Item, ICommodity
    {
        private CraftResource m_Resource;
 
        [CommandProperty( AccessLevel.GameMaster )]
        public CraftResource Resource
        {
            get{ return m_Resource; }
            set{ m_Resource = value; InvalidateProperties(); }
        }
       
        int ICommodity.DescriptionNumber { get { return LabelNumber; } }
        bool ICommodity.IsDeedable { get { return true; } }
 
        public override void Serialize( GenericWriter writer )
        {
            base.Serialize( writer );
 
            writer.Write( (int) 1 ); // version
 
            writer.Write( (int) m_Resource );
        }
 
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );
 
            int version = reader.ReadInt();
 
            switch ( version )
            {
                case 1:
                {
                    m_Resource = (CraftResource)reader.ReadInt();
                    break;
                }
                case 0:
                {
                    OreInfo info = new OreInfo( reader.ReadInt(), reader.ReadInt(), reader.ReadString() );
 
                    m_Resource = CraftResources.GetFromOreInfo( info );
                    break;
                }
            }
        }
 
        public BaseHides( CraftResource resource ) : this( resource, 1 )
        {
        }
 
        public BaseHides( CraftResource resource, int amount ) : base( 0x1079 )
        {
            Stackable = true;
            Weight = 5.0;
            Amount = amount;
            Hue = CraftResources.GetHue( resource );
 
            m_Resource = resource;
        }
 
        public BaseHides( Serial serial ) : base( serial )
        {
        }
 
        public override void AddNameProperty( ObjectPropertyList list )
        {
            if ( Amount > 1 )
                list.Add( 1050039, "{0}\t#{1}", Amount, 1024216 ); // ~1_NUMBER~ ~2_ITEMNAME~
            else
                list.Add( 1024216 ); // pile of hides
        }
 
        public override void GetProperties( ObjectPropertyList list )
        {
            base.GetProperties( list );
 
            if ( !CraftResources.IsStandard( m_Resource ) )
            {
                int num = CraftResources.GetLocalizationNumber( m_Resource );
 
                if ( num > 0 )
                    list.Add( num );
                else
                    list.Add( CraftResources.GetName( m_Resource ) );
            }
        }
 
        public override int LabelNumber
        {
            get
            {
                if ( m_Resource >= CraftResource.SpinedLeather && m_Resource <= CraftResource.BarbedLeather )
                    return 1049687 + (int)(m_Resource - CraftResource.SpinedLeather);
 
                return 1047023;
            }
        }
    }
 
    [FlipableAttribute( 0x1079, 0x1078 )]
    public class Hides : BaseHides, IScissorable
    {
        [Constructable]
        public Hides() : this( 1 )
        {
        }
 
        [Constructable]
        public Hides( int amount ) : base( CraftResource.RegularLeather, amount )
        {
            Name = "Regular Hides"; //daat99 OWLTR - resource names
        }
 
        public Hides( Serial serial ) : base( serial )
        {
        }
 
        public override void Serialize( GenericWriter writer )
        {
            base.Serialize( writer );
 
            writer.Write( (int) 0 ); // version
        }
 
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );
 
            int version = reader.ReadInt();
        }
 
        public bool Scissor( Mobile from, Scissors scissors )
        {
            if ( Deleted || !from.CanSee( this ) ) return false;
 
            if ( Core.AOS && !IsChildOf ( from.Backpack ) )
            {
                from.SendLocalizedMessage ( 502437 ); // Items you wish to cut must be in your backpack
                return false;
            }
            base.ScissorHelper( from, new Leather(), 1 );
 
            return true;
        }
    }
 
    [FlipableAttribute( 0x1079, 0x1078 )]
    public class SpinedHides : BaseHides, IScissorable
    {
        [Constructable]
        public SpinedHides() : this( 1 )
        {
        }
 
        [Constructable]
        public SpinedHides( int amount ) : base( CraftResource.SpinedLeather, amount )
        {
            Name = "Spined Hides"; //daat99 OWLTR - resource names
        }
 
        public SpinedHides( Serial serial ) : base( serial )
        {
        }
 
        public override void Serialize( GenericWriter writer )
        {
            base.Serialize( writer );
 
            writer.Write( (int) 0 ); // version
        }
 
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );
 
            int version = reader.ReadInt();
        }
 
        public bool Scissor( Mobile from, Scissors scissors )
        {
            if ( Deleted || !from.CanSee( this ) ) return false;
 
            if ( Core.AOS && !IsChildOf ( from.Backpack ) )
            {
                from.SendLocalizedMessage ( 502437 ); // Items you wish to cut must be in your backpack
                return false;
            }
 
            base.ScissorHelper( from, new SpinedLeather(), 1 );
 
            return true;
        }
    }
 
    [FlipableAttribute( 0x1079, 0x1078 )]
    public class HornedHides : BaseHides, IScissorable
    {
        [Constructable]
        public HornedHides() : this( 1 )
        {
        }
 
        [Constructable]
        public HornedHides( int amount ) : base( CraftResource.HornedLeather, amount )
        {
            Name = "Horned Hides"; //daat99 OWLTR - resource names
        }
 
        public HornedHides( Serial serial ) : base( serial )
        {
        }
 
        public override void Serialize( GenericWriter writer )
        {
            base.Serialize( writer );
 
            writer.Write( (int) 0 ); // version
        }
 
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );
 
            int version = reader.ReadInt();
        }
 
        public bool Scissor( Mobile from, Scissors scissors )
        {
            if ( Deleted || !from.CanSee( this ) ) return false;
 
            if ( Core.AOS && !IsChildOf ( from.Backpack ) )
            {
                from.SendLocalizedMessage ( 502437 ); // Items you wish to cut must be in your backpack
                return false;
            }
           
            base.ScissorHelper( from, new HornedLeather(), 1 );
 
            return true;
        }
    }
 
    [FlipableAttribute( 0x1079, 0x1078 )]
    public class BarbedHides : BaseHides, IScissorable
    {
        [Constructable]
        public BarbedHides()
            : this(1)
        {
        }
 
        [Constructable]
        public BarbedHides(int amount)
            : base(CraftResource.BarbedLeather, amount)
        {
            Name = "Barbed Hides"; //daat99 OWLTR - resource names
        }
 
        public BarbedHides(Serial serial)
            : base(serial)
        {
        }
 
        public override void Serialize(GenericWriter writer)
        {
            base.Serialize(writer);
 
            writer.Write((int)0); // version
        }
 
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
 
            int version = reader.ReadInt();
        }
 
 
 
        public bool Scissor(Mobile from, Scissors scissors)
        {
            if (Deleted || !from.CanSee(this)) return false;
 
            if (!IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(502437); // Items you wish to cut must be in your backpack
                return false;
            }
 
            base.ScissorHelper(from, new BarbedLeather(), 1);
 
            return true;
        }
    }
    [FlipableAttribute(0x1079, 0x1078)]
    public class PolarHides : BaseHides, IScissorable
    {
        [Constructable]
        public PolarHides()
            : this(1)
        {
        }
 
        [Constructable]
        public PolarHides(int amount)
            : base(CraftResource.PolarLeather, amount)
        {
            Name = "Polar Hides"; //daat99 OWLTR - resource names
        }
 
        public PolarHides(Serial serial)
            : base(serial)
        {
        }
 
        public override void Serialize(GenericWriter writer)
        {
            base.Serialize(writer);
 
            writer.Write((int)0); // version
        }
 
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
 
            int version = reader.ReadInt();
        }
 
        public bool Scissor(Mobile from, Scissors scissors)
        {
            if (Deleted || !from.CanSee(this)) return false;
 
            if (!IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(502437); // Items you wish to cut must be in your backpack
                return false;
            }
 
            base.ScissorHelper(from, new PolarLeather(), 1);
 
            return true;
        }
    }
 
    [FlipableAttribute(0x1079, 0x1078)]
    public class SyntheticHides : BaseHides, IScissorable
    {
        [Constructable]
        public SyntheticHides()
            : this(1)
        {
        }
 
        [Constructable]
        public SyntheticHides(int amount)
            : base(CraftResource.SyntheticLeather, amount)
        {
            Name = "Synthetic Hides"; //daat99 OWLTR - resource names
        }
 
        public SyntheticHides(Serial serial)
            : base(serial)
        {
        }
 
        public override void Serialize(GenericWriter writer)
        {
            base.Serialize(writer);
 
            writer.Write((int)0); // version
        }
 
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
 
            int version = reader.ReadInt();
        }
 
        public bool Scissor(Mobile from, Scissors scissors)
        {
            if (Deleted || !from.CanSee(this)) return false;
 
            if (!IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(502437); // Items you wish to cut must be in your backpack
                return false;
            }
 
            base.ScissorHelper(from, new SyntheticLeather(), 1);
 
            return true;
        }
    }
 
    [FlipableAttribute(0x1079, 0x1078)]
    public class BlazeHides : BaseHides, IScissorable
    {
        [Constructable]
        public BlazeHides()
            : this(1)
        {
        }
 
        [Constructable]
        public BlazeHides(int amount)
            : base(CraftResource.BlazeLeather, amount)
        {
            Name = "Blaze Hides"; //daat99 OWLTR - resource names
        }
 
        public BlazeHides(Serial serial)
            : base(serial)
        {
        }
 
        public override void Serialize(GenericWriter writer)
        {
            base.Serialize(writer);
 
            writer.Write((int)0); // version
        }
 
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
 
            int version = reader.ReadInt();
        }
 
        public bool Scissor(Mobile from, Scissors scissors)
        {
            if (Deleted || !from.CanSee(this)) return false;
 
            if (!IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(502437); // Items you wish to cut must be in your backpack
                return false;
            }
 
            base.ScissorHelper(from, new BlazeLeather(), 1);
 
            return true;
        }
    }
 
    [FlipableAttribute(0x1079, 0x1078)]
    public class DaemonicHides : BaseHides, IScissorable
    {
        [Constructable]
        public DaemonicHides()
            : this(1)
        {
        }
 
        [Constructable]
        public DaemonicHides(int amount)
            : base(CraftResource.DaemonicLeather, amount)
        {
            Name = "Daemonic Hides"; //daat99 OWLTR - resource names
        }
 
        public DaemonicHides(Serial serial)
            : base(serial)
        {
        }
 
        public override void Serialize(GenericWriter writer)
        {
            base.Serialize(writer);
 
            writer.Write((int)0); // version
        }
 
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
 
            int version = reader.ReadInt();
        }
 
        public bool Scissor(Mobile from, Scissors scissors)
        {
            if (Deleted || !from.CanSee(this)) return false;
 
            if (!IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(502437); // Items you wish to cut must be in your backpack
                return false;
            }
 
            base.ScissorHelper(from, new DaemonicLeather(), 1);
 
            return true;
        }
    }
 
    [FlipableAttribute(0x1079, 0x1078)]
    public class ShadowHides : BaseHides, IScissorable
    {
        [Constructable]
        public ShadowHides()
            : this(1)
        {
        }
 
        [Constructable]
        public ShadowHides(int amount)
            : base(CraftResource.ShadowLeather, amount)
        {
            Name = "Shadow Hides"; //daat99 OWLTR - resource names
        }
 
        public ShadowHides(Serial serial)
            : base(serial)
        {
        }
 
        public override void Serialize(GenericWriter writer)
        {
            base.Serialize(writer);
 
            writer.Write((int)0); // version
        }
 
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
 
            int version = reader.ReadInt();
        }
 
        public bool Scissor(Mobile from, Scissors scissors)
        {
            if (Deleted || !from.CanSee(this)) return false;
 
            if (!IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(502437); // Items you wish to cut must be in your backpack
                return false;
            }
 
            base.ScissorHelper(from, new ShadowLeather(), 1);
 
            return true;
        }
    }
 
    [FlipableAttribute(0x1079, 0x1078)]
    public class FrostHides : BaseHides, IScissorable
    {
        [Constructable]
        public FrostHides()
            : this(1)
        {
        }
 
        [Constructable]
        public FrostHides(int amount)
            : base(CraftResource.FrostLeather, amount)
        {
            Name = "Frost Hides"; //daat99 OWLTR - resource names
        }
 
        public FrostHides(Serial serial)
            : base(serial)
        {
        }
 
        public override void Serialize(GenericWriter writer)
        {
            base.Serialize(writer);
 
            writer.Write((int)0); // version
        }
 
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
 
            int version = reader.ReadInt();
        }
 
        public bool Scissor(Mobile from, Scissors scissors)
        {
            if (Deleted || !from.CanSee(this)) return false;
 
            if (!IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(502437); // Items you wish to cut must be in your backpack
                return false;
            }
 
            base.ScissorHelper(from, new FrostLeather(), 1);
 
            return true;
        }
    }
 
    [FlipableAttribute(0x1079, 0x1078)]
    public class EtherealHides : BaseHides, IScissorable
    {
        [Constructable]
        public EtherealHides()
            : this(1)
        {
        }
 
        [Constructable]
        public BarbedHides( int amount ) : base( CraftResource.BarbedLeather, amount )
        {
        }
 
        public BarbedHides( Serial serial ) : base( serial )
        {
        }
 
        public override void Serialize( GenericWriter writer )
        {
            base.Serialize( writer );
 
            writer.Write( (int) 0 ); // version
        }
 
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );
 
            int version = reader.ReadInt();
        }
 
        public bool Scissor( Mobile from, Scissors scissors )
        {
            if ( Deleted || !from.CanSee( this ) ) return false;
 
            if ( Core.AOS && !IsChildOf ( from.Backpack ) )
            {
                from.SendLocalizedMessage ( 502437 ); // Items you wish to cut must be in your backpack
                return false;
            }
 
            base.ScissorHelper( from, new BarbedLeather(), 1 );
 
            return true;
        }
    }
}
 
Top