コード例 #1
0
ファイル: Character.cs プロジェクト: karliky/wowwow
		public override PermanentAura AddPermanentAura( AuraEffect ae, Aura a )
		{
			PermanentAura paura = new PermanentAura(a,ae.Id);
			this.permanentAura.Add(paura);
			this.AdjustBonii();
			return paura;
		}
コード例 #2
0
ファイル: Mobile.cs プロジェクト: karliky/wowwow
		public virtual PermanentAura AddPermanentAura( AuraEffect ae, Aura a )
		{
			PermanentAura paura = new PermanentAura(a,ae.Id);
			permanentAura.Add(paura);
			if (this is Character) (this as Character).AdjustBonii();
			return paura;
		}
コード例 #3
0
ファイル: Mobile.cs プロジェクト: karliky/wowwow
		public void RemovePermanentAura(AuraEffect ae)
		{
			PermanentAura paura1 = null;
			foreach(PermanentAura paura in permanentAura)
			{
				if(paura.Id == ae.Id) 
				{
					paura1 = paura;
					break;
				}

			}
			if (paura1 != null)
				permanentAura.Remove(paura1);
		}
コード例 #4
0
ファイル: Mobile.cs プロジェクト: karliky/wowwow
		public Aura AddAura( AuraEffect ae, Aura a, bool offensive )
		{
			if ( Dead )
				return null;	
	
			if ( offensive )
				this.OnGetHit( this, false, 1 );

			if ( aura.Count < 50 )
			{	
				int num = -1;
				int n = 0;
				ArrayList free = new ArrayList();
				if ( offensive || a is DotAura )
					free.AddRange( new int[] { 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45
												 , 46, 47, 48, 49 } );
				else
					free.AddRange( new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
												 , 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31 } );

				foreach( AuraReleaseTimer arts in aura )
				{
					if ( arts.ae == ae )
					{
						num = n;
						break;
					}
					else
					{
						free.Remove( arts.num );
						n++;
					}
				}
				if ( free.Count == 0 )
					return null;//	Too much aura !!!!!
				if ( num == -1 )
					num = (int)free[ 0 ];
				else
				{//	l'aura a deja ete lanc?, remise a zero de son compteur
					int ne = num;
					num = ( aura[ ne ] as AuraReleaseTimer ).num;
					ReleaseAura( ( aura[ ne ] as AuraReleaseTimer ) );
				}
					
				if (ae != null)
				{
					AuraReleaseTimer art = null;
					if ( ae.Duration( this ) == 0x100 )
						art = new AuraReleaseTimer( this, a, ae, num, 0xfffffff );
					else
						art = new AuraReleaseTimer( this, a, ae, num, ae.Duration( this ) );
					aura.Add( art );
					SendSmallUpdateToPlayerNearMe( 
						new int[] { 
						(int)UpdateFields.UNIT_FIELD_AURA + num, 
						(int)UpdateFields.UNIT_FIELD_AURAFLAGS + ( num >> 3 ), 
						(int)UpdateFields.UNIT_FIELD_AURALEVELS + ( num >> 2 ),
						(int)UpdateFields.UNIT_FIELD_AURAAPPLICATIONS + ( num >> 2 ), 
						
						(int)UpdateFields.UNIT_FIELD_AURASTATE }, 
					new object[] { (int)ae.Id, 0xdddddddd, 0x01010101, 0, 0x2 } );

					int offset = 4;
					Converter.ToBytes( (byte)num, tempBuff, ref offset );
					if ( ae.Duration( this ) == 0x100 )
						Converter.ToBytes( 0xffffffff, tempBuff, ref offset );
					else
						Converter.ToBytes( ae.Duration( this ), tempBuff, ref offset );
					ToAllPlayerNear( OpCodes.SMSG_UPDATE_AURA_DURATION, tempBuff, 9 );
					if ( this is Character )
						( this as Character ).AdjustBonii();
				}
				return a;
			}
			return null;
		}
