From 6ceed8668e774df1d896007334eea6b19243c1e2 Mon Sep 17 00:00:00 2001 From: "theastropath@gmail.com" Date: Sun, 10 Sep 2023 13:37:58 -0400 Subject: [PATCH] Fix bingo viewer to use regex to parse bingo lines for more flexibility. Also adjust some bingo goal names. --- BingoDisplay.py | 25 +++++++++++++------------ DXRModules/DeusEx/Classes/DXREvents.uc | 4 ++-- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/BingoDisplay.py b/BingoDisplay.py index c575cb910..704930ef6 100644 --- a/BingoDisplay.py +++ b/BingoDisplay.py @@ -5,6 +5,7 @@ import os.path import urllib.request import urllib.parse +import re from tkinter import filedialog as fd from tkinter import font from tkinter import messagebox @@ -40,6 +41,7 @@ def __init__(self,targetFile): self.height=500 self.selectedMod="" self.prevLines=None + self.bingoLineMatch = re.compile(r'bingoexport\[(?P\d+)\]=\(Event="(?P.*)",Desc="(?P.*)",Progress=(?P\d+),Max=(?P\d+),Active=(?P\d+)\)') self.initDrawnBoard() def closeWindow(self): @@ -139,20 +141,19 @@ def bingoNumberToCoord(self,bingoNumber): return (x,y) def parseBingoLine(self,bingoLine): - bingoNumber = int(bingoLine.split("[")[1].split("]")[0]) + bingoMatches=self.bingoLineMatch.match(bingoLine) + if (bingoMatches==None): + return + + bingoNumber=int(bingoMatches.group('key')) bingoCoord = self.bingoNumberToCoord(bingoNumber) - state = "=".join(bingoLine.split("=")[1:])[1:-1] - fields = state.split(",") + bingoItem = dict() - for field in fields: - split = field.split("=") - fieldName = split[0].lower() - fieldVal = split[1].replace('"',"") - try: - fieldVal = int(fieldVal) - except: - pass - bingoItem[fieldName]=fieldVal + bingoItem["event"]=bingoMatches.group('event') + bingoItem["desc"]=bingoMatches.group('desc') + bingoItem["progress"]=int(bingoMatches.group('progress')) + bingoItem["max"]=int(bingoMatches.group('max')) + bingoItem["active"]=int(bingoMatches.group('active')) self.board[bingoCoord[0]][bingoCoord[1]] = bingoItem diff --git a/DXRModules/DeusEx/Classes/DXREvents.uc b/DXRModules/DeusEx/Classes/DXREvents.uc index c46b43dd9..b59d19ff2 100644 --- a/DXRModules/DeusEx/Classes/DXREvents.uc +++ b/DXRModules/DeusEx/Classes/DXREvents.uc @@ -3425,7 +3425,7 @@ defaultproperties bingo_options(223)=(event="02_Email05",desc="Paul's Classic Movies",max=1,missions=4) bingo_options(224)=(event="11_Book08",desc="Read Adept 34501's diary",max=1,missions=2048) bingo_options(225)=(event="GasStationCeiling",desc="Access the ceiling of a gas station",max=1,missions=4096) - bingo_options(226)=(event="NicoletteHouseTour",desc="Get a tour of %s parts of Chateau DuClare from Nicolette",max=5,missions=1024) + bingo_options(226)=(event="NicoletteHouseTour",desc="Tour %s parts of Chateau DuClare with Nicolette",max=5,missions=1024) bingo_options(227)=(event="nico_fireplace",desc="Access Nicolette's secret stash",max=1,missions=1024) bingo_options(228)=(event="dumbwaiter",desc="Not so dumb now!",max=1,missions=1024) bingo_options(229)=(event="secretdoor01",desc="Open the secret door in the cathedral",max=1,missions=2048) @@ -3435,7 +3435,7 @@ defaultproperties bingo_options(233)=(event="VendingMachineEmpty",desc="All Sold Out! (%s)",max=18,missions=36734) bingo_options(234)=(event="VendingMachineEmpty_Drink",desc="I Wanted Orange! (%s)",max=12,missions=36734) bingo_options(235)=(event="VendingMachineDispense_Candy",desc="Ooh, a piece of candy! (%s)",max=100,missions=36478) - bingo_options(236)=(event="M06JCHasDate",desc="Pay for some companionship",max=1,missions=64) + bingo_options(236)=(event="M06JCHasDate",desc="Pay for some company",max=1,missions=64) bingo_options(237)=(event="Sailor_ClassDeadM6",desc="I spilled %s drinks!",max=5,missions=64) bingo_options(238)=(event="Shannon_Dead",desc="Kill the thief in UNATCO",max=1,missions=58) bingo_options(239)=(event="DestroyCapitalism",desc="MUST. CRUSH. %s CAPITALISTS.",max=10,missions=1406)