Skip to content

Commit

Permalink
statcap revisions + command
Browse files Browse the repository at this point in the history
  • Loading branch information
moshehbenavraham committed Sep 26, 2022
1 parent 3e53c21 commit cd745c1
Show file tree
Hide file tree
Showing 6 changed files with 149 additions and 40 deletions.
1 change: 1 addition & 0 deletions act.h
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ ACMD_DECL(do_examine);
ACMD_DECL(do_exits);
ACMD_DECL(do_survey);
ACMD_DECL(do_gold);
ACMD_DECL(do_statcap);
ACMD_DECL(do_help);
ACMD_DECL(do_history);
ACMD_DECL(do_inventory);
Expand Down
7 changes: 7 additions & 0 deletions act.informative.c
Original file line number Diff line number Diff line change
Expand Up @@ -2535,6 +2535,13 @@ ACMD(do_examine)
}
}

/* command to check your stat caps! */
ACMD(do_statcap)
{
compute_char_cap(ch, 1);
}

/* commnand to check your gold balance! */
ACMD(do_gold)
{
if (GET_GOLD(ch) == 0)
Expand Down
27 changes: 17 additions & 10 deletions act.other.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ void show_exchange_rates(struct char_data *ch)

void show_exchange_rates(struct char_data *ch)
{
send_to_char(ch, "Usage: cexchange <currency source> <amount to purchase>\r\n");
send_to_char(ch, "Usage: cexchange <currency source> <amount to purchase of exchange currency>\r\n");
send_to_char(ch, "This command is used to exchange in-game currencies including your "
"experience points, gold coins, account experience or quest points.\r\n");
send_to_char(ch, "The exchange order is: exp -> accexp -> gold -> qp -> (back to start) exp -> ...\r\n");
Expand Down Expand Up @@ -150,7 +150,6 @@ ACMD(do_cexchange)

if (!*arg1 || !*arg2)
{
send_to_char(ch, "You need to provide more information.\r\n");
show_exchange_rates(ch);
return;
}
Expand All @@ -159,17 +158,17 @@ ACMD(do_cexchange)

if (!is_number(arg2))
{
send_to_char(ch, "The third argument is invalid, it needs to be a number.\r\n");
show_exchange_rates(ch);
send_to_char(ch, "The second argument is invalid, it needs to be a number.\r\n");
return;
}

amount = atoi(arg2);

if (amount <= 0.0)
{
send_to_char(ch, "The second argument needs to be above 0.\r\n");
show_exchange_rates(ch);
send_to_char(ch, "The second argument needs to be above 0.\r\n");
return;
}

Expand All @@ -191,8 +190,8 @@ ACMD(do_cexchange)
}
else
{
send_to_char(ch, "The first argument is invalid.\r\n");
show_exchange_rates(ch);
send_to_char(ch, "The first argument is invalid or missing.\r\n");
return;
}

Expand Down Expand Up @@ -252,7 +251,8 @@ ACMD(do_cexchange)
/* can we afford it? if so, go ahead and make exchange */
if ((float)GET_ACCEXP_DESC(ch) < cost)
{
send_to_char(ch, "You do not have enough account exp, you need %d total.\r\n", (int)cost);
send_to_char(ch, "You do not have enough account exp, you need %d total (you have %d).\r\n",
(int)cost, GET_ACCEXP_DESC(ch));
return;
}

Expand All @@ -279,8 +279,8 @@ ACMD(do_cexchange)
if ((float)GET_GOLD(ch) < cost)
{
send_to_char(ch, "You do not have enough gold on hand, you need %d total on "
"hand (not in bank) to make the exchange.\r\n",
(int)cost);
"hand (not in bank) to make the exchange (you have %d).\r\n",
(int)cost, GET_GOLD(ch));
return;
}

Expand All @@ -293,6 +293,12 @@ ACMD(do_cexchange)

case SRC_DST_QP:

if (GET_LEVEL(ch) < (LVL_IMMORT - 1))
{
send_to_char(ch, "This exchange is reserved for level 30 chars!\r\n");
return;
}

/* amount limitation */
if (amount >= 1000000000)
{
Expand Down Expand Up @@ -323,7 +329,8 @@ ACMD(do_cexchange)
/* can we afford it? if so, go ahead and make exchange */
if ((float)GET_QUESTPOINTS(ch) < cost)
{
send_to_char(ch, "You do not have enough quest points, you need %d total.\r\n", (int)cost);
send_to_char(ch, "You do not have enough quest points, you need %d total (you have %d).\r\n",
(int)cost, GET_QUESTPOINTS(ch));
return;
}

Expand All @@ -336,7 +343,7 @@ ACMD(do_cexchange)

default: /* should never get here */
show_exchange_rates(ch);
send_to_char(ch, "Please report to staff: reached default case in 1st exchange switch in do_cexchange.\r\n");
send_to_char(ch, "Please report to staff: reached default case in exchange switch in do_cexchange.\r\n");
return;
}

Expand Down
Loading

0 comments on commit cd745c1

Please sign in to comment.