/// <summary>
        /// Action
        /// </summary>
        /// <param name="living"></param>
        public override void Execute(GameLiving living)
        {
            if (CheckPreconditions(living, DEAD | SITTING | MEZZED | STUNNED)) return;

            GamePlayer player = living as GamePlayer;
            if (player != null)
            {
                ArrayList targets = new ArrayList();
                if (player.Group == null)
                    targets.Add(player);
                else
                {
                    foreach (GamePlayer grpplayer in player.Group.GetPlayersInTheGroup())
                    {
                        if (player.IsWithinRadius(grpplayer, SpellRadius) && grpplayer.IsAlive)
                            targets.Add(grpplayer);
                    }
                }
                foreach (GamePlayer target in targets)
                {
                    //send spelleffect
                    if (!target.IsAlive) continue;
                    ValhallasBlessingEffect ValhallasBlessing = target.EffectList.GetOfType<ValhallasBlessingEffect>();
                    if (ValhallasBlessing != null)
                        ValhallasBlessing.Cancel(false);
                    new ValhallasBlessingEffect().Start(target);
                }
            }
            DisableSkill(living);
        }
Example #2
0
 // constructor
 public CureMezzSpellHandler(GameLiving caster, Spell spell, SpellLine line)
     : base(caster, spell, line)
 {
     // RR4: now it's a list
     m_spellTypesToRemove = new List<string>();
     m_spellTypesToRemove.Add("Mesmerize");
 }
