예제 #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);
            }
        }
예제 #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);
		}
예제 #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);
            }
        }
예제 #4
0
		public void Deserialize()
		{
			var test = new MabiDictionary();
			test.Parse("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;");

			Assert.Equal(true, test.GetBool("a bool"));
			Assert.Equal(1, test.GetByte("a byte"));
			Assert.Equal(2, test.GetShort("a short"));
			Assert.Equal(3, test.GetInt("an int"));
			Assert.Equal(4, test.GetFloat("a float"));
			Assert.Equal("five, special chars :;", test.GetString("a string"));
		}
예제 #5
0
        public void Deserialize()
        {
            var test = new MabiDictionary();

            test.Parse("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;");

            Assert.Equal(true, test.GetBool("a bool"));
            Assert.Equal(1, test.GetByte("a byte"));
            Assert.Equal(2, test.GetShort("a short"));
            Assert.Equal(3, test.GetInt("an int"));
            Assert.Equal(4, test.GetFloat("a float"));
            Assert.Equal("five, special chars :;", test.GetString("a string"));
        }
예제 #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);
		}
예제 #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);
		}
예제 #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);
            }
        }