Ejemplo n.º 1
0
	public function
	getAttackLogsCount() {
		return BattleLog::getAttackLogsCount($this->id);
	}
Ejemplo n.º 2
0
	'id'     => FILTER_VALIDATE_INT | FILTER_SANITIZE_NUMBER_INT,
	'isview' => FILTER_VALIDATE_INT | FILTER_SANITIZE_NUMBER_INT,
);

$filteredG = filter_input_array(INPUT_GET, $filter);


$bId    = $filteredG['id']     ? max($filteredG['id'],     0) : 0;
$isview = $filteredG['isview'] ? max($filteredG['isview'], 0) : 0;

if (!$bId) {
	header('Location: attacklog.php');
	exit;
}

$b = new BattleLog();
$b->get($bId);

try {
	if ($user->id != $b->targetId and $user->id == $b->attackerId) {
		$t->target = new User();
		$t->target->get($b->targetId);
		$t->attacker = $user;
	}
	else if($user->id != $b->attackerId and $user->id == $b->targetId) {
		$t->attacker = new User();
		$t->attacker->get($b->attackerId);
		$t->target = $user;
	}
	else {
		header('Location: attacklog.php?e=1');
Ejemplo n.º 3
0
if ($attackCount >= $conf['max-attacks']) {
	// Maxed out potential
	header("Location: stats.php?uid=$uid&e=3");
	exit;
}

if ($user->attackturns < $attackTurns) {
	// Not enough turns
	header("Location: stats.php?uid=$uid&e=1");
	exit;
}

$user->attackturns -= $attackTurns;

// Ok, can create the attack log
$attacklog             = new BattleLog();
$attacklog->attackerId = $user->id;
$attacklog->targetId   = $target->id;
$attacklog->attackType = $attackTurns;
$attacklog->time       = time();

// now invert the attack turns.
if ($attackTurns == 1) {
	$attackTurns = 15;
}

debug("<h1>This is debugging info, it will not affect either account</h1> Please ignore it while I debug the attacking<br/>");
$attackerCount = BattleLog::getAttackLogsOfUserSinceTimeCount($user->id,    $someTimeAgo);
$defenseCount  = BattleLog::getDefenseLogsOfUserSinceTimeCount($target->id, $someTimeAgo);

debug("attackerCount: $attackerCount<br>defenseCount: $defenseCount");