code säuberung attackensets

main
radiskull 13 years ago
parent 10334d2b79
commit 7e06965ea6

@ -52,7 +52,7 @@ function stelledar($char_id,$user_ida,$name) {
type="hidden" name="char_id" value="<?php echo $char_id; ?>" /> <input
type="hidden" name="submit" value="1" />
<table border="1" cellpadding="0" cellspacing="0"
<table border="0" cellpadding="0" cellspacing="0"
style="border-collapse: collapse;" bordercolor="#111111" width="100%"
height="25">
<tr>
@ -322,16 +322,6 @@ function stelledar($char_id,$user_ida,$name) {
}
}
function getAttackNamesFromAttackSet($attset) {
$qry = mysql_query('SELECT l.id,a.name FROM attacken a INNER JOIN lernen l ON a.id=l.at_id WHERE l.id in ('.implode(',', $attset).');');
while ($result = mysql_fetch_assoc($qry)) {
$set[$result['id']] = $result['name'];
}
return $set;
}
function eintragen($char_id,$name,$user_ida) {
$char = getChar($char_id);
if($char['besitzer'] != $user_ida['id']) {
@ -339,7 +329,7 @@ function eintragen($char_id,$name,$user_ida) {
exit;
}
if(!checkCharStatus($char, 'Frei')) {
if(!checkCharStatus($char_id, STATUS_FREI)) {
displayErrorMessage(NULL,'Der Charakter ist zur Zeit nicht frei!', displayHistoryBackLink());
exit;
}

@ -40,18 +40,18 @@ function getCharAttackSet($char_id, $type) {
}
if(is_numeric($char_id)) {
$qry = mysql_query('SELECT Attack_ID, Round FROM attackenset WHERE Char_ID = '.$char_id.' AND Type = '.$type);
$qry = mysql_query('SELECT attack_id, round FROM attackenset WHERE char_id = '.$char_id.' AND type = '.$type);
}
while ($result = mysql_fetch_assoc($qry)) {
$set[$result['Round']] = $result['Attack_ID'];
$set[$result['round']] = $result['attack_id'];
}
return $set;
}
function updateCharAttack($char_id, $att_id,$round, $type) {
$qry = 'UPDATE attackenset SET Attack_ID = '.$att_id.' WHERE Char_ID = '.$char_id.' AND Type = '.$type.' AND Round = '.$round.';';
$qry = 'UPDATE attackenset SET attack_id = '.$att_id.' WHERE char_id = '.$char_id.' AND type = '.$type.' AND round = '.$round.';';
mysql_query($qry);
}
@ -74,6 +74,16 @@ function updateCharAttackSet($char_id, $set, $type) {
}
}
function getAttackNamesFromAttackSet($attset) {
$qry = mysql_query('SELECT l.id,a.name FROM attacken a INNER JOIN lernen l ON a.id=l.at_id WHERE l.id in ('.implode(',', $attset).');');
while ($result = mysql_fetch_assoc($qry)) {
$set[$result['id']] = $result['name'];
}
return $set;
}
function getAttackTypesFromAttackSet($attset) {
$qry = mysql_query('SELECT l.id,a.type FROM attacken a INNER JOIN lernen l ON a.id=l.at_id WHERE l.id in ('.implode(',', $attset).');');

@ -7,6 +7,8 @@
*/
include_once($_SERVER['DOCUMENT_ROOT'].'ag/include/char.inc.php');
defineIfNotDefined('STATUS_FREI', 'Frei');
//Dadurch kriege ich detailierte infos, sollte ein mysql query mal inkorrekt sein!
function safe_query($query="") {
if(empty($query)) return false;
@ -38,14 +40,13 @@ function chardaten($char_id,$name,&$char_1,&$hp1,&$mp1,&$exp,&$fehler) {
/**
*
* Überprüft den Status des Charakters
* @param Array $char: Der Charakterarray, welche 'status' beinhalten muss
*
* @param Int $char_id: Die ID des zu überprüfenden Charakters
* @param String $status: Der Status auf den geprüft wird
*/
function checkCharStatus($char, $status) {
if($char['status'] == $status) {
return TRUE;
}
return FALSE;
function checkCharStatus($char_id, $status) {
$char = getChar($char_id, false);
return $char['status'] == $status;
}
?>
Loading…
Cancel
Save