Jump to content
Sign in to follow this  
gmedannik

[LUA] Авто-фрукты - это легко!

Recommended Posts

---------------------------------
-- Авто-фрукты by GreM --
---------------------------------


-- [1 Шаг]  Добавляем в cha_timer

 

local ElfItem, FruitItem = GetChaItem(role, 2, 1), GetChaItem(role, 2, 3)
local ElfType, FruitID = GetItemType(ElfItem), GetItemID(FruitItem)

if (ElfType == 59) then

    if (AutoFruit[FruitID] ~= nil) then
    
        local ChaIsBoat = GetCtrlBoat(role)

        if (ChaIsBoat == nil) then
    
            local Elf_Str = GetItemAttr(ElfItem, ITEMATTR_VAL_STR)
            local Elf_Con = GetItemAttr(ElfItem, ITEMATTR_VAL_CON)
            local Elf_Agi = GetItemAttr(ElfItem, ITEMATTR_VAL_AGI)
            local Elf_Dex = GetItemAttr(ElfItem, ITEMATTR_VAL_DEX)
            local Elf_Sta = GetItemAttr(ElfItem, ITEMATTR_VAL_STA)
            local Elf_Lv = Elf_Str + Elf_Con + Elf_Agi + Elf_Dex + Elf_Sta

            if (Elf_Lv >= AutoFruit[FruitID].min_lv and (Elf_Lv + AutoFruit[FruitID].count_up) <= AutoFruit[FruitID].max_lv) then
                    
                local Check_Exp = CheckElf_EXP(role, ElfItem)
                
                if (Check_Exp == 1) then
    
                    if (DelBagItem2(role, FruitItem, 1)) then
    
                        AutoFruit[FruitID].func(role, FruitID, ElfItem)
                        
                    end
                
                end
        
            end
      
        end
    
    end
  
end

 

-- [2 Шаг]  Заменяем стандартные функции фруктов

 

Ищем:

Lvup_Dex(role, Item_Num, Item_Traget)


Заменяем на:

Lvup_Dex = function(role, Item_Num, Item_Traget)

 

Внимание: Это нужно проделать для всех функций фруктов.

 

-- [3 Шаг]  Добавляем в variable.

 

AutoFruit = {}
AutoFruit[226] = {func = Lvup_Dex, min_lv = 0, max_lv = 100, count_up = 1}

 

Что бы добавить новый фрукт, просто создайте новую строку.

 

Формат строки: AutoFruit[id фрукта] {func = название функции фрукта, min_lv = мин. ур. феи, max_lv = макс. ур. феи, count_up = на сколько увеличит фрукт уровень феи}

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...