Find
You are looking at the blacksmith called Stan
The blacksmith stands ready to repair your weapon.
To see how much it will cost,
talk to stan
You must have enough to fully repair your weapon.
Created by
thorn
, last updated 01 Aug 2015
Code
if reacting to arrives then checkarrclass;
if second of gives then checkgift;
if target of hit then setwho;
if target of talk then converse;
##checkarrclass:
if $init_obj's class ne 'player' then donothing else amialive;
##amialive:
if $actor's health > 0 then checkown;
##checkgift:
$gmsg = "[$actor] is dead.";
if $actor's health > 0 then checkgift1 else giveitback;
##checkgift1:
$gmsg = "[$actor] shrugs at [$init_obj],'That doesn't look like a weapon to me'";
if $target's material like 'living' then giveitback else checkgift2;
##checkgift2:
$health = $target's health;
$hm = $target's healthmax;
$gmsg = "[$actor] shrugs at [$init_obj],'It looks fine to me'";
if $health < $hm then checkinitw else giveitback;
##checkinitw:
$wrth = $init_obj's worth;
$cost = $hm;
take $health from $cost;
multiply $cost by $hm;
$gmsg = "[$actor] shrugs at [$init_obj],'Sorry, but it will cost you $cost pennies for me to repair this. Come back when you have it.'";
if $wrth < $cost then giveitback else fixgift;
##checkown:
if $actor's owner ne $init_obj then nothing else hello;
##hello:
say 'msg',"[$actor] looks at [$init_obj] and says, 'Hello, master.'";
##fixgift:
say 'msg',"[$actor] says,'Thank you, I will get to work right away.'";
set $target's health to $hm;
say 'msg',"[$actor] repairs [$target].";
say 'msg',"[$actor] nods at his work, 'Much better now.'";
take $cost from $wrth;
set $init_obj's worth to $wrth;
say 'msg',"[$init_obj] tosses [$actor] $cost coins.";
$gmsg = "[$actor] says, 'There you go.'";
runsub giveitback;
##giveitback:
say 'msg',"$gmsg";
set $target's loc to $loc;
set $target's pose to '';
say 'msg',"[$actor] drops [$target]";
relook $loc;
##setwho:
set $actor's slot1 to $init_obj;
##tickloc:runsub ticked;
##tickhour2:runsub tickhoured;
##tickhoured:
if $actor's health > 0 then nothing else pretick;
##pretick:
set $actor's counter to 51;
runsub ticked;
##ticked:
if $actor's health > 0 then alive else dead;
##alive:
$weapon is wielded by $actor;
if $weapon > 0 then keepweap else getweap;
$hammer = 55776;
$forge = 50597;
if $hammer's host > 0 then howhammer else rehosthammer;
##howhammer:
if $hammer's hosthow eq 'chained to' then continue else rehosthammer;
##rehosthammer:
update $hammer = "host='$forge',hosthow='chained to'";
say 'msg',"[$actor] bonds a chain to [$hammer] and [$forge]";
relook $loc;
##dead:
if $actor's counter < 1 then justdied;
$cnt = $actor's counter;
add 1 to $cnt;
set $actor's counter to $cnt;
if $actor's counter > 50 then respawn;
##justdied:
$actdead = (slumps to the floor,gasps one last breath then falls,cries out in agony then is silent);
say 'msg',"[$actor] $actdead.";
##respawn:
set $actor's pose to '';
set $actor's health to $actor's healthmax;
set $actor's counter to 0;
say 'msg',"[$actor] returns to life!";
##keepweap:
if $actor's slot2 ne $weapon then keepweap2;
##keepweap2:
set $actor's slot2 to $weapon;
say 'msg',"[$actor] looks at [$weapon] and grins wickedly";
##getweap:
$weapon = $actor's slot2;
if $weapon > 0 then getweap2;
##getweap2:
if $weapon's loc eq $actor's loc then wieldit else whereisit;
##wieldit:
call "wield $weapon";
##whereisit:
say 'msg',"[$actor] looks around the room for [$weapon] but can't see it.";
set $actor's slot2 to '';
##converse:
$weapon is wielded by $init_obj;
if $weapon > 0 then converse1 else smalltalk;
##smalltalk:
$verb = (shoots the breeze,spins a yarn,chitchats,discusses the weather,hangs out,exchanges a few jokes);
say 'msg',"[$init_obj] $verb with [$actor].";
sayto $init_obj,"(You might get farther if you tried wielding something first.)";
##converse1:
say 'msg',"[$init_obj] inquires about [$weapon].";
$wh = $weapon's health;
$whm = $weapon's healthmax;
$cost = $whm;
take $wh from $cost;
multiply $cost by $whm;
if $whm > $wh then deal else nodeal;
##deal:
say 'msg',"[$actor] looks over [$weapon] and says, 'You've made a bloody mess with it, but I can repair it and shine it up for you for just $cost pennies. Just give it to me and I'll get right to work on it.'";
##nodeal:
say 'msg',"[$actor] whistles at [$weapon], 'A mighty fine piece of work that is. No repairs needed.'"