[Plugin] xChat


#1

Do you wish to promoting something in all chat? Just say it, loud and clear with this plugin!

Features :

  • Spam messages to all chat every 10s
  • Script support, send message in all possible types from Chat API

Script example :

chat,all,Hello World!
or
chat,private,JellyBitz,Hi!

Please, let me to know if something doesn’t work as expected. It’s an old plugin, I just move a few things!

xChat
from phBot import *
import phBotChat
import QtBind

# Avoid possible issues
inGame = False

# Initializing GUI
gui = QtBind.init(__name__,"xChat")
lblSpamCounter = QtBind.createLabel(gui,"Spam Counter:",21,35)
lblCounter = QtBind.createLabel(gui,"0",90,35)

cbxMsg = QtBind.createCheckBox(gui, 'cbxMsg_clicked','Send message: ', 21, 13)
cbxMsg_checked = False
tbxMsg = QtBind.createLineEdit(gui,"",130,12,590,18)
delayMsg = 10000 # delay between messages
delayCounter = 0

log('Plugin: xChat plugin successfully loaded.')

# Check to start sending messages
def cbxMsg_clicked(checked):
	global cbxMsg_checked
	cbxMsg_checked = checked
	if checked:
		# restart spamer counter
		global delayCounter
		delayCounter = 0
		QtBind.setText(gui,lblCounter,"0")

# Send message, even through script. Ex. "chat,All,Hello World!" or "chat,private,JellyBitz,Hi!"
def chat(args):
	# check arguments length and empty message
	if (len(args) >= 3 and len(args[2]) > 0):
		success = False
		type = args[2].lower()
		if type == "all":
			success = phBotChat.All(args[3])
		elif type == "private":
			success = phBotChat.Private(args[3],args[4])
		elif type == "party":
			success = phBotChat.Party(args[3])
		elif type == "guild":
			success = phBotChat.Guild(args[3])
		elif type == "union":
			success = phBotChat.Union(args[3])
		elif type == "note":
			success = phBotChat.Note(args[3],args[4])
		elif type == "stall":
			success = phBotChat.Stall(args[3])
		if success:
			log("Plugin: Message sent successfully (xChat)")

# Called when the bot successfully connects to the game server
def connected():
	global inGame
	inGame = False

# Called when the character enters the game world
def joined_game():
	global inGame
	inGame = True

# Called every 500ms.
def event_loop():
	if inGame:
		if cbxMsg_checked:
			global delayCounter
			delayCounter += 500
			if delayCounter%delayMsg == 0:
				chat(['chat','All',QtBind.text(gui,tbxMsg)])
				QtBind.setText(gui,lblCounter,str(int(QtBind.text(gui,lblCounter))+1))