Hello! You can add to the bot the function of creating stones from tablets? thanks for the answer
It’s possible but I don’t have any plans to do so.
Thank. I hope in the future there will be time to do. This is a very useful feature for alchemy.
ilk zamanlarda yaptığım acemice bir stone yapma zımbırtısı ^^ uğraşıp daha kısa kodla daha verimli birşeyler yapabilirsin örnek olsun diye bırakıyorum temizlik yaparken rastladım ^^
ÖRNEK KOD
from phBot import *
import QtBind,time
# Tasarım
tas = QtBind.init(__name__,'TABLET')
yenile = QtBind.createButton(tas,'yenile_clicked'," Çanta Yenile ",10,10)
ekle = QtBind.createButton(tas,'ekle_clicked'," Ekle ",270,50)
sil = QtBind.createButton(tas,'sil_clicked'," Sil ",270,100)
calistir = QtBind.createButton(tas,'calistir_clicked'," Çalıştır ",420,10)
canta = QtBind.createList(tas,10,30,250,250)
secim = QtBind.createList(tas,350,30,250,250)
slist= []
zaman=False
#hata=0
def decToHex(n):
if(n<16):
return {
0: "00",
1: "01",
2: "02",
3: "03",
4: "04",
5: "05",
6: "06",
7: "07",
8: "08",
9: "09",
10: "0a",
11: "0b",
12: "0c",
13: "0d",
14: "0e",
15: "0f"
}.get(n, "00")
else:
return hex(n).split('x')[-1]
def yenile_clicked():
QtBind.clear(tas,canta)
data=get_inventory()["items"]
for i in range(13,get_inventory()["size"]):
if data[i]:
if not kontrol(data[i]['name'],QtBind.getItems(tas,canta)):
if not data[i]['name'].find("Ruby"):
QtBind.append(tas,canta,data[i]["name"])
elif not data[i]['name'].find("Jade"):
QtBind.append(tas,canta,data[i]["name"])
def sil_clicked():
sec = QtBind.text(tas,secim)
if sec:
secin = QtBind.currentIndex(tas,secim)
QtBind.removeAt(tas,secim,secin)
slist.pop(secin)
def ekle_clicked():
global slist
secilen = QtBind.text(tas,canta)
if secilen:
if not kontrol(secilen,slist):
QtBind.append(tas,secim,secilen)
slist.append(secilen)
else:
log(secilen+" Listede Mevcut")
def kontrol(s, l):
return s in l
def kodYap(tablet):
r=[0,0,0,0,0]
s=[0,0,0,0,0]
item=get_inventory()["items"]
for i in range(13,get_inventory()["size"]):
if item[i]:
if item[i]["name"]==tablet:
r[0]=i
elif not item[i]["name"].find("Earth element"):
if s[2]<item[i]["quantity"]:
r[2]=i
s[2]=item[i]["quantity"]
elif not item[i]["name"].find("Fire element"):
if s[1]<item[i]["quantity"]:
r[1]=i
s[1]=item[i]["quantity"]
elif not item[i]["name"].find("Water element"):
if s[3]<item[i]["quantity"]:
r[3]=i
s[3]=item[i]["quantity"]
elif not item[i]["name"].find("Wind element"):
if s[4]<item[i]["quantity"]:
r[4]=i
s[4]=item[i]["quantity"]
for i in r:
if i==0:
r=False
if r:
r="02 02 05 "+str(decToHex(r[0]))+" "+str(decToHex(r[1]))+" "+str(decToHex(r[2]))+" "+str(decToHex(r[3]))+" "+str(decToHex(r[4]))
return r
def inject(paket):
if paket:
veri = bytearray()
parca = paket.split()
i = 0
while i < len(parca):
veri.append(int(parca[i],16))
i += 1
inject_joymax(0x7155,veri,False)
else:
log("Paket Boş")
def calistir():
global slist
global secim
global zaman
tabletler=QtBind.getItems(tas,secim)
if len(tabletler):
kod=kodYap(tabletler[0])
if kod:
inject(kod)
zaman=time.time()+0.5
else:
QtBind.removeAt(tas,secim,0)
slist.remove(tabletler[0])
log("Seçilen Tabletler Bitti")
else:
stop_bot()
log("Tamamlandı")
zaman=False
def calistir_clicked():
global zaman
if zaman:
stop_bot()
zaman=False
else:
start_bot()
zaman=time.time()
def event_loop():
global zaman
if zaman:
if zaman<time.time():
calistir()
def handle_joymax(opcode, data):
global zaman
if '{:02X}'.format(opcode)=="B155":
s=' '.join('{:02X}'.format(x) for x in data)
if s=="02 09 58":
zaman=time.time()+10
elif s=="02 08 58":
zaman=time.time()+10
return True
umarım azda olsa işini görür selametle
Use code tags so people don’t need to literally indent every line of your plugin.
I have to point a few things out…
Why?
if '{:02X}'.format(opcode)=="B155":
When this is the proper way?
if opcode == 0xB155:
Same with your packet comparisons:
s=' '.join('{:02X}'.format(x) for x in data)
if s=="02 09 58":
if data == b'\x02\x09\x58':
Then converting decimal to hex? Just use struct.pack
. We used to do crap like that in 2008 with VB6. Thank god that language is dead.
Sorry.
1 Like
its my first python plugin now i dont use like it