aded the first requirenments for fetch a char from a event!

main
hecht 13 years ago
parent 69d12c9461
commit 62a93ecf4c

@ -108,27 +108,21 @@ echo "<b> $kampf_a1[name] vs. $kampf_a2[name]";
} }
#######################Clan Kampf #######################Clan Kampf
if($ab == "Clan Kampf") { if($ab == "Clanfight") {
echo "<SCRIPT language='JavaScript'>"; echo "<SCRIPT language='JavaScript'>";
?> ?>
function showfight(){ function showfight(){
var Info = window.open("./clan_kampf.php?char_id=<?php echo $char_id; ?>","","status=no,hotkeys=no,Height=600,Width=820,scrollbars=yes"); var Info = window.open("./event_abholen.php?<?php echo $abholstring; ?>","","status=no,hotkeys=no,Height=600,Width=820,scrollbars=yes");
} }
<?php <?php
echo "</SCRIPT>"; echo "</SCRIPT>";
$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 = getEventStatusBlocked($char_id);
$zeit_in_sek = $kampf_a[dauer] - time();
?> ?>
<p align=center><b>Clan Kampf</b><br>&nbsp; <br> <p align=center><b>Clan Kampf</b><br>&nbsp; <br>
<?php
echo "<b> $kampf_a[c1name] vs. $kampf_a[name] </b><br>&nbsp; <br>";
?>
<div align='center' id='timer'> <div align='center' id='timer'>
<?php <?php
if($zeit_in_sek <= 0){ if($zeit_in_sek <= 0){

@ -21,13 +21,13 @@ include_once(ROOT_PATH.'/include/fehlerausgabe.inc.php');
include_once(ROOT_PATH.'/include/char.inc.php'); include_once(ROOT_PATH.'/include/char.inc.php');
$chars = getCharsOfUser($user_ida['id']); $chars = getCharsOfUser($user_ida['id']);
$char_zahl = 0; $char_zahl = 0;
foreach($chars as $my_charz){ foreach($chars as $my_charz){
// $hp = explode(",", $my_charz[hp]); // $hp = explode(",", $my_charz[hp]);
// $mp = explode(",", $my_charz[mp]); // $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'] + $hp[1]/10 + $mp[1]/5;
$POWERLEVEL5 = $my_charz['starke']+$my_charz['verteidigung']+$my_charz['speed']+$my_charz['ausdauer']+$my_charz['glueck']; $POWERLEVEL5 = $my_charz['starke']+$my_charz['verteidigung']+$my_charz['speed']+$my_charz['ausdauer']+$my_charz['glueck'];
if($my_charz['fusion']=="ja"){ if($my_charz['fusion']=="ja"){
$fusi = "<br>Fusionsrasse: ".$my_charz['fusion_rasse']; $fusi = "<br>Fusionsrasse: ".$my_charz['fusion_rasse'];
@ -84,6 +84,8 @@ include_once(ROOT_PATH.'/include/char.inc.php');
$zeit_in_sek[$char_zahl] = $kampf_a['dauer']; $zeit_in_sek[$char_zahl] = $kampf_a['dauer'];
$temp = '<a href="index.php?as=abholen&ab='.$statustemp.'&char_id='.$my_charz['id'].'" id="popup">Status: '.$my_charz['status'].'</a><br /><span id="timer_'.$char_zahl.'"></span>'; $temp = '<a href="index.php?as=abholen&ab='.$statustemp.'&char_id='.$my_charz['id'].'" id="popup">Status: '.$my_charz['status'].'</a><br /><span id="timer_'.$char_zahl.'"></span>';
} else { } else {
$zeit_in_sek[$char_zahl] = getEventStatusBlocked($my_charz['id']);
$temp = '<a href="index.php?as=abholen&ab='.$statustemp.'&char_id='.$my_charz['id'].'" id="popup">Status: '.$my_charz['status'].'</a><br /><span id="timer_'.$char_zahl.'"></span>';
} }
$werte = "St&auml;rke: ".$c_starke."<br>Verteidigung: ".$c_verteidigung."<br>Geschwindigkeit: ".$c_speed."<br>Ausdauer: ".$c_ausdauer."<br>Gl&uuml;ck: ".$c_glueck; $werte = "St&auml;rke: ".$c_starke."<br>Verteidigung: ".$c_verteidigung."<br>Geschwindigkeit: ".$c_speed."<br>Ausdauer: ".$c_ausdauer."<br>Gl&uuml;ck: ".$c_glueck;
$lp = "<br><a href=index.php?as=lernpunkte&char_id=".$my_charz['id']." id=popup>Lernpunkte: ".$my_charz['lernpunkte']."</a>"; $lp = "<br><a href=index.php?as=lernpunkte&char_id=".$my_charz['id']." id=popup>Lernpunkte: ".$my_charz['lernpunkte']."</a>";
@ -96,17 +98,17 @@ include_once(ROOT_PATH.'/include/char.inc.php');
$status[$char_zahl]= $my_charz['status']; $status[$char_zahl]= $my_charz['status'];
$char_zahl++; $char_zahl++;
} }
$visiblechars = 8; $visiblechars = 8;
for($i=$char_zahl;$i<$visiblechars;$i++){ for($i=$char_zahl;$i<$visiblechars;$i++){
$CHARAKTER_NAME[$i] = "Kein Charakter"; $CHARAKTER_NAME[$i] = "Kein Charakter";
$CHARAKTER_VERWALTUNG[$i] = "none"; $CHARAKTER_VERWALTUNG[$i] = "none";
$CHARAKTER_LERNPUNKTE[$i] = "none"; $CHARAKTER_LERNPUNKTE[$i] = "none";
$CHARAKTER_TRAINING[$i] = "none"; $CHARAKTER_TRAINING[$i] = "none";
$CHARAKTER_STATUS[$i] = "none"; $CHARAKTER_STATUS[$i] = "none";
$CHARAKTER_SCHATZ[$i] = "none"; $CHARAKTER_SCHATZ[$i] = "none";
} }
if(!$chars_bilds['0']) { $chars_bilds['0'] = "bilder/Char.gif"; } if(!$chars_bilds['0']) { $chars_bilds['0'] = "bilder/Char.gif"; }
if(!$chars_bilds['1']) { $chars_bilds['1'] = "bilder/Char.gif"; } if(!$chars_bilds['1']) { $chars_bilds['1'] = "bilder/Char.gif"; }
@ -119,7 +121,8 @@ if(!$chars_bilds['7']) { $chars_bilds['7'] = "bilder/Char.gif"; }
?> ?>
<table cellpadding="5" cellspacing="0" width="100%" height="0"> <table cellpadding="5" cellspacing="0"
width="100%" height="0">
<!-- MSTableType="layout" --> <!-- MSTableType="layout" -->
<tr> <tr>
<?php <?php

@ -0,0 +1,26 @@
<?php
/*
*
* @copyright (c) 2011 animegame.eu
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public Licence
*
*/
include_once('path.inc.php'); // get the path ;)
include_once (ROOT_PATH . '/include/config.inc.php');
include_once (ROOT_PATH . '/include/char.inc.php');
include_once (ROOT_PATH . '/include/event.inc.php');
include_once (ROOT_PATH . '/include/parse.inc.php');
$char_id = validateUnsignedInteger($_GET['char_id'], null);
//function abholenChar(array $user, $event_id, $char_id) {
//function getEventIdsToFetch($charid) {
$ids = getEventIdsToFetch($char_id);
foreach ($ids as $id) {
// abholenChar(array $user, $event_id, $char_id)
}
?>

@ -218,8 +218,10 @@ function acceptChallengeRequest($challenged_clan, array $user) {
} }
// insert the participants :) // 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'].')'); $sql = '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'].')'); 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 :) // 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?? // 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); $row = mysql_fetch_assoc($qry);
if($row['anzahl'] != 0) { if($row['anzahl'] != 0) {

@ -141,8 +141,8 @@ function persistFight($event_id, array $combinedArray, $startTimestamp, $endTime
function getEventStatus($charid) { 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 . '<br>';
$qry = mysql_query($sql); $qry = mysql_query($sql);
$row = mysql_fetch_assoc($qry); $row = mysql_fetch_assoc($qry);
switch ($row['event_type']) { switch ($row['event_type']) {
@ -161,6 +161,27 @@ function getEventStatus($charid) {
case EVENT_CLAN_FIGHT: case EVENT_CLAN_FIGHT:
return 'Clanfight'; return 'Clanfight';
} }
return NULL;
}
function getEventStatusBlocked($charid) {
$sql = 'SELECT Timestampdiff(Second,now(),MAX(block_end)) FROM event_chars WHERE char_id = ' . $charid;
// echo $sql . '<br>';
$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) { function abholenChar(array $user, $event_id, $char_id) {

Loading…
Cancel
Save