real_escape_string($_GET['order_by']) : "name"; $dir = (isset($_GET['dir'])) ? $Database->real_escape_string($_GET['dir']) : 1; $order_dir = ($dir) ? "ASC" : "DESC"; $dir = ($dir) ? 0 : 1; function HeaderText($Text, $Column) { global $dir, $order_by, $GuildId; echo(''.($order_by==$Column ? ' ' : '').$Text.''); } function HeaderTextGuild($Text, $Column) { global $dir, $order_by, $GuildId; echo(''.($order_by==$Column ? ' ' : '').$Text.''); } $Database->select_db($Config['Mangos']['DatabaseCharacters']); if(!array_key_exists('guild', $_GET)) { echo('

Seznam spolků:

'); echo(''); HeaderText('F', 'fraction'); HeaderText('Název', 'name'); HeaderText('Počet členů', 'member_count'); HeaderText('Součet levelů', 'guild_level'); HeaderText('Součet bodů cti', 'guild_honor'); HeaderText('Webové stránky', ''); echo(''); // DB_Query(' COUNT(guild_member.guildid) as member_count FROM guild JOIN guild_member ON guild_member.guildid = guild.guildid GROUP BY guild.name ORDER BY member_count DESC'); $Result = $Database->query('SELECT `guild`.homepage, `guild`.name, guild.guildid, COUNT(`guild_member`.`guildid`) as member_count, SUM(SUBSTRING_INDEX(SUBSTRING_INDEX(`memebers`.`data`, " ", 35), " ", -1)) as guild_level, SUM(SUBSTRING_INDEX(SUBSTRING_INDEX(`memebers`.`data`, " ", '.(CHAR_DATA_OFFSET_HONOR_POINTS+1).'), " ", -1)) as guild_honor, `leader`.`race` IN (1, 3, 4, 7, 11) as fraction FROM `guild` JOIN `guild_member` ON `guild_member`.`guildid` = `guild`.`guildid` JOIN `characters` as `memebers` ON `memebers`.`guid`= `guild_member`.`guid` JOIN `characters` as `leader` ON `leader`.`guid`= `guild`.`leaderguid` GROUP BY guild.name ORDER BY '.$order_by.' '.$order_dir); while($Guild = $Result->fetch_array()) { if($Guild['fraction'] == 1) $Fraction = 'aliance'; else $Fraction = 'horda'; if($Guild['homepage'] == '') $Guild['homepage'] = ' '; else $Guild['homepage'] = ''.$Guild['homepage'].''; echo(''); } echo('
'.$Fraction.''.$Guild['name'].''.$Guild['member_count'].''.$Guild['guild_level'].''.$Guild['guild_honor'].''.$Guild['homepage'].'
'); } else { $GuildId = addslashes($_GET['guild']); $Result = $Database->query('SELECT `guild`.name, guild.guildid, guild.leaderguid, COUNT(`guild_member`.`guildid`) as member_count, SUM(SUBSTRING_INDEX(SUBSTRING_INDEX(`characters`.`data`, " ", '.(CHAR_DATA_OFFSET_LEVEL+1).'), " ", -1)) as guild_level, SUM(SUBSTRING_INDEX(SUBSTRING_INDEX(`characters`.`data`, " ", '.(CHAR_DATA_OFFSET_HONOR_POINTS+1).'), " ", -1)) as guild_honor FROM `guild` JOIN `guild_member` ON `guild_member`.`guildid` = `guild`.`guildid` JOIN `characters` ON `characters`.`guid`= `guild_member`.`guid` WHERE guild.guildid='.$GuildId.' GROUP BY guild.name'); if($Result->num_rows > 0) { $Guild = $Result->fetch_array(); // if($Guild['homepage'] != '') $Guild['name'] = $Guild['name'].' WWW'; //if($Guild['info'] != '') $Guild['info'] = ''.$Guild['info'].''; echo('

Seznam členů spolku '.$Guild['name'].'

'); $Result = $Database->select('characters', 'name', $Guild['leaderguid'].'=guid'); $GuildMaster = $Result->fetch_array(); echo('Vedoucí spolku: '.$GuildMaster['name'].'
'); echo(''); echo(''); HeaderTextGuild('Jméno', 'name'); HeaderTextGuild('Úroveň', 'level'); HeaderTextGuild('Hodnost', 'rank'); HeaderTextGuild('Body cti', 'honor'); echo(''); //echo(''); $GuildRanks = array(); $Result = $Database->select('guild_rank', '*', 'guildid='.$Guild['guildid']); while($GuildRank = $Result->fetch_array()) $GuildRanks[$GuildRank['rid']] = $GuildRank; $Result = $Database->query('SELECT guild_member.rank, guild_member.guid, SUBSTRING_INDEX(SUBSTRING_INDEX(characters.data," ", '.(CHAR_DATA_OFFSET_LEVEL+1).'), " ", -1)*1 as level, SUBSTRING_INDEX(SUBSTRING_INDEX(characters.data," ", '.(CHAR_DATA_OFFSET_HONOR_POINTS+1).'), " ", -1)*1 as honor, characters.name FROM guild_member JOIN `characters` ON guild_member.guid = characters.guid AND guild_member.guildid='.$Guild['guildid'].' ORDER BY '.$order_by.' '.$order_dir); while($Member = $Result->fetch_array()) { if(array_key_exists($Member['rank'] + 1, $GuildRanks)) $GuildRank = $GuildRanks[$Member['rank'] + 1]['rname']; else $GuildRank = ' '; // $DataParts = explode(' ', $Member['data']); // $Member['level'] .= ','.$DataParts[34]; echo(''); } echo('
Informace: '.$Guild['public_info'].'
'.$Member['name'].''.$Member['level'].''.$GuildRank.''.$Member['honor'].'
'); echo('Zpět na seznam spolků
'); } else echo('Spolek nenalezen!'); } ShowFooter(); ?>