'; $group = $_GET['id']; $leader = getInfo(leader,npc_groups,"WHERE id='$group'"); $owner = getInfo(creator,npc_groups,"WHERE id='$group'"); if (($leader == $userId) || ($owner == $userId) || (admin($user_name))) { if (($_POST['mode'] == "movetown") && (admin($user_name))) { $town = $_POST['destination']; echo $town; if (!$town) $message = "You have not selected a destination."; $place = getInfo(townsqr,towns,"WHERE id='$town'"); $room = getInfo(id,rooms,"WHERE place='$place'"); if (!$message) { $result = getRows(npcs,"WHERE npcgroup='$group' and npcgroup!=''"); while ($row = mysql_fetch_array($result)) { $slave = $row['name']; if (isFighting($slave)) $failure = true; if (!$failure) { $query = "UPDATE users SET town='$town' WHERE id='$slave'"; mysql_query($query); $query = "UPDATE users SET location='$place' WHERE id='$slave'"; mysql_query($query); $query = "UPDATE users SET room='$room' WHERE id='$slave'"; mysql_query($query); } } $message = "You have moved your NPCs."; } echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'; echo '
Success
'; echo '
'; echo '
'.$message.'
'; echo '
'; echo '
'; } if ($_POST['mode'] == "move") { $destination = $_POST['destination']; if (!$destination) $message = "You have not selected a destination."; $location = getInfo(location,users,"WHERE id='$slave'"); $place = getInfo(place,rooms,"WHERE id='$destination'"); $locked = getInfo(locked,places,"WHERE id='$place'"); $town = getInfo(town,places,"WHERE id='$place'"); $x = getInfo(x,transport,"WHERE place='$place'"); $y = getInfo(y,transport,"WHERE place='$place'"); if (($location != $place) && ($locked)) $message = "That place is locked."; if (!$message) { $result = getRows(npcs,"WHERE npcgroup='$group'"); while ($row = mysql_fetch_array($result)) { $slave = $row['name']; $room = getInfo(room,users,"WHERE id='$slave'"); if (!inArray($destination,destinations($room))) $failure = "nodestination"; if (weigh($slave) > maxWeight($slave)) $failure = "overweight"; if (($destination != "travel") && ($destination != "overboard")) { $npctown = getInfo(town,users,"WHERE id='$slave'"); $building = getInfo(place,rooms,"WHERE id='$destination'"); $npcx = getInfo(x,transport,"WHERE place='$building'"); $npcy = getInfo(y,transport,"WHERE place='$building'"); if ($town) { if ($town != $npctown) $failure = "wrongtown"; } else { if (($x != $npcx) || ($y != $npcy)) $failure = "wrongsquare"; } if (((!$town) && ($npctown)) || (($town) && (!$npctown))) $failure = "difftown"; } if (isFighting($slave)) $failure = "fighting"; if (!$failure) { move($slave,$destination); } unset($failure); } $message = "Every NPC in this group that can access the building has been moved there."; } echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'; echo '
Success
'; echo '
'; echo '
'.$message.'
'; echo '
'; echo '
'; } if ($_POST['mode'] == "movesettings") { $move = $_POST['move']; if ($move == "stand") { $result = getRows(npcs,"WHERE npcgroup='$group'"); while ($row = mysql_fetch_array($result)) { $slave = $row['name']; $query = "UPDATE npcs SET movement='' WHERE name='$slave'"; mysql_query($query); } echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'; echo '
Success
'; echo '
'; echo '
The NPCs are now set to stay in one place.
'; echo '
'; echo '
'; } if (($move == "wandergroupregion") && (admin($user_name))) { $result = getRows(npcs,"WHERE npcgroup='$group'"); $query = "DELETE FROM npc_groupwander WHERE npcgroup='$group'"; mysql_query($query); while ($row = mysql_fetch_array($result)) { $slave = $row['name']; $query = "DELETE FROM npc_siege WHERE npc='$slave'"; mysql_query($query); $query = "DELETE FROM npc_arrow WHERE npc='$slave'"; mysql_query($query); $query = "DELETE FROM npc_mining WHERE npc='$slave'"; mysql_query($query); $query = "DELETE FROM npc_wander WHERE npc='$slave'"; mysql_query($query); $time = time(); $query = "UPDATE npcs SET mode='wander' WHERE name='$slave'"; mysql_query($query); $query = "UPDATE npcs SET var='' WHERE name='$slave'"; mysql_query($query); $query = "UPDATE npcs SET movement='wander' WHERE name='$slave'"; mysql_query($query); $query = "INSERT INTO npc_groupwander VALUES('','$group','$time','region')"; mysql_query($query); } $query = "UPDATE npc_groups SET mode='wander' WHERE id='$group'"; mysql_query($query); echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'; echo '
Success
'; echo '
'; echo '
The NPCs are now set to wander around aimlessly together in the region.
'; echo '
'; echo '
'; } if ($move == "wandergroup") { $query = "DELETE FROM npc_groupwander WHERE npcgroup='$group'"; mysql_query($query); $result = getRows(npcs,"WHERE npcgroup='$group'"); while ($row = mysql_fetch_array($result)) { $slave = $row['name']; $query = "DELETE FROM npc_siege WHERE npc='$slave'"; mysql_query($query); $query = "DELETE FROM npc_arrow WHERE npc='$slave'"; mysql_query($query); $query = "DELETE FROM npc_mining WHERE npc='$slave'"; mysql_query($query); $query = "DELETE FROM npc_wander WHERE npc='$slave'"; mysql_query($query); $time = time(); $query = "UPDATE npcs SET mode='wander' WHERE name='$slave'"; mysql_query($query); $query = "UPDATE npcs SET var='' WHERE name='$slave'"; mysql_query($query); $query = "UPDATE npcs SET movement='wander' WHERE name='$slave'"; mysql_query($query); } $query = "INSERT INTO npc_groupwander VALUES('','$group','$time','')"; mysql_query($query); $query = "UPDATE npc_groups SET mode='wander' WHERE id='$group'"; mysql_query($query); echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'; echo '
Success
'; echo '
'; echo '
The NPCs are now set to wander around aimlessly together.
'; echo '
'; echo '
'; } if ($move == "wander") { $result = getRows(npcs,"WHERE npcgroup='$group'"); while ($row = mysql_fetch_array($result)) { $slave = $row['name']; $query = "DELETE FROM npc_siege WHERE npc='$slave'"; mysql_query($query); $query = "DELETE FROM npc_arrow WHERE npc='$slave'"; mysql_query($query); $query = "DELETE FROM npc_mining WHERE npc='$slave'"; mysql_query($query); $query = "DELETE FROM npc_wander WHERE npc='$slave'"; mysql_query($query); $time = time(); $query = "UPDATE npcs SET mode='wander' WHERE name='$slave'"; mysql_query($query); $query = "UPDATE npcs SET var='' WHERE name='$slave'"; mysql_query($query); $query = "UPDATE npcs SET movement='wander' WHERE name='$slave'"; mysql_query($query); $query = "INSERT INTO npc_wander VALUES('','$slave','$time')"; mysql_query($query); } $query = "UPDATE npc_groups SET mode='wander' WHERE id='$group'"; mysql_query($query); echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'; echo '
Success
'; echo '
'; echo '
The NPCs are now set to wander around aimlessly individually.
'; echo '
'; echo '
'; } if ($move == "follow") { $user = $_POST['user']; $username = getInfo(username,users,"WHERE id='$user'"); if (!$user) $message = "That user does not exist."; else $message = "The NPCs are now set to follow $username."; if ($user) { $result = getRows(npcs,"WHERE npcgroup='$group'"); while ($row = mysql_fetch_array($result)) { $slave = $row['name']; $query = "UPDATE npcs SET movement='follow' WHERE name='$slave'"; mysql_query($query); $query = "UPDATE npcs SET var='$user' WHERE name='$slave'"; mysql_query($query); } } echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'; echo '
Success
'; echo '
'; echo '
'.$message.'
'; echo '
'; echo '
'; } } if ($_POST['mode'] == "travel") { $destination = $_POST['destination']; $username = $_POST['user']; $user = $_POST['user']; $oldUser = $user; if ((!$user) && (!$destination)) $message = "You must select either a user or a town."; $user = getInfo(id,users,"WHERE username='$user'"); if ((!$user) && ($oldUser)) $message = "That user does not exist."; if (!$message) { $result = getRows(npcs,"WHERE npcgroup='$group'"); while ($row = mysql_fetch_array($result)) { $slave = $row['name']; $time = time(); $query = "INSERT INTO npc_travel VALUES('','$slave','','$destination','','$user','','$time')"; mysql_query($query); } $message = "The NPC is now travelling."; } echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'; echo '
Success
'; echo '
'; echo '
'.$message.'
'; echo '
'; echo '
'; } if ($_POST['mode'] == "jobsettings") { $job = $_POST['job']; if ($job == "idle") { $result = getRows(npcs,"WHERE npcgroup='$group'"); while ($row = mysql_fetch_array($result)) { $slave = $row['name']; $query = "DELETE FROM npc_siege WHERE npc='$slave'"; mysql_query($query); $query = "DELETE FROM npc_arrow WHERE npc='$slave'"; mysql_query($query); $query = "DELETE FROM npc_mining WHERE npc='$slave'"; mysql_query($query); $query = "UPDATE npcs SET mode='' WHERE name='$slave'"; mysql_query($query); } $query = "UPDATE npc_groups SET mode='' WHERE id='$group'"; mysql_query($query); $message = "The NPCs are now set to idle."; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'; echo '
Success
'; echo '
'; echo '
'.$message.'
'; echo '
'; echo '
'; } if ($job == "mine") { $result = getRows(npcs,"WHERE npcgroup='$group'"); while ($row = mysql_fetch_array($result)) { $slave = $row['name']; $query = "DELETE FROM npc_mining WHERE npc='$slave'"; mysql_query($query); $time = time(); $room = getInfo(room,users,"WHERE id='$slave'"); $query = "INSERT INTO npc_mining VALUES('','$slave','$time','$room')"; mysql_query($query); $query = "UPDATE npcs SET mode='mine' WHERE name='$slave'"; mysql_query($query); $query = "UPDATE npcs SET movement='' WHERE npc='$slave'"; mysql_query($query); } $query = "UPDATE npc_groups SET mode='mine' WHERE id='$group'"; mysql_query($query); $message = "Your NPCs are now set to pick up every resource in the room every 12 hours."; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'; echo '
Success
'; echo '
'; echo '
'.$message.'
'; echo '
'; echo '
'; } if ($job == "sell") { $result = getRows(npcs,"WHERE npcgroup='$group'"); while ($row = mysql_fetch_array($result)) { $slave = $row['name']; $query = "UPDATE npcs SET mode='sell' WHERE name='$slave'"; mysql_query($query); $query = "UPDATE npcs SET var='' WHERE name='$slave'"; mysql_query($query); $query = "UPDATE npcs SET movement='' WHERE name='$slave'"; mysql_query($query); } $query = "UPDATE npc_groups SET mode='sell' WHERE id='$group'"; mysql_query($query); echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'; echo '
Success
'; echo '
'; echo '
The NPCs are now set to automatically work the counter for a restaurant or shop.
'; echo '
'; echo '
'; } if ($job == "protect") { $user = $_POST['user']; $username = getInfo(username,users,"WHERE id='$user'"); if ($user == "all:room") $username = "all NPCs (stop any fights), while staying in the same room."; if ($user == "all:place") $username = "all NPCs (stop any fights), while staying in the same building and wandering from room to room."; if ($user == "all") $username = "all NPCs (stop any fights), while wandering around town."; if (!$user) $message = "That user does not exist."; if (isFighting($user)) $message = "That user is currently fighting - you may only set your NPC to protect a user who is not being attacked at the time."; if (!$message) { $result = getRows(npcs,"WHERE npcgroup='$group'"); while ($row = mysql_fetch_array($result)) { $slave = $row['name']; if ($row['type'] > 10) { $query = "UPDATE npcs SET mode='protect' WHERE name='$slave'"; mysql_query($query); $query = "UPDATE npcs SET var='$user' WHERE name='$slave'"; mysql_query($query); if (($user == "all:place") || ($user == "all")) { $query = "UPDATE npcs SET movement='wander' WHERE name='$slave'"; mysql_query($query); $time = time(); $query = "INSERT INTO npc_wander VALUES('','$slave','$time')"; mysql_query($query); } elseif ($user != "all:room") { $query = "UPDATE npcs SET movement='follow' WHERE name='$slave'"; mysql_query($query); } } } $message = "The NPCs are now set to protect $username."; $query = "UPDATE npc_groups SET mode='protect' WHERE id='$group'"; mysql_query($query); $query = "UPDATE npc_groups SET var='$user' WHERE id='$group'"; mysql_query($query); } echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'; echo '
Success
'; echo '
'; echo '
'.$message.'
'; echo '
'; echo '
'; } } if ($_POST['mode'] == "target") { $target = $_POST['target']; $targetPlace = getInfo(place,rooms,"WHERE id='$target'"); $result = getRows(npcs,"WHERE npcgroup='$group'"); while ($row = mysql_fetch_array($result)) { $npc = $row['name']; $query = "UPDATE npc_siege SET target='$targetPlace' WHERE npc='$npc'"; mysql_query($query); $query = "UPDATE npc_arrow SET target='$target' WHERE npc='$npc'"; mysql_query($query); } echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'; echo '
Success
'; echo '
'; echo '
You have successfully changed their targets.
'; echo '
'; echo '
'; } if ($_POST['mode'] == "delete") { if (getInfo(creator,npc_groups,"WHERE id='$group'") == $userId) { $query = "UPDATE npcs SET npcgroup='' WHERE npcgroup='$group'"; mysql_query($query); $query = "DELETE FROM npc_groups WHERE id='$group'"; mysql_query($query); echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'; echo '
Success
'; echo '
'; echo '
You have successfully deleted the group.
'; 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 your npc\'s belongings. You may remove your npc\'s clothing, and/or take anything from its inventory.
'; echo '
'; if (getInfo(creator,npc_groups,"WHERE id='$group'") == $userId) echo '
'; echo '
'; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'; echo '
NPCs
'; echo '
'; echo ''; $result = getRows(npcs,"WHERE npcgroup='$group'"); while ($row = mysql_fetch_array($result)) { $npc = $row['name']; $name = getInfo(username,users,"WHERE id='$npc'"); $status = getInfo(status,users,"WHERE id='$npc'"); if ($status != "dead") echo ''; } echo '
'.$name.' - '.capitalize($status).'
'; echo '
'; echo '
'; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'; echo '
Current Settings
'; echo '
'; echo '
'; $var = getInfo('var',npc_groups,"WHERE id='$group'"); $job = getInfo(mode,npc_groups,"WHERE id='$group'"); echo "Current Job : "; if ($job == "siege") { $target = getInfo(target,npc_siege,"WHERE npc='$slave'"); $weapon = getInfo(weapon,npc_siege,"WHERE npc='$slave'"); $weaponType = getInfo(type,arsenals,"WHERE id='$weapon'"); $weaponType = getInfo(name,weapons,"WHERE id='$weaponType'"); $ammo = getInfo(ammo,npc_siege,"WHERE npc='$slave'"); $ammoType = getInfo(type,ammo,"WHERE id='$ammo'"); $ammoType = getInfo(name,ammunition,"WHERE id='$ammoType'"); $targetName = getInfo(name,places,"WHERE id='$target'"); if ($target) echo "Fire $weaponType [$weapon] ($ammoType) at $targetName
"; else echo "Man $weaponType [$weapon] ($ammoType) and return fire if attacked
"; } if ($job == "protect") { $protect = getInfo('var',npcs,"WHERE name='$slave'"); $protect = getInfo(username,users,"WHERE id='$protect'"); echo "Protect $protect
"; } if ($job == "sell") { echo "Automatically tend to the selling of items, if the npc is an employee in its current location
"; } if ($job == "mine") { echo "Automatically pick up every crude resource in a room, every 12 hours."; } if ($job == "wander") { echo "Wander around aimlessly"; } if ($job == "") { echo "This NPC is not set to do anything"; } echo '
'; echo '
'; echo '
'; if (admin($user_name)) { echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'; echo '
Move Town
'; echo '
'; echo '
'; echo '
'; echo 'Move :
'; echo '
'; echo '
'; echo '
'; echo '
'; echo '
'; } echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'; echo '
Move NPC
'; echo '
'; echo '
'; echo '
'; $npc = getInfo(name,npcs,"WHERE npcgroup='$group'"); echo 'Move :
'; echo '
'; echo '
'; echo '
'; echo '
'; echo '
'; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'; echo '
Change Siege/Arrow Targets
'; echo '
'; echo '
'; echo '
'; echo 'Target : '; echo '
'; echo '
'; echo '
'; echo '
'; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'; echo '
Travelling
'; echo '
'; echo '
'; echo '
'; if (!getInfo(npc,npc_travel,"WHERE npc='$slave'")) { echo 'Fill out as much of the form below as you need; do note that not every field is mandatory for certain tasks. For example, if you only want your NPC to go to a particular town, you need only select a "destination". Similarly, if you don\'t want your NPC to deliver something, you need not select an item. Also, you do not even need to state a destination, if you wish the NPC to follow a particular user - the NPC will simply hop from town to town, trying to get to the same town as that user. Do remember, however, that an NPC cannot deliver a crate.

