diff --git a/ag/include/user.inc.php b/ag/include/user.inc.php
index 158cd0d..c0ade6b 100644
--- a/ag/include/user.inc.php
+++ b/ag/include/user.inc.php
@@ -120,4 +120,35 @@ function encryptPassword($password){
return $result['pw'];
}
+function getUserMetaData($userid) {
+ $sql = 'SELECT * FROM user_meta_data WHERE user_id = ' . $userid;
+ $qry = mysql_query($sql);
+
+ $result = array();
+ if(!$qry)
+ {
+ echo $sql .'
';
+ return $result;
+ }
+
+ while ($row = mysql_fetch_assoc($qry)) {
+ $result[$row['key']] = $row['value'];
+ }
+ return $result;
+}
+
+function setUserMetaDataEntry($userid, $key, $value) {
+ $sql = 'UPDATE user_meta_data SET `value` = \''.$value.'\' WHERE user_id = \''.$userid.'\' and `key` = \''.$key.'\'';
+ $qry = mysql_query($sql);
+ if(!qry)
+ return;
+
+ if(mysql_affected_rows() > 0)
+ return;
+
+ $sql = 'INSERT INTO user_meta_data(user_id, `key`, `value`) values (\''.$userid.'\',\''.$key.'\',\''.$value.'\')';
+ $qry = mysql_query($sql);
+}
+
+
?>
\ No newline at end of file
diff --git a/ag/index.php b/ag/index.php
index 811d476..6f2383d 100644
--- a/ag/index.php
+++ b/ag/index.php
@@ -431,6 +431,28 @@ if($as != "irc" AND $as != "login" AND $as != "anmeldung" AND $as != "info/logs"
+
+
+
+
+
+
+ Werbung
|
+
+
+ |
+
+
+ |
+
+
+
+
+
@@ -452,25 +474,6 @@ if($as != "irc" AND $as != "login" AND $as != "anmeldung" AND $as != "info/logs"
|
-
-
-
-
-
- Werbung
|
-
-
- |
-
-
- |
-
-
-
|
diff --git a/ag/kampf_list.php b/ag/kampf_list.php
index d595280..9ace299 100644
--- a/ag/kampf_list.php
+++ b/ag/kampf_list.php
@@ -8,6 +8,7 @@
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/user.inc.php');
include_once(ROOT_PATH.'/include/designfunctions.inc.php');
include_once(ROOT_PATH.'/include/abholcodes.inc.php');
include_once(ROOT_PATH.'/include/parse.inc.php');
@@ -16,6 +17,18 @@ include_once(ROOT_PATH.'/include/fehlerausgabe.inc.php');
include_once(ROOT_PATH.'/include/img.inc.php');
include_once(ROOT_PATH.'/include/exp.inc.php');
+// DEFINES FOR auto filling the forms!
+define(AUTO_FIGHT_TIME, 'auto_fight_time');
+define(AUTO_FIGHT_NAME, 'auto_fight_name');
+define(AUTO_FIGHT_NONAME, 'auto_fight_noname');
+define(AUTO_FIGHT_CREATE, 'auto_fight_create');
+define(AUTO_FIGHT_LEVEL, 'auto_fight_level');
+
+define(CREATE_FIGHT_TIME, 'create_fight_time');
+define(CREATE_FIGHT_NAME, 'create_fight_name');
+define(CREATE_FIGHT_LEVEL, 'create_fight_level');
+
+
// GET-Section
// Kritisch (SQL-Injections)
$lvl = validateUnsignedInteger($_GET['lvl'], null);
@@ -38,6 +51,8 @@ $imgid = $_GET['imgid'];
// Unkritisch
$charm = $_REQUEST['charm'];
+$noname_autofight = $_GET['noname_autofight'];
+$create_autofight = $_GET['create_autofight'];
$auth = true;
@@ -256,10 +271,10 @@ function nehmeAutofightAn($user, $charid, $kampf_name, $kampf_zeit, $lvl){
starteFight($char_a, $chara_2, $fight_row);
semaphoreDown($ressource);
- return $char_a['name'].': Kampf wurde erfolgreich angenommen!';
+ return NULL;
}
-function autokampf($user, $kampf_name, $char_id, $kampf_zeit, $lvl){
+function autokampf($user, $kampf_name, $char_id, $kampf_zeit, $lvl, $acceptWithoutName, $createAfterAccept){
if(!is_numeric($lvl) || !is_numeric($kampf_zeit) || $kampf_zeit < 0 || c > 4){
displayErrorMessage(NULL,'Fehlerhafte Eingabe!',displayHistoryBackLink());
return;
@@ -273,12 +288,30 @@ function autokampf($user, $kampf_name, $char_id, $kampf_zeit, $lvl){
displayErrorMessage(NULL,'Verarbeitung gerade in Gange, bitte warten...', displayHistoryBackLink());
return;
}
+
if(is_array($char_id)){
for($i=0;$i\n";
+ $txt = nehmeAutofightAn($user, $char_id[$i], $kampf_name, $kampf_zeit, $lvl);
+ if($txt != NULL && $acceptWithoutName == 1) {
+ $txt = nehmeAutofightAn($user, $char_id[$i], '', $kampf_zeit, $lvl);
+ }
+ if($txt != NULL && $createAfterAccept == 1) {
+ // does always return text!!
+ $txt = erstelleEinenFight($char_id[$i], $user, $kampf_name, '', $kampf_zeit, $lvl);
+ }
+
+ if($txt == NULL) {
+ $char = getChar($charid[$i]);
+ $txt = $char['name']. ': Kampf wurde erfolgreich angenommen!';
+ }
+
+ $tmp .= $txt ."
\n";
}
}
+ setUserMetaDataEntry($user['id'], AUTO_FIGHT_NAME, $kampf_name);
+ setUserMetaDataEntry($user['id'], AUTO_FIGHT_TIME, $kampf_zeit/300);
+ setUserMetaDataEntry($user['id'], AUTO_FIGHT_LEVEL, $lvl);
} else {
$tmp = 'Kein Char ausgewählt!';
}
@@ -287,8 +320,8 @@ function autokampf($user, $kampf_name, $char_id, $kampf_zeit, $lvl){
semaphoreDown($ressource);
}
-
function erstelleFights($user, $kampf_name, $kampf_pw, $char_id, $kampf_zeit, $lvl){
+
if(!is_numeric($lvl) || !is_numeric($kampf_zeit) || $kampf_zeit < 0 || c > 4){
displayErrorMessage(NULL,'Fehlerhafte Eingabe!',displayHistoryBackLink());
return;
@@ -313,6 +346,9 @@ function erstelleFights($user, $kampf_name, $kampf_pw, $char_id, $kampf_zeit, $l
if(is_numeric($char_id[$i])){
$tmp .= erstelleEinenFight($char_id[$i], $user, $kampf_name, $kampf_pw, $kampf_zeit, $lvl)."
\n";
}
+ setUserMetaDataEntry($user['id'], CREATE_FIGHT_NAME, $kampf_name);
+ setUserMetaDataEntry($user['id'], CREATE_FIGHT_TIME, $kampf_zeit/300);
+ setUserMetaDataEntry($user['id'], CREATE_FIGHT_LEVEL, $lvl);
}
// Pro erstellter Fight kostet es einen Aktionspunkt!
hasDoneAction($user,count($char_id));
@@ -326,6 +362,7 @@ function erstelleFights($user, $kampf_name, $kampf_pw, $char_id, $kampf_zeit, $l
}
function displayAutoFights($user, $portal, $pagenum){
+ $meta_data = getUserMetaData($user['id']);
?>