diff --git a/__pycache__/monop_parser.cpython-310.pyc b/__pycache__/monop_parser.cpython-310.pyc index a3a2d8a..38d2321 100644 Binary files a/__pycache__/monop_parser.cpython-310.pyc and b/__pycache__/monop_parser.cpython-310.pyc differ diff --git a/cardinal-plugin/monop/monop_parser.py b/cardinal-plugin/monop/monop_parser.py index 9b913a4..7fab73e 100644 --- a/cardinal-plugin/monop/monop_parser.py +++ b/cardinal-plugin/monop/monop_parser.py @@ -285,6 +285,7 @@ class MonopParser: if not is_info and g._buy_pending: # Resolve: use checkpoint peek if available + bought = False m_ck = self.CHECKPOINT_RE.match(msg) if m_ck: ck_money = int(m_ck.group(3)) @@ -296,6 +297,7 @@ class MonopParser: if ck_name == cp_buy.name: if abs(ck_money - expected) < abs(ck_money - cp_buy.money): cp_buy.money -= g.pending_buy_cost + bought = True else: # Checkpoint is for next player; can't peek buyer's money # Use last user input: if "n" or "no", declined @@ -303,10 +305,17 @@ class MonopParser: pass # declined else: cp_buy.money -= g.pending_buy_cost + bought = True else: cp_buy = g.current_player if cp_buy and g.pending_buy_cost: cp_buy.money -= g.pending_buy_cost + bought = True + # Assign ownership if purchase confirmed + if bought and cp_buy: + sq_id = cp_buy.location + if 0 <= sq_id < 40: + g.property_owner[sq_id] = cp_buy.number g._buy_pending = False g.pending_buy_cost = None @@ -759,6 +768,12 @@ class MonopParser: buyer = g.get_player(name=name, number=num) if buyer: buyer.money -= price + # The auctioned property is at the current player's location + cp = g.current_player + if cp: + sq_id = cp.location + if 0 <= sq_id < 40: + g.property_owner[sq_id] = num return if self.NOBODY_RE.match(msg): diff --git a/monop_parser.py b/monop_parser.py index 9b913a4..7fab73e 100644 --- a/monop_parser.py +++ b/monop_parser.py @@ -285,6 +285,7 @@ class MonopParser: if not is_info and g._buy_pending: # Resolve: use checkpoint peek if available + bought = False m_ck = self.CHECKPOINT_RE.match(msg) if m_ck: ck_money = int(m_ck.group(3)) @@ -296,6 +297,7 @@ class MonopParser: if ck_name == cp_buy.name: if abs(ck_money - expected) < abs(ck_money - cp_buy.money): cp_buy.money -= g.pending_buy_cost + bought = True else: # Checkpoint is for next player; can't peek buyer's money # Use last user input: if "n" or "no", declined @@ -303,10 +305,17 @@ class MonopParser: pass # declined else: cp_buy.money -= g.pending_buy_cost + bought = True else: cp_buy = g.current_player if cp_buy and g.pending_buy_cost: cp_buy.money -= g.pending_buy_cost + bought = True + # Assign ownership if purchase confirmed + if bought and cp_buy: + sq_id = cp_buy.location + if 0 <= sq_id < 40: + g.property_owner[sq_id] = cp_buy.number g._buy_pending = False g.pending_buy_cost = None @@ -759,6 +768,12 @@ class MonopParser: buyer = g.get_player(name=name, number=num) if buyer: buyer.money -= price + # The auctioned property is at the current player's location + cp = g.current_player + if cp: + sq_id = cp.location + if 0 <= sq_id < 40: + g.property_owner[sq_id] = num return if self.NOBODY_RE.match(msg):