00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00028 #include <global.h>
00029 #include <ob_methods.h>
00030 #include <ob_types.h>
00031 #include <sounds.h>
00032 #include <sproto.h>
00033
00034 static method_ret skillscroll_type_apply(ob_methods *context, object *lighter, object *applier, int aflags);
00035
00039 void init_type_skillscroll(void) {
00040 register_apply(SKILLSCROLL, skillscroll_type_apply);
00041 }
00042
00057 static method_ret skillscroll_type_apply(ob_methods *context, object *scroll, object *applier, int aflags) {
00058 char name[MAX_BUF];
00059
00060
00061 if (applier->type == PLAYER) {
00062 switch ((int)learn_skill(applier, scroll)) {
00063 case 0:
00064 query_name(scroll, name, MAX_BUF);
00065 draw_ext_info_format(NDI_UNIQUE, 0, applier, MSG_TYPE_APPLY, MSG_TYPE_APPLY_ERROR,
00066 "You already possess the knowledge held within the %s.",
00067 "You already possess the knowledge held within the %s.",
00068 name);
00069 return METHOD_OK;
00070
00071 case 1:
00072 draw_ext_info_format(NDI_UNIQUE, 0, applier, MSG_TYPE_APPLY, MSG_TYPE_APPLY_SUCCESS,
00073 "You succeed in learning %s",
00074 "You succeed in learning %s",
00075 scroll->skill);
00076 draw_ext_info_format(NDI_UNIQUE, 0, applier, MSG_TYPE_APPLY, MSG_TYPE_APPLY_SUCCESS,
00077 "Type 'bind ready_skill %s to store the skill in a key.",
00078 "Type 'bind ready_skill %s to store the skill in a key.",
00079 scroll->skill);
00080 decrease_ob(scroll);
00081 return METHOD_OK;
00082
00083 default:
00084 query_name(scroll, name, MAX_BUF);
00085 draw_ext_info_format(NDI_UNIQUE, 0, applier, MSG_TYPE_APPLY, MSG_TYPE_APPLY_FAILURE,
00086 "You fail to learn the knowledge of the %s.\n",
00087 "You fail to learn the knowledge of the %s.\n",
00088 name);
00089 decrease_ob(scroll);
00090 return METHOD_OK;
00091 }
00092 }
00093 return METHOD_OK;
00094 }