Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I have this data (below). I need to pull out several bits of data. In the Example below, I need to pull the values:

The Paradox

["Guild"] = The Paradox

["Motd"]

and then this 'data' from each 'member'

["Sindogg"] = {

["Note"] = "",

["Zone"] = "Westfall",

["Group"] = "no",

["Class"] = "Druid",

["Level"] = 24,

["Name"] = "Sindogg",

["Rank"] = "Alt",

{

 

Any ideas, C#, VB are welcome.

 

myProfile = {
["Malorne"] = {
	["Guild"] = {
		["Guild"] = "The Paradox",
		["Date"] = "12/04/06 18:21:16",
		["Hour"] = 18,
		["Locale"] = "enUS",
		["Minute"] = 21,
		["Motd"] = "Download Teamspeak ([url]www.goteamspeak.com[/url]) TS hostname=theparadox.shacknet.nu:8767. ZG 12.09.06 we need EVERYONE there",
		["Created"] = "11-9-2006",
		["DateUTC"] = "12/05/06 00:21:16",
		["DateExtracted"] = "12/04/06 18:21:16",
		["Members"] = {
			["Sindogg"] = {
				["Note"] = "",
				["Zone"] = "Westfall",
				["Group"] = "no",
				["Class"] = "Druid",
				["LastOnline"] = {
					["Day"] = 10,
					["Month"] = 0,
					["Hour"] = 4,
					["Year"] = 0,
				},
				["RankIndex"] = 7,
				["OfficerNote"] = "",
				["Status"] = "",
				["Level"] = 24,
				["Name"] = "Sindogg",
				["Rank"] = "Alt",
			},
			["Sushiroll"] = {
				["Note"] = "",
				["Zone"] = "Ironforge",
				["Group"] = "no",
				["Class"] = "Rogue",
				["LastOnline"] = {
					["Day"] = 0,
					["Month"] = 0,
					["Hour"] = 22,
					["Year"] = 0,
				},
				["RankIndex"] = 6,
				["OfficerNote"] = "",
				["Status"] = "",
				["Level"] = 45,
				["Name"] = "Sushiroll",
				["Rank"] = "Initiate",
			},
			["Wheelz"] = {
				["Note"] = "",
				["Zone"] = "Darkshore",
				["Group"] = "no",
				["Class"] = "Hunter",
				["LastOnline"] = {
					["Day"] = 14,
					["Month"] = 0,
					["Hour"] = 2,
					["Year"] = 0,
				},
				["RankIndex"] = 5,
				["OfficerNote"] = "",
				["Status"] = "",
				["Level"] = 18,
				["Name"] = "Wheelz",
				["Rank"] = "Member",
			},
			["Nubber"] = {
				["Note"] = "",
				["Zone"] = "Stormwind City",
				["Group"] = "no",
				["Class"] = "Warrior",
				["LastOnline"] = {
					["Day"] = 2,
					["Month"] = 0,
					["Hour"] = 18,
					["Year"] = 0,
				},
				["RankIndex"] = 4,
				["OfficerNote"] = "",
				["Status"] = "",
				["Level"] = 16,
				["Name"] = "Nubber",
				["Rank"] = "Charter Member",
			},
		["NumMembers"] = 91,
		["NumAccounts"] = "71",
		["Info"] = "ZG attempts begin saturday!!!!!!!!!!\n\nTemp website\nhttp://www.guildportal.com/Guild.aspx?GuildID=129956&TabID=1106625\n\n\n\n\nTHE PARADOX TEAMSPEAK SERVER\n\ntheparadox.shacknet.nu:8767\n",
		["Faction"] = "Alliance",
		["DBversion"] = "1.6.0",
		["Version"] = "1.6.0",
		["GPprovider"] = "rpgo",
		["GPversion"] = "1.6.0",
	},
},
}

~Nate�

___________________________________________

Please use the [vb]/[cs] tags on posted code.

Please post solutions you find somewhere else.

Follow me on Twitter here.

Posted

Strangly enough, I found a PhP example that is supposed to process that very data. I don't know any PhP, and I don't have an apache server to test it out.

 

Here's the of the function that stores the data in a sql database. If necessary, I can attach the entire php file, but it's too big to post.

 

function processGuildRoster($myProfile)
{
global $wowdb, $roster_conf, $wordings;

$wowdb->resetMessages();

if( is_array($myProfile) )
{
	foreach( array_keys($myProfile) as $realm_name )
	{
		// Only allow realms specified in config
		if( $realm_name == $roster_conf['server_name'])
		{
			$realm = $myProfile[$realm_name];
			$guild = $realm['Guild'];
			if( is_array($guild) )
			{
				$guildName = $guild['Guild'];
				// Only allow the guild specified in config
				if( $roster_conf['guild_name'] == $guildName )
				{
					// GP Version Detection, don't allow lower than minVer
					if( $guild['DBversion'] >= $roster_conf['minGPver'] )
					{
						// make hour between 0 and 23 and minute between 0 and 60
						$guildHour= intval($guild['Hour']);
						$guildMinute= intval($guild['Minute']);

						// take the current time and get the offset. Upload must occur same day that roster was obtained
						$currentTimestamp = mktime($guildHour,$guildMinute,0);
						$currentTime = getDate($currentTimestamp);

						// Update the guild
						$guildId = $wowdb->update_guild($realm_name, $guildName, $currentTime, $guild);
						$guildMembers = $guild['Members'];

						// update the list of guild members
						$guild_output = '';
						foreach(array_keys($guildMembers) as $char_name)
						{
							$char = $guildMembers[$char_name];
							$wowdb->update_guild_member($guildId, $char_name, $char, $currentTimestamp);
							$guild_output .= $wowdb->getMessages();
							$wowdb->resetMessages();

							// Start update triggers
							if( $roster_conf['use_update_triggers'] )
							{
								$guild_output .= start_update_trigger($char_name,'guild');
							}
						}
						// Remove the members who were not in this list
						$wowdb->remove_guild_members($guildId, $currentTime);
						$wowdb->remove_guild_members_id($guildId);

						$guild_output .= $wowdb->getMessages();
						$wowdb->resetMessages();
						$guild_output .= "</ul>\n";
						$output .= "<strong>Updating Guild [<span class=\"orange\">$guildName</span>]</strong>\n<ul>\n";
						$output .= "<li><strong>Member Log</strong></li>\n<ul>\n".
							"<li>Updated: ".$wowdb->membersupdated."</li>\n".
							"<li>Added: ".$wowdb->membersadded."</li>\n".
							"<li>Removed: ".$wowdb->membersremoved."</li>\n".
							"</ul>\n<br />\n";
						$output .= $guild_output;
					}
					else
					// GP Version not new enough
					{
						$output .= "<span class=\"red\">NOT Updating Guild list for $guildName</span><br />\n";
						$output .= "Data is from GuildProfiler v".$guild['DBversion']."<br />\n";
						$output .= $wordings[$roster_conf['roster_lang']]['GPver_err']."<br />\n";
					}
				}
				else
				{
					$output .= sprintf($wordings[$roster_conf['roster_lang']]['guild_nameNotFound'],$guildName)."<br />\n";
				}
			}
			else
			{
				$output .= '<span class="red">'.$wordings[$roster_conf['roster_lang']]['guild_addonNotFound'].'</span>'."<br />\n";
			}
		}
		else
		{
			$output .= $myProfile[$realm_name]['Guild']['Guild'].' @ '.$realm_name.' '.$wordings[$roster_conf['roster_lang']]['ignored']."<br />\n";
		}
	}
}
return $output;
}

~Nate�

___________________________________________

Please use the [vb]/[cs] tags on posted code.

Please post solutions you find somewhere else.

Follow me on Twitter here.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...