- Herausforderungen |
+ Herausforderungen |
Clan herausfordern |
@@ -348,37 +404,40 @@ function displayClanFightMenu($user) {
Anzahl |
Status |
+
'.$challenged_clan['clanname'].' | '.formatTimestamp($challenge['challenged_time']).' | ';
- echo ''.getFightType($challenge['type']).' | '.$challenge['anzahl_chars'].' | ';
- echo 'ausstehend (zurückziehen) |
';
- } else {
- echo ''.$requester_clan['clanname'].' | '.formatTimestamp($challenge['challenged_time']).' | ';
- echo ''.getFightType($challenge['type']).' | '.$challenge['anzahl_chars'].' | ';
- echo 'annehmen |';
- echo 'ablehnen |
';
+ if(count($open_challenge_requests) == 0) {
+ echo 'Keine | ';
+ } else {
+ foreach ($open_challenge_requests as $challenge) {
+ $requester_clan = getClan($challenge['clan_requester']);
+ $challenged_clan = getClan($challenge['clan_challenged']);
+
+ //unterscheidung zwischen herausforder und herausgeforderter
+ if($user_clan['id'] == $challenge['clan_requester']) {
+ echo ''.$challenged_clan['clanname'].' | '.formatTimestamp($challenge['challenged_time']).' | ';
+ echo ''.getFightType($challenge['type']).' | '.$challenge['anzahl_chars'].' | ';
+ echo 'ausstehend (zurückziehen) |
';
+ } else {
+ echo ''.$requester_clan['clanname'].' | '.formatTimestamp($challenge['challenged_time']).' | ';
+ echo ''.getFightType($challenge['type']).' | '.$challenge['anzahl_chars'].' | ';
+ echo 'annehmen |';
+ echo 'ablehnen |
';
+ }
}
}
?>
+
- offene Herausforderungen |
+ offene Herausforderungen |
-
- Keine |
-
Keine';
} else {
foreach ($open_challenge_ids as $oci) {
$participating_clan_ids = getParticipatingClanIDs($oci);
@@ -388,30 +447,47 @@ function displayClanFightMenu($user) {
echo '
';
echo ' '.$challenged_clan['clanname'].' | ';
echo ''.anzeigen.' | ';
+ echo ''.abbrechen.' | ';
echo '
';
}
}
}
?>
+
+
+ Laufende Herausforderungen |
+
+ Keine';
+ } else {
+ foreach ($active_clan_challange_ids as $acci) {
+ $participating_clan_ids = getParticipatingClanIDs($acci);
+ foreach ($participating_clan_ids as $pci)
+ if($pci != $user_clan['id']) {
+ $challenged_clan = getClan($pci);
+ echo '
'.$challenged_clan['clanname'].' | ';
+ //TODO: hier muss javascript fenster aufgerufen werden
+ echo ''.anzeigen.' |
';
+ }
+ }
+ }
+ ?>
- Beendete Herausforderungen |
+ Beendete Herausforderungen |
- Keine |
- Keine';
} else {
foreach ($old_challenge_ids as $oci) {
$participating_clan_ids = getParticipatingClanIDs($oci);
foreach ($participating_clan_ids as $pci)
if($pci != $user_clan['id']) {
$challenged_clan = getClan($pci);
- echo '
';
- echo ' '.$challenged_clan['clanname'].' | ';
- echo ''.anzeigen.' | ';
- echo '
';
+ echo '
'.$challenged_clan['clanname'].' | ';
+ echo ''.anzeigen.' |
';
}
}
}
@@ -426,18 +502,17 @@ switch($action) {
case 'challengeclan':
displayChallengeClan($user_ida, $challangedclan_id);
break;
- case 'acceptchallenge':
+ case 'acceptclanchallenge':
displayChallengeAccepted($user_ida, $inquirychallenge_clanid);
break;
- case 'q_denychallenge':
+ case 'q_denyclanchallenge':
displayDenyChallenge($inquirychallenge_clanid, DENY_CHALLENGE);
break;
- case 'q_withdrawchallenge':
+ case 'q_withdrawclanchallenge':
displayDenyChallenge($inquirychallenge_clanid, WITHDRAW_CHALLENGE);
break;
case 'denychallenge':
- denyChallengeRequest($inquirychallenge_clanid, $user_ida);
- displayClanFightMenu($user_ida);
+ denyChallenge($type, $inquirychallenge_clanid, $user_ida);
break;
case 'showchallenge':
displayShowChallenge($clan_challange_id, $user_ida);
@@ -451,6 +526,12 @@ switch($action) {
case 'leavechallenge':
displayLeaveChallenge($user_ida, $clan_challange_id, $char_id);
break;
+ case 'q_cancelclanchallenge':
+ displayCancelChallenge($user_ida, $clan_challange_id);
+ break;
+ case 'cancelchallenge':
+ cancelThisChallenge($user_ida, $clan_challange_id);
+ break;
default:
displayClanFightMenu($user_ida);
}
diff --git a/ag/include/user.inc.php b/ag/include/user.inc.php
index 072de70..1aed720 100644
--- a/ag/include/user.inc.php
+++ b/ag/include/user.inc.php
@@ -25,6 +25,25 @@ function getUser($userid, $buffer_enabled = true) {
return $GLOBALS['user_buffered_instances'][$userid];
}
+/**
+ *
+ * Returns the user of the Character. (attributes of the user-table should be added here if needed)
+ * @param unknown_type $charid
+ * @param unknown_type $buffer_enabled
+ */
+function getOwnerOfChar($charid, $buffer_enabled = true) {
+ // Fehlerkontrolle
+ if(!is_numeric($charid)){
+ return null;
+ }
+ // Wenn Char nicht im Puffer ist, oder nicht gepuffert werden soll
+ if ($GLOBALS['user_buffered_instances'][$userid] == null || !$buffer_enabled) {
+ $user = mysql_fetch_assoc(mysql_query('SELECT u.nickname, u.id FROM user u INNER JOIN chars ch ON ch.besitzer=u.id WHERE ch.id = '.$charid));
+ $GLOBALS['user_buffered_instances'][$userid] = $user;
+ }
+ return $GLOBALS['user_buffered_instances'][$userid];
+}
+
function addMoneyToUser($userid, $amount) {
mysql_query('update user set geld = geld + ' . $amount . ' WHERE id = ' .$userid);
}