Пример #1
0
                 $xml = ryzom_guild_simplexml($key);
                 if ($xml == null) {
                     throw new Exception(__("Connection with ryzom_api impossible."));
                 }
                 $guild = parse_guild($xml);
                 parse_item($xml, '/guild/room/*', $guild);
                 $list_guild[$guild->id] = $guild;
             } else {
                 if (ryzom_character_valid_key($key, $uid, $slot, $full)) {
                     $list_correct_ckey[] = $ckey;
                     $xml = ryzom_character_simplexml($key, 'full');
                     if ($xml == null) {
                         throw new Exception(__("Connection with ryzom_api impossible."));
                     }
                     $character = parse_character($xml);
                     $xml_inv = ryzom_character_simplexml($key, 'items');
                     if ($xml == null) {
                         throw new Exception(__("Connection with ryzom_api impossible."));
                     }
                     parse_item($xml_inv, '/items/room/*', $character);
                     $list_guild[$character->id] = $character;
                 } else {
                     $error_msg .= __('Invalid key') . "<br />";
                 }
             }
         } catch (Exception $e) {
             $error_msg .= $e->getMessage() . "<br />";
             array_pop($list_correct_ckey);
         }
     }
 }
Пример #2
0
function render_character($xml, $key)
{
    $content = '<h1>' . $xml->name . '</h1>';
    $content .= '<ul>';
    $content .= '<li>Shard: <b>' . $xml->shard . '</b></li>';
    $content .= '<li>Race: <b>' . $xml->race . '</b></li>';
    $gender = $xml->gender;
    $content .= '<li>Gender: <b>' . ($gender == 'f' ? 'Female' : 'Male') . '</b></li>';
    $title = ryzom_title_txt($xml->titleid, 'en', $gender);
    $content .= '<li>Title: <b>' . $title . '</b></li>';
    $content .= '</ul>';
    $content .= '<h2>Hands</h2>';
    $result = $xml->xpath('/character/hands/*');
    while (list(, $item) = each($result)) {
        $content .= ryzom_item_icon_image_from_simplexml($item) . ' ';
    }
    $content .= '<h2>Equipments</h2>';
    $result = $xml->xpath('/character/equipments/*');
    while (list(, $item) = each($result)) {
        $content .= ryzom_item_icon_image_from_simplexml($item) . ' ';
    }
    if ($xml->guild->name != '') {
        $content .= '<h2>Guild</h2>';
        $content .= '<ul>';
        $content .= '<li>Name: <b>' . $xml->guild->name . '</b></li>';
        $guild_icon = ryzom_guild_icon_image($xml->guild->icon, 'b');
        $guild_icon_small = ryzom_guild_icon_image($xml->guild->icon, 's');
        $content .= "<li>Guild Icon: {$guild_icon} {$guild_icon_small}</li>";
        $content .= '</ul>';
    } else {
        $content .= '<h2>No Guild</h2>';
    }
    // inventories
    $inv_xml = ryzom_character_simplexml($key, 'items');
    if (isset($inv_xml->inventories->bag)) {
        $content .= '<h2>Bag</h2>';
        $content .= '<p>(leave the mouse on an item to display its custom text, if any)</p>';
        $result = $inv_xml->xpath('/items/inventories/bag/*');
        while (list(, $item) = each($result)) {
            $content .= ryzom_item_icon_image_from_simplexml($item);
        }
    }
    if (isset($inv_xml->item_in_store)) {
        $content .= '<h2>Item in store</h2>';
        $content .= '<p>(leave the mouse on an item to display its price)</p>';
        $result = $inv_xml->xpath('/items/item_in_store/*');
        while (list(, $item) = each($result)) {
            $content .= ryzom_item_icon_image_from_simplexml($item, "Price: " . $item['price']);
        }
    }
    $content .= '<hr/><a class="ryzom-ui-button" href="?">Back</a>';
    return $content;
}