Rune_PRC8/_module/nss/opw_dm_switch.nss
Jaysyn904 d1c309ae63 Initial commit
Initial commit
2024-09-13 09:10:39 -04:00

589 lines
17 KiB
Plaintext

////////////////////////////////////////////////////////////////////////////////
// DM Control Room Switch
// opw_dm_switch
// By Don Anderson
// dandersonru@msn.com
//
// Place this script in the Switch OnUsed Event
//
////////////////////////////////////////////////////////////////////////////////
#include "nbde_inc"
void ActivateSwitch()
{
DelayCommand(0.1, PlayAnimation(ANIMATION_PLACEABLE_ACTIVATE));
DelayCommand(2.0, PlayAnimation(ANIMATION_PLACEABLE_DEACTIVATE));
}
void main()
{
object oDM = GetLastUsedBy();
object oMod = GetModule();
object oSwitch = OBJECT_SELF;
string sSwitch = GetTag(oSwitch);
//:****************************************************************************/
//: CHANGE GLOBAL SYSTEMS ON AND OFF
//Module Reload
if(sSwitch == "DMReloadSwitch")
{
int nPrep = GetLocalInt(oMod,"RELOADPREP");
if(nPrep == 0)
{
SetLocalInt(oMod,"RELOADPREP",1);
ActivateSwitch();
SpeakString("Reload is Prepared. Use this switch again within 10 Seconds to Start Module Reload.");
DelayCommand(10.0,DeleteLocalInt(oMod,"RELOADPREP"));//So it does not stay Prepared
}
if(nPrep == 1)
{
ActivateSwitch();
ExecuteScript("opw_dm_modreload",oMod);
}
}
//Binding Stones System
if(sSwitch == "DMBindingSwitch")
{
int BS_ENABLE = GetLocalInt(oMod,"BS_ENABLE");
if(BS_ENABLE == 0)
{
SetLocalInt(oMod,"BS_ENABLE",1);
ActivateSwitch();
SpeakString("Binding Stones are now ON.");
}
if(BS_ENABLE == 1)
{
SetLocalInt(oMod,"BS_ENABLE",0);
ActivateSwitch();
SpeakString("Binding Stones are now OFF.");
}
}
//Adding Lifes to a Player
if(sSwitch == "DMAddLife")
{
if(GetIsDM(oDM) == TRUE || GetIsDMPossessed(oDM) == TRUE) return;
int nRunes = GetLocalInt(oMod,"LIFES");
int nLifes = NBDE_GetCampaignInt("SOULRUNE","LIFES",oDM);
ActivateSwitch();
if(nLifes >= nRunes)
{
SpeakString("You already have the maximum Lifes allowed.");
return;
}
else
{
NBDE_SetCampaignInt("SOULRUNE","LIFES",nLifes + 1,oDM);
SpeakString("One Life has been added for you. Please wait 30 Seconds before logging off.");
//Set the Player Death Stat's
if(GetLocalInt(GetModule(),"PKTRACK") == 1)
{
int nTimesDied = NBDE_GetCampaignInt("SOULRUNE", "TIMES_DIED", oDM);
if(nTimesDied > 0)
{
NBDE_SetCampaignInt("SOULRUNE", "TIMES_DIED", nTimesDied - 1, oDM);
}
}
}
NBDE_FlushCampaignDatabase("SOULRUNE");
}
//HTF System Globally
if(sSwitch == "DMHTFSwitch")
{
int nHTFGLOBAL = GetLocalInt(oMod,"HTFGLOBAL");
if(nHTFGLOBAL == 0)
{
SetLocalInt(oMod,"HTFGLOBAL",1);
ActivateSwitch();
SpeakString("HTF System is now ON.");
}
if(nHTFGLOBAL == 1)
{
SetLocalInt(oMod,"HTFGLOBAL",0);
ActivateSwitch();
SpeakString("HTF System is now OFF.");
}
}
//HTF Hunger System
if(sSwitch == "DMHungerSwitch")
{
int nHUNGERSYSTEM = GetLocalInt(oMod,"HUNGERSYSTEM");
if(nHUNGERSYSTEM == 0)
{
SetLocalInt(oMod,"HUNGERSYSTEM",1);
ActivateSwitch();
SpeakString("HTF Hunger System is now ON.");
}
if(nHUNGERSYSTEM == 1)
{
SetLocalInt(oMod,"HUNGERSYSTEM",0);
ActivateSwitch();
SpeakString("HTF Hunger System is now OFF.");
}
}
//HTF Fatigue System
if(sSwitch == "DMFatigueSwitch")
{
int nFATIGUESYSTEM = GetLocalInt(oMod,"FATIGUESYSTEM");
if(nFATIGUESYSTEM == 0)
{
SetLocalInt(oMod,"FATIGUESYSTEM",1);
ActivateSwitch();
SpeakString("HTF Hunger System is now ON.");
}
if(nFATIGUESYSTEM == 1)
{
SetLocalInt(oMod,"FATIGUESYSTEM",0);
ActivateSwitch();
SpeakString("HTF Hunger System is now OFF.");
}
}
//Resting System
if(sSwitch == "DMRestingSwitch")
{
int nRESTGLOBAL = GetLocalInt(oMod,"RESTGLOBAL");
if(nRESTGLOBAL == 0)
{
SetLocalInt(oMod,"RESTGLOBAL",1);
ActivateSwitch();
SpeakString("Resting System is now ON.");
}
if(nRESTGLOBAL == 1)
{
SetLocalInt(oMod,"RESTGLOBAL",0);
ActivateSwitch();
SpeakString("Resting System is now OFF.");
}
}
//PHB Resting System
if(sSwitch == "DMPHBRestingSwitch")
{
int nRESTPHB = GetLocalInt(oMod,"RESTPHB");
if(nRESTPHB == 0)
{
SetLocalInt(oMod,"RESTPHB",1);
ActivateSwitch();
SpeakString("PHB Resting is now ON.");
}
if(nRESTPHB == 1)
{
SetLocalInt(oMod,"RESTPHB",0);
ActivateSwitch();
SpeakString("PHB Resting is now OFF.");
}
}
//Crafting System
if(sSwitch == "DMCraftingSwitch")
{
int nCRAFTGLOBAL = GetLocalInt(oMod,"CRAFTGLOBAL");
if(nCRAFTGLOBAL == 0)
{
SetLocalInt(oMod,"CRAFTGLOBAL",1);
ActivateSwitch();
SpeakString("Crafting System is now ON.");
}
if(nCRAFTGLOBAL == 1)
{
SetLocalInt(oMod,"CRAFTGLOBAL",0);
ActivateSwitch();
SpeakString("Crafting System is now OFF.");
}
}
//Crafting System
if(sSwitch == "DMCraftingDeflectSwitch")
{
int nDEFLECTMESSAGE = GetLocalInt(oMod,"DEFLECTMESSAGE");
if(nDEFLECTMESSAGE == 0)
{
SetLocalInt(oMod,"DEFLECTMESSAGE",1);
ActivateSwitch();
SpeakString("Crafting Deflection Messages are now ON.");
}
if(nDEFLECTMESSAGE == 1)
{
SetLocalInt(oMod,"DEFLECTMESSAGE",0);
ActivateSwitch();
SpeakString("Crafting Deflection Messages are now OFF.");
}
}
//Crafting System
if(sSwitch == "DMCraftingRollSwitch")
{
int nROLLMESSAGE = GetLocalInt(oMod,"ROLLMESSAGE");
if(nROLLMESSAGE == 0)
{
SetLocalInt(oMod,"ROLLMESSAGE",1);
ActivateSwitch();
SpeakString("Crafting Roll Messages are now ON.");
}
if(nROLLMESSAGE == 1)
{
SetLocalInt(oMod,"ROLLMESSAGE",0);
ActivateSwitch();
SpeakString("Crafting Roll Messages are now OFF.");
}
}
//Weather System
if(sSwitch == "DMWeatherSwitch")
{
int nWEATHERGLOBAL = GetLocalInt(oMod,"WEATHERGLOBAL");
if(nWEATHERGLOBAL == 0)
{
SetLocalInt(oMod,"WEATHERGLOBAL",1);
ActivateSwitch();
SpeakString("Weather System is now ON.");
}
if(nWEATHERGLOBAL == 1)
{
SetLocalInt(oMod,"WEATHERGLOBAL",0);
ActivateSwitch();
SpeakString("Weather System is now OFF.");
}
}
//Sky Box Disable System
if(sSwitch == "DMSkyBoxSwitch")
{
int nWEATHERSKYBOX = GetLocalInt(oMod,"WEATHERSKYBOX");
if(nWEATHERSKYBOX == 0)
{
SetLocalInt(oMod,"WEATHERSKYBOX",1);
ActivateSwitch();
SpeakString("Dynamic Sky Box System is now ON.");
}
if(nWEATHERSKYBOX == 1)
{
SetLocalInt(oMod,"WEATHERSKYBOX",0);
ActivateSwitch();
SpeakString("Dynamic Sky Box System is now OFF.");
}
}
//Gold Encumberance System
if(sSwitch == "DMGoldSwitch")
{
int nDOA = GetLocalInt(oMod,"DOAGOLD");
if(nDOA == 0)
{
SetLocalInt(oMod,"DOAGOLD",1);
ActivateSwitch();
SpeakString("DOA Gold Encumberance is now ON.");
}
if(nDOA == 1)
{
SetLocalInt(oMod,"DOAGOLD",0);
ActivateSwitch();
SpeakString("DOA Gold Encumberance is now OFF.");
}
}
//DM Inventory Cleaner (Will Clean out Everything except Creature Stuff (For Subrace)!!!)
if(sSwitch == "DMInventoryCleanerSwitch")
{
int nPrep = GetLocalInt(oSwitch,"CLEANPREP");
if(nPrep == 0)
{
SetLocalInt(oSwitch,"CLEANPREP",1);
ActivateSwitch();
SpeakString("Cleaner is Prepared! Use this Switch again within 10 Seconds to Clean your inventory.");
DelayCommand(10.0,DeleteLocalInt(oSwitch,"CLEANPREP"));//So it does not stay Prepared
}
if(nPrep == 1)
{
ActivateSwitch();
//Now we Destroy all the objects in the inventory
object oItem = GetFirstItemInInventory(oDM);
while (oItem != OBJECT_INVALID)
{
DestroyObject(oItem);
oItem = GetNextItemInInventory(oDM);
}
DestroyObject(GetItemInSlot(INVENTORY_SLOT_HEAD, oDM), 0.0);
DestroyObject(GetItemInSlot(INVENTORY_SLOT_NECK, oDM), 0.0);
DestroyObject(GetItemInSlot(INVENTORY_SLOT_CHEST, oDM), 0.0);
DestroyObject(GetItemInSlot(INVENTORY_SLOT_BELT, oDM), 0.0);
DestroyObject(GetItemInSlot(INVENTORY_SLOT_CLOAK, oDM), 0.0);
DestroyObject(GetItemInSlot(INVENTORY_SLOT_ARMS, oDM), 0.0);
DestroyObject(GetItemInSlot(INVENTORY_SLOT_LEFTHAND, oDM), 0.0);
DestroyObject(GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oDM), 0.0);
DestroyObject(GetItemInSlot(INVENTORY_SLOT_RIGHTRING, oDM), 0.0);
DestroyObject(GetItemInSlot(INVENTORY_SLOT_LEFTRING, oDM), 0.0);
DestroyObject(GetItemInSlot(INVENTORY_SLOT_BOOTS, oDM), 0.0);
DestroyObject(GetItemInSlot(INVENTORY_SLOT_BOLTS, oDM), 0.0);
DestroyObject(GetItemInSlot(INVENTORY_SLOT_ARROWS, oDM), 0.0);
DestroyObject(GetItemInSlot(INVENTORY_SLOT_BULLETS, oDM), 0.0);
SpeakString("Your Inventory has been Cleansed.");
//Now we want to give back Important Items!
ExecuteScript("opw_give_robe",oDM); //Give Basic Brown Robe
object oRuneStone = CreateItemOnObject("runestone",oDM);//Runestone for HTF
}
}
//Allegiance Reset Switch
if(sSwitch == "DMAllegianceResetSwitch")
{
int nPrep = GetLocalInt(oSwitch,"ALRESETPREP");
if(nPrep == 0)
{
SetLocalInt(oSwitch,"ALRESETPREP",1);
ActivateSwitch();
SpeakString("Allegiance Reset is Prepared! Use this Switch again within 10 Seconds to Reset your Allegiance.");
DelayCommand(10.0,DeleteLocalInt(oSwitch,"ALRESETPREP"));//So it does not stay Prepared
}
if(nPrep == 1)
{
ActivateSwitch();
//Destroy Allegiance Skin
DestroyObject(GetItemInSlot(INVENTORY_SLOT_CARMOUR, oDM), 0.0);
//Now Update DB
NBDE_SetCampaignInt("ALLEGIANCE","FACTION",0,oDM);
SetLocalInt(oDM,"FACTION",0);
SetLocalString(oDM,"CAPITOL_TAG","");
SetSubRace(oDM, "");
SpeakString("Your Allegiance has been Reset to Nothing.");
}
}
//Player Jumping to Leader
if(sSwitch == "DMLeaderJump")
{
int nJump = GetLocalInt(oMod,"LEADERJUMP");
if(nJump == 0)
{
SetLocalInt(oMod,"LEADERJUMP",1);
ActivateSwitch();
SpeakString("Player Jumping to Leader is now ON.");
}
if(nJump == 1)
{
SetLocalInt(oMod,"LEADERJUMP",0);
ActivateSwitch();
SpeakString("Player Jumping to Leader is now OFF.");
}
}
//Farm DB Reset
if(sSwitch == "DMFarmResetDBSwitch")
{
int nPrep = GetLocalInt(oMod,"FARMPREP");
if(nPrep == 0)
{
SetLocalInt(oMod,"FARMPREP",1);
ActivateSwitch();
SpeakString("Farm DB Reset is Prepared. Use this switch again within 10 Seconds to Reset Farm DB.");
DelayCommand(10.0,DeleteLocalInt(oMod,"FARMPREP"));//So it does not stay Prepared
}
if(nPrep == 1)
{
ActivateSwitch();
ExecuteScript("farm_reset_db",oMod);
}
}
//OAI Critical System
if(sSwitch == "DMOAICriticalSwitch")
{
int nOAICRIT = GetLocalInt(oMod,"OAICRIT");
if(nOAICRIT == 0)
{
SetLocalInt(oMod,"OAICRIT",1);
ActivateSwitch();
SpeakString("OAI Critical System is now ON.");
}
if(nOAICRIT == 1)
{
SetLocalInt(oMod,"OAICRIT",0);
ActivateSwitch();
SpeakString("OAI Critical System is now OFF.");
}
}
//DM Enchanting Book Reset
if(sSwitch == "DMEncBookResetSwitch")
{
if(GetIsPC(oDM) == TRUE)
{
ActivateSwitch();
object oBook = GetItemPossessedBy(oDM,"BookofEnchanting");
DeleteLocalInt(oBook,"ENC_REG");
DeleteLocalInt(oBook,"ENCHANTING_LVL");
SpeakString("Your Enchanting Book Has Been Reset.");
}
}
//DM Enchanting Book Add 4
if(sSwitch == "DMEncBookAdd4Switch")
{
if(GetIsPC(oDM)==TRUE)
{
ActivateSwitch();
object oBook = GetItemPossessedBy(oDM,"BookofEnchanting");
int nLevel = GetLocalInt(oBook,"ENCHANTING_LVL");
nLevel = nLevel + 4;
if(nLevel <= 20) SetLocalInt(oBook,"ENCHANTING_LVL",nLevel);
if(nLevel <= 20) SpeakString("Your Enchanting Book now has "+IntToString(nLevel)+" College Credits.");
}
}
//DM Herbology Book Reset
if(sSwitch == "DMHerBookResetSwitch")
{
if(GetIsPC(oDM) == TRUE)
{
ActivateSwitch();
object oBook = GetItemPossessedBy(oDM,"BookofHerbology");
DeleteLocalInt(oBook,"HERB_REG");
DeleteLocalInt(oBook,"HERBOLOGY_LVL");
SpeakString("Your Herbology Book Has Been Reset.");
}
}
//DM Herbology Book Add 4
if(sSwitch == "DMHerBookAdd4Switch")
{
if(GetIsPC(oDM)==TRUE)
{
ActivateSwitch();
object oBook = GetItemPossessedBy(oDM,"BookofEnchanting");
int nLevel = GetLocalInt(oBook,"HERBOLOGY_LVL");
nLevel = nLevel + 4;
if(nLevel <= 20) SetLocalInt(oBook,"HERBOLOGY_LVL",nLevel);
if(nLevel <= 20) SpeakString("Your Herbology Book now has "+IntToString(nLevel)+" College Credits.");
}
}
//DM Smithing Book Reset
if(sSwitch == "DMSmiBookResetSwitch")
{
if(GetIsPC(oDM) == TRUE)
{
ActivateSwitch();
object oBook = GetItemPossessedBy(oDM,"BookofSmithing");
DeleteLocalInt(oBook,"BLK_REG");
DeleteLocalInt(oBook,"HERBOLOGY_LVL");
SpeakString("Your Smithing Book Has Been Reset.");
}
}
//DM Smithing Book Add 4
if(sSwitch == "DMSmiBookAdd4Switch")
{
if(GetIsPC(oDM)==TRUE)
{
ActivateSwitch();
object oBook = GetItemPossessedBy(oDM,"BookofSmithing");
int nLevel = GetLocalInt(oBook,"SMITHING_LVL");
nLevel = nLevel + 4;
if(nLevel <= 20) SetLocalInt(oBook,"SMITHING_LVL",nLevel);
if(nLevel <= 20) SpeakString("Your Smithing Book now has "+IntToString(nLevel)+" College Credits.");
}
}
//DM Woodworking Book Reset
if(sSwitch == "DMWdwBookResetSwitch")
{
if(GetIsPC(oDM) == TRUE)
{
ActivateSwitch();
object oBook = GetItemPossessedBy(oDM,"BookofWoodworking");
DeleteLocalInt(oBook,"WDW_REG");
DeleteLocalInt(oBook,"WOODWORKING_LVL");
SpeakString("Your Woodworking Book Has Been Reset.");
}
}
//DM Woodworking Book Add 4
if(sSwitch == "DMWdwBookAdd4Switch")
{
if(GetIsPC(oDM)==TRUE)
{
ActivateSwitch();
object oBook = GetItemPossessedBy(oDM,"BookofWoodworking");
int nLevel = GetLocalInt(oBook,"WOODWORKING_LVL");
nLevel = nLevel + 4;
if(nLevel <= 20) SetLocalInt(oBook,"WOODWORKING_LVL",nLevel);
if(nLevel <= 20) SpeakString("Your Woodworking Book now has "+IntToString(nLevel)+" College Credits.");
}
}
//DM Ranking Reset
if(sSwitch == "DMRankingReset")
{
if(GetIsPC(oDM)==TRUE)
{
ActivateSwitch();
object oRank = GetItemPossessedBy(oDM,"RankInsignia");
DestroyObject(oRank);
SetLocalInt(oDM,"OAS_RANK",0);
NBDE_SetCampaignInt("ALLEGIANCE","OAS_RANK",0,oDM);
DelayCommand(1.0,NBDE_FlushCampaignDatabase("ALLEGIANCE"));
SpeakString("Your Ranking Has Been Reset.");
}
}
//DM Ranking Add 1
if(sSwitch == "DMRankingAdd1")
{
if(GetIsPC(oDM)==TRUE)
{
ActivateSwitch();
int nRank = GetLocalInt(oDM,"OAS_RANK");
if(nRank == 0) ExecuteScript("oas_give_rank1",oDM);
else if(nRank == 1) ExecuteScript("oas_give_rank2",oDM);
else if(nRank == 2) ExecuteScript("oas_give_rank3",oDM);
else if(nRank == 3) ExecuteScript("oas_give_rank4",oDM);
else if(nRank == 4) ExecuteScript("oas_give_rank5",oDM);
else if(nRank == 5) ExecuteScript("oas_give_rank6",oDM);
else if(nRank == 6) ExecuteScript("oas_give_rank7",oDM);
else if(nRank == 7) ExecuteScript("oas_give_rank8",oDM);
DelayCommand(1.0,NBDE_FlushCampaignDatabase("ALLEGIANCE"));
}
}
}