@ -55,12 +56,12 @@ function istrinstr($source, $insert, $search) {
}
}
function getNPCUser() {
function getNPCUser() {
$qry = mysql_query('SELECT * FROM user WHERE nickname = "'.NPC_USER_NAME.'";');
$qry = db_query('SELECT * FROM user WHERE nickname = "'.NPC_USER_NAME.'";');
return mysql_fetch_assoc($qry);
return mysql_fetch_assoc($qry);
}
}
function getNPCAttacks() {
function getNPCAttacks() {
$qry = mysql_query('SELECT name,id FROM attacken a WHERE info like "%NPC%";');
$qry = db_query('SELECT name,id FROM attacken a WHERE info like "%NPC%";');
$set = array();
$set = array();
while ($result = mysql_fetch_assoc($qry)) {
while ($result = mysql_fetch_assoc($qry)) {
@ -73,7 +74,7 @@ function getNPCAttacks() {
function learnNewAttacks($charid, $att_ids) {
function learnNewAttacks($charid, $att_ids) {
//auslesen der gelernten Attacken
//auslesen der gelernten Attacken
$sql = 'SELECT at_id, id FROM lernen WHERE besitzer = '.$charid.' AND at_id in ('.implode(',', $att_ids).');';
$sql = 'SELECT at_id, id FROM lernen WHERE besitzer = '.$charid.' AND at_id in ('.implode(',', $att_ids).');';
$qry = mysql_query($sql);
$qry = db_query($sql);
$learned_atts = array();
$learned_atts = array();
while($result = mysql_fetch_assoc($qry)) {
while($result = mysql_fetch_assoc($qry)) {
@ -82,7 +83,7 @@ function learnNewAttacks($charid, $att_ids) {
//Namen der Attacken auslesen
//Namen der Attacken auslesen
$sql = 'SELECT id,name FROM attacken WHERE id in ('.implode(',', $att_ids).');';
$sql = 'SELECT id,name FROM attacken WHERE id in ('.implode(',', $att_ids).');';
$qry = mysql_query($sql);
$qry = db_query($sql);
$att_names = array();
$att_names = array();
while($result = mysql_fetch_assoc($qry)) {
while($result = mysql_fetch_assoc($qry)) {
@ -95,14 +96,14 @@ function learnNewAttacks($charid, $att_ids) {
* Keine Gute Lösung, es wird zwar von der db verhindert, dass doppelte Einträge gespeichert werden
* Keine Gute Lösung, es wird zwar von der db verhindert, dass doppelte Einträge gespeichert werden
* aber ungebrauchte Attacken werden so auch nicht gelöscht (höchstens der NPC wird gelöscht)
* aber ungebrauchte Attacken werden so auch nicht gelöscht (höchstens der NPC wird gelöscht)
*/
*/
mysql_query('INSERT INTO lernen(name,at_id,besitzer,aktiv) VALUES(\''.$att_names[$att].'\','.$att.','.$charid.',1);');
db_query('INSERT INTO lernen(name,at_id,besitzer,aktiv) VALUES(\''.$att_names[$att].'\','.$att.','.$charid.',1);');
}
}
}
}
}
}
function getAttackSet($charid, $att_ids) {
function getAttackSet($charid, $att_ids) {
$sql = 'SELECT at_id, id FROM lernen WHERE besitzer = '.$charid.' AND at_id in ('.implode(',', $att_ids).');';
$sql = 'SELECT at_id, id FROM lernen WHERE besitzer = '.$charid.' AND at_id in ('.implode(',', $att_ids).');';
$qry = mysql_query($sql);
$qry = db_query($sql);
$learned_atts = array();
$learned_atts = array();
while($result = mysql_fetch_assoc($qry)) {
while($result = mysql_fetch_assoc($qry)) {
@ -149,7 +150,7 @@ function displayNPCInfo($action, $task, $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 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 kampf_list kl on c.id = kl.charakter WHERE c.id ='.$charid;
$qry = mysql_query($sql);
$qry = db_query($sql);
$row = mysql_fetch_assoc($qry);
$row = mysql_fetch_assoc($qry);
}
}
@ -250,7 +251,7 @@ function editNPC($charid, $data, $att_ids) {
$sql .= ' WHERE c.id=\''.$charid.'\'';
$sql .= ' WHERE c.id=\''.$charid.'\'';
//echo $sql;
//echo $sql;
$u = mysql_query($sql);
$u = db_query($sql);
$log = 0;
$log = 0;
if(mysql_affected_rows() == 0 || $u === FALSE) {
if(mysql_affected_rows() == 0 || $u === FALSE) {
@ -265,7 +266,7 @@ function editNPC($charid, $data, $att_ids) {
//alter müll
//alter müll
$qry = 'UPDATE chars SET attacken=\''.implode(',', $attset).'\', '.
$qry = 'UPDATE chars SET attacken=\''.implode(',', $attset).'\', '.
'attacken2=\''.implode(',', $attset).'\' WHERE id='.$charid.' LIMIT 1';
'attacken2=\''.implode(',', $attset).'\' WHERE id='.$charid.' LIMIT 1';