Revert "Fixed API Issues with Flyff Collector Node"

This reverts commit 038de06bfd7cb323373ffb5d178a7b1ce18f9370.
This commit is contained in:
Nicole Rappe 2025-02-25 19:04:25 -07:00
parent 62144b3588
commit 78ca945581
4 changed files with 131 additions and 83 deletions

View File

@ -8,7 +8,7 @@ Flyff Character Status Node:
import re import re
from OdenGraphQt import BaseNode from OdenGraphQt import BaseNode
from PyQt5.QtWidgets import QMessageBox from PyQt5.QtWidgets import QMessageBox
from PyQt5.QtCore import QTimer from PyQt5.QtCore import QTimer # Corrected import
from Modules import data_manager, data_collector from Modules import data_manager, data_collector
class FlyffCharacterStatusNode(BaseNode): class FlyffCharacterStatusNode(BaseNode):
@ -42,20 +42,14 @@ class FlyffCharacterStatusNode(BaseNode):
def parse_character_stats(self, raw_text): def parse_character_stats(self, raw_text):
""" """
Extract HP, MP, FP, EXP from the raw OCR text lines. 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()] 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 hp_current, hp_total = 0, 0
mp_current, mp_total = 0, 0 mp_current, mp_total = 0, 0
fp_current, fp_total = 0, 0 fp_current, fp_total = 0, 0
exp_value = 0.0 exp_value = 0.0
if len(lines) == 4: if len(lines) >= 4:
# line 1: HP # line 1: HP
hp_match = re.search(r"(\d+)\s*/\s*(\d+)", lines[0]) hp_match = re.search(r"(\d+)\s*/\s*(\d+)", lines[0])
if hp_match: if hp_match:
@ -78,10 +72,8 @@ class FlyffCharacterStatusNode(BaseNode):
exp_match = re.search(r"(\d+(?:\.\d+)?)", lines[3]) exp_match = re.search(r"(\d+(?:\.\d+)?)", lines[3])
if exp_match: if exp_match:
val = float(exp_match.group(1)) val = float(exp_match.group(1))
if val < 0: if val < 0: val = 0
val = 0 if val > 100: val = 100
if val > 100:
val = 100
exp_value = val exp_value = val
return hp_current, hp_total, mp_current, mp_total, fp_current, fp_total, exp_value 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. Called periodically to update character status from OCR.
""" """
raw_text = data_collector.get_raw_text(self.region_id) raw_text = data_collector.get_raw_text(self.region_id)
# Uncomment below for debugging if needed: # print("Raw OCR Text:", raw_text) # Debugging OCR text reading
# 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) hp_c, hp_t, mp_c, mp_t, fp_c, fp_t, exp_v = self.parse_character_stats(raw_text)

101
Workflows/test.json Normal file
View File

@ -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"
]
}
]
}

View File

@ -9,10 +9,10 @@
"reject_connection_types":{} "reject_connection_types":{}
}, },
"nodes":{ "nodes":{
"0x191410fec90":{ "0x25062603f80":{
"type_":"bunny-lab.io.flyff_character_status_node.FlyffCharacterStatusNode", "type_":"bunny-lab.io.data_node.DataNode",
"icon":null, "icon":null,
"name":"Flyff - Character Status", "name":"Data Node",
"color":[ "color":[
13, 13,
18, 18,
@ -34,64 +34,23 @@
"disabled":false, "disabled":false,
"selected":false, "selected":false,
"visible":true, "visible":true,
"width":278.0, "width":269.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,
"height":74.2, "height":74.2,
"pos":[ "pos":[
-237.34556433027646, -183.12907239097774,
77.62806051403777 203.3685322819906
], ],
"layout_direction":0, "layout_direction":0,
"port_deletion_allowed":false, "port_deletion_allowed":false,
"subgraph_session":{}, "subgraph_session":{},
"custom":{ "custom":{
"value":"49.0" "value":"25"
} }
}, },
"0x191735ae690":{ "0x250626141a0":{
"type_":"bunny-lab.io.flyff_leveling_predictor_node.FlyffLevelingPredictorNode", "type_":"bunny-lab.io.data_node.DataNode",
"icon":null, "icon":null,
"name":"Flyff - Leveling Predictor", "name":"Data Node 1",
"color":[ "color":[
13, 13,
18, 18,
@ -113,26 +72,23 @@
"disabled":false, "disabled":false,
"selected":false, "selected":false,
"visible":true, "visible":true,
"width":324.0, "width":269.0,
"height":200.20000000000002, "height":74.2,
"pos":[ "pos":[
170.42482250783007, 279.96246102035116,
77.62806051403777 512.9884977805091
], ],
"layout_direction":0, "layout_direction":0,
"port_deletion_allowed":false, "port_deletion_allowed":false,
"subgraph_session":{}, "subgraph_session":{},
"custom":{ "custom":{
"exp_track_count":"7", "value":"25"
"time_to_level":"Insufficient data",
"time_between_kills":"N/A",
"exp_per_kill":"N/A"
} }
}, },
"0x191735ae9c0":{ "0x250626159d0":{
"type_":"bunny-lab.io.backdrop.BackdropNode", "type_":"bunny-lab.io.backdrop.BackdropNode",
"icon":null, "icon":null,
"name":"Track EXP Changes Over Time to Predict Leveling Up", "name":"flask",
"color":[ "color":[
5, 5,
129, 129,
@ -154,11 +110,11 @@
"disabled":false, "disabled":false,
"selected":false, "selected":false,
"visible":true, "visible":true,
"width":777.8842478973615, "width":804.65254462634,
"height":380.82117975084645, "height":483.4329838785975,
"pos":[ "pos":[
-264.113861059255, -205.22360825550223,
23.199190498448075 146.33335545174936
], ],
"layout_direction":0, "layout_direction":0,
"port_deletion_allowed":false, "port_deletion_allowed":false,
@ -171,12 +127,12 @@
"connections":[ "connections":[
{ {
"out":[ "out":[
"0x19173496de0", "0x25062603f80",
"value" "Output"
], ],
"in":[ "in":[
"0x191735ae690", "0x250626141a0",
"exp" "Input"
] ]
} }
] ]