コード例 #5
0
ファイル: Mobile.cs プロジェクト: karliky/wowwow
		public void ReleaseAura( AuraEffect ae )
		{
			AuraReleaseTimer toRemove = null;
			foreach( AuraReleaseTimer art in aura )
				if ( art.ae == ae )
				{
					toRemove = art;
					break;
				}
			if ( toRemove != null )
				ReleaseAura( toRemove );

		}
コード例 #6
0
ファイル: Mobile.cs プロジェクト: karliky/wowwow
		public Aura AddAura( Mobile from, AuraEffect ae, Aura a, bool offensive )
		{
			return AddAura( ae, a, offensive );
		}
コード例 #7
0
ファイル: Mobile.cs プロジェクト: karliky/wowwow
		public Aura AddAura( AuraEffect ae, Aura a )
		{
			
			
			return AddAura( ae, a, false );
		}
コード例 #8
0
ファイル: Mobile.cs プロジェクト: karliky/wowwow
		public bool AlreadyHaveAura( AuraEffect ae )
		{
			foreach( AuraReleaseTimer art in aura )
				if ( art.ae == ae )
					return true;
			return false;
		}
コード例 #9
0
ファイル: Mobile.cs プロジェクト: karliky/wowwow
		public Aura AddAura( Mobile from, AuraEffect ae, Aura a )
		{
			if ( this != from )
				this.OnGetHit( from, false, 1 );
			return AddAura( ae, a, false );
			
		}
コード例 #10
0
ファイル: Mobile.cs プロジェクト: karliky/wowwow
		public virtual void Mount( Mobile m )
		{
			this.MountModel = m.Model;

			int offset = 4;
			Converter.ToBytes( 1, tempBuff, ref offset );
			Converter.ToBytes( (byte)0, tempBuff, ref offset );				
			PrepareUpdateData( tempBuff, ref offset , UpdateType.UpdateFull, true );
			this.ToAllPlayerNearExceptMe( OpCodes.SMSG_UPDATE_OBJECT, tempBuff, offset );
			
			Aura aura = new Aura();
			aura.OnRelease = new Aura.AuraReleaseDelegate( this.OnUnMount );
			AddAura( mountedIdAuraEffect = (AuraEffect)World.MountsList[ m.Id ], aura );
		}
コード例 #11
0
ファイル: Mobile.cs プロジェクト: karliky/wowwow
			public AuraReleaseTimer( Mobile st, Aura ar, AuraEffect a, int n, int duration ) : base( duration, "AuraReleaseTimer" )
			{
				aura = ar;
				num = n;
				from = st;
				ae = a;
				Start();
			}
コード例 #12
0
ファイル: SpellTemplate.cs プロジェクト: karliky/wowwow
        public void ApplyDot( Mobile c, Mobile target, int dmg, int freq, int duration )
        {
            if ( target.Dead )
                return;
            AuraEffect ae = null;
            if(this is AuraEffect)
            {
                ae = (AuraEffect)this;
            }
            else
            {
                ae = new AuraEffect( Id,0,
                    levelMin, levelMax, bonus1, bonus2, s1, s2, s3,
                    t1, t2, resistance,dispeltype, this.GetManaCost(c), (int)CastingTime( c ), range, duration, CoolDown( c ),
                    0, 0, classe );

                ae.Applications = 0x01010101;
            }
            Aura aura = new DotAura( this, c, target, dmg, duration, freq );
            target.AddAura( c,ae, aura, true );
        }
