… | |
… | |
1029 | if (sack == NULL || sack->type != CONTAINER) |
1029 | if (sack == NULL || sack->type != CONTAINER) |
1030 | { |
1030 | { |
1031 | LOG (llevError, "apply_container: %s is not container!\n", sack ? &sack->name : "[nullobject]"); |
1031 | LOG (llevError, "apply_container: %s is not container!\n", sack ? &sack->name : "[nullobject]"); |
1032 | return 0; |
1032 | return 0; |
1033 | } |
1033 | } |
1034 | op->contr->last_used = NULL; |
1034 | |
1035 | op->contr->last_used_id = 0; |
1035 | op->contr->last_used = 0; |
1036 | |
1036 | |
1037 | if (sack->env != op) |
1037 | if (sack->env != op) |
1038 | { |
1038 | { |
1039 | if (sack->other_arch == NULL || sack->env != NULL) |
1039 | if (sack->other_arch == NULL || sack->env != NULL) |
1040 | { |
1040 | { |
1041 | new_draw_info (NDI_UNIQUE, 0, op, "You must get it first."); |
1041 | new_draw_info (NDI_UNIQUE, 0, op, "You must get it first."); |
1042 | return 1; |
1042 | return 1; |
1043 | } |
1043 | } |
|
|
1044 | |
1044 | /* It's on the ground, the problems begin */ |
1045 | /* It's on the ground, the problems begin */ |
1045 | if (op->container != sack) |
1046 | if (op->container != sack) |
1046 | { |
1047 | { |
1047 | /* it's closed OR some player has opened it */ |
1048 | /* it's closed OR some player has opened it */ |
1048 | if (QUERY_FLAG (sack, FLAG_APPLIED)) |
1049 | if (QUERY_FLAG (sack, FLAG_APPLIED)) |
… | |
… | |
1143 | apply_container (op, sack); |
1144 | apply_container (op, sack); |
1144 | return 1; |
1145 | return 1; |
1145 | } |
1146 | } |
1146 | } |
1147 | } |
1147 | } |
1148 | } |
|
|
1149 | |
1148 | new_draw_info (NDI_UNIQUE, 0, op, buf); |
1150 | new_draw_info (NDI_UNIQUE, 0, op, buf); |
|
|
1151 | |
1149 | if (op->contr) |
1152 | if (op->contr) |
1150 | op->contr->socket.update_look = 1; |
1153 | op->contr->socket->update_look = 1; |
|
|
1154 | |
1151 | return 1; |
1155 | return 1; |
1152 | } |
1156 | } |
1153 | |
1157 | |
1154 | /** |
1158 | /** |
1155 | * 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 |
… | |
… | |
1786 | |
1790 | |
1787 | if (!QUERY_FLAG (tmp, FLAG_IDENTIFIED)) |
1791 | if (!QUERY_FLAG (tmp, FLAG_IDENTIFIED)) |
1788 | { |
1792 | { |
1789 | /*exp_gain *= 2; because they just identified it too */ |
1793 | /*exp_gain *= 2; because they just identified it too */ |
1790 | SET_FLAG (tmp, FLAG_IDENTIFIED); |
1794 | SET_FLAG (tmp, FLAG_IDENTIFIED); |
|
|
1795 | |
1791 | /* If in a container, update how it looks */ |
1796 | /* If in a container, update how it looks */ |
1792 | if (tmp->env) |
1797 | if (tmp->env) |
1793 | esrv_update_item (UPD_FLAGS | UPD_NAME, op, tmp); |
1798 | esrv_update_item (UPD_FLAGS | UPD_NAME, op, tmp); |
1794 | else |
1799 | else |
1795 | op->contr->socket.update_look = 1; |
1800 | op->contr->socket->update_look = 1; |
1796 | } |
1801 | } |
|
|
1802 | |
1797 | change_exp (op, exp_gain, skill_ob->skill, 0); |
1803 | change_exp (op, exp_gain, skill_ob->skill, 0); |
1798 | 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 */ |
1799 | } |
1805 | } |
1800 | } |
1806 | } |
1801 | |
1807 | |
… | |
… | |
1850 | } |
1856 | } |
1851 | return; |
1857 | return; |
1852 | } |
1858 | } |
1853 | |
1859 | |
1854 | play_sound_player_only (op->contr, SOUND_LEARN_SPELL, 0, 0); |
1860 | play_sound_player_only (op->contr, SOUND_LEARN_SPELL, 0, 0); |
1855 | tmp = object::create (); |
1861 | tmp = spell->clone (); |
1856 | spell->copy_to (tmp); |
|
|
1857 | insert_ob_in_ob (tmp, op); |
1862 | insert_ob_in_ob (tmp, op); |
1858 | |
1863 | |
1859 | if (special_prayer) |
1864 | if (special_prayer) |
1860 | { |
|
|
1861 | SET_FLAG (tmp, FLAG_STARTEQUIP); |
1865 | SET_FLAG (tmp, FLAG_STARTEQUIP); |
1862 | } |
|
|
1863 | |
1866 | |
1864 | esrv_add_spells (op->contr, tmp); |
1867 | esrv_add_spells (op->contr, tmp); |
1865 | } |
1868 | } |
1866 | |
1869 | |
1867 | /** |
1870 | /** |
… | |
… | |
1951 | 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); |
1952 | |
1955 | |
1953 | if (!QUERY_FLAG (tmp, FLAG_IDENTIFIED)) |
1956 | if (!QUERY_FLAG (tmp, FLAG_IDENTIFIED)) |
1954 | { |
1957 | { |
1955 | identify (tmp); |
1958 | identify (tmp); |
|
|
1959 | |
1956 | if (tmp->env) |
1960 | if (tmp->env) |
1957 | esrv_update_item (UPD_FLAGS | UPD_NAME, op, tmp); |
1961 | esrv_update_item (UPD_FLAGS | UPD_NAME, op, tmp); |
1958 | else |
1962 | else |
1959 | op->contr->socket.update_look = 1; |
1963 | op->contr->socket->update_look = 1; |
1960 | } |
1964 | } |
1961 | |
1965 | |
1962 | /* 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 |
1963 | * 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 |
1964 | * 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 |
… | |
… | |
2811 | op->destroy (); |
2815 | op->destroy (); |
2812 | return 1; |
2816 | return 1; |
2813 | } |
2817 | } |
2814 | |
2818 | |
2815 | pl->contr->last_used = op; |
2819 | pl->contr->last_used = op; |
2816 | pl->contr->last_used_id = op->count; |
|
|
2817 | |
2820 | |
2818 | tmp = manual_apply (pl, op, aflag); |
2821 | tmp = manual_apply (pl, op, aflag); |
2819 | if (!quiet) |
2822 | if (!quiet) |
2820 | { |
2823 | { |
2821 | if (tmp == 0) |
2824 | if (tmp == 0) |
… | |
… | |
3921 | { /* lighter gets used up */ |
3924 | { /* lighter gets used up */ |
3922 | /* Split multiple lighters if they're being used up. Otherwise * |
3925 | /* Split multiple lighters if they're being used up. Otherwise * |
3923 | * one charge from each would be used up. --DAMN */ |
3926 | * one charge from each would be used up. --DAMN */ |
3924 | if (lighter->nrof > 1) |
3927 | if (lighter->nrof > 1) |
3925 | { |
3928 | { |
3926 | object *oneLighter = object::create (); |
3929 | object *oneLighter = lighter->clone (); |
3927 | |
3930 | |
3928 | lighter->copy_to (oneLighter); |
|
|
3929 | lighter->nrof -= 1; |
3931 | lighter->nrof -= 1; |
3930 | oneLighter->nrof = 1; |
3932 | oneLighter->nrof = 1; |
3931 | oneLighter->stats.food--; |
3933 | oneLighter->stats.food--; |
3932 | esrv_send_item (who, lighter); |
3934 | esrv_send_item (who, lighter); |
3933 | oneLighter = insert_ob_in_ob (oneLighter, who); |
3935 | oneLighter = insert_ob_in_ob (oneLighter, who); |