Beispiel #1
0
         $charid = user_character_id($char_name);
         if ($charid !== false) {
             if ($config['TFSVersion'] === 'TFS_10') {
                 if (!user_is_online_10($charid)) {
                     if (guild_leader_gid($charid) === false) {
                         user_delete_character_soft($charid);
                     } else {
                         echo 'Character is leader of a guild, you must disband the guild or change leadership before deleting character.';
                     }
                 } else {
                     echo 'Character must be offline first.';
                 }
             } else {
                 $chr_data = user_character_data($charid, 'online');
                 if ($chr_data['online'] != 1) {
                     if (guild_leader_gid($charid) === false) {
                         user_delete_character_soft($charid);
                     } else {
                         echo 'Character is leader of a guild, you must disband the guild or change leadership before deleting character.';
                     }
                 } else {
                     echo 'Character must be offline first.';
                 }
             }
         }
     }
     break;
     // end
     // CHANGE character name
 // end
 // CHANGE character name
Beispiel #2
0
function guild_change_leader($nCid, $oCid)
{
    $nCid = (int) $nCid;
    $oCid = (int) $oCid;
    $gid = guild_leader_gid($oCid);
    $ranks = get_guild_rank_data($gid);
    $leader_rid = 0;
    $vice_rid = 0;
    // Get rank id for leader and vice leader.
    foreach ($ranks as $rank) {
        if ($rank['level'] == 3) {
            $leader_rid = $rank['id'];
        }
        if ($rank['level'] == 2) {
            $vice_rid = $rank['id'];
        }
    }
    $status = false;
    if ($leader_rid > 0 && $vice_rid > 0) {
        $status = true;
    }
    // Verify that we found the rank ids for vice leader and leader.
    if ($status) {
        // Update players and set their new rank id
        if (config('TFSVersion') !== 'TFS_10') {
            mysql_update("UPDATE `players` SET `rank_id`='{$leader_rid}' WHERE `id`={$nCid} LIMIT 1;");
            mysql_update("UPDATE `players` SET `rank_id`='{$vice_rid}' WHERE `id`={$oCid} LIMIT 1;");
        } else {
            mysql_update("UPDATE `guild_membership` SET `rank_id`='{$leader_rid}' WHERE `player_id`={$nCid} LIMIT 1;");
            mysql_update("UPDATE `guild_membership` SET `rank_id`='{$vice_rid}' WHERE `player_id`={$oCid} LIMIT 1;");
        }
        // Update guilds set new ownerid
        guild_new_leader($nCid, $gid);
    }
    return $status;
}