mirror of
https://github.com/tbamud/tbamud.git
synced 2025-09-22 05:50:48 +02:00
Added increase_gold/bank funcs to prevent cash overflow
This commit is contained in:
parent
a95ac76ef7
commit
4892b22a51
13 changed files with 230 additions and 101 deletions
|
@ -35,6 +35,10 @@ export (QQ's a zone into a tarball)
|
||||||
Xlist (mlist, olist, rlist, zlist, slist, tlist, qlist)
|
Xlist (mlist, olist, rlist, zlist, slist, tlist, qlist)
|
||||||
(lots of major bugfixes too)
|
(lots of major bugfixes too)
|
||||||
@
|
@
|
||||||
|
[Nov 26 2010] - Jamdog
|
||||||
|
Bug-Fix: set level now allows GRGOD or higher to set to any mortal level
|
||||||
|
Advance command changed to work for both mortal and admin levels
|
||||||
|
Added increase_gold and increase_bank functions to prevent cash overflows
|
||||||
[Nov 25 2010] - Jamdog
|
[Nov 25 2010] - Jamdog
|
||||||
Added diagonal directions with cedit toggle (default to 'off')
|
Added diagonal directions with cedit toggle (default to 'off')
|
||||||
Bug-Fix: admin <player> default now targets the victim player
|
Bug-Fix: admin <player> default now targets the victim player
|
||||||
|
|
|
@ -186,7 +186,7 @@ static void get_check_money(struct char_data *ch, struct obj_data *obj)
|
||||||
|
|
||||||
extract_obj(obj);
|
extract_obj(obj);
|
||||||
|
|
||||||
GET_GOLD(ch) += value;
|
increase_gold(ch, value);
|
||||||
|
|
||||||
if (value == 1)
|
if (value == 1)
|
||||||
send_to_char(ch, "There was 1 coin.\r\n");
|
send_to_char(ch, "There was 1 coin.\r\n");
|
||||||
|
@ -424,7 +424,7 @@ static void perform_drop_gold(struct char_data *ch, int amount, byte mode, room_
|
||||||
|
|
||||||
send_to_char(ch, "You drop some gold which disappears in a puff of smoke!\r\n");
|
send_to_char(ch, "You drop some gold which disappears in a puff of smoke!\r\n");
|
||||||
}
|
}
|
||||||
GET_GOLD(ch) -= amount;
|
decrease_gold(ch, amount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -590,7 +590,7 @@ ACMD(do_drop)
|
||||||
if (amount && (subcmd == SCMD_JUNK)) {
|
if (amount && (subcmd == SCMD_JUNK)) {
|
||||||
send_to_char(ch, "You have been rewarded by the gods!\r\n");
|
send_to_char(ch, "You have been rewarded by the gods!\r\n");
|
||||||
act("$n has been rewarded by the gods!", TRUE, ch, 0, 0, TO_ROOM);
|
act("$n has been rewarded by the gods!", TRUE, ch, 0, 0, TO_ROOM);
|
||||||
GET_GOLD(ch) += amount;
|
increase_gold(ch, amount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -663,8 +663,8 @@ static void perform_give_gold(struct char_data *ch, struct char_data *vict,
|
||||||
act(buf, TRUE, ch, 0, vict, TO_NOTVICT);
|
act(buf, TRUE, ch, 0, vict, TO_NOTVICT);
|
||||||
|
|
||||||
if (IS_NPC(ch) || (!ADM_FLAGGED(ch, ADM_MONEY)))
|
if (IS_NPC(ch) || (!ADM_FLAGGED(ch, ADM_MONEY)))
|
||||||
GET_GOLD(ch) -= amount;
|
decrease_gold(ch, amount);
|
||||||
GET_GOLD(vict) += amount;
|
increase_gold(vict, amount);
|
||||||
|
|
||||||
bribe_mtrigger(vict, ch, amount);
|
bribe_mtrigger(vict, ch, amount);
|
||||||
}
|
}
|
||||||
|
@ -1533,7 +1533,7 @@ ACMD(do_sac)
|
||||||
switch (rand_number(0, 5)) {
|
switch (rand_number(0, 5)) {
|
||||||
case 0:
|
case 0:
|
||||||
send_to_char(ch, "You sacrifice %s to the Gods.\r\nYou receive one gold coin for your humility.\r\n", GET_OBJ_SHORT(j));
|
send_to_char(ch, "You sacrifice %s to the Gods.\r\nYou receive one gold coin for your humility.\r\n", GET_OBJ_SHORT(j));
|
||||||
GET_GOLD(ch) += 1;
|
increase_gold(ch, 1);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
send_to_char(ch, "You sacrifice %s to the Gods.\r\nThe Gods ignore your sacrifice.\r\n", GET_OBJ_SHORT(j));
|
send_to_char(ch, "You sacrifice %s to the Gods.\r\nThe Gods ignore your sacrifice.\r\n", GET_OBJ_SHORT(j));
|
||||||
|
@ -1548,15 +1548,15 @@ ACMD(do_sac)
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
send_to_char(ch, "Your sacrifice to the Gods is rewarded with %d gold coins.\r\n", GET_OBJ_COST(j));
|
send_to_char(ch, "Your sacrifice to the Gods is rewarded with %d gold coins.\r\n", GET_OBJ_COST(j));
|
||||||
GET_GOLD(ch) += GET_OBJ_COST(j);
|
increase_gold(ch, GET_OBJ_COST(j));
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
send_to_char(ch, "Your sacrifice to the Gods is rewarded with %d gold coins\r\n", (2*GET_OBJ_COST(j)));
|
send_to_char(ch, "Your sacrifice to the Gods is rewarded with %d gold coins\r\n", (2*GET_OBJ_COST(j)));
|
||||||
GET_GOLD(ch) += (2*GET_OBJ_COST(j));
|
increase_gold(ch, (2*GET_OBJ_COST(j)));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
send_to_char(ch, "You sacrifice %s to the Gods.\r\nYou receive one gold coin for your humility.\r\n", GET_OBJ_SHORT(j));
|
send_to_char(ch, "You sacrifice %s to the Gods.\r\nYou receive one gold coin for your humility.\r\n", GET_OBJ_SHORT(j));
|
||||||
GET_GOLD(ch) += 1;
|
increase_gold(ch, 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
for (jj = j->contains; jj; jj = next_thing2) {
|
for (jj = j->contains; jj; jj = next_thing2) {
|
||||||
|
|
|
@ -185,7 +185,7 @@ ACMD(do_steal)
|
||||||
percent -= 50;
|
percent -= 50;
|
||||||
|
|
||||||
/* No stealing if not allowed. If it is no stealing from Imm's or Shopkeepers. */
|
/* No stealing if not allowed. If it is no stealing from Imm's or Shopkeepers. */
|
||||||
if (IS_ADMIN(vict, ADMLVL_IMMORT) || pcsteal || GET_MOB_SPEC(vict) == shop_keeper)
|
if (ADM_FLAGGED(vict, ADM_NOSTEAL) || pcsteal || GET_MOB_SPEC(vict) == shop_keeper)
|
||||||
percent = 101; /* Failure */
|
percent = 101; /* Failure */
|
||||||
|
|
||||||
if (str_cmp(obj_name, "coins") && str_cmp(obj_name, "gold")) {
|
if (str_cmp(obj_name, "coins") && str_cmp(obj_name, "gold")) {
|
||||||
|
@ -253,14 +253,14 @@ ACMD(do_steal)
|
||||||
gold = (GET_GOLD(vict) * rand_number(1, 10)) / 100;
|
gold = (GET_GOLD(vict) * rand_number(1, 10)) / 100;
|
||||||
gold = MIN(1782, gold);
|
gold = MIN(1782, gold);
|
||||||
if (gold > 0) {
|
if (gold > 0) {
|
||||||
GET_GOLD(ch) += gold;
|
increase_gold(ch, gold);
|
||||||
GET_GOLD(vict) -= gold;
|
decrease_gold(vict, gold);
|
||||||
if (gold > 1)
|
if (gold > 1)
|
||||||
send_to_char(ch, "Bingo! You got %d gold coins.\r\n", gold);
|
send_to_char(ch, "Bingo! You got %d gold coins.\r\n", gold);
|
||||||
else
|
else
|
||||||
send_to_char(ch, "You manage to swipe a solitary gold coin.\r\n");
|
send_to_char(ch, "You manage to swipe a solitary gold coin.\r\n");
|
||||||
} else {
|
} else {
|
||||||
send_to_char(ch, "You couldn't get any gold...\r\n");
|
send_to_char(ch, "You couldn't get any gold...\r\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -532,7 +532,7 @@ ACMD(do_split)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
GET_GOLD(ch) -= share * (num - 1);
|
decrease_gold(ch, share * (num - 1));
|
||||||
|
|
||||||
/* Abusing signed/unsigned to make sizeof work. */
|
/* Abusing signed/unsigned to make sizeof work. */
|
||||||
len = snprintf(buf, sizeof(buf), "%s splits %d coins; you receive %d.\r\n",
|
len = snprintf(buf, sizeof(buf), "%s splits %d coins; you receive %d.\r\n",
|
||||||
|
@ -544,7 +544,7 @@ ACMD(do_split)
|
||||||
}
|
}
|
||||||
if (AFF_FLAGGED(k, AFF_GROUP) && IN_ROOM(k) == IN_ROOM(ch) &&
|
if (AFF_FLAGGED(k, AFF_GROUP) && IN_ROOM(k) == IN_ROOM(ch) &&
|
||||||
!IS_NPC(k) && k != ch) {
|
!IS_NPC(k) && k != ch) {
|
||||||
GET_GOLD(k) += share;
|
increase_gold(k, share);
|
||||||
send_to_char(k, "%s", buf);
|
send_to_char(k, "%s", buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -554,8 +554,8 @@ ACMD(do_split)
|
||||||
(IN_ROOM(f->follower) == IN_ROOM(ch)) &&
|
(IN_ROOM(f->follower) == IN_ROOM(ch)) &&
|
||||||
f->follower != ch) {
|
f->follower != ch) {
|
||||||
|
|
||||||
GET_GOLD(f->follower) += share;
|
increase_gold(f->follower, share);
|
||||||
send_to_char(f->follower, "%s", buf);
|
send_to_char(f->follower, "%s", buf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
send_to_char(ch, "You split %d coins among %d members -- %d coins each.\r\n",
|
send_to_char(ch, "You split %d coins among %d members -- %d coins each.\r\n",
|
||||||
|
@ -564,7 +564,7 @@ ACMD(do_split)
|
||||||
if (rest) {
|
if (rest) {
|
||||||
send_to_char(ch, "%d coin%s %s not splitable, so you keep the money.\r\n",
|
send_to_char(ch, "%d coin%s %s not splitable, so you keep the money.\r\n",
|
||||||
rest, (rest == 1) ? "" : "s", (rest == 1) ? "was" : "were");
|
rest, (rest == 1) ? "" : "s", (rest == 1) ? "was" : "were");
|
||||||
GET_GOLD(ch) += rest;
|
increase_gold(ch, rest);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
send_to_char(ch, "How many coins do you wish to split with your group?\r\n");
|
send_to_char(ch, "How many coins do you wish to split with your group?\r\n");
|
||||||
|
|
181
src/act.wizard.c
181
src/act.wizard.c
|
@ -1689,6 +1689,7 @@ ACMD(do_admin)
|
||||||
/* Copy current flags */
|
/* Copy current flags */
|
||||||
for (i=0; i<AD_ARRAY_MAX; i++) tmp_adm[i] = ADM_FLAGS(vict)[i];
|
for (i=0; i<AD_ARRAY_MAX; i++) tmp_adm[i] = ADM_FLAGS(vict)[i];
|
||||||
set_default_admin_privs(vict, FALSE);
|
set_default_admin_privs(vict, FALSE);
|
||||||
|
send_to_char(ch, "%s", CONFIG_OK);
|
||||||
/* Compare for changed flags */
|
/* Compare for changed flags */
|
||||||
for (i=0; i<AD_ARRAY_MAX; i++) {
|
for (i=0; i<AD_ARRAY_MAX; i++) {
|
||||||
if (tmp_adm[i] != ADM_FLAGS(vict)[i]) {
|
if (tmp_adm[i] != ADM_FLAGS(vict)[i]) {
|
||||||
|
@ -1735,10 +1736,10 @@ ACMD(do_admin)
|
||||||
ACMD(do_advance)
|
ACMD(do_advance)
|
||||||
{
|
{
|
||||||
struct char_data *victim;
|
struct char_data *victim;
|
||||||
char name[MAX_INPUT_LENGTH], level[MAX_INPUT_LENGTH];
|
char name[MAX_INPUT_LENGTH], level[MAX_INPUT_LENGTH], *buf;
|
||||||
int newlevel, oldlevel, i;
|
int newlevel, oldlevel, i;
|
||||||
|
|
||||||
two_arguments(argument, name, level);
|
buf = two_arguments(argument, name, level);
|
||||||
|
|
||||||
if (*name) {
|
if (*name) {
|
||||||
if (!(victim = get_char_vis(ch, name, NULL, FIND_CHAR_WORLD))) {
|
if (!(victim = get_char_vis(ch, name, NULL, FIND_CHAR_WORLD))) {
|
||||||
|
@ -1746,8 +1747,9 @@ ACMD(do_advance)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
send_to_char(ch, "Usage: %sadvance <player> <admin level>%s\r\n", QYEL, QNRM);
|
send_to_char(ch, "Usage: %sadvance <player> <mortal level>%s\r\n", QYEL, QNRM);
|
||||||
send_to_char(ch, "%s<admin level>%s may be a level name (e.g. mortal) or number.\r\n", QYEL, QNRM);
|
send_to_char(ch, "Usage: %sadvance <player> admin <admin level>%s\r\n", QYEL, QNRM);
|
||||||
|
send_to_char(ch, "%s<admin level>%s may be a level name (e.g. immortal) or number.\r\n", QYEL, QNRM);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1763,65 +1765,116 @@ ACMD(do_advance)
|
||||||
send_to_char(ch, "You must specify a level!\r\n");
|
send_to_char(ch, "You must specify a level!\r\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ((newlevel = get_admin_level_by_string(level)) < 0) {
|
/* Set MORTAL Level */
|
||||||
send_to_char(ch, "That's not a level!\r\n");
|
if (!is_abbrev(level, "admin")) {
|
||||||
return;
|
if ((newlevel = atoi(level)) <= 0) {
|
||||||
}
|
send_to_char(ch, "That's not a valid mortal level!\r\n");
|
||||||
if (newlevel > ADMLVL_IMPL) {
|
return;
|
||||||
send_to_char(ch, "%s (level %d) is the highest possible admin level.\r\n", admin_level_names[ADMLVL_IMPL], ADMLVL_IMPL);
|
}
|
||||||
return;
|
if (newlevel > CONFIG_MAX_LEVEL) {
|
||||||
}
|
send_to_char(ch, "%d is the highest possible mortal level.\r\n", CONFIG_MAX_LEVEL);
|
||||||
if (newlevel > GET_ADMLEVEL(ch)) {
|
return;
|
||||||
send_to_char(ch, "Yeah, right.\r\n");
|
}
|
||||||
return;
|
if (!IS_ADMIN(ch, ADMLVL_GRGOD) && newlevel > GET_LEVEL(ch)) {
|
||||||
}
|
send_to_char(ch, "You can't set above your own mortal level.\r\n");
|
||||||
if (newlevel == GET_ADMLEVEL(victim)) {
|
return;
|
||||||
send_to_char(ch, "They are already at that level.\r\n");
|
}
|
||||||
return;
|
if (newlevel == GET_LEVEL(victim)) {
|
||||||
}
|
send_to_char(ch, "They are already at that mortal level.\r\n");
|
||||||
oldlevel = GET_ADMLEVEL(victim);
|
return;
|
||||||
if (newlevel < GET_ADMLEVEL(victim)) {
|
}
|
||||||
do_start(victim);
|
oldlevel = GET_LEVEL(victim);
|
||||||
send_to_char(victim, "You are momentarily enveloped by darkness!\r\nYou feel somewhat diminished.\r\n");
|
if (newlevel < GET_LEVEL(victim)) {
|
||||||
} else {
|
do_start(victim);
|
||||||
act("$n makes some strange gestures. A strange feeling comes upon you,\r\n"
|
GET_LEVEL(victim) = newlevel;
|
||||||
"Like a giant hand, light comes down from above, grabbing your body,\r\n"
|
send_to_char(victim, "You are momentarily enveloped by darkness!\r\nYou feel somewhat diminished.\r\n");
|
||||||
"that begins to pulse with colored lights from inside.\r\n\r\n"
|
} else {
|
||||||
"Your head seems to be filled with demons from another plane as\r\n"
|
act("$n makes some strange gestures. A strange feeling comes upon you,\r\n"
|
||||||
"your body dissolves to the elements of time and space itself.\r\n"
|
"Like a giant hand, light comes down from above, grabbing your body,\r\n"
|
||||||
"Suddenly a silent explosion of light snaps you back to reality.\r\n\r\n"
|
"that begins to pulse with colored lights from inside.\r\n\r\n"
|
||||||
"You feel slightly different.", FALSE, ch, 0, victim, TO_VICT);
|
"Your head seems to be filled with demons from another plane as\r\n"
|
||||||
}
|
"your body dissolves to the elements of time and space itself.\r\n"
|
||||||
|
"Suddenly a silent explosion of light snaps you back to reality.\r\n\r\n"
|
||||||
|
"You feel slightly different.", FALSE, ch, 0, victim, TO_VICT);
|
||||||
|
}
|
||||||
|
|
||||||
set_admin_level(victim, newlevel);
|
send_to_char(ch, "%s", CONFIG_OK);
|
||||||
send_to_char(ch, "%s", CONFIG_OK);
|
|
||||||
|
|
||||||
if (newlevel < oldlevel)
|
if (newlevel < oldlevel)
|
||||||
log("(GC) %s demoted %s from admin level %d to %d.",
|
log("(GC) %s demoted %s from mortal level %d to %d.",
|
||||||
GET_NAME(ch), GET_NAME(victim), oldlevel, newlevel);
|
GET_NAME(ch), GET_NAME(victim), oldlevel, newlevel);
|
||||||
else
|
else
|
||||||
log("(GC) %s has advanced %s to admin level %d (from %d)",
|
log("(GC) %s has advanced %s to mortal level %d (from %d)",
|
||||||
GET_NAME(ch), GET_NAME(victim), newlevel, oldlevel);
|
GET_NAME(ch), GET_NAME(victim), newlevel, oldlevel);
|
||||||
|
|
||||||
if (oldlevel >= ADMLVL_IMMORT && newlevel < ADMLVL_IMMORT) {
|
gain_exp_regardless(victim, level_exp(GET_CLASS(victim), newlevel) - GET_EXP(victim));
|
||||||
/* If they are no longer an immortal, remove the immortal only flags. */
|
|
||||||
REMOVE_BIT_AR(PRF_FLAGS(victim), PRF_LOG1);
|
} else { /* Set ADMIN Level */
|
||||||
REMOVE_BIT_AR(PRF_FLAGS(victim), PRF_LOG2);
|
one_argument(buf, level);
|
||||||
REMOVE_BIT_AR(PRF_FLAGS(victim), PRF_NOHASSLE);
|
|
||||||
REMOVE_BIT_AR(PRF_FLAGS(victim), PRF_HOLYLIGHT);
|
if (!*level) {
|
||||||
REMOVE_BIT_AR(PRF_FLAGS(victim), PRF_SHOWVNUMS);
|
send_to_char(ch, "You must specify a level!\r\n");
|
||||||
if (!PLR_FLAGGED(victim, PLR_NOWIZLIST))
|
return;
|
||||||
run_autowiz();
|
}
|
||||||
} else if (oldlevel < ADMLVL_IMMORT && newlevel >= ADMLVL_IMMORT) {
|
if ((newlevel = get_admin_level_by_string(level)) < 0) {
|
||||||
SET_BIT_AR(PRF_FLAGS(victim), PRF_LOG2);
|
send_to_char(ch, "That's not a level!\r\n");
|
||||||
SET_BIT_AR(PRF_FLAGS(victim), PRF_HOLYLIGHT);
|
return;
|
||||||
SET_BIT_AR(PRF_FLAGS(victim), PRF_SHOWVNUMS);
|
}
|
||||||
SET_BIT_AR(PRF_FLAGS(victim), PRF_AUTOEXIT);
|
if (newlevel > ADMLVL_IMPL) {
|
||||||
for (i = 1; i <= MAX_SKILLS; i++)
|
send_to_char(ch, "%s (level %d) is the highest possible admin level.\r\n", admin_level_names[ADMLVL_IMPL], ADMLVL_IMPL);
|
||||||
SET_SKILL(victim, i, 100);
|
return;
|
||||||
GET_OLC_ZONE(victim) = NOWHERE;
|
}
|
||||||
|
if (newlevel > GET_ADMLEVEL(ch)) {
|
||||||
|
send_to_char(ch, "Yeah, right.\r\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (newlevel == GET_ADMLEVEL(victim)) {
|
||||||
|
send_to_char(ch, "They are already at that level.\r\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
oldlevel = GET_ADMLEVEL(victim);
|
||||||
|
if (newlevel < GET_ADMLEVEL(victim)) {
|
||||||
|
do_start(victim);
|
||||||
|
send_to_char(victim, "You are momentarily enveloped by darkness!\r\nYou feel somewhat diminished.\r\n");
|
||||||
|
} else {
|
||||||
|
act("$n makes some strange gestures. A strange feeling comes upon you,\r\n"
|
||||||
|
"Like a giant hand, light comes down from above, grabbing your body,\r\n"
|
||||||
|
"that begins to pulse with colored lights from inside.\r\n\r\n"
|
||||||
|
"Your head seems to be filled with demons from another plane as\r\n"
|
||||||
|
"your body dissolves to the elements of time and space itself.\r\n"
|
||||||
|
"Suddenly a silent explosion of light snaps you back to reality.\r\n\r\n"
|
||||||
|
"You feel slightly different.", FALSE, ch, 0, victim, TO_VICT);
|
||||||
|
}
|
||||||
|
|
||||||
|
set_admin_level(victim, newlevel);
|
||||||
|
send_to_char(ch, "%s", CONFIG_OK);
|
||||||
|
|
||||||
|
if (newlevel < oldlevel)
|
||||||
|
log("(GC) %s demoted %s from admin level %d to %d.",
|
||||||
|
GET_NAME(ch), GET_NAME(victim), oldlevel, newlevel);
|
||||||
|
else
|
||||||
|
log("(GC) %s has advanced %s to admin level %d (from %d)",
|
||||||
|
GET_NAME(ch), GET_NAME(victim), newlevel, oldlevel);
|
||||||
|
|
||||||
|
if (oldlevel >= ADMLVL_IMMORT && newlevel < ADMLVL_IMMORT) {
|
||||||
|
/* If they are no longer an immortal, remove the immortal only flags. */
|
||||||
|
REMOVE_BIT_AR(PRF_FLAGS(victim), PRF_LOG1);
|
||||||
|
REMOVE_BIT_AR(PRF_FLAGS(victim), PRF_LOG2);
|
||||||
|
REMOVE_BIT_AR(PRF_FLAGS(victim), PRF_NOHASSLE);
|
||||||
|
REMOVE_BIT_AR(PRF_FLAGS(victim), PRF_HOLYLIGHT);
|
||||||
|
REMOVE_BIT_AR(PRF_FLAGS(victim), PRF_SHOWVNUMS);
|
||||||
|
if (!PLR_FLAGGED(victim, PLR_NOWIZLIST))
|
||||||
|
run_autowiz();
|
||||||
|
} else if (oldlevel < ADMLVL_IMMORT && newlevel >= ADMLVL_IMMORT) {
|
||||||
|
SET_BIT_AR(PRF_FLAGS(victim), PRF_LOG2);
|
||||||
|
SET_BIT_AR(PRF_FLAGS(victim), PRF_HOLYLIGHT);
|
||||||
|
SET_BIT_AR(PRF_FLAGS(victim), PRF_SHOWVNUMS);
|
||||||
|
SET_BIT_AR(PRF_FLAGS(victim), PRF_AUTOEXIT);
|
||||||
|
for (i = 1; i <= MAX_SKILLS; i++)
|
||||||
|
SET_SKILL(victim, i, 100);
|
||||||
|
GET_OLC_ZONE(victim) = NOWHERE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
save_char(victim);
|
save_char(victim);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3119,7 +3172,7 @@ static int perform_set(struct char_data *ch, struct char_data *vict, int mode, c
|
||||||
break;
|
break;
|
||||||
case 2: /* admlevel */
|
case 2: /* admlevel */
|
||||||
if ((IS_NPC(vict) || value > GET_ADMLEVEL(ch)) || value > ADMLVL_IMPL) {
|
if ((IS_NPC(vict) || value > GET_ADMLEVEL(ch)) || value > ADMLVL_IMPL) {
|
||||||
send_to_char(ch, "You can't do that.\r\n");
|
send_to_char(ch, "You can't set above your own admin level.\r\n");
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
RANGE(1, ADMLVL_IMPL);
|
RANGE(1, ADMLVL_IMPL);
|
||||||
|
@ -3262,8 +3315,12 @@ static int perform_set(struct char_data *ch, struct char_data *vict, int mode, c
|
||||||
SET_OR_REMOVE(PLR_FLAGS(vict), PLR_KILLER);
|
SET_OR_REMOVE(PLR_FLAGS(vict), PLR_KILLER);
|
||||||
break;
|
break;
|
||||||
case 26: /* level */
|
case 26: /* level */
|
||||||
if ((!IS_NPC(vict) && value > GET_LEVEL(ch)) || value > CONFIG_MAX_LEVEL) {
|
if (!IS_NPC(vict) && !IS_ADMIN(ch, ADMLVL_GRGOD)) {
|
||||||
send_to_char(ch, "You can't do that.\r\n");
|
if (value > GET_LEVEL(ch)) {
|
||||||
|
send_to_char(ch, "You can't set higher than your own level.\r\n");
|
||||||
|
} else if (value > CONFIG_MAX_LEVEL) {
|
||||||
|
send_to_char(ch, "Maximum level is %d.\r\n", CONFIG_MAX_LEVEL);
|
||||||
|
}
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
RANGE(1, CONFIG_MAX_LEVEL);
|
RANGE(1, CONFIG_MAX_LEVEL);
|
||||||
|
|
|
@ -670,7 +670,7 @@ void find_replacement(void *go, struct script_data *sc, trig_data *trig,
|
||||||
if (!str_cmp(field, "gold")) {
|
if (!str_cmp(field, "gold")) {
|
||||||
if (subfield && *subfield) {
|
if (subfield && *subfield) {
|
||||||
int addition = atoi(subfield);
|
int addition = atoi(subfield);
|
||||||
GET_GOLD(c) += addition;
|
increase_gold(c, addition);
|
||||||
}
|
}
|
||||||
snprintf(str, slen, "%d", GET_GOLD(c));
|
snprintf(str, slen, "%d", GET_GOLD(c));
|
||||||
}
|
}
|
||||||
|
|
|
@ -837,7 +837,7 @@ int damage(struct char_data *ch, struct char_data *victim, int dam, int attackty
|
||||||
{
|
{
|
||||||
happy_gold = (long)(GET_GOLD(victim) * (((float)(HAPPY_GOLD))/(float)100));
|
happy_gold = (long)(GET_GOLD(victim) * (((float)(HAPPY_GOLD))/(float)100));
|
||||||
happy_gold = MAX(0, happy_gold);
|
happy_gold = MAX(0, happy_gold);
|
||||||
GET_GOLD(victim) += happy_gold;
|
increase_gold(victim, happy_gold);
|
||||||
}
|
}
|
||||||
local_gold = GET_GOLD(victim);
|
local_gold = GET_GOLD(victim);
|
||||||
sprintf(local_buf,"%ld", (long)local_gold);
|
sprintf(local_buf,"%ld", (long)local_gold);
|
||||||
|
|
61
src/limits.c
61
src/limits.c
|
@ -20,6 +20,7 @@
|
||||||
#include "dg_scripts.h"
|
#include "dg_scripts.h"
|
||||||
#include "class.h"
|
#include "class.h"
|
||||||
#include "fight.h"
|
#include "fight.h"
|
||||||
|
#include "screen.h"
|
||||||
|
|
||||||
/* local file scope function prototypes */
|
/* local file scope function prototypes */
|
||||||
static int graf(int grafage, int p0, int p1, int p2, int p3, int p4, int p5, int p6);
|
static int graf(int grafage, int p0, int p1, int p2, int p3, int p4, int p5, int p6);
|
||||||
|
@ -474,3 +475,63 @@ void point_update(void)
|
||||||
game_info("Happy hour has ended!");
|
game_info("Happy hour has ended!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Note: amt may be negative */
|
||||||
|
int increase_gold(struct char_data *ch, int amt)
|
||||||
|
{
|
||||||
|
int curr_gold;
|
||||||
|
|
||||||
|
curr_gold = GET_GOLD(ch);
|
||||||
|
|
||||||
|
if (amt < 0) {
|
||||||
|
GET_GOLD(ch) = MAX(0, curr_gold+amt);
|
||||||
|
/* Validate to prevent overflow */
|
||||||
|
if (GET_GOLD(ch) > curr_gold) GET_GOLD(ch) = 0;
|
||||||
|
} else {
|
||||||
|
GET_GOLD(ch) = MIN(MAX_GOLD, curr_gold+amt);
|
||||||
|
/* Validate to prevent overflow */
|
||||||
|
if (GET_GOLD(ch) < curr_gold) GET_GOLD(ch) = MAX_GOLD;
|
||||||
|
}
|
||||||
|
if (GET_GOLD(ch) == MAX_GOLD)
|
||||||
|
send_to_char(ch, "%sYou have reached the maximum gold!\r\n%sYou must spend it or bank it before you can gain any more.\r\n", QBRED, QNRM);
|
||||||
|
|
||||||
|
return (GET_GOLD(ch));
|
||||||
|
}
|
||||||
|
|
||||||
|
int decrease_gold(struct char_data *ch, int deduction)
|
||||||
|
{
|
||||||
|
int amt;
|
||||||
|
amt = (deduction * -1);
|
||||||
|
increase_gold(ch, amt);
|
||||||
|
return (GET_GOLD(ch));
|
||||||
|
}
|
||||||
|
|
||||||
|
int increase_bank(struct char_data *ch, int amt)
|
||||||
|
{
|
||||||
|
int curr_bank;
|
||||||
|
|
||||||
|
if (IS_NPC(ch)) return 0;
|
||||||
|
|
||||||
|
curr_bank = GET_BANK_GOLD(ch);
|
||||||
|
|
||||||
|
if (amt < 0) {
|
||||||
|
GET_BANK_GOLD(ch) = MAX(0, curr_bank+amt);
|
||||||
|
/* Validate to prevent overflow */
|
||||||
|
if (GET_BANK_GOLD(ch) > curr_bank) GET_BANK_GOLD(ch) = 0;
|
||||||
|
} else {
|
||||||
|
GET_BANK_GOLD(ch) = MIN(MAX_BANK, curr_bank+amt);
|
||||||
|
/* Validate to prevent overflow */
|
||||||
|
if (GET_BANK_GOLD(ch) < curr_bank) GET_BANK_GOLD(ch) = MAX_BANK;
|
||||||
|
}
|
||||||
|
if (GET_BANK_GOLD(ch) == MAX_BANK)
|
||||||
|
send_to_char(ch, "%sYou have reached the maximum bank balance!\r\n%sYou cannot put more into your account unless you withdraw some first.\r\n", QBRED, QNRM);
|
||||||
|
return (GET_BANK_GOLD(ch));
|
||||||
|
}
|
||||||
|
|
||||||
|
int decrease_bank(struct char_data *ch, int deduction)
|
||||||
|
{
|
||||||
|
int amt;
|
||||||
|
amt = (deduction * -1);
|
||||||
|
increase_bank(ch, amt);
|
||||||
|
return (GET_BANK_GOLD(ch));
|
||||||
|
}
|
||||||
|
|
|
@ -313,7 +313,7 @@ static void postmaster_send_mail(struct char_data *ch, struct char_data *mailman
|
||||||
act(buf, FALSE, mailman, 0, ch, TO_VICT);
|
act(buf, FALSE, mailman, 0, ch, TO_VICT);
|
||||||
|
|
||||||
if (!ADM_FLAGGED(ch, ADM_MONEY))
|
if (!ADM_FLAGGED(ch, ADM_MONEY))
|
||||||
GET_GOLD(ch) -= STAMP_PRICE;
|
decrease_gold(ch, STAMP_PRICE);
|
||||||
|
|
||||||
SET_BIT_AR(PLR_FLAGS(ch), PLR_MAILING); /* string_write() sets writing. */
|
SET_BIT_AR(PLR_FLAGS(ch), PLR_MAILING); /* string_write() sets writing. */
|
||||||
|
|
||||||
|
|
|
@ -315,12 +315,12 @@ void generic_complete_quest(struct char_data *ch)
|
||||||
if ((IS_HAPPYHOUR) && (IS_HAPPYGOLD)) {
|
if ((IS_HAPPYHOUR) && (IS_HAPPYGOLD)) {
|
||||||
happy_gold = (int)(QST_GOLD(rnum) * (((float)(100+HAPPY_GOLD))/(float)100));
|
happy_gold = (int)(QST_GOLD(rnum) * (((float)(100+HAPPY_GOLD))/(float)100));
|
||||||
happy_gold = MAX(happy_gold, 0);
|
happy_gold = MAX(happy_gold, 0);
|
||||||
GET_GOLD(ch) += happy_gold;
|
increase_gold(ch, happy_gold);
|
||||||
send_to_char(ch,
|
send_to_char(ch,
|
||||||
"You have been awarded %d gold coins for your service.\r\n",
|
"You have been awarded %d gold coins for your service.\r\n",
|
||||||
happy_gold);
|
happy_gold);
|
||||||
} else {
|
} else {
|
||||||
GET_GOLD(ch) += QST_GOLD(rnum);
|
increase_gold(ch, QST_GOLD(rnum));
|
||||||
send_to_char(ch,
|
send_to_char(ch,
|
||||||
"You have been awarded %d gold coins for your service.\r\n",
|
"You have been awarded %d gold coins for your service.\r\n",
|
||||||
QST_GOLD(rnum));
|
QST_GOLD(rnum));
|
||||||
|
|
10
src/shop.c
10
src/shop.c
|
@ -583,7 +583,7 @@ static void shopping_buy(char *arg, struct char_data *ch, struct char_data *keep
|
||||||
charged = buy_price(obj, shop_nr, keeper, ch);
|
charged = buy_price(obj, shop_nr, keeper, ch);
|
||||||
goldamt += charged;
|
goldamt += charged;
|
||||||
if (!ADM_FLAGGED(ch, ADM_MONEY))
|
if (!ADM_FLAGGED(ch, ADM_MONEY))
|
||||||
GET_GOLD(ch) -= charged;
|
decrease_gold(ch, charged);
|
||||||
|
|
||||||
last_obj = obj;
|
last_obj = obj;
|
||||||
obj = get_purchase_obj(ch, arg, keeper, shop_nr, FALSE);
|
obj = get_purchase_obj(ch, arg, keeper, shop_nr, FALSE);
|
||||||
|
@ -612,7 +612,7 @@ static void shopping_buy(char *arg, struct char_data *ch, struct char_data *keep
|
||||||
do_tell(keeper, buf, cmd_tell, 0);
|
do_tell(keeper, buf, cmd_tell, 0);
|
||||||
}
|
}
|
||||||
if (!IS_GOD(ch) && obj && !OBJ_FLAGGED(obj, ITEM_QUEST)) {
|
if (!IS_GOD(ch) && obj && !OBJ_FLAGGED(obj, ITEM_QUEST)) {
|
||||||
GET_GOLD(keeper) += goldamt;
|
increase_gold(keeper, goldamt);
|
||||||
if (SHOP_USES_BANK(shop_nr))
|
if (SHOP_USES_BANK(shop_nr))
|
||||||
if (GET_GOLD(keeper) > MAX_OUTSIDE_BANK) {
|
if (GET_GOLD(keeper) > MAX_OUTSIDE_BANK) {
|
||||||
SHOP_BANK(shop_nr) += (GET_GOLD(keeper) - MAX_OUTSIDE_BANK);
|
SHOP_BANK(shop_nr) += (GET_GOLD(keeper) - MAX_OUTSIDE_BANK);
|
||||||
|
@ -773,7 +773,7 @@ static void shopping_sell(char *arg, struct char_data *ch, struct char_data *kee
|
||||||
|
|
||||||
goldamt += charged;
|
goldamt += charged;
|
||||||
if (!IS_SET(SHOP_BITVECTOR(shop_nr), HAS_UNLIMITED_CASH))
|
if (!IS_SET(SHOP_BITVECTOR(shop_nr), HAS_UNLIMITED_CASH))
|
||||||
GET_GOLD(keeper) -= charged;
|
decrease_gold(keeper, charged);
|
||||||
|
|
||||||
sold++;
|
sold++;
|
||||||
obj_from_char(obj);
|
obj_from_char(obj);
|
||||||
|
@ -793,7 +793,7 @@ static void shopping_sell(char *arg, struct char_data *ch, struct char_data *kee
|
||||||
|
|
||||||
do_tell(keeper, buf, cmd_tell, 0);
|
do_tell(keeper, buf, cmd_tell, 0);
|
||||||
}
|
}
|
||||||
GET_GOLD(ch) += goldamt;
|
increase_gold(ch, goldamt);
|
||||||
|
|
||||||
strlcpy(tempstr, times_message(0, name, sold), sizeof(tempstr));
|
strlcpy(tempstr, times_message(0, name, sold), sizeof(tempstr));
|
||||||
snprintf(tempbuf, sizeof(tempbuf), "$n sells %s.", tempstr);
|
snprintf(tempbuf, sizeof(tempbuf), "$n sells %s.", tempstr);
|
||||||
|
@ -807,7 +807,7 @@ static void shopping_sell(char *arg, struct char_data *ch, struct char_data *kee
|
||||||
if (GET_GOLD(keeper) < MIN_OUTSIDE_BANK) {
|
if (GET_GOLD(keeper) < MIN_OUTSIDE_BANK) {
|
||||||
goldamt = MIN(MAX_OUTSIDE_BANK - GET_GOLD(keeper), SHOP_BANK(shop_nr));
|
goldamt = MIN(MAX_OUTSIDE_BANK - GET_GOLD(keeper), SHOP_BANK(shop_nr));
|
||||||
SHOP_BANK(shop_nr) -= goldamt;
|
SHOP_BANK(shop_nr) -= goldamt;
|
||||||
GET_GOLD(keeper) += goldamt;
|
increase_gold(keeper, goldamt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -193,7 +193,7 @@ SPECIAL(dump)
|
||||||
if (GET_LEVEL(ch) < 3)
|
if (GET_LEVEL(ch) < 3)
|
||||||
gain_exp(ch, value);
|
gain_exp(ch, value);
|
||||||
else
|
else
|
||||||
GET_GOLD(ch) += value;
|
increase_gold(ch, value);
|
||||||
}
|
}
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
|
@ -311,8 +311,8 @@ static void npc_steal(struct char_data *ch, struct char_data *victim)
|
||||||
/* Steal some gold coins */
|
/* Steal some gold coins */
|
||||||
gold = (GET_GOLD(victim) * rand_number(1, 10)) / 100;
|
gold = (GET_GOLD(victim) * rand_number(1, 10)) / 100;
|
||||||
if (gold > 0) {
|
if (gold > 0) {
|
||||||
GET_GOLD(ch) += gold;
|
increase_gold(ch, gold);
|
||||||
GET_GOLD(victim) -= gold;
|
decrease_gold(victim, gold);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -621,7 +621,7 @@ SPECIAL(pet_shops)
|
||||||
send_to_char(ch, "You don't have enough gold!\r\n");
|
send_to_char(ch, "You don't have enough gold!\r\n");
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
GET_GOLD(ch) -= PET_PRICE(pet);
|
decrease_gold(ch, PET_PRICE(pet));
|
||||||
|
|
||||||
pet = read_mobile(GET_MOB_RNUM(pet), REAL);
|
pet = read_mobile(GET_MOB_RNUM(pet), REAL);
|
||||||
GET_EXP(pet) = 0;
|
GET_EXP(pet) = 0;
|
||||||
|
@ -674,8 +674,8 @@ SPECIAL(bank)
|
||||||
send_to_char(ch, "You don't have that many coins!\r\n");
|
send_to_char(ch, "You don't have that many coins!\r\n");
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
GET_GOLD(ch) -= amount;
|
decrease_gold(ch, amount);
|
||||||
GET_BANK_GOLD(ch) += amount;
|
increase_bank(ch, amount);
|
||||||
send_to_char(ch, "You deposit %d coins.\r\n", amount);
|
send_to_char(ch, "You deposit %d coins.\r\n", amount);
|
||||||
act("$n makes a bank transaction.", TRUE, ch, 0, FALSE, TO_ROOM);
|
act("$n makes a bank transaction.", TRUE, ch, 0, FALSE, TO_ROOM);
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
|
@ -688,8 +688,8 @@ SPECIAL(bank)
|
||||||
send_to_char(ch, "You don't have that many coins deposited!\r\n");
|
send_to_char(ch, "You don't have that many coins deposited!\r\n");
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
GET_GOLD(ch) += amount;
|
increase_gold(ch, amount);
|
||||||
GET_BANK_GOLD(ch) -= amount;
|
decrease_bank(ch, amount);
|
||||||
send_to_char(ch, "You withdraw %d coins.\r\n", amount);
|
send_to_char(ch, "You withdraw %d coins.\r\n", amount);
|
||||||
act("$n makes a bank transaction.", TRUE, ch, 0, FALSE, TO_ROOM);
|
act("$n makes a bank transaction.", TRUE, ch, 0, FALSE, TO_ROOM);
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
|
|
|
@ -642,6 +642,9 @@
|
||||||
#define MAX_HELP_ENTRY MAX_STRING_LENGTH /**< Max size of help entry */
|
#define MAX_HELP_ENTRY MAX_STRING_LENGTH /**< Max size of help entry */
|
||||||
#define MAX_COMPLETED_QUESTS 1024 /**< Maximum number of completed quests allowed */
|
#define MAX_COMPLETED_QUESTS 1024 /**< Maximum number of completed quests allowed */
|
||||||
|
|
||||||
|
#define MAX_GOLD 2140000000 /**< Maximum possible on hand gold (2.14 Billion) */
|
||||||
|
#define MAX_BANK 2140000000 /**< Maximum possible in bank gold (2.14 Billion) */
|
||||||
|
|
||||||
/** Define the largest set of commands for a trigger.
|
/** Define the largest set of commands for a trigger.
|
||||||
* 16k should be plenty and then some. */
|
* 16k should be plenty and then some. */
|
||||||
#define MAX_CMD_LENGTH 16384
|
#define MAX_CMD_LENGTH 16384
|
||||||
|
|
|
@ -130,6 +130,10 @@ void gain_condition(struct char_data *ch, int condition, int value);
|
||||||
void point_update(void);
|
void point_update(void);
|
||||||
void update_pos(struct char_data *victim);
|
void update_pos(struct char_data *victim);
|
||||||
void run_autowiz(void);
|
void run_autowiz(void);
|
||||||
|
int increase_gold(struct char_data *ch, int amt);
|
||||||
|
int decrease_gold(struct char_data *ch, int amt);
|
||||||
|
int increase_bank(struct char_data *ch, int amt);
|
||||||
|
int decrease_bank(struct char_data *ch, int amt);
|
||||||
|
|
||||||
/* in class.c */
|
/* in class.c */
|
||||||
void advance_level(struct char_data *ch);
|
void advance_level(struct char_data *ch);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue