diff --git a/ag/gm/include/npc.inc.php b/ag/gm/include/npc.inc.php index 2ed0396..e1b690f 100644 --- a/ag/gm/include/npc.inc.php +++ b/ag/gm/include/npc.inc.php @@ -19,6 +19,41 @@ defineIfNotDefined('TASK_EDIT', 'dochange'); defineIfNotDefined('TASK_CREATE', 'docreate'); defineIfNotDefined('NPC_USER_NAME', 'animegame-npc'); +function getDropItemsAsOptions(){ + $result = NULL; + $index = 0; + // Die etwas abgewandelten SQL-Querys aus dem auktion_functions.php + $query = 'SELECT id, name, \'ware\' as tablename FROM item i WHERE s_type = \'Trank\' + union + SELECT id, name, \'sp_ware\' as tablename FROM sp_item i + union + SELECT id, item AS name, \'wochen_ware\' as tablename FROM wochen_markt w;'; + + $qry = mysql_query($query); + // Damit waeren alle noetigen Datenbankaufrufe erledigt! + while($row = mysql_fetch_assoc($qry)){ + $result[$index++] = ''; + } + + $result[$index++] = ''; + $result[$index++] = ''; + $result[$index++] = ''; + $result[$index++] = ''; + $result[$index++] = ''; + $result[$index++] = ''; + $result[$index++] = ''; + $result[$index++] = ''; + $result[$index++] = ''; + + return $result; +} + +function istrinstr($source, $insert, $search) { + $pos = strpos($source, $search); + $newstr = substr($source, 0, $pos).$insert.substr($source, $pos); + return $newstr; +} + function getNPCUser() { $qry = mysql_query('SELECT * FROM user WHERE nickname = "'.NPC_USER_NAME.'";'); return mysql_fetch_assoc($qry); @@ -105,13 +140,15 @@ function displayNPCInfo($action, $task, $charid) { 'Ausdauer', 'Glück', 'Kampfdauer in Sekunden', 'Level', 'Min-Level', 'Max-Level', 'Bild'); $attset = array(-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1); $attset_names = array(' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '); + $drop_items = getDropItemsAsOptions(); + //initialisieren falls editiert wird (dort existieren schon Inhalte) if($task == TASK_EDIT) { $attset = getCharAttackSet($charid, NORMALKAMPF); $attset_names = getAttackNamesFromAttackSet($attset); - //$sql = 'SELECT * FROM chars c inner join npc_item ni on ni.charakter = c.id inner join kampf_list kl on ni.charakter = kl.charakter WHERE c.id ='.$charid; - $sql = 'SELECT * FROM chars c inner join kampf_list kl on c.id = kl.charakter WHERE c.id ='.$charid; + $sql = 'SELECT * FROM chars c inner join npc_item ni on ni.charakter = c.id inner join kampf_list kl on ni.charakter = kl.charakter WHERE c.id ='.$charid; + //$sql = 'SELECT * FROM chars c inner join kampf_list kl on c.id = kl.charakter WHERE c.id ='.$charid; $qry = mysql_query($sql); $row = mysql_fetch_assoc($qry); } @@ -145,6 +182,27 @@ function displayNPCInfo($action, $task, $charid) { } } + //dropitems + echo "\t".'