wallet
I'm working on a plugin to keep track of the items in our barter wallet that are now pooled across our account, tracking which of them should belong to which character. (And in the process, I'm working on learning LUA, which I've never worked with before.)
Looking through other people's code (Garan's Wallet and AltInventory plugins, and RandomAugury's WalletTracker) I've come across the GetWallet() function and the GetName(), GetQuantity(), and IsAccountItem() functions on individual currencies listed within that wallet. None of this, however, seems to be included in the LUA documentation I downloaded from this site. Is there a more up-to-date version of the documentation that includes these and (more importantly) would tell me what other methods and events are available to work with? Specifically, I'm looking for an event (and I'm hoping there is one) when a character either earns or spends Marks, Medallions, Commendations, etc. So far, I've taken care of setting up a table of currencies and characters, identifying who owns how many of which, and I've set up a UI window in which the player can assign their available currencies between their characters. That sort of manual assignment will be necessary during initial setup, and useful later on if a player wants to transfer some skirmish marks (or whatever) from one of their characters to another. But for the most part, I envision this plugin keeping track of them more automatically, so when a character earns skirmish marks, they're automatically assigned to that character, and when they're spent, they automatically come from the pool assigned to the character who's spending them. That part's going to require some event handling (which I still need to learn how to do in LUA). |
http://www.lotrointerface.com/downlo...-TitanBar.html
Titan bars is already doing some of the stuff your doing but you take a peek and see what else or more you can do. |
Ok, that's not much like what I'm doing, but going through the code I found where it adds the callback for "QuantityChanged" on each of the wallet items, and that piece looks straightforward enough. That at least should give me a trigger for knowing that something has happened.
Now the tricky part. I need to figure out what has happened. I can look up how many of the given item are in the wallet when the QuantityChanged event occurs, but in order to turn that into knowing how many were just added/removed, I would also need to know how many there had been just prior to the change. In my initial draft of this Per Character Wallet plugin (which, as I mentioned before, just has the manual assignments so far) I first tried initializing what currencies are in the wallet when the plugin was loaded, but found there's nothing there then. I switched it to initializing the first time the user invokes the plugin, which works well enough for something that only has display and manual input. Of course, it won't work so well once event triggers are added into the mix. I have no way of knowing whether the player will look at the plugin before earning any barter currencies. Is there any point at which I can safely do initializations? Sometime after the game loads the wallet information (which apparently occurs after plugins are loaded), but before any point when the player might earn or spend wallet currency? |
Sir Garan has also released an very good Wallet plugin :
http://www.lotrointerface.com/downlo...12-Wallet.html |
Quote:
What should happen when Turbine fixes their bug is that either all of the currencies that are already in the wallet should be available when the plugin loads or the ItemAdded event will fire as each existing currency gets initialized. Either mechanism will be sufficient to get away from the Update handler. As to knowing what has changed when a QuantityChanged event fires, you have to track the old value yourself and perform the comparison to see what change occured. Character contribution to shared currencies is something I was already considering for Wallet, but it seems to have limited usefulness so it got a pretty low priority on the ToDo list. |
Thanks. I'll try that workaround with Update to get the initializations done. Then I can work with the QuantityChanged and ItemAdded events to deal with assigning earned/spent currency. I think that gives me enough to work with for now, though I might have other questions come up as I get further into the project.
|
Quote:
And I'm still not quite sure when to decide the initialization is over and any currencies still not in the wallet are not available and should be deleted from my assignments. Maybe I'll just leave that part at when the player first opens my Per Character Wallet window like I had before. Hopefully, by the time the player is in game and opening windows, the game has finished loading. Quote:
Quote:
EDIT: Oh, and another question: Besides the ItemAdded event, is there a corresponding ItemDeleted event or something of the sort? Or does "ItemAdded" really mean any change in which items are included in the wallet? The wallet contains only currencies that the character has, so a currency would disappear from the wallet when a character spends their last of it. |
All times are GMT -5. The time now is 05:35 PM. |
vBulletin® - Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
© MMOUI