<commit_before>#include <kernel/access.h>

#include <kotaka/paths.h>
#include <kotaka/privilege.h>

#include <game/paths.h>

inherit GAME_LIB_USTATE;

int stopped;
int reading;

static void create(int clone)
{
	::create();
}

static void destruct(int clone)
{
	::destruct();
}

private void prompt()
{
	string name;

	name = query_user()->query_username();

	if (!name) {
		name = "guest";
	}

	send_out("[" + name + "@ulario] ");
}

void begin()
{
	ACCESS_CHECK(previous_object() == query_user());

	send_out(read_file("~/data/doc/guest_welcome"));
}

void stop()
{
	ACCESS_CHECK(previous_object() == query_user());

	stopped = 1;
}

void go()
{
	ACCESS_CHECK(previous_object() == query_user());

	stopped = 0;

	if (!reading) {
		prompt();
	}
}

void pre_end()
{
	object user;
	string name;

	ACCESS_CHECK(previous_object() == query_user());

	user = query_user();
	name = titled_name(user->query_username(), user->query_class());

	send_out("Come back soon.\n");
	send_to_all_except(name + " dies and sinks into the ground.\n", ({ user }) );
}

void end()
{
	ACCESS_CHECK(previous_object() == query_user());

	destruct_object(this_object());
}

void do_who()
{
	object *users;
	string **lists;
	int sz, i;

	lists = ({ ({ }), ({ }), ({ }) });

	send_out("User list\n");
	send_out("---------\n");

	users = GAME_USERD->query_users();
	sz = sizeof(users);

	for (i = 0; i < sz; i++) {
		lists[users[i]->query_class() - 1]
			+= ({ users[i]->query_username() });
	}

	for (i = 0; i < 3; i++) {
		if (sizeof(lists[i])) {
			int j;
			string *list;
			
			list = lists[i];
			sz = sizeof(list);

			switch(i) {
			case 0: send_out("Players:\n"); break;
			case 1: send_out("Wizards:\n"); break;
			case 2: send_out("Administrators:\n"); break;
			}

			for (j = 0; j < sz; j++) {
				send_out(list[j] + "\n");
			}
		}
	}
}

void do_help()
{
	object pager;

	pager = clone_object("~Kotaka/obj/ustate/page");

	pager->set_text(read_file("~/data/help/player/index.hlp"));

	push_state(pager);
}

void do_alist()
{
	string *users;
	object user;

	user = query_user();

	if (user->query_class() < 2) {
		send_out("You do not have sufficient access rights to list accounts.\n");
		return;
	}

	users = ACCOUNTD->query_accounts();

	send_out("Users: " + implode(users, ", ") + "\n");
}

void do_emote(string args)
{
	object user;
	string name;

	args = STRINGD->trim_whitespace(args);

	if (args == "") {
		send_out("Cat got your tongue?\n");
		return;
	}

	user = query_user();
	name = titled_name(user->query_username(), user->query_class());

	send_out("You " + args + "\n");
	send_to_all_except(name + " " + args + "\n", ({ user }) );
}

void do_say(string args)
{
	object user;
	string name;

	args = STRINGD->trim_whitespace(args);

	if (args == "") {
		send_out("Cat got your tongue?\n");
		return;
	}

	user = query_user();
	name = titled_name(user->query_username(), user->query_class());<commit_msg>Don't allow guests to communicate by default<commit_after>#include <kernel/access.h>

#include <kotaka/paths.h>
#include <kotaka/privilege.h>

#include <game/paths.h>

inherit GAME_LIB_USTATE;

int stopped;
int reading;

static void create(int clone)
{
	::create();
}

static void destruct(int clone)
{
	::destruct();
}

private void prompt()
{
	string name;

	name = query_user()->query_username();

	if (!name) {
		name = "guest";
	}

	send_out("[" + name + "@ulario] ");
}

void begin()
{
	ACCESS_CHECK(previous_object() == query_user());

	send_out(read_file("~/data/doc/guest_welcome"));
}

void stop()
{
	ACCESS_CHECK(previous_object() == query_user());

	stopped = 1;
}

void go()
{
	ACCESS_CHECK(previous_object() == query_user());

	stopped = 0;

	if (!reading) {
		prompt();
	}
}

void pre_end()
{
	object user;
	string name;

	ACCESS_CHECK(previous_object() == query_user());

	user = query_user();
	name = titled_name(user->query_username(), user->query_class());

	send_out("Come back soon.\n");
	send_to_all_except(name + " dies and sinks into the ground.\n", ({ user }) );
}

void end()
{
	ACCESS_CHECK(previous_object() == query_user());

	destruct_object(this_object());
}

void do_who()
{
	object *users;
	string **lists;
	int sz, i;

	lists = ({ ({ }), ({ }), ({ }) });

	send_out("User list\n");
	send_out("---------\n");

	users = GAME_USERD->query_users();
	sz = sizeof(users);

	for (i = 0; i < sz; i++) {
		lists[users[i]->query_class() - 1]
			+= ({ users[i]->query_username() });
	}

	for (i = 0; i < 3; i++) {
		if (sizeof(lists[i])) {
			int j;
			string *list;
			
			list = lists[i];
			sz = sizeof(list);

			switch(i) {
			case 0: send_out("Players:\n"); break;
			case 1: send_out("Wizards:\n"); break;
			case 2: send_out("Administrators:\n"); break;
			}

			for (j = 0; j < sz; j++) {
				send_out(list[j] + "\n");
			}
		}
	}
}

void do_help()
{
	object pager;

	pager = clone_object("~Kotaka/obj/ustate/page");

	pager->set_text(read_file("~/data/help/player/index.hlp"));

	push_state(pager);
}

void do_alist()
{
	string *users;
	object user;

	user = query_user();

	if (user->query_class() < 2) {
		send_out("You do not have sufficient access rights to list accounts.\n");
		return;
	}

	users = ACCOUNTD->query_accounts();

	send_out("Users: " + implode(users, ", ") + "\n");
}

void do_emote(string args)
{
	object user;
	string name;

	user = query_user();

	if (user->query_class() < 1) {
		send_out("You do not have sufficient access rights to emote.\n");
		return;
	}

	args = STRINGD->trim_whitespace(args);

	if (args == "") {
		send_out("Cat got your tongue?\n");
		return;
	}

	name = titled_name(user->query_username(), user->query_class());

	send_out("You " + args + "\n");
	send_to_all_except(name + " " + args + "\n", ({ user }) );
}

void do_say(string args)
{
	object user;
	string name;

	user = query_user();

	if (user->query_class() < 1) {
		send_out("You do not have sufficient access rights to speak.\n");
		return;
	}

	args = STRINGD->trim_whitespace(args);

	if (args == "") {
		send_out("Cat got your tongue?\n");
		return;
	}

	name = titled_name(user->query_username(), user->query_class());
{'fraction_non_alphanumeric': 0.19775688603001815, 'fraction_numerical': 0.0039584364176150424, 'mean_word_length': 3.88638195004029, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 43, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2545009', 'n_tokens_mistral': 2518, 'n_tokens_neox': 2318, 'n_words': 499}