Go Back   EQEmulator Home > EQEmulator Forums > Quests > Quests::Q&A

Quests::Q&A This is the quest support section

Reply
 
Thread Tools Display Modes
  #1  
Old 04-07-2019, 06:56 PM
Azrealvect
Sarnak
 
Join Date: May 2011
Posts: 53
Default 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?
Reply With Quote
  #2  
Old 04-15-2019, 10:05 PM
Rakkoraz05
Fire Beetle
 
Join Date: Apr 2009
Location: UTah
Posts: 28
Default

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
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 06:33 PM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3