Toggle guild nick feature in config.php

Fix #407
TFS 1.3 has a potential unresolved crash bug related to guild nicks.
You can check out the details here: https://github.com/otland/forgottenserver/issues/2561#issuecomment-633101435
This commit is contained in:
Znote 2020-06-01 23:32:09 +02:00
parent 31c233d559
commit 5a80034915
3 changed files with 268 additions and 259 deletions

View File

@ -620,6 +620,11 @@
// Do you need to have premium account to create a guild?
$config['guild_require_premium'] = true;
// There is a TFS 1.3 bug related to guild nicks
// https://github.com/otland/forgottenserver/issues/2561
// So if your using TFS 1.x, you might need to disable guild nicks until the crash has been fixed.
$config['guild_allow_nicknames'] = true;
$config['guildwar_enabled'] = false;
// Use htaccess rewrite? (basically this makes website.com/username work instead of website.com/characterprofile.php?name=username

View File

@ -436,7 +436,7 @@ function update_player_guildnick($cid, $nick) {
mysql_update("UPDATE `players` SET `guildnick`='$nick' WHERE `id`=$cid");
} else {
mysql_update("UPDATE `players` SET `guildnick`= NULL WHERE `id`=$cid");
mysql_update("UPDATE `players` SET `guildnick`='' WHERE `id`=$cid");
}
}
function update_player_guildnick_10($cid, $nick) {
@ -445,7 +445,7 @@ function update_player_guildnick_10($cid, $nick) {
if (!empty($nick)) {
mysql_update("UPDATE `guild_membership` SET `nick`='$nick' WHERE `player_id`=$cid");
} else {
mysql_update("UPDATE `guild_membership` SET `nick`= NULL WHERE `player_id`=$cid");
mysql_update("UPDATE `guild_membership` SET `nick`='' WHERE `player_id`=$cid");
}
}

View File

@ -400,6 +400,7 @@ if ($highest_access >= 2) {
// Change Guild Nick
if (!empty($_POST['player_guildnick'])) {
if ($config['guild_allow_nicknames']) {
$p_cid = user_character_id($_POST['player_guildnick']);
$p_guild = get_player_guild_data($p_cid);
if (preg_match("/^[a-zA-Z_ ]+$/", $_POST['guildnick']) || empty($_POST['guildnick'])) {
@ -416,6 +417,7 @@ if ($highest_access >= 2) {
} else echo '<font color="red" size="4">Character not offline.</font>';
}
} else echo '<font color="red" size="4">Character guild nick may only contain a-z, A-Z and spaces.</font>';
} else echo '<font color="red" size="4">Change guild nickname feature has been disabled.</font>';
}
// Promote character to guild position
@ -696,6 +698,7 @@ if ($highest_access >= 2) {
</li>
</ul>
</form>
<?php if ($config['guild_allow_nicknames']): ?>
<!-- FORMS TO CHANGE GUILD NICK -->
<form action="" method="post">
<ul>
@ -722,6 +725,7 @@ if ($highest_access >= 2) {
</li>
</ul>
</form>
<?php endif; ?>
<!-- END FORMS TO CHANGE GUILD NICK -->
<?php if ($members > 1) { ?>
<!-- FORMS TO PROMOTE CHARACTER-->