<?php
    global $EFFECT_AREA;
?>
<!DOCTYPE html>
<html lang='en'>
    <head>
        <meta content='text/html; charset=utf-8' http-equiv='content-type'/>
        <meta name='viewport' content='width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1'/>
        <title><?=$page->title?></title>
        <link rel='shortcut icon' href='<?=$page->favicon?>'/>
        <!-- CSS files -->
        <link rel='stylesheet' type='text/css' href='<?=$path["css"]?>ui.css'/>
        <link rel='stylesheet' type='text/css' href='<?=$path["css"]?>home.css'/>
        <!-- Script files -->
        <script src="<?=$path["js"]?>ui.js"></script>
        <!-- Meta tags -->
        <link rel='canonical' href='<?=$page->canonical?>'/>
        <link rel='author' href='<?=$page->author?>'/>
        <link rel='publisher' href='<?=$page->author?>'/>
        <meta name='description' content='<?=$page->description?>'/>
        <meta property='og:title' content='<?=$page->title?>'/>
        <meta property='og:url' content='<?=$page->canonical?>'/>
        <meta property='og:description' content='<?=$page->description?>'/>
        <meta property='og:image' content='<?=$page->icon?>'/>
        <meta property='og:site_name' content='<?=$page->name?>'/>
        <meta property='og:type' content='website'/>
        <meta property='og:locale' content='en'/>
        <meta name='twitter:card' content='summary'/>
        <meta name='twitter:title' content='<?=$page->title?>'/>
        <meta name='twitter:description' content='<?=$page->description?>'/>
        <meta name='twitter:image' content='<?=$page->icon?>'/>
        <meta name='twitter:url' content='<?=$page->canonical?>'/>
        <meta name='robots' content='index follow'/>
    </head>
    <body>
<?php
        include __DIR__ . "/inc/header.php";
?>
        <section class='content'>
            <h2>
                <span>
                    Summoners War DataBase
                </span>
            </h2>
            <article id='profile'>
                <h3>
                    <?=$page->name?>
                </h3>
<?php
                if (isset($page->rep)){
?>
                    <div id='rep' class='profile_section'>
                        <h4>
                            Rep. Monster
                        </h4>
                        <div class='monster_panel'>
                            <?=html_unit_panel($page->rep)?>
                        </div> <!-- .monster_panel -->
                    </div>
<?php
                } // if (isset($page->rep))
?>
                <div id='defense' class='profile_section'>
                    <h4>
                        Arena defense
                    </h4>
<?php
                    $first = true;
                    foreach ($page->defense as $defense){
?>
                        <div class='monster_panel'>
                            <?=html_unit_panel($defense)?>
                        </div>
<?php
                        if ($first && isset($defense->unit->leader_skill) && ($defense->unit->leader_skill->area == $EFFECT_AREA["GENERAL"] || $defense->unit->leader_skill->area == $EFFECT_AREA["ARENA"])){
?>
                            <div class='skill'>
                                <img class='skill_img' title='<?=$defense->unit->leader_skill->create_description()?>' src='<?=$defense->unit->leader_skill->get_image()?>'/>
                            </div>
<?php
                        }
                        $first = false;
                    }
?>
                </div>
                <div id='building' class='profile_section'>
                    <h4>
                        Buildings
                    </h4>
<?php
                    foreach ($page->building as $building){
?>
                        <?=html_building_panel($building)?>
<?php
                    }
?>
                </div>
                <div id='decoration' class='profile_section'>
                    <h4>
                        Decorations
                    </h4>
<?php
                    foreach ($page->decoration as $decoration){
?>
                        <?=html_building_panel($decoration)?>
<?php
                    }
?>
                </div>
                <div class='inventory profile_section' id='inventory_scroll'>
                    <h4>
                        Scrolls
                    </h4>
<?php
                    foreach ($page->inventory_scroll as $item){
?>
                        <?=html_item_panel($item)?>
<?php
                    }
?>
                </div>
                <div class='inventory profile_section' id='inventory_craft_rune'>
                    <h4>
                        Rune crafting items
                    </h4>
<?php
                    foreach ($page->inventory_craft_rune as $item){
?>
                        <?=html_item_panel($item)?>
<?php
                    }
?>
                </div>
                <div class='inventory profile_section' id='inventory_craft'>
                    <h4>
                        Other crafting items
                    </h4>
<?php
                    foreach ($page->inventory_craft as $item){
?>
                        <?=html_item_panel($item)?>
<?php
                    }
?>
                </div>
                <div class='inventory profile_section' id='inventory_essence'>
                    <h4>
                        Essences
                    </h4>
<?php
                    foreach ($page->inventory_essence as $item){
?>
                        <?=html_item_panel($item)?>
<?php
                    }
?>
                </div>
                <div id='currency' class='profile_section'>
                    <h4>
                        Currency
                    </h4>
                    <ul>
                        <li>
                            <img title='Energy' src='<?=$path["img"]["currency"]?>energy.png'/>
                            <?=$page->currency["energy"]?> / <?=$page->currency["energy_max"]?>
                        </li>
                        <li>
                            <img title='Arena Invitations' src='<?=$path["img"]["currency"]?>arenaenergy.png'/>
                            <?=$page->currency["arena_energy"]?> / <?=$page->currency["arena_energy_max"]?>
                        </li>
                        <li>
                            <img title='Dimensional Energy' src='<?=$path["img"]["currency"]?>dimensionenergy.png'/>
                            <?=$page->currency["dimension_energy"]?> / <?=$page->currency["dimension_energy_max"]?>
                        </li>
                        <li>
                            <img title='Dimensional Crystal' src='<?=$path["img"]["currency"]?>darkportalenergy.png'/>
                            <?=$page->currency["darkportal_energy"]?> / <?=$page->currency["darkportal_energy_max"]?>
                        </li>
                        <li>
                            <img title='Mana' src='<?=$path["img"]["currency"]?>mana.png'/>
                            <?=$page->currency["mana"]?>
                        </li>
                        <li>
                            <img title='Crystal' src='<?=$path["img"]["currency"]?>crystal.png'/>
                            <?=$page->currency["crystal"]?>
                        </li>
                        <li>
                            <img title='Social Points' src='<?=$path["img"]["currency"]?>socialpoint.png'/>
                            <?=$page->currency["social_point"]?>
                        </li>
                        <li>
                            <img title='Honor Points' src='<?=$path["img"]["currency"]?>honor.png'/>
                            <?=$page->currency["honor_point"]?>
                        </li>
                        <li>
                            <img title='Guild Points' src='<?=$path["img"]["currency"]?>guildpoint.png'/>
                            <?=$page->currency["guild_point"]?>
                        </li>
                        <li>
                            <img title='Honor Medals' src='<?=$path["img"]["currency"]?>badge.png'/>
                            <?=$page->currency["honor_medal"]?>
                        </li>
                        <li>
                            <img src='<?=$path["img"]["currency"]?>mark.png'/>
                            <?=$page->currency["honor_mark"]?>
                        </li>
                        <li>
                            <img title='Ancient Coins' src='<?=$path["img"]["currency"]?>ancientcoin.png'/>
                            <?=$page->currency["event_coin"]?>
                        </li>
                        <li>
                            <img title='Ancient Crystal' src='<?=$path["img"]["currency"]?>ancientstone.png'/>
                            <?=$page->currency["ancient_stone"]?>
                        </li>
                        <li>
                            <img title='Shapeshifting Stones' src='<?=$path["img"]["currency"]?>costumestone.png'/>
                            <?=$page->currency["costume_point"]?>
                        </li>
                    </ul>
                </div>
            </article>
        </section>
<?php
        include __DIR__ . "/inc/footer.php";
?>
    </body>
</html>
