示例#1
0
        public static void CastAtXY(SkillType Skill, SkillHand Hand, int TargetX, int TargetY)
        {
            PC Me = new PC();

            if (Me.GetSkillOnHand(Hand) != Skill)
            {
                Me.SetSkill(Skill, Hand);
                int count = 0;
                while (true)
                {
                    if (Me.GetSkillOnHand(Hand) == Skill)
                    {
                        break;
                    }
                    Thread.Sleep(20);
                    count++;
                    if (count > 50)
                    {
                        throw new ApplicationException("Could not set skill on the given hand");
                    }
                }
            }

            int click = 3;

            if (Hand == SkillHand.Left)
            {
                click = 0;
            }
            Me.ClickMap((ClickType)click, false, TargetX, TargetY);
            Thread.Sleep(100);
            Me.ClickMap((ClickType)(click + 2), false, TargetX, TargetY);
            //return;

            if (Me.Mode == PlayerMode.Cast)
            {
                if (!ModeWait(PlayerMode.Cast, false))
                {
                    throw new ApplicationException("Could not start casting");
                }
            }

            if (!ModeWait(PlayerMode.Neutral, false))
            {
                throw new ApplicationException("Could not detect end of casting");
            }
        }
 public static byte[] Build(SkillType skill, SkillHand hand, uint chargedItemUID)
 {
     byte[] buffer = new byte[9];
     buffer[0] = 60;
     buffer[1] = (byte) skill;
     buffer[2] = (byte) (((ushort) skill) >> 8);
     buffer[4] = (hand == SkillHand.Left) ? ((byte) 0x80) : ((byte) 0);
     buffer[5] = (byte) chargedItemUID;
     buffer[6] = (byte) (chargedItemUID >> 8);
     buffer[7] = (byte) (chargedItemUID >> 0x10);
     buffer[8] = (byte) (chargedItemUID >> 0x18);
     return buffer;
 }
 public static byte[] Build(SkillType skill, SkillHand hand)
 {
     return Build(skill, hand, uint.MaxValue);
 }
 public SelectSkill(SkillType skill, SkillHand hand, uint chargedItemUID)
     : base(Build(skill, hand, chargedItemUID))
 {
     this.skill = skill;
     this.hand = hand;
     this.chargedItemUID = chargedItemUID;
 }
 public SelectSkill(SkillType skill, SkillHand hand)
     : base(Build(skill, hand))
 {
     this.skill = skill;
     this.hand = hand;
     this.chargedItemUID = 0;
 }
 // Methods
 public SelectSkill(byte[] data)
     : base(data)
 {
     this.skill = (SkillType) BitConverter.ToUInt16(data, 1);
     if (data[4] == 0x80)
     {
     this.hand = SkillHand.Left;
     }
     this.chargedItemUID = BitConverter.ToUInt32(data, 5);
     if (this.chargedItemUID == uint.MaxValue)
     {
     this.chargedItemUID = 0;
     }
 }
 // Methods
 public AssignSkill(byte[] data)
     : base(data)
 {
     this.unitType = (UnitType) data[1];
     this.uid = BitConverter.ToUInt32(data, 2);
     this.hand = (SkillHand) data[6];
     this.skill = (SkillType) BitConverter.ToUInt16(data, 7);
     this.chargedItemUID = BitConverter.ToUInt32(data, 9);
 }