1 | /* |
1 | /* |
2 | * static char *rcsid_apply_c = |
2 | * static char *rcsid_apply_c = |
3 | * "$Id: apply.C,v 1.3 2006/08/15 15:00:20 elmex Exp $"; |
3 | * "$Id: apply.C,v 1.9 2006/08/25 17:11:53 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 |
… | |
… | |
63 | */ |
63 | */ |
64 | int apply_transport(object *pl, object *transport, int aflag) { |
64 | int apply_transport(object *pl, object *transport, int aflag) { |
65 | |
65 | |
66 | /* Only players can use transports right now */ |
66 | /* Only players can use transports right now */ |
67 | if (pl->type != PLAYER) return 0; |
67 | if (pl->type != PLAYER) return 0; |
|
|
68 | |
|
|
69 | // due to brokenness of transports disable them until a working alternative |
|
|
70 | // has been found... :( |
|
|
71 | // - elmex |
|
|
72 | new_draw_info (NDI_UNIQUE, 0, pl, "This transport is out of order!"); |
|
|
73 | return 1; |
68 | |
74 | |
69 | /* If player is currently on a transport but not this transport, they need |
75 | /* If player is currently on a transport but not this transport, they need |
70 | * to exit first. Perhaps transport to transport transfers should be |
76 | * to exit first. Perhaps transport to transport transfers should be |
71 | * allowed. |
77 | * allowed. |
72 | */ |
78 | */ |
… | |
… | |
338 | int got_one = 0, i; |
344 | int got_one = 0, i; |
339 | object *force = 0, *floor = 0; |
345 | object *force = 0, *floor = 0; |
340 | |
346 | |
341 | floor = get_map_ob (op->map, op->x, op->y); |
347 | floor = get_map_ob (op->map, op->x, op->y); |
342 | |
348 | |
343 | if (!(get_map_flags(op->map, NULL, op->x, op->y, NULL, NULL) & P_SAFE_MAP)) |
349 | if (get_map_flags(op->map, NULL, op->x, op->y, NULL, NULL) & P_SAFE) |
344 | { |
350 | { |
345 | if (op->type == PLAYER) |
351 | if (op->type == PLAYER) |
|
|
352 | new_draw_info (NDI_UNIQUE, 0, op, |
|
|
353 | "Gods prevent you from using this here, it's sacred ground!" |
|
|
354 | ); |
|
|
355 | CLEAR_FLAG (tmp, FLAG_APPLIED); |
|
|
356 | return 0; |
|
|
357 | } |
|
|
358 | |
|
|
359 | if (op->type == PLAYER) |
|
|
360 | { |
|
|
361 | if (!QUERY_FLAG (tmp, FLAG_IDENTIFIED)) |
|
|
362 | identify (tmp); |
|
|
363 | } |
|
|
364 | |
|
|
365 | handle_apply_yield (tmp); |
|
|
366 | |
|
|
367 | /* Potion of restoration - only for players */ |
|
|
368 | if (op->type == PLAYER && (tmp->attacktype & AT_DEPLETE)) |
|
|
369 | { |
|
|
370 | object *depl; |
|
|
371 | archetype *at; |
|
|
372 | |
|
|
373 | if (QUERY_FLAG (tmp, FLAG_CURSED) || QUERY_FLAG (tmp, FLAG_DAMNED)) |
346 | { |
374 | { |
347 | if (!QUERY_FLAG (tmp, FLAG_IDENTIFIED)) |
|
|
348 | identify (tmp); |
|
|
349 | } |
|
|
350 | |
|
|
351 | handle_apply_yield (tmp); |
|
|
352 | |
|
|
353 | /* Potion of restoration - only for players */ |
|
|
354 | if (op->type == PLAYER && (tmp->attacktype & AT_DEPLETE)) |
|
|
355 | { |
|
|
356 | object *depl; |
|
|
357 | archetype *at; |
|
|
358 | |
|
|
359 | if (QUERY_FLAG (tmp, FLAG_CURSED) || QUERY_FLAG (tmp, FLAG_DAMNED)) |
|
|
360 | { |
|
|
361 | drain_stat (op); |
375 | drain_stat (op); |
362 | fix_player (op); |
376 | fix_player (op); |
363 | decrease_ob (tmp); |
|
|
364 | return 1; |
|
|
365 | } |
|
|
366 | if ((at = find_archetype (ARCH_DEPLETION)) == NULL) |
|
|
367 | { |
|
|
368 | LOG (llevError, "Could not find archetype depletion\n"); |
|
|
369 | return 0; |
|
|
370 | } |
|
|
371 | depl = present_arch_in_ob (at, op); |
|
|
372 | if (depl != NULL) |
|
|
373 | { |
|
|
374 | for (i = 0; i < NUM_STATS; i++) |
|
|
375 | if (get_attr_value (&depl->stats, i)) |
|
|
376 | { |
|
|
377 | new_draw_info (NDI_UNIQUE, 0, op, restore_msg[i]); |
|
|
378 | } |
|
|
379 | remove_ob (depl); |
|
|
380 | free_object (depl); |
|
|
381 | fix_player (op); |
|
|
382 | } |
|
|
383 | else |
|
|
384 | new_draw_info (NDI_UNIQUE, 0, op, "You potion had no effect."); |
|
|
385 | |
|
|
386 | decrease_ob (tmp); |
377 | decrease_ob (tmp); |
387 | return 1; |
378 | return 1; |
388 | } |
379 | } |
389 | |
380 | if ((at = find_archetype (ARCH_DEPLETION)) == NULL) |
390 | /* improvement potion - only for players */ |
|
|
391 | if (op->type == PLAYER && tmp->attacktype & AT_GODPOWER) |
|
|
392 | { |
381 | { |
393 | |
382 | LOG (llevError, "Could not find archetype depletion\n"); |
394 | for (i = 1; i < MIN (11, op->level); i++) |
|
|
395 | { |
|
|
396 | if (QUERY_FLAG (tmp, FLAG_CURSED) || QUERY_FLAG (tmp, FLAG_DAMNED)) |
|
|
397 | { |
|
|
398 | if (op->contr->levhp[i] != 1) |
|
|
399 | { |
|
|
400 | op->contr->levhp[i] = 1; |
|
|
401 | break; |
|
|
402 | } |
|
|
403 | if (op->contr->levsp[i] != 1) |
|
|
404 | { |
|
|
405 | op->contr->levsp[i] = 1; |
|
|
406 | break; |
|
|
407 | } |
|
|
408 | if (op->contr->levgrace[i] != 1) |
|
|
409 | { |
|
|
410 | op->contr->levgrace[i] = 1; |
|
|
411 | break; |
|
|
412 | } |
|
|
413 | } |
|
|
414 | else |
|
|
415 | { |
|
|
416 | if (op->contr->levhp[i] < 9) |
|
|
417 | { |
|
|
418 | op->contr->levhp[i] = 9; |
|
|
419 | break; |
|
|
420 | } |
|
|
421 | if (op->contr->levsp[i] < 6) |
|
|
422 | { |
|
|
423 | op->contr->levsp[i] = 6; |
|
|
424 | break; |
|
|
425 | } |
|
|
426 | if (op->contr->levgrace[i] < 3) |
|
|
427 | { |
|
|
428 | op->contr->levgrace[i] = 3; |
|
|
429 | break; |
|
|
430 | } |
|
|
431 | } |
|
|
432 | } |
|
|
433 | /* Just makes checking easier */ |
|
|
434 | if (i < MIN (11, op->level)) |
|
|
435 | got_one = 1; |
|
|
436 | if (!QUERY_FLAG (tmp, FLAG_CURSED) && !QUERY_FLAG (tmp, FLAG_DAMNED)) |
|
|
437 | { |
|
|
438 | if (got_one) |
|
|
439 | { |
|
|
440 | fix_player (op); |
|
|
441 | new_draw_info (NDI_UNIQUE, 0, op, |
|
|
442 | "The Gods smile upon you and remake you"); |
|
|
443 | new_draw_info (NDI_UNIQUE, 0, op, |
|
|
444 | "a little more in their image."); |
|
|
445 | new_draw_info (NDI_UNIQUE, 0, op, |
|
|
446 | "You feel a little more perfect."); |
|
|
447 | } |
|
|
448 | else |
|
|
449 | new_draw_info (NDI_UNIQUE, 0, op, |
|
|
450 | "The potion had no effect - you are already perfect"); |
|
|
451 | } |
|
|
452 | else |
|
|
453 | { /* cursed potion */ |
|
|
454 | if (got_one) |
|
|
455 | { |
|
|
456 | fix_player (op); |
|
|
457 | new_draw_info (NDI_UNIQUE, 0, op, |
|
|
458 | "The Gods are angry and punish you."); |
|
|
459 | } |
|
|
460 | else |
|
|
461 | new_draw_info (NDI_UNIQUE, 0, op, |
|
|
462 | "You are fortunate that you are so pathetic."); |
|
|
463 | } |
|
|
464 | decrease_ob (tmp); |
|
|
465 | return 1; |
383 | return 0; |
466 | } |
384 | } |
467 | |
385 | depl = present_arch_in_ob (at, op); |
468 | |
386 | if (depl != NULL) |
469 | /* A potion that casts a spell. Healing, restore spellpoint (power potion) |
|
|
470 | * and heroism all fit into this category. Given the spell object code, |
|
|
471 | * there is no limit to the number of spells that potions can be cast, |
|
|
472 | * but direction is problematic to try and imbue fireball potions for example. |
|
|
473 | */ |
387 | { |
474 | if (tmp->inv) |
388 | for (i = 0; i < NUM_STATS; i++) |
|
|
389 | if (get_attr_value (&depl->stats, i)) |
|
|
390 | { |
|
|
391 | new_draw_info (NDI_UNIQUE, 0, op, restore_msg[i]); |
|
|
392 | } |
|
|
393 | remove_ob (depl); |
|
|
394 | free_object (depl); |
|
|
395 | fix_player (op); |
|
|
396 | } |
|
|
397 | else |
|
|
398 | new_draw_info (NDI_UNIQUE, 0, op, "You potion had no effect."); |
|
|
399 | |
|
|
400 | decrease_ob (tmp); |
|
|
401 | return 1; |
|
|
402 | } |
|
|
403 | |
|
|
404 | /* improvement potion - only for players */ |
|
|
405 | if (op->type == PLAYER && tmp->attacktype & AT_GODPOWER) |
|
|
406 | { |
|
|
407 | |
|
|
408 | for (i = 1; i < MIN (11, op->level); i++) |
475 | { |
409 | { |
476 | if (QUERY_FLAG (tmp, FLAG_CURSED) || QUERY_FLAG (tmp, FLAG_DAMNED)) |
410 | if (QUERY_FLAG (tmp, FLAG_CURSED) || QUERY_FLAG (tmp, FLAG_DAMNED)) |
477 | { |
411 | { |
478 | object *fball; |
412 | if (op->contr->levhp[i] != 1) |
479 | |
413 | { |
480 | new_draw_info (NDI_UNIQUE, 0, op, "Yech! Your lungs are on fire!"); |
414 | op->contr->levhp[i] = 1; |
481 | /* Explodes a fireball centered at player */ |
415 | break; |
482 | fball = get_archetype (EXPLODING_FIREBALL); |
416 | } |
483 | fball->dam_modifier = |
417 | if (op->contr->levsp[i] != 1) |
484 | random_roll (1, op->level, op, PREFER_LOW) / 5 + 1; |
418 | { |
485 | fball->stats.maxhp = |
419 | op->contr->levsp[i] = 1; |
486 | random_roll (1, op->level, op, PREFER_LOW) / 10 + 2; |
420 | break; |
487 | fball->x = op->x; |
421 | } |
488 | fball->y = op->y; |
422 | if (op->contr->levgrace[i] != 1) |
489 | insert_ob_in_map (fball, op->map, NULL, 0); |
423 | { |
|
|
424 | op->contr->levgrace[i] = 1; |
|
|
425 | break; |
|
|
426 | } |
490 | } |
427 | } |
491 | else |
428 | else |
492 | cast_spell (op, tmp, op->facing, tmp->inv, NULL); |
|
|
493 | |
|
|
494 | decrease_ob (tmp); |
|
|
495 | /* if youre dead, no point in doing this... */ |
|
|
496 | if (!QUERY_FLAG (op, FLAG_REMOVED)) |
|
|
497 | fix_player (op); |
|
|
498 | return 1; |
|
|
499 | } |
|
|
500 | |
|
|
501 | /* Deal with protection potions */ |
|
|
502 | force = NULL; |
|
|
503 | for (i = 0; i < NROFATTACKS; i++) |
|
|
504 | { |
|
|
505 | if (tmp->resist[i]) |
|
|
506 | { |
429 | { |
507 | if (!force) |
430 | if (op->contr->levhp[i] < 9) |
508 | force = get_archetype (FORCE_NAME); |
431 | { |
509 | memcpy (force->resist, tmp->resist, sizeof (tmp->resist)); |
432 | op->contr->levhp[i] = 9; |
510 | force->type = POTION_EFFECT; |
433 | break; |
511 | break; /* Only need to find one protection since we copy entire batch */ |
434 | } |
|
|
435 | if (op->contr->levsp[i] < 6) |
|
|
436 | { |
|
|
437 | op->contr->levsp[i] = 6; |
|
|
438 | break; |
|
|
439 | } |
|
|
440 | if (op->contr->levgrace[i] < 3) |
|
|
441 | { |
|
|
442 | op->contr->levgrace[i] = 3; |
|
|
443 | break; |
|
|
444 | } |
512 | } |
445 | } |
513 | } |
446 | } |
514 | /* This is a protection potion */ |
447 | /* Just makes checking easier */ |
515 | if (force) |
448 | if (i < MIN (11, op->level)) |
|
|
449 | got_one = 1; |
|
|
450 | if (!QUERY_FLAG (tmp, FLAG_CURSED) && !QUERY_FLAG (tmp, FLAG_DAMNED)) |
516 | { |
451 | { |
517 | /* cursed items last longer */ |
452 | if (got_one) |
518 | if (QUERY_FLAG (tmp, FLAG_CURSED) || QUERY_FLAG (tmp, FLAG_DAMNED)) |
|
|
519 | { |
453 | { |
520 | force->stats.food *= 10; |
454 | fix_player (op); |
521 | for (i = 0; i < NROFATTACKS; i++) |
455 | new_draw_info (NDI_UNIQUE, 0, op, |
522 | if (force->resist[i] > 0) |
456 | "The Gods smile upon you and remake you"); |
523 | force->resist[i] = -force->resist[i]; /* prot => vuln */ |
457 | new_draw_info (NDI_UNIQUE, 0, op, |
|
|
458 | "a little more in their image."); |
|
|
459 | new_draw_info (NDI_UNIQUE, 0, op, |
|
|
460 | "You feel a little more perfect."); |
524 | } |
461 | } |
525 | force->speed_left = -1; |
462 | else |
526 | force = insert_ob_in_ob (force, op); |
463 | new_draw_info (NDI_UNIQUE, 0, op, |
527 | CLEAR_FLAG (tmp, FLAG_APPLIED); |
464 | "The potion had no effect - you are already perfect"); |
528 | SET_FLAG (force, FLAG_APPLIED); |
|
|
529 | change_abil (op, force); |
|
|
530 | decrease_ob (tmp); |
|
|
531 | return 1; |
|
|
532 | } |
465 | } |
533 | |
466 | else |
534 | /* Only thing left are the stat potions */ |
467 | { /* cursed potion */ |
535 | if (op->type == PLAYER) |
468 | if (got_one) |
536 | { /* only for players */ |
469 | { |
537 | if ((QUERY_FLAG (tmp, FLAG_CURSED) || QUERY_FLAG (tmp, FLAG_DAMNED)) |
470 | fix_player (op); |
538 | && tmp->value != 0) |
471 | new_draw_info (NDI_UNIQUE, 0, op, |
539 | CLEAR_FLAG (tmp, FLAG_APPLIED); |
472 | "The Gods are angry and punish you."); |
|
|
473 | } |
540 | else |
474 | else |
541 | SET_FLAG (tmp, FLAG_APPLIED); |
|
|
542 | if (!change_abil (op, tmp)) |
|
|
543 | new_draw_info (NDI_UNIQUE, 0, op, "Nothing happened."); |
475 | new_draw_info (NDI_UNIQUE, 0, op, |
|
|
476 | "You are fortunate that you are so pathetic."); |
544 | } |
477 | } |
|
|
478 | decrease_ob (tmp); |
|
|
479 | return 1; |
545 | } |
480 | } |
546 | else |
481 | |
|
|
482 | |
|
|
483 | /* A potion that casts a spell. Healing, restore spellpoint (power potion) |
|
|
484 | * and heroism all fit into this category. Given the spell object code, |
|
|
485 | * there is no limit to the number of spells that potions can be cast, |
|
|
486 | * but direction is problematic to try and imbue fireball potions for example. |
|
|
487 | */ |
|
|
488 | if (tmp->inv) |
547 | { |
489 | { |
548 | if (op->type == PLAYER) |
490 | if (QUERY_FLAG (tmp, FLAG_CURSED) || QUERY_FLAG (tmp, FLAG_DAMNED)) |
549 | new_draw_info (NDI_UNIQUE, 0, op, |
|
|
550 | "Gods prevent you from using the potion on this sacred ground" |
|
|
551 | ); |
491 | { |
|
|
492 | object *fball; |
|
|
493 | |
|
|
494 | new_draw_info (NDI_UNIQUE, 0, op, "Yech! Your lungs are on fire!"); |
|
|
495 | /* Explodes a fireball centered at player */ |
|
|
496 | fball = get_archetype (EXPLODING_FIREBALL); |
|
|
497 | fball->dam_modifier = |
|
|
498 | random_roll (1, op->level, op, PREFER_LOW) / 5 + 1; |
|
|
499 | fball->stats.maxhp = |
|
|
500 | random_roll (1, op->level, op, PREFER_LOW) / 10 + 2; |
|
|
501 | fball->x = op->x; |
|
|
502 | fball->y = op->y; |
|
|
503 | insert_ob_in_map (fball, op->map, NULL, 0); |
|
|
504 | } |
|
|
505 | else |
|
|
506 | cast_spell (op, tmp, op->facing, tmp->inv, NULL); |
|
|
507 | |
|
|
508 | decrease_ob (tmp); |
|
|
509 | /* if youre dead, no point in doing this... */ |
|
|
510 | if (!QUERY_FLAG (op, FLAG_REMOVED)) |
|
|
511 | fix_player (op); |
552 | return 0; |
512 | return 1; |
|
|
513 | } |
|
|
514 | |
|
|
515 | /* Deal with protection potions */ |
|
|
516 | force = NULL; |
|
|
517 | for (i = 0; i < NROFATTACKS; i++) |
|
|
518 | { |
|
|
519 | if (tmp->resist[i]) |
|
|
520 | { |
|
|
521 | if (!force) |
|
|
522 | force = get_archetype (FORCE_NAME); |
|
|
523 | memcpy (force->resist, tmp->resist, sizeof (tmp->resist)); |
|
|
524 | force->type = POTION_EFFECT; |
|
|
525 | break; /* Only need to find one protection since we copy entire batch */ |
|
|
526 | } |
|
|
527 | } |
|
|
528 | /* This is a protection potion */ |
|
|
529 | if (force) |
|
|
530 | { |
|
|
531 | /* cursed items last longer */ |
|
|
532 | if (QUERY_FLAG (tmp, FLAG_CURSED) || QUERY_FLAG (tmp, FLAG_DAMNED)) |
|
|
533 | { |
|
|
534 | force->stats.food *= 10; |
|
|
535 | for (i = 0; i < NROFATTACKS; i++) |
|
|
536 | if (force->resist[i] > 0) |
|
|
537 | force->resist[i] = -force->resist[i]; /* prot => vuln */ |
|
|
538 | } |
|
|
539 | force->speed_left = -1; |
|
|
540 | force = insert_ob_in_ob (force, op); |
|
|
541 | CLEAR_FLAG (tmp, FLAG_APPLIED); |
|
|
542 | SET_FLAG (force, FLAG_APPLIED); |
|
|
543 | change_abil (op, force); |
|
|
544 | decrease_ob (tmp); |
|
|
545 | return 1; |
|
|
546 | } |
|
|
547 | |
|
|
548 | /* Only thing left are the stat potions */ |
|
|
549 | if (op->type == PLAYER) |
|
|
550 | { /* only for players */ |
|
|
551 | if ((QUERY_FLAG (tmp, FLAG_CURSED) || QUERY_FLAG (tmp, FLAG_DAMNED)) |
|
|
552 | && tmp->value != 0) |
|
|
553 | CLEAR_FLAG (tmp, FLAG_APPLIED); |
|
|
554 | else |
|
|
555 | SET_FLAG (tmp, FLAG_APPLIED); |
|
|
556 | if (!change_abil (op, tmp)) |
|
|
557 | new_draw_info (NDI_UNIQUE, 0, op, "Nothing happened."); |
553 | } |
558 | } |
554 | |
559 | |
555 | /* CLEAR_FLAG is so that if the character has other potions |
560 | /* CLEAR_FLAG is so that if the character has other potions |
556 | * that were grouped with the one consumed, his |
561 | * that were grouped with the one consumed, his |
557 | * stat will not be raised by them. fix_player just clears |
562 | * stat will not be raised by them. fix_player just clears |
… | |
… | |
1491 | } else { |
1496 | } else { |
1492 | remove_ob (op); |
1497 | remove_ob (op); |
1493 | op->x += freearr_x[i]; |
1498 | op->x += freearr_x[i]; |
1494 | op->y += freearr_y[i]; |
1499 | op->y += freearr_y[i]; |
1495 | rv = insert_ob_in_map (op, op->map, shop_mat,0) == NULL; |
1500 | rv = insert_ob_in_map (op, op->map, shop_mat,0) == NULL; |
1496 | esrv_map_scroll(&op->contr->socket, freearr_x[i],freearr_y[i]); |
|
|
1497 | op->contr->socket.update_look=1; |
|
|
1498 | op->contr->socket.look_position=0; |
|
|
1499 | } |
1501 | } |
1500 | } |
1502 | } |
1501 | CLEAR_FLAG (op, FLAG_NO_APPLY); |
1503 | CLEAR_FLAG (op, FLAG_NO_APPLY); |
1502 | return rv; |
1504 | return rv; |
1503 | } |
1505 | } |
… | |
… | |
1822 | else |
1824 | else |
1823 | new_draw_info(NDI_UNIQUE, 0,op,"This book is totally beyond your comprehension."); |
1825 | new_draw_info(NDI_UNIQUE, 0,op,"This book is totally beyond your comprehension."); |
1824 | return; |
1826 | return; |
1825 | } |
1827 | } |
1826 | |
1828 | |
1827 | |
|
|
1828 | /* Lauwenmark: Handle for plugin book event */ |
|
|
1829 | /*printf("Book apply: %s\n", tmp->name); |
|
|
1830 | execute_event(tmp, EVENT_APPLY,op,NULL,SCRIPT_FIX_ALL); |
|
|
1831 | printf("Book applied: %s\n", tmp->name);*/ |
|
|
1832 | /*if ((evt = find_event(tmp, EVENT_APPLY)) != NULL) |
|
|
1833 | { |
|
|
1834 | CFParm CFP; |
|
|
1835 | int k, l, m; |
|
|
1836 | uint32 n; |
|
|
1837 | new_draw_info_format (NDI_UNIQUE, 0, op, |
|
|
1838 | "You open the %s and start reading.", tmp->name); |
|
|
1839 | k = EVENT_APPLY; |
|
|
1840 | l = SCRIPT_FIX_ALL; |
|
|
1841 | m = 0; |
|
|
1842 | n = 0; |
|
|
1843 | CFP.Value[0] = &k; |
|
|
1844 | CFP.Value[1] = op; |
|
|
1845 | CFP.Value[2] = tmp; |
|
|
1846 | CFP.Value[3] = NULL; |
|
|
1847 | CFP.Value[4] = NULL; |
|
|
1848 | CFP.Value[5] = &n; |
|
|
1849 | CFP.Value[6] = &m; |
|
|
1850 | CFP.Value[7] = &m; |
|
|
1851 | CFP.Value[8] = &l; |
|
|
1852 | CFP.Value[9] = (void*)evt->hook; |
|
|
1853 | CFP.Value[10]= (void*)evt->options; |
|
|
1854 | if (findPlugin(evt->plugin)>=0) |
|
|
1855 | ((PlugList[findPlugin(evt->plugin)].eventfunc) (&CFP)); |
|
|
1856 | } |
|
|
1857 | else*/{ |
|
|
1858 | readable_message_type* msgType = get_readable_message_type(tmp); |
1829 | readable_message_type* msgType = get_readable_message_type(tmp); |
1859 | draw_ext_info_format(NDI_UNIQUE | NDI_NAVY, 0, op, |
1830 | draw_ext_info_format(NDI_UNIQUE | NDI_NAVY, 0, op, |
1860 | msgType->message_type, msgType->message_subtype, |
1831 | msgType->message_type, msgType->message_subtype, |
1861 | "You open the %s and start reading.\n%s", |
1832 | "You open the %s and start reading.\n%s", |
1862 | "%s\n%s", |
1833 | "%s\n%s", |
1863 | long_desc(tmp,op), tmp->msg); |
1834 | long_desc(tmp,op), tmp->msg); |
1864 | } |
|
|
1865 | |
1835 | |
1866 | /* gain xp from reading */ |
1836 | /* gain xp from reading */ |
1867 | if(!QUERY_FLAG(tmp,FLAG_NO_SKILL_IDENT)) { /* only if not read before */ |
1837 | if(!QUERY_FLAG(tmp,FLAG_NO_SKILL_IDENT)) { /* only if not read before */ |
1868 | int exp_gain=calc_skill_exp(op,tmp, skill_ob); |
1838 | int exp_gain=calc_skill_exp(op,tmp, skill_ob); |
1869 | if(!QUERY_FLAG(tmp,FLAG_IDENTIFIED)) { |
1839 | if(!QUERY_FLAG(tmp,FLAG_IDENTIFIED)) { |
… | |
… | |
2578 | } |
2548 | } |
2579 | } |
2549 | } |
2580 | |
2550 | |
2581 | |
2551 | |
2582 | /* Lauwenmark: Handle for plugin apply event */ |
2552 | /* Lauwenmark: Handle for plugin apply event */ |
|
|
2553 | //TODO: remove |
2583 | if (execute_event(tmp, EVENT_APPLY,op,NULL,NULL,SCRIPT_FIX_ALL)!=0) |
2554 | if (execute_event(tmp, EVENT_APPLY,op,NULL,NULL,SCRIPT_FIX_ALL)!=0) |
|
|
2555 | return 1; |
|
|
2556 | |
|
|
2557 | if (INVOKE_OBJECT (APPLY, tmp, ARG_OBJECT (op))) |
2584 | return 1; |
2558 | return 1; |
2585 | |
2559 | |
2586 | switch (tmp->type) { |
2560 | switch (tmp->type) { |
2587 | |
2561 | |
2588 | case TRANSPORT: |
2562 | case TRANSPORT: |