Querying a Character for a Specific Item - PlanetSide Universe
PSU Social Facebook Twitter Twitter YouTube Steam TwitchTV
PlanetSide Universe
PSU: format c: *.*
Home Forum Chat Wiki Social AGN PS2 Stats
Notices
Go Back   PlanetSide Universe > PlanetSide Discussions > PlanetSide 2 API Discussion

 
 
Thread Tools Search this Thread Display Modes
Old 2013-05-30, 09:47 PM   [Ignore Me] #1
Razzun
Private
 
Querying a Character for a Specific Item


So, I am trying to create an "at a glance" roster to host on our outfit website. So far, with the help of these forums and the Wiki I have gotten most of the information I want... the only information I am still lacking is weather the person as "Spawn Beacon" (id=7) or smoke (aka Rally Point, but doesn't seem to be listed in the item_list yet).

How can I use c:show to pull just the Spawn Beacon (and smoke, when it shows up).

Here is the test page I am working from: http://projectxfire.com/russ_test/ps2_search.php

Below is the source code for people that want it
Code:
<?php

$api = "https://census.soe.com";

$outfit_id = ""; //fill in your own outfit_id
$format = "json";
$service_id = ""; //fill in your own service_id
$verb = "get";
$game = "ps2-beta";
$collection = "outfit";
$query = "c:resolve=member_online_status,member_character(name.first,experience.rank,stats.update_time,times.last_login)";

$ApiLink = $api . "/" . $service_id . "/" . $format . "/" . $verb . "/" . $game . "/" . $collection . "/" . $outfit_id . "/?" . $query;

$json_decode = (json_decode(file_get_contents($ApiLink), true));
$outfit_output = $json_decode["outfit_list"];

foreach ($outfit_output as $key => $value)
{
	$get_outfit_name = $value["name"];
	$get_outfit_alias = $value["alias"];
	
	echo $get_outfit_name . ' (' . $get_outfit_alias . ') <br />';
	
	$character_output = $value["members"];
}

?>
	
<table border=1>
	<tr>
		<td>Character</td>
		<td>Battle Rank</td>
		<td>Outfit Rank</td>
		<td>Spawn Beacon?</td>
		<td>Smoke?</td>
		<td>Last Online</td>
		<td>Last Update</td>
	</tr>
		
<?php	

foreach ($character_output as $key => $value) 
{
	$get_character = $value["name"]["first"];
	$get_rank = $value["rank"];
	$get_online = $value["online_status"];
	$get_update = $value["stats"]["update_time"];
	$get_last_on = $value["times"]["last_login"];
	$get_character_id = $value["character_id"];
	$br_output = $value["experience"];
		
	$TimeZoneNameFrom="UTC";
	$TimeZoneNameTo="America/Los_Angeles";
	
	foreach ($br_output as $key => $value)
	{
		$get_br = $value["rank"];
	}
	
	if ($get_online == 1)
	{
		$online = "Online Now!";
	}
	else
	{
		$dt = new DateTime("@$get_last_on");
		// $online = $dt->format('d-M-Y \a\t H:i T');
		
		$TimeStr=$dt->format("d-M-Y H:i T");
		
		$online = date_create($TimeStr, new DateTimeZone($TimeZoneNameFrom))
			-> setTimezone(new DateTimeZone($TimeZoneNameTo))->format("d-M-Y \@ H:i \G\M\T O");
	}
	
	$last_update = date_create($get_update, new DateTimeZone($TimeZoneNameFrom))
		-> setTimezone(new DateTimeZone($TimeZoneNameTo))->format("d-M-Y \@ H:i \G\M\T O");
		
	$char_link = "http://www.planetside-universe.com/character-" . $get_character_id  . ".php";

	// $collection = "character";
	// $query = "c:resolve=item_list(name.en)";
	// $item_link = $api . "/" . $service_id . "/" . $format . "/" . $verb . "/" . $game . "/" . $collection . "/" . $get_character_id . "/?" . $query;
	// $json_decode = (json_decode(file_get_contents($item_link), true));
	// $outfit_output = $json_decode["outfit_list"];
	
	echo "<tr><td><a href=\"$char_link\" target=\"_blank\">" . $get_character . "</a></td><td>" . $get_br . "</td><td>" . $get_rank . "</td><td>Becon</td><td>Smoke</td><td>" . $online . "</td><td>" . $last_update . "</tr>";
	
}
	
?>

</table>	

<?php
		
?>
I haven't coded extensively in a few years now... so any thoughts on optimizations would be greatly appreciated!

Last edited by Razzun; 2013-05-31 at 02:43 PM.
Razzun is offline  
Old 2013-06-01, 10:42 PM   [Ignore Me] #2
Saladin
Private
 
Re: Querying a Character for a Specific Item


I am thinking it is a simple addition to the resolve to add items.. then use if statement or in foreach to pool the items looking for the item with 7 or another that you would want to check for doing a little look up on PSU sandbox.. but should be simple once you get it in the same pool of information to take what you will out of it..

Edit: Well I am having no luck as well I thought was a simple thing had done it for a few other things playing around but looks like I don't see either in the item list like you said (missed that earlier) so I am at a loss sorry

Last edited by Saladin; 2013-06-01 at 10:59 PM. Reason: reseached
Saladin is offline  
Old 2013-06-02, 04:13 PM   [Ignore Me] #3
shaql
Private
 
Re: Querying a Character for a Specific Item


skill_list in the API has the list of certs, which seems to be what you need.
ids 3948-3951: Rally Point - Orange, Green, Purple, Yellow
3947 Spawn Beacon, lowest lvl , 3955-3958 are "Priority Deployment", upgrading the Spawn Beacon (only the highest ID is shown)

3946 Request Reinforcements
3952 Squad Objectives
3953 Command Comm. Channel

however, this list might be VS only. There are other identical entries with other IDs - each of the above IDs +14 or +28, idk which one is which.

(so, basically make yourself an array of smoke and an array of beacon ids, and check in_array)
shaql is offline  
Old 2013-06-02, 06:54 PM   [Ignore Me] #4
Saladin
Private
 
Re: Querying a Character for a Specific Item


Yea what he had stated above.. I was looking this morning and finally found them LOL took a little of digging but agree array would be the best option of this.. as simple and less coding that way
Saladin is offline  
 
  PlanetSide Universe > PlanetSide Discussions > PlanetSide 2 API Discussion

Bookmarks

Discord

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 12:31 PM.

Content © 2002-2013, PlanetSide-Universe.com, All rights reserved.
PlanetSide and the SOE logo are registered trademarks of Sony Online Entertainment Inc. © 2004 Sony Online Entertainment Inc. All rights reserved.
All other trademarks or tradenames are properties of their respective owners.
Powered by vBulletin
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.