View Full Version : Adjusting Server Currency
trevius
03-11-2009, 12:32 AM
Does anyone know of a an easy way to update the currency (platinum, silver, gold and copper) for all characters on a server at once? I am guessing there may be some MySQL query that could be ran to adjust it, but I am not exactly sure how to do that since all of that info is stored in the Player Profile Blob and I don't know how to access that.
What I am trying to do is maybe run a query that does something like dividing all player currency by 10. Then, I would also want to run a second simpler query to update all item prices over a certain amount to be divided by 10 as well. I think I can figure out the one for updating item prices, but if anyone knows how to update characters for currency on the character, in their bank and in their shared bank, I would appreciate it.
Thanks :)
Aldest
03-11-2009, 11:37 AM
This may be of no help to you since it seems you want to reduce inflation on your server but for just adding money to accounts the "shared bank" is not part of the combined character information. It is set at the account level.
I used that to pull some "Funny Plat" out of the system. It, of course, does no good for the money that wasn't stored there.
I'd be very interested to see an answer on this too.
AndMetal
03-11-2009, 10:46 PM
the one thing i cannot posible edit is the stupid BLOB file, which contains 4 essential things: stats, deyty, race and class - thats why i belive this little thing should be stand alone =)
Not trying to derail the thread, but here is a relatively easy way to change the profile blob using a MySQL query:
UPDATE character_ SET profile = INSERT((SELECT profile FROM (SELECT * FROM character_) AS x WHERE id = 748),(4720+1),4,RPAD(CHAR(100),4,CHAR(0))) WHERE id = 748;
This would give a character with an ID of 748 100 platinum.
In theory, you can change 4720 to any field # in the profile blob (http://www.eqemulator.net/wiki/wikka.php?wakka=EQEmuDBSchemacharacterprofile) & the 100 to whatever numeric value you want it set to. You would then need to change the 4's to correspond with however many characters the data takes up (32-bit integers are 4, for example), otherwise the blob will become corrupt (too many/too few characters).
Some might be wondering why there are 2 subqueries. The answer is discussed here (http://www.xaprb.com/blog/2006/06/23/how-to-select-from-an-update-target-in-mysql/), and it's basically a workaround for not being able to query the same table in an update.
I verified it works without any issues on an existing toon.
If anyone has any questions about this, please feel free to ask in another thread.
Hope this helps.
trevius
03-11-2009, 11:33 PM
Thanks, AndMetal! That sorta makes sense. Though, I imagine it would be pretty confusing for someone who isn't as familiar with the packet structures lol.
The only thing I can't seem to figure out from that is how I would divide the current value by 10. Normally in SQL, I could just tell it to do something like plat = (plat / 10), but since this isn't an actual named field, I am not sure how to do that exactly.
This will definitely take some testing on my test server before I could even think about doing it on the real server lol. Also, a backup of the accounts table will be a good idea before any changes like that.
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.