📄 items.php
字号:
//FIXME: maybe move buy price and sell price into their own tables
switch($item['type']){
case "gold":
$info['description']= $GLOBALS['lang_gold'];
$info['image_path'] = "images/icons/gold.gif";
$info['effect'] = "";
$info['sell_price'] = $item['number'];
$info['buy_price'] = $item['number'];
$info['skill_req'] = "";
$info['skill_need'] = "#FFFFFF";
$info['skill_type'] = "";
break;
// add extra information
case "weapon":
$result = mysql_query("SELECT * FROM phaos_weapons WHERE id = '$item[id]'");
if ($row = mysql_fetch_array($result)) {
$info['description'] = $row["name"];
$info['image_path'] = $row["image_path"];
$info['min_damage'] = $row["min_damage"];
$info['max_damage'] = $row["max_damage"];
$info['effect'] = $GLOBALS['lang_shop']["dam"]." ".$row["min_damage"]."-".$row["max_damage"];
$info['sell_price'] = $row["sell_price"];
$info['buy_price'] = $row["buy_price"];
$info['skill_req'] = ceil((($row['min_damage']+$row['max_damage'])-10)/3);
if($info['skill_req'] > $character->fight) {$info['skill_need'] = "red";} else {$info['skill_need'] = "#FFFFFF";}
$info['skill_type'] = $GLOBALS['lang_att'];
}
break;
case "armor":
$result = mysql_query("SELECT * FROM phaos_armor WHERE id = '$item[id]'");
if ($row = mysql_fetch_array($result)) {
$info['description'] = $row["name"];
$info['image_path'] = $row["image_path"];
$info['armor_class'] = $row["armor_class"];
$info['effect'] = $GLOBALS['lang_shop']["ac"]." ".$row["armor_class"];
$info['sell_price'] = $row["sell_price"];
$info['buy_price'] = $row["buy_price"];
$info['skill_req'] = ceil(($row["armor_class"]-10)/3);
if($info['skill_req'] > $character->defence) {$info['skill_need'] = "red";} else {$info['skill_need'] = "#FFFFFF";}
$info['skill_type'] = $GLOBALS['lang_def'];
}
break;
case "boots":
$result = mysql_query("SELECT * FROM phaos_boots WHERE id = '$item[id]'");
if ($row = mysql_fetch_array($result)) {
$info['description'] = $row["name"];
$info['image_path'] = $row["image_path"];
$info['armor_class'] = $row["armor_class"];
$info['effect'] = $GLOBALS['lang_shop']["ac"]." ".$row["armor_class"];
$info['sell_price'] = $row["sell_price"];
$info['buy_price'] = $row["buy_price"];
$info['skill_req'] = ceil($row["armor_class"]);
if($info['skill_req'] > $character->defence) {$info['skill_need'] = "red";} else {$info['skill_need'] = "#FFFFFF";}
$info['skill_type'] = $GLOBALS['lang_def'];
}
break;
case "gloves":
$result = mysql_query("SELECT * FROM phaos_gloves WHERE id = '$item[id]'");
if ($row = mysql_fetch_array($result)) {
$info['description'] = $row["name"];
$info['image_path'] = $row["image_path"];
$info['armor_class'] = $row["armor_class"];
$info['effect'] = $GLOBALS['lang_shop']["ac"]." ".$row["armor_class"];
$info['sell_price'] = $row["sell_price"];
$info['buy_price'] = $row["buy_price"];
$info['skill_req'] = ceil($row["armor_class"]);
if($info['skill_req'] > $character->defence) {$info['skill_need'] = "red";} else {$info['skill_need'] = "#FFFFFF";}
$info['skill_type'] = $GLOBALS['lang_def'];
}
break;
case "helm":
$result = mysql_query("SELECT * FROM phaos_helmets WHERE id = '$item[id]'");
if ($row = mysql_fetch_array($result)) {
$info['description'] = $row["name"];
$info['image_path'] = $row["image_path"];
$info['armor_class'] = $row["armor_class"];
$info['effect'] = $GLOBALS['lang_shop']["ac"]." ".$row["armor_class"];
$info['sell_price'] = $row["sell_price"];
$info['buy_price'] = $row["buy_price"];
$info['skill_req'] = ceil($row["armor_class"]);
if($info['skill_req'] > $character->defence) {$info['skill_need'] = "red";} else {$info['skill_need'] = "#FFFFFF";}
$info['skill_type'] = $GLOBALS['lang_def'];
}
break;
case "shield":
$result = mysql_query("SELECT * FROM phaos_shields WHERE id = '$item[id]'");
if ($row = mysql_fetch_array($result)) {
$info['description'] = $row["name"];
$info['image_path'] = $row["image_path"];
$info['armor_class'] = $row["armor_class"];
$info['effect'] = $GLOBALS['lang_shop']["ac"]." ".$row["armor_class"];
$info['sell_price'] = $row["sell_price"];
$info['buy_price'] = $row["buy_price"];
$info['skill_req'] = ceil($row["armor_class"]);
if($info['skill_req'] > $character->defence) {$info['skill_need'] = "red";} else {$info['skill_need'] = "#FFFFFF";}
$info['skill_type'] = $GLOBALS['lang_def'];
}
break;
case "potion":
$result = mysql_query("SELECT * FROM phaos_potion WHERE id = '$item[id]'");
if ($row = mysql_fetch_array($result)) {
$info['description'] = $row["name"];
$info['image_path'] = $row["image_path"];
// don't want to give away what potion might do :)
// $effect = $GLOBALS['lang_shop']["heall"]." ".$row["heal_amount"];
$info['effect'] = "";
$info['sell_price'] = $row["sell_price"];
$info['buy_price'] = $row["buy_price"];
//$skill_req = ceil($row["armor_class"]);
//if($skill_req > $character->defence) {$skill_need = "red";} else {$skill_need = "#FFFFFF";}
//$skill_type = $GLOBALS['lang_def'];
$info['skill_need']= '';
$info['skill_req']= 0;
$info['skill_type']= '';
}
break;
case "spell_items":
$result = mysql_query("SELECT * FROM phaos_spells_items WHERE id = '$item[id]'");
if ($row = mysql_fetch_array($result)) {
$info['description'] = $row["name"];
$info['image_path'] = $row["image_path"];
$info['min_damage'] = $row["min_damage"];
$info['max_damage'] = $row["max_damage"];
$info['sell_price'] = $row["sell_price"];
$info['buy_price'] = $row["buy_price"];
$info['skill_req'] = $row["req_skill"];
$info['damage_mess'] = $row["damage_mess"]==0?"单效":"多效" ;
if($info['skill_req'] > $character->wisdom) {$info['skill_need'] = "red";} else {$info['skill_need'] = "#FFFFFF";}
$info['effect'] = $GLOBALS['lang_shop']["dam"]." ".$row["min_damage"]."-".$row["max_damage"]."(".$info['damage_mess'].")";
$info['skill_type'] = $GLOBALS['lang_wis'];
}
break;
default:
echo "<p>Unknown item type $item[type] ($item[id]) in ".__FUNCTION__."</p>";
}
return $info;
}
//FIXME: actually, tables should be locked when doing this
function item_pickup($location,$item){
$query = "select number from phaos_ground where location='$location' and item_id='$item[id]' and item_type='$item[type]'";
$number= fetch_value($query,__FILE__,__LINE__,__FUNCTION__);
if($item['number']>$number){
$item['number']= $number;
}
$item['number']= -$item['number'];
item_drop($location,$item);
//remove drops of zero size
$req = mysql_query("delete from phaos_ground where number<=0");
if (!$req) {showError(__FILE__,__LINE__,__FUNCTION__); exit;}
return -$item['number'];
}
//FIXME: actually, tables should be locked when doing this
//FIXME: an update+= statement also would be more robust even with no locking
function item_drop($location,$item){
$query = "select number from phaos_ground where location='$location' and item_id='$item[id]' and item_type='$item[type]'";
$here= fetch_value($query,__FILE__,__LINE__,__FUNCTION__);
$number= $item['number'];
if( $here ){
$number+= $here;
}
$query = "REPLACE INTO phaos_ground (location,item_id,item_type,number)
VALUES ('$location','$item[id]','$item[type]','$number')";
$req = mysql_query($query);
if (!$req) {showError(__FILE__,__LINE__,__FUNCTION__); exit;}
defined('DEBUG') and DEBUG and $GLOBALS['debugmsgs'][]= "Dropped item:".print_r($item,true);
}
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -