mirror of
https://github.com/fishyboteso/fishyboteso.git
synced 2024-08-30 18:32:13 +00:00
fixup luaparser
This commit is contained in:
parent
b6a375f486
commit
58457ef798
@ -10,7 +10,7 @@ import logging
|
||||
from fishy.engine.semifisher.fishing_event import FishEvent
|
||||
|
||||
from fishy.engine.common.window import WindowClient
|
||||
from fishy.engine.semifisher.fishing_mode import State, FishingMode
|
||||
from fishy.engine.semifisher.fishing_mode import Colors, FishingMode
|
||||
|
||||
from fishy.engine.common.IEngine import IEngine
|
||||
from fishy.engine.semifisher import fishing_mode, fishing_event
|
||||
@ -38,7 +38,7 @@ class SemiFisherEngine(IEngine):
|
||||
# check for game window and stuff
|
||||
self.gui.bot_started(True)
|
||||
|
||||
sv_color_extract(State)
|
||||
sv_color_extract(Colors)
|
||||
|
||||
if self.get_gui:
|
||||
logging.info("Starting the bot engine, look at the fishing hole to start fishing")
|
||||
|
@ -18,7 +18,7 @@ def _sv_parser(path):
|
||||
EXPRESSIONS: A) List-Start "name=", B) Variable assignment "name=val", C) List End "}"
|
||||
"""
|
||||
for old, new in ((",","\n"), ("{","{\n"), ("}","}\n"), ("{",""), (",", ""), ("[", ""), ("]", ""), ('"', ""), (" ", "")):
|
||||
lua = lua.replace(old, new)
|
||||
lua = lua.replace(old, new)
|
||||
lua = lua.lower().split("\n")
|
||||
lua = [expression for expression in lua if expression]
|
||||
|
||||
@ -54,10 +54,10 @@ def _sv_parser(path):
|
||||
return None
|
||||
|
||||
|
||||
def sv_color_extract(states):
|
||||
def sv_color_extract(Colors):
|
||||
root = _sv_parser(os.path.join(get_savedvarsdir(), "Chalutier.lua"))
|
||||
if root == None:
|
||||
return states
|
||||
return Colors
|
||||
|
||||
for i in range(4):
|
||||
name, root = root.popitem()
|
||||
@ -73,7 +73,7 @@ def sv_color_extract(states):
|
||||
floor(float(root["colors"][i]["b"])*255)
|
||||
]
|
||||
colors.append(rgb)
|
||||
for i,s in enumerate(states):
|
||||
states[s] = colors[i]
|
||||
return states
|
||||
for i,c in enumerate(Colors):
|
||||
Colors[c] = colors[i]
|
||||
return Colors
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user