Skip to content

Commit

Permalink
Typo fixes and updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
luciensadi committed Dec 24, 2023
1 parent dddf7ac commit 2f456ee
Show file tree
Hide file tree
Showing 14 changed files with 272 additions and 12 deletions.
6 changes: 6 additions & 0 deletions SQL/awakemud.sql
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,12 @@ CREATE TABLE `help_category` (
UNIQUE KEY `idnum` (`idnum`)
);

CREATE TABLE `pfiles_named_tags` (
`idnum` mediumint(5) unsigned default '0',
`tag_name` varchar(256) NOT NULL,
PRIMARY KEY (`idnum`, `tag_name`)
);

INSERT INTO `help_category` VALUES (0,'Combat'),(2,'General'),(1,'Magic'),(3,'Maps'),(4,'Matrix'),(5,'Rigging');

CREATE TABLE `help_topic` (
Expand Down
80 changes: 72 additions & 8 deletions lib/world/obj/0.obj
Original file line number Diff line number Diff line change
Expand Up @@ -1306,19 +1306,19 @@ Material: paper
Barrier: 4
BREAK
#126
Keywords: silver cord
Name: a silver cord
Keywords: holiday gift box present
Name: a holiday gift box
RoomDesc:$
A silver cord lies here rolled neatly.~
A holiday gift has been abandoned here.~
LookDesc:$
A fine silver rope cord.
It's festive!
~
Type: Worn
WearFlags: 100000000001
ExtraFlags: 1000001000
Type: Other
WearFlags: 1
ExtraFlags: 100000000000000001000001000
Material: metal
[POINTS]
Weight: 1.00
Weight: 0.01
Barrier: 32
BREAK
#127
Expand Down Expand Up @@ -1498,6 +1498,70 @@ Material: metal
Val6: 10
Val7: -4
BREAK
#196
Keywords: sharpened candy cane bayonet
Name: a sharpened ^Rc^Wa^Rn^Wd^Ry ^Wc^Ra^Wn^Re^n
RoomDesc:$
A sharpened candy cane gathers dirt here.~
LookDesc:$
This vaguely-sticky sweet treat has been sharpened into a wicked point, like
someone's spent a good few minutes licking it in preparation for waging
holiday-themed war on their friends and family. In a stark departure from
tradition, they've also added hardware for underbarrel mounting to the base,
allowing it to be used as a bayonet if so desired.
~
Type: Gun Accessory
WearFlags: 1
ExtraFlags: 1000001000
Material: metal
[POINTS]
Barrier: 32
[VALUES]
Val0: 2
Val1: 10
BREAK
#197
Keywords: vintage ugly Christmas sweater 2023
Name: a vintage ugly ^GC^Rh^Gr^Ri^Gs^Rt^Gm^Ra^Gs^n sweater from 2023
RoomDesc:$
An ugly Christmas sweater has been abandoned here. Probably for the best.~
LookDesc:$
The design is garish, the colors are bright, and the overall vibe feels
straight out of 2023. Who knew a 41-year-old sweater could hurt the eyes so
badly?
~
Type: Worn
WearFlags: 10000001001
ExtraFlags: 1000001000
Material: fabric
[POINTS]
Weight: 0.01
Barrier: 4
[VALUES]
Val0: 10
Val4: 10
Val7: 50
BREAK
#198
Keywords: shady-looking looking single-use use health injector high-tech tech syringe
Name: a shady-looking single-use health injector
RoomDesc:$
A high-tech syringe has been set down here.~
LookDesc:$
Consisting of a pressure-activated syringe filled with a shimmering silver
liquid, this injector is clearly the product of some highly secret research
project by a megacorp somewhere. You're probably not even supposed to know it
exists, let alone have one in your possession... best to keep quiet about it.
(OOC: It will fully heal you even if you are mortally wounded. To use it,
type ^WRESTORE^n.)
~
Type: Other
WearFlags: 1
ExtraFlags: 100000000000000001000001000
Material: metal
[POINTS]
Barrier: 32
BREAK
#199
Keywords: ring wedding gold
Name: Zack's wedding ring
Expand Down
26 changes: 26 additions & 0 deletions src/act.informative.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3814,6 +3814,32 @@ void do_probe_object(struct char_data * ch, struct obj_data * j, bool is_in_shop
}
}

