My favorites | Sign in
Project Home Downloads Wiki Issues Source
Checkout   Browse   Changes    
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<?php
/**********************************************************************//**\file
Armory Player XML

Description: Provides specific functions for parsing the wowarmory.com
player character information.
*******************************************************************************/

class playerxml extends armoryxml
{
protected $player;

public function __construct($name)
{
$this->get_cache('player', $name);
$this->player = new playerdata($name, true);
}

public function parse()
{
# General
$general = $this->xmldata->getElementsByTagName('character');

foreach($general as $data)
{
$class = $data->getAttribute('classId');
$gender = $data->getAttribute('genderId');
$level = $data->getAttribute('level');
$race = $data->getAttribute('raceId');

$this->player->update_general($class, $gender, $level, $race);
}

unset($general);

# Talents
$talents = $this->xmldata->getElementsByTagName('talentSpec');

foreach($talents as $data)
{
$talents1 = $data->getAttribute('treeOne');
$talents2 = $data->getAttribute('treeTwo');
$talents3 = $data->getAttribute('treeThree');

$this->player->update_talents($talents1, $talents2, $talents3);
}

unset($talents);

# Professions
$professions = $this->xmldata->getElementsByTagName('skill');

foreach($professions as $data)
{
$type = $data->getAttribute('key');
$value = $data->getAttribute('value');

$this->player->update_professions($type, $value);
}

unset($professions);
}

public function store()
{
$this->player->store();
}

public function debug()
{
$this->player->debug();
}
}
?>

Change log

r12 by banzaimonkey on Oct 28, 2009   Diff
Updated XML parsing functions
Simple database abstraction class
Implemented data object storage functions
Go to: 
Project members, sign in to write a code review

Older revisions

r11 by banzaimonkey on Oct 27, 2009   Diff
Initial code import
All revisions of this file

File info

Size: 1683 bytes, 74 lines
Powered by Google Project Hosting