Initial Commit
Initial Commit
This commit is contained in:
84
_module/nss/house_putsale.nss
Normal file
84
_module/nss/house_putsale.nss
Normal file
@@ -0,0 +1,84 @@
|
||||
#include "x4_inc_functions"
|
||||
void main()
|
||||
{
|
||||
object oPC = GetPCSpeaker();
|
||||
object oModule = GetModule();
|
||||
|
||||
string sDatabase = GetLocalString(oModule, "DB");
|
||||
int nPrice = GetLocalInt(oPC, "HousePrice");
|
||||
string sHouse = GetLocalString(oPC, "HouseToSell");
|
||||
|
||||
string sHouseOwnership = "H_"+sHouse+"_OWNER";
|
||||
string sOwner = CharacterDB(oPC);
|
||||
string sHouseSeller = "H_"+sHouse+"_SELLER";
|
||||
string sHousePrice = "H_"+sHouse+"_PRICE";
|
||||
|
||||
SetCampaignString(sDatabase, sHouseOwnership, "FORSALE");
|
||||
SetCampaignString(sDatabase, sHouseSeller, sOwner);
|
||||
SetCampaignInt(sDatabase, sHousePrice, nPrice);
|
||||
|
||||
//Clear the list of the authorized people of the estate
|
||||
DeleteCampaignVariable(sDatabase, "H_"+sHouse+"_AUTH_1");
|
||||
DeleteCampaignVariable(sDatabase, "H_"+sHouse+"_AUTH_2");
|
||||
DeleteCampaignVariable(sDatabase, "H_"+sHouse+"_AUTH_3");
|
||||
DeleteCampaignVariable(sDatabase, "H_"+sHouse+"_AUTH_4");
|
||||
DeleteCampaignVariable(sDatabase, "H_"+sHouse+"_AUTH_5");
|
||||
DeleteCampaignVariable(sDatabase, "H_"+sHouse+"_AUTH_6");
|
||||
DeleteCampaignVariable(sDatabase, "H_"+sHouse+"_AUTH_7");
|
||||
DeleteCampaignVariable(sDatabase, "H_"+sHouse+"_AUTH_8");
|
||||
DeleteCampaignVariable(sDatabase, "H_"+sHouse+"_AUTH_9");
|
||||
DeleteCampaignVariable(sDatabase, "H_"+sHouse+"_AUTH_10");
|
||||
|
||||
|
||||
//Identify the area with the estate in question
|
||||
string sWaypointName = "WP_AREA_"+sHouse;
|
||||
object oAreaWP = GetWaypointByTag(sWaypointName);
|
||||
object oEstate = GetArea(oAreaWP);
|
||||
|
||||
//Kick out all players that might still be present in the sold estate
|
||||
object oTarget = GetWaypointByTag("WP_AREA_"+sHouse+"_OUT");
|
||||
object oVisitor = GetFirstPC();
|
||||
object oHench;
|
||||
int nHench;
|
||||
while (GetIsObjectValid(oVisitor) == TRUE)
|
||||
{
|
||||
if(GetArea(oVisitor)==oEstate)
|
||||
{
|
||||
// Teleport the PC.
|
||||
AssignCommand(oVisitor, ClearAllActions());
|
||||
AssignCommand(oVisitor, JumpToObject(oTarget));
|
||||
|
||||
// Also teleport associates.
|
||||
oHench = GetAssociate(ASSOCIATE_TYPE_ANIMALCOMPANION, oVisitor);
|
||||
AssignCommand(oHench, ClearAllActions());
|
||||
AssignCommand(oHench, JumpToObject(oTarget));
|
||||
oHench = GetAssociate(ASSOCIATE_TYPE_DOMINATED, oVisitor);
|
||||
AssignCommand(oHench, ClearAllActions());
|
||||
AssignCommand(oHench, JumpToObject(oTarget));
|
||||
oHench = GetAssociate(ASSOCIATE_TYPE_FAMILIAR, oVisitor);
|
||||
AssignCommand(oHench, ClearAllActions());
|
||||
AssignCommand(oHench, JumpToObject(oTarget));
|
||||
oHench = GetAssociate(ASSOCIATE_TYPE_SUMMONED, oVisitor);
|
||||
AssignCommand(oHench, ClearAllActions());
|
||||
AssignCommand(oHench, JumpToObject(oTarget));
|
||||
|
||||
// Support for multiple henchmen (includes horses).
|
||||
nHench = 1;
|
||||
oHench = GetHenchman(oVisitor, 1);
|
||||
while ( oHench != OBJECT_INVALID )
|
||||
{
|
||||
AssignCommand(oHench, ClearAllActions());
|
||||
AssignCommand(oHench, JumpToObject(oTarget));
|
||||
// Next henchman.
|
||||
oHench = GetHenchman(oVisitor, ++nHench);
|
||||
}
|
||||
}
|
||||
oVisitor = GetNextPC();
|
||||
}
|
||||
|
||||
|
||||
//In ONLINE mode, delete the current date
|
||||
if (GetLocalString(oModule, "MODE") == "ONLINE")
|
||||
DeleteCampaignVariable(sDatabase, "TIME_"+sHouse);
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user