HoS_PRC8/_mod/_module/nss/lib_h_lairaddons.nss
Jaysyn904 04165202c0 Initial upload
Initial upload
2024-11-25 19:36:07 -05:00

101 lines
3.2 KiB
Plaintext

////////////////////////////////////////////////////////////////////////////////
// lib_h_lairaddons - This will provide functions used by the scripts in the
// special lair add-ons.
//------------------------------------------------------------------------------
// By Deva Winblood. September, 20th, 2008
////////////////////////////////////////////////////////////////////////////////
#include "rtsh_multiplay"
////////////////////////////////////
// PROTOTYPES
////////////////////////////////////
// FILE: lib_h_lairaddons FUNCTION: LADD_HandleMana()
// This will check to see if mana crystals are in the object and will use the
// largest sized one to add mana to this object.
void LADD_HandleMana(object oPlaceable);
// FILE: lib_h_lairaddons FUNCTION: LADD_GetMana()
// This will return the amount of mana stored on this object.
int LADD_GetMana(object oPlaceable);
// FILE: lib_h_lairaddons FUNCTION: LADD_SetMana()
// This will set nAmount of the mana stored on the object.
void LADD_SetMana(object oPlaceable,int nAmount);
// FILE: lib_h_lairaddons FUNCTION: LADD_GetAbsoluteHour();
int LADD_GetAbsoluteHour();
////////////////////////////////////
// FUNCTIONS
////////////////////////////////////
int LADD_GetAbsoluteHour()
{ // PURPOSE: To Return the absolute hour
int nHour=GetTimeHour()+GetCalendarDay()*24+GetCalendarMonth()*24*30+GetCalendarYear()*24*30*12;
return nHour;
} // LADD_GetAbsoluteHour()
void LADD_SetMana(object oPlaceable,int nAmount)
{ // PURPOSE: Set the Mana level on this placeable
SetLocalInt(oPlaceable,"nLADDMana",nAmount);
} // LADD_SetMana()
int LADD_GetMana(object oPlaceable)
{ // PURPOSE: Get amount of mana store on this placeable
return GetLocalInt(oPlaceable,"nLADDMana");
} // LADD_GetMana()
void LADD_HandleMana(object oPlaceable)
{ // PURPOSE: Handle Mana
object oMe=OBJECT_SELF;
int nAdd=0;
object oCrystal=GetItemPossessedBy(oPlaceable,"MANA_CRYSTAL_5");
if (GetIsObjectValid(oCrystal)) nAdd=5;
else
{ // check for medium
oCrystal=GetItemPossessedBy(oPlaceable,"MANA_CRYSTAL_2");
if (GetIsObjectValid(oCrystal)) nAdd=2;
else
{ // check for minor
oCrystal=GetItemPossessedBy(oPlaceable,"MANA_CRYSTAL_1");
if (GetIsObjectValid(oCrystal)) nAdd=1;
} // check for minor
} // check for medium
if (nAdd>0)
{ // has mana
int nHour=GetLocalInt(oPlaceable,"nLADDHour");
effect eVFX=EffectVisualEffect(VFX_DUR_GLOW_WHITE);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eVFX,oPlaceable,8.0);
if (nHour>0)
{ // hour exists
if (LADD_GetAbsoluteHour()>=nHour)
{ // produce
int nDiff=LADD_GetAbsoluteHour()-nHour;
nDiff++;
nAdd=nAdd*nDiff;
int nMana=LADD_GetMana(oPlaceable);
nMana=nMana+nAdd;
LADD_SetMana(oPlaceable,nMana);
SetLocalInt(oPlaceable,"nLADDHour",LADD_GetAbsoluteHour()+1);
} // produce
} // hour exists
else
{ // set
SetLocalInt(oPlaceable,"nLADDHour",LADD_GetAbsoluteHour()+1);
} // set
} // has mana
} // LADD_HandleMana()
//void main(){}