-
Notifications
You must be signed in to change notification settings - Fork 69
/
xNPC.py
29 lines (25 loc) · 976 Bytes
/
xNPC.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from phBot import *
import QtBind
pVersion = 'v0.1.0'
pName = 'xNPC'
pUrl = 'https://raw.githubusercontent.com/JellyBitz/phBot-xPlugins/master/xNPC.py'
# Needed for phbot GUI
gui = QtBind.init(__name__,pName)
lblNpcs = QtBind.createLabel(gui,"List of NPC's near to you..",21,11)
btnNpcs = QtBind.createButton(gui,'btnNpcs_clicked'," Refresh list ",645,8)
lstNpcs = QtBind.createList(gui,21,30,700,200)
# Clear and load the list of NPCs
def btnNpcs_clicked():
# Get all NPCs and teleporters
npcs = get_npcs()
# Clear list
QtBind.clear(gui,lstNpcs)
# Add header
QtBind.append(gui,lstNpcs,'[Name] [ServerName] [ModelID] (UniqueID)')
if npcs:
# Header data separation
QtBind.append(gui,lstNpcs,' -')
for UniqueID, NPC in npcs.items():
# Append every NPC description to the list
QtBind.append(gui,lstNpcs,"["+NPC['name'] + "] ["+NPC['servername']+"] ["+str(NPC['model'])+"] ("+str(UniqueID)+")")
log('Plugin: '+pName+' '+pVersion+' successfully loaded.')