Skip to content

Commit

Permalink
interesting changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Hexalgo committed Dec 1, 2024
1 parent 1f92bae commit f98c9fb
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from pydofus2.com.ankamagames.dofus.modules.utils.pathFinding.world.Vertex import Vertex
from pydofus2.com.ankamagames.jerakine.data.XmlConfig import XmlConfig
from pydofus2.com.ankamagames.jerakine.logger.Logger import Logger
from pydofus2.com.ankamagames.jerakine.metaclass.ThreadSharedSingleton import ThreadSharedSingleton
from pydofus2.com.ankamagames.jerakine.metaclass.Singleton import Singleton
from pydofus2.com.ankamagames.jerakine.network.CustomDataWrapper import ByteArray
from pydofus2.com.ankamagames.jerakine.types.enums.DirectionsEnum import DirectionsEnum
from pydofus2.mapTools import MapTools
Expand All @@ -25,7 +25,7 @@
EDGE_PATCHES_FILE = os.path.join(__dir__, "edge_patches.json")


class WorldGraph(metaclass=ThreadSharedSingleton):
class WorldGraph(metaclass=Singleton):
def __init__(self):
self._vertices = dict[int, dict[int, Vertex]]()
self._edges = dict[float, Edge]()
Expand Down Expand Up @@ -133,7 +133,7 @@ def getOutgoingEdgesFromVertex(self, src: Vertex) -> List[Edge]:
return None

result = self._outgoingEdges.get(src.UID, [])
rappel_potion_edge = self.getRappelPotionEdge(src)
rappel_potion_edge = self.getTpPotionEdges(src)
if rappel_potion_edge:
result.append(rappel_potion_edge)
zaap_edges = self.getOutgoingZaapEdges(src)
Expand All @@ -154,7 +154,7 @@ def getOutgoingZaapEdges(self, src: Vertex):

return self.getEdgesToKnownZaapsFromVertex(src, TransitionTypeEnum.ZAAP)

def getRappelPotionEdge(self, src: Vertex) -> Edge:
def getTpPotionEdges(self, src: Vertex) -> Edge:
from pydofus2.com.ankamagames.dofus.kernel.Kernel import Kernel
from pydofus2.com.ankamagames.dofus.logic.game.common.managers.InventoryManager import InventoryManager

Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"allow_havenbag": {"1": {"map_id": 128452097, "allowed": false}, "2": {"map_id": 128453121, "allowed": false}, "3": {"map_id": 128451073, "allowed": false}, "4": {"map_id": 139785, "allowed": false}, "5": {"map_id": 139784, "allowed": false}, "6": {"map_id": 209454086, "allowed": false}, "7": {"map_id": 207620106, "allowed": false}, "8": {"map_id": 209455108, "allowed": false}, "9": {"map_id": 209455112, "allowed": false}, "10": {"map_id": 206308353, "allowed": false}}, "zaap_vertices": {"1": {"key": "185860609.0,1", "is_zaap": true, "map_id": 185860609.0, "zone_id": 1}, "2": {"key": "191105026.0,1", "is_zaap": true, "map_id": 191105026.0, "zone_id": 1}, "3": {"key": "142087694.0,1", "is_zaap": true, "map_id": 142087694.0, "zone_id": 1}, "4": {"key": "88082704.0,1", "is_zaap": true, "map_id": 88082704.0, "zone_id": 1}, "5": {"key": "88212746.0,1", "is_zaap": true, "map_id": 88212746.0, "zone_id": 1}, "6": {"key": "88212481.0,1", "is_zaap": true, "map_id": 88212481.0, "zone_id": 1}, "7": {"key": "88085249.0,1", "is_zaap": true, "map_id": 88085249.0, "zone_id": 1}, "8": {"key": "120062979.0,1", "is_zaap": true, "map_id": 120062979.0, "zone_id": 1}, "9": {"key": "156240386.0,1", "is_zaap": true, "map_id": 156240386.0, "zone_id": 1}, "10": {"key": "173278210.0,1", "is_zaap": true, "map_id": 173278210.0, "zone_id": 1}, "11": {"key": "68552706.0,1", "is_zaap": true, "map_id": 68552706.0, "zone_id": 1}, "12": {"key": "207619076.0,1", "is_zaap": true, "map_id": 207619076.0, "zone_id": 1}, "13": {"key": "154642.0,1", "is_zaap": true, "map_id": 154642.0, "zone_id": 1}, "14": {"key": "88213271.0,1", "is_zaap": true, "map_id": 88213271.0, "zone_id": 1}, "15": {"key": "84806401.0,1", "is_zaap": true, "map_id": 84806401.0, "zone_id": 1}, "16": {"key": "54172969.0,1", "is_zaap": true, "map_id": 54172969.0, "zone_id": 1}, "17": {"key": "147590153.0,1", "is_zaap": true, "map_id": 147590153.0, "zone_id": 1}, "18": {"key": "73400320.0,1", "is_zaap": true, "map_id": 73400320.0, "zone_id": 1}, "19": {"key": "212600323.0,1", "is_zaap": true, "map_id": 212600323.0, "zone_id": 1}, "20": {"key": "100270593.0,1", "is_zaap": true, "map_id": 100270593.0, "zone_id": 1}, "21": {"key": "164364304.0,1", "is_zaap": true, "map_id": 164364304.0, "zone_id": 1}, "22": {"key": "95422468.0,1", "is_zaap": true, "map_id": 95422468.0, "zone_id": 1}, "23": {"key": "68419587.0,1", "is_zaap": true, "map_id": 68419587.0, "zone_id": 1}, "24": {"key": "171967506.0,1", "is_zaap": true, "map_id": 171967506.0, "zone_id": 1}, "25": {"key": "126094107.0,1", "is_zaap": true, "map_id": 126094107.0, "zone_id": 1}, "26": {"key": "165153537.0,1", "is_zaap": true, "map_id": 165153537.0, "zone_id": 1}, "27": {"key": "165152263.0,1", "is_zaap": true, "map_id": 165152263.0, "zone_id": 1}, "28": {"key": "179831296.0,1", "is_zaap": true, "map_id": 179831296.0, "zone_id": 1}, "29": {"key": "223349001.0,1", "is_zaap": true, "map_id": 223349001.0, "zone_id": 1}, "30": {"key": "212861955.0,1", "is_zaap": true, "map_id": 212861955.0, "zone_id": 1}, "31": {"key": "154010371.0,1", "is_zaap": true, "map_id": 154010371.0, "zone_id": 1}, "32": {"key": "153879813.0,1", "is_zaap": true, "map_id": 153879813.0, "zone_id": 1}, "33": {"key": "153880064.0,1", "is_zaap": true, "map_id": 153880064.0, "zone_id": 1}}}
{"allow_havenbag": {"1": {"map_id": 128452097, "allowed": false}, "2": {"map_id": 128453121, "allowed": false}, "3": {"map_id": 128451073, "allowed": false}, "4": {"map_id": 139785, "allowed": false}, "5": {"map_id": 139784, "allowed": false}, "6": {"map_id": 209454086, "allowed": false}, "7": {"map_id": 207620106, "allowed": false}, "8": {"map_id": 209455108, "allowed": false}, "9": {"map_id": 209455112, "allowed": false}, "10": {"map_id": 206308353, "allowed": false}}, "zaap_vertices": {"1": {"key": "185860609.0,1", "is_zaap": true, "map_id": 185860609.0, "zone_id": 1}, "2": {"key": "191105026.0,1", "is_zaap": true, "map_id": 191105026.0, "zone_id": 1}, "3": {"key": "142087694.0,1", "is_zaap": true, "map_id": 142087694.0, "zone_id": 1}, "4": {"key": "88082704.0,1", "is_zaap": true, "map_id": 88082704.0, "zone_id": 1}, "5": {"key": "88212746.0,1", "is_zaap": true, "map_id": 88212746.0, "zone_id": 1}, "6": {"key": "88212481.0,1", "is_zaap": true, "map_id": 88212481.0, "zone_id": 1}, "7": {"key": "88085249.0,1", "is_zaap": true, "map_id": 88085249.0, "zone_id": 1}, "8": {"key": "120062979.0,1", "is_zaap": true, "map_id": 120062979.0, "zone_id": 1}, "9": {"key": "156240386.0,1", "is_zaap": true, "map_id": 156240386.0, "zone_id": 1}, "10": {"key": "173278210.0,1", "is_zaap": true, "map_id": 173278210.0, "zone_id": 1}, "11": {"key": "68552706.0,1", "is_zaap": true, "map_id": 68552706.0, "zone_id": 1}, "12": {"key": "207619076.0,1", "is_zaap": true, "map_id": 207619076.0, "zone_id": 1}, "13": {"key": "154642.0,1", "is_zaap": true, "map_id": 154642.0, "zone_id": 1}, "14": {"key": "88213271.0,1", "is_zaap": true, "map_id": 88213271.0, "zone_id": 1}, "15": {"key": "84806401.0,1", "is_zaap": true, "map_id": 84806401.0, "zone_id": 1}, "16": {"key": "54172969.0,1", "is_zaap": true, "map_id": 54172969.0, "zone_id": 1}, "17": {"key": "147590153.0,1", "is_zaap": true, "map_id": 147590153.0, "zone_id": 1}, "18": {"key": "73400320.0,1", "is_zaap": true, "map_id": 73400320.0, "zone_id": 1}, "19": {"key": "212600323.0,1", "is_zaap": true, "map_id": 212600323.0, "zone_id": 1}, "20": {"key": "100270593.0,1", "is_zaap": true, "map_id": 100270593.0, "zone_id": 1}, "21": {"key": "164364304.0,1", "is_zaap": true, "map_id": 164364304.0, "zone_id": 1}, "22": {"key": "95422468.0,1", "is_zaap": true, "map_id": 95422468.0, "zone_id": 1}, "23": {"key": "68419587.0,1", "is_zaap": true, "map_id": 68419587.0, "zone_id": 1}, "24": {"key": "171967506.0,1", "is_zaap": true, "map_id": 171967506.0, "zone_id": 1}, "25": {"key": "126094107.0,1", "is_zaap": true, "map_id": 126094107.0, "zone_id": 1}, "26": {"key": "165153537.0,1", "is_zaap": true, "map_id": 165153537.0, "zone_id": 1}, "27": {"key": "165152263.0,1", "is_zaap": true, "map_id": 165152263.0, "zone_id": 1}, "28": {"key": "179831296.0,1", "is_zaap": true, "map_id": 179831296.0, "zone_id": 1}, "29": {"key": "223349001.0,1", "is_zaap": true, "map_id": 223349001.0, "zone_id": 1}, "30": {"key": "212861955.0,1", "is_zaap": true, "map_id": 212861955.0, "zone_id": 1}, "31": {"key": "154010371.0,1", "is_zaap": true, "map_id": 154010371.0, "zone_id": 1}, "32": {"key": "153879813.0,1", "is_zaap": true, "map_id": 153879813.0, "zone_id": 1}, "33": {"key": "153880064.0,1", "is_zaap": true, "map_id": 153880064.0, "zone_id": 1}}}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ class BenchmarkTimer(threading.Thread):
_timers = defaultdict(list)
_timers_count = 0
_started_timers_count = 0
logger = Logger()

def __init__(
self, interval: float, function: FunctionType, args: Optional[list] = None, kwargs: Optional[dict] = None
Expand Down Expand Up @@ -61,7 +60,7 @@ def run(self) -> None:
if not self.finished.wait(self.interval):
core.Kernel().defer(lambda: self.function(*self.args, **self.kwargs))
except Exception as e:
self.logger.error(f"Error in timer execution: {e}")
Logger().error(f"Error in timer execution: {e}", exc_info=e)
finally:
self.finished.set()
self._cleanup()
Expand Down

0 comments on commit f98c9fb

Please sign in to comment.