51 lines
1.9 KiB
Python
51 lines
1.9 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Flyff EXP Node (Final Combined Version)
|
|
- Pulls the EXP value directly from data_manager.py
|
|
- Outputs only the "exp" value as a string
|
|
- Uses color (48, 116, 143) for its output port
|
|
- Displays "exp" in a text field labeled "Value"
|
|
- Retrieves the port with self.outputs().get('value')
|
|
"""
|
|
|
|
import time
|
|
import traceback
|
|
from OdenGraphQt import BaseNode
|
|
from Modules import data_manager # Importing data_manager from Modules
|
|
|
|
class FlyffEXPCurrentNode(BaseNode):
|
|
__identifier__ = 'bunny-lab.io.flyff_exp_current_node'
|
|
NODE_NAME = 'Flyff - EXP'
|
|
|
|
def __init__(self):
|
|
super(FlyffEXPCurrentNode, self).__init__()
|
|
|
|
# 1) Text input property named "value" for UI display
|
|
self.add_text_input('value', 'Value', text='N/A')
|
|
|
|
# 2) Output port also named "value"
|
|
self.add_output('value', color=(48, 116, 143))
|
|
|
|
self.set_name("Flyff - EXP")
|
|
|
|
def process_input(self):
|
|
try:
|
|
new_value = data_manager.get_data().get("exp", "N/A")
|
|
new_value_str = str(new_value)
|
|
self.set_property('value', new_value_str)
|
|
self.transmit_data(new_value_str)
|
|
except Exception as e:
|
|
tb = traceback.format_exc()
|
|
print(f"[ERROR] Exception in FlyffEXPCurrentNode: {e}\nTraceback:\n{tb}")
|
|
|
|
def transmit_data(self, data):
|
|
output_port = self.outputs().get('value')
|
|
if output_port and output_port.connected_ports():
|
|
for connected_port in output_port.connected_ports():
|
|
connected_node = connected_port.node()
|
|
if hasattr(connected_node, 'receive_data'):
|
|
try:
|
|
connected_node.receive_data(data, source_port_name='value')
|
|
except Exception as e:
|
|
print(f"[ERROR] Error transmitting data to {connected_node}: {e}")
|