Code for Rom2.4b4: do_award code v1.1 by Kracus Based on ROM Version 2.4 beta (c)1993-96 Russ Taylor Based on Merc 2.1 code by Hatchet, Furey, and Kahn Original DikiMud by: Hans Staerfeldt, Katja Nyboe, Tom Madsen, Micheal Seifert, Sebastian Hammer // Award command by Kracus '97 for source: Rom24b4 (c)Russ Taylor // The award uses atoi which allows a -amount // If awarding(taking away) a -amount, you still have to have a += // example: 10 + (-5) = 5 which is correct, 10 - (-5) = 15 is wrong // With this command there is no need to make the player remove // their eq in order to award anything such as hp, since it is // coded to perm_x and checks for < 1 perm_x void do_award(CHAR_DATA *ch, char *argument) { CHAR_DATA *victim; char buf [MAX_STRING_LENGTH]; char arg1 [MAX_STRING_LENGTH]; char arg2 [MAX_STRING_LENGTH]; char arg3 [MAX_STRING_LENGTH]; int amount; argument = one_argument(argument, arg1); argument = one_argument(argument, arg2); argument = one_argument(argument, arg3); amount = atoi(arg2); // amount uses atoi for -amounts if(!IS_IMMORTAL(ch)) { send_to_char("You are not able to use the award command.", ch); return; } if (arg1[0] == '\0' || arg2[0] == '\0' || !is_number(arg2) || arg3[0] == '\0') { send_to_char("===================================================================\n\r", ch); send_to_char("| Syntax: award |\n\r", ch); send_to_char("| |\n\r", ch); send_to_char("| Name : the player's name who is being awarded |\n\r", ch); send_to_char("| Amount : amount can also be in -amount, to take away |\n\r", ch); send_to_char("| Award Type : hp, mana, mov, train, practice |\n\r", ch); send_to_char("| |\n\r", ch); send_to_char("===================================================================\n\r", ch); return; } if ((victim = get_char_world(ch, arg1)) == NULL) { send_to_char("That player is not currently online.\n\r", ch); return; } if (IS_NPC(victim)) { send_to_char("You cannot award a mobile with anything.\n\r", ch); return; } if (amount < -1000) { send_to_char("That amount is too low...\n\r", ch); return; } if (amount > 1000) { send_to_char("That amount is too high...\n\r", ch); return; } if (amount == 0) { send_to_char("What amount do you want to award?\n\r", ch); return; } if (!str_prefix(arg3,"hp")) { if (victim->pcdata->perm_hit < 1 && amount < 1) { sprintf(buf,"%s has only %d permanent hp, you cannot take away %d hp.\n\r", victim->name, victim->pcdata->perm_hit, amount); send_to_char(buf, ch); return; } if (victim->pcdata->perm_hit > 0 && (amount < 0 && (victim->pcdata->perm_hit + amount < 1))) { sprintf(buf,"%s has only %d permanent hp which is too low to take away %d hp.\n\r", victim->name, victim->pcdata->perm_hit, amount); send_to_char(buf, ch); return; } victim->hit = victim->max_hit; update_pos( victim); if (amount > 0) { victim->pcdata->perm_hit += amount; victim->max_hit += amount; victim->hit += amount; sprintf(buf,"You have awarded %s with %d hp.\n\r", victim->name, amount); send_to_char(buf, ch); sprintf(buf,"%s has awarded you with %d hp.\n\r", ch->name, amount); send_to_char(buf, victim); sprintf(buf, "$N has awarded %s with %d hp.", victim->name, amount); wiznet(buf,ch,NULL,WIZ_PENALTIES,WIZ_SECURE,0); return; } else { victim->pcdata->perm_hit += amount; victim->max_hit += amount; victim->hit += amount; sprintf(buf,"You have taken away %d hp from %s.\n\r", amount, victim->name); send_to_char(buf, ch); sprintf(buf,"%s has taken away %d hp from you.\n\r", ch->name, amount); send_to_char(buf, victim); sprintf(buf,"$N has taken away %d hp from %s.", amount, victim->name); wiznet(buf,ch,NULL,WIZ_PENALTIES,WIZ_SECURE,0); return; } } if (!str_prefix(arg3,"mana")) { if (victim->pcdata->perm_mana < 1 && amount < 1) { sprintf(buf,"%s has only %d permanent mana, you cannot take away %d mana.\n\r", victim->name, victim->pcdata->perm_mana, amount); send_to_char(buf, ch); return; } if (victim->pcdata->perm_mana > 0 && (amount < 0 && (victim->pcdata->perm_mana + amount < 1))) { sprintf(buf,"%s has only %d permanent mana which is too low to take away %d mana.\n\r", victim->name, victim->pcdata->perm_mana, amount); send_to_char(buf, ch); return; } victim->mana = victim->max_mana; update_pos( victim); if (amount > 0) { victim->pcdata->perm_mana += amount; victim->max_mana += amount; victim->mana += amount; sprintf(buf,"You have awarded %s with %d mana.\n\r", victim->name, amount); send_to_char(buf, ch); sprintf(buf,"%s has awarded you with %d mana.\n\r", ch->name, amount); send_to_char(buf, victim); sprintf(buf, "$N has awarded %s with %d mana.", victim->name, amount); wiznet(buf,ch,NULL,WIZ_PENALTIES,WIZ_SECURE,0); return; } else { victim->pcdata->perm_mana += amount; victim->max_mana += amount; victim->mana += amount; sprintf(buf,"You have taken away %d mana from %s.\n\r", amount, victim->name); send_to_char(buf, ch); sprintf(buf,"%s has taken away %d mana from you.\n\r", ch->name, amount); send_to_char(buf, victim); sprintf(buf,"$N has taken away %d mana from %s.", amount, victim->name); wiznet(buf,ch,NULL,WIZ_PENALTIES,WIZ_SECURE,0); return; } } if (!str_prefix(arg3,"move")) { if (victim->pcdata->perm_move < 1 && amount < 1) { sprintf(buf,"%s has only %d permanent move, you cannot take away %d move.\n\r", victim->name, victim->pcdata->perm_move, amount); send_to_char(buf, ch); return; } if (victim->pcdata->perm_move > 0 && (amount < 0 && (victim->pcdata->perm_move + amount < 1))) { sprintf(buf,"%s has only %d permanent move which is too low to take away %d move.\n\r", victim->name, victim->pcdata->perm_move, amount); send_to_char(buf, ch); return; } victim->move = victim->max_move; update_pos( victim); if (amount > 0) { victim->pcdata->perm_move += amount; victim->max_move += amount; victim->move += amount; sprintf(buf,"You have awarded %s with %d movement.\n\r", victim->name, amount); send_to_char(buf, ch); sprintf(buf,"%s has awarded you with %d movement.\n\r", ch->name, amount); send_to_char(buf, victim); sprintf(buf, "$N has awarded %s with %d movement.", victim->name, amount); wiznet(buf,ch,NULL,WIZ_PENALTIES,WIZ_SECURE,0); return; } else { victim->pcdata->perm_move += amount; victim->max_move += amount; victim->move += amount; sprintf(buf,"You have taken away %d movement from %s.\n\r", amount, victim->name); send_to_char(buf, ch); sprintf(buf,"%s has taken away %d movement from you.\n\r", ch->name, amount); send_to_char(buf, victim); sprintf(buf,"$N has taken away %d movement from %s.", amount, victim->name); wiznet(buf,ch,NULL,WIZ_PENALTIES,WIZ_SECURE,0); return; } } if (!str_prefix(arg3,"train")) { if (amount > 100 || amount < -100) { sprintf(buf,"An award of %d trains is too much, max(10) or min(-10).\n\r", amount); send_to_char(buf, ch); return; } if (victim->train < 1 && amount < 1) { sprintf(buf,"%s has only %d train(s), you cannot take away %d train(s).\n\r", victim->name, victim->train, amount); send_to_char(buf, ch); return; } if (victim->train > 0 && (amount < 0 && (victim->train + amount < 1))) { sprintf(buf,"%s has only %d train(s) which is too low to take away %d train(s).\n\r", victim->name, victim->train, amount); send_to_char(buf, ch); return; } if (amount > 0) { victim->train += amount; sprintf(buf,"You have awarded %s with %d train(s).\n\r", victim->name, amount); send_to_char(buf, ch); sprintf(buf,"%s has awarded you with %d train(s).\n\r", ch->name, amount); send_to_char(buf, victim); sprintf(buf, "$N has awarded %s with %d train(s).", victim->name, amount); wiznet(buf,ch,NULL,WIZ_PENALTIES,WIZ_SECURE,0); return; } else { victim->train += amount; sprintf(buf,"You have taken away %d train(s) from %s.\n\r", amount, victim->name); send_to_char(buf, ch); sprintf(buf,"%s has taken away %d train(s) from you.\n\r", ch->name, amount); send_to_char(buf, victim); sprintf(buf,"$N has taken away %d train(s) from %s.", amount, victim->name); wiznet(buf,ch,NULL,WIZ_PENALTIES,WIZ_SECURE,0); return; } } if (!str_prefix(arg3,"practice")) { if (amount > 100 || amount < -100) { sprintf(buf,"An award of %d practices is too much, max(10) or min(-10).\n\r", amount); send_to_char(buf, ch); return; } if (victim->practice < 1 && amount < 1) { sprintf(buf,"%s has only %d practice(s), you cannot take away %d practice(s).\n\r", victim->name, victim->practice, amount); send_to_char(buf, ch); return; } if (victim->practice > 0 && (amount < 0 && (victim->practice + amount < 1))) { sprintf(buf,"%s has only %d practice(s) which is too low to take away %d practice(s).\n\r", victim->name, victim->practice, amount); send_to_char(buf, ch); return; } if (amount > 0) { victim->practice += amount; sprintf(buf,"You have awarded %s with %d practice(s).\n\r", victim->name, amount); send_to_char(buf, ch); sprintf(buf,"%s has awarded you with %d practice(s).\n\r", ch->name, amount); send_to_char(buf, victim); sprintf(buf, "$N has awarded %s with %d practice(s).", victim->name, amount); wiznet(buf,ch,NULL,WIZ_PENALTIES,WIZ_SECURE,0); return; } else { victim->practice += amount; sprintf(buf,"You have taken away %d practice(s) from %s.\n\r", amount, victim->name); send_to_char(buf, ch); sprintf(buf,"%s has taken away %d practice(s) from you.\n\r", ch->name, amount); send_to_char(buf, victim); sprintf(buf,"$N has taken away %d practice(s) from %s.", amount, victim->name); wiznet(buf,ch,NULL,WIZ_PENALTIES,WIZ_SECURE,0); return; } } }