Fixed API Issues with Flyff Collector Node
This commit is contained in:
parent
e736622213
commit
038de06bfd
Binary file not shown.
@ -8,7 +8,7 @@ Flyff Character Status Node:
|
||||
import re
|
||||
from OdenGraphQt import BaseNode
|
||||
from PyQt5.QtWidgets import QMessageBox
|
||||
from PyQt5.QtCore import QTimer # Corrected import
|
||||
from PyQt5.QtCore import QTimer
|
||||
from Modules import data_manager, data_collector
|
||||
|
||||
class FlyffCharacterStatusNode(BaseNode):
|
||||
@ -42,14 +42,20 @@ class FlyffCharacterStatusNode(BaseNode):
|
||||
def parse_character_stats(self, raw_text):
|
||||
"""
|
||||
Extract HP, MP, FP, EXP from the raw OCR text lines.
|
||||
We strip out empty lines, then only look at the first 4 lines.
|
||||
"""
|
||||
# Split on newlines, strip each line, and discard blank lines
|
||||
lines = [l.strip() for l in raw_text.splitlines() if l.strip()]
|
||||
|
||||
# Only consider the first 4 lines (HP, MP, FP, EXP)
|
||||
lines = lines[:4]
|
||||
|
||||
hp_current, hp_total = 0, 0
|
||||
mp_current, mp_total = 0, 0
|
||||
fp_current, fp_total = 0, 0
|
||||
exp_value = 0.0
|
||||
|
||||
if len(lines) >= 4:
|
||||
if len(lines) == 4:
|
||||
# line 1: HP
|
||||
hp_match = re.search(r"(\d+)\s*/\s*(\d+)", lines[0])
|
||||
if hp_match:
|
||||
@ -72,8 +78,10 @@ class FlyffCharacterStatusNode(BaseNode):
|
||||
exp_match = re.search(r"(\d+(?:\.\d+)?)", lines[3])
|
||||
if exp_match:
|
||||
val = float(exp_match.group(1))
|
||||
if val < 0: val = 0
|
||||
if val > 100: val = 100
|
||||
if val < 0:
|
||||
val = 0
|
||||
if val > 100:
|
||||
val = 100
|
||||
exp_value = val
|
||||
|
||||
return hp_current, hp_total, mp_current, mp_total, fp_current, fp_total, exp_value
|
||||
@ -83,7 +91,8 @@ class FlyffCharacterStatusNode(BaseNode):
|
||||
Called periodically to update character status from OCR.
|
||||
"""
|
||||
raw_text = data_collector.get_raw_text(self.region_id)
|
||||
# print("Raw OCR Text:", raw_text) # Debugging OCR text reading
|
||||
# Uncomment below for debugging if needed:
|
||||
# print("Raw OCR Text:", repr(raw_text))
|
||||
|
||||
hp_c, hp_t, mp_c, mp_t, fp_c, fp_t, exp_v = self.parse_character_stats(raw_text)
|
||||
|
||||
|
@ -9,10 +9,10 @@
|
||||
"reject_connection_types":{}
|
||||
},
|
||||
"nodes":{
|
||||
"0x25062603f80":{
|
||||
"type_":"bunny-lab.io.data_node.DataNode",
|
||||
"0x191410fec90":{
|
||||
"type_":"bunny-lab.io.flyff_character_status_node.FlyffCharacterStatusNode",
|
||||
"icon":null,
|
||||
"name":"Data Node",
|
||||
"name":"Flyff - Character Status",
|
||||
"color":[
|
||||
13,
|
||||
18,
|
||||
@ -34,23 +34,26 @@
|
||||
"disabled":false,
|
||||
"selected":false,
|
||||
"visible":true,
|
||||
"width":269.0,
|
||||
"height":74.2,
|
||||
"width":278.0,
|
||||
"height":200.20000000000002,
|
||||
"pos":[
|
||||
-183.12907239097774,
|
||||
203.3685322819906
|
||||
-234.47843187544638,
|
||||
171.50740184739476
|
||||
],
|
||||
"layout_direction":0,
|
||||
"port_deletion_allowed":false,
|
||||
"subgraph_session":{},
|
||||
"custom":{
|
||||
"value":"25"
|
||||
"hp":"HP: 5848/5848",
|
||||
"mp":"MP: 955/555",
|
||||
"fp":"FP: 0/0",
|
||||
"exp":"EXP: 49.0%"
|
||||
}
|
||||
},
|
||||
"0x250626141a0":{
|
||||
"type_":"bunny-lab.io.data_node.DataNode",
|
||||
"0x19173496de0":{
|
||||
"type_":"bunny-lab.io.flyff_exp_current_node.FlyffEXPCurrentNode",
|
||||
"icon":null,
|
||||
"name":"Data Node 1",
|
||||
"name":"Flyff - EXP (API Connected)",
|
||||
"color":[
|
||||
13,
|
||||
18,
|
||||
@ -72,23 +75,64 @@
|
||||
"disabled":false,
|
||||
"selected":false,
|
||||
"visible":true,
|
||||
"width":269.0,
|
||||
"width":339.0,
|
||||
"height":74.2,
|
||||
"pos":[
|
||||
279.96246102035116,
|
||||
512.9884977805091
|
||||
-237.34556433027646,
|
||||
77.62806051403777
|
||||
],
|
||||
"layout_direction":0,
|
||||
"port_deletion_allowed":false,
|
||||
"subgraph_session":{},
|
||||
"custom":{
|
||||
"value":"25"
|
||||
"value":"49.0"
|
||||
}
|
||||
},
|
||||
"0x250626159d0":{
|
||||
"0x191735ae690":{
|
||||
"type_":"bunny-lab.io.flyff_leveling_predictor_node.FlyffLevelingPredictorNode",
|
||||
"icon":null,
|
||||
"name":"Flyff - Leveling Predictor",
|
||||
"color":[
|
||||
13,
|
||||
18,
|
||||
23,
|
||||
255
|
||||
],
|
||||
"border_color":[
|
||||
74,
|
||||
84,
|
||||
85,
|
||||
255
|
||||
],
|
||||
"text_color":[
|
||||
255,
|
||||
255,
|
||||
255,
|
||||
180
|
||||
],
|
||||
"disabled":false,
|
||||
"selected":false,
|
||||
"visible":true,
|
||||
"width":324.0,
|
||||
"height":200.20000000000002,
|
||||
"pos":[
|
||||
170.42482250783007,
|
||||
77.62806051403777
|
||||
],
|
||||
"layout_direction":0,
|
||||
"port_deletion_allowed":false,
|
||||
"subgraph_session":{},
|
||||
"custom":{
|
||||
"exp_track_count":"7",
|
||||
"time_to_level":"Insufficient data",
|
||||
"time_between_kills":"N/A",
|
||||
"exp_per_kill":"N/A"
|
||||
}
|
||||
},
|
||||
"0x191735ae9c0":{
|
||||
"type_":"bunny-lab.io.backdrop.BackdropNode",
|
||||
"icon":null,
|
||||
"name":"flask",
|
||||
"name":"Track EXP Changes Over Time to Predict Leveling Up",
|
||||
"color":[
|
||||
5,
|
||||
129,
|
||||
@ -110,11 +154,11 @@
|
||||
"disabled":false,
|
||||
"selected":false,
|
||||
"visible":true,
|
||||
"width":804.65254462634,
|
||||
"height":483.4329838785975,
|
||||
"width":777.8842478973615,
|
||||
"height":380.82117975084645,
|
||||
"pos":[
|
||||
-205.22360825550223,
|
||||
146.33335545174936
|
||||
-264.113861059255,
|
||||
23.199190498448075
|
||||
],
|
||||
"layout_direction":0,
|
||||
"port_deletion_allowed":false,
|
||||
@ -127,12 +171,12 @@
|
||||
"connections":[
|
||||
{
|
||||
"out":[
|
||||
"0x25062603f80",
|
||||
"Output"
|
||||
"0x19173496de0",
|
||||
"value"
|
||||
],
|
||||
"in":[
|
||||
"0x250626141a0",
|
||||
"Input"
|
||||
"0x191735ae690",
|
||||
"exp"
|
||||
]
|
||||
}
|
||||
]
|
@ -1,101 +0,0 @@
|
||||
{
|
||||
"graph":{
|
||||
"layout_direction":0,
|
||||
"acyclic":true,
|
||||
"pipe_collision":false,
|
||||
"pipe_slicing":true,
|
||||
"pipe_style":1,
|
||||
"accept_connection_types":{},
|
||||
"reject_connection_types":{}
|
||||
},
|
||||
"nodes":{
|
||||
"0x25032ceeae0":{
|
||||
"type_":"bunny-lab.io.data_node.DataNode",
|
||||
"icon":null,
|
||||
"name":"Data Node",
|
||||
"color":[
|
||||
13,
|
||||
18,
|
||||
23,
|
||||
255
|
||||
],
|
||||
"border_color":[
|
||||
74,
|
||||
84,
|
||||
85,
|
||||
255
|
||||
],
|
||||
"text_color":[
|
||||
255,
|
||||
255,
|
||||
255,
|
||||
180
|
||||
],
|
||||
"disabled":false,
|
||||
"selected":false,
|
||||
"visible":true,
|
||||
"width":269.0,
|
||||
"height":74.2,
|
||||
"pos":[
|
||||
-140.9796961059538,
|
||||
314.0813482866816
|
||||
],
|
||||
"layout_direction":0,
|
||||
"port_deletion_allowed":false,
|
||||
"subgraph_session":{},
|
||||
"custom":{
|
||||
"value":"56"
|
||||
}
|
||||
},
|
||||
"0x250626018b0":{
|
||||
"type_":"bunny-lab.io.data_node.DataNode",
|
||||
"icon":null,
|
||||
"name":"Data Node 1",
|
||||
"color":[
|
||||
13,
|
||||
18,
|
||||
23,
|
||||
255
|
||||
],
|
||||
"border_color":[
|
||||
74,
|
||||
84,
|
||||
85,
|
||||
255
|
||||
],
|
||||
"text_color":[
|
||||
255,
|
||||
255,
|
||||
255,
|
||||
180
|
||||
],
|
||||
"disabled":false,
|
||||
"selected":false,
|
||||
"visible":true,
|
||||
"width":269.0,
|
||||
"height":74.2,
|
||||
"pos":[
|
||||
436.3232366823503,
|
||||
297.12809369166183
|
||||
],
|
||||
"layout_direction":0,
|
||||
"port_deletion_allowed":false,
|
||||
"subgraph_session":{},
|
||||
"custom":{
|
||||
"value":"56"
|
||||
}
|
||||
}
|
||||
},
|
||||
"connections":[
|
||||
{
|
||||
"out":[
|
||||
"0x25032ceeae0",
|
||||
"Output"
|
||||
],
|
||||
"in":[
|
||||
"0x250626018b0",
|
||||
"Input"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user