myProfile = {
["Anetheron"] = {
["Character"] = {
["Néfuh"] = {
["Currency"] = {
["Verschiedenes"] = {
["Kochpreis von Dalaran"] = {
["Type"] = 0,
["Name"] = "Kochpreis von Dalaran",
["Tooltip"] = "Kochpreis von Dalaran<br>\"Beim Kochbedarfhändler von Dalaran einlösen.\"",
["Icon"] = "INV_Misc_Ribbon_01",
["Count"] = 70,
},
["Siegel des Champions"] = {
["Type"] = 0,
["Name"] = "Siegel des Champions",
["Tooltip"] = "Siegel des Champions",
["Icon"] = "Ability_Paladin_ArtofWar",
["Count"] = 26,
},
["Abzeichen der Gerechtigkeit"] = {
["Type"] = 0,
["Name"] = "Abzeichen der Gerechtigkeit",
["Tooltip"] = "Abzeichen der Gerechtigkeit<br>Benötigt Stufe 70",
["Icon"] = "Spell_Holy_ChampionsBond",
["Count"] = 97,
},
},
["Spieler gegen Spieler"] = {
["Ehrenpunkte"] = {
["Type"] = 2,
["Name"] = "Ehrenpunkte",
["Tooltip"] = "Ehrenpunkte<br>Wird beim Aufheben gebunden<br>Benötigt Stufe 60<br>\"Ehre wird durch das Töten gegnerischer Spieler im PvP-Kampf gewonnen. Ehrenpunkte können genutzt werden, um spezielle Gegenstände zu kaufen.\"",
["Icon"] = "UI-PVP-Horde",
["Count"] = 6452,
},
["Arenapunkte"] = {
["Type"] = 1,
["Name"] = "Arenapunkte",
["Tooltip"] = "Arenapunkte<br>\"Arenapunkte werden durch Siege in Arenakämpfen erworben. Sie können gegen fantastische Preise eingetauscht werden!\"",
["Icon"] = "PVP-ArenaPoints-Icon",
["Count"] = 0,
},
["Splitter eines Steinbewahrers"] = {
["Type"] = 0,
["Name"] = "Splitter eines Steinbewahrers",
["Tooltip"] = "Splitter eines Steinbewahrers",
["Icon"] = "INV_Misc_Platnumdisks",
["Count"] = 354,
},
["Ehrenabzeichen des Arathibeckens"] = {
["Type"] = 0,
["Name"] = "Ehrenabzeichen des Arathibeckens",
["Tooltip"] = "Ehrenabzeichen des Arathibeckens<br>\"Auszeichnung für den Kampf im Arathibecken\"",
["Icon"] = "INV_Jewelry_Amulet_07",
["Count"] = 3,
},
["Ehrenabzeichen vom Auge des Sturms"] = {
["Type"] = 0,
["Name"] = "Ehrenabzeichen vom Auge des Sturms",
["Tooltip"] = "Ehrenabzeichen vom Auge des Sturms<br>\"Auszeichnung für den Kampf im Auge des Sturms\"",
["Icon"] = "Spell_Nature_EyeOfTheStorm",
["Count"] = 5,
},
},
["Dungeon und Schlachtzug"] = {
["Emblem der Ehre"] = {
["Type"] = 0,
["Name"] = "Emblem der Ehre",
["Tooltip"] = "Emblem der Ehre<br>Benötigt Stufe 80",
["Icon"] = "Spell_Holy_ProclaimChampion_02",
["Count"] = 11,
},
["Emblem der Eroberung"] = {
["Type"] = 0,
["Name"] = "Emblem der Eroberung",
["Tooltip"] = "Emblem der Eroberung<br>Benötigt Stufe 80",
["Icon"] = "Spell_Holy_ChampionsGrace",
["Count"] = 32,
},
["Emblem des Heldentums"] = {
["Type"] = 0,
["Name"] = "Emblem des Heldentums",
["Tooltip"] = "Emblem des Heldentums<br>Benötigt Stufe 80",
["Icon"] = "Spell_Holy_ProclaimChampion",
["Count"] = 85,
},
["Emblem des Triumphs"] = {
["Type"] = 0,
["Name"] = "Emblem des Triumphs",
["Tooltip"] = "Emblem des Triumphs<br>Benötigt Stufe 80",
["Icon"] = "spell_holy_summonchampion",
["Count"] = 14,
},
},
},
},
},
},
}
* Handles formating and insertion of currency data
*
* @param array $data
* @param int $memberId
*/
function do_currency( $data, $memberId )
{
global $roster;
if(isset($data['Currency']))
{
$currencyData = $data['Currency'];
}
if( !empty($currencyData) && is_array($currencyData) )
{
$messages = '<li>Updating Currency ';
//first delete the stale data
$querystr = "DELETE FROM `" . $roster->db->table('currency') . "` WHERE `member_id` = '$memberId'";
$messages .= 'deleted stale data\n';
if( !$roster->db->query($querystr) )
{
$this->setError('Currency could not be deleted',$roster->db->error());
return;
}
foreach( array_keys( $currencyData ) as $categories )// eg. 'Miscellaneous, Player vs. Player, Dungeon and Raid
{
$category = $currencyData[$categories];
//if ($category_name != $count)
//{
foreach( array_keys( $category ) as $currency )// eg. Arena Points, Badge of Justice, Emblem of Valor
{
$this->reset_values();
if( !empty($memberId) )
{
$this->add_value('member_id', $memberId );
}
if( !empty($categories) )
{
$this->add_value('currency_category', $categories );
}
if( !empty($currency) )
{
$this->add_value('name', $currency );
}
if( !empty($currencyData[$categories][$currency]['Count']) )
{
$this->add_value('count', $currencyData[$categories][$currency]['Count'] );
}
if( !empty($currencyData[$categories][$currency]['Type']) )
{
$this->add_value('type', $currencyData[$categories][$currency]['Type'] );
}
$messages .= '.';
$querystr = "INSERT INTO `" . $roster->db->table('currency') . "` SET " . $this->assignstr;
$result = $roster->db->query($querystr);
if( !$result )
{
$this->setError('Currency for ' . $currency . ' could not be inserted',$roster->db->error());
}
}
//}
}
$this->setMessage($messages . '</li>');
}
else
{
$this->setMessage('<li>No Currency Data</li>');
}
}
CREATE TABLE `roster_currency` (
`member_id` int(10) unsigned NOT NULL default '0',
`currency_category` varchar(32) NOT NULL default '',
`name` varchar(32) NOT NULL default '',
`type` tinyint(3) unsigned NOT NULL default '0',
`count` int(8) unsigned NOT NULL default '0',
PRIMARY KEY (`member_id`,`name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
$this->do_buffs( $data, $memberId );
$this->do_currency( $data, $memberId );
$messages .= 'Reputation..';
$querystr = "DELETE FROM `" . $roster->db->table('reputation') . "` WHERE `member_id` IN ($inClause)";
if( !$roster->db->query($querystr) )
{
$this->setError('Reputation Data could not be deleted',$roster->db->error());
}
$messages .= 'Currency..';
$querystr = "DELETE FROM `" . $roster->db->table('currency') . "` WHERE `member_id` IN ($inClause)";
if( !$roster->db->query($querystr) )
{
$this->setError('Currency Data could not be deleted',$roster->db->error());
}
Kaylaura wrote:That was the easy part everything's so nicely coded and commented it wasn't hard.
Now figuring out the char.lib.php ...
Users browsing this forum: No registered users and 1 guest