Changeset 856

Show
Ignore:
Timestamp:
04/28/08 22:51:05 (3 months ago)
Author:
takkaria
Message:

#433:

  • Remove individual-shopkeeper and race-based price changes from the store code, to make it easier to balance pricing.
  • Adjust adj_chr_gold[] values upwards to represent the average-110% inflation usually applied by the individual-shopkeeper greed values. This should really be applied to the object.txt file, though.
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/init1.c

    r849 r856  
    29722972 
    29732973                /* Scan for the values */ 
    2974                 if (3 != sscanf(buf+2, "%d:%d:%d", 
    2975                                     &idx, &gld, &inflate)) return (PARSE_ERROR_GENERIC); 
     2974                if (3 != sscanf(buf+2, "%d:%d", 
     2975                                    &idx, &gld)) return (PARSE_ERROR_GENERIC); 
    29762976 
    29772977                /* Save the values */ 
    29782978                ot_ptr->owner_race = idx; 
    29792979                ot_ptr->max_cost = gld; 
    2980                 ot_ptr->inflate = inflate; 
    29812980        } 
    29822981        else 
     
    29912990 
    29922991 
    2993  
    2994  
    2995 /* 
    2996  * Initialize the "g_info" array, by parsing an ascii "template" file 
    2997  */ 
    2998 errr parse_g_info(char *buf, header *head) 
    2999 { 
    3000         int i, j; 
    3001  
    3002         char *s; 
    3003  
    3004         /* Current entry */ 
    3005         static byte *g_ptr; 
    3006  
    3007  
    3008         /* Process 'A' for "Adjustments" */ 
    3009         if (buf[0] == 'A') 
    3010         { 
    3011                 int adj; 
    3012  
    3013                 /* Start the string */ 
    3014                 s = buf+1; 
    3015  
    3016                 /* Initialize the counter to max races */ 
    3017                 j = z_info->p_max; 
    3018  
    3019                 /* Repeat */ 
    3020                 while (j-- > 0) 
    3021                 { 
    3022                         /* Hack - get the index */ 
    3023                         i = error_idx + 1; 
    3024  
    3025                         /* Verify information */ 
    3026                         if (i <= error_idx) return (PARSE_ERROR_NON_SEQUENTIAL_RECORDS); 
    3027  
    3028                         /* Verify information */ 
    3029                         if (i >= head->info_num) return (PARSE_ERROR_TOO_MANY_ENTRIES); 
    3030  
    3031                         /* Save the index */ 
    3032                         error_idx = i; 
    3033  
    3034                         /* Point at the "info" */ 
    3035                         g_ptr = (byte*)head->info_ptr + i; 
    3036  
    3037                         /* Find the colon before the subindex */ 
    3038                         s = strchr(s, ':'); 
    3039  
    3040                         /* Verify that colon */ 
    3041                         if (!s) return (PARSE_ERROR_GENERIC); 
    3042  
    3043                         /* Nuke the colon, advance to the subindex */ 
    3044                         *s++ = '\0'; 
    3045  
    3046                         /* Get the value */ 
    3047                         adj = atoi(s); 
    3048  
    3049                         /* Save the value */ 
    3050                         *g_ptr = adj; 
    3051                 } 
    3052         } 
    3053         else 
    3054         { 
    3055                 /* Oops */ 
    3056                 return (PARSE_ERROR_UNDEFINED_DIRECTIVE); 
    3057         } 
    3058  
    3059         /* Success */ 
    3060         return (0); 
    3061 } 
    30622992 
    30632993 
  • trunk/src/init2.c

    r815 r856  
    877877 
    878878/* 
    879  * Initialize the "g_info" array 
    880  */ 
    881 static errr init_g_info(void) 
    882 { 
    883         errr err; 
    884  
    885         /* Init the header */ 
    886         init_header(&g_head, (u16b)(z_info->p_max * z_info->p_max), sizeof(byte)); 
    887  
    888 #ifdef ALLOW_TEMPLATES 
    889  
    890         /* Save a pointer to the parsing function */ 
    891         g_head.parse_info_txt = parse_g_info; 
    892  
    893 #endif /* ALLOW_TEMPLATES */ 
    894  
    895         err = init_info("cost_adj", &g_head); 
    896  
    897         /* Set the global variables */ 
    898         g_info = g_head.info_ptr; 
    899         g_name = g_head.name_ptr; 
    900         g_text = g_head.text_ptr; 
    901  
    902         return (err); 
    903 } 
    904  
    905  
    906 /* 
    907879 * Initialize the "flavor_info" array 
    908880 */ 
     
    14651437        event_signal_string(EVENT_INITSTATUS, "Initializing arrays... (owners)"); 
    14661438        if (init_b_info()) quit("Cannot initialize owners"); 
    1467  
    1468         /* Initialize price info */ 
    1469         event_signal_string(EVENT_INITSTATUS, "Initializing arrays... (prices)"); 
    1470         if (init_g_info()) quit("Cannot initialize prices"); 
    14711439 
    14721440        /* Initialize flavor info */ 
  • trunk/src/store.c

    r847 r856  
    393393 *               == FALSE means the shop is selling, player buying 
    394394 * 
    395  * This function takes into account the player's charisma, and the 
    396  * shop-keepers friendliness, and the shop-keeper's base greed, but 
     395 * This function takes into account the player's charisma, but 
    397396 * never lets a shop-keeper lose money in a transaction. 
    398397 * 
     
    401400 * 
    402401 * Hack -- the black market always charges twice as much as it should. 
    403  * 
    404  * Charisma adjustment runs from 80 to 130 
    405  * Racial adjustment runs from 95 to 130 
    406  * 
    407  * Since greed/charisma/racial adjustments are centered at 100, we need 
    408  * to adjust (by 200) to extract a usable multiplier.  Note that the 
    409  * "greed" value is always something (?). 
    410402 */ 
    411403s32b price_item(const object_type *o_ptr, bool store_buying, int qty) 
    412404{ 
    413         int factor; 
    414405        int adjust; 
    415406        s32b price; 
    416407 
    417408        owner_type *ot_ptr = store_owner(store_current); 
    418  
    419         /* The greed value is always of the current store's owner */ 
    420         int greed = ot_ptr->inflate; 
    421409 
    422410 
     
    431419 
    432420 
    433         /* Compute the racial factor */ 
    434         factor = g_info[(ot_ptr->owner_race * z_info->p_max) + p_ptr->prace]; 
    435  
    436421        /* Add in the charisma factor */ 
    437         factor += adj_chr_gold[p_ptr->stat_ind[A_CHR]]; 
     422        if (store_current == STORE_B_MARKET) 
     423                adjust = 150; 
     424        else 
     425                adjust = adj_chr_gold[p_ptr->stat_ind[A_CHR]]; 
    438426 
    439427 
     
    441429        if (store_buying) 
    442430        { 
    443                 /* Adjust for greed */ 
    444                 adjust = 100 + (300 - (greed + factor)); 
    445  
    446                 /* Never get "silly" */ 
     431                /* Set the factor */ 
     432                adjust = 100 + (100 - adjust); 
    447433                if (adjust > 100) adjust = 100; 
    448434 
     
    454440        else 
    455441        { 
    456                 /* Adjust for greed */ 
    457                 adjust = 100 + ((greed + factor) - 300); 
    458  
    459                 /* Never get "silly" */ 
     442                /* Fix the factor */ 
    460443                if (adjust < 100) adjust = 100; 
    461444 
  • trunk/src/tables.c

    r855 r856  
    246246const byte adj_chr_gold[] = 
    247247{ 
    248         130   /* 3 */, 
    249         125   /* 4 */, 
    250         122   /* 5 */, 
    251         120   /* 6 */, 
    252         118   /* 7 */, 
    253         116   /* 8 */, 
    254         114   /* 9 */, 
    255         112   /* 10 */, 
    256         110   /* 11 */, 
    257         108   /* 12 */, 
    258         106   /* 13 */, 
    259         104   /* 14 */, 
    260         103   /* 15 */, 
    261         102   /* 16 */, 
    262         101   /* 17 */, 
    263         100   /* 18/00-18/09 */, 
    264         99    /* 18/10-18/19 */, 
    265         98    /* 18/20-18/29 */, 
    266         97    /* 18/30-18/39 */, 
    267         96    /* 18/40-18/49 */, 
    268         95    /* 18/50-18/59 */, 
    269         94    /* 18/60-18/69 */, 
    270         93    /* 18/70-18/79 */, 
    271         92    /* 18/80-18/89 */, 
    272         91    /* 18/90-18/99 */, 
    273         90    /* 18/100-18/109 */, 
    274         89    /* 18/110-18/119 */, 
    275         88    /* 18/120-18/129 */, 
    276         87    /* 18/130-18/139 */, 
    277         86    /* 18/140-18/149 */, 
    278         85    /* 18/150-18/159 */, 
    279         84    /* 18/160-18/169 */, 
    280         83    /* 18/170-18/179 */, 
    281         82    /* 18/180-18/189 */, 
    282         81    /* 18/190-18/199 */, 
    283         80    /* 18/200-18/209 */, 
    284         80    /* 18/210-18/219 */, 
    285         80    /* 18/220+ */ 
     248        143   /* 3 */, 
     249        137   /* 4 */, 
     250        134   /* 5 */, 
     251        132   /* 6 */, 
     252        129   /* 7 */, 
     253        127   /* 8 */, 
     254        123   /* 9 */, 
     255        122   /* 10 */, 
     256        121   /* 11 */, 
     257        118   /* 12 */, 
     258        116   /* 13 */, 
     259        113   /* 14 */, 
     260        113   /* 15 */, 
     261        112   /* 16 */, 
     262        111   /* 17 */, 
     263        110   /* 18/00-18/09 */, 
     264        108   /* 18/10-18/19 */, 
     265        107   /* 18/20-18/29 */, 
     266        106   /* 18/30-18/39 */, 
     267        105   /* 18/40-18/49 */, 
     268        104   /* 18/50-18/59 */, 
     269        103   /* 18/60-18/69 */, 
     270        102   /* 18/70-18/79 */, 
     271        101   /* 18/80-18/89 */, 
     272        100   /* 18/90-18/99 */, 
     273        99    /* 18/100-18/109 */, 
     274        97    /* 18/110-18/119 */, 
     275        96    /* 18/120-18/129 */, 
     276        95    /* 18/130-18/139 */, 
     277        94    /* 18/140-18/149 */, 
     278        93    /* 18/150-18/159 */, 
     279        92    /* 18/160-18/169 */, 
     280        91    /* 18/170-18/179 */, 
     281        90    /* 18/180-18/189 */, 
     282        90    /* 18/190-18/199 */, 
     283        90    /* 18/200-18/209 */, 
     284        90    /* 18/210-18/219 */, 
     285        90    /* 18/220+ */ 
    286286}; 
    287287 
  • trunk/src/types.h

    r849 r856  
    579579        s32b max_cost;          /* Purse limit */ 
    580580 
    581         byte inflate;           /* Inflation */ 
    582  
    583581        byte owner_race;        /* Owner race */ 
    584582}; 
  • trunk/src/variable.c

    r816 r856  
    640640 
    641641/* 
    642  * The racial price adjustment arrays 
    643  */ 
    644 byte *g_info; 
    645 char *g_name; 
    646 char *g_text; 
    647  
    648  
    649 /* 
    650642 * The object flavor arrays 
    651643 */