Razor:Mining

Z Endor Revived Wiki

Verze z 12. 2. 2024, 20:45, kterou vytvořil FuzzyBot (diskuse | příspěvky) (Stránka aktualizována, aby odpovídala nové verzi zdrojové stránky)
(rozdíl) ← Starší verze | zobrazit aktuální verzi (rozdíl) | Novější verze → (rozdíl)

Tento skript těží do pěti směrů - 4 kolmé na nakonfigurovaný směr chůze a jeden přímo pod vámi. Když je těchto 5 polí vytěženo, skript vás přesune o jedno pole v nakonfigurovaném směru, veškerou nakonfigurovanou rudu vyhodí z batohu na zem a dá rudu pod vaši postavu. Varování - veme to veškerou rudu 2 pole od vaší postavy, takže se držte dál od jiných hráčů, pokud ovšem nemilujete drama. 😊

Požadavky

  • Mějte lopatu nebo krumpáč v ruce a nejlépe i nějaké náhradní ve svém batohu.
  • Běžte do jeskyně, ve které se dá těžit.

Skript

// Mining
// version 1.1
//
// Changelog:
// 1.1: added food checking

if listexists 'mine-direction'
    removelist 'mine-direction'
endif
createlist 'mine-direction'
if listexists 'mine-orehues'
    removelist 'mine-orehues'    
endif
createlist 'mine-orehues'
if listexists 'mine-foodtypes'
    removelist 'mine-foodtypes'    
endif
createlist 'mine-foodtypes'

### start of configuration ###

# change mining direction here
# must be exactly one of these values: West East North South
pushlist 'mine-direction' 'West'

# change which ores you want dropped on ground and dragged behind here
# note that if ore drops to ground due to weight and is not listed here it will be left on the spot
# iron ore
pushlist 'mine-orehues' "0"
# copper ore
pushlist 'mine-orehues' "1118"
# tin ore
pushlist 'mine-orehues' "2401"
# lead ore
pushlist 'mine-orehues' "1045"
# zinc ore
pushlist 'mine-orehues' "2403"
# silver ore
pushlist 'mine-orehues' "2951"
# gold ore
pushlist 'mine-orehues' "2213"
# gorinite ore
pushlist 'mine-orehues' "1645"
# chlorite ore
pushlist 'mine-orehues' "2128"
# hieronite ore
pushlist 'mine-orehues' "2428"
# sangvine ore
pushlist 'mine-orehues' "41"
# arite ore
pushlist 'mine-orehues' "1344"

# change which foods do you want to try to consume from your backpack
# cuts of ribs
pushlist 'mine-foodtypes' 2546
# fish steak 
pushlist 'mine-foodtypes' 2427

### end of configuration ###

if listexists 'mine-locations'
    removelist 'mine-locations'
endif
createlist 'mine-locations'
pushlist 'mine-locations' -2
pushlist 'mine-locations' -1
pushlist 'mine-locations' 0
pushlist 'mine-locations' 1
pushlist 'mine-locations' 2

# eat
setvar! 'mine-hungry' 1
while varexist! 'mine-hungry'
    clearsysmsg 

    setvar! 'mine-eating' 1
    foreach foodtype in 'mine-foodtypes'
        if varexist! 'mine-eating' and findtype foodtype 'backpack' as 'food'
            dclick 'food'
            unsetvar! 'mine-eating'
            wait 250
        endif
    endfor
    
    if varexist! 'mine-eating'
        sysmsg 'Warning: no food'
        unsetvar! 'mine-hungry'
    endif
    
    if insysmsg 'You are too full to eat any more'
        unsetvar! 'mine-hungry'
    endif
    
endwhile

# cut gems
@clearignore
while findtype 5031 'backpack' as 'chunk'
    if findtype 7868 'backpack' 5 as 'tool'
        clearsysmsg 
        dclick 'tool'
        waitfortarget 
        target 'chunk'
        while 1 = 1
            if insysmsg 'Your tool broke'
                break;
            endif
            if insysmsg 'You have created a gem'
                break;
            endif
            if insysmsg 'You have failed to create a gem'
                break;
            endif
            
            wait 50
        endwhile
        wait 250
    else
        break
    endif
endwhile

# mine locations
foreach loc in 'mine-locations'
    if inlist 'mine-direction' 'West' or inlist 'mine-direction' 'East'
        sysmsg 'Mining at 0 {{loc}}'
    elseif inlist 'mine-direction' 'North' or inlist 'mine-direction' 'south'
        sysmsg 'Mining at {{loc}} 0'
    else
        sysmsg 'Mining direction is misconfigured'
        stop
    endif

    setvar! 'mine_minespot' 1
    while varexist 'mine_minespot'
        clearsysmsg
        
        // shovel > rhand > pickaxe in bag
        if findtype 3897 'backpack' as 'tool'
            dclick 'tool'    
        elseif not rhandempty
            hotkey 'use item in hand'
        elseif findtype 3718 'backpack' as 'tool' or findtype 3717 'backpack' as 'tool'
            dress 'tool'
            while rhandempty
                wait 50
            endwhile
            wait 500
            dclick 'tool'
        else
            sysmsg 'No tool found'
            stop
        endif
        
        waitfortarget 
        if inlist 'mine-direction' 'West' or inlist 'mine-direction' 'East'
            targetrelloc 0 loc
        elseif inlist 'mine-direction' 'North' or inlist 'mine-direction' 'south'
            targetrelloc loc 0
        else
            sysmsg 'Mining direction is misconfigured'
            stop
        endif
        
        setvar! 'mine_wait' 1
        while varexist 'mine_wait'
            if insysmsg 'You can mine only from cave floor' or insysmsg 'That is too far away' or insysmsg "You cannot see that"
                unsetvar! 'mine_wait'
                unsetvar! 'mine_minespot'
            elseif insysmsg 'there is no more'
                unsetvar! 'mine_wait'
                unsetvar! 'mine_minespot'
            elseif insysmsg 'tool broke'
                unsetvar! 'mine_wait'
            endif
            wait 500
        endwhile

    endwhile
endfor

# change direction to next spot
foreach step in 'mine-direction'
    walk step
endfor
# make step on next spot
foreach step in 'mine-direction'
    walk step
endfor

wait 500

# drop ores from backpack
@clearignore
foreach orehue in 'mine-orehues'
    while findtype 6585 'backpack' orehue as 'backpackstack'
        @ignore 'backpackstack'
        while findtype 6585 'backpack' orehue as 'otherstack'
            @ignore 'otherstack'
        endwhile
        
        lift 'backpackstack' 0
        if findtype 6585 true orehue as 'groundstack'
            sysmsg 'Dropping {{orehue}} to ground stack'
            drop 'groundstack'
        else
            sysmsg 'Dropping {{orehue}} to ground location'
            droprelloc 0 0
        endif
        wait 150
        
        @clearignore
    endwhile
endfor

wait 500

# drag ores under our character
@clearignore
foreach orehue in 'mine-orehues'
    // backpack ores should have been dropped already
    // but to be sure lets ignore them
    while findtype 6585 'backpack' orehue as 'stack'
        @ignore 'stack'
    endwhile
    
    // first stack
    unsetvar! 'minevacuumgroundstack';
    while findtype 6585 true orehue as 'stack'
        lift 'stack' 0
        if varexist! 'minevacuumgroundstack'
            drop 'minevacuumgroundstack'
        else
            droprelloc 0 0
            setvar! 'minevacuumgroundstack' 'stack'
        endif
        wait 150
        @ignore 'stack'
    endwhile
endfor

wait 500

// pickup all chunks
@clearignore
while findtype 5031 'backpack' as 'chunk'
    @ignore 'chunk'
endwhile
while findtype 5031 true as 'chunk'
    lift 'chunk' 0
    drop 'backpack' -1 -1
    wait 150
    @ignore 'chunk'
endwhile

// go again
loop