[dialog d_convertgold]
100,100
resizepic 0 0 2600 400 180
text 90 20 100 0
text 80 60 920 1
button 160 120 247 248 1 0 1
textentry 80 80 253 25 1800 0 2
[dialog d_convertgold text]
Gold Ingot Converting to Gold Coins
How much gold ingot you will convert?
[dialog d_convertgold button]
ON=0
src.flags &= ~statf_freeze
ON=1
if !(<src.restest 1 i_ingot_gold>)
SRC.SYSMESSAGE @,3,1 You have not a gold ingot to convert.
src.flags &= ~statf_freeze
return 1
endif
if !<eval <ARGTXT[0]>>>0
src.sysMESSAGE @,3,1 You cannot do this.
src.flags &= ~statf_freeze
return 1
endif
if <eval <ARGTXT[0]>>>100
src.sysMESSAGE @,3,1 You can convert maximum 100 gold ingots.
src.flags &= ~statf_freeze
return 1
endif
if !<src.restest <eval <ARGTXT[0]>> i_ingot_gold>
src.sysMESSAGE @,3,1 You do not have <eval <ARGTXT[0]>> gold ingots.
src.flags &= ~statf_freeze
return 1
endif
var.amount <eval <ARGTXT[0]>>
src.timerf 1 , sound 0237
src.anim 11
src.timerf 2 , anim 11
src.timerf 2 , sound 0237
src.timerf 3 , sound 0237
src.timerf 3 , anim 11
src.timerf 4 , f_compconvert
src.timerf 4 , anim 11
[FUNCTION f_compconvert]
if rand(10)>2
src.newitem i_gold
new.amount (<var.amount> * 500)
new.bounce
src.consume <var.amount> i_ingot_gold
src.sysMESSAGE @,3,1 You success the converting. You have got <eval <new.amount>> gold pieces.
src.flags &= ~statf_freeze
return 1
else
src.consume <var.amount> i_ingot_gold
src.sysMESSAGE @,3,1 You failed the converting. You lost <eval <var.amount>> gold ingots.
src.flags &= ~statf_freeze
if rand(32)=1
src.sysMESSAGE @,3,1 You broke the hammer.
src.consume 1 i_hammer_converting
return 1
endif
endif
[itemdef i_hammer_converting]
ID=i_hammer_smith
NAME=Gold Ingot Converter Hammer
WEIGHT=1
TYPE=t_script
VALUE=3000
ON=@CREATE
COLOR=035
ON=@DCLICK
IF ( <CONT> != <SRC.FINDLAYER.21> )
src.SYSMESSAGE @,3,1 The item must be in your backpack.
RETURN 1
ENDIF
if (<src.blacksmithing><980)
src.sysMESSAGE @,3,1 You are not a good enough blacksmith to use this.
return 1
else
IF (<SRC.ISNEARTYPE t_anvil 1>)
src.flags |= statf_freeze
src.dialog d_convertgold
else
src.sysMESSAGE @,3,1 You must be near an anvil.
return 1
endif