generated from Jaysyn/ModuleTemplate
45 lines
1.5 KiB
Plaintext
45 lines
1.5 KiB
Plaintext
// the familiar heals itself fully (no effects)
|
|
// familiar may feed only once every 8 hours
|
|
// mod. by Jim Lowe 9/26/02
|
|
void main()
|
|
{
|
|
object oPlayer = GetMaster();
|
|
|
|
int iLastHourRest = GetLocalInt(oPlayer, "FMLastHourRest");
|
|
int iLastDayRest = GetLocalInt(oPlayer, "FMLastDayRest");
|
|
int iLastYearRest = GetLocalInt(oPlayer, "FMLastYearRest");
|
|
int iLastMonthRest = GetLocalInt(oPlayer, "FMLastMonthRest");
|
|
int iHour = GetTimeHour();
|
|
int iDay = GetCalendarDay();
|
|
int iYear = GetCalendarYear();
|
|
int iMonth = GetCalendarMonth();
|
|
int iHowLong = 0;
|
|
int iSum = iLastHourRest + iLastDayRest + iLastYearRest + iLastMonthRest;
|
|
|
|
if (iLastYearRest != iYear)
|
|
iMonth = iMonth + 12;
|
|
if (iLastMonthRest != iMonth)
|
|
iDay = iDay + 28;
|
|
if (iDay != iLastDayRest)
|
|
iHour = iHour + 24 * (iDay - iLastDayRest);
|
|
|
|
iHowLong = iHour - iLastHourRest;
|
|
|
|
if ((iHowLong < 8) && (iSum != 0))
|
|
{
|
|
string msg = "You may feed " + GetName(OBJECT_SELF) + " again in "
|
|
+ IntToString(8-iHowLong) + " hours.";
|
|
SendMessageToPC(oPlayer, msg);
|
|
}
|
|
else
|
|
{
|
|
SetLocalInt(oPlayer, "FMLastHourRest", GetTimeHour());
|
|
SetLocalInt(oPlayer, "FMLastDayRest", GetCalendarDay());
|
|
SetLocalInt(oPlayer, "FMLastMonthRest", GetCalendarMonth());
|
|
SetLocalInt(oPlayer, "FMLastYearRest", GetCalendarYear());
|
|
int nHeal = GetMaxHitPoints();
|
|
effect eHeal = EffectHeal(nHeal);
|
|
ApplyEffectToObject(DURATION_TYPE_INSTANT,eHeal,OBJECT_SELF);
|
|
}
|
|
}
|