'; $npc = $_GET['npc']; $npcName = getInfo(username,users,"WHERE id='$npc'"); $master = getInfo(NPC,users,"WHERE id='$npc'"); $leader = getInfo(employer,npc_citizens,"WHERE npc='$npc'"); if ((admin($user_name)) || ($leader == $userId)) { if ($_POST['mode'] == "settings") { $job = getInfo(job,npc_citizens,"WHERE npc='$npc'"); $var1 = $_POST['var1']; $var2 = $_POST['var2']; if ($job == "mine") { if (getInfo(owner,places,"WHERE id='$var2'") != $userId) $failure = "You are not the owner of that dropsite."; if (getInfo(type,places,"WHERE id='$var2'") != 32) $failure = "That is not a mining depot."; } if ($job == "sell") { $place = getInfo(place,rooms,"WHERE id='$var1'"); if (getInfo(owner,places,"WHERE id='$place'") != $userId) $failure = "You do not own that restaurant/shop."; } if (!$failure) { $query = "UPDATE npc_citizens SET var1='$var1' WHERE npc='$npc'"; mysql_query($query); $query = "UPDATE npc_citizens SET var2='$var2' WHERE npc='$npc'"; mysql_query($query); if ($job == "sell") { $employees = getInfo(employees,places,"WHERE id='$place'"); $employees = removeElement($npc,$employees,'.'); if ($employees) $employees .= '.'.$npc; else $employees = $npc; $query = "UPDATE places SET employees='$employees' WHERE id='$place'"; mysql_query($query); } if ($job == "protect") { $query = "UPDATE npcs SET mode='protect' WHERE name='$npc'"; mysql_query($query); $query = "UPDATE npcs SET var='$var1' WHERE name='$npc'"; mysql_query($query); $query = "UPDATE npcs SET movement='follow' WHERE name='$npc'"; mysql_query($query); } echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'; echo '
'; echo 'Success'; echo '
'; echo '
'; echo '
'; echo 'You have successfully altered the settings.'; echo '
'; echo '
'; echo '
'; } else { echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'; echo '
'; echo 'Error'; echo '
'; echo '
'; echo '
'; echo $failure; echo '
'; echo '
'; echo '
'; } } if ($_POST['mode'] == "hidehair") { $hair = getInfo(hair,users,"WHERE id='$npc'"); if (!$hair) { $hair = getInfo(hairhide,users,"WHERE id='$npc'"); $hide_hair = true; } else { $hide_hair = false; } if (!$hair) $failure = "You do not have any hair."; if (!$failure) { if ($hide_hair) { $query = "UPDATE users SET hair='$hair' WHERE id='$npc'"; mysql_query($query); $query = "UPDATE users SET hairhide='' WHERE id='$npc'"; mysql_query($query); } else { $query = "UPDATE users SET hair='' WHERE id='$npc'"; mysql_query($query); $query = "UPDATE users SET hairhide='$hair' WHERE id='$npc'"; mysql_query($query); } } echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'; echo '
'; if (!$failure) echo 'Success'; else echo 'Error'; echo '
'; echo '
'; echo '
'; if (!$failure) { if ($hide_hair) echo "The NPC's hair is now being displayed."; else echo "The NPC's hair is now hidden."; } else echo $failure; echo '
'; echo '
'; echo '
'; } if ($_POST['mode'] == "remove") { $remOverhead = $_POST['remOverhead']; $remClothes = $_POST['remClothes']; $remBehind = $_POST['remBehind']; $conditions = "WHERE id='$npc'"; $inventory = getInfo(inventory,users,$conditions); $max = count($remOverhead); if ($max > 0) { $overhead = explode('.',getInfo(overhead,users,"WHERE id='$npc'")); for ($i = 0;$i < $max;$i++) { $rem = $remOverhead[$i]; if (inArray($rem,$overhead)) { $overhead = implode('.',$overhead); $overhead = removeElement($rem,$overhead,"."); $overhead = explode('.',$overhead); if ($inventory) $inventory .= '.'.$rem; else $inventory = $rem; } else { $failure = "The NPC is not wearing one or more of the items you are trying to remove."; } } } $max = count($remBehind); if ($max > 0) { $behind = explode('.',getInfo(behind,users,"WHERE id='$npc'")); for ($i = 0;$i < $max;$i++) { $rem = $remBehind[$i]; if (inArray($rem,$behind)) { $behind = implode('.',$behind); $behind = removeElement($rem,$behind,"."); $behind = explode('.',$behind); if ($inventory) $inventory .= '.'.$rem; else $inventory = $rem; } else { $failure = "The NPC is not wearing one or more of the items you are trying to remove."; } } } $max = count($remClothes); if ($max > 0) { $clothes = explode('.',getInfo(clothes,users,"WHERE id='$npc'")); for ($i = 0;$i < $max;$i++) { $rem = $remClothes[$i]; if (inArray($rem,$clothes)) { $clothes = implode('.',$clothes); $clothes = removeElement($rem,$clothes,"."); $clothes = explode('.',$clothes); if ($inventory) $inventory .= '.'.$rem; else $inventory = $rem; } else { $failure = "The NPC is not wearing one or more of the items you are trying to remove."; } } } if (!$failure) { if ($remOverhead) { $overhead = implode('.',$overhead); $query = "UPDATE users SET overhead='$overhead' WHERE id='$npc'"; mysql_query($query); } if ($remClothes) { $clothes = implode('.',$clothes); $query = "UPDATE users SET clothes='$clothes' WHERE id='$npc'"; mysql_query($query); } if ($remBehind) { $behind = implode('.',$behind); $query = "UPDATE users SET behind='$behind' WHERE id='$npc'"; mysql_query($query); } $query = "UPDATE users SET inventory='$inventory' WHERE id='$npc'"; mysql_query($query); echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'; echo '
Success
'; echo '
'; echo '
You have successfully removed the clothes you have chosen.
'; echo '
'; echo '
'; } else { echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'; echo '
Error
'; echo '
'; echo '
'.$failure.'
'; echo '
'; echo '
'; } } if ($_POST['mode'] == "fire") { if (getInfo(employer,npc_citizens,"WHERE npc='$npc'") != $userId) $failure = "You are not this NPC's employer."; if (!$failure) { $query = "DELETE FROM npc_mining WHERE npc='$npc'"; mysql_query($query); $query = "UPDATE npc_citizens SET employer='' WHERE npc='$npc'"; mysql_query($query); $query = "UPDATE npc_citizens SET eat='' WHERE npc='$npc'"; mysql_query($query); $query = "UPDATE npcs SET mode='' WHERE name='$npc'"; mysql_query($query); $query = "UPDATE npcs SET var='' WHERE name='$npc'"; mysql_query($query); $query = "UPDATE npcs SET movement='' WHERE name='$'npc"; mysql_query($query); echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'; echo '
Success
'; echo '
'; echo '
You have successfully fired the NPC.
'; echo '
'; echo '
'; } else { echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'; echo '
Error
'; echo '
'; echo '
'.$failure.'
'; echo '
'; echo '
'; } } if ($_POST['mode'] == "wear") { $wearOverhead = $_POST['overhead']; $wearUnderhead = $_POST['underhead']; $wearBehind = $_POST['behind']; $conditions = "WHERE id='$npc'"; $overhead = getInfo(overhead,users,$conditions); $underhead = getInfo(clothes,users,$conditions); $behind = getInfo(behind,users,$conditions); $inventory = explode('.',getInfo(inventory,users,$conditions)); $max = count($wearBehind); for ($i = 0;$i < $max;$i++) { $item = $wearBehind[$i]; if (inArray($item,$inventory)) { $inventory = implode('.',$inventory); $inventory = removeElement($item,$inventory,'.'); $inventory = explode('.',$inventory); if ($behind) $behind .= '.'.$item; else $behind = $item; } else { $failure = "The NPC is not carrying one of the items you are trying to wear."; } } $max = count($wearOverhead); for ($i = 0;$i < $max;$i++) { $item = $wearOverhead[$i]; if (inArray($item,$inventory)) { $inventory = implode('.',$inventory); $inventory = removeElement($item,$inventory,'.'); $inventory = explode('.',$inventory); if ($overhead) $overhead .= '.'.$item; else $overhead = $item; } else { $failure = "The NPC is not carrying one of the items you are trying to wear."; } } $max = count($wearUnderhead); for ($i = 0;$i < $max;$i++) { $item = $wearUnderhead[$i]; if (inArray($item,$inventory)) { $inventory = implode('.',$inventory); $inventory = removeElement($item,$inventory,'.'); $inventory = explode('.',$inventory); if ($underhead) $underhead .= '.'.$item; else $underhead = $item; } else { $failure = "The NPC is not carrying one of the items you are trying to wear."; } } if (!$failure) { $inventory = implode('.',$inventory); $query = "UPDATE users SET inventory='$inventory' WHERE id='$npc'"; mysql_query($query); $query = "UPDATE users SET overhead='$overhead' WHERE id='$npc'"; mysql_query($query); $query = "UPDATE users SET clothes='$underhead' WHERE id='$npc'"; mysql_query($query); $query = "UPDATE users SET behind='$behind' WHERE id='$npc'"; mysql_query($query); echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'; echo '
Success
'; echo '
'; echo '
The NPC has successfully worn the clothes you have chosen.
'; echo '
'; echo '
'; } else { echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'; echo '
Error
'; echo '
'; echo '
'.$failure.'
'; echo '
'; echo '
'; } } echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'; echo '
NPC Control Panel
'; echo '
'; echo '
This is where you may control '.$npcName.'\'s belongings. You may remove your npc\'s clothing, and change its work settings.
'; echo '
'; echo '
'; echo '

