aboutsummaryrefslogtreecommitdiffstats
path: root/inc/guild.inc
blob: c0e826438bdb9cdfb96facaffd3067e61615aad2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php

define("GUILD_COST",10);
define("MINER_COST",5);

function createGuild(){
	if(!empty($_SESSION["guild"])) {
		sendError("guild_already_built");
	}
	elseif(debitAccount(GUILD_COST)) {
		$_SESSION["guild"] = true;
		echo json_encode(array("cost" => GUILD_COST));
	}
}

function hireMiner(){
	if(!isset($_SESSION["guild"])){
		sendError("guild_not_yet_created");
	}
	elseif(debitAccount(MINER_COST)){
		$_SESSION["mine"]["miners"]++;
		echo json_encode(array("cost" => MINER_COST , "miners" => $_SESSION["mine"]["miners"]));	
	}
}

function sendMiners(){
	return $_SESSION["mine"]["miners"];
}
	

?>