1/*
2 *
3 *  Copyright (C) 2006  The Exult Team
4 *
5 *  This program is free software; you can redistribute it and/or modify
6 *  it under the terms of the GNU General Public License as published by
7 *  the Free Software Foundation; either version 2 of the License, or
8 *  (at your option) any later version.
9 *
10 *  This program is distributed in the hope that it will be useful,
11 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 *  GNU General Public License for more details.
14 *
15 *  You should have received a copy of the GNU General Public License
16 *  along with this program; if not, write to the Free Software
17 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 */
19
20void DeskItem shape#(0x2A3) ()
21{
22	if (!gflags[TIME_FORMAT_24_HOURS])
23	{
24		DeskItem.original();
25		abort;
26	}
27
28	if (event == DOUBLECLICK)
29	{
30		var framenum = UI_get_item_frame(item);
31		if (framenum == 21)
32		{
33
34			var hour = UI_game_hour();
35			if (hour <= 9)
36				hour = ("0" + hour);
37
38			var minute = UI_game_minute();
39			if (minute <= 9)
40				minute = ("0" + minute);
41
42			var bark = hour + ":" + minute;
43			if (UI_in_gump_mode())
44				UI_item_say(item, bark);
45
46			else
47			{
48				bark = "@" + bark + "@";
49				UI_item_say(AVATAR, bark);
50			}
51			return;
52		}
53	}
54	DeskItem.original();
55}
56
57void Sundial shape#(0x11C) ()
58{
59	if (!gflags[TIME_FORMAT_24_HOURS])
60	{
61		Sundial.original();
62		abort;
63	}
64
65	if (event == DOUBLECLICK)
66	{
67		var hour = UI_game_hour();
68		if (hour == 12)
69			item_say("Noon");
70		else if ((hour >= 6) && (hour <= 20))
71			item_say(UI_game_hour() + " o'clock");
72		else
73			var bark = "@^<Avatar>, I believe the important part of the word sundial is `sun'.@";
74			partyUtters(1, bark, bark, false);
75	}
76}
77