コード例 #13
0
        public bool CheckSpell(Mobile from, Object target)
        {
            if (this is SpellTemplate || this is AuraEffect)
            {
                #region multiple auras
                if (this is AuraEffect && target is Mobile)
                {
                    AuraEffect ae      = (AuraEffect)this;
                    byte       purebin = ae.GetPureBin();
                    Console.WriteLine(purebin);
                    //if(ae.Unpure == true) return true;
                    ArrayList al1 = new ArrayList();
                    foreach (Mobile.AuraReleaseTimer art1 in (target as Mobile).Auras)
                    {
                        AuraEffect af = art1.ae;
                        if (af.Aura == ae.Aura)
                        {
                            if (af.Id > ae.Id)
                            {
                                (from as Character).SpellFaillure(SpellFailedReason.AMorePowerfulSpellAlreadyActive);
                                return(false);
                            }
                            else
                            {
                                al1.Add(art1);
                            }
                        }
                    }
                    foreach (Mobile.AuraReleaseTimer art2 in al1)
                    {
                        (target as Mobile).ReleaseAura(art2);
                    }
                }
                #endregion
                #region silence test
                if (from.ForceSilence)
                {
                    from.SpellFaillure(SpellFailedReason.CanDoWhileSilenced);
                    return(false);
                }
                #endregion
                #region avoid cast
                foreach (Mobile.AuraReleaseTimer art in from.Auras)
                {
                    if (art.aura.AvoidCastMagicClass != 0)
                    {
                        if (AbilityClasses.abilityClasses[(int)Id] == art.aura.AvoidCastMagicClass)
                        {
                            from.SpellFaillure(SpellFailedReason.YouCantDoThatYet);
                            return(false);
                        }
                    }
                }

                #endregion
                #region Mana test
                if (!(from is Character) || (from as Character).Player.AccessLevel == AccessLevels.PlayerLevel)
                {
                    if ((this as SpellTemplate).GetManaCost(from) > from.Mana)
                    {
                        from.SpellFaillure(SpellFailedReason.NotEnoughMana);
                        return(false);
                    }
                }
                #endregion
                #region invalid target
                if ((SpellTemplate.SpellEffects[this.Id] is SingleTargetSpellEffect) && !(target is Mobile || target is Character))
                {
                    from.SpellFaillure(SpellFailedReason.InvalidTarget);
                    return(false);
                }
                if ((SpellTemplate.SpellEffects[this.Id] is OnSingleTargetItemSpellEffect) && !(target is Items.Item))
                {
                    from.SpellFaillure(SpellFailedReason.InvalidTarget);
                    return(false);
                }
                if ((SpellTemplate.SpellEffects[this.Id] is TargetXYZSpellEffect) && !(target == null))
                {
                    from.SpellFaillure(SpellFailedReason.InvalidTarget);
                    return(false);
                }
                if ((SpellTemplate.SpellEffects[this.Id] is OnSelfSpellEffect) && target != from)
                {
                    from.SpellFaillure(SpellFailedReason.InvalidTarget);
                    return(false);
                }
                if ((SpellTemplate.SpellEffects[this.Id] is GameObjectTargetSpellEffect) && target is GameObject)
                {
                    from.SpellFaillure(SpellFailedReason.InvalidTarget);
                    return(false);
                }
                #endregion
                #region Standing
                if (from is Character)
                {
                    int st = (int)from.StandState;
                    st = st & 0xffff;
                    StandStates s = (StandStates)st;
                    if (s != StandStates.Standing)
                    {
                        from.SpellFaillure(SpellFailedReason.YouHaveToStandingToDoThat);
                        return(false);
                    }
                }
                #endregion
                #region caster is dead
                if (from.Dead == true)
                {
                    from.SpellFaillure(SpellFailedReason.YouAreDead);
                    return(false);
                }
                #endregion
                #region have spell
                if (!from.HaveSpell(this.Id))
                {
                    from.SpellFaillure(SpellFailedReason.SpellNotLearned);
                    return(false);
                }
                #endregion
                #region level test
                if (from is Character)
                {
                    if (!((from as Character).AccountLevel == AccessLevels.Admin || (from as Character).AccountLevel == AccessLevels.GM))
                    {
                        if (from.Level < (this as SpellTemplate).RequieredLevel)
                        {
                            from.SpellFaillure(SpellFailedReason.YouAreNotEnoughLevel);
                            return(false);
                        }
                    }
                }
                else
                {
                    if (this is SpellTemplate || this is AuraEffect)
                    {
                        if (from.Level < (this as SpellTemplate).RequieredLevel)
                        {
                            from.SpellFaillure(SpellFailedReason.YouAreNotEnoughLevel);
                            return(false);
                        }
                    }
                }
                #endregion
                #region target type
                if (SpecificSpellTargets.specificSpellTargets[(int)this.Id] != 0 && target is Mobile)
                {
                    int    k   = (int)SpecificSpellTargets.specificSpellTargets[(int)this.Id];
                    int    j   = k;
                    Mobile mob = (Mobile)target;
                    Console.WriteLine(" " + j + " ");
                    j &= mob.NpcType;
                    Console.WriteLine(" " + j + " " + mob.NpcType);
                    if ((j == 0))
                    {
                        from.SpellFaillure(SpellFailedReason.RequiredExoticAmno);
                        Console.WriteLine("upppppps");
                        return(false);
                    }
                }
                #endregion
            }
            else
            {
                Console.WriteLine("Ability/Teach spell casted - Id: " + this.Id);
            }
            return(true);
        }
コード例 #14
0
        public bool CheckSpellTarget(Mobile from, Object target)
        {
            if (this is SpellTemplate || this is AuraEffect)
            {
                #region multiple auras
                if (this is AuraEffect && target is Mobile)
                {
                    AuraEffect ae      = (AuraEffect)this;
                    byte       purebin = ae.GetPureBin();
                    Console.WriteLine(purebin);
                    //if(ae.Unpure == true) return true;
                    ArrayList al1 = new ArrayList();
                    foreach (Mobile.AuraReleaseTimer art1 in (target as Mobile).Auras)
                    {
                        AuraEffect af = art1.ae;
                        if (af.Aura == ae.Aura)
                        {
                            if (af.Id > ae.Id)
                            {
                                (from as Character).SpellFaillure(SpellFailedReason.AMorePowerfulSpellAlreadyActive);
                                return(false);
                            }
                            else
                            {
                                al1.Add(art1);
                            }
                        }
                    }
                    foreach (Mobile.AuraReleaseTimer art2 in al1)
                    {
                        (target as Mobile).ReleaseAura(art2);
                    }
                }
                #endregion
                #region invalid target
                if ((SpellTemplate.SpellEffects[this.Id] is SingleTargetSpellEffect) && !(target is Mobile || target is Character))
                {
                    from.SpellFaillure(SpellFailedReason.InvalidTarget);
                    return(false);
                }
                if ((SpellTemplate.SpellEffects[this.Id] is OnSingleTargetItemSpellEffect) && !(target is Items.Item))
                {
                    from.SpellFaillure(SpellFailedReason.InvalidTarget);
                    return(false);
                }
                if ((SpellTemplate.SpellEffects[this.Id] is TargetXYZSpellEffect) && !(target == null))
                {
                    from.SpellFaillure(SpellFailedReason.InvalidTarget);
                    return(false);
                }
                if ((SpellTemplate.SpellEffects[this.Id] is OnSelfSpellEffect) && target != from)
                {
                    from.SpellFaillure(SpellFailedReason.InvalidTarget);
                    return(false);
                }
                if ((SpellTemplate.SpellEffects[this.Id] is GameObjectTargetSpellEffect) && target is GameObject)
                {
                    from.SpellFaillure(SpellFailedReason.InvalidTarget);
                    return(false);
                }
                #endregion
                #region target is dead
                if (target is Mobile)
                {
                    if ((target as Mobile).Dead == true)
                    {
                        from.SpellFaillure(SpellFailedReason.YouAreDead);
                        return(false);
                    }
                }
                #endregion
            }

            else
            {
                Console.WriteLine("Ability/Teach spell casted - Id: " + this.Id);
            }
            return(true);
        }
