erster Teil für Frontend Clanfights (nicht fertig!!!)

Seelenzerstörer Bug behoben.
main
radiskull 13 years ago
parent a33f91757d
commit 84fe500a8a

@ -0,0 +1,158 @@
<?php
/*
*
* @copyright (c) 2009 animegame.eu
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public Licence
*
*/
include_once($_SERVER['DOCUMENT_ROOT'].'ag/include/clan.inc.php');
include_once($_SERVER['DOCUMENT_ROOT'].'ag/include/fehlerausgabe.inc.php');
include_once($_SERVER['DOCUMENT_ROOT'].'ag/include/parse.inc.php');
//Get-Section
if(isset($_GET['action'])) {
$action = $_GET['action'];
} else {
$action = NULL;
}
$challangedclan_id = validateUnsignedInteger($_GET['challangedclan_id'], null);
$inquirychallenge_clanid = validateUnsignedInteger($_GET['clanid'], null);
//unkritisch
function displayChallengeClan($user, $clan_id) {
if($clan_id == -1 || $clan_id == NULL) {
displayErrorMessage(NULL,'Es wurde kein Clan ausgewählt!', displayHistoryBackLink());
exit;
}
if($user['clan'] == $clan_id) {
displayErrorMessage(NULL,'Man kann sich nicht selbst herausfordern!', displayHistoryBackLink());
exit;
}
//TODO: es sollte hier unbedingt ne Auswahl geben wieviel Leute nun kämpfen dürfen :)
$result = challengeClan($user, $clan_id, 5);
if ($result != NULL) {
displayErrorMessage(NULL, $result, displayHistoryBackLink());
exit;
} else {
displayErrorMessage(NULL, 'Clan erfolgreich herausgefordert!', displayHistoryBackLink());
exit;
}
}
function displayChallengeAccepted($user, $clan_id) {
if(!is_numeric($clan_id)) {
displayErrorMessage(NULL, 'Wollte da jemand schummeln? ;)', displayHistoryBackLink());
exit;
}
acceptChallengeRequest($clan_id, $user);
echo 'Herausforderung wurde angenommen!<br><br>';
echo displayHistoryBackLink();
}
function displayDenyChallenge($clan_id) {
if(!is_numeric($clan_id)) {
displayErrorMessage(NULL, 'Wollte da jemand schummeln? ;)', displayHistoryBackLink());
exit;
}
?>
<table>
<tr>
<th colspan="2">Herausforderung wirklich ablehnen?</th>
</tr>
<tr>
<td align="center"><?php echo '<a href="index.php?as=clan/kampf_info&action=denychallenge&clanid='.$clan_id.'">ja</a>';?></td>
<td align="center"><?php echo '<a href="index.php?as=clan/kampf_info">nein</a>';?></td>
</tr>
</table>
<?php
}
function getFightType($id) {
switch ($id) {
case DAVY_BACK_FIGHT:
return 'Davy Back';
case SURVIVAL:
return 'Survival';
default:
return 'unbekannt';
}
}
function displayClanFightMenu($user) {
$user_clan = getClan($user['clan']);
$clans = getAllClans();
$challenges = getOpenChallengeRequests($user_clan['id']);
$test = getOpenChallengeIDs($user_clan['id']);
?>
<div align="center">
<table width="100%" border="1">
<tr>
<th height="30" colspan="2" align="center">Herausforderungen</th>
</tr>
<tr>
<th align="Left" height="25">Clan herausfordern</th>
<td>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="GET">
<input type="hidden" name="as" value="clan/kampf_info"> <input
type="hidden" name="action" value="challengeclan"> <select
id="input" name="challangedclan_id">
<option value="-1">Clan ausw&auml;hlen</option>
<?php
foreach($clans as $c) {
echo '<option value="'.$c['id'].'">'.$c['clanname'].'</option>';
}
?>
</select> <input class="input" type="submit" value="herausfordern" />
</form>
</td>
</tr>
<tr>
<td colspan="3">
<table width="100%" border="1">
<tr>
<th align="center" height="25">Herausforderer</th>
<th align="center" height="25">Datum</th>
<th align="center" height="25">Typ</th>
<th align="center" height="25">Anzahl</th>
<th align="center" height="25">Option</th>
</tr>
<?php
foreach ($challenges as $challenge) {
$clan = getClan($challenge['clan_requester']);
echo '<tr><td align ="center">'.$clan['clanname'].'</td><td align ="center">'.formatTimestamp($challenge['challenged_time']).'</td>';
echo '<td align ="center">'.getFightType($challenge['type']).'</td><td align ="center">'.$challenge['anzahl_chars'].'</td>';
echo '<td align ="center"><a href="index.php?as=clan/kampf_info&action=acceptchallenge&clanid='.$clan['id'].'">annehmen</a> |';
echo '<a href="index.php?as=clan/kampf_info&action=q_denychallenge&clanid='.$clan['id'].'">ablehnen</a></td></tr>';
}
?>
</table>
</td>
</tr>
<tr>
<th height="30" colspan="2" align="center">offene Herausforderungen</th>
</tr>
<?php
foreach ($challenges as $cllng) {
echo '<tr> <td>'.$cllng.'<td></tr>';
}
?>
</table>
</div><?php
}
if($action == 'challengeclan') {
displayChallengeClan($user_ida, $challangedclan_id);
} else if($action == 'acceptchallenge') {
displayChallengeAccepted($user_ida, $inquirychallenge_clanid);
} else if($action == 'q_denychallenge') {
displayDenyChallenge($inquirychallenge_clanid);
} else if($action == 'denychallenge') {
denyChallengeRequest($inquirychallenge_clanid, $user_ida);
displayClanFightMenu($user_ida);
} else if ($action == NULL) {
displayClanFightMenu($user_ida);
}
?>

