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")

main
hecht 13 years ago
parent cf1ccd8d6c
commit 04cac8c623

@ -593,6 +593,17 @@ function joinChallenge($clan_challenge_id, array $user, $charid, $slot ) {
} }
if($char['status'] != 'Frei') { if($char['status'] != 'Frei') {
if($forced && ($char['status'] == 'Kampf' || $char['status'] == 'Schatz Suche')) { // foreign assignment may also possible if the status is in "fetching" state
// okay now check if the fetch-time is reached!!
if($char['status'] == 'Schatz Suche') {
$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? // char is not free but is he already participating?
$participant = getParticipatingChar($clan_challenge_id, $clan['id'], $charid); $participant = getParticipatingChar($clan_challenge_id, $clan['id'], $charid);
if(!$participant || !$participant['forced']) { if(!$participant || !$participant['forced']) {
@ -601,6 +612,7 @@ function joinChallenge($clan_challenge_id, array $user, $charid, $slot ) {
db_query('UPDATE clan_challenge_participants SET forced = FALSE WHERE clan_challenge_id = ' . $clan_challenge_id . ' AND clan_id = '.$clan['id'].' AND char_id = ' . $charid); db_query('UPDATE clan_challenge_participants SET forced = FALSE WHERE clan_challenge_id = ' . $clan_challenge_id . ' AND clan_id = '.$clan['id'].' AND char_id = ' . $charid);
return NULL; return NULL;
} }
}
$clan_challenge = getChallenge($clan_challenge_id); $clan_challenge = getChallenge($clan_challenge_id);

@ -35,15 +35,15 @@ $GLOBALS['semaphorecount'] = 0;
* @param string $resource the name of the resource * @param string $resource the name of the resource
*/ */
function semaphoreUP($resource){ function semaphoreUP($resource){
// echo 'semaphoreUp('.$ressource.')<br>' . PHP_EOL ; // echo 'semaphoreUp('.$resource.')<br>' . PHP_EOL ;
if($GLOBALS['semaphorecount'] == 0){ if($GLOBALS['semaphorecount'] == 0){
ignore_user_abort(true); // Verarbeitung darf NICHT abgebrochen werden!! ignore_user_abort(true); // Verarbeitung darf NICHT abgebrochen werden!!
// echo 'DEBUG: kritischer Bereich betreten<br>'; // echo 'DEBUG: kritischer Bereich betreten<br>';
} }
// Loesche alte Ressourcen // Loesche alte Ressourcen
mysql_query('DELETE FROM semaphore WHERE TIMESTAMPDIFF(MINUTE, zeit, now()) > 5 and ressource = \''.$ressource.'\''); mysql_query('DELETE FROM semaphore WHERE TIMESTAMPDIFF(MINUTE, zeit, now()) > 5 and ressource = \''.$resource.'\'');
$sql = 'INSERT INTO semaphore(ressource) values(\''.$ressource.'\')'; $sql = 'INSERT INTO semaphore(ressource) values(\''.$resource.'\')';
mysql_query($sql); mysql_query($sql);
if(mysql_affected_rows() > 0){ if(mysql_affected_rows() > 0){
// echo 'DEBUG: Semaphore fuer '.$ressource.' belegt!('.mysql_affected_rows().')<br>'; // echo 'DEBUG: Semaphore fuer '.$ressource.' belegt!('.mysql_affected_rows().')<br>';
@ -59,8 +59,8 @@ function semaphoreUP($resource){
} }
// @Returns TRUE if ok, FALSE on Semaphore error, NULL on MYQL Error // @Returns TRUE if ok, FALSE on Semaphore error, NULL on MYQL Error
function semaphoreDown($ressource){ function semaphoreDown($resource){
$sql = 'DELETE FROM semaphore where ressource = \''.$ressource.'\''; $sql = 'DELETE FROM semaphore where ressource = \''.$resource.'\'';
mysql_query($sql); mysql_query($sql);
if(mysql_affected_rows() == 0){ if(mysql_affected_rows() == 0){
// echo 'DEBUG: Semaphore '.$ressource.' war schon freigegeben<br>'; // echo 'DEBUG: Semaphore '.$ressource.' war schon freigegeben<br>';

Loading…
Cancel
Save