diff --git a/Nodes/Flyff/__pycache__/flyff_character_status_node.cpython-312.pyc b/Nodes/Flyff/__pycache__/flyff_character_status_node.cpython-312.pyc index 52b9809..cbe246a 100644 Binary files a/Nodes/Flyff/__pycache__/flyff_character_status_node.cpython-312.pyc and b/Nodes/Flyff/__pycache__/flyff_character_status_node.cpython-312.pyc differ diff --git a/Nodes/Flyff/flyff_character_status_node.py b/Nodes/Flyff/flyff_character_status_node.py index 6b6fe37..4498261 100644 --- a/Nodes/Flyff/flyff_character_status_node.py +++ b/Nodes/Flyff/flyff_character_status_node.py @@ -8,7 +8,7 @@ Flyff Character Status Node: import re from OdenGraphQt import BaseNode from PyQt5.QtWidgets import QMessageBox -from PyQt5.QtCore import QTimer +from PyQt5.QtCore import QTimer # Corrected import from Modules import data_manager, data_collector class FlyffCharacterStatusNode(BaseNode): @@ -42,20 +42,14 @@ 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: @@ -78,10 +72,8 @@ 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 @@ -91,8 +83,7 @@ class FlyffCharacterStatusNode(BaseNode): Called periodically to update character status from OCR. """ raw_text = data_collector.get_raw_text(self.region_id) - # Uncomment below for debugging if needed: - # print("Raw OCR Text:", repr(raw_text)) +# print("Raw OCR Text:", raw_text) # Debugging OCR text reading hp_c, hp_t, mp_c, mp_t, fp_c, fp_t, exp_v = self.parse_character_stats(raw_text) diff --git a/Workflows/test.json b/Workflows/test.json new file mode 100644 index 0000000..ad50743 --- /dev/null +++ b/Workflows/test.json @@ -0,0 +1,101 @@ +{ + "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" + ] + } + ] +} \ No newline at end of file diff --git a/Workflows/Flyff - EXP Calculator.json b/Workflows/test2.json similarity index 50% rename from Workflows/Flyff - EXP Calculator.json rename to Workflows/test2.json index 1107099..fe8f3be 100644 --- a/Workflows/Flyff - EXP Calculator.json +++ b/Workflows/test2.json @@ -9,10 +9,10 @@ "reject_connection_types":{} }, "nodes":{ - "0x191410fec90":{ - "type_":"bunny-lab.io.flyff_character_status_node.FlyffCharacterStatusNode", + "0x25062603f80":{ + "type_":"bunny-lab.io.data_node.DataNode", "icon":null, - "name":"Flyff - Character Status", + "name":"Data Node", "color":[ 13, 18, @@ -34,64 +34,23 @@ "disabled":false, "selected":false, "visible":true, - "width":278.0, - "height":200.20000000000002, - "pos":[ - -234.47843187544638, - 171.50740184739476 - ], - "layout_direction":0, - "port_deletion_allowed":false, - "subgraph_session":{}, - "custom":{ - "hp":"HP: 5848/5848", - "mp":"MP: 955/555", - "fp":"FP: 0/0", - "exp":"EXP: 49.0%" - } - }, - "0x19173496de0":{ - "type_":"bunny-lab.io.flyff_exp_current_node.FlyffEXPCurrentNode", - "icon":null, - "name":"Flyff - EXP (API Connected)", - "color":[ - 13, - 18, - 23, - 255 - ], - "border_color":[ - 74, - 84, - 85, - 255 - ], - "text_color":[ - 255, - 255, - 255, - 180 - ], - "disabled":false, - "selected":false, - "visible":true, - "width":339.0, + "width":269.0, "height":74.2, "pos":[ - -237.34556433027646, - 77.62806051403777 + -183.12907239097774, + 203.3685322819906 ], "layout_direction":0, "port_deletion_allowed":false, "subgraph_session":{}, "custom":{ - "value":"49.0" + "value":"25" } }, - "0x191735ae690":{ - "type_":"bunny-lab.io.flyff_leveling_predictor_node.FlyffLevelingPredictorNode", + "0x250626141a0":{ + "type_":"bunny-lab.io.data_node.DataNode", "icon":null, - "name":"Flyff - Leveling Predictor", + "name":"Data Node 1", "color":[ 13, 18, @@ -113,26 +72,23 @@ "disabled":false, "selected":false, "visible":true, - "width":324.0, - "height":200.20000000000002, + "width":269.0, + "height":74.2, "pos":[ - 170.42482250783007, - 77.62806051403777 + 279.96246102035116, + 512.9884977805091 ], "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" + "value":"25" } }, - "0x191735ae9c0":{ + "0x250626159d0":{ "type_":"bunny-lab.io.backdrop.BackdropNode", "icon":null, - "name":"Track EXP Changes Over Time to Predict Leveling Up", + "name":"flask", "color":[ 5, 129, @@ -154,11 +110,11 @@ "disabled":false, "selected":false, "visible":true, - "width":777.8842478973615, - "height":380.82117975084645, + "width":804.65254462634, + "height":483.4329838785975, "pos":[ - -264.113861059255, - 23.199190498448075 + -205.22360825550223, + 146.33335545174936 ], "layout_direction":0, "port_deletion_allowed":false, @@ -171,12 +127,12 @@ "connections":[ { "out":[ - "0x19173496de0", - "value" + "0x25062603f80", + "Output" ], "in":[ - "0x191735ae690", - "exp" + "0x250626141a0", + "Input" ] } ]