diff --git a/Werwolf.php b/Werwolf.php index ec932d4..d89e06c 100644 --- a/Werwolf.php +++ b/Werwolf.php @@ -1588,6 +1588,8 @@ p#liste { `dorfzusatz` INT ( 10 ) DEFAULT 10 , `dorfstichwahltimer` INT ( 10 ) DEFAULT 200 , `dorfstichwahlzusatz` INT ( 10 ) DEFAULT 5 , + `inaktivzeit` INT ( 10 ) DEFAULT 40 , + `inaktivzeitzusatz` INT ( 10 ) DEFAULT 0 , `tagestext` TEXT , `nacht` INT ( 5 ) DEFAULT 1 , `log` LONGTEXT , @@ -2326,6 +2328,10 @@ function spielRegeln($mysqli) $dorfstichwahlzusatz = $gameResAssoc['dorfstichwahlzusatz']; $zufaelligauswaehlen = $gameResAssoc['zufaelligeAuswahl']; $zufaelligeAuswahlBonus = $gameResAssoc['zufaelligeAuswahlBonus']; + + $inaktivzeit = $gameResAssoc['inaktivzeit']; + $inaktivzeitzusatz = $gameResAssoc['inaktivzeitzusatz']; + echo "
"; } @@ -2454,6 +2463,8 @@ function spielRegelnAnwenden($mysqli) $dorfzusatz = (int)$_POST['dorfzusatz']; $dorfstichwahltimer = (int)$_POST['dorfstichwahltimer']; $dorfstichwahlzusatz = (int)$_POST['dorfstichwahlzusatz']; + $inaktivzeit = (int)$_POST['inaktivzeit']; + $inaktivzeitzusatz = (int)$_POST['inaktivzeitzusatz']; $zufaelligeAuswahlBonus = (int)$_POST['zufaelligeAuswahlBonus']; $zufaelligauswaehlen = 0; if (isset($_POST['zufaelligauswaehlen'])) @@ -2510,7 +2521,9 @@ function spielRegelnAnwenden($mysqli) dorftimer = $dorftimer, dorfzusatz = $dorfzusatz, dorfstichwahltimer = $dorfstichwahltimer, - dorfstichwahlzusatz = $dorfstichwahlzusatz"); + dorfstichwahlzusatz = $dorfstichwahlzusatz, + inaktivzeit = $inaktivzeit, + inaktivzeitzusatz = $inaktivzeitzusatz"); //Fertig upgedated ;) } } @@ -2886,12 +2899,12 @@ function phaseInitialisieren($phase,$mysqli) { //Neue verliebte ... Setze alle verliebten auf -1 $mysqli->Query("UPDATE $spielID"."_spieler SET verliebtMit = -1"); - $waiting_for_others_time = time() + _WAITINGFOROTHERSTIME; + $waiting_for_others_time = time() + get_waiting_for_others_time($mysqli); $mysqli->Query("UPDATE $spielID"."_game SET `waiting_for_others_time` = $waiting_for_others_time"); } elseif ($phase == PHASENACHT2) { - $waiting_for_others_time = time() + _WAITINGFOROTHERSTIME; + $waiting_for_others_time = time() + get_waiting_for_others_time($mysqli); $mysqli->Query("UPDATE $spielID"."_game SET `waiting_for_others_time` = $waiting_for_others_time"); } elseif ($phase == PHASENACHT3) @@ -2922,12 +2935,12 @@ function phaseInitialisieren($phase,$mysqli) $countdownAb = time(); $mysqli->Query("UPDATE $spielID"."_spieler SET countdownBis = $countdownBis, countdownAb = $countdownAb WHERE (nachtIdentitaet = ".CHARWERWOLF." OR nachtIdentitaet = ".CHARURWOLF.")"); } - $waiting_for_others_time = time() + _WAITINGFOROTHERSTIME; + $waiting_for_others_time = time() + get_waiting_for_others_time($mysqli); $mysqli->Query("UPDATE $spielID"."_game SET `waiting_for_others_time` = $waiting_for_others_time"); } elseif ($phase == PHASENACHT4) { - $waiting_for_others_time = time() + _WAITINGFOROTHERSTIME; + $waiting_for_others_time = time() + get_waiting_for_others_time($mysqli); $mysqli->Query("UPDATE $spielID"."_game SET `waiting_for_others_time` = $waiting_for_others_time"); } elseif ($phase == PHASENACHTENDE) @@ -3095,6 +3108,21 @@ function phaseInitialisieren($phase,$mysqli) } } +function get_waiting_for_others_time($mysqli) +{ + //Gibt die Anzahl der Sekunden zurück, wie lange wir warten wollen, bis wir anzeigen, auf wen wir noch warten. + $spielID = (int)$_COOKIE['SpielID']; + if ($result = $mysqli->query("SELECT * FROM $spielID"."_spieler")) + { + $spielerzahl = $result->num_rows; + if ($g = gameAssoc($mysqli)) + { + return $g['inaktivzeit'] + $g['inaktivzeitzusatz'] * $spielerzahl; + } + } + return 0; +} + function toeteSpieler($mysqli, $spielerID) { //Wird aufgerufen, wenn dieser Spieler stirbt diff --git a/constants.php b/constants.php index 12b5c6f..4fa5e08 100644 --- a/constants.php +++ b/constants.php @@ -2,7 +2,6 @@ //Constants define("_VERSION","v1.2.5"); define("_LISTMAXRELOADTIME",3000); -define("_WAITINGFOROTHERSTIME",30); //Innerhalb dieser Sekunden bleibt verborgen, auf wen noch gewartet wird. define("_MAXPLAYERS",50); //Phasen