'; echo '
'; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'; echo '
Edit Questions
'; echo '
'; echo '
'; echo "In order to make your NPC more interesting, you can set up pre-set statements other users can say to it. You can also set up pre-written responses.

"; echo "
"; echo ""; echo "
"; echo '
'; echo '
'; echo '
'; echo '
'; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'; echo '
Employment Settings
'; echo '
'; echo '
'; echo '
'; $job = getInfo(job,npc_citizens,"WHERE npc='$npc'"); if ($job == "mine") $jobname = "Resource Gatherer"; if ($job == "protect") $jobname = "Bodyguard"; if ($job == "sell") $jobname = "Tend to Shop/Restaurant"; if ($job == "other") $jobname = "Miscellaneous Worker"; echo "Specialty: $jobname
"; if ($job == "protect") { echo "Protect: "; } if ($job == "mine") { $result = getRows(towns,""); $echo = ""; $hide = ""; while ($row = mysql_fetch_array($result)) { $town = $row['id']; $townname = $row['name']; $echo .= ""; $hide .= "hide(\'town".$town."\');"; } echo "Mining Site Town:
"; $result = getRows(towns,""); $echo = ""; while ($row = mysql_fetch_array($result)) { $town = $row['id']; $townname = $row['name']; echo "
"; echo "Mining Site Room: "; echo "
"; } echo "
Drop Point (Mining Depot): "; } if ($job == "other") { $result = getRows(towns,""); $echo = ""; $hide = ""; while ($row = mysql_fetch_array($result)) { $town = $row['id']; $townname = $row['name']; $echo .= ""; $hide .= "hide(\'town".$town."\');"; } echo "Town:
"; $result = getRows(towns,"WHERE developed=''"); $echo = ""; while ($row = mysql_fetch_array($result)) { $town = $row['id']; $townname = $row['name']; echo "
"; echo "Room: "; echo "
"; } } if ($job == "sell") { echo ""; } echo "

"; echo "
"; echo '
'; echo '
'; echo '
'; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'; echo '
Avatar
'; echo '
'; echo '
'; $user_id = getInfo(id,users,"WHERE id='$npc'"); echo '
'; echo ''; echo '
'; $conditions = "WHERE id='$npc'"; $overhead = explode('.',getInfo(overhead,users,$conditions)); $clothes = explode('.',getInfo(clothes,users,$conditions)); $behind = explode('.',getInfo(behind,users,$conditions)); $hair = getInfo(hair,users,"WHERE id='$npc'"); if (!$hair) { $hair_hidden = true; $hair = getInfo(hairhide,users,"WHERE id='$npc'"); } else { $hair_hidden = false; } $hair_image = getInfo(image,hair,"WHERE id='$hair'"); $hair_sex = getInfo(sex,hair,"WHERE id='$hair'"); $hair_sex = getInfo(sex,bases,"WHERE id='$hair_sex'"); echo '
Hair
'; echo ''; echo ''; echo '

'; echo '
'; echo '

'; echo '
'; echo '
Over-Hair Clothing/Accessories
'; $max = count($overhead); for ($i = 0;$i < $max;$i++) { $item = $overhead[$i]; if ($item) { $conditions = "WHERE id='$item'"; $name = getInfo(name,user_items,$conditions); $record = getInfo(item,user_items,$conditions); $image = displayClothing($record); if ($i % 4 == 0) echo ''; echo ''; if ((($i + 1) % 4 == 0) || ($i + 1 == $max)) echo ''; } } echo '
'.$name.'


'; echo '
Remove
'; echo '

'; echo '
'; echo '
Under-Hair Clothing/Accessories
'; $max = count($clothes); for ($i = 0;$i < $max;$i++) { $item = $clothes[$i]; if ($item) { $conditions = "WHERE id='$item'"; $name = getInfo(name,user_items,$conditions); $record = getInfo(item,user_items,$conditions); $image = displayClothing($record); if ($i % 4 == 0) echo ''; echo ''; if ((($i + 1) % 4 == 0) || ($i + 1 == $max)) echo ''; } } echo '
'.$name.'


'; echo '
Remove
'; echo '
'; echo '
'; echo '
Behind Avatar Clothing/Accessories
'; $max = count($behind); for ($i = 0;$i < $max;$i++) { $item = $behind[$i]; if ($item) { $conditions = "WHERE id='$item'"; $name = getInfo(name,user_items,$conditions); $record = getInfo(item,user_items,$conditions); $image = displayClothing($record); if ($i % 4 == 0) echo ''; echo ''; if ((($i + 1) % 4 == 0) || ($i + 1 == $max)) echo ''; } } echo '
'.$name.'


'; echo '
Remove
'; echo '

'; echo '
'; echo '
'; echo '
'; echo '
'; echo '
'; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'; echo '
Inventory
'; echo '
'; echo '
'; unset($clothes); $conditions = "WHERE id='$npc'"; $inventory = explode('.',getInfo(inventory,users,$conditions)); $max = count($inventory); for ($i = 0;$i < $max;$i++) { $item = $inventory[$i]; $conditions = "WHERE id='$item'"; $type = getInfo(type,user_items,$conditions); if (($type == "clothing") || ($type == "armour") || ($type == "weapon")) $clothes[] = $item; } echo '
Clothing/Accessories
'; $max = count($clothes); for ($i = 0;$i < $max;$i++) { $item = $clothes[$i]; if ($item) { $conditions = "WHERE id='$item'"; $name = getInfo(name,user_items,$conditions); $record = getInfo(item,user_items,$conditions); $image = displayClothing($record); if ($i % 4 == 0) echo ''; echo ''; if ((($i + 1) % 4 == 0) || ($i + 1 == $max)) echo ''; } } echo '
'.$name.'


'; echo '
Wear Over-Hair
'; echo '
Wear Under-Hair
'; echo '
Wear Behind Avatar
'; echo '

'; echo '
'; echo '
'; } else { echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'; echo '
Error
'; echo '
'; echo '
You must be '.$npcName.'\'s owner to view this.
'; echo '
'; echo '
'; } echo ''; include "index-bottom.php" ?>