Jump to content
Sign in to follow this  
gmedannik

[LUA] Auto-fruit - its easy!

Recommended Posts

-----------------------------
-- Auto Fruit by GreM --
-----------------------------


-- [1 Step]  Add into 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 Step]  Change fruit default function

 

Search:

Lvup_Dex(role, Item_Num, Item_Traget)


Change to:

Lvup_Dex = function(role, Item_Num, Item_Traget)

 

Warning: This needs to be done for all the fruit default function.

 

-- [3 Step]  Add into variable

 

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

 

 

To add a new fruit, just add a new line.

 

Line formate: AutoFruit[fruit id] {func = function name, min_lv = min fairy lv, max_lv = max fairy lv, count_up = count add param}

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...