diff --git a/ag/abholen.php b/ag/abholen.php
index 52fa20d..6322d42 100644
--- a/ag/abholen.php
+++ b/ag/abholen.php
@@ -108,27 +108,21 @@ echo " $kampf_a1[name] vs. $kampf_a2[name]";
}
#######################Clan Kampf
-if($ab == "Clan Kampf") {
+if($ab == "Clanfight") {
echo "";
-$kampf_a = mysql_fetch_array(mysql_query("SELECT c1.name AS c1name, c2.name, k.id, k.dauer FROM clan_kampf k LEFT JOIN chars c1 ON(k.char1=c1.id) LEFT JOIN chars c2 ON(k.char2=c2.id) WHERE k.db_satz='$char_id' LIMIT 1"));
-
-$zeit_in_sek = $kampf_a[dauer] - time();
+$zeit_in_sek = getEventStatusBlocked($char_id);
?>
Fusionsrasse: ".$my_charz['fusion_rasse'];
- }
- else
- $fusi = "";
- if($my_charz['type']=="Onepiece"){
- $frucht = "
Teufelsfrucht: ".$my_charz['frucht'];
- }
- else
- $frucht = "";
- $hptemp = explode(",", $my_charz['hp']);
- $hpleft[$char_zahl] = $hptemp['0'] / $hptemp['1'] * 100;
- $mptemp = explode(",", $my_charz['mp']);
- $mpleft[$char_zahl] = $mptemp['0'] / $mptemp['1'] * 100;
- $exptemp = explode(",", $my_charz['exp']);
- $room = mysql_query('SELECT ci.name FROM clan_item ci inner join clan_ware cw on ci.id = cw.item_id WHERE cw.id='.$my_charz['clan_train']);
- $clanroom=mysql_fetch_assoc($room);
-
- if($clanroom['name']=="")
- $clanroom['name']="kein";
-
- $temproom="
";
-
- $hp = "HP: ".$hptemp['0']." / ".$hptemp['1'];
- if($my_charz['status'] == "Schatz Suche")
- $statustemp = "Schatz%20Suche";
- else
- $statustemp = $my_charz['status'];
-
-
- if($my_charz['kampf_item'] != NULL && $my_charz['kampf_item'] != ',,,,'){
- // echo 'Problematic Entry = '.$chara_1['kampf_item'].'
';
- $char1_buffs = mysql_fetch_assoc(mysql_query('SELECT sum(i.hp) as hp, sum(i.mp) as mp, sum(i.starke) as starke, sum(i.verteidigung) as verteidigung, sum(i.speed) as speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id IN (' . $my_charz['kampf_item'] . ')'));
- }
- $c_starke = $char1_buffs['starke']==0?$my_charz['starke']:($my_charz['starke']).' (+'.$char1_buffs['starke'].')';
- $c_verteidigung = $char1_buffs['verteidigung']==0?$my_charz['verteidigung']:($my_charz['verteidigung']).' (+'.$char1_buffs['verteidigung'].')';
- $c_speed = $char1_buffs['speed']==0?$my_charz['speed']:($my_charz['speed']).' (+'.$char1_buffs['speed'].')';
- $c_ausdauer = $char1_buffs['ausdauer']==0?$my_charz['ausdauer']:($my_charz['ausdauer']).' (+'.$char1_buffs['ausdauer'].')';
- $c_glueck = $char1_buffs['glueck']==0?$my_charz['glueck']:($my_charz['glueck']).' (+'.$char1_buffs['glueck'].')';
-
- $mp = "MP: ".$mptemp['0']." / ".$mptemp['1'];
- $exp = "Exp: ".$exptemp['0']." / ".$exptemp['1'];
- if($my_charz['status'] == 'Frei' ){
- $temp = 'Status: '.$my_charz['status'];
- } elseif($my_charz['status'] == 'Angemeldet' OR $my_charz['status'] == 'Kampf erstellt') {
- $temp = 'Status: '.$my_charz['status'];
- } elseif($my_charz['status'] == 'Kampf') {
- $kampf_a = mysql_fetch_assoc(mysql_query("SELECT dauer FROM kampf WHERE db_satz='".$my_charz['id']."' order by id DESC LIMIT 1"));
- $zeit_in_sek[$char_zahl] = $kampf_a['dauer'] - time();
- $temp = '
';
- } elseif($my_charz['status'] == 'Schatz Suche') {
- $kampf_a = mysql_fetch_array(mysql_query('select Timestampdiff(Second,now(),dauer) as dauer from quests where charid = '.$my_charz['id']));
- $zeit_in_sek[$char_zahl] = $kampf_a['dauer'];
- $temp = '
';
- } else {
- }
- $werte = "Stärke: ".$c_starke."
Verteidigung: ".$c_verteidigung."
Geschwindigkeit: ".$c_speed."
Ausdauer: ".$c_ausdauer."
Glück: ".$c_glueck;
- $lp = "
";
- $tp = "".$temproom;
+$chars = getCharsOfUser($user_ida['id']);
+$char_zahl = 0;
+foreach($chars as $my_charz){
+ // $hp = explode(",", $my_charz[hp]);
+ // $mp = explode(",", $my_charz[mp]);
+ //
+ // $POWERLEVEL5 = $my_charz['starke']+$my_charz['verteidigung']+$my_charz['speed']+$my_charz['ausdauer']+$my_charz['glueck'] + $hp[1]/10 + $mp[1]/5;
+ $POWERLEVEL5 = $my_charz['starke']+$my_charz['verteidigung']+$my_charz['speed']+$my_charz['ausdauer']+$my_charz['glueck'];
+ if($my_charz['fusion']=="ja"){
+ $fusi = "
Fusionsrasse: ".$my_charz['fusion_rasse'];
+ }
+ else
+ $fusi = "";
+ if($my_charz['type']=="Onepiece"){
+ $frucht = "
Teufelsfrucht: ".$my_charz['frucht'];
+ }
+ else
+ $frucht = "";
+ $hptemp = explode(",", $my_charz['hp']);
+ $hpleft[$char_zahl] = $hptemp['0'] / $hptemp['1'] * 100;
+ $mptemp = explode(",", $my_charz['mp']);
+ $mpleft[$char_zahl] = $mptemp['0'] / $mptemp['1'] * 100;
+ $exptemp = explode(",", $my_charz['exp']);
+ $room = mysql_query('SELECT ci.name FROM clan_item ci inner join clan_ware cw on ci.id = cw.item_id WHERE cw.id='.$my_charz['clan_train']);
+ $clanroom=mysql_fetch_assoc($room);
+
+ if($clanroom['name']=="")
+ $clanroom['name']="kein";
+
+ $temproom="
";
+
+ $hp = "HP: ".$hptemp['0']." / ".$hptemp['1'];
+ if($my_charz['status'] == "Schatz Suche")
+ $statustemp = "Schatz%20Suche";
+ else
+ $statustemp = $my_charz['status'];
+
+
+ if($my_charz['kampf_item'] != NULL && $my_charz['kampf_item'] != ',,,,'){
+ // echo 'Problematic Entry = '.$chara_1['kampf_item'].'
';
+ $char1_buffs = mysql_fetch_assoc(mysql_query('SELECT sum(i.hp) as hp, sum(i.mp) as mp, sum(i.starke) as starke, sum(i.verteidigung) as verteidigung, sum(i.speed) as speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id IN (' . $my_charz['kampf_item'] . ')'));
+ }
+ $c_starke = $char1_buffs['starke']==0?$my_charz['starke']:($my_charz['starke']).' (+'.$char1_buffs['starke'].')';
+ $c_verteidigung = $char1_buffs['verteidigung']==0?$my_charz['verteidigung']:($my_charz['verteidigung']).' (+'.$char1_buffs['verteidigung'].')';
+ $c_speed = $char1_buffs['speed']==0?$my_charz['speed']:($my_charz['speed']).' (+'.$char1_buffs['speed'].')';
+ $c_ausdauer = $char1_buffs['ausdauer']==0?$my_charz['ausdauer']:($my_charz['ausdauer']).' (+'.$char1_buffs['ausdauer'].')';
+ $c_glueck = $char1_buffs['glueck']==0?$my_charz['glueck']:($my_charz['glueck']).' (+'.$char1_buffs['glueck'].')';
+
+ $mp = "MP: ".$mptemp['0']." / ".$mptemp['1'];
+ $exp = "Exp: ".$exptemp['0']." / ".$exptemp['1'];
+ if($my_charz['status'] == 'Frei' ){
+ $temp = 'Status: '.$my_charz['status'];
+ } elseif($my_charz['status'] == 'Angemeldet' OR $my_charz['status'] == 'Kampf erstellt') {
+ $temp = 'Status: '.$my_charz['status'];
+ } elseif($my_charz['status'] == 'Kampf') {
+ $kampf_a = mysql_fetch_assoc(mysql_query("SELECT dauer FROM kampf WHERE db_satz='".$my_charz['id']."' order by id DESC LIMIT 1"));
+ $zeit_in_sek[$char_zahl] = $kampf_a['dauer'] - time();
+ $temp = '
';
+ } elseif($my_charz['status'] == 'Schatz Suche') {
+ $kampf_a = mysql_fetch_array(mysql_query('select Timestampdiff(Second,now(),dauer) as dauer from quests where charid = '.$my_charz['id']));
+ $zeit_in_sek[$char_zahl] = $kampf_a['dauer'];
+ $temp = '
';
+ } else {
+ $zeit_in_sek[$char_zahl] = getEventStatusBlocked($my_charz['id']);
+ $temp = '
';
+ }
+ $werte = "Stärke: ".$c_starke."
Verteidigung: ".$c_verteidigung."
Geschwindigkeit: ".$c_speed."
Ausdauer: ".$c_ausdauer."
Glück: ".$c_glueck;
+ $lp = "
";
+ $tp = "".$temproom;
- //$temp = $statustemp."";
- $temp2 = "Level: ".$my_charz['level']."
Powerlevel: $POWERLEVEL5
Typ: ".$my_charz['type']."
Rasse: ".$my_charz['rasse'].$fusi.$frucht.$lp."
$tp
$hp
$mp
$exp
$werte";
+ //$temp = $statustemp."";
+ $temp2 = "Level: ".$my_charz['level']."
Powerlevel: $POWERLEVEL5
Typ: ".$my_charz['type']."
Rasse: ".$my_charz['rasse'].$fusi.$frucht.$lp."
$tp
$hp
$mp
$exp
$werte";
- $popup[$char_zahl] = $temp.'
'.''.$my_charz['name'].'
'.$temp2;
- $status[$char_zahl]= $my_charz['status'];
+ $popup[$char_zahl] = $temp.'
'.''.$my_charz['name'].'
'.$temp2;
+ $status[$char_zahl]= $my_charz['status'];
- $char_zahl++;
- }
- $visiblechars = 8;
-
- for($i=$char_zahl;$i<$visiblechars;$i++){
- $CHARAKTER_NAME[$i] = "Kein Charakter";
- $CHARAKTER_VERWALTUNG[$i] = "none";
- $CHARAKTER_LERNPUNKTE[$i] = "none";
- $CHARAKTER_TRAINING[$i] = "none";
- $CHARAKTER_STATUS[$i] = "none";
- $CHARAKTER_SCHATZ[$i] = "none";
- }
+ $char_zahl++;
+}
+$visiblechars = 8;
+
+for($i=$char_zahl;$i<$visiblechars;$i++){
+ $CHARAKTER_NAME[$i] = "Kein Charakter";
+ $CHARAKTER_VERWALTUNG[$i] = "none";
+ $CHARAKTER_LERNPUNKTE[$i] = "none";
+ $CHARAKTER_TRAINING[$i] = "none";
+ $CHARAKTER_STATUS[$i] = "none";
+ $CHARAKTER_SCHATZ[$i] = "none";
+}
if(!$chars_bilds['0']) { $chars_bilds['0'] = "bilder/Char.gif"; }
if(!$chars_bilds['1']) { $chars_bilds['1'] = "bilder/Char.gif"; }
@@ -119,40 +121,41 @@ if(!$chars_bilds['7']) { $chars_bilds['7'] = "bilder/Char.gif"; }
?>
-
+
- ';
- echo '';
-
- echo '';
- if($hpleft[$i] > 1)
- echo ' | ';
- if($hpleft[$i] < 100)
- echo ' | ';
- echo '
';
- echo '';
- if($mpleft[$i] > 1)
- echo ' | ';
- if($mpleft[$i] < 100)
- echo ' | ';
- echo '
';
-
- echo $popup[$i].'';
-
- if($i==3){
- echo '
';
- }
+
+ echo '';
+ echo '';
+
+ echo '';
+ if($hpleft[$i] > 1)
+ echo ' | ';
+ if($hpleft[$i] < 100)
+ echo ' | ';
+ echo ' ';
+ echo '';
+ if($mpleft[$i] > 1)
+ echo ' | ';
+ if($mpleft[$i] < 100)
+ echo ' | ';
+ echo ' ';
+
+ echo $popup[$i].' | ';
+
+ if($i==3){
+ echo '
';
}
- if ($status[$i] != 'Frei' AND $status[$i] != 'Angemeldet' AND $status[$i] != 'Kampf erstellt') {
- ?>
-
+ }
+ ?>
-
\ No newline at end of file
+
diff --git a/ag/event_abholen.php b/ag/event_abholen.php
new file mode 100644
index 0000000..9ab08be
--- /dev/null
+++ b/ag/event_abholen.php
@@ -0,0 +1,26 @@
+
\ No newline at end of file
diff --git a/ag/include/clan_fights.inc.php b/ag/include/clan_fights.inc.php
index 5366395..82cbb7b 100644
--- a/ag/include/clan_fights.inc.php
+++ b/ag/include/clan_fights.inc.php
@@ -218,8 +218,10 @@ function acceptChallengeRequest($challenged_clan, array $user) {
}
// insert the participants :)
- mysql_query('INSERT INTO clan_challenge_clans(clan_challenge_id, clan_id, clan_coordinator, elo) values('.$id.', '.$clan['id'].', '.$user['id'].', ' .$clan['elo'].')');
- mysql_query('INSERT INTO clan_challenge_clans(clan_challenge_id, clan_id, clan_coordinator, elo) values('.$id.', '.$oclan['id'].', ' .$clan_challenge['clan_challenge_creator'].', ' .$clan['elo'].')');
+ $sql = 'INSERT INTO clan_challenge_clans(clan_challenge_id, clan_id, clan_coordinator, elo) values('.$id.', '.$clan['id'].', '.$user['id'].', ' .$clan['elo'].')';
+ mysql_query($sql);
+ $sql = 'INSERT INTO clan_challenge_clans(clan_challenge_id, clan_id, clan_coordinator, elo) values('.$id.', '.$oclan['id'].', ' .$clan_challenge['clan_challenge_creator'].', ' .$clan['elo'].')';
+ mysql_query($sql);
// we have everything we need for this challenge to be opened :)
@@ -463,7 +465,7 @@ function joinChallenge($clan_challenge_id, array $user, $charid, $slot ) {
}
// okay does this user already has a char in the fight??
- $qry = mysql_query('SELECT count(*) as anzahl FROM clan_challenge_participants ccp inner join chars c on ccp.char_id = c.id WHERE besitzer = ' .$user['id']);
+ $qry = mysql_query('SELECT count(*) as anzahl FROM clan_challenge_participants ccp inner join chars c on ccp.char_id = c.id WHERE besitzer = ' .$user['id'] . ' AND clan_challenge_id = ' . $clan_challenge_id);
$row = mysql_fetch_assoc($qry);
if($row['anzahl'] != 0) {
@@ -588,7 +590,7 @@ function calculateChallenge($clan_challenge_id) {
$sql = 'update clan_challenge_clans ccc inner join clan c on c.id = clan_id SET ccc.elo = c.elo WHERE clan_id IN (' . implode(', ', $clan_ids) .')';
$res = mysql_query($sql);
if(!$res)
- echo 'Could not execute QUERY : ' .$sql .'
';
+ echo 'Could not execute QUERY : ' .$sql .'
';
foreach ($clan_char_ids as $slot => $char_id) {
addParticipant($event_id, getChar($char_id));
@@ -776,16 +778,16 @@ function isAuthorizedClanfightCoordinator($clan_id, $user_id, $clan_fight_id = N
// it is a more general thing ;)
$sql = 'SELECT COUNT(*) FROM `clan_challenge_whitelist` WHERE `user_id` = ' .$user_id. ' AND `clan_id` = '.$clan_id;
$row = mysql_fetch_row(mysql_query($sql));
- if($row[0] <= 0) {
- // okay, maybe its a leader ;)
- $clan = getClan($clan_id);
- if($clan['leader'] == $user_id || $clan['co_leader'] == $user_id) {
- // the leader or the co_leader is always authorized!
+ if($row[0] <= 0) {
+ // okay, maybe its a leader ;)
+ $clan = getClan($clan_id);
+ if($clan['leader'] == $user_id || $clan['co_leader'] == $user_id) {
+ // the leader or the co_leader is always authorized!
//echo 'true
';
- return true;
- }
- // not authorized!
- return false;
+ return true;
+ }
+ // not authorized!
+ return false;
}
}
return true;
diff --git a/ag/include/event.inc.php b/ag/include/event.inc.php
index a3563e8..54aebb6 100644
--- a/ag/include/event.inc.php
+++ b/ag/include/event.inc.php
@@ -141,8 +141,8 @@ function persistFight($event_id, array $combinedArray, $startTimestamp, $endTime
function getEventStatus($charid) {
- $sql = 'SELECT event_type FROM event_chars ec inner join events e on ec.event_id = e.event_id where block_end > now() and char_id = ' . $charid;
-
+ $sql = 'SELECT event_type FROM event_chars ec inner join events e on ec.event_id = e.event_id where (block_end > now() or abgeholt = 1) and char_id = ' . $charid;
+// echo $sql . '
';
$qry = mysql_query($sql);
$row = mysql_fetch_assoc($qry);
switch ($row['event_type']) {
@@ -161,6 +161,27 @@ function getEventStatus($charid) {
case EVENT_CLAN_FIGHT:
return 'Clanfight';
}
+ return NULL;
+}
+
+
+function getEventStatusBlocked($charid) {
+ $sql = 'SELECT Timestampdiff(Second,now(),MAX(block_end)) FROM event_chars WHERE char_id = ' . $charid;
+// echo $sql . '
';
+ $row = mysql_fetch_row(mysql_query($sql));
+ return $row[0];
+}
+
+function getEventIdsToFetch($charid) {
+ $sql = 'SELECT event_id FROM event_chars e WHERE block_end < now() and abgeholt = 1 AND char_id = ' .$charid;
+ $qry = mysql_query($sql);
+
+ $result = array();
+
+ while ($row = mysql_fetch_row($qry)) {
+ $result[] = $row[0];
+ }
+ return $result;
}
function abholenChar(array $user, $event_id, $char_id) {
@@ -285,8 +306,8 @@ function getEventFightIdsByChar($event_id, $event_char_id) {
}
function getEventFightRoundData($event_id, $event_fight_id, $round) {
- $sql = 'SELECT * FROM event_fight_rounds WHERE event_id = ' . $event_id . ' AND event_fight_id = ' . $event_fight_id . ' AND `round` = ' .$round;
-
+ $sql = 'SELECT * FROM event_fight_rounds WHERE event_id = ' . $event_id . ' AND event_fight_id = ' . $event_fight_id . ' AND `round` = ' .$round;
+
$qry = mysql_query($sql);
if(!$qry) {
echo $sql . '
';