|
|
|
@ -17,6 +17,8 @@ defineIfNotDefined('CLANKAMPF', 2);
|
|
|
|
|
//Anzahl der Runden pro Kampf
|
|
|
|
|
defineIfNotDefined('KAMPF_RUNDEN', 10);
|
|
|
|
|
|
|
|
|
|
$GLOBALS['char_buffered_attackset'] = array();
|
|
|
|
|
|
|
|
|
|
function createAttackSet($char_id, $type) {
|
|
|
|
|
if(!is_numeric($char_id) || !is_numeric($type)) {
|
|
|
|
|
return false;
|
|
|
|
@ -42,16 +44,20 @@ function deleteAttackSet($char_id, $type) {
|
|
|
|
|
return db_query($qry);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getAttackSet($char_id, $type) {
|
|
|
|
|
function getAttackSet($char_id, $type, $buffer_enabled = true) {
|
|
|
|
|
if(!is_numeric($char_id) || !is_numeric($type)) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
if (isset($GLOBALS['char_buffered_attackset'][$char_id]) && isset($GLOBALS['char_buffered_attackset'][$char_id][$type]) && $buffer_enabled) {
|
|
|
|
|
return $GLOBALS['char_buffered_attackset'][$char_id][$type];
|
|
|
|
|
}
|
|
|
|
|
$qry = db_query('SELECT attack_id, round FROM attackenset WHERE char_id = '.$char_id.' AND type = '.$type);
|
|
|
|
|
|
|
|
|
|
$set = array();
|
|
|
|
|
while ($result = mysqli_fetch_assoc($qry)) {
|
|
|
|
|
$set[$result['round']] = $result['attack_id'];
|
|
|
|
|
}
|
|
|
|
|
$GLOBALS['char_buffered_attackset'][$char_id][$type] = $set;
|
|
|
|
|
return $set;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -59,7 +65,7 @@ function updateAttackSet($char_id, $type, $newSet) {
|
|
|
|
|
if(!is_numeric($char_id) || !is_numeric($type) || !is_array($newSet) || count($newSet) == 0) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
$oldset = getAttackSet($char_id, $type);
|
|
|
|
|
$oldset = getAttackSet($char_id, $type, false);
|
|
|
|
|
|
|
|
|
|
for ($i = 1; $i < KAMPF_RUNDEN + 1; $i++) {
|
|
|
|
|
if($oldset[$i] != $newSet[$i]) {
|
|
|
|
@ -67,6 +73,7 @@ function updateAttackSet($char_id, $type, $newSet) {
|
|
|
|
|
db_query($qry);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
unset($GLOBALS['char_buffered_attackset'][$char_id][$type]);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|