… | |
… | |
124 | continue; |
124 | continue; |
125 | |
125 | |
126 | if (*buf == '%') |
126 | if (*buf == '%') |
127 | { /* send one news */ |
127 | { /* send one news */ |
128 | if (size > 0) |
128 | if (size > 0) |
129 | draw_ext_info_format (NDI_UNIQUE | NDI_GREEN, 0, op, MSG_TYPE_ADMIN, MSG_TYPE_ADMIN_NEWS, "INFORMATION: %s\n%s", "%s\n%s", subject, news); /*send previously read news */ |
129 | draw_ext_info_format (NDI_UNIQUE | NDI_GREEN, 0, op, MSG_TYPE_ADMIN, MSG_TYPE_ADMIN_NEWS, "INFORMATION: %s\n%s", (char *)"%s\n%s", subject, news); /*send previously read news */ |
130 | |
130 | |
131 | strcpy (subject, buf + 1); |
131 | strcpy (subject, buf + 1); |
132 | strip_endline (subject); |
132 | strip_endline (subject); |
133 | size = 0; |
133 | size = 0; |
134 | news[0] = '\0'; |
134 | news[0] = '\0'; |
… | |
… | |
144 | size += strlen (buf); |
144 | size += strlen (buf); |
145 | } |
145 | } |
146 | } |
146 | } |
147 | |
147 | |
148 | draw_ext_info_format (NDI_UNIQUE | NDI_GREEN, 0, op, |
148 | draw_ext_info_format (NDI_UNIQUE | NDI_GREEN, 0, op, |
149 | MSG_TYPE_ADMIN, MSG_TYPE_ADMIN_NEWS, "INFORMATION: %s\n%s\n", "%s\n%s", subject, news); |
149 | MSG_TYPE_ADMIN, MSG_TYPE_ADMIN_NEWS, "INFORMATION: %s\n%s\n", (char *)"%s\n%s", subject, news); |
150 | close_and_delete (fp, comp); |
150 | close_and_delete (fp, comp); |
151 | } |
151 | } |
152 | |
152 | |
153 | /* This loads the first map an puts the player on it. */ |
153 | /* This loads the first map an puts the player on it. */ |
154 | static void |
154 | static void |
… | |
… | |
315 | player::player () |
315 | player::player () |
316 | { |
316 | { |
317 | /* There are some elements we want initialised to non zero value - |
317 | /* There are some elements we want initialised to non zero value - |
318 | * we deal with that below this point. |
318 | * we deal with that below this point. |
319 | */ |
319 | */ |
320 | outputs_sync = 16; /* Every 2 seconds */ |
320 | outputs_sync = 6; /* Every 2 seconds */ |
321 | outputs_count = 8; /* Keeps present behaviour */ |
321 | outputs_count = 10; /* Keeps present behaviour */ |
322 | unapply = unapply_nochoice; |
322 | unapply = unapply_nochoice; |
323 | |
323 | |
324 | savebed_map = first_map_path; /* Init. respawn position */ |
324 | savebed_map = first_map_path; /* Init. respawn position */ |
325 | |
325 | |
326 | gen_sp_armour = 10; |
326 | gen_sp_armour = 10; |
… | |
… | |
2256 | * Returns true if there are more actions we can do. |
2256 | * Returns true if there are more actions we can do. |
2257 | */ |
2257 | */ |
2258 | int |
2258 | int |
2259 | handle_newcs_player (object *op) |
2259 | handle_newcs_player (object *op) |
2260 | { |
2260 | { |
2261 | if (op->contr->hidden) |
|
|
2262 | { |
|
|
2263 | op->invisible = 1000; |
|
|
2264 | /* the socket code flashes the player visible/invisible |
|
|
2265 | * depending on the value of invisible, so we need to |
|
|
2266 | * alternate it here for it to work correctly. |
|
|
2267 | */ |
|
|
2268 | if (pticks & 2) |
|
|
2269 | op->invisible--; |
|
|
2270 | } |
|
|
2271 | else if (op->invisible && !(QUERY_FLAG (op, FLAG_MAKE_INVIS))) |
|
|
2272 | { |
|
|
2273 | op->invisible--; |
|
|
2274 | if (!op->invisible) |
|
|
2275 | { |
|
|
2276 | make_visible (op); |
|
|
2277 | new_draw_info (NDI_UNIQUE, 0, op, "Your invisibility spell runs out."); |
|
|
2278 | } |
|
|
2279 | } |
|
|
2280 | |
|
|
2281 | if (QUERY_FLAG (op, FLAG_SCARED)) |
2261 | if (QUERY_FLAG (op, FLAG_SCARED)) |
2282 | { |
2262 | { |
2283 | flee_player (op); |
2263 | flee_player (op); |
2284 | /* If player is still scared, that is his action for this tick */ |
2264 | /* If player is still scared, that is his action for this tick */ |
2285 | if (QUERY_FLAG (op, FLAG_SCARED)) |
2265 | if (QUERY_FLAG (op, FLAG_SCARED)) |
… | |
… | |
2439 | int rate_grace = 2000; |
2419 | int rate_grace = 2000; |
2440 | const int max_hp = 1; |
2420 | const int max_hp = 1; |
2441 | const int max_sp = 1; |
2421 | const int max_sp = 1; |
2442 | const int max_grace = 1; |
2422 | const int max_grace = 1; |
2443 | |
2423 | |
|
|
2424 | if (op->contr->hidden) |
|
|
2425 | { |
|
|
2426 | op->invisible = 1000; |
|
|
2427 | /* the socket code flashes the player visible/invisible |
|
|
2428 | * depending on the value of invisible, so we need to |
|
|
2429 | * alternate it here for it to work correctly. |
|
|
2430 | */ |
|
|
2431 | if (pticks & 2) |
|
|
2432 | op->invisible--; |
|
|
2433 | } |
|
|
2434 | else if (op->invisible && !(QUERY_FLAG (op, FLAG_MAKE_INVIS))) |
|
|
2435 | { |
|
|
2436 | if (!op->invisible--) |
|
|
2437 | { |
|
|
2438 | make_visible (op); |
|
|
2439 | new_draw_info (NDI_UNIQUE, 0, op, "Your invisibility spell runs out."); |
|
|
2440 | } |
|
|
2441 | } |
|
|
2442 | |
2444 | if (op->contr->outputs_sync) |
2443 | if (op->contr->outputs_sync) |
2445 | { |
|
|
2446 | for (i = 0; i < NUM_OUTPUT_BUFS; i++) |
2444 | for (i = 0; i < NUM_OUTPUT_BUFS; i++) |
2447 | if (op->contr->outputs[i].buf && (op->contr->outputs[i].first_update + op->contr->outputs_sync) < (uint16) pticks) |
2445 | if (op->contr->outputs[i].buf && (op->contr->outputs[i].first_update + op->contr->outputs_sync) < (uint16) pticks) |
2448 | flush_output_element (op, &op->contr->outputs[i]); |
2446 | flush_output_element (op, &op->contr->outputs[i]); |
2449 | } |
|
|
2450 | |
2447 | |
2451 | if (op->contr->ns->state == ST_PLAYING) |
2448 | if (op->contr->ns->state == ST_PLAYING) |
2452 | { |
2449 | { |
2453 | /* these next three if clauses make it possible to SLOW DOWN |
2450 | /* these next three if clauses make it possible to SLOW DOWN |
2454 | hp/grace/spellpoint regeneration. */ |
2451 | hp/grace/spellpoint regeneration. */ |
… | |
… | |
2910 | op->stats.hp = op->stats.maxhp; |
2907 | op->stats.hp = op->stats.maxhp; |
2911 | op->stats.sp = MAX (op->stats.sp, op->stats.maxsp); |
2908 | op->stats.sp = MAX (op->stats.sp, op->stats.maxsp); |
2912 | op->stats.grace = MAX (op->stats.grace, op->stats.maxgrace); |
2909 | op->stats.grace = MAX (op->stats.grace, op->stats.maxgrace); |
2913 | |
2910 | |
2914 | /* |
2911 | /* |
2915 | * Check to see if the player is in a shop. IF so, then check to see if |
|
|
2916 | * the player has any unpaid items. If so, remove them and put them back |
2912 | * Check to see if the player has any unpaid items. If so, remove them |
2917 | * in the map. |
2913 | * and put them back in the map. |
2918 | */ |
2914 | */ |
2919 | |
|
|
2920 | if (is_in_shop (op)) |
|
|
2921 | remove_unpaid_objects (op->inv, op); |
2915 | remove_unpaid_objects (op->inv, op); |
2922 | |
2916 | |
2923 | /****************************************/ |
2917 | /****************************************/ |
2924 | /* */ |
2918 | /* */ |
2925 | /* Move player to his current respawn- */ |
2919 | /* Move player to his current respawn- */ |
2926 | /* position (usually last savebed) */ |
2920 | /* position (usually last savebed) */ |
… | |
… | |
3071 | if (op->type == PLAYER) |
3065 | if (op->type == PLAYER) |
3072 | { |
3066 | { |
3073 | op->contr->tmp_invis = 0; |
3067 | op->contr->tmp_invis = 0; |
3074 | op->contr->invis_race = 0; |
3068 | op->contr->invis_race = 0; |
3075 | } |
3069 | } |
|
|
3070 | |
3076 | update_object (op, UP_OBJ_FACE); |
3071 | update_object (op, UP_OBJ_CHANGE); |
3077 | } |
3072 | } |
3078 | |
3073 | |
3079 | int |
3074 | int |
3080 | is_true_undead (object *op) |
3075 | is_true_undead (object *op) |
3081 | { |
3076 | { |