public void ChangeBattleStance( StandStates st ) { int t = (int)StandState; t = t & 0xffff; t += (int)st; StandState = (StandStates)t; this.SendSmallUpdateToPlayerNearMe( new int[] { (int)UpdateFields.UNIT_FIELD_BYTES_1 }, new object[] { t } ); }
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); }
public override void Deserialize( GenericReader gr ) { int version = gr.ReadInt(); // id = gr.ReadInt(); UInt64 g = gr.ReadInt64(); SpawnerLink = null;//(BaseSpawner)MobileList.TempSpawner[ g ]; int esu = 0; int ech = 0; esu = gr.ReadInt(); ech = gr.ReadInt(); name = gr.ReadString(); if ( version > 0 ) classe = (Classes)gr.ReadInt(); talent = gr.ReadInt(); Level = gr.ReadInt(); model = gr.ReadInt(); exp = (uint)gr.ReadInt(); guildId = (uint)gr.ReadInt(); petLevel = (uint)gr.ReadInt(); petCreatureFamily = (uint)gr.ReadInt(); petDisplayId = (uint)gr.ReadInt(); speed = gr.ReadFloat(); size = gr.ReadFloat(); faction = (Factions)gr.ReadInt(); str = gr.ReadInt(); agility = gr.ReadInt(); stamina = gr.ReadInt(); iq = gr.ReadInt(); spirit = gr.ReadInt(); baseStr = gr.ReadFloat(); baseAgility = gr.ReadFloat(); baseStamina = gr.ReadFloat(); baseIq = gr.ReadFloat(); baseSpirit = gr.ReadFloat(); walkSpeed = gr.ReadFloat(); if ( walkSpeed == 0 ) walkSpeed = 4.7777f; runSpeed = gr.ReadFloat(); if ( runSpeed == 0 ) runSpeed = 7f; swimSpeed = gr.ReadFloat(); if ( swimSpeed == 0 ) swimSpeed = 4.72f; swimBackSpeed = gr.ReadFloat(); if ( swimBackSpeed == 0 ) swimBackSpeed = 2.5f; hitPoints = gr.ReadInt(); mana = gr.ReadInt(); energy = gr.ReadInt(); rage = gr.ReadInt(); focus = gr.ReadInt(); baseHitPoints = gr.ReadInt(); baseMana = gr.ReadInt(); baseEnergy = gr.ReadInt(); baseRage = gr.ReadInt(); baseFocus = gr.ReadInt(); block = gr.ReadInt(); armor = gr.ReadInt(); resistHoly = gr.ReadInt(); resistFire = gr.ReadInt(); resistNature = gr.ReadInt(); resistFrost = gr.ReadInt(); resistShadow = gr.ReadInt(); resistArcane = gr.ReadInt(); int nSkills = gr.ReadInt(); for(int t = 0;t < nSkills;t++ ) { ushort skill = (ushort)gr.ReadShort(); allSkills[ skill ] = Skill.Deserialize( gr, t ); } int nSpells = gr.ReadInt(); for(int t = 0;t < nSpells;t++ ) { ushort spell = (ushort)gr.ReadShort(); byte place = gr.ReadByte(); knownAbilities[ (int)spell ] = (int)place; /* if ( TalentDescription.IsTalent( (int)spell ) ) { if ( onInitialiseTalent[ (int)spell ] != null ) { ( onInitialiseTalent[ (int)spell ] as TalentHandlers.TalentHandler )( Abilities.abilities[ (int)spell ], this ); } // this.AddPermanentAura( Abilities.abilities[ (int)spell ], new Aura() ); // permanentAura.Add( spell ); }*/ } int nTalentList = gr.ReadInt(); for(int t = 0;t < nTalentList;t++ ) { int spell = gr.ReadInt(); int lev = gr.ReadInt(); talentList[ spell ] = (int)lev; } if ( gr.ReadInt() != 0 ) freeze = true; int nit = gr.ReadInt(); for(int t = 0;t < nit;t++ ) { int n = gr.ReadInt(); if ( n == 1 ) items[ t ] = Item.Load( gr ); else items[ t ] = null; } if ( gr.ReadInt() != 0 ) movementChange = true; manaType = gr.ReadInt(); professions = gr.ReadByte(); standState = (StandStates)gr.ReadInt(); base.Deserialize( gr ); moveVector = new MoveVector( this, X, Y, Z ); // if ( this is BaseSpawner ) // MobileList.TempSpawner[ Guid ] = this; if ( esu != 0 ) MobileList.TempSummon[ Guid ] = this; if ( ech != 0 ) MobileList.TempSummon[ Guid ] = this; //movementTimer = new MovementTimer( this ); }
public bool CheckSpellCaster(Mobile from) { if (this is SpellTemplate || this is AuraEffect) { #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 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 (this is SpellTemplate || this is AuraEffect) { if (from.Level < (this as SpellTemplate).RequieredLevel) { from.SpellFaillure(SpellFailedReason.YouAreNotEnoughLevel); return(false); } } #endregion } else { Console.WriteLine("Ability/Teach spell casted - Id: " + this.Id); } return(true); }