//===================
// CSD UO Reward system
//===================

// 25.09.2001, MoNK: t_key
// 15.08.2001, MoNK: t_bed
// 27.07.2001, MoNK: t_table
// 22.07.2001, MoNK: statf_saveparity, reward coins is not a money more
// 18.07.2001, MoNK: auto trash items in backpack
// 15.07.2001, MoNK: amount of items define the cost, tag.counter
// 14.07.2001, MoNK: file created

[ITEMDEF i_reward_coin]
NAME=reward coin%s
ID=i_coin_silver
TYPE=t_normal
WEIGHT=0

On=@Create
	attr = attr_newbie

On=@Click
	type = t_normal

[ITEMDEF i_reward_chest]
NAME=Reward chest
ID=i_chest_metal
WEIGHT=10

On=@Create
	attr = attr_move_never | attr_decay
	color = color_o_gold
	type = t_normal
	timer = 60

On=@Click
	attr = attr_move_never | attr_decay
	timer = 10

On=@DClick
	attr = attr_move_never | attr_decay
	timer = 10
	dialog d_x_reward_system
	return 1

[SPEECH spk_scavenger]
On=counter
	if <tag.counter>
		say I get <eval(<tag.counter>)> items, <src.sex Milord/Milady> <src.name>
	elseif <src.isgm>
		say I don't have tag.counger.
	endif

On=reward
On=reward*
	if <src.restest 1 i_reward_coin>
		say Choose the prize for you, <src.sex Milord/Milady> <src.name>!
		src.newitem i_reward_chest
		src.act.link = <serial>
		src.act.more = <src.serial>
		src.act.timer = -1
		src.act.p = <src.p>
		src.act.update
	else
		say Sorry, <src.sex Milord/Milady> <src.name>, but thou must give me something to get some reward coins, then ask me for reward.
	endif
	return 1

On=*job*
On=*work*
On=*what*do*do*
On=*profession*
On=*occupation*
On=*scavenger*
	dorand 2
		say I'm a scavenger, <src.sex Milord/Milady> <src.name>
		say I collect any useless stuff that you can give me. Do you have some?
	enddo

[EVENTS e_scavenger]
On=@NPCSeeNewPlayer
	face
	dorand 3
		begin
			say Looking up and looking down, All that useless stuff i'm buying!
			say If you got it - bring it here, We will give you price that fair!
		end
		say Hey, hey, hey! Let save the world today!
		say Never trash the garbage pile, bring it t'me, take price that fair!
	enddo
	timer = 10
	if <findlayer(layer_pack)>
		if <findlayer(layer_pack).findcont(1)>
			if <tag.counter>
				tag.counter = <tag.counter> + <findlayer(layer_pack).findcont(1).amount>
			else
				tag.counter = <findlayer(layer_pack).findcont(1).amount>
			endif
			findlayer(layer_pack).findcont(1).remove
		endif
	endif

On=@NPCAcceptItem
	face
	if !<tag.counter>
		tag.counter = 0
	endif
	src.newitem i_reward_coin
	src.act.amount = <eval(<eval(<argo.value>)> / 10)>
	if <src.act.amount> == 0
		src.act.amount = 1
	endif
	if <src.act.amount> > 10
		src.act.amount = 10
	endif
	src.act.amount = (<src.act.amount> * <argo.amount>)

	if <argo.amount> > 1
		say I take your <argo.amount> <argo.name> and give you <src.act.amount> reward coins.
	else
		dorand 3
			say Take this reward coins for you help in cleaning the world.
			say Thank thee for cleaning the world, <src.name>.
			say I take this <argo.name> and give you <src.act.amount> reward coins.
		enddo
	endif

	tag.counter = <tag.counter> + <argo.amount>
	src.consume <argo.amount> <argo.baseid>

	src.act.bounce
	timer = 10
	return 1

On=@NPCRefuseItem
	face
	if <argo.type> == t_gold
		say Not, not and one more time not! I don't need your gold, <src.sex Milord/Milady> <src.name>! Thank thee.
	elseif (<argo.type> == t_food) || (<argo.type> == t_food_raw) || (<argo.type> == t_fish)
		say You must think of the less advantage and starving! I don't take food.
	elseif <argo.type> == t_deed
		say Whoops... Do you realy want to give me <argo.name>? I don't think so.
	elseif (<argo.type> == t_log) || (<argo.baseid> == t_board) || (<argo.baseid> == i_nails)
		say Give this <argo.name> to carpenter, old chap! He will make good furniture for your house.
	elseif <argo.type> == t_ore
		say Oh, no. Thank you. I am not a miner, I am scavenger.
	elseif <argo.type> == t_ingot
		say I don't need your metal, <src.name>.
	elseif <argo.type> == t_reagent
		say Nice <argo.name>, <src.name>. But I don't know what to do with THIS.
	elseif (<argo.type> == t_container) || (<argo.type> == t_container_locked)
		say I can't get this <argo.name> from you, <src.name>. Try to sell it.
	elseif (<argo.type> == t_leather) || (<argo.type> == t_hide)
		say No, I don't need your leather, <src.name>.
	else
		say I don't need <argo.name>.
	endif
	timer = 10

