Name request service
55Honey opened this issue · comments
This is about https://github.com/chromiecraft/configuration/discussions/349
-
Create a service page telling players that they unlock a name. It is not reserved once unlocked and free to use for anyone.
-
Create a text field where the user can enter a name. When pressing Enter / clicking Confirm, the DB is checked for availability as follows:
-
Find the
account_id
holding the character:
SELECT `level`,`account` FROM `characters` WHERE `name` = @name COLLATE UTF8MB4_BIN;
- Check if the account is a GM account on the main realm:
SELECT `id` FROM `account_access` WHERE `id` = @account_id AND `RealmID` < 2;
Deny the service "This name is not available for request.", if there is a result.
- Check if the account wasn't logged in for a while. (Pseudo code)
if @level < 5 then
min_time_since_login = 30days
elseif @level < 30 then
min_time_since_login = 90 days
elseif @level < 60 then
min_time_since_login = 180 days
else
min_time_since_login = 360 days
end
- Check if the account wasn't logged in for
min_time_since_login
by comparing it to
SELECT `username`,`last_login` FROM `account` WHERE `id` = @account_id;
If the condition is not met, deny the service. "This name is not available for request."
- Check if the account is banned currently
SELECT `unbandate` FROM `account_banned` WHERE `id` = @account_id AND `active` = 1;
If it is currently banned and the unbandate is equal to the bandate (perma ban), ask the player to submit a ticket and have us manually check if the name is appropriate to re-use.
If it is currently banned and the unbandate is in the future, tell the player to try again after the ban expires.
Otherwise confirm the service and grant it as follows:
Execute a server-side script (Core or Lua via Soap) which does the following:
- lock the account holding the name currently for 5min
- Force a free rename for the character holding the name currently
- Rename the character to a random valid string which isn't a name currently