예제 #1
0
    private static void PoisonWeapon()
    {
        bool hasMainHandEnchant = Lua.LuaDoString <bool>
                                      (@"local hasMainHandEnchant, _, _, _, _, _, _, _, _ = GetWeaponEnchantInfo()
            if (hasMainHandEnchant) then 
               return '1'
            else
               return '0'
            end");

        bool hasOffHandEnchant = Lua.LuaDoString <bool>
                                     (@"local _, _, _, _, hasOffHandEnchant, _, _, _, _ = GetWeaponEnchantInfo()
            if (hasOffHandEnchant) then 
               return '1'
            else
               return '0'
            end");

        bool hasoffHandWeapon = Lua.LuaDoString <bool>(@"local hasWeapon = OffhandHasWeapon()
            return hasWeapon");

        if (!hasMainHandEnchant)
        {
            IEnumerable <uint> MP = DeadlyPoisonDictionary
                                    .Where(i => i.Key <= Me.Level && ItemsManager.HasItemById(i.Value))
                                    .OrderByDescending(i => i.Key)
                                    .Select(i => i.Value);

            if (MP.Any())
            {
                MHPoison = MP.First();
                ItemsManager.UseItem(MHPoison);
                Thread.Sleep(10);
                Lua.LuaDoString("/click PickupInventoryItem(17)");
                Thread.Sleep(5000);
                return;
            }
        }
        if (!hasOffHandEnchant && hasoffHandWeapon)
        {
            IEnumerable <uint> OP = InstantPoisonDictionary
                                    .Where(i => i.Key <= Me.Level && ItemsManager.HasItemById(i.Value))
                                    .OrderByDescending(i => i.Key)
                                    .Select(i => i.Value);

            if (OP.Any())
            {
                OHPoison = OP.First();
                ItemsManager.UseItem(MHPoison);
                Thread.Sleep(10);
                Lua.LuaDoString("/click PickupInventoryItem(18)");
                Thread.Sleep(5000);
                return;
            }
        }
    }
    private static void PoisonWeapon()
    {
        bool hasMainHandEnchant = Lua.LuaDoString <bool>
                                      (@"local hasMainHandEnchant, _, _, _, _, _, _, _, _ = GetWeaponEnchantInfo()
            if (hasMainHandEnchant) then 
               return '1'
            else
               return '0'
            end");

        bool hasOffHandEnchant = Lua.LuaDoString <bool>
                                     (@"local _, _, _, _, hasOffHandEnchant, _, _, _, _ = GetWeaponEnchantInfo()
            if (hasOffHandEnchant) then 
               return '1'
            else
               return '0'
            end");

        bool hasoffHandWeapon = Lua.LuaDoString <bool>(@"local hasWeapon = OffhandHasWeapon()
            return hasWeapon");

        if (!hasMainHandEnchant)
        {
            IEnumerable <uint> DP = DeadlyPoisonDictionary
                                    .Where(i => i.Key <= Me.Level && ItemsManager.HasItemById(i.Value))
                                    .OrderByDescending(i => i.Key)
                                    .Select(i => i.Value);

            IEnumerable <uint> IP = InstantPoisonDictionary
                                    .Where(i => i.Key <= Me.Level && ItemsManager.HasItemById(i.Value))
                                    .OrderByDescending(i => i.Key)
                                    .Select(i => i.Value);

            if (DP.Any() || IP.Any())
            {
                MovementManager.StopMoveTo(true, 1000);
                MHPoison = DP.Any() ? DP.First() : IP.First();
                ItemsManager.UseItem(MHPoison);
                Thread.Sleep(10);
                Lua.RunMacroText("/use 16");
                Usefuls.WaitIsCasting();
                return;
            }
        }
        if (!hasOffHandEnchant && hasoffHandWeapon)
        {
            IEnumerable <uint> IP = InstantPoisonDictionary
                                    .Where(i => i.Key <= Me.Level && ItemsManager.HasItemById(i.Value))
                                    .OrderByDescending(i => i.Key)
                                    .Select(i => i.Value);

            if (IP.Any())
            {
                MovementManager.StopMoveTo(true, 1000);
                OHPoison = IP.First();
                ItemsManager.UseItem(OHPoison);
                Thread.Sleep(10);
                Lua.RunMacroText("/use 17");
                Usefuls.WaitIsCasting();
                return;
            }
        }
    }