Release 0.9.0

This commit is contained in:
2025-11-21 07:26:02 +01:00
committed by ecv
commit 472f0812e7
240 changed files with 20033 additions and 0 deletions

View File

@@ -0,0 +1,68 @@
from bot import loaded_modules_dict
from bot import telnet_prefixes
from os import path, pardir
module_name = path.basename(path.normpath(path.join(path.abspath(__file__), pardir, pardir)))
trigger_name = path.basename(path.abspath(__file__))[:-3]
def main_function(origin_module, module, regex_result):
command = regex_result.group("command")
active_dataset = module.dom.data.get("module_game_environment", {}).get("active_dataset", None)
player_steamid = regex_result.group("player_steamid")
existing_player_dict = (
module.dom.data
.get("module_players", {})
.get("elements", {})
.get(active_dataset, {})
.get(player_steamid, None)
)
if command == "connected":
# we want to mute completely new players and players that are not authenticated on login.
if existing_player_dict is not None:
default_player_password = module.default_options.get("default_player_password", None)
player_is_authenticated = existing_player_dict.get("is_authenticated", False)
if not player_is_authenticated and default_player_password is not None:
is_muted = True
else:
is_muted = False
event_data = ['set_player_mute', {
'dataset': module.dom.data.get("module_game_environment", {}).get("active_dataset", None),
'player_steamid': player_steamid,
'is_muted': is_muted
}]
module.trigger_action_hook(origin_module, event_data=event_data)
trigger_meta = {
"description": "reacts to telnets player discovery messages for real time responses!",
"main_function": main_function,
"triggers": [
{
"regex": (
telnet_prefixes["telnet_log"]["timestamp"] +
r"\[Steamworks.NET\]\s"
r"(?P<command>.*)\s"
r"player:\s(?P<player_name>.*)\s"
r"SteamId:\s(?P<player_steamid>\d+)\s(.*)"
),
"callback": main_function
}, {
"regex": (
telnet_prefixes["telnet_log"]["timestamp"] +
r"Player\s"
r"(?P<command>.*), "
r"entityid=(?P<entity_id>.*), "
r"name=(?P<player_name>.*), "
r"steamid=(?P<player_steamid>.*), "
r"steamOwner=(?P<owner_id>.*), "
r"ip=(?P<player_ip>.*)"
),
"callback": main_function
}
]
}
loaded_modules_dict["module_" + module_name].register_trigger(trigger_name, trigger_meta)

View File

@@ -0,0 +1,43 @@
from bot import loaded_modules_dict
from os import path, pardir
module_name = path.basename(path.normpath(path.join(path.abspath(__file__), pardir, pardir)))
trigger_name = path.basename(path.abspath(__file__))[:-3]
def main_function(*args, **kwargs):
module = args[0]
updated_values_dict = kwargs.get("updated_values_dict", {})
player_steamid = kwargs.get("dispatchers_steamid", None)
is_authenticated = updated_values_dict.get("is_authenticated", None)
try:
if all([
is_authenticated is not None,
player_steamid is not None
]):
event_data = ['set_player_mute', {
'dataset': module.dom.data.get("module_game_environment", {}).get("active_dataset", None),
'player_steamid': player_steamid
}]
if is_authenticated:
event_data[1]["is_muted"] = False
else:
event_data[1]["is_muted"] = True
module.trigger_action_hook(module, event_data=event_data)
except AttributeError:
pass
trigger_meta = {
"description": "reacts to a players authentication change",
"main_function": main_function,
"handlers": {
"module_players/elements/%map_identifier%/%steamid%/is_authenticated": main_function,
}
}
loaded_modules_dict["module_" + module_name].register_trigger(trigger_name, trigger_meta)

View File

@@ -0,0 +1,62 @@
from bot import loaded_modules_dict
from os import path, pardir
module_name = path.basename(path.normpath(path.join(path.abspath(__file__), pardir, pardir)))
trigger_name = path.basename(path.abspath(__file__))[:-3]
def main_function(*args, **kwargs):
module = args[0]
original_values_dict = kwargs.get("original_values_dict", {})
updated_values_dict = kwargs.get("updated_values_dict", {})
dataset = module.dom.data.get("module_game_environment", {}).get("active_dataset", None)
found_lobby = False
for lobby in module.locations.get_elements_by_type("is_lobby"):
lobby_dict = lobby
found_lobby = True
if found_lobby is False:
return
# only dive into this when not authenticated
if original_values_dict.get("is_authenticated", False) is False and any([
original_values_dict.get("pos", {}).get("x") != updated_values_dict.get("pos", {}).get("x"),
original_values_dict.get("pos", {}).get("y") != updated_values_dict.get("pos", {}).get("y"),
original_values_dict.get("pos", {}).get("z") != updated_values_dict.get("pos", {}).get("z")
]):
on_the_move_player_dict = (
module.dom.data
.get("module_players", {})
.get("elements", {})
.get(dataset, {})
.get(updated_values_dict.get("steamid"), {})
)
pos_is_inside_coordinates = module.locations.position_is_inside_boundary(updated_values_dict, lobby_dict)
if pos_is_inside_coordinates is True:
# nothing to do, we are inside the lobby
return
# no early exits, seems like the player is outside an active lobby without any authentication!
# seems like we should port ^^
event_data = ['teleport_to_coordinates', {
'location_coordinates': {
"x": lobby_dict["coordinates"]["x"],
"y": lobby_dict["coordinates"]["y"],
"z": lobby_dict["coordinates"]["z"]
},
'steamid': on_the_move_player_dict.get("steamid")
}]
module.trigger_action_hook(module.locations, event_data=event_data)
trigger_meta = {
"description": "reacts to every players move!",
"main_function": main_function,
"handlers": {
"module_players/elements/%map_identifier%/%steamid%/pos": main_function,
}
}
loaded_modules_dict["module_" + module_name].register_trigger(trigger_name, trigger_meta)