shop.h
1 /* ************************************************************************ 2 * File: shop.h Part of CircleMUD * 3 * Usage: shop file definitions, structures, constants * 4 * * 5 * All rights reserved. See license.doc for complete information. * 6 * * 7 * Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University * 8 * CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. * 9 ************************************************************************ */ 10 11 12 struct shop_buy_data { 13 int type; 14 char *keywords; 15 }; 16 17 #define BUY_TYPE(i) ((i).type) 18 #define BUY_WORD(i) ((i).keywords) 19 20 struct shop_data { 21 room_vnum vnum; /* Virtual number of this shop */ 22 obj_vnum *producing; /* Which item to produce (virtual) */ 23 float profit_buy; /* Factor to multiply cost with */ 24 float profit_sell; /* Factor to multiply cost with */ 25 struct shop_buy_data *type; /* Which items to trade */ 26 char *no_such_item1; /* Message if keeper hasn't got an item */ 27 char *no_such_item2; /* Message if player hasn't got an item */ 28 char *missing_cash1; /* Message if keeper hasn't got cash */ 29 char *missing_cash2; /* Message if player hasn't got cash */ 30 char *do_not_buy; /* If keeper dosn't buy such things */ 31 char *message_buy; /* Message when player buys item */ 32 char *message_sell; /* Message when player sells item */ 33 int temper1; /* How does keeper react if no money */ 34 bitvector_t bitvector; /* Can attack? Use bank? Cast here? */ 35 mob_rnum keeper; /* The mobile who owns the shop (rnum) */ 36 int with_who; /* Who does the shop trade with? */ 37 room_vnum *in_room; /* Where is the shop? */ 38 int open1, open2; /* When does the shop open? */ 39 int close1, close2; /* When does the shop close? */ 40 int bankAccount; /* Store all gold over 15000 (disabled) */ 41 int lastsort; /* How many items are sorted in inven? */ 42 SPECIAL (*func); /* Secondary spec_proc for shopkeeper */ 43 }; 44 45 46 #define MAX_TRADE 5 /* List maximums for compatibility */ 47 #define MAX_PROD 5 /* with shops before v3.0 */ 48 #define VERSION3_TAG "v3.0" /* The file has v3.0 shops in it! */ 49 #define MAX_SHOP_OBJ 100 /* "Soft" maximum for list maximums */ 50 51 52 /* Pretty general macros that could be used elsewhere */ 53 #define IS_GOD(ch) (!IS_NPC(ch) && (GET_LEVEL(ch) >= LVL_GOD)) 54 #define END_OF(buffer) ((buffer) + strlen((buffer))) 55 56 57 /* Possible states for objects trying to be sold */ 58 #define OBJECT_DEAD 0 59 #define OBJECT_NOTOK 1 60 #define OBJECT_OK 2 61 #define OBJECT_NOVAL 3 62 63 64 /* Types of lists to read */ 65 #define LIST_PRODUCE 0 66 #define LIST_TRADE 1 67 #define LIST_ROOM 2 68 69 70 /* Whom will we not trade with (bitvector for SHOP_TRADE_WITH()) */ 71 #define TRADE_NOGOOD (1 << 0) 72 #define TRADE_NOEVIL (1 << 1) 73 #define TRADE_NONEUTRAL (1 << 2) 74 #define TRADE_NOMAGIC_USER (1 << 3) 75 #define TRADE_NOCLERIC (1 << 4) 76 #define TRADE_NOTHIEF (1 << 5) 77 #define TRADE_NOWARRIOR (1 << 6) 78 79 80 struct stack_data { 81 int data[100]; 82 int len; 83 } ; 84 85 #define S_DATA(stack, index) ((stack)->data[(index)]) 86 #define S_LEN(stack) ((stack)->len) 87 88 89 /* Which expression type we are now parsing */ 90 #define OPER_OPEN_PAREN 0 91 #define OPER_CLOSE_PAREN 1 92 #define OPER_OR 2 93 #define OPER_AND 3 94 #define OPER_NOT 4 95 #define MAX_OPER 4 96 97 98 #define SHOP_NUM(i) (shop_index[(i)].vnum) 99 #define SHOP_KEEPER(i) (shop_index[(i)].keeper) 100 #define SHOP_OPEN1(i) (shop_index[(i)].open1) 101 #define SHOP_CLOSE1(i) (shop_index[(i)].close1) 102 #define SHOP_OPEN2(i) (shop_index[(i)].open2) 103 #define SHOP_CLOSE2(i) (shop_index[(i)].close2) 104 #define SHOP_ROOM(i, num) (shop_index[(i)].in_room[(num)]) 105 #define SHOP_BUYTYPE(i, num) (BUY_TYPE(shop_index[(i)].type[(num)])) 106 #define SHOP_BUYWORD(i, num) (BUY_WORD(shop_index[(i)].type[(num)])) 107 #define SHOP_PRODUCT(i, num) (shop_index[(i)].producing[(num)]) 108 #define SHOP_BANK(i) (shop_index[(i)].bankAccount) 109 #define SHOP_BROKE_TEMPER(i) (shop_index[(i)].temper1) 110 #define SHOP_BITVECTOR(i) (shop_index[(i)].bitvector) 111 #define SHOP_TRADE_WITH(i) (shop_index[(i)].with_who) 112 #define SHOP_SORT(i) (shop_index[(i)].lastsort) 113 #define SHOP_BUYPROFIT(i) (shop_index[(i)].profit_buy) 114 #define SHOP_SELLPROFIT(i) (shop_index[(i)].profit_sell) 115 #define SHOP_FUNC(i) (shop_index[(i)].func) 116 117 #define NOTRADE_GOOD(i) (IS_SET(SHOP_TRADE_WITH((i)), TRADE_NOGOOD)) 118 #define NOTRADE_EVIL(i) (IS_SET(SHOP_TRADE_WITH((i)), TRADE_NOEVIL)) 119 #define NOTRADE_NEUTRAL(i) (IS_SET(SHOP_TRADE_WITH((i)), TRADE_NONEUTRAL)) 120 #define NOTRADE_MAGIC_USER(i) (IS_SET(SHOP_TRADE_WITH((i)), TRADE_NOMAGIC_USER)) 121 #define NOTRADE_CLERIC(i) (IS_SET(SHOP_TRADE_WITH((i)), TRADE_NOCLERIC)) 122 #define NOTRADE_THIEF(i) (IS_SET(SHOP_TRADE_WITH((i)), TRADE_NOTHIEF)) 123 #define NOTRADE_WARRIOR(i) (IS_SET(SHOP_TRADE_WITH((i)), TRADE_NOWARRIOR)) 124 125 126 127 #define WILL_START_FIGHT (1 << 0) 128 #define WILL_BANK_MONEY (1 << 1) 129 130 #define SHOP_KILL_CHARS(i) (IS_SET(SHOP_BITVECTOR(i), WILL_START_FIGHT)) 131 #define SHOP_USES_BANK(i) (IS_SET(SHOP_BITVECTOR(i), WILL_BANK_MONEY)) 132 133 134 #define MIN_OUTSIDE_BANK 5000 135 #define MAX_OUTSIDE_BANK 15000 136 137 #define MSG_NOT_OPEN_YET "Come back later!" 138 #define MSG_NOT_REOPEN_YET "Sorry, we have closed, but come back later." 139 #define MSG_CLOSED_FOR_DAY "Sorry, come back tomorrow." 140 #define MSG_NO_STEAL_HERE "$n is a bloody thief!" 141 #define MSG_NO_SEE_CHAR "I don't trade with someone I can't see!" 142 #define MSG_NO_SELL_ALIGN "Get out of here before I call the guards!" 143 #define MSG_NO_SELL_CLASS "We don't serve your kind here!" 144 #define MSG_NO_USED_WANDSTAFF "I don't buy used up wands or staves!" 145 #define MSG_CANT_KILL_KEEPER "Get out of here before I call the guards!" 146