New house system, ASCII hcontrol file and hsedit house OLC

This commit is contained in:
JamDog 2010-12-01 18:40:34 +00:00
parent 74c3d208b6
commit 3fa8ebe048
16 changed files with 2647 additions and 681 deletions

View file

@ -35,12 +35,21 @@ 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 30 2010] - Jamdog
Bug-Fix: Fixed incorrect rnum showing on stat room <vnum> (Thanks Kam)
Added hsedit House Editor OLC
[Nov 28 2010] - Jamdog
Converted houses (lib/etc/hcontrol file) to ASCII file format
Added hcontrol file converter (hstoascii.c) to src/utils folder
Converted houses to work as linked lists, not wasteful fixed-size arrays
Added GOD houses and player-owned shops as house types
Added 'receptionist' and 'player-shopkeeper' type spec-procs for houses
[Nov 26 2010] - Jamdog [Nov 26 2010] - Jamdog
Bug-Fix: set level now allows GRGOD or higher to set to any mortal level 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 Advance command changed to work for both mortal and admin levels
Added increase_gold and increase_bank functions to prevent cash overflows Added increase_gold and increase_bank functions to prevent cash overflows
Added dupe check for new characters in char creation (thanks Mirad) Added dupe check for new characters in char creation (thanks Mirad)
Bug-Fix: Since admin update, real mortals didn't show on who list Bug-Fix: Since admin update, real mortals didn't show on who list (thanks Rhade)
[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

View file

@ -510,9 +510,7 @@ void look_at_room(struct char_data *ch, int ignore_brief)
if(!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_AUTOMAP) && can_see_map(ch)) if(!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_AUTOMAP) && can_see_map(ch))
{ {
str_and_map(world[target_room].description, ch, target_room); str_and_map(world[target_room].description, ch, target_room);
} } else {
else
{
send_to_char(ch, "%s", world[IN_ROOM(ch)].description); send_to_char(ch, "%s", world[IN_ROOM(ch)].description);
} }
} }
@ -555,13 +553,13 @@ static void look_in_obj(struct char_data *ch, char *arg)
send_to_char(ch, "There doesn't seem to be %s %s here.\r\n", AN(arg), arg); send_to_char(ch, "There doesn't seem to be %s %s here.\r\n", AN(arg), arg);
} else if ((GET_OBJ_TYPE(obj) != ITEM_DRINKCON) && } else if ((GET_OBJ_TYPE(obj) != ITEM_DRINKCON) &&
(GET_OBJ_TYPE(obj) != ITEM_FOUNTAIN) && (GET_OBJ_TYPE(obj) != ITEM_FOUNTAIN) &&
(GET_OBJ_TYPE(obj) != ITEM_CONTAINER)) (GET_OBJ_TYPE(obj) != ITEM_CONTAINER)) {
send_to_char(ch, "There's nothing inside that!\r\n"); send_to_char(ch, "There's nothing inside that!\r\n");
else { } else {
if (GET_OBJ_TYPE(obj) == ITEM_CONTAINER) { if (GET_OBJ_TYPE(obj) == ITEM_CONTAINER) {
if (OBJVAL_FLAGGED(obj, CONT_CLOSED) && (!IS_ADMIN(ch, ADMLVL_IMMORT) || !PRF_FLAGGED(ch, PRF_NOHASSLE))) if (OBJVAL_FLAGGED(obj, CONT_CLOSED) && (!IS_ADMIN(ch, ADMLVL_IMMORT) || !PRF_FLAGGED(ch, PRF_NOHASSLE))) {
send_to_char(ch, "It is closed.\r\n"); send_to_char(ch, "It is closed.\r\n");
else { } else {
send_to_char(ch, "%s", fname(obj->name)); send_to_char(ch, "%s", fname(obj->name));
switch (bits) { switch (bits) {
case FIND_OBJ_INV: case FIND_OBJ_INV:
@ -585,10 +583,9 @@ static void look_in_obj(struct char_data *ch, char *arg)
char buf2[MAX_STRING_LENGTH]; char buf2[MAX_STRING_LENGTH];
sprinttype(GET_OBJ_VAL(obj, 2), color_liquid, buf2, sizeof(buf2)); sprinttype(GET_OBJ_VAL(obj, 2), color_liquid, buf2, sizeof(buf2));
send_to_char(ch, "It's full of a %s liquid.\r\n", buf2); send_to_char(ch, "It's full of a %s liquid.\r\n", buf2);
} } else if (GET_OBJ_VAL(obj,1)>GET_OBJ_VAL(obj,0)) {
else if (GET_OBJ_VAL(obj,1)>GET_OBJ_VAL(obj,0))
send_to_char(ch, "Its contents seem somewhat murky.\r\n"); /* BUG */ send_to_char(ch, "Its contents seem somewhat murky.\r\n"); /* BUG */
else { } else {
char buf2[MAX_STRING_LENGTH]; char buf2[MAX_STRING_LENGTH];
amt = (GET_OBJ_VAL(obj, 1) * 3) / GET_OBJ_VAL(obj, 0); amt = (GET_OBJ_VAL(obj, 1) * 3) / GET_OBJ_VAL(obj, 0);
sprinttype(GET_OBJ_VAL(obj, 2), color_liquid, buf2, sizeof(buf2)); sprinttype(GET_OBJ_VAL(obj, 2), color_liquid, buf2, sizeof(buf2));
@ -656,41 +653,47 @@ static void look_at_target(struct char_data *ch, char *arg)
} }
/* Does the argument match an extra desc in the char's equipment? */ /* Does the argument match an extra desc in the char's equipment? */
for (j = 0; j < NUM_WEARS && !found; j++) for (j = 0; j < NUM_WEARS && !found; j++) {
if (GET_EQ(ch, j) && CAN_SEE_OBJ(ch, GET_EQ(ch, j))) if (GET_EQ(ch, j) && CAN_SEE_OBJ(ch, GET_EQ(ch, j))) {
if ((desc = find_exdesc(arg, GET_EQ(ch, j)->ex_description)) != NULL && ++i == fnum) { if ((desc = find_exdesc(arg, GET_EQ(ch, j)->ex_description)) != NULL && ++i == fnum) {
send_to_char(ch, "%s", desc); send_to_char(ch, "%s", desc);
found = TRUE; found = TRUE;
} }
}
}
/* Does the argument match an extra desc in the char's inventory? */ /* Does the argument match an extra desc in the char's inventory? */
for (obj = ch->carrying; obj && !found; obj = obj->next_content) { for (obj = ch->carrying; obj && !found; obj = obj->next_content) {
if (CAN_SEE_OBJ(ch, obj)) if (CAN_SEE_OBJ(ch, obj)) {
if ((desc = find_exdesc(arg, obj->ex_description)) != NULL && ++i == fnum) { if ((desc = find_exdesc(arg, obj->ex_description)) != NULL && ++i == fnum) {
send_to_char(ch, "%s", desc); send_to_char(ch, "%s", desc);
found = TRUE; found = TRUE;
} }
} }
}
/* Does the argument match an extra desc of an object in the room? */ /* Does the argument match an extra desc of an object in the room? */
for (obj = world[IN_ROOM(ch)].contents; obj && !found; obj = obj->next_content) for (obj = world[IN_ROOM(ch)].contents; obj && !found; obj = obj->next_content) {
if (CAN_SEE_OBJ(ch, obj)) if (CAN_SEE_OBJ(ch, obj)) {
if ((desc = find_exdesc(arg, obj->ex_description)) != NULL && ++i == fnum) { if ((desc = find_exdesc(arg, obj->ex_description)) != NULL && ++i == fnum) {
send_to_char(ch, "%s", desc); send_to_char(ch, "%s", desc);
found = TRUE; found = TRUE;
} }
}
}
/* If an object was found back in generic_find */ /* If an object was found back in generic_find */
if (bits) { if (bits) {
if (!found) if (!found) {
show_obj_to_char(found_obj, ch, SHOW_OBJ_ACTION); show_obj_to_char(found_obj, ch, SHOW_OBJ_ACTION);
else { } else {
show_obj_modifiers(found_obj, ch); show_obj_modifiers(found_obj, ch);
send_to_char(ch, "\r\n"); send_to_char(ch, "\r\n");
} }
} else if (!found) } else if (!found) {
send_to_char(ch, "You do not see that here.\r\n"); send_to_char(ch, "You do not see that here.\r\n");
} }
}
ACMD(do_look) ACMD(do_look)
{ {
@ -971,14 +974,13 @@ ACMD(do_equipment)
send_to_char(ch, "You are using:\r\n"); send_to_char(ch, "You are using:\r\n");
for (i = 0; i < NUM_WEARS; i++) { for (i = 0; i < NUM_WEARS; i++) {
if (GET_EQ(ch, i)) { if (GET_EQ(ch, i)) {
found = TRUE;
if (CAN_SEE_OBJ(ch, GET_EQ(ch, i))) { if (CAN_SEE_OBJ(ch, GET_EQ(ch, i))) {
send_to_char(ch, "%s", wear_where[i]); send_to_char(ch, "%s", wear_where[i]);
show_obj_to_char(GET_EQ(ch, i), ch, SHOW_OBJ_SHORT); show_obj_to_char(GET_EQ(ch, i), ch, SHOW_OBJ_SHORT);
found = TRUE;
} else { } else {
send_to_char(ch, "%s", wear_where[i]); send_to_char(ch, "%s", wear_where[i]);
send_to_char(ch, "Something.\r\n"); send_to_char(ch, "Something.\r\n");
found = TRUE;
} }
} }
} }
@ -1303,7 +1305,7 @@ ACMD(do_who)
if (showleader && (!tch->followers || !AFF_FLAGGED(tch, AFF_GROUP))) if (showleader && (!tch->followers || !AFF_FLAGGED(tch, AFF_GROUP)))
continue; continue;
sprintf(admlev, "%11s", admin_level_names[(GET_ADMLEVEL(tch))]); sprintf(admlev, "%-11s", admin_level_names[(GET_ADMLEVEL(tch))]);
if (short_list) { if (short_list) {
send_to_char(ch, "%s[%2d %s] %-12.12s%s%s", send_to_char(ch, "%s[%2d %s] %-12.12s%s%s",
(IS_ADMIN(tch, ADMLVL_IMMORT) ? CCYEL(ch, C_SPR) : ""), (IS_ADMIN(tch, ADMLVL_IMMORT) ? CCYEL(ch, C_SPR) : ""),
@ -2404,8 +2406,7 @@ void add_history(struct char_data *ch, char *str, int type)
if (!tmp) { if (!tmp) {
CREATE(GET_HISTORY(ch, type), struct txt_block, 1); CREATE(GET_HISTORY(ch, type), struct txt_block, 1);
GET_HISTORY(ch, type)->text = strdup(buf); GET_HISTORY(ch, type)->text = strdup(buf);
} } else {
else {
while (tmp->next) while (tmp->next)
tmp = tmp->next; tmp = tmp->next;
CREATE(tmp->next, struct txt_block, 1); CREATE(tmp->next, struct txt_block, 1);
@ -2477,25 +2478,17 @@ ACMD(do_whois)
send_to_char(ch, "Last Logon: They're playing now! (Idle %d Minutes)", send_to_char(ch, "Last Logon: They're playing now! (Idle %d Minutes)",
victim->char_specials.timer * SECS_PER_MUD_HOUR / SECS_PER_REAL_MIN); victim->char_specials.timer * SECS_PER_MUD_HOUR / SECS_PER_REAL_MIN);
if (!victim->desc) if (!victim->desc) {
{
send_to_char(ch, " (Linkless)\r\n"); send_to_char(ch, " (Linkless)\r\n");
} } else {
else
{
send_to_char(ch, "\r\n"); send_to_char(ch, "\r\n");
} }
if (PRF_FLAGGED(victim, PRF_AFK)) if (PRF_FLAGGED(victim, PRF_AFK)) {
{
send_to_char(ch, "%s%s is afk right now, so %s may not respond to communication.%s\r\n", CBGRN(ch, C_NRM), GET_NAME(victim), GET_SEX(victim) == SEX_NEUTRAL ? "it" : (GET_SEX(victim) == SEX_MALE ? "he" : "she"), CCNRM(ch, C_NRM)); send_to_char(ch, "%s%s is afk right now, so %s may not respond to communication.%s\r\n", CBGRN(ch, C_NRM), GET_NAME(victim), GET_SEX(victim) == SEX_NEUTRAL ? "it" : (GET_SEX(victim) == SEX_MALE ? "he" : "she"), CCNRM(ch, C_NRM));
} }
} } else if (hours > 0) {
else if (hours > 0)
{
send_to_char(ch, "Last Logon: %s (%d days & %d hours ago.)\r\n", buf, hours/24, hours%24); send_to_char(ch, "Last Logon: %s (%d days & %d hours ago.)\r\n", buf, hours/24, hours%24);
} } else {
else
{
send_to_char(ch, "Last Logon: %s (0 hours & %d minutes ago.)\r\n", send_to_char(ch, "Last Logon: %s (0 hours & %d minutes ago.)\r\n",
buf, (int)(time(0) - victim->player.time.logon)/60); buf, (int)(time(0) - victim->player.time.logon)/60);
} }
@ -2638,14 +2631,14 @@ distance, int door)
/* this loop is a quick, easy way to help make a grammatical sentence /* this loop is a quick, easy way to help make a grammatical sentence
(i.e., "You see x, x, y, and z." with commas, "and", etc.) */ (i.e., "You see x, x, y, and z." with commas, "and", etc.) */
for (i = list; i; i = i->next_in_room) for (i = list; i; i = i->next_in_room) {
/* put any other conditions for scanning someone in this if statement - /* put any other conditions for scanning someone in this if statement -
i.e., if (CAN_SEE(ch, i) && condition2 && condition3) or whatever */ i.e., if (CAN_SEE(ch, i) && condition2 && condition3) or whatever */
if (CAN_SEE(ch, i)) if (CAN_SEE(ch, i))
count++; count++;
}
if (!count) if (!count)
return; return;

View file

@ -248,9 +248,9 @@ void get_from_container(struct char_data *ch, struct obj_data *cont,
} }
} }
if (!found) { if (!found) {
if (obj_dotmode == FIND_ALL) if (obj_dotmode == FIND_ALL) {
act("$p seems to be empty.", FALSE, ch, cont, 0, TO_CHAR); act("$p seems to be empty.", FALSE, ch, cont, 0, TO_CHAR);
else { } else {
char buf[MAX_STRING_LENGTH]; char buf[MAX_STRING_LENGTH];
snprintf(buf, sizeof(buf), "You can't seem to find any %ss in $p.", arg); snprintf(buf, sizeof(buf), "You can't seem to find any %ss in $p.", arg);
@ -352,7 +352,7 @@ ACMD(do_get)
send_to_char(ch, "Get from all of what?\r\n"); send_to_char(ch, "Get from all of what?\r\n");
return; return;
} }
for (cont = ch->carrying; cont; cont = cont->next_content) for (cont = ch->carrying; cont; cont = cont->next_content) {
if (CAN_SEE_OBJ(ch, cont) && if (CAN_SEE_OBJ(ch, cont) &&
(cont_dotmode == FIND_ALL || isname(arg2, cont->name))) { (cont_dotmode == FIND_ALL || isname(arg2, cont->name))) {
if (GET_OBJ_TYPE(cont) == ITEM_CONTAINER) { if (GET_OBJ_TYPE(cont) == ITEM_CONTAINER) {
@ -363,7 +363,8 @@ ACMD(do_get)
act("$p is not a container.", FALSE, ch, cont, 0, TO_CHAR); act("$p is not a container.", FALSE, ch, cont, 0, TO_CHAR);
} }
} }
for (cont = world[IN_ROOM(ch)].contents; cont; cont = cont->next_content) }
for (cont = world[IN_ROOM(ch)].contents; cont; cont = cont->next_content) {
if (CAN_SEE_OBJ(ch, cont) && if (CAN_SEE_OBJ(ch, cont) &&
(cont_dotmode == FIND_ALL || isname(arg2, cont->name))) { (cont_dotmode == FIND_ALL || isname(arg2, cont->name))) {
if (GET_OBJ_TYPE(cont) == ITEM_CONTAINER) { if (GET_OBJ_TYPE(cont) == ITEM_CONTAINER) {
@ -374,6 +375,7 @@ ACMD(do_get)
found = 1; found = 1;
} }
} }
}
if (!found) { if (!found) {
if (cont_dotmode == FIND_ALL) if (cont_dotmode == FIND_ALL)
send_to_char(ch, "You can't seem to find any containers.\r\n"); send_to_char(ch, "You can't seem to find any containers.\r\n");
@ -559,13 +561,14 @@ ACMD(do_drop)
return; return;
} }
if (dotmode == FIND_ALL) { if (dotmode == FIND_ALL) {
if (!ch->carrying) if (!ch->carrying) {
send_to_char(ch, "You don't seem to be carrying anything.\r\n"); send_to_char(ch, "You don't seem to be carrying anything.\r\n");
else } else {
for (obj = ch->carrying; obj; obj = next_obj) { for (obj = ch->carrying; obj; obj = next_obj) {
next_obj = obj->next_content; next_obj = obj->next_content;
amount += perform_drop(ch, obj, mode, sname, RDR); amount += perform_drop(ch, obj, mode, sname, RDR);
} }
}
} else if (dotmode == FIND_ALLDOT) { } else if (dotmode == FIND_ALLDOT) {
if (!*arg) { if (!*arg) {
send_to_char(ch, "What do you want to %s all of?\r\n", sname); send_to_char(ch, "What do you want to %s all of?\r\n", sname);
@ -718,9 +721,9 @@ ACMD(do_give)
send_to_char(ch, "All of what?\r\n"); send_to_char(ch, "All of what?\r\n");
return; return;
} }
if (!ch->carrying) if (!ch->carrying) {
send_to_char(ch, "You don't seem to be holding anything.\r\n"); send_to_char(ch, "You don't seem to be holding anything.\r\n");
else } else {
for (obj = ch->carrying; obj; obj = next_obj) { for (obj = ch->carrying; obj; obj = next_obj) {
next_obj = obj->next_content; next_obj = obj->next_content;
if (CAN_SEE_OBJ(ch, obj) && if (CAN_SEE_OBJ(ch, obj) &&
@ -730,6 +733,7 @@ ACMD(do_give)
} }
} }
} }
}
void weight_change_object(struct obj_data *obj, int weight) void weight_change_object(struct obj_data *obj, int weight)
{ {
@ -851,9 +855,10 @@ ACMD(do_drink)
if (!(temp = get_obj_in_list_vis(ch, arg, NULL, world[IN_ROOM(ch)].contents))) { if (!(temp = get_obj_in_list_vis(ch, arg, NULL, world[IN_ROOM(ch)].contents))) {
send_to_char(ch, "You can't find it!\r\n"); send_to_char(ch, "You can't find it!\r\n");
return; return;
} else } else {
on_ground = 1; on_ground = 1;
} }
}
if ((GET_OBJ_TYPE(temp) != ITEM_DRINKCON) && if ((GET_OBJ_TYPE(temp) != ITEM_DRINKCON) &&
(GET_OBJ_TYPE(temp) != ITEM_FOUNTAIN)) { (GET_OBJ_TYPE(temp) != ITEM_FOUNTAIN)) {
send_to_char(ch, "You can't drink from that!\r\n"); send_to_char(ch, "You can't drink from that!\r\n");
@ -1148,8 +1153,7 @@ ACMD(do_pour)
amount = GET_OBJ_VAL(to_obj, 0); amount = GET_OBJ_VAL(to_obj, 0);
} }
/* Poisoned? */ /* Poisoned? */
GET_OBJ_VAL(to_obj, 3) = (GET_OBJ_VAL(to_obj, 3) || GET_OBJ_VAL(from_obj, 3)) GET_OBJ_VAL(to_obj, 3) = (GET_OBJ_VAL(to_obj, 3) || GET_OBJ_VAL(from_obj, 3));
;
/* Weight change, except for unlimited. */ /* Weight change, except for unlimited. */
if (GET_OBJ_VAL(from_obj, 0) > 0) { if (GET_OBJ_VAL(from_obj, 0) > 0) {
weight_change_object(from_obj, -amount); weight_change_object(from_obj, -amount);
@ -1367,7 +1371,7 @@ ACMD(do_wear)
send_to_char(ch, "You don't seem to have any %ss.\r\n", arg1); send_to_char(ch, "You don't seem to have any %ss.\r\n", arg1);
else if (GET_LEVEL(ch) < GET_OBJ_LEVEL(obj)) else if (GET_LEVEL(ch) < GET_OBJ_LEVEL(obj))
send_to_char(ch, "You are not experienced enough to use that.\r\n"); send_to_char(ch, "You are not experienced enough to use that.\r\n");
else else {
while (obj) { while (obj) {
next_obj = get_obj_in_list_vis(ch, arg1, NULL, obj->next_content); next_obj = get_obj_in_list_vis(ch, arg1, NULL, obj->next_content);
if ((where = find_eq_pos(ch, obj, 0)) >= 0) if ((where = find_eq_pos(ch, obj, 0)) >= 0)
@ -1376,6 +1380,7 @@ ACMD(do_wear)
act("You can't wear $p.", FALSE, ch, obj, 0, TO_CHAR); act("You can't wear $p.", FALSE, ch, obj, 0, TO_CHAR);
obj = next_obj; obj = next_obj;
} }
}
} else { } else {
if (!(obj = get_obj_in_list_vis(ch, arg1, NULL, ch->carrying))) if (!(obj = get_obj_in_list_vis(ch, arg1, NULL, ch->carrying)))
send_to_char(ch, "You don't seem to have %s %s.\r\n", AN(arg1), arg1); send_to_char(ch, "You don't seem to have %s %s.\r\n", AN(arg1), arg1);
@ -1477,11 +1482,12 @@ ACMD(do_remove)
if (dotmode == FIND_ALL) { if (dotmode == FIND_ALL) {
found = 0; found = 0;
for (i = 0; i < NUM_WEARS; i++) for (i = 0; i < NUM_WEARS; i++) {
if (GET_EQ(ch, i)) { if (GET_EQ(ch, i)) {
perform_remove(ch, i); perform_remove(ch, i);
found = 1; found = 1;
} }
}
if (!found) if (!found)
send_to_char(ch, "You're not using anything.\r\n"); send_to_char(ch, "You're not using anything.\r\n");
} else if (dotmode == FIND_ALLDOT) { } else if (dotmode == FIND_ALLDOT) {
@ -1489,12 +1495,13 @@ ACMD(do_remove)
send_to_char(ch, "Remove all of what?\r\n"); send_to_char(ch, "Remove all of what?\r\n");
else { else {
found = 0; found = 0;
for (i = 0; i < NUM_WEARS; i++) for (i = 0; i < NUM_WEARS; i++) {
if (GET_EQ(ch, i) && CAN_SEE_OBJ(ch, GET_EQ(ch, i)) && if (GET_EQ(ch, i) && CAN_SEE_OBJ(ch, GET_EQ(ch, i)) &&
isname(arg, GET_EQ(ch, i)->name)) { isname(arg, GET_EQ(ch, i)->name)) {
perform_remove(ch, i); perform_remove(ch, i);
found = 1; found = 1;
} }
}
if (!found) if (!found)
send_to_char(ch, "You don't seem to be using any %ss.\r\n", arg); send_to_char(ch, "You don't seem to be using any %ss.\r\n", arg);
} }

View file

@ -696,9 +696,9 @@ ACMD(do_enter)
return; return;
} }
send_to_char(ch, "There is no %s here.\r\n", buf); send_to_char(ch, "There is no %s here.\r\n", buf);
} else if (ROOM_FLAGGED(IN_ROOM(ch), ROOM_INDOORS)) } else if (ROOM_FLAGGED(IN_ROOM(ch), ROOM_INDOORS)) {
send_to_char(ch, "You are already indoors.\r\n"); send_to_char(ch, "You are already indoors.\r\n");
else { } else {
/* try to locate an entrance */ /* try to locate an entrance */
for (door = 0; door < DIR_COUNT; door++) for (door = 0; door < DIR_COUNT; door++)
if (EXIT(ch, door)) if (EXIT(ch, door))

View file

@ -522,7 +522,7 @@ static void do_stat_room(struct char_data *ch, struct room_data *rm)
sprinttype(rm->sector_type, sector_types, buf2, sizeof(buf2)); sprinttype(rm->sector_type, sector_types, buf2, sizeof(buf2));
send_to_char(ch, "Zone: [%3d], VNum: [%s%5d%s], RNum: [%5d], IDNum: [%5ld], Type: %s\r\n", send_to_char(ch, "Zone: [%3d], VNum: [%s%5d%s], RNum: [%5d], IDNum: [%5ld], Type: %s\r\n",
zone_table[rm->zone].number, CCGRN(ch, C_NRM), rm->number, zone_table[rm->zone].number, CCGRN(ch, C_NRM), rm->number,
CCNRM(ch, C_NRM), IN_ROOM(ch), (long) rm->number + ROOM_ID_BASE, buf2); CCNRM(ch, C_NRM), real_room(rm->number), (long) rm->number + ROOM_ID_BASE, buf2);
sprintbitarray(rm->room_flags, room_bits, RF_ARRAY_MAX, buf2); sprintbitarray(rm->room_flags, room_bits, RF_ARRAY_MAX, buf2);
send_to_char(ch, "SpecProc: %s, Flags: %s\r\n", rm->func == NULL ? "None" : get_spec_func_name(rm->func), buf2); send_to_char(ch, "SpecProc: %s, Flags: %s\r\n", rm->func == NULL ? "None" : get_spec_func_name(rm->func), buf2);
@ -1785,7 +1785,7 @@ ACMD(do_advance)
} }
oldlevel = GET_LEVEL(victim); oldlevel = GET_LEVEL(victim);
if (newlevel < GET_LEVEL(victim)) { if (newlevel < GET_LEVEL(victim)) {
do_start(victim); do_start(victim); /* Send 'em back to level 1, then advance */
GET_LEVEL(victim) = newlevel; GET_LEVEL(victim) = newlevel;
send_to_char(victim, "You are momentarily enveloped by darkness!\r\nYou feel somewhat diminished.\r\n"); send_to_char(victim, "You are momentarily enveloped by darkness!\r\nYou feel somewhat diminished.\r\n");
} else { } else {

View file

@ -715,7 +715,7 @@ static void cedit_disp_admin_levels(struct descriptor_data *d)
write_to_output(d, "\r\n\r\n"); write_to_output(d, "\r\n\r\n");
for (i=ADMLVL_IMMORT; i<=ADMLVL_IMPL; i++) { for (i=ADMLVL_IMMORT; i<=ADMLVL_IMPL; i++) {
write_to_output(d, "%sd%s) %s%s%s\r\n", grn, nrm, cyn, admin_level_names[i], nrm); write_to_output(d, "%s%d%s) %s%s%s\r\n", grn, i, nrm, cyn, admin_level_names[i], nrm);
} }
} }

View file

@ -1440,6 +1440,7 @@ void roll_real_abils(struct char_data *ch)
void do_start(struct char_data *ch) void do_start(struct char_data *ch)
{ {
GET_LEVEL(ch) = 1; GET_LEVEL(ch) = 1;
GET_ADMLEVEL(ch) = ADMLVL_MORTAL;
GET_EXP(ch) = 1; GET_EXP(ch) = 1;
set_title(ch, NULL); set_title(ch, NULL);

View file

@ -569,6 +569,31 @@ const char *container_bits[] = {
"\n", "\n",
}; };
/** Flag descriptions for HOUSE_ flags
* @pre Must be in the same order as the defines.
* Must end array with a single newline. */
const char *house_bits[] = {
"NO_GUEST",
"FREE",
"NO_IMM",
"IMP_ONLY",
"RENTFREE",
"SAVE_!RENT",
"NO_SAVE",
"NO_SPEC",
"\n"
};
/** House mode types for HOUSE_ mode values
* @pre Must be in the same order as the defines.
* Must end array with a single newline. */
const char *house_types[] = {
"PLAYER_OWNED",
"IMM_OWNED",
"CLAN_OWNED",
"\n"
};
/** Describes the liquid description. /** Describes the liquid description.
* @pre Must be in the same order as the defines. * @pre Must be in the same order as the defines.
* Must end array with a single newline. */ * Must end array with a single newline. */

View file

@ -36,6 +36,8 @@ extern const char *wear_bits[];
extern const char *extra_bits[]; extern const char *extra_bits[];
extern const char *apply_types[]; extern const char *apply_types[];
extern const char *container_bits[]; extern const char *container_bits[];
extern const char *house_bits[];
extern const char *house_types[];
extern const char *drinks[]; extern const char *drinks[];
extern const char *drinknames[]; extern const char *drinknames[];
extern const char *color_liquid[]; extern const char *color_liquid[];

File diff suppressed because it is too large Load diff

View file

@ -12,29 +12,61 @@
#ifndef _HOUSE_H_ #ifndef _HOUSE_H_
#define _HOUSE_H_ #define _HOUSE_H_
#define MAX_HOUSES 100 #define MAX_HOUSES 100 /* Maximum number of houses in the MUD */
#define MAX_GUESTS 10 #define MAX_GUESTS 10 /* Maximum number of guests per house */
#define HOUSE_PRIVATE 0 /* House modes/types */
#define HOUSE_PRIVATE 0 /* A Normal Player-Owned House */
#define HOUSE_GOD 1 /* Imm owned house */
#define HOUSE_SHOP 2 /* Player-Owned Shop */
struct house_control_rec { #define NUM_HOUSE_TYPES 3
room_vnum vnum; /* vnum of this house */
room_vnum atrium; /* vnum of atrium */ /* House Flags - also see string constants, in constants.c */
sh_int exit_num; /* direction of house's exit */ #define HOUSE_NOGUESTS 0 /* Owner cannot add guests */
time_t built_on; /* date this house was built */ #define HOUSE_FREE 1 /* House does not require payments */
int mode; /* mode of ownership */ #define HOUSE_NOIMMS 2 /* Imms below level 2 cannot enter */
long owner; /* idnum of house's owner */ #define HOUSE_IMPONLY 3 /* Imms below level 4 cannot enter */
int num_of_guests; /* how many guests for house */ #define HOUSE_RENTFREE 4 /* No rent is charged on items left here */
long guests[MAX_GUESTS]; /* idnums of house's guests */ #define HOUSE_SAVENORENT 5 /* NORENT items are crashsaved too */
time_t last_payment; /* date of last house payment */ #define HOUSE_NOSAVE 6 /* Do not crash save this room - private only */
long spare0; #define HOUSE_NOSPEC 7 /* Don't use 'standard' spec proc for house type */
long spare1;
long spare2; #define HOUSE_NUM_FLAGS 8
long spare3;
long spare4; /** House flags.
long spare5; * @param loc The house_control_data structure. */
long spare6; #define HOUSE_FLAGS(loc) ((loc)->house_flags)
long spare7;
/** House flagged.
* @param loc The house_control_data structure. *
* flag The house flag (see above) */
#define HOUSE_FLAGGED(loc, flag) ((loc) && IS_SET_AR(HOUSE_FLAGS(loc), (flag)))
#define TOROOM(room, dir) (world[room].dir_option[dir] ? \
world[room].dir_option[dir]->to_room : NOWHERE)
/* List structure for house guests */
struct guest_data {
long id; /**< The ID number of this guest */
struct guest_data *next; /**< pointer to next guest in list */
};
/* List structure for houses */
struct house_control_data {
room_vnum vnum; /**< vnum of this house */
room_vnum atrium; /**< vnum of atrium */
sh_int exit_num; /**< direction of house's exit */
time_t built_on; /**< date this house was built */
long built_by; /**< The ID of the builder (hsedit) */
long owner; /**< idnum of house's owner */
int mode; /**< mode of ownership */
struct guest_data *guests; /**< idnums of house's guests */
time_t last_payment; /**< date of last house payment */
int house_flags[HS_ARRAY_MAX]; /**< House Flags (hsedit) */
mob_vnum receptionist; /**< The Receptionist/Shopkeeper */
struct house_control_data *next; /**< pointer to next house in list */
}; };
#define TOROOM(room, dir) (world[room].dir_option[dir] ? \ #define TOROOM(room, dir) (world[room].dir_option[dir] ? \
@ -46,12 +78,32 @@ void House_boot(void);
void House_save_all(void); void House_save_all(void);
int House_can_enter(struct char_data *ch, room_vnum house); int House_can_enter(struct char_data *ch, room_vnum house);
void House_crashsave(room_vnum vnum); void House_crashsave(room_vnum vnum);
void House_list_guests(struct char_data *ch, int i, int quiet); void House_list_guests(struct char_data *ch, struct house_control_data *h, int quiet);
int House_save(struct obj_data *obj, FILE *fp); int House_save(struct obj_data *obj, FILE *fp);
void House_save_control(void);
void House_delete_file(room_vnum vnum);
void hcontrol_list_houses(struct char_data *ch, char *arg); void hcontrol_list_houses(struct char_data *ch, char *arg);
void set_house(struct house_control_data *h);
void free_house_guests(struct house_control_data *h);
void clear_house_control_data(struct house_control_data *h);
void add_house_guest(struct house_control_data *h_data, long guest_id);
int count_house_guests(struct house_control_data *h);
bool is_house_guest(struct house_control_data *h, long id_num);
bool remove_house_guest(struct house_control_data *h, long id_num);
int count_houses(void);
void free_house(struct house_control_data *h);
void free_house_list(void);
bool delete_house_control(struct house_control_data *to_del);
struct house_control_data *new_house(void);
struct house_control_data *add_house(struct house_control_data *h_data);
struct house_control_data *find_house(room_vnum vnum);
/* In game Commands */ /* In game Commands */
ACMD(do_hcontrol); ACMD(do_hcontrol);
ACMD(do_house); ACMD(do_house);
/* Spec-procs in house.c */
SPECIAL(house_shopkeeper);
SPECIAL(house_receptionist);
#endif /* _HOUSE_H_ */ #endif /* _HOUSE_H_ */

1134
src/hsedit.c Executable file

File diff suppressed because it is too large Load diff

View file

@ -195,6 +195,7 @@ cpp_extern const struct command_info cmd_info[] = {
{ "holler" , "holler" , POS_RESTING , do_gen_comm , 1, ADMLVL_MORTAL, ADM_NONE, SCMD_HOLLER }, { "holler" , "holler" , POS_RESTING , do_gen_comm , 1, ADMLVL_MORTAL, ADM_NONE, SCMD_HOLLER },
{ "holylight", "holy" , POS_DEAD , do_gen_tog , 0, ADMLVL_IMMORT, ADM_NONE, SCMD_HOLYLIGHT }, { "holylight", "holy" , POS_DEAD , do_gen_tog , 0, ADMLVL_IMMORT, ADM_NONE, SCMD_HOLYLIGHT },
{ "house" , "house" , POS_RESTING , do_house , 0, ADMLVL_MORTAL, ADM_NONE, 0 }, { "house" , "house" , POS_RESTING , do_house , 0, ADMLVL_MORTAL, ADM_NONE, 0 },
{ "hsedit" , "hsedit" , POS_DEAD , do_oasis_hsedit,0,ADMLVL_GOD, ADM_ADVBUILD, 0 },
{ "inventory", "i" , POS_DEAD , do_inventory , 0, ADMLVL_MORTAL, ADM_NONE, 0 }, { "inventory", "i" , POS_DEAD , do_inventory , 0, ADMLVL_MORTAL, ADM_NONE, 0 },
{ "identify" , "id" , POS_STANDING, do_not_here , 1, ADMLVL_MORTAL, ADM_NONE, 0 }, { "identify" , "id" , POS_STANDING, do_not_here , 1, ADMLVL_MORTAL, ADM_NONE, 0 },
@ -1320,6 +1321,7 @@ void nanny(struct descriptor_data *d, char *arg)
{ CON_QEDIT, qedit_parse }, { CON_QEDIT, qedit_parse },
{ CON_PREFEDIT, prefedit_parse }, { CON_PREFEDIT, prefedit_parse },
{ CON_IBTEDIT, ibtedit_parse }, { CON_IBTEDIT, ibtedit_parse },
{ CON_HSEDIT, hsedit_parse },
{ -1, NULL } { -1, NULL }
}; };

View file

@ -97,6 +97,7 @@ struct oasis_olc_data {
struct trig_data *trig; struct trig_data *trig;
struct prefs_data *prefs; /* used for 'prefedit' */ struct prefs_data *prefs; /* used for 'prefedit' */
struct ibt_data *ibt; /* used for 'ibtedit' */ struct ibt_data *ibt; /* used for 'ibtedit' */
struct house_control_data *house; /* used for 'hsedit' */
int script_mode; int script_mode;
int trigger_position; int trigger_position;
int item_type; int item_type;
@ -129,6 +130,7 @@ extern const char *nrm, *grn, *cyn, *yel;
#define OLC_HELP(d) (OLC(d)->help) /**< Hedit structure */ #define OLC_HELP(d) (OLC(d)->help) /**< Hedit structure */
#define OLC_PREFS(d) (OLC(d)->prefs) /**< Preferences structure */ #define OLC_PREFS(d) (OLC(d)->prefs) /**< Preferences structure */
#define OLC_IBT(d) (OLC(d)->ibt) /**< IBT (idea/bug/typo) structure */ #define OLC_IBT(d) (OLC(d)->ibt) /**< IBT (idea/bug/typo) structure */
#define OLC_HOUSE(d) (OLC(d)->house) /**< Player-Owned House/Shop structure */
/* Other macros. */ /* Other macros. */
#define OLC_EXIT(d) (OLC_ROOM(d)->dir_option[OLC_VAL(d)]) #define OLC_EXIT(d) (OLC_ROOM(d)->dir_option[OLC_VAL(d)])
@ -381,6 +383,32 @@ extern const char *nrm, *grn, *cyn, *yel;
#define HEDIT_KEYWORDS 5 #define HEDIT_KEYWORDS 5
#define HEDIT_MIN_LEVEL 6 #define HEDIT_MIN_LEVEL 6
/*. House editor - Submodes of HSEDIT connectedness. */
#define HSEDIT_MAIN_MENU 0
#define HSEDIT_CONFIRM_SAVESTRING 1
#define HSEDIT_OWNER_MENU 2
#define HSEDIT_OWNER_NAME 3
#define HSEDIT_OWNER_ID 4
#define HSEDIT_ROOM 5
#define HSEDIT_ATRIUM 6
#define HSEDIT_DIR_MENU 7
#define HSEDIT_GUEST_MENU 8
#define HSEDIT_GUEST_ADD 9
#define HSEDIT_GUEST_DELETE 10
#define HSEDIT_GUEST_CLEAR 11
#define HSEDIT_FLAGS 12
#define HSEDIT_BUILD_DATE 13
#define HSEDIT_PAYMENT 14
#define HSEDIT_TYPE 15
#define HSEDIT_DELETE 16
#define HSEDIT_VALUE_0 17
#define HSEDIT_VALUE_1 18
#define HSEDIT_VALUE_2 19
#define HSEDIT_VALUE_3 20
#define HSEDIT_NOVNUM 21
#define HSEDIT_BUILDER 22
#define HSEDIT_RECEP 23
int save_config( IDXTYPE nowhere ); int save_config( IDXTYPE nowhere );
/* Prototypes to keep. */ /* Prototypes to keep. */
@ -450,6 +478,12 @@ ACMD(do_tedit);
/* public functions from qedit.c */ /* public functions from qedit.c */
ACMD(do_oasis_qedit); ACMD(do_oasis_qedit);
/* public functions from hsedit.c */
void hsedit_parse(struct descriptor_data * d, char *arg);
void hsedit_string_cleanup(struct descriptor_data *d, int terminator);
ACMD(do_oasis_hsedit);
/* public functions from oasis_copy.c */ /* public functions from oasis_copy.c */
int buildwalk(struct char_data *ch, int dir); int buildwalk(struct char_data *ch, int dir);
ACMD(do_dig); ACMD(do_dig);

View file

@ -18,6 +18,7 @@
#include "ban.h" /* for SPECIAL(gen_board) */ #include "ban.h" /* for SPECIAL(gen_board) */
#include "boards.h" #include "boards.h"
#include "mail.h" #include "mail.h"
#include "house.h"
SPECIAL(questmaster); SPECIAL(questmaster);
SPECIAL(shop_keeper); SPECIAL(shop_keeper);
@ -191,6 +192,8 @@ struct spec_func_data spec_func_list[] = {
{"Guild Guard", guild_guard }, {"Guild Guard", guild_guard },
{"Questmaster", questmaster }, {"Questmaster", questmaster },
{"Shopkeeper", shop_keeper }, {"Shopkeeper", shop_keeper },
{"House-Receptionist", house_receptionist },
{"House-Shopkeeper", house_shopkeeper },
{"\n", NULL} {"\n", NULL}
}; };

View file

@ -357,10 +357,11 @@
#define CON_QEDIT 28 /**< OLC mode - quest edit */ #define CON_QEDIT 28 /**< OLC mode - quest edit */
#define CON_PREFEDIT 29 /**< OLC mode - preference edit */ #define CON_PREFEDIT 29 /**< OLC mode - preference edit */
#define CON_IBTEDIT 30 /**< OLC mode - idea/bug/typo edit */ #define CON_IBTEDIT 30 /**< OLC mode - idea/bug/typo edit */
#define CON_HSEDIT 31 /**< OLC mode - house editor */
/* OLC States range - used by IS_IN_OLC and IS_PLAYING */ /* OLC States range - used by IS_IN_OLC and IS_PLAYING */
#define FIRST_OLC_STATE CON_OEDIT /**< The first CON_ state that is an OLC */ #define FIRST_OLC_STATE CON_OEDIT /**< The first CON_ state that is an OLC */
#define LAST_OLC_STATE CON_IBTEDIT /**< The last CON_ state that is an OLC */ #define LAST_OLC_STATE CON_HSEDIT /**< The last CON_ state that is an OLC */
/* Character equipment positions: used as index for char_data.equipment[] */ /* Character equipment positions: used as index for char_data.equipment[] */
/* NOTE: Don't confuse these constants with the ITEM_ bitvectors /* NOTE: Don't confuse these constants with the ITEM_ bitvectors
@ -551,6 +552,7 @@
#define EF_ARRAY_MAX 4 /**< # Bytes in Bit vector - Obj Extra Flags */ #define EF_ARRAY_MAX 4 /**< # Bytes in Bit vector - Obj Extra Flags */
#define ZN_ARRAY_MAX 4 /**< # Bytes in Bit vector - Zone Flags */ #define ZN_ARRAY_MAX 4 /**< # Bytes in Bit vector - Zone Flags */
#define AD_ARRAY_MAX 4 /**< # Bytes in Bit vector - Admin Priv Flags */ #define AD_ARRAY_MAX 4 /**< # Bytes in Bit vector - Admin Priv Flags */
#define HS_ARRAY_MAX 4 /**< # Bytes in Bit vector - House Flags */
/* other #defined constants */ /* other #defined constants */
/* **DO**NOT** blindly change the number of levels in your MUD merely by /* **DO**NOT** blindly change the number of levels in your MUD merely by