@ -80,6 +80,7 @@ if ($name AND $passwort) {
$clan_009 = "
<a href=index.php?as=clan/clan_info>Mein Clan</a><br>
<a href=index.php?as=clan/kampf_info>Clan K&auml;mpfe</a><br>
<a href=index.php?as=clan/c_markt>Clan Markt</a><br>
<a href=index.php?as=clan/c_ware>Clan Item Nutzung</a><br>
<a href=index.php?as=clan/spende>Geld Spenden</a><br>

@ -186,7 +186,18 @@ function fireMember($user, $member){
}
}
/**
*
* Return all Clans with their id and name.
*
*/
function getAllClans() {
$qry = mysql_query('SELECT id,clanname FROM clan;');
while ($result = mysql_fetch_assoc($qry)) {
$clans[] = $result;
}
return $clans;
}
function joinClan($user, $clanid){
// last chance to lock the clan if in the old situation it was having to few members ;)
isClanLocked($clanid); // we only require the calculation not the result!

@ -9,37 +9,43 @@
####################KAIOKEN-LOSE SPIELER 1
if($technick1['type'] == 'lose2') {
$k_mp[0] = $k_mp[0] - $technick1['mp'];
if($k_mp[0] < 0) {
$schaden_1 = 'Schw&auml;chen fehlgeschlagen';
$k_mp[0] = 0;
} else {
if($technick1['starke'] >= mt_rand(1,100)) {
$schaden_1 = 'Schw&auml;chen';
$k_mp[1] = ($k_mp2[1] / 100) * 20;
} else {
$schaden_1 = 'Schw&auml;chen fehlgeschlagen';
}
}
$aktion_AV1[$x] = 'nein';
$k_mp[0] = $k_mp[0] - $technick1['mp'];
if($k_mp[0] < 0) {
$schaden_1 = 'Schw&auml;chen fehlgeschlagen';
$k_mp[0] = 0;
} else {
if($technick1['starke'] >= mt_rand(1,100)) {
$schaden_1 = 'Schw&auml;chen';
$k_mp[1] -= $k_mp2[1] * 0.8;
if($k_mp[1] < 0) {
$k_mp[1] = 0;
}
} else {
$schaden_1 = 'Schw&auml;chen fehlgeschlagen';
}
}
$aktion_AV1[$x] = 'nein';
}
####################KAIOKEN-LOSE SPIELER 2
if($technick2['type'] == 'lose2') {
$k_mp[1] = $k_mp[1] - $technick2['mp'];
if($k_mp[1] < 0) {
$schaden_2 = 'Schw&auml;chen fehlgeschlagen';
$k_mp[1] = 0;
} else {
$k_mp[1] = $k_mp[1] - $technick2['mp'];
if($k_mp[1] < 0) {
$schaden_2 = 'Schw&auml;chen fehlgeschlagen';
$k_mp[1] = 0;
} else {
if($technick2['starke'] >= mt_rand(1,100)) {
$schaden_2 = 'Schw&auml;chen';
$k_mp[0] = ($k_mp1[1] / 100) * 20;
} else {
$schaden_2 = 'Schw&auml;chen fehlgeschlagen';
if($technick2['starke'] >= mt_rand(1,100)) {
$schaden_2 = 'Schw&auml;chen';
$k_mp[0] -= $k_mp1[1] * 0.8;
if($k_mp[0] < 0) {
$k_mp[0] = 0;
}
} else {
$schaden_2 = 'Schw&auml;chen fehlgeschlagen';
}
}
$aktion_AV2[$x] = 'nein';
}
}
$aktion_AV2[$x] = 'nein';
}
?>

@ -39,8 +39,7 @@ function getUserGroups($user) {
$i = 0;
while ($result = mysql_fetch_assoc($qry)) {
$groups[$i] = array("gruppen_id" => $result['gruppen_id'], "gruppen_name" => $result['gruppen_name']);
$i++;
$groups[] = array("gruppen_id" => $result['gruppen_id'], "gruppen_name" => $result['gruppen_name']);
}
return $groups;

Loading…
Cancel
Save