From 0a242d546ebb576842765fb6f2e8d1fb31ec7002 Mon Sep 17 00:00:00 2001 From: hecht Date: Thu, 28 Sep 2017 20:06:03 +0000 Subject: [PATCH] Fixed items so new races can also have their own items. --- ag/char_profil.php | 12 +++-- ag/clan/spende.php | 20 ++++++--- ag/gfx/markt.htm | 22 +++++---- ag/gfx/markt/line_top_clean.gif | Bin 0 -> 227 bytes ag/gfx/markt/line_top_clean2.gif | Bin 0 -> 257 bytes ag/gm/include/item.inc.php | 75 ++++++++++++++++++++++++++----- ag/item.php | 6 +-- ag/markt.php | 26 ++++++++--- 8 files changed, 113 insertions(+), 48 deletions(-) create mode 100644 ag/gfx/markt/line_top_clean.gif create mode 100644 ag/gfx/markt/line_top_clean2.gif diff --git a/ag/char_profil.php b/ag/char_profil.php index dcb205c..6b542ef 100644 --- a/ag/char_profil.php +++ b/ag/char_profil.php @@ -64,14 +64,12 @@ function stelledar($char_id,$user_ida,$name) { $clanfight_attset_name = getAttackNames($clanfight_attset); $normfight_attset_name = getAttackNames($normfight_attset); - - //Rüstung laden - $e_schuhe = 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='Schuhe' AND i.level <='$char_1[level]' AND 0 = (SELECT count(c.id) from chars c WHERE c.besitzer = w.user AND c.id != '$char_1[id]' AND find_in_set(w.id, kampf_item)) group by i.name order by i.level desc"); - $e_schwert = 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='Schwert' AND i.level <='$char_1[level]' AND 0 = (SELECT count(c.id) from chars c WHERE c.besitzer = w.user AND c.id != '$char_1[id]' AND find_in_set(w.id, kampf_item)) group by i.name order by i.level desc"); - $e_rustung = 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='Ruestung' AND i.level <='$char_1[level]' AND 0 = (SELECT count(c.id) from chars c WHERE c.besitzer = w.user AND c.id != '$char_1[id]' AND find_in_set(w.id, kampf_item)) group by i.name order by i.level desc"); - $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]' AND 0 = (SELECT count(c.id) from chars c WHERE c.besitzer = w.user AND c.id != '$char_1[id]' AND find_in_set(w.id, kampf_item)) 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]' AND 0 = (SELECT count(c.id) from chars c WHERE c.besitzer = w.user AND c.id != '$char_1[id]' AND find_in_set(w.id, kampf_item)) group by i.name order by i.level desc"); + $e_schuhe = db_query("SELECT i.name, w.id, i.level FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE (i.rassen_type=".$char_1['rasse_a']['type']." OR i.rassen_type is NULL) AND w.user='$user_ida[id]' AND w.ru_mal='1' AND i.s_type='Schuhe' AND i.level <='$char_1[level]' AND 0 = (SELECT count(c.id) from chars c WHERE c.besitzer = w.user AND c.id != '$char_1[id]' AND find_in_set(w.id, kampf_item)) group by i.name order by i.level desc"); + $e_schwert = db_query("SELECT i.name, w.id, i.level FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE (i.rassen_type=".$char_1['rasse_a']['type']." OR i.rassen_type is NULL) AND w.user='$user_ida[id]' AND w.ru_mal='1' AND i.s_type='Schwert' AND i.level <='$char_1[level]' AND 0 = (SELECT count(c.id) from chars c WHERE c.besitzer = w.user AND c.id != '$char_1[id]' AND find_in_set(w.id, kampf_item)) group by i.name order by i.level desc"); + $e_rustung = db_query("SELECT i.name, w.id, i.level FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE (i.rassen_type=".$char_1['rasse_a']['type']." OR i.rassen_type is NULL) AND w.user='$user_ida[id]' AND w.ru_mal='1' AND i.s_type='Ruestung' AND i.level <='$char_1[level]' AND 0 = (SELECT count(c.id) from chars c WHERE c.besitzer = w.user AND c.id != '$char_1[id]' AND find_in_set(w.id, kampf_item)) group by i.name order by i.level desc"); + $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.rassen_type=".$char_1['rasse_a']['type']." OR i.rassen_type is NULL) AND w.user='$user_ida[id]' AND w.ru_mal='1' AND i.s_type='Schild' AND i.level <='$char_1[level]' AND 0 = (SELECT count(c.id) from chars c WHERE c.besitzer = w.user AND c.id != '$char_1[id]' AND find_in_set(w.id, kampf_item)) 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.rassen_type=".$char_1['rasse_a']['type']." OR i.rassen_type is NULL) AND w.user='$user_ida[id]' AND w.ru_mal='1' AND i.s_type='Helm' AND i.level <='$char_1[level]' AND 0 = (SELECT count(c.id) from chars c WHERE c.besitzer = w.user AND c.id != '$char_1[id]' AND find_in_set(w.id, kampf_item)) group by i.name order by i.level desc"); $checked = explode(',',$char_1['kampf_item']); $excludeIds = getExcludeIds($user_ida['id'], $char_id); ?> diff --git a/ag/clan/spende.php b/ag/clan/spende.php index b12c1fd..c69b153 100644 --- a/ag/clan/spende.php +++ b/ag/clan/spende.php @@ -55,10 +55,10 @@ if ($user_geld < $clan_geld) { db_query("UPDATE clan SET geld=geld+'$clan_geld' WHERE id='$user_ida[clan]'"); db_query('Update user SET geld=geld-'.$clan_geld.' WHERE id='.$user_ida['id']); -db_query('UPDATE user_clan SET spende = spende + '.$clan_geld.' WHERE clanid = '.$user_ida['clan'].' and userid = '.$user_ida['id']); +db_query('UPDATE user_clan SET spende = spende + '.$clan_geld.', spende_today = spende_today + '.$clan_geld.' WHERE clanid = '.$user_ida['clan'].' and userid = '.$user_ida['id']); if(db_affected_rows() == 0){ - db_query('INSERT INTO user_clan(spende,clanid,userid) values('.$clan_geld.','.$user_ida['clan'].','.$user_ida['id'].')'); + db_query('INSERT INTO user_clan(spende,clanid,userid,spende_today) values('.$clan_geld.','.$user_ida['clan'].','.$user_ida['id'].','.$clan_geld.')'); } displayErrorMessage(NULL,'An Clan Erfolgreich Gespendet', 'weiter...'); @@ -157,7 +157,7 @@ while($row = mysqli_fetch_assoc($qry)){ //print_r($user_raum); -$clans_spend = db_query('SELECT spende, nickname, user.id as userid FROM user left join user_clan on user.id = user_clan.userid and user.clan = user_clan.clanid WHERE user.clan = '.$user_ida['clan'].' ORDER BY spende DESC'); +$clans_spend = db_query('SELECT spende, nickname, user.id as userid, spende_today, spende_yesterday FROM user left join user_clan on user.id = user_clan.userid and user.clan = user_clan.clanid WHERE user.clan = '.$user_ida['clan'].' ORDER BY spende DESC'); $member = mysqli_num_rows($clans_spend); $sql = 'select besitzer, round(sum(1/(1+exp(3-level/12)) * nutzung)) as nutzkosten from user inner join chars on chars.besitzer = user.id inner join clan_ware on chars.clan_train = clan_ware.id inner join clan_item on clan_ware.item_id = clan_item.id where user.clan = clan_ware.clan and user.clan = '.$user_ida['clan'].' group by besitzer order by besitzer'; @@ -182,7 +182,7 @@ for($i=0;$i<$raumanzahl;$i++){ } //echo 'Unterschuss: '.$clan_untersch.'
'; -$cols = 4; +$cols = 6; ?> @@ -193,10 +193,12 @@ $cols = 4; Member - Spenden + Spenden
Total + Spenden
Heute + Spenden
Gestern '.$clanraum_a[$i]['name'].''; + echo ''.join('
', explode(' ', $clanraum_a[$i]['name'])).''; } ?> Mietgebühren @@ -212,6 +214,8 @@ while($row = mysqli_fetch_assoc($clans_spend)) { + + Member + + - - - - +
- - - - -
+ + + + + + + + + - diff --git a/ag/gfx/markt/line_top_clean.gif b/ag/gfx/markt/line_top_clean.gif new file mode 100644 index 0000000000000000000000000000000000000000..5218089546f429d6a7e573837aa7b3ca03e25837 GIT binary patch literal 227 zcmZ?wbhEHbtYG9|Xc1v}_~z7u*C+44I(hBU!PD2aoxHmB#FZ_F&aK;he8rXni&k!% zv1;4QrJJTM+cb5_#wm-|PoBSK!rWDTb5{1wUeWWP2%z|rg^`OvozI_FDr?^mpQulnHsfdvH~I#T^7mK2@Lv6_EjMTytisQxvp%TB+o z+W%lf#TuW9=U;58I-A$+`))^#-}>9zm+Y=P|Ni%R<@%=Pmew{$rS`7wp56vU25SI+ CI*QT& literal 0 HcmV?d00001 diff --git a/ag/gfx/markt/line_top_clean2.gif b/ag/gfx/markt/line_top_clean2.gif new file mode 100644 index 0000000000000000000000000000000000000000..2d4e775be48f901914380021f242ba6371ff58d0 GIT binary patch literal 257 zcmZ?wbhEHbtYG9~Xc1v}_~z7u*C+44I(hBU!PD2aoxHmB#FZ_F&aK;he8rXni&k!% zv1;4QrJJTM+cb5_#wm-|PoBSK!rWDTb5{1wUeWWP2%z|r1!$2xgAM}_fb3*oty56w zQ*lt~GFhARdS8Lg`I6lG73<#Dy#Ie-fxrq60j8x(iZ)1C&A+gs#A|KT`t3&@PO{1< z-Plm!qc{8fRp;$34!iGv*iobBvc{ElSKaydzt^*t^VheuwzYTgFvYTU^z~1en9LT- hIcfTgnX@c7V|iyUSh#2+U#!656)RVjs3Qy literal 0 HcmV?d00001 diff --git a/ag/gm/include/item.inc.php b/ag/gm/include/item.inc.php index 158fd52..59c61c7 100644 --- a/ag/gm/include/item.inc.php +++ b/ag/gm/include/item.inc.php @@ -72,11 +72,17 @@ function displayItems($action, $task, $itemid, $itemtable, $searchstring, $s_ite echo "\t".''."\n"; $colspan = 2; echo "\t\t\t".''."\n"; + $d_array = NULL; + $desc_array = NULL; + $value_type_map = array(); if($itemtable == 'item'){ - $d_array = array('id','name','hp','mp','starke','verteidigung','speed','s_type','preis','anzahl','type','level','tausch_lvl','tausch_anzahl','info'); - $desc_array = array('ID', 'Name', 'HP', 'MP', 'Bonus Stärke', 'Bonus Verteidigung', 'Bonus Geschwindigkeit', 'Art (Item, Helm, ..)', 'Preis im Markt', 'Anzahl', 'Rassen (ALL, Onepiece, Dragonball)', 'Level', 'Tauschlevel', 'Tauschanzahl', 'Infotext'); + $d_array = array('id','name','hp','mp','starke','verteidigung','speed','s_type','preis','anzahl','rassen_type','level','tausch_lvl','tausch_anzahl','info'); + $desc_array = array('ID', 'Name', 'HP', 'MP', 'Bonus Stärke', 'Bonus Verteidigung', 'Bonus Geschwindigkeit', 'Art (Item, Helm, ..)', 'Preis im Markt', 'Anzahl', 'Rassen', 'Level', 'Tauschlevel', 'Tauschanzahl', 'Infotext'); + $race_types = getRaceTypes(); + $race_types[] = array('id' => NULL, 'name' => 'ALL'); + $value_type_map = array('rassen_type' => array( 'index' => 'id', 'name' => 'name', 'data' => $race_types )); } else if($itemtable == 'sp_item'){ - $d_array = array('id','name','preis','wert','type','slot','tausch_lvl','tausch_anzahl','info'); + $d_array = array('id','name','preis','wert','type','slot','tausch_lvl','tausch_anzahl','info'); $desc_array = array('ID', 'Name', 'Preis', 'Häufigkeit (je höher desto seltener)', '"Teufels Frucht" oder nicht', 'Slot (immer auf 0 setzen)', 'Tauschlevel', 'Tauschanzahl', 'Infotext'); } else if($itemtable == 'wochen_markt'){ $d_array = array('id','item','starke','ver','speed','ausdauer','hp','mp','glueck','type','preis','anzahl','verteilung','aktiv','art','kategorie','tausch_lvl','tausch_anzahl','info'); @@ -91,7 +97,22 @@ function displayItems($action, $task, $itemid, $itemtable, $searchstring, $s_ite $row = mysqli_fetch_assoc($qry); echo "\t\t".''."\n"; for($i = 1;$i'."\n"; + if (isset($value_type_map[$d_array[$i]])) { + $entry = $value_type_map[$d_array[$i]]; + echo "\t\t".''."\n"; + } else { + echo "\t\t".''."\n"; + } } // Infotext @@ -127,7 +148,7 @@ function displayItems($action, $task, $itemid, $itemtable, $searchstring, $s_ite } else if($task == 'dochange'){ // d_array[0] muss name sein!! if($itemtable == 'item'){ - $d_array = array('name','hp','mp','starke','verteidigung','speed','s_type','preis','anzahl','type','level','tausch_lvl','tausch_anzahl','info'); + $d_array = array('name','hp','mp','starke','verteidigung','speed','s_type','preis','anzahl','rassen_type','level','tausch_lvl','tausch_anzahl','info'); } else if($itemtable == 'sp_item'){ $d_array = array('name','preis','wert','type','slot','tausch_lvl','tausch_anzahl','info'); } else if($itemtable == 'wochen_markt'){ @@ -144,11 +165,15 @@ function displayItems($action, $task, $itemid, $itemtable, $searchstring, $s_ite $sql .= $d_array[0].' = \''.encodeNoHTMLWithBB($data[$d_array[0]]).'\''; for($i=1;$i'; + // echo $sql.'
'; $u = db_query($sql); if(db_affected_rows() == 0 || $u === FALSE){ echo "\t\t\t".'
'; @@ -213,7 +238,7 @@ function displayItems($action, $task, $itemid, $itemtable, $searchstring, $s_ite if($task == 'docreate'){ // Do the insert and open the edit-page :) if($itemtable == 'item'){ - $d_array = array('name','hp','mp','starke','verteidigung','speed','s_type','preis','anzahl','type','level','info'); + $d_array = array('name','hp','mp','starke','verteidigung','speed','s_type','preis','anzahl','rassen_type','level','info'); } else if($itemtable == 'sp_item'){ $d_array = array('name','preis','wert','type','slot','info'); } else if($itemtable == 'wochen_markt'){ @@ -232,7 +257,11 @@ function displayItems($action, $task, $itemid, $itemtable, $searchstring, $s_ite $sql = 'INSERT INTO '.$itemtable.' (id, '.join($d_array,', ').') values('.$itemid; for($i=0;$i'."\n"; if($itemtable == 'item'){ - $d_array = array('id','name','hp','mp','starke','verteidigung','speed','s_type','preis','anzahl','type','level','info'); - $desc_array = array('ID', 'Name', 'HP', 'MP', 'Bonus Stärke', 'Bonus Verteidigung', 'Bonus Geschwindigkeit', 'Art (Item, Helm, ..)', 'Preis im Markt', 'Anzahl', 'Rassen (ALL, Onepiece, Dragonball)', 'Level', 'Infotext'); + $d_array = array('id','name','hp','mp','starke','verteidigung','speed','s_type','preis','anzahl','rassen_type','level','info'); + $desc_array = array('ID', 'Name', 'HP', 'MP', 'Bonus Stärke', 'Bonus Verteidigung', 'Bonus Geschwindigkeit', 'Art (Item, Helm, ..)', 'Preis im Markt', 'Anzahl', 'Rassen', 'Level', 'Infotext'); + $race_types = getRaceTypes(); + $race_types[] = array('id' => NULL, 'name' => 'ALL'); + $value_type_map = array('rassen_type' => array( 'index' => 'id', 'name' => 'name', 'data' => $race_types )); + } else if($itemtable == 'sp_item'){ $d_array = array('id','name','preis','wert','type','slot','info'); $desc_array = array('ID', 'Name', 'Preis', 'Häufigkeit (je höher desto seltener)', '"Teufels Frucht" oder nicht', 'Slot (immer auf 0 setzen)', 'Infotext'); @@ -282,7 +318,22 @@ function displayItems($action, $task, $itemid, $itemtable, $searchstring, $s_ite echo "\t".''."\n"; echo "\t\t".''."\n"; for($i = 1;$i'."\n"; + if (isset($value_type_map[$d_array[$i]])) { + $entry = $value_type_map[$d_array[$i]]; + echo "\t\t".''."\n"; + } else { + echo "\t\t".''."\n"; + } } // Infotext diff --git a/ag/item.php b/ag/item.php index 0185f23..2f922a0 100644 --- a/ag/item.php +++ b/ag/item.php @@ -115,7 +115,7 @@ $user = $user_ida; if ($charm == 1) { $item_info1 = mysqli_fetch_array(db_query("SELECT item_id, id, user FROM ware WHERE id='$item_id1' LIMIT 1")); - $item_info3 = mysqli_fetch_array(db_query("SELECT preis, anzahl, hp, mp, starke, verteidigung, speed, s_type, type FROM item WHERE id='$item_info1[item_id]' LIMIT 1")); + $item_info3 = mysqli_fetch_array(db_query("SELECT preis, anzahl, hp, mp, starke, verteidigung, speed, s_type, rassen_type FROM item WHERE id='$item_info1[item_id]' LIMIT 1")); $char_id1 = getChar($char_id2); if ($item_info1['user'] != $user['id']) { @@ -127,7 +127,7 @@ if ($charm == 1) { displayErrorMessage(NULL,'Dieser Charakter gehört nicht dir!', displayHistoryBackLink()); exit; } - if ($item_info3['type'] != $char_id1['type'] AND $item_info3['type'] != 'ALL') { + if ($item_info3['rassen_type'] != $char_id1['rasse']['type'] AND $item_info3['rassen_type'] != NULL) { displayErrorMessage(NULL,'Dein Charakter kann dieses Item nicht benutzen!', displayHistoryBackLink()); exit; } @@ -360,7 +360,7 @@ $item1 = db_query("SELECT item_id, id, ru_mal FROM ware WHERE user='$user[id]' g

   $HEADER_DATA

Editieren

'.$desc_array[0].''.$row[$d_array[0]].'
'.$desc_array[$i].'
'.$desc_array[$i].''."\n"; + echo "\t\t\t".''."\n"; + echo "\t\t".'
'.$desc_array[$i].'
Fehler! Änderungen konnten nicht übernommen werden!

Erstellen

'.$desc_array[0].''.$data[$d_array[0]].'
'.$desc_array[$i].'
'.$desc_array[$i].''."\n"; + echo "\t\t\t".''."\n"; + echo "\t\t".'
'.$desc_array[$i].'