57 lines
1.8 KiB
Plaintext
57 lines
1.8 KiB
Plaintext
void main()
|
|
{
|
|
object user = GetLastUsedBy();
|
|
if (user != OBJECT_INVALID) {
|
|
int can_see = TRUE;
|
|
|
|
if (GetHasSpellEffect(SPELL_DARKNESS, user))
|
|
can_see = FALSE;
|
|
if (GetHasSpellEffect(SPELL_DARKNESS, OBJECT_SELF))
|
|
can_see = FALSE;
|
|
if (GetHasSpellEffect(SPELL_BLINDNESS_AND_DEAFNESS, user))
|
|
can_see = FALSE;
|
|
if (GetHasSpellEffect(SPELL_MASS_BLINDNESS_AND_DEAFNESS, user))
|
|
can_see = FALSE;
|
|
|
|
if (!can_see) {
|
|
ActionSpeakString("You can not see the sundial...");
|
|
return;
|
|
}
|
|
}
|
|
|
|
string hour = IntToString(GetTimeHour());
|
|
string minute = IntToString(GetTimeMinute());
|
|
|
|
if (GetStringLength(minute) < 2)
|
|
minute = "0" + minute;
|
|
|
|
string sunphase = "neither day, dusk, night or dawn...";
|
|
if (GetIsDay()) {
|
|
sunphase = "day";
|
|
} else if (GetIsDawn()) {
|
|
sunphase = "dawn";
|
|
} else if (GetIsDusk()) {
|
|
sunphase = "dusk";
|
|
} else if (GetIsNight()) {
|
|
sunphase = "night";
|
|
|
|
// A sundial doesn't work during the night.
|
|
// When under the effect of a light spell, we'll make it work
|
|
if (GetHasSpellEffect(SPELL_LIGHT)) {
|
|
ActionSpeakString("A light spell iluminates the sundial. Strange, but it even shows the right time...");
|
|
ActionWait(4.0);
|
|
} else if (GetHasSpellEffect(SPELL_SUNBEAM)) {
|
|
ActionSpeakString("A sunbeam shines on the sundial, making it show the time...");
|
|
ActionWait(4.0);
|
|
} else {
|
|
ActionSpeakString("A sundial doesn't work during the night...");
|
|
return;
|
|
}
|
|
}
|
|
|
|
ActionSpeakString("The time is " + hour + ":" + minute);
|
|
ActionWait(4.0);
|
|
ActionSpeakString("This means that it is now " + sunphase);
|
|
}
|
|
|