c_cpp 快速制造一个不朽的人
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了c_cpp 快速制造一个不朽的人相关的知识,希望对你有一定的参考价值。
This is a quick Command that I whipped up to aid when you hire a member
of the immortal staff to your MUD. What does it do? It sets the character's
stats to maximum. For my MUD, it's slightly different because I have a PK
system, and an e-mail address system. All you have to do is add the act
flags accordingly, or "remove" them for immortals (like corpse being lootable).
I've modified this code to work with stock code. I HAVE tested this function,
and it works 100%. I've also debugged it. Should have no problems.
All I ask is that you leave the comments in the code, and if you write
a helpfile, you give credit where it's due. Thanks, and hope it helps
you out! I've included versions for both "OLC" enabled, and non-OLC
MUDs. Feel free to color as you like if you have a color code in your MUD.
Another note: I have this set as a max_level command. If you TRULY trust a
lower levelled immortal on your staff with this, then you can set it
to their level, or grant it to them. Whatever you want. I on the other hand
have been burned too many times. Also, you cannot wizify mortals. If you want
to have chaos, go for it. :P Might make a fun quest for a day. Hehehe.
Files to MUCK: act_wiz.c (or whatever your imm commands file is)
interp.c (your function table)
interp.h (your function declarations)
/**********************************************************************
*In act_wiz.c, put this at the bottom of the file: *
**********************************************************************/
/* Immortal Wizify command by Koqlb Nov 26th, 2014.
* Sets maximum stats for a character and hp, mana, move
* and player flags for Immortals automatically, then restores
* them.
* This is the OLC version of the command.
*/
void do_wizify (CHAR_DATA *ch, char * argument)
{
char buf[MAX_STRING_LENGTH];
char arg1[MAX_INPUT_LENGTH];
char arg2[MAX_INPUT_LENGTH];
CHAR_DATA *victim;
int value;
argument = one_argument (argument, arg1);
strcpy (arg2, argument);
if (arg1[0] == '\0' || arg2[0] == '\0')
{
send_to_char ("Syntax: wizify <char> <security>.\n\r", ch);
return;
}
if ((victim = get_char_world (ch, arg1)) == NULL)
{
send_to_char ("They aren't online.\n\r", ch);
return;
}
if (IS_NPC (victim))
{
send_to_char ("Mobs can't be Immortals!!!\n\r", ch);
return;
}
value = is_number (arg2) ? atoi (arg2) : 0;
if (value < 0 || value > 9)
{
sprintf (buf,
"Builder security range is 0 to 9\n\r.");
send_to_char (buf, ch);
return;
}
if (victim->level > ch->level )
{
send_to_char("Try it on someone your own size.\n\r", ch);
return;
}
if (victim->trust >= ch->trust )
{
send_to_char("You aren't trusted at a high enough level.\n\r", ch);
return;
}
if (victim->level <= LEVEL_HERO)
{
send_to_char("You can only wizify Immortals!\n\r",ch);
return;
}
/*Set the max stats and security*/
victim->max_hit = 30000;
victim->max_mana = 30000;
victim->max_move = 30000;
victim->perm_stat[STAT_STR] = 25;
victim->perm_stat[STAT_INT] = 25;
victim->perm_stat[STAT_WIS] = 25;
victim->perm_stat[STAT_DEX] = 25;
victim->perm_stat[STAT_CON] = 25;
victim->pcdata->security = value;
/* Set the common act flags for Immortals. */
SET_BIT (victim->act, PLR_HOLYLIGHT);
SET_BIT (victim->act, PLR_NOSUMMON);
REMOVE_BIT(victim->act, PLR_AUTOLOOT);
REMOVE_BIT(victim->act, PLR_AUTOSAC);
REMOVE_BIT(victim->act, PLR_CANLOOT);
/*Restore the character */
victim->hit = victim->max_hit;
victim->mana = victim->max_mana;
victim->move = victim->max_move;
update_pos (victim);
sprintf(buf, "%s has been Wizified! All stats have been set.\n\r",victim->name);
send_to_char(buf,ch);
send_to_char("Alright!!! Suddenly you feel like a TRUE IMMORTAL!\n\r",victim);
return;
}
/*End do_wizify*/
******************************End OLC version ***********************************
********************************Non - OLC version *******************************
/* Immortal Wizify command by Koqlb Nov 26th, 2014.
* Sets maximum stats for a character and hp, mana, move
* and player flags for Immortals automatically, then restores
* them.
* This is the wizify function for MUDs without OLC.
*/
void do_wizify (CHAR_DATA *ch, char * argument)
{
char buf[MAX_STRING_LENGTH];
char arg[MAX_INPUT_LENGTH];
CHAR_DATA *victim;
int value;
argument = one_argument (argument, arg);
if (arg[0] == '\0')
{
send_to_char ("Syntax: wizify <char>.\n\r", ch);
return;
}
if ((victim = get_char_world (ch, arg1)) == NULL)
{
send_to_char ("They aren't online.\n\r", ch);
return;
}
if (IS_NPC (victim))
{
send_to_char ("Mobs can't be Immortals!!!\n\r", ch);
return;
}
if (victim->level > ch->level )
{
send_to_char("Try it on someone your own size.\n\r", ch);
return;
}
if (victim->trust >= ch->trust )
{
send_to_char("You aren't trusted at a high enough level.\n\r", ch);
return;
}
if (victim->level <= LEVEL_HERO)
{
send_to_char("You can only wizify Immortals!\n\r",ch);
return;
}
/*Set the max stats and security*/
victim->max_hit = 30000;
victim->max_mana = 30000;
victim->max_move = 30000;
victim->perm_stat[STAT_STR] = 25;
victim->perm_stat[STAT_INT] = 25;
victim->perm_stat[STAT_WIS] = 25;
victim->perm_stat[STAT_DEX] = 25;
victim->perm_stat[STAT_CON] = 25;
/* Set the act flags for Immortals. */
SET_BIT (victim->act, PLR_HOLYLIGHT);
SET_BIT (victim->act, PLR_NOSUMMON);
REMOVE_BIT(victim->act, PLR_AUTOLOOT);
REMOVE_BIT(victim->act, PLR_AUTOSAC);
REMOVE_BIT(victim->act, PLR_CANLOOT);
/*Restore the character */
victim->hit = victim->max_hit;
victim->mana = victim->max_mana;
victim->move = victim->max_move;
update_pos (victim);
sprintf(buf, "%s has been Wizified! All stats have been set.\n\r",victim->name);
send_to_char(buf,ch);
send_to_char("Alright!!! Suddenly you feel like a TRUE IMMORTAL!\n\r",victim);
return;
}
/*End do_wizify*/
***************************End Non-OLC version***************************************
******************************End act_wiz.c *****************************************
In interp.c, add the code that has the plus sign:
NOTE: Code WITHOUT a plus sign is code that's already there.
{"wizinvis", do_invis, POS_DEAD, IM, LOG_NORMAL, 1},
+ {"wizify", do_wizify, POS_DEAD, ML, LOG_ALWAYS, 1},
{"vnum", do_vnum, POS_DEAD, IM, LOG_NORMAL, 1},
Then delete the plus sign. Save the file.
****************************** End interp.c ****************************************
Then, look for:
do_wizhelp
Underneath the line:
DECLARE_DO_FUN( do_wizhelp );
Add:
DECLARE_DO_FUN( do_wizify ); /* Wizify by Koqlb */
************************************End interp.h************************************
That's it! Remove *.o files, then do a clean compile, and copyover/reboot. You now
have a quick command to set an immortal's stats to maximum. I got tired of having
to type all those commands separately. :P
Any problems with this, log onto subversive.themudhost.net port 7500
or go to http://subversive.themudhost.net/forum/ and message me. Thanks!
--Koqlb
以上是关于c_cpp 快速制造一个不朽的人的主要内容,如果未能解决你的问题,请参考以下文章