Exemplo n.º 1
0
        public void Stop(Creature creature, Skill skill, Packet packet)
        {
            var  stringParam = packet.NextIs(PacketElementType.String);
            var  dict        = new MabiDictionary();
            byte unkByte     = 0;

            if (stringParam)
            {
                dict.Parse(packet.GetString());
            }
            else if (packet.NextIs(PacketElementType.Byte))
            {
                unkByte = packet.GetByte();
            }

            var result = this.Stop(creature, skill, dict);

            skill.Deactivate(SkillFlags.InUse);

            if (result == StartStopResult.Fail)
            {
                Send.SkillStopSilentCancel(creature, skill.Info.Id);
            }
            else if (stringParam)
            {
                Send.SkillStop(creature, skill, dict.ToString());
            }
            else
            {
                Send.SkillStop(creature, skill, unkByte);
            }
        }
Exemplo n.º 2
0
		public void Start(Creature creature, Skill skill, Packet packet)
		{
			// Get parameters
			var stringParam = packet.NextIs(PacketElementType.String);
			var dict = new MabiDictionary();
			byte unkByte = 0;

			if (stringParam)
				dict.Parse(packet.GetString());
			else
				unkByte = packet.GetByte();

			// Run skill
			var result = this.Start(creature, skill, dict);

			if (result == StartStopResult.Fail)
			{
				Send.SkillStartSilentCancel(creature, skill.Info.Id);
				return;
			}

			skill.Activate(SkillFlags.InUse);

			Send.StatUpdate(creature, StatUpdateType.Private, Stat.Mana, Stat.Stamina);

			if (stringParam)
				Send.SkillStart(creature, skill, dict.ToString());
			else
				Send.SkillStart(creature, skill, unkByte);
		}
Exemplo n.º 3
0
        public void Start(Creature creature, Skill skill, Packet packet)
        {
            // Check mana and stamina
            if (!this.CheckMana(creature, skill))
            {
                Send.SystemMessage(creature, Localization.Get("Insufficient Mana"));
                Send.SkillStartSilentCancel(creature, skill.Info.Id);
                return;
            }
            if (!this.CheckStamina(creature, skill))
            {
                Send.SystemMessage(creature, Localization.Get("Insufficient Stamina"));
                Send.SkillStartSilentCancel(creature, skill.Info.Id);
                return;
            }

            // Get parameters
            var  stringParam = packet.NextIs(PacketElementType.String);
            var  dict        = new MabiDictionary();
            byte unkByte     = 0;

            if (stringParam)
            {
                dict.Parse(packet.GetString());
            }
            else
            {
                unkByte = packet.GetByte();
            }

            // Run skill
            var result = this.Start(creature, skill, dict);

            if (result == StartStopResult.Fail)
            {
                Send.SkillStartSilentCancel(creature, skill.Info.Id);
                return;
            }

            skill.Activate(SkillFlags.InUse);

            // Use mana/stamina
            this.UseMana(creature, skill);
            this.UseStamina(creature, skill);

            Send.StatUpdate(creature, StatUpdateType.Private, Stat.Mana, Stat.Stamina);

            if (stringParam)
            {
                Send.SkillStart(creature, skill, dict.ToString());
            }
            else
            {
                Send.SkillStart(creature, skill, unkByte);
            }
        }
Exemplo n.º 4
0
		public void Serialize()
		{
			var test = new MabiDictionary();
			test.SetBool("a bool", true);
			test.SetByte("a byte", 1);
			test.SetShort("a short", 2);
			test.SetInt("an int", 3);
			test.SetFloat("a float", 4);
			test.SetString("a string", "five, special chars :;");

			var test2 = test.ToString();

			Assert.Equal("a bool:b:1;a byte:1:1;a short:2:2;an int:4:3;a float:f:4;a string:s:five, special chars %C%S;", test2);
		}
Exemplo n.º 5
0
        public void Serialize()
        {
            var test = new MabiDictionary();

            test.SetBool("a bool", true);
            test.SetByte("a byte", 1);
            test.SetShort("a short", 2);
            test.SetInt("an int", 3);
            test.SetFloat("a float", 4);
            test.SetString("a string", "five, special chars :;");

            var test2 = test.ToString();

            Assert.Equal("a bool:b:1;a byte:1:1;a short:2:2;an int:4:3;a float:f:4;a string:s:five, special chars %C%S;", test2);
        }
Exemplo n.º 6
0
		public void Start(Creature creature, Skill skill, Packet packet)
		{
			// Check mana and stamina
			if (!this.CheckMana(creature, skill))
			{
				Send.SystemMessage(creature, Localization.Get("Insufficient Mana"));
				Send.SkillStartSilentCancel(creature, skill.Info.Id);
				return;
			}
			if (!this.CheckStamina(creature, skill))
			{
				Send.SystemMessage(creature, Localization.Get("Insufficient Stamina"));
				Send.SkillStartSilentCancel(creature, skill.Info.Id);
				return;
			}

			// Get parameters
			var stringParam = packet.NextIs(PacketElementType.String);
			var dict = new MabiDictionary();
			byte unkByte = 0;

			if (stringParam)
				dict.Parse(packet.GetString());
			else
				unkByte = packet.GetByte();

			// Run skill
			var result = this.Start(creature, skill, dict);

			if (result == StartStopResult.Fail)
			{
				Send.SkillStartSilentCancel(creature, skill.Info.Id);
				return;
			}

			skill.Activate(SkillFlags.InUse);

			// Use mana/stamina
			this.UseMana(creature, skill);
			this.UseStamina(creature, skill);

			Send.StatUpdate(creature, StatUpdateType.Private, Stat.Mana, Stat.Stamina);

			if (stringParam)
				Send.SkillStart(creature, skill, dict.ToString());
			else
				Send.SkillStart(creature, skill, unkByte);
		}
Exemplo n.º 7
0
		public void Stop(Creature creature, Skill skill, Packet packet)
		{
			var stringParam = packet.NextIs(PacketElementType.String);
			var dict = new MabiDictionary();
			byte unkByte = 0;

			if (stringParam)
				dict.Parse(packet.GetString());
			else if (packet.NextIs(PacketElementType.Byte))
				unkByte = packet.GetByte();

			var result = this.Stop(creature, skill, dict);

			skill.Deactivate(SkillFlags.InUse);

			if (result == StartStopResult.Fail)
				Send.SkillStopSilentCancel(creature, skill.Info.Id);
			else if (stringParam)
				Send.SkillStop(creature, skill, dict.ToString());
			else
				Send.SkillStop(creature, skill, unkByte);
		}
Exemplo n.º 8
0
        public void Start(Creature creature, Skill skill, Packet packet)
        {
            // Get parameters
            var  stringParam = packet.NextIs(PacketElementType.String);
            var  dict        = new MabiDictionary();
            byte unkByte     = 0;

            if (stringParam)
            {
                dict.Parse(packet.GetString());
            }
            else
            {
                unkByte = packet.GetByte();
            }

            // Run skill
            var result = this.Start(creature, skill, dict);

            if (result == StartStopResult.Fail)
            {
                Send.SkillStartSilentCancel(creature, skill.Info.Id);
                return;
            }

            skill.Activate(SkillFlags.InUse);

            Send.StatUpdate(creature, StatUpdateType.Private, Stat.Mana, Stat.Stamina);

            if (stringParam)
            {
                Send.SkillStart(creature, skill, dict.ToString());
            }
            else
            {
                Send.SkillStart(creature, skill, unkByte);
            }
        }