remove unnecessary ternaries in multiclient
This commit is contained in:
parent
b1cf1a80e6
commit
129d2ec037
|
@ -940,7 +940,7 @@ async def process_server_cmd(ctx: Context, cmd, args):
|
||||||
ctx.ui_node.notify_item_sent(ctx.player_names[player_sent], ctx.player_names[player_recvd],
|
ctx.ui_node.notify_item_sent(ctx.player_names[player_sent], ctx.player_names[player_recvd],
|
||||||
get_item_name_from_id(item), get_location_name_from_address(location),
|
get_item_name_from_id(item), get_location_name_from_address(location),
|
||||||
player_sent == ctx.slot, player_recvd == ctx.slot,
|
player_sent == ctx.slot, player_recvd == ctx.slot,
|
||||||
True if get_item_name_from_id(item) in Items.progression_items else False)
|
get_item_name_from_id(item) in Items.progression_items)
|
||||||
item = color_item(item, player_sent == ctx.slot)
|
item = color_item(item, player_sent == ctx.slot)
|
||||||
player_sent = color(ctx.player_names[player_sent], 'yellow' if player_sent != ctx.slot else 'magenta')
|
player_sent = color(ctx.player_names[player_sent], 'yellow' if player_sent != ctx.slot else 'magenta')
|
||||||
player_recvd = color(ctx.player_names[player_recvd], 'yellow' if player_recvd != ctx.slot else 'magenta')
|
player_recvd = color(ctx.player_names[player_recvd], 'yellow' if player_recvd != ctx.slot else 'magenta')
|
||||||
|
@ -952,7 +952,7 @@ async def process_server_cmd(ctx: Context, cmd, args):
|
||||||
found = ReceivedItem(*args)
|
found = ReceivedItem(*args)
|
||||||
ctx.ui_node.notify_item_found(ctx.player_names[found.player], get_item_name_from_id(found.item),
|
ctx.ui_node.notify_item_found(ctx.player_names[found.player], get_item_name_from_id(found.item),
|
||||||
get_location_name_from_address(found.location), found.player == ctx.slot,
|
get_location_name_from_address(found.location), found.player == ctx.slot,
|
||||||
True if get_item_name_from_id(found.item) in Items.progression_items else False)
|
get_item_name_from_id(found.item) in Items.progression_items)
|
||||||
item = color_item(found.item, found.player == ctx.slot)
|
item = color_item(found.item, found.player == ctx.slot)
|
||||||
player_sent = color(ctx.player_names[found.player], 'yellow' if found.player != ctx.slot else 'magenta')
|
player_sent = color(ctx.player_names[found.player], 'yellow' if found.player != ctx.slot else 'magenta')
|
||||||
logging.info('%s found %s (%s)' % (player_sent, item, color(get_location_name_from_address(found.location),
|
logging.info('%s found %s (%s)' % (player_sent, item, color(get_location_name_from_address(found.location),
|
||||||
|
@ -1089,7 +1089,7 @@ class ClientCommandProcessor(CommandProcessor):
|
||||||
self.ctx.ui_node.notify_item_received(self.ctx.player_names[item.player], get_item_name_from_id(item.item),
|
self.ctx.ui_node.notify_item_received(self.ctx.player_names[item.player], get_item_name_from_id(item.item),
|
||||||
get_location_name_from_address(item.location), index,
|
get_location_name_from_address(item.location), index,
|
||||||
len(self.ctx.items_received),
|
len(self.ctx.items_received),
|
||||||
True if get_item_name_from_id(item.item) in Items.progression_items else False)
|
get_item_name_from_id(item.item) in Items.progression_items)
|
||||||
logging.info('%s from %s (%s) (%d/%d in list)' % (
|
logging.info('%s from %s (%s) (%d/%d in list)' % (
|
||||||
color(get_item_name_from_id(item.item), 'red', 'bold'),
|
color(get_item_name_from_id(item.item), 'red', 'bold'),
|
||||||
color(self.ctx.player_names[item.player], 'yellow'),
|
color(self.ctx.player_names[item.player], 'yellow'),
|
||||||
|
@ -1348,7 +1348,7 @@ async def game_watcher(ctx : Context):
|
||||||
ctx.ui_node.notify_item_received(ctx.player_names[item.player], get_item_name_from_id(item.item),
|
ctx.ui_node.notify_item_received(ctx.player_names[item.player], get_item_name_from_id(item.item),
|
||||||
get_location_name_from_address(item.location), recv_index + 1,
|
get_location_name_from_address(item.location), recv_index + 1,
|
||||||
len(ctx.items_received),
|
len(ctx.items_received),
|
||||||
True if get_item_name_from_id(item.item) in Items.progression_items else False)
|
get_item_name_from_id(item.item) in Items.progression_items)
|
||||||
logging.info('Received %s from %s (%s) (%d/%d in list)' % (
|
logging.info('Received %s from %s (%s) (%d/%d in list)' % (
|
||||||
color(get_item_name_from_id(item.item), 'red', 'bold'), color(ctx.player_names[item.player], 'yellow'),
|
color(get_item_name_from_id(item.item), 'red', 'bold'), color(ctx.player_names[item.player], 'yellow'),
|
||||||
get_location_name_from_address(item.location), recv_index + 1, len(ctx.items_received)))
|
get_location_name_from_address(item.location), recv_index + 1, len(ctx.items_received)))
|
||||||
|
|
12
WebUI.py
12
WebUI.py
|
@ -58,9 +58,9 @@ class WebUiClient(Node, logging.Handler):
|
||||||
'recipient': recipient,
|
'recipient': recipient,
|
||||||
'item': item,
|
'item': item,
|
||||||
'location': location,
|
'location': location,
|
||||||
'iAmFinder': 1 if i_am_finder else 0,
|
'iAmFinder': int(i_am_finder),
|
||||||
'iAmRecipient': 1 if i_am_recipient else 0,
|
'iAmRecipient': int(i_am_recipient),
|
||||||
'itemIsUnique': 1 if item_is_unique else 0,
|
'itemIsUnique': int(item_is_unique),
|
||||||
}))
|
}))
|
||||||
|
|
||||||
def notify_item_found(self, finder: str, item: str, location: str, i_am_finder: bool, item_is_unique: bool = False):
|
def notify_item_found(self, finder: str, item: str, location: str, i_am_finder: bool, item_is_unique: bool = False):
|
||||||
|
@ -68,8 +68,8 @@ class WebUiClient(Node, logging.Handler):
|
||||||
'finder': finder,
|
'finder': finder,
|
||||||
'item': item,
|
'item': item,
|
||||||
'location': location,
|
'location': location,
|
||||||
'iAmFinder': 1 if i_am_finder else 0,
|
'iAmFinder': int(i_am_finder),
|
||||||
'itemIsUnique': 1 if item_is_unique else 0,
|
'itemIsUnique': int(item_is_unique),
|
||||||
}))
|
}))
|
||||||
|
|
||||||
def notify_item_received(self, finder: str, item: str, location: str, item_index: int, queue_length: int,
|
def notify_item_received(self, finder: str, item: str, location: str, item_index: int, queue_length: int,
|
||||||
|
@ -80,7 +80,7 @@ class WebUiClient(Node, logging.Handler):
|
||||||
'location': location,
|
'location': location,
|
||||||
'itemIndex': item_index,
|
'itemIndex': item_index,
|
||||||
'queueLength': queue_length,
|
'queueLength': queue_length,
|
||||||
'itemIsUnique': 1 if item_is_unique else 0,
|
'itemIsUnique': int(item_is_unique),
|
||||||
}))
|
}))
|
||||||
|
|
||||||
def send_hint(self, finder, recipient, item, location, found, i_am_finder: bool, i_am_recipient: bool,
|
def send_hint(self, finder, recipient, item, location, found, i_am_finder: bool, i_am_recipient: bool,
|
||||||
|
|
Loading…
Reference in New Issue