'; echo 'Destination : User :

'; echo ''; } else { echo ""; $destination = getInfo(destination,npc_travel,"WHERE npc='$slave'"); $town = getInfo(name,towns,"WHERE id='$destination'"); $user = getInfo(user,npc_travel,"WHERE npc='$slave'"); $item = getInfo(item,npc_travel,"WHERE npc='$slave'"); $itemName = getInfo(name,user_items,"WHERE id='$item'"); if ($user) { if ($item) echo "The NPC is delivering $itemName to $user."; else echo "The NPC is travelling to $user."; } else echo "The NPC is travelling to $town."; } echo '
'; echo '
'; echo '
'; echo '
'; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'; echo '
Settings
'; echo '
'; echo '
'; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'; echo '
'; echo '
'; echo 'Movement :

'; $room = getInfo(room,users,"WHERE id='$userId'"); $place = getInfo(place,rooms,"WHERE id='$room'"); $town = getInfo(town,places,"WHERE id='$place'"); echo '
'; echo 'User : '; echo '
'; echo ''; echo '
'; echo '
'; echo '
'; echo '
'; echo '
'; echo '
'; echo 'Job :

'; echo '
'; echo 'User :
'; echo '
'; echo ''; echo '
'; echo '
'; echo '
'; echo '
'; echo '
'; echo '
'; echo 'When Attacked :

'; echo '
'; echo '
'; echo '
'; echo '
'; echo '
'; echo '
'; echo 'Reaction to fire :

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