Skip to content

Commit

Permalink
Merge branch 'source' of github.com:freeAhao/jhwd into source
Browse files Browse the repository at this point in the history
merge fix
  • Loading branch information
ahao-laptop committed Sep 20, 2022
2 parents edd2824 + 15f1c21 commit f1ec22c
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 8 deletions.
15 changes: 12 additions & 3 deletions controller/AiController.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ def recognize(self):
int(it+ih+(self.ai.fixregion/3)*ih)
)

if ok and self.pointer_in_range(center,bbox):
if ok and self.pointer_in_range(center,bbox) and self.area_limit(bbox):
cv.rectangle(simg,ip1,ip2,(0,255,0),3,cv.LINE_AA)
cv.putText(simg, "TARGET", ip1, cv.FONT_HERSHEY_SIMPLEX, 1, (0,0,255), 3,cv.LINE_AA)
cv.rectangle(simg,op1,op2,(255,178,50),1,cv.LINE_AA)
Expand Down Expand Up @@ -336,7 +336,10 @@ def recognize(self):

if box:
boxcenter,bbox = self.findclose(box,center,width,height)
if boxcenter:
if not self.area_limit(bbox):
self.box = None
self.qt_comunicate.update.emit({"move":(0,0)})
elif boxcenter:

trackimg = cv.cvtColor(cvimg,cv.COLOR_BGRA2BGR)
trackimg,_ = self.ai.circle_mask(cvimg)
Expand All @@ -362,11 +365,17 @@ def recognize(self):

text = "{}fps".format(round(1/(time.time()-self.strat_time)))
cv.putText(img,text,(5,50),cv.FONT_HERSHEY_SIMPLEX,1,(0,255,0),2)
if box and bbox:
if box and bbox and self.area_limit(bbox):
cv.rectangle(img,(bbox[0],bbox[1]),(bbox[0]+bbox[2],bbox[1]+bbox[3]),(0,255,0),3,cv.LINE_AA)
cv.circle(img,center,5,(0,255,0),3,cv.LINE_AA)
qimg = cv_img_to_qimg(img)
self.qt_comunicate.update.emit({"img":qimg}) if self.qt_comunicate else None

def area_limit(self,bbox):
radius = round(640*self.ai.airegion)
detech_area = radius*radius*math.pi
box_area = bbox[2] *bbox[3]
return box_area/detech_area <0.5 and bbox[2]/bbox[3]<1

def pointer_in_range(self,point,xywh):
il,it,iw,ih = xywh
Expand Down
3 changes: 2 additions & 1 deletion controller/PubgWeaponConfigController.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ def cal_data_result(self):
continue
dsplit = d.split(",")
keys_sorted.append(int(dsplit[0]))
datas_result[int(dsplit[0])] = [int(dsplit[1]),int(dsplit[2])]
datas_result[int(dsplit[0])] = [float(dsplit[1]),float(dsplit[2])]
keys_sorted.sort()

self.view.weapon_data_result.setText("这里显示最终结果")
Expand Down Expand Up @@ -241,6 +241,7 @@ def cal_data_result(self):
self.datas["weapons"][weapon_name]["countdatax"] = countdatax
self.datas["weapons"][weapon_name]["countdatay"] = countdatay
except:
traceback.print_exc()
self.view.weapon_data_result.setText("")
self.apply()

Expand Down
2 changes: 1 addition & 1 deletion resource/APEX/ghubscripts.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
false
],
"ads": [
"\n if vars[\"adsmode\"] == \"HOLD\" then\n return (vars[\"left\"] and vars[\"right\"]) or (vars[\"left\"] and IsKeyLockOn(\"Capslock\")) or (vars[\"left\"] and step ~=1)\n end\n if vars[\"adsmode\"] == \"CLICK\" then\n return vars[\"left\"] and IsKeyLockOn(\"Capslock\")\n end\n",
"\n if vars[\"adsmode\"] == \"HOLD\" then\n if not table[vars[\"weapon\"]] then\n return (vars[\"left\"] and vars[\"right\"]) or (vars[\"left\"] and IsKeyLockOn(\"Capslock\")) or (vars[\"left\"] and step ~= 1) or vars[\"right\"]\n end\n return (vars[\"left\"] and vars[\"right\"]) or (vars[\"left\"] and IsKeyLockOn(\"Capslock\")) or (vars[\"left\"] and step ~=1)\n end\n if vars[\"adsmode\"] == \"CLICK\" then\n return vars[\"left\"] and IsKeyLockOn(\"Capslock\")\n end\n",
"",
"",
false
Expand Down
2 changes: 1 addition & 1 deletion resource/APEX/lgsscripts.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
false
],
"ads": [
"\n if vars[\"adsmode\"] == \"HOLD\" then\n return (vars[\"left\"] and vars[\"right\"]) or (vars[\"left\"] and IsKeyLockOn(\"Capslock\")) or (vars[\"left\"] and step ~= 1)\n end\n if vars[\"adsmode\"] == \"CLICK\" then\n return vars[\"left\"] and IsKeyLockOn(\"Capslock\")\n end\n",
"\n if vars[\"adsmode\"] == \"HOLD\" then\n if not table[vars[\"weapon\"]] then\n return (vars[\"left\"] and vars[\"right\"]) or (vars[\"left\"] and IsKeyLockOn(\"Capslock\")) or (vars[\"left\"] and step ~= 1) or vars[\"right\"]\n end\n\n return (vars[\"left\"] and vars[\"right\"]) or (vars[\"left\"] and IsKeyLockOn(\"Capslock\")) or (vars[\"left\"] and step ~= 1)\n end\n if vars[\"adsmode\"] == \"CLICK\" then\n return vars[\"left\"] and IsKeyLockOn(\"Capslock\")\n end\n",
"",
"",
false
Expand Down
2 changes: 1 addition & 1 deletion resource/PUBG/ghubscripts.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
false
],
"ads": [
"\n if vars[\"adsmode\"] == \"HOLD\" then\n return (IsMouseButtonPressed(1) and IsMouseButtonPressed(3)) or (IsMouseButtonPressed(1) and vars[\"aim\"])\n end\n if vars[\"adsmode\"] == \"CLICK\" then\n return IsMouseButtonPressed(1) and IsKeyLockOn(\"Capslock\")\n end\n",
"\n if vars[\"adsmode\"] == \"HOLD\" then\n if not table[vars[\"weapon\"]] or #table[vars[\"weapon\"]][\"countdatax\"] == 1 then\n return (vars[\"left\"] and vars[\"right\"]) or (vars[\"left\"] and vars[\"aim\"]) or vars[\"right\"]\n end\n return (IsMouseButtonPressed(1) and IsMouseButtonPressed(3)) or (IsMouseButtonPressed(1) and vars[\"aim\"])\n end\n if vars[\"adsmode\"] == \"CLICK\" then\n return IsMouseButtonPressed(1) and IsKeyLockOn(\"Capslock\")\n end\n",
"",
"",
false
Expand Down
2 changes: 1 addition & 1 deletion resource/PUBG/lgsscripts.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
false
],
"ads": [
"\n if vars[\"adsmode\"] == \"HOLD\" then\n return (vars[\"left\"] and vars[\"right\"]) or (vars[\"left\"] and vars[\"aim\"]) \n end\n if vars[\"adsmode\"] == \"CLICK\" then\n return vars[\"left\"] and IsKeyLockOn(\"Capslock\")\n end\n",
"\n if vars[\"adsmode\"] == \"HOLD\" then\n if not table[vars[\"weapon\"]] or #table[vars[\"weapon\"]][\"countdatax\"] == 1 then\n return (vars[\"left\"] and vars[\"right\"]) or (vars[\"left\"] and vars[\"aim\"]) or vars[\"right\"]\n end\n return (vars[\"left\"] and vars[\"right\"]) or (vars[\"left\"] and vars[\"aim\"]) \n end\n if vars[\"adsmode\"] == \"CLICK\" then\n return vars[\"left\"] and IsKeyLockOn(\"Capslock\")\n end\n",
"",
"",
false
Expand Down

0 comments on commit f1ec22c

Please sign in to comment.