… | |
… | |
1144 | apply_container (op, sack); |
1144 | apply_container (op, sack); |
1145 | return 1; |
1145 | return 1; |
1146 | } |
1146 | } |
1147 | } |
1147 | } |
1148 | } |
1148 | } |
|
|
1149 | |
1149 | new_draw_info (NDI_UNIQUE, 0, op, buf); |
1150 | new_draw_info (NDI_UNIQUE, 0, op, buf); |
|
|
1151 | |
1150 | if (op->contr) |
1152 | if (op->contr) |
1151 | op->contr->socket.update_look = 1; |
1153 | op->contr->socket->floorbox_update (); |
|
|
1154 | |
1152 | return 1; |
1155 | return 1; |
1153 | } |
1156 | } |
1154 | |
1157 | |
1155 | /** |
1158 | /** |
1156 | * Eneq(@csd.uu.se): Handle apply on containers. This is for containers |
1159 | * Eneq(@csd.uu.se): Handle apply on containers. This is for containers |
… | |
… | |
1787 | |
1790 | |
1788 | if (!QUERY_FLAG (tmp, FLAG_IDENTIFIED)) |
1791 | if (!QUERY_FLAG (tmp, FLAG_IDENTIFIED)) |
1789 | { |
1792 | { |
1790 | /*exp_gain *= 2; because they just identified it too */ |
1793 | /*exp_gain *= 2; because they just identified it too */ |
1791 | SET_FLAG (tmp, FLAG_IDENTIFIED); |
1794 | SET_FLAG (tmp, FLAG_IDENTIFIED); |
|
|
1795 | |
1792 | /* If in a container, update how it looks */ |
1796 | /* If in a container, update how it looks */ |
1793 | if (tmp->env) |
1797 | if (tmp->env) |
1794 | esrv_update_item (UPD_FLAGS | UPD_NAME, op, tmp); |
1798 | esrv_update_item (UPD_FLAGS | UPD_NAME, op, tmp); |
1795 | else |
1799 | else |
1796 | op->contr->socket.update_look = 1; |
1800 | op->contr->socket->floorbox_update (); |
1797 | } |
1801 | } |
|
|
1802 | |
1798 | change_exp (op, exp_gain, skill_ob->skill, 0); |
1803 | change_exp (op, exp_gain, skill_ob->skill, 0); |
1799 | SET_FLAG (tmp, FLAG_NO_SKILL_IDENT); /* so no more xp gained from this book */ |
1804 | SET_FLAG (tmp, FLAG_NO_SKILL_IDENT); /* so no more xp gained from this book */ |
1800 | } |
1805 | } |
1801 | } |
1806 | } |
1802 | |
1807 | |
… | |
… | |
1949 | new_draw_info_format (NDI_UNIQUE, 0, op, "The spellbook contains the %s level spell %s.", get_levelnumber (spell->level), &spell->name); |
1954 | new_draw_info_format (NDI_UNIQUE, 0, op, "The spellbook contains the %s level spell %s.", get_levelnumber (spell->level), &spell->name); |
1950 | |
1955 | |
1951 | if (!QUERY_FLAG (tmp, FLAG_IDENTIFIED)) |
1956 | if (!QUERY_FLAG (tmp, FLAG_IDENTIFIED)) |
1952 | { |
1957 | { |
1953 | identify (tmp); |
1958 | identify (tmp); |
|
|
1959 | |
1954 | if (tmp->env) |
1960 | if (tmp->env) |
1955 | esrv_update_item (UPD_FLAGS | UPD_NAME, op, tmp); |
1961 | esrv_update_item (UPD_FLAGS | UPD_NAME, op, tmp); |
1956 | else |
1962 | else |
1957 | op->contr->socket.update_look = 1; |
1963 | op->contr->socket->floorbox_update (); |
1958 | } |
1964 | } |
1959 | |
1965 | |
1960 | /* I removed the check for special_prayer_mark here - it didn't make |
1966 | /* I removed the check for special_prayer_mark here - it didn't make |
1961 | * a lot of sense - special prayers are not found in spellbooks, and |
1967 | * a lot of sense - special prayers are not found in spellbooks, and |
1962 | * if the player doesn't know the spell, doesn't make a lot of sense that |
1968 | * if the player doesn't know the spell, doesn't make a lot of sense that |
… | |
… | |
3648 | int i; |
3654 | int i; |
3649 | |
3655 | |
3650 | switch (op->type) |
3656 | switch (op->type) |
3651 | { |
3657 | { |
3652 | case SHOP_FLOOR: |
3658 | case SHOP_FLOOR: |
3653 | if (!HAS_RANDOM_ITEMS (op)) |
3659 | if (!op->has_random_items ()) |
3654 | return 0; |
3660 | return 0; |
3655 | |
3661 | |
3656 | do |
3662 | do |
3657 | { |
3663 | { |
3658 | i = 10; /* let's give it 10 tries */ |
3664 | i = 10; /* let's give it 10 tries */ |
… | |
… | |
3735 | { |
3741 | { |
3736 | invnext = invtmp->below; |
3742 | invnext = invtmp->below; |
3737 | |
3743 | |
3738 | if (QUERY_FLAG (invtmp, FLAG_AUTO_APPLY)) |
3744 | if (QUERY_FLAG (invtmp, FLAG_AUTO_APPLY)) |
3739 | auto_apply (invtmp); |
3745 | auto_apply (invtmp); |
3740 | else if (invtmp->type == TREASURE && HAS_RANDOM_ITEMS (invtmp)) |
3746 | else if (invtmp->type == TREASURE && invtmp->has_random_items ()) |
3741 | { |
3747 | { |
3742 | while ((invtmp->stats.hp--) > 0) |
3748 | while ((invtmp->stats.hp--) > 0) |
3743 | create_treasure (invtmp->randomitems, invtmp, 0, m->difficulty, 0); |
3749 | create_treasure (invtmp->randomitems, invtmp, 0, m->difficulty, 0); |
3744 | |
3750 | |
3745 | invtmp->randomitems = NULL; |
3751 | invtmp->randomitems = NULL; |
3746 | } |
3752 | } |
3747 | else if (invtmp && invtmp->arch |
3753 | else if (invtmp && invtmp->arch |
3748 | && invtmp->type != TREASURE && invtmp->type != SPELL && invtmp->type != CLASS && HAS_RANDOM_ITEMS (invtmp)) |
3754 | && invtmp->type != TREASURE && invtmp->type != SPELL && invtmp->type != CLASS && invtmp->has_random_items ()) |
3749 | { |
3755 | { |
3750 | create_treasure (invtmp->randomitems, invtmp, 0, m->difficulty, 0); |
3756 | create_treasure (invtmp->randomitems, invtmp, 0, m->difficulty, 0); |
3751 | /* Need to clear this so that we never try to create |
3757 | /* Need to clear this so that we never try to create |
3752 | * treasure again for this object |
3758 | * treasure again for this object |
3753 | */ |
3759 | */ |
… | |
… | |
3770 | |
3776 | |
3771 | } |
3777 | } |
3772 | |
3778 | |
3773 | if (QUERY_FLAG (tmp, FLAG_AUTO_APPLY)) |
3779 | if (QUERY_FLAG (tmp, FLAG_AUTO_APPLY)) |
3774 | auto_apply (tmp); |
3780 | auto_apply (tmp); |
3775 | else if ((tmp->type == TREASURE || (tmp->type == CONTAINER)) && HAS_RANDOM_ITEMS (tmp)) |
3781 | else if ((tmp->type == TREASURE || (tmp->type == CONTAINER)) && tmp->has_random_items ()) |
3776 | { |
3782 | { |
3777 | while ((tmp->stats.hp--) > 0) |
3783 | while ((tmp->stats.hp--) > 0) |
3778 | create_treasure (tmp->randomitems, tmp, 0, m->difficulty, 0); |
3784 | create_treasure (tmp->randomitems, tmp, 0, m->difficulty, 0); |
3779 | tmp->randomitems = NULL; |
3785 | tmp->randomitems = NULL; |
3780 | } |
3786 | } |
… | |
… | |
3795 | * This is a problem for the above objects, because they have counters |
3801 | * This is a problem for the above objects, because they have counters |
3796 | * which say how many times to make the treasure. |
3802 | * which say how many times to make the treasure. |
3797 | */ |
3803 | */ |
3798 | else if (tmp && tmp->arch && tmp->type != PLAYER |
3804 | else if (tmp && tmp->arch && tmp->type != PLAYER |
3799 | && tmp->type != TREASURE && tmp->type != SPELL |
3805 | && tmp->type != TREASURE && tmp->type != SPELL |
3800 | && tmp->type != PLAYER_CHANGER && tmp->type != CLASS && HAS_RANDOM_ITEMS (tmp)) |
3806 | && tmp->type != PLAYER_CHANGER && tmp->type != CLASS && tmp->has_random_items ()) |
3801 | { |
3807 | { |
3802 | create_treasure (tmp->randomitems, tmp, GT_APPLY, m->difficulty, 0); |
3808 | create_treasure (tmp->randomitems, tmp, GT_APPLY, m->difficulty, 0); |
3803 | tmp->randomitems = NULL; |
3809 | tmp->randomitems = NULL; |
3804 | } |
3810 | } |
3805 | } |
3811 | } |