/
com/planet_ink/coffee_mud/Abilities/Common/
com/planet_ink/coffee_mud/Abilities/Diseases/
com/planet_ink/coffee_mud/Abilities/Druid/
com/planet_ink/coffee_mud/Abilities/Fighter/
com/planet_ink/coffee_mud/Abilities/Languages/
com/planet_ink/coffee_mud/Abilities/Misc/
com/planet_ink/coffee_mud/Abilities/Prayers/
com/planet_ink/coffee_mud/Abilities/Properties/
com/planet_ink/coffee_mud/Abilities/Skills/
com/planet_ink/coffee_mud/Abilities/Songs/
com/planet_ink/coffee_mud/Abilities/Specializations/
com/planet_ink/coffee_mud/Abilities/Spells/
com/planet_ink/coffee_mud/Abilities/Thief/
com/planet_ink/coffee_mud/Abilities/Traps/
com/planet_ink/coffee_mud/Behaviors/
com/planet_ink/coffee_mud/CharClasses/
com/planet_ink/coffee_mud/CharClasses/interfaces/
com/planet_ink/coffee_mud/Commands/
com/planet_ink/coffee_mud/Commands/interfaces/
com/planet_ink/coffee_mud/Common/
com/planet_ink/coffee_mud/Common/interfaces/
com/planet_ink/coffee_mud/Exits/interfaces/
com/planet_ink/coffee_mud/Items/Armor/
com/planet_ink/coffee_mud/Items/Basic/
com/planet_ink/coffee_mud/Items/BasicTech/
com/planet_ink/coffee_mud/Items/CompTech/
com/planet_ink/coffee_mud/Items/MiscMagic/
com/planet_ink/coffee_mud/Items/Weapons/
com/planet_ink/coffee_mud/Items/interfaces/
com/planet_ink/coffee_mud/Libraries/
com/planet_ink/coffee_mud/Libraries/interfaces/
com/planet_ink/coffee_mud/Locales/
com/planet_ink/coffee_mud/MOBS/
com/planet_ink/coffee_mud/Races/
com/planet_ink/coffee_mud/Races/interfaces/
com/planet_ink/coffee_mud/WebMacros/
com/planet_ink/coffee_mud/WebMacros/interfaces/
com/planet_ink/coffee_mud/core/
com/planet_ink/coffee_mud/core/collections/
com/planet_ink/coffee_mud/core/interfaces/
com/planet_ink/coffee_mud/core/intermud/
com/planet_ink/coffee_mud/core/intermud/i3/
com/planet_ink/coffee_web/server/
com/planet_ink/siplet/applet/
lib/
resources/factions/
resources/fakedb/
resources/progs/autoplayer/
resources/quests/holidays/
web/
web/admin.templates/
web/admin/grinder/
web/admin/images/
web/clan.templates/
web/pub.templates/
web/pub/images/mxp/
web/pub/sounds/
web/pub/textedit/
<?xml version="1.0"?>
<!-- ----------------------------------------------------------------------------
Copyright 2019-2019 Bo Zimmerman

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
--------------------------------------------------------------------------------

See guides/RandomAreas.html for information about documents of this type.

template: normal_delivery1
settable vars: 
    template(normal_delivery1)
    area_name(area name)
    source_name(mob name)
    targetarea_name(area name)
    targetname(container name)
    itemname(name of an item)
    multiarea(yes or NO)
	xp_amount_awarded
	gold_amount_awarded
	quest_point_awarded(YES,NO)
	reward_items()
	quest_multiple(YES, NO, or PREV)
-->

