From 0a08e350b83ac645f506b9b1952537c031c72954 Mon Sep 17 00:00:00 2001 From: hecht Date: Mon, 25 Aug 2014 19:30:12 +0000 Subject: [PATCH] =?UTF-8?q?Die=20GMs=20k=C3=B6nnen=20nun=20zulassen,=20das?= =?UTF-8?q?s=20Chars=20mehrfach=20hintereinander=20zu=20CFs=20hinzugewiese?= =?UTF-8?q?n=20werden!?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ag/gm/include/clan.inc.php | 6 +++--- ag/include/clan_fights.inc.php | 13 +++++++++++-- ag/include/event.inc.php | 10 ++++++++-- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/ag/gm/include/clan.inc.php b/ag/gm/include/clan.inc.php index 8dddc1e..3bac025 100644 --- a/ag/gm/include/clan.inc.php +++ b/ag/gm/include/clan.inc.php @@ -241,11 +241,11 @@ function displayClanFightOptions($data) { $colspan = 2; $desc_array = array('minimale Anzahl an Clanmitgliedern um kämpfen zu können', 'maximale Anzahl an Herausforderungen', 'maximale Anzahl von Offlinecharakteren die angemeldet werden dürfen', 'maximalen Clankämpfe pro Tag', 'Zeit zwischen dem Herausfordern des selben Clans in Stunden', 'Kampfdauer pro Einzelkampf in Davy Back', - 'Kampfdauer pro Einzelkampf in Survival', 'Modifikator G für die Clan-Exp Verteilungsformel'); + 'Kampfdauer pro Einzelkampf in Survival', 'Modifikator G für die Clan-Exp Verteilungsformel', 'Anzahl CFs die ein Char nacheinander haben kann.'); $define_array = array('MIN_MEMBERS', 'MAX_OPEN_REQUESTS', 'MAX_LEADER_ASSIGNED_CHARS', 'CLANFIGHTS_MAX_FIGHTS_PER_24H', 'CLANFIGHTS_RECHALLENGE_DELAY', 'DURATION_DAVY_BACK_FIGHT', - 'DURATION_SURVIVAL_FIGHT', 'CLAN_EXP_FAKTOR_G'); + 'DURATION_SURVIVAL_FIGHT', 'CLAN_EXP_FAKTOR_G', 'MAX_COUNT_PARALLEL_CFS'); $value_array = array(MIN_MEMBERS, MAX_OPEN_REQUESTS, MAX_LEADER_ASSIGNED_CHARS, CLANFIGHTS_MAX_FIGHTS_PER_24H, CLANFIGHTS_RECHALLENGE_DELAY, DURATION_DAVY_BACK_FIGHT, DURATION_SURVIVAL_FIGHT, - CLAN_EXP_FAKTOR_G); + CLAN_EXP_FAKTOR_G, MAX_COUNT_PARALLEL_CFS); $change = false; //data überprüfen diff --git a/ag/include/clan_fights.inc.php b/ag/include/clan_fights.inc.php index f3d9a07..a8bf4cc 100644 --- a/ag/include/clan_fights.inc.php +++ b/ag/include/clan_fights.inc.php @@ -25,6 +25,7 @@ defineIfNotDefined('DAVY_BACK_FIGHT', 1); defineIfNotDefined('SURVIVAL', 2); defineIfNotDefined('DURATION_DAVY_BACK_FIGHT', 15); defineIfNotDefined('DURATION_SURVIVAL_FIGHT', 15); +defineIfNotDefined('MAX_COUNT_PARALLEL_CFS', 1); defineIfNotDefined('ATTACK_SET_DAVY_BACK_FIGHT', 2); @@ -594,14 +595,22 @@ function joinChallenge($clan_challenge_id, array $user, $charid, $slot ) { } 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 + if($forced && ($char['status'] == 'Kampf' || $char['status'] == 'Schatz Suche' || $char['status'] == 'Clanfight')) { // 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 if($char['status'] == 'Clanfight') { + if(isCharBusyWithClanfighting($charid)) { + $row[0] = '???'; // we do not know when the fight is starting! + } else if(getOngoingEventCount($charid) >= MAX_COUNT_PARALLEL_CFS) { + $row[0] = 'MAX'; + } else { + $row[0] = getEventStatusBlocked($char_id); + } } else { $row = mysql_fetch_row(db_query('SELECT dauer - ' . time() . ' FROM kampf WHERE db_satz='.$charid )); } - if($row[0] > 0) { + if(!is_numeric($row[0]) || $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 { diff --git a/ag/include/event.inc.php b/ag/include/event.inc.php index cf00f11..3a7b619 100644 --- a/ag/include/event.inc.php +++ b/ag/include/event.inc.php @@ -149,7 +149,7 @@ function getEventStatus($charid) { case EVENT_TEST: return 'Test'; case EVENT_SCHATZ_SUCHE: - return 'Schatzsuche'; + return 'Schatz Suche'; case EVENT_TURNIER: return 'Turnier'; case EVENT_KAMPF: @@ -164,9 +164,15 @@ function getEventStatus($charid) { return NULL; } +function getOngoingEventCount($charid) { + $sql = 'SELECT count(*) FROM event_chars e WHERE abgeholt = FALSE AND char_id = ' .$charid; + $row = mysql_fetch_row(mysql_query($sql)); + return $row[0]; +} + function getEventStatusBlocked($charid) { - $sql = 'SELECT Timestampdiff(Second,now(),MAX(block_end)) FROM event_chars WHERE char_id = ' . $charid; + $sql = 'SELECT Timestampdiff(Second,now(),MAX(block_end)) FROM event_chars WHERE abgeholt = FALSE AND char_id = ' . $charid; // echo $sql . '
'; $row = mysql_fetch_row(mysql_query($sql)); return $row[0];