
Originally Posted by
Woffen
A simple solution (on our side) is to simply autoload bootstrap or similar plugin managers which in turn loads the plugins without the bug.. I think?
This still causes the problems with the shortcuts, because Bootstrap still loads the plugins before the backpack is accessible to the plugins. The solution I presented to Dvarlin/MrJackdaw works, unfortunately it still doesn't correct the problem when you run out of an item in your backpack and then buy a new stack or if you merge stacks in a certain way - your quickslot will still disappear once you reload the plugin.
I'm starting to think there's no good way to fix this problem (the quickslots clearing problem that is, since I'm pretty sure my fix corrects using the LOTRO Plugin Manager problem, though both are connected in a way, and until both are fixed, both problems will consist in some form or fashion). Last night with the help of Lunarwtr from LOTROInterface I was able to make quickslots appear even if you didn't have the actual item in your inventory, by converting the Data string you insert into the constructor for a shortcut (Shortcut(Type, Data)) to make the first number before the comma all zeros. Unfortunately this seems to break the actual quickslot so you can't even click on it if you do have that item in your inventory, though when you first click on the quickslot it seems to fix it, so after that you can use the quickslot normally, but it doesn't always work, sometimes the quickslot remains broken, other times it gets fixed.
I think the best solution to this would be to have Turbine add a method to get the Data string from an item in your inventory, something like this:
Code:
backpack = Turbine.Gameplay.LocalPlayer:GetInstance():GetBackpack()
item = backpack:GetItem(indexOfItem)
data = item:GetData()
then you could create a quickslot from that information:
Code:
shortcut = Turbine.UI.Lotro.Shortcut(Turbine.UI.Lotro.ShortcutType.Item, data)
Though another solution would be to allow to pass in an Item object from the backpack into the Shortcut constructor:
Code:
shortcut = Turbine.UI.Lotro.Shortcut(Turbine.UI.Lotro.ShortcutType.Item, item)
For anyone that's still reading and interested, the data string passed into the Shortcut constructor is composed of two parts: the first part is "0x030A0002A920344A" for example, seems to only point to the actual stack of an item, and is pretty much unique to just that stack. In other words, two stacks of the same item will have different numbers/letters even if they are the same size and same item. The second part is the hex number that refers to the item, which is unique only to the actually item, and is used for any stacks. So two stacks of Traveling Rations will have different first parts, but have the same hex number for the second part. You can generate the hex number using the Lorebook ID numbers.
You can "point" to any stack (or no stack at all) by converting the first part to all 0s, like this: "0x0000000000000000". This is what I was talking about in the second paragraph. As an easy example of what I'm talking about, you can use this code to see the broken quickslots in action:
Code:
import "Turbine";
import "Turbine.Gameplay";
import "Turbine.UI";
import "Turbine.UI.Lotro";
Window=Turbine.UI.Window();
Window:SetSize(200,200);
Window:SetPosition(Turbine.UI.Display:GetWidth()/2-100,Turbine.UI.Display:GetHeight()/2-100);
Window:SetText("Test");
Window:SetVisible(true);
quickslots = Turbine.UI.Lotro.Quickslot();
quickslots:SetParent(Window);
quickslots:SetVisible(true);
quickslots:SetOpacity(1);
quickslots:SetSize( 36, 36 );
quickslots:SetPosition( 0, 0);
quickslots:SetShortcut(Turbine.UI.Lotro.Shortcut(2, "0x0000000000000000,0x700017E2")) -- this sets the shortcut to traveling rations whether you have them in your inventory or not
Turbine.Shell.WriteLine("Test Item name: "..quickslots:GetShortcut():GetItem():GetName())
Turbine.Shell.WriteLine("Test Shortcutdata: "..quickslots:GetShortcut():GetData())
function quickslots:ShortcutChanged(sender, args)
Turbine.Shell.WriteLine("Name: "..quickslots:GetShortcut():GetItem():GetName())
Turbine.Shell.WriteLine("Data: "..quickslots:GetShortcut():GetData())
end
If you don't have any traveling rations in your inventory, you'll see a quickslot in the middle of your screen that is grayed out and can't be used. If you do have traveling rations in your inventory, you'll see a quickslot that is normal looking, however, if you try to left or right click on it, nothing happens (the sandglass icon should briefly appear in the quickslot if it were working correctly). To get it to work, you must REMOVE the stack of traveling rations from your inventory (into your bank or sell them), and then add them back into your inventory. If you then click on the quickslot again nothing will happen, but you'll get the chat output of the name and data string. Then clicking it again and it'll work like a normal quickslot. It seems the quickslot doesn't try to update until you click on it, and then once you do it finds the link its looking for, which is why it updates (it changes the data string to match the one found in inventory). If there was a way to get the quickslot to do this prior to you clicking on it, then that would be a pretty decent solution, but I can't get it to do so, since it doesn't fire the ShortcutChanged event until you click on it, and there's no way to programmically click the quickslot right when it loads to get that first click out of the way.
Perhaps someone else can figure out a way to get it to update?
You can also use this code to experiment with the data strings to see what you get.
Overall I'm going to stick with the LOTRO Plugin Manager because so far I haven't had any problems with my plugins once I removed the Glan Vraig map from the Travel plugin and BevyOBars has a fix in place that removes the loading bug (even if I still have to set up quickslots when I run out power potions, which I do way too often), and none of the other plugins I use have had problems (Aura, BuffBars - only use the slider and buff list though, CombatAnalysis, VBar, and anything else I load if I need it). Hopefully now that the LOTRO Plugin Manager is in place it can be refined a bit in future updates.