You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
137 lines
4.0 KiB
137 lines
4.0 KiB
<?php
|
|
/*
|
|
*
|
|
* @copyright (c) 2011 animegame.eu
|
|
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public Licence
|
|
*
|
|
*/
|
|
|
|
include_once($_SERVER['DOCUMENT_ROOT'].'ag/include/user.inc.php');
|
|
include_once($_SERVER['DOCUMENT_ROOT'].'ag/include/parse.inc.php');
|
|
include_once($_SERVER['DOCUMENT_ROOT'].'ag/include/clan.inc.php');
|
|
include_once($_SERVER['DOCUMENT_ROOT'].'ag/include/clan_fights.inc.php');
|
|
|
|
|
|
$acceptTestCase = true;
|
|
|
|
mysql_query('DELETE FROM clan_challenge_requests');
|
|
mysql_query('DELETE FROM clan_challenges');
|
|
mysql_query('DELETE FROM events');
|
|
|
|
$clan1 = getClan(786);
|
|
$clan2 = getClan(783);
|
|
|
|
$leaderClan1 = getUser($clan1['leader']);
|
|
$leaderClan2 = getUser($clan2['leader']);
|
|
|
|
$result = challengeClan($leaderClan1, $clan2['id'], 1);
|
|
if($result !== NULL) {
|
|
echo $result.'<br>';
|
|
}
|
|
|
|
if(getOpenChallengeRequestCount($clan1['id']) != 1) {
|
|
echo 'Fehler: Es sollte mindestens ein Fight offen sein!!<br>';
|
|
}
|
|
|
|
if(getOpenChallengeRequestCount($clan2['id']) != 1) {
|
|
echo 'Fehler: Es sollte mindestens ein Fight offen sein!!<br>';
|
|
}
|
|
|
|
if(count(getOpenChallengeRequests($clan1['id'])) != 1) {
|
|
echo 'Fehler: Es sollte mindestens ein Fight offen sein!!<br>';
|
|
}
|
|
|
|
if(count(getOpenChallengeRequests($clan2['id'])) != 1) {
|
|
echo 'Fehler: Es sollte mindestens ein Fight offen sein!!<br>';
|
|
}
|
|
|
|
$challengeArray = getOpenChallengeRequests($clan2['id']);
|
|
|
|
if($acceptTestCase) {
|
|
|
|
$result = acceptChallengeRequest($challengeArray[0]['clan_requester'], $leaderClan2);
|
|
|
|
if($result !== NULL) {
|
|
echo $result.'<br>';
|
|
}
|
|
|
|
if(getOpenChallengeRequestCount($clan1['id']) > 0) {
|
|
echo 'Fehler in getOpenChallengeRequestCount: Es sollte kein Fight-Request offen sein!!<br>';
|
|
}
|
|
|
|
if(getOpenChallengeRequestCount($clan2['id']) > 0) {
|
|
echo 'Fehler in getOpenChallengeRequestCount: Es sollte kein Fight-Request offen sein!!<br>';
|
|
}
|
|
|
|
if(count(getOpenChallengeRequests($clan1['id'])) > 0) {
|
|
echo 'Fehler in getOpenChallengeRequests ('.$clan1['id'].'): Es sollte kein Fight-Request offen sein!!<br>';
|
|
}
|
|
|
|
if(count(getOpenChallengeRequests($clan2['id'])) > 0) {
|
|
echo 'Fehler in getOpenChallengeRequests ('.$clan2['id'].'): Es sollte kein Fight-Request offen sein!!<br>';
|
|
}
|
|
|
|
|
|
if(count(getOpenChallengeIDs($clan1['id'])) != 1) {
|
|
echo 'Fehler: Es sollte mindestens ein Fight offen sein!!<br>';
|
|
}
|
|
|
|
if(count(getOpenChallengeIDs($clan2['id'])) != 1) {
|
|
echo 'Fehler: Es sollte mindestens ein Fight offen sein!!<br>';
|
|
}
|
|
|
|
$challengeIDsArray = getOpenChallengeIDs($clan1['id']);
|
|
$clan_challenge_id = $challengeIDsArray[0];
|
|
if(count(getParticipatingClanIDs($clan_challenge_id)) != 2) {
|
|
echo 'Fehler in getParticipatingClanIDs: Es sollten 2 Clans teilnehmen!<br>';
|
|
}
|
|
|
|
// Okay now let the chars participate
|
|
|
|
$chars1 = getCharsOfUser($leaderClan1['id']);
|
|
$chars2 = getCharsOfUser($leaderClan2['id']);
|
|
|
|
$result = joinChallenge($clan_challenge_id, $leaderClan1, $chars1[0]['id'], 1);
|
|
if($result !== NULL) {
|
|
echo $result .'<br>';
|
|
}
|
|
$result = joinChallenge($clan_challenge_id, $leaderClan1, $chars1[1]['id'], 2);
|
|
if($result === NULL) {
|
|
echo 'Error: Es war möglich einen zweiten Char desselben Users hinzuzufügen!!';
|
|
}
|
|
|
|
$result = joinChallenge($clan_challenge_id, $leaderClan2, $chars2[0]['id'], 1);
|
|
if($result !== NULL) {
|
|
echo $result .'<br>';
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
$result = denyChallengeRequest($challengeArray[0]['clan_requester'], $leaderClan2);
|
|
|
|
if($result !== NULL) {
|
|
echo $result .'<br>';
|
|
}
|
|
|
|
if(getOpenChallengeRequestCount($clan1['id']) > 0) {
|
|
echo 'Fehler in getOpenChallengeRequestCount: Es sollte kein Fight-Request offen sein!!<br>';
|
|
}
|
|
|
|
if(getOpenChallengeRequestCount($clan2['id']) > 0) {
|
|
echo 'Fehler in getOpenChallengeRequestCount: Es sollte kein Fight-Request offen sein!!<br>';
|
|
}
|
|
|
|
if(count(getOpenChallengeRequests($clan1['id'])) > 0) {
|
|
echo 'Fehler in getOpenChallengeRequests ('.$clan1['id'].'): Es sollte kein Fight-Request offen sein!!<br>';
|
|
}
|
|
|
|
if(count(getOpenChallengeRequests($clan2['id'])) > 0) {
|
|
echo 'Fehler in getOpenChallengeRequests ('.$clan2['id'].'): Es sollte kein Fight-Request offen sein!!<br>';
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|