WarQuest 2.4

Today Plaatsoft released WarQuest v2.4. The following features are added:

29-08-2011 version 2.40
Game website
– Added Wheel of Fortune casino game.
– Added basic casino functionality. More is coming soon!
– Move Logout button to home submenu.
– Added more awards with more bonus expercience points.
– Update all existing player accounts with new award schema.
– Improve award help and skill point page.
– Improve worldmap. Sea is now transparant.
– Corrected total request count. Bots actions are not counted anymore.
– Improve some database queries. Now faster page response.
– Added admin cleanup battle log action.

Play

Click here to enter directly the game!

WarQuest 2.3

Today Plaatsoft released WarQuest v2.3. The following features are added:

25-08-2011 version 2.30
Game website
– Added Nasdaq, DowJones and AEX stock exchange with realtime price information.
– Enlarge maximum amount of buildings from 300 to 350.
– Improve best country leaderboard (Added total server requests).
– Replace bots country name from Europe to Cyberspace.
– Added discount buildings. Give building price discount.
– Refactor existing buildings.
– Added “Nuclair power plant” energy building.
– Make source code compliant with the PHP 5.3.x standard.
– Added some missing country names.

General
– Who will help translate WarQuest to other languages? Please leave a comment.
– Please visit www.gravatar.com to upload player image.

Play

Click here to enter directly the game!

PHP stock information example

Hereby an easy example how you can use the finance.yahoo.com webservice to fetch stock exchange information with PHP.


	function warquest_stockarray($data,$delim=',',$enclosure='"') {
		$enclosed=false;
		$fldcount=0;
		$linecount=0;
		$fldval='';
		for($i=0;$i<strlen($data);$i++) {
			$chr=$data{$i};
			switch($chr)
			{
				case $enclosure:
					if($enclosed&&$data{$i+1}==$enclosure) {
						$fldval.=$chr;
						++$i; 
					} else {
						$enclosed=!$enclosed;
					}
					break;
   
				case $delim:
					if(!$enclosed) {
						$ret_array[$linecount][$fldcount++]=$fldval;
						$fldval='';
					} else {
						$fldval.=$chr;
					}
					break;
				
				case "\r":
					if (!$enclosed&&$data{$i+1}=="\n") continue;
					
				case "\n":
					if(!$enclosed) {
						$ret_array[$linecount++][$fldcount]=$fldval;
						$fldcount=0;
						$fldval='';
					} else {
						$fldval.=$chr;
					}
					break;
				
				default:
					$fldval.=$chr;
			}
		}
		if($fldval) {
			$ret_array[$linecount][$fldcount]=$fldval;
		}
		return $ret_array;
	}

	function warquest_stock($stocksymbols) {		
		$url = sprintf("http://download.finance.yahoo.com/d/quotes.csv?s=%s&f=snl1d1t1c1ohgvp", $stocksymbols);
		$data = file_get_contents($url);
	
		$stocklist=warquest_stockarray($data);
	
		for($i=0;$i<count($stocklist);$i++) {
		
			$stocksymbol=trim($stocklist[$i][0], '\"');
			$stock[$stocksymbol]["stocksymbol"] = 
			$stock[$stocksymbol]["company"] = trim($stocklist[$i][1], '\"');
			$stock[$stocksymbol]["last"] = $stocklist[$i][2];
			$stock[$stocksymbol]["date"] = trim($stocklist[$i][3], '\"');	
			$stock[$stocksymbol]["time"] = trim($stocklist[$i][4], '\"');					
			$stock[$stocksymbol]["change"] = $stocklist[$i][5];
			$stock[$stocksymbol]["open"] = $stocklist[$i][6];
			$stock[$stocksymbol]["high"] = $stocklist[$i][7];
			$stock[$stocksymbol]["low"] = $stocklist[$i][8];
			$stock[$stocksymbol]["volume"] = $stocklist[$i][9];
			$stock[$stocksymbol]["prevclose"] = $stocklist[$i][10];	
		}
		return $stock;
	}
	
	print_r(warquest_stock("DB"));