diff --git a/doc/changelog.txt b/doc/changelog.txt index 94f14a4..f47a3a9 100644 --- a/doc/changelog.txt +++ b/doc/changelog.txt @@ -1,3 +1,2 @@ -2014-12-20 v0.4.10 - Add doc subdirectory and changelog.txt - \ No newline at end of file +2015-03-16 v1 + Basic functionality complete diff --git a/doc/description.txt b/doc/description.txt new file mode 100644 index 0000000..2118e92 --- /dev/null +++ b/doc/description.txt @@ -0,0 +1,22 @@ +This addon keeps track of when research items will complete for all your characters. +It is similar to Ato's "Craft Research Timer", however it does a lot less. +The dialog isn't configurable and no, you can't move it. +No, it doesn't pop up alerts. (Wykkeds' taskbar can help with this) + +You pop it up for a look in game, plan and put it away. + +What is does, it does well. +The list of upcoming research completions is sorted. +The soonest are on top. + +It comes with a little viewer that can show the same information from your desktop, without having to start the game. + + +To use: +/rt to open and close dialog or create a keybinding. + + + +The saved variables file is written with current information when you logout of that character. + + diff --git a/doc/offline_use.txt b/doc/offline_use.txt new file mode 100644 index 0000000..778ce4e --- /dev/null +++ b/doc/offline_use.txt @@ -0,0 +1,42 @@ +The program "RTOffline.lua" will read the saved variables files and presents a grid on your windows desktop. +To use it you need a copy of IUP for lua which you can download from here. + +The site page: http://webserver2.tecgraf.puc-rio.br/iup/ +download http://sourceforge.net/projects/iup/files/3.13/ + + + + + +This is a zip archive which contains 2 versions of Lua with the IUP Dlls. +It also contains some exe programs that we don't need. +Unzip it and move stuff around if you want. +The basic is in directory \IUP\Lua52 All else can be discarded. + +Lua52 contains a command line exe (lua52.exe) that has a console--good for debugging and a windows exe, wlua52.exe + + + +Open RTOffline.lua in a text editor. + +Review this line. + +dateformat = "%d/%m, %H:%M" + +This formats the date display. + +Edit this line +local allcraft = ResearchTimer["Default"]["@MYACCOUNTNAME"]["$AccountWide"]["Craft"] + +the part MYACCOUNTNAME must be changed to your account name. + +Create a shortcut on your desktop for the lua52.exe. +Edit its properties, change the "Start in" to the Addons/SavedVariables Folder. + +Run. When it works ok, you can edit the shortcut to use wlua52.exe + + + +tada. Feel free to edit + +-Dad diff --git a/lua/RTOffline.lua b/lua/RTOffline.lua new file mode 100644 index 0000000..ab2e8f0 --- /dev/null +++ b/lua/RTOffline.lua @@ -0,0 +1,85 @@ +--Licence: No restriction and no responsibility +dateformat = "%d/%m, %H:%M" + +require( "iuplua" ) +require( "iupluacontrols" ) + +dofile "C:/iup/prog/ResearchTimer.lua" + +function dump(o) + if type(o) == 'table' then + local s = '{ ' + for k,v in pairs(o) do + if type(k) ~= 'number' then k = '"'..k..'"' end + s = s .. '['..k..'] = ' .. dump(v) .. ',' + end + return s .. '} ' + else + return tostring(o) + end +end + +local i =0 k =0 + +for i,_ in pairs(ResearchTimer["Default"]) do -- Only one entry + myaccount = i +end + +local allcraft = ResearchTimer["Default"][myaccount]["$AccountWide"]["Craft"] + +-- print (dump (allcraft)) +local summary = {} names = {} + for char, _ in pairs(allcraft) do + if allcraft[char]["shortest"] ~= nil -- Some chars may have incorrect data. Just Skip. + then +-- print (allcraft[char]["shortest"]); + summary[char] = {} + for craft, _ in pairs (allcraft[char]) do + summary[char][craft] = {} + summary[char][craft]["Finished"] = 0 + end + table.insert (names, char) + end + end +lines= #names + +table.sort(names, function (a,b) return allcraft[a].shortest < allcraft[b].shortest end) + + +mat = iup.matrix {numcol=3, numlin=lines, numlin_visible = lines, numcol_visible=3, widthdef=150,heightdef=40} +mat.resizematrix = "YES" +mat.hidefocus = "YES" +mat.multiline = "YES" +mat.readonly = "YES" + +mat:setcell(0,0,"Character") +mat:setcell(0,1,"Blacksmithing") +mat:setcell(0,2,"Clothing") +mat:setcell(0,3,"Woodworking") + +for k, char in ipairs(names) do +mat:setcell(k,0,char) + + for thiscraft = 0,2 do -- cant use ipairs as it starts from 0. can't use pairs, has "shortest" as key + local itemstr = "" itempadded = "" + for thisdoing, thisitem in pairs(allcraft[char][thiscraft].doing) do + --print (thisitem.Item_name) + itempadded = thisitem.Item_name .. "\\" .. thisitem.Trait_name .. string.rep("-", 40) + itempadded = string.sub(itempadded,1,26) + itemstr = itemstr .. itempadded .. " " .. os.date(dateformat,thisitem.EndTimeStamp) .. "\n" + end + + mat:setcell(k,thiscraft+1, string.sub(itemstr, 1, string.len(itemstr)-1)) -- cut trailing newline + end +end + + +dlg = iup.dialog{iup.vbox{mat; margin="10x10"}} + +dlg:showxy(iup.CENTER, iup.CENTER) +dlg.title="Research" + +if (iup.MainLoopLevel()==0) then + iup.MainLoop() +end +