コード例 #15
0
        public virtual int CoolDown(Mobile from)
        {
            int        coldwn = cooldown;
            AuraEffect ae     = null;

            if (this is SpellTemplate)
            {
                switch (from.Classe)
                {
                    #region mage
                case Classes.Mage:
                    // improved fireblast
                    if (SpellTemplate.SpellEffects[(int)Id] == SpellTemplate.SpellEffects[2136])                                  //	FireBlast
                    {
                        if (from.HaveTalent(Talents.ImprovedFireBlast))
                        {
                            ae      = (AuraEffect)from.GetTalentEffect(Talents.ImprovedFireBlast);
                            coldwn += ae.S1;
                        }
                    }
                    // improved frost nova
                    if (SpellTemplate.SpellEffects[(int)Id] == SpellTemplate.SpellEffects[6131])                                  //	FireBlast
                    {
                        if (from.HaveTalent(Talents.ImprovedFrostNova))
                        {
                            ae      = (AuraEffect)from.GetTalentEffect(Talents.ImprovedFrostNova);
                            coldwn += ae.S1;
                        }
                    }
                    break;

                    #endregion
                    #region warrior
                case Classes.Warrior:
                    //improved taunt
                    if (SpellTemplate.SpellEffects[(int)Id] == SpellTemplate.SpellEffects[355])                          //	Taunt
                    {
                        if (from.HaveTalent(Talents.ImprovedTaunt))
                        {
                            ae      = (AuraEffect)from.GetTalentEffect(Talents.ImprovedTaunt);
                            coldwn += ae.S1;
                        }
                    }
                    //improved intercept
                    if (SpellTemplate.SpellEffects[(int)Id] == SpellTemplate.SpellEffects[20252])                                  //	intercept
                    {
                        if (from.HaveTalent(Talents.ImprovedIntercept))
                        {
                            ae      = (AuraEffect)from.GetTalentEffect(Talents.ImprovedIntercept);
                            coldwn += ae.S1;
                        }
                    }
                    break;

                    #endregion
                    #region warlock
                case Classes.Warlock:

                    break;
                    #endregion
                }
                if (from.SummonedBy != null)
                {
                    if (SpellTemplate.SpellEffects[(int)Id] == SpellTemplate.SpellEffects[4388])
                    {
                        if (from.SummonedBy.HaveTalent(Talents.ImprovedLashOfPain))
                        {
                            ae      = (AuraEffect)from.GetTalentEffect(Talents.ImprovedLashOfPain);
                            coldwn += ae.S1;
                        }
                    }
                }
            }
            int cooldwn = coldwn;
            #region Cooldown for ability
            foreach (Mobile.AuraReleaseTimer art in from.Auras)
            {
                if (art.aura.CooldownEffectedAbilityList != 0)
                {
                    if (from.SpecialForAuras[art.aura.CooldownEffectedAbilityList] != null)
                    {
                        if (from.SpecialForAuras[art.aura.CooldownEffectedAbilityList] is ArrayList)
                        {
                            if ((from.SpecialForAuras[art.aura.CooldownEffectedAbilityList] as ArrayList).Contains((int)this.Id))
                            {
                                cooldwn = (int)((cooldwn + art.aura.CooldownBonusForAbility) * art.aura.CooldownModificatorForAbility);
                            }
                        }
                        if (from.SpecialForAuras[art.aura.CooldownEffectedAbilityList] is int)
                        {
                            int list = (int)from.SpecialForAuras[art.aura.CooldownEffectedAbilityList];
                            if (list == this.Id)
                            {
                                cooldwn = (int)((cooldwn + art.aura.CooldownBonusForAbility) * art.aura.CooldownModificatorForAbility);
                            }
                        }
                    }
                }
                if (art.aura.CooldownEffectedAbilityClass != 0)
                {
                    if (AbilityClasses.abilityClasses[(int)Id] == art.aura.CooldownEffectedAbilityClass)
                    {
                        cooldwn = (int)((cooldwn + art.aura.CooldownBonusForAbility) * art.aura.CooldownModificatorForAbility);
                    }
                }
            }
            foreach (PermanentAura art in from.PermanentAuras)
            {
                if (art.aura.CooldownEffectedAbilityList != 0)
                {
                    if (from.SpecialForAuras[art.aura.CooldownEffectedAbilityList] != null)
                    {
                        if (from.SpecialForAuras[art.aura.CooldownEffectedAbilityList] is ArrayList)
                        {
                            if ((from.SpecialForAuras[art.aura.CooldownEffectedAbilityList] as ArrayList).Contains((int)this.Id))
                            {
                                cooldwn = (int)((cooldwn + art.aura.CooldownBonusForAbility) * art.aura.CooldownModificatorForAbility);
                            }
                        }
                        if (from.SpecialForAuras[art.aura.CooldownEffectedAbilityList] is int)
                        {
                            int list = (int)from.SpecialForAuras[art.aura.CooldownEffectedAbilityList];
                            if (list == this.Id)
                            {
                                cooldwn = (int)((cooldwn + art.aura.CooldownBonusForAbility) * art.aura.CooldownModificatorForAbility);
                            }
                        }
                    }
                }
                if (art.aura.CooldownEffectedAbilityClass != 0)
                {
                    if (AbilityClasses.abilityClasses[(int)Id] == art.aura.CooldownEffectedAbilityClass)
                    {
                        cooldwn = (int)((cooldwn + art.aura.CooldownBonusForAbility) * art.aura.CooldownModificatorForAbility);
                    }
                }
            }

            #endregion

            return(cooldwn);
        }
