Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
tintin++ ogg sound player script for linux
Author: Robert Smith
Submitted by: Vladaar
6Dragons ogg Soundpack
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.4
Author: Vladaar
Submitted by: Vladaar
LoP 1.46
Author: Remcon
Submitted by: Remcon
LOP 1.45
Author: Remcon
Submitted by: Remcon
Users Online
CommonCrawl, Yandex

Members: 0
Guests: 7
Stats
Files
Topics
Posts
Members
Newest Member
481
3,735
19,368
618
Micheal64X
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Codebases » AFKMud Support & Development » healer snippet
Forum Rules | Mark all | Recent Posts

healer snippet
< Newer Topic :: Older Topic > converted for AFKMud 1.53

Pages:<< prev 1 next >>
Post is unread #1 Jul 15, 2003, 8:49 am   Last edited Nov 24, 2007, 4:22 pm by Samson
Go to the top of the page
Go to the bottom of the page

Moonwolf

GroupMembers
Posts43
JoinedAug 25, 2005

Hi everyone,
This snippet mod might seem painfully obvious, but it's my first attempt, so please be gentle :P I have no idea if there's a better way to code it, I'm not a C programmer, so feedback is appreciated.
                            HEALER
1.  In olc.h find MAX_ACT_FLAG and add this right before it in that array:
ACT_HEALER,
2.  In build.c find the act_flags array and add at the end
, "healer"
3.- Add this file called HEALER.C
/***************************************************************************
* ROM 2.4 is copyright 1993-1998 Russ Taylor   *
* ROM has been brought to you by the ROM consortium   *
*    Russ Taylor (rtaylor@hypercube.org)   *
*    Gabrielle Taylor (gtaylor@hypercube.org)   *
*    Brian Moore (zump@rom.org)   *
* By using this code, you have agreed to follow the terms of the   *
* ROM license, in the file Rom24/doc/rom.license   *
***************************************************************************/
/***************************************************************************
*    Ported to Smaug 1.4 by Desden, el Chaman Tibetano in November 1998    *
*           ( Jose Luis Sogorb ) Email: jose@luisso.net          *
*                                                                          *
***************************************************************************/
#include 
#include 
#include 
#include "mud.h"
/* Added by Moonwolf 7/15/2003 for AFKMud 1.53 */
ch_ret spell_smaug( int sn, int level, CHAR_DATA *ch, void *vo );
ch_ret spell_cure_poison( int sn, int level, CHAR_DATA *ch, void *vo );
ch_ret spell_cure_blindness( int sn, int level, CHAR_DATA *ch, void *vo );
ch_ret spell_remove_curse( int sn, int level, CHAR_DATA *ch, void *vo );
void do_heal(CHAR_DATA *ch, char *argument)
{
   CHAR_DATA *mob;
   char arg[MAX_INPUT_LENGTH];
   int cost,sn;
   SPELL_FUN *spell;
   char *words;
   /* Search for an act_healer */
   for ( mob = ch->in_room->first_person; mob; mob = mob->next_in_room )
   {
       if ( IS_NPC(mob) && xIS_SET(mob->act, ACT_HEALER) )
           break;
   }
   if ( mob == NULL )
   {
       send_to_char( "You can't do that here.\r\n", ch );
       return;
   }
   one_argument(argument,arg);
   if (arg[0] == '\0')
   {
       /* display price list */
act(AT_PLAIN,"$N says 'I offer the following spells:'",ch,NULL,mob,TO_CHAR);
send_to_char("  light: cure light wounds          10 gold\r\n",ch);
send_to_char("  serious: cure serious wounds      15 gold\r\n",ch);
send_to_char("  critical: cure critical wounds    25 gold\r\n",ch);
send_to_char("  heal: healing spell               50 gold\r\n",ch);
send_to_char("  blind: cure blindness             20 gold\r\n",ch);
send_to_char("  poison:  cure poison              25 gold\r\n",ch);
send_to_char("  curse: remove curse               50 gold\r\n",ch);
send_to_char("  refresh: restore movement          5 gold\r\n",ch);
send_to_char("  mana:  restore mana          10 gold\r\n",ch);
send_to_char(" Type heal  to be healed.\r\n",ch);
return;
   }
   if (!str_cmp(arg,"light";))
   {
       spell = spell_smaug;
sn    = skill_lookup("cure light";);
words = "judicandus dies";
cost  = 1000;
   }
   else if (!str_cmp(arg,"serious";))
   {
spell = spell_smaug;
sn    = skill_lookup("cure serious";);
words = "judicandus gzfuajg";
cost  = 1600;
   }
   else if (!str_cmp(arg,"critical";))
   {
spell = spell_smaug;
sn    = skill_lookup("cure critical";);
words = "judicandus qfuhuqar";
cost  = 2500;
   }
   else if (!str_cmp(arg,"heal";))
   {
spell = spell_smaug;
sn = skill_lookup("heal";);
words = "pzar";
cost  = 5000;
   }
   else if (!str_cmp(arg,"blind";))
   {
spell = spell_cure_blindness;
sn    = skill_lookup("cure blindness";);
      words = "judicandus noselacri";
       cost  = 2000;
   }
   else if (!str_cmp(arg,"poison";))
   {
spell = spell_cure_poison;
sn    = skill_lookup("cure poison";);
words = "judicandus sausabru";
cost  = 2500;
   }
   else if (!str_cmp(arg,"curse";))
   {
spell = spell_remove_curse;
sn    = skill_lookup("remove curse";);
words = "candussido judifgz";
cost  = 5000;
   }
     else if (!str_cmp(arg,"mana";))
    {
        spell = NULL;
        sn = -1;
        words = "energizer";
        cost = 1000;
    }
   else if (!str_cmp(arg,"refresh";) )
   {
spell =  spell_smaug;
sn    = skill_lookup("refresh";);
words = "candusima";
cost  = 500;
   }
   else
   {
act(AT_PLAIN,"$N says ' Type 'heal' for a list of spells.'",
   ch,NULL,mob,TO_CHAR);
return;
   }
   if (cost > ch->gold )
   {
act(AT_PLAIN,"$N says 'You do not have enough gold for my services.'",
   ch,NULL,mob,TO_CHAR);
return;
   }
   WAIT_STATE( ch, sysdata.pulseviolence );
   ch->gold -= cost;
act(AT_PLAIN,"$n utters the words '$T'.",mob,NULL,words,TO_ROOM);
   if (spell == NULL)
  {
  ch->mana += dice(2,8) +  ch->level / 3;
ch->mana += UMIN(ch->level,ch->max_mana - ch->mana);
send_to_char("A warm glow passes through you.\r\n",ch);
return;
   }
   if (sn == -1)
return;
    spell(sn,mob->level,mob,ch);
}
/*********   End of code *****************************************/
4.- Add in MAKEFILE:  healer.c in the right section.
5.- Do a 'make clean' and a 'make.
6.- You must add the command in /SYSTEM/COMMANDS.DAT:
#COMMAND
Name        heal~
Code        do_heal
Position    dead~
Level       1
Log         normal~
End
7.  To mset an act_flag to a mob, it must be a prototype, so you must do:
mset  flags prototype
mset  flags healer
mset  flags prototype
foldarea 
/***********************************************************************
*    Ported to Smaug 1.4 by Desden, el Chaman Tibetano (J.L.Sogorb)    *
*       November 1998 - Email: jlalbatros@retemail.es               *
*                                                                      *
***********************************************************************/
       
Post is unread #2 Jul 16, 2003, 9:37 am   Last edited Nov 24, 2007, 4:22 pm by Samson
Go to the top of the page
Go to the bottom of the page

Amalric

GroupMembers
Posts48
JoinedMay 15, 2003

This looks like something I want to add to my "learning experience". I like the concept and your execution looks pretty good from a coding POV.
I do have one question... are the prices in the price list:
/* display price list */
act(AT_PLAIN,"$N says 'I offer the following spells:'",ch,NULL,mob,TO_CHAR);
send_to_char(" light: cure light wounds 10 gold\r\n",ch);
send_to_char(" serious: cure serious wounds 15 gold\r\n",ch);
send_to_char(" critical: cure critical wounds 25 gold\r\n",ch);
send_to_char(" heal: healing spell 50 gold\r\n",ch);
send_to_char(" blind: cure blindness 20 gold\r\n",ch);
send_to_char(" poison: cure poison 25 gold\r\n",ch);
send_to_char(" curse: remove curse 50 gold\r\n",ch);
send_to_char(" refresh: restore movement 5 gold\r\n",ch);
send_to_char(" mana: restore mana 10 gold\r\n",ch);
send_to_char(" Type heal to be healed.\r\n",ch);
return;

diferent from the costs in the code?
spell = spell_smaug;
sn = skill_lookup("cure light";);
words = "judicandus dies";
cost = 1000;
}
else if (!str_cmp(arg,"serious";))
{
spell = spell_smaug;
sn = skill_lookup("cure serious";);
words = "judicandus gzfuajg";
cost = 1600;

The cure serious one is definitely a typo (16 instead of 15). The rest look like thousands while the prices are tens of gold.
This is the only part that is confusing me.
Thanks for posting this snippet!
       
Post is unread #3 Jul 16, 2003, 10:32 am
Go to the top of the page
Go to the bottom of the page

Moonwolf

GroupMembers
Posts43
JoinedAug 25, 2005

I didn't notice those, they were transferred across from the original snippet on Samson's site.

I need to poke at it more, when I tried to hack the original mod, it was just to get it running on my AFK 1.53, I never considered looking at it to see if it was logical

Kathi
       
Pages:<< prev 1 next >>