Ejemplo n.º 1
0
        public void Complete(Creature creature, Skill skill, Packet packet)
        {
            var str  = packet.GetString();
            var dict = new MabiDictionary(str);

            var hwEntityId = dict.GetLong("ITEMID");

            if (hwEntityId == 0)
            {
                goto L_End;
            }

            var hw = creature.Inventory.GetItemSafe(hwEntityId);

            if (!hw.HasTag("/large_blessing_potion/"))
            {
                goto L_End;
            }

            // TODO: Check loading time

            var items = creature.Inventory.GetEquipment(a => a.IsBlessable);

            creature.Bless(items);
            creature.Inventory.Decrement(hw, 1);

L_End:
            Send.UseMotion(creature, 14, 0);
            Send.SkillComplete(creature, skill.Info.Id, str);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Starts rest skill.
        /// </summary>
        /// <param name="creature"></param>
        /// <param name="skill"></param>
        /// <param name="dict"></param>
        /// <returns></returns>
        public override StartStopResult Start(Creature creature, Skill skill, MabiDictionary dict)
        {
            creature.StopMove();

            var chairItemEntityId = dict.GetLong("ITEMID");

            if (chairItemEntityId != 0)
            {
                this.SetUpChair(creature, chairItemEntityId);
            }

            creature.Activate(CreatureStates.SitDown);
            if (skill.Info.Rank >= SkillRank.R9)
            {
                creature.Activate(CreatureStatesEx.RestR9);
            }

            Send.SitDown(creature);

            creature.Regens.Add("Rest", Stat.Life, (0.12f * ((skill.RankData.Var1 - 100) / 100)), creature.LifeMax);
            creature.Regens.Add("Rest", Stat.Stamina, (0.4f * ((skill.RankData.Var2 - 100) / 100)), creature.StaminaMax);
            creature.Regens.Add("Rest", Stat.LifeInjured, skill.RankData.Var3, creature.LifeMax);

            if (skill.Info.Rank == SkillRank.Novice)
            {
                skill.Train(1);                                                  // Use Rest.
            }
            return(StartStopResult.Okay);
        }
Ejemplo n.º 3
0
		public void Complete(Creature creature, Skill skill, Packet packet)
		{
			var str = packet.GetString();
			var dict = new MabiDictionary(str);

			var hwEntityId = dict.GetLong("ITEMID");
			if (hwEntityId == 0)
				goto L_End;

			var hw = creature.Inventory.GetItemSafe(hwEntityId);
			if (!hw.HasTag("/large_blessing_potion/"))
				goto L_End;

			// TODO: Check loading time

			var items = creature.Inventory.GetEquipment();
			foreach (var item in items)
			{
				var blessable = (item.HasTag("/equip/") && !item.HasTag("/not_bless/"));

				if (blessable)
					item.OptionInfo.Flags |= ItemFlags.Blessed;
			}

			creature.Inventory.Decrement(hw, 1);
			Send.ItemBlessed(creature, items);

		L_End:
			Send.UseMotion(creature, 14, 0);
			Send.SkillComplete(creature, skill.Info.Id, str);
		}
Ejemplo n.º 4
0
        public override StartStopResult Start(Creature creature, Skill skill, MabiDictionary dict)
        {
            creature.StopMove();

            var chairItemEntityId = dict.GetLong("ITEMID");

            if (chairItemEntityId != 0)
                this.SetUpChair(creature, chairItemEntityId);

            creature.Activate(CreatureStates.SitDown);
            Send.SitDown(creature);

            creature.Regens.Add("Rest", Stat.Life, (0.12f * ((skill.RankData.Var1 - 100) / 100)), creature.LifeMax);
            creature.Regens.Add("Rest", Stat.Stamina, (0.4f * ((skill.RankData.Var2 - 100) / 100)), creature.StaminaMax);
            creature.Regens.Add("Rest", Stat.LifeInjured, skill.RankData.Var3, creature.LifeMax);

            if (skill.Info.Rank == SkillRank.Novice) skill.Train(1); // Use Rest.

            return StartStopResult.Okay;
        }
Ejemplo n.º 5
0
        public void Complete(Creature creature, Skill skill, Packet packet)
        {
            var str  = packet.GetString();
            var dict = new MabiDictionary(str);

            var hwEntityId = dict.GetLong("ITEMID");

            if (hwEntityId == 0)
            {
                goto L_End;
            }

            var hw = creature.Inventory.GetItemSafe(hwEntityId);

            if (!hw.HasTag("/large_blessing_potion/"))
            {
                goto L_End;
            }

            // TODO: Check loading time

            var items = creature.Inventory.GetEquipment();

            foreach (var item in items)
            {
                var blessable = (item.HasTag("/equip/") && !item.HasTag("/not_bless/"));

                if (blessable)
                {
                    item.OptionInfo.Flags |= ItemFlags.Blessed;
                }
            }

            creature.Inventory.Decrement(hw, 1);
            Send.ItemBlessed(creature, items);

L_End:
            Send.UseMotion(creature, 14, 0);
            Send.SkillComplete(creature, skill.Info.Id, str);
        }
Ejemplo n.º 6
0
Archivo: Rest.cs Proyecto: xKamuna/aura
		/// <summary>
		/// Starts rest skill.
		/// </summary>
		/// <param name="creature"></param>
		/// <param name="skill"></param>
		/// <param name="dict"></param>
		/// <returns></returns>
		public override StartStopResult Start(Creature creature, Skill skill, MabiDictionary dict)
		{
			creature.StopMove();

			creature.IsInBattleStance = false;
			creature.AttemptingAttack = false;

			var chairItemEntityId = dict.GetLong("ITEMID");

			if (chairItemEntityId != 0)
				this.SetUpChair(creature, chairItemEntityId);

			creature.Activate(CreatureStates.SitDown);
			if (skill.Info.Rank >= SkillRank.R9)
				creature.Activate(CreatureStatesEx.RestR9);

			Send.SitDown(creature);

			// Get bonuses if meditation isn't active.
			if (!creature.Conditions.Has(ConditionsE.Meditation))
			{
				ApplyRestBonus(creature, skill, chairItemEntityId);
			}
			else
			{
				RestCampfireBonus(creature, skill, chairItemEntityId);
			}

			// Add bonus from campfire
			// TODO: Check for disappearing of campfire? (OnDisappears+Recheck)
			var campfires = creature.Region.GetProps(a => a.Info.Id == 203 && a.GetPosition().InRange(creature.GetPosition(), 500));
			if (campfires.Count > 0)
			{
				Send.Notice(creature, Localization.Get("The fire feels very warm."));
			}

			if (skill.Info.Rank == SkillRank.Novice) skill.Train(1); // Use Rest.

			return StartStopResult.Okay;
		}
Ejemplo n.º 7
0
		public void Complete(Creature creature, Skill skill, Packet packet)
		{
			var str = packet.GetString();
			var dict = new MabiDictionary(str);

			var hwEntityId = dict.GetLong("ITEMID");
			if (hwEntityId == 0)
				goto L_End;

			var hw = creature.Inventory.GetItemSafe(hwEntityId);
			if (!hw.HasTag("/large_blessing_potion/"))
				goto L_End;

			// TODO: Check loading time

			var items = creature.Inventory.GetEquipment(a => a.IsBlessable);
			creature.Bless(items);
			creature.Inventory.Decrement(hw, 1);

		L_End:
			Send.UseMotion(creature, 14, 0);
			Send.SkillComplete(creature, skill.Info.Id, str);
		}
Ejemplo n.º 8
0
        /// <summary>
        /// Starts rest skill.
        /// </summary>
        /// <param name="creature"></param>
        /// <param name="skill"></param>
        /// <param name="dict"></param>
        /// <returns></returns>
        public override StartStopResult Start(Creature creature, Skill skill, MabiDictionary dict)
        {
            creature.StopMove();

            var chairItemEntityId = dict.GetLong("ITEMID");

            if (chairItemEntityId != 0)
            {
                this.SetUpChair(creature, chairItemEntityId);
            }

            creature.Activate(CreatureStates.SitDown);
            if (skill.Info.Rank >= SkillRank.R9)
            {
                creature.Activate(CreatureStatesEx.RestR9);
            }

            Send.SitDown(creature);

            // Get base bonuses
            var bonusLife    = ((skill.RankData.Var1 - 100) / 100);
            var bonusStamina = ((skill.RankData.Var2 - 100) / 100);
            var bonusInjury  = skill.RankData.Var3;

            // Add bonus from campfire
            // TODO: Check for disappearing of campfire? (OnDisappears+Recheck)
            var campfires = creature.Region.GetProps(a => a.Info.Id == 203 && a.GetPosition().InRange(creature.GetPosition(), 500));

            if (campfires.Count > 0)
            {
                // Add bonus if no chair?
                if (chairItemEntityId == 0)
                {
                    // TODO: Select nearest? Random?
                    var campfire = campfires[0];

                    var multi = (campfire.Temp.CampfireSkillRank != null ? campfire.Temp.CampfireSkillRank.Var1 / 100f : 1);

                    // Add bonus for better wood.
                    // Amounts unofficial.
                    if (campfire.Temp.CampfireFirewood != null)
                    {
                        if (campfire.Temp.CampfireFirewood.HasTag("/firewood01/"))
                        {
                            multi += 0.1f;
                        }
                        else if (campfire.Temp.CampfireFirewood.HasTag("/firewood02/"))
                        {
                            multi += 0.2f;
                        }
                        else if (campfire.Temp.CampfireFirewood.HasTag("/firewood03/"))
                        {
                            multi += 0.3f;
                        }
                    }

                    // Apply multiplicator
                    bonusLife    *= multi;
                    bonusStamina *= multi;
                    bonusInjury  *= multi;
                }

                Send.Notice(creature, Localization.Get("The fire feels very warm"));
            }

            creature.Regens.Add("Rest", Stat.Life, (0.12f * bonusLife), creature.LifeMax);
            creature.Regens.Add("Rest", Stat.Stamina, (0.4f * bonusStamina), creature.StaminaMax);
            creature.Regens.Add("Rest", Stat.LifeInjured, bonusInjury, creature.LifeMax);             // TODO: Test if LifeInjured = Injuries

            if (skill.Info.Rank == SkillRank.Novice)
            {
                skill.Train(1);                                                  // Use Rest.
            }
            return(StartStopResult.Okay);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Starts rest skill.
        /// </summary>
        /// <param name="creature"></param>
        /// <param name="skill"></param>
        /// <param name="dict"></param>
        /// <returns></returns>
        public override StartStopResult Start(Creature creature, Skill skill, MabiDictionary dict)
        {
            creature.StopMove();

            var chairItemEntityId = dict.GetLong("ITEMID");

            if (chairItemEntityId != 0)
            {
                this.SetUpChair(creature, chairItemEntityId);
            }
            else
            {
                // Find all nearby sittable props and sit on closest one
                var crpos = creature.GetPosition();
                var props = creature.Region.GetProps(prop => prop.HasTag("/sittable/") &&
                                                     (!prop.HasXml || prop.Xml.Attribute("SITCHAR") == null || prop.Xml.Attribute("SITCHAR").Value == "0") &&
                                                     prop.GetPosition().GetDistance(crpos) < 125);
                if (props.Count > 0)
                {
                    int nearest = 0;
                    int minDist = 125;
                    for (int i = 0; i < props.Count; i++)
                    {
                        var dist = crpos.GetDistance(props[i].GetPosition());
                        if (dist < minDist)
                        {
                            nearest = i;
                            minDist = dist;
                        }
                    }
                    this.SitOnProp(creature, props[nearest]);
                }
            }

            creature.Activate(CreatureStates.SitDown);
            if (skill.Info.Rank >= SkillRank.R9)
            {
                creature.Activate(CreatureStatesEx.RestR9);
            }

            Send.SitDown(creature);

            // Get base bonuses
            var bonusLife    = ((skill.RankData.Var1 - 100) / 100);
            var bonusStamina = ((skill.RankData.Var2 - 100) / 100);
            var bonusInjury  = skill.RankData.Var3;

            // Add bonus from campfire
            // TODO: Check for disappearing of campfire? (OnDisappears+Recheck)
            var campfires = creature.Region.GetProps(a => a.Info.Id == 203 && a.GetPosition().InRange(creature.GetPosition(), 500));

            if (campfires.Count > 0)
            {
                // Add bonus if no chair?
                if (chairItemEntityId == 0)
                {
                    // TODO: Select nearest? Random?
                    var campfire = campfires[0];

                    var multi = (campfire.Temp.CampfireSkillRank != null ? campfire.Temp.CampfireSkillRank.Var1 / 100f : 1);

                    // Add bonus for better wood.
                    // Amounts unofficial.
                    if (campfire.Temp.CampfireFirewood != null)
                    {
                        if (campfire.Temp.CampfireFirewood.HasTag("/firewood01/"))
                        {
                            multi += 0.1f;
                        }
                        else if (campfire.Temp.CampfireFirewood.HasTag("/firewood02/"))
                        {
                            multi += 0.2f;
                        }
                        else if (campfire.Temp.CampfireFirewood.HasTag("/firewood03/"))
                        {
                            multi += 0.3f;
                        }
                    }

                    // Apply multiplicator
                    bonusLife    *= multi;
                    bonusStamina *= multi;
                    bonusInjury  *= multi;
                }

                Send.Notice(creature, Localization.Get("The fire feels very warm"));
            }

            creature.Regens.Add("Rest", Stat.Life, (0.12f * bonusLife), creature.LifeMax);
            creature.Regens.Add("Rest", Stat.Stamina, (0.4f * bonusStamina), creature.StaminaMax);
            creature.Regens.Add("Rest", Stat.LifeInjured, bonusInjury, creature.LifeMax);             // TODO: Test if LifeInjured = Injuries

            if (skill.Info.Rank == SkillRank.Novice)
            {
                skill.Train(1);                                                  // Use Rest.
            }
            return(StartStopResult.Okay);
        }
Ejemplo n.º 10
0
		/// <summary>
		/// Starts rest skill.
		/// </summary>
		/// <param name="creature"></param>
		/// <param name="skill"></param>
		/// <param name="dict"></param>
		/// <returns></returns>
		public override StartStopResult Start(Creature creature, Skill skill, MabiDictionary dict)
		{
			creature.StopMove();

			var chairItemEntityId = dict.GetLong("ITEMID");

			if (chairItemEntityId != 0)
				this.SetUpChair(creature, chairItemEntityId);
			else
			{
				// Find all nearby sittable props and sit on closest one
				var crpos = creature.GetPosition();
				var props = creature.Region.GetProps(prop => prop.HasTag("/sittable/")
					&& (!prop.HasXml || prop.Xml.Attribute("SITCHAR") == null || prop.Xml.Attribute("SITCHAR").Value == "0")
					&& prop.GetPosition().GetDistance(crpos) < 125);
				if (props.Count > 0)
				{
					int nearest = 0;
					int minDist = 125;
					for (int i = 0; i < props.Count; i++)
					{
						var dist = crpos.GetDistance(props[i].GetPosition());
						if(dist < minDist)
						{
							nearest = i;
							minDist = dist;
						}
					}
					this.SitOnProp(creature, props[nearest]);
				}
			}

			creature.Activate(CreatureStates.SitDown);
			if (skill.Info.Rank >= SkillRank.R9)
				creature.Activate(CreatureStatesEx.RestR9);

			Send.SitDown(creature);

			// Get base bonuses
			var bonusLife = ((skill.RankData.Var1 - 100) / 100);
			var bonusStamina = ((skill.RankData.Var2 - 100) / 100);
			var bonusInjury = skill.RankData.Var3;

			// Add bonus from campfire
			// TODO: Check for disappearing of campfire? (OnDisappears+Recheck)
			var campfires = creature.Region.GetProps(a => a.Info.Id == 203 && a.GetPosition().InRange(creature.GetPosition(), 500));
			if (campfires.Count > 0)
			{
				// Add bonus if no chair?
				if (chairItemEntityId == 0)
				{
					// TODO: Select nearest? Random?
					var campfire = campfires[0];

					var multi = (campfire.Temp.CampfireSkillRank != null ? campfire.Temp.CampfireSkillRank.Var1 / 100f : 1);

					// Add bonus for better wood.
					// Amounts unofficial.
					if (campfire.Temp.CampfireFirewood != null)
					{
						if (campfire.Temp.CampfireFirewood.HasTag("/firewood01/"))
							multi += 0.1f;
						else if (campfire.Temp.CampfireFirewood.HasTag("/firewood02/"))
							multi += 0.2f;
						else if (campfire.Temp.CampfireFirewood.HasTag("/firewood03/"))
							multi += 0.3f;
					}

					// Apply multiplicator
					bonusLife *= multi;
					bonusStamina *= multi;
					bonusInjury *= multi;
				}

				Send.Notice(creature, Localization.Get("The fire feels very warm"));
			}

			creature.Regens.Add("Rest", Stat.Life, (0.12f * bonusLife), creature.LifeMax);
			creature.Regens.Add("Rest", Stat.Stamina, (0.4f * bonusStamina), creature.StaminaMax);
			creature.Regens.Add("Rest", Stat.LifeInjured, bonusInjury, creature.LifeMax); // TODO: Test if LifeInjured = Injuries

			if (skill.Info.Rank == SkillRank.Novice) skill.Train(1); // Use Rest.

			return StartStopResult.Okay;
		}
Ejemplo n.º 11
0
		/// <summary>
		/// Starts rest skill.
		/// </summary>
		/// <param name="creature"></param>
		/// <param name="skill"></param>
		/// <param name="dict"></param>
		/// <returns></returns>
		public override StartStopResult Start(Creature creature, Skill skill, MabiDictionary dict)
		{
			creature.StopMove();

			var chairItemEntityId = dict.GetLong("ITEMID");

			if (chairItemEntityId != 0)
				this.SetUpChair(creature, chairItemEntityId);

			creature.Activate(CreatureStates.SitDown);
			if (skill.Info.Rank >= SkillRank.R9)
				creature.Activate(CreatureStatesEx.RestR9);

			Send.SitDown(creature);

			// Get base bonuses
			var bonusLife = ((skill.RankData.Var1 - 100) / 100);
			var bonusStamina = ((skill.RankData.Var2 - 100) / 100);
			var bonusInjury = skill.RankData.Var3;

			// Add bonus from campfire
			// TODO: Check for disappearing of campfire? (OnDisappears+Recheck)
			var campfires = creature.Region.GetProps(a => a.Info.Id == 203 && a.GetPosition().InRange(creature.GetPosition(), 500));
			if (campfires.Count > 0)
			{
				// Add bonus if no chair?
				if (chairItemEntityId == 0)
				{
					// TODO: Select nearest? Random?
					var campfire = campfires[0];

					var multi = (campfire.Temp.CampfireSkillRank != null ? campfire.Temp.CampfireSkillRank.Var1 / 100f : 1);

					// Add bonus for better wood.
					// Amounts unofficial.
					if (campfire.Temp.CampfireFirewood != null)
					{
						if (campfire.Temp.CampfireFirewood.HasTag("/firewood01/"))
							multi += 0.1f;
						else if (campfire.Temp.CampfireFirewood.HasTag("/firewood02/"))
							multi += 0.2f;
						else if (campfire.Temp.CampfireFirewood.HasTag("/firewood03/"))
							multi += 0.3f;
					}

					// Apply multiplicator
					bonusLife *= multi;
					bonusStamina *= multi;
					bonusInjury *= multi;
				}

				Send.Notice(creature, Localization.Get("The fire feels very warm"));
			}

			creature.Regens.Add("Rest", Stat.Life, (0.12f * bonusLife), creature.LifeMax);
			creature.Regens.Add("Rest", Stat.Stamina, (0.4f * bonusStamina), creature.StaminaMax);
			creature.Regens.Add("Rest", Stat.LifeInjured, bonusInjury, creature.LifeMax); // TODO: Test if LifeInjured = Injuries

			if (skill.Info.Rank == SkillRank.Novice) skill.Train(1); // Use Rest.

			return StartStopResult.Okay;
		}