// ######################################################################################################################
// # #
// # Stable Script SYSTEM BY Admin Phoenix aka Levanthis #
// # #
// # You have to redesign the Gump Pics for yourself #
// # #
// # Features: #
// # Store your pet #
// # Storing max Pets Numbers depends from your taming Skill #
// # Sell your pet #
// # Buy Pets #
// ######################################################################################################################
[DEFNAME stabler_defname]
stabler_budget 2500
stabler_time 12*60*60
[DIALOG d_stallmenue]
0,0
page 0
ref2=<src.uid>
FORCONT <FINDLAYER.29.uid> 1
IF (<link.uid> == <ref2.uid>)
local.a +=1
local.name_<dlocal.a>=<name>
local.icon_<dlocal.a>=<id>
local.color_<dlocal.a>=<color>
ENDIF
ENDFOR
local.max=<eval <src.taming>/100>
local.max -= <local.a>
IF (<dlocal.max> == 0)
local.max=1
ELSEIF (<dlocal.max> < 0)
local.max=0
ENDIF
gumppic 0 0 <hval 08b>
button 520 430 <hval 0f2> <hval 0f1> 1 0 0 // cancel
button 520 405 <hval 0f7> <hval 0f8> 1 0 1 // ok
button 260 106 <hval 037> <hval 037> 1 0 3 // sell
IF (<dlocal.max> > 0)
button 260 139 <hval 037> <hval 037> 1 0 2 // store pet
ELSE
dhtmlgump 260 139 320 60 0 0 <def.BFONT_SIZE7> <def.Bfont_DRED>N/A
ENDIF
dhtmlgump 468 195 320 60 0 0 <def.BFONT_SIZE7> <def.Bfont_DRED> <name>, <def.br>the Stabler //name
dhtmlgump 495 312 320 20 0 0 <def.BFONT_SIZE7> <def.Bfont_DRED> <dlocal.a> // stored pet
dhtmlgump 495 382 320 20 0 0 <def.BFONT_SIZE7> <def.Bfont_DRED> <dlocal.max> // max stored
button 260 172 <hval 037> <hval 037> 0 3 0 // buy
page 1
IF (<dlocal.a> > 0)
FOR b 1 <dlocal.a>
IF (<dlocal.b> < 6)
local.y = <eval <local.b>*40>
checkbox 80 <eval <local.y>+190> <hval 02600> <hval 02601> 0 <dlocal.b>
tilepichue 150 <eval <local.y>+196> <local.icon_<dlocal.b>> <dlocal.color_<dlocal.b>>
dhtmlgump 230 <eval <local.y>+195> 120 20 0 0 <def.BFONT_SIZE7> <def.Bfont_DRED><local.name_<dlocal.b>>
ENDIF
ENDFOR
ENDIF
IF (<dlocal.a> > 5)
button 423 395 <hval 08c> <hval 08d> 0 2 0 // page up
ENDIF
page 2
IF (<dlocal.a> > 5)
FOR b 1 <dlocal.a>
IF (<dlocal.b> > 5)
local.y = <eval (<local.b>-5)*55>
checkbox 80 <eval <local.y>+175> <hval 02600> <hval 02601> 0 <dlocal.b>
tilepichue 150 <eval <local.y>+180> <local.icon_<dlocal.b>> <dlocal.color_<dlocal.b>>
dhtmlgump 230 <eval <local.y>+180> 120 20 0 0 <def.BFONT_SIZE7> <def.Bfont_DRED><local.name_<dlocal.b>>
ENDIF
ENDFOR
ENDIF
button 423 395 <hval 08e> <hval 08f> 0 1 0 // page down
page 3
dhtmlgump 75 205 40 20 0 0 <def.BFONT_SIZE7> <def.Bfont_DRED>GP
dhtmlgump 75 240 120 20 0 0 <def.BFONT_SIZE7> <def.Bfont_DRED>75
tilepic 150 230 <serv.chardef.c_rabbit.ICON>
dhtmlgump 230 240 120 20 0 0 <def.BFONT_SIZE7> <def.Bfont_DRED>Rabbit
button 360 240 <hval 037> <hval 037> 1 0 4 // buy
dhtmlgump 75 270 120 20 0 0 <def.BFONT_SIZE7> <def.Bfont_DRED>100
tilepic 150 270 <serv.chardef.c_cat.ICON>
dhtmlgump 230 270 120 20 0 0 <def.BFONT_SIZE7> <def.Bfont_DRED>Cat
button 360 270 <hval 037> <hval 037> 1 0 5 // buy
dhtmlgump 75 300 120 20 0 0 <def.BFONT_SIZE7> <def.Bfont_DRED>150
tilepic 150 300 <serv.chardef.c_dog.ICON>
dhtmlgump 230 300 120 20 0 0 <def.BFONT_SIZE7> <def.Bfont_DRED>Dog
button 360 300 <hval 037> <hval 037> 1 0 6 // buy
dhtmlgump 75 330 120 20 0 0 <def.BFONT_SIZE7> <def.Bfont_DRED>175
tilepic 150 327 <serv.chardef.c_eagle.ICON>
dhtmlgump 230 330 120 20 0 0 <def.BFONT_SIZE7> <def.Bfont_DRED>Eagle
button 360 330 <hval 037> <hval 037> 1 0 7 // buy
dhtmlgump 75 360 120 20 0 0 <def.BFONT_SIZE7> <def.Bfont_DRED>200
tilepic 150 345 <serv.chardef.c_llama_pack.ICON>
dhtmlgump 230 360 120 20 0 0 <def.BFONT_SIZE7> <def.Bfont_DRED>Pack Lama
button 360 360 <hval 037> <hval 037> 1 0 8 // buy
dhtmlgump 75 390 120 20 0 0 <def.BFONT_SIZE7> <def.Bfont_DRED>230
tilepic 150 380 <serv.chardef.c_horse_pack.ICON>
dhtmlgump 230 390 120 20 0 0 <def.BFONT_SIZE7> <def.Bfont_DRED>Pack Horse
button 360 390 <hval 037> <hval 037> 1 0 9 // buy
[DIALOG d_stallmenue button]
ON=0
smsg @<def0.def_smsg_norm>,3 Canceled the action.
ON=1
ref2=<src.uid>
FORCONT <FINDLAYER.29.uid> 1
IF (<link.uid> == <ref2.uid>)
local.a +=1
local.uid_<dlocal.a>=<uid>
ENDIF
ENDFOR
FOR x 1 <dlocal.a>
IF (<argchk[<dlocal.x>]> == 1)
uid.<local.uid_<dlocal.x>>.useitem
ENDIF
ENDFOR
ON=2
ref2=<src.uid>
FORCONT <FINDLAYER.29.uid> 1
IF (<link.uid> == <ref2.uid>)
local.a +=1
ENDIF
ENDFOR
local.max=<eval <src.taming>/100>
IF (<dlocal.max> < 2)
local.max=2
ENDIF
local.max -= <local.a>
IF (<dlocal.max> < 1)
src.smsg @<def0.def_smsg_norm>,3 You can not put any more pet here!
ELSE
if !<findlayer.layer_bankbox.uid>
serv.newitem i_bankbox
new.cont = <uid>
new.layer = 29
endif
src.targetf f_stable_npc <findlayer.layer_bankbox.uid>
src.smsg @<def0.def_smsg_norm>,3 Choose the pet you want to store there.
ENDIF
RETURN 1
ON=3
src.smsg @<def0.def_smsg_norm>,3 Which pet you want to sell?
src.targetf f_sell_animal <uid>
ON=4 10
IF (<argn1> == 4)
src.f_stabler_buy 75,i_pet_RABBIT_2,c_rabbit
ELSEIF (<argn1> == 5)
src.f_stabler_buy 100,i_pet_CAT,c_cat
ELSEIF (<argn1> == 6)
src.f_stabler_buy 150,i_pet_DOG,c_dog
ELSEIF (<argn1> == 7)
src.f_stabler_buy 175,i_pet_EAGLE,c_eagle
ELSEIF (<argn1> == 8)
src.f_stabler_buy 200,i_pet_llama_pack,c_llama
ELSEIF (<argn1> == 9)
src.f_stabler_buy 230,i_pet_horse_pack,c_horse_pack
ENDIF
[FUNCTION f_stabler_buy]
local.gold=<dargv[0]>
local.pet=<argv[1]>
local.pet_name=<argv[2]>
IF (<restest <dlocal.gold> i_gold>)
serv.newitem=<local.pet>
new.bounce
consume=<dlocal.gold> i_gold
ELSE
smsg @<def0.def_smsg_norm>,3 <serv.chardef.<local.pet_name>.name> is to expensive for you.
ENDIF
[FUNCTION f_sell_animal]
ref1=<argo.uid>
ref2=<args>
IF (<ref1.isplayer>)
smsg @<def0.def_smsg_norm>,3 You can not sell players!
ELSEIF !(<ref1.ischar>)
smsg @<def0.def_smsg_norm>,3 You can not sell items!
ELSEIF (<ref1.uid> == <uid>)
smsg @<def0.def_smsg_norm>,3 You can not sell yourself!
ELSEIF !(<ref1.ismypet>)
smsg @<def0.def_smsg_norm>,3 That is not a pet!
ELSEIF (<ref1.flags>&statf_conjured)
smsg @<def0.def_smsg_norm>,3 You can not sell summoned pets!
ELSE
local.money=<eval <ref1.taming>/10>
newgold=<dlocal.money>
smsg @<def0.def_smsg_norm>,3 You sell your pet for <dlocal.money> gold.
ref1.remove
ENDIF
RETURN 1
// Stable function
[function f_stable_npc]
ref1=<argo.uid> // pet to store
ref2=<uid> // spieler
IF (<ref1> == <ref2>)
ref1.smsg @<def0.def_smsg_norm>,3 You can not sell yourself!
return 1
ENDIF
IF (<ref1.memoryfindtype.memory_ipet.link> == <ref2.uid>)
ref1.shrink
FORITEMS 10
IF (<type> == t_figurine)
IF <more2> == <ref1>
ref77 = <uid>
ENDIF
ENDIF
ENDFOR
ref77.tag0.control.slots=<local.slot>
ref77.link=<ref2.uid>
ref77.removefromview
ref77.tag0.master = <ref2.uid>
ref77.cont = <args>
ref2.sysmessage You store your pet.
ENDIF
[EOF]