mirror of
https://github.com/tbamud/tbamud.git
synced 2026-04-05 03:47:20 +02:00
Remove happy hour
This commit is contained in:
parent
f6339b495e
commit
9ce2340f7d
12 changed files with 15 additions and 228 deletions
|
|
@ -239,7 +239,6 @@ ACMD(do_use);
|
|||
/* Functions without subcommands */
|
||||
ACMD(do_display);
|
||||
ACMD(do_group);
|
||||
ACMD(do_happyhour);
|
||||
ACMD(do_hide);
|
||||
ACMD(do_not_here);
|
||||
ACMD(do_practice);
|
||||
|
|
|
|||
|
|
@ -1361,9 +1361,6 @@ ACMD(do_who)
|
|||
else
|
||||
send_to_char(ch, "%d characters displayed.\r\n", num_can_see);
|
||||
|
||||
if (IS_HAPPYHOUR > 0){
|
||||
send_to_char(ch, "It's a Happy Hour! Type \tRhappyhour\tW to see the current bonuses.\r\n");
|
||||
}
|
||||
}
|
||||
|
||||
#define USERS_FORMAT \
|
||||
|
|
|
|||
115
src/act.other.c
115
src/act.other.c
|
|
@ -855,117 +855,4 @@ ACMD(do_gen_tog)
|
|||
send_to_char(ch, "%s", tog_messages[subcmd][TOG_OFF]);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static void show_happyhour(struct char_data *ch)
|
||||
{
|
||||
char happyexp[80], happygold[80], happyqp[80];
|
||||
int secs_left;
|
||||
|
||||
if ((IS_HAPPYHOUR) || (GET_LEVEL(ch) >= LVL_GRGOD))
|
||||
{
|
||||
if (HAPPY_TIME)
|
||||
secs_left = ((HAPPY_TIME - 1) * SECS_PER_MUD_HOUR) + next_tick;
|
||||
else
|
||||
secs_left = 0;
|
||||
|
||||
sprintf(happyqp, "%s+%d%%%s to Questpoints per quest\r\n", CCYEL(ch, C_NRM), HAPPY_QP, CCNRM(ch, C_NRM));
|
||||
sprintf(happygold, "%s+%d%%%s to Gold gained per kill\r\n", CCYEL(ch, C_NRM), HAPPY_GOLD, CCNRM(ch, C_NRM));
|
||||
sprintf(happyexp, "%s+%d%%%s to Experience per kill\r\n", CCYEL(ch, C_NRM), HAPPY_EXP, CCNRM(ch, C_NRM));
|
||||
|
||||
send_to_char(ch, "tbaMUD Happy Hour!\r\n"
|
||||
"------------------\r\n"
|
||||
"%s%s%sTime Remaining: %s%d%s hours %s%d%s mins %s%d%s secs\r\n",
|
||||
(IS_HAPPYEXP || (GET_LEVEL(ch) >= LVL_GOD)) ? happyexp : "",
|
||||
(IS_HAPPYGOLD || (GET_LEVEL(ch) >= LVL_GOD)) ? happygold : "",
|
||||
(IS_HAPPYQP || (GET_LEVEL(ch) >= LVL_GOD)) ? happyqp : "",
|
||||
CCYEL(ch, C_NRM), (secs_left / 3600), CCNRM(ch, C_NRM),
|
||||
CCYEL(ch, C_NRM), (secs_left % 3600) / 60, CCNRM(ch, C_NRM),
|
||||
CCYEL(ch, C_NRM), (secs_left % 60), CCNRM(ch, C_NRM) );
|
||||
}
|
||||
else
|
||||
{
|
||||
send_to_char(ch, "Sorry, there is currently no happy hour!\r\n");
|
||||
}
|
||||
}
|
||||
|
||||
ACMD(do_happyhour)
|
||||
{
|
||||
char arg[MAX_INPUT_LENGTH], val[MAX_INPUT_LENGTH];
|
||||
int num;
|
||||
|
||||
if (GET_LEVEL(ch) < LVL_GOD)
|
||||
{
|
||||
show_happyhour(ch);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Only Imms get here, so check args */
|
||||
two_arguments(argument, arg, val);
|
||||
|
||||
if (is_abbrev(arg, "experience"))
|
||||
{
|
||||
num = MIN(MAX((atoi(val)), 0), 1000);
|
||||
HAPPY_EXP = num;
|
||||
send_to_char(ch, "Happy Hour Exp rate set to +%d%%\r\n", HAPPY_EXP);
|
||||
}
|
||||
else if ((is_abbrev(arg, "gold")) || (is_abbrev(arg, "coins")))
|
||||
{
|
||||
num = MIN(MAX((atoi(val)), 0), 1000);
|
||||
HAPPY_GOLD = num;
|
||||
send_to_char(ch, "Happy Hour Gold rate set to +%d%%\r\n", HAPPY_GOLD);
|
||||
}
|
||||
else if ((is_abbrev(arg, "time")) || (is_abbrev(arg, "ticks")))
|
||||
{
|
||||
num = MIN(MAX((atoi(val)), 0), 1000);
|
||||
if (HAPPY_TIME && !num)
|
||||
game_info("Happyhour has been stopped!");
|
||||
else if (!HAPPY_TIME && num)
|
||||
game_info("A Happyhour has started!");
|
||||
|
||||
HAPPY_TIME = num;
|
||||
send_to_char(ch, "Happy Hour Time set to %d ticks (%d hours %d mins and %d secs)\r\n",
|
||||
HAPPY_TIME,
|
||||
(HAPPY_TIME*SECS_PER_MUD_HOUR)/3600,
|
||||
((HAPPY_TIME*SECS_PER_MUD_HOUR)%3600) / 60,
|
||||
(HAPPY_TIME*SECS_PER_MUD_HOUR)%60 );
|
||||
}
|
||||
else if ((is_abbrev(arg, "qp")) || (is_abbrev(arg, "questpoints")))
|
||||
{
|
||||
num = MIN(MAX((atoi(val)), 0), 1000);
|
||||
HAPPY_QP = num;
|
||||
send_to_char(ch, "Happy Hour Questpoints rate set to +%d%%\r\n", HAPPY_QP);
|
||||
}
|
||||
else if (is_abbrev(arg, "show"))
|
||||
{
|
||||
show_happyhour(ch);
|
||||
}
|
||||
else if (is_abbrev(arg, "default"))
|
||||
{
|
||||
HAPPY_EXP = 100;
|
||||
HAPPY_GOLD = 50;
|
||||
HAPPY_QP = 50;
|
||||
HAPPY_TIME = 48;
|
||||
game_info("A Happyhour has started!");
|
||||
}
|
||||
else
|
||||
{
|
||||
send_to_char(ch, "Usage: %shappyhour %s- show usage (this info)\r\n"
|
||||
" %shappyhour show %s- display current settings (what mortals see)\r\n"
|
||||
" %shappyhour time <ticks> %s- set happyhour time and start timer\r\n"
|
||||
" %shappyhour qp <num> %s- set qp percentage gain\r\n"
|
||||
" %shappyhour exp <num> %s- set exp percentage gain\r\n"
|
||||
" %shappyhour gold <num> %s- set gold percentage gain\r\n"
|
||||
" \tyhappyhour default \tw- sets a default setting for happyhour\r\n\r\n"
|
||||
"Configure the happyhour settings and start a happyhour.\r\n"
|
||||
"Currently 1 hour IRL = %d ticks\r\n"
|
||||
"If no number is specified, 0 (off) is assumed.\r\nThe command \tyhappyhour time\tn will therefore stop the happyhour timer.\r\n",
|
||||
CCYEL(ch, C_NRM), CCNRM(ch, C_NRM),
|
||||
CCYEL(ch, C_NRM), CCNRM(ch, C_NRM),
|
||||
CCYEL(ch, C_NRM), CCNRM(ch, C_NRM),
|
||||
CCYEL(ch, C_NRM), CCNRM(ch, C_NRM),
|
||||
CCYEL(ch, C_NRM), CCNRM(ch, C_NRM),
|
||||
CCYEL(ch, C_NRM), CCNRM(ch, C_NRM),
|
||||
(3600 / SECS_PER_MUD_HOUR) );
|
||||
}
|
||||
}
|
||||
}
|
||||
2
src/db.c
2
src/db.c
|
|
@ -121,8 +121,6 @@ struct weather_data weather_info; /* the infomation about the weather */
|
|||
struct player_special_data dummy_mob; /* dummy spec area for mobs */
|
||||
struct reset_q_type reset_q; /* queue of zones to be reset */
|
||||
|
||||
struct happyhour happy_data = {0,0,0,0};
|
||||
|
||||
/* declaration of local (file scope) variables */
|
||||
static int converting = FALSE;
|
||||
|
||||
|
|
|
|||
3
src/db.h
3
src/db.h
|
|
@ -396,9 +396,6 @@ extern struct message_list fight_messages[MAX_MESSAGES];
|
|||
extern struct aq_data *aquest_table;
|
||||
extern qst_rnum total_quests;
|
||||
|
||||
/* Happyhour global */
|
||||
extern struct happyhour happy_data;
|
||||
|
||||
/* begin previously located in players.c, returned to db.c */
|
||||
extern struct player_index_element *player_table;
|
||||
extern int top_of_p_table;
|
||||
|
|
|
|||
|
|
@ -432,16 +432,6 @@ void find_replacement(void *go, struct script_data *sc, trig_data *trig,
|
|||
snprintf(str, slen, "%d",((num = atoi(field)) > 0) ? trgvar_in_room(num) : 0);
|
||||
return;
|
||||
}
|
||||
else if (!str_cmp(var, "happyhour")) {
|
||||
if (!str_cmp(field, "qp") && IS_HAPPYHOUR)
|
||||
snprintf(str, slen, "%d", HAPPY_QP);
|
||||
else if (!str_cmp(field, "exp") && IS_HAPPYHOUR)
|
||||
snprintf(str, slen, "%d", HAPPY_EXP);
|
||||
else if (!str_cmp(field, "gold") && IS_HAPPYHOUR)
|
||||
snprintf(str, slen, "%d", HAPPY_GOLD);
|
||||
else snprintf(str, slen, "%d", HAPPY_TIME);
|
||||
return;
|
||||
}
|
||||
else if (!str_cmp(var, "time")) {
|
||||
if (!str_cmp(field, "hour"))
|
||||
snprintf(str, slen, "%d", time_info.hours);
|
||||
|
|
|
|||
21
src/fight.c
21
src/fight.c
|
|
@ -310,12 +310,6 @@ static void perform_group_gain(struct char_data *ch, int base,
|
|||
|
||||
share = MIN(CONFIG_MAX_EXP_GAIN, MAX(1, base));
|
||||
|
||||
if ((IS_HAPPYHOUR) && (IS_HAPPYEXP))
|
||||
{
|
||||
/* This only reports the correct amount - the calc is done in gain_exp */
|
||||
hap_share = share + (int)((float)share * ((float)HAPPY_EXP / (float)(100)));
|
||||
share = MIN(CONFIG_MAX_EXP_GAIN, MAX(1, hap_share));
|
||||
}
|
||||
if (share > 1)
|
||||
send_to_char(ch, "You receive your share of experience -- %d points.\r\n", share);
|
||||
else
|
||||
|
|
@ -353,7 +347,7 @@ static void group_gain(struct char_data *ch, struct char_data *victim)
|
|||
|
||||
static void solo_gain(struct char_data *ch, struct char_data *victim)
|
||||
{
|
||||
int exp, happy_exp;
|
||||
int exp;
|
||||
|
||||
exp = MIN(CONFIG_MAX_EXP_GAIN, GET_EXP(victim) / 3);
|
||||
|
||||
|
|
@ -365,11 +359,6 @@ static void solo_gain(struct char_data *ch, struct char_data *victim)
|
|||
|
||||
exp = MAX(exp, 1);
|
||||
|
||||
if (IS_HAPPYHOUR && IS_HAPPYEXP) {
|
||||
happy_exp = exp + (int)((float)exp * ((float)HAPPY_EXP / (float)(100)));
|
||||
exp = MAX(happy_exp, 1);
|
||||
}
|
||||
|
||||
if (exp > 1)
|
||||
send_to_char(ch, "You receive %d experience points.\r\n", exp);
|
||||
else
|
||||
|
|
@ -587,7 +576,7 @@ int skill_message(int dam, struct char_data *ch, struct char_data *vict,
|
|||
* > 0 How much damage done. */
|
||||
int damage(struct char_data *ch, struct char_data *victim, int dam, int attacktype)
|
||||
{
|
||||
long local_gold = 0, happy_gold = 0;
|
||||
long local_gold = 0;
|
||||
char local_buf[256];
|
||||
struct char_data *tmp_char;
|
||||
struct obj_data *corpse_obj;
|
||||
|
|
@ -756,12 +745,6 @@ int damage(struct char_data *ch, struct char_data *victim, int dam, int attackty
|
|||
}
|
||||
/* Cant determine GET_GOLD on corpse, so do now and store */
|
||||
if (IS_NPC(victim)) {
|
||||
if ((IS_HAPPYHOUR) && (IS_HAPPYGOLD))
|
||||
{
|
||||
happy_gold = (long)(GET_GOLD(victim) * (((float)(HAPPY_GOLD))/(float)100));
|
||||
happy_gold = MAX(0, happy_gold);
|
||||
increase_gold(victim, happy_gold);
|
||||
}
|
||||
local_gold = GET_GOLD(victim);
|
||||
sprintf(local_buf,"%ld", (long)local_gold);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -167,7 +167,6 @@ cpp_extern const struct command_info cmd_info[] = {
|
|||
{ "gtell" , "gt" , POS_SLEEPING, do_gsay , 0, 0 },
|
||||
|
||||
{ "help" , "h" , POS_DEAD , do_help , 0, 0 },
|
||||
{ "happyhour", "ha" , POS_DEAD , do_happyhour, 0, 0 },
|
||||
{ "hedit" , "hedit" , POS_DEAD , do_oasis_hedit, LVL_GOD , 0 },
|
||||
{ "helpcheck", "helpch" , POS_DEAD , do_helpcheck, LVL_GOD, 0 },
|
||||
{ "hide" , "hi" , POS_RESTING , do_hide , 1, 0 },
|
||||
|
|
|
|||
16
src/limits.c
16
src/limits.c
|
|
@ -233,8 +233,6 @@ void gain_exp(struct char_data *ch, int gain)
|
|||
return;
|
||||
}
|
||||
if (gain > 0) {
|
||||
if ((IS_HAPPYHOUR) && (IS_HAPPYEXP))
|
||||
gain += (int)((float)gain * ((float)HAPPY_EXP / (float)(100)));
|
||||
|
||||
gain = MIN(CONFIG_MAX_EXP_GAIN, gain); /* put a cap on the max gain per kill */
|
||||
GET_EXP(ch) += gain;
|
||||
|
|
@ -272,9 +270,6 @@ void gain_exp_regardless(struct char_data *ch, int gain)
|
|||
int is_altered = FALSE;
|
||||
int num_levels = 0;
|
||||
|
||||
if ((IS_HAPPYHOUR) && (IS_HAPPYEXP))
|
||||
gain += (int)((float)gain * ((float)HAPPY_EXP / (float)(100)));
|
||||
|
||||
GET_EXP(ch) += gain;
|
||||
if (GET_EXP(ch) < 0)
|
||||
GET_EXP(ch) = 0;
|
||||
|
|
@ -457,17 +452,6 @@ void point_update(void)
|
|||
timer_otrigger(j);
|
||||
}
|
||||
}
|
||||
|
||||
/* Take 1 from the happy-hour tick counter, and end happy-hour if zero */
|
||||
if (HAPPY_TIME > 1) HAPPY_TIME--;
|
||||
else if (HAPPY_TIME == 1) /* Last tick - set everything back to zero */
|
||||
{
|
||||
HAPPY_QP = 0;
|
||||
HAPPY_EXP = 0;
|
||||
HAPPY_GOLD = 0;
|
||||
HAPPY_TIME = 0;
|
||||
game_info("Happy hour has ended!");
|
||||
}
|
||||
}
|
||||
|
||||
/* Note: amt may be negative */
|
||||
|
|
|
|||
50
src/quest.c
50
src/quest.c
|
|
@ -291,51 +291,25 @@ void generic_complete_quest(struct char_data *ch)
|
|||
qst_rnum rnum;
|
||||
qst_vnum vnum = GET_QUEST(ch);
|
||||
struct obj_data *new_obj;
|
||||
int happy_qp, happy_gold, happy_exp;
|
||||
|
||||
if (--GET_QUEST_COUNTER(ch) <= 0) {
|
||||
rnum = real_quest(vnum);
|
||||
if (IS_HAPPYHOUR && IS_HAPPYQP) {
|
||||
happy_qp = (int)(QST_POINTS(rnum) * (((float)(100+HAPPY_QP))/(float)100));
|
||||
happy_qp = MAX(happy_qp, 0);
|
||||
GET_QUESTPOINTS(ch) += happy_qp;
|
||||
send_to_char(ch,
|
||||
"%s\r\nYou have been awarded %d quest points for your service.\r\n",
|
||||
QST_DONE(rnum), happy_qp);
|
||||
} else {
|
||||
GET_QUESTPOINTS(ch) += QST_POINTS(rnum);
|
||||
send_to_char(ch,
|
||||
"%s\r\nYou have been awarded %d quest points for your service.\r\n",
|
||||
QST_DONE(rnum), QST_POINTS(rnum));
|
||||
}
|
||||
GET_QUESTPOINTS(ch) += QST_POINTS(rnum);
|
||||
send_to_char(ch,
|
||||
"%s\r\nYou have been awarded %d quest points for your service.\r\n",
|
||||
QST_DONE(rnum), QST_POINTS(rnum));
|
||||
|
||||
if (QST_GOLD(rnum)) {
|
||||
if ((IS_HAPPYHOUR) && (IS_HAPPYGOLD)) {
|
||||
happy_gold = (int)(QST_GOLD(rnum) * (((float)(100+HAPPY_GOLD))/(float)100));
|
||||
happy_gold = MAX(happy_gold, 0);
|
||||
increase_gold(ch, happy_gold);
|
||||
send_to_char(ch,
|
||||
"You have been awarded %d gold coins for your service.\r\n",
|
||||
happy_gold);
|
||||
} else {
|
||||
increase_gold(ch, QST_GOLD(rnum));
|
||||
send_to_char(ch,
|
||||
"You have been awarded %d gold coins for your service.\r\n",
|
||||
QST_GOLD(rnum));
|
||||
}
|
||||
increase_gold(ch, QST_GOLD(rnum));
|
||||
send_to_char(ch,
|
||||
"You have been awarded %d gold coins for your service.\r\n",
|
||||
QST_GOLD(rnum));
|
||||
}
|
||||
if (QST_EXP(rnum)) {
|
||||
gain_exp(ch, QST_EXP(rnum));
|
||||
if ((IS_HAPPYHOUR) && (IS_HAPPYEXP)) {
|
||||
happy_exp = (int)(QST_EXP(rnum) * (((float)(100+HAPPY_EXP))/(float)100));
|
||||
happy_exp = MAX(happy_exp, 0);
|
||||
send_to_char(ch,
|
||||
"You have been awarded %d experience for your service.\r\n",
|
||||
happy_exp);
|
||||
} else {
|
||||
send_to_char(ch,
|
||||
"You have been awarded %d experience points for your service.\r\n",
|
||||
QST_EXP(rnum));
|
||||
}
|
||||
send_to_char(ch,
|
||||
"You have been awarded %d experience points for your service.\r\n",
|
||||
QST_EXP(rnum));
|
||||
}
|
||||
if (QST_OBJ(rnum) && QST_OBJ(rnum) != NOTHING) {
|
||||
if (real_object(QST_OBJ(rnum)) != NOTHING) {
|
||||
|
|
|
|||
|
|
@ -1265,14 +1265,6 @@ struct guild_info_type
|
|||
int direction;
|
||||
};
|
||||
|
||||
/** Happy Hour Data */
|
||||
struct happyhour {
|
||||
int qp_rate;
|
||||
int exp_rate;
|
||||
int gold_rate;
|
||||
int ticks_left;
|
||||
};
|
||||
|
||||
/** structure for list of recent players (see 'recent' command) */
|
||||
struct recent_player
|
||||
{
|
||||
|
|
|
|||
13
src/utils.h
13
src/utils.h
|
|
@ -873,19 +873,6 @@ do \
|
|||
#define GROUP_LEADER(group) (group->leader)
|
||||
#define GROUP_FLAGS(group) (group->group_flags)
|
||||
|
||||
/* Happy-hour defines */
|
||||
#define IS_HAPPYQP (happy_data.qp_rate > 0)
|
||||
#define IS_HAPPYEXP (happy_data.exp_rate > 0)
|
||||
#define IS_HAPPYGOLD (happy_data.gold_rate > 0)
|
||||
|
||||
#define HAPPY_EXP happy_data.exp_rate
|
||||
#define HAPPY_GOLD happy_data.gold_rate
|
||||
#define HAPPY_QP happy_data.qp_rate
|
||||
|
||||
#define HAPPY_TIME happy_data.ticks_left
|
||||
|
||||
#define IS_HAPPYHOUR ((IS_HAPPYEXP || IS_HAPPYGOLD || IS_HAPPYQP) && (HAPPY_TIME > 0))
|
||||
|
||||
/* OS compatibility */
|
||||
#ifndef NULL
|
||||
/** Just in case NULL is not defined. */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue