consecrate-Rom-2.txt
snippets · 8.7 KB · 2010-03-30
Consecrate snippet by Xrakisis for Children of the Night (ROM/QuickMUD).
Download « Back to the snippets list
Consecrate Snippit by Xrakisis
please email me if you use this.. ian_shirm2@yahoo.com
snippit wrote for Children of the Night:Rom-Quickmud Edition
save.c
fprintf( fp, "WeaponCurrentXP %d\n", obj->weapon_currentxp);
fprintf( fp, "WeaponLevel %d\n", obj->weapon_level);
fprintf( fp, "WeaponPoints %d\n", obj->weapon_points);
KEY ("WeaponCurrentXP", obj->weapon_currentxp, fread_number (fp) );
KEY ("WeaponLevel", obj->weapon_level, fread_number (fp));
KEY ("WeaponPoints", obj->weapon_points, fread_number (fp));
merc.h obj_index_data/obj_data
int weapon_level;
int weapon_points;
int weapon_currentxp;
interp.c: {"consecrate", do_consecrate, POS_DEAD, 0, LOG_NORMAL, 1},
interp.h:DECLARE_DO_FUN( do_consecrate );
fight.c:group_gain
OBJ_DATA *wield;
OBJ_DATA *wield2;
int livingweap_exp = 0;
int livingweap_needed = 0;
wield = get_eq_char( ch, WEAR_WIELD );
wield2 = get_eq_char( ch, WEAR_HOLD );
Put The Following Code under gain_exp (gch, xp);
wield = get_eq_char( ch, WEAR_WIELD );
wield2 = get_eq_char( ch, WEAR_HOLD );
if (wield != NULL)
{
livingweap_needed = (wield->weapon_level * 100);
if (wield->weapon_level >= 100) return;
livingweap_exp = (xp * .5);
xp -= (livingweap_exp);
sprintf(buf, "{b- {gYour Weapon receives {w%d {gexperience points.{x\n\r", livingweap_exp);
stc(buf, gch);
wield->weapon_currentxp += livingweap_exp;
if (wield->weapon_currentxp >= livingweap_needed )
{
wield->weapon_level++;
send_to_char("{wYour {rweapon {whas gained a Level{x\n\r", gch);
wield->weapon_currentxp -= livingweap_needed;
wield->weapon_points++;
}
}
if (wield2 != NULL)
{
livingweap_needed = (wield2->weapon_level * 100);
if (wield2->weapon_level >= 100) return;
livingweap_exp = (xp * .5);
xp -= (livingweap_exp);
sprintf(buf, "{b- {gYour Weapon receives {w%d {gexperience points.{x\n\r", livingweap_exp);
stc(buf, gch);
wield2->weapon_currentxp += livingweap_exp;
if (wield2->weapon_currentxp >= livingweap_needed )
{
wield2->weapon_level++;
send_to_char("{wYour {rweapon {whas gained a Level{x\n\r", gch);
wield2->weapon_currentxp -= livingweap_needed;
wield2->weapon_points++;
}
}
void do_consecrate(CHAR_DATA *ch, char *argument)
{
OBJ_DATA *obj;
char arg1[MAX_INPUT_LENGTH];
char arg2[MAX_INPUT_LENGTH];
char buf[MAX_STRING_LENGTH];
int livingweap_needed = 0;
argument = one_argument( argument, arg1 );
argument = one_argument( argument, arg2 );
if (arg1[0] == '\0')
{
send_to_char("Which item do you wish to consecrate?\n\r", ch);
return;
}
if ( (obj = get_obj_carry(ch, arg1, ch)) == NULL)
{
send_to_char("You are not carrying that item.\n\r", ch);
return;
}
if (obj->item_type != ITEM_WEAPON)
{
send_to_char("You may only Consecrate weapons.\n\r",ch);
return;
}
else if (obj->item_type == ITEM_WEAPON && arg2[0] == '\0')
{
send_to_char("{b[{r**********{b[{wConsecrate Menu{b]{r**********{b]{x.\n\r",ch);
sprintf( buf, "Weapon Name: %s \n\r", obj->short_descr );
send_to_char( buf, ch );
sprintf( buf, "Weapon Attack Type: %s \n\r", attack_table[obj->value[3]].name );
send_to_char( buf, ch );
sprintf( buf, "Weapon Damage: %d d %d \n\r", obj->value[1], obj->value[2]);
send_to_char( buf, ch );
sprintf( buf, "Weapon Level: %d, Weapon Points: %d \n\r", obj->weapon_level, obj->weapon_points);
send_to_char( buf, ch );
livingweap_needed = (obj->weapon_level * 100);
sprintf( buf, "Weapon Experiance: %d, EXP til next Level: %d \n\r", obj->weapon_currentxp,
(livingweap_needed - obj->weapon_currentxp));
send_to_char( buf, ch );
if (IS_WEAPON_STAT (obj, WEAPON_POISON))
send_to_char("This Weapon is Poisoned.\n\r",ch);
if (IS_WEAPON_STAT (obj, WEAPON_VAMPIRIC))
send_to_char("This Weapon is Vampiric.\n\r",ch);
if (IS_WEAPON_STAT (obj, WEAPON_FLAMING))
send_to_char("This Weapon is Enchanted with Fire.\n\r",ch);
if (IS_WEAPON_STAT (obj, WEAPON_FROST))
send_to_char("This Weapon is Enchanted with Frost.\n\r",ch);
if (IS_WEAPON_STAT (obj, WEAPON_SHOCKING))
send_to_char("This Weapon is Enchanted with Electricity.\n\r",ch);
if (IS_WEAPON_STAT (obj, WEAPON_SHARP))
send_to_char("This Weapon is Sharp.\n\r",ch);
if (IS_WEAPON_STAT (obj, WEAPON_TWO_HANDS))
send_to_char("This Weapon is Two-Handed\n\r",ch);
send_to_char("{b[{r**********{b[{wConsecrate Menu{b]{r**********{b]{x.\n\r",ch);
send_to_char("Upgrade Costs:\n\r",ch);
if (!IS_WEAPON_STAT (obj, WEAPON_POISON))
send_to_char("Poison(5)",ch);
if (!IS_WEAPON_STAT (obj, WEAPON_VAMPIRIC))
send_to_char(" Vampiric(5)",ch);
if (!IS_WEAPON_STAT (obj, WEAPON_FLAMING) && !IS_WEAPON_STAT (obj, WEAPON_FROST))
send_to_char(" Flaming(5)",ch);
if (!IS_WEAPON_STAT (obj, WEAPON_FROST) && !IS_WEAPON_STAT (obj, WEAPON_FLAMING))
send_to_char(" Frost(5)",ch);
if (!IS_WEAPON_STAT (obj, WEAPON_SHOCKING))
send_to_char(" Shocking(5)",ch);
if (!IS_WEAPON_STAT (obj, WEAPON_SHARP))
send_to_char(" Sharp(5)",ch);
send_to_char("\n\rNumber of Die +1 (5)",ch);
send_to_char("\n\rDamage ammount of Die +1 (1)",ch);
send_to_char("\n\r{b[{r**********{b[{wConsecrate Menu{b]{r**********{b]{x.\n\r",ch);
}
if (!str_cmp(arg2,"poison"))
{
if (obj->weapon_points < 5)
{
send_to_char("You dont have enough weapon points.\n\r",ch);
return;
}
else
{
sprintf(buf,"%s is coated with poisonous venom!\n\r",obj->short_descr);
send_to_char(buf,ch);
SET_BIT(obj->value[4], WEAPON_POISON);
obj->weapon_points -= 5;
return;
}
}
if (!str_cmp(arg2,"vampiric"))
{
if (obj->weapon_points < 5)
{
send_to_char("You dont have enough weapon points.\n\r",ch);
return;
}
else
{
sprintf(buf,"%s has become Vampyric!\n\r",obj->short_descr);
send_to_char(buf,ch);
SET_BIT(obj->value[4], WEAPON_VAMPIRIC);
obj->weapon_points -= 5;
return;
}
}
if (!str_cmp(arg2,"fire"))
{
if (IS_WEAPON_STAT (obj, WEAPON_FROST))
{
send_to_char("you may not enflame a Frost Weapon.\n\r",ch);
return;
}
else if (obj->weapon_points < 5)
{
send_to_char("You dont have enough weapon points.\n\r",ch);
return;
}
else
{
sprintf(buf,"%s becomes enveloped with Fire!\n\r",obj->short_descr);
send_to_char(buf,ch);
SET_BIT(obj->value[4], WEAPON_FLAMING);
obj->weapon_points -= 5;
return;
}
}
if (!str_cmp(arg2,"frost"))
{
if (IS_WEAPON_STAT (obj, WEAPON_FLAMING))
{
send_to_char("you may not Frost a Flaming Weapon.\n\r",ch);
return;
}
else if (obj->weapon_points < 5)
{
send_to_char("You dont have enough weapon points.\n\r",ch);
return;
}
else
{
sprintf(buf,"%s is enveloped with Frost!\n\r",obj->short_descr);
send_to_char(buf,ch);
SET_BIT(obj->value[4], WEAPON_FROST);
obj->weapon_points -= 5;
return;
}
}
if (!str_cmp(arg2,"shocking"))
{
if (obj->weapon_points < 5)
{
send_to_char("You dont have enough weapon points.\n\r",ch);
return;
}
else
{
sprintf(buf,"%s is surrounded with electricity!\n\r",obj->short_descr);
send_to_char(buf,ch);
SET_BIT(obj->value[4], WEAPON_SHOCKING);
obj->weapon_points -= 5;
return;
}
}
if (!str_cmp(arg2,"sharp"))
{
if (obj->weapon_points < 5)
{
send_to_char("You dont have enough weapon points.\n\r",ch);
return;
}
else
{
sprintf(buf,"%s is honed to Razor Sharpness!\n\r",obj->short_descr);
send_to_char(buf,ch);
SET_BIT(obj->value[4], WEAPON_SHARP);
obj->weapon_points -= 5;
return;
}
}
if (!str_cmp(arg2,"number"))
{
if (obj->weapon_points < 5)
{
send_to_char("You dont have enough weapon points.\n\r",ch);
return;
}
else
{
sprintf(buf,"%s gains an additional Number of Damage Die!\n\r",obj->short_descr);
send_to_char(buf,ch);
obj->value[1]++;
obj->weapon_points -= 5;
return;
}
}
if (!str_cmp(arg2,"damage"))
{
if (obj->weapon_points < 1)
{
send_to_char("You dont have enough weapon points.\n\r",ch);
return;
}
else
{
sprintf(buf,"%s gains an additional Damage Die!\n\r",obj->short_descr);
send_to_char(buf,ch);
obj->value[2]++;
obj->weapon_points -= 1;
return;
}
}
return;
}