كود:
from phBot import *
from threading import Timer
from time import gmtime, strftime
import QtBind,struct
# Initializing GUI
gui = QtBind.init(__name__,"xAutoAttendant")
lblNpcs = QtBind.createLabel(gui,"- Obtain coupon through log-in everyday & Rewards according to how many days you log-in the game",21,11)
btnAttendance = QtBind.createButton(gui,'btnAttendance_clicked'," Attendance Check ",600,33)
btnCoupon = QtBind.createButton(gui,'btnCoupon_clicked'," Subscription Card (Continuity) ",21,33)
btnTicket = QtBind.createButton(gui,'btnTicket_clicked'," Chamber of Vicious Shadows Entrance Ticket (Acumulation) ",21,55)
btnMagicP = QtBind.createButton(gui,'btnMagicP_clicked'," New Premium Magic POP Card (Acumulation) ",21,77)
btnRClock = QtBind.createButton(gui,'btnRClock_clicked'," Revival Clock (7days) (Acumulation) ",21,99)
btnPGoldt = QtBind.createButton(gui,'btnPGoldt_clicked'," Premium Gold Time Plus (7days) (Acumulation) ",21,121)
isConnected = False
log('Plugins: xAutoAttendant Plugin Succesfully loaded ~ by ProjeXNET [May 2016]')
# Called when the bot successfully connects to the game server
def connected():
global isConnected
isConnected = False
# Called when the character enters the game world
def joined_game():
locale = get_locale()
if locale == 18 or locale == 65: # Only iSRO & rSRO
global isConnected
isConnected = True
check_attendance()
# All packets received from Silkroad will be passed to this function
# Returning True will keep the packet and False will not forward it to the game server
def handle_joymax(opcode, data):
if opcode == 0xB4DD:
if data[0] == 0x02 and data[1] == 0x01:
log("Event: Attendance check completed ~ xAutoAttendant Plugin")
if opcode == 0xB034:
if data[0] == 0x01 and data[1] == 0x0E: #Flag & Event
#Reading reward
log("Event: Reward obtained ["+get_item(struct.unpack_from("<i",data,8)[0])['name']+"]")
return True
# Try to check the Attendance Event
def check_attendance():
dateNow = gmtime()
# Checking maxim date of event
year = int(strftime("%y",dateNow))
month = int(strftime("%m",dateNow))
if year == 16 and month == 5:
log("Event: Checking Attendance event ~ xAutoAttendant Plugin")
Packet = bytearray()
Packet.append(0x01)
# Open attendance (return data for assistance check)
Timer(10.0, inject_joymax,(0x74DD,Packet,False)).start()
Packet = bytearray()
Packet.append(0x02)
# Try to check day
Timer(15.0, inject_joymax,(0x74DD,Packet,False)).start()
# Start timer for try to check in 6 hours
Timer(21600.0,check_attendance).start()
def btnAttendance_clicked():
if isConnected:
check_attendance()
def btnCoupon_clicked():
if isConnected:
Packet = bytearray()
Packet.append(0x04) # Selecting
Packet = Packet + struct.pack('<i', 1) # Add reward ID
inject_joymax(0x74DD,Packet,False)
Packet = bytearray()
Packet.append(0x05) # Getting reward
Packet = Packet + struct.pack('<i', 1) # Add reward ID
Packet = Packet + struct.pack('<i', 1) # Maybe is the quantity
Timer(2.5, inject_joymax,(0x74DD,Packet,False)).start()
def btnTicket_clicked():
if isConnected:
Packet = bytearray()
Packet.append(0x04)
Packet = Packet + struct.pack('<i', 2)
inject_joymax(0x74DD,Packet,False)
Packet = bytearray()
Packet.append(0x05)
Packet = Packet + struct.pack('<i', 2)
Packet = Packet + struct.pack('<i', 1)
Timer(2.5, inject_joymax,(0x74DD,Packet,False)).start()
def btnMagicP_clicked():
if isConnected:
Packet = bytearray()
Packet.append(0x04)
Packet = Packet + struct.pack('<i', 3)
inject_joymax(0x74DD,Packet,False)
Packet = bytearray()
Packet.append(0x05)
Packet = Packet + struct.pack('<i', 3)
Packet = Packet + struct.pack('<i', 1)
Timer(2.5, inject_joymax,(0x74DD,Packet,False)).start()
def btnRClock_clicked():
if isConnected:
Packet = bytearray()
Packet.append(0x04)
Packet = Packet + struct.pack('<i', 4)
inject_joymax(0x74DD,Packet,False)
Packet = bytearray()
Packet.append(0x05)
Packet = Packet + struct.pack('<i', 4)
Packet = Packet + struct.pack('<i', 1)
Timer(2.5, inject_joymax,(0x74DD,Packet,False)).start()
def btnPGoldt_clicked():
if isConnected:
Packet = bytearray()
Packet.append(0x04)
Packet = Packet + struct.pack('<i', 5)
inject_joymax(0x74DD,Packet,False)
Packet = bytearray()
Packet.append(0x05)
Packet = Packet + struct.pack('<i', 5)
Packet = Packet + struct.pack('<i', 1)
Timer(2.5, inject_joymax,(0x74DD,Packet,False)).start()