Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions SQL/Migrations/add_favours.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
CREATE TABLE `pfiles_favours` (
`idnum` mediumint(5) unsigned default '0',
`number` smallint(3) unsigned default '0',
`questnum` mediumint(3) unsigned default '0',
`completed` boolean default FALSE,
KEY(`idnum`)
);
51 changes: 49 additions & 2 deletions src/act.informative.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ extern int find_sight(struct char_data *ch);
extern int belongs_to(struct char_data *ch, struct obj_data *obj);
extern int calculate_vehicle_entry_load(struct veh_data *veh);
extern unsigned int get_johnson_overall_max_rep(struct char_data *johnson);
extern unsigned int get_johnson_lowest_max_rep(struct char_data *johnson);
extern const char *get_crap_count_string(int crap_count, const char *default_color = "^n", bool screenreader = FALSE);
extern void display_gamba_ledger_leaderboard(struct char_data *ch);
const char *convert_and_write_string_to_file(const char *str, const char *path);
Expand Down Expand Up @@ -598,6 +599,46 @@ void list_veh_to_char(struct veh_data * list, struct char_data * ch)
}
}

void brief_list_veh_to_char(struct veh_data * list, struct char_data * ch)
{
int bikes, cars, trucks, drones;
struct veh_data *i;
for (i = list; i; i = i->next_veh) {
if (ch->in_veh != i && ch->char_specials.rigging != i) {
if (i->owner && GET_IDNUM(ch) == i->owner) {
show_veh_to_char(i, ch);
} else {
switch (i->type) {
case VEH_BIKE:
bikes++;
case VEH_CAR:
cars++;
case VEH_TRUCK:
trucks++;
case VEH_DRONE:
drones++;
default:
break;
}
}
}

send_to_char(ch, "There are also %d bikes, %d cars, %d trucks and %d drones here.", bikes, cars, trucks, drones);

if (i == i->next_veh) {
char errbuf[1000];
snprintf(errbuf, sizeof(errbuf), "SYSERR: Infinite loop in list_veh_to_char for %s (%ld) at %s (%ld). Breaking the list.",
GET_VEH_NAME(i),
i->veh_number,
GET_ROOM_NAME(get_veh_in_room(i)),
GET_ROOM_VNUM(get_veh_in_room(i)));
i->next_veh = NULL;
mudlog(errbuf, ch, LOG_SYSLOG, TRUE);
break;
}
}
}

bool items_are_visually_similar(struct obj_data *first, struct obj_data *second) {
if (!first || !second) {
mudlog("SYSERR: Received null object to items_are_visually_similar.", NULL, LOG_SYSLOG, TRUE);
Expand Down Expand Up @@ -1432,11 +1473,17 @@ void list_one_char(struct char_data * i, struct char_data * ch)
}
if (MOB_HAS_SPEC(i, johnson)) {
unsigned int max_rep = get_johnson_overall_max_rep(i);
unsigned int lowest_rep = get_johnson_lowest_max_rep(i);
if (max_rep >= GET_REP(ch) || max_rep >= 10000) {
snprintf(ENDOF(buf), sizeof(buf) - strlen(buf), "^y...%s%s might have a job for you.%s^n\r\n",
HSSH(i),
already_printed ? " also" : "",
SHOULD_SEE_TIPS(ch) ? " See ^YHELP JOB^y for instructions." : "");
} else if (GET_TKE(ch) >= NEWBIE_KARMA_THRESHOLD && lowest_rep < GET_REP(ch)) {
snprintf(ENDOF(buf), sizeof(buf) - strlen(buf), "^y...%s%s might need to call in a favor.^n\r\n",
HSSH(i),
already_printed ? " also" : "",
SHOULD_SEE_TIPS(ch) ? " See ^YHELP FAVOR^y for instructions." : "");
} else {
snprintf(ENDOF(buf), sizeof(buf) - strlen(buf), "^y...%s%s only has work for less-experienced 'runners.^n\r\n",
HSSH(i),
Expand Down Expand Up @@ -2093,7 +2140,7 @@ void look_in_veh(struct char_data * ch)
list_obj_to_char(veh->in_room->contents, ch, SHOW_MODE_ON_GROUND, FALSE, TRUE);
list_char_to_char(veh->in_room->people, ch);
CCHAR = "^y";
list_veh_to_char(veh->in_room->vehicles, ch);
brief_list_veh_to_char(veh->in_room->vehicles, ch);
if (PLR_FLAGGED(ch, PLR_REMOTE))
ch->in_room = was_in;
else
Expand Down Expand Up @@ -2436,7 +2483,7 @@ void look_at_room(struct char_data * ch, int ignore_brief, int is_quicklook)
list_obj_to_char(ch->in_room->contents, ch, SHOW_MODE_ON_GROUND, FALSE, TRUE);
list_char_to_char(ch->in_room->people, ch);
CCHAR = "^y";
list_veh_to_char(ch->in_room->vehicles, ch);
brief_list_veh_to_char(ch->in_room->vehicles, ch);
}

void peek_into_adjacent(struct char_data * ch, int dir)
Expand Down
6 changes: 4 additions & 2 deletions src/awake.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,8 @@ enum {
#define PLR_ADDITIONAL_SCRUTINY 56
#define PLR_RECEIVED_GHOUL_INDEX_DELTA 57 /* Player has had their ghoul index cost reset */
#define PLR_PAID_FOR_WHOTITLE 58
#define PLR_MAX 59
#define PLR_DOING_FAVOUR 59
#define PLR_MAX 60
// Adding something here? Add it to constants.cpp's player_bits too.


Expand Down Expand Up @@ -3154,7 +3155,8 @@ enum {
#define DIRTY_BIT_ECHOES 8
#define DIRTY_BIT_QUESTS 9
#define DIRTY_BIT_BULLETPANTS 10
#define NUM_DIRTY_BITS 11
#define DIRTY_BIT_FAVOURS 11
#define NUM_DIRTY_BITS 12


#define SMARTLINK_II_MODIFIER 3
Expand Down
2 changes: 2 additions & 0 deletions src/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ extern const char *CHARACTER_DELETED_NAME_FOR_SQL;
#define KARMA_GAIN_MULTIPLIER 2.0
#define NUYEN_GAIN_MULTIPLIER 2.0
#define GROUP_QUEST_REWARD_MULTIPLIER 1.5
#define FAVOURS_KARMA_MULTIPLIER 0.0
#define FAVOURS_NUYEN_MULTIPLIER 0.0

// How well should markets regenerate over time? (currently every 2 mins)
#define MAX_PAYDATA_MARKET_INCREASE_PER_TICK 250
Expand Down
1 change: 1 addition & 0 deletions src/constants.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,7 @@ const char *player_bits[] =
"STAFF_SCRUTINY",
"GHOUL_IDX_DONE",
"PAID_FOR_WHOTITLE",
"DOING_FAVOUR",
"\n"
};

Expand Down
8 changes: 8 additions & 0 deletions src/interpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -684,6 +684,8 @@ struct command_info cmd_info[] =

// TODO: Make this a rigging and matrix command too
{ "factions" , POS_MORTALLYW, do_factions, LVL_PRESIDENT, 0, ALLOWS_IDLE_REWARD },
{ "favors" , POS_DEAD , do_recap , 0, 0, BLOCKS_IDLE_REWARD },
{ "favours" , POS_DEAD , do_recap , 0, 0, BLOCKS_IDLE_REWARD },
{ "force" , POS_SLEEPING, do_force , LVL_EXECUTIVE, 0, BLOCKS_IDLE_REWARD },
{ "forceget" , POS_SLEEPING, do_forceget , LVL_PRESIDENT, 0, BLOCKS_IDLE_REWARD },
{ "forceput" , POS_SLEEPING, do_forceput , LVL_PRESIDENT, 0, BLOCKS_IDLE_REWARD },
Expand Down Expand Up @@ -1333,6 +1335,8 @@ struct command_info mtx_htr_info[] =
{ "look", 0, do_not_here, 0, 0, BLOCKS_IDLE_REWARD }, // shadows 'l' so people reflexively looking don't get DC'd from hitch session
{ "logoff", 0, do_logoff, 0, 0, BLOCKS_IDLE_REWARD },
{ "emote", 0, do_echo, 0, SCMD_EMOTE , BLOCKS_IDLE_REWARD },
{ "favors", 0, do_recap, 0, 0, BLOCKS_IDLE_REWARD },
{ "favours", 0, do_recap, 0, 0, BLOCKS_IDLE_REWARD },
{ ":", 0, do_echo, 0, SCMD_EMOTE , BLOCKS_IDLE_REWARD },
{ "exit", 0, do_logoff, 0, 0, BLOCKS_IDLE_REWARD },
{ "help", 0, do_help, 0, 0, BLOCKS_IDLE_REWARD },
Expand Down Expand Up @@ -1397,6 +1401,8 @@ struct command_info mtx_info[] =
{ "emote", 0, do_echo, 0, SCMD_EMOTE , BLOCKS_IDLE_REWARD },
{ ":", 0, do_echo, 0, SCMD_EMOTE , BLOCKS_IDLE_REWARD },
{ "exit", 0, do_logoff, 0, 0, BLOCKS_IDLE_REWARD },
{ "favors", 0, do_recap, 0, 0, BLOCKS_IDLE_REWARD },
{ "favours", 0, do_recap, 0, 0, BLOCKS_IDLE_REWARD },
{ "hangup", 0, do_comcall, 0, SCMD_HANGUP, BLOCKS_IDLE_REWARD },
{ "help", 0, do_help, 0, 0, BLOCKS_IDLE_REWARD },
{ "ht", 0, do_gen_comm , 0, SCMD_HIREDTALK, BLOCKS_IDLE_REWARD },
Expand Down Expand Up @@ -1498,6 +1504,8 @@ struct command_info rig_info[] =
{ "enter", 0, do_enter, 0, 0, BLOCKS_IDLE_REWARD },
{ "examine", 0, do_look_while_rigging, 0, 0, BLOCKS_IDLE_REWARD },
{ "exits", 0, do_exits, 0, 0, BLOCKS_IDLE_REWARD },
{ "favors", 0, do_recap, 0, 0, BLOCKS_IDLE_REWARD },
{ "favours", 0, do_recap, 0, 0, BLOCKS_IDLE_REWARD },
{ "flyto", 0, do_flyto, 0, 0, BLOCKS_IDLE_REWARD },
{ "get", 0, do_get, 0, 0, BLOCKS_IDLE_REWARD },
{ "gridguide", 0, do_gridguide, 0, 0, BLOCKS_IDLE_REWARD },
Expand Down
35 changes: 35 additions & 0 deletions src/newdb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ void auto_repair_obj(struct obj_data *obj, idnum_t owner);
void save_adept_powers_to_db(struct char_data *player);
void save_spells_to_db(struct char_data *player);
void save_quests_to_db(struct char_data *player);
void save_favours_to_db(struct char_data * player);
void save_inventory_to_db(struct char_data *player);
void save_worn_equipment_to_db(struct char_data *player);
void save_metamagic_to_db(struct char_data *player);
Expand Down Expand Up @@ -1535,6 +1536,9 @@ static bool save_char(char_data *player, DBIndex::vnum_t loadroom, bool fromCopy
/* Save data for quests the player has run. */
SAVE_IF_DIRTY_BIT_SET(GET_QUEST_DIRTY_BIT, save_quests_to_db);

/* Save data for favours the player has run. */
SAVE_IF_DIRTY_BIT_SET(GET_FAVOUR_DIRTY_BIT, save_favours_to_db);

/* Wipe out their memory, then re-write it. */
SAVE_IF_DIRTY_BIT_SET(GET_MEMORY_DIRTY_BIT, save_pc_memory_to_db);

Expand Down Expand Up @@ -2825,6 +2829,37 @@ void save_quests_to_db(struct char_data *player) {
}
}

void save_favours_to_db(struct char_data *player) {
PERF_PROF_SCOPE(pr_, __func__);
int i, q;

snprintf(buf, sizeof(buf), "DELETE FROM pfiles_favours WHERE idnum=%ld", GET_IDNUM(player));
mysql_wrapper(mysql, buf);
strlcpy(buf, "INSERT INTO pfiles_favours (idnum, number, questnum, completed) VALUES (", sizeof(buf));
for (i = 0, q = 0; i <= QUEST_TIMER - 1; i++) {
if (GET_LFAVOUR(player ,i)) {
bool found = FALSE;
// Check to see if it's in the CQUEST list. If it is, store it as completed.
for (int c_idx = 0; c_idx <= QUEST_TIMER - 1; c_idx++) {
if (GET_LFAVOUR(player, i) == GET_CFAVOUR(player, c_idx)) {
found = TRUE;
break;
}
}

snprintf(ENDOF(buf), sizeof(buf) - strlen(buf), "%s%ld, %d, %ld, %s",
q ? "), (" : "",
GET_IDNUM(player), i, GET_LFAVOUR(player, i), found ? "TRUE" : "FALSE");
q = 1;
}
}
if (q) {
strcat(buf, ");");
mysql_wrapper(mysql, buf);
}
}


void save_elementals_to_db(struct char_data *player) {
PERF_PROF_SCOPE(pr_, __func__);
if (GET_TRADITION(player) == TRAD_HERMETIC) {
Expand Down
Loading
Loading