okay, finally!!! the leader now can force another users char to participate in the clanfight, even if they have the "Kampf" or "Schatzsuche Status" depending if they can be fetched ("abgeholen")
@ -263,7 +263,7 @@ function cancelChallengeRequest($challenged_clan, array $user) {
}
}
$sql = 'SELECT * FROM clan_challenge_requests WHERE clan_challenged = ' .$challenged_clan . ' AND clan_requester = ' .$user['clan'] . ' AND active = TRUE AND challenged_time > TIMESTAMPADD(day, -1, now())';
$sql = 'SELECT * FROM clan_challenge_requests WHERE clan_challenged = ' .$challenged_clan . ' AND clan_requester = ' .$user['clan'] . ' AND active = TRUE AND challenged_time > TIMESTAMPADD(day, -1, now())';
@ -308,7 +308,7 @@ function denyChallengeRequest($challenge_requester, array $user) {
}
}
$sql = 'SELECT * FROM clan_challenge_requests WHERE clan_challenged = ' .$user['clan'] . ' AND clan_requester = ' .$challenge_requester . ' AND active = TRUE AND challenged_time > TIMESTAMPADD(day, -1, now())';
$sql = 'SELECT * FROM clan_challenge_requests WHERE clan_challenged = ' .$user['clan'] . ' AND clan_requester = ' .$challenge_requester . ' AND active = TRUE AND challenged_time > TIMESTAMPADD(day, -1, now())';
@ -428,7 +428,7 @@ function getAwatingChallengeIDs() {
// before doing anything check if we are locked
// before doing anything check if we are locked
$array = array();
$array = array();
$sql = 'SELECT distinct(cc.clan_challenge_id) FROM clan_challenges AS cc inner join clan_challenge_clans AS ccp ON cc.clan_challenge_id = ccp.clan_challenge_id WHERE elo_change is null AND calculated = TRUE AND enddate <now()';
$sql = 'SELECT distinct(cc.clan_challenge_id) FROM clan_challenges AS cc inner join clan_challenge_clans AS ccp ON cc.clan_challenge_id = ccp.clan_challenge_id WHERE elo_change is null AND calculated = TRUE AND enddate <now()';
// echo $sql . '<br>';
// echo $sql . '<br>';
$qry = mysql_query($sql);
$qry = mysql_query($sql);
while($row = mysql_fetch_row($qry)) {
while($row = mysql_fetch_row($qry)) {
$array[] = $row[0];
$array[] = $row[0];
@ -504,7 +504,7 @@ function getClanLockedTime($clan_id) {
$sql = 'SELECT TIMESTAMPDIFF(SECOND, NOW(), locked_until) FROM clan_locked WHERE clanid = ' . $clan_id;
$sql = 'SELECT TIMESTAMPDIFF(SECOND, NOW(), locked_until) FROM clan_locked WHERE clanid = ' . $clan_id;
$row = mysql_fetch_row(mysql_query($sql));
$row = mysql_fetch_row(mysql_query($sql));
if($row)
if($row)
return $row[0];
return $row[0];
return 0;
return 0;
}
}
@ -538,7 +538,7 @@ function isClanLocked($clanid) {
// echo $sql.'<br>';
// echo $sql.'<br>';
$res = mysql_query($sql);
$res = mysql_query($sql);
if(!$res)
if(!$res)
echo $sql . '<br>';
echo $sql . '<br>';
mysql_query('UPDATE clan_challenge_requests SET active = FALSE WHERE (clan_challenged = '.$clanid.' OR clan_requester = '.$clanid);
mysql_query('UPDATE clan_challenge_requests SET active = FALSE WHERE (clan_challenged = '.$clanid.' OR clan_requester = '.$clanid);
mysql_query('DELETE FROM clan_challenges WHERE calculated = FALSE AND clan_challenge_id IN (SELECT clan_challenge_id from clan_challenge_clans WHERE clan_id = '.$clanid.')');
mysql_query('DELETE FROM clan_challenges WHERE calculated = FALSE AND clan_challenge_id IN (SELECT clan_challenge_id from clan_challenge_clans WHERE clan_id = '.$clanid.')');
// char is not free but is he already participating?
if($forced && ($char['status'] == 'Kampf' || $char['status'] == 'Schatz Suche')) { // foreign assignment may also possible if the status is in "fetching" state
return 'Du kannst den Char nicht an dem Kampf teilnehmen lassen, da er nicht frei ist!';
$row = mysql_fetch_row(db_query('SELECT Timestampdiff(Second,now(),dauer) as dauer from quests where charid = '.$charid));
} else {
$row = mysql_fetch_row(db_query('SELECT dauer - ' . time() . ' FROM kampf WHERE db_satz='.$charid ));
}
if($row[0] > 0) {
return 'Du kannst den Char \''.$char['name'].'\' nicht an dem Kampf teilnehmen lassen, da er im Moment noch für ' . $row[0] . ' Sekunden mit ' . $char['status']. ' beschäftigt ist!';
}
} else {
// char is not free but is he already participating?