';
echo '';
echo 'NPCs, or non-player-characters are little computer-run characters that can be used to fill the odd jobs that you yourself may not wish to do. While some NPCs can only be used for shopkeeping, mining and delivering messages, others can be used in combat as well. Please refer to this guide article for more information: NPCs
| ';
$result = getRows(users,"WHERE NPC='$userId' and status!='dead'");
while ($row = mysql_fetch_array($result)) {
$npc = $row['id'];
$npcname = $row['username'];
$npc_id = $row['id'];
$mode = getInfo(mode,npcs,"WHERE name='$npc'");
$var = getInfo('var',npcs,"WHERE name='$npc'");
if ($mode == "siege") {
$target = getInfo(target,npc_siege,"WHERE npc='$npc'");
$weapon = getInfo(weapon,npc_siege,"WHERE npc='$npc'");
$weaponType = getInfo(type,arsenals,"WHERE id='$weapon'");
$weaponType = getInfo(name,weapons,"WHERE id='$weaponType'");
$ammo = getInfo(ammo,npc_siege,"WHERE npc='$npc'");
$ammoType = getInfo(type,ammo,"WHERE id='$ammo'");
$ammoType = getInfo(name,ammunition,"WHERE id='$ammoType'");
$targetName = getInfo(name,places,"WHERE id='$target'");
if ($target) {
$job = "Fire $weaponType [$weapon] ($ammoType) at $targetName.";
$cooldown = getInfo(cooldown,arsenals,"WHERE id='$weapon'");
$cooldown = $cooldown - time();
if ($cooldown > 0) {
$hours = truncate($cooldown / 3600);
$cooldown = $cooldown - ($hours * 3600);
$minutes = truncate($cooldown / 60);
$seconds = $cooldown - ($minutes * 60);
$job .= " Weapon cooldown in $hours hours, $minutes minutes and $seconds seconds.";
} else {
$job .= " Weapon cooldown complete.";
}
$cooldown = getInfo('time',npc_siege,"WHERE npc='$npc'");
$cooldown = $cooldown - time();
if ($cooldown > 0) {
$hours = truncate($cooldown / 3600);
$cooldown = $cooldown - ($hours * 3600);
$minutes = truncate($cooldown / 60);
$seconds = $cooldown - ($minutes * 60);
$job .= " Firing next in $hours hours, $minutes minutes and $seconds seconds";
} else {
$job .= " Ready to fire.";
}
} else {
$job = "Man $weaponType [$weapon] ($ammoType) and return fire if attacked.";
$cooldown = getInfo(cooldown,arsenals,"WHERE id='$weapon'");
$cooldown = $cooldown - time();
if ($cooldown > 0) {
$hours = truncate($cooldown / 3600);
$cooldown = $cooldown - ($hours * 3600);
$minutes = truncate($cooldown / 60);
$seconds = $cooldown - ($minutes * 60);
$job .= " Weapon cooldown in $hours hours, $minutes minutes and $seconds seconds";
} else {
$job .= " Weapon cooldown complete";
}
}
}
if ($mode == "arrows") {
$target = getInfo(target,npc_arrow,"WHERE npc='$npc'");
$roomName = getInfo(name,rooms,"WHERE id='$target'");
$targetName = getInfo(place,rooms,"WHERE id='$target'");
$targetName = getInfo(name,places,"WHERE id='$targetName'");
if ($target) {
$job = "Fire arrows at $roomName, $targetName.";
$cooldown = getInfo(arrows,npcs,"WHERE name='$npc'");
$cooldown = $cooldown - time();
if ($cooldown > 0) {
$hours = truncate($cooldown / 3600);
$cooldown = $cooldown - ($hours * 3600);
$minutes = truncate($cooldown / 60);
$seconds = $cooldown - ($minutes * 60);
$job .= " Cooldown in $hours hours, $minutes minutes and $seconds seconds.";
} else {
$job .= " Cooldown complete.";
}
$cooldown = getInfo('time',npc_arrow,"WHERE npc='$npc'");
$cooldown = $cooldown - time();
if ($cooldown > 0) {
$hours = truncate($cooldown / 3600);
$cooldown = $cooldown - ($hours * 3600);
$minutes = truncate($cooldown / 60);
$seconds = $cooldown - ($minutes * 60);
$job .= " Firing next in $hours hours, $minutes minutes and $seconds seconds";
} else {
$job .= " Ready to fire";
}
} else {
$job = "Stand guard with bow and arrows, return fire if attacked.";
$cooldown = getInfo(arrows,npcs,"WHERE name='$npc'");
$cooldown = $cooldown - time();
if ($cooldown > 0) {
$hours = truncate($cooldown / 3600);
$cooldown = $cooldown - ($hours * 3600);
$minutes = truncate($cooldown / 60);
$seconds = $cooldown - ($minutes * 60);
$job .= " Cooldown in $hours hours, $minutes minutes and $seconds seconds";
} else {
$job .= " Cooldown complete";
}
}
}
if ($mode == "protect") {
$protected = getInfo(username,users,"WHERE id='$var'");
$job = "Protect $protected";
}
if ($mode == "sell") {
$job = "Automatically tend to the selling of items, if the npc is an employee in its current location";
}
if ($mode == "mine") {
$job = "Automatically pick up crude resources.";
$cooldown = getInfo('time',npc_mining,"WHERE npc='$npc'");
$cooldown = $cooldown - time();
if ($cooldown > 0) {
$hours = truncate($cooldown / 3600);
$cooldown = $cooldown - ($hours * 3600);
$minutes = truncate($cooldown / 60);
$seconds = $cooldown - ($minutes * 60);
$job .= " Picking up next in $hours hours, $minutes minutes and $seconds seconds";
}
}
if ($mode == "") {
$job = "Idle";
}
echo '| '.$npcname.' : '.$job.' | ';
}
$result = getRows(npcs,"WHERE leader='$userId'");
while ($row = mysql_fetch_array($result)) {
$npc = $row['name'];
if (getInfo(status,users,"WHERE id='$npc'") != "dead") {
$npcname = getInfo(username,users,"WHERE id='$npc'");
$mode = getInfo(mode,npcs,"WHERE name='$npc'");
$var = getInfo('var',npcs,"WHERE name='$npc'");
if ($mode == "siege") {
$target = getInfo(target,npc_siege,"WHERE npc='$npc'");
$weapon = getInfo(weapon,npc_siege,"WHERE npc='$npc'");
$weaponType = getInfo(type,arsenals,"WHERE id='$weapon'");
$weaponType = getInfo(name,weapons,"WHERE id='$weaponType'");
$ammo = getInfo(ammo,npc_siege,"WHERE npc='$npc'");
$ammoType = getInfo(type,ammo,"WHERE id='$ammo'");
$ammoType = getInfo(name,ammunition,"WHERE id='$ammoType'");
$targetName = getInfo(name,places,"WHERE id='$target'");
if ($target) {
$job = "Fire $weaponType [$weapon] ($ammoType) at $targetName.";
$cooldown = getInfo(cooldown,arsenals,"WHERE id='$weapon'");
$cooldown = $cooldown - time();
if ($cooldown > 0) {
$hours = truncate($cooldown / 3600);
$cooldown = $cooldown - ($hours * 3600);
$minutes = truncate($cooldown / 60);
$seconds = $cooldown - ($minutes * 60);
$job .= " Weapon cooldown in $hours hours, $minutes minutes and $seconds seconds.";
} else {
$job .= " Weapon cooldown complete.";
}
$cooldown = getInfo('time',npc_siege,"WHERE npc='$npc'");
$cooldown = $cooldown - time();
if ($cooldown > 0) {
$hours = truncate($cooldown / 3600);
$cooldown = $cooldown - ($hours * 3600);
$minutes = truncate($cooldown / 60);
$seconds = $cooldown - ($minutes * 60);
$job .= " Firing next in $hours hours, $minutes minutes and $seconds seconds";
} else {
$job .= " Ready to fire.";
}
} else {
$job = "Man $weaponType [$weapon] ($ammoType) and return fire if attacked.";
$cooldown = getInfo(cooldown,arsenals,"WHERE id='$weapon'");
$cooldown = $cooldown - time();
if ($cooldown > 0) {
$hours = truncate($cooldown / 3600);
$cooldown = $cooldown - ($hours * 3600);
$minutes = truncate($cooldown / 60);
$seconds = $cooldown - ($minutes * 60);
$job .= " Weapon cooldown in $hours hours, $minutes minutes and $seconds seconds";
} else {
$job .= " Weapon cooldown complete";
}
}
}
if ($mode == "arrows") {
$target = getInfo(target,npc_arrow,"WHERE npc='$npc'");
$roomName = getInfo(name,rooms,"WHERE id='$target'");
$targetName = getInfo(place,rooms,"WHERE id='$target'");
$targetName = getInfo(name,places,"WHERE id='$targetName'");
if ($target) {
$job = "Fire arrows at $roomName, $targetName.";
$cooldown = getInfo(arrows,npcs,"WHERE name='$npc'");
$cooldown = $cooldown - time();
if ($cooldown > 0) {
$hours = truncate($cooldown / 3600);
$cooldown = $cooldown - ($hours * 3600);
$minutes = truncate($cooldown / 60);
$seconds = $cooldown - ($minutes * 60);
$job .= " Cooldown in $hours hours, $minutes minutes and $seconds seconds.";
} else {
$job .= " Cooldown complete.";
}
$cooldown = getInfo('time',npc_arrow,"WHERE npc='$npc'");
$cooldown = $cooldown - time();
if ($cooldown > 0) {
$hours = truncate($cooldown / 3600);
$cooldown = $cooldown - ($hours * 3600);
$minutes = truncate($cooldown / 60);
$seconds = $cooldown - ($minutes * 60);
$job .= " Firing next in $hours hours, $minutes minutes and $seconds seconds";
} else {
$job .= " Ready to fire";
}
} else {
$job = "Stand guard with bow and arrows, return fire if attacked.";
$cooldown = getInfo(arrows,npcs,"WHERE name='$npc'");
$cooldown = $cooldown - time();
if ($cooldown > 0) {
$hours = truncate($cooldown / 3600);
$cooldown = $cooldown - ($hours * 3600);
$minutes = truncate($cooldown / 60);
$seconds = $cooldown - ($minutes * 60);
$job .= " Cooldown in $hours hours, $minutes minutes and $seconds seconds";
} else {
$job .= " Cooldown complete";
}
}
}
if ($mode == "protect") {
$protected = getInfo(username,users,"WHERE id='$var'");
$job = "Protect $protected";
}
if ($mode == "sell") {
$job = "Automatically tend to the selling of items, if the npc is an employee in its current location";
}
if ($mode == "mine") {
$job = "Gather resources from the room.";
$cooldown = getInfo('time',npc_mining,"WHERE npc='$npc'");
$cooldown = $cooldown - time();
if ($cooldown > 0) {
$hours = truncate($cooldown / 3600);
$cooldown = $cooldown - ($hours * 3600);
$minutes = truncate($cooldown / 60);
$seconds = $cooldown - ($minutes * 60);
$job .= " Picking up next in $hours hours, $minutes minutes and $seconds seconds";
}
}
if ($mode == "") {
$job = "Idle";
}
echo '| '.$npcname.' : '.$job.' | ';
}
}
echo '';
if (npclimit($userId)) echo '
| | ';
echo ' | | | ';
echo ' ';
echo ' | ';
echo '
';
echo '