[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  SMAUG
. -> [Folder]  Running the server
. . -> [Subject]  Smaugfuss 1.9 do_practice Bug??

Smaugfuss 1.9 do_practice Bug??

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page


Posted by Robert Powell   Australia  (367 posts)  [Biography] bio
Date Tue 24 Jun 2014 06:58 AM (UTC)
Message
There seems to be an issue with do_practice in smaugfuss 1.9. I am not sure what is happening here, but you can see from the output that something is amiss.

Immortal Char at a practice mob


                                  (none)
 -----------------------------------[Skills]-----------------------------------
  aggressive style [100%]             climb [100%]              cook [100%]
   defensive style [100%]               dig [100%]   enhanced damage [100%]
     evasive style [100%]              kick [100%]             mount [100%]
             parry [100%]            rescue [100%]            search [100%]
     second attack [100%]    standard style [100%]
 -----------------------------------[Weapons]-----------------------------------
         bludgeons [100%]     flexible arms [100%]       long blades [100%]
          pugilism [100%]      short blades [100%]     talonous arms [100%]
 -----------------------------------[Tongues]-----------------------------------
            common [100%]           dwarven [100%]            elvish [100%]
              gith [100%]            goblin [100%]          halfling [100%]
              ogre [100%]            orcish [100%]             pixie [100%]
          trollese [100%]
You have 8 practice sessions left.
 -------------------------------------------------------------------------------
  Skill and Spell List                                                          
 -----------------------------------[Spells]------------------------------------


Immortal char not at a pract mob, truncated for the line limit in the forums


m 109mv 2400/370741350xp>          reserved [  0%]     acetum primus [100%]        acid blast [100%]
       acid breath [100%]          acidmist [100%]          acidshot [100%]
         alertness [100%]      animate dead [100%]   antimagic shell [100%]
       aqua breath [100%]             armor [100%]       astral walk [100%]
     
        
   unravel defense [100%]            uplift [100%]          valiance [100%]
       venomshield [100%]         venomshot [100%]     ventriloquate [100%]
            weaken [100%]       winter mist [100%]    word of recall [100%]
  Wrath of Dominus [100%]
(C)ontinue, (N)on-stop, (R)efresh, (B)ack, (Q)uit: [C]  -----------------------------------[Skills]-----------------------------------
  aggressive style [100%]               aid [100%]          backstab [100%]
              bash [100%]           berserk [100%]     berserk style [100%]
              bite [100%]             blitz [100%]          bloodlet [100%]
  
             swipe [100%]              tail [100%]              tend [100%]
      third attack [100%]             track [100%]            trance [100%]
            tumble [100%]          uppercut [100%]             vault [100%]
     vomica pravus [100%]
(C)ontinue, (N)on-stop, (R)efresh, (B)ack, (Q)uit: [C]  -----------------------------------[Weapons]-----------------------------------
         bludgeons [100%]     flexible arms [100%]       long blades [100%]
   missile weapons [100%]          pugilism [100%]      short blades [100%]
     talonous arms [100%]
 -----------------------------------[Tongues]-----------------------------------
            common [100%]           dwarven [100%]            elvish [100%]
              gith [100%]            goblin [100%]          halfling [100%]
              ogre [100%]            orcish [100%]             pixie [100%]
          trollese [100%]
You have 8 practice sessions left.
 -------------------------------------------------------------------------------
  Skill and Spell List                                                      
 -----------------------------------[Spells]------------------------------------


When a player character tries to practice at a practice mob, it displays a number of skills that the character does not have access to and are 20+ levels higher than the character.


This is the stock code, it is over my head what is happening, but the none should be at the bottom and the Skill and Spell list at the top.

Any help would be great, I tried to register on SmaugMuds but their website is broken and I cannot get authenticated.

Just a guy having a bit of fun. Nothing more, nothing less, I do not need I WIN to feel validated.
[Go to top] top

Posted by Robert Powell   Australia  (367 posts)  [Biography] bio
Date Reply #1 on Tue 24 Jun 2014 06:59 AM (UTC)
Message

void do_practice( CHAR_DATA* ch, const char* argument)
{
   CHAR_DATA *mob;
   char buf[MAX_STRING_LENGTH];
   int sn;

   if( IS_NPC( ch ) )
      return;

   for( mob = ch->in_room->first_person; mob; mob = mob->next_in_room )
      if( IS_NPC( mob ) && xIS_SET( mob->act, ACT_PRACTICE ) )
         break;

   if( argument[0] == '' )
   {
      int col;
      short lasttype, cnt;
      bool is_ok;

      col = cnt = 0;
      lasttype = SKILL_SPELL;
      set_pager_color( AT_MAGIC, ch );

      for( sn = 0; sn < num_skills; ++sn )
      {
         const SKILLTYPE *skill;
         int normalSn;

         // the first num_sorted_skills are sorted by type, so we don't want
         // to index into skill_table -- that is sorted alphabetically -- so
         // we need to do the following dance to check if we are in the
         // sorted section or the unsorted section.
         if( sn < num_sorted_skills )
         {
            skill = skill_table_bytype[sn];

            // we are looping over the skills sorted by type.
            // So, we need to get the normal sn as well.
            normalSn = skill_lookup( skill->name );
         }
         else
         {
            skill = skill_table[sn];
            normalSn = sn;
         }

         if( !skill || !skill->name || skill->name[0] == '' )
            continue;

         if( strcmp( skill->name, "reserved" ) == 0 && ( IS_IMMORTAL( ch ) || CAN_CAST( ch ) ) )
         {
            if( col % 3 != 0 )
               send_to_pager( "rn", ch );
            set_pager_color( AT_MAGIC, ch );
            send_to_pager_color( " ----------------------------------[&CSpells&B]----------------------------------rn",
                                 ch );
            col = 0;
         }

         if( skill->type != lasttype )
         {
            if( !cnt )
               send_to_pager( "                                   (none)rn", ch );
            else if( col % 3 != 0 )
               send_to_pager( "rn", ch );
            set_pager_color( AT_MAGIC, ch );
            pager_printf_color( ch,
                                " ----------------------------------&C%ss&B----------------------------------rn",
                                skill_tname[skill->type] );
            col = cnt = 0;
         }
         lasttype = skill->type;

         if( !IS_IMMORTAL( ch )
             && ( skill->guild != CLASS_NONE && ( !IS_GUILDED( ch ) || ( ch->pcdata->clan->Class != skill->guild ) ) ) )
            continue;

         if( mob )
         {
            if( skill->skill_level[mob->Class] > mob->level && skill->race_level[mob->race] > mob->level )
               continue;
         }
         else
         {
            is_ok = FALSE;

            if( ch->level >= skill->skill_level[ch->Class] )
               is_ok = TRUE;
            if( ch->level >= skill->race_level[ch->race] )
               is_ok = TRUE;

            if( !is_ok )
               continue;
         }

         if( ch->pcdata->learned[sn] <= 0 && SPELL_FLAG( skill, SF_SECRETSKILL ) )
            continue;

         ++cnt;
         set_pager_color( AT_MAGIC, ch );
         pager_printf( ch, "%20.20s", skill->name );
         if( ch->pcdata->learned[normalSn] > 0 )
            set_pager_color( AT_SCORE, ch );
         pager_printf( ch, " %3d%% ", ch->pcdata->learned[normalSn] );
         if( ++col % 3 == 0 )
            send_to_pager( "rn", ch );
      }

      if( col % 3 != 0 )
         send_to_pager( "rn", ch );
      set_pager_color( AT_MAGIC, ch );
      pager_printf( ch, "You have %d practice sessions left.rn", ch->practice );
   }
   


Just a guy having a bit of fun. Nothing more, nothing less, I do not need I WIN to feel validated.
[Go to top] top

Posted by Robert Powell   Australia  (367 posts)  [Biography] bio
Date Reply #2 on Tue 24 Jun 2014 07:00 AM (UTC)
Message

else
   {
      int adept;
      bool can_prac = TRUE;

      if( !IS_AWAKE( ch ) )
      {
         send_to_char( "In your dreams, or what?rn", ch );
         return;
      }

      if( !mob )
      {
         send_to_char( "You can't do that here.rn", ch );
         return;
      }

      if( ch->practice <= 0 )
      {
         act( AT_TELL, "$n tells you 'You must earn some more practice sessions.'", mob, NULL, ch, TO_VICT );
         return;
      }

      sn = skill_lookup( argument );

      if( can_prac && ( ( sn == -1 ) || ( !IS_NPC( ch ) && ch->level < skill_table[sn]->skill_level[ch->Class]
                                          && ch->level < skill_table[sn]->race_level[ch->race] ) ) )
      {
         act( AT_TELL, "$n tells you 'You're not ready to learn that yet...'", mob, NULL, ch, TO_VICT );
         return;
      }

      if( is_name( skill_tname[skill_table[sn]->type], CANT_PRAC ) )
      {
         act( AT_TELL, "$n tells you 'I do not know how to teach that.'", mob, NULL, ch, TO_VICT );
         return;
      }

      /*
       * Skill requires a special teacher
       */
      if( skill_table[sn]->teachers && skill_table[sn]->teachers[0] != '' )
      {
         snprintf( buf, MAX_STRING_LENGTH, "%d", mob->pIndexData->vnum );
         if( !is_name( buf, skill_table[sn]->teachers ) )
         {
            act( AT_TELL, "$n tells you, 'I know not know how to teach that.'", mob, NULL, ch, TO_VICT );
            return;
         }
      }

/*
 * Guild checks - right now, cant practice guild skills - done on 
 * induct/outcast
 */
/*	
	if ( !IS_NPC(ch) && !IS_GUILDED(ch)
	&&    skill_table[sn]->guild != CLASS_NONE)
	{
	    act( AT_TELL, "$n tells you 'Only guild members can use that..'"
		mob, NULL, ch, TO_VICT );
	    return;
	}

	if ( !IS_NPC(ch) && skill_table[sn]->guild != CLASS_NONE 
	     && ch->pcdata->clan->class != skill_table[sn]->guild )
	{
	    act( AT_TELL, "$n tells you 'That can not be used by your guild.'"
		mob, NULL, ch, TO_VICT );
	    return;
	}
*/
      if( !IS_NPC( ch ) && skill_table[sn]->guild != CLASS_NONE )
      {
         act( AT_TELL, "$n tells you 'That is only for members of guilds...'", mob, NULL, ch, TO_VICT );
         return;
      }

      /*
       * Disabled for now
       if ( mob->level < skill_table[sn]->skill_level[ch->class]
       ||   mob->level < skill_table[sn]->skill_level[mob->class] )
       {
       act( AT_TELL, "$n tells you 'You must seek another to teach you that...'",
       mob, NULL, ch, TO_VICT );
       return;
       }
       */

      adept = ( int )( class_table[ch->Class]->skill_adept * 0.6 );

      if( ch->pcdata->learned[sn] >= adept )
      {
         snprintf( buf, MAX_STRING_LENGTH, "$n tells you, 'I've taught you everything I can about %s.'",
                   skill_table[sn]->name );
         act( AT_TELL, buf, mob, NULL, ch, TO_VICT );
         act( AT_TELL, "$n tells you, 'You'll have to practice it on your own now...'", mob, NULL, ch, TO_VICT );
      }
      else
      {
         ch->practice--;
         ch->pcdata->learned[sn] += int_app[get_curr_int( ch )].learn;
         act( AT_ACTION, "You practice $T.", ch, NULL, skill_table[sn]->name, TO_CHAR );
         act( AT_ACTION, "$n practices $T.", ch, NULL, skill_table[sn]->name, TO_ROOM );
         if( ch->pcdata->learned[sn] >= adept )
         {
            ch->pcdata->learned[sn] = adept;
            act( AT_TELL, "$n tells you. 'You'll have to practice it on your own now...'", mob, NULL, ch, TO_VICT );
         }
      }
   }
   return;
}

Just a guy having a bit of fun. Nothing more, nothing less, I do not need I WIN to feel validated.
[Go to top] top

Posted by Robert Powell   Australia  (367 posts)  [Biography] bio
Date Reply #3 on Tue 24 Jun 2014 07:02 AM (UTC)
Message
Sorry for the multi posts, :) I am in verbose mode :)

Just a guy having a bit of fun. Nothing more, nothing less, I do not need I WIN to feel validated.
[Go to top] top

Posted by Robert Powell   Australia  (367 posts)  [Biography] bio
Date Reply #4 on Tue 24 Jun 2014 10:33 AM (UTC)

Amended on Tue 24 Jun 2014 10:35 AM (UTC) by Robert Powell

Message
Ok, fixed the layout issue, dont know what I did there, but I still have the issue of skills showing that should not be, IE 2nd attack showing for a L2 warrior.

pract
                                   (none)
 ----------------------------------Skills----------------------------------
    aggressive style   0%                climb   0%                 cook   0% 
     defensive style   0%                  dig   0%      enhanced damage  90% 
       evasive style   0%                 kick   0%                mount   0% 
               parry  48%               rescue   0%               search   0% 
       second attack   0%       standard style   0% 
 ----------------------------------Weapons----------------------------------
           bludgeons   0%        flexible arms   0%          long blades  50% 
            pugilism   0%         short blades   0%        talonous arms   0% 
 ----------------------------------Tongues----------------------------------
              common 100%              dwarven   0%               elvish   0% 
                gith   0%               goblin   0%             halfling   0% 
                ogre   0%               orcish   0%                pixie   0% 
            trollese   0% 
You have 7 practice sessions left.

<134hp 100m 500mv> 
score
--[Tommi       the Recruit             ]--------------------------------------
 Level: 2    Clan : Human      Items: 0 (max 5) 
 Years: 0    Class: Warrior    Weight: 13 (max 250) 
 STR : 18(18) HitRoll: 4     Armor: 91 
 INT : 13(13) DamRoll: 4     Align: 0    
 WIS : 13(13) 
 DEX : 13(13) Quest: 0 points. 
 CON : 12(12) PRACT:   7 
 LCK : 12(12) EXP : 3,047        TNL : 6,153        
 CHA : 13(13) GOLD : 534         
-[Health Status]----------------------------------------------------------------
 HP : 134   of   134 
 Mana: 100   of   100 
 Move: 500   of   500 
-[Play Data]--------------------------------------------------------------------
 Played: -34 hours
 Log In: Tue Jun 24 14:57:52 2014
 Saved : no save this session
 Time : Tue Jun 24 15:31:52 2014
-[Fight Data]-------------------------------------------------------------------
 Pkills: 0   Pdeaths: 0   Illegal Pkills: 0  
 MKills: 4      Mdeaths: 0     
 Wimpy : 0      Style : 6,153      
 -[Magical Tattoo's]------------------------------------------------------------
 none
--------------------------------------------------------------------------------

Just a guy having a bit of fun. Nothing more, nothing less, I do not need I WIN to feel validated.
[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


14,905 views.

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]