void do_consecrate(CHAR_DATA *ch, char *argument)
{
OBJ_DATA *obj;
char arg1[MAX_INPUT_LENGTH];
char arg2[MAX_INPUT_LENGTH];
char arg3[MAX_STRING_LENGTH];
char buf[MAX_STRING_LENGTH];
int livingweap_needed = 0;
int arti_needed = 0;
int hitroll = 0;
int damroll = 0;
int hp = 0;
int mana = 0;
int move = 0;
// int wear = 0;
// int armor = 0;
// int value;
argument = one_argument( argument, arg1 );
argument = one_argument( argument, arg2 );
strcpy(arg3,argument);
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 && obj->item_type != ITEM_ARMOR)
{
send_to_char("You may only Consecrate weapons and armor.\n\r",ch);
return;
}
if (!IS_OBJ_STAT (obj, ITEM_RELIC) && !IS_OBJ_STAT (obj, ITEM_ARTIFACT))
{
send_to_char("You may only Consecrate Relics and Artifacts.\n\r",ch);
return;
}
if (obj->item_type == ITEM_ARMOR && arg2[0] == '\0')
{
send_to_char("{b[{r**********{b[{wConsecrate Menu{b]{r**********{b]{x.\n\r",ch);
sprintf( buf, "Artifact Name: %s \n\r", obj->short_descr );
send_to_char( buf, ch );
sprintf( buf, "Artifact Level: %d, Artifact Points: %d \n\r", obj->weapon_level, obj->weapon_points);
send_to_char( buf, ch );
arti_needed = 20000;
sprintf( buf, "Artifact Experiance: %d, EXP til next Level: %d \n\r", obj->weapon_currentxp,
(arti_needed - obj->weapon_currentxp));
send_to_char( buf, ch );
stc( "10 Artifact Points are redeamable for:\n\r", ch );
stc( "Hitroll: 10\n\r", ch );
stc( "Damroll: 10\n\r", ch );
stc( "HP: 1000\n\r", ch );
stc( "Mana: 1000\n\r", ch );
stc( "Move: 1000\n\r", ch );
send_to_char("{b[{r**********{b[{wConsecrate Menu{b]{r**********{b]{x.\n\r",ch);
}
if (obj->item_type == ITEM_ARMOR)
{
hitroll = 10;
damroll = 10;
hp = 1000;
mana = 1000;
move = 1000;
if (obj->weapon_points == 10)
{
if (!str_cmp(arg2,"hitroll"))
{
add_affect( obj, APPLY_HITROLL, hitroll );
stc( "Hitroll + 10\n\r", ch );
obj->weapon_points = 0;
return;
}
if (!str_cmp(arg2,"damroll"))
{
add_affect( obj, APPLY_DAMROLL, damroll );
stc( "Damroll + 10\n\r", ch );
obj->weapon_points = 0;
return;
}
if (!str_cmp(arg2,"hp"))
{
add_affect( obj, APPLY_HIT, hp );
stc( "HP + 1000\n\r", ch );
obj->weapon_points = 0;
return;
}
if (!str_cmp(arg2,"mana"))
{
add_affect( obj, APPLY_MANA, mana );
stc( "Mana + 1000\n\r", ch );
obj->weapon_points = 0;
return;
}
if (!str_cmp(arg2,"move"))
{
add_affect( obj, APPLY_MOVE, move );
stc( "Move + 1000\n\r", ch );
obj->weapon_points = 0;
return;
}
}
return;
}
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 );
send_to_char ("Weapon type is ", ch);
switch (obj->value[0])
{
case (WEAPON_EXOTIC):
send_to_char ("exotic.\n\r", ch);
break;
case (WEAPON_SWORD):
send_to_char ("sword.\n\r", ch);
break;
case (WEAPON_DAGGER):
send_to_char ("dagger.\n\r", ch);
break;
case (WEAPON_SPEAR):
send_to_char ("spear/staff.\n\r", ch);
break;
case (WEAPON_MACE):
send_to_char ("mace/club.\n\r", ch);
break;
case (WEAPON_AXE):
send_to_char ("axe.\n\r", ch);
break;
case (WEAPON_FLAIL):
send_to_char ("flail.\n\r", ch);
break;
case (WEAPON_WHIP):
send_to_char ("whip.\n\r", ch);
break;
case (WEAPON_POLEARM):
send_to_char ("polearm.\n\r", ch);
break;
default:
send_to_char ("unknown.\n\r", ch);
break;
}
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 = 1500;
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))
send_to_char(" Flaming(5)",ch);
if (!IS_WEAPON_STAT (obj, WEAPON_FROST))
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\rName - Short",ch);
send_to_char("\n\rWeapon Type (weapon)",ch);
send_to_char("\n\r{b[{r**********{b[{wConsecrate Menu{b]{r**********{b]{x.\n\r",ch);
}
if (!str_cmp(arg2,"name"))
{
free_string(obj->name);
obj->name = str_dup(arg3);
}
if (!str_cmp(arg2,"short"))
{
free_string(obj->short_descr);
obj->short_descr=str_dup(arg3);
}
if (!str_cmp(arg2,"weapon"))
{
if (arg3[0] == '\0')
{
send_to_char("exotic sword dagger spear mace axe flail whip polearm\n\r",ch);
return;
}
if (!str_cmp(arg3,"exotic")) obj->value[0] = WEAPON_EXOTIC;
if (!str_cmp(arg3,"sword")) obj->value[0] = WEAPON_SWORD;
if (!str_cmp(arg3,"dagger")) obj->value[0] = WEAPON_DAGGER;
if (!str_cmp(arg3,"spear")) obj->value[0] = WEAPON_SPEAR;
if (!str_cmp(arg3,"mace")) obj->value[0] = WEAPON_MACE;
if (!str_cmp(arg3,"axe")) obj->value[0] = WEAPON_AXE;
if (!str_cmp(arg3,"flail")) obj->value[0] = WEAPON_FLAIL;
if (!str_cmp(arg3,"whip")) obj->value[0] = WEAPON_WHIP;
if (!str_cmp(arg3,"polearm")) obj->value[0] = WEAPON_POLEARM;
return;
}
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,"flaming"))
{
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 (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;
}
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.h
DECLARE_DO_FUN( do_consecrate );
interp.c
{"consecrate", do_consecrate, POS_DEAD, 0, LOG_NORMAL, 1},
fight.c
void 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 );
int arti_exp = 0;
int arti_needed = 0;
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++;
}
}
for (obj = ch->carrying; obj != NULL; obj = obj_next)
{
obj_next = obj->next_content;
if (obj->wear_loc == WEAR_NONE)
continue;
if (obj != NULL)
{
arti_needed = 20000;
if (IS_OBJ_STAT (obj, ITEM_ARTIFACT))
{
if (obj->weapon_level < 10)
{
arti_exp = (xp * .2);
xp -= (arti_exp);
sprintf(buf, "{gYour Artifact receives {w%d {gexperience points.{x\n\r", arti_exp);
stc(buf, gch);
obj->weapon_currentxp += arti_exp;
}
if (obj->weapon_currentxp >= arti_needed )
{
obj->weapon_level++;
obj->value[0] += 10;
obj->value[1] += 10;
obj->value[2] += 10;
obj->value[3] += 10;
send_to_char("{wYour {rArtifact {whas gained a Level{x\n\r", gch);
obj->weapon_currentxp -= arti_needed;
obj->weapon_points++;
} }
}
}
handler.c
char *extra_bit_name (int extra_flags)
if (extra_flags & ITEM_RELIC)
strcat (buf, " relic");
if (extra_flags & ITEM_ARTIFACT)
strcat (buf, " artifact");
merc.h
/*
* Extra flags.
* Used in #OBJECTS.
*/
#define ITEM_RELIC (aa)
#define ITEM_ARTIFACT (bb)
tables.c
const struct flag_type extra_flags[] = {
{"relic", ITEM_RELIC, TRUE},
{"artifact", ITEM_ARTIFACT, TRUE},