1 | /* |
1 | /* |
2 | * static char *rcsid_apply_c = |
2 | * static char *rcsid_apply_c = |
3 | * "$Id: apply.c,v 1.1.1.2 2006/02/22 18:03:18 elmex Exp $"; |
3 | * "$Id: apply.c,v 1.10 2006/06/19 10:15:44 root Exp $"; |
4 | */ |
4 | */ |
5 | /* |
5 | /* |
6 | CrossFire, A Multiplayer game for X-windows |
6 | CrossFire, A Multiplayer game for X-windows |
7 | |
7 | |
8 | Copyright (C) 2001 Mark Wedel & Crossfire Development Team |
8 | Copyright (C) 2001 Mark Wedel & Crossfire Development Team |
… | |
… | |
981 | * convert_item() returns 1 if anything was converted, 0 if the item was not |
981 | * convert_item() returns 1 if anything was converted, 0 if the item was not |
982 | * what the converter wants, -1 if the converter is broken. |
982 | * what the converter wants, -1 if the converter is broken. |
983 | */ |
983 | */ |
984 | #define CONV_FROM(xyz) xyz->slaying |
984 | #define CONV_FROM(xyz) xyz->slaying |
985 | #define CONV_TO(xyz) xyz->other_arch |
985 | #define CONV_TO(xyz) xyz->other_arch |
986 | #define CONV_NR(xyz) (unsigned char) xyz->stats.sp |
986 | #define CONV_NR(xyz) xyz->stats.sp |
987 | #define CONV_NEED(xyz) (unsigned long) xyz->stats.food |
987 | #define CONV_NEED(xyz) xyz->stats.food |
988 | |
988 | |
989 | /* Takes one items and makes another. |
989 | /* Takes one items and makes another. |
990 | * converter is the object that is doing the conversion. |
990 | * converter is the object that is doing the conversion. |
991 | * item is the object that triggered the converter - if it is not |
991 | * item is the object that triggered the converter - if it is not |
992 | * what the converter wants, this will not do anything. |
992 | * what the converter wants, this will not do anything. |
… | |
… | |
1070 | if(nr) |
1070 | if(nr) |
1071 | item->nrof*=nr; |
1071 | item->nrof*=nr; |
1072 | if(is_in_shop) |
1072 | if(is_in_shop) |
1073 | SET_FLAG(item,FLAG_UNPAID); |
1073 | SET_FLAG(item,FLAG_UNPAID); |
1074 | else if(price_in < item->nrof*item->value) { |
1074 | else if(price_in < item->nrof*item->value) { |
1075 | LOG(llevError, "Broken converter %s at %s (%d, %d) in value %d, out value %d for %s\n", |
1075 | LOG(llevDebug, "converter output price higher than input: %s at %s (%d, %d) in value %d, out value %d for %s\n", |
1076 | converter->name, converter->map->path, converter->x, converter->y, price_in, |
1076 | converter->name, converter->map->path, converter->x, converter->y, price_in, |
1077 | item->nrof*item->value, item->name); |
1077 | item->nrof*item->value, item->name); |
1078 | free_object(item); |
1078 | /** |
1079 | return -1; |
1079 | * elmex: we are going to let the game continue, as the mapcreator |
|
|
1080 | * propably had something in mind when doing this |
|
|
1081 | */ |
1080 | } |
1082 | } |
1081 | insert_ob_in_map_at(item, converter->map, converter, 0, converter->x, converter->y); |
1083 | insert_ob_in_map_at(item, converter->map, converter, 0, converter->x, converter->y); |
1082 | return 1; |
1084 | return 1; |
1083 | } |
1085 | } |
1084 | |
1086 | |
… | |
… | |
2348 | return 1; |
2350 | return 1; |
2349 | } |
2351 | } |
2350 | |
2352 | |
2351 | static void apply_savebed (object *pl) |
2353 | static void apply_savebed (object *pl) |
2352 | { |
2354 | { |
|
|
2355 | #ifndef COZY_SERVER |
2353 | if(!pl->contr->name_changed||!pl->stats.exp) { |
2356 | if(!pl->contr->name_changed||!pl->stats.exp) { |
2354 | new_draw_info(NDI_UNIQUE, 0,pl,"You don't deserve to save your character yet."); |
2357 | new_draw_info(NDI_UNIQUE, 0,pl,"You don't deserve to save your character yet."); |
2355 | return; |
2358 | return; |
2356 | } |
2359 | } |
2357 | if(QUERY_FLAG(pl,FLAG_WAS_WIZ)) { |
2360 | #endif |
2358 | new_draw_info(NDI_UNIQUE, 0,pl,"Since you have cheated you can't save."); |
|
|
2359 | return; |
|
|
2360 | } |
|
|
2361 |
|
|
|
2362 | /* Lauwenmark : Here we handle the LOGOUT global event */
|
|
|
2363 | execute_global_event(EVENT_LOGOUT, pl->contr, pl->contr->socket.host);
|
|
|
2364 |
|
|
|
2365 | /* Need to call terminate_all_pets() before we remove the player ob */ |
2361 | /* Need to call terminate_all_pets() before we remove the player ob */ |
2366 | terminate_all_pets(pl); |
2362 | terminate_all_pets(pl); |
2367 | remove_ob(pl); |
2363 | remove_ob(pl); |
2368 | pl->direction=0; |
2364 | pl->direction=0; |
2369 | new_draw_info_format(NDI_UNIQUE | NDI_ALL | NDI_DK_ORANGE, 5, pl, |
2365 | new_draw_info_format(NDI_UNIQUE | NDI_ALL | NDI_DK_ORANGE, 5, pl, |
… | |
… | |
3053 | #endif |
3049 | #endif |
3054 | return 1; |
3050 | return 1; |
3055 | } |
3051 | } |
3056 | /* If we are just printing, we don't care about cursed status */ |
3052 | /* If we are just printing, we don't care about cursed status */ |
3057 | if ((aflags & AP_IGNORE_CURSE) || (aflags & AP_PRINT) || |
3053 | if ((aflags & AP_IGNORE_CURSE) || (aflags & AP_PRINT) || |
3058 | (!(QUERY_FLAG(tmp, FLAG_CURSED) && !QUERY_FLAG(tmp, FLAG_DAMNED)))) { |
3054 | (!(QUERY_FLAG(tmp, FLAG_CURSED) || QUERY_FLAG(tmp, FLAG_DAMNED)))) { |
3059 | if (aflags & AP_PRINT) |
3055 | if (aflags & AP_PRINT) |
3060 | new_draw_info(NDI_UNIQUE, 0, who, query_name(tmp)); |
3056 | new_draw_info(NDI_UNIQUE, 0, who, query_name(tmp)); |
3061 | else |
3057 | else |
3062 | unapply_special(who, tmp, aflags); |
3058 | unapply_special(who, tmp, aflags); |
3063 | } |
3059 | } |
… | |
… | |
3207 | } |
3203 | } |
3208 | |
3204 | |
3209 | |
3205 | |
3210 | |
3206 | |
3211 | /** |
3207 | /** |
3212 | * who is the object using the object. It can be a monster |
3208 | * who is the object using the object. It can be a monster. |
3213 | * op is the object they are using. op is an equipment type item, |
3209 | * op is the object they are using. op is an equipment type item, |
3214 | * eg, one which you put on and keep on for a while, and not something |
3210 | * eg, one which you put on and keep on for a while, and not something |
3215 | * like a potion or scroll. |
3211 | * like a potion or scroll. |
3216 | * |
3212 | * |
3217 | * function returns 1 if the action could not be completed, 0 on |
3213 | * function returns 1 if the action could not be completed, 0 on |