Initial commit
Adding all of the current content for Anphillia Unlimited.
This commit is contained in:
84
_module/nss/eye_dm_inc.nss
Normal file
84
_module/nss/eye_dm_inc.nss
Normal file
@@ -0,0 +1,84 @@
|
||||
// Subscription CONSTANTS
|
||||
string SUBSCRIPTION_01 = "Join/Leave Messages";
|
||||
string SUBSCRIPTION_02 = "Rest Script Messages";
|
||||
string SUBSCRIPTION_03 = "LevelUp Messages";
|
||||
string SUBSCRIPTION_04 = "Death Messages";
|
||||
string SUBSCRIPTION_05 = "- no subscription yet -";
|
||||
|
||||
// Checks if DM oDM is subscribed to sSubscription
|
||||
int DM_HasSubscribed(object oDM, string sSubscription)
|
||||
{
|
||||
if (GetLocalInt(oDM, sSubscription) == 1)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
// Subscribes Object oDM to Subscription sSubscription
|
||||
void DM_SubscribeToMessage(object oDM, string sSubscription)
|
||||
{
|
||||
SetLocalInt(oDM, sSubscription, 1);
|
||||
}
|
||||
|
||||
// UnSubscribes Object oDM to Subscription sSubscription
|
||||
void DM_UnSubscribeToMessage(object oDM, string sSubscription)
|
||||
{
|
||||
SetLocalInt(oDM, sSubscription, 0);
|
||||
}
|
||||
|
||||
// Sets initial Subscriptions for DMs
|
||||
void DM_InitialSubscriptions(object oDM)
|
||||
{
|
||||
SetLocalInt(oDM, SUBSCRIPTION_01, 1);
|
||||
SetLocalInt(oDM, SUBSCRIPTION_03, 1);
|
||||
SetLocalInt(oDM, SUBSCRIPTION_04, 1);
|
||||
}
|
||||
|
||||
// Sends Message sMessage to all Subscribers of sSubscription
|
||||
void SendMessageToSubscribers(string sSubscription, string sMessage)
|
||||
{
|
||||
object oModule = GetModule();
|
||||
int iNumberOfDMs = GetLocalInt(oModule, "NumberOfDMs");
|
||||
int iCount;
|
||||
object oCurrentDM;
|
||||
for (iCount = 1; iCount < (iNumberOfDMs + 1); iCount++)
|
||||
{
|
||||
oCurrentDM = GetLocalObject(oModule, "DM" + IntToString(iCount));
|
||||
if (GetLocalInt(oCurrentDM, sSubscription) == 1)
|
||||
{
|
||||
SendMessageToPC(oCurrentDM, sMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Adds object oDM to DM-List
|
||||
void DM_AddDM(object oDM)
|
||||
{
|
||||
object oModule = GetModule();
|
||||
int iNumberOfDMs = GetLocalInt(oModule, "NumberOfDMs");
|
||||
iNumberOfDMs++;
|
||||
SetLocalObject(oModule, "DM" + IntToString(iNumberOfDMs), oDM);
|
||||
SetLocalInt(oModule, "NumberOfDMs", iNumberOfDMs);
|
||||
SetLocalInt(oDM, "DMNumber", iNumberOfDMs);
|
||||
}
|
||||
|
||||
// Removes object oDM from DM-List and fills the hole
|
||||
void DM_RemoveDM(object oDM)
|
||||
{
|
||||
object oModule = GetModule();
|
||||
int iNumberOfDMs = GetLocalInt(oModule, "NumberOfDMs");
|
||||
int iNumberOfDM = GetLocalInt(oDM, "DMNumber");
|
||||
SetLocalObject(oModule, "DM" + IntToString(iNumberOfDMs), OBJECT_INVALID);
|
||||
int iCount;
|
||||
for (iCount = iNumberOfDM; iCount < iNumberOfDMs; iCount++)
|
||||
{
|
||||
SetLocalObject(oModule, "DM" + IntToString(iCount), GetLocalObject(oModule, "DM" + IntToString(iCount + 1)));
|
||||
SetLocalInt(GetLocalObject(oModule, "DM" + IntToString(iCount)), "DMNumber", iCount);
|
||||
}
|
||||
iNumberOfDMs--;
|
||||
SetLocalInt(oModule, "NumberOfDMs", iNumberOfDMs);
|
||||
}
|
||||
Reference in New Issue
Block a user