… | |
… | |
259 | /* IF the player is flying & trying to take the item out of a container |
259 | /* IF the player is flying & trying to take the item out of a container |
260 | * that is in his inventory, let him. tmp->env points to the container |
260 | * that is in his inventory, let him. tmp->env points to the container |
261 | * (sack, luggage, etc), tmp->env->env then points to the player (nested |
261 | * (sack, luggage, etc), tmp->env->env then points to the player (nested |
262 | * containers not allowed as of now) |
262 | * containers not allowed as of now) |
263 | */ |
263 | */ |
264 | if ((pl->move_type & MOVE_FLYING) && !QUERY_FLAG (pl, FLAG_WIZ) && is_player_inv (tmp) != pl) |
264 | if ((pl->move_type & MOVE_FLYING) && !QUERY_FLAG (pl, FLAG_WIZ) && tmp->in_player () != pl) |
265 | { |
265 | { |
266 | new_draw_info (NDI_UNIQUE, 0, pl, "You are levitating, you can't reach the ground!"); |
266 | new_draw_info (NDI_UNIQUE, 0, pl, "You are levitating, you can't reach the ground!"); |
267 | return; |
267 | return; |
268 | } |
268 | } |
269 | |
269 | |
… | |
… | |
633 | else |
633 | else |
634 | tmp->remove (); |
634 | tmp->remove (); |
635 | |
635 | |
636 | new_draw_info_format (NDI_UNIQUE, 0, op, "You put the %s in %s.", query_name (tmp), query_name (sack)); |
636 | new_draw_info_format (NDI_UNIQUE, 0, op, "You put the %s in %s.", query_name (tmp), query_name (sack)); |
637 | tmp2 = insert_ob_in_ob (tmp, sack); |
637 | tmp2 = insert_ob_in_ob (tmp, sack); |
638 | fix_player (op); /* This is overkill, fix_player() is called somewhere */ |
638 | op->update_stats (); /* This is overkill, fix_player() is called somewhere */ |
639 | /* in object.c */ |
639 | /* in object.c */ |
640 | |
640 | |
641 | /* If an object merged (and thus, different object), we need to |
641 | /* If an object merged (and thus, different object), we need to |
642 | * delete the original. |
642 | * delete the original. |
643 | */ |
643 | */ |
… | |
… | |
702 | if (QUERY_FLAG (tmp, FLAG_STARTEQUIP)) |
702 | if (QUERY_FLAG (tmp, FLAG_STARTEQUIP)) |
703 | { |
703 | { |
704 | sprintf (buf, "You drop the %s.", query_name (tmp)); |
704 | sprintf (buf, "You drop the %s.", query_name (tmp)); |
705 | new_draw_info (NDI_UNIQUE, 0, op, buf); |
705 | new_draw_info (NDI_UNIQUE, 0, op, buf); |
706 | new_draw_info (NDI_UNIQUE, 0, op, "The gods who lent it to you retrieves it."); |
706 | new_draw_info (NDI_UNIQUE, 0, op, "The gods who lent it to you retrieves it."); |
|
|
707 | |
707 | if (op->type == PLAYER) |
708 | if (op->type == PLAYER) |
708 | esrv_del_item (op->contr, tmp->count); |
709 | esrv_del_item (op->contr, tmp->count); |
|
|
710 | |
709 | tmp->destroy (); |
711 | tmp->destroy (); |
710 | fix_player (op); |
712 | op->update_stats (); |
711 | return; |
713 | return; |
712 | } |
714 | } |
713 | |
715 | |
714 | /* If SAVE_INTERVAL is commented out, we never want to save |
716 | /* If SAVE_INTERVAL is commented out, we never want to save |
715 | * the player here. |
717 | * the player here. |
… | |
… | |
720 | * of what he is dropping? |
722 | * of what he is dropping? |
721 | */ |
723 | */ |
722 | if (op->type == PLAYER && !QUERY_FLAG (tmp, FLAG_UNPAID) && |
724 | if (op->type == PLAYER && !QUERY_FLAG (tmp, FLAG_UNPAID) && |
723 | (tmp->nrof ? tmp->value * tmp->nrof : tmp->value > 2000) && (op->contr->last_save_time + SAVE_INTERVAL) <= time (NULL)) |
725 | (tmp->nrof ? tmp->value * tmp->nrof : tmp->value > 2000) && (op->contr->last_save_time + SAVE_INTERVAL) <= time (NULL)) |
724 | { |
726 | { |
725 | save_player (op, 1); |
727 | op->contr->save (); |
726 | op->contr->last_save_time = time (NULL); |
728 | op->contr->last_save_time = time (NULL); |
727 | } |
729 | } |
728 | #endif /* SAVE_INTERVAL */ |
730 | #endif /* SAVE_INTERVAL */ |
729 | |
731 | |
730 | if (op->type == PLAYER) |
732 | if (op->type == PLAYER) |
731 | esrv_del_item (op->contr, tmp->count); |
733 | esrv_del_item (op->contr, tmp->count); |
732 | |
734 | |
733 | /* Call this before we update the various windows/players. At least |
735 | /* Call this before we update the various windows/players. At least |
734 | * that we, we know the weight is correct. |
736 | * that we, we know the weight is correct. |
735 | */ |
737 | */ |
736 | fix_player (op); /* This is overkill, fix_player() is called somewhere */ |
738 | op->update_stats (); /* This is overkill, fix_player() is called somewhere */ |
737 | /* in object.c */ |
739 | /* in object.c */ |
738 | |
740 | |
739 | if (op->type == PLAYER) |
741 | if (op->type == PLAYER) |
740 | { |
742 | { |
741 | op->contr->socket.update_look = 1; |
|
|
742 | /* Need to update the weight for the player */ |
743 | /* Need to update the weight for the player */ |
743 | esrv_send_item (op, op); |
744 | esrv_send_item (op, op); |
|
|
745 | op->contr->ns->floorbox_update (); |
744 | } |
746 | } |
745 | |
747 | |
746 | for (floor = get_map_ob (op->map, op->x, op->y); floor; floor = floor->above) |
748 | for (floor = GET_MAP_OB (op->map, op->x, op->y); floor; floor = floor->above) |
747 | if (INVOKE_OBJECT (DROP_ON, floor, ARG_OBJECT (tmp), ARG_OBJECT (op))) |
749 | if (INVOKE_OBJECT (DROP_ON, floor, ARG_OBJECT (tmp), ARG_OBJECT (op))) |
748 | return; |
750 | return; |
749 | |
751 | |
750 | if (is_in_shop (op) && !QUERY_FLAG (tmp, FLAG_UNPAID) && tmp->type != MONEY) |
752 | if (is_in_shop (op) && !QUERY_FLAG (tmp, FLAG_UNPAID) && tmp->type != MONEY) |
751 | sell_item (tmp, op); |
753 | sell_item (tmp, op); |
… | |
… | |
800 | new_draw_info (NDI_UNIQUE, 0, op, "This item can't be dropped."); |
802 | new_draw_info (NDI_UNIQUE, 0, op, "This item can't be dropped."); |
801 | #endif |
803 | #endif |
802 | return; |
804 | return; |
803 | } |
805 | } |
804 | |
806 | |
805 | if (op->type == PLAYER) |
807 | if (op->type == PLAYER && op->contr->last_used == tmp) |
806 | { |
808 | op->contr->last_used = tmp->below ? tmp->below |
807 | if (op->contr->last_used == tmp && op->contr->last_used_id == tmp->count) |
809 | : tmp->above ? tmp->above |
808 | { |
810 | : 0; |
809 | object *n = NULL; |
|
|
810 | |
|
|
811 | if (tmp->below != NULL) |
|
|
812 | n = tmp->below; |
|
|
813 | else if (tmp->above != NULL) |
|
|
814 | n = tmp->above; |
|
|
815 | op->contr->last_used = n; |
|
|
816 | if (n != NULL) |
|
|
817 | op->contr->last_used_id = n->count; |
|
|
818 | else |
|
|
819 | op->contr->last_used_id = 0; |
|
|
820 | } |
|
|
821 | }; |
|
|
822 | |
811 | |
823 | if (op->container) |
812 | if (op->container) |
824 | { |
813 | { |
825 | if (op->type == PLAYER) |
814 | if (op->type == PLAYER) |
826 | { |
|
|
827 | put_object_in_sack (op, op->container, tmp, op->contr->count); |
815 | put_object_in_sack (op, op->container, tmp, op->contr->count); |
828 | } |
|
|
829 | else |
816 | else |
830 | { |
|
|
831 | put_object_in_sack (op, op->container, tmp, 0); |
817 | put_object_in_sack (op, op->container, tmp, 0); |
832 | }; |
|
|
833 | } |
818 | } |
834 | else |
819 | else |
835 | { |
820 | { |
836 | if (op->type == PLAYER) |
821 | if (op->type == PLAYER) |
837 | { |
|
|
838 | drop_object (op, tmp, op->contr->count); |
822 | drop_object (op, tmp, op->contr->count); |
839 | } |
|
|
840 | else |
823 | else |
841 | { |
|
|
842 | drop_object (op, tmp, 0); |
824 | drop_object (op, tmp, 0); |
843 | }; |
|
|
844 | } |
825 | } |
|
|
826 | |
845 | if (op->type == PLAYER) |
827 | if (op->type == PLAYER) |
846 | op->contr->count = 0; |
828 | op->contr->count = 0; |
847 | } |
829 | } |
848 | |
830 | |
849 | |
831 | |
… | |
… | |
957 | } |
939 | } |
958 | } |
940 | } |
959 | curinv = nextinv; |
941 | curinv = nextinv; |
960 | } |
942 | } |
961 | } |
943 | } |
962 | op->contr->socket.update_look = 1; |
944 | |
|
|
945 | op->contr->ns->floorbox_update (); |
963 | |
946 | |
964 | /* draw_look(op);*/ |
947 | /* draw_look(op);*/ |
965 | return 0; |
948 | return 0; |
966 | } |
949 | } |
967 | |
950 | |
… | |
… | |
997 | new_draw_info (NDI_UNIQUE, 0, op, "Nothing to drop."); |
980 | new_draw_info (NDI_UNIQUE, 0, op, "Nothing to drop."); |
998 | } |
981 | } |
999 | if (op->type == PLAYER) |
982 | if (op->type == PLAYER) |
1000 | { |
983 | { |
1001 | op->contr->count = 0; |
984 | op->contr->count = 0; |
1002 | op->contr->socket.update_look = 1; |
985 | op->contr->ns->floorbox_update (); |
1003 | }; |
986 | }; |
1004 | |
987 | |
1005 | /* draw_look(op);*/ |
988 | /* draw_look(op);*/ |
1006 | return 0; |
989 | return 0; |
1007 | } |
990 | } |
… | |
… | |
1578 | new_draw_info (NDI_UNIQUE, 0, op, "items containing the word 'magic+1'."); |
1561 | new_draw_info (NDI_UNIQUE, 0, op, "items containing the word 'magic+1'."); |
1579 | return 1; |
1562 | return 1; |
1580 | } |
1563 | } |
1581 | op->contr->search_str[0] = '\0'; |
1564 | op->contr->search_str[0] = '\0'; |
1582 | new_draw_info (NDI_UNIQUE, 0, op, "Search mode turned off."); |
1565 | new_draw_info (NDI_UNIQUE, 0, op, "Search mode turned off."); |
1583 | fix_player (op); |
1566 | op->update_stats (); |
1584 | return 1; |
1567 | return 1; |
1585 | } |
1568 | } |
1586 | if ((int) strlen (params) >= MAX_BUF) |
1569 | if ((int) strlen (params) >= MAX_BUF) |
1587 | { |
1570 | { |
1588 | new_draw_info (NDI_UNIQUE, 0, op, "Search string too long."); |
1571 | new_draw_info (NDI_UNIQUE, 0, op, "Search string too long."); |
1589 | return 1; |
1572 | return 1; |
1590 | } |
1573 | } |
1591 | strcpy (op->contr->search_str, params); |
1574 | strcpy (op->contr->search_str, params); |
1592 | sprintf (buf, "Searching for '%s'.", op->contr->search_str); |
1575 | sprintf (buf, "Searching for '%s'.", op->contr->search_str); |
1593 | new_draw_info (NDI_UNIQUE, 0, op, buf); |
1576 | new_draw_info (NDI_UNIQUE, 0, op, buf); |
1594 | fix_player (op); |
1577 | op->update_stats (); |
1595 | return 1; |
1578 | return 1; |
1596 | } |
1579 | } |
1597 | |
1580 | |