Arena

I rewrote part of it so you can specify the one you want to register for. Not tested.

Examples:

arena,random flag
arena,party flag
from phBot import *

log('[Plugin] Succesfully loaded [%s]' % __name__)

ArenaType = ''

def handle_joymax(opcode, data):
	if opcode == 0x34D2:
		if data[0] == 0xFF and data[1] == 0x00 and data[2] == 0x01 and data[3] == 0x01:
			log('[Arena] Successfully registered to arena: %s' % ArenaType)
			stop_bot()
	return True

def arena(arguments):
	if len(arguments) != 2:
		log('[Arena] Missing arena type in the script')
		return 0

	t = arguments[1].lower()
	NPCID = 0

	NPCs = get_npcs()
	for UniqueID, NPC in NPCs.items():
		if NPC['name'] == 'Arena Manager':
			NPCID = UniqueID
			break

	if NPCID != 0:
		global ArenaType
		ArenaType = ''

		Packet = bytearray()
		Packet.append(0x01)

		if t == 'job flag':
		 	ArenaType = 'Job Flag'
		 	Packet.append(0x03)
		 	Packet.append(0x02)
		elif t == 'job points':
		 	ArenaType = 'Job Points'
		 	Packet.append(0x03)
		 	Packet.append(0x01)
		elif t == 'random flag':
			ArenaType = 'Random Flag'
			Packet.append(0x00)
			Packet.append(0x02)
		elif t == 'random points':
			ArenaType = 'Random Points'
			Packet.append(0x00)
			Packet.append(0x01)
		elif t == 'party flag':
			ArenaType = 'Party Flag'
			Packet.append(0x01)
			Packet.append(0x02)
		elif t == 'party points':
			ArenaType = 'Party Points'
			Packet.append(0x01)
			Packet.append(0x01)
		else:
			log('[Arena] Guild arena not supported')
			return 0

		inject_joymax(0x74D3, Packet, False)
		return 500

	return 0
3 Likes