[CHARDEF c_h_scavenger]
NAME=#NAMES_HUMANMALE, the Scavenger
ID=c_man

TSPEECH=spk_scavenger
TSPEECH=spk_human_prime
TSPEECH=spk_needs
TSPEECH=spk_rehello
TSPEECH=spk_human_default

TEVENTS=e_Human_HearUnk
TEVENTS=e_Human_Needs
TEVENTS=e_Human_ConvInit
TEVENTS=e_Human_Greet
TEVENTS=e_Human_Space
TEVENTS=e_Human_Refuse
TEVENTS=e_Human_Environ
TEVENTS=e_scavenger

AVERSIONS=t_trap,t_eerie_stuff
DESIRES=i_nails, i_lantern, t_ttm, t_l1map, t_l2map, t_l3map, t_l4map, t_l5map, t_armor, t_weapon_mace_smith, t_weapon_mace_sharp, t_weapon_sword, t_weapon_fence, t_weapon_bow, t_wand, t_book, t_rune, t_booze, t_potion, t_clock, t_musical, t_water, t_clothing, t_scroll, t_carpentry, t_forge, t_rock, t_carpentry_chop, t_crops, t_drink, t_anvil, t_map, t_weapon_mace_staff, t_comm_crystal, t_game_board, t_armor_leather, t_seed, t_crystal_ball, t_reagent_raw, t_arock, t_weapon_mace_crook, t_weapon_mace_pick, t_spellbook, t_loom, t_bee_hive, t_archery_butte, t_campfire, t_map_blank, t_sextant, t_fruit, t_water_wash, t_weapon_axe, t_weapon_xbow, t_keyring, t_fur, t_foliage, t_scissors, t_spinwheel, t_bandage_blood	, t_fish_pole, t_lockpick, t_train_dummy, t_train_pickpocket, t_bedroll, t_bellows, t_pitcher, t_pitcher_empty, t_dye_vat, t_dye, t_potion_empty, t_mortar, t_hair_dye, t_sewing_kit, t_tinker_tools, t_bone, t_shield, t_jewelry

//t_key
//t_bed
//t_table - counter
//t_chair - woodworker bench
//t_craft_fence, t_craft_door
//t_light_lit		6 // Local Light giving object
//t_light_out		7 // Can be lit.
//t_dirt			182 // a patch of dirt where i can plant something
//t_fire			23 // It will burn you.
//t_normal		0
//t_container		1 // any unlocked container or corpse. CContainer based
//t_container_locked	2
//t_door			3 // 3 = door can be opened
//t_door_locked		4 // a locked door.
//t_telepad		17 // walk on teleport
//t_switch		18 // this is a switch which effects some other object in the world.
//t_trap			25 // walk on trap.
//t_trap_active		26 // = some animation
//t_spell			28 // = magic spell effect.
//t_gem			29 // = no use yet
//t_spawn_char		34 // = spawn object. should be invis also.
//t_game_piece		35 // = can't be removed from game.
//t_portculis		36 // = Z delta moving gate (open)
//t_figurine		37 // = magic figure that turns into a creature when activated.
//t_shrine		38 // = can res you
//t_moongate		39 // = linked to other moon gates (hard coded locations)
//t_tree			44 // = can be chopped
//t_multi			47 // = multi part object like house or ship.
//t_ship			49 // = this is a SHIP MULTI
//t_ship_plank		50 //
//t_ship_side		51 // = Should extend to make a plank
//t_ship_side_locked	52 //
//t_ship_tiller		53 // = Tiller man on the ship
//t_eq_trade_window	54 // = container for the trade window
//t_sign_gump		56 // = Things like grave stones and sign plaques
//t_stone_guild		57 // = Guild stones
//t_anim_active		58 // = active anium that will recycle when done
//t_advance_gate		59 // = advance gate (m_AdvanceGateType = CREID_TYPE)
//t_cloth			60 // = bolt or folded cloth
//t_hair			61 //
//t_beard			62 // = just for grouping purposes
//t_coin			64 // = coin of some sort (gold or otherwise)
//t_port_locked		68 // = this portcullis must be triggered
//t_spawn_item		69 // = spawn other items
//t_telescope		70 // = big telescope pic
//t_gold			72 // = gold coin
//t_eq_memory_obj	74 // = A Char has a memory link to some object (I am fighting with someone. This records the fight)
//t_eq_horse		76 // = equipped horse object represents a riding horse to the client
//t_junk			85 // = never used
////t_old_cashiers_check	87 // = represents large amounts of money
//t_message		88 // = user written message item (for bboard ussually)
//t_eq_client_linger	90 // = Change player to NPC for a while
//t_dream_gate		91 // = Push you to another server (no items transfered client insta logged out)
//t_it_stone		92 // = Double click for items
//t_metronome		93 // = ticks once every n secs
//t_explosion		94 // = async explosion
//t_eq_npc_script		95 // = Script npc actions in the form of a book (Get rid of this in favor of waiting on m_Events)
//t_web			96 // = walk on this and transform into some other object
//t_grass			97 // = can be eaten by grazing animals
//t_tracker		99 // = points to a linked object
//t_sound		100 // = this is a sound source
//t_stone_town		101 // = Town stones. Everyone free to join
//t_ship_other		105 // = some other part of a ship
//t_bboard		106 // = a container and bboard object
//t_corpse		108 // = special type of item
//t_track_item		109 // = track a id or type of item
//t_track_char		110 // = track a char or range of char id's
//t_eq_vendor_box		113 // = an equipped vendor
//t_eq_bank_box		114 // = an equipped bank box
//t_eq_murder_count	119 // = my murder count flag
//t_eq_stuck		120 // we are stuck in a web
//t_trap_inactive		121 //	= a safe trap
//t_stone_room		122 //	= house type stone (for mapped house regions)
//t_scroll_blank		128
//t_spellicon		133
//t_door_open		134
//t_meat_raw		135 // Just a meaty part of a corpse (uncooked meat)
//t_floor			139
//t_roof			140
//t_feather		141 // a birds feather
//t_wool			142 // Wool cut frm a sheep
//t_blood			144 // blood of some creature
//t_thread		148
//t_yarn			149
//t_kindling		155
//t_hide			160 // made into leather
//t_cloth_bolt		161
//t_wall			172 // wall of a structure
//t_window		173 // window for a structure
//t_cotton		174 // Cotton from the plant
//t_eq_script		176 // Pure scriptable item equipped
//t_ship_hold		177 // ships hold
//t_ship_hold_lock		178
//t_lava			179
//t_script			183

On=@Create
	COLOR=colors_skin
	STR={521 535}
	DEX={126 140}
	INT={126 140}

	flags = statf_saveparity

	BRAIN=brain_human
	NEED=i_gold

	ITEM i_pants_short
	color = colors_all
	ITEM i_tunic
	color = colors_all
	ITEM i_apron_half
	color = colors_all
	ITEM i_boots_calf
	ITEM i_cap
	color = colors_all

	ITEM=loot_cityman

CATEGORY=Civilized
SUBSECTION=Other
DESCRIPTION=Scavenger

[FUNCTION f_reward1000]
	if <src.restest 1000 i_reward_coin>
		src.consume 1000 i_reward_coin
		src.newitem <eval(<argn>)>
		src.act.timer = -1
		src.act.bounce
		link.say That is one thousand of reward coins worth of <src.act.name>.
	else
		link.say You lack one thousand of reward coins to pay.
	endif
	return 1

[FUNCTION f_reward2000]
	if <src.restest 2000 i_reward_coin>
		src.consume 2000 i_reward_coin
		src.newitem <eval(<argn>)>
		src.act.timer = -1
		src.act.bounce
		link.say That is two thousand of reward coins worth of <src.act.name>.
	else
		link.say You lack two thousand of reward coins to pay.
	endif
	return 1

[FUNCTION f_reward5000]
	if <src.restest 5000 i_reward_coin>
		src.consume 5000 i_reward_coin
		src.newitem <eval(<argn>)>
		src.act.timer = -1
		src.act.bounce
		link.say That is five thousand of reward coins worth of <src.act.name>.
	else
		link.say You lack five thousand of reward coins to pay.
	endif
	return 1

[FUNCTION f_reward10000]
	if <src.restest 10000 i_reward_coin>
		src.consume 10000 i_reward_coin
		src.newitem <eval(<argn>)>
		src.act.timer = -1
		src.act.bounce
		link.say That is ten thousand of reward coins worth of <src.act.name>.
	else
		link.say You lack ten thousand of reward coins to pay.
	endif
	return 1

[DIALOG d_x_reward_system]
0, 0
resizepic 100 1 2600 370 400
gumppic  0 0 1000

tilepic 110 125 2885	// large vase
button 110 125 1209 1210 1 1 101
tilepic 110 155 2886	// small vase
button 110 155 1209 1210 1 1 102
tilepic 150 125 4551	// large flower pot
button 150 125 1209 1210 1 1 103
tilepic 150 155 4550	// small flower pot
button 150 155 1209 1210 1 1 104
tilepic 280 125 4566	// bamboo table
button 280 125 1209 1210 1 1 105
tilepic 320 125 4575	// log table
button 320 125 1209 1210 1 1 106
tilepic 360 125 4609	// dark stone table
button 360 125 1209 1210 1 1 107
tilepic 400 125 4633	// dark stone chair
button 400 125 1209 1210 1 1 108
tilepic 440 125 7611	// sandstone table
button 440 125 1209 1210 1 1 109
tilepic 480 125 7617	// marble table
button 480 125 1209 1210 1 1 110

tilepic 100 200 4553
button 100 200 1209 1210 1 1 201
tilepic 140 200 4554
button 140 200 1209 1210 1 1 202
tilepic 180 200 4552
button 180 200 1209 1210 1 1 203
tilepic 220 200 7695
button 220 200 1209 1210 1 1 204
tilepic 260 200 4556
button 260 200 1209 1210 1 1 205
tilepic 260 250 4555
button 260 250 1209 1210 1 1 206
tilepic 220 250 7696
button 220 250 1209 1210 1 1 207
tilepic 300 200 7698
button 300 200 1209 1210 1 1 208
tilepic 300 235 7699
button 300 235 1209 1210 1 1 209
tilepic 340 200 7700
button 340 200 1209 1210 1 1 210
tilepic 520 200 7697
button 520 200 1209 1210 1 1 211

tilepic 380 200 5018	// figurine
button 380 200 1209 1210 1 1 212
tilepic 410 200 5019
button 410 200 1209 1210 1 1 213
tilepic 440 200 5020
button 440 200 1209 1210 1 1 214
tilepic 470 200 5021
button 470 200 1209 1210 1 1 215

tilepic 85 295 6570		// large brazier
button 90 300 1209 1210 1 1 501
tilepic 130 297 3633	// medium brazier
button 120 300 1209 1210 1 1 502
tilepic 120 350 7979	// small brazier
button 120 350 1209 1210 1 1 503
tilepic 170 295 7732
button 170 300 1209 1210 1 1 504

tilepic 315 295 5384	// decorative armor
button 300 300 1209 1210 1 1 1001
tilepic 355 295 5402
button 340 300 1209 1210 1 1 1002
tilepic 380 295 5404	// decorative armor
button 420 300 1209 1210 1 1 1003
tilepic 420 295 5394
button 460 300 1209 1210 1 1 1004

text 110 100 48 1
text 100 180 95 2
text 90 280 1153 3
text 300 280 1152 4

[DIALOG d_x_reward_system TEXT]
Reward Chest of <link.name>
For one thousand of reward coins you can get:
For two thousand of reward coins you can get:
For 5000 you can get:
For 10000 you can get:

[DIALOG d_x_reward_system BUTTON]
ONBUTTON=0
	src.sysmessage Reward Chest closed
	//src.sfx 555

// one thousand
ONBUTTON=101
	f_reward1000 2885
ONBUTTON=102
	f_reward1000 2886
ONBUTTON=103
	f_reward1000 4551
ONBUTTON=104
	f_reward1000 4550
ONBUTTON=105
	f_reward1000 4566
ONBUTTON=106
	f_reward1000 4575
ONBUTTON=107
	f_reward1000 4609
ONBUTTON=108
	f_reward1000 4633
ONBUTTON=109
	f_reward1000 7611
ONBUTTON=110
	f_reward1000 7617

// two thousand
ONBUTTON=201
	f_reward2000 4553
ONBUTTON=202
	f_reward2000 4554
ONBUTTON=203
	f_reward2000 4552
ONBUTTON=204
	f_reward2000 7695
ONBUTTON=205
	f_reward2000 4556
ONBUTTON=206
	f_reward2000 4555
ONBUTTON=207
	f_reward2000 7696
ONBUTTON=208
	f_reward2000 7698
ONBUTTON=209
	f_reward2000 7699
ONBUTTON=210
	f_reward2000 7700
ONBUTTON=211
	f_reward2000 7697
ONBUTTON=212
	f_reward2000 5018
ONBUTTON=213
	f_reward2000 5019
ONBUTTON=214
	f_reward2000 5020
ONBUTTON=215
	f_reward2000 5021

// five thousand
ONBUTTON=501
	f_reward5000 6570
	src.act.type = t_normal
ONBUTTON=502
	f_reward5000 3633
	src.act.type = t_normal
ONBUTTON=503
	f_reward5000 7979
	src.act.type = t_normal
ONBUTTON=504
	f_reward5000 7732

// ten thousand
ONBUTTON=1001
	f_reward10000 5384
ONBUTTON=1002
	f_reward10000 5402
ONBUTTON=1003
	f_reward10000 5404
ONBUTTON=1004
	f_reward10000 5394

[EOF]