Example #3
0
		/// <summary>
		/// Constructs new EnemyHealedEventArgs
		/// </summary>
		/// <param name="enemy">The healed enemy</param>
		/// <param name="healSource">The heal source</param>
		/// <param name="changeType">The health change type</param>
		/// <param name="healAmount">The heal amount</param>
		public EnemyHealedEventArgs(GameLiving enemy, GameObject healSource, GameLiving.eHealthChangeType changeType, int healAmount)
		{
			m_enemy = enemy;
			m_healSource = healSource;
			m_changeType = changeType;
			m_healAmount = healAmount;
		}
        /// <summary>
        /// Execute damage over time spell
        /// </summary>
        /// <param name="target"></param>
        public override void FinishSpellCast(GameLiving target)
        {
            base.FinishSpellCast(target);

            GiveEndurance(m_caster, (int)m_spell.Value);
            OnEffectExpires(null, true);
        }
        public override void Start(GameLiving target)
        {
            base.Start(target);
            owner = target;
            GamePlayer player = target as GamePlayer;
            if (player != null)
            {
                foreach (GamePlayer p in player.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
                {
                    p.Out.SendSpellEffectAnimation(player, player, Icon, 0, false, 1);
                }
            }

            //[StephenxPimentel]
            //1.108 - this ability no longer reduces the users attack power by 50%

            //target.DebuffCategory[(int)eProperty.MissHit] -= 50;
            target.BuffBonusCategory4[(int)eProperty.EvadeChance] += 50;
            target.BuffBonusMultCategory1.Set((int)eProperty.MaxSpeed, this, 0.5);

            if (player != null)
            {
                player.Out.SendUpdateMaxSpeed();
            }
        }
Example #6
0
		/// <summary>
		/// Start the stag on player
		/// </summary>
		/// <param name="living">The living object the effect is being started on</param>
		public override void Start(GameLiving living)
		{
			base.Start(living);

			m_originalModel = living.Model;

			if (living is GamePlayer)
			{
				if ((living as GamePlayer).Race == (int)eRace.Lurikeen)
					living.Model = 859;
				else living.Model = 583;
			}			


			double m_amountPercent = (m_level + 0.5 + Util.RandomDouble()) / 10; //+-5% random
			if (living is GamePlayer)
				m_amount = (int)((living as GamePlayer).CalculateMaxHealth(living.Level, living.GetModified(eProperty.Constitution)) * m_amountPercent);
			else m_amount = (int)(living.MaxHealth * m_amountPercent);

			living.BaseBuffBonusCategory[(int)eProperty.MaxHealth] += m_amount;
			living.Health += (int)(living.GetModified(eProperty.MaxHealth) * m_amountPercent);
			if (living.Health > living.MaxHealth) living.Health = living.MaxHealth;

			living.Emote(eEmote.StagFrenzy);

			if (living is GamePlayer)
			{
				(living as GamePlayer).Out.SendUpdatePlayer();
				(living as GamePlayer).Out.SendMessage(LanguageMgr.GetTranslation((living as GamePlayer).Client, "Effects.StagEffect.HuntsSpiritChannel"), eChatType.CT_YouHit, eChatLoc.CL_SystemWindow);
			}
		}
        /// <summary>
        /// Merchant has received a /whisper.
        /// </summary>
        /// <param name="source"></param>
        /// <param name="text"></param>
        /// <returns></returns>
        public override bool WhisperReceive(GameLiving source, String text)
        {
            GamePlayer player = source as GamePlayer;

            if (player == null)
                return false;

            switch (text.ToLower())
            {
                case "tales of battle":
                    String reply = String.Format("Oh, how I wish I could leave the lands of Atlantis at will as you do. {0} {1}",
                        "I'd [leave] in a heartbeat if I could, but I am only sustained by the lingering magic",
                        "of the Atlanteans. This hall is as far as I can go.");

                    SayTo(player, reply);
                    return true;
                case "leave":
                    reply = String.Format("I'd even join you in your war if I could, {0} {1} {2}",
                        "anything for a little adventure, a little excitement. I remember a time when we",
                        "sphinxes were greatly feared as guardians of more than just [knowledge].",
                        "Ah, but that time has long since passed.");

                    SayTo(player, reply);
                    return true;
                case "knowledge":
                    reply = String.Format("Indeed, that is all I am now: a living tome of knowledge, {0} {1}",
                        "particularly of the Atlanteans' lost artifacts. Perhaps you'd be willing to trade",
                        "stories of your adventures in the frontiers for some of this knowledge.");

                    SayTo(player, reply);
                    return true;
            }

            return base.WhisperReceive(source, text);
        }
Example #8
0
		/// <summary>
		/// Handle an item given to the scholar.
		/// </summary>
		/// <param name="source"></param>
		/// <param name="item"></param>
		/// <param name="target"></param>
		/// <returns></returns>
		public override bool ReceiveItem(GameLiving source, GameLiving target, InventoryItem item)
		{
			if (base.ReceiveItem(source, target, item))
				return true;

			GamePlayer player = source as GamePlayer;
			Scholar scholar = target as Scholar;
			if (player == null || scholar == null)
				return false;

			if (Step == 2 && ArtifactMgr.GetArtifactID(item.Name) == ArtifactID)
			{
				Dictionary<String, ItemTemplate> versions = ArtifactMgr.GetArtifactVersions(ArtifactID,
					(eCharacterClass)player.CharacterClass.ID, (eRealm)player.Realm);
				
				if (versions.Count > 0 && RemoveItem(player, item))
				{
					GiveItem(scholar, player, ArtifactID, versions[";;"]);
					String reply = String.Format("Brilliant, thank you! Here, take the artifact. {0} {1} {2}",
						"I've unlocked its powers for you. As I've said before, I'm more interested",
						"in the stories and the history behind these artifacts than the actual items",
						"themselves.");
					scholar.TurnTo(player);
					scholar.SayTo(player, eChatLoc.CL_PopupWindow, reply);
					FinishQuest();
					return true;
				}
			}

			return false;
		}
Example #9
0
		public override void OnDirectEffect(GameLiving target, double effectiveness)
		{
			GamePlayer player = target as GamePlayer;
			if(player == null) 
				return;

			var text = new List<string>();
			text.Add("Class: "+player.CharacterClass.Name);
			text.Add("Realmpoints: "+player.RealmPoints+" = "+string.Format("{0:#L#} {1}",player.RealmLevel+10,player.RealmTitle));
			text.Add("----------------------------------------------------");
			text.Add("Str: "+player.Strength+" Dex: "+player.Dexterity+" Con: "+player.Constitution);
			text.Add("Qui: "+player.Quickness+" Emp: "+player.Empathy+" Cha: "+player.Charisma);
			text.Add("Pie: "+player.Piety+" Int: "+player.Intelligence+" HP: "+player.MaxHealth);
			text.Add("----------------------------------------------------");
			IList specs = player.GetSpecList();
			foreach (object obj in specs)
				if (obj is Specialization)
					text.Add(((Specialization)obj).Name + ": " + ((Specialization)obj).Level.ToString());
			text.Add("----------------------------------------------------");
			IList abilities = player.GetAllAbilities();
			foreach(Ability ab in abilities)
				if(ab is RealmAbility && ab is RR5RealmAbility == false)
					text.Add(((RealmAbility)ab).Name);

			(m_caster as GamePlayer).Out.SendCustomTextWindow("Realm Lore [ "+player.Name+" ]",text);
			(m_caster as GamePlayer).Out.SendMessage("Realm Lore [ "+player.Name+" ]\n"+text,eChatType.CT_System,eChatLoc.CL_SystemWindow);
		}
Example #10
0
		public override bool ReceiveItem(GameLiving source, InventoryItem item)
		{
			GamePlayer t = source as GamePlayer;
			if (t == null || item == null)
				return false;

			if (item.Level >= 10 && item.IsCrafted)
			{
				if (item.Object_Type != (int) eObjectType.Magical && item.Object_Type != (int) eObjectType.Bolt && item.Object_Type != (int) eObjectType.Poison)
				{
					if (item.Bonus == 0)
					{
						t.TempProperties.setProperty(ENCHANT_ITEM_WEAK, new WeakRef(item));
                        t.Client.Out.SendCustomDialog(LanguageMgr.GetTranslation(t.Client, "Enchanter.ReceiveItem.Text1", Money.GetString(CalculEnchantPrice(item))), new CustomDialogResponse(EnchanterDialogResponse));
                    }
					else
                        SayTo(t, eChatLoc.CL_SystemWindow, LanguageMgr.GetTranslation(t.Client, "Enchanter.ReceiveItem.Text2"));
                }
				else
                    SayTo(t, eChatLoc.CL_SystemWindow, LanguageMgr.GetTranslation(t.Client, "Enchanter.ReceiveItem.Text3"));
            }
			else
                SayTo(t, eChatLoc.CL_SystemWindow, LanguageMgr.GetTranslation(t.Client, "Enchanter.ReceiveItem.Text4"));

			return false;
		}
		public override int CalcValue(GameLiving living, eProperty property) 
		{
			/* PATCH 1.87 COMBAT AND REGENERATION
			  - While in combat, health and power regeneration ticks will happen twice as often.
    		  - Each tick of health and power is now twice as effective.
              - All health and power regeneration aids are now twice as effective.
             */

			double regen = 5 + (living.Level / 2.75);

			if (living is GameNPC && living.InCombat)
				regen /= 2.0;

			// tolakram - there is no difference per tic between combat and non combat

			if (regen != 0 && ServerProperties.Properties.MANA_REGEN_RATE != 1)
				regen *= ServerProperties.Properties.MANA_REGEN_RATE;

			double decimals = regen - (int)regen;
			if (Util.ChanceDouble(decimals)) 
			{
				regen += 1;	// compensate int rounding error
			}

			int debuff = living.SpecBuffBonusCategory[(int)property];
			if (debuff < 0)
				debuff = -debuff;

			regen += living.BaseBuffBonusCategory[(int)property] + living.AbilityBonus[(int)property] + living.ItemBonus[(int)property] - debuff;

			if (regen < 1)
				regen = 1;

			return (int)regen;
		}
Example #12
0
		public override void Start(GameLiving target)
		{
			base.Start(target);
			owner = target;
			GamePlayer player = target as GamePlayer;
			if (player != null)
			{
				foreach (GamePlayer p in player.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
				{
					p.Out.SendSpellEffectAnimation(player, player, Icon, 0, false, 1);
				}
			}

            GameEventMgr.AddHandler(target, GameLivingEvent.AttackedByEnemy, new DOLEventHandler(OnAttack));

            //[StephenxPimentel]
            //1.108 updates this so it no longer stuns, but silences.
            //Rest of the code is now located in SpellHandler. (Line 617)
            owner.StopCurrentSpellcast();


			//owner.IsStunned = true;
			//owner.StopAttack();
			//owner.DisableTurning(true);
			//if (player != null)
			//{
			//	player.Out.SendUpdateMaxSpeed();
			//}
			//else
			//{
			//	owner.CurrentSpeed = owner.MaxSpeed;
			//}
		}
 public override AttackData CalculateDamageToTarget(GameLiving target, double effectiveness)
 {
     AttackData ad = base.CalculateDamageToTarget(target, effectiveness);
     ad.CriticalDamage = 0;
     ad.AttackType = AttackData.eAttackType.Unknown;
     return ad;
 }
        public override void CalculateDamageVariance(GameLiving target, out double min, out double max)
        {
            int speclevel = 1;
            if (m_caster is GamePlayer)
            {
                speclevel = ((GamePlayer)m_caster).GetModifiedSpecLevel(m_spellLine.Spec);
            }
            min = 1;
            max = 1;

            if (target.Level > 0)
            {
                min = 0.5 + (speclevel - 1) / (double)target.Level * 0.5;
            }

            if (speclevel - 1 > target.Level)
            {
                double overspecBonus = (speclevel - 1 - target.Level) * 0.005;
                min += overspecBonus;
                max += overspecBonus;
            }

            if (min > max) min = max;
            if (min < 0) min = 0;
        }
Example #15
0
		/// <summary>
		/// Handle an item given to the scholar.
		/// </summary>
		/// <param name="source"></param>
		/// <param name="item"></param>
		/// <param name="target"></param>
		/// <returns></returns>
		public override bool ReceiveItem(GameLiving source, GameLiving target, InventoryItem item)
		{
			if (base.ReceiveItem(source, target, item))
				return true;

			GamePlayer player = source as GamePlayer;
			Scholar scholar = target as Scholar;
			if (player == null || scholar == null)
				return false;

			if (Step == 2 && ArtifactMgr.GetArtifactID(item.Name) == ArtifactID)
			{
				Dictionary<String, ItemTemplate> versions = ArtifactMgr.GetArtifactVersions(ArtifactID,
					(eCharacterClass)player.CharacterClass.ID, (eRealm)player.Realm);

				if (versions.Count > 0 && RemoveItem(player, item))
				{
					IDictionaryEnumerator versionsEnum = versions.GetEnumerator();
					versionsEnum.MoveNext();
					GiveItem(scholar, player, ArtifactID, versionsEnum.Value as ItemTemplate);
					String reply = String.Format("Here is your gloves. Do not lose it, it is irreplaceable.");
					scholar.TurnTo(player);
					scholar.SayTo(player, eChatLoc.CL_PopupWindow, reply);
					FinishQuest();
					return true;
				}
			}

			return false;
		}
Example #16
0
        public override void Execute(GameLiving living)
		{
            if (CheckPreconditions(living, DEAD | SITTING | MEZZED | STUNNED)) return;
            GamePlayer player = living as GamePlayer;
            ItemTemplate arrow_summoning_1 = GameServer.Database.FindObjectByKey<ItemTemplate>("arrow_summoning1");
            ItemTemplate arrow_summoning_2 = GameServer.Database.FindObjectByKey<ItemTemplate>("arrow_summoning2");
            ItemTemplate arrow_summoning_3 = GameServer.Database.FindObjectByKey<ItemTemplate>("arrow_summoning3");

			// what are these used for? - tolakram
            WorldInventoryItem as1 = WorldInventoryItem.CreateFromTemplate(arrow_summoning_1);
            WorldInventoryItem as2 = WorldInventoryItem.CreateFromTemplate(arrow_summoning_2);
            WorldInventoryItem as3 = WorldInventoryItem.CreateFromTemplate(arrow_summoning_3);

            if(!player.Inventory.AddTemplate(GameInventoryItem.Create<ItemTemplate>(arrow_summoning_1),10,eInventorySlot.FirstBackpack, eInventorySlot.LastBackpack))
			{
				player.Out.SendMessage("You do not have enough inventory space to place this item!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
			}
			else if (!player.Inventory.AddTemplate(GameInventoryItem.Create<ItemTemplate>(arrow_summoning_2), 10, eInventorySlot.FirstBackpack, eInventorySlot.LastBackpack))
			{
                player.Out.SendMessage("You do not have enough inventory space to place this item!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
			}
			else if (!player.Inventory.AddTemplate(GameInventoryItem.Create<ItemTemplate>(arrow_summoning_3), 10, eInventorySlot.FirstBackpack, eInventorySlot.LastBackpack))
			{
                player.Out.SendMessage("You do not have enough inventory space to place this item!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
			}			

			GameEventMgr.AddHandler(player,GamePlayerEvent.Quit, new DOLEventHandler(PlayerQuit));	
            DisableSkill(living);	
		}
		/// <summary>
		/// Retrieve all Champion Subline Spec's Spells to an Hybrid List
		/// </summary>
		/// <param name="living"></param>
		/// <param name="level"></param>
		/// <returns></returns>
		protected override IDictionary<SpellLine, List<Skill>> GetLinesSpellsForLiving(GameLiving living, int level)
		{
			if (living is GamePlayer)
			{
				GamePlayer player = (GamePlayer)living;
				
				var specs = player.GetSpecList().Where(sp => sp is LiveChampionsLineSpec).Cast<LiveChampionsLineSpec>();
				
				var result = new Dictionary<SpellLine, List<Skill>>();
				
				foreach (var spec in specs)
				{
					var skills = spec.GetMiniLineSkillsForLiving(living, spec.GetSpecLevelForLiving(living)).Where(e => e.Item1 is Spell);
					
					foreach (var elem in skills)
					{
						elem.Item2.Level = player.MaxLevel;
						if (!result.ContainsKey((SpellLine)elem.Item2))
							result.Add((SpellLine)elem.Item2, new List<Skill>());
						
						elem.Item1.Level = player.MaxLevel;
						result[(SpellLine)elem.Item2].Add(elem.Item1);
					}
				}
				
				return result;
			}
			else
			{
				// Unsupported specs for livings...
				return new Dictionary<SpellLine, List<Skill>>();
			}
		}
        public override bool CheckBeginCast(GameLiving selectedTarget)
        {
            int nCount = 0;

            Region rgn = WorldMgr.GetRegion(Caster.CurrentRegion.ID);

            if (rgn == null || rgn.GetZone(Caster.GroundTarget.X, Caster.GroundTarget.Y) == null)
            {
                MessageToCaster("You can't summon Turret without ground-target !", eChatType.CT_SpellResisted);
                return false;
            }

            foreach (GameNPC npc in Caster.CurrentRegion.GetNPCsInRadius(Caster.GroundTarget.X, Caster.GroundTarget.Y, Caster.GroundTarget.Z, (ushort)Properties.TURRET_AREA_CAP_RADIUS, false, true))
                if (npc.Brain is TurretFNFBrain)
                    nCount++;

            if (nCount >= Properties.TURRET_AREA_CAP_COUNT)
            {
                MessageToCaster("You can't summon anymore Turrets in this Area!", eChatType.CT_SpellResisted);
                return false;
            }

            if (Caster.PetCount >= Properties.TURRET_PLAYER_CAP_COUNT)
            {
                MessageToCaster("You cannot control anymore Turrets!", eChatType.CT_SpellResisted);
                return false;
            }

            return base.CheckBeginCast(selectedTarget);
        }
Example #19
0
        /// <summary>
        /// called when spell effect has to be started and applied to targets
        /// </summary>
        public override bool StartSpell(GameLiving target)
        {
            if (target == null) return false;

            IList targets = SelectTargets(target);
            IList realmtargets = SelectRealmTargets(target);

            foreach (GameLiving t in targets)
            {
                if(t.Level <= m_spell.Value)
                {
                    GameNPC mob = (GameNPC)t;
                    if(mob.Brain is StandardMobBrain)
                    {
                        StandardMobBrain sBrain = (StandardMobBrain) mob.Brain;
                        //mob.StopAttack();

                        foreach(GamePlayer player in realmtargets)
                            sBrain.RemoveFromAggroList(player);

                    }

                    mob.AddBrain(new FriendBrain(this));
                }
            }

            return true;
        }
		/// <summary>
		/// Execute Handler
		/// Cast the According Spell
		/// </summary>
		/// <param name="living">Living Executing Ability</param>
		public override void Execute(GameLiving living)
		{
			base.Execute(living);
			
			if (Spell != null && SpellLine != null)
				living.CastSpell(this);
		}
        /// <summary>
        /// called after normal spell cast is completed and effect has to be started
        /// </summary>
        public override void FinishSpellCast(GameLiving target)
        {
            foreach (GamePlayer player in m_caster.GetPlayersInRadius(WorldMgr.INFO_DISTANCE))
            {
                if (player != m_caster)
                    player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client, "GameObject.Casting.CastsASpell", m_caster.GetName(0, true)), eChatType.CT_Spell, eChatLoc.CL_SystemWindow);
            }

            m_caster.Mana -= PowerCost(target);

            base.FinishSpellCast(target);

            if (m_pet == null)
                return;

            if (Spell.Message1 == string.Empty)
            {
                if (m_isSilent == false)
                {
                    MessageToCaster(String.Format("The {0} is now under your control.", m_pet.Name), eChatType.CT_Spell);
                }
            }
            else
            {
                MessageToCaster(Spell.Message1, eChatType.CT_Spell);
            }
        }
Example #22
0
        /// <summary>
        /// Action
        /// </summary>
        /// <param name="living"></param>
        public override void Execute(GameLiving living)
        {
            if (CheckPreconditions(living, DEAD | SITTING | MEZZED | STUNNED)) return;

            SendCasterSpellEffectAndCastMessage(living, 1145, true);

            bool deactivate = false;
            foreach (GamePlayer player in living.GetPlayersInRadius(false, 350))
            {
                if (GameServer.ServerRules.IsAllowedToAttack(living, player, true))
                {
                    DamageTarget(player, living);
                    deactivate = true;
                }
            }

            foreach (GameNPC npc in living.GetNPCsInRadius(false, 350))
            {
                if (GameServer.ServerRules.IsAllowedToAttack(living, npc, true))
                {
                    DamageTarget(npc, living);
                    deactivate = true;
                }
            }
            if (deactivate)
                DisableSkill(living);
        }
        /// <summary>
        /// Action
        /// </summary>
        /// <param name="living"></param>
        public override void Execute(GameLiving living)
        {
            if (CheckPreconditions(living, DEAD | SITTING | MEZZED | STUNNED)) return;

            GamePlayer player = living as GamePlayer;
            if (player == null)
                return;

            // Check for MoC on the Sorceror: he cannot cast RA5L when the other is up
            MasteryofConcentrationEffect ra5l = null;
            lock (player.EffectList)
            {
                foreach (object effect in player.EffectList)
                {
                    if (effect is MasteryofConcentrationEffect)
                    {
                        ra5l = effect as MasteryofConcentrationEffect;
                        break;
                    }
                }
            }
            if (ra5l != null)
            {
                player.Out.SendMessage("You cannot currently use this ability", eChatType.CT_SpellResisted, eChatLoc.CL_SystemWindow);
                return;
            }

            SendCasterSpellEffectAndCastMessage(player, 7048, true);
            ShieldOfImmunityEffect raEffect = new ShieldOfImmunityEffect();
            raEffect.Start(player);

            DisableSkill(living);
        }
Example #24
0
        public override int CalculateSpellResistChance(GameLiving target)
        {
            int resistvalue = 0;
            int resist = 0;
            GameSpellEffect fury = SpellHandler.FindEffectOnTarget(target, "Fury");
            if (fury != null)
            {
                resist += (int)fury.Spell.Value;
            }

            //bonedancer rr5
            if (target.EffectList.GetOfType<AllureofDeathEffect>() != null)
            {
                return AllureofDeathEffect.ccchance;
            }

            if (m_spellLine.KeyName == GlobalSpellsLines.Combat_Styles_Effect)
                return 0;
            if (HasPositiveEffect)
                return 0;

            int hitchance = CalculateToHitChance(target);

            //Calculate the Resistchance
            resistvalue = (100 - hitchance + resist);
            if (resistvalue > 100)
                resistvalue = 100;
            //use ResurrectHealth=1 if the CC should not be resisted
            if(Spell.ResurrectHealth==1) resistvalue=0;
            //always 1% resistchance!
            else if (resistvalue < 1)
                resistvalue = 1;
            return resistvalue;
        }
Example #25
0
        /// <summary>
        /// Action
        /// </summary>
        /// <param name="living"></param>
        public override void Execute(GameLiving living)
        {
            if (CheckPreconditions(living, DEAD | SITTING | MEZZED | STUNNED )) return;

            bool deactivate = false;

            GamePlayer player = living as GamePlayer;
            if (player != null)
            {
                if (player.Group != null)
                {
                    SendCasterSpellEffectAndCastMessage(living, 7066, true);
                    foreach (GamePlayer member in player.Group.GetPlayersInTheGroup())
                    {
                        if (!CheckPreconditions(member, DEAD) && living.IsWithinRadius(member, 2000))
                        {
                            if (restoreMana(member, player))
                                deactivate = true;
                        }
                    }
                }
                else
                {
                    if (!CheckPreconditions(player, DEAD))
                    {
                        if (restoreMana(player, player))
                            deactivate = true;
                    }
                }

                if (deactivate)
                    DisableSkill(living);
            }
        }
Example #26
0
		/// <summary>
		/// Handle an item given to the scholar.
		/// </summary>
		/// <param name="source"></param>
		/// <param name="item"></param>
		/// <param name="target"></param>
		/// <returns></returns>
		public override bool ReceiveItem(GameLiving source, GameLiving target, InventoryItem item)
		{
			if (base.ReceiveItem(source, target, item))
				return true;

			GamePlayer player = source as GamePlayer;
			Scholar scholar = target as Scholar;
			if (player == null || scholar == null)
				return false;

			if (Step == 2 && ArtifactMgr.GetArtifactID(item.Name) == ArtifactID)
			{
				Dictionary<String, ItemTemplate> versions = ArtifactMgr.GetArtifactVersions(ArtifactID,
					(eCharacterClass)player.CharacterClass.ID, (eRealm)player.Realm);

				if (versions.Count > 0 && RemoveItem(player, item))
				{
					GiveItem(scholar, player, ArtifactID, versions[";;"]);
					String reply = String.Format("Great! Thanks! This should help us in {0} {1}",
						"our studies. We've found several other references to this shield. Don't know how",
						"much this book will help, but it certainly can't hurt!");
					scholar.TurnTo(player);
					scholar.SayTo(player, eChatLoc.CL_PopupWindow, reply);
					FinishQuest();
					return true;
				}
			}

			return false;
		}
Example #27
0
        /// <summary>
        /// Handle an item given to the scholar.
        /// </summary>
        /// <param name="source"></param>
        /// <param name="item"></param>
        /// <param name="target"></param>
        /// <returns></returns>
        public override bool ReceiveItem(GameLiving source, GameLiving target, InventoryItem item)
        {
            GamePlayer player = source as GamePlayer;
            Scholar scholar = target as Scholar;
            if (player == null || scholar == null)
                return false;

            if (Step == 2 && ArtifactMgr.GetArtifactID(item.Name) == ArtifactID)
            {
                Dictionary<String, ItemTemplate> versions = ArtifactMgr.GetArtifactVersions(ArtifactID,
                    (eCharacterClass)player.CharacterClass.ID, (eRealm)player.Realm);

                IDictionaryEnumerator versionsEnum = versions.GetEnumerator();
                versionsEnum.MoveNext();

                if (versions.Count > 0 && RemoveItem(player, item))
                {
                    GiveItem(scholar, player, ArtifactID, versionsEnum.Value as ItemTemplate);
                    String reply = String.Format("Thank you! Here, take this cloak. {0}",
                        "I hope you find it useful. Please don't lose it, I can't replace it!");
                    scholar.TurnTo(player);
                    scholar.SayTo(player, eChatLoc.CL_PopupWindow, reply);
                    FinishQuest();
                    return true;
                }
            }

            return base.ReceiveItem(source, target, item);
        }
Example #28
0
        /// <summary>
        /// Check whether it's possible to summon a pet.
        /// </summary>
        /// <param name="selectedTarget"></param>
        /// <returns></returns>
        public override bool CheckBeginCast(GameLiving selectedTarget)
        {
            if (Caster.GroundTarget == null)
            {
                if (Caster is GamePlayer)
                    MessageToCaster(LanguageMgr.GetTranslation((Caster as GamePlayer).Client, "SummonAnimistPet.CheckBeginCast.GroundTargetNull"), eChatType.CT_SpellResisted);
                return false;
            }

            if (!Caster.GroundTargetInView)
            {
                if (Caster is GamePlayer)
                    MessageToCaster(LanguageMgr.GetTranslation((Caster as GamePlayer).Client, "SummonAnimistPet.CheckBeginCast.GroundTargetNotInView"), eChatType.CT_SpellResisted);
                return false;
            }

            if (!Caster.IsWithinRadius(Caster.GroundTarget, CalculateSpellRange()))
            {
                if (Caster is GamePlayer)
                    MessageToCaster(LanguageMgr.GetTranslation((Caster as GamePlayer).Client, "SummonAnimistPet.CheckBeginCast.GroundTargetNotInSpellRange"), eChatType.CT_SpellResisted);
                return false;
            }

            return base.CheckBeginCast(selectedTarget);
        }
Example #29
0
		/// <summary>
		/// Handle an item given to the scholar.
		/// </summary>
		/// <param name="source"></param>
		/// <param name="item"></param>
		/// <param name="target"></param>
		/// <returns></returns>
		public override bool ReceiveItem(GameLiving source, GameLiving target, InventoryItem item)
		{
			if (base.ReceiveItem(source, target, item))
				return true;

			GamePlayer player = source as GamePlayer;
			Scholar scholar = target as Scholar;
			if (player == null || scholar == null)
				return false;

			if (Step == 2 && ArtifactMgr.GetArtifactID(item.Name) == ArtifactID)
			{
				Dictionary<String, ItemTemplate> versions = ArtifactMgr.GetArtifactVersions(ArtifactID,
					(eCharacterClass)player.CharacterClass.ID, (eRealm)player.Realm);

				if (versions.Count > 0 && RemoveItem(player, item))
				{
					GiveItem(scholar, player, ArtifactID, versions[";;"]);
					String reply = String.Format("Ahh. This is a tale about some great {0} {1} {2} {3}.",
						"crazy champion named Remus. There's not much known about him, or his father,",
						"except what is in this tale. I've read pieces of it, but never did we find all",
						"the letters. It's a great find. Thank you,",
						player.Name);
					scholar.TurnTo(player);
					scholar.SayTo(player, eChatLoc.CL_PopupWindow, reply);
					FinishQuest();
					return true;
				}
			}

			return false;
		}
Example #30
0
        public override bool CheckBeginCast(GameLiving selectedTarget)
        {
            if(!(Caster is GamePlayer))
            {
                return false;
            }
            /*
             * [Ganrod]Nidel: Like 1.90 EU off servers
             * -Need Main Turret under our controle before casting.
             * -Select automatically Main controlled Turret if player don't have target or Turret target.
             * -Cast only on our turrets.
             */
            if (Caster.ControlledBrain == null || Caster.ControlledBrain.Body == null)
            {
                MessageToCaster(LanguageMgr.GetTranslation((Caster as GamePlayer).Client, "PetPBAOE.CheckBeginCast.NoPet"), eChatType.CT_System);
                return false;
            }
            TurretPet target = selectedTarget as TurretPet;

            if(target == null || !Caster.IsControlledNPC(target))
            {
                target = Caster.ControlledBrain.Body as TurretPet;
            }
            return base.CheckBeginCast(target);
        }
Example #31
0
        public override bool IsSameRealm(GameLiving source, GameLiving target, bool quiet)
        {
            if (source == null || target == null)
            {
                return(false);
            }

            // if controlled NPC - do checks for owner instead
            if (source is GameNPC npc)
            {
                if (npc.Brain is IControlledBrain controlled)
                {
                    source = controlled.GetPlayerOwner();
                    quiet  = true; // silence all attacks by controlled npc
                }
            }

            if (target is GameNPC gameNpc)
            {
                if (gameNpc.Brain is IControlledBrain controlled)
                {
                    target = controlled.GetPlayerOwner();
                }
            }

            if (source == target)
            {
                return(true);
            }

            // clients with priv level > 1 are considered friendly by anyone
            if (target is GamePlayer player && player.Client.Account.PrivLevel > 1)
            {
                return(true);
            }

            // mobs can heal mobs, players heal players/NPC
            if (source.Realm == 0 && target.Realm == 0)
            {
                return(true);
            }

            if (source.Realm != 0 && target.Realm != 0)
            {
                return(true);
            }

            // Peace flag NPCs are same realm
            if (target is GameNPC npc1)
            {
                if ((npc1.Flags & GameNPC.eFlags.PEACE) != 0)
                {
                    return(true);
                }
            }

            if (source is GameNPC gameNpc1)
            {
                if ((gameNpc1.Flags & GameNPC.eFlags.PEACE) != 0)
                {
                    return(true);
                }
            }

            if (quiet == false)
            {
                MessageToLiving(source, $"{target.GetName(0, true)} is not a member of your realm!");
            }

            return(false);
        }
 public QuicknessAbilityBuffHandler(GameLiving caster, Spell spell, SpellLine line)
     : base(caster, spell, line)
 {
 }
Example #33
0
 public override int CalculateSpellResistChance(GameLiving target)
 {
     return(0);
 }
Example #34
0
 public DirectDamageDebuffSpellHandler(GameLiving caster, Spell spell, SpellLine line) : base(caster, spell, line)
 {
 }
Example #35
0
 private void SpellResisted(GameLiving target)
 {
     base.OnSpellResisted(target);
 }
Example #36
0
 // constructor
 public HealthToEndurance(GameLiving caster, Spell spell, SpellLine line) : base(caster, spell, line)
 {
 }
Example #37
0
 public override bool ReceiveItem(GameLiving source, DOL.Database.InventoryItem item)
 {
     //todo check if bullet
     return(base.ReceiveItem(source, item));
 }
Example #38
0
 public TraldorSpellHandler(GameLiving caster, Spell spell, SpellLine line) : base(caster, spell, line)
 {
 }
 public DexterityAbilityBuffHandler(GameLiving caster, Spell spell, SpellLine line)
     : base(caster, spell, line)
 {
 }
 public ConstitutionAbilityBuffHandler(GameLiving caster, Spell spell, SpellLine line)
     : base(caster, spell, line)
 {
 }
 protected SingleStatAbilityBuffHandler(GameLiving caster, Spell spell, SpellLine line)
     : base(caster, spell, line)
 {
 }
 public StrengthAbilityBuffHandler(GameLiving caster, Spell spell, SpellLine line)
     : base(caster, spell, line)
 {
 }
 protected override void SendUpdates(GameLiving target)
 {
     target.UpdateHealthManaEndu();
 }
 public override void ApplyEffectOnTarget(GameLiving target, double effectiveness)
 {
     // Ability Bonus are not modified by any effectiveness modifier
     base.ApplyEffectOnTarget(target, 1.0);
 }
Example #45
0
 /// <summary>
 /// Find Immunity Effects by spellHandler Type
 /// Inner Method to get Enumerable For LINQ.
 /// </summary>
 /// <param name="target">Living to find effect on</param>
 /// <param name="spellHandler">Effect Type to find (Exact Type Match)</param>
 /// <returns>All Immunity State GameSpellEffect matching SpellHandler Type in target's effect list</returns>
 private static IEnumerable <GameSpellEffect> ImmunityEffectsOnTarget(this GameLiving target, Type spellHandler)
 {
     return(target.EffectList.OfType <GameSpellEffect>().Where(fx => (fx is GameSpellAndImmunityEffect && ((GameSpellAndImmunityEffect)fx).ImmunityState) &&
                                                               fx.SpellHandler != null && fx.SpellHandler.GetType() == spellHandler));
 }
Example #46
0
 /// <summary>
 /// Find Game Spell Effects by spell object
 /// Inner Method to get Enumerable For LINQ.
 /// </summary>
 /// <param name="target">Living to find effect on</param>
 /// <param name="spell">Spell Object to Find (Spell.ID Match)</param>
 /// <returns>All GameSpellEffect build from spell in target's effect list or null</returns>
 private static IEnumerable <GameSpellEffect> EffectsOnTarget(this GameLiving target, Spell spell)
 {
     return(target.EffectList.OfType <GameSpellEffect>().Where(fx => !(fx is GameSpellAndImmunityEffect && ((GameSpellAndImmunityEffect)fx).ImmunityState) &&
                                                               fx.Spell.ID == spell.ID));
 }
Example #47
0
 /// <summary>
 /// Find pulsing spells effect by spell handler
 /// Inner Method to get Enumerable For LINQ.
 /// </summary>
 /// <param name="target">Living to find effect on</param>
 /// <param name="handler">Spell Handler to find (Exact Object Match)</param>
 /// <returns>All PulsingSpellEffect Matching SpellHandler in targets' concentration list</returns>
 private static IEnumerable <PulsingSpellEffect> PulsingSpellsOnTarget(this GameLiving target, ISpellHandler handler)
 {
     return(target.ConcentrationEffects.OfType <PulsingSpellEffect>().Where(pfx => pfx.SpellHandler == handler));
 }
Example #48
0
 /// <summary>
 /// Find Static Effects by Effect Type
 /// Inner Method to get Enumerable For LINQ.
 /// </summary>
 /// <param name="target">Living to find effect on</param>
 /// <param name="effectType">Effect Type to find (Exact Type Match)</param>
 /// <returns>All IGameEffect matching Effect Type in target's effect list</returns>
 private static IEnumerable <IGameEffect> StaticEffectsOnTarget(this GameLiving target, Type effectType)
 {
     return(target.EffectList.Where(fx => fx.GetType() == effectType));
 }
Example #49
0
 /// <summary>
 /// Find effects by spell handler Type hierarchically
 /// Inner Method to get Enumerable For LINQ.
 /// </summary>
 /// <param name="target">Living to find effect on</param>
 /// <param name="spellHandler">Spell Handler to find (Exact Object Match)</param>
 /// <returns>All GameSpellEffect matching SpellHandler in target's effect list</returns>
 private static IEnumerable <GameSpellEffect> EffectsOnTarget(this GameLiving target, Type spellHandler)
 {
     return(target.EffectList.OfType <GameSpellEffect>().Where(fx => !(fx is GameSpellAndImmunityEffect && ((GameSpellAndImmunityEffect)fx).ImmunityState) &&
                                                               spellHandler.IsInstanceOfType(fx.SpellHandler)));
 }
Example #50
0
 /// <summary>
 /// Find Pulsing Spell Effects by spell object
 /// Inner Method to get Enumerable For LINQ.
 /// </summary>
 /// <param name="target">Living to find effect on</param>
 /// <param name="spell">Spell Object to Find (Spell.ID Match)</param>
 /// <returns>All PulsingSpellEffect build from spell in target's concentration list or null</returns>
 private static IEnumerable <PulsingSpellEffect> PulsingSpellsOnTarget(this GameLiving target, Spell spell)
 {
     return(target.ConcentrationEffects.OfType <PulsingSpellEffect>().Where(pfx => pfx.SpellHandler?.Spell != null && pfx.SpellHandler.Spell.ID == spell.ID));
 }
        public override void SendLivingEquipmentUpdate(GameLiving living)
        {
            if (m_gameClient.Player == null || living.IsVisibleTo(m_gameClient.Player) == false)
            {
                return;
            }

            using (GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.EquipmentUpdate)))
            {
                ICollection <InventoryItem> items = null;
                if (living.Inventory != null)
                {
                    items = living.Inventory.VisibleItems;
                }

                pak.WriteShort((ushort)living.ObjectID);
                pak.WriteByte((byte)((living.IsCloakHoodUp ? 0x01 : 0x00) | (int)living.ActiveQuiverSlot));                 //bit0 is hood up bit4 to 7 is active quiver

                pak.WriteByte((byte)living.VisibleActiveWeaponSlots);
                if (items != null)
                {
                    pak.WriteByte((byte)items.Count);
                    foreach (InventoryItem item in items)
                    {
                        ushort model   = (ushort)(item.Model & 0x1FFF);
                        int    slot    = item.SlotPosition;
                        int    texture = (item.Emblem != 0) ? item.Emblem : item.Color;
                        if (item.SlotPosition == Slot.LEFTHAND || item.SlotPosition == Slot.CLOAK) // for test only cloack and shield
                        {
                            slot = slot | ((texture & 0x010000) >> 9);                             // slot & 0x80 if new emblem
                        }
                        pak.WriteByte((byte)slot);
                        if ((texture & ~0xFF) != 0)
                        {
                            model |= 0x8000;
                        }
                        else if ((texture & 0xFF) != 0)
                        {
                            model |= 0x4000;
                        }
                        if (item.Effect != 0)
                        {
                            model |= 0x2000;
                        }

                        pak.WriteShort(model);

                        if (item.SlotPosition > Slot.RANGED || item.SlotPosition < Slot.RIGHTHAND)
                        {
                            pak.WriteByte((byte)item.Extension);
                        }

                        if ((texture & ~0xFF) != 0)
                        {
                            pak.WriteShort((ushort)texture);
                        }
                        else if ((texture & 0xFF) != 0)
                        {
                            pak.WriteByte((byte)texture);
                        }
                        if (item.Effect != 0)
                        {
                            pak.WriteByte((byte)item.Effect);
                        }
                    }
                }
                else
                {
                    pak.WriteByte(0x00);
                }
                SendTCP(pak);
            }
        }
Example #52
0
 /// <summary>
 /// Find Game Spell Effects by spell Type
 /// Inner Method to get Enumerable For LINQ.
 /// </summary>
 /// <param name="target">Living to find effect on</param>
 /// <param name="spellType">Spell Type to Find</param>
 /// <returns>All GameSpellEffect according to Type and Name in target's effect list or null</returns>
 private static IEnumerable <GameSpellEffect> EffectsOnTarget(this GameLiving target, string spellType)
 {
     return(target.EffectList.OfType <GameSpellEffect>().Where(fx => !(fx is GameSpellAndImmunityEffect && ((GameSpellAndImmunityEffect)fx).ImmunityState) &&
                                                               fx.Spell != null && fx.Spell.SpellType.Equals(spellType)));
 }
Example #53
0
 public override bool IsAllowedToUnderstand(GameLiving source, GamePlayer target)
 {
     return(true);
 }
Example #54
0
        public override bool IsAllowedToAttack(GameLiving attacker, GameLiving defender, bool quiet)
        {
            if (!base.IsAllowedToAttack(attacker, defender, quiet))
            {
                return(false);
            }

            // if controlled NPC - do checks for owner instead
            if (attacker is GameNPC npc)
            {
                if (npc.Brain is IControlledBrain controlled)
                {
                    attacker = controlled.GetPlayerOwner();
                    quiet    = true; // silence all attacks by controlled npc
                }
            }

            if (defender is GameNPC gameNpc)
            {
                if (gameNpc.Brain is IControlledBrain controlled)
                {
                    defender = controlled.GetPlayerOwner();
                }
            }

            // "You can't attack yourself!"
            if (attacker == defender)
            {
                if (quiet == false)
                {
                    MessageToLiving(attacker, "You can't attack yourself!");
                }

                return(false);
            }

            // Pet release might cause one of these to be null
            if (attacker == null || defender == null)
            {
                return(false);
            }

            if (attacker.Realm != eRealm.None && defender.Realm != eRealm.None)
            {
                if (attacker is GamePlayer player && player.DuelTarget == defender)
                {
                    return(true);
                }

                if (quiet == false)
                {
                    MessageToLiving(attacker, "You can not attack other players on this server!");
                }

                return(false);
            }

            // allow attacks on same realm only under the following circumstances
            if (attacker.Realm == defender.Realm)
            {
                // allow confused mobs to attack same realm
                if (attacker is GameNPC && ((GameNPC)attacker).IsConfused)
                {
                    return(true);
                }

                // else, don't allow mobs to attack mobs
                if (attacker.Realm == eRealm.None)
                {
                    return(FactionMgr.CanLivingAttack(attacker, defender));
                }

                if (quiet == false)
                {
                    MessageToLiving(attacker, "You can't attack a member of your realm!");
                }

                return(false);
            }

            return(true);
        }
Example #55
0
 public BracerOfZo(GameLiving caster, Spell spell, SpellLine line) : base(caster, spell, line)
 {
 }
Example #56
0
 public override bool IsAllowedToTrade(GameLiving source, GameLiving target, bool quiet)
 {
     return(true);
 }
Example #57
0
 public BomberSpellHandler(GameLiving caster, Spell spell, SpellLine line) : base(caster, spell, line)
 {
     m_isSilent = true;
 }
Example #58
0
 public override void CastSubSpells(GameLiving target)
 {
 }
Example #59
0
 /// <summary>
 /// Constructs a new WhsiperReceiveEventArgs
 /// </summary>
 /// <param name="source">the source of the whisper</param>
 /// <param name="target">the target of the whisper</param>
 /// <param name="text">the text being whispered</param>
 public WhisperReceiveEventArgs(GameLiving source, GameLiving target, string text) : base(source, target, text)
 {
 }
Example #60
0
 protected override IControlledBrain GetPetBrain(GameLiving owner)
 {
     return(new BomberBrain(owner));
 }