Added protocols,lists and events, and fixed some bugs... refer to changelog.

This commit is contained in:
Vatiken
2012-02-12 22:07:50 +00:00
parent 6dadf24c51
commit dd280c1b58
22 changed files with 419 additions and 89 deletions

View File

@@ -85,7 +85,7 @@ static char *times_message(struct obj_data *obj, char *name, int num);
static int buy_price(struct obj_data *obj, int shop_nr, struct char_data *keeper, struct char_data *buyer);
static int sell_price(struct obj_data *obj, int shop_nr, struct char_data *keeper, struct char_data *seller);
static int ok_shop_room(int shop_nr, room_vnum room);
static int add_to_list(struct shop_buy_data *list, int type, int *len, int *val);
static int add_to_shop_list(struct shop_buy_data *list, int type, int *len, int *val);
static int end_read_list(struct shop_buy_data *list, int len, int error);
static void read_line(FILE *shop_f, const char *string, void *data);
@@ -532,14 +532,18 @@ static void shopping_buy(char *arg, struct char_data *ch, struct char_data *keep
}
}
}
if (IS_CARRYING_N(ch) + 1 > CAN_CARRY_N(ch)) {
send_to_char(ch, "%s: You can't carry any more items.\r\n", fname(obj->name));
return;
}
if (IS_CARRYING_W(ch) + GET_OBJ_WEIGHT(obj) > CAN_CARRY_W(ch)) {
send_to_char(ch, "%s: You can't carry that much weight.\r\n", fname(obj->name));
return;
if (IS_NPC(ch) || (!IS_NPC(ch) && !PRF_FLAGGED(ch, PRF_NOHASSLE))) {
if (IS_CARRYING_N(ch) + 1 > CAN_CARRY_N(ch)) {
send_to_char(ch, "%s: You can't carry any more items.\r\n", fname(obj->name));
return;
}
if (IS_CARRYING_W(ch) + GET_OBJ_WEIGHT(obj) > CAN_CARRY_W(ch)) {
send_to_char(ch, "%s: You can't carry that much weight.\r\n", fname(obj->name));
return;
}
}
if (OBJ_FLAGGED(obj, ITEM_QUEST)) {
while (obj &&
(GET_QUESTPOINTS(ch) >= GET_OBJ_COST(obj) || IS_GOD(ch))
@@ -1019,7 +1023,7 @@ int ok_damage_shopkeeper(struct char_data *ch, struct char_data *victim)
}
/* val == obj_vnum and obj_rnum (?) */
static int add_to_list(struct shop_buy_data *list, int type, int *len, int *val)
static int add_to_shop_list(struct shop_buy_data *list, int type, int *len, int *val)
{
if (*val != NOTHING && *val >= 0) { /* necessary after changing to unsigned v/rnums -- Welcor */
if (*len < MAX_SHOP_OBJ) {
@@ -1066,12 +1070,12 @@ static int read_list(FILE *shop_f, struct shop_buy_data *list, int new_format,
read_line(shop_f, "%d", &temp);
if (temp < 0) /* Always "-1" the string. */
break;
error += add_to_list(list, type, &len, &temp);
error += add_to_shop_list(list, type, &len, &temp);
}
} else
for (count = 0; count < max; count++) {
read_line(shop_f, "%d", &temp);
error += add_to_list(list, type, &len, &temp);
error += add_to_shop_list(list, type, &len, &temp);
}
return (end_read_list(list, len, error));
}
@@ -1115,7 +1119,7 @@ static int read_type_list(FILE *shop_f, struct shop_buy_data *list,
ptr++;
while (isspace(*(END_OF(ptr) - 1)))
*(END_OF(ptr) - 1) = '\0';
error += add_to_list(list, LIST_TRADE, &len, &num);
error += add_to_shop_list(list, LIST_TRADE, &len, &num);
if (*ptr)
BUY_WORD(list[len - 1]) = strdup(ptr);
} while (num >= 0);