Find
You are looking at a cash register
Created by
wolis
, last updated 18 Dec 2007
Code
##get:runsub checkworth;
##drop:runsub setowner;
##setowner:
set $target's owner to $init_obj;
say 'msg',"[$target] is now owned by [$init_obj]";
##checkworth:
var $iworth to $init_obj's worth;
var $tworth to $target's worth;
if $iworth > $tworth then sellit else nosale;
##sellit:
var $ownr to $actor's owner; rem if paying cash registers owner;
var $ownr to $target's owner; rem if paying objects owner;
var $oworth to $ownr's worth;
take $tworth from $iworth; rem take from buy;
add $tworth to $oworth; rem give to owner;
set $ownr's worth to $oworth;
set $init_obj's worth to $iworth;
say 'msg',"[$init_obj] buys [$target] making [$ownr] $tworth $coinage richer";
##nosale:
say 'msg',"[$init_obj] can not afford to buy [$target] for $tworth $coninage";
set $target's loc to $actor's loc;