EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Quests::Q&A (https://www.eqemulator.org/forums/forumdisplay.php?f=599)
-   -   Auto-populating merchants (https://www.eqemulator.org/forums/showthread.php?t=42386)

Azrealvect 04-07-2019 06:56 PM

Auto-populating merchants
 
I know this has been touched on here and there before and its something ive always wanted on my server. Is there a way to set up merchants that will randomly pull from the items database to stock their wares? Reset on a timer would be nice but even a reset on server boot up would be just as good for me. How would I go about setting this up and what work outside of the pl file would be needed?

Rakkoraz05 04-15-2019 10:05 PM

Hey Azrealvect!

I was also looking for this for some makeshift trader system. I tried learning Pearl for this but I already had some experience in SQL(Very little really). I ended up with the following that I pretty much looped over and over for the number of MerchantsIds I had in another table.

The script below only shows how to get random items of a certain item type in MariaDB/MySQL. You could easily change this to work to pull any item by removing the "itemtype =" line.


Code:

-- Select used to provide random items to Bazaar merchants
-- All info for fields can be found at https://github.com/EQEmu/Server/wiki and searching for the pages.
-- for classes 15906 = All Casters Classses where 49629 = All Melee Classes and 65535 = All player classes in game.

Select * from peq.items
where itemtype = 0 -- Limit results to specific item types
    and reclevel = 0 -- limit results to items with no recommended level
    and reqlevel = 0 -- Limit results to items with no required level
    and nodrop = 0 -- Removes No drop items from results
    and augtype = 0 -- Removes augemnts from results
    and damage <= 10 -- Limit results to have a max dmg of 10 or stated number
    and damage >= 1 -- Limit results to have weapons with at least the stated dmg.
    And classes <= 65535 -- This is the ## for all classes
    and classes >= 1 -- This is the ## for warrior
    and size > 1 -- This will return items Small to Gigantic
    and fvnodrop = 0 -- Return only non No Trade Items
    And ac > 0 -- for armor. Limit the bottom end of ac an item can have
    and ac < 10 -- for armor. Limit the top end of ac an item can have
    and slot = 2048 -- Limit search to a specific slot. 2048 = Range Slot.
ORDER By RAND() -- Will make sure you get a more random set of items
Limit 20; -- Limit the amount of results you get



All times are GMT -4. The time now is 09:15 AM.

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