コード例 #16
0
        public void Summon(Mobile c)
        {
            if (c.Summon != null)
            {
                c.Summon.Delete();
                if (World.allMobiles.Contains(c.Summon))
                {
                    World.Remove(c.Summon, c);
                }
            }
            ConstructorInfo ci = World.MobilePool(mountId);
            BaseCreature    bc = (BaseCreature)ci.Invoke(null);

            bc.Faction    = c.Faction;
            bc.AIEngine   = new SummonedAI(c, bc);
            bc.SummonedBy = c;
            c.Summon      = bc;
            bc.Level      = c.Level;
            bc.Stamina    = bc.Str = bc.Iq = bc.Spirit = bc.HitPoints = bc.BaseHitPoints = bc.Agility = bc.BaseMana = 0;
            bc.InitStats();
            //	bc.AIEngine = new SummonedAI( c, bc );
            if (c.Classe == Classes.Warlock)
            {
                #region Fel Intellect
                if (bc.Id == 416 || bc.Id == 1863 || bc.Id == 1860 || bc.Id == 417)
                {
                    if (c.HaveTalent(Talents.FelIntellect))
                    {
                        AuraEffect ae = (AuraEffect)c.GetTalentEffect(Talents.FelIntellect);
                        float      bm = (float)bc.BaseMana;
                        bm         += bm * ((float)ae.S1) / 100f;
                        bc.BaseMana = bc.Mana = (int)bm;
                    }
                }
                #endregion
                #region Fel Stamina
                if (bc.Id == 416 || bc.Id == 1863 || bc.Id == 1860 || bc.Id == 417)
                {
                    if (c.HaveTalent(Talents.FelStamina))
                    {
                        AuraEffect ae = (AuraEffect)c.GetTalentEffect(Talents.FelStamina);
                        float      bm = (float)bc.BaseHitPoints;
                        bm += bm * ((float)ae.S1) / 100f;
                        bc.BaseHitPoints = bc.HitPoints = (int)bm;
                    }
                }
                #endregion
            }

            World.Add(bc, c.X, c.Y, c.Z, c.MapId);
            if (c is Character)
            {
                //	c.SendSmallUpdate( new int[] { (int)UpdateFields.UNIT_FIELD_CHARM, (int)UpdateFields.UNIT_FIELD_SUMMON }, new object[] { bc.Guid, bc.Guid } );

                Character ch     = c as Character;
                int       offset = 4;
                Converter.ToBytes(1, c.tempBuff, ref offset);
                Converter.ToBytes((byte)0, c.tempBuff, ref offset);
                c.PrepareUpdateData(c.tempBuff, ref offset, UpdateType.UpdateFull, false);
                //				bc.PrepareUpdateData( c.tempBuff, ref offset , UpdateType.UpdateFull, false );
                ch.Send(OpCodes.SMSG_UPDATE_OBJECT, c.tempBuff, offset);
                ch.ItemsUpdate();

                if (bc.Id == 89 || bc.Id == 416 || bc.Id == 1863 || bc.Id == 1860 || bc.Id == 304 || bc.Id == 417)
                {
                    ch.SendPetActionBar();
                }
            }
        }