<QUEST ID="normal_delivery2" QUEST_TEMPLATE_ID="normal_delivery2">
	<QUEST_ID DEFINE="quest_id">${_:source_area_name}_${_:source_name}_${h:quest_template}_R$[100000000?999999999]</QUEST_ID>
	<QUEST_CRITERIA>+SYSOP +LEVELS -&lt;$[$target_level - $level_span] -&gt;$[$target_level + $level_span]</QUEST_CRITERIA>
	<DELIVERER_AREA>"$source_area_name"</DELIVERER_AREA>
	<DELIVERER_ROOM>"$source_room_id"</DELIVERER_ROOM>
	<DELIVERER_NAME>"$source_name"</DELIVERER_NAME>
	<DESTINATION_AREA>"$target_area_name"</DESTINATION_AREA>
	<DESTINATION_ROOM>"$target_room_id"</DESTINATION_ROOM>
	<DESTINATION_CONTAINER>$target_container_quoted_name</DESTINATION_CONTAINER>
	<DELIVERABLE_ITEM>${SELECT: ANY\. from $target_item}</DELIVERABLE_ITEM>
	<QUEST_POINT>$quest_point_awarded</QUEST_POINT>
	<GOLD>$gold_amount_awarded</GOLD>
	<EXP>$xp_amount_awarded</EXP>
	<MULTIPLE>$quest_multiple</MULTIPLE>
	<NEXT_QUEST>$next_quest_id</NEXT_QUEST>
	<FACTION>$source_faction</FACTION>
	<NUMFACTION>$[$source_faction_amt / 500]</NUMFACTION>
	<QUEST_NAME SELECT="Any-1">
		<QUEST_NAME>${C:source_name} needs ${target_item_name} $reason_verbed to $target_name in ${C:target_area_name}</QUEST_NAME>
		<QUEST_NAME>${C:source_name} wants ${target_item_name} $reason_verbed to $target_name in ${C:target_area_name}</QUEST_NAME>
		<QUEST_NAME>${C:source_name} asks for ${target_item_name} to be $reason_verbed to $target_name in ${C:target_area_name}</QUEST_NAME>
		<QUEST_NAME>${C:reason_verb} ${target_item_name} to $target_name in ${C:target_area_name} for ${C:source_name}</QUEST_NAME>
	</QUEST_NAME>
	<QUEST_NOTIFYSSTRING>${j:1:quest_notifystring}</QUEST_NOTIFYSSTRING>
	<QUEST_INSTRUCTIONSSTRING>${j:1:quest_instructionstring}</QUEST_INSTRUCTIONSSTRING>
	<DELIVER_RESPONSE>${j:1:quest_delivered}</DELIVER_RESPONSE>
	<REWARD_ITEMS>${SELECT: ANY\. FROM $dungeon_treasure_items}</REWARD_ITEMS>

	<STRING load="/resources/quests/random/inc_questcommon.xml" />

	<STRING ID="quest_notifystring" define="quest_notifystring" SELECT="ALL">
		<STRING ACTION="PREPEND">$reason_short  $quest_notifyaddendum</STRING>
	</STRING>

	<STRING ID="quest_notifyaddendum" SELECT="Pick-1">
		<STRING PICKWEIGHT=1>Are you game?</STRING>
		<STRING PICKWEIGHT=1>Are you ready?</STRING>
		<STRING PICKWEIGHT=1>Are you up to it?</STRING>
		<STRING PICKWEIGHT=1>Can you handle it?</STRING>
		<STRING PICKWEIGHT=1>Who's ready?</STRING>
		<STRING PICKWEIGHT=12></STRING>
	</STRING>
	
	<STRING ID="reason_short" define="reason_short" SELECT="Any-1">
		<STRING>I need ${target_item_name} $reason_verbed!</STRING>
		<STRING>Help me $reason_verb ${p:target_item_name}!</STRING>
		<STRING>Assistance required delivering ${p:target_item_name}!</STRING>
		<STRING>${c:reason_verb} ${p:target_item_name} for me!</STRING>
		<STRING>${c:reason_verb} ${p:target_item_name}, quickly!</STRING>
		<STRING>I want ${target_item_name} $reason_verbed!</STRING>
	</STRING>

	<STRING ID="quest_instructionstring" SELECT="ALL">
		<STRING ACTION="PREPEND">$reason_desc</STRING>
		<STRING ACTION="APPEND">$reason_short</STRING>
	</STRING>

	<STRING ID="quest_delivered" PREDEFINE="reason=$reason">
		<STRING condition="$quest_delivered != ''">$quest_delivered</STRING>
		<STRING condition="$quest_delivered = ''">Your task is complete.</STRING>
	</STRING>
	<STRING ID="reason_verbed" PREDEFINE="reason=$reason">delivered</STRING>
	<STRING ID="reason_verb" PREDEFINE="reason=$reason">deliver</STRING>
	<STRING ID="reason_desc" PREDEFINE="reason=$reason">$reason_desc</STRING>
	<STRING ID="reason" DEFINE="reason" SELECT="Any-1">
		<STRING>$reason_theyoweme</STRING>
		<STRING>$reason_partytime</STRING>
		<STRING>$reason_iowethem</STRING>
		<STRING>$reason_ilostthem</STRING>
		<STRING>$reason_gendeliver</STRING>
		<STRING CONDITION="$source_align &gt; 500">$reason_idoforthem</STRING>
		<STRING>$reason_wedotogether</STRING>
		<STRING CONDITION="$source_align &lt; -500">$reason_idotothem</STRING>
		<STRING CONDITION="$source_align &lt; -500">$reason_wedotoeachother</STRING>
	</STRING>

	<STRING id="quest_generic_delivered_speeches" SELECT="Any-1">
		<STRING>How wonderful! Thank you $$n!!</STRING>
		<STRING>${c:reason_verbed} at last! Thank you $$n!</STRING>
		<STRING>Thanks $$n, I'll take it from here.</STRING>
		<STRING>Thank you $$n, that will be all.</STRING>
	</STRING>

	<STRING ID="reason_theyoweme" SELECT="All">
		<STRING define="quest_delivered">$quest_generic_delivered_speeches</STRING>
		<STRING define="reason_desc" SELECT="Any-1">
			<STRING>I want to place $target_item_name in ${C:target_area_name} as a free sample.</STRING>
		</STRING>
	</STRING>
	
	<STRING ID="reason_partytime" SELECT="All">
		<STRING define="quest_delivered">$quest_generic_delivered_speeches</STRING>
		<STRING define="reason_desc" SELECT="Any-1">
			<STRING>It is officially ${C:source_area_name} Day, and I'm donating $target_item_name.</STRING>
			<STRING>It is officially ${C:source_area_name} Day, and I'm giving a gift of $target_item_name.</STRING>
		</STRING>
	</STRING>

	<STRING ID="reason_iowethem" SELECT="All">
		<STRING define="quest_delivered">$quest_generic_delivered_speeches</STRING>
		<STRING define="reason_desc" SELECT="Any-1">
			<STRING>I need supplies dropped off in $target_area_name.</STRING>
		</STRING>
	</STRING>
	<STRING ID="reason_ilostthem" SELECT="All">
		<STRING define="quest_delivered">$quest_generic_delivered_speeches</STRING>
		<STRING define="reason_desc" SELECT="Any-1">
			<STRING>Someone lost $target_item_name and I took it by mistake.</STRING>
		</STRING>
	</STRING>

	<STRING ID="reason_gendeliver" SELECT="All">
		<STRING define="quest_delivered">$quest_generic_delivered_speeches</STRING>
		<STRING define="reason_desc" SELECT="Any-1">
			<STRING>I need $target_item_name delivered to $target_name.</STRING>
			<STRING>${c:target_item_name} needs to be delivered to $target_name.</STRING>
		</STRING>
	</STRING>

	<STRING ID="reason_idoforthem" SELECT="All">
		<STRING define="quest_delivered">$quest_generic_delivered_speeches</STRING>
		<STRING define="reason_desc" SELECT="Any-1">
			<STRING>I want to make ${target_area_name} beautiful.</STRING>
		</STRING>
	</STRING>

	<STRING ID="reason_wedotogether" SELECT="All">
		<STRING define="quest_delivered">$quest_generic_delivered_speeches</STRING>
		<STRING define="reason_desc" SELECT="Any-1">
			<STRING>I need to fill my order to a customers in $target_area_name.</STRING>
			<STRING>I want to see what happens when $target_item_name is put elsewhere.</STRING>
		</STRING>
	</STRING>

	<STRING ID="reason_idotothem" SELECT="All">
		<STRING define="quest_delivered">$quest_generic_delivered_speeches</STRING>
		<STRING define="reason_desc" SELECT="Any-1">
			<STRING>I want to make ${target_area_name} ugly.</STRING>
		</STRING>
	</STRING>

	<STRING ID="reason_wedotoeachother" SELECT="All">
		<STRING define="quest_delivered">$quest_generic_delivered_speeches</STRING>
		<STRING define="reason_desc" SELECT="Any-1">
			<STRING>I am studying $target_area_name, and need $target_item_name delivered today.</STRING>
		</STRING>
	</STRING>

	<STRING ID="quest_point_awarded" DEFINE="quest_point_awarded" SELECT="Pick-1">
		<STRING PICKWEIGHT=2>NO</STRING>
		<STRING PICKWEIGHT=1>YES</STRING>
	</STRING>

	<STRING ID="gold_amount_awarded" DEFINE="gold_amount_awarded" SELECT="any-1">
		<STRING>$[$target_level*2]</STRING>
	</STRING>

	<STRING ID="xp_amount_awarded" DEFINE="xp_amount_awarded" SELECT="any-1">
		<STRING>$[100 + $target_level*3]</STRING>
	</STRING>

	<OBJECT ID="source_area" SELECT="Pick-1" DEFINE="source_area">
		<OBJECT pickweight=99999 condition="'${SELECT: name FROM area}' != ''">SELECT: . FROM area</OBJECT>
		<OBJECT pickweight=55555 condition="$area_name != ''" and '${SELECT: name FROM area}' = ''>SELECT: ANY\. FROM areas where NAME=$area_name</OBJECT> 
		<OBJECT pickweight=1 condition="$area_name = '' and '${SELECT: name FROM area}' = '' and $multiarea = 'YES'">
			SELECT: ANY\. FROM areas WHERE (SELECT: count\. from $mql_viable_questgivers) &gt; 0
		</OBJECT>
		<OBJECT pickweight=1 condition="$area_name = '' and '${SELECT: name FROM area}' = '' and $multiarea != 'YES'">
			SELECT: ANY\. FROM areas WHERE (SELECT: count\. from $mql_viable_questgivers) &gt; 0
				AND (SELECT:count\. from area\rooms WHERE exits\count &gt; 0  AND display\count = 1) &gt; 0
		</OBJECT>
	</OBJECT>

	<OBJECT ID="source_room" DEFINE="source_room">SELECT: . FROM $source\room</OBJECT>
	
	<OBJECT ID="source" SELECT="Pick-1" DEFINE="source">
		<OBJECT PICKWEIGHT=99999 CONDITION="'${SELECT: name FROM mob}' != ''">SELECT: . FROM mob</OBJECT>
		<OBJECT pickweight=55555 condition="$sourcename != ''" and '${SELECT: name FROM mob}' = ''>SELECT: . FROM $source_area\npcs WHERE name = $sourcename</OBJECT> 
		<OBJECT PICKWEIGHT=1 CONDITION="$sourcename = '' and '${SELECT: name FROM mob}' = ''" insert="$mql_viable_questgiver" />
	</OBJECT>

	<STRING ID="source_area_name" SELECT="any-1" DEFINE="source_area_name">
		<STRING>${SELECT:name FROM $source_area}</STRING>
	</STRING>

	<STRING ID="target_level" DEFINE="target_level" SELECT="any-1">
		<STRING>${SELECT:MED_LEVEL from $target_area}</STRING>
	</STRING>
	
	<STRING ID="level_range" SELECT="any-1" DEFINE="level_range" MERGE=true>
		<STRING>$target_level</STRING>
	</STRING>
	
	<STRING ID="source_room_id" SELECT="any-1" DEFINE="source_room_id">
		<STRING>${SELECT:roomid from $source_room}</STRING>
	</STRING>

	<STRING ID="source_name" SELECT="any-1" DEFINE="source_name">
		<STRING>${SELECT:name from $source}</STRING>
	</STRING>

	<STRING ID="source_class" SELECT="any-1" DEFINE="source_class">
		<STRING>${SELECT:class from $source}</STRING>
	</STRING>

	<STRING ID="source_faction" SELECT="any-1" DEFINE="source_faction">
		<STRING>${SELECT:factionid from $source}</STRING>
	</STRING>

	<STRING ID="source_faction_amt" SELECT="first" DEFINE="source_faction_amt">
		<STRING CONDITION="$source_faction!=''">${SELECT:factionamt from $source}</STRING>
		<STRING>0</STRING>
	</STRING>

	<STRING ID="source_align" SELECT="any-1" DEFINE="source_align">
		<STRING>${SELECT:alignment from $source}</STRING>
	</STRING>

	<OBJECT ID="target" DEFINE="target">SELECT: ANY\. from $target_room</OBJECT>

	<STRING ID="target_name" SELECT="any-1" DEFINE="target_name">
		<STRING CONDITION="$target_container_name = ''">${SELECT:display from $target}</STRING>
		<STRING CONDITION="$target_container_name != ''">$target_container_name at ${SELECT:display from $target}</STRING>
	</STRING>

	<STRING ID="multiarea" define="multiarea">NO</STRING>
	
	<OBJECT ID="target_area" SELECT="Pick-1" DEFINE="target_area">
		<OBJECT pickweight=55555 condition="$targetarea_name != ''">SELECT: ANY\. FROM areas where NAME=$targetarea_name</OBJECT> 
		<OBJECT pickweight=100 condition="$targetarea_name = '' and $multiarea != 'YES'">SELECT: any\. from $source_area</OBJECT>
		<OBJECT pickweight=1 select="Pick-1" condition="$targetarea_name = '' and $multiarea = 'YES'">
			<OBJECT CONDITION="$number_of_areas_with_container_rooms &gt; 0" PICKWEIGHT=1>
				SELECT: any\. from $target_area_container_guess
			</OBJECT>
			<OBJECT PICKWEIGHT=1>
				SELECT: any\. from $target_areas_guess
			</OBJECT>
		</OBJECT>
	</OBJECT>

	<STRING ID="number_of_areas_with_container_rooms" define="number_of_areas_with_container_rooms">${select: count\. from $target_area_container_guess}</STRING>

	<OBJECT ID="target_area_container_guess" define="target_area_container_guess">
		SELECT: . FROM $target_areas_guess WHERE (SELECT: count\. from $target_container_room_guess) &gt; 0
	</OBJECT>

	<OBJECT ID="target_areas_guess" define="target_areas_guess">
		SELECT: . FROM areas WHERE (SELECT: count\. from area\rooms WHERE exits\count &gt; 0  AND display\count = 1) &gt; 0
	</OBJECT>

	<OBJECT ID="target_container_guess">
		SELECT: . from room\items where . like '-javaclass +gencontainer' and 'itemnotget' in current_sensesstr and capacity &gt; weight
	</OBJECT>
	
	<OBJECT ID="target_container_room_guess">
		SELECT: . from area\rooms where (SELECT: COUNT\. from $target_container_guess) &gt; 0 AND exits\count &gt; 0 AND display\count = 1
	</OBJECT>

	<STRING ID="target_area_name" SELECT="any-1" DEFINE="target_area_name">
		<STRING>${SELECT:name from $target_area}</STRING>
	</STRING>	
	
	<OBJECT ID="target_rooms_with_items" define="target_rooms_with_items">
		SELECT: . FROM $target_area\rooms WHERE (SELECT: COUNT\. from $target_container_guess) &gt; 0 AND exits\count &gt; 0 AND display\count = 1
	</OBJECT>
	<OBJECT ID="target_rooms_without_items" define="target_rooms_without_items">
		SELECT: . FROM $target_area\rooms WHERE exits\count &gt; 0  AND display\count = 1
	</OBJECT>

	<OBJECT ID="target_room" DEFINE="target_room" select="Pick-1">
		<OBJECT CONDITION="${SELECT: COUNT\. FROM $target_rooms_with_items} &gt; 0" PICKWEIGHT=1>SELECT: any\. FROM $target_rooms_with_items</OBJECT>
		<OBJECT PICKWEIGHT=1>SELECT: any\. FROM $target_rooms_without_items</OBJECT>
	</OBJECT>
	
	<STRING ID="target_room_id" DEFINE="target_room_id">${SELECT: roomid from $target_room}</STRING>
	
	<OBJECT ID="target_container_item" DEFINE="target_container_item">
		SELECT: any\. FROM $target_room\items where . like '-javaclass +gencontainer' and 'itemnotget' in current_sensesstr and capacity &gt; weight
	</OBJECT>
	
	<STRING ID="target_container_name" DEFINE="target_container_name" SELECT="First-1">
		<STRING CONDITION="'${SELECT: name from $target_container_item}' != ''">${SELECT: name from $target_container_item}</STRING>
		<STRING></STRING>
	</STRING>
	
	<STRING ID="target_container_quoted_name" DEFINE="target_container_quoted_name" SELECT="First-1">
		<STRING CONDITION="'${SELECT: name from $target_container_item}' != ''">"${SELECT: name from $target_container_item}"</STRING>
		<STRING></STRING>
	</STRING>
	
	<STRING ID="target_item_name" define="target_item_name">${SELECT: NAME from $target_item}</STRING>
	
	<STRING ID="item_level" define="item_level">$target_level</STRING>
	<OBJECT ID="target_item" define="target_item" SELECT="Any-1">
		<OBJECT condition="$itemname=''">SELECT: ANY\. FROM $item_junk</OBJECT>
		<OBJECT condition="$itemname!=''">
			<ITEM class="GenItem" name="$itemname" display="$itemname lies here" material="PAPER" level="$level_range" />
		</OBJECT>
	</OBJECT>

</QUEST>