How can we load slk file from the MPQ

Status
Not open for further replies.
Level 11
Joined
Dec 3, 2011
Messages
366
JASS:
library UnitData requires Table, TimerUtils
//! loaddata "UnitData.slk"

    struct UnitData
        readonly static Table tb
        readonly integer id
        readonly real m
        readonly boolean g
        
        static method operator [] takes integer id returns thistype
            return tb[id]
        endmethod
        
        private static method saveData takes nothing returns nothing
            local timer t = GetExpiredTimer()
            local thistype this = GetTimerData(t)
            set tb[.id] = this
            call ReleaseTimer(t)
            set t = null
        endmethod
        
        static method getFromKey takes integer i returns thistype
            local thistype this = tb[i]
            if this == 0 then
                set tb[i] = create()
                set this = tb[i]
            endif
            call TimerStart(NewTimerEx(this), 0, false, function thistype.saveData)
            return this
        endmethod
        
        private static method init takes nothing returns nothing
            local integer index= 5
            loop
                call getFromKey(index)
                set index = index - 1
                exitwhen index == 0
            endloop
        endmethod
        
        static method onInit takes nothing returns nothing
            set tb = Table.create()
        endmethod
        
        implement InitTimer
    endstruct
    
endlibrary

It's working well, but I'm trying to find a way to get data from slk file of MPQ.
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
As I said, take an MPQ editor and extract from the Warcraft III\war3patch.mpq or where the latest version of the file is in.

FileExporter does not seem to work, only for maps and specific files.

You can also use my postproc or jmpq if you want to do it programmatically.

You do not actually have to extract it all the time, do you? So just do it once and okay.
 
Status
Not open for further replies.
Top