Character find

find a character information.

<?php
require_once('Services/CamelotHerald.php');

$cacheDir = '/tmp/';
$lifeTime = 10800;

$herald = new Services_CamelotHerald($cacheDir, $lifeTime);

$character = $herald->findCharacter('characterName', 'Lancelot');

print $character->name;
print $character->class;

print $character->totalrp;
print $character->todayrp;
print $character->lastweekrp;

foreach ($character->weeks as $week) {
    print $week->day;
    print $week->deaths;
    print $week->kills;
    print $week->rp;
?>

Set character name, server name and execute findCharacter(). Method return the details of a character object. ( ex. total RP, Master Level/Path, Craft Skill and more. See Services_CamelotHerald_Dto_Character)

If raise error, Services_CamleotHerald stack Error Object (PEAR_ErrorStack).

And more usage.

<?php
$result = $herald->searchCharacter('characterName', 'Lancelot');
foreach ($result as $value) {
    $character = $herald->findCharacter($value);
    print $character->name;
    print $character->class;
    print $character->totalrp;
}
?>

Set Services_CamelotHerald_Dto_Character object to this method, you'll get same result.

If you use no cache and get latest data from the server, you use SERVICES_CAMELOTHERALD_FIND_FORCE to the third argument of the findMode flag.

<?php
$result = $herald->searchCharacter('characterName', 'Lancelot', SERVICES_CAMELOTHERALD_FIND_FORCE);
?>

If you get data from cache only, you use SERVICES_CAMELOTHERALD_FIND_CACHE to the third argument of the findMode flag.

<?php
$result = $herald->searchCharacter('characterName', 'Lancelot', SERVICES_CAMELOTHERALD_FIND_CACHE);
?>


Add comment