0001 protect
0002 {
0003 if( !%canSee( @this, @o ) )
0004 {
0005 echoto char @n @I doesn't seem to notice the @O.
0006 break
0007 }
0008 endif
0009
0010 if( !%canSee( @this, @n ) )
0011 {
0012 say Hmmm? Where did this come from?
0013 drop @o
0014 break
0015 }
0016 endif
0017
0018 if( @o->hitpoints >= @o->maxHitpoints ) )
0019 {
0020 talk @n This is already in perfect condition!
0021 give @o @n
0022 drop @o
0023 break
0024 }
0025 endif
0026
0027 @repairCost =
0028 \ @o->sellValue * (@o->maxHitpoints - @o->hitpoints) / @o->maxHitpoints
0029
0030 @repairCost = %asInteger( @repairCost )
0031
0032 if( @n->gold < @repairCost )
0033 {
0034 talk @n You need @repairCost gold pieces to get that fixed.
0035 talk @n Please come back when you have more gold.
0036 give @o @n
0037 drop @o
0038 break
0039 }
0040 endif
0041
0042 @o->hitpoints = @o->maxHitpoints
0043 emote rapidly fiddles with @O, %sexPossess( @this ) hands moving
0044 \ faster than the eye can follow.
0045 say There we go, right as rain!
0046 give @o @n
0047 drop @o
0048
0049 echoto char @n You give @repairCost gold coins to @I.
0050 echoto notc @n gives some gold to @I.
0051
0052 @n->gold = @n->gold - @repairCost
0053 @this->gold = @this->gold + %asInt( @repairCost / 25 )
0054 }
0055 endprotect