if (GET_OBJ_VNUM(j) == OBJ_STAFF_REBATE_FOR_DECKBUILDING) {
if (GET_DECKBUILDING_TOKEN_IDNUM(j) <= 0) {
strlcat(buf, " It can be used by anyone.", sizeof(buf));
} else if (GET_DECKBUILDING_TOKEN_IDNUM(j) == GET_IDNUM(ch)) {
strlcat(buf, " It can only be used by you.", sizeof(buf));
} else {
strlcat(buf, " You can't use it-- it belongs to someone else.", sizeof(buf));
}
}

if (GET_OBJ_VNUM(j) == OBJ_HOLIDAY_GIFT) {
if (GET_HOLIDAY_GIFT_ISSUED_TO(j) == GET_IDNUM(ch)) {
strlcat(buf, " It is made out to you.", sizeof(buf));
} else {
strlcat(buf, " You can't open it-- it is made out to someone else.", sizeof(buf));
}
}

if (GET_OBJ_VNUM(j) == OBJ_ONE_SHOT_HEALING_INJECTOR) {
if (GET_HEALING_INJECTOR_ISSUED_TO(j) == GET_IDNUM(ch)) {
strlcat(buf, " It can only be used by you.", sizeof(buf));
} else {
strlcat(buf, " You can't use it-- it belongs to someone else.", sizeof(buf));
}
}

if (GET_OBJ_AFFECT(j).IsSet(AFF_LASER_SIGHT) && has_smartlink) {
strlcat(buf, "\r\n\r\n^yWARNING:^n Your smartlink overrides your laser sight-- the laser will not function.", sizeof(buf));
}
Expand Down
9 changes: 9 additions & 0 deletions src/act.wizard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2269,6 +2269,15 @@ void perform_wizload_object(struct char_data *ch, int vnum) {
if (GET_OBJ_TYPE(obj) == ITEM_WORN && IS_OBJ_STAT(obj, ITEM_EXTRA_HARDENED_ARMOR)) {
GET_WORN_HARDENED_ARMOR_CUSTOMIZED_FOR(obj) = -1;
}

// Flag staff-loaded tokens as issued by them.
if (GET_OBJ_VNUM(obj) == OBJ_STAFF_REBATE_FOR_DECKBUILDING) {
GET_DECKBUILDING_TOKEN_ISSUED_BY(obj) = GET_IDNUM_EVEN_IF_PROJECTING(ch);
} else if (GET_OBJ_VNUM(obj) == OBJ_HOLIDAY_GIFT) {
GET_HOLIDAY_GIFT_ISSUED_BY(obj) = GET_IDNUM_EVEN_IF_PROJECTING(ch);
} else if (GET_OBJ_VNUM(obj) == OBJ_ONE_SHOT_HEALING_INJECTOR) {
GET_HEALING_INJECTOR_ISSUED_BY(obj) = GET_IDNUM_EVEN_IF_PROJECTING(ch);
}
}

