%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /www/old2/_music/ingress/
Upload File :
Create Path :
Current File : /www/old2/_music/ingress/inventoryanalyze.php

<?php
die;
	class Inventory
	{
		var $owner = "";
		var $ap = 0;
		var $xm = 0;
		var $time;
		var $resonators;
		var $bursters;
		var $powerCubes;
		var $media;
		var $shields;
		var $heatsinks;
		var $multihacks;
		var $forceamps;
		var $linkamps;
		var $turrets;
		var $ADAs;
		var $JARVISes;
		var $keys = array();

		public function __construct()
		{
			$this->time = time();
			$this->resonators = array(new LeveledItem(1), new LeveledItem(2), new LeveledItem(3), new LeveledItem(4), new LeveledItem(5), new LeveledItem(6), new LeveledItem(7), new LeveledItem(8));
			$this->bursters = array(new LeveledItem(1), new LeveledItem(2), new LeveledItem(3), new LeveledItem(4), new LeveledItem(5), new LeveledItem(6), new LeveledItem(7), new LeveledItem(8));
			$this->powerCubes = array(new LeveledItem(1), new LeveledItem(2), new LeveledItem(3), new LeveledItem(4), new LeveledItem(5), new LeveledItem(6), new LeveledItem(7), new LeveledItem(8));
			$this->media = array(new LeveledItem(1), new LeveledItem(2), new LeveledItem(3), new LeveledItem(4), new LeveledItem(5), new LeveledItem(6), new LeveledItem(7), new LeveledItem(8));
			$this->shields = array(new ModItem("COMMON"), new ModItem("RARE"), new ModItem("VERY_RARE"));
			$this->heatsinks = array(new ModItem("COMMON"), new ModItem("RARE"), new ModItem("VERY_RARE"));
			$this->multihacks = array(new ModItem("COMMON"), new ModItem("RARE"), new ModItem("VERY_RARE"));
			$this->forceamps = array(new ModItem("RARE"));
			$this->linkamps = array(new ModItem("RARE"));
			$this->turrets = array(new ModItem("RARE"));
			$this->ADAs = array(new ModItem("VERY_RARE"));
			$this->JARVISes = array(new ModItem("VERY_RARE"));
		}
	}

	class LeveledItem
	{
		var $level = 0;
		var $amount = 0;

		public function __construct($level)
		{
			$this->level = $level;
		}
	}

	class ModItem
	{
		var $rarity = "VERY_COMMON";
		var $amount = 0;
		public function __construct($rarity)
		{
			$this->rarity = $rarity;
		}
	}

	class KeyItem
	{
		var $portalGuid = "";
		var $portalName = "";
		var $amount = 0;
	}



	header("Content-Type: text/plain");
	exec("ls /var/www/hacks/decompressed/inventory/*.txt", $files);
	foreach($files as $file)
	{
	$txt = file_get_contents($file);
	$inventory = new Inventory();

	preg_match("/.*?_([0-9]*).*/", $file, $match);
	$inventory->time = $match[1];

	$data = json_decode($txt);
	$inventory->ap = $data->currentAP;
	$inventory->xm = $data->currentXM;
	$inventory->owner = $data->playerName;
	foreach($data->rpcResult as $item)
	{
		if(isset($item[2]->resourceWithLevels))
		{
			if($item[2]->resourceWithLevels->resourceType == "POWER_CUBE")
			{
				$lvl = $item[2]->resourceWithLevels->level-1;
				$inventory->powerCubes[$lvl]->amount++;
			}
			elseif($item[2]->resourceWithLevels->resourceType == "EMP_BURSTER")
			{
				$lvl = $item[2]->resourceWithLevels->level-1;
				$inventory->bursters[$lvl]->amount++;
			}
			elseif($item[2]->resourceWithLevels->resourceType == "EMITTER_A")
			{
				$lvl = $item[2]->resourceWithLevels->level-1;
				$inventory->resonators[$lvl]->amount++;
			}
			elseif($item[2]->resourceWithLevels->resourceType == "MEDIA")
			{
				$lvl = $item[2]->resourceWithLevels->level-1;
				$inventory->media[$lvl]->amount++;
			}
		}
		elseif(isset($item[2]->modResource))
		{
			if($item[2]->modResource->resourceType == "RES_SHIELD")
			{
				switch($item[2]->modResource->rarity)
				{
					case "COMMON":
					{
						$inventory->shields[0]->amount++;
						break;
					}
					case "RARE":
					{
						$inventory->shields[1]->amount++;
						break;
					}
					case "VERY_RARE":
					{
						$inventory->shields[2]->amount++;
						break;
					}
				}
			}
			elseif($item[2]->modResource->resourceType == "HEATSINK")
			{
				switch($item[2]->modResource->rarity)
				{
					case "COMMON":
					{
						$inventory->heatsinks[0]->amount++;
						break;
					}
					case "RARE":
					{
						$inventory->heatsinks[1]->amount++;
						break;
					}
					case "VERY_RARE":
					{
						$inventory->heatsinks[2]->amount++;
						break;
					}
				}
			}
			elseif($item[2]->modResource->resourceType == "MULTIHACK")
			{
				switch($item[2]->modResource->rarity)
				{
					case "COMMON":
					{
						$inventory->multihacks[0]->amount++;
						break;
					}
					case "RARE":
					{
						$inventory->multihacks[1]->amount++;
						break;
					}
					case "VERY_RARE":
					{
						$inventory->multihacks[2]->amount++;
						break;
					}
				}
			}
			elseif($item[2]->modResource->resourceType == "TURRET")
			{
				if($item[2]->modResource->rarity == "RARE")
				{
					$inventory->turrets[0]->amount++;
				}
			}
			elseif($item[2]->modResource->resourceType == "FORCE_AMP")
			{
				if($item[2]->modResource->rarity == "RARE")
				{
					$inventory->forceamps[0]->amount++;
				}
			}
			elseif($item[2]->modResource->resourceType == "LINK_AMPLIFIER")
			{
				if($item[2]->modResource->rarity == "RARE")
				{
					$inventory->linkamps[0]->amount++;
				}
			}
			// ADA and JARVIS, check this after hacking one !!!!!!!!!!!!!
			elseif($item[2]->modResource->resourceType == "ADA")
			{
				if($item[2]->modResource->rarity == "VERY_RARE")
				{
					$inventory->ADAs[0]->amount++;
				}
			}
			elseif($item[2]->modResource->resourceType == "JARVIS")
			{
				if($item[2]->modResource->rarity == "VERY_RARE")
				{
					$inventory->JARVISes[0]->amount++;
				}
			}
		}
		elseif(isset($item[2]->portalCoupler))
		{
			// Try to find the key
			$fount = false;
			foreach($inventory->keys as $key)
			{
				if($item[2]->portalCoupler->portalGuid == $key->portalGuid)
				{
					$key->amount++;
					$found = true;
					break;
				}
			}
			if(!$found)
			{
				$key = new KeyItem();
				$key->portalGuid = $item[2]->portalCoupler->portalGuid;
				$key->portalName = $item[2]->portalCoupler->portalTitle;
				$key->amount = 1;
				$inventory->keys[] = $key;
			}
		}
	}

	//print_r($inventory);
	$m = new MongoClient();
	$db = $m->selectDB("ingress");
	$col = $db->selectCollection("inventory");
	$col->insert($inventory);
	}
?>

Zerion Mini Shell 1.0