Unlock() public méthode

Deactivates given Locks for creature.
Unlocking movement on the client apparently resets skill stuns.
public Unlock ( Locks locks, bool updateClient = false ) : Locks
locks Locks Locks to deactivate.
updateClient bool Sends CharacterUnlock to client if true.
Résultat Locks
Exemple #1
0
		/// <summary>
		/// Prepares the skill, called to start casting.
		/// </summary>
		/// <param name="creature"></param>
		/// <param name="skill"></param>
		/// <param name="packet"></param>
		public override bool Prepare(Creature creature, Skill skill, Packet packet)
		{
			Send.SkillFlashEffect(creature);
			Send.SkillPrepare(creature, skill.Info.Id, skill.GetCastTime());

			// Default lock is Walk|Run, since renovation you're not able to
			// move while loading anymore.
			if (AuraData.FeaturesDb.IsEnabled("TalentRenovationCloseCombat"))
			{
				creature.StopMove();
			}
			// Since the client locks Walk|Run by default we have to tell it
			// to enable walk but disable run (under any circumstances) if
			// renovation is disabled.
			else
			{
				creature.Lock(Locks.Run, true);
				creature.Unlock(Locks.Walk, true);
			}

			return true;
		}
Exemple #2
0
		/// <summary>
		/// Cancels special effects.
		/// </summary>
		/// <param name="creature"></param>
		/// <param name="skill"></param>
		public override void Cancel(Creature creature, Skill skill)
		{
			// Updating unlock because of the updating lock for pre-renovation
			if (!AuraData.FeaturesDb.IsEnabled("TalentRenovationCloseCombat"))
			{
				creature.Unlock(Locks.Run, true);

				// For some reason the client won't actually unlock Run,
				// unless the unlock is sent twice.
				creature.Unlock(Locks.Run, true);
			}
		}
Exemple #3
0
		/// <summary>
		/// Cancels special effects.
		/// </summary>
		/// <param name="creature"></param>
		/// <param name="skill"></param>
		public override void Cancel(Creature creature, Skill skill)
		{
			// Updating unlock because of the updating lock for pre-renovation
			if (!AuraData.FeaturesDb.IsEnabled("TalentRenovationCloseCombat"))
				creature.Unlock(Locks.Run, true);
		}
Exemple #4
0
		/// <summary>
		/// Handles usage of the skill.
		/// </summary>
		/// <param name="attacker"></param>
		/// <param name="target"></param>
		public void Use(Creature attacker, Creature target)
		{
			// Updating unlock because of the updating lock for pre-renovation
			// Has to be done here because we can't have an updating unlock
			// after the combat action, it resets the stun.
			if (!AuraData.FeaturesDb.IsEnabled("TalentRenovationCloseCombat"))
				attacker.Unlock(Locks.Move, true);

			var skill = attacker.Skills.Get(SkillId.Counterattack);

			var aAction = new AttackerAction(CombatActionType.RangeHit, attacker, SkillId.Counterattack, target.EntityId);
			aAction.Options |= AttackerOptions.Result | AttackerOptions.KnockBackHit2;

			var tAction = new TargetAction(CombatActionType.CounteredHit2, target, attacker, target.Skills.IsReady(SkillId.Smash) ? SkillId.Smash : SkillId.CombatMastery);
			tAction.Options |= TargetOptions.Result | TargetOptions.Smash;

			var cap = new CombatActionPack(attacker, skill.Info.Id);
			cap.Add(aAction, tAction);

			var damage =
				(attacker.GetRndTotalDamage() * (skill.RankData.Var2 / 100f)) +
				(target.GetRndTotalDamage() * (skill.RankData.Var1 / 100f));

			var critChance = attacker.GetTotalCritChance(target.Protection) + skill.RankData.Var3;

			CriticalHit.Handle(attacker, critChance, ref damage, tAction, true);
			SkillHelper.HandleDefenseProtection(target, ref damage, true, true);

			target.TakeDamage(tAction.Damage = damage, attacker);

			target.Aggro(attacker);

			if (target.IsDead)
				tAction.Options |= TargetOptions.FinishingKnockDown;

			aAction.Stun = StunTime;
			tAction.Stun = StunTime;

			target.Stability = Creature.MinStability;
			attacker.Shove(target, KnockbackDistance);

			// Update both weapons
			SkillHelper.UpdateWeapon(attacker, target, attacker.RightHand, attacker.LeftHand);

			Send.SkillUseStun(attacker, skill.Info.Id, StunTime, 1);

			this.Training(aAction, tAction);

			cap.Handle();
		}
Exemple #5
0
		/// <summary>
		/// Cancels special effects.
		/// </summary>
		/// <param name="creature"></param>
		/// <param name="skill"></param>
		public override void Cancel(Creature creature, Skill skill)
		{
			// Updating unlock because of the updating lock for pre-renovation.
			// Since moving isn't locked by default when using a skill it's
			// apparently not unlocked by default either.
			if (!AuraData.FeaturesDb.IsEnabled("TalentRenovationCloseCombat"))
				creature.Unlock(Locks.Move, true);
		}
Exemple #6
0
		/// <summary>
		/// Handles usage of the skill.
		/// </summary>
		/// <param name="attacker"></param>
		/// <param name="target"></param>
		public void Use(Creature attacker, Creature target)
		{
			// Updating unlock because of the updating lock for pre-renovation
			// Has to be done here because we can't have an updating unlock
			// after the combat action, it resets the stun.
			if (!AuraData.FeaturesDb.IsEnabled("TalentRenovationCloseCombat"))
			{
				attacker.Unlock(Locks.Run, true);
				attacker.Unlock(Locks.Move, true);
			}

			var skill = attacker.Skills.Get(SkillId.Counterattack);

			var aAction = new AttackerAction(CombatActionType.RangeHit, attacker, SkillId.Counterattack, target.EntityId);
			aAction.Options |= AttackerOptions.Result | AttackerOptions.KnockBackHit2;

			var tAction = new TargetAction(CombatActionType.CounteredHit2, target, attacker, target.Skills.IsReady(SkillId.Smash) ? SkillId.Smash : SkillId.CombatMastery);
			tAction.Options |= TargetOptions.Result | TargetOptions.Smash;

			var cap = new CombatActionPack(attacker, skill.Info.Id);
			cap.Add(aAction, tAction);

			float damage;
			if (attacker.RightHand != null && attacker.RightHand.Data.HasTag("/weapon/gun/"))   //TODO: Only do this when out of ammo.
			{
				damage = (attacker.GetRndBareHandDamage() * (skill.RankData.Var2 / 100f)) +
				(target.GetRndTotalDamage() * (skill.RankData.Var1 / 100f));
			}
			else
			{
				damage = (attacker.GetRndTotalDamage() * (skill.RankData.Var2 / 100f)) +
				(target.GetRndTotalDamage() * (skill.RankData.Var1 / 100f));
			}


			var critShieldReduction = (target.LeftHand != null ? target.LeftHand.Data.DefenseBonusCrit : 0);
			var critChance = attacker.GetTotalCritChance(target.Protection + critShieldReduction) + skill.RankData.Var3;

			CriticalHit.Handle(attacker, critChance, ref damage, tAction, true);
			var maxDamage = damage; //Damage without Defense and Protection
			SkillHelper.HandleDefenseProtection(target, ref damage, true, true);
			ManaShield.Handle(target, ref damage, tAction, maxDamage);

			target.TakeDamage(tAction.Damage = damage, attacker);

			target.Aggro(attacker);

			if (target.IsDead)
				tAction.Options |= TargetOptions.FinishingKnockDown;


			if (attacker.IsCharacter && AuraData.FeaturesDb.IsEnabled("CombatSystemRenewal"))
			{
				aAction.Stun = 2000;
			}
			else
			{
				aAction.Stun = AttackStunTime;
			}
			tAction.Stun = StunTime;

			target.Stability = Creature.MinStability;
			attacker.Shove(target, KnockbackDistance);

			// Update both weapons
			SkillHelper.UpdateWeapon(attacker, target, attacker.RightHand, attacker.LeftHand);

			Send.SkillUseStun(attacker, skill.Info.Id, aAction.Stun, 1);

			this.Training(aAction, tAction);

			cap.Handle();
		}
		/// <summary>
		/// Uses skill, attempting to place the stone.
		/// </summary>
		/// <param name="creature"></param>
		/// <param name="skill"></param>
		/// <param name="packet"></param>
		public void Use(Creature creature, Skill skill, Packet packet)
		{
			var locationId = packet.GetLong();
			var unkInt1 = packet.GetInt();
			var unkInt2 = packet.GetInt();

			var guild = creature.Guild;
			var region = creature.Region;
			var pos = new Position(locationId);
			var creaturePos = creature.GetPosition();

			// Check range
			if (!creaturePos.InRange(pos, MaxStoneDistance))
			{
				creature.Unlock(Locks.Walk | Locks.Run);

				Send.Notice(creature, Localization.Get("You're too far away."));
				Send.SkillUseSilentCancel(creature);
				return;
			}

			// Check distance to other stones
			var otherStones = region.GetProps(a => a.HasTag("/guildstone/") && a.GetPosition().InRange(pos, MinStoneDistance));
			if (otherStones.Count != 0)
			{
				creature.Unlock(Locks.Walk | Locks.Run);

				Send.Notice(creature, Localization.Get("You're too close to another Guild Stone to put yours up."));
				Send.SkillUseSilentCancel(creature);
				return;
			}

			// Check street
			if (creature.Region.IsOnStreet(pos))
			{
				Send.Notice(creature, Localization.Get("You can't place a Guild Stone on the street."));
				Send.SkillUseSilentCancel(creature);
				return;
			}

			// Place stone (from complete)
			creature.Skills.Callback(skill.Info.Id, () =>
			{
				guild.Stone.PropId = GuildStonePropId.Normal;
				guild.Stone.RegionId = region.Id;
				guild.Stone.X = pos.X;
				guild.Stone.Y = pos.Y;
				guild.Stone.Direction = MabiMath.ByteToRadian(creature.Direction);

				ChannelServer.Instance.GuildManager.SetStone(guild);

				Send.Notice(NoticeType.Top, 20000, Localization.Get("{0} Guild has been formed. Guild Leader : {1}"), guild.Name, guild.LeaderName);

				creature.Inventory.Remove(63041); // Guild Stone Installation Permit
			});

			// TODO: Skills that don't necessarily end in Use need a way to get
			//   back to Ready, we currently don't properly support that.
			//   Use will probably require a return value, like Prepare.
			//   Temporary solution: working with stacks.
			skill.Stacks = 0;

			Send.Echo(creature, Op.SkillUse, packet);
		}