00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00026 #include <global.h>
00027 #include <ob_methods.h>
00028 #include <ob_types.h>
00029 #include <sounds.h>
00030 #include <sproto.h>
00031
00032 static method_ret clock_type_apply(ob_methods *context, object *op, object *applier, int aflags);
00033
00037 void init_type_clock(void) {
00038 register_apply(CLOCK, clock_type_apply);
00039 }
00040
00050 static method_ret clock_type_apply(ob_methods *context, object *op, object *applier, int aflags) {
00051 if (applier->type == PLAYER) {
00052 timeofday_t tod;
00053
00054 get_tod(&tod);
00055 play_sound_player_only(applier->contr, SOUND_TYPE_ITEM, op, 0, "tick");
00056 draw_ext_info_format(NDI_UNIQUE, 0, applier, MSG_TYPE_APPLY, MSG_TYPE_APPLY_SUCCESS,
00057 "It is %d minute%s past %d o'clock %s",
00058 "It is %d minute%s past %d o'clock %s",
00059 tod.minute+1, ((tod.minute+1 < 2) ? "" : "s"),
00060 ((tod.hour%14 == 0) ? 14 : ((tod.hour)%14)),
00061 ((tod.hour >= 14) ? "pm" : "am"));
00062 return METHOD_OK;
00063 }
00064 return METHOD_UNHANDLED;
00065 }