51 lines
1.2 KiB
Plaintext
51 lines
1.2 KiB
Plaintext
//KCpunker Healing Fountain (On Used Event)
|
|
|
|
int GetTotalTime()
|
|
{
|
|
int nYear = GetCalendarYear();
|
|
int nMonth = GetCalendarMonth();
|
|
int nDay = GetCalendarDay();
|
|
int nHour = GetTimeHour();
|
|
|
|
int nTTime = (nYear * 12 * 28 * 24) + ((nMonth - 1) * 28 * 24) + ((nDay - 1) * 24) + nHour;
|
|
return nTTime;
|
|
}
|
|
|
|
void main()
|
|
{
|
|
object oPC = GetLastUsedBy();
|
|
|
|
int nHMax = 3;//Max Heals for Period
|
|
int nHHours = 24;//Number of Hours a Player Must Wait to Get more Heals
|
|
int nLHHour = GetLocalInt(oPC,"LHHOUR");
|
|
int nHAllow = GetLocalInt(oPC,"HEAL_ALLOWED");
|
|
int nTTime = GetTotalTime();
|
|
|
|
//Check Time Period First (This allows Healing if more than 24 hours has passed on First Use)
|
|
int nCheck = (nLHHour + nHHours) - nTTime;
|
|
if(nCheck <= 0)
|
|
{
|
|
SetLocalInt(oPC,"HEAL_CURRENT",nHMax);
|
|
SetLocalInt(oPC,"LHHOUR",nTTime);
|
|
}
|
|
|
|
//Quantity of Heals
|
|
int nCHeals = GetLocalInt(oPC,"HEAL_CURRENT");
|
|
|
|
//All heals Used Up and In Same Period
|
|
if(nCHeals <= 0 && nCheck > 0)
|
|
{
|
|
SendMessageToPC(oPC,"You have already had your " +IntToString(nHMax)+ " heals in a 24 hour period.");
|
|
return;
|
|
}
|
|
|
|
//Ok to Heal
|
|
if(nCHeals > 0)
|
|
{
|
|
//: APPLY HEALING HERE
|
|
|
|
nCHeals--;
|
|
SetLocalInt(oPC,"HEAL_CURRENT",nCHeals);
|
|
}
|
|
}
|