//Basic stuff, the loot part is handled on e_player.scp

[DEFNAME insure_settings]
INSURANCE_PRICE 600

[FUNCTION INSURE]
TARGETF TARGET_INSURE
SYSMESSAGELOC -1,1060868

[FUNCTION TARGET_INSURE]
IF !(<ARGN>)
REF1=<ARGO.UID>
ELSE
REF1=<ARGN>
ENDIF
IF ((<REF1.TOPOBJ>!=<UID>) || (<REF1.UID> == <UID>))
sysmessageloc 04ec,1060871
ELIF (<REF1.ATTR>&ATTR_NEWBIE)
sysmessageloc 04ec,1060870
ELIF (<REF1.BASEID> == i_power_scroll) || (<REF1.BASEID> == i_stat_power_scroll) || (<REF1.TAG0.UNIQUEITEM>) || (<REF1.ATTR>&ATTR_CURSED)
sysmessageloc 04ec,1060869
ELIF (<SRC.GOLD> < <DEF.INSURANCE_PRICE>)
sysmessageloc 023,1061079
ELIF (<REF1.ISEVENT.T_ITEM_INSURED>)
sysmessageloc 036,1060874
addgold <DEF.INSURANCE_PRICE> <FINDLAYER.layer_bankbox>
sysmessageloc -1,1060397,<dDEF.INSURANCE_PRICE>
REF1.EVENTS -T_ITEM_INSURED
REF1.UPDATE 1
ELSE
REF1.EVENTS +T_ITEM_INSURED
GOLD -= <DEF.INSURANCE_PRICE>
sysmessageloc 04ec,1060873
sysmessageloc -1,1060398,<dDEF.INSURANCE_PRICE>
REF1.UPDATE 1
IF (!(<FLAGS>&STATF_DEAD))
UPDATE
ENDIF
ENDIF
IF (!<ARGN>)
INSURE
ENDIF

[TYPEDEF T_ITEM_INSURED]
ON=@ClientToolTip
SRC.ADDCLILOC 1061682

[EOF]