Skip to content

Commit

Permalink
Fix bingo viewer to use regex to parse bingo lines for more flexibility.
Browse files Browse the repository at this point in the history
Also adjust some bingo goal names.
  • Loading branch information
theastropath committed Sep 10, 2023
1 parent 678c272 commit 6ceed86
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
25 changes: 13 additions & 12 deletions BingoDisplay.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -40,6 +41,7 @@ def __init__(self,targetFile):
self.height=500
self.selectedMod=""
self.prevLines=None
self.bingoLineMatch = re.compile(r'bingoexport\[(?P<key>\d+)\]=\(Event="(?P<event>.*)",Desc="(?P<desc>.*)",Progress=(?P<progress>\d+),Max=(?P<max>\d+),Active=(?P<active>\d+)\)')
self.initDrawnBoard()

def closeWindow(self):
Expand Down Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions DXRModules/DeusEx/Classes/DXREvents.uc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit 6ceed86

Please sign in to comment.