diff --git a/ag/char_profil.php b/ag/char_profil.php index e363d23..989a9fc 100644 --- a/ag/char_profil.php +++ b/ag/char_profil.php @@ -21,6 +21,20 @@ defineIfNotDefined('KAMPF_RUNDEN', 10); $char_id = validateUnsignedInteger($_GET['char_id'], null); +function getExcludeIds($userId, $excludeCharId) { + $ids = array(); + $qry = db_query('SELECT kampf_item from chars WHERE besitzer = '.$userId.' AND id != '.$excludeCharId); + while ($row = mysqli_fetch_row($qry)) { + foreach (explode(',', $row[0]) as $id) { + if(is_numeric($id) && $id > 0) { + $ids[] = $id; + } + } + } + return $ids; +} + + function stelledar($char_id,$user_ida,$name) { //Alle Chardaten laden //TODO: chardaten gefällt mir absolut nicht! Das muss man anders regeln =/ @@ -57,6 +71,7 @@ function stelledar($char_id,$user_ida,$name) { $e_schild = db_query("SELECT i.name, w.id, i.level FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE (i.type='$char_1[type]' OR i.type='ALL') AND w.user='$user_ida[id]' AND w.ru_mal='1' AND i.s_type='Schild' AND i.level <='$char_1[level]' group by i.name order by i.level desc"); $e_helm = db_query("SELECT i.name, w.id, i.level FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE (i.type='$char_1[type]' OR i.type='ALL') AND w.user='$user_ida[id]' AND w.ru_mal='1' AND i.s_type='Helm' AND i.level <='$char_1[level]' group by i.name order by i.level desc"); $checked = explode(',',$char_1['kampf_item']); + $excludeIds = getExcludeIds($user_ida['id'], $char_id); ?>
Nix '.$helm_e_w['name'].' (Level: '.$helm_e_w['level'].')'; @@ -267,6 +285,9 @@ function stelledar($char_id,$user_ida,$name) { '.$rustung_e_w['name'].' (Level: '.$rustung_e_w['level'].')'; @@ -282,6 +303,9 @@ function stelledar($char_id,$user_ida,$name) { '.$schild_e_w['name'].' (Level: '.$schild_e_w['level'].')'; @@ -297,6 +321,9 @@ function stelledar($char_id,$user_ida,$name) { '.$schwert_e_w['name'].' (Level: '.$schwert_e_w['level'].')'; @@ -312,6 +339,9 @@ function stelledar($char_id,$user_ida,$name) { '.$schuhe_e_w['name'].' (Level: '.$schuhe_e_w['level'].')'; diff --git a/ag/dragonballs.php b/ag/dragonballs.php index 404ec73..b744198 100644 --- a/ag/dragonballs.php +++ b/ag/dragonballs.php @@ -65,13 +65,18 @@ function wuenscheTeufelsfrucht($user){ return true; } -function wuenscheSpecialChar($user, $specialcharname, $newname = ''){ - if($specialcharname == 'Kaioshin'){ - $spitem = 3; - } else if($specialcharname == 'Shichibukai'){ - $spitem = 15; - } else{ - displayErrorMessage(NULL,'Es koennen nur Kaioshin und Shichibukai gewünscht werden!!',displayHistoryBackLink()); +function wuenscheSpecialChar($user, $specialcharid, $newname = ''){ + $specialRaceIds = getSpecialRaceIds(); + $race = NULL; + foreach ($specialRaceIds as $specialRace) { + if ($specialRace['item'] !== NULL && $specialRace['id'] == $specialcharid) { + $race = $specialRace; + break; + } + } + + if ($race == NULL) { + displayErrorMessage(NULL,'Diese Rasse kann nicht gewünscht werden!!',displayHistoryBackLink()); return false; } @@ -81,7 +86,7 @@ function wuenscheSpecialChar($user, $specialcharname, $newname = ''){ } // Hat der User überhaupt das Item ??? - $qry = db_query('SELECT count(*) AS anzahl FROM sp_ware WHERE item='.$spitem.' AND user='.$user['id']); + $qry = db_query('SELECT count(*) AS anzahl FROM sp_ware WHERE item='.$race['item'].' AND user='.$user['id']); $row = mysqli_fetch_assoc($qry); if($row['anzahl'] < 1){ // Er hat das Item garnicht!! @@ -89,7 +94,7 @@ function wuenscheSpecialChar($user, $specialcharname, $newname = ''){ return false; } - $rasse = getRaceByName($specialcharname); + $rasse = $race; $chars = getCharsOfUser($user['id']); foreach($chars as $char) { @@ -105,7 +110,7 @@ function wuenscheSpecialChar($user, $specialcharname, $newname = ''){ } // Slotüberprüfung beendet! - db_query('DELETE FROM sp_ware WHERE item='.$spitem.' AND user='.$user['id'].' LIMIT 1'); + db_query('DELETE FROM sp_ware WHERE item='.$race['item'].' AND user='.$user['id'].' LIMIT 1'); return true; } @@ -145,14 +150,12 @@ function worker($charm,$wunsch,$user,$newname){ $result = wuenscheGeld($user); } else if($wunsch == 2) { $result = wuenschePotaras($user); - } else if($wunsch == 3) { - $result = wuenscheSpecialChar($user,'Kaioshin',$newname); - } else if($wunsch == 4) { - $result = wuenscheSpecialChar($user,'Shichibukai',$newname); } else if($wunsch == 5) { $result = wuenscheTeufelsfrucht($user); } else if($wunsch == 6) { $result = wuenscheUserRename($user,$newname); + } else if($wunsch > 10) { + $result = wuenscheSpecialChar($user,$wunsch - 10,$newname); } } if($result){ @@ -186,22 +189,34 @@ $items = db_query('SELECT distinct(i1.id) FROM sp_ware i INNER JOIN sp_item i1 O + + + + + + + + + + + + +
Zum Hauptmenu +
+
+Das item '.$item['name'].' von Tabelle '.$item['table_name'].' an User '.$user['nickname'].' erfolgreich verschenkt!

'; + } else { + echo '

FEHLER!! Das item '.$item['name'].' von Tabelle '.$item['table_name'].' an User '.$user['nickname'].' wurde nicht verschenkt!

'; + + } + } + } + +?> +
+ + + + + + + + + + + + + + + + + + + + + + + + 100, 'stm' => 100, 'tp' => 500, - 'special' => true + 'special' => true, + 'item' => 15 ), array( 'name' => 'Kaioshin', @@ -156,7 +157,8 @@ function getDefaultData() { 'lck' => 100, 'stm' => 100, 'tp' => 500, - 'special' => true + 'special' => true, + 'item' => 3 ), // Continue 'One Piece' array( @@ -216,22 +218,75 @@ function getDefaultData() { return $array; } +function createLink($name, $values, $confirmation = NULL) { + if ( $confirmation !== NULL ) { + $link = ' $value) { + $link .= '&'.$key.'='.$value; + } + + + if ( $confirmation !== NULL ) { + $link .= '\'">'.$name.''; + } else { + $link .= '">'.$name.''; + } + + return $link; +} + function displayRassen($request) { - if($request['setup'] == 1) { - $array = getDefaultData(); - foreach($array['race_type'] as $race_type) { - db_query('INSERT INTO rassen_type(id, name, gm_only) values('.$race_type['id'].', \''.$race_type['name'].'\', '.($race_type['gm_only']?'1':'0').')'); - } - foreach($array['race'] as $r) { - db_query('INSERT INTO rassen(name, type, id, hp, mp, str, def, spd, lck, stm, special) '. - 'values(\''.$r['name'].'\', '.$r['type'].','.$r['id'].', '.$r['hp'].','.$r['mp'].','.$r['str'].','.$r['def'].','.$r['spd'].','.$r['lck'].','.$r['stm'].','.($r['special']?'1':'0').')'); - } - } - ?> + $showOverview = true; + if($request['action'] == 'setup') { + $showOverview = displayRassenSetup( $request ); + } else if ($request['action'] == 'edit') { + $showOverview = displayRassenEdit( $request ); + } else if ($request['action'] == 'delete') { + $showOverview = displayRassenDelete( $request ); + } else if ($request['action'] == 'edit_type') { + $showOverview = displayRassenTypeEdit( $request ); + } else if ($request['action'] == 'delete_type') { + $showOverview = displayRassenTypeDelete( $request ); + } else if ($request['action'] == 'create') { + $showOverview = displayRassenCreate( $request ); + } else if ($request['action'] == 'create_type') { + $showOverview = displayRassenTypeCreate( $request ); + } +?>
Verschenken von Items
Item + +
User + +
Bedenke, dass das Verschenken aufgezeichnet wird, also nicht cheaten!!
Zum Hauptmenu +
+'; + } else if ( $showOverview ) { + $race_types = getRaceTypes(); +?> + + + + + + + + + 'edit_type', 'id' => $type['id'])); + $deleteLink = createLink('Delete', array('action' => 'delete_type', 'id' => $type['id']), $type['name']); + echo ''."\n"; + } +?> + + + @@ -240,17 +295,26 @@ function displayRassen($request) { '; - } else { - $race_types = getRaceTypes(); - foreach($race_types as $type) { + foreach ($race_types as $type) { $races = getRacesByType($type); - foreach($races as $race) { - echo ''."\n"; + foreach ($races as $race) { + $editLink = createLink('Edit', array('action' => 'edit', 'id' => $race['id'])); + $deleteLink = createLink('Delete', array('action' => 'delete', 'id' => $race['id']), $race['name']); + echo ''."\n"; } } +?> + + + + + + + @@ -261,3 +325,183 @@ function displayRassen($request) {
'.createLink('setup rassen database', array('action' => 'setup')).'
+ Rassen-Typ Übersicht +
NameGM-OnlyAktion
'.$type['name'].''.($type['gm_only']?'Ja':'Nein').''.$editLink.''.$deleteLink.'
'create_type')); ?>

- Rassen Übersicht + Rassen Übersicht
Aktion
setup rassen database
'.$race['name'].''.$type['name'].'EditDelete
'.$race['name'].''.$type['name'].''.$editLink.''.$deleteLink.'
'create')); ?>

+ +
$row['name'], 'id' => $row['id']); + } +?> +
+ + + + + + + + + + + + + + + + + + + + + +
Rasse
Name
Typ + +
HP
MP
Stärke
Verteidigung
Geschwindigkeit
Glück
Ausdauer
Special type="checkbox" />
Item (nur Special) + +
+
+ '"'.$request['name'].'"', + 'type' => $request['type'], + 'hp' => $request['hp'], + 'mp' => $request['mp'], + 'str' => $request['str'], + 'def' => $request['def'], + 'spd' => $request['spd'], + 'lck' => $request['lck'], + 'stm' => $request['stm'], + 'special' => $special, + 'item' => $item + ); + + $data_entries = array(); + foreach ($data as $key => $value) { + $data_entries[] = $key.'='.$value; + } + + db_query('UPDATE rassen SET '.join(', ', $data_entries).' WHERE id = '.$request['id']); + return true; + } else { + createRassenForm(getRaceById($request['id'])); + return false; + } +} + +function displayRassenDelete( $request ) { + db_query('DELETE FROM rassen WHERE id = '.$request['id']); + return true; +} + +function createRassenTypeForm( $data = NULL ) { + $action = ($data === NULL) ? 'create' : 'edit'; +?> +
+ + + + + + + + + + +
Rassen-typ
Name
GM-Only />
+
+ Rezepte - - ItemZutatenAction - + + +
+ + + + + + ItemZutatenAction + +'.$set['item']['name'].''.join(',',$dep_item_names).'Edit | Delete'; } ?> Neues Rezept erstellen +
+ + Rezept Topics + + + + + Edit | Up | Down | Delete + + + Neues Rezept Topic erstellen + Zum Hauptmenu @@ -135,10 +122,6 @@ function displayRezepteMainMenu($request) { Rezept + + Topic + + + + + + + + + + + + + + + + +
Neues Rezept Topic erstellen
Name:
Zum Hauptmenu +
+ + + +
+ + + + + + + + + + + + + + + + +
Topic editieren
Name:
Zum Hauptmenu +
+
+ + '.$topic_id)); + if ( $other ) { + swapRezepteTopicOrder($topic_id, $other[0]); + } + displayRezepteMainMenu(array()); +} + + + diff --git a/ag/gm/include/tutorial.inc.php b/ag/gm/include/tutorial.inc.php new file mode 100644 index 0000000..2e97c1a --- /dev/null +++ b/ag/gm/include/tutorial.inc.php @@ -0,0 +1,33 @@ + Text (will be rendered on display) + +function displayTutorial($request) { + if (isset($request['data'])) { + $content = encodeNoHTMLNoBB($request['data']); + db_query('UPDATE tutorial SET content = "'.$content.'" WHERE id = 1'); + if (db_affected_rows() == 0) { + silent_query('INSERT INTO tutorial(id, content) value(1, "'.$content.'")'); + } + } + $content = mysqli_fetch_row(db_query('SELECT content FROM tutorial WHERE id = 1'))[0]; +?> + +
+

+ +

+

Zum Hauptmenu

+ +
+ += $char_exp[1]){ + while($char['level'] < CHAR_MAX_LEVEL && $char_exp[0] >= $char_exp[1]){ // Level UP!! $lvls++; $char['level']++; @@ -162,6 +163,10 @@ function addExpToChar($char_id, $n_exp){ $lp += 10; } + if ($char['level'] == CHAR_MAX_LEVEL) { + $char_exp[0] = 0; + } + if($lvls > 0){ // Ist Char um mindestens ein Level gestiegen? echo ''; $sql = 'Update chars set exp = \''.$char_exp[0].','.$char_exp[1].'\', lernpunkte = lernpunkte +'.$lp.', training_points = training_points + '.$tp.', level = level + '.$lvls.' where id = '.$char_id; @@ -199,4 +204,4 @@ function addExpToArena($user_id, $n_exp){ } } -?> \ No newline at end of file +?> diff --git a/ag/include/items.inc.php b/ag/include/items.inc.php new file mode 100644 index 0000000..48a7e7f --- /dev/null +++ b/ag/include/items.inc.php @@ -0,0 +1,112 @@ + 'ware', 'sp_item' => 'sp_ware', 'wochen_markt' => 'wochen_ware'); + if ( $ware_table[$item['table_name']] == 'ware' ) { + $ru = $item['s_type']=='Trank'?' ':'1'; + db_query('INSERT ware(user,item_id,ru_mal) values('.$user_id.', '.$item['id'].', \''.$ru.'\')'); + } else { + db_query('INSERT '.$ware_table[$item['table_name']].'(user, item) values('.$user_id.', '.$item['id'].')'); + } + return db_affected_rows() > 0; +} diff --git a/ag/include/parse.inc.php b/ag/include/parse.inc.php index 3a765ef..28cb5e9 100644 --- a/ag/include/parse.inc.php +++ b/ag/include/parse.inc.php @@ -190,9 +190,10 @@ function bbcode($messagetext) { '#\[s](.*?)\[/s\]#', '#\[sub](.*?)\[/sub\]#', '#\[sup](.*?)\[/sup\]#', - '#\[color=\#?([0-9a-fA-F]{6})\](.*?)\[/color]#', - '#\[color=([a-zA-Z]+?)\](.*?)\[/color]#', - '#\[text=(.*?)\](.*?)\[/text]#', + '#\[color=\#?([0-9a-fA-F]{6})\](.*?)\[/color\]#', + '#\[color=([a-zA-Z]+?)\](.*?)\[/color\]#', + '#\[text=(.*?)\](.*?)\[/text\]#', + '#\[h(\d)\](.*?)\[/h\d\]#', '#\n#' //'#\[img]([a-z]+?://){1}(.*?)\[/img]#', //'#\[img](.*?)\[/img\]#' @@ -212,6 +213,7 @@ function bbcode($messagetext) { '\2', '\2', '\2', + '\2', '
' //'', //'' diff --git a/ag/index.php b/ag/index.php index c28bce5..82eb1dc 100644 --- a/ag/index.php +++ b/ag/index.php @@ -86,6 +86,9 @@ if (top != self)
+
+ +
diff --git a/ag/sets.php b/ag/sets.php index 372024f..8945180 100644 --- a/ag/sets.php +++ b/ag/sets.php @@ -36,6 +36,7 @@ function create_set(id, name){ function get_set_definitions() { $items_map = array(); + $topics_map = array(); $qry = db_query('SELECT * from sp_item'); while( $row = mysqli_fetch_assoc($qry) ) { @@ -56,7 +57,13 @@ function get_set_definitions() { $items_map['wochen_markt'][$row['id']] = $row; } - $qry = db_query('SELECT * from sp_sets'); + $qry = db_query('SELECT * from sp_set_topics ORDER BY id'); + + while( $row = mysqli_fetch_assoc($qry) ) { + $topics_map[$row['id']] = $row; + } + + $qry = db_query('SELECT * from sp_sets ORDER BY set_topic_id'); $sets = array(); while( $row = mysqli_fetch_assoc($qry) ) { $set = array(); @@ -68,6 +75,11 @@ function get_set_definitions() { } $set['deps'] = $dep_items; $set['id'] = $row['set_id']; + $set['topic_id'] = $row['set_topic_id']; + if ( $set['topic_id'] !== NULL ) { + $set['topic'] = $topics_map[$set['topic_id']]['name']; + } + $sets[] = $set; } return $sets; @@ -98,9 +110,10 @@ function displaySets($user_ida) { ?> - + + + + + + + + + + diff --git a/ag/tutorial.php b/ag/tutorial.php new file mode 100644 index 0000000..37b6615 --- /dev/null +++ b/ag/tutorial.php @@ -0,0 +1,19 @@ + +
Rezepte fürs Crafting
ItemZutatenAktion

ItemZutatenAktion
+ +