• Hail, we're RedGuides. We want you to play six (yes, 6!) EverQuest characters at once. We have scripts and a friendly community to help, please join our playstyle and say hello! 👋
  • We've added LLM sections to our Terms & Rules and Resource Rules, for everyone's sanity & in-game safety.
    Read more
    a. Do not replace your voice with an LLM. This goes for your posts and your scripts. Drafting and editing with a tool is fine, but don't take you out of what you share.
    b. Do not replace your EQ character's voice with an LLM. We don't want scripts that speak over /ooc, /shout or other public channels. This has been an unwritten rule that's kept casino scripts off the site for decades, but we're now compelled to make it clear: keep automated communication private.

    Why Does RG Review Scripts?
    Nearly every LLM-written Lua script we see is making your character do impossible things, and rarely in a way that's beneficial to you. We've seen heavy server hammering, /target over impossible distances when /nav spawn would passively accomplish the same thing, a spawn search that fires 20+ times per second, and other pointless actions that are likely annoying GMs.

    You are welcome to use LLMs as a tool to structure, draft, and edit your work, but please read critically before hitting /lua run

💾Software Discord Bot for building ADVLoot INI File Item Syntax - (Thread also now includes standalone python scripts)

This is a discord bot that I put together that will look up an in game item and generate the proper syntax for adding the item to your advloot filter files located in your game client userdata folder.

ie.

In discord type: !advlookup Blue Diamond
it returns: 22503^9644^Blue Diamond

ADVLootBot
Python:
#!/usr/bin/python3.6

# Program Name: ADVLoot-Discord.py
#               'ADVLoot Discord Bot for EverQuest'
# Original Author: TheDank
# Python Version: 3.6
# Original Date: 5/7/2020
# Last Revision: 5/7/2020

# Purpose:  This program will parse item input from discord and return the proper ADVLoot loot ini file item syntax.

# Dependencies: Python 3 && discord module
#               python3 -m pip install --user -U discord.py[voice] # discord module

# Note:         This program requires the items.txt file from "http://items.sodeq.org/download.php"

#    This file is part of ADVLoot-Discord.py.

#    ADVLoot-Discord is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.

#    ADVLoot-Discord is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#    see <http://www.gnu.org/licenses/>.

import subprocess
import time
import sys
import os
import discord
import asyncio
import csv

from discord.ext import commands

#### MAIN PROGRAM ####

### USER DEFINED SETTINGS ###

## Discord specific settings ##
## Obtain via 'developer mode' in Discord and by right clicking on the channel, then choose copy id ##
# general chat channel ID on discord server
CHAT_ID = <insert your channel ID here>

# Discord Bot TOKEN - DO NOT SHARE!
# Obtained from your Discord applications page under your registered Bot for this application
TOKEN = '<insert your bot token ID here>'


### END USER DEFINED SETTINGS ###

# program banner
print("\n\nStarting The EverQuest ADVLoot Item Discord Bot\n")
print("Press Ctrl+C to exit\n")

# start up the bot and log in to discord
client = discord.Client()

# start up the bot
@client.event
async def on_ready():
    print('Logged in as')
    print(client.user.name)
    print(client.user.id)
    print('----------')

# some bot commands for testing and information
@client.event
async def on_message(message):
    if message.content.startswith('!test'):
        counter = 0
        channel = message.channel
        tmp = await channel.send('Calculating messages...')
        async for message in channel.history(limit=100):
            if message.author == client.user:
                counter += 1
        await channel.send(counter)

    # Lookup DKP
    elif message.content.startswith('!advhelp'):
        channel = message.channel
        await channel.send('Hello, my name is ADVLootBot and my creator is TheDank.  I am here to help you populate your LF_AN_<CHARNAME>_server.ini file with the proper item syntax. Use the following format to request the item line to insert into the file: !advlookup <itemname>', tts=False)

    elif message.content.startswith('!advlookup'):
        channel = message.channel
        msg = message.content.split(" ")
        msglist = msg[1:]
        itemSearch = ' '.join(map(str, msglist))
        print(itemSearch)
        # open and parse items.txt file
        with open('items.txt', 'r', newline='') as csvfile:
            readCSV = csv.reader(csvfile, delimiter='|')
            for row in readCSV:
                itemName = row[1]
                itemID = row[5]
                itemIconID = row[13]
                if itemName.lower() == itemSearch.lower():
                    advline = itemID+'^'+itemIconID+'^'+itemName
                    await channel.send(advline)

# run the bot using the TOKEN
client.run(TOKEN)

Enjoy!
 
Thanks!

Add it to a discord server of your choosing. Remember you will need the items.txt file for the bot to parse from here. On my server I setup a cron job to download it every night at 00:10 and extract it into the bot's directory, so I have a fresh copy each day.

the cron script:

Bash:
#!/bin/bash

# download latest itemlist from sodeq.org

cd /home/thedank/scripts
wget http://items.sodeq.org/downloads/items.txt.gz
gunzip items.txt.gz


The cron job entry:

Bash:
10 0 * * * bash /home/thedank/scripts/eqitems_refresh.sh
 
I mean there are probably a few that wouldn't be a bad idea to host with a channel that people can mute for bot spam commands and replies.

On the server I deployed it to I did setup a separate advloot_lookup channel for this to avoid spam in other channels. Just use that channel ID in the bot.
 
One last tidbit to help out when running the bot

A. I usually run it in a screen session on my linux server
B. I then use the following bash script to launch it, which automatically restarts the bot if it happens to crash at any point.

start_advloot_bot.sh
Bash:
#!/bin/bash

while true
do
    echo Starting ADVLootBot
    ./ADVLoot-Discord.py
    echo Restarting Bot in 5 Seconds ...
    sleep 5
done
 
Last edited:
Here is a standalone python version that does not require Discord.

eqadvloot.py
Python:
#!/usr/bin/python

import csv

itemSearch = input("What item would you like me to look up?\n")
print("Generating advloot syntax for: ", itemSearch)

with open('items.txt', 'r', newline='') as csvfile:
    readCSV = csv.reader(csvfile, delimiter='|')
    for row in readCSV:
        itemName = row[1]
        itemID = row[5]
        itemIconID = row[13]
        if itemName.lower() == itemSearch.lower():
            advline = itemID+'^'+itemIconID+'^'+itemName
            print(advline)

You will need the items.txt file in the same directory as the script. That script is posted above but here it is again to make things easy.

eqitems_refresh.sh
Bash:
#!/bin/bash

# download latest itemlist from sodeq.org
wget http://items.sodeq.org/downloads/items.txt.gz
gunzip items.txt.gz


I don't do windows, so feel free to port as you see fit!
 
One more update then I am done for today. I just evolved the standalone script to take in a list of items and produce the converted advloot list to stdout. Again this will need the items.txt file as stated above. You will also need to create a text file with each item on a separate line that you want to get advloot syntax for to feed this script. For example:

list_of_items.txt
INI:
Blue Diamond
Skybarrage
Cloth Cape
Skymaul
Diamond
Black Ornate Silken Bridle
Crimson Runed Mask

Here is the new script:

eqadvloot_multi.py
Python:
#!/usr/bin/python

import csv
import sys

def convertAdv(item):
    with open('items.txt', 'r', newline='') as csvfile:
        readCSV = csv.reader(csvfile, delimiter='|')
        for row in readCSV:
            itemName = row[1]
            itemID = row[5]
            itemIconID = row[13]
            if itemName.lower() == item.lower():
                advline = itemID+'^'+itemIconID+'^'+itemName
                print(advline)
    csvfile.close()

def main():

   itemFile = sys.argv[1]
    print("Generating advloot syntax for: ", itemFile)
    with open(itemFile) as f:
        itemList = f.read().splitlines()
    f.close()

    for i in itemList:
        convertAdv(i)

main()

Example run:

You have an item list formatted as indicated above called [list_of_items.txt]

python3 eqadvloot_multi.py list_of_items.txt

which will return to stdout the following:

stdout
INI:
22503^9644^Blue Diamond
148964^8570^Skybarrage
1006^656^Cloth Cape
148962^8573^Skymaul
10037^966^Diamond
127635^596^Black Ornate Silken Bridle
26773^1063^Crimson Runed Mask

This can then be direclty copied and pasted into your advloot ini files. Note this process will take a bit of time, depending on how long your input list is. The items.txt file is quite large and it needs to compare each item you input to each line in the items.txt file to see if there is a match.
 
Last edited:
💾Software Discord Bot for building ADVLoot INI File Item Syntax - (Thread also now includes standalone python scripts)

Users who are viewing this thread

Back
Top
Cart