mirror of
https://github.com/tbamud/tbamud.git
synced 2025-09-22 05:50:48 +02:00
Object Events and some formatting corrections.
This commit is contained in:
parent
36f35cdf55
commit
f0d34e6cd6
5 changed files with 55 additions and 35 deletions
|
@ -1521,49 +1521,49 @@ ACMD(do_sac)
|
|||
one_argument(argument, arg);
|
||||
|
||||
if (!*arg) {
|
||||
send_to_char(ch, "Sacrifice what?\n\r");
|
||||
return;
|
||||
}
|
||||
|
||||
send_to_char(ch, "Sacrifice what?\n\r");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(j = get_obj_in_list_vis(ch, arg, NULL, world[IN_ROOM(ch)].contents)) && (!(j = get_obj_in_list_vis(ch, arg, NULL, ch->carrying)))) {
|
||||
send_to_char(ch, "It doesn't seem to be here.\n\r");
|
||||
return;
|
||||
}
|
||||
send_to_char(ch, "It doesn't seem to be here.\n\r");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!CAN_WEAR(j, ITEM_WEAR_TAKE)) {
|
||||
send_to_char(ch, "You can't sacrifice that!\n\r");
|
||||
return;
|
||||
}
|
||||
send_to_char(ch, "You can't sacrifice that!\n\r");
|
||||
return;
|
||||
}
|
||||
|
||||
act("$n sacrifices $p.", FALSE, ch, j, 0, TO_ROOM);
|
||||
|
||||
switch (rand_number(0, 5)) {
|
||||
case 0:
|
||||
send_to_char(ch, "You sacrifice %s to the Gods.\r\nYou receive one gold coin for your humility.\r\n", GET_OBJ_SHORT(j));
|
||||
increase_gold(ch, 1);
|
||||
break;
|
||||
case 1:
|
||||
send_to_char(ch, "You sacrifice %s to the Gods.\r\nThe Gods ignore your sacrifice.\r\n", GET_OBJ_SHORT(j));
|
||||
break;
|
||||
case 2:
|
||||
send_to_char(ch, "You sacrifice %s to the Gods.\r\nThe gods give you %d experience points.\r\n", GET_OBJ_SHORT(j), (2*GET_OBJ_COST(j)));
|
||||
GET_EXP(ch) += (2*GET_OBJ_COST(j));
|
||||
break;
|
||||
case 3:
|
||||
send_to_char(ch, "You sacrifice %s to the Gods.\r\nYou receive %d experience points.\r\n", GET_OBJ_SHORT(j), GET_OBJ_COST(j));
|
||||
GET_EXP(ch) += GET_OBJ_COST(j);
|
||||
break;
|
||||
case 4:
|
||||
send_to_char(ch, "Your sacrifice to the Gods is rewarded with %d gold coins.\r\n", GET_OBJ_COST(j));
|
||||
increase_gold(ch, GET_OBJ_COST(j));
|
||||
break;
|
||||
case 5:
|
||||
send_to_char(ch, "Your sacrifice to the Gods is rewarded with %d gold coins\r\n", (2*GET_OBJ_COST(j)));
|
||||
increase_gold(ch, (2*GET_OBJ_COST(j)));
|
||||
break;
|
||||
case 0:
|
||||
send_to_char(ch, "You sacrifice %s to the Gods.\r\nYou receive one gold coin for your humility.\r\n", GET_OBJ_SHORT(j));
|
||||
increase_gold(ch, 1);
|
||||
break;
|
||||
case 1:
|
||||
send_to_char(ch, "You sacrifice %s to the Gods.\r\nThe Gods ignore your sacrifice.\r\n", GET_OBJ_SHORT(j));
|
||||
break;
|
||||
case 2:
|
||||
send_to_char(ch, "You sacrifice %s to the Gods.\r\nThe gods give you %d experience points.\r\n", GET_OBJ_SHORT(j), (2*GET_OBJ_COST(j)));
|
||||
GET_EXP(ch) += (2*GET_OBJ_COST(j));
|
||||
break;
|
||||
case 3:
|
||||
send_to_char(ch, "You sacrifice %s to the Gods.\r\nYou receive %d experience points.\r\n", GET_OBJ_SHORT(j), GET_OBJ_COST(j));
|
||||
GET_EXP(ch) += GET_OBJ_COST(j);
|
||||
break;
|
||||
case 4:
|
||||
send_to_char(ch, "Your sacrifice to the Gods is rewarded with %d gold coins.\r\n", GET_OBJ_COST(j));
|
||||
increase_gold(ch, GET_OBJ_COST(j));
|
||||
break;
|
||||
case 5:
|
||||
send_to_char(ch, "Your sacrifice to the Gods is rewarded with %d gold coins\r\n", (2*GET_OBJ_COST(j)));
|
||||
increase_gold(ch, (2*GET_OBJ_COST(j)));
|
||||
break;
|
||||
default:
|
||||
send_to_char(ch, "You sacrifice %s to the Gods.\r\nYou receive one gold coin for your humility.\r\n", GET_OBJ_SHORT(j));
|
||||
increase_gold(ch, 1);
|
||||
send_to_char(ch, "You sacrifice %s to the Gods.\r\nYou receive one gold coin for your humility.\r\n",GET_OBJ_SHORT(j));
|
||||
increase_gold(ch, 1);
|
||||
break;
|
||||
}
|
||||
for (jj = j->contains; jj; jj = next_thing2) {
|
||||
|
|
6
src/db.c
6
src/db.c
|
@ -519,6 +519,7 @@ void destroy_db(void)
|
|||
event_cancel(pEvent);
|
||||
}
|
||||
free_list(world[cnt].events);
|
||||
world[cnt].events = NULL;
|
||||
}
|
||||
|
||||
/* free any assigned scripts */
|
||||
|
@ -2420,6 +2421,8 @@ struct obj_data *create_obj(void)
|
|||
clear_object(obj);
|
||||
obj->next = object_list;
|
||||
object_list = obj;
|
||||
|
||||
obj->events = NULL;
|
||||
|
||||
GET_ID(obj) = max_obj_id++;
|
||||
/* find_obj helper */
|
||||
|
@ -2444,6 +2447,8 @@ struct obj_data *read_object(obj_vnum nr, int type) /* and obj_rnum */
|
|||
*obj = obj_proto[i];
|
||||
obj->next = object_list;
|
||||
object_list = obj;
|
||||
|
||||
obj->events = NULL;
|
||||
|
||||
obj_index[i].number++;
|
||||
|
||||
|
@ -3233,6 +3238,7 @@ void free_char(struct char_data *ch)
|
|||
event_cancel(pEvent);
|
||||
}
|
||||
free_list(ch->events);
|
||||
ch->events = NULL;
|
||||
}
|
||||
|
||||
/* new version of free_followers take the followers pointer as arg */
|
||||
|
|
|
@ -176,6 +176,7 @@ int delete_room(room_rnum rnum)
|
|||
event_cancel(pEvent);
|
||||
}
|
||||
free_list(room->events);
|
||||
room->events = NULL;
|
||||
}
|
||||
|
||||
/* Change any exit going to this room to go the void. Also fix all the exits
|
||||
|
|
|
@ -816,6 +816,17 @@ void extract_obj(struct obj_data *obj)
|
|||
if (SCRIPT(obj))
|
||||
extract_script(obj, OBJ_TRIGGER);
|
||||
|
||||
if (obj->events != NULL) {
|
||||
if (obj->events->iSize > 0) {
|
||||
struct event * pEvent;
|
||||
|
||||
while ((pEvent = simple_list(obj->events)) != NULL)
|
||||
event_cancel(pEvent);
|
||||
}
|
||||
free_list(obj->events);
|
||||
obj->events = NULL;
|
||||
}
|
||||
|
||||
if (GET_OBJ_RNUM(obj) == NOTHING || obj->proto_script != obj_proto[GET_OBJ_RNUM(obj)].proto_script)
|
||||
free_proto_script(obj, OBJ_TRIGGER);
|
||||
|
||||
|
|
|
@ -732,6 +732,8 @@ struct obj_data
|
|||
struct obj_data *next_content; /**< For 'contains' lists */
|
||||
struct obj_data *next; /**< For the object list */
|
||||
struct char_data *sitting_here; /**< For furniture, who is sitting in it */
|
||||
|
||||
struct list_data *events; /**< Used for object events */
|
||||
};
|
||||
|
||||
/** Instance info for an object that gets saved to disk.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue