⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 character.php

📁 三國好好 子
💻 PHP
📖 第 1 页 / 共 2 页
字号:
<?
include "header.php";
include_once "class_character.php";
include_once "items.php";

$refsidebar= false;

$character=new character($PHP_PHAOS_CHARID);

include_once "location_actions.php";
$dropped= drop_actions($character);

// if you've clicked to put something up for market sale
if(@$_POST['market_item'] == "yes") {
	$res=mysql_query("SELECT * FROM phaos_char_inventory WHERE id = '$_POST[char_inv_id]' AND username = '$_COOKIE[PHP_PHAOS_USER]'");
	if ($row = mysql_fetch_array($res)) {
		if(empty($sell_to)){$sell_to ="all";}
		if($_POST['asking_price']<=0){
			$sell_to= '';//stop selling
		}

		$sql=("UPDATE phaos_char_inventory SET asking_price = '$_POST[asking_price]',
								   sell_to = '$sell_to'
							     WHERE id = '$_POST[char_inv_id]'");
		mysql_query($sql) or die("<B>Error ".mysql_errno()." :</B> ".mysql_error()."");
	}
}

// clear out any bad database rows
mysql_query("DELETE FROM phaos_char_inventory WHERE item_id='' AND type='' ");

// find out if character is at a blacksmith, item shop, or magic shop
$res=mysql_query("SELECT * FROM phaos_buildings WHERE location = '".$character->location."' ");
$res OR die("<B>Error ".mysql_errno()." :</B> ".mysql_error()."");

$blacksmith_yn= false;
$item_yn= false;
$magicshop_yn= false;
while ($row=mysql_fetch_array($res)) {
	$blacksmith_yn	|= $row["name"] == "Blacksmith";
	$item_yn	|= $row["name"] == "Item Shop";
	$magicshop_yn	|= $row["name"] == "Magic Shop";
	//echo "$row[name] $blacksmith_yn,$item_yn,$magicshop_yn<br>";
}

$shopForItemtype= array();
function setShopForItemtype($its,$value){
	global $shopForItemtype;
	foreach($its as $it){
		$shopForItemtype[$it]= $value;
	}
}

setShopForItemtype( array( "armor","weapon","boots","shield","helm","gloves"), $blacksmith_yn);
setShopForItemtype( array( "potion" ), $item_yn);
setShopForItemtype( array( "spell_items"), $magicshop_yn);

// did you click to delete your character?
if(@$_POST['delete'] == "yes") {
	$character->kill_character();
	$refsidebar= true;
}

// SELL AN ITEM
if(@$sell_id == "Y") {
	$result = mysql_query ("SELECT * FROM phaos_char_inventory WHERE id = '$id'");
	if ($row = mysql_fetch_array($result)) {
		$ite_type = $row["type"];
	}

	if($ite_type == "potion") {
		if($item_yn) {
			$priceresult = mysql_query("SELECT * FROM phaos_potion WHERE id = '$item_id'");
			if ($row = mysql_fetch_array($priceresult)) {$sell_price = $row["sell_price"];}
		} else {$sell_price = 0;}
	} elseif ($ite_type == "weapon") {
		if($blacksmith_yn) {
			$priceresult = mysql_query("SELECT * FROM phaos_weapons WHERE id = '$item_id'");
			if ($row = mysql_fetch_array($priceresult)) {$sell_price = $row["sell_price"];}
		} else {$sell_price = 0;}
	} elseif ($ite_type == "armor") {
		if($blacksmith_yn) {
			$priceresult = mysql_query("SELECT * FROM phaos_armor WHERE id = '$item_id'");
			if ($row = mysql_fetch_array($priceresult)) {$sell_price = $row["sell_price"];}
		} else {$sell_price = 0;}
	} elseif ($ite_type == "boots") {
		if($blacksmith_yn) {
			$priceresult = mysql_query("SELECT * FROM phaos_boots WHERE id = '$item_id'");
			if ($row = mysql_fetch_array($priceresult)) {$sell_price = $row["sell_price"];}
		} else {$sell_price = 0;}
	} elseif ($ite_type == "gloves") {
		if($blacksmith_yn) {
			$priceresult = mysql_query("SELECT * FROM phaos_gloves WHERE id = '$item_id'");
			if ($row = mysql_fetch_array($priceresult)) {$sell_price = $row["sell_price"];}
		} else {$sell_price = 0;}
	} elseif ($ite_type == "helm") {
		if($blacksmith_yn) {
			$priceresult = mysql_query("SELECT * FROM phaos_helmets WHERE id = '$item_id'");
			if ($row = mysql_fetch_array($priceresult)) {$sell_price = $row["sell_price"];}
		} else {$sell_price = 0;}
	} elseif ($ite_type == "shield") {
		if($blacksmith_yn) {
			$priceresult = mysql_query("SELECT * FROM phaos_shields WHERE id = '$item_id'");
			if ($row = mysql_fetch_array($priceresult)) {$sell_price = $row["sell_price"];}
		} else {$sell_price = 0;}
	} elseif ($ite_type == "spell_items") {
		if($magicshop_yn) {
			$priceresult = mysql_query("SELECT * FROM phaos_spells_items WHERE id = '$item_id'");
			if ($row = mysql_fetch_array($priceresult)) {$sell_price = $row["sell_price"];}
		} else {$sell_price = 0;}
	}

	if($sell_price>0) {
		$sell_gold = $sell_price+$character->gold;
		$query = "UPDATE phaos_characters SET gold = '$sell_gold' WHERE username = '$_COOKIE[PHP_PHAOS_USER]'";
		$req = mysql_query($query);
		if (!$req) {echo "<B>Error ".mysql_errno()." :</B> ".mysql_error().""; exit;}

		$character->unequipt($item_type,$item_id);

		$query = "DELETE FROM phaos_char_inventory WHERE id = '$id'";
		$result = mysql_query($query) or die ("Error in query: $query. " .mysql_error());

		$sell_msg= $lang_char['soldtoshop'];
	} else {
		$sell_msg= $lang_char['noshop'];
	}
	$refsidebar= true;
}


// DRINK POTION
if($_GET[drink_potion] == "Y") {
	$result = mysql_query ("SELECT type FROM phaos_char_inventory WHERE id = '$_GET[id]'");
	if ($row = mysql_fetch_array($result)) {
		if ($row["type"] == "potion") {
			$character->drink_potion2($_GET[id]);
		}
	}
	$refsidebar= true;
}

// EQUIP AN ITEM
if(@$equip_id){
	if($equip_id == "Y") {
		if ($character->equipt($item_type,$item_id)){
			$refsidebar= true;
			//echo "equipping successfull";
		} else {
			//echo "not equipped";
		}
	}

	// UNEQUIP AN ITEM
	if($equip_id == "N") {
		if ($character->unequipt($item_type,$item_id)){
			$refsidebar = true;
			//echo "unequipping successfull";
		} else {
			//echo "not unequipped";
		}
	}
}

if($dropped>0) {
	$refsidebar= true;
	?><div align=center><?php
	echo $dropped." ".$lang_char['itemsdropped'];
	?></div><?php
}

if($refsidebar){
	refsidebar();
	$refsidebar= false;
}
?>

<table border=0 cellspacing=0 cellpadding=0 width="100%">
<tr>
<td align=center valign=top colspan=2>
<table border=0 cellspacing=5 cellpadding=0>
<tr>
<td align=center colspan=2>
<img src="lang/<? echo $lang ?>_images/character.png">
</td>
</tr>
<?
// MAKE SURE EQUIPPED ARMOR IS STILL IN INVENTORY
if ($numerrors=$character->checkequipment()){
	echo $numerrors." ".$lang_char["eq_dropped"];
}
// Take Care of Skill-Levels!!
if ($numerrors=$character->inv_skillmatch()){
	echo $numerrors." ".$lang_char["ins_skill"];
}

if(@$sell_msg){
	echo "<center>$sell_msg</center>";
}

if($character->name != "" AND $character->image != "") {
	?>
	<tr>
	<td align=center colspan=2>
	<big><b><? echo $lang_char["info"]; ?></b></big>
	<br>
	<br>
	<table border=0 cellspacing=0 cellpadding=0 width="60%"><? # change width="50%" -> width="60%"?>
	<tr>
	<td rowspan=4 valign=middle align=right>
	<img src="<? print $character->image; ?>"> &nbsp
	</td>
	<td align=right>
	<b><? echo $lang_name; ?>: &nbsp</b>
	</td>
	<td>
	<?/* ### getclan_sig ### */ getclan_sig($character->name);?> <b><? print $character->name; ?> &nbsp</b>
	</td>
	</tr>
	<tr>
	<td align=right>
	<b><? echo $lang_age; ?>: &nbsp</b>
	</td>
	<td>
	<b><? print $character->age; ?> &nbsp</b>
	</td>
	</tr>
	<tr>
	<td align=right>
	<b><? echo $lang_sex; ?>: &nbsp</b>
	</td>
	<td>
	<b><? print $character->sex; ?> &nbsp</b>
	</td>
	</tr>
	<tr>
	<td align=right>
	<b><? echo $lang_race; ?>: &nbsp</b>
	</td>
	<td>
	<b><? print $character->race; ?> &nbsp</b>
	</td>
	</tr>
	<tr>
	<td></td>
	<td align=right>
	<b><? echo $lang_class; ?>: &nbsp</b>
	</td>
	<td>
	<b><? print $character->cclass; ?> &nbsp</b>
	</td>
	</tr>
	<tr>
	<td></td>
	<td align=right>
	<b><? echo $lang_att; ?>: &nbsp</b>
	</td>
	<td>
	<b><? print $character->fight; ?> &nbsp</b>
	</td>
	</tr>
	<tr>
	<td></td>
	<td align=right>
	<b><? echo $lang_def; ?>: &nbsp</b>
	</td>
	<td>
	<b><? print $character->defence; ?> &nbsp</b>
	</td>
	</tr>
	<tr>
	<td></td>
	<td align=right>
	<b><? echo $lang_wplss; ?>: &nbsp</b>
	</td>
	<td>
	<b><? print $character->weaponless; ?> &nbsp</b>
	</td>
	</tr>
	<tr>
	<td></td>
	<td align=right>
	<b><? echo $lang_lckpk; ?>: &nbsp</b>
	</td>
	<td>
	<b><? print $character->lockpick; ?> &nbsp</b>
	</td>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -