Ir para conteúdo

hrubesch

Campones
  • Total de itens

    42
  • Registro em

  • Última visita

Posts postados por hrubesch

  1. FOI5ZJ7.gif

     

     

    iY2Tw02.gifSurrealBaiak.Com iY2Tw02.gifVersão 8.60
    iY2Tw02.gifABERTURA 07/12 AS 19H!

     

     

    ~Informações do Servidor~

     

     

     

    rMoR2WZ.gif Mapa 100% Custom.

     

    rMoR2WZ.gif Servidor 100% Balanceado. ( Todas Vocações Com Vantagens e Desvantagens )

     

    rMoR2WZ.gifPrezamos Bastante o PvP Então Removemos Alguns Exhausts e Colocamos Outros Para Equilibrar Tudo.

     

    rMoR2WZ.gif Quests Inéditas e Diferentes de Qualquer Servidor.

     

    rMoR2WZ.gifEvento Exclusivo Criado Pela Nossa Equipe [PTO Event] Protect The Orb.

     

    rMoR2WZ.gifStaff Sempre Presente, Dúvidas, Reports, Sujestões, Basta Contatar a Staff In Game ou Enviar Ticket Pelo Site, Será Respondido o Quanto Antes.

     

    rMoR2WZ.gifCasttle 24H Diferenciado e Com Algumas Dificuldades a Mais.

     

    rMoR2WZ.gifMuito RPG, Este Para Quem Gosta De Explorar Irá Gostar Muito, Nosso Server Contém Muitas Caves Escondidas, Lugares Secretos, Missões Secretas, e Quests Fora Da Área de Quests. ( OBS : Explorem Bastante Cliquem Nas Coisas, Qualquer Coisa Pode Conter Um Segredo )

     

    rMoR2WZ.gifPagseguro 100% Automático. ( Pagamento Assim Que Aprovado o Pagseguro Vai Entregar Seus Pontos )

     

    rMoR2WZ.gif Paypal System

     

    rMoR2WZ.gif Sistema de Task Exclusivo Nosso.

     

    rMoR2WZ.gif Event Ferumbras Tower ( Exclusivo Nosso Diferenciado ) Obs : Leiam Na Aba Ferumbras Tower Para Saber Mais.

     

    rMoR2WZ.gif Event Hunt Monster.

  2. Qualquer um quando cria guild no meu server fica bugada como na imagem.

    OBS : Uso Gesior ACC Em Linux

    16c1b2x.png

     

    guilds.php

    Spoiler

    <?php
    if(!defined('INITIALIZED'))
        exit;

    if($action == "") {

        $guilds_list = new DatabaseList('Guild');
        $guilds_list->addOrder(new SQL_Order(new SQL_Field('name'), SQL_Order::ASC));
        
        $main_content .= '
            <div class="TableContainer" >
                <table class="Table3" cellpadding="0" cellspacing="0" >
                    <div class="CaptionContainer" >
                        <div class="CaptionInnerContainer" > 
                            <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                            <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                            <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                            <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>                        
                            <div class="Text" >Active Guilds on ' .htmlspecialchars($config['site']['serverName']). '</div>
                            <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
                            <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                            <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                            <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                        </div>
                    </div>
                    <tr>
                        <td><div class="InnerTableContainer" >
                                <table style="width:100%;" >
                                    <tr>
                                        <td><div class="TableShadowContainerRightTop" >
                                                <div class="TableShadowRightTop" style="background-image:url('.$layout_name.'/images/global/content/table-shadow-rt.gif);" ></div>
                                            </div>
                                            <div class="TableContentAndRightShadow" style="background-image:url('.$layout_name.'/images/global/content/table-shadow-rm.gif);" >
                                                <div class="TableContentContainer" >
                                                    <table class="TableContent" width="100%" >
                                                        <TR BGCOLOR=#D4C0A1>
                                                            <TD WIDTH=64><B>Logo</B></TD>
                                                            <TD WIDTH=100%><B>Description</B></TD>
                                                            <TD WIDTH=56><B>&#160;</B></TD>
                                                        </TR>';
                                                    $showed_guilds = 1;
                                                    if(count($guilds_list) > 0)
                                                    {
                                                        foreach($guilds_list as $guild)
                                                        {
                                                            if(is_int($showed_guilds / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $showed_guilds++;
                                                            $description = $guild->getDescription();                                                        
                                                            $newlines   = array("\r\n", "\n", "\r");
                                                            $description_with_lines = str_replace($newlines, '<br />', $description, $count);
                                                            if($count < $config['site']['guild_description_lines_limit'])
                                                                $description = $description_with_lines;
                                                            $main_content .= '
                                                                <TR BGCOLOR='.$bgcolor.'>
                                                                    <TD><IMG SRC="'. $guild->getGuildLogoLink() .'" WIDTH=64 HEIGHT=64></TD>
                                                                    <TD><B>'.htmlspecialchars($guild->getName()).'</B><BR>'.$description.'</TD>
                                                                    <TD>
                                                                        <table border="0" cellspacing="0" cellpadding="0" >
                                                                            <form action="?subtopic=guilds&action=view" method="post" >
                                                                                <tr>
                                                                                    <td style="border:0px;" ><input type="hidden" name=GuildName value="'.htmlspecialchars($guild->getName()).'" >
                                                                                        <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
                                                                                            <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
                                                                                                <input class="ButtonText" type="image" name="View" alt="View" src="'.$layout_name.'/images/global/buttons/_sbutton_view.gif" >
                                                                                            </div>
                                                                                        </div>
                                                                                    </td>
                                                                                </tr>
                                                                            </form>';
                                                                        if($group_id_of_acc_logged >= $config['site']['access_admin_panel'])
                                                                            $main_content .= '
                                                                            <form action="?subtopic=guilds&action=deletebyadmin" method="post">
                                                                                <tr>
                                                                                    <td style="border:0px;" >
                                                                                        <input type="hidden" name="guild" value="'.$guild->getId().'">
                                                                                        <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_red.gif)" >
                                                                                            <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_red_over.gif);" ></div>
                                                                                                <input class="ButtonText" type="image" name="Delete" alt="Delete" src="'.$layout_name.'/images/global/buttons/_sbutton_delete.gif" >
                                                                                            </div>
                                                                                        </div>
                                                                                    </td>
                                                                                </tr>
                                                                            </form>';
                                                                        $main_content .= '
                                                                        </table>
                                                                    </TD>
                                                                </TR>';
                                                        }
                                                    }
                                                    $main_content .= '
                                                    </table>
                                                </div>
                                            </div>
                                            <div class="TableShadowContainer" >
                                                <div class="TableBottomShadow" style="background-image:url('.$layout_name.'/images/global/content/table-shadow-bm.gif);" >
                                                    <div class="TableBottomLeftShadow" style="background-image:url('.$layout_name.'/images/global/content/table-shadow-bl.gif);" ></div>
                                                    <div class="TableBottomRightShadow" style="background-image:url('.$layout_name.'/images/global/content/table-shadow-br.gif);" ></div>
                                                </div>
                                            </div>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </td>
                    </tr>
                </table>
            </div>
            <BR>
            <TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%>
                <TR>
                    <TD>No guild found that suits your needs?</TD>
                </TR>
                <TR>
                    <TD><table border="0" cellspacing="0" cellpadding="0" >
                            <form action="?subtopic=guilds&action=create" method="post" >
                                <tr>
                                    <td style="border:0px;" >
                                        <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
                                            <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
                                                <input class="ButtonText" type="image" name="FoundGuild" alt="FoundGuild" src="'.$layout_name.'/images/global/buttons/_sbutton_foundguild.gif" >
                                            </div>
                                        </div>
                                    </td>
                                </tr>
                            </form>
                        </table>
                    </TD>
                </TR>
            </TABLE>';
    }
    if($action == "view")
    {
        $guild_name = (string) $_REQUEST['GuildName'];
        $guild = new Guild();
        $guild->loadByName($guild_name);
        if(!$guild->isLoaded())
            $guild_errors[] = 'Guild with name <b>'.$guild_name.'</b> doesn\'t exist.';
        
        if(!empty($guild_errors))
        {
            //errors
                $main_content .= '
                    <div class="TableContainer" >
                        <table class="Table1" cellpadding="0" cellspacing="0" >
                            <div class="CaptionContainer" >
                                <div class="CaptionInnerContainer" > 
                                    <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                    <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                    <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                    <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>                            
                                    <div class="Text" >Error</div>
                                    <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
                                    <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                    <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                    <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                </div>
                            </div>
                            <tr>
                                <td>
                                    <div class="InnerTableContainer" >
                                        <table style="width:100%;" >
                                            <tr>
                                                <td>';
                                                foreach($guild_errors as $guild_error)
                                                    $main_content .= '<p>'.$guild_error;
                                            $main_content .= '
                                                </td>
                                            </tr>
                                        </table>
                                    </div>
                                </td>
                            </tr>
                        </table>
                    </div><BR>
                    <TABLE BORDER=0 WIDTH=100%>
                        <TR>
                            <TD ALIGN=center>
                                <table border="0" cellspacing="0" cellpadding="0" >
                                    <form action="?subtopic=guilds" method="post" >
                                        <tr>
                                            <td style="border:0px;" ><div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
                                                    <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
                                                        <input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/global/buttons/_sbutton_back.gif" >
                                                    </div>
                                                </div>
                                            </td>
                                        </tr>
                                    </form>
                                </table>
                            </TD>
                        </TR>
                    </TABLE>';
            //show errors
        }
        else
        {
            //check is it vice or/and leader account (leader has vice + leader rights)
            $guild_leader_char = $guild->getOwner();
            $rank_list = $guild->getGuildRanksList();
            $guild_leader = FALSE;
            $guild_vice = FALSE;
            if($logged)
            {
                $account_players = $account_logged->getPlayers();
                foreach($account_players as $player)
                {
                    $players_from_account_ids[] = $player->getId();
                    $player_rank = $player->getRank();
                    if(!empty($player_rank))
                        foreach($rank_list as $rank_in_guild)
                            if($rank_in_guild->getId() == $player_rank->getId())
                            {
                                $players_from_account_in_guild[] = $player->getName();
                                if($player_rank->getLevel() > 1)
                                {
                                    $guild_vice = TRUE;
                                    $level_in_guild = $player_rank->getLevel();
                                }
                                if($guild->getOwner()->getId() == $player->getId())
                                {
                                    $guild_vice = TRUE;
                                    $guild_leader = TRUE;
                                }
                            }
                }
            }
            
            //show guild page
            $description = $guild->getDescription();
            $newlines   = array("\r\n", "\n", "\r");
            $description_with_lines = str_replace($newlines, '<br />', $description, $count);
            if($count < $config['site']['guild_description_lines_limit'])
                $description = $description_with_lines;
            $guild_owner = $guild->getOwner();
            if($guild_owner->isLoaded())
                $guild_owner = $guild_owner->getName();        
            
            $main_content .= '
                <TABLE BORDER=0 WIDTH=100%>
                    <TR>
                        <TD WIDTH=64><IMG SRC="' . $guild->getGuildLogoLink() . '" WIDTH=64 HEIGHT=64></TD>
                        <TD ALIGN=center WIDTH=100%><H1>'.htmlspecialchars($guild->getName()).'</H1></TD>
                        <TD WIDTH=64><IMG SRC="' . $guild->getGuildLogoLink() . '" WIDTH=64 HEIGHT=64></TD>
                    </TR>
                </TABLE>
                <BR>
                <TABLE Width=100%>
                    <colgroup>
                    <col width="90%">
                    <col width="10%">
                    </colgroup>
                    <TR>
                        <TD style="vertical-align:top; padding-right: 5px;"><div class="TableContainer" >
                                <table class="Table1" cellpadding="0" cellspacing="0" >
                                    <div class="CaptionContainer" >
                                        <div class="CaptionInnerContainer" > 
                                            <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                            <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                            <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                            <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>                                    
                                            <div class="Text" >Guild Information</div>
                                            <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
                                            <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                            <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                            <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                        </div>
                                    </div>
                                    <tr>
                                        <td><div class="InnerTableContainer" >';
                                        //show guild page
                                        $description = $guild->getDescription();
                                        $newlines   = array("\r\n", "\n", "\r");
                                        $description_with_lines = str_replace($newlines, '<br />', $description, $count);
                                        if($count < $config['site']['guild_description_lines_limit'])
                                            $description = $description_with_lines;
                                            $main_content .= '
                                                <table style="width:100%;" >
                                                    <TR>
                                                        <TD>
                                                            <div id="GuildInformationContainer">
                                                                '.$description.'<br><br>
                                                                The guild was founded on Maddox on '.date("M d Y",$guild->getCreateDate()).'.<BR>
                                                                It is currently active.<BR>
                                                            </div>
                                                        </TD>
                                                    </TR>
                                                </table>
                                            </div>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </TD>
                        <TD style="vertical-align:top;">
                            <div class="TableContainer" >
                                <table class="Table1" cellpadding="0" cellspacing="0" >
                                    <div class="CaptionContainer" >
                                        <div class="CaptionInnerContainer" > 
                                            <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                            <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                            <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                            <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>                            
                                            <div class="Text" >Navigation</div>
                                            <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
                                            <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                            <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                            <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                        </div>
                                    </div>
                                    <tr>
                                        <td>
                                            <div class="InnerTableContainer" >
                                                <table style="width:100%;" >
                                                    <tr>
                                                        <td align="center"><div id="NavigationContainer">
                                                                <table border="0" cellspacing="0" cellpadding="0" >
                                                                    <form action="?subtopic=guilds" method="post" >
                                                                        <tr>
                                                                            <td style="border:0px;" >
                                                                                <input type="hidden" name=action value=guildwars >
                                                                                <input type="hidden" name=GuildName value="'.$_REQUEST['GuildName'].'" >
                                                                                <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
                                                                                    <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
                                                                                        <input class="ButtonText" type="image" name="Guild Wars" alt="Guild Wars" src="'.$layout_name.'/images/global/buttons/_sbutton_guildwars.gif" >
                                                                                    </div>
                                                                                </div>
                                                                            </td>
                                                                        </tr>
                                                                    </form>
                                                                </table>
                                                                <div style="font-size:1px;height:4px;" ></div>
                                                                <table border="0" cellspacing="0" cellpadding="0" >
                                                                    <form action="?subtopic=guilds" method="post" >
                                                                        <tr>
                                                                            <td style="border:0px;" >
                                                                                <input type="hidden" name=action value=guildevents >
                                                                                <input type="hidden" name=GuildName value="'.$_REQUEST['GuildName'].'" >
                                                                                <input type="hidden" name=world value="Neptera" >
                                                                                <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
                                                                                    <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
                                                                                        <input class="ButtonText" type="image" name="Guild Events" alt="Guild Events" src="'.$layout_name.'/images/global/buttons/_sbutton_guildevents.gif" >
                                                                                    </div>
                                                                                </div>
                                                                            </td>
                                                                        </tr>
                                                                    </form>
                                                                </table>
                                                                <div style="font-size:1px;height:4px;" ></div>
                                                            </div>
                                                        </td>
                                                    </tr>
                                                </table>
                                            </div>
                                        </td>
                                    </tr>
                                </table>
                            </div>';
                    if($guild_leader)
                        $main_content .= '
                            <div style="font-size:1px;height:6px;" ></div>
                            <div class="TableContainer" >
                                <table class="Table1" cellpadding="0" cellspacing="0" >
                                    <div class="CaptionContainer" >
                                        <div class="CaptionInnerContainer" > 
                                            <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                            <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                            <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                            <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>                                        
                                            <div class="Text" >Administration</div>
                                            <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
                                            <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                            <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                            <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                        </div>
                                    </div>
                                    <tr>
                                        <td><div class="InnerTableContainer" >
                                                <table style="width:100%;" >
                                                    <TR>
                                                        <TD align="center">
                                                            <div id="AdministrationContainer">
                                                                <table border="0" cellspacing="0" cellpadding="0" >
                                                                    <form action="?subtopic=guilds" method="post" >
                                                                        <tr>
                                                                            <td style="border:0px;" >
                                                                                <input type="hidden" name=action value=description >
                                                                                <input type="hidden" name=GuildName value="'.$_REQUEST['GuildName'].'" >
                                                                                <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
                                                                                    <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
                                                                                        <input class="ButtonText" type="image" name="Edit Description" alt="Edit Description" src="'.$layout_name.'/images/global/buttons/_sbutton_editdescription.gif" >
                                                                                    </div>
                                                                                </div>
                                                                            </td>
                                                                        </tr>
                                                                    </form>
                                                                </table>                                                            
                                                                <div style="font-size:1px;height:4px;" ></div>                                                    
                                                                <table border="0" cellspacing="0" cellpadding="0" >
                                                                    <form action="?subtopic=guilds" method="post" >
                                                                        <tr>
                                                                            <td style="border:0px;" >
                                                                                <input type="hidden" name=action value=disband >
                                                                                <input type="hidden" name=GuildName value="'.$_REQUEST['GuildName'].'" >
                                                                                <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
                                                                                    <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
                                                                                        <input class="ButtonText" type="image" name="Disband Guild" alt="Disband Guild" src="'.$layout_name.'/images/global/buttons/_sbutton_disbandguild.gif" >
                                                                                    </div>
                                                                                </div>
                                                                            </td>
                                                                        </tr>
                                                                    </form>
                                                                </table>
                                                                <div style="font-size:1px;height:4px;" ></div>
                                                                <table border="0" cellspacing="0" cellpadding="0" >
                                                                    <form action="?subtopic=guilds" method="post" >
                                                                        <tr>
                                                                            <td style="border:0px;" >
                                                                                <input type="hidden" name=action value=resignleadership >
                                                                                <input type="hidden" name=GuildName value="'.$_REQUEST['GuildName'].'" >
                                                                                <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
                                                                                    <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
                                                                                        <input class="ButtonText" type="image" name="Resign Leadership" alt="Resign Leadership" src="'.$layout_name.'/images/global/buttons/_sbutton_resignleadership.gif" >
                                                                                    </div>
                                                                                </div>
                                                                            </td>
                                                                        </tr>
                                                                    </form>
                                                                </table>
                                                            </div>
                                                        </td>
                                                    </tr>
                                                </table>
                                            </div>
                                        </td>
                                    </tr>
                                </table>
                            </div>';
                    $main_content .= '
                        </TD>
                    </TR>
                </TABLE>
                <script type="text/javascript" >
                $(document).ready(function() {
                    var g_GuildInformationContainerHeight = $(\'#GuildInformationContainer\').height();
                    if($(\'#AdministrationContainer\').length > 0) {
                      var g_AdministrationContainerHeight = $(\'#AdministrationContainer\').height() + 28;
                      var g_NavigationContainerHeight = $(\'#NavigationContainer\').height() + 28;
                    } else {
                      var g_NavigationContainerHeight = $(\'#NavigationContainer\').height();
                      var g_AdministrationContainerHeight = 0;
                    }
                    //alert(g_GuildInformationContainerHeight+\' \'+g_NavigationContainerHeight+\' \'+g_AdministrationContainerHeight);
                    if(g_GuildInformationContainerHeight < g_NavigationContainerHeight + g_AdministrationContainerHeight) {
                      $(\'#GuildInformationContainer\').css(\'height\', g_NavigationContainerHeight + g_AdministrationContainerHeight);
                    } else {
                      if($(\'#AdministrationContainer\').length > 0) {
                        $(\'#NavigationContainer\').css(\'height\', g_GuildInformationContainerHeight * 0.7 - 28);
                        $(\'#AdministrationContainer\').css(\'height\', g_GuildInformationContainerHeight * 0.3 - 28);
                      } else {
                        $(\'#NavigationContainer\').css(\'height\', g_GuildInformationContainerHeight);
                      }
                    }
                  });</script> 
                <BR>
                <div class="TableContainer" >
                    <table class="Table3" cellpadding="0" cellspacing="0" >
                        <div class="CaptionContainer" >
                            <div class="CaptionInnerContainer" > <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" />
                                    </span>
                                <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" />
                                    </span>
                                <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" />
                                    </span>
                                
                                <div class="Text" >Guild Members</div>
                                <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" />
                                    </span>
                                <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" />
                                    </span>
                                <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" />
                                    </span>
                            </div>
                        </div>
                        <tr>
                                <td>
                            <div class="InnerTableContainer" >
                                <table style="width:100%;" >
                                    <tr><td>
                                        <div class="TableShadowContainerRightTop" >
                                            <div class="TableShadowRightTop" style="background-image:url('.$layout_name.'/images/global/content/table-shadow-rt.gif);" ></div>
                                        </div>
                                        <div class="TableContentAndRightShadow" style="background-image:url('.$layout_name.'/images/global/content/table-shadow-rm.gif);" >
                                            <div class="TableContentContainer" >
                                                <table class="TableContent" width="100%" >
                                                    <tr class="LabelH">
                                                        <td>Rank <small style="font-weight:normal;" >[<a href="#" >sort</a>]</small> 
                                                        <img class="sortarrow" src="'.$layout_name.'/images/global/content/order_desc.gif" /></td>
                                                        <td>Name and Title</td>
                                                        <td>Vocation <small style="font-weight:normal;" >[<a href="#" >sort</a>]</small> 
                                                        <img class="sortarrow" src="'.$layout_name.'/images/global/general/blank.gif" /></td>
                                                        <td>Level <small style="font-weight:normal;" >[<a href="#" >sort</a>]</small> 
                                                        <img class="sortarrow" src="'.$layout_name.'/images/global/general/blank.gif" /></td>
                                                        <td>Status</td>
                                                    </tr>';
                                                #show players
                                                $showed_players = 1;
                                                foreach($rank_list as $rank) {
                                                    $oi = 0;
                                                    if(!isset($_REQUEST['onlyshowonline']) || $_REQUEST['onlyshowonline'] == 0)
                                                        $players_with_rank = $rank->getPlayersList();
                                                    else
                                                        $players_with_rank = $rank->getOnlinePlayersList();
                                                    $players_with_rank_number = count($players_with_rank);
                                                    if($players_with_rank_number > 0) {
                                                        if(is_int($showed_players / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; }
                                                        $showed_players++;
                                                        foreach($players_with_rank as $player) {
                                                            $oi++;
                                                            $main_content .= '
                                                                <TR BGCOLOR='.$bgcolor.'>
                                                                    <TD>'.(($oi == 1) ? htmlspecialchars($rank->getName()) : '').'</TD>
                                                                    <TD>
                                                                        <A HREF="?subtopic=characters&name='.urlencode($player->getName()).'">'.htmlspecialchars($player->getName()).'</A>';
                                                                        if ($player->getGuildNick() != "")
                                                                            $main_content .= ' (' . $player->getGuildNick() . ')';
                                                                $main_content .= '
                                                                    </TD>
                                                                        <TD>' . htmlspecialchars(Website::getVocationName($player->getVocation())) . '</TD>
                                                                        <TD>' . htmlspecialchars($player->getLevel()) . '</TD>
                                                                        <TD class="onlinestatus"><span '.((!$player->isOnline()) ? 'class="red"' : 'class="green"').'>'.((!$player->isOnline()) ? 'offline' : '<strong>online</strong>').'</span>
                                                                    </TD>
                                                                </TR>';
                                                        }
                                                    }
                                                }
                                                $main_content .= '
                                                </table>
                                            </div>
                                        </div>
                                        <div class="TableShadowContainer" >
                                            <div class="TableBottomShadow" style="background-image:url('.$layout_name.'/images/global/content/table-shadow-bm.gif);" >
                                                <div class="TableBottomLeftShadow" style="background-image:url('.$layout_name.'/images/global/content/table-shadow-bl.gif);" ></div>
                                                <div class="TableBottomRightShadow" style="background-image:url('.$layout_name.'/images/global/content/table-shadow-br.gif);" ></div>
                                            </div>
                                        </div>
                                            </td>
                                    </tr>
                                    <tr>
                                        <td>';
                                    if(!isset($_REQUEST['onlyshowonline']) || $_REQUEST['onlyshowonline'] == 0)
                                        $main_content .= '
                                            <table class="InnerTableButtonRow" cellpadding="0" cellspacing="0" >
                                                <tr>
                                                    <td></td>
                                                    <td align="right" style="padding-right:7px;width:100%;" >
                                                        <form action="?subtopic=guilds" method="post" style="padding:0px;margin:0px;" >
                                                            <input type="hidden" name="action" value="view" >
                                                            <input type="hidden" name="onlyshowonline" value="1" >
                                                            <input type="hidden" name="GuildName" value="'.$_REQUEST['GuildName'].'" >
                                                            <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
                                                                <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
                                                                    <input class="ButtonText" type="image" name="Show Online" alt="Show Online" src="'.$layout_name.'/images/global/buttons/_sbutton_showonline.gif" >
                                                                </div>
                                                            </div>
                                                        </form>
                                                    </td>
                                                </tr>
                                            </table>';
                                    else
                                        $main_content .= '
                                            <table class="InnerTableButtonRow" cellpadding="0" cellspacing="0" >
                                                <tr>
                                                    <td></td>
                                                    <td align="right" style="padding-right:7px;width:100%;" >
                                                        <form action="?subtopic=guilds" method="post" style="padding:0px;margin:0px;" >
                                                            <input type="hidden" name="action" value="view" >
                                                            <input type="hidden" name="onlyshowonline" value="0" >
                                                            <input type="hidden" name="GuildName" value="'.$_REQUEST['GuildName'].'" >
                                                            <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
                                                                <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
                                                                    <input class="ButtonText" type="image" name="Show All" alt="Show All" src="'.$layout_name.'/images/global/buttons/_sbutton_showall.gif" >
                                                                </div>
                                                            </div>
                                                        </form>
                                                    </td>
                                                </tr>
                                            </table>';
                                    $main_content .= '
                                        </td>
                                    </tr>
                                </table>
                            </div>
                            </td>
                        </tr>
                    </table>
                </div>';
            if($logged) {
                $main_content .= '
                    <TABLE BORDER=0 class="fixed">
                        <TR>
                        <col width="140px">
                        <col width="140px">
                        <col width="140px">
                        <col width="140px">
                        <col width="140px">
                        <col width="140px">';
                    if($guild_vice)
                        $main_content .= '                    
                            <TD>
                                <table border="0" cellspacing="0" cellpadding="0" >
                                    <form action="?subtopic=guilds" method="post" >
                                        <tr>
                                            <td style="border:0px;" >
                                                <input type="hidden" name=action value=members >
                                                <input type="hidden" name=GuildName value="'.$_REQUEST['GuildName'].'" >
                                                <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
                                                    <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
                                                        <input class="ButtonText" type="image" name="Edit Members" alt="Edit Members" src="'.$layout_name.'/images/global/buttons/_sbutton_editmembers.gif" >
                                                    </div>
                                                </div>
                                            </td>
                                        </tr>
                                    </form>
                                </table>
                            </TD>';
                        if($guild_leader)
                        #Edit players ranks
                            $main_content .= '
                                <TD>
                                    <table border="0" cellspacing="0" cellpadding="0" >
                                        <form action="?subtopic=guilds" method="post" >
                                            <tr>
                                                <td style="border:0px;" >
                                                    <input type="hidden" name=action value=ranks >
                                                    <input type="hidden" name=GuildName value="'.$_REQUEST['GuildName'].'" >
                                                    <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
                                                        <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
                                                            <input class="ButtonText" type="image" name="Edit Ranks" alt="Edit Ranks" src="'.$layout_name.'/images/global/buttons/_sbutton_editranks.gif" >
                                                        </div>
                                                    </div>
                                                </td>
                                            </tr>
                                        </form>
                                    </table>
                                </TD>';
                    if($players_from_account_in_guild > 0)
                            $main_content .= '
                                <TD>
                                    <table border="0" cellspacing="0" cellpadding="0" >
                                        <form action="?subtopic=guilds" method="post" >
                                            <tr>
                                                <td style="border:0px;" >
                                                    <input type="hidden" name=action value=leave >
                                                    <input type="hidden" name=GuildName value="'.$_REQUEST['GuildName'].'" >
                                                    <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
                                                        <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
                                                            <input class="ButtonText" type="image" name="Leave Guild" alt="Leave Guild" src="'.$layout_name.'/images/global/buttons/_sbutton_leaveguild.gif" >
                                                        </div>
                                                    </div>
                                                </td>
                                            </tr>
                                        </form>
                                    </table>
                                </TD>';
                    $main_content .= '
                        </TR>
                    </TABLE>';
            }
            $main_content .= '
            <BR>
                <div class="TableContainer" >
                    <table class="Table3" cellpadding="0" cellspacing="0" >
                        <div class="CaptionContainer" >
                            <div class="CaptionInnerContainer" > 
                                <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>                            
                                <div class="Text" >Invited Characters</div>
                                <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
                                <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                            </div>
                        </div>
                        <tr>
                            <td><div class="InnerTableContainer" >
                                    <table style="width:100%;" >
                                        <tr>
                                            <td>
                                                <div class="TableShadowContainerRightTop" >
                                                    <div class="TableShadowRightTop" style="background-image:url('.$layout_name.'/images/global/content/table-shadow-rt.gif);" ></div>
                                                </div>
                                                <div class="TableContentAndRightShadow" style="background-image:url('.$layout_name.'/images/global/content/table-shadow-rm.gif);" >
                                                    <div class="TableContentContainer" >
                                                        <table class="TableContent" width="100%" >';
                                                    $invited_list = $guild->listInvites();
                                                    if(count($invited_list) == 0)
                                                        $main_content .= '
                                                            <TR BGCOLOR=#F1E0C6>
                                                                <TD>No invited characters found.</TD>
                                                            </TR>';
                                                    else {
                                                        $main_content .= '
                                                            <TR BGCOLOR=#D4C0A1>
                                                                <TD WIDTH=100%><B>Name</B></TD>
                                                            </TR>';
                                                        $show_accept_invite = 0;
                                                        $showed_invited = 1;
                                                        foreach($invited_list as $invited_player) {
                                                            if(count($account_players) > 0)
                                                                foreach($account_players as $player_from_acc)
                                                                    if($player_from_acc->getName() == $invited_player->getName())
                                                                        $show_accept_invite++;
                                                            if(is_int($showed_invited / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $showed_invited++;
                                                            $main_content .= '
                                                                <TR BGCOLOR='.$bgcolor.'>
                                                                    <TD><A HREF="?subtopic=characters&name='.urlencode($invited_player->getName()).'">'.htmlspecialchars($invited_player->getName()).'</A></TD>                                                            
                                                                </TR>';
                                                        }
                                                        
                                                    }
                                                    $main_content .= '
                                                        </table>
                                                    </div>
                                                </div>
                                                <div class="TableShadowContainer" >
                                                    <div class="TableBottomShadow" style="background-image:url('.$layout_name.'/images/global/content/table-shadow-bm.gif);" >
                                                        <div class="TableBottomLeftShadow" style="background-image:url('.$layout_name.'/images/global/content/table-shadow-bl.gif);" ></div>
                                                        <div class="TableBottomRightShadow" style="background-image:url('.$layout_name.'/images/global/content/table-shadow-br.gif);" ></div>
                                                    </div>
                                                </div>
                                            </td>
                                        </tr>
                                    </table>
                                </div>
                            </td>
                        </tr>
                    </table>
                </div>';
            
                $main_content .= '
                    <TABLE BORDER=0 class="fixed">
                        <col width="140px">
                        <col width="140px">
                        <col width="140px">
                        <col width="140px">
                        <col width="140px">
                        <TR>';
                    if($guild_vice)
                        $main_content .= '
                            <TD><table border="0" cellspacing="0" cellpadding="0" >
                                    <form action="?subtopic=guilds" method="post" >
                                        <tr>
                                            <td style="border:0px;" >
                                                <input type="hidden" name=action value=invite >
                                                <input type="hidden" name=GuildName value="'.$guild->getName().'" >
                                                <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
                                                    <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
                                                        <input class="ButtonText" type="image" name="Invite Character" alt="Invite Character" src="'.$layout_name.'/images/global/buttons/_sbutton_invitecharacter.gif" >
                                                    </div>
                                                </div>
                                            </td>
                                        </tr>
                                    </form>
                                </table>
                            </TD>';
                    if($show_accept_invite > 0)
                        $main_content .= '
                            <TD>
                                <table border="0" cellspacing="0" cellpadding="0" >
                                    <form action="?subtopic=guilds" method="post" >
                                        <tr>
                                            <td style="border:0px;" >
                                                <input type="hidden" name=action value=join >
                                                <input type="hidden" name=GuildName value="'.$guild->getName().'" >
                                                <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
                                                    <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
                                                        <input class="ButtonText" type="image" name="Join Guild" alt="Join Guild" src="'.$layout_name.'/images/global/buttons/_sbutton_joinguild.gif" >
                                                    </div>
                                                </div>
                                            </td>
                                        </tr>
                                    </form>
                                </table>
                            </TD>';
                    $main_content .= '
                        </TR>
                    </TABLE>';
            $main_content .= '
                <BR>
                <TABLE BORDER=0 WIDTH=100%>
                    <TR>
                        <TD ALIGN=center><IMG SRC="'.$layout_name.'/images/global/general/blank.gif" WIDTH=80 HEIGHT=1 BORDER=0<BR></TD>                    
                        <TD ALIGN="center">
                            <form action="?subtopic=guilds" method="post" style="padding:0px;margin:0px;" >
                                <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
                                    <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
                                        <input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/global/buttons/_sbutton_back.gif" >
                                    </div>
                                </div>
                            </form>
                        </TD>
                        <TD ALIGN=center><IMG SRC="'.$layout_name.'/images/global/general/blank.gif" WIDTH=80 HEIGHT=1 BORDER=0<BR></TD>
                    </TR>
                </TABLE>';
        }
    }
    if($action == "create") {
        $guild_name = trim($_REQUEST['name']);
        $leader = $_REQUEST['leader'];
        $todo = $_REQUEST['todo'];
        $guild_password = trim($_REQUEST['password']);    
        if(!$logged)
            $guild_errors[] = 'You are not logged in. You can\'t create guild.';
        if(empty($guild_errors)) 
        {
            $account_players = $account_logged->getPlayers();
            foreach($account_players as $player)
            {
                $player_rank = $player->getRank();
                if(empty($player_rank))
                    if($player->getLevel() >= $config['site']['guild_need_level'])
                        if(!$config['site']['guild_need_pacc'] || $account_logged->isPremium())
                            $array_of_player_nig[] = $player->getName();
            }
        }
        if(count($array_of_player_nig) == 0)
            $guild_errors[] = 'On your account all characters are in guilds or have too low level to create new guild.';
        if($todo == "save") {
            if(!check_guild_name($guild_name)) {
                $guild_errors[] = 'Invalid guild name format.';
            }
            if(!check_name($leader)) {
                $guild_errors[] = 'Invalid character name format.';
            }
            if(empty($guild_errors)) {
                $player = new Player();
                $player->find($leader);
                if(!$player->isLoaded())
                    $guild_errors[] = 'Character <b>'.htmlspecialchars($leader).'</b> doesn\'t exist.';
            }
            if(empty($guild_errors)) {
                $guild = new Guild();
                $guild->find($guild_name);
                if($guild->isLoaded())
                    $guild_errors[] = 'Guild <b>'.htmlspecialchars($guild_name).'</b> already exist. Select other name.';
            }
            if(empty($guild_errors)) {
                $bad_char = TRUE;
                foreach($array_of_player_nig as $nick_from_list)
                    if($nick_from_list == $player->getName())
                        $bad_char = FALSE;
                if($bad_char)
                    $guild_errors[] = 'Character <b>'.htmlspecialchars($leader).'</b> isn\'t on your account or is already in guild.';
            }
            if(empty($guild_errors)) {
                if($player->getLevel() < $config['site']['guild_need_level'])
                    $guild_errors[] = 'Character <b>'.htmlspecialchars($leader).'</b> has too low level. To create guild you need character with level <b>'.$config['site']['guild_need_level'].'</b>.';
                if($config['site']['guild_need_pacc'] && !$account_logged->isPremium())
                    $guild_errors[] = 'Character <b>'.htmlspecialchars($leader).'</b> is on FREE account. To create guild you need PREMIUM account.';
            }
            if(empty($guild_errors)) {
                if (!$account_logged->isValidPassword($guild_password))
                    $guild_errors[] = 'Wrong password, please check it and try again.';
            }
        }
        
        if(!empty($guild_errors)) {
            $main_content .= '
                <div class="TableContainer" >
                    <table class="Table1" cellpadding="0" cellspacing="0" >
                        <div class="CaptionContainer" >
                            <div class="CaptionInnerContainer" > 
                                <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>                        
                                <div class="Text" >Error</div>
                                <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
                                <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                            </div>
                        </div>
                        <tr>
                            <td>
                                <div class="InnerTableContainer" >
                                    <table style="width:100%;" >
                                        <tr>
                                            <td>';
                                        foreach($guild_errors as $guild_error)
                                            $main_content .= '<p>'.$guild_error.'</p>';
                                        $main_content .= '
                                            </td>
                                        </tr>
                                    </table>
                                </div>
                            </td>
                        </tr>
                    </table>
                </div><BR>
                <TABLE BORDER=0 WIDTH=100%>
                    <TR>
                        <TD ALIGN=center>
                            <table border="0" cellspacing="0" cellpadding="0" >
                                <form action="?subtopic=guilds" method="post" >
                                    <tr>
                                        <td style="border:0px;" >';
                                        if ($logged)
                                            if(count($array_of_player_nig) > 0)
                                                $main_content .= '
                                                    <input type="hidden" name=action value=create >';
                                        $main_content .= '
                                            <input type="hidden" name=name value="'.$guild_name.'" >
                                            <input type="hidden" name=leader value="'.$leader.'" >
                                            <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
                                                <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
                                                    <input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/global/buttons/_sbutton_back.gif" >
                                                </div>
                                            </div>
                                        </td>
                                    </tr>
                                </form>
                            </table>
                        </TD>
                    </TR>
                </TABLE>';
        } else {
            if($todo == "save")
            {
                $new_guild = new Guild();
                $new_guild->setCreationData(time());
                $new_guild->setName($guild_name);
                $new_guild->setOwner($player);
                $new_guild->setDescription('New guild. Leader must edit this text :)');
                $new_guild->setGuildLogo('image/gif', Website::getFileContents('./images/default_guild_logo.gif'));
                
                $new_guild->save();
                $ranks = $new_guild->getGuildRanksList(true);
                foreach($ranks as $rank)
                    if($rank->getLevel() == 3)
                    {
                        $player->setRank($rank);
                        $player->save();
                    }
                $main_content .= '
                    <div class="TableContainer" >
                        <table class="Table1" cellpadding="0" cellspacing="0" >
                            <div class="CaptionContainer" >
                                <div class="CaptionInnerContainer" > 
                                    <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                    <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                    <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                    <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>                        
                                    <div class="Text" >Guild Founded!</div>
                                    <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
                                    <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                    <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                    <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                </div>
                            </div>
                            <tr>
                                <td>
                                    <div class="InnerTableContainer" >
                                        <table style="width:100%;" >
                                            <tr>
                                                <td>You have founded the '.htmlspecialchars($guild_name).'. Now go ahead and invite the first members.</td>
                                            </tr>
                                        </table>
                                    </div>
                                </td>
                            </tr>
                        </table>
                    </div><br>
                    <TABLE BORDER=0 WIDTH=100%>
                        <TR>
                            <TD ALIGN=center>
                                <table border="0" cellspacing="0" cellpadding="0" >
                                    <form action="?subtopic=guilds" method="post" >
                                        <tr>
                                            <td style="border:0px;" >
                                                <input type="hidden" name=action value=view >
                                                <input type="hidden" name=GuildName value="'.$guild_name.'" >
                                                <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
                                                    <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
                                                        <input class="ButtonText" type="image" name="Continue" alt="Continue" src="'.$layout_name.'/images/global/buttons/_sbutton_continue.gif" >
                                                    </div>
                                                </div>
                                            </td>
                                        </tr>
                                    </form>
                                </table>
                            </TD>
                        </TR>
                    </TABLE>';
            } else {
                #form to create
                $main_content .= 'Do you want to found a new guild? none of your characters may hold one of the two highest ranks in any other guild.<BR><BR>Now enter the name of the new guild, specify the name of your character that should become the first leader and confirm with your account password. Then click on "Submit". Note that the first two data cannot be changed later.<BR><BR>';
                $main_content .= '
                    <FORM ACTION="?subtopic=guilds" METHOD="post">
                    <div class="TableContainer" >
                        <table class="Table1" cellpadding="0" cellspacing="0" >
                            <div class="CaptionContainer" >
                                <div class="CaptionInnerContainer" > 
                                    <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                    <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                    <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                    <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>                        
                                    <div class="Text" >Found Guild</div>
                                    <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
                                    <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                    <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                    <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                </div>
                            </div>
                            <tr>
                                <td>
                                    <div class="InnerTableContainer" >
                                        <table style="width:100%;" >
                                            <TR>
                                                <TD BGCOLOR=#D4C0A1>
                                                    <TABLE BORDER=0 CELLPADDING=1>
                                                        <TR>
                                                            <TD>Guild Name:</TD>
                                                            <TD><INPUT NAME="name" VALUE="'.$_REQUEST['name'].'" SIZE=30 MAXLENGTH=29></TD>
                                                        </TR>
                                                        <TR>
                                                            <TD>Leader:</TD>
                                                            <TD>
                                                                <SELECT NAME="leader">';
                                                                    if(count($array_of_player_nig) > 0) {
                                                                        sort($array_of_player_nig);
                                                                        foreach($array_of_player_nig as $nick)
                                                                            $main_content .= '<OPTION>'.htmlspecialchars($nick).'</OPTION>';
                                                                    }
                                                            $main_content .= '
                                                                </SELECT>
                                                            </TD>
                                                        </TR>
                                                        <TR>
                                                            <TD>Password:</TD>
                                                            <TD><INPUT TYPE=password NAME="password" SIZE=30 MAXLENGTH=29></TD>
                                                        </TR>
                                                    </TABLE>
                                                </TD>
                                            </TR>
                                        </table>
                                    </div>
                                </td>
                            </tr>
                        </table>
                    </div><BR>
                    <TABLE BORDER=0 WIDTH=100%>
                        <TR>
                            <TD ALIGN=center><IMG SRC="'.$layout_name.'/images/global/general/blank.gif" WIDTH=120 HEIGHT=1 BORDER=0><BR></TD>
                            <TD ALIGN=center>
                                <table border="0" cellspacing="0" cellpadding="0" >
                                    <tr>
                                        <td style="border:0px;" >
                                            <input type="hidden" name="todo" value="save" >
                                            <input type="hidden" name="action" value="create" >
                                            <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
                                                <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
                                                    <input class="ButtonText" type="image" name="Submit" alt="Submit" src="'.$layout_name.'/images/global/buttons/_sbutton_submit.gif" >
                                                </div>
                                            </div>
                                        </td>
                                    <tr>
                                </form>
                                </table>
                            </TD>
                            <TD ALIGN=center>
                                <table border="0" cellspacing="0" cellpadding="0" >
                                    <form action="?subtopic=guilds" method="post" >
                                        <tr>
                                            <td style="border:0px;" >
                                                <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
                                                    <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
                                                        <input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/global/buttons/_sbutton_back.gif" >
                                                    </div>
                                                </div>
                                            </td>
                                        </tr>
                                    </form>
                                </table>
                            </TD>
                            <TD ALIGN=center><IMG SRC="'.$layout_name.'/images/global/general/blank.gif" WIDTH=120 HEIGHT=1 BORDER=0><BR></TD>
                        </TR>
                    </TABLE>';
            }
        }
    }
    if ($action == "invite") {
        //set rights in guild
        $guild_name = (string) $_REQUEST['GuildName'];
        $name = $_REQUEST['character'];
        if(!$logged)
            $guild_errors[] = 'You are not logged in. You can\'t invite players.';
        if(empty($guild_errors))
        {
            $guild = new Guild();
            $guild->loadByName($guild_name);
            if(!$guild->isLoaded())
                $guild_errors[] = 'Guild with ID <b>'.$guild_id.'</b> doesn\'t exist.';
        }
        if(empty($guild_errors))
        {
            $rank_list = $guild->getGuildRanksList();
            $guild_leader = FALSE;
            $guild_vice = FALSE;
            $account_players = $account_logged->getPlayers();
            foreach($account_players as $player)
            {
                $player_rank = $player->getRank();
                if(!empty($player_rank))
                    foreach($rank_list as $rank_in_guild)
                        if($rank_in_guild->getId() == $player_rank->getId())
                        {
                            $players_from_account_in_guild[] = $player->getName();
                            if($player_rank->getLevel() > 1)
                            {
                                $guild_vice = TRUE;
                                $level_in_guild = $player_rank->getLevel();
                            }
                            if($guild->getOwner()->getId() == $player->getId())
                            {
                                $guild_vice = TRUE;
                                $guild_leader = TRUE;
                            }
                        }
            }
        }
        if(!$guild_vice)
            $guild_errors[] = 'You are not a leader or vice leader of guild ID <b>'.$guild_name.'</b>.';
        if($_REQUEST['invitation'] == 'yes')
        {
            if(!check_name($name))
                $guild_errors[] = 'Invalid name format.';
            if(empty($guild_errors))
            {
                $player = new Player();
                $player->find($name);
                if(!$player->isLoaded())
                    $guild_errors[] = 'Character <b>'.htmlspecialchars($name).'</b> doesn\'t exist.';
                else
                {
                    $rank_of_player = $player->getRank();
                    if(!empty($rank_of_player))
                        $guild_errors[] = 'Character <b>'.htmlspecialchars($name).'</b> is already in guild. He must leave guild before you can invite him.';
                }
            }
            if(empty($guild_errors))
            {
                $invited_list = $guild->listInvites();
                if(count($invited_list) > 0)
                    foreach($invited_list as $invited)
                        if($invited->getName() == $player->getName())
                            $guild_errors[] = '<b>'.htmlspecialchars($player->getName()).'</b> is already invited to your guild.';
            }
        }
        if($_REQUEST['invitation'] == 'no') {
            $player_remove_invite = $_REQUEST['character'];
            $player_noinvite = new Player();
            $player_noinvite->find($player_remove_invite);
            if($player_noinvite->isLoaded())
                $player_noinvite_id = $player_noinvite->getId();
            
        }
        
        if(!empty($guild_errors)) {
            $main_content .= '
                <div class="TableContainer" >
                    <table class="Table1" cellpadding="0" cellspacing="0" >
                        <div class="CaptionContainer" >
                            <div class="CaptionInnerContainer" > 
                                <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>                            
                                <div class="Text" >Error</div>
                                <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
                                <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                            </div>
                        </div>
                        <tr>
                            <td>
                                <div class="InnerTableContainer" >
                                    <table style="width:100%;" >
                                        <tr>
                                            <td class="red" >';
                                            foreach($guild_errors as $guild_error)
                                                $main_content .= '<p>'.$guild_error;
                                        $main_content .= '
                                            </td>
                                        </tr>
                                    </table>
                                </div>
                            </td>
                        </tr>
                    </table>
                </div><BR>';
        } else {
            if($_REQUEST['invitation'] == 'yes') {
                $guild->invite($player);
                //mensagem do char invitado
                $main_content .= '
                    <div class="TableContainer" >
                        <table class="Table1" cellpadding="0" cellspacing="0" >
                            <div class="CaptionContainer" >
                                <div class="CaptionInnerContainer" > 
                                    <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                    <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                    <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                    <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>                        
                                    <div class="Text" >Character Invited</div>
                                    <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
                                    <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                    <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                    <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                </div>
                            </div>
                            <tr>
                                <td><div class="InnerTableContainer" >
                                        <table style="width:100%;" >
                                            <tr>
                                                <td>'.htmlspecialchars($player->getName()).' has been invited.</td>
                                            </tr>
                                        </table>
                                    </div>
                                </td>
                            </tr>
                        </table>
                    </div>
                    <BR>';
            }
            if($_REQUEST['invitation'] == 'no') {
                $guild->deleteInvite($player_noinvite);
                $main_content .= '
                    <div class="TableContainer" >
                        <table class="Table1" cellpadding="0" cellspacing="0" >
                            <div class="CaptionContainer" >
                                <div class="CaptionInnerContainer" > 
                                    <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                    <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                    <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                    <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>                                
                                    <div class="Text" >Invitation Cancelled</div>
                                    <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
                                    <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                    <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                    <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                </div>
                            </div>
                            <tr>
                                <td>
                                    <div class="InnerTableContainer" >
                                        <table style="width:100%;" >
                                            <tr>
                                                <td>The invitation of '.$player_remove_invite.' has been cancelled.</td>
                                            </tr>
                                        </table>
                                    </div>
                                </td>
                            </tr>
                        </table>
                    </div>
                    <BR>';
            }
        }
            $main_content .= '
                Enter the name of a character you want to invite to your guild and click on "Submit".<BR><BR>';
            $main_content .= '
                <div class="TableContainer" >
                    <table class="Table1" cellpadding="0" cellspacing="0" >
                        <div class="CaptionContainer" >
                            <div class="CaptionInnerContainer" > 
                                <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>                        
                                <div class="Text" >Invite Character</div>
                                <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
                                <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                            </div>
                        </div>
                        <tr>
                            <td>
                                <div class="InnerTableContainer" >
                                    <table style="width:100%;" >
                                        <TR>
                                            <TD BGCOLOR=#D4C0A1>
                                                <FORM ACTION="?subtopic=guilds" METHOD=post>
                                                    <TABLE BORDER=0 CELLPADDING=1>
                                                        <TR>
                                                            <TD>Name:</TD>
                                                            <TD><INPUT NAME="character" VALUE="" SIZE=30 MAXLENGTH=30></TD>
                                                            <TD WIDTH=100% ALIGN=right>
                                                                <table border="0" cellspacing="0" cellpadding="0" >
                                                                    <tr>
                                                                        <td style="border:0px;" >
                                                                            <input type="hidden" name=action value=invite >
                                                                            <input type="hidden" name=invitation value=yes >
                                                                            <input type="hidden" name=GuildName value="'.$_REQUEST['GuildName'].'" >
                                                                            <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
                                                                                <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
                                                                                    <input class="ButtonText" type="image" name="Submit" alt="Submit" src="'.$layout_name.'/images/global/buttons/_sbutton_submit.gif" >
                                                                                </div>
                                                                            </div>
                                                                        </td>                                                    
                                                                    </tr>
                                                                </table>
                                                            </TD>
                                                        </TR>
                                                    </TABLE>
                                                </form>
                                            </td>
                                        </tr>
                                    </table>
                                </div>
                            </td>
                        </tr>
                    </table>
                </div>';
            $invited_list = $guild->listInvites();
            if(count($invited_list) > 0) {
                $main_content .= '
                    <BR>
                    If you want to cancel an invitation, select the according character and click on "Submit".<BR><BR>
                    <div class="TableContainer" >
                        <table class="Table1" cellpadding="0" cellspacing="0" >
                            <div class="CaptionContainer" >
                                <div class="CaptionInnerContainer" > 
                                    <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                    <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                    <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                    <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>                                
                                    <div class="Text" >Cancel Invitation</div>
                                    <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
                                    <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                    <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                    <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                </div>
                            </div>
                            <tr>
                                <td>
                                    <div class="InnerTableContainer" >
                                        <table style="width:100%;" >
                                            <TR>
                                                <TD BGCOLOR=#D4C0A1>
                                                    <FORM ACTION="?subtopic=guilds" METHOD=post>
                                                        <TABLE BORDER=0 CELLPADDING=1>
                                                            <TR>
                                                                <TD>Name:</TD>
                                                                <TD>
                                                                    <SELECT NAME="character">';
                                                                foreach($invited_list as $invited)
                                                                    $main_content .= '
                                                                        <OPTION VALUE="'.$invited->getName().'">'.$invited->getName().'</OPTION>';
                                                                $main_content .= '
                                                                    </SELECT>
                                                                </TD>
                                                                <TD WIDTH=100% ALIGN=right>
                                                                    <table border="0" cellspacing="0" cellpadding="0" >
                                                                        <tr>
                                                                            <td style="border:0px;" >
                                                                                <input type="hidden" name=action value=invite >
                                                                                <input type="hidden" name=invitation value=no >
                                                                                <input type="hidden" name=GuildName value="'.$_REQUEST['GuildName'].'" >
                                                                                <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
                                                                                    <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
                                                                                        <input class="ButtonText" type="image" name="Submit" alt="Submit" src="'.$layout_name.'/images/global/buttons/_sbutton_submit.gif" >
                                                                                    </div>
                                                                                </div>
                                                                            </td>                                                        
                                                                        <tr>
                                                                    </table>
                                                                </TD>
                                                            </TR>
                                                        </TABLE>
                                                    </FORM>
                                                </TD>
                                            </TR>
                                        </table>
                                    </div>
                                </td>
                            </tr>
                        </table>
                    </div>';
            }
            
            $main_content .= '
                <BR>
                <TABLE BORDER=0 WIDTH=100%>
                    <TR>
                        <TD ALIGN=center><table border="0" cellspacing="0" cellpadding="0" >
                                <form action="?subtopic=guilds&action=view" method="post" >
                                    <tr>
                                        <td style="border:0px;" >
                                            <input type="hidden" name=GuildName value="'.$_REQUEST['GuildName'].'" >
                                            <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
                                                <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
                                                    <input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/global/buttons/_sbutton_back.gif" >
                                                </div>
                                            </div>
                                        </td>
                                    </tr>
                                </form>
                            </table>
                        </TD>
                    </TR>
                </TABLE>';
    }
    if($action == "leave") {
        //set rights in guild
        $guild_name = (string) $_REQUEST['GuildName'];
        $name = $_REQUEST['character'];
        if(!$logged)
            $guild_errors[] = 'You are not logged in. You can\'t leave guild.';
        if(empty($guild_errors))
        {
            $guild = new Guild();
            $guild->loadByName($guild_name);
            if(!$guild->isLoaded())
                $guild_errors[] = 'Guild <b>'.$guild_name.'</b> doesn\'t exist.';
        }

        if(empty($guild_errors))
        {
            $guild_owner_id = $guild->getOwner()->getId();
            if($_REQUEST['leaveguild'] == 'yes')
            {
                if(!check_name($name))
                    $guild_errors[] = 'Invalid name format.';
                if(empty($guild_errors))
                {
                    $player = new Player();
                    $player->find($name);
                    if(!$player->isLoaded())
                        $guild_errors[] = 'Character <b>'.htmlspecialchars($name).'</b> doesn\'t exist.';
                    else
                        if($player->getAccount()->getId() != $account_logged->getId())
                            $guild_errors[] = 'Character <b>'.htmlspecialchars($name).'</b> isn\'t from your account!';
                }
                if(empty($guild_errors))
                {
                    $player_loaded_rank = $player->getRank();
                    if(!empty($player_loaded_rank) && $player_loaded_rank->isLoaded())
                    {
                        if($player_loaded_rank->getGuild()->getId() != $guild->getId())
                            $guild_errors[] = 'Character <b>'.htmlspecialchars($name).'</b> isn\'t from guild <b>'.htmlspecialchars($guild->getName()).'</b>.';
                    }
                    else
                        $guild_errors[] = 'Character <b>'.htmlspecialchars($name).'</b> isn\'t in any guild.';
                }
                if(empty($guild_errors))
                    if($guild_owner_id == $player->getId())
                        $guild_errors[] = 'You can\'t leave guild. You are an owner of guild.';
            }
            else
            {
                $account_players = $account_logged->getPlayers();
                foreach($account_players as $player_fac)
                {
                    $player_rank = $player_fac->getRank();
                    if(!empty($player_rank))
                        if($player_rank->getGuild()->getId() == $guild->getId())
                            if($guild_owner_id != $player_fac->getId())
                                $array_of_player_ig[] = $player_fac->getName();
                }
            }
        }
        if(!empty($guild_errors)) {
            $main_content .= '
                <div class="TableContainer" >
                    <table class="Table1" cellpadding="0" cellspacing="0" >
                        <div class="CaptionContainer" >
                            <div class="CaptionInnerContainer" > 
                                <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>                            
                                <div class="Text" >Error</div>
                                <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
                                <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                            </div>
                        </div>
                        <tr>
                            <td>
                                <div class="InnerTableContainer" >
                                    <table style="width:100%;" >
                                        <tr>
                                            <td class="red" >';
                                            foreach($guild_errors as $guild_error)
                                                $main_content .= '<p>'.$guild_error;
                                        $main_content .= '
                                            </td>
                                        </tr>
                                    </table>
                                </div>
                            </td>
                        </tr>
                    </table>
                </div><BR>';
        } else {
            if($_REQUEST['leaveguild'] == 'yes') {
                $player->setRank();
                $player->save();
                $main_content .= '                
                    <div class="TableContainer" >
                        <table class="Table1" cellpadding="0" cellspacing="0" >
                            <div class="CaptionContainer" >
                                <div class="CaptionInnerContainer" > 
                                    <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                    <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                    <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                    <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>                                
                                    <div class="Text" >Guild Left</div>
                                    <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
                                    <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                    <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                    <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                </div>
                            </div>
                            <tr>
                                <td><div class="InnerTableContainer" >
                                        <table style="width:100%;" >
                                            <tr>
                                                <td>You have left the guild.</td>
                                            </tr>
                                        </table>
                                    </div>
                                </td>
                            </tr>
                        </table>
                    </div><BR>
                    <TABLE BORDER=0 WIDTH=100%>
                        <TR>
                            <TD ALIGN=center><table border="0" cellspacing="0" cellpadding="0" >
                                    <form action="?subtopic=guilds&page=view" method="post" >
                                        <tr>
                                            <td style="border:0px;" >
                                                <input type="hidden" name=action value=view >
                                                <input type="hidden" name=GuildName value="'.$_REQUEST['GuildName'].'" >
                                                <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
                                                    <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
                                                        <input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/global/buttons/_sbutton_back.gif" >
                                                    </div>
                                                </div>
                                            </td>
                                        </tr>
                                    </form>
                                </table>
                            </TD>
                        </TR>
                    </TABLE>';
            } else {
                $main_content .= '
                    The following of your characters are members of this guild. If you want to leave, select a character and click on "Submit".<BR><BR>';
                $main_content .= '
                    <FORM ACTION="?subtopic=guilds" METHOD=post>
                        <div class="TableContainer" >
                            <table class="Table1" cellpadding="0" cellspacing="0" >
                                <div class="CaptionContainer" >
                                    <div class="CaptionInnerContainer" > 
                                        <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                        <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                        <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                        <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>                
                                        <div class="Text" >Guild Members</div>
                                        <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
                                        <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                        <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                        <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                    </div>
                                </div>
                                <tr>
                                    <td><div class="InnerTableContainer" >
                                            <table style="width:100%;" >
                                                <TR>';
                                            if(count($array_of_player_ig) > 0) {
                                                $main_content .= '
                                                    <TD BGCOLOR=#D4C0A1>';
                                                    sort($array_of_player_ig);
                                                    foreach($array_of_player_ig as $player_to_leave)
                                                        $main_content .= '                                        
                                                            <INPUT TYPE=radio NAME="character" VALUE="'.htmlspecialchars($player_to_leave).'" '.((count($array_of_player_ig) == 1) ? 'checked' : '').'>'.htmlspecialchars($player_to_leave).'<BR>';
                                                $main_content .= '</TD>';
                                            } else {
                                                $main_content .= '<TD BGCOLOR=#D4C0A1>Any of your characters can\'t leave guild.</TD>';
                                            }
                                            $main_content .= '                                        
                                                </TR>
                                            </table>
                                        </div>
                                    </td>
                                </tr>
                            </table>
                        </div>
                        <BR>
                        <TABLE BORDER=0 WIDTH=100%>
                            <TR align="center">
                                <TD ALIGN=center>
                                    <table border="0" cellspacing="0" cellpadding="0" >
                                        <tr>
                                            <td style="border:0px;" >
                                                <input type="hidden" name=action value=leave >
                                                <input type="hidden" name="leaveguild" value="yes">
                                                <input type="hidden" name=GuildName value="'.$_REQUEST['GuildName'].'" >
                                                <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
                                                    <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
                                                        <input class="ButtonText" type="image" name="Submit" alt="Submit" src="'.$layout_name.'/images/global/buttons/_sbutton_submit.gif" >
                                                    </div>
                                                </div>
                                            </td>                    
                                        <tr>
                                    </form>
                                </table>
                            </TD>
                            <TD ALIGN=center>
                                <table border="0" cellspacing="0" cellpadding="0" >
                                    <form action="?subtopic=guilds&action=view" method="post" >
                                        <tr>
                                            <td style="border:0px;" >
                                                <input type="hidden" name=action value=view >
                                                <input type="hidden" name=GuildName value="'.$_REQUEST['GuildName'].'" >
                                                <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
                                                    <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
                                                        <input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/global/buttons/_sbutton_back.gif" >
                                                    </div>
                                                </div>
                                            </td>
                                        </tr>
                                    </form>
                                </table>
                            </TD>
                        </TR>
                    </TABLE>';
            }
        }
    }
    if($action == "join") {
        //set rights in guild
        $guild_name = (string) $_REQUEST['GuildName'];
        $name = $_REQUEST['character'];
        if(!$logged)
            $guild_errors[] = 'You are not logged in. You can\'t accept invitations.';
        if(empty($guild_errors))
        {
            $guild = new Guild();
            $guild->loadByName($guild_name);
            if(!$guild->isLoaded())
                $guild_errors[] = 'Guild <b>'.$guild_name.'</b> doesn\'t exist.';
        }

        if($_REQUEST['joinguild'] == 'yes')
        {
            if(!check_name($name))
                $guild_errors[] = 'Invalid name format.';
            if(empty($guild_errors))
            {
                $player = new Player();
                $player->find($name);
                if(!$player->isLoaded())
                {
                    $guild_errors[] = 'Player with name <b>'.htmlspecialchars($name).'</b> doesn\'t exist.';
                }
                else
                {
                    $rank_of_player = $player->getRank();
                    if(!empty($rank_of_player))
                    {
                        $guild_errors[] = 'Character with name <b>'.htmlspecialchars($name).'</b> is already in guild. You must leave guild before you join other guild.';
                    }
                }
            }
        }
        if($_REQUEST['joinguild'] == 'yes')
        {
            if(empty($guild_errors))
            {
                $is_invited = FALSE;
                $invited_list = $guild->listInvites();
                if(count($invited_list) > 0)
                {
                    foreach($invited_list as $invited)
                    {
                        if($invited->getName() == $player->getName())
                        {
                            $is_invited = TRUE;
                        }
                    }
                }
                if(!$is_invited)
                {
                    $guild_errors[] = 'Character '.htmlspecialchars($player->getName()).' isn\'t invited to guild <b>'.htmlspecialchars($guild->getName()).'</b>.';
                }
            }
        } else
        {
            if(empty($guild_errors))
            {
                $acc_invited = FALSE;
                $account_players = $account_logged->getPlayers();
                $invited_list = $guild->listInvites();
                if(count($invited_list) > 0)
                {
                    foreach($invited_list as $invited)
                    {
                        foreach($account_players as $player_from_acc)
                        {
                            if($invited->getName() == $player_from_acc->getName())
                            {
                                $acc_invited = TRUE;
                                $list_of_invited_players[] = $player_from_acc->getName();
                            }
                        }
                    }
                }
            }
            if(!$acc_invited)
            {
                $guild_errors[] = 'Any character from your account isn\'t invited to <b>'.htmlspecialchars($guild->getName()).'</b>.';
            }
        }
        if(!empty($guild_errors)) {
            $main_content .= '
                <div class="TableContainer" >
                    <table class="Table1" cellpadding="0" cellspacing="0" >
                        <div class="CaptionContainer" >
                            <div class="CaptionInnerContainer" > 
                                <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>                            
                                <div class="Text" >Error</div>
                                <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
                                <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                            </div>
                        </div>
                        <tr>
                            <td>
                                <div class="InnerTableContainer" >
                                    <table style="width:100%;" >
                                        <tr>
                                            <td class="red" >';
                                            foreach($guild_errors as $guild_error)
                                                $main_content .= '<p>'.$guild_error;
                                        $main_content .= '
                                            </td>
                                        </tr>
                                    </table>
                                </div>
                            </td>
                        </tr>
                    </table>
                </div><BR>';
        }else
        {
            if($_REQUEST['joinguild'] == 'yes') {
                $guild->acceptInvite($player);
                $main_content .= '                
                    <div class="TableContainer" >
                        <table class="Table1" cellpadding="0" cellspacing="0" >
                            <div class="CaptionContainer" >
                                <div class="CaptionInnerContainer" > 
                                    <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                    <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                    <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                    <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>                                
                                    <div class="Text" >Guild Join</div>
                                    <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
                                    <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                    <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                    <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                </div>
                            </div>
                            <tr>
                                <td><div class="InnerTableContainer" >
                                        <table style="width:100%;" >
                                            <tr>
                                                <td>You have joined the guild.</td>
                                            </tr>
                                        </table>
                                    </div>
                                </td>
                            </tr>
                        </table>
                    </div><BR>
                    <TABLE BORDER=0 WIDTH=100%>
                        <TR>
                            <TD ALIGN=center><table border="0" cellspacing="0" cellpadding="0" >
                                    <form action="?subtopic=guilds&action=view" method="post" >
                                        <tr>
                                            <td style="border:0px;" >
                                                <input type="hidden" name=action value=view >
                                                <input type="hidden" name=GuildName value="'.$_REQUEST['GuildName'].'" >
                                                <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
                                                    <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
                                                        <input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/global/buttons/_sbutton_back.gif" >
                                                    </div>
                                                </div>
                                            </td>
                                        </tr>
                                    </form>
                                </table>
                            </TD>
                        </TR>
                    </TABLE>';
            } else {
                $main_content .= '
                    The following of your characters are invited for this guild. If you want to join, select a character and click on "Submit".<BR><BR>';
                $main_content .= '
                    <FORM ACTION="?subtopic=guilds" METHOD=post>
                        <div class="TableContainer" >
                            <table class="Table1" cellpadding="0" cellspacing="0" >
                                <div class="CaptionContainer" >
                                    <div class="CaptionInnerContainer" > 
                                        <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                        <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                        <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                        <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>                
                                        <div class="Text" >Join Guild</div>
                                        <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
                                        <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                        <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                        <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                    </div>
                                </div>
                                <tr>
                                    <td><div class="InnerTableContainer" >
                                            <table style="width:100%;" >
                                                <TR>';
                                            if(count($list_of_invited_players) > 0) {
                                                $main_content .= '
                                                    <TD BGCOLOR=#D4C0A1>';
                                                    sort($list_of_invited_players);
                                                    foreach($list_of_invited_players as $invited_player_from_list)
                                                        $main_content .= '                                        
                                                            <INPUT TYPE=radio NAME="character" VALUE="'.htmlspecialchars($invited_player_from_list).'" '.((count($list_of_invited_players) == 1) ? 'checked' : '').'>'.htmlspecialchars($invited_player_from_list).'<BR>';
                                                $main_content .= '</TD>';
                                            } else {
                                                $main_content .= '<TD BGCOLOR=#D4C0A1>Any of your characters can\'t join guild.</TD>';
                                            }
                                            $main_content .= '                                        
                                                </TR>
                                            </table>
                                        </div>
                                    </td>
                                </tr>
                            </table>
                        </div>
                        <BR>
                        <TABLE BORDER=0 WIDTH=100%>
                            <TR align="center">
                                <TD ALIGN=center>
                                    <table border="0" cellspacing="0" cellpadding="0" >
                                        <tr>
                                            <td style="border:0px;" >
                                                <input type="hidden" name=action value=join >
                                                <input type="hidden" name="joinguild" value="yes">
                                                <input type="hidden" name=GuildName value="'.$_REQUEST['GuildName'].'" >
                                                <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
                                                    <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
                                                        <input class="ButtonText" type="image" name="Submit" alt="Submit" src="'.$layout_name.'/images/global/buttons/_sbutton_submit.gif" >
                                                    </div>
                                                </div>
                                            </td>                    
                                        <tr>
                                    </form>
                                </table>
                            </TD>
                            <TD ALIGN=center>
                                <table border="0" cellspacing="0" cellpadding="0" >
                                    <form action="?subtopic=guilds&action=view" method="post" >
                                        <tr>
                                            <td style="border:0px;" >
                                                <input type="hidden" name=action value=view >
                                                <input type="hidden" name=GuildName value="'.$_REQUEST['GuildName'].'" >
                                                <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
                                                    <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
                                                        <input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/global/buttons/_sbutton_back.gif" >
                                                    </div>
                                                </div>
                                            </td>
                                        </tr>
                                    </form>
                                </table>
                            </TD>
                        </TR>
                    </TABLE>';
            }
        }
    }
    if($action == "ranks") {
        //set rights in guild
        $guild_name = (string) $_REQUEST['GuildName'];
        $ranktorename = (int) $_REQUEST['ranktorename'];
        $new_rankname = (string) trim($_REQUEST['newrankname']);
        $rank_name = $_REQUEST['rank_name'];
        if(!$logged)
            $guild_errors[] = 'You are not logged in. You can\'t accept invitations.';
        if(empty($guild_errors)) {
            $guild = new Guild();
            $guild->loadByName($guild_name);
            if(!$guild->isLoaded())
                $guild_errors[] = 'Guild <b>'.$guild_name.'</b> doesn\'t exist.';
        }
        if(empty($guild_errors)) {
            $guild_leader_char = $guild->getOwner();
            $rank_list = $guild->getGuildRanksList();
            $guild_leader = FALSE;
            $account_players = $account_logged->getPlayers();
            foreach($account_players as $player)
                if($guild_leader_char->getId() == $player->getId())
                {
                    $guild_leader = TRUE;
                    $level_in_guild = 3;
                }
            if(!$guild_leader)
                $guild_errors[] = 'You are not leader of the Guild.';
        }
        if($_REQUEST['changerankname'] == "yes") {
            $rank_rename = new GuildRank();
            $rank_rename->load($ranktorename);
            if(!$rank_rename->isLoaded())
                $guild_errors[] = 'This rank doesn\'t exist.';
            if(!check_rank_name($new_rankname))
                $guild_errors[] = 'Invalid rank name. Please use only a-Z, 0-9 and spaces.';
        }
        
        if($_REQUEST['add_rank'] == "yes")
            if(!check_rank_name($rank_name))
                $guild_errors[] = 'Invalid rank name format.';
                
        if(!empty($guild_errors)) {
            //errors
            $main_content .= '
                <div class="TableContainer" >
                    <table class="Table1" cellpadding="0" cellspacing="0" >
                        <div class="CaptionContainer" >
                            <div class="CaptionInnerContainer" > 
                                <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>                            
                                <div class="Text" >Guild Rank Errors</div>
                                <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
                                <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                            </div>
                        </div>
                        <tr>
                            <td>
                                <div class="InnerTableContainer" >
                                    <table style="width:100%;" >
                                        <tr>
                                            <td class="red" >';
                                            foreach($guild_errors as $guild_error)
                                                $main_content .= '<p>'.$guild_error;
                                        $main_content .= '
                                            </td>
                                        </tr>
                                    </table>
                                </div>
                            </td>
                        </tr>
                    </table>
                </div><BR>';
        } else {
            if($_REQUEST['changerankname'] == "yes") {
                //renamed
                $rank_rename->setName($new_rankname);
                $rank_rename->save();
                $main_content .= '                
                    <div class="TableContainer" >
                        <table class="Table1" cellpadding="0" cellspacing="0" >
                            <div class="CaptionContainer" >
                                <div class="CaptionInnerContainer" > 
                                    <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                    <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                    <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                    <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>                                
                                    <div class="Text" >Guild Rank</div>
                                    <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
                                    <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                    <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                    <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                </div>
                            </div>
                            <tr>
                                <td><div class="InnerTableContainer" >
                                        <table style="width:100%;" >
                                            <tr>
                                                <td>The name of the rank was changed successfully.</td>
                                            </tr>
                                        </table>
                                    </div>
                                </td>
                            </tr>
                        </table>
                    </div><BR>
                    <TABLE BORDER=0 WIDTH=100%>
                        <TR>
                            <TD ALIGN=center><table border="0" cellspacing="0" cellpadding="0" >
                                    <form action="?subtopic=guilds&action=view" method="post" >
                                        <tr>
                                            <td style="border:0px;" >
                                                <input type="hidden" name=action value=view >
                                                <input type="hidden" name=GuildName value="'.$_REQUEST['GuildName'].'" >
                                                <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
                                                    <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
                                                        <input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/global/buttons/_sbutton_back.gif" >
                                                    </div>
                                                </div>
                                            </td>
                                        </tr>
                                    </form>
                                </table>
                            </TD>
                        </TR>
                    </TABLE>';
                } elseif($_REQUEST['add_rank'] == "yes") {
                $new_rank = new GuildRank();
                $new_rank->setGuild($guild);
                $new_rank->setLevel(1);
                $new_rank->setName($rank_name);
                $new_rank->save();
                
                $main_content .= '                
                    <div class="TableContainer" >
                        <table class="Table1" cellpadding="0" cellspacing="0" >
                            <div class="CaptionContainer" >
                                <div class="CaptionInnerContainer" > 
                                    <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                    <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                    <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                    <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>                                
                                    <div class="Text" >Guild Rank</div>
                                    <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
                                    <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                    <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                    <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                </div>
                            </div>
                            <tr>
                                <td><div class="InnerTableContainer" >
                                        <table style="width:100%;" >
                                            <tr>
                                                <td>The rank was added to Guild.</td>
                                            </tr>
                                        </table>
                                    </div>
                                </td>
                            </tr>
                        </table>
                    </div><BR>
                    <TABLE BORDER=0 WIDTH=100%>
                        <TR>
                            <TD ALIGN=center><table border="0" cellspacing="0" cellpadding="0" >
                                    <form action="?subtopic=guilds&action=view" method="post" >
                                        <tr>
                                            <td style="border:0px;" >
                                                <input type="hidden" name=action value=view >
                                                <input type="hidden" name=GuildName value="'.$_REQUEST['GuildName'].'" >
                                                <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
                                                    <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
                                                        <input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/global/buttons/_sbutton_back.gif" >
                                                    </div>
                                                </div>
                                            </td>
                                        </tr>
                                    </form>
                                </table>
                            </TD>
                        </TR>
                    </TABLE>';
            } else {
                $main_content .= '
                    To change the name of a rank, simply edit name in the corresponding field and confirm the change by clicking on "Submit".<BR>
                    <BR>
                    <div class="TableContainer" >
                        <table class="Table5" cellpadding="0" cellspacing="0" >
                            <div class="CaptionContainer" >
                                <div class="CaptionInnerContainer" > 
                                    <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                    <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                    <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                    <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>                        
                                    <div class="Text" >Edit Guild Ranks</div>
                                    <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
                                    <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                    <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                    <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                </div>
                            </div>
                            <tr>
                                <td>
                                    <div class="InnerTableContainer" >
                                        <table style="width:100%;" >
                                            <tr>
                                                <td>
                                                    <div class="TableShadowContainerRightTop" >
                                                        <div class="TableShadowRightTop" style="background-image:url('.$layout_name.'/images/global/content/table-shadow-rt.gif);" ></div>
                                                    </div>
                                                    <div class="TableContentAndRightShadow" style="background-image:url('.$layout_name.'/images/global/content/table-shadow-rm.gif);" >
                                                        <div class="TableContentContainer" >
                                                            <table class="TableContent" width="100%" >
                                                                <TR>
                                                                    <TD BGCOLOR=#D4C0A1>
                                                                        <TABLE BORDER=0 CELLPADDING=2>
                                                                            <FORM ACTION="?subtopic=guilds" METHOD=post>
                                                                                <TR>
                                                                                    <TD>Set&nbsp;rank&nbsp;name</TD>
                                                                                    <TD>
                                                                                        <SELECT NAME="ranktorename">';
                                                                                    $rank_number = 0;
                                                                                    foreach($rank_list as $rank) {
                                                                                        $rank_number++;
                                                                                        $main_content .= '
                                                                                            <OPTION VALUE="'.$rank->getID().'">'.$rank_number.': '.$rank->getName().'</OPTION>';
                                                                                    }
                                                                                    $main_content .= '
                                                                                        </SELECT>
                                                                                    </TD>
                                                                                    <TD>to:</TD>
                                                                                    <TD><INPUT NAME="newrankname" VALUE="'.$_REQUEST['newrankname'].'" SIZE=30 MAXLENGTH=29></TD>
                                                                                    <TD WIDTH=100% ALIGN=right>
                                                                                        <table border="0" cellspacing="0" cellpadding="0" >
                                                                                            <tr>
                                                                                                <td style="border:0px;" >
                                                                                                    <input type="hidden" name=action value=ranks >
                                                                                                    <input type="hidden" name="changerankname" value="yes">
                                                                                                    <input type="hidden" name=GuildName value="'.$_REQUEST['GuildName'].'" >
                                                                                                    <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
                                                                                                        <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" >
                                                                                                            <div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
                                                                                                            <input class="ButtonText" type="image" name="Submit" alt="Submit" src="'.$layout_name.'/images/global/buttons/_sbutton_submit.gif" >
                                                                                                        </div>
                                                                                                    </div>
                                                                                                </td>                                                                    
                                                                                            <tr>
                                                                                        </table>
                                                                                    </TD>
                                                                                </TR>
                                                                            </FORM>
                                                                        </TABLE>
                                                                    </TD>
                                                                </TR>
                                                            </table>
                                                        </div>
                                                    </div>
                                                    <div class="TableShadowContainer" >
                                                        <div class="TableBottomShadow" style="background-image:url('.$layout_name.'/images/global/content/table-shadow-bm.gif);" >
                                                            <div class="TableBottomLeftShadow" style="background-image:url('.$layout_name.'/images/global/content/table-shadow-bl.gif);" ></div>
                                                            <div class="TableBottomRightShadow" style="background-image:url('.$layout_name.'/images/global/content/table-shadow-br.gif);" ></div>
                                                        </div>
                                                    </div>
                                                </td>
                                            </tr>
                                        </table>
                                    </div>
                                </td>
                            </tr>
                        </table>
                    </div>
                    <BR>
                    <div class="TableContainer" >
                        <table class="Table5" cellpadding="0" cellspacing="0" >
                            <div class="CaptionContainer" >
                                <div class="CaptionInnerContainer" > 
                                    <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                    <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                    <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                    <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>                                
                                    <div class="Text" >Add new rank</div>
                                    <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
                                    <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                    <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                    <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                </div>
                            </div>
                            <tr>
                                <td>
                                    <div class="InnerTableContainer" >
                                        <table style="width:100%;" >
                                            <tr>
                                                <td>
                                                    <div class="TableShadowContainerRightTop" >
                                                        <div class="TableShadowRightTop" style="background-image:url('.$layout_name.'/images/global/content/table-shadow-rt.gif);" ></div>
                                                    </div>
                                                    <div class="TableContentAndRightShadow" style="background-image:url('.$layout_name.'/images/global/content/table-shadow-rm.gif);" >
                                                        <div class="TableContentContainer" >
                                                            <table class="TableContent" width="100%">
                                                                <TR>
                                                                    <TD BGCOLOR=#D4C0A1>
                                                                    <FORM ACTION="?subtopic=guilds" METHOD=post>
                                                                        <TABLE BORDER=0 CELLPADDING=3>
                                                                            <tr>
                                                                                <td valign="middle">New rank name:</td>
                                                                                <td valign="middle">                                                                                
                                                                                    <input type="text" name="rank_name" size="50" value="'.$_REQUEST['rank_name'].'">                                                                                
                                                                                </td>
                                                                                <td valign="middle">
                                                                                        <input type="hidden" name=action value=ranks >
                                                                                        <input type="hidden" name=GuildName value="'.$_REQUEST['GuildName'].'" >
                                                                                        <input type="hidden" name="add_rank" value="yes">
                                                                                        <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
                                                                                            <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" >
                                                                                                <div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
                                                                                                <input class="ButtonText" type="image" name="Submit" alt="Submit" src="'.$layout_name.'/images/global/buttons/_sbutton_submit.gif" >
                                                                                            </div>
                                                                                        </div>
                                                                                    </FORM>
                                                                                </td>
                                                                            </tr>
                                                                        </TABLE>
                                                                    </TD>
                                                                </TR>
                                                            </table>
                                                        </div>
                                                    </div>
                                                    <div class="TableShadowContainer" >
                                                        <div class="TableBottomShadow" style="background-image:url('.$layout_name.'/images/global/content/table-shadow-bm.gif);" >
                                                            <div class="TableBottomLeftShadow" style="background-image:url('.$layout_name.'/images/global/content/table-shadow-bl.gif);" ></div>
                                                            <div class="TableBottomRightShadow" style="background-image:url('.$layout_name.'/images/global/content/table-shadow-br.gif);" ></div>
                                                        </div>
                                                    </div>
                                                </td>
                                            </tr>
                                        </table>
                                    </div>
                                </table>
                            </div>
                        </td>
                    </tr>
                    <br>
                    <TABLE BORDER=0 WIDTH=100%>
                        <TR>
                            <TD ALIGN=center>
                                <table border="0" cellspacing="0" cellpadding="0" >
                                    <form action="?subtopic=guilds&action=view" method="post" >
                                        <tr>
                                            <td style="border:0px;" >
                                                <input type="hidden" name=GuildName value="'.$_REQUEST['GuildName'].'" >
                                                <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
                                                    <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
                                                        <input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/global/buttons/_sbutton_back.gif" >
                                                    </div>
                                                </div>
                                            </td>
                                        </tr>
                                    </form>
                                </table>
                            </TD>
                        </TR>
                    </TABLE>';
            }
        }
    }

    #organize ranks

    if($action == "members") {
        
        #infos
        $guild_name = (string) $_REQUEST['GuildName'];
        $player_name = $_REQUEST['character'];
        $new_rank = (int) $_REQUEST['newrank'];
        $newtitle = trim($_REQUEST['newtitle']);
        
        if(!$logged)
            $guild_errors[] = 'You are not logged in. You can\'t change rank.';
            
        if(empty($guild_errors)) {
            $guild = new Guild();
            $guild->loadByName($guild_name);
            if(!$guild->isLoaded())
                $guild_errors[] = 'Guild <b>'.$guild_name.'</b> doesn\'t exist.';
        }
        
        if(empty($guild_errors)) {
            if($_REQUEST['promote'] == "yes")
                if(!isset($_REQUEST['function']) || $_REQUEST['function'] == "")
                    $guild_errors[] = 'Select an action.';
        }
        
        if(empty($guild_errors)) {
            $rank_list = $guild->getGuildRanksList();
            $guild_leader = FALSE;
            $guild_vice = FALSE;
            $account_players = $account_logged->getPlayers();
            foreach($account_players as $player)
            {
                $player_rank = $player->getRank();
                if(!empty($player_rank))
                    foreach($rank_list as $rank_in_guild)
                        if($rank_in_guild->getId() == $player_rank->getId())
                        {
                            $players_from_account_in_guild[] = $player->getName();
                            if($player_rank->getLevel() > 1) {
                                $guild_vice = TRUE;
                                $level_in_guild = $player_rank->getLevel();
                            }
                            if($guild->getOwner()->getId() == $player->getId()) {
                                $guild_vice = TRUE;
                                $guild_leader = TRUE;
                            }
                        }
            }
            
            //if(!$guild_vice)
                //$guild_errors[] = 'You are not leader or vice leader in the Guild.';
        }
        
        if(empty($guild_errors)) {
            foreach($rank_list as $rank)
            {
                if($guild_leader || $rank->getLevel() < $level_in_guild)
                {
                    $ranks[$rid]['0'] = $rank->getId();
                    $ranks[$rid]['1'] = $rank->getName();
                    $rid++;
                    $players_with_rank = $rank->getPlayersList();
                    if(count($players_with_rank) > 0)
                    {
                        foreach($players_with_rank as $player)
                        {
                            if($guild->getOwner()->getId() != $player->getId() || $guild_leader)
                            {
                                $players_with_lower_rank[$sid]['0'] = htmlspecialchars($player->getName());
                                $players_with_lower_rank[$sid]['1'] = htmlspecialchars($player->getName()).' ('.htmlspecialchars($rank->getName()).')';
                                $sid++;
                            }
                        }
                    }
                }
            }
            
            if($_REQUEST['promote'] == 'yes') {
                $player_to_change = new Player();
                $player_to_change->find($player_name);
                if(!$player_to_change->isLoaded())
                    $guild_errors[] = 'Player with name '.htmlspecialchars($player_name).'</b> doesn\'t exist.';
            }
        }
        
        if(empty($guild_errors))
            if($_REQUEST['promote'] == 'yes') {
                if($_REQUEST['function'] == "setrank") {
                    $rank = new GuildRank();
                    $rank->load($new_rank);
                    if(!$rank->isLoaded())
                        $guild_errors[] = 'Rank with this ID doesn\'t exist.';
                }
                if($_REQUEST['function'] == "settile") {
                    if(strlen($newtitle) >= 30)
                        $guild_errors[] = 'Too long guild nick. Max. 30 chars, your: '.strlen($newtitle);
                }
                if($_REQUEST['function'] == "exclude") {
                    if($guild->getOwner()->getName() == $player_to_change->getName())
                        $guild_errors[] = 'It\'s not exclude guild owner!';
                    
                }
            }
        
        if(!empty($guild_errors)) {
            //errors
            $main_content .= '
                <div class="TableContainer" >
                    <table class="Table1" cellpadding="0" cellspacing="0" >
                        <div class="CaptionContainer" >
                            <div class="CaptionInnerContainer" > 
                                <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>                            
                                <div class="Text" >Members Errors</div>
                                <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
                                <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                            </div>
                        </div>
                        <tr>
                            <td>
                                <div class="InnerTableContainer" >
                                    <table style="width:100%;" >
                                        <tr>
                                            <td>';
                                            foreach($guild_errors as $guild_error)
                                                $main_content .= '<p>'.$guild_error;
                                        $main_content .= '
                                            </td>
                                        </tr>
                                    </table>
                                </div>
                            </td>
                        </tr>
                    </table>
                </div><BR>
                <TABLE BORDER=0 WIDTH=100%>
                        <TR>
                            <TD ALIGN=center><table border="0" cellspacing="0" cellpadding="0" >
                                    <form action="?subtopic=guilds&action=view" method="post" >
                                        <tr>
                                            <td style="border:0px;" >
                                                <input type="hidden" name=action value=members >
                                                <input type="hidden" name=GuildName value="'.$_REQUEST['GuildName'].'" >
                                                <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
                                                    <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
                                                        <input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/global/buttons/_sbutton_back.gif" >
                                                    </div>
                                                </div>
                                            </td>
                                        </tr>
                                    </form>
                                </table>
                            </TD>
                        </TR>
                    </TABLE>';
        } else {
            if($_REQUEST['promote'] == "yes") {
                if($_REQUEST['function'] == "setrank") {
                    $player_to_change->setRank($rank);
                    $player_to_change->save();
                    $main_content .= '                
                        <div class="TableContainer" >
                            <table class="Table1" cellpadding="0" cellspacing="0" >
                                <div class="CaptionContainer" >
                                    <div class="CaptionInnerContainer" > 
                                        <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                        <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                        <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                        <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>                                
                                        <div class="Text" >Members</div>
                                        <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
                                        <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                        <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                        <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                    </div>
                                </div>
                                <tr>
                                    <td><div class="InnerTableContainer" >
                                            <table style="width:100%;" >
                                                <tr>
                                                    <td>Rank of player '.htmlspecialchars($player_to_change->getName()).' has been changed to '.htmlspecialchars($rank->getName()).'.</td>
                                                </tr>
                                            </table>
                                        </div>
                                    </td>
                                </tr>
                            </table>
                        </div><BR>
                        <TABLE BORDER=0 WIDTH=100%>
                            <TR>
                                <TD ALIGN=center><table border="0" cellspacing="0" cellpadding="0" >
                                        <form action="?subtopic=guilds&action=view" method="post" >
                                            <tr>
                                                <td style="border:0px;" >
                                                    <input type="hidden" name=action value=view >
                                                    <input type="hidden" name=GuildName value="'.$_REQUEST['GuildName'].'" >
                                                    <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
                                                        <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
                                                            <input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/global/buttons/_sbutton_back.gif" >
                                                        </div>
                                                    </div>
                                                </td>
                                            </tr>
                                        </form>
                                    </table>
                                </TD>
                            </TR>
                        </TABLE>';
                    unset($players_with_lower_rank);
                    unset($ranks);
                    $rid = 0;
                    $sid= 0;
                    foreach($rank_list as $rank)
                    {
                        if($guild_leader || $rank->getLevel() < $level_in_guild)
                        {
                            $ranks[$rid]['0'] = $rank->getId();
                            $ranks[$rid]['1'] = $rank->getName();
                            $rid++;
                            $players_with_rank = $rank->getPlayersList();
                            if(count($players_with_rank) > 0)
                            {
                                foreach($players_with_rank as $player)
                                {
                                    if($guild->getOwner()->getId() != $player->getId() || $guild_leader)
                                    {
                                        $players_with_lower_rank[$sid]['0'] = htmlspecialchars($player->getName());
                                        $players_with_lower_rank[$sid]['1'] = htmlspecialchars($player->getName()).' ('.htmlspecialchars($rank->getName()).')';
                                        $sid++;
                                    }
                                }
                            }
                        }
                    }
                }
                if($_REQUEST['function'] == "settitle") {
                    $player_to_change->setGuildNick($newtitle);
                    $player_to_change->save();
                    $main_content .= '                
                        <div class="TableContainer" >
                            <table class="Table1" cellpadding="0" cellspacing="0" >
                                <div class="CaptionContainer" >
                                    <div class="CaptionInnerContainer" > 
                                        <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                        <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                        <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                        <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>                                
                                        <div class="Text" >Members</div>
                                        <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
                                        <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                        <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                        <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                    </div>
                                </div>
                                <tr>
                                    <td><div class="InnerTableContainer" >
                                            <table style="width:100%;" >
                                                <tr>
                                                    <td>Title of player '.htmlspecialchars($player_to_change->getName()).' has been changed.</td>
                                                </tr>
                                            </table>
                                        </div>
                                    </td>
                                </tr>
                            </table>
                        </div><BR>
                        <TABLE BORDER=0 WIDTH=100%>
                            <TR>
                                <TD ALIGN=center><table border="0" cellspacing="0" cellpadding="0" >
                                        <form action="?subtopic=guilds&action=view" method="post" >
                                            <tr>
                                                <td style="border:0px;" >
                                                    <input type="hidden" name=action value=view >
                                                    <input type="hidden" name=GuildName value="'.$_REQUEST['GuildName'].'" >
                                                    <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
                                                        <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
                                                            <input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/global/buttons/_sbutton_back.gif" >
                                                        </div>
                                                    </div>
                                                </td>
                                            </tr>
                                        </form>
                                    </table>
                                </TD>
                            </TR>
                        </TABLE>';
                }
                if($_REQUEST['function'] == "exclude") {
                    $player_to_change->setRank();
                    $player_to_change->save();
                    $main_content .= '                
                        <div class="TableContainer" >
                            <table class="Table1" cellpadding="0" cellspacing="0" >
                                <div class="CaptionContainer" >
                                    <div class="CaptionInnerContainer" > 
                                        <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                        <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                        <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                        <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>                                
                                        <div class="Text" >Members</div>
                                        <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
                                        <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                        <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                        <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                    </div>
                                </div>
                                <tr>
                                    <td><div class="InnerTableContainer" >
                                            <table style="width:100%;" >
                                                <tr>
                                                    <td>Player with name '.htmlspecialchars($player->getName()).' has been excluded from your guild.</td>
                                                </tr>
                                            </table>
                                        </div>
                                    </td>
                                </tr>
                            </table>
                        </div><BR>
                        <TABLE BORDER=0 WIDTH=100%>
                            <TR>
                                <TD ALIGN=center>
                                    <table border="0" cellspacing="0" cellpadding="0" >
                                        <form action="?subtopic=guilds&action=view" method="post" >
                                            <tr>
                                                <td style="border:0px;" >
                                                    <input type="hidden" name=action value=view >
                                                    <input type="hidden" name=GuildName value="'.$_REQUEST['GuildName'].'" >
                                                    <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
                                                        <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
                                                            <input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/global/buttons/_sbutton_back.gif" >
                                                        </div>
                                                    </div>
                                                </td>
                                            </tr>
                                        </form>
                                    </table>
                                </TD>
                            </TR>
                        </TABLE>';
                }
            } else {
                $main_content .= '
                Select a member and the action you want to perform, then click on "Submit".<BR><BR>
                <FORM ACTION="?subtopic=guilds" METHOD=post>
                    <div class="TableContainer" >
                        <table class="Table1" cellpadding="0" cellspacing="0" >
                            <div class="CaptionContainer" >
                                <div class="CaptionInnerContainer" > 
                                    <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                    <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                    <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                    <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>                                
                                    <div class="Text" >Edit Members</div>
                                    <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
                                    <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                    <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                    <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                </div>
                            </div>
                            <tr>
                                <td>
                                    <div class="InnerTableContainer" >
                                        <table style="width:100%;" >
                                            <TR>
                                                <TD BGCOLOR=#D4C0A1>
                                                    <TABLE BORDER=0 CELLPADDING=1>
                                                        <TR>
                                                            <TD VALIGN=top>
                                                                <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=1>
                                                                    <TR>
                                                                        <TD>Name:</TD>
                                                                        <TD>
                                                                            <SELECT NAME="character">';
                                                                        foreach($players_with_lower_rank as $player_to_list)
                                                                            $main_content .= '
                                                                                <option value="'.$player_to_list['0'].'">'.$player_to_list['1'].'</option>';
                                                                        $main_content .= '
                                                                            </SELECT>
                                                                        </TD>
                                                                    </TR>
                                                                </TABLE>
                                                            </TD>
                                                            <TD>&#160;&#160;&#160;</TD>
                                                            <TD VALIGN=top>
                                                                <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=1>
                                                                    <TR>
                                                                        <TD>Action:</TD>
                                                                        <TD><INPUT TYPE=radio NAME="function" VALUE="setrank" '.(($_REQUEST['function'] == "setrank") ? 'checked' : '').'>
                                                                            Set rank to
                                                                            <SELECT NAME="newrank">';
                                                                        foreach($ranks as $rank)
                                                                            $main_content .= '
                                                                                <option value="'.htmlspecialchars($rank['0']).'" '.(($_REQUEST['newrank'] == $rank['0'])).'>'.htmlspecialchars($rank['1']).'</option>';
                                                                        $main_content .= '
                                                                            </SELECT>
                                                                        </TD>
                                                                    </TR>';
                                                            if($guild_leader) {
                                                                $main_content .= '
                                                                    <TR>
                                                                        <TD></TD>
                                                                        <TD><INPUT TYPE=radio NAME="function" VALUE="settitle" '.(($_REQUEST['function'] == "settitle") ? 'checked' : '').'>
                                                                            Set title to
                                                                            <INPUT NAME="newtitle" SIZE=30 MAXLENGTH=29></TD>
                                                                    </TR>';
                                                                $main_content .= '
                                                                    <TR>
                                                                        <TD></TD>
                                                                        <TD><INPUT TYPE=radio NAME="function" VALUE="exclude" '.(($_REQUEST['function'] == "exclude") ? 'checked' : '').'>
                                                                            Exclude from guild </TD>
                                                                    </TR>';
                                                            }
                                                            $main_content .= '
                                                                </TABLE>
                                                            </TD>
                                                        </TR>
                                                    </TABLE>
                                                </TD>
                                            </TR>
                                        </table>
                                    </div>
                                </td>
                            </tr>
                        </table>
                    </div>
                <BR>
                <TABLE BORDER=0 WIDTH=100%>
                    <TR align="center">
                        <TD ALIGN=center>
                            <table border="0" cellspacing="0" cellpadding="0" >
                                <tr>
                                    <td style="border:0px;" >
                                        <input type="hidden" name=action value=members >
                                        <input type="hidden" name="promote" value="yes">
                                        <input type="hidden" name=GuildName value="'.$_REQUEST['GuildName'].'" >
                                        <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
                                            <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
                                                <input class="ButtonText" type="image" name="Submit" alt="Submit" src="'.$layout_name.'/images/global/buttons/_sbutton_submit.gif" >
                                            </div>
                                        </div>
                                    </td>            
                                <tr>
                            </table>
                        </TD>
                        </FORM>
                        <TD ALIGN=center>
                            <table border="0" cellspacing="0" cellpadding="0" >
                                <form action="?subtopic=guilds&action=view" method="post" >
                                    <tr>
                                        <td style="border:0px;" >
                                            <input type="hidden" name=GuildName value="'.$_REQUEST['GuildName'].'" >
                                            <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
                                                <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
                                                    <input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/global/buttons/_sbutton_back.gif" >
                                                </div>
                                            </div>
                                        </td>
                                    </tr>
                                </form>
                            </table>
                        </TD>
                    </TR>
                </TABLE>';
            }
        }
        
        
        
    } #members condition

    if($action == "disband") {
        $guild_name = (string) $_REQUEST['GuildName'];
        $password = (string) trim($_REQUEST['password']);
        if(!$logged)
            $guild_errors[] = 'You are not logged in. You can\'t disband this Guild.';
        if(empty($guild_errors)) {
            $guild = new Guild();
            $guild->loadByName($guild_name);
            if(!$guild->isLoaded())
                $guild_errors[] = 'Guild <b>'.$guild_name.'</b> doesn\'t exist.';
        }
        if(empty($guild_errors)) {
            $guild_leader_char = $guild->getOwner();
                $rank_list = $guild->getGuildRanksList();
                $guild_leader = FALSE;
                $account_players = $account_logged->getPlayers();
                foreach($account_players as $player)
                    if($guild->getOwner()->getId() == $player->getId())
                    {
                        $guild_vice = TRUE;
                        $guild_leader = TRUE;
                        $level_in_guild = 3;
                    }
                    if(!$guild_leader)
                        $guild_errors[] = 'You are not leader of Guild.';
        }
        if(empty($guild_errors)) {
            if($_REQUEST['disband'] == "yes")
                if(!$account_logged->isValidPassword($password))
                    $guild_errors[] = 'Wrong password.';
        }
        if(!empty($guild_errors)) {
            //errors
            $main_content .= '
                <div class="TableContainer" >
                    <table class="Table1" cellpadding="0" cellspacing="0" >
                        <div class="CaptionContainer" >
                            <div class="CaptionInnerContainer" > 
                                <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>                            
                                <div class="Text" >Error</div>
                                <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
                                <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                            </div>
                        </div>
                        <tr>
                            <td>
                                <div class="InnerTableContainer" >
                                    <table style="width:100%;" >
                                        <tr>
                                            <td>';
                                            foreach($guild_errors as $guild_error)
                                                $main_content .= '<p>'.$guild_error;
                                        $main_content .= '
                                            </td>
                                        </tr>
                                    </table>
                                </div>
                            </td>
                        </tr>
                    </table>
                </div><BR>
                <TABLE BORDER=0 WIDTH=100%>
                            <TR>
                                <TD ALIGN=center>
                                    <table border="0" cellspacing="0" cellpadding="0" >
                                        <form action="?subtopic=guilds" method="post" >
                                            <input type="hidden" name="action" value="disband">
                                            <input type="hidden" name="GuildName" value="'.$_REQUEST['GuildName'].'">
                                            <tr>
                                                <td style="border:0px;" ><div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
                                                        <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
                                                            <input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/global/buttons/_sbutton_back.gif" >
                                                        </div>
                                                    </div>
                                                </td>
                                            </tr>
                                        </form>
                                    </table>
                                </TD>
                            </TR>
                        </TABLE>';
        } else {
                if($_REQUEST['disband'] == "yes") {
                    $guild->delete();
                    $main_content .= '
                        <div class="TableContainer" >
                            <table class="Table1" cellpadding="0" cellspacing="0" >
                                <div class="CaptionContainer" >
                                    <div class="CaptionInnerContainer" > 
                                        <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                        <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                        <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                        <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>                            
                                        <div class="Text" >Guild Disbanded</div>
                                        <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
                                        <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                        <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                        <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                    </div>
                                </div>
                                <tr>
                                    <td>
                                        <div class="InnerTableContainer" >
                                            <table style="width:100%;" >
                                                <tr>
                                                    <td>You have disbanded the '.$_REQUEST['GuildName'].'.</td>
                                                </tr>
                                            </table>
                                        </div>
                                    </td>
                                </tr>
                            </table>
                        </div><BR>
                        <TABLE BORDER=0 WIDTH=100%>
                            <TR>
                                <TD ALIGN=center>
                                    <table border="0" cellspacing="0" cellpadding="0" >
                                        <form action="?subtopic=guilds" method="post" >
                                            <tr>
                                                <td style="border:0px;" ><div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
                                                        <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
                                                            <input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/global/buttons/_sbutton_back.gif" >
                                                        </div>
                                                    </div>
                                                </td>
                                            </tr>
                                        </form>
                                    </table>
                                </TD>
                            </TR>
                        </TABLE>';
                } else {
                    $main_content .= '
                        Do you really want to disband your guild? Confirm this decision with your password and click on "Submit".<BR>
                        <BR>
                        <FORM ACTION="?subtopic=guilds" METHOD=post>
                            <div class="TableContainer" >
                                <table class="Table1" cellpadding="0" cellspacing="0" >
                                    <div class="CaptionContainer" >
                                        <div class="CaptionInnerContainer" > 
                                            <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                            <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                            <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                            <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>                        
                                            <div class="Text" >Disband Guild</div>
                                            <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
                                            <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                            <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                            <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                        </div>
                                    </div>
                                    <tr>
                                        <td>
                                            <div class="InnerTableContainer" >
                                                <table style="width:100%;" >
                                                    <TR>
                                                        <TD BGCOLOR=#D4C0A1><TABLE BORDER=0 CELLPADDING=1>
                                                                <TR>
                                                                    <TD>Password:</TD>
                                                                    <TD><INPUT TYPE=password NAME="password" SIZE=30 MAXLENGTH=29></TD>
                                                                </TR>
                                                            </TABLE>
                                                        </TD>
                                                    </TR>
                                                </table>
                                            </div>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                            <BR>
                            <TABLE BORDER=0 WIDTH=100%>
                                <TR>
                                    <TD ALIGN=center><IMG SRC="'.$layout_name.'/images/global/general/blank.gif" WIDTH=120 HEIGHT=1 BORDER=0><BR></TD>
                                    <TD ALIGN=center><table border="0" cellspacing="0" cellpadding="0" >
                                        <tr>
                                            <td style="border:0px;" >
                                                <input type="hidden" name=action value=disband>
                                                <input type="hidden" name="disband" value="yes">
                                                <input type="hidden" name=GuildName value="'.$_REQUEST['GuildName'].'" >
                                                <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
                                                    <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
                                                        <input class="ButtonText" type="image" name="Submit" alt="Submit" src="'.$layout_name.'/images/global/buttons/_sbutton_submit.gif" >
                                                    </div>
                                                </div>
                                            </td>                    
                                        <tr>
                                    </form>
                                </table>
                            </TD>
                            <TD ALIGN=center>
                                <table border="0" cellspacing="0" cellpadding="0" >
                                    <form action="?subtopic=guilds&action=view" method="post" >
                                        <tr>
                                            <td style="border:0px;" >
                                                <input type="hidden" name=GuildName value="'.$_REQUEST['GuildName'].'" >
                                                <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
                                                    <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" >
                                                        <div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
                                                        <input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/global/buttons/_sbutton_back.gif" >
                                                    </div>
                                                </div>
                                            </td>
                                        </tr>
                                    </form>
                                </table>
                            </TD>
                            <TD ALIGN=center><IMG SRC="'.$layout_name.'/images/global/general/blank.gif" WIDTH=120 HEIGHT=1 BORDER=0><BR></TD>
                        </TR>
                    </TABLE>';
                }
        }
    }
    if($action == "description") {
        $guild_name = (string) $_REQUEST['GuildName'];
        if(empty($guild_errors))
        {
            $guild = new Guild();
            $guild->loadByName($guild_name);
            if(!$guild->isLoaded())
                $guild_errors[] = 'Guild <b>'.$guild_name.'</b> doesn\'t exist.';
        }
        if(empty($guild_errors)) {
            $guild_leader_char = $guild->getOwner();
            $rank_list = $guild->getGuildRanksList();
            $guild_leader = FALSE;
            $account_players = $account_logged->getPlayers();
            foreach($account_players as $player)
                if($guild->getOwner()->getId() == $player->getId()) {
                    $guild_vice = TRUE;
                    $guild_leader = TRUE;
                    $level_in_guild = 3;
                }
            if(!$guild_leader)
                $guild_errors[] = 'You are not the Guild Leader.';
        }
        if(empty($guild_errors)) {
            $max_image_size_b = $config['site']['guild_image_size_kb'] * 1024;
            if($_REQUEST['guildlogo'] == "yes") {            
                $file = $_FILES['newlogo'];
            if(is_uploaded_file($file['tmp_name']))
                switch($file['error']) {
                    case UPLOAD_ERR_OK:
                        break; // all ok
                    case UPLOAD_ERR_INI_SIZE:
                    case UPLOAD_ERR_FORM_SIZE:
                        $guild_errors[] = 'Image is too large';
                        break;
                    case UPLOAD_ERR_PARTIAL:
                        $guild_errors[] = 'Image was only partially uploaded';
                        break;
                    case UPLOAD_ERR_NO_TMP_DIR:
                        $guild_errors[] = 'Upload folder not found';
                        break;
                    case UPLOAD_ERR_CANT_WRITE:
                        $guild_errors[] = 'Unable to write uploaded file';
                        break;
                    case UPLOAD_ERR_EXTENSION:
                        $guild_errors[] =  'Upload failed due to extension';
                        break;
                    default:
                        $guild_errors[] =  'Unknown error';
                }
                if(is_uploaded_file($file['tmp_name'])) {
                    if($file['size'] > $max_image_size_b)
                        $guild_errors[] = 'Uploaded image is too big. Size: <b>'.$file['size'].' bytes</b>, Max. size: <b>'.$max_image_size_b.' bytes</b>.';
                    $info = getimagesize($file['tmp_name']);
                    if(!$info)
                        $guild_errors[] = 'Uploaded file is not an image!';
                }
            }
        }
        if(!empty($guild_errors)) {
            if($_REQUEST['changedescription'] == "yes") {
                //errors
                $main_content .= '
                    <div class="TableContainer" >
                        <table class="Table1" cellpadding="0" cellspacing="0" >
                            <div class="CaptionContainer" >
                                <div class="CaptionInnerContainer" > 
                                    <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                    <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                    <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                    <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>                            
                                    <div class="Text" >Guild Description Error</div>
                                    <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
                                    <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                    <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                    <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                </div>
                            </div>
                            <tr>
                                <td>
                                    <div class="InnerTableContainer" >
                                        <table style="width:100%;" >
                                            <tr>
                                                <td>';
                                                foreach($guild_errors as $guild_error)
                                                    $main_content .= '<p>'.$guild_error;
                                            $main_content .= '
                                                </td>
                                            </tr>
                                        </table>
                                    </div>
                                </td>
                            </tr>
                        </table>
                    </div><BR>
                    <TABLE BORDER=0 WIDTH=100%>
                        <TR>
                            <TD ALIGN=center>
                                <table border="0" cellspacing="0" cellpadding="0" >
                                    <form action="?subtopic=guilds" method="post" >
                                        <input type="hidden" name="GuildName" value="'.$_REQUEST['GuildName'].'">
                                        <tr>
                                            <td style="border:0px;" ><div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
                                                    <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
                                                        <input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/global/buttons/_sbutton_back.gif" >
                                                    </div>
                                                </div>
                                            </td>
                                        </tr>
                                    </form>
                                </table>
                            </TD>
                        </TR>
                    </TABLE>';
            }
            if($_REQUEST['guildlogo'] == "yes") {
                //errors
                $main_content .= '
                    <div class="TableContainer" >
                        <table class="Table1" cellpadding="0" cellspacing="0" >
                            <div class="CaptionContainer" >
                                <div class="CaptionInnerContainer" > 
                                    <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                    <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                    <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                    <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>                            
                                    <div class="Text" >Guild Logo Error</div>
                                    <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
                                    <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                    <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                    <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                </div>
                            </div>
                            <tr>
                                <td>
                                    <div class="InnerTableContainer" >
                                        <table style="width:100%;" >
                                            <tr>
                                                <td>';
                                                foreach($guild_errors as $guild_error)
                                                    $main_content .= '<p>'.$guild_error;
                                            $main_content .= '
                                                </td>
                                            </tr>
                                        </table>
                                    </div>
                                </td>
                            </tr>
                        </table>
                    </div><BR>
                    <TABLE BORDER=0 WIDTH=100%>
                        <TR>
                            <TD ALIGN=center>
                                <table border="0" cellspacing="0" cellpadding="0" >
                                    <form action="?subtopic=guilds" method="post" >
                                        <input type="hidden" name="GuildName" value="'.$_REQUEST['GuildName'].'">
                                        <tr>
                                            <td style="border:0px;" ><div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
                                                    <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
                                                        <input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/global/buttons/_sbutton_back.gif" >
                                                    </div>
                                                </div>
                                            </td>
                                        </tr>
                                    </form>
                                </table>
                            </TD>
                        </TR>
                    </TABLE>';
            }
        } else {
            if($_REQUEST['changedescription'] == "yes") {
                $description = htmlspecialchars(substr(trim($_REQUEST['description']),0,$config['site']['guild_description_chars_limit']));
                $guild->set('description', $description);
                $guild->save();
                $main_content .= '
                    <div class="TableContainer" >
                        <table class="Table1" cellpadding="0" cellspacing="0" >
                            <div class="CaptionContainer" >
                                <div class="CaptionInnerContainer" > 
                                    <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                    <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                    <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                    <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>                            
                                    <div class="Text" >Guild Description Changed</div>
                                    <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
                                    <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                    <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                    <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                </div>
                            </div>
                            <tr>
                                <td>
                                    <div class="InnerTableContainer" >
                                        <table style="width:100%;" >
                                            <tr>
                                                <td>Your Guild Description was changed succefully.</td>
                                            </tr>
                                        </table>
                                    </div>
                                </td>
                            </tr>
                        </table>
                    </div><BR>
                    <TABLE BORDER=0 WIDTH=100%>
                        <TR>
                            <TD ALIGN=center>
                                <table border="0" cellspacing="0" cellpadding="0" >
                                    <form action="?subtopic=guilds" method="post" >
                                        <input type="hidden" name="action" value="view">
                                        <input type="hidden" name="GuildName" value="'.$_REQUEST['GuildName'].'">
                                        <tr>
                                            <td style="border:0px;" ><div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
                                                    <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
                                                        <input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/global/buttons/_sbutton_back.gif" >
                                                    </div>
                                                </div>
                                            </td>
                                        </tr>
                                    </form>
                                </table>
                            </TD>
                        </TR>
                    </TABLE>';
            }
            elseif($_REQUEST['guildlogo'] == "yes") {
                if(!is_uploaded_file($file['tmp_name'])) {
                    $guild->setGuildLogo('image/gif', Website::getFileContents('./images/default_guild_logo.gif'));
                    $guild->save();
                } else {
                    $guild->setGuildLogo($info['mime'], file_get_contents($file['tmp_name']));
                    $guild->save();
                }
                $main_content .= '
                    <div class="TableContainer" >
                        <table class="Table1" cellpadding="0" cellspacing="0" >
                            <div class="CaptionContainer" >
                                <div class="CaptionInnerContainer" > 
                                    <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                    <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                    <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                    <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>                            
                                    <div class="Text" >Guild Logo Changed</div>
                                    <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
                                    <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                    <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                    <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                </div>
                            </div>
                            <tr>
                                <td>
                                    <div class="InnerTableContainer" >
                                        <table style="width:100%;" >
                                            <tr>
                                                <td>Your Guild Logo was changed succefully.</td>
                                            </tr>
                                        </table>
                                    </div>
                                </td>
                            </tr>
                        </table>
                    </div><BR>
                    <TABLE BORDER=0 WIDTH=100%>
                        <TR>
                            <TD ALIGN=center>
                                <table border="0" cellspacing="0" cellpadding="0" >
                                    <form action="?subtopic=guilds" method="post" >
                                        <input type="hidden" name="action" value="view">
                                        <input type="hidden" name="GuildName" value="'.$_REQUEST['GuildName'].'">
                                        <tr>
                                            <td style="border:0px;" ><div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
                                                    <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
                                                        <input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/global/buttons/_sbutton_back.gif" >
                                                    </div>
                                                </div>
                                            </td>
                                        </tr>
                                    </form>
                                </table>
                            </TD>
                        </TR>
                    </TABLE>';
            }
            else {
                    $main_content .= 'If you want to change the description or the URL of the official homepage of your guild, edit the corresponding field and click on the "Submit" button.<BR><BR>';
        //formulario com as ações
        $main_content .= '
            <FORM ACTION="?subtopic=guilds" METHOD=post>
                <div class="TableContainer" >
                    <table class="Table1" cellpadding="0" cellspacing="0" >
                        <div class="CaptionContainer" >
                            <div class="CaptionInnerContainer" > 
                                <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>                                
                                <div class="Text" >Change Description</div>
                                <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
                                <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                            </div>
                        </div>
                        <tr>
                            <td>
                                <div class="InnerTableContainer" >
                                    <table style="width:100%;" >
                                        <tr>
                                            <td valign="top">Description:</td>
                                            <td><textarea name="description" cols="60" rows="15">'.$guild->getDescription().'</textarea></td>
                                            <td align="right" valign="bottom">
                                                <table border="0" cellspacing="0" cellpadding="0" >
                                                    <tr>
                                                        <td style="border:0px;" >
                                                            <input type="hidden" name="changedescription" value="yes">
                                                            <input type="hidden" name="action" value="description">
                                                            <input type="hidden" name=GuildName value="'.$_REQUEST['GuildName'].'" >
                                                            <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
                                                                <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
                                                                    <input class="ButtonText" type="image" name="Submit" alt="Submit" src="'.$layout_name.'/images/global/buttons/_sbutton_submit.gif" >
                                                                </div>
                                                            </div>
                                                        </td>
                                                    </tr>
                                                    </form>
                                                </table>
                                            </td>
                                        </tr>
                                    </table>
                                </div>
                            </td>
                        </tr>
                    </table>
                </div><BR>
                If you want to change the logo of your guild, enter the path to a 64*64 pixels GIF icon and click on the "Submit" button.<BR>Leave the path empty if you want to use the default logo.<BR><BR>
                <FORM ACTION="?subtopic=guilds" METHOD=post enctype="multipart/form-data">
                <div class="TableContainer" >
                    <table class="Table1" cellpadding="0" cellspacing="0" >
                        <div class="CaptionContainer" >
                            <div class="CaptionInnerContainer" > 
                                <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>                                
                                <div class="Text" >Guild Logo</div>
                                <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
                                <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                            </div>
                        </div>
                        <tr>
                            <td>
                                <div class="InnerTableContainer" >
                                    <table style="width:100%;" >
                                        <tr>
                                            <td valign="top">Current logo:</td>
                                            <td><IMG SRC="'. $guild->getGuildLogoLink(1) .'" WIDTH=64 HEIGHT=64></td>
                                            <td></td>
                                        </tr>
                                        <tr>
                                            <td valign="top">New logo:</td>
                                            <td><input type="file" name="newlogo"></td>
                                            <td align="right">
                                                <table border="0" cellspacing="0" cellpadding="0" >
                                                    <tr>
                                                        <td style="border:0px;" >
                                                            <input type="hidden" name="guildlogo" value="yes">
                                                            <input type="hidden" name="action" value="description">
                                                            <input type="hidden" name=GuildName value="'.$_REQUEST['GuildName'].'" >
                                                            <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
                                                                <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
                                                                    <input class="ButtonText" type="image" name="Submit" alt="Submit" src="'.$layout_name.'/images/global/buttons/_sbutton_submit.gif" >
                                                                </div>
                                                            </div>
                                                        </td>
                                                    </tr>
                                                    </form>
                                                </table>
                                            </td>
                                        </tr>
                                    </table>
                                </div>
                            </td>
                        </tr>
                    </table>
                </div><BR>
                <TABLE BORDER=0 WIDTH=100%>
                    <TR align="center">
                        <TD ALIGN=center>
                            <table border="0" cellspacing="0" cellpadding="0" >
                                <form action="?subtopic=guilds&action=view" method="post" >
                                    <tr>
                                        <td style="border:0px;" >
                                            <input type="hidden" name=GuildName value="'.$_REQUEST['GuildName'].'" >
                                            <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
                                                <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
                                                    <input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/global/buttons/_sbutton_back.gif" >
                                                </div>
                                            </div>
                                        </td>
                                    </tr>
                                </form>
                            </table>
                        </TD>
                    </TR>
                </TABLE>';
            }
        }
    }
    if($action == "resignleadership") {
        $guild_name = (string) $_REQUEST['GuildName'];
        $pass_to = (string) $_REQUEST['character'];
        $password = trim($_REQUEST['password']);
        if(empty($guild_errors))
        {
            $guild = new Guild();
            $guild->loadByName($guild_name);
            if(!$guild->isLoaded())
                $guild_errors[] = 'Guild <b>'.$guild_name.'</b> doesn\'t exist.';
        }
        if(empty($guild_errors))
        {
            if($_POST['resign'] == 'yes')
            {
                if(!$account_logged->isValidPassword($password))
                    $guild_errors[] = 'Password is wrong.';
                if(!check_name($pass_to))
                    $guild_errors[] = 'Invalid player name format.';
                if(empty($guild_errors))
                {
                    $to_player = new Player();
                    $to_player->find($pass_to);
                    if(!$to_player->isLoaded())
                        $guild_errors[] = 'Player with name <b>'.htmlspecialchars($pass_to).'</b> doesn\'t exist.';
                    if(empty($guild_errors))
                    {
                        $to_player_rank = $to_player->getRank();
                        if(!empty($to_player_rank))
                        {
                            $to_player_guild = $to_player_rank->getGuild();
                            if($to_player_guild->getId() != $guild->getId())
                                $guild_errors[] = 'Player with name <b>'.htmlspecialchars($to_player->getName()).'</b> isn\'t from your guild.';
                        }
                        else
                            $guild_errors[] = 'Player with name <b>'.htmlspecialchars($to_player->getName()).'</b> isn\'t from your guild.';
                    }
                }
            }
        }
        if(empty($guild_errors)) {
            if($logged) {
                $guild_leader_char = $guild->getOwner();
                $guild_leader = FALSE;
                $account_players = $account_logged->getPlayers();
                foreach($account_players as $player)
                    if($guild_leader_char->getId() == $player->getId()) {
                        $guild_vice = TRUE;
                        $guild_leader = TRUE;
                        $level_in_guild = 3;
                    }
                if($guild_leader) {
                    if($_POST['resign'] == 'yes') {
                        $newleaderID = $to_player->getID();
                        $oldleaderID = $guild_leader_char->getId();
                        $newrank = $guild_leader_char->getRank()->getID();
                        $oldrank = $to_player_rank->getID();
                        $up = $SQL->query("UPDATE `guild_membership` SET `rank_id` = '$newrank' WHERE `player_id` = '$newleaderID'");
                        if($up)
                            $up2 = $SQL->query("UPDATE `guild_membership` SET `rank_id` = '$oldrank' WHERE `player_id` = '$oldleaderID'");
                        if($up2) {
                            $guild->setOwner($to_player);
                            $guild->save();
                        }
                        $saved = TRUE;
                        
                        $main_content .= '
                            <div class="TableContainer" >
                                <table class="Table1" cellpadding="0" cellspacing="0" >
                                    <div class="CaptionContainer" >
                                        <div class="CaptionInnerContainer" > 
                                            <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                            <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                            <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                            <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>                            
                                            <div class="Text" >New Guild Leadership</div>
                                            <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
                                            <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                            <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                            <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                        </div>
                                    </div>
                                    <tr>
                                        <td>
                                            <div class="InnerTableContainer" >
                                                <table style="width:100%;" >
                                                    <tr>
                                                        <td>The new leader is '.$to_player->getName().'.</td>
                                                    </tr>
                                                </table>
                                            </div>
                                        </td>
                                    </tr>
                                </table>
                            </div><BR>
                            <TABLE BORDER=0 WIDTH=100%>
                                <TR>
                                    <TD ALIGN=center>
                                        <table border="0" cellspacing="0" cellpadding="0" >
                                            <form action="?subtopic=guilds" method="post" >
                                                <input type="hidden" name="action" value="view">
                                                <input type="hidden" name="GuildName" value="'.$_REQUEST['GuildName'].'">
                                                <tr>
                                                    <td style="border:0px;" ><div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
                                                            <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
                                                                <input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/global/buttons/_sbutton_back.gif" >
                                                            </div>
                                                        </div>
                                                    </td>
                                                </tr>
                                            </form>
                                        </table>
                                    </TD>
                                </TR>
                            </TABLE>';
                    } else {
                        //formulario com as ações
                        $main_content .= '
                            Select a member to your new Guild Leader and click "Submit" button.<BR><BR>
                            <FORM ACTION="?subtopic=guilds" METHOD=post>
                                <div class="TableContainer" >
                                    <table class="Table1" cellpadding="0" cellspacing="0" >
                                        <div class="CaptionContainer" >
                                            <div class="CaptionInnerContainer" > 
                                                <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                                <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                                <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                                <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>                                
                                                <div class="Text" >Resign Leadership</div>
                                                <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
                                                <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                                <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                                <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                            </div>
                                        </div>
                                        <tr>
                                            <td>
                                                <div class="InnerTableContainer" >
                                                    <table style="width:100%;" >
                                                        <TR>
                                                            <TD BGCOLOR=#D4C0A1>
                                                                <TABLE BORDER=0 CELLPADDING=1>
                                                                    <TR>
                                                                        <TD>
                                                                            <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=1>
                                                                                <TR>
                                                                                    <TD>Resign Leadership to:</TD>
                                                                                </TR>
                                                                            </TABLE>
                                                                        </TD>
                                                                        <TD>&#160;&#160;&#160;</TD>
                                                                        <TD>
                                                                            <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=1>
                                                                                <TR>
                                                                                    <TD align="right" valign="top">
                                                                                        <SELECT NAME="character">';
                                                                                    $rank_list = $guild->getGuildRanksList();
                                                                                    foreach($rank_list as $rank) {
                                                                                        $players_with_rank = $rank->getPlayersList();
                                                                                        foreach($players_with_rank as $player) {
                                                                                            if($guild_leader_char->getName() != $player->getName()) {
                                                                                                $main_content .= '<OPTION>' . $player->getName() . '</OPTION>';
                                                                                            }
                                                                                        }
                                                                                    }
                                                                                    $main_content .='                                                                                    
                                                                                        </SELECT>
                                                                                    </TD>
                                                                                </TR>
                                                                            </TABLE>
                                                                        </TD>
                                                                    </TR>
                                                                </TABLE>
                                                            </TD>
                                                        </TR>
                                                        <TR>
                                                            <TD>
                                                                <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=1>
                                                                    <TR>
                                                                        <TD>Password:</TD>
                                                                        <TD><input type="password" name="password"></TD>
                                                                    </TR>
                                                                </TABLE>                                                    
                                                            </TD>
                                                        </TR>
                                                    </table>
                                                </div>
                                            </td>
                                        </tr>
                                    </table>
                                </div>
                            <BR>
                            <TABLE BORDER=0 WIDTH=100%>
                                <TR align="center">
                                    <TD ALIGN=center>
                                        <table border="0" cellspacing="0" cellpadding="0" >
                                            <tr>
                                                <td style="border:0px;" >
                                                    <input type="hidden" name=action value=resignleadership >
                                                    <input type="hidden" name="resign" value="yes">
                                                    <input type="hidden" name=GuildName value="'.$_REQUEST['GuildName'].'" >
                                                    <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
                                                        <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
                                                            <input class="ButtonText" type="image" name="Submit" alt="Submit" src="'.$layout_name.'/images/global/buttons/_sbutton_submit.gif" >
                                                        </div>
                                                    </div>
                                                </td>            
                                            <tr>
                                        </table>
                                    </TD>
                                    </FORM>
                                    <TD ALIGN=center>
                                        <table border="0" cellspacing="0" cellpadding="0" >
                                            <form action="?subtopic=guilds&action=view" method="post" >
                                                <tr>
                                                    <td style="border:0px;" >
                                                        <input type="hidden" name=GuildName value="'.$_REQUEST['GuildName'].'" >
                                                        <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
                                                            <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
                                                                <input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/global/buttons/_sbutton_back.gif" >
                                                            </div>
                                                        </div>
                                                    </td>
                                                </tr>
                                            </form>
                                        </table>
                                    </TD>
                                </TR>
                            </TABLE>';
                    }
                } 
                else
                    $guild_errors[] = 'You are not a leader of guild!';
            }
            else
                $guild_errors[] = 'You are not logged. You can\'t manage guild.';
        }
        if(!empty($guild_errors)) {
            //errors
                $main_content .= '
                    <div class="TableContainer" >
                        <table class="Table1" cellpadding="0" cellspacing="0" >
                            <div class="CaptionContainer" >
                                <div class="CaptionInnerContainer" > 
                                    <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                    <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                    <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                    <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>                            
                                    <div class="Text" >Guild Leadership Error</div>
                                    <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
                                    <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                    <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                    <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                </div>
                            </div>
                            <tr>
                                <td>
                                    <div class="InnerTableContainer" >
                                        <table style="width:100%;" >
                                            <tr>
                                                <td>';
                                                foreach($guild_errors as $guild_error)
                                                    $main_content .= '<p>'.$guild_error;
                                            $main_content .= '
                                                </td>
                                            </tr>
                                        </table>
                                    </div>
                                </td>
                            </tr>
                        </table>
                    </div><BR>
                    <TABLE BORDER=0 WIDTH=100%>
                        <TR>
                            <TD ALIGN=center>
                                <table border="0" cellspacing="0" cellpadding="0" >
                                    <form action="?subtopic=guilds" method="post" >
                                        <input type="hidden" name="action" value="view">
                                        <input type="hidden" name="GuildName" value="'.$_REQUEST['GuildName'].'">
                                        <tr>
                                            <td style="border:0px;" ><div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
                                                    <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
                                                        <input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/global/buttons/_sbutton_back.gif" >
                                                    </div>
                                                </div>
                                            </td>
                                        </tr>
                                    </form>
                                </table>
                            </TD>
                        </TR>
                    </TABLE>';
        }
    }
    if($action == "guildwars") {
        
        # Guild wars status
        # 1 - War Started
        # 2 - War Rejected
        # 3 - War Canceled
        
        
        $guild_name = (string) $_REQUEST['GuildName'];
        $guild = new Guild();
        $guild->loadByName($guild_name);
        if(!$guild->isLoaded())
            $guild_errors[] = 'Guild with name <b>'.$guild_name.'</b> doesn\'t exist.';
        
        $guild_id = $guild->getID();
        if(empty($guild_errors)) {
            //check is it vice or/and leader account (leader has vice + leader rights)
            $guild_leader_char = $guild->getOwner();
            $rank_list = $guild->getGuildRanksList();
            $guild_leader = FALSE;
            $guild_vice = FALSE;
            if($logged)
            {
                $account_players = $account_logged->getPlayers();
                foreach($account_players as $player)
                {
                    $players_from_account_ids[] = $player->getId();
                    $player_rank = $player->getRank();
                    if(!empty($player_rank))
                        foreach($rank_list as $rank_in_guild)
                            if($rank_in_guild->getId() == $player_rank->getId())
                            {
                                $players_from_account_in_guild[] = $player->getName();
                                if($player_rank->getLevel() > 1)
                                {
                                    $guild_vice = TRUE;
                                    $level_in_guild = $player_rank->getLevel();
                                }
                                if($guild->getOwner()->getId() == $player->getId())
                                {
                                    $guild_vice = TRUE;
                                    $guild_leader = TRUE;
                                }
                            }
                }
            }
        }
        if($guild_leader)
            $main_content .= '
                <center>
                    <table border="0" cellspacing="0" cellpadding="0" >
                        <form action="?subtopic=guilds" method="post" >
                            <tr>
                                <td style="border:0px;" >
                                    <input type="hidden" name=action value=declarewar >
                                    <input type="hidden" name=GuildName value="'.$_REQUEST['GuildName'].'" >
                                    <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
                                        <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
                                            <input class="ButtonText" type="image" name="Declare War" alt="Declare War" src="'.$layout_name.'/images/global/buttons/_sbutton_declarewar.gif" >
                                        </div>
                                    </div>
                                </td>
                            </tr>
                        </form>
                    </table>
                </center>
                <br/>';
                /*
            $main_content .= '
                <div class="TableContainer" >
                    <table class="Table5" cellpadding="0" cellspacing="0" >
                        <div class="CaptionContainer" >
                            <div class="CaptionInnerContainer" > 
                                <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>                        
                                <div class="Text" >Declarations of War</div>
                                <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
                                <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                                <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                                <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                            </div>
                        </div>
                        <tr>
                            <td><div class="InnerTableContainer" >
                                    <table style="width:100%;" >
                                        <tr>
                                            <td>The guild Lino Lucky has currently no open war declarations.</td>
                                        </tr>
                                    </table>
                                </div>
                            </td>
                        </tr>
                    </table>
                </div>
                <br/>';
                */
                $main_content .= "<script type=\"text/javascript\"><!--
            function show_hide(flip)
            {
                    var tmp = document.getElementById(flip);
                    if(tmp)
                            tmp.style.display = tmp.style.display == 'none' ? '' : 'none';
            }
            --></script>";
        $main_content .= '
            <div class="TableContainer" >
                <table class="Table5" cellpadding="0" cellspacing="0" >
                    <div class="CaptionContainer" >
                        <div class="CaptionInnerContainer" > 
                            <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                            <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                            <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                            <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>                        
                            <div class="Text" >Guild Wars</div>
                            <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
                            <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                            <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                            <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                        </div>
                    </div>
                    <tr>
                        <td>
                            <div class="InnerTableContainer" >
                                <table style="width:100%;" >';
                                $main_content .= '
                                    <tr>
                                        <td>
                                            <div class="TableShadowContainerRightTop" >
                                                    <div class="TableShadowRightTop" style="background-image:url('.$layout_name.'/images/global/content/table-shadow-rt.gif);" ></div>
                                                </div>
                                                <div class="TableContentAndRightShadow" style="background-image:url('.$layout_name.'/images/global/content/table-shadow-rm.gif);" >
                                                    <div class="TableContentContainer" >
                                                        <table class="TableContent" width="100%" >
                                                            <tr class="LabelV">
                                                                <td>Aggressor</td>
                                                                <td>Information</td>
                                                                <td>Enemy</td>
                                                            </tr>';
                                                            $warFrags = array();
                                                            foreach($SQL->query('SELECT * FROM `guildwar_kills` WHERE `killerguild` = ' . $guild_id . ' OR `targetguild` = ' . $guild_id . ' ORDER BY `time` DESC')->fetchAll() as $frag)
                                                            {
                                                                $warFrags[$frag['warid']][] = $frag;
                                                            }
                                                    
                                                            $count = 0;
                                                            foreach($SQL->query('SELECT `guild_wars`.`id`, `guild_wars`.`guild1`, `guild_wars`.`guild2`, `guild_wars`.`name1`, `guild_wars`.`name2`, `guild_wars`.`status`, `guild_wars`.`started`, `guild_wars`.`ended`, (SELECT COUNT(1) FROM `guildwar_kills` WHERE `guildwar_kills`.`warid` = `guild_wars`.`id` AND `guildwar_kills`.`killerguild` = `guild_wars`.`guild1`) guild1_kills, (SELECT COUNT(1) FROM `guildwar_kills` WHERE `guildwar_kills`.`warid` = `guild_wars`.`id` AND `guildwar_kills`.`killerguild` = `guild_wars`.`guild2`) guild2_kills FROM `guild_wars` WHERE `guild1` = ' . $guild_id . ' OR `guild2` = ' . $guild_id . ' ORDER BY CASE `status` WHEN 0 THEN 2 WHEN 1 THEN 1 WHEN 4 THEN 3 WHEN 3 THEN 4 WHEN 2 THEN 5 END, `started` DESC') as $war)
                                                            {
                                                                $count++;
                                                                $main_content .= "<tr style=\"background: " . (is_int($count / 2) ? $config['site']['darkborder'] : $config['site']['lightborder']) . ";\">
                                                            <td align=\"center\"><a href=\"?subtopic=guilds&action=view&GuildName=".$war['name1']."\"><img src=\"guild_image.php?id=" . $war['guild1'] . "\" width=\"64\" height=\"64\" border=\"0\"/><br />".htmlspecialchars($war['name1'])."</a></td>
                                                            <td align=\"center\">";
                                                                switch($war['status'])
                                                                {
                                                                    case 0:
                                                                    {
                                                                        $main_content .= "<b>Pending acceptation</b><br />Invited on " . date("M d Y, H:i:s", $war['started']) . " for 4 hours war.<br />";
                                                                        if($guild_leader && $war['guild2'] == $guild->getID())
                                                                        {
                                                                            $main_content .= '<br /><a href="?subtopic=guilds&action=guildwar_accept&GuildName=' . $guild_name . '&war=' . $war['id'] . '" onclick="return confirm(\'Are you sure that you want ACCEPT that invitation for 2 hours war?\');" style="cursor: pointer;">accept invitation to war</a>';
                                                                            $main_content .= '<br /><br /><a href="?subtopic=guilds&action=guildwar_reject&GuildName=' . $guild_name . '&war=' . $war['id'] . '" onclick="return confirm(\'Are you sure that you want REJECT that invitation for 2 hours war?\');" style="cursor: pointer;">reject invitation to war</a>';
                                                                        }
                                                                        if($guild_leader && $war['guild1'] == $guild->getID())
                                                                        {
                                                                            $main_content .= '<br /><br /><a href="?subtopic=guilds&action=guildwar_cancel&GuildName=' . $guild_name . '&war=' . $war['id'] . '" onclick="return confirm(\'Are you sure that you want CANCEL that invitation for 2 hours war?\');" style="cursor: pointer;">cancel invitation to war</a>';
                                                                        }
                                                                        $main_content .= '</font>';
                                                                        break;
                                                                    }
                                                                    case 1:
                                                                    {
                                                                        $main_content .= "<font size=\"12\"><span style=\"color: red;\">" . $war['guild1_kills'] . "</span><font color=black> : </font><span style=\"color: lime;\">" . $war['guild2_kills'] . "</span></font><br /><br /><span style=\"color: darkred; font-weight: bold;\">On a brutal war</span><br /><font color=black>Began on " . date("M d Y, H:i:s", $war['started']) . ", will end up after server restart after " . date("M d Y, H:i:s", $war['started'] + (2*3600)) . ".<br /></font>";
                                                                        $main_content .= "<br /><br />";
                                                                        if(in_array($war['status'], array(1,4)))
                                                                        {
                                                                            $main_content .= "<a onclick=\"show_hide('war-details:" . $war['id'] . "'); return false;\" style=\"cursor: pointer;\">War Details</a>";
                                                                        }
                                                                        break;
                                                                    }
                                                                    case 2:
                                                                    {
                                                                        $main_content .= "<b>Rejected invitation</b><br />Invited on " . date("M d Y, H:i:s", $war['started']) . ", rejected on " . date("M d Y, H:i:s", $war['ended']) . ".</font>";
                                                                        break;
                                                                    }
                                                                    case 3:
                                                                    {
                                                                        $main_content .= "<b>Canceled invitation</b><br />Sent invite on " . date("M d Y, H:i:s", $war['started']) . ", canceled on " . date("M d Y, H:i:s", $war['ended']) . ".</font>";
                                                                        break;
                                                                    }
                                                                    case 4:
                                                                    {
                                                                        $main_content .= "<b><i>Ended</i></b><br />Began on " . date("M d Y, H:i:s", $war['started']) . ", ended on " . date("M d Y, H:i:s", $war['ended']) . ". Frag statistics: <span style=\"color: red;\">" . $war['guild1_kills'] . "</span> to <span style=\"color: lime;\">" . $war['guild2_kills'] . "</span>.";
                                                                        $main_content .= "<br /><br />";
                                                                        if(in_array($war['status'], array(1,4)))
                                                                        {
                                                                            $main_content .= "<a onclick=\"show_hide('war-details:" . $war['id'] . "'); return false;\" style=\"cursor: pointer;\">&raquo; Details &laquo;</a>";
                                                                        }
                                                                        $main_content .= "</font>";
                                                                        break;
                                                                    }
                                                                    default:
                                                                    {
                                                                        $main_content .= "Unknown, please contact with gamemaster.";
                                                                        break;
                                                                    }
                                                                }
                                                                $main_content .= "</td>
                                                            <td align=\"center\"><a href=\"?subtopic=guilds&action=view&GuildName=".$war['name2']."\"><img src=\"guild_image.php?id=" . $war['guild2'] . "\" width=\"64\" height=\"64\" border=\"0\"/><br />".htmlspecialchars($war['name2'])."</a></td>
                                                            </tr>
                                                            <tr id=\"war-details:" . $war['id'] . "\" style=\"display: none; background: " . (is_int($count / 2) ? $config['site']['darkborder'] : $config['site']['lightborder']) . ";\">
                                                            <td colspan=\"3\">";
                                                                if(in_array($war['status'], array(1,4)))
                                                                {
                                                                    if(isset($warFrags[$war['id']]))
                                                                    {
                                                                        foreach($warFrags[$war['id']] as $frag)
                                                                        {
                                                                            $main_content .= date("j M Y, H:i", $frag['time']) . " <span style=\"font-weight: bold; color: " . ($frag['killerguild'] == $war['guild1'] ? "red" :"lime") . ";\">+</span><a href=\"?subtopic=characters&name=" . urlencode($frag['killer']) . "\"><b>".htmlspecialchars($frag['killer'])."</b></a> killed <a href=\"?subtopic=characters&name=".urlencode($frag['target'])."\"> " . htmlspecialchars($frag['target']) . "</a><br>";
                                                                        }
                                                                    }
                                                                    else
                                                                        $main_content .= "<center>There were no frags on this war so far.</center>";
                                                                }
                                                                else
                                                                    $main_content .= "</td></tr>";
                                                            }
                                                    $main_content .= '
                                                        </table>
                                                    </div>
                                                </div>
                                            </div>
                                        </td>
                                    </tr>';
                            if($count == 0)
                                $main_content .= "
                                    <tr>
                                        <td>The guild ".$guild_name." is currently not involved in a guild war.</td>
                                    </tr>";
                            $main_content .= '
                                </table>
                            </div>
                        </td>
                    </tr>
                </table>
            </div>
            <br/>';
            /*
        $main_content .= '
            <div class="TableContainer" >
                <table class="Table5" cellpadding="0" cellspacing="0" >
                    <div class="CaptionContainer" >
                        <div class="CaptionInnerContainer" > 
                            <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                            <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                            <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                            <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>                        
                            <div class="Text" >Guild War History</div>
                            <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
                            <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> 
                            <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                            <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
                        </div>
                    </div>
                    <tr>
                        <td>
                            <div class="InnerTableContainer">
                                <table style="width:100%;">
                                    <tr>
                                        <td>The guild Lino Lucky has never participated in a guild war.</td>
                                    </tr>
                                </table>
                            </div>
                        </td>
                    </tr>
                </table>
            </div>
            <br/>';
            */
        $main_content .= '
            <center>
                <table border="0" cellspacing="0" cellpadding="0" >
                    <form action="?subtopic=guilds&action=view" method="post" >
                        <tr>
                            <td style="border:0px;" >
                                <input type="hidden" name=GuildName value="'.$_REQUEST['GuildName'].'" >
                                <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
                                    <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
                                        <input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/global/buttons/_sbutton_back.gif" >
                                    </div>
                                </div>
                            </td>
                        </tr>
                    </form>
                </table>
            </center>
            ';
    }
    if($action == 'declarewar')
    {
        $guild_name = (string) $_REQUEST['GuildName'];
        if(!$logged)
            $guild_errors[] = 'You are not logged.';
        if(empty($guild_errors))
        {
            $guild = new Guild();
            $guild->loadByName($guild_name);
            if(!$guild->isLoaded())
                $guild_errors[] = 'Guild <b>'.$guild_name.'</b> doesn\'t exist.';
            if(empty($guild_errors))
            {
                $guild_leader_char = $guild->getOwner();
                $guild_leader = FALSE;
                $account_players = $account_logged->getPlayers();
                foreach($account_players as $player)
                {
                    if($guild_leader_char->getId() == $player->getId())
                    {
                        $guild_leader = TRUE;
                    }
                }
                if($guild_leader)
                {
                    $currentWars = array();
                    $wars = new DatabaseList('GuildWar');
                    foreach($wars as $war)
                    {
                        if($war->getStatus() == GuildWar::STATE_INVITED || $war->getStatus() == GuildWar::STATE_ON_WAR)
                        {
                            if($war->getGuild1ID() == $guild->getID())
                                $currentWars[$war->getGuild2ID()] = $war->getStatus();
                            elseif($war->getGuild2ID() == $guild->getID())
                                $currentWars[$war->getGuild1ID()] = $war->getStatus();
                        }
                    }

                    $main_content .= '<center><h1>' . htmlspecialchars($guild->getName()) . ' vs. ???</h2></center><br /><h3>Choose your enemy!</h3><br /><table width="100%" border="0" cellspacing="1" cellpadding="4">';

                    $guildsList = new DatabaseList('Guild');
                    $guildsList->addOrder(new SQL_Order(new SQL_Field('name'), SQL_Order::ASC));
                    $shown_guilds = 0;
                    foreach($guildsList as $enemyGuild)
                    {
                        if(is_int($shown_guilds / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $shown_guilds++;
                        $main_content .= '<tr BGCOLOR="'.$bgcolor.'"><td width="70px"><IMG SRC="guild_image.php?id='. $enemyGuild->getID() .'" WIDTH="64" HEIGHT="64"></td><td valign="top"><B>'.htmlspecialchars($enemyGuild->getName()).'</B></td><td>';
                        if($enemyGuild->getID() != $guild->getID())
                        {
                            if(isset($currentWars[$enemyGuild->getID()]))
                            {
                                // in war or invited
                                if($currentWars[$enemyGuild->getID()] == GuildWar::STATE_INVITED)
                                {
                                    // guild already invited you or you invited that guild
                                    $main_content .= 'There is already invitation between your and this guild.';
                                }
                                else
                                {
                                    // you are on war with this guild
                                    $main_content .= 'There is already war between your and this guild.';
                                }
                            }
                            else
                            {
                                // can invite
                                $main_content .= '<a href="?subtopic=guilds&action=guildwar_invite&GuildName=' . urlencode($guild->getName()) . '&enemy=' . $enemyGuild->getID() . '" onclick="return confirm(\'Are you sure that you want invite that guild?\')">INVITE FOR WAR</a>';
                            }
                        }
                        else
                        {
                            // your own guild
                            $main_content .= 'YOUR GUILD';
                        }
                        $main_content .= '</td></tr>';
                    }
                    $main_content .= '</table>';
                }
                else
                    $guild_errors[] = 'You are not a leader of guild!';
            }
        }
        if(!empty($guild_errors))
        {
            $main_content .= '<div class="SmallBox" >  <div class="MessageContainer" >    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/global/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></div>    <div class="ErrorMessage" >      <div class="BoxFrameVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></div>      <div class="BoxFrameVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></div>      <div class="AttentionSign" style="background-image:url('.$layout_name.'/images/global/content/attentionsign.gif);" /></div><b>The Following Errors Have Occurred:</b><br/>';
            foreach($guild_errors as $guild_error)
                $main_content .= '<li>'.$guild_error.'</li>';
            $main_content .= '</div>    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/global/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></div>  </div></div><br>';
            $main_content .= '<br/><center><form action="?subtopic=guilds" METHOD=post><div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/global/buttons/_sbutton_back.gif" ></div></div></form></center>';
        }
    }
    if($action == 'guildwar_invite')
    {
        $guild_name = (string) $_REQUEST['GuildName'];
        $enemy_id = (int) $_REQUEST['enemy'];
        if(!$logged)
            $guild_errors[] = 'You are not logged.';
        if(empty($guild_errors))
        {
            $guild = new Guild();
            $guild->loadByName($guild_name);
            $enemyGuild = new Guild($enemy_id);
            if(!$guild->isLoaded() || !$enemyGuild->isLoaded())
                $guild_errors[] = 'Guild <b>'.$guild_id.'</b> or <b>'.$enemy_id.'</b> doesn\'t exist.';
            if(empty($guild_errors))
            {
                $guild_leader_char = $guild->getOwner();
                $guild_leader = FALSE;
                $account_players = $account_logged->getPlayers();
                foreach($account_players as $player)
                {
                    if($guild_leader_char->getId() == $player->getId())
                    {
                        $guild_leader = TRUE;
                    }
                }
                if($guild_leader)
                {
                    if($enemyGuild->getID() != $guild->getID())
                    {
                        $currentWars = array();
                        $wars = new DatabaseList('GuildWar');
                        foreach($wars as $war)
                        {
                            if($war->getStatus() == GuildWar::STATE_INVITED || $war->getStatus() == GuildWar::STATE_ON_WAR)
                            {
                                if($war->getGuild1ID() == $guild->getID())
                                    $currentWars[$war->getGuild2ID()] = $war->getStatus();
                                elseif($war->getGuild2ID() == $guild->getID())
                                    $currentWars[$war->getGuild1ID()] = $war->getStatus();
                            }
                        }
                        if(isset($currentWars[$enemyGuild->getID()]))
                        {
                            // in war or invited
                            if($currentWars[$enemyGuild->getID()] == GuildWar::STATE_INVITED)
                            {
                                // guild already invited you or you invited that guild
                                $guild_errors[] = 'There is already invitation between your and this guild.';
                            }
                            else
                            {
                                // you are on war with this guild
                                $guild_errors[] = 'There is already war between your and this guild.';
                            }
                        }
                        else
                        {
                            // can invite
                            $war = new GuildWar();
                            $war->setGuild1ID($guild->getID());
                            $war->setGuild2ID($enemyGuild->getID());
                            $war->setGuild1Name($guild->getName());
                            $war->setGuild2Name($enemyGuild->getName());
                            $war->setStatus(GuildWar::STATE_INVITED);
                            $war->setStarted(time());
                            $war->setEnded(0);
                            $war->save();
                            header("Location: ?subtopic=guilds&action=view&GuildName=".urlencode($guild_name)."");
                            $main_content .= 'War invitation sent. Redirecting...';
                        }
                    }
                    else
                    {
                        $guild_errors[] = 'You cannot invite same guild!';
                    }
                }
                else
                    $guild_errors[] = 'You are not a leader of guild!';
            }
        }
        if(!empty($guild_errors))
        {
            $main_content .= '<div class="SmallBox" >  <div class="MessageContainer" >    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="ErrorMessage" >      <div class="BoxFrameVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="BoxFrameVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="AttentionSign" style="background-image:url('.$layout_name.'/images/content/attentionsign.gif);" /></div><b>The Following Errors Have Occurred:</b><br/>';
            foreach($guild_errors as $guild_error)
                $main_content .= '<li>'.$guild_error.'</li>';
            $main_content .= '</div>    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>  </div></div><br>';
            $main_content .= '<br/><center><form action="?subtopic=guilds" METHOD=post><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" ></div></div></form></center>';
        }
    }
    if($action == 'guildwar_cancel')
    {
        $guild_name = (string) $_REQUEST['GuildName'];
        $war_id = (int) $_REQUEST['war'];
        if(!$logged)
            $guild_errors[] = 'You are not logged.';
        if(empty($guild_errors))
        {
            $guild = new Guild();
            $guild->loadByName($guild_name);
            if(!$guild->isLoaded())
                $guild_errors[] = 'Guild <b>'.$guild_name.'</b> doesn\'t exist.';
            if(empty($guild_errors))
            {
                $guild_leader_char = $guild->getOwner();
                $guild_leader = FALSE;
                $account_players = $account_logged->getPlayers();
                foreach($account_players as $player)
                {
                    if($guild_leader_char->getId() == $player->getId())
                    {
                        $guild_leader = TRUE;
                    }
                }
                if($guild_leader)
                {
                    $war = new GuildWar($war_id);
                    if(!$war->isLoaded())
                        $guild_errors[] = 'War with ID <b>'.$war_id.'</b> doesn\'t exist.';

                    if(empty($guild_errors))
                    {
                        if($war->getGuild1ID() != $guild->getID() || $war->getStatus() != GuildWar::STATE_INVITED)
                        {
                            $guild_errors[] = 'Your guild did not invite to that war.';
                        }

                        if(empty($guild_errors))
                        {
                            $war->setStatus(GuildWar::STATE_CANCELED);
                            $war->setEnded(time());
                            $war->save();
                            header("Location: ?subtopic=guilds&action=view&GuildName=".$guild_name."");
                            $main_content .= 'War invitation rejected. Redirecting...';
                        }
                    }
                }
                else
                    $guild_errors[] = 'You are not a leader of guild!';
            }
        }
        if(!empty($guild_errors))
        {
            $main_content .= '<div class="SmallBox" >  <div class="MessageContainer" >    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="ErrorMessage" >      <div class="BoxFrameVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="BoxFrameVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="AttentionSign" style="background-image:url('.$layout_name.'/images/content/attentionsign.gif);" /></div><b>The Following Errors Have Occurred:</b><br/>';
            foreach($guild_errors as $guild_error)
                $main_content .= '<li>'.$guild_error.'</li>';
            $main_content .= '</div>    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>  </div></div><br>';
            $main_content .= '<br/><center><form action="?subtopic=guilds" METHOD=post><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" ></div></div></form></center>';
        }
    }
    if($action == 'guildwar_reject')
    {
        $guild_name = (string) $_REQUEST['GuildName'];
        $war_id = (int) $_REQUEST['war'];
        if(!$logged)
            $guild_errors[] = 'You are not logged.';
        if(empty($guild_errors))
        {
            $guild = new Guild();
            $guild->loadByName($guild_name);
            if(!$guild->isLoaded())
                $guild_errors[] = 'Guild <b>'.$guild_name.'</b> doesn\'t exist.';
            if(empty($guild_errors))
            {
                $guild_leader_char = $guild->getOwner();
                $guild_leader = FALSE;
                $account_players = $account_logged->getPlayers();
                foreach($account_players as $player)
                {
                    if($guild_leader_char->getId() == $player->getId())
                    {
                        $guild_leader = TRUE;
                    }
                }
                if($guild_leader)
                {
                    $war = new GuildWar($war_id);
                    if(!$war->isLoaded())
                        $guild_errors[] = 'War with ID <b>'.$war_id.'</b> doesn\'t exist.';

                    if(empty($guild_errors))
                    {
                        if($war->getGuild2ID() != $guild->getID() || $war->getStatus() != GuildWar::STATE_INVITED)
                        {
                            $guild_errors[] = 'Your guild is not invited to that war.';
                        }

                        if(empty($guild_errors))
                        {
                            $war->setStatus(GuildWar::STATE_REJECTED);
                            $war->setEnded(time());
                            $war->save();
                            header("Location: ?subtopic=guilds&action=view&GuildName=".urlencode($guild_name)."");
                            $main_content .= 'War invitation rejected. Redirecting...';
                        }
                    }
                }
                else
                    $guild_errors[] = 'You are not a leader of guild!';
            }
        }
        if(!empty($guild_errors))
        {
            $main_content .= '<div class="SmallBox" >  <div class="MessageContainer" >    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="ErrorMessage" >      <div class="BoxFrameVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="BoxFrameVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="AttentionSign" style="background-image:url('.$layout_name.'/images/content/attentionsign.gif);" /></div><b>The Following Errors Have Occurred:</b><br/>';
            foreach($guild_errors as $guild_error)
                $main_content .= '<li>'.$guild_error.'</li>';
            $main_content .= '</div>    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>  </div></div><br>';
            $main_content .= '<br/><center><form action="?subtopic=guilds" METHOD=post><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" ></div></div></form></center>';
        }
    }
    if($action == 'guildwar_accept')
    {
        $guild_name = (string) $_REQUEST['GuildName'];
        $war_id = (int) $_REQUEST['war'];
        if(!$logged)
            $guild_errors[] = 'You are not logged.';
        if(empty($guild_errors))
        {
            $guild = new Guild();
            $guild->loadByName($guild_name);
            if(!$guild->isLoaded())
                $guild_errors[] = 'Guild <b>'.$guild_name.'</b> doesn\'t exist.';
            if(empty($guild_errors))
            {
                $guild_leader_char = $guild->getOwner();
                $guild_leader = FALSE;
                $account_players = $account_logged->getPlayers();
                foreach($account_players as $player)
                {
                    if($guild_leader_char->getId() == $player->getId())
                    {
                        $guild_leader = TRUE;
                    }
                }
                if($guild_leader)
                {
                    $war = new GuildWar($war_id);
                    if(!$war->isLoaded())
                        $guild_errors[] = 'War with ID <b>'.$war_id.'</b> doesn\'t exist.';

                    if(empty($guild_errors))
                    {
                        if($war->getGuild2ID() != $guild->getID() || $war->getStatus() != GuildWar::STATE_INVITED)
                        {
                            $guild_errors[] = 'Your guild is not invited to that war.';
                        }

                        if(empty($guild_errors))
                        {
                            $war->setStatus(GuildWar::STATE_ON_WAR);
                            $war->setStarted(time());
                            $war->setEnded(0);
                            $war->save();
                            header("Location: ?subtopic=guilds&action=view&GuildName=".urlencode($guild_name)."");
                            $main_content .= 'War invitation accepted. Redirecting...';
                        }
                    }
                }
                else
                    $guild_errors[] = 'You are not a leader of guild!';
            }
        }
        if(!empty($guild_errors))
        {
            $main_content .= '<div class="SmallBox" >  <div class="MessageContainer" >    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="ErrorMessage" >      <div class="BoxFrameVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="BoxFrameVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="AttentionSign" style="background-image:url('.$layout_name.'/images/content/attentionsign.gif);" /></div><b>The Following Errors Have Occurred:</b><br/>';
            foreach($guild_errors as $guild_error)
                $main_content .= '<li>'.$guild_error.'</li>';
            $main_content .= '</div>    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>  </div></div><br>';
            $main_content .= '<br/><center><form action="?subtopic=guilds" METHOD=post><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" ></div></div></form></center>';
        }
    }
    if($action == "guildevents") {
        $main_content .= '
            Page under construction
            <BR><BR>
                    <TABLE BORDER=0 WIDTH=100%>
                        <TR>
                            <TD ALIGN=center>
                                <table border="0" cellspacing="0" cellpadding="0" >
                                    <form action="?subtopic=guilds" method="post" >
                                        <input type="hidden" name="action" value="view">
                                        <input type="hidden" name="GuildName" value="'.$_REQUEST['GuildName'].'">
                                        <tr>
                                            <td style="border:0px;" ><div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
                                                    <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
                                                        <input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/global/buttons/_sbutton_back.gif" >
                                                    </div>
                                                </div>
                                            </td>
                                        </tr>
                                    </form>
                                </table>
                            </TD>
                        </TR>
                    </TABLE>';
    }
    if($action == 'deletebyadmin')
    {
        $guild_id = (int) $_REQUEST['guild'];
        if(empty($guild_errors))
        {
            $guild = new Guild();
            $guild->load($guild_id);
            if(!$guild->isLoaded())
                $guild_errors[] = 'Guild with ID <b>'.$guild_id.'</b> doesn\'t exist.';
        }
        if(empty($guild_errors))
        {
            if($logged)
            {
                if($group_id_of_acc_logged >= $config['site']['access_admin_panel'])
                {
                    if($_POST['todo'] == 'save')
                    {
                        $guild->delete();
                        $main_content .= '<div class="TableContainer" >  <table class="Table1" cellpadding="0" cellspacing="0" >    <div class="CaptionContainer" >      <div class="CaptionInnerContainer" >        <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>        <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>        <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>        <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>        <div class="Text" >Guild Deleted</div>        <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>        <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>        <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>        <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>      </div>    </div>    <tr>      <td>        <div class="InnerTableContainer" >          <table style="width:100%;" ><tr><td>Guild with ID <b>'.$guild_id.'</b> has been deleted.</td></tr>          </table>        </div>  </table></div></td></tr><br/><center><form action="?subtopic=guilds" METHOD=post><div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/global/buttons/_sbutton_back.gif" ></div></div></form></center>';
                    }
                    else
                        $main_content .= '<div class="TableContainer" >  <table class="Table1" cellpadding="0" cellspacing="0" >    <div class="CaptionContainer" >      <div class="CaptionInnerContainer" >        <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>        <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>        <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>        <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>        <div class="Text" >Guild Deleted</div>        <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>        <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>        <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>        <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>      </div>    </div>    <tr>      <td>        <div class="InnerTableContainer" >          <table style="width:100%;" ><tr><td>Are you sure you want delete guild <b>'.htmlspecialchars($guild->getName()).'</b>?<br>
                        <form action="?subtopic=guilds&guild='.$guild_id.'&action=deletebyadmin" METHOD=post><input type="hidden" name="todo" value="save"><input type="submit" value="Yes, delete"></form>
                        </td></tr>          </table>        </div>  </table></div></td></tr><br/><center><form action="?subtopic=guilds" METHOD=post><div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/global/buttons/_sbutton_back.gif" ></div></div></form></center>';
                }
                else
                    $guild_errors[] = 'You are not an admin!';
            }
            else
                $guild_errors[] = 'You are not logged. You can\'t delete guild.';
        }
        if(!empty($guild_errors))
        {
            $main_content .= '<div class="SmallBox" >  <div class="MessageContainer" >    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/global/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></div>    <div class="ErrorMessage" >      <div class="BoxFrameVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></div>      <div class="BoxFrameVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></div>      <div class="AttentionSign" style="background-image:url('.$layout_name.'/images/global/content/attentionsign.gif);" /></div><b>The Following Errors Have Occurred:</b><br/>';
            foreach($guild_errors as $guild_error)
                $main_content .= '<li>'.$guild_error.'</li>';
            $main_content .= '</div>    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/global/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></div>  </div></div><br>';
            $main_content .= '<br/><center><form action="?subtopic=guilds" METHOD=post><div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/global/buttons/_sbutton_back.gif" ></div></div></form></center>';
        }
    }

     

  3. Tipo eu quero simplesmente saber qual nome da pasta ou arquivo que eu tenho que editar para o nome dos itens que está ai mudar, exemplo se no meu server o vip hat é o hat of the mad, quando entrar no site e ver o set do player não vai mostrar vip hat vai mostrar hat of the mad, onde edito essas descrições de itens?

    RJH6SFh.png

  4. Iria Por Que o Error Era Algo Na Lib Mas Não Tem Está Opção... Meu CTF Event Está 100% Único Problema é Que Quando o Time Ganha o Time Perdedor Vai Para o Templo e o Ganhador Continua No Evento + Recebe o Premio Normalmente.. Alguém Poderia Ajudar? Só Para Ajeitar Para os Ganhadores Irem Templo.

     

    --[[
    	Capture The Flag System
    	Author: Maxwell Denisson(MaXwEllDeN)
    	Version: 2.0
    	Contact: maxwellmda@gmail.com
    ]]
    
    CTF_LIB = {
    	waitpos = {x = 1188, y = 1161, z =7}, -- Posição da sala de espera
    	tppos = {x = 1088, y = 1055, z =7}, -- Onde o TP vai aparecer
    
    	days = {1, 2, 3, 4, 5, 6, 7}, -- Dias que o evento vai abrir
    	xp_percent = 0.5, -- Porcentagem de exp que o player vai ganhar
    	timeclose = 1, -- Tempo, em minutos, para iniciar o CTF
    	winp = 2, -- Quantos pontos uma equipe precisa marcar para vencer
    
    	teams = {
    		["Vermelho"] = {
    			temple = 15, -- TownID da equipe vermelha
    			outfit = {lookHead = 0, lookBody = 132, lookLegs = 113, lookFeet = 94},
    
    			flag = {
    				id = 1435,
    				flag_pos = {x = 605, y = 1676, z =6}, -- Posição onde a bandeira vermelha vai ser criada
    				gnd_pos = {x = 607, y = 1676, z =6}, -- Onde os players da equipe vermelha entregarão a bandeira.
    			},
    		},
    
    		["Verde"] = {
    			temple = 16, -- TownID da equipe verde
    			outfit = {lookHead = 0, lookBody = 121, lookLegs = 101, lookFeet = 101},
    
    			flag = {
    				id = 1437,
    				flag_pos = {x = 690, y = 1676, z =6}, -- Posição onde a bandeira verde vai ser criada
    				gnd_pos = {x = 688, y = 1676, z =6}, -- Onde os players da equipe verde entregarão a bandeira.
    			},
    		},
    	},
    }
    
    local CTF = CTF_LIB
    
    function CTF.getMembers()
    	local members = {}
    
    	for _, cid in pairs(getPlayersOnline()) do
    		if getPlayerStorageValue(cid, 16700) ~= -1 then
    			table.insert(members, cid)
    		end
    	end
    
    	return members
    end
    
    function CTF.getTeamMembers(team)
    	local members = {}
    
    	for _, cid in pairs(CTF.getMembers()) do
    		if getPlayerStorageValue(cid, 16700) == team then
    			table.insert(members, cid)
    		end
    	end
    
    	return members
    end
    
    function CTF.removePlayer(uid)
    	doPlayerSetTown(uid, getPlayerStorageValue(uid, 16701))
    	doTeleportThing(uid, getTownTemplePosition(getPlayerStorageValue(uid, 16701)))
    	doRemoveCondition(uid, CONDITION_OUTFIT)
    	doCreatureAddHealth(uid, getCreatureMaxHealth(uid))
    	doCreatureAddMana(uid, getCreatureMaxMana(uid))
    
    	setPlayerStorageValue(uid, 16701, -1)
    	setPlayerStorageValue(uid, 16700, -1)
    	return true
    end
    
    function CTF.addPlayer(uid)
    	local team = CTF.getTeamLivre()
    	local n_team = CTF.teams[team]
    
    	setPlayerStorageValue(uid, 16700, team)
    	setPlayerStorageValue(uid, 16701, getPlayerTown(uid))
    
    	doPlayerSetTown(uid, n_team.temple)
    	doTeleportThing(uid, CTF.waitpos)
    
    	doPlayerSendTextMessage(uid, 22, "Você agora faz parte do time ".. team .. ".")
    
    	local outfit = getCreatureOutfit(uid)
    
    	for i, v in pairs(n_team.outfit) do
    		outfit[i] = v
    	end
    
    	registerCreatureEvent(uid, "CTFLogout")
    	registerCreatureEvent(uid, "CTFAttack")
    	registerCreatureEvent(uid, "CTFCombat")
    	registerCreatureEvent(uid, "CTFDeath")
    	doSetCreatureOutfit(uid, outfit, -1)
    	return true
    end
    
    function CTF.getTeamLivre()
    	local teams = {}
    
    	for i, _ in pairs(CTF.teams) do
    		table.insert(teams, {i, #CTF.getTeamMembers(i)})
    	end
    
    	if (teams[1][2] < teams[2][2]) then
    		return teams[1][1]
    	elseif (teams[1][2] > teams[2][2]) then
    		return teams[2][1]
    	end
    
    	return teams[math.random(2)][1]
    end
    
    function CTF.broadCast(msg, class)
    	for _, uid in pairs(CTF.getMembers()) do
    		doPlayerSendTextMessage(uid, class or 20, msg)
    	end
    
    	return true
    end
    
    function CTF.getFlagTeam(flag)
    	for i, v in pairs(CTF.teams) do
    		if v.flag.id == flag then
    			return i
    		end
    	end
    
    	return ""
    end
    
    local score_sto = {}
    local a = 0
    for i, _ in pairs(CTF.teams) do
    	score_sto[i] = 42314 + a
    	a = a + 1
    end
    
    function CTF.createFlags()
    	for i, v in pairs(CTF.teams) do
    		local flag = doCreateItem(v.flag.id, 1, v.flag.flag_pos)
    		doItemSetAttribute(flag, "aid", 63218)
    
    		v.flag.gnd_pos.stackpos = 0
    		local gnd = getThingFromPos(v.flag.gnd_pos).uid
    		doItemSetAttribute(gnd, "aid", 63200)
    		doItemSetAttribute(gnd, "team", i)
    
    		setGlobalStorageValue(score_sto[i], 0)
    	end
    
    	return true
    end
    
    function CTF.removeFlags()
    	for i, v in pairs(CTF.teams) do
    		local flag = doFindItemInPos({v.flag.id}, v.flag.flag_pos)[1]
    		if flag then
    			doRemoveItem(flag.uid, 1)
    		end
    
    		v.flag.gnd_pos.stackpos = 0
    		local gnd = getThingFromPos(v.flag.gnd_pos).uid
    		doItemSetAttribute(gnd, "aid", 0)
    	end
    
    	return true
    end
    
    function CTF.start()
    	doRemoveItem(doFindItemInPos({1387}, CTF.tppos)[1].uid, 1)
    	setGlobalStorageValue(16705, -1)
    
    	if #CTF.getMembers() < 2 then
    		doBroadcastMessage("O CTF não pôde ser iniciado por falta de players.")
    
    		for _, cid in pairs(CTF.getMembers()) do
    			CTF.removePlayer(cid)
    		end
    
    		return false
    	end
    
    	CTF.broadCast("O CTF foi iniciado. Bom jogo!")
    
    	for _, uid in pairs(CTF.getMembers()) do
    		doTeleportThing(uid, getTownTemplePosition(getPlayerTown(uid)))
    	end
    
    	CTF.createFlags()
    	return true
    end
    
    function CTF.returnFlag(uid, status)
    	local team = getPlayerStorageValue(uid, 16702)
    
    	if status then
    		local msg = "O player ".. getCreatureName(uid) .. ", estava com a bandeira do time ".. team .. " "
    
    		if status == 1 then
    			msg = msg .. "e foi eliminado. "
    		elseif status == 2 then
    			msg = "e foi removido do evento. "
    		end
    
    		msg = msg .. "Portanto a bandeira do time ".. team .. " foi devolvida."
    		CTF.broadCast(msg)
    	end
    
    	if CTF.teams[team] then
    		local flag = doCreateItem(CTF.teams[team].flag.id, 1, CTF.teams[team].flag.flag_pos)
    		doItemSetAttribute(flag, "aid", 63218)
    
    		setPlayerStorageValue(uid, 16702, -1)
    	end
    
    	return true
    end
    
    function CTF.addPoint(uid)
    	local finish
    	local msg = "Capture The Flag:"
    
    	setGlobalStorageValue(score_sto[getPlayerStorageValue(uid, 16700)], getGlobalStorageValue(score_sto[getPlayerStorageValue(uid, 16700)]) + 1)
    
    	for i, _ in pairs(CTF.teams) do
    		msg = msg .. "\nTime ".. i .. ": ".. getGlobalStorageValue(score_sto[i])
    
    		if getGlobalStorageValue(score_sto[i]) >= CTF.winp then
    			finish = i
    		end
    	end
    
    	CTF.broadCast(getCreatureName(uid) .. " marcou um ponto para o time ".. getPlayerStorageValue(uid, 16700) .. ".", 22)
    	CTF.broadCast(msg)
    	CTF.returnFlag(uid)
    
    	if finish then
    		CTF.close(finish)
    		return "close"
    	end
    
    	return true
    end
    
    function CTF.close(win)
    
    	if not win then
    		doBroadcastMessage("O CTF acabou sem vencedores.")
    	else
    		CTF.broadCast("O time ".. win .. " marcou ".. CTF.winp .. " ponto(s) e venceu o evento.")
    	end
    
    	for _, cid in pairs(CTF.getMembers()) do
    		if getPlayerStorageValue(cid, 16700) == win then
    			local xp = math.ceil(getPlayerExperience(cid) * (CTF.xp_percent / 100), 215)
    			doPlayerSendTextMessage(cid, 22, "Parabéns! Você ganhou o evento e obteve ".. CTF.xp_percent .."% de sua experiência total(".. xp ..").")
    			doSendAnimatedText(getThingPos(cid), xp, 215)
    			doPlayerAddExperience(cid, xp)
    		end
    
    		--[[
    		if getPlayerStorageValue(cid, 16702) ~= -1 then
    			CTF.returnFlag(cid)
    		end]]
    
    		CTF.removePlayer(cid)
    	end
    
    	CTF.removeFlags()
    
    	for i, _ in pairs(CTF.teams) do
    		setGlobalStorageValue(score_sto[i], 0)
    	end
    
    	return true
    end
    
    local function Alert(uid)
    	if (isCreature(uid)) then
    		if getPlayerStorageValue(uid, 16702) == -1 or getPlayerStorageValue(uid, 16700) == -1 then
    			return false
    		end
    
    		doSendAnimatedText(getThingPos(uid), "Flag!", math.random(50, 200))
    
    		local bla = {18, 19, 21, 22, 23, 24}
    		doSendMagicEffect(getThingPos(uid), bla[math.random(#bla)])
    
    		if (os.time() - getPlayerStorageValue(uid, 16703) >= 60) then
    			CTF.returnFlag(uid)
    			return setPlayerStorageValue(uid, 16703, -1)
    		end
    
    		addEvent(Alert, 500, uid)
    		return true
    	end
    
    	return false
    end
    
    function CTF.stealFlag(uid, team)
    	setPlayerStorageValue(uid, 16702, team)
    	setPlayerStorageValue(uid, 16703, os.time())
    
    	CTF.broadCast(getCreatureName(uid) .. " roubou a bandeira do time ".. team .. "!")
    	Alert(uid)
    	return true
    end
    
    function doFindItemInPos(ids, pos) -- By Undead Slayer
    	local results = {}
    
    	for _ = 0, 255 do
    		local findPos = {x = pos.x, y = pos.y, z = pos.z, stackpos = _}
    		if isInArray(ids, getThingFromPos(findPos).itemid) then
    			table.insert(results, getThingFromPos(findPos))
    		end
    	end
    
    	return results
    end

     

     

  5. Queria Saber o Seguinte Essa DLL Esta Bloqueando o Elfbot Fazendo QUe o Jogo Feche Ao Abrir Mais Se Remover Essa DLL Da Pasta o Client Fica Sem Conexão a Internet. Ajuda Aew...

     

    Tudo Que Tem Dentro Da DLL é Isso :

    MZ       ÿÿ  ¸       @                                     º ´	Í!¸LÍ!This program cannot be run in DOS mode.$       z-«ZCøZCøZCøWIœø[CøWI£øQCøWIžø^CøWI¢ø_Cø‡äˆø_CøZBø7Cø'b¦ø[Cø'bŸø[CøWI˜ø[CøZÔø[Cø'bø[CøRichZCø                        PE  L Þ/Y        à !  F   @      ÕH      `                          °          @                   Pr  M    r  d      ð                      	  a  8                           xg  @            `  `                          .text   [D      F                    `.rdata  ,   `       J              @  @.data   „   €      j              @  À.rsrc   ð         v              @  @.reloc  	          |              @  B                                                                                                                                                                                                                                                                                                                        U‹ìjÿhöQ d¡    PSVW¡ € 3ÅPEôd£    3É»   8Lb ‹ÃDÁ¹ € PhLb è©.  ÇEü    3É8Pb ¿   ‹ÇÇL€    DÁÇH€     PhPb ¹8€ Æ8€  èe.  ÆEü3É8\b ‹ÇÇd€    DÁÇ`€     Ph\b ¹P€ ÆP€  è).  ÆEü3É8hb ¾   ‹ÆÇ|€    DÁÇx€     Phhb ¹h€ Æh€  èè-  ˆ]ü3É8lb ‹ÃÇ”€    DÁÇ€     Phlb ¹€€ Æ€€  è­-  ÆEü3É8Pb ‹ÇǬ€    DÁǨ€     PhPb ¹˜€ Ƙ€  èq-  ÆEüÇÄ€    ÇÀ€     Æ°€  3É‹Ç8\b DÁ¹°€ Ph\b è5-  ÆEü3É8hb ‹ÆÇÜ€    DÁÇØ€     Phhb ¹È€ ÆÈ€  èù,  ÆEü3É8pb ‹ÃÇô€    DÁÇð€     Phpb ¹à€ Æà€  è½,  ÆEü3É8tb ‹ÇÇ    DÁÇ     Phtb ¹ø€ Æø€  è,  ÆEü	3É8€b ‹ÇÇ$    DÁÇ      Ph€b ¹ Æ  èE,  ÆEü3É8hb ‹ÆÇ<    DÁÇ8     Phhb ¹( Æ(  è	,  ÆEü3É8Œb ‹ÃÇT    ÇP     Æ@  DÁ¹@ PhŒb èÍ+  ÆEü3É8b ‹ÇÇl    DÁÇh     Phb ¹X ÆX  è‘+  ÆEü3É8œb ‹ÇÇ„    DÁÇ€     Phœb ¹p Æp  èU+  ÆEü3É8hb ‹ÆÇœ    DÁǘ     Phhb ¹ˆ ƈ  è+  ÆEü3É8¨b ‹ÃÇ´    DÁÇ°     Ph¨b ¹  Æ   èÝ*  ÆEü3É8¬b ‹ÇÇÌ    DÁÇÈ     Ph¬b ¹¸ Ƹ  è¡*  ÆEü3É8\b ‹ÇÇä    DÁÇà     PÆÐ  h\b ¹Ð èe*  ÆEü3É8hb ‹ÆÇü    DÁÇø     Phhb ¹è Æè  è)*  ÆEü3É8¸b ‹ÃÇ‚    DÁÇ‚     Ph¸b ¹ ‚ Æ ‚  èí)  ÆEü3É8¼b ‹ÇÇ,‚    DÁÇ(‚     Ph¼b ¹‚ Æ‚  è±)  ÆEü3É8\b ‹ÇÇD‚    DÁÇ@‚     Ph\b ¹0‚ Æ0‚  èu)  ÆEü3É8hb ‹ÆÇ\‚    DÁÇX‚     Phhb ¹H‚ ÆH‚  è9)  ÆEü3É8Èb ‹ÃÇt‚    DÁÇp‚     PhÈb ¹`‚ Æ`‚  èý(  ÆEü3É8Ìb ‹ÇÇŒ‚    DÁLj‚     PhÌb ¹x‚ Æx‚  èÁ(  ÆEü3É8Øb ‹ÇǤ‚    DÁÇ ‚     PhØb ¹‚ Æ‚  è…(  ÆEü3É8hb ‹ÆǼ‚    DÁǸ‚     Phhb ¹¨‚ ƨ‚  èI(  ÆEü3É8äb ‹ÃÇÔ‚    DÁÇЂ     Phäb ¹À‚ ÆÀ‚  è(  ÆEü3É8èb ‹ÇÇì‚    DÁÇè‚     Phèb ¹Ø‚ ÆØ‚  èÑ'  ÆEü3É8ôb ‹Çǃ    DÁÇ ƒ     Phôb ¹ð‚ Æð‚  è•'  ÆEüǃ    ǃ     3Éƃ  8hb ‹ÆDÁ¹ƒ Phhb èY'  ÆEü3É8 c ‹ÃÇ4ƒ    DÁÇ0ƒ     Ph c ¹ ƒ Æ ƒ  è'  ÆEü 3É8c ‹ÇÇLƒ    DÁÇHƒ     Phc ¹8ƒ Æ8ƒ  èá&  ÆEü!3É8c ‹ÇÇdƒ    DÁÇ`ƒ     Phc ¹Pƒ ÆPƒ  è¥&  ÆEü"3É8hb ‹ÆÇ|ƒ    DÁÇxƒ     Phhb ¹hƒ Æhƒ  èi&  ÆEü#3É8c ‹ÃÇ”ƒ    DÁǃ     Phc ¹€ƒ Æ€ƒ  è-&  ÆEü$‹ÇǬƒ    3ÉǨƒ     Ƙƒ  8 c DÁ¹˜ƒ Ph c èñ%  ÆEü%3É8,c ‹ÇÇă    DÁÇÀƒ     Ph,c ¹°ƒ Æ°ƒ  èµ%  ÆEü&3É8hb ‹ÆÇ܃    DÁÇ؃     Phhb ¹Èƒ Æȃ  èy%  ÆEü'3É88c ‹ÃÇôƒ    DÁÇðƒ     Ph8c ¹àƒ Æàƒ  è=%  ÆEü(3É8<c ‹ÇÇ„    DÁÇ„     Ph<c ¹øƒ Æøƒ  è%  ÆEü)3É8Hc ‹ÇÇ$„    DÁÇ „     PhHc ¹„ Æ„  èÅ$  ÆEü*3É8hb ‹ÆÇ<„    DÁÇ8„     Æ(„  Phhb ¹(„ è‰$  ÆEü+3É8Tc ‹ÃÇT„    DÁÇP„     PhTc ¹@„ Æ@„  èM$  ÆEü,3É8Xc ‹ÇÇl„    DÁÇh„     PhXc ¹X„ ÆX„  è$  ÆEü-3É8dc ‹ÇÇ„„    DÁÇ€„     Phdc ¹p„ Æp„  èÕ#  ÆEü.3É8hb ‹ÆÇœ„    DÁǘ„     Phhb ¹ˆ„ ƈ„  è™#  ÆEü/3É8pc ‹ÃÇ´„    DÁÇ°„     Phpc ¹ „ Æ „  è]#  ÆEü03É8tc ‹ÇÇÌ„    DÁÇÈ„     Phtc ¹¸„ Ƹ„  è!#  ÆEü13É8dc ‹ÇÇä„    DÁÇà„     Phdc ¹Ð„ ÆЄ  èå"  ÆEü23À8hb ¹è„ Çü„    DðÇø„     Vhhb Æè„  è«"  ÆEü33À8€c ¹ … Ç…    DØÇ…     Sh€c Æ …  èq"  ÆEü43À8„c ¹… Ç,…    DøÇ(…     Wh„c Æ…  è7"  hc ¹0… ÆEü5èd  hhb ¹H… ÆEü6èQ  hœc ¹`… ÆEü7è>  h c ¹x… ÆEü8è+  h¬c ¹… ÆEü9è  hhb ¹¨… ÆEü:è  ÆEü;h¸c ¹À… èò  h¼c ¹Ø… ÆEü<èß  hÈc ¹ð… ÆEü=èÌ  hhb ¹† ÆEü>è¹  hÔc ¹ † ÆEü?è¦  hØc ¹8† ÆEü@è“  häc ¹P† ÆEüAè€  hhb ¹h† ÆEüBèm  hðc ¹€† ÆEüCèZ  hôc ¹˜† ÆEüDèG  h d ¹°† ÆEüEè4  hhb ¹È† ÆEüFè!  hd ¹à† ÆEüGè  hd ¹ø† ÆEüHèû  hd ¹‡ ÆEüIèè  hhb ¹(‡ ÆEüJèÕ  ÆEüKh(d ¹@‡ è  h,d ¹X‡ ÆEüLè¯  h8d ¹p‡ ÆEüMèœ  hDd ¹ˆ‡ ÆEüNè‰  hHd ¹ ‡ ÆEüOèv  hLd ¹¸‡ ÆEüPèc  hXd ¹Ð‡ ÆEüQèP  hDd ¹è‡ ÆEüRè=  hdd ¹ ˆ ÆEüSè*  hhd ¹ˆ ÆEüTè  htd ¹0ˆ ÆEüUè  hDd ¹Hˆ ÆEüVèñ  hT èØ&  ƒÄ‹Môd‰    Y_^[‹å]ÃÌÌU‹ìjÿh@S d¡    PƒìVW¡ € 3ÅPEôd£    jdÇEð    è‹$  ‹øƒÄ‰}ìÇEü    …ÿ„Æ   wÇ   jÇF   ‹ÎÇF    hèe Æ è  ÆEüOj,ÇA   ÇA    h f ÇEð   Æ èñ  ÇEü   O4jÇA   ÇA    h0f ÇEð   Æ èà  ÇEü   OLjÇA   ÇA    hHf ÇEð   Æ è•  ‰5dŽ ‹Môd‰    Y_^‹å]ÃÇdŽ     ‹Môd‰    Y_^‹å]ÃÌÌÌhPT è‡%  YÃÌÌÌÌh@T èw%  YÃÌÌÌÌh0T èg%  YÃÌÌÌÌU‹ìöEV‹ñÇ\g tVÿä` ƒÄ‹Æ^] ÌÌÌÌÌÌÌÌÌÌÌÌÌU‹ì‹E‹U‰‰H] ÌÌÌÌÌÌÌÌÌÌÌÌÌÌU‹ì‹UøƒìÿuRÿP‹U‹H;Ju‹ ;u°‹å] 2À‹å] ÌÌÌÌÌÌÌÌÌÌÌÌÌU‹ì‹E;Hu‹ ;Eu°] 2À] Ì̸àa ÃÌÌÌÌÌÌÌÌÌÌU‹ìQVÿuÇEü    ÿÔ` ‹uƒÄ…Àºèa EÐÇF   ÇF    Æ €: u3ÉQR‹Îè*  ‹Æ^‹å] ‹ÊWyŠA„Àuù+Ï_QR‹Îè  ‹Æ^‹å] ÌÌÌÌÌÌÌÌÌÌÌÌÌÌ̸øa ÃÌÌÌÌÌÌÌÌÌÌU‹ìQ‹EÇEü    V‹uƒøu(jÇF   ‹ÎÇF    hb Æ èª  ‹Æ^‹å] PVè*ÿÿÿ‹Æ^‹å] ̸b ÃÌÌÌÌÌÌÌÌÌÌU‹ìQVÿuÇEü    ÿØ` ‹uƒÄ…Àºèa EÐÇF   ÇF    Æ €: u3ÉQR‹Îè:  ‹Æ^‹å] ‹ÊWyŠA„Àuù+Ï_QR‹Îè  ‹Æ^‹å] ÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌU‹ìV‹uVÿÔ` ƒÄ…À‹E‰0tÇ@€ ^] Ç@€ ^] ÌÌÌÌÌÌÌÌÌÌÌÌÌÌU‹ìƒìH¡ € 3ʼnEüVRh$b E¼ÇE¸    j@P‹ñÿDa ÇF   ƒÄÇF    Æ €}¼ u3ÉëM¼QŠA„Àuù+ÊQE¼‹ÎPè[  ‹Mü‹Æ3Í^è¾   ‹å]ÃÌÌÌÌÌÌÌÌÌÌU‹ì‹MƒìSV‹ñWVŠF„Àuù+ò3Û‹4` …ö~c‹}+ω}ü‰M¾9‰EøÿÒ‹øWjÿ(` Wjhÿÿ ÿ` ‹}üMøj jQWPÿ8` …Àt‹4` CG‰}ü;Þ}‹Më³_^2À[‹å] ÇE    ÿÒ‹ðVjÿ(` Vjhÿÿ ÿ` j jMQ‹MËQPÿ8` _^°[‹å] ÌÌÌÌÌU‹ìSVWÿ4` ‹ðVjÿ(` Vjhÿÿ ÿ` ‹u‹ø…öta‹ ` EPj@h4  VWÿÓ…Àu EPÿuh4  VWÿÓWÿ0` _^2À[] j h4  h€d VWÿ8` …ÀtEPÿuh4  VWÿÓ_^°[] ÌÌÌÌÌÌÌÌU‹ìƒìVWÇEô    ÿ4` ‹ðVjÿ(` Vjhÿÿ ÿ` ‹5 ` ‹øEüPjjhP¢E WÿÖj jEøPhP¢E Wÿ` j ÿuüjhP¢E WÿÖWÿ0` ‹Eø…À…¸   ‹}3öÇG   ‰Gˆ8    tNŠF„Àuù+ñƒþþvh„f ÿd` ‹G;Æsÿw‹ÏVè~  …ötcƒr,‹ë*…öuò‰wƒør‹Æ  ‹Ç_^‹å] ‹Ç_^Æ  ‹å] ‹Ç…ötVj PèO(  ƒÄƒ‰wr‹Æ0 ‹Ç_^‹å] ‹ÇÆ0 ‹Ç_^‹å] ™3Â+Â=£ü+‘  „s  =Xÿ" à   „¥   =s£  \tB=Ü   t#=P  …“  ‹Mhäb èŽ  ‹E_^‹å] ‹Mh¸c èv  ‹E_^‹å] ‹Mhlb è^  ‹E_^‹å] =s t#=k_ …9  ‹Mhpc è4  ‹E_^‹å] ‹MhTc è  ‹E_^‹å] ‹Mhc è  ‹E_^‹å] =c\tB=ô“E t#=jj…Ö  ‹Mh¨b èÑ  ‹E_^‹å] ‹Mh€c è¹  ‹E_^‹å] ‹Mhpb è¡  ‹E_^‹å] = 0t#=wpÿ$…|  ‹Mh¸b èw  ‹E_^‹å] ‹MhŒb è_  ‹E_^‹å] ‹Mh c èG  ‹E_^‹å] =   _à   „¥   =¢rû>\tB= s²/t#= 6…  ‹MhÈb è  ‹E_^‹å] ‹MhHd èë  ‹E_^‹å] ‹Mhðc èÓ  ‹E_^‹å] =úÿÆEt#=øPG…®   ‹Mhd è©  ‹E_^‹å] ‹MhLb è‘  ‹E_^‹å] ‹Mhœc èy  ‹E_^‹å] =ª¥ÿrXt>=¡ dt=U‹ìjuO‹Mh(d èJ  ‹E_^‹å] ‹Mh8c è2  ‹E_^‹å] ‹MhÔc è  ‹E_^‹å] =ƒùtt‹MhÜa èû  ‹E_^‹å] ‹Mhdd èã  ‹E_^‹å] ÌÌÌÌÌÌÌÌU‹ìjÿh°R d¡    Pì   ¡ € 3ʼnEìSVWPEôd£    ÇEÐ    jh¸e ÇEü   ÿu4ÇEÈ    QM$èš  ‹ä` …Àu EÔPèWûÿÿPM$è¾  ƒ}èrÿuÔÿÓƒÄ3ÿ¾ € ë¤$    ƒ}8E$ÿu4CE$PÿvQ‹ÎèF  …ÀtƒÆ`Gþ`ˆ |Ö3ÿéq  ÄþÿÿÇ…\þÿÿg Ç…lþÿÿPg ÿˆ` j …tþÿÿÆEüP\þÿÿÇEÐ   ÿ„` ÇEü   ‹…\þÿÿ‹@Ç„\þÿÿg ‹…\þÿÿ‹HA˜‰„Xþÿÿtþÿÿÿ€` Ç…tþÿÿ°f Ç…¬þÿÿ    Ç…°þÿÿ    <ÆEüÁçlþÿÿ—8€ è\  ‹5l` E¼j PÿÖ‹\þÿÿÿp‹I‹ Œ\þÿÿQÿЃÄEÌ\þÿÿPÿœ` tÿÿÿÇ…ÿÿÿg Ç…ÿÿÿPg ÿˆ` j …$ÿÿÿÆEüPÿÿÿÇEÐ   ÿ„` ÇEü   ‹…ÿÿÿ‹@Ç„ÿÿÿg ‹…ÿÿÿ‹HA˜‰„ÿÿÿ$ÿÿÿÿ€` Ç…$ÿÿÿ°f Ç…\ÿÿÿ    Ç…`ÿÿÿ    ÆEü	—P€ ÿÿÿèv  E¼j PÿÖ‹ÿÿÿÿp‹I‹ ŒÿÿÿQÿЃÄEÄÿÿÿPÿœ` ƒ¿|€ ‡h€ r‹ Pÿ8a ‹UÄMԃċø‰}Èè÷ÿÿƒ}èrÿuÔÿÓƒÄÆEü‹…ÿÿÿ‹@Ç„ÿÿÿg ‹…ÿÿÿ‹HA˜‰„ÿÿÿö…`ÿÿÿÇ…$ÿÿÿ°f t‹…0ÿÿÿÿ0ÿÓƒÄj j j $ÿÿÿÿ”` ‹…4ÿÿÿ$ÿÿÿÇ     ‹…DÿÿÿÇ     ‹…TÿÿÿÇ     ƒ¥`ÿÿÿþÇ…\ÿÿÿ    ÿÌ` ,ÿÿÿÿ˜` tÿÿÿÿ¤` ÆEü‹…\þÿÿ‹@Ç„\þÿÿg ‹…\þÿÿ‹HA˜‰„Xþÿÿö…°þÿÿÇ…tþÿÿ°f t‹…€þÿÿÿ0ÿÓƒÄj j j tþÿÿÿ”` ‹…„þÿÿtþÿÿÇ     ‹…”þÿÿÇ     ‹…¤þÿÿÇ     ƒ¥°þÿÿþÇ…¬þÿÿ    ÿÌ` |þÿÿÿ˜` Äþÿÿÿ¤` ÿuÄèæöÿÿ„À„Á   ÿ4` ‹ðVjÿ(` Vjhÿÿ ÿ` ‹ð3Û‰uÐ…ÿ~o‹M̃} ECEPQèÎõÿÿ„À„Ï   ‹}Ì‹EƒÇd‰EÀÿ4` ‹ðVjÿ(` Vjhÿÿ ÿ` j jMÀQWPÿ8` …Àt‹MÌCƒÁp‰MÌ;]È|˜‹uÐVÿ0` ³ëÿuÐÿ0` j hÀe hÜe j ÿXa 2Ûƒ} ‹5ä` rÿuÿփă}8ÇE    ÇE    ÆE rÿu$ÿփĊËMôd‰    Y_^[‹Mì3Íè­  ‹å]Â4 ÿuÐÿ0` j hÀe hÐe ë‹‹VqhN°‹@ÇD0˜g ‹F˜‹PB˜‰D2”èJ  N¸ÿ˜` ‹Î^ÿ%¤` ÌÌÌÌÌÌÌÌU‹ìjÿhhS d¡    PƒìSVW¡ € 3ÅPEôd£    ‹Ù‰]ÜÇEØ    ¸-   ÇEü    Mèf‰EèÇEä    QŠA„Àuù+ʉMà„Î   ‹U}‹]u‹MEƒúCûùƒúCóñƒúCÉEì‹EäŠLèˆMó€ù€|Z€ùU‹Uì‹Æ+ÂP¶ÁPRÿ<a ‹ÈƒÄ…É‹ÆEÁ;Æt*H3Ò‹Þ+Ù;ÎGÚ‰]ì…Ût‹óŠ}óŠ:ßtˆ@BA;Öuñ‹U‹]ë‹ÆƒúuCó…Àu3Éë‹È+Î…ÿt+øWQMè’  ‹Eä@‰Eä;Eà‚5ÿÿÿ‹]ÜÇC   ÇC    Æ ‹Uƒús‹E@tPEPSÿ@a ‹UƒÄë‹M‰‹M‹Ã‰K‰S‹Môd‰    Y_^[‹å]ÃÌÌÌÌÌÌÌÌÌÌU‹ìƒì$¡ € 3ʼnEüSVW3Û¡dŽ ƒì‹ÌÃjÿj ÇA   ÇA    PÆ è  Mäè,þÿÿ‹5dŽ ‹øóƒÄ;÷tcƒ~rÿ6ÿä` ƒÄÇF   ÇF    Æ ƒs‹G@tPWVÿ@a ƒÄë‹‰Ç    ‹G‰F‹G‰FÇG   ÇG    Æ ƒ}ørÿuäÿä` ƒÄƒÃƒû`‚?ÿÿÿ‹Mü_^3Í[èÝ  ‹å]ÃÌÌÌÌÌÌÌÌÌU‹ììL  ¡ € 3ʼnEüSVWÿ4` Pjÿ(` ‹øƒÿÿt#…¸ýÿÿÇ…¸ýÿÿ$  PWÿ` …ÀuWÿ0` 3À_^[‹Mü3Íèr  ‹å]Ëä` ë›    €½Øýÿÿ ÇEø   ÇEô    ÆEä u3ÉëØýÿÿQŠA„Àuù+ÊQ…ØýÿÿPMäè¯  3ö¡dŽ ƃx‹Hr‹ QQPMäè   ƒøÿuIƒÆƒþ`rÖƒ}ørÿuäÿӃą¸ýÿÿPWÿ,` …À…oÿÿÿWÿ0` ‹Mü¸   _^3Í[è¶  ‹å]Ãj ÿ ` ÌÌÌÌÌÌÌÌÌÌU‹ìƒäøjÿh˜S d¡    PƒìV¡ € 3ÄPD$d£    ÿ4` ‹ðVjÿ(` Vjhÿÿ ÿ` ƒì‹Ì‰d$$jÇA   ÇA    h¸e Æ èÁ  ƒìÇD$P    ‹ôƒì‹Ìj!ÇA   ÇA    h`f Æ è’  ‹Îè«ûÿÿƒÄÇD$Pÿÿÿÿh  èæõÿÿè!ýÿÿ‹5` èþÿÿjdÿÖëõVWj j j hÀ2 j j ÿ<` ‹ðjþVÿ` h(b h@b ÿ$` Pÿ` ‹ø…ÿtj j j…öuÿ` Pÿ×_^ÃVÿ×_^ÃÌÌÌÌÌU‹ì‹EÆ`Ž  Htƒèt¸   ] Æ`Ž èvÿÿÿ¸   ] ÌÌÌÌÌÌÌÌÌÌÌÌÌU‹ìV‹ñ‹MÇF   ÇF    Æ €9 u3ÒRQ‹Îè–  ‹Æ^] ‹ÑWzŠB„Àuù+×_RQ‹Îèv  ‹Æ^] ÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌU‹ìVW‹}‹ñ;÷tcƒ~rÿ6ÿä` ƒÄÇF   ÇF    Æ ƒs‹G@tPWVÿ@a ƒÄë‹‰Ç    ‹G‰F‹G‰FÇG   ÇG    Æ _‹Æ^] ÌÌÌÌÌÌÌV‹ñƒ~rÿ6ÿä` ƒÄÇF   ÇF    Æ ^ÃÌÌÌÌÌÌÌÌÌV‹ñöF<Ç°f t‹Fÿ0ÿä` ƒÄ‹F‹ÎÇ     ‹FÇ     ‹F,Ç     ‹FÇ     ‹F Ç     ‹F0Ç     ƒf<þÇF8    ^ÿ%Ì` ÌÌÌÌÌÌÌÌÌU‹ìƒìV‹ñ‹F<¨tƒÈÿ^‹å] S‹]ƒûÿu[3À^‹å] W¨t#‹F ‹…Òt‹~8;×s‹F0‹‹F Ê+ω8‹F0‰‹F ‹…Òt$‹N0‹	Ê;Ñs‹ÎÿŒ` _ˆ‹Ã[^‹å] …Òu3ÿë‹F0‹N‹8+9ú‹ÏÑéƒù s¹    ë…Ét¸ÿÿÿ+Á;ÇsÑéuñ…Éu_[ƒÈÿ^‹å] 93Û‰Eø…ÀtƒøÿwPÿè` ‹ØƒÄ…Ûuÿ` ‹F‹‰Mü…ÿtWQSèÆ  ‹MüƒÄ…ÿu@‹F‹Uø‹}ü‰^8‰‹F ‰‹F0‰‹FöF<‰‹FtÇ     ‹F,‰ëu‰‹F,Ç    ëh‹}ü‹Ã+ÁF8‹F ‹‹Ã+Ñ+Ç‹NÓ‹Ë‹F +ÊMø‰‹F0‰öF<t‹F‰‹FÇ     ‹F,‰ë ‹F ‹‹F‹‹F+ÏË+ÑB‰‹F‰‹F,‰öF<tWÿä` ƒÄƒN<‹ÎÿŒ` ‹M_[ˆ‹Á^‹å] ÌÌU‹ì‹ÑV‹B‹0…öt@‹B;0v9‹Mƒùÿt:NÿtöB<u&‹B,ÿ ‹Bÿƒùÿt‹B^‹ ˆ‹Á] 3É‹Á^] ƒÈÿ^] ÌÌÌÌÌÌÌÌÌV‹q‹…ÒuƒÈÿ^ÃW‹y,‹Â;Ðs¶_^ÃöA<u,‹A ‹ …Àt#;Âw9Q8v9A8s‰A8‹A8+‰‹A_^‹ ¶ Ã_ƒÈÿ^ÃÌÌÌÌÌÌÌU‹ìQS‹ÙVW‹S ‹…Àt9C8s‰C8‹MöÁ„Ð   ‹C‹0‰uü…ö„À   ‹Eƒøu‹K‹C8‹u‹}+™ðúë5ƒøuöÁu‹K‹Æ‹u‹}+™ðúë…Àt‹=Ð` ‹7‹ë‹}‹u…ÿŒ  …ö‚÷   ‹C‹‹C8+Á™;úä   |;ð‡Ú   ‹C,+MüÎ)‹CöE„Ë   ‹S ƒ: „¿   ‹C0‹‹C‹ +ȉ‹C0‰é¥   öÁ„†   ‹‰U…Òt}‹Eƒøu‹K‹C8‹u‹}+™ðúë0ƒøu‹K‹Â‹u‹}+™ðúë…Àt‹=Ð` ‹7‹ë‹}‹u…ÿ|8…ör2‹C‹‹C8+Á™;ú#|;ðw‹C0+MÎ)‹C ë‹u‹Æ‹}Çt¡Ð` ‹0‹x‹E‰x_‰0^Ç@    Ç@    Ç@    [‹å] ÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌU‹ìƒäøƒìS‹]V‹uuW]‹ù‹G ‹ …Àt9G8s‰G8¡Ð` ‹‹@‰L$‰D$;ñu;Ø„º   ‹U$öÂto‹G‹ ‰D$…Àt^…Û|T…örN‹G‹‹G8+Á™;Ú;|;ðw5‹G,+L$Î)‹GöE$tp‹W ƒ: th‹G0‹‹G‹ +ȉ‹G0‰ëQ‹L$‹\$ëE‹D$öÂt:‹W ƒ: t2…Û|å…örß‹G‹‹G8+Á™;ÚÌ|;ðwÆ‹G +‹G0Î)‹G ë‹Ø‹ñ‹E_‰0^‰XÇ@    Ç@    Ç@    [‹å]  ÌÌÌÌÌÌÌU‹ì‹A˜VWy˜‹@OÇ8g ‹‹PB˜‰üèÇùÿÿO ÿ˜` Ohÿ¤` öEtWÿä` ƒÄ‹Ç_^] ÌÌÌÌÌÌÌÌÌÌÌÌÌU‹ìV‹ñè…ùÿÿöEtVÿä` ƒÄ‹Æ^] ÌÌÌÌÌÌÌÌÌÌÌÌÌÌU‹ìS‹]VW‹ñ‹M‹{;ùsh”f ÿ`` +ù9}B};óuN9Fsh”f ÿ`` ƒ~‰Fr‹Qj ‹ÎÆ è‡   _‹Æ^[] ‹ÖQj ‹ÎÆ èn   _‹Æ^[] QW‹Îèœ  „ÀtFƒ{r‹ƒ~r‹ë‹Î…ÿt‹EWÃPQèé  ƒÄƒ~‰~r‹Æ8 ‹Æ_^[] ‹ÆÆ8 _‹Æ^[] ÌÌÌÌÌÌÌÌÌU‹ìV‹ñ‹MW‹~;ùsh”f ÿ`` ‹U‹Ç+Á;Âw#ƒ~‰Nr‹_Æ ‹Æ^] ‹Æ_^Æ ] …ÒtEƒ~r‹ë‹Æ+úS‹Ç+ÁtPPSÿ@a ƒÄƒ~‰~[r‹Æ8 ‹Æ_^] ‹ÆÆ8 _‹Æ^] ÌÌÌÌÌU‹ìƒì‹U‰Mø…Òu3À‹å] SVW‹y…ÿ„µ   ;ׇ­   ¸   +Âøƒyr‹	‰Mü…ÿ„‘   ‹uW¾PQÿ<a ‹ØƒÄ…Ûty‹M‹Óƒérd$ ‹;uƒÂƒÆƒésïƒùüt=Š:u'ƒùýt2ŠB:Fuƒùþt%ŠB:FuƒùÿtŠB:Ft‹Mü+ËIùKé|ÿÿÿ‹Eøƒxr‹ _+Ø^‹Ã[‹å] _^ƒÈÿ[‹å] ÌÌÌÌÌÌÌÌÌU‹ìSW‹}9yByƒyr‹	‹];û‹ÓB×…Òt\V‹uƒêr‹ÿ‹;uƒÁƒÆƒêsïƒúüt4Š:u'ƒúýt)ŠA:FuƒúþtŠA:FuƒúÿtŠA:FtÀƒÈë3À^…Àu;ûs	_ƒÈÿ[] 3À;û•À_[] ÌÌÌÌÌU‹ìS‹]V‹ñ…ÛtW‹Nƒùr‹ë‹Æ;ØrEƒùr‹ë‹Ö‹FÂ;Ãv1ƒùrÿu‹‹Î+ØSVè§üÿÿ^[] ÿu‹Æ‹Î+ØSVè‘üÿÿ^[] W‹}ƒÿþvh„f ÿd` ‹F;Çsÿv‹ÎWèå   …ÿt_ƒ~r*‹ë(…ÿuò‰~ƒør‹_Æ  ‹Æ^[] ‹Æ_^[Æ  ] ‹Æ…ÿtWSPè¹  ƒÄƒ~‰~r‹Æ8 ‹Æ_^[] ‹ÆÆ8 _‹Æ^[] ÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌU‹ìV‹uƒþþvh„f ÿd` ‹A;ÆsÿqVè9   3À;Æ^À÷Ø] …öu‰qƒør‹	Æ 3À;Æ^À÷Ø] ÌÌÌÌÌÌÌÌÌÌÌÌÌÌU‹ìjÿhÀS d¡    PƒìSVW¡ € 3ÅPEôd£    ‰eð‹ñ‰uè‹E‹øƒÏƒÿþv‹øë'‹^¸«ªªª÷ç‹ËÑéÑê;Êv¸þÿÿÿ<+Á;Øv¿þÿÿÿOÇEü    3À‰Eì…ÉtEƒùÿwQÿè` ƒÄ‰Eì…Àu/ÿ` ‹E‰E@‰eðPÆEüèÕ   ‰Eì¸A ËEì‹uè‹}‰Eì‹]…ÛtIƒ~r2‹ë0‹uèƒ~rÿ6ÿä` ƒÄj ÇF   ÇF    j Æ è  ‹Î…ÛtSQPè	  ƒÄƒ~rÿ6ÿä` ƒÄ‹EìÆ ‰‰~‰^ƒÿr‹ðÆ ‹Môd‰    Y_^[‹å] ÌÌV‹ñÿh` „Àu‹ÿt` ‹^‹‹@‹L8…Ét‹ÿ`ÃÌÌÌÌÌU‹ì‹E3É…ÀtƒøÿwPÿè` ‹ÈƒÄ…Éuÿ` ‹Á] ÌÌÌ‹	‹‹@‹L8…Ét‹ÿ`ÃÌÌÌÌÌÌÌÌÌÌÌU‹ìjÿhðS d¡    Pƒì$SVW¡ € 3ÅPEôd£    ‰eð‰UÜ‹Ù‰]è‹3ÿ‹R‰}ä‰Uì‹H‹D$‹t …À|…öt‰EÔ;òv‰EÔ+òë3ö‹L8‰]Ð…Ét‹ÿPÇEü    ‹‹@ƒ| u‹L<…Ét;Ëtÿ|` ‹‹Hƒ| ”ÀˆEÔÇEü   „Àu¿   é×   ÆEü‹D%À  ƒø@t,…öt$‹‹HŠD@‹L8ˆEàÿuàÿx` ƒøÿuZƒÏ‰}ä…ÿu)‹M܃yr‹	‹j ÿuì‹@Q‹L8ÿp` ;Eìu1…Òu-…öt.‹‹HŠD@‹L8ˆEÜÿuÜÿx` ƒøÿuƒÏëNëNëÓ¿   ‹‹@ÇD     ÇD$    ë ‹Uèjj‹‹HÊÿ ` ¸¹C Ë]è‹}äÇEü   ‹j W‹HËÿ ` ÇEüÿÿÿÿÿh` ‹uЄÀu‹Îÿt` ‹‹@‹L08…Ét‹ÿP‹Ã‹Môd‰    Y_^[‹å]Ã+Iüé0÷ÿÿU‹ì]éc  Ìÿ%¨` ÿ%¬` ÿ%°` ÿ%´` ÿ%¸` ÿ%¼` ÿ%À` ÿ%Ä` ÿ%È` ; € uóÃéù  jh¨q èõ  ƒeä ‹]‹Ã‹}¯Ç‹uð‰uƒeü O‰}x+ó‰u‹ÎÿUëî3À@‰EäÇEüþÿÿÿè   èö   ‹}‹]‹u‹Eä…ÀuÿuWSVè   ÃjhÈq è†  ƒeü ÿMx:‹M+M‰MÿUëí‹Eì‰Eä‹Eä‹ ‰Eà‹Eà8csmàtÇEÜ    ‹EÜÃè:  ‹eèÇEüþÿÿÿè|   ƒ=€Ž  t3ÀÃVjj ÿø` YY‹ðVÿX` £€Ž £|Ž …öujX^Ã& 3À^Ãjhèq èì  ƒeÜ ÿ5€Ž ‹5H` ÿÖ‰Eäƒøÿuÿuÿ a Yëejè;  Yƒeü ÿ5€Ž ÿÖ‰Eäÿ5|Ž ÿÖ‰EàEàPEäPÿu‹5X` ÿÖPè  ƒÄ‹ø‰}ÜÿuäÿÖ£€Ž ÿuàÿÖ£|Ž ÇEüþÿÿÿè   ‹Çè¡  Ë}ÜjèÓ  YÃU‹ìÿuèLÿÿÿ÷ØYÀ÷ØH]Ãÿ%à` ÿ%ä` U‹ìöEV‹ñt%WhþK ~üÿ7jVèþÿÿöEtWèÏÿÿÿY‹Ç_ëè†  öEtVè¸ÿÿÿY‹Æ^] ÿ%è` Vh€   ÿa Y‹ðVÿX` £€Ž £|Ž …öu3À@^Ã& è*  hN èTÿÿÿÇ$:N èHÿÿÿY3À^ÃU‹ìQQƒ} SVW…)  ¡0‹ …ÀŽ  H»pŽ £0‹ 3ÿd¡   ‰}ü‹Pë;Ât3À‹Êð±…ÀuðëÇEü   ƒ=tŽ tjèÉ  Yé‚  ÿ5€Ž ÿH` ‹ð‰u…ö„š   ÿ5|Ž ÿH` ‹Ø‰u‰]ƒë;Þr\9;tõWÿX` 9têÿ3ÿH` W‹ðÿX` ‰ÿÖÿ5€Ž ‹5H` ÿÖÿ5|Ž ‰EøÿÖ‹Mø9Mu‹u9Et¬‹ñ‰M‰u‹Ø‰EëƒþÿtVÿa YWÿX` £|Ž »pŽ £€Ž ‰=tŽ 9}ü…À   3À‡é·   3Àé³   ƒ}…¦   d¡   3ÿ‹÷»pŽ ‹Pë;Ât3À‹Êð±…Àuðë3öF9=tŽ j_t	jè¬  ë5hˆa h|a ÇtŽ    è»  YY…Àu“hxa h`a è   Y‰=tŽ Y…öu3À‡ƒ=xŽ  thxŽ è¯  Y…ÀtÿuWÿuÿxŽ ÿ0‹ 3À@_^[‹å] U‹ìƒ}uèn  ÿuÿuÿuè   ƒÄ] jhr èl  3À@‹ð‰uä3Û‰]ü‹}‰=€ ‰Eü…ÿu9=0‹ „Ô   ;øtƒÿu8¡Ða …ÀtÿuWÿuÿЋð‰uä…ö„±   ÿuWÿuè}ýÿÿ‹ð‰uä…ö„˜   ÿuWÿuèvêÿÿ‹ð‰uäƒÿu.…öu*ÿuSÿuè\êÿÿÿuSÿuè>ýÿÿ¡Ða …Àt	ÿuSÿuÿÐ…ÿtƒÿuKÿuWÿuèýÿÿ÷ØÀ#ð‰uät4¡Ða …Àt+ÿuWÿuÿЋðë‹Mì‹‹ ‰EàQPè  YYËeè3Û‹ó‰uä‰]üÇEüþÿÿÿè   ‹Æè™  ËuäÇ€ ÿÿÿÿÃU‹ìÿL` j£TŽ è  ÿuè  ƒ=TŽ  YYujèì  Yh	 Àèí  Y]ÃU‹ìì$  jèì  …ÀtjYÍ)£8Œ ‰4Œ ‰0Œ ‰,Œ ‰5(Œ ‰=$Œ fŒPŒ fŒDŒ fŒ Œ fŒŒ fŒ%Œ fŒ-Œ œHŒ ‹E £<Œ ‹E£@Œ E£LŒ ‹…ÜüÿÿLj‹   ¡@Œ £D‹ Ç8‹ 	 ÀÇ<‹    ÇH‹    jXkÀ Ç€L‹    jXkÀ ‹ € ‰LøjXÁà ‹€ ‰LøhÔa èÌþÿÿ‹å]ÃÌÿ%ì` ÌÌÌÌÌÌhÉK dÿ5    ‹D$‰l$l$+àSVW¡ € 1Eü3ÅP‰eèÿuø‹EüÇEüþÿÿÿ‰EøEðd£    ËMðd‰    Y__^[‹å]QÃU‹ìÿuÿuÿuÿuh`D h € èq  ƒÄ]Ãÿ%ð` ÿ%ô` ÿ%ü` ÿ%a ÿ%a ÿ%a U‹ì‹E3ÒSVW‹H<È·A·YƒÀÁ…Ût‹}‹p;þr	‹HÎ;ùrBƒÀ(;Órè3À_^[]ÃÌÌÌÌÌÌÌÌÌÌÌÌÌU‹ìjþh0r hÉK d¡    PƒìSVW¡ € 1Eø3ÅPEðd£    ‰eèÇEü    h   è|   ƒÄ…ÀtT‹E-   Ph   èRÿÿÿƒÄ…Àt:‹@$Áè÷ЃàÇEüþÿÿÿ‹Mðd‰    Y_^[‹å]ËEì‹ 3É8  À”Á‹ÁËeèÇEüþÿÿÿ3À‹Mðd‰    Y_^[‹å]ÃÌÌÌÌÌÌU‹ì‹E¹MZ  f9t3À]ËH<È3À9PE  uº  f9Q”À]ÃU‹ìƒìƒeô ƒeø ¡ € VW¿Næ@»¾  ÿÿ;Çt…Æt	÷У€ ëfEôPÿ@` ‹Eø3Eô‰EüÿD` 1Eüÿ4` 1EüEìPÿT` ‹MðEü3Mì3Mü3È;Ïu¹Oæ@»ë…Îu‹ÁG  Áàȉ € ÷щ€ _^‹å]ÃVW¾´l ¿´l ë‹…ÀtÿЃÆ;÷rñ_^ÃVW¾¼l ¿¼l ë‹…ÀtÿЃÆ;÷rñ_^ÃÌÿ%a ÿ%a hXŽ è   YÃÿ% a ÿ%$a ÿ%(a ÿ%,a ÿ%0a ÿ%P` ÿ%La ÿ%Ha ÿ%Pa ÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌ̹ € évæÿÿ¹8€ élæÿÿ¹P€ ébæÿÿ¹h€ éXæÿÿ¹€€ éNæÿÿ¹˜€ éDæÿÿ¹°€ é:æÿÿ¹È€ é0æÿÿ¹à€ é&æÿÿ¹ø€ éæÿÿ¹ éæÿÿ¹( éæÿÿ¹@ éþåÿÿ¹X éôåÿÿ¹p éêåÿÿ¹ˆ éàåÿÿ¹  éÖåÿÿ¹¸ éÌåÿÿ¹Ð éÂåÿÿ¹è é¸åÿÿ¹ ‚ é®åÿÿ¹‚ é¤åÿÿ¹0‚ éšåÿÿ¹H‚ éåÿÿ¹`‚ é†åÿÿ¹x‚ é|åÿÿ¹‚ éråÿÿ¹¨‚ éhåÿÿ¹À‚ é^åÿÿ¹Ø‚ éTåÿÿ¹ð‚ éJåÿÿ¹ƒ é@åÿÿ¹ ƒ é6åÿÿ¹8ƒ é,åÿÿ¹Pƒ é"åÿÿ¹hƒ éåÿÿ¹€ƒ éåÿÿ¹˜ƒ éåÿÿ¹°ƒ éúäÿÿ¹Èƒ éðäÿÿ¹àƒ éæäÿÿ¹øƒ éÜäÿÿ¹„ éÒäÿÿ¹(„ éÈäÿÿ¹@„ é¾äÿÿ¹X„ é´äÿÿ¹p„ éªäÿÿ¹ˆ„ é äÿÿ¹ „ é–äÿÿ¹¸„ éŒäÿÿ¹Ð„ é‚äÿÿ¹è„ éxäÿÿ¹ … énäÿÿ¹… édäÿÿ¹0… éZäÿÿ¹H… éPäÿÿ¹`… éFäÿÿ¹x… é<äÿÿ¹… é2äÿÿ¹¨… é(äÿÿ¹À… éäÿÿ¹Ø… éäÿÿ¹ð… éäÿÿ¹† é äÿÿ¹ † éöãÿÿ¹8† éìãÿÿ¹P† éâãÿÿ¹h† éØãÿÿ¹€† éÎãÿÿ¹˜† éÄãÿÿ¹°† éºãÿÿ¹È† é°ãÿÿ¹à† é¦ãÿÿ¹ø† éœãÿÿ¹‡ é’ãÿÿ¹(‡ éˆãÿÿ¹@‡ é~ãÿÿ¹X‡ étãÿÿ¹p‡ éjãÿÿ¹ˆ‡ é`ãÿÿ¹ ‡ éVãÿÿ¹¸‡ éLãÿÿ¹Ð‡ éBãÿÿ¹è‡ é8ãÿÿ¹ ˆ é.ãÿÿ¹ˆ é$ãÿÿ¹0ˆ éãÿÿ‹T$B‹Jð3ÈèYòÿÿ¸Àl é_üÿÿÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌM$éèâÿÿMéàâÿÿ‹EÐƒà„   ƒeÐþÄþÿÿÿ%¤` Ã|þÿÿÿ%˜` ‹Xþÿÿÿ%Ì` \þÿÿé`Üÿÿ‹EÐƒà„   ƒeÐýtÿÿÿÿ%¤` Ã,ÿÿÿÿ%˜` ‹Tþÿÿÿ%Ì` ÿÿÿé Üÿÿ‹T$B‹ŠPþÿÿ3Èèœñÿÿ‹Jø3Èè’ñÿÿ¸ o é˜ûÿÿÌÌÌÌÌÌÌÌ‹EìPÿ4a YËEðƒà„   ƒeðþ‹MìƒÁé	âÿÿËEðƒà„   ƒeðý‹MìƒÁéíáÿÿËEðƒà„   ƒeðû‹MìƒÁ4éÑáÿÿËT$B‹Jì3Èèñÿÿ¸p éûÿÿÌÌÌÌÌMé¨áÿÿ‹T$B‹JÔ3Èèçðÿÿ¸\p éíúÿÿÌÌÌÌÌÌÌÌÌÌÌÌÌ‹Mèéxáÿÿ‹T$Bì‹Jè3Èè·ðÿÿ¸ˆp é½úÿÿÌÌÌÌÌÌÌÌÌÌÌÌÌ‹T$B‹Jä3Èèðÿÿ¸´p é•úÿÿÌÌÌÌÌMÐé(îÿÿMÐéÀíÿÿ‹T$B‹JÌ3Èè_ðÿÿ¸@q éeúÿÿÌÌÌÌÌh5 jXjh € èLðÿÿÃÌÌÌÌÌÌÌÌÌÌÌÌÇ€ \g ÃÌÌÌÌÌÇ`ˆ \g ÃÌÌÌÌÌÇ€ \g à                                                                                                                                                                                                                                                                                                                                                                                                                                     dt  rt  †t  ”t  œt  °t  Ät  Ôt  æt  út  u  *u  :u  Hu  ^u  tu  Ü~  Æ~  l~  |~  ~  ¬~  \~      v  <v  \v  ~v  ¦v  ìv  *w  jw  ¬w  èw  Rx  ˆx  v  Êx  y  Hy  Šy  Êy   z  Lz  Šz  Ôz  {  `{   {  ä{  &|  f|  ìu  Ìu  ¬u      è|  ô|  }  "}  6}  >}  H}  V}  d}  n}  †}  ˜}  ¦}  ®}  ¼}  È}  Ö}  ì}  ~  ~  8~  Ø|  Ð|  Æ|  ¼|  °|    ö~  "      ’u            `      °          ’F <E             Þ/Y       L   Àg  ÀQ      Þ/Y          h  R   h BF     8‹ ˆ‹     generic unknown error   iostream    iostream stream error   system  %d  NtSetInformationThread  ntdll.dll   871 0x7C0C28    0x5B8980    10  870 862 0x7B7620    0x5B2980    861 0x789458    0x5B0980    860 0x7947F8    857 0x7947F0    855 0x791D20    0x5B7610    854 0x78A728    0x5B2610    852 0x787E30    0x5B1610    850 0x786E70    0x5B0610    842 0x785D30    0x5AF610    841 0x780CD0    0x5AB610    840 0x77FC48    830 0x77AD88    0x5AA610    822 0x776CF0    0x5A7610    821 0x774CF0    0x5A5610    820 0x771CF0    0x5A3610    810 0x763BB8    0x597610    800 0x593610    0x75EAE8    792 0x755E18    0x58D620    5   780 0x746710    0x582620    760 0x5EFB50    0x000000    85479466557364910961333345737396640246270564315543144852031277841748439065781221833098023523690843397366660313364287042189065294937373763545871563988300348960393970772528253318425929673380107357686531216696197206280828833541524674628817462988624308724781959941933548351307053290668668836005235181508413577661    Auto    otPokemon.com   Error (11)  Error (12)  w-o-o-k-a-s-h-.-d-l-l   -t-i-b-i-a-_-u-n-b-i-n-d-e-r-_-8-5-4-.-d-l-l    -e-l-f-b-o-t-.-d-l-l    -e-l-f-l-o-a-d-.-d-l-l  i-p-1-.-o-t-p-o-k-e-m-o-n-.-c-o-m   string too long invalid string position „h °; ZD TD °5 7 ND ð7 HD BD <D P8  : 6D 0D *D ´i À  p! €! ð  P! ! ¤j D     h   Œk À  `" p" ð" P! ! Xj À   " " ð  P! !     X   <j À  6F 6F ð  P! !     Hl    RSDSœû3†1ªàL¾"ÓçNÁñ   \git\otPokemon-Tools\antibot\Release\graphics.pdb                               hˆ 4h            Dh Lh     hˆ         ÿÿÿÿ    @   4h HŠ        ÿÿÿÿ    @   j             ø‰ l            Pj            Àj ðŠ         ÿÿÿÿ    @   ˜h            ¸j À‰               P   |k            ,i ‰        ÿÿÿÿ    @   ôj lj äh ˆi  k     Àˆ 	       ÿÿÿÿ    @   äi dŠ         ÿÿÿÿ    @   Ôh            ¤i L‰               @   ¨h k ôi \i                 ˆŠ @l HŠ         ÿÿÿÿ    @   j           ¼k ˆŠ        ÿÿÿÿ    @   @l            0k h‰        ÿÿÿÿ    @    k             dŠ Ôh ¸h                 h‰  k ´Š        ÿÿÿÿ    @    i ´Š       ÿÿÿÿ    @    i     h      Àˆ äi \i     l hh     À‰        ÿÿÿÿ    @   |k dl ¸h                Pl ”‰        ÿÿÿÿ    @   xi            €l Èi     `k i äh ˆi  k ˆj äh ˆi  k     €ˆ        ÿÿÿÿ    @   ôk            0l             ”‰ xi HŠ               @   j @i `k i äh ˆi  k ˆj äh ˆi  k     ôi \i            	   8k            èj L‰        ÿÿÿÿ    @   ¨h Ìj l hh                èk i äh ˆi  k     ø‰        ÿÿÿÿ    @   l  j ôi \i     ÉK  öQ  °R  @S  hS  ˜S  ÀS  ðS                  "W   èl                            ÿÿÿÿN     šN    ¤N    ®N    ¸N    ÂN    ÌN    ÖN    àN    êN 	   ôN    þN    O    O    O    &O    0O    :O    DO    NO    XO    bO    lO    vOO    ŠOO    žO    ¨O    ²O    ¼O    ÆO    ÐO     ÚO !   äO "   îO #   øO $   P %   P &   P '    P (   *P )   4P *   >P +   HP ,   RP -   \P .   fP /   pP 0   zP 1   „P 2   ŽP 3   ˜P 4   ¢P 5   ¬P 6   ¶P 7   ÀP 8   ÊP 9   ÔP :   ÞP ;   èP <   òP =   üP >   Q ?   Q @   Q A   $Q B   .Q C   8Q D   BQ E   LQ F   VQ G   `Q H   jQ I   tQ J   ~Q K   ˆQ L   ’Q M   œQ N   ¦Q O   °Q P   ºQ Q   ÄQ R   ÎQ S   ØQ T   âQ U   ìQ "“   Èo                            ÿÿÿÿ R     (R    0R    MR    YR    eR    pR    R    ™R    ¥R "“   <p                        ÿÿÿÿàR     ìR    S    $S "“   €p                        ÿÿÿÿ`S "“   ¬p                        ÿÿÿÿS "“   Øp    øp                ÿÿÿÿ    ÿÿÿÿ                               q               0q @           1A @           ÷@ "“   dq    „q                ÿÿÿÿàS ÿÿÿÿèS                           ˜q @           ŸC þÿÿÿ    Ôÿÿÿ    þÿÿÿ    ÂD     þÿÿÿ    Ìÿÿÿ    þÿÿÿE *E     þÿÿÿ    Ìÿÿÿ    þÿÿÿ    F     þÿÿÿ    Ðÿÿÿ    þÿÿÿ    J     èI üI þÿÿÿ    Øÿÿÿ    þÿÿÿéL üL         Ý/Y    ‚r           xr  |r  €r  3  r    graphics.dll InjectKontrol    s          „u   `  \t           u  Xa  ds          ¢|  ``  äs          }  à`                      dt  rt  †t  ”t  œt  °t  Ät  Ôt  æt  út  u  *u  :u  Hu  ^u  tu  Ü~  Æ~  l~  |~  ~  ¬~  \~      v  <v  \v  ~v  ¦v  ìv  *w  jw  ¬w  èw  Rx  ˆx  v  Êx  y  Hy  Šy  Êy   z  Lz  Šz  Ôz  {  `{   {  ä{  &|  f|  ìu  Ìu  ¬u      è|  ô|  }  "}  6}  >}  H}  V}  d}  n}  †}  ˜}  ¦}  ®}  ¼}  È}  Ö}  ì}  ~  ~  8~  Ø|  Ð|  Æ|  ¼|  °|    ö~  "      ’u      QExitProcess GetCurrentThread  îOpenProcess RSleep SReadProcessMemory 5SetThreadPriority ÄModule32First GetProcAddress  ¢VirtualProtectEx  dGetModuleHandleA  ñ CreateToolhelp32Snapshot  ÆModule32Next   CloseHandle GetCurrentProcessId êWriteProcessMemory  è CreateThread  KERNEL32.dll  FMessageBoxA USER32.dll  Å?_Winerror_map@std@@YAPBDH@Z  °?_Syserror_map@std@@YAPBDH@Z  §?_BADOFF@std@@3_JB  É?_Xbad_alloc@std@@YAXXZ Í?_Xout_of_range@std@@YAXPBD@Z Ì?_Xlength_error@std@@YAXPBD@Z C?uncaught_exception@std@@YA_NXZ Õ?setbase@std@@YA?AU?$_Smanip@H@1@H@Z  ?sputn@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAE_JPBD_J@Z  v?_Osfx@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEXXZ  ÿ?sputc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHD@Z Ž?flush@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV12@XZ * ??0?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAE@XZ   ??0?$basic_iostream@DU?$char_traits@D@std@@@std@@QAE@PAV?$basic_streambuf@DU?$char_traits@D@std@@@1@@Z   ??0?$basic_ios@DU?$char_traits@D@std@@@std@@IAE@XZ  |?_Pninc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEPADXZ Û?setg@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEXPAD00@Z  ~ ??1?$basic_iostream@DU?$char_traits@D@std@@@std@@UAE@XZ Ë ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@AAH@Z  æ?setstate@?$basic_ios@DU?$char_traits@D@std@@@std@@QAEXH_N@Z  { ??1?$basic_ios@DU?$char_traits@D@std@@@std@@UAE@XZ  ?imbue@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MAEXABVlocale@2@@Z  !?sync@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MAEHXZ Ö?setbuf@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MAEPAV12@PAD_J@Z n?xsputn@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MAE_JPBD_J@Z k?xsgetn@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MAE_JPAD_J@Z @?uflow@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MAEHXZ  ö?showmanyc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MAE_JXZ ¿?_Unlock@?$basic_streambuf@DU?$char_traits@D@std@@@std@@UAEXXZ  X?_Lock@?$basic_streambuf@DU?$char_traits@D@std@@@std@@UAEXXZ  ‡ ??1?$basic_streambuf@DU?$char_traits@D@std@@@std@@UAE@XZ  MSVCP120.dll  (sprintf_s èmemmove ämemchr  ïatoi  ‰ ??_V@YAXPAX@Z I_purecall r ??3@YAXPAX@Z  p ??2@YAPAXI@Z  MSVCR120.dll  5?terminate@@YAXXZ ”_lock _unlock ._calloc_crt ®__dllonexit :_onexit o ??1type_info@@UAE@XZ  o__CppXcptFilter _amsg_exit  ƒfree  ¥_malloc_crt _initterm _initterm_e P_crt_debugger_hook  ¬__crtUnhandledException «__crtTerminateProcess z_except_handler4_common Œ__clean_type_info_names_internal  !EncodePointer þ DecodePointer gIsDebuggerPresent mIsProcessorFeaturePresent -QueryPerformanceCounter GetCurrentThreadId  ÖGetSystemTimeAsFileTime X_CxxThrowException  t__CxxFrameHandler3  æmemcpy                                                                                                                                                                                                                      Næ@»±¿D        ÿÿÿÿg ðf                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    8g     Ìa     .?AVtype_info@@ Ìa     .?AV?$basic_iostream@DU?$char_traits@D@std@@@std@@      Ìa     .?AV?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ Ìa     .?AV?$basic_istream@DU?$char_traits@D@std@@@std@@   Ìa     .?AVios_base@std@@  Ìa     .?AV_Iostream_error_category@std@@  Ìa     .?AV_System_error_category@std@@    Ìa     .?AV?$basic_ios@DU?$char_traits@D@std@@@std@@   Ìa     .?AV?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@    Ìa     .?AV?$_Iosb@H@std@@ Ìa     .?AVerror_category@std@@    Ìa     .?AV_Generic_error_category@std@@   Ìa     .?AV?$basic_ostream@DU?$char_traits@D@std@@@std@@   Ìa     .?AV?$basic_streambuf@DU?$char_traits@D@std@@@std@@                                                                                                                                                                                                                                          €   8  €                  P  €                  h  €               	  €                  	        Ð          p“  }          Ð4   V S _ V E R S I O N _ I N F O     ½ïþ               ?                        0   S t r i n g F i l e I n f o      0 4 0 9 0 4 b 0   <   C o m p a n y N a m e     o t P o k e m o n . c o m   T   F i l e D e s c r i p t i o n     G r a p h i c s   i m p r o v e m e n t s   0   F i l e V e r s i o n     1 . 0 . 0 . 1   :   I n t e r n a l N a m e   g r a p h i c s . d l l     J   L e g a l C o p y r i g h t   C o p y r i g h t   ( C )   2 0 1 7     B   O r i g i n a l F i l e n a m e   g r a p h i c s . d l l     4   P r o d u c t N a m e     o t P o k e m o n   4   P r o d u c t V e r s i o n   1 . 0 . 0 . 1   D    V a r F i l e I n f o     $    T r a n s l a t i o n     	°<?xml version='1.0' encoding='UTF-8' standalone='yes'?><assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">    <security>      <requestedPrivileges>        <requestedExecutionLevel level='asInvoker' uiAccess='false' />      </requestedPrivileges>    </security>  </trustInfo></assembly>                                                                                                                                                                                                                                                                                         00.080>0R0_0l0v0{00“0›0¨0²0·0½0Ï0Ü0é0ó0ø0þ011$1.13191K1S1`1j1o1u1…11™1¤1¬1²1Ã1Ë1Ø1â1ç1í1ÿ1222#2)2;2C2P2Z2_2e2w22Œ2–2›2¡2³2»2È2Ò2×2Ý2ï2÷23333+333@3J3O3U3g3o3|3†3‹3‘3£3«3¸3Â3Ç3Í3ß3ç3ô3þ34	44#404:4?4E4W4_4l4w4}4‚4“4›4¨4²4·4½4Ï4×4ä4î4ó4ù455 5*5/555G5O5\5f5k5q5ƒ5‹5˜5¢5§5­5¿5Ç5Ô5Þ5ã5é5û56666%676?6L6V6[6a6s6{6ˆ6’6—66¯6·6Ä6Î6Ó6Ù6ë6ó6 7777'7/7<7F7K7Q7a7k7w7~7ˆ7Ž7Ÿ7§7´7¾7Ã7É7Û7ã7ð7ú7ÿ7888,868;8A8S8[8h8r8w8}88—8¤8®8³8¹8Ë8×8á8è8ð8ö8999&9+919C9K9X9b9g9m99‡9”9ž9£9©9»9Ã9Ð9Ú9ß9å9÷9ÿ9:!:3:;:H:R:Y:^:w:„:Ž:“:™:«:³:À:Ê:Ï:Õ:ç:ï:ü:;;;#;+;8;B;G;M;_;g;t;~;ƒ;‰;›;£;°;º;¿;Å;×;ß;ì;ö;û;<<<<+<5<;<M<R<X<e<o<u<‡<Œ<’<Ÿ<©<¯<º<¿<Í<Ò<à<å<ó<ø<====0=5=?=D=R=W=e=j=x=}=‹==ž=£=±=¶=Ä=É=×=Ü=ê=ï=ý=>>>#>(>6>;>I>N>`>e>o>t>‚>‡>•>š>¨>­>»>À>Î>Ó>á>æ>ô>ù>????-?2?@?f?w?È?ì?      0H0]0t0‘0¡0±0Ì0Õ0q1‘1ž12:2a22Ž2ú23373C3X3Î3ñ3ÿ344I4W4l4ˆ4“4¡4°4Ú4ï4÷415<5J5P5v5Œ5Æ5Ì5™6±6É6ó67#7V7n7†7°7È7à7$8<8T8~8–8®8Ý8õ89,9D9f9x9˜9¸9ã9:-:7:=:]—:¡:Ë:Ö:	;;#;I;d;ƒ;;«;é;ï;ö;<:<^<<À<Ì<Ø<ð<=5=v=‚=Ž=¤=¯=½=ø=>>!>>>K>R>W>_>k>¾>Å>Ê>à>û>??(?Á?   0  Œ   h0§0¶0æ0ÿ0(1c1š1¨1±1Ð1Û1ô1D2…2”2²2É2Ù2ì2÷23#3R33™3£3®3³3¸3¾3Å3Û3ø34¨4Ñ45I5V5£56‰6˜6k7z7Ç8”9â9L:d;~;‡;”;Ä;ö;ü;<<Ò<Ø<.=µ=_?e?   @  ¤  00f0x0ã0ó01>1z1µ1Á1ô1262H2Æ23I3o3¯3´3Ò3ß3î3,42484>4D4J4P4V4\4b4r4á4>5O5Z5_5d5{5Š55£5¸5Ã5Ù5ó5ý586>6P6Ž6š6¤6©6®6Ä6Ð6ñ6ÿ6737I7O7b7h7‚7Ž7—7¡7§7¯7ß7ç7ì7ñ7ö7ü7.8N8a8f8l8€8…8‘8 8¨8¿8Å8û89#979¡9Ó9":0:7:J:‚:ˆ:Ž:”:š: :§:®:µ:¼:Ã:Ê:Ñ:Ù:á:é:õ:þ:;	;;;-;=;M;V;f;q;Ž;Ù;Þ;î;ô;ú; <<<f<k<}<›<¯<µ<`={=‡=–=Ÿ=¬=Û=ã=ð=õ=>>0>6>;>H>N>T>Z>`>f>l>r>x>‘>›>¥>¯>¹>Ã>Í>×>á>ë>õ>ÿ>	???'?1?;?E?O?Y?c?m?w??‹?•?Ÿ?©?³?½?Ç?Ñ?Û?å?ï?ù? P  ˜   000!0+050?0I0S0]0g0q0{0…00™0£0­0·0Á0Ë0Õ0ß0é0ó0ý0111%1/191C1M1W1a1k1u11‰1“11§1±1»1Å1Ï1Ù1ã1í12H2U2a2ˆ2•2¡2Ï2æ2R3z3ª3Ò34442464B4F4R4V4 `     d1h1l1p1t1€1„1È1Ì1Ô1Ø1¬6°6´6¸6¼6À6Ä6È6Ì6Ð6Ô6Ø6Ü6à6ä6è6ì6ð6ô6ø6ü6 777777 7$7(7,7074787<7@7D7H7L7X7\7`7d7h7l7p7´7¸7,808@8D8L8d8h8€88”8¤8´8¸8Ð8à8ä8ü899(9,9094989@9X9\9t9„9ˆ9 9¤9¨9¬9À9Ä9È9à9ð9ô9:: :8:H:L:P:d:h:l:„:ˆ: :°:´:¸:À:Ä:Ì:ä:è:ì: ;;;,;0;8;<;@;D;H;L;P;T;X;`;x;ˆ;˜;œ; ;¸;¼;À;Ä;È;Ì;Ð;Ô;Ø;Ü;à;è;ì; <<<,<0<4<8<L<P<T<X<\<d<|<€<„<ˆ<È<ì<ô<ü<====$=,=4=<=D=L=T=\=d=l=t=|=„=Œ=”=œ=¤=¬=´=¼=Ä=Ì=Ô=Ü=ä=ì=ô=ü=>>>>$>,>4><>D>L>T>\>d>l>t>|>„>Œ>”>œ>¤>¬>´>¼>Ä>Ì>Ô>Ü>ä>ì>ô>ü>????$?,?4?<?D?L?T?\?d?l?t?|?„?Œ?”?œ?¨?Ì?Ô?Ü?ä?ì?ô?ü?   p  L   000 0@0H0P0X0d000°0¼0Ä011,1<1H1P1h1p11¤1À1Ü1à1 2 2(2,2D2H2     ,   00`8h8€8À89L9h9”9À9ø9H:ˆ:´:ð:                                                                                                                  

     

    foto 1.png

    foto 2.png

    596010dda47ad_foto1.png.6816685d7d891439ca95f5a63259916f.png

    596010e015edb_foto2.png.9835e608044ec1e49dac30a67656dd9a.png

  6. Alguem Pode Ajudar Rapidao Tipo Meu Quest Log Ta Pegando Tudo Certo Mais Queria Saber Combo Botar Mais De 1 Mission Dentro De Um Quest Tipo QUando Abrir Quest Log Vai Ter Quest Tal Você Entra Ai Vai Ter

    Mission 1

    Mission 2

     

     

     

    Meu Script e Esse :

    <quest name="Extra Quest" startstorageid="50038" startstoragevalue="1">
    <mission name="KKs" storageid="50038" startvalue="1" endvalue="1">
    <missionstate id="1" description="Voce Completou a Quest Extra!"/>
    </mission>

     

  7. Tipo Estou Usando Quest Log Só Que Tem Quest Que Tem Vários Bau Tipo Poi Ai QUeria Botar Poi Quest
    Mission 1
    Mission 2
    e Por Ai Vai o Que Preciso Mudar Nesse Script?
    </quest>
    <quest name="1kk Quest" startstorageid="50038" startstoragevalue="1">
    <mission name="KKs" storageid="50038" startvalue="1" endvalue="1">
    <missionstate id="2" description="Voce Completou a Quest Extra!"/>
    </mission>
    </quest>

     

  8. Tipo Uso o Sistema Vip Do Monk 100% Certo Mais Só Queria Que Quando o Player Logasse a Conta La Nos Characters Na Hora De Escolher o Personagem Aparecesse Quantos Dias De Vip Account Restam. Alguem Ajuda Aew?

  9. Tipo Meu Shop Está Com Um Bug Horrivel Já Estou Tentando Resolver Isso a Dias e Nada Ja Vi Vários Tutoriais e Nenhum Funciona Quando Eu Compro Um Item No Shop Ele Vem Infinitas Vezes Não Para De Chegar Nunca, Fui Olhar No Historico De Compras Lá Mostra Que o Item Foi Comprando e Não Foi Entregue Por Isso Ele Fica Sendo Enviado Sem Parar Como Posso Resolver Isso??

    16hso01.png

  10. Tipo Esses 2 Script é o Exp Potion e Dodge Eles Estão Certos Mais Para Usar Ambos e Preciso Clicar No Item e Usa No Char Eu Quero Que Seja Use Direto Deu Use o Item Sumiu e o Player Usou Alguem Modifica Pra Mim??

     

    DODGE :

    local limite = 100 -- limite de dodge
    local storagedodge = 48092 -- storage do dodge
     
    function onUse(cid, item, fromPosition, itemEx, toPosition)
    		doSendMagicEffect(fromPosition, CONST_ME_POFF)
        if getPlayerStorageValue(cid, storagedodge) == -1 then
            doPlayerSetStorageValue(cid, storagedodge, (getPlayerStorageValue(cid, storagedodge)) + 2)
            doPlayerSendCancel(cid, " DodgeSKILL:["..getPlayerStorageValue(cid, storagedodge).."/"..limite.."].")
        elseif getPlayerStorageValue(cid, storagedodge) >= -1 and getPlayerStorageValue(cid, storagedodge) <= limite then
            doPlayerSetStorageValue(cid, storagedodge, (getPlayerStorageValue(cid, storagedodge)) + 1)
            doPlayerSendCancel(cid, " DodgeSKILL:["..getPlayerStorageValue(cid, storagedodge).."/"..limite.."].")
            doRemoveItem(item.uid, 1)
        else
            doPlayerSendCancel(cid, "Voce ja chego no maximo.DodgeSKILL:["..getPlayerStorageValue(cid, storagedodge).."/"..limite.."]")
        end
        return true
    end
    

    EXP POTION :

    <?xml version="1.0" encoding="UTF-8"?>
    <mod name="AdvancedExpPotionSystem" enabled="yes" author="MatheusMkalo" forum="um fórum que não merece ser citado">
    
    <!-- Configs and Functions -->
    <config name="PotionExpConfigs"><![CDATA[
    
    ------ CONFIGURE SEU SCRIPT ------ TRUE ou FALSE
    configs = {
    time = 60, ---- TIME IN MINUTES
    needpa = TRUE,
    needlvl = {TRUE, level = 1},
    costmana = {TRUE, mana = 0},
    addrate = 20, -- Exp que vai adicionar em %
    removeonuse = TRUE
    }
    
    function getTime(s)
    local n = math.floor(s / 60)
    s = s - (60 * n)
    return n, s
    end
    
    CreatureEventChecker = function(event, ...) -- Colex
    if isCreature(arg[1]) then
    event(unpack(arg))
    end
    end
    
    creatureEvent = function(event, delay, ...) -- Colex
    addEvent(CreatureEventChecker, delay, event, unpack(arg))
    end
    
    function getPlayerExtraExpRate(cid) -- By MatheusMkalo
    return (getPlayerRates(cid)[8]-1)*100
    end
    ]]></config>
    
    <!-- exppotion.lua -->
    <action itemid="8205" event="script"><![CDATA[
    domodlib('PotionExpConfigs')
    if getPlayerStorageValue(cid, 62164) >= 1 then
    return doPlayerSendCancel(cid, "You are already taking effect from this item.")
    end
    
    if configs.needpa and not isPremium(cid) then
    return doPlayerSendCancel(cid, "You need to be a premmium account to use this item.")
    end
    
    if configs.needlvl[1] and getPlayerLevel(cid) < configs.needlvl.level then
    return doPlayerSendCancel(cid, "You need to be level " .. configs.needlvl.level .. " to use this item.")
    end
    
    if configs.costmana[1] then
    if getCreatureMana(cid) < configs.costmana.mana then
    return doPlayerSendCancel(cid, "You need " .. configs.costmana.mana .. " mana to use this item.")
    else
    doCreatureAddMana(cid, -configs.costmana.mana)
    end
    end
    
    if configs.removeonuse then
    doRemoveItem(item.uid, 1)
    end
    
    for i = configs.time*60, 1, -1 do
    local a = math.floor(i/60) .. ":" .. i - (60 * math.floor(i/60))
    if #a < 4 then
    a = string.sub(a,1,2) .. "0" .. string.sub(a, 3)
    end
    if i == configs.time*60 then
    creatureEvent(doPlayerSendCancel, configs.time*60*1000, cid, "The effect of the exp potion end.")
    end
    creatureEvent(doPlayerSendCancel, (configs.time*60-i)*1000, cid, "The effect of the exp potion will end in "..a..".")
    end
    
    doPlayerSetExperienceRate(cid, (1+(configs.addrate/100))+(getPlayerExtraExpRate(cid)/100))
    creatureEvent(doPlayerSetExperienceRate, configs.time *60*1000, cid, 1+(getPlayerExtraExpRate(cid)/100-(configs.addrate/100)))
    doPlayerSendTextMessage(cid, 22, "Agora voce ira receber mais exp por matar os mosntros.")
    setPlayerStorageValue(cid, 62164, os.time())
    creatureEvent(setPlayerStorageValue, configs.time *60*1000, cid, 62164, 0)
    return TRUE
    ]]></action>
    
    <creaturescript type="login" name="ExpPotion" event="script"><![CDATA[
    domodlib('PotionExpConfigs')
    local time = configs.time
    if os.time()-getPlayerStorageValue(cid, 62164) < time *60 then
    doPlayerSetExperienceRate(cid, (1+(configs.addrate/100))+(getPlayerExtraExpRate(cid)/100))
    creatureEvent(doPlayerSetExperienceRate, (time*60-(os.time()-getPlayerStorageValue(cid, 62164))) * 1000, cid, 1+(getPlayerExtraExpRate(cid)/100-(configs.addrate/100)))
    creatureEvent(setPlayerStorageValue, (time*60-(os.time()-getPlayerStorageValue(cid, 62164))) * 1000 , cid, 62164, 0)
    
    for i = (time*60-(os.time()-getPlayerStorageValue(cid, 62164))), 1, -1 do
    local a = math.floor(i/60) .. ":" .. i - (60 * math.floor(i/60))
    if #a < 4 then
    a = string.sub(a,1,2) .. "0" .. string.sub(a, 3)
    end
    if i == (time*60-(os.time()-getPlayerStorageValue(cid, 62164))) then
    creatureEvent(doPlayerSendCancel, (time*60-(os.time()-getPlayerStorageValue(cid, 62164)))*1000, cid, "The effect of the exp potion end.")
    end
    creatureEvent(doPlayerSendCancel, ((time*60-(os.time()-getPlayerStorageValue(cid, 62164)))-i)*1000, cid, "The effect of the exp potion will end in "..a..".")
    end
    end
    return TRUE
    ]]></creaturescript>
    </mod>
    
  11. Ja Vi Vários Tutoriais e Ainda Não Achei Esse Script Que Realmente Funcione Preciso De Um Script Para Que Em Um Determinado Tile Só Seja Permitido Passar Player Com Guild Se Não Tive Guild Será Enviado Para o Tempo Ou Uma Position Que Eu Possa Escolher Tfs 0.4? Alguem Pra Ajudar?

  12. Meu Shop Está Bugado Quando Entro No Site e Compro Algo No Shop O Item Fica Sendo Entregue Infinitas Vezes Fui Olhar No Histórico De Compras Isso Está Ocorrendo Pois Lá Está Falando Que o Item Ainda Não Foi Entregue Sendo Assim o Item Continua Enviando Como Ageito isso????? REP++

     

    Lek Nada De Flood Aqui Não Mandei 3 x Por que Ninguem AJudo Se Quer Que Eu Pare De Mando Int Ajuda Ue Ficar Reclamando Nao Vai Dar Em Nada e Eu Vou Continuar Mandando Até Alguem Ajudar Esse Forum e De Suporte Enquanto Alguém Não Der o Suporte Continuarei Pedindo Ajuda :)

  13. Meu Shop Está Bugado Quando Entro No Site e Compro Algo No Shop O Item Fica Sendo Entregue Infinitas Vezes Fui Olhar No Histórico De Compras Isso Está Ocorrendo Pois Lá Está Falando Que o Item Ainda Não Foi Entregue Sendo Assim o Item Continua Enviando Como Ageito isso????? REP++

  14. Quando Compro Algo Pelo Shop Do Meu Gesior o Item Fica Entregando Sem Parar Infinitas Vezes Alguem AJuda Aew ?? REP++

     

     

    Globalevents/Script/Shop.lua :

    -- ### CONFIG ###
    -- message send to player by script "type" (types you can check in "global.lua")
    SHOP_MSG_TYPE = 19
    -- time (in seconds) between connections to SQL database by shop script
    SQL_interval = 30
    -- ### END OF CONFIG ###
    function onThink(interval, lastExecution)
    local result_plr = db.getResult("SELECT * FROM z_ots_comunication WHERE `type` = 'login';")
    if(result_plr:getID() ~= -1) then
    while(true) do
    id = tonumber(result_plr:getDataInt("id"))
    action = tostring(result_plr:getDataString("action"))
    delete = tonumber(result_plr:getDataInt("delete_it"))
    cid = getCreatureByName(tostring(result_plr:getDataString("name")))
    if isPlayer(cid) == TRUE then
    local itemtogive_id = tonumber(result_plr:getDataInt("param1"))
    local itemtogive_count = tonumber(result_plr:getDataInt("param2"))
    local container_id = tonumber(result_plr:getDataInt("param3"))
    local container_count = tonumber(result_plr:getDataInt("param4"))
    local add_item_type = tostring(result_plr:getDataString("param5"))
    local add_item_name = tostring(result_plr:getDataString("param6"))
    local received_item = 0
    local full_weight = 0
    if add_item_type == 'container' then
    container_weight = getItemWeightById(container_id, 1)
    if isItemRune(itemtogive_id) == TRUE then
    items_weight = container_count * getItemWeightById(itemtogive_id, 1)
    else
    items_weight = container_count * getItemWeightById(itemtogive_id, itemtogive_count)
    end
    full_weight = items_weight + container_weight
    else
    full_weight = getItemWeightById(itemtogive_id, itemtogive_count)
    if isItemRune(itemtogive_id) == TRUE then
    full_weight = getItemWeightById(itemtogive_id, 1)
    else
    full_weight = getItemWeightById(itemtogive_id, itemtogive_count)
    end
    end
    local free_cap = getPlayerFreeCap(cid)
    if full_weight <= free_cap then
    if add_item_type == 'container' then
    local new_container = doCreateItemEx(container_id, 1)
    local iter = 0
    while iter ~= container_count do
    doAddContainerItem(new_container, itemtogive_id, itemtogive_count)
    iter = iter + 1
    end
    received_item = doPlayerAddItemEx(cid, new_container)
    else
    local new_item = doCreateItemEx(itemtogive_id, itemtogive_count)
    received_item = doPlayerAddItemEx(cid, new_item)
    end
    if received_item == RETURNVALUE_NOERROR then
    doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, 'You received >> '.. add_item_name ..' << from OTS shop.')
    db.executeQuery("DELETE FROM `z_ots_comunication` WHERE `id` = " .. id .. ";")
    db.executeQuery("UPDATE `z_shop_history_item` SET `trans_state`='realized', `trans_real`=" .. os.time() .. " WHERE id = " .. id .. ";")
    else
    doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, '>> '.. add_item_name ..' << from OTS shop is waiting for you. Please make place for this item in your backpack/hands and wait about '.. SQL_interval ..' seconds to get it.')
    end
    else
    doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, '>> '.. add_item_name ..' << from OTS shop is waiting for you. It weight is '.. full_weight ..' oz., you have only '.. free_cap ..' oz. free capacity. Put some items in depot and wait about '.. SQL_interval ..' seconds to get it.')
    end
    end
    if not(result_plr:next()) then
    break
    end
    end
    result_plr:free()
    end
    return TRUE
    end 

    Globalevents.Xml :

    <globalevent name="shop" interval="30000" script="shop.lua"/>  

    Tipo Se For Possivel Tambem Mandem Os Comandos Para Eu Executar Na Database Para Apaga e Re-Criar As Tabelas Que o Shop Usa.

     

  • Quem Está Navegando   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.
×
×
  • Criar Novo...