EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Support::Windows Servers (https://www.eqemulator.org/forums/forumdisplay.php?f=587)
-   -   Need help adjusting prices of spells via SQL (https://www.eqemulator.org/forums/showthread.php?t=35218)

chrsschb 04-19-2012 06:11 PM

Need help adjusting prices of spells via SQL
 
I'm looking for a SQL script and since I'm pretty new at writing scripts I'm asking for help. I want to alter the price of all spells by this equation: Manacost * 40.

louis1016 04-20-2012 04:09 AM

the mana cost isnt stored in the spell scroll item, its stored in the spell table itself so im not sure if this is actually doable this way

trevius 04-20-2012 04:47 AM

Yeah, I think that should be doable. I haven't tested it, but the query should be something like this:

Code:

UPDATE items, spells_new SET items.price = (spells_new.mana * 40) WHERE items.scrolleffect = spells_new.id;
As always, it is recommended to do a DB or at least items table backup before running any queries you are not 100% sure about. If using Navicat, you can just right click the items table and make a copy of it from there (copy and paste), so you will have a backup in case something goes wrong with the price changes.

chrsschb 04-20-2012 08:24 AM

Quote:

Originally Posted by trevius (Post 209024)
Yeah, I think that should be doable. I haven't tested it, but the query should be something like this:

Code:

UPDATE items, spells_new SET items.price = (spells_new.mana * 40) WHERE items.scrolleffect = spells_new.id;
As always, it is recommended to do a DB or at least items table backup before running any queries you are not 100% sure about. If using Navicat, you can just right click the items table and make a copy of it from there (copy and paste), so you will have a backup in case something goes wrong with the price changes.

Thanks Trevius. I knew it was doable, just wasn't sure how. Will this pull the individual mana costs of each item and not just the first one?

trevius 04-26-2012 02:24 AM

Yes, it basically looks for a spell ID that matches the spell ID in the scrolleffect field of the item, and then uses the mana for that spell to set the price of the item. If there is no matching spell id for the scrolleffect field (such as items that are not scrolls), the price shouldn't be affected by that query. This particular query will update all scrolls at once, but you could specify more stuff in the WHERE clause to limit it in any way you want such as certain item or spell IDs or whatever.


All times are GMT -4. The time now is 10:16 PM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.