add player name as Hint target
This commit is contained in:
parent
85a4e9d409
commit
2fad46c26e
|
@ -336,21 +336,30 @@ async def console(ctx : Context):
|
||||||
print("Unknown item: " + item)
|
print("Unknown item: " + item)
|
||||||
elif command[0] == '/hint':
|
elif command[0] == '/hint':
|
||||||
if len(command) > 2:
|
if len(command) > 2:
|
||||||
player_number = int(command[1])
|
player_number = 0
|
||||||
item = " ".join(command[2:])
|
if command[1].isnumeric():
|
||||||
if item in Items.item_table:
|
player_number = int(command[1])
|
||||||
seeked_item_id = Items.item_table[item][3]
|
|
||||||
for check, result in ctx.locations.items():
|
|
||||||
item_id, receiving_player = result
|
|
||||||
if receiving_player == player_number and item_id == seeked_item_id:
|
|
||||||
location_id, finding_player = check
|
|
||||||
notify_all(ctx, f"[Hint]: P{player_number}'s {item} can be found in {get_location_name_from_address(location_id)} in "
|
|
||||||
f"P{finding_player}'s World")
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
print("Unknown item: " + item)
|
client = get_client_from_name(ctx, command[1])
|
||||||
|
if client:
|
||||||
|
player_number = client.slot()
|
||||||
|
else:
|
||||||
|
print(f"Player with name {command[1]} not found.")
|
||||||
|
if player_number:
|
||||||
|
item = " ".join(command[2:])
|
||||||
|
if item in Items.item_table:
|
||||||
|
seeked_item_id = Items.item_table[item][3]
|
||||||
|
for check, result in ctx.locations.items():
|
||||||
|
item_id, receiving_player = result
|
||||||
|
if receiving_player == player_number and item_id == seeked_item_id:
|
||||||
|
location_id, finding_player = check
|
||||||
|
notify_all(ctx, f"[Hint]: P{player_number}'s {item} can be found in {get_location_name_from_address(location_id)} in "
|
||||||
|
f"P{finding_player}'s World")
|
||||||
|
|
||||||
|
else:
|
||||||
|
print("Unknown item: " + item)
|
||||||
else:
|
else:
|
||||||
print("Use /hint {playernumber} {itemname}\nFor example /hint 1 Lamp")
|
print("Use /hint {Playernumber/Playername} {itemname}\nFor example /hint 1 Lamp")
|
||||||
elif command[0][0] != '/':
|
elif command[0][0] != '/':
|
||||||
notify_all(ctx, '[Server]: ' + input)
|
notify_all(ctx, '[Server]: ' + input)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
Loading…
Reference in New Issue