ACMD(do_iload)
Expand Down
7 changes: 5 additions & 2 deletions src/awake.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2607,6 +2607,8 @@ enum {
#define OBJ_RUGER_100 828
#define OBJ_BO_STAFF 60510
#define OBJ_HEAVY_MILITARY_HELMET 717
#define OBJ_VINTAGE_UGLY_CHRISTMAS_SWEATER 197
#define OBJ_CHRISTMAS_2024_GIFT 196

#define OBJ_TITLE_TO_AMERICAR 891
#define OBJ_TITLE_TO_SCORPION 892
Expand Down Expand Up @@ -2730,6 +2732,7 @@ enum {

#define OBJ_SHOPCONTAINER 83
#define OBJ_VEHCONTAINER 13
#define OBJ_ONE_SHOT_HEALING_INJECTOR 198

#define BOTTOM_OF_TEMPLATE_ITEMS 106
#define OBJ_BLANK_OPTICAL_CHIP 106
Expand All @@ -2752,9 +2755,9 @@ enum {
#define OBJ_CUSTOM_NERPS_BIOWARE 123
#define OBJ_RITUAL_SPELL_COMPONENTS 124
#define OBJ_CUSTOM_ART 125
#define TOP_OF_TEMPLATE_ITEMS 125

#define OBJ_HOLIDAY_GIFT 126
#define OBJ_BLANK_MAGAZINE 127
#define TOP_OF_TEMPLATE_ITEMS 127

#define OBJ_DOCWAGON_PAPER_GOWN 16201
#define OBJ_ANTI_DRUG_CHEMS 44
Expand Down
2 changes: 2 additions & 0 deletions src/comm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ void msdp_update();
void increase_congregation_bonus_pools();
void send_nuyen_rewards_to_pcs();
void cleanup_things_valgrind_complains_about();
extern void award_holiday_gifts();

/* extern fcnts */
extern void DBInit();
Expand Down Expand Up @@ -1082,6 +1083,7 @@ void game_loop(int mother_desc)
// johnson_update();
process_boost();
tick_down_room_tempdesc_expiries();
award_holiday_gifts();
}

// By default, every IRL hour, but configurable in config.h.
Expand Down
3 changes: 2 additions & 1 deletion src/db.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,7 @@ void boot_world(void)
require_that_field_exists_in_table("completed", "pfiles_quests", "SQL/Migrations/quest_completed_fix.sql");
require_that_field_exists_in_table("graffiti", "pfiles_worn", "SQL/Migrations/add_graffiti_field.sql");
require_that_field_exists_in_table("prestige_alt", "pfiles_chargendata", "SQL/Migrations/prestige_races.sql");
require_that_sql_table_exists("pfiles_named_tags", "SQL/Migrations/add_named_tags.sql");

log("Calculating lexicon data.");
populate_lexicon_size_table();
Expand Down Expand Up @@ -2004,7 +2005,7 @@ void parse_object(File &fl, long nr)

// Set the do-not-touch flags for known templated items.
if ((BOTTOM_OF_TEMPLATE_ITEMS <= nr && nr <= TOP_OF_TEMPLATE_ITEMS)
|| nr == OBJ_BLANK_MAGAZINE || nr == OBJ_VEHCONTAINER || nr == OBJ_SHOPCONTAINER) {
|| nr == OBJ_VEHCONTAINER || nr == OBJ_SHOPCONTAINER || nr == OBJ_ONE_SHOT_HEALING_INJECTOR) {
GET_OBJ_EXTRA(obj).SetBit(ITEM_EXTRA_DONT_TOUCH);
}

Expand Down
12 changes: 12 additions & 0 deletions src/handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1526,6 +1526,18 @@ void obj_to_char(struct obj_data * object, struct char_data * ch)
return;
}

// Soulbind it if necessary. Items never soulbind to NPCs or staffers.
if (!IS_NPC(ch) && !IS_SENATOR(ch)) {
// Deckbuilding tokens bind to the first non-staffer to take possession of them.
if (GET_OBJ_VNUM(object) == OBJ_STAFF_REBATE_FOR_DECKBUILDING && GET_DECKBUILDING_TOKEN_IDNUM(object) <= 0) {
GET_DECKBUILDING_TOKEN_IDNUM(object) = GET_IDNUM(ch);
} else if (GET_OBJ_VNUM(object) == OBJ_HOLIDAY_GIFT && GET_HOLIDAY_GIFT_ISSUED_BY(object) <= 0) {
GET_HOLIDAY_GIFT_ISSUED_TO(object) = GET_IDNUM(ch);
} else if (GET_OBJ_VNUM(object) == OBJ_ONE_SHOT_HEALING_INJECTOR && GET_HEALING_INJECTOR_ISSUED_BY(object) <= 0) {
GET_HEALING_INJECTOR_ISSUED_TO(object) = GET_IDNUM(ch);
}
}

// Iterate over the objects that the character already has.
for (i = ch->carrying; i; i = i->next_content) {
// Attempt at additional error detection.
Expand Down
49 changes: 49 additions & 0 deletions src/newdb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2879,3 +2879,52 @@ void fix_character_essence_after_cybereye_migration(struct char_data *ch) {
// Finally, save them. TODO: Does saving them in the middle of the load process break things?
save_char(ch, GET_LOADROOM(ch));
}

// Check if a PC has a specified DB tag applied to them.
bool player_has_db_tag(idnum_t idnum, const char *tag_name) {
char prepare_quotes_buf[1000];
char query_buf[2000];
bool result;

MYSQL_RES *res;
MYSQL_ROW row;

snprintf(query_buf, sizeof(query_buf), "SELECT idnum FROM pfiles_named_tags WHERE idnum=%ld AND tag_name='%s';",
idnum,
prepare_quotes(prepare_quotes_buf, tag_name, sizeof(prepare_quotes_buf) / sizeof(prepare_quotes_buf[0])));

mysql_wrapper(mysql, query_buf);

if (!(res = mysql_use_result(mysql))) {
result = FALSE;
} else if (!(row = mysql_fetch_row(res)) && mysql_field_count(mysql)) {
result = FALSE;
} else {
result = TRUE;
}

mysql_free_result(res);
return result;
}

void set_db_tag(idnum_t idnum, const char *tag_name) {
char prepare_quotes_buf[1000];
char query_buf[2000];

snprintf(query_buf, sizeof(query_buf), "INSERT IGNORE INTO pfiles_named_tags (idnum, tag_name) VALUES (%ld, '%s')",
idnum,
prepare_quotes(prepare_quotes_buf, tag_name, sizeof(prepare_quotes_buf) / sizeof(prepare_quotes_buf[0])));

mysql_wrapper(mysql, query_buf);
}

void remove_db_tag(idnum_t idnum, const char *tag_name) {
char prepare_quotes_buf[1000];
char query_buf[2000];

snprintf(query_buf, sizeof(query_buf), "DELETE FROM pfiles_named_tags WHERE idnum=%ld AND tag_name='%s'",
idnum,
prepare_quotes(prepare_quotes_buf, tag_name, sizeof(prepare_quotes_buf) / sizeof(prepare_quotes_buf[0])));

mysql_wrapper(mysql, query_buf);
}
5 changes: 5 additions & 0 deletions src/newdb.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,11 @@ extern bool get_plr_flag_is_set_by_idnum(int flag, vnum_t id);
extern bool get_prf_flag_is_set_by_idnum(int flag, vnum_t id);
extern bool get_aff_flag_is_set_by_idnum(int flag, vnum_t id);

// DB tag functions, for when you need to persist data but don't want to write a new table for it.
bool player_has_db_tag(idnum_t idnum, const char *tag_name);
void set_db_tag(idnum_t idnum, const char *tag_name);
void remove_db_tag(idnum_t idnum, const char *tag_name);

extern MYSQL *mysql;

extern int mysql_wrapper(MYSQL *mysql, const char *query);
Expand Down
5 changes: 5 additions & 0 deletions src/spec_assign.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -868,6 +868,11 @@ void assign_objects(void)
SPECIAL(medical_workshop);
SPECIAL(toggled_voice_modulator);
SPECIAL(initiative_tracker);
SPECIAL(one_shot_self_heal);
SPECIAL(holiday_gift);

ASSIGNOBJ(OBJ_HOLIDAY_GIFT, holiday_gift);
ASSIGNOBJ(OBJ_ONE_SHOT_HEALING_INJECTOR, one_shot_self_heal);

// Adding a board? Add it to the index in boards.cpp too!
ASSIGNOBJ(26, gen_board);
Expand Down
38 changes: 38 additions & 0 deletions src/spec_procs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6718,6 +6718,44 @@ SPECIAL(airport_guard)
return FALSE;
}

SPECIAL(one_shot_self_heal) {
struct obj_data *obj = (struct obj_data *) me;

if (!cmd || !ch || IS_NPC(ch) || !ch->desc)
return FALSE;

if (CMD_IS("restore")) {
// Only use it if it's yours.
if (GET_HEALING_INJECTOR_ISSUED_TO(obj) > 0 && GET_HEALING_INJECTOR_ISSUED_TO(obj) != GET_IDNUM(ch)) {
send_to_char(ch, "%s belongs to someone else.\r\n", CAP(GET_OBJ_NAME(obj)));
char *owner_name = get_player_name(GET_HEALING_INJECTOR_ISSUED_TO(obj));
mudlog_vfprintf(ch, LOG_CHEATLOG, "Warning: %s is holding a healing injector that actually belongs to %s (%d).",
GET_CHAR_NAME(ch),
owner_name,
GET_HEALING_INJECTOR_ISSUED_TO(obj));
delete [] owner_name;
return TRUE;
}

// Don't allow mistaken use.
if (GET_PHYSICAL(ch) >= GET_MAX_PHYSICAL(ch) && GET_MENTAL(ch) >= GET_MAX_MENTAL(ch)) {
send_to_char("You're feeling perfectly fine-- there's nothing to restore.\r\n", ch);
return TRUE;
}

// It fixes you up.
restore_character(ch, FALSE);
send_to_char(ch, "You blearily jab %s into your side, and the healing rush roars through you like a wildfire.\r\n", decapitalize_a_an(GET_OBJ_NAME(obj)));
mudlog_vfprintf(ch, LOG_SYSLOG, "%s used a single-shot healing item.", GET_CHAR_NAME(ch));

// Remove it.
extract_obj(obj);
return TRUE;
}

return FALSE;
}

// Give to morts for testing combat so staff don't have to restore them all the time.
SPECIAL(restoration_button) {
if (!cmd)
Expand Down
Loading

0 comments on commit 2f456ee

Please sign in to comment.