lotrointerface.com
Search Downloads

LoTROInterface SVN SortPack

[/] [trunk/] [JackdawPlugins/] [SortPack/] [Load.lua] - Rev 150

Go to most recent revision | Compare with Previous | Blame | View Log

import "Turbine"
import "Turbine.UI"
import "Turbine.UI.Lotro"
import "Turbine.Gameplay"
import "Deusdictum.UI.Dragbar"
import  "JackdawPlugins.SortPack.Functions"
import  "JackdawPlugins.SortPack.Slash"

player = Turbine.Gameplay.LocalPlayer.GetInstance()
backpack = player:GetBackpack()
size =backpack:GetSize()

if not pcall(function() import "JackdawPlugins.Patch.Patch" end) then 
        --Turbine.Shell.WriteLine("Patch not present - default Load and Save used")
        JackdawPlugins.Patch={}
        function JackdawPlugins.Patch.Load(a,b,c) return Turbine.PluginData.Load(a,b,c) end
        function JackdawPlugins.Patch.Save(a,b,c,d) Turbine.PluginData.Save(a,b,c,d) end
end

local Player = player:GetName()
local savedata=JackdawPlugins.Patch.Load( Turbine.DataScope.Server, "SortPackData" )
if savedata~=nil then
        ItemCategory=savedata.ItemCategory
        CustomItem=savedata.CustomItem
        Groups=savedata.Groups
        if Groups==nil then Turbine.Shell.WriteLine("I am sorry, this new version of Sortpack uses groups and your old data has been lost. Please right click the SortPack icon to restore your order and see the new feature that makes this easier.") end
        if savedata[Player]~=nil then 
                SortButtonData=savedata[Player].SortButtonData 
                SB=savedata[Player].SB 
                Counter=savedata[Player].Counter
        end
else
        savedata={}
end

import"JackdawPlugins.SortPack.List"
import"JackdawPlugins.SortPack.Button"

Plugins["SortPack"].Unload = function( sender, args )

                Turbine.Shell.WriteLine("<rgb=#888888>Saved Sort Pack Data")
                SortButtonData.X,SortButtonData.Y=SortButton:GetPosition()
                local Player = Turbine.Gameplay.LocalPlayer.GetInstance():GetName()
                
                savedata.list=nil
                savedata.Groups=Groups
                savedata.CustomItem=CustomItem
                savedata.ItemCategory=ItemCategory
                savedata[Player]={}
                savedata[Player].SortButtonData=SortButtonData
                savedata[Player].SB=SB
                savedata[Player].Counter=Counter
                JackdawPlugins.Patch.Save( Turbine.DataScope.Server, "SortPackData", savedata )
end

--If the SortBag is to override the main data then better load it!
if SB~=nil then
        if SB.override then
                import "JackdawPlugins.SortPack.bag"
        end
end

--Load the onscreen bag counter
if Counter~=nil then
        if Counter.Show then
                import "JackdawPlugins.SortPack.Counter"
        end
end

Go to most recent revision | Compare with Previous | Blame


All times are GMT -5. The time now is 06:40 PM.


Our Network
EQInterface | EQ2Interface | Minion | WoWInterface | ESOUI | LoTROInterface | MMOUI | Swtorui