Initial upload

Initial upload.
This commit is contained in:
Jaysyn904
2024-10-09 14:17:22 -04:00
parent a13073fd78
commit e51634d39b
2354 changed files with 658510 additions and 0 deletions

23
_module/nss/_concat.nss Normal file
View File

@@ -0,0 +1,23 @@
#include "fcb_inc_vars"
#include "fcb_inc_parser"
//==========================================/
void main()
//==========================================/
{
string result = "";
int n = 1;
string arg = retrieve_arg(n);
while(arg != CMD_ERROR_STRING)
{
result += arg;
n++;
arg = retrieve_arg(n);
}
set_function_result(result);
set_function_result_valid();
}

21
_module/nss/_setcgrd.nss Normal file
View File

@@ -0,0 +1,21 @@
#include "fcb_inc_vars"
#include "fcb_inc_cvdisp"
#include "fcb_inc_parser"
//==========================================/
void main()
//==========================================/
{
string name = retrieve_arg(1);
int r1 = StringToInt(retrieve_arg(2));
int g1 = StringToInt(retrieve_arg(3));
int b1 = StringToInt(retrieve_arg(4));
int r2 = StringToInt(retrieve_arg(5));
int g2 = StringToInt(retrieve_arg(6));
int b2 = StringToInt(retrieve_arg(7));
set_function_result(set_gradation(name, r1, g1, b1, r2, g2, b2));
set_function_result_valid();
}

13
_module/nss/_setcolor.nss Normal file
View File

@@ -0,0 +1,13 @@
#include "fcb_inc_vars"
#include "fcb_inc_cvdisp"
#include "fcb_inc_parser"
//==========================================/
void main()
//==========================================/
{
string result = set_string_color(retrieve_arg(1), StringToInt(retrieve_arg(2)), StringToInt(retrieve_arg(3)), StringToInt(retrieve_arg(4)));
set_function_result(result);
set_function_result_valid();
}

30
_module/nss/_setgp.nss Normal file
View File

@@ -0,0 +1,30 @@
#include "fcb_inc_vars"
#include "fcb_inc_parser"
#include "fcb_inc_general"
//==========================================/
void main()
//==========================================/
{
//uncomment to use - gives infinite gold
/*
string arg = retrieve_arg(1);
if(get_is_number(arg))
{
int gp_amount = StringToInt(arg);
if(gp_amount < 0)
{
gp_amount = 0;
}
object user = GetLocalObject(FCB_HOST, USER);
int gp_current = GetGold(user);
give_gold(gp_amount - gp_current, user);
set_function_result(IntToString(GetGold(user)));
set_function_result_valid();
}
*/
}

42
_module/nss/_sw_forge.nss Normal file
View File

@@ -0,0 +1,42 @@
#include "fcb_inc_vars"
#include "fcb_inc_parser"
#include "fcb_inc_cvdisp"
#include "fcb_inc_general"
//==========================================/
void main()
//==========================================/
{
//uncomment to use - controls forge enable/disable
/*
string arg = retrieve_arg(1);
if(get_is_number(arg))
{
string result = "";
switch(StringToInt(arg))
{
case 0:
{
switch_forge_enable(0);
result = "Forge disabled";
break;
}
default:
{
switch_forge_enable(1);
result = "Forge enabled";
break;
}
}
start_conversation(GetLocalObject(FCB_HOST, USER));
set_function_result(result);
set_function_result_valid();
}
*/
}

39
_module/nss/_sw_ilr.nss Normal file
View File

@@ -0,0 +1,39 @@
#include "fcb_inc_vars"
#include "fcb_inc_parser"
#include "fcb_inc_general"
//==========================================/
void main()
//==========================================/
{
//uncomment to use - controls ILR enable/disable
/*
string arg = retrieve_arg(1);
if(get_is_number(arg))
{
string result = "";
switch(StringToInt(arg))
{
case 0:
{
switch_ILR_enable(0);
result = "ILR disabled";
break;
}
default:
{
switch_ILR_enable(1);
result = "ILR enabled";
break;
}
}
set_function_result(result);
set_function_result_valid();
}
*/
}

View File

@@ -0,0 +1,9 @@
int StartingConditional()
{
if (2 < 1)
return TRUE;
else
return FALSE;
}

View File

@@ -0,0 +1,68 @@
//::///////////////////////////////////////////////
//:: Area_Clean_Inc
//:: Copyright (c) 2004 Indigo-Red
//:://////////////////////////////////////////////
/*
Designed to clean the area when no players are present.
Functions/scripts contained here are used as follows for the Area:
OnEnter: [CheckForPC()]
- Keeps track of the number of players in the area
OnExit: [TimerCheck()]
- Checks to see if any players remain in the area
- Starts cleanup process when no PC is present
* In addition the following script is needed:
OnUserDefined: "area_clean_usr"
- Performs the actual clearing of the area
NOTE: The first two are presented as functions so that they can
be easily incorporated with any existing area scripts.
*/
//:://////////////////////////////////////////////
//:: Created By: Johnnie "Nekyia" Casiano
//:: Created On: 20040208
//:://////////////////////////////////////////////
// **** FUNCTION DECLARATIONS
// Function is used to keep track of the number of players present in the area
// Ex: (As part of the Area's OnEnter) CheckForPC(GetEnteringObject());
void CheckForPC(object PC, object Area=OBJECT_SELF);
// Function makes sure no PCs are left in the area before starting the clean timer
// Ex: (As part of the Area's OnExit) TimerCheck(GetExitingObject());
void TimerCheck(object PC, object Area=OBJECT_SELF);
// **** CUSTOM FUNCTIONS
void CheckForPC(object PC, object Area=OBJECT_SELF)
{
if(!GetIsPC(PC)||GetIsDM(PC)){return;}
object Last=GetLocalObject(PC,"Area");
//SendMessageToPC(PC,"Last Area: "+GetName(Last));
if(Last==Area){
int Count=GetLocalInt(Area,"PCCount");
//SendMessageToPC(PC,"Last Area Same. Count: "+IntToString(Count));
return;
}
int Count=GetLocalInt(Area,"PCCount")+1;
SetLocalInt(Area,"PCCount",Count);
SetLocalObject(PC,"Area",Area);
//SendMessageToPC(PC,"Area Set To: "+GetName(GetLocalObject(PC,"Area")));
//SendMessageToPC(PC,GetName(Area)+" Count: "+IntToString(GetLocalInt(Area,"PCCount")));
}
void TimerCheck(object PC, object Area=OBJECT_SELF)
{
if(!GetIsPC(PC)||GetIsDM(PC)){return;}
int Count=GetLocalInt(Area,"PCCount")-1;
int Timer=GetLocalInt(Area,"Timer");
if(Count==0 && Timer==0){
SetLocalInt(Area,"Timer",1);
SignalEvent(Area,EventUserDefined(69));
//SendMessageToPC(PC,"Cleanup check signal sent for "+GetName(Area));
}
SetLocalInt(Area,"PCCount",Count);
//SendMessageToPC(PC,GetName(Area)+"PC Count: "+IntToString(Count));
}

View File

@@ -0,0 +1,117 @@
//::///////////////////////////////////////////////
//:: Area_Clean_Usr
//:: Copyright (c) 2004 Indigo-Red
//:://////////////////////////////////////////////
/*
Designed to clean the area when no players are present.
Works in conjunction with the following two functions:
CheckForPC() & TimerCheck()
(Examine the "area_clean_inc" script for more detail)
*/
//:://////////////////////////////////////////////
//:: Created By: Johnnie "Nekyia" Casiano
//:: Created On: 20040208
//:://////////////////////////////////////////////
// **** CONSTANTS
float Default=1.0; //If no time is specified for the area, the default is 3 minutes
// **** FUNCTION DECLARATIONS
// Function gets the area's delay; if none found assigns it the default (300 secs)
float GetDelay(object Area=OBJECT_SELF);
// Function screens objects in the area to make sure they should be destroyed
int CleanCheck(object Trash, object Area=OBJECT_SELF);
// Function used to clear the area of any NPCs, loot bags and general trash
void CleanArea(object Area=OBJECT_SELF);
//Function to clear the inventory prior to destroying the container (BodyBag)
void CleanInventory(object Bag);
// **** CUSTOM FUNCTIONS
float GetDelay(object Area=OBJECT_SELF)
{
float Delay=GetLocalFloat(Area,"Delay");
// Set a default delay to an area that has not been specifically defined
if(Delay==0.0){
SetLocalFloat(Area,"Delay",Default);}
//SendMessageToPC(GetFirstPC(),
//"Delay setting for "+GetName(Area)+" is "+FloatToString(Delay));
return Delay; // Delay set on area
}
int CleanCheck(object Trash, object Area=OBJECT_SELF)
{
//SendMessageToPC(GetFirstPC(),"Checking: "+GetName(Trash));
if(GetIsPC(Trash) && !GetIsDM(Trash)){ // Halt if a PC is found
return 3;}
if(GetIsEncounterCreature(Trash)){
return TRUE;}
if(GetObjectType(Trash)==OBJECT_TYPE_ITEM){
// Designed to recycle dropped items & loot if there is a shop assigned
// to the area. A separate script can be used on the loot shop
// to further move the loot to their appropriate treasure pile.
object Loot=GetObjectByTag(GetLocalString(Area,"Loot"));
if(GetIsObjectValid(Loot) && !GetIsPC(Loot) && GetHasInventory(Loot))
{CopyItem(Trash,Loot,TRUE);}
return TRUE;}
if(GetObjectType(Trash)==OBJECT_TYPE_PLACEABLE && GetTag(Trash)=="BodyBag"){
CleanInventory(Trash);
return TRUE;}
return FALSE;
}
void CleanArea(object Area=OBJECT_SELF)
{ // Halts cleanup if a player is present
if(GetLocalInt(Area,"PCCount")>=1){
//SendMessageToPC(GetFirstPC(),"Cleanup Aborted");
return;}
// Begin scanning through the various objects in the area
//SendMessageToPC(GetFirstPC(),"Cleanup Started for area: "+GetTag(Area));
object Trash=GetFirstObjectInArea(Area);
while(GetIsObjectValid(Trash)){
int Verify=CleanCheck(Trash);
if(Verify==3){
return;}
if(Verify==TRUE){
float Delay=GetDelay()-Random(FloatToInt(GetDelay()));
DelayCommand(Delay,DestroyObject(Trash));
//SendMessageToPC(GetFirstPC(),"Will Destroy: "+GetName(Trash));
//SendMessageToPC(GetFirstPC(),"Object Tag: "+GetTag(Trash));
//SendMessageToPC(GetFirstPC(),"Time To Purge: "+FloatToString(Delay));
}
Trash=GetNextObjectInArea(Area);
}
SetLocalInt(Area,"Timer",0);
//SendMessageToPC(GetFirstPC(),
//"Cleanup for "+GetName(Area)+" is complete.");
}
void CleanInventory(object Bag)
{
object Item=GetFirstItemInInventory(Bag);
while(GetIsObjectValid(Item)){
//SendMessageToPC(GetExitingObject(),"Destroying from BodyBag:"+GetName(Item));
DestroyObject(Item);
Item=GetNextItemInInventory(Bag);
}
//SendMessageToPC(GetExitingObject(),GetName(Bag)+" now empty.");
}
void main()
{
if(GetUserDefinedEventNumber()==69){
float Delay=GetDelay()+Random(FloatToInt(GetDelay()));
DelayCommand(Delay,CleanArea());
//SendMessageToPC(GetFirstPC(),"Signal Received");
//SendMessageToPC(GetFirstPC(),"Delay:"+FloatToString(Delay));
}
return;
}

View File

@@ -0,0 +1,6 @@
#include "area_clean_inc"
void main()
{
CheckForPC(GetEnteringObject());
}

View File

@@ -0,0 +1,6 @@
#include "area_clean_inc"
void main()
{
TimerCheck(GetExitingObject());
}

View File

@@ -0,0 +1,26 @@
void main()
{
object oExiting = GetExitingObject();
if (GetIsPC(oExiting))
{
//SendMessageToPC(oExiting, "Area cleanup event fired.");
object oObjectToClean = GetFirstObjectInArea(OBJECT_SELF);
while (GetIsObjectValid(oObjectToClean))
{
if (
!GetIsPC(oObjectToClean) &&
!GetIsDM(oObjectToClean) &&
!GetPlotFlag(oObjectToClean) &&
GetObjectType(oObjectToClean) == OBJECT_TYPE_CREATURE
)
{
//SendMessageToPC(oExiting, "Destroying " + GetName(oObjectToClean));
DestroyObject(oObjectToClean, 0.1);
}
oObjectToClean = GetNextObjectInArea(OBJECT_SELF);
}
}
}

View File

@@ -0,0 +1,9 @@
void main()
{
int nActive = GetLocalInt (GetObjectByTag("CS_ORBSUMMON"),"X2_L_PLC_ACTIVATED_STATE");
if (!nActive)
{
SoundObjectStop(GetObjectByTag("MagicGlowingBall"));
}
}

View File

@@ -0,0 +1,9 @@
void main()
{
object oPC = GetPCSpeaker();
int iToModify;
for (iToModify=2; iToModify <=13; iToModify++)
{
if (iToModify != 6 && iToModify != 8 && iToModify != 9) SetCreatureBodyPart(iToModify, 1, oPC);
}
}

View File

@@ -0,0 +1,25 @@
//::///////////////////////////////////////////////
//:: BODY TAILOR: increase hair, skin, tattoo color
//:: onconv bodytailor
//:: Created By: styzygy
//:: based on the mil tailor by Jake E. Fitch (Milambus Mandragon)
//:://////////////////////////////////////////////
//#include "inc_bodytailor"
void main()
{
object oPC = GetPCSpeaker();
int iColorChannel = GetLocalInt(oPC, "iColorChannel");
int iColor = GetLocalInt(oPC, "iColorBod" + IntToString(iColorChannel));
//SendMessageToPC(oPC, "Channel=" + IntToString(iColorChannel) + ", Color =" + IntToString(iColor));
int iNewColor;
if (iColor < 175)
iNewColor = iColor + 1;
else iNewColor = 0;
SetColor(oPC, iColorChannel, iNewColor);
SetLocalInt(oPC, "iColorBod" + IntToString(iColorChannel), iNewColor);
FloatingTextStringOnCreature("Color " + IntToString(iNewColor), oPC, FALSE);
}

View File

@@ -0,0 +1,25 @@
//::///////////////////////////////////////////////
//:: BODY TAILOR: increase hair, skin, tattoo color
//:: onconv bodytailor
//:: Created By: styzygy
//:: based on the mil tailor by Jake E. Fitch (Milambus Mandragon)
//:://////////////////////////////////////////////
//#include "inc_bodytailor"
void main()
{
object oPC = GetPCSpeaker();
int iColorChannel = GetLocalInt(oPC, "iColorChannel");
int iColor = GetLocalInt(oPC, "iColorBod" + IntToString(iColorChannel));
//SendMessageToPC(oPC, "Channel=" + IntToString(iColorChannel) + ", Color =" + IntToString(iColor));
int iNewColor;
if (iColor > 0)
iNewColor = iColor - 1;
else iNewColor = 175;
SetColor(oPC, iColorChannel, iNewColor);
SetLocalInt(oPC, "iColorBod" + IntToString(iColorChannel), iNewColor);
FloatingTextStringOnCreature("Color " + IntToString(iNewColor), oPC, FALSE);
}

View File

@@ -0,0 +1,210 @@
//::///////////////////////////////////////////////
//:: BODY TAILOR: decrease
//:: onconv bodytailor
//:://////////////////////////////////////////////
/*
this just decrements the piece number and slaps it on.
well, checking for restrictions and looping back to top,
too.
*/
//:://////////////////////////////////////////////
//:: Modified By: styzygy
//:: Created By: bloodsong
//:: based on the mil tailor by Jake E. Fitch (Milambus Mandragon)
//:://////////////////////////////////////////////
#include "inc_bodytailor"
void main()
{
object oPC = GetPCSpeaker();
string sToModify = GetLocalString(oPC, "ToModify");
//-- WINGS, TAIL, HEAD, EYES...
int iToModify = GetLocalInt(oPC, "ToModify");
//-- bodypart #...
string s2DAFile = GetLocalString(oPC, "2DAFile");
//-- "" for items with no 2da file...?
string s2DAend; //-- the endoffile check
int iNewApp;
//--WING SECTION vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
if(sToModify == "WINGS")
{
//-- advance wing type.
iNewApp = GetCreatureWingType(oPC)-1;
if(iNewApp < 0) { GetCachedLimit(s2DAFile); }
//--if it is restricted, skip ahead.
while(WingIsInvalid(iNewApp))
{//-- decrease
iNewApp--;
s2DAend = Get2DACheck(s2DAFile, iNewApp);
//-- check for blank lines
if (s2DAend == "SKIP")
{//-- be careful reading 2da in a fast loop.
iNewApp--;
s2DAend = Get2DACheck(s2DAFile, iNewApp);
}
//-- check we didnt hit the end
if (iNewApp < 0)
{//-- if hit the end, loop back to top
iNewApp = GetCachedLimit(s2DAFile);
}
}
//--do the loop around check
s2DAend = Get2DACheck(s2DAFile, iNewApp);
while (s2DAend == "SKIP" || s2DAend == "FAIL")
{
if (iNewApp < 0)
{
iNewApp = GetCachedLimit(s2DAFile);
} else {
iNewApp--;
}
s2DAend = Get2DACheck(s2DAFile, iNewApp);
} //-- end loop around check
SetCreatureWingType(iNewApp, oPC); //--now slap the new wing on!
}
//--END WINGS ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
//--TAIL SECTION vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
if(sToModify == "TAIL")
{
//-- advance tail type.
iNewApp = GetCreatureTailType(oPC)-1;
if(iNewApp < 0) { GetCachedLimit(s2DAFile); }
//--if it is restricted, skip ahead.
while(TailIsInvalid(iNewApp))
{//-- increase
iNewApp--;
s2DAend = Get2DACheck(s2DAFile, iNewApp);
//-- check for blank lines
if (s2DAend == "SKIP")
{//-- be careful reading 2da in a fast loop.
iNewApp--;
s2DAend = Get2DACheck(s2DAFile, iNewApp);
}
//-- check we didnt hit the end
if (iNewApp < 0)
{//-- if hit the end, loop back to top
iNewApp = GetCachedLimit(s2DAFile);
}
}
//--do the loop around check
s2DAend = Get2DACheck(s2DAFile, iNewApp);
while (s2DAend == "SKIP" || s2DAend == "FAIL")
{
if (iNewApp < 0)
{
iNewApp = GetCachedLimit(s2DAFile);
} else {
iNewApp--;
}
s2DAend = Get2DACheck(s2DAFile, iNewApp);
} //-- end loop around check
SetCreatureTailType(iNewApp, oPC); //--now slap the new tail on!
}
//--END TAIL ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
//--the rest of the parts dont have 2da files to read from.
//-- be sure you set your max numbers in the include file (btlr__inc)
int nGender = GetGender(oPC);
int nRace = GetAppearanceType(oPC);
int nMax = 256;
//--HEAD BITS-------------------------------------------------------
if(sToModify == "HEAD")
{
iNewApp = GetCreatureBodyPart(CREATURE_PART_HEAD, oPC)-1;
//-- check we didnt hit the end(s)
if(nGender==GENDER_FEMALE)
{
switch(nRace)
{
case 0: nMax=DFHEADMAX; break;
case 1: nMax = EFHEADMAX; break;
case 2: nMax = GFHEADMAX; break;
case 4:
case 6: nMax = HFHEADMAX; break;
case 3: nMax = AFHEADMAX; break;
case 5: nMax = OFHEADMAX; break;
}
}
else //--males and everything else
{
switch(nRace)
{
case 0: nMax=DMHEADMAX; break;
case 1: nMax = EMHEADMAX; break;
case 2: nMax = GMHEADMAX; break;
case 4:
case 6: nMax = HMHEADMAX; break;
case 3: nMax = AMHEADMAX; break;
case 5: nMax = OMHEADMAX; break;
}
}
if(iNewApp < 0)
{//-- loop to 0
iNewApp = nMax;
}
SetCreatureBodyPart(CREATURE_PART_HEAD, iNewApp, oPC);
} //-- end HEAD section
//--MISC BITS------------------------------------------------------
if(sToModify == "PARTS")
{
iNewApp = GetCreatureBodyPart(iToModify, oPC) -1;
//--check the ceiling
if(iNewApp <= 255)
{ //-- more than our 3 parts
if(iNewApp < 0)
{ //-- if it is 0, loop to 255
iNewApp = 255;
}
else if(iNewApp < 255 && iNewApp > CUSTOMPARTS)
{ //-- or else jump from 255 to max custom pieces
iNewApp = CUSTOMPARTS;
}
} //-- end loop check
SetCreatureBodyPart(iToModify, iNewApp, oPC);
}
//--PHENO PART------------------------------------------------------
if(sToModify == "PHENO")
{
iNewApp = GetPhenoType(oPC) -1;
//--check the ceiling
if(iNewApp < 0)
{
iNewApp = MAXPHENO;
} //-- end loop check
SetPhenoType(iNewApp, oPC);
}
//--END PHENO PART------------------------------------------------------
//--EVERYBODY/THING SECTION ---------------------------------------------
SendMessageToPC(oPC, "New Appearance: " + IntToString(iNewApp));
}

View File

@@ -0,0 +1,207 @@
//::///////////////////////////////////////////////
//:: BODY TAILOR: increase
//:: onconv bodytailor
//:://////////////////////////////////////////////
/*
this just increments the piece number and slaps it on.
well, checking for restrictions and looping back to 0,
too.
*/
//:://////////////////////////////////////////////
//:: Modified By: styzygy
//:: Created By: bloodsong
//:: based on the mil tailor by Jake E. Fitch (Milambus Mandragon)
//:://////////////////////////////////////////////
#include "inc_bodytailor"
void main()
{
object oPC = GetPCSpeaker();
string sToModify = GetLocalString(oPC, "ToModify");
//-- WINGS, TAIL, HEAD, EYES...
int iToModify = GetLocalInt(oPC, "ToModify");
//-- bodypart #...
string s2DAFile = GetLocalString(oPC, "2DAFile");
//-- "" for items with no 2da file...?
string s2DAend; //-- the endoffile check
int iNewApp;
//--WING SECTION vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
if(sToModify == "WINGS")
{
//-- advance wing type.
iNewApp = GetCreatureWingType(oPC)+1;
//--if it is restricted, skip ahead.
while(WingIsInvalid(iNewApp))
{//-- increase
iNewApp++;
s2DAend = Get2DACheck(s2DAFile, iNewApp);
//-- check for blank lines
if (s2DAend == "SKIP")
{//-- be careful reading 2da in a fast loop.
iNewApp++;
s2DAend = Get2DACheck(s2DAFile, iNewApp);
}
//-- check we didnt hit the end
if (s2DAend == "FAIL" || iNewApp > GetCachedLimit(s2DAFile))
{//-- if hit the end, loop back to 0
iNewApp = 0;
}
}
//--do the loop around check
s2DAend = Get2DACheck(s2DAFile, iNewApp);
while (s2DAend == "SKIP" || s2DAend == "FAIL")
{
if (s2DAend == "FAIL" || iNewApp > GetCachedLimit(s2DAFile))
{
iNewApp = 0;
} else {
iNewApp++;
}
s2DAend = Get2DACheck(s2DAFile, iNewApp);
} //-- end loop around check
SetCreatureWingType(iNewApp, oPC); //--now slap the new wing on!
}
//--END WINGS ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
//--TAIL SECTION vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
if(sToModify == "TAIL")
{
//-- advance tail type.
iNewApp = GetCreatureTailType(oPC)+1;
//--if it is restricted, skip ahead.
while(TailIsInvalid(iNewApp))
{//-- increase
iNewApp++;
s2DAend = Get2DACheck(s2DAFile, iNewApp);
//-- check for blank lines
if (s2DAend == "SKIP")
{//-- be careful reading 2da in a fast loop.
iNewApp++;
s2DAend = Get2DACheck(s2DAFile, iNewApp);
}
//-- check we didnt hit the end
if (s2DAend == "FAIL" || iNewApp > GetCachedLimit(s2DAFile))
{//-- if hit the end, loop back to 0
iNewApp = 0;
}
}
//--do the loop around check
s2DAend = Get2DACheck(s2DAFile, iNewApp);
while (s2DAend == "SKIP" || s2DAend == "FAIL")
{
if (s2DAend == "FAIL" || iNewApp > GetCachedLimit(s2DAFile))
{
iNewApp = 0;
} else {
iNewApp++;
}
s2DAend = Get2DACheck(s2DAFile, iNewApp);
} //-- end loop around check
SetCreatureTailType(iNewApp, oPC); //--now slap the new tail on!
}
//--END TAIL ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
//--the rest of the parts dont have 2da files to read from.
//-- be sure you set your max numbers in the include file (btlr__inc)
int nGender = GetGender(OBJECT_SELF);
int nRace = GetAppearanceType(OBJECT_SELF);
int nMax = 256;
//--HEAD BITS-------------------------------------------------------
if(sToModify == "HEAD")
{
iNewApp = GetCreatureBodyPart(CREATURE_PART_HEAD, oPC)+1;
//-- check we didnt hit the end(s)
if(nGender==GENDER_FEMALE)
{
switch(nRace)
{
case 0: nMax=DFHEADMAX; break;
case 1: nMax = EFHEADMAX; break;
case 2: nMax = GFHEADMAX; break;
case 4:
case 6: nMax = HFHEADMAX; break;
case 3: nMax = AFHEADMAX; break;
case 5: nMax = OFHEADMAX; break;
}
}
else //--males and everything else
{
switch(nRace)
{
case 0: nMax=DMHEADMAX; break;
case 1: nMax = EMHEADMAX; break;
case 2: nMax = GMHEADMAX; break;
case 4:
case 6: nMax = HMHEADMAX; break;
case 3: nMax = AMHEADMAX; break;
case 5: nMax = OMHEADMAX; break;
}
}
if(iNewApp > nMax)
{//-- loop to 0
iNewApp = 0;
}
SetCreatureBodyPart(CREATURE_PART_HEAD, iNewApp, oPC);
} //-- end HEAD section
//--MISC BITS------------------------------------------------------
if(sToModify == "PARTS")
{
iNewApp = GetCreatureBodyPart(iToModify, oPC) +1;
//--check the ceiling
if(iNewApp > CUSTOMPARTS)
{ //-- more than our 3 parts
if(iNewApp >= 255)
{ //-- if it is 256, loop to 0
iNewApp = 0;
}
else
{ //-- or else jump from max custom to 256
iNewApp = 255;
}
} //-- end loop check
SetCreatureBodyPart(iToModify, iNewApp, oPC);
//SendMessageToPC(oPC, "Part=" + IntToString(iToModify) + ", #=" + IntToString(iNewApp));
}
//--PHENO PART------------------------------------------------------
if(sToModify == "PHENO")
{
iNewApp = GetPhenoType(oPC) +1;
//--check the ceiling
if(iNewApp > MAXPHENO)
{ //-- more than our 3 parts
iNewApp = 0;
} //-- end loop check
SetPhenoType(iNewApp, oPC);
}
//--END PHENO PART------------------------------------------------------
//--EVERYBODY/THING SECTION ---------------------------------------------
SendMessageToPC(oPC, "New Appearance: " + IntToString(iNewApp));
}

View File

@@ -0,0 +1,21 @@
// Prepare for body colorization
void main()
{
object oPC = GetPCSpeaker();
// what are PC's initial colors?
SetLocalInt(oPC, "iColorBod" + IntToString(COLOR_CHANNEL_SKIN), GetColor(oPC, COLOR_CHANNEL_SKIN));
SetLocalInt(oPC, "iColorBod" + IntToString(COLOR_CHANNEL_HAIR), GetColor(oPC, COLOR_CHANNEL_HAIR));
SetLocalInt(oPC, "iColorBod" + IntToString(COLOR_CHANNEL_TATTOO_1), GetColor(oPC, COLOR_CHANNEL_TATTOO_1));
SetLocalInt(oPC, "iColorBod" + IntToString(COLOR_CHANNEL_TATTOO_2), GetColor(oPC, COLOR_CHANNEL_TATTOO_2));
//SendMessageToPC(oPC, "iColorBod" + IntToString(COLOR_CHANNEL_SKIN) + "=" + IntToString(GetColor(oPC, COLOR_CHANNEL_SKIN)));
//SendMessageToPC(oPC, "iColorBod" + IntToString(COLOR_CHANNEL_HAIR) + "=" + IntToString(GetColor(oPC, COLOR_CHANNEL_HAIR)));
//SendMessageToPC(oPC, "iColorBod" + IntToString(COLOR_CHANNEL_TATTOO_1) + "=" + IntToString(GetColor(oPC, COLOR_CHANNEL_TATTOO_1)));
//SendMessageToPC(oPC, "iColorBod" + IntToString(COLOR_CHANNEL_TATTOO_2) + "=" + IntToString(GetColor(oPC, COLOR_CHANNEL_TATTOO_2)));
// take off gear so we can see body
AssignCommand(oPC, ActionUnequipItem(GetItemInSlot(INVENTORY_SLOT_HEAD, oPC)));
AssignCommand(oPC, ActionUnequipItem(GetItemInSlot(INVENTORY_SLOT_CHEST, oPC)));
}

View File

@@ -0,0 +1,9 @@
//:: Created By: styzygy
//:: based on the Mil_Tailor by Milambus Mandragon
void main()
{
object oPC = GetPCSpeaker();
SetLocalInt(oPC, "iColorChannel", COLOR_CHANNEL_HAIR);
SetCustomToken(91154, "Hair");
}

View File

@@ -0,0 +1,22 @@
//:://////////////////////////////////////////////
//:: BODY TAILOR: modify ...
//:: onconv bodytailor
//:://////////////////////////////////////////////
/*
sets the system to know what part to change
*/
//:://////////////////////////////////////////////
//:: Modified By: styzygy
//:: Created By: bloodsong
//:: based on the Mil_Tailor by Milambus Mandragon
//:://////////////////////////////////////////////
void main()
{
object oPC = GetPCSpeaker();
SetLocalString(oPC, "ToModify", "HEAD");
SetLocalString(oPC, "2DAFile", "");
SetCustomToken(91154, "Head");
AssignCommand(oPC, ActionUnequipItem(GetItemInSlot(INVENTORY_SLOT_HEAD, oPC)));
}

View File

@@ -0,0 +1,18 @@
//:://////////////////////////////////////////////
//:: BODY TAILOR: modify ...
//:: onconv bodytailor
//:://////////////////////////////////////////////
/*
sets the system to know what part to change
*/
//:://////////////////////////////////////////////
//:: Created By: bloodsong
//:: based on the Mil_Tailor by Milambus Mandragon
//:://////////////////////////////////////////////
void main()
{
object oPC = GetPCSpeaker();
SetLocalInt(oPC, "ToModify", CREATURE_PART_LEFT_BICEP);
}

View File

@@ -0,0 +1,19 @@
//:://////////////////////////////////////////////
//:: BODY TAILOR: modify ...
//:: onconv bodytailor
//:://////////////////////////////////////////////
/*
sets the system to know what part to change
*/
//:://////////////////////////////////////////////
//:: Created By: bloodsong
//:: based on the Mil_Tailor by Milambus Mandragon
//:://////////////////////////////////////////////
void main()
{
object oPC = GetPCSpeaker();
SetLocalInt(oPC, "ToModify", CREATURE_PART_LEFT_FOOT);
}

View File

@@ -0,0 +1,19 @@
//:://////////////////////////////////////////////
//:: BODY TAILOR: modify ...
//:: onconv bodytailor
//:://////////////////////////////////////////////
/*
sets the system to know what part to change
*/
//:://////////////////////////////////////////////
//:: Created By: bloodsong
//:: based on the Mil_Tailor by Milambus Mandragon
//:://////////////////////////////////////////////
void main()
{
object oPC = GetPCSpeaker();
SetLocalInt(oPC, "ToModify", CREATURE_PART_LEFT_FOREARM);
}

View File

@@ -0,0 +1,19 @@
//:://////////////////////////////////////////////
//:: BODY TAILOR: modify ...
//:: onconv bodytailor
//:://////////////////////////////////////////////
/*
sets the system to know what part to change
*/
//:://////////////////////////////////////////////
//:: Created By: bloodsong
//:: based on the Mil_Tailor by Milambus Mandragon
//:://////////////////////////////////////////////
void main()
{
object oPC = GetPCSpeaker();
SetLocalInt(oPC, "ToModify", CREATURE_PART_LEFT_HAND);
}

View File

@@ -0,0 +1,19 @@
//:://////////////////////////////////////////////
//:: BODY TAILOR: modify ...
//:: onconv bodytailor
//:://////////////////////////////////////////////
/*
sets the system to know what part to change
*/
//:://////////////////////////////////////////////
//:: Created By: bloodsong
//:: based on the Mil_Tailor by Milambus Mandragon
//:://////////////////////////////////////////////
void main()
{
object oPC = GetPCSpeaker();
SetLocalInt(oPC, "ToModify", CREATURE_PART_LEFT_SHIN);
}

View File

@@ -0,0 +1,19 @@
//:://////////////////////////////////////////////
//:: BODY TAILOR: modify ...
//:: onconv bodytailor
//:://////////////////////////////////////////////
/*
sets the system to know what part to change
*/
//:://////////////////////////////////////////////
//:: Created By: bloodsong
//:: based on the Mil_Tailor by Milambus Mandragon
//:://////////////////////////////////////////////
void main()
{
object oPC = GetPCSpeaker();
SetLocalInt(oPC, "ToModify", CREATURE_PART_LEFT_THIGH);
}

View File

@@ -0,0 +1,19 @@
//:://////////////////////////////////////////////
//:: BODY TAILOR: modify ...
//:: onconv bodytailor
//:://////////////////////////////////////////////
/*
sets the system to know what part to change
*/
//:://////////////////////////////////////////////
//:: Created By: bloodsong
//:: based on the Mil_Tailor by Milambus Mandragon
//:://////////////////////////////////////////////
void main()
{
object oPC = GetPCSpeaker();
SetLocalInt(oPC, "ToModify", CREATURE_PART_NECK);
}

View File

@@ -0,0 +1,23 @@
//:://////////////////////////////////////////////
//:: BODY TAILOR: modify ...
//:: onconv bodytailor
//:://////////////////////////////////////////////
/*
sets the system to know what part to change
*/
//:://////////////////////////////////////////////
//:: Created By: bloodsong
//:: based on the Mil_Tailor by Milambus Mandragon
//:://////////////////////////////////////////////
void main()
{
object oPC = GetPCSpeaker();
SetLocalString(oPC, "ToModify", "PARTS");
SetLocalString(oPC, "2DAFile", "");
SetCustomToken(91154, "Body Parts");
AssignCommand(oPC, ActionUnequipItem(GetItemInSlot(INVENTORY_SLOT_CHEST, oPC)));
}

View File

@@ -0,0 +1,19 @@
//:://////////////////////////////////////////////
//:: BODY TAILOR: modify ...
//:: onconv bodytailor
//:://////////////////////////////////////////////
/*
sets the system to know what part to change
*/
//:://////////////////////////////////////////////
//:: Created By: bloodsong
//:: based on the Mil_Tailor by Milambus Mandragon
//:://////////////////////////////////////////////
void main()
{
object oPC = GetPCSpeaker();
SetLocalInt(oPC, "ToModify", CREATURE_PART_PELVIS);
}

View File

@@ -0,0 +1,19 @@
//:://////////////////////////////////////////////
//:: BODY TAILOR: modify ...
//:: onconv bodytailor
//:://////////////////////////////////////////////
/*
sets the system to know what part to change
*/
//:://////////////////////////////////////////////
//:: Created By: bloodsong
//:: based on the Mil_Tailor by Milambus Mandragon
//:://////////////////////////////////////////////
void main()
{
object oPC = GetPCSpeaker();
SetLocalInt(oPC, "ToModify", CREATURE_PART_RIGHT_BICEP);
}

View File

@@ -0,0 +1,19 @@
//:://////////////////////////////////////////////
//:: BODY TAILOR: modify ...
//:: onconv bodytailor
//:://////////////////////////////////////////////
/*
sets the system to know what part to change
*/
//:://////////////////////////////////////////////
//:: Created By: bloodsong
//:: based on the Mil_Tailor by Milambus Mandragon
//:://////////////////////////////////////////////
void main()
{
object oPC = GetPCSpeaker();
SetLocalInt(oPC, "ToModify", CREATURE_PART_RIGHT_FOOT);
}

View File

@@ -0,0 +1,19 @@
//:://////////////////////////////////////////////
//:: BODY TAILOR: modify ...
//:: onconv bodytailor
//:://////////////////////////////////////////////
/*
sets the system to know what part to change
*/
//:://////////////////////////////////////////////
//:: Created By: bloodsong
//:: based on the Mil_Tailor by Milambus Mandragon
//:://////////////////////////////////////////////
void main()
{
object oPC = GetPCSpeaker();
SetLocalInt(oPC, "ToModify", CREATURE_PART_RIGHT_FOREARM);
}

View File

@@ -0,0 +1,19 @@
//:://////////////////////////////////////////////
//:: BODY TAILOR: modify ...
//:: onconv bodytailor
//:://////////////////////////////////////////////
/*
sets the system to know what part to change
*/
//:://////////////////////////////////////////////
//:: Created By: bloodsong
//:: based on the Mil_Tailor by Milambus Mandragon
//:://////////////////////////////////////////////
void main()
{
object oPC = GetPCSpeaker();
SetLocalInt(oPC, "ToModify", CREATURE_PART_RIGHT_HAND);
}

View File

@@ -0,0 +1,19 @@
//:://////////////////////////////////////////////
//:: BODY TAILOR: modify ...
//:: onconv bodytailor
//:://////////////////////////////////////////////
/*
sets the system to know what part to change
*/
//:://////////////////////////////////////////////
//:: Created By: bloodsong
//:: based on the Mil_Tailor by Milambus Mandragon
//:://////////////////////////////////////////////
void main()
{
object oPC = GetPCSpeaker();
SetLocalInt(oPC, "ToModify", CREATURE_PART_RIGHT_SHIN);
}

View File

@@ -0,0 +1,19 @@
//:://////////////////////////////////////////////
//:: BODY TAILOR: modify ...
//:: onconv bodytailor
//:://////////////////////////////////////////////
/*
sets the system to know what part to change
*/
//:://////////////////////////////////////////////
//:: Created By: bloodsong
//:: based on the Mil_Tailor by Milambus Mandragon
//:://////////////////////////////////////////////
void main()
{
object oPC = GetPCSpeaker();
SetLocalInt(oPC, "ToModify", CREATURE_PART_RIGHT_THIGH);
}

View File

@@ -0,0 +1,9 @@
//:: Created By: styzygy
//:: based on the Mil_Tailor by Milambus Mandragon
void main()
{
object oPC = GetPCSpeaker();
SetLocalInt(oPC, "iColorChannel", COLOR_CHANNEL_SKIN);
SetCustomToken(91154, "Skin");
}

View File

@@ -0,0 +1,24 @@
//:://////////////////////////////////////////////
//:: BODY TAILOR: modify ...
//:: onconv bodytailor
//:://////////////////////////////////////////////
/*
sets the system to know what part to change
*/
//:://////////////////////////////////////////////
//:: Modified By: styzygy
//:: Created By: bloodsong
//:: based on the Mil_Tailor by Milambus Mandragon
//:://////////////////////////////////////////////
void main()
{
object oPC = GetPCSpeaker();
SetLocalString(oPC, "ToModify", "TAIL");
SetLocalString(oPC, "2DAFile", "tailmodel");
SetCustomToken(91154, "Tail");
AssignCommand(oPC, ActionUnequipItem(GetItemInSlot(INVENTORY_SLOT_CHEST, oPC)));
AssignCommand(oPC, ActionUnequipItem(GetItemInSlot(INVENTORY_SLOT_CLOAK, oPC)));
}

View File

@@ -0,0 +1,9 @@
//:: Created By: styzygy
//:: based on the Mil_Tailor by Milambus Mandragon
void main()
{
object oPC = GetPCSpeaker();
SetLocalInt(oPC, "iColorChannel", COLOR_CHANNEL_TATTOO_1);
SetCustomToken(91154, "Tattoo 1");
}

View File

@@ -0,0 +1,9 @@
//:: Created By: styzygy
//:: based on the Mil_Tailor by Milambus Mandragon
void main()
{
object oPC = GetPCSpeaker();
SetLocalInt(oPC, "iColorChannel", COLOR_CHANNEL_TATTOO_2);
SetCustomToken(91154, "Tattoo 2");
}

View File

@@ -0,0 +1,19 @@
//:://////////////////////////////////////////////
//:: BODY TAILOR: modify ...
//:: onconv bodytailor
//:://////////////////////////////////////////////
/*
sets the system to know what part to change
*/
//:://////////////////////////////////////////////
//:: Created By: bloodsong
//:: based on the Mil_Tailor by Milambus Mandragon
//:://////////////////////////////////////////////
void main()
{
object oPC = GetPCSpeaker();
SetLocalInt(oPC, "ToModify", CREATURE_PART_TORSO);
}

View File

@@ -0,0 +1,24 @@
//:://////////////////////////////////////////////
//:: BODY TAILOR: modify ...
//:: onconv bodytailor
//:://////////////////////////////////////////////
/*
sets the system to know what part to change
*/
//:://////////////////////////////////////////////
//:: Modified By: styzygy
//:: Created By: bloodsong
//:: based on the Mil_Tailor by Milambus Mandragon
//:://////////////////////////////////////////////
void main()
{
object oPC = GetPCSpeaker();
SetLocalString(oPC, "ToModify", "WINGS");
SetLocalString(oPC, "2DAFile", "wingmodel");
SetCustomToken(91154, "Wing");
AssignCommand(oPC, ActionUnequipItem(GetItemInSlot(INVENTORY_SLOT_CHEST, oPC)));
AssignCommand(oPC, ActionUnequipItem(GetItemInSlot(INVENTORY_SLOT_CLOAK, oPC)));
}

View File

@@ -0,0 +1,9 @@
void main()
{
object oPC = GetPCSpeaker();
int iToModify;
for (iToModify=2; iToModify <=13; iToModify++)
{
if (iToModify != 6 && iToModify != 8 && iToModify != 9) SetCreatureBodyPart(iToModify, 2, oPC);
}
}

View File

@@ -0,0 +1,24 @@
#include "inc_itemprop002"
void main()
{
object oPC = GetPCSpeaker();
object oItem = GetLocalObject(oPC, "MODIFY_ITEM");
itemproperty ip = GetNewProperty(oItem);
//Copy item and modify to get new value
if ( GetIsItemPropertyValid(ip))
{
object oCopy = CopyItem(oItem, OBJECT_SELF);
CustomAddProperty(oCopy, ip);
SetLocalObject(oPC, "MODIFY_COPY", oCopy);
int iItemLevel = GetItemLevel(oCopy);
SetLocalInt(oPC, "iItemLevel", iItemLevel);
SetCustomToken(103, IntToString(iItemLevel));
}
else
SendMessageToPC(oPC, "ERROR: Invalid Property");
}

View File

@@ -0,0 +1,29 @@
void main()
{
object oPC = GetPCSpeaker();
object oItem = GetLocalObject(oPC, "MODIFY_ITEM");
object oCopy = GetLocalObject(oPC, "MODIFY_COPY");
SetCustomToken(102, IntToString(GetGold(oPC)));
//Get values of original item and modified copy, then destroy copy
int iCurrentValue = GetGoldPieceValue(oItem);
int iNewValue = GetGoldPieceValue(oCopy);
DestroyObject(oCopy);
//Either amount to pay, refund or no change
int iValue = 0;
int iDiff = 0;
if (iNewValue > iCurrentValue)
{
iValue = iNewValue - iCurrentValue;
iDiff = 1; //iValue is amount to pay
}
else if (iNewValue < iCurrentValue)
{
iValue = iCurrentValue - iNewValue;
iDiff = -1; //iValue is refund
};
SetLocalInt(oPC, "MODIFY_VALUE", iValue);
SetLocalInt(oPC, "MODIFY_DIFF", iDiff);
SetCustomToken(101, IntToString(iValue));
}

View File

@@ -0,0 +1,13 @@
int StartingConditional()
{
object oPC = GetPCSpeaker();
int iDiff = GetLocalInt(oPC, "MODIFY_DIFF");
if (iDiff = 1)
{
int iValue = GetLocalInt(oPC, "MODIFY_VALUE");
int iGold = GetGold(oPC);
return( iGold < iValue);
}
else
return FALSE;
}

28
_module/nss/cc_listen.nss Normal file
View File

@@ -0,0 +1,28 @@
/*
Thanks for help from PASSWORD PROTECTED DOOR by mod_urn@yahoo.com
*/
#include "nw_i0_generic"
void main()
{
int iListen = GetListenPatternNumber();
string sHeard;
if(iListen == 777) // listen pattern set in s_listener
{
sHeard = GetMatchedSubstring(0);
SpeakString("Echo = " + sHeard);
}
else if (iListen == -1)
{
// Not a match -- start an ordinary conversation
if (GetCommandable(OBJECT_SELF))
{
ClearActions(CLEAR_NW_C2_DEFAULT4_29);
BeginConversation();
}
}
}

View File

@@ -0,0 +1,38 @@
/*
Thanks for help from PASSWORD PROTECTED DOOR by mod_urn@yahoo.com
*/
#include "nw_i0_generic"
void main()
{
int iListen = GetListenPatternNumber();
string sNewName;
if(iListen == 777) // listen pattern set in s_listener
{
sNewName = GetMatchedSubstring(0);
if (GetLocalInt(OBJECT_SELF, "iListenFlag") == TRUE)
{
//SpeakString("Echo = " + sNewName);
object oAnvil = GetNearestObjectByTag("pAnvilOfWonder");
object oItem = GetFirstItemInInventory(oAnvil);
string sOldName = GetName(oItem);
SetName(oItem, sNewName);
SpeakString(sOldName + " is renamed to " + sNewName);
}
}
else if (iListen == -1)
{
// Not a match -- start an ordinary conversation
if (GetCommandable(OBJECT_SELF))
{
ClearActions(CLEAR_NW_C2_DEFAULT4_29);
BeginConversation();
}
}
}

View File

@@ -0,0 +1,37 @@
/*
Thanks for help from PASSWORD PROTECTED DOOR by mod_urn@yahoo.com
*/
#include "nw_i0_generic"
void main()
{
int iListen = GetListenPatternNumber();
string sNewName;
if(iListen == 777) // listen pattern set in s_listener
{
sNewName = GetMatchedSubstring(0);
if (GetLocalInt(OBJECT_SELF, "iListenFlag") == TRUE)
{
//SpeakString("Echo = " + sNewName);
object oPortal = GetNearestObjectByTag("PV_EXITPORTAL");
//SetLocalString(oPortal, "sSelectablePortalLink", sNewName);
SetCampaignString("PGC3_DATA", "sSelectablePortalLink", sNewName);
SpeakString("The Selectable Portal Link is " + sNewName + ".");
}
}
else if (iListen == -1)
{
// Not a match -- start an ordinary conversation
if (GetCommandable(OBJECT_SELF))
{
ClearActions(CLEAR_NW_C2_DEFAULT4_29);
BeginConversation();
}
}
}

View File

@@ -0,0 +1,29 @@
//::///////////////////////////////////////////////
//:: Default: End of Combat Round
//:: NW_C2_DEFAULT3
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
Calls the end of combat script every round
*/
//:://////////////////////////////////////////////
//:: Created By: Preston Watamaniuk
//:: Created On: Oct 16, 2001
//:://////////////////////////////////////////////
#include "INC_I0_GENERIC"
void main()
{
if(GetBehaviorState(NW_FLAG_BEHAVIOR_SPECIAL))
{
DetermineSpecialBehavior();
}
else if(!GetSpawnInCondition(NW_FLAG_SET_WARNINGS))
{
DetermineCombatRound();
}
if(GetSpawnInCondition(NW_FLAG_END_COMBAT_ROUND_EVENT))
{
SignalEvent(OBJECT_SELF, EventUserDefined(1003));
}
}

316
_module/nss/cs_archer.nss Normal file
View File

@@ -0,0 +1,316 @@
// On spawn for Arcane Archer
#include "x0_i0_anims"
// #include "x0_i0_walkway" - in x0_i0_anims
#include "x0_i0_treasure"
#include "x2_inc_switches"
//DMFI CODE ADDITIONS BEGIN HERE
#include "dmfi_dmw_inc"
//DMFI CODE ADDITIONS END HERE
const int EVENT_USER_DEFINED_PRESPAWN = 1510;
const int EVENT_USER_DEFINED_POSTSPAWN = 1511;
void main()
{
// User defined OnSpawn event requested?
int nSpecEvent = GetLocalInt(OBJECT_SELF,"X2_USERDEFINED_ONSPAWN_EVENTS");
// Pre Spawn Event requested
if (nSpecEvent == 1 || nSpecEvent == 3 )
{
SignalEvent(OBJECT_SELF,EventUserDefined(EVENT_USER_DEFINED_PRESPAWN ));
}
// ***** Spawn-In Conditions ***** //
// * REMOVE COMMENTS (// ) before the "Set..." functions to activate
// * them. Do NOT touch lines commented out with // *, those are
// * real comments for information.
// * This causes the creature to say a one-line greeting in their
// * conversation file upon perceiving the player. Put [NW_D2_GenCheck]
// * in the "Text Seen When" field of the greeting in the conversation
// * file. Don't attach any player responses.
// *
// SetSpawnInCondition(NW_FLAG_SPECIAL_CONVERSATION);
// * Same as above, but for hostile creatures to make them say
// * a line before attacking.
// *
// SetSpawnInCondition(NW_FLAG_SPECIAL_COMBAT_CONVERSATION);
// * This NPC will attack when its allies call for help
// *
// SetSpawnInCondition(NW_FLAG_SHOUT_ATTACK_MY_TARGET);
// * If the NPC has the Hide skill they will go into stealth mode
// * while doing WalkWayPoints().
// *
// SetSpawnInCondition(NW_FLAG_STEALTH);
//--------------------------------------------------------------------------
// Enable stealth mode by setting a variable on the creature
// Great for ambushes
// See x2_inc_switches for more information about this
//--------------------------------------------------------------------------
if (GetCreatureFlag(OBJECT_SELF, CREATURE_VAR_USE_SPAWN_STEALTH) == TRUE)
{
SetSpawnInCondition(NW_FLAG_STEALTH);
}
// * Same, but for Search mode
// *
// SetSpawnInCondition(NW_FLAG_SEARCH);
//--------------------------------------------------------------------------
// Make creature enter search mode after spawning by setting a variable
// Great for guards, etc
// See x2_inc_switches for more information about this
//--------------------------------------------------------------------------
if (GetCreatureFlag(OBJECT_SELF, CREATURE_VAR_USE_SPAWN_SEARCH) == TRUE)
{
SetSpawnInCondition(NW_FLAG_SEARCH);
}
// * This will set the NPC to give a warning to non-enemies
// * before attacking.
// * NN -- no clue what this really does yet
// *
// SetSpawnInCondition(NW_FLAG_SET_WARNINGS);
// * Separate the NPC's waypoints into day & night.
// * See comment on WalkWayPoints() for use.
// *
// SetSpawnInCondition(NW_FLAG_DAY_NIGHT_POSTING);
// * If this is set, the NPC will appear using the "EffectAppear"
// * animation instead of fading in, *IF* SetListeningPatterns()
// * is called below.
// *
//SetSpawnInCondition(NW_FLAG_APPEAR_SPAWN_IN_ANIMATION);
// * This will cause an NPC to use common animations it possesses,
// * and use social ones to any other nearby friendly NPCs.
// *
// SetSpawnInCondition(NW_FLAG_IMMOBILE_AMBIENT_ANIMATIONS);
//--------------------------------------------------------------------------
// Enable immobile ambient animations by setting a variable
// See x2_inc_switches for more information about this
//--------------------------------------------------------------------------
if (GetCreatureFlag(OBJECT_SELF, CREATURE_VAR_USE_SPAWN_AMBIENT_IMMOBILE) == TRUE)
{
SetSpawnInCondition(NW_FLAG_IMMOBILE_AMBIENT_ANIMATIONS);
}
// * Same as above, except NPC will wander randomly around the
// * area.
// *
// SetSpawnInCondition(NW_FLAG_AMBIENT_ANIMATIONS);
//--------------------------------------------------------------------------
// Enable mobile ambient animations by setting a variable
// See x2_inc_switches for more information about this
//--------------------------------------------------------------------------
if (GetCreatureFlag(OBJECT_SELF, CREATURE_VAR_USE_SPAWN_AMBIENT) == TRUE)
{
SetSpawnInCondition(NW_FLAG_AMBIENT_ANIMATIONS);
}
// **** Animation Conditions **** //
// * These are extra conditions you can put on creatures with ambient
// * animations.
// * Civilized creatures interact with placeables in
// * their area that have the tag "NW_INTERACTIVE"
// * and "talk" to each other.
// *
// * Humanoid races are civilized by default, so only
// * set this flag for monster races that you want to
// * behave the same way.
// SetAnimationCondition(NW_ANIM_FLAG_IS_CIVILIZED);
// * If this flag is set, this creature will constantly
// * be acting. Otherwise, creatures will only start
// * performing their ambient animations when they
// * first perceive a player, and they will stop when
// * the player moves away.
// SetAnimationCondition(NW_ANIM_FLAG_CONSTANT);
// * Civilized creatures with this flag set will
// * randomly use a few voicechats. It's a good
// * idea to avoid putting this on multiple
// * creatures using the same voiceset.
// SetAnimationCondition(NW_ANIM_FLAG_CHATTER);
// * Creatures with _immobile_ ambient animations
// * can have this flag set to make them mobile in a
// * close range. They will never leave their immediate
// * area, but will move around in it, frequently
// * returning to their starting point.
// *
// * Note that creatures spawned inside interior areas
// * that contain a waypoint with one of the tags
// * "NW_HOME", "NW_TAVERN", "NW_SHOP" will automatically
// * have this condition set.
// SetAnimationCondition(NW_ANIM_FLAG_IS_MOBILE_CLOSE_RANGE);
// **** Special Combat Tactics *****//
// * These are special flags that can be set on creatures to
// * make them follow certain specialized combat tactics.
// * NOTE: ONLY ONE OF THESE SHOULD BE SET ON A SINGLE CREATURE.
// * Ranged attacker
// * Will attempt to stay at ranged distance from their
// * target.
SetCombatCondition(X0_COMBAT_FLAG_RANGED);
// * Defensive attacker
// * Will use defensive combat feats and parry
// SetCombatCondition(X0_COMBAT_FLAG_DEFENSIVE);
// * Ambusher
// * Will go stealthy/invisible and attack, then
// * run away and try to go stealthy again before
// * attacking anew.
// SetCombatCondition(X0_COMBAT_FLAG_AMBUSHER);
// * Cowardly
// * Cowardly creatures will attempt to flee
// * attackers.
// SetCombatCondition(X0_COMBAT_FLAG_COWARDLY);
// **** Escape Commands ***** //
// * NOTE: ONLY ONE OF THE FOLLOWING SHOULD EVER BE SET AT ONE TIME.
// * NOTE2: Not clear that these actually work. -- NN
// * Flee to a way point and return a short time later.
// *
// SetSpawnInCondition(NW_FLAG_ESCAPE_RETURN);
// * Flee to a way point and do not return.
// *
// SetSpawnInCondition(NW_FLAG_ESCAPE_LEAVE);
// * Teleport to safety and do not return.
// *
// SetSpawnInCondition(NW_FLAG_TELEPORT_LEAVE);
// * Teleport to safety and return a short time later.
// *
// SetSpawnInCondition(NW_FLAG_TELEPORT_RETURN);
// ***** CUSTOM USER DEFINED EVENTS ***** /
/*
If you uncomment any of these conditions, the creature will fire
a specific user-defined event number on each event. That will then
allow you to write custom code in the "OnUserDefinedEvent" handler
script to go on top of the default NPC behaviors for that event.
Example: I want to add some custom behavior to my NPC when they
are damaged. I uncomment the "NW_FLAG_DAMAGED_EVENT", then create
a new user-defined script that has something like this in it:
if (GetUserDefinedEventNumber() == 1006) {
// Custom code for my NPC to execute when it's damaged
}
These user-defined events are in the range 1001-1007.
*/
// * Fire User Defined Event 1001 in the OnHeartbeat
// *
// SetSpawnInCondition(NW_FLAG_HEARTBEAT_EVENT);
// * Fire User Defined Event 1002
// *
// SetSpawnInCondition(NW_FLAG_PERCIEVE_EVENT);
// * Fire User Defined Event 1005
// *
// SetSpawnInCondition(NW_FLAG_ATTACK_EVENT);
// * Fire User Defined Event 1006
// *
// SetSpawnInCondition(NW_FLAG_DAMAGED_EVENT);
// * Fire User Defined Event 1008
// *
// SetSpawnInCondition(NW_FLAG_DISTURBED_EVENT);
// * Fire User Defined Event 1003
// *
// SetSpawnInCondition(NW_FLAG_END_COMBAT_ROUND_EVENT);
// * Fire User Defined Event 1004
// *
// SetSpawnInCondition(NW_FLAG_ON_DIALOGUE_EVENT);
// ***** DEFAULT GENERIC BEHAVIOR (DO NOT TOUCH) ***** //
// * Goes through and sets up which shouts the NPC will listen to.
// *
SetListeningPatterns();
// * Walk among a set of waypoints.
// * 1. Find waypoints with the tag "WP_" + NPC TAG + "_##" and walk
// * among them in order.
// * 2. If the tag of the Way Point is "POST_" + NPC TAG, stay there
// * and return to it after combat.
//
// * Optional Parameters:
// * void WalkWayPoints(int nRun = FALSE, float fPause = 1.0)
//
// * If "NW_FLAG_DAY_NIGHT_POSTING" is set above, you can also
// * create waypoints with the tags "WN_" + NPC Tag + "_##"
// * and those will be walked at night. (The standard waypoints
// * will be walked during the day.)
// * The night "posting" waypoint tag is simply "NIGHT_" + NPC tag.
WalkWayPoints();
//* Create a small amount of treasure on the creature
if ((GetLocalInt(GetModule(), "X2_L_NOTREASURE") == FALSE) &&
(GetLocalInt(OBJECT_SELF, "X2_L_NOTREASURE") == FALSE) )
{
CTG_GenerateNPCTreasure(TREASURE_TYPE_MONSTER, OBJECT_SELF);
}
// ***** ADD ANY SPECIAL ON-SPAWN CODE HERE ***** //
// * If Incorporeal, apply changes
if (GetCreatureFlag(OBJECT_SELF, CREATURE_VAR_IS_INCORPOREAL) == TRUE)
{
effect eConceal = EffectConcealment(50, MISS_CHANCE_TYPE_NORMAL);
eConceal = ExtraordinaryEffect(eConceal);
effect eGhost = EffectCutsceneGhost();
eGhost = ExtraordinaryEffect(eGhost);
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eConceal, OBJECT_SELF);
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eGhost, OBJECT_SELF);
}
//DMFI CODE ADDITIONS BEGIN HERE
if ((DMFI_LISTENING_GLOBAL) || (GetLocalInt(OBJECT_SELF, "DMFI_LISTEN")==1))
{
SetListening(OBJECT_SELF, TRUE);
SetListenPattern(OBJECT_SELF, "**", 20600);
SetLocalInt(OBJECT_SELF, "hls_Listening", 1); //listen to all text
}
//DMFI CODE ADDITIONS END HERE
//Post Spawn event request
if (nSpecEvent == 2 || nSpecEvent == 3)
{
SignalEvent(OBJECT_SELF,EventUserDefined(EVENT_USER_DEFINED_POSTSPAWN));
}
}

View File

@@ -0,0 +1,60 @@
//::///////////////////////////////////////////////
//:: Name x2_def_spawn
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
Default On Spawn script
2003-07-28: Georg Zoeller:
If you set a ninteger on the creature named
"X2_USERDEFINED_ONSPAWN_EVENTS"
The creature will fire a pre and a post-spawn
event on itself, depending on the value of that
variable
1 - Fire Userdefined Event 1510 (pre spawn)
2 - Fire Userdefined Event 1511 (post spawn)
3 - Fire both events
*/
//:://////////////////////////////////////////////
//:: Created By: Keith Warner, Georg Zoeller
//:: Created On: June 11/03
//:://////////////////////////////////////////////
const int EVENT_USER_DEFINED_PRESPAWN = 1510;
const int EVENT_USER_DEFINED_POSTSPAWN = 1511;
#include "x2_inc_switches"
void main()
{
// User defined OnSpawn event requested?
int nSpecEvent = GetLocalInt(OBJECT_SELF,"X2_USERDEFINED_ONSPAWN_EVENTS");
// Pre Spawn Event requested
if (nSpecEvent == 1 || nSpecEvent == 3 )
{
SignalEvent(OBJECT_SELF,EventUserDefined(EVENT_USER_DEFINED_PRESPAWN ));
}
/* Fix for the new golems to reduce their number of attacks */
int nNumber = GetLocalInt(OBJECT_SELF,CREATURE_VAR_NUMBER_OF_ATTACKS);
if (nNumber >0 )
{
SetBaseAttackBonus(nNumber);
}
// Execute default OnSpawn script.
ExecuteScript("inc_c2_default9", OBJECT_SELF);
//Post Spawn event requeste
if (nSpecEvent == 2 || nSpecEvent == 3)
{
SignalEvent(OBJECT_SELF,EventUserDefined(EVENT_USER_DEFINED_POSTSPAWN));
}
}

12
_module/nss/cs_echo.nss Normal file
View File

@@ -0,0 +1,12 @@
/*
Thanks for help from PASSWORD PROTECTED DOOR by mod_urn@yahoo.com
*/
void main()
{
//using "**" listens to all text
//the 777 is arbitrary and can be any number you like
SetListenPattern(OBJECT_SELF, "**", 777);
SetListening(OBJECT_SELF, TRUE); //be sure NPC is listening
}

View File

@@ -0,0 +1,20 @@
// onSpawn for Item Property Helper to enable listening for new item name
#include "x0_i0_anims"
// #include "x0_i0_walkway" - in x0_i0_anims
//#include "x0_i0_treasure"
//#include "x2_inc_switches"
void main()
{
//using "**" listens to all text
//the 777 is arbitrary and can be any number you like
SetListenPattern(OBJECT_SELF, "**", 777);
SetListening(OBJECT_SELF, TRUE); //be sure NPC is listening
SetLocalInt(OBJECT_SELF, "iListenFlag", FALSE);
// SetListeningPatterns();
WalkWayPoints();
}

View File

@@ -0,0 +1,97 @@
//::///////////////////////////////////////////////
//:: Name x2_def_userdef
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
Default On User Defined Event script
*/
//:://////////////////////////////////////////////
//:: Created By: Keith Warner
//:: Created On: June 11/03
//:://////////////////////////////////////////////
#include "nw_i0_generic"
const int EVENT_USER_DEFINED_PRESPAWN = 1510;
const int EVENT_USER_DEFINED_POSTSPAWN = 1511;
void main()
{
int nUser = GetUserDefinedEventNumber();
if(nUser == EVENT_HEARTBEAT ) //HEARTBEAT
{
}
else if(nUser == EVENT_PERCEIVE) // PERCEIVE
{
}
else if(nUser == EVENT_END_COMBAT_ROUND) // END OF COMBAT
{
}
else if(nUser == EVENT_DIALOGUE) // ON DIALOGUE
{
}
else if(nUser == EVENT_ATTACKED) // ATTACKED
{
object oPC = GetLastAttacker(OBJECT_SELF);
int nCRMax = GetHitDice(oPC);
//ActionUseTalentOnObject(GetCreatureTalentBest(TALENT_CATEGORY_BENEFICIAL_OBTAIN_ALLIES, nCRMax), OBJECT_SELF);
}
else if(nUser == EVENT_DAMAGED) // DAMAGED
{
int iFeatCheck = GetLocalInt(OBJECT_SELF, "iFeatCheck");
int iHalfHP;
if (GetCurrentHitPoints() < (GetMaxHitPoints()/2)) iHalfHP = 1;
if (iFeatCheck != 1 && iHalfHP == 1)
{
int iFeat;
//Shifter
if (GetLevelByClass(CLASS_TYPE_SHIFTER) > 0)
{
if (GetHasFeat(FEAT_EPIC_WILD_SHAPE_DRAGON)) iFeat = FEAT_EPIC_WILD_SHAPE_DRAGON;
else if (GetHasFeat(FEAT_EPIC_OUTSIDER_SHAPE)) iFeat = FEAT_EPIC_OUTSIDER_SHAPE;
else if (GetHasFeat(FEAT_EPIC_CONSTRUCT_SHAPE)) iFeat = FEAT_EPIC_CONSTRUCT_SHAPE;
else if (GetHasFeat(FEAT_EPIC_WILD_SHAPE_UNDEAD)) iFeat = FEAT_EPIC_WILD_SHAPE_UNDEAD;
else if (GetHasFeat(FEAT_GREATER_WILDSHAPE_4)) iFeat = FEAT_GREATER_WILDSHAPE_4;
else if (GetHasFeat(FEAT_GREATER_WILDSHAPE_3)) iFeat = FEAT_GREATER_WILDSHAPE_3;
else if (GetHasFeat(FEAT_HUMANOID_SHAPE)) iFeat = FEAT_HUMANOID_SHAPE;
else if (GetHasFeat(FEAT_GREATER_WILDSHAPE_2)) iFeat = FEAT_GREATER_WILDSHAPE_2;
else if (GetHasFeat(FEAT_GREATER_WILDSHAPE_1)) iFeat = FEAT_GREATER_WILDSHAPE_1;
ActionUseFeat(iFeat, OBJECT_SELF);
}
SetLocalInt(OBJECT_SELF, "iFeatCheck", 1);
}
}
else if(nUser == 1007) // DEATH - do not use for critical code, does not fire reliably all the time
{
}
else if(nUser == EVENT_DISTURBED) // DISTURBED
{
}
else if (nUser == EVENT_USER_DEFINED_PRESPAWN)
{
}
else if (nUser == EVENT_USER_DEFINED_POSTSPAWN)
{
}
}

View File

@@ -0,0 +1,527 @@
void dmw_CleanUp(object oMySpeaker)
{
int nCount;
int nCache;
DeleteLocalObject(oMySpeaker, "dmfi_univ_target");
DeleteLocalLocation(oMySpeaker, "dmfi_univ_location");
DeleteLocalObject(oMySpeaker, "dmw_item");
DeleteLocalString(oMySpeaker, "dmw_repamt");
DeleteLocalString(oMySpeaker, "dmw_repargs");
nCache = GetLocalInt(oMySpeaker, "dmw_playercache");
for(nCount = 1; nCount <= nCache; nCount++)
{
DeleteLocalObject(oMySpeaker, "dmw_playercache" + IntToString(nCount));
}
DeleteLocalInt(oMySpeaker, "dmw_playercache");
nCache = GetLocalInt(oMySpeaker, "dmw_itemcache");
for(nCount = 1; nCount <= nCache; nCount++)
{
DeleteLocalObject(oMySpeaker, "dmw_itemcache" + IntToString(nCount));
}
DeleteLocalInt(oMySpeaker, "dmw_itemcache");
for(nCount = 1; nCount <= 10; nCount++)
{
DeleteLocalString(oMySpeaker, "dmw_dialog" + IntToString(nCount));
DeleteLocalString(oMySpeaker, "dmw_function" + IntToString(nCount));
DeleteLocalString(oMySpeaker, "dmw_params" + IntToString(nCount));
}
DeleteLocalString(oMySpeaker, "dmw_playerfunc");
DeleteLocalInt(oMySpeaker, "dmw_started");
}
void main()
{
object oUser=OBJECT_SELF;
if (!GetIsObjectValid(oUser)) oUser = GetItemActivator();
object oItem = GetLocalObject(oUser, "dmfi_item");
if (!GetIsObjectValid(oItem)) oItem=GetItemActivated();
object oOther = GetLocalObject(oUser, "dmfi_target");
if (!GetIsObjectValid(oOther)) oOther=GetItemActivatedTarget();
location lLocation=GetLocalLocation(oUser, "dmfi_location");
if (!GetIsObjectValid(GetAreaFromLocation(lLocation))) lLocation = GetItemActivatedTargetLocation();
string sItemTag=GetTag(oItem);
//initialize the listening commands reminder
if (GetLocalInt(GetModule(), "dmfi_voice_initial")!=1 && (GetLocalInt(oUser, "dmfi_reminded")!=1)
&&(GetIsDM(oUser)))
{
SetLocalInt(oUser, "dmfi_reminded", 1);
SendMessageToAllDMs("Target a creature with Voice Widget to initialize system.");
FloatingTextStringOnCreature("Target a creature with Voice Widget to initialize system", oUser);
}
//*************************************INITIALIZATION CODE***************************************
//***************************************RUNS ONE TIME ***************************************
//voice stuff is module wide
if (GetLocalInt(GetModule(), "dmfi_initialized")!=1)
{
SetLocalInt(GetModule(), "dmfi_initialized", 1);
int iLoop = 20610;
string sText;
while (iLoop<20680)
{
sText = GetCampaignString("dmfi", "hls" + IntToString(iLoop));
SetCustomToken(iLoop, sText);
iLoop++;
}
SendMessageToAllDMs("Voice custom tokens initialized.");
}
//remainder of settings are user based
if ((GetLocalInt(oUser, "dmfi_initialized")!=1) && GetIsDM(oUser))
{
//if you have campaign variables set - use those settings
if (GetCampaignInt("dmfi", "Settings", oUser)==1)
{
FloatingTextStringOnCreature("Settings Restored", oUser, FALSE);
SetLocalInt(oUser, "dmfi_initialized", 1);
int n = GetCampaignInt("dmfi", "dmfi_alignshift", oUser);
SetCustomToken(20781, IntToString(n));
SetLocalInt(oUser, "dmfi_alignshift", n);
SendMessageToPC(oUser, "Settings: Alignment shift: "+IntToString(n));
n = GetCampaignInt("dmfi", "dmfi_safe_factions", oUser);
SetLocalInt(oUser, "dmfi_safe_factions", n);
SendMessageToPC(oUser, "Settings: Factions (1 is DMFI Safe Faction): "+IntToString(n));
n = GetCampaignInt("dmfi", "dmfi_damagemodifier", oUser);
SetLocalInt(oUser, "dmfi_damagemodifier",n);
SendMessageToPC(oUser, "Settings: Damage Modifier: "+IntToString(n));
n = GetCampaignInt("dmfi","dmfi_buff_party",oUser);
SetLocalInt(oUser, "dmfi_buff_party", n);
if (n==1)
SetCustomToken(20783, "Party");
else
SetCustomToken(20783, "Single Target");
SendMessageToPC(oUser, "Settings: Buff Party (1 is Party): "+IntToString(n));
string sLevel = GetCampaignString("dmfi", "dmfi_buff_level", oUser);
SetCustomToken(20782, sLevel);
SetLocalString(oUser, "dmfi_buff_level", sLevel);
SendMessageToPC(oUser, "Settings: Buff Level: "+ sLevel);
n = GetCampaignInt("dmfi", "dmfi_dicebag", oUser);
SetLocalInt(oUser, "dmfi_dicebag", n);
string sText;
if (n==0)
{SetCustomToken(20681, "Private");
sText = "Private";
}
else if (n==1)
{SetCustomToken(20681, "Global");
sText = "Global";
}
else if (n==2)
{SetCustomToken(20681, "Local");
sText = "Local";
}
else if (n==3)
{SetCustomToken(20681, "DM Only");
sText = "DM Only";
}
SendMessageToPC(oUser, "Settings: Dicebag Reporting: "+sText);
n = GetCampaignInt("dmfi", "dmfi_dice_no_animate", oUser);
SetLocalInt(oUser, "dmfi_dice_no_animate", n);
SendMessageToPC(oUser, "Settings: Roll Animations (1 is OFF): "+IntToString(n));
float f = GetCampaignFloat("dmfi", "dmfi_reputaion", oUser);
SetLocalFloat(oUser, "dmfi_reputation", f);
SendMessageToPC(oUser, "Settings: Reputation Adjustment: "+FloatToString(f));
f = GetCampaignFloat("dmfi", "dmfi_effectduration", oUser);
SetLocalFloat(oUser, "dmfi_effectduration", f);
SendMessageToPC(oUser, "Settings: Effect Duration: "+FloatToString(f));
f = GetCampaignFloat("dmfi", "dmfi_sound_delay", oUser);
SetLocalFloat(oUser, "dmfi_sound_delay", f);
SendMessageToPC(oUser, "Settings: Sound Delay: "+FloatToString(f));
f = GetCampaignFloat("dmfi", "dmfi_beamduration", oUser);
SetLocalFloat(oUser, "dmfi_beamduration", f);
SendMessageToPC(oUser, "Settings: Beam Duration: "+FloatToString(f));
f = GetCampaignFloat("dmfi", "dmfi_stunduration", oUser);
SetLocalFloat(oUser, "dmfi_stunduration", f);
SendMessageToPC(oUser, "Settings: Stun Duration: "+FloatToString(f));
f = GetCampaignFloat("dmfi", "dmfi_saveamount", oUser);
SetLocalFloat(oUser, "dmfi_saveamount", f);
SendMessageToPC(oUser, "Settings: Save Adjustment: "+FloatToString(f));
f = GetCampaignFloat("dmfi", "dmfi_effectdelay", oUser);
SetLocalFloat(oUser, "dmfi_effectdelay", f);
SendMessageToPC(oUser, "Settings: Effect Delay: "+FloatToString(f));
}
else
{
FloatingTextStringOnCreature("Default Settings Initialized", oUser, FALSE);
//Setting FOUR campaign variables so 1st use will be slow.
//Recommend initializing your preferences with no players or
//while there is NO fighting.
SetLocalInt(oUser, "dmfi_initialized", 1);
SetCampaignInt("dmfi", "Settings", 1, oUser);
SetCustomToken(20781, "5");
SetLocalInt(oUser, "dmfi_alignshift", 5);
SetCampaignInt("dmfi", "dmfi_alignshift", 5, oUser);
SendMessageToPC(oUser, "Settings: Alignment shift: 5");
SetCustomToken(20783, "Single Target");
SetLocalInt(oUser, "dmfi_buff_party", 0);
SetCampaignInt("dmfi", "dmfi_buff_party", 0, oUser);
SendMessageToPC(oUser, "Settings: Buff set to Single Target: ");
SetCustomToken(20782, "Low");
SetLocalString(oUser, "dmfi_buff_level", "LOW");
SetCampaignString("dmfi", "dmfi_buff_level", "LOW", oUser);
SendMessageToPC(oUser, "Settings: Buff Level set to LOW: ");
SetLocalInt(oUser, "dmfi_dicebag", 0);
SetCustomToken(20681, "Private");
SetCampaignInt("dmfi", "dmfi_dicebag", 0, oUser);
SendMessageToPC(oUser, "Settings: Dicebag Rolls set to PRIVATE");
SetLocalInt(oUser, "", 0);
SetCampaignInt("dmfi", "dmfi_safe_factions", 0, oUser);
SendMessageToPC(oUser, "Settings: Factions set to BW base behavior");
SetLocalFloat(oUser, "dmfi_reputation", 5.0);
SetCustomToken(20784, "5");
SetCampaignFloat("dmfi", "dmfi_reputation", 5.0, oUser);
SendMessageToPC(oUser, "Settings: Reputation adjustment: 5");
SetCampaignFloat("dmfi", "dmfi_effectduration", 60.0, oUser);
SetLocalFloat(oUser, "dmfi_effectduration", 60.0);
SetCampaignFloat("dmfi", "dmfi_sound_delay", 0.2, oUser);
SetLocalFloat(oUser, "dmfi_sound_delay", 0.2);
SetCampaignFloat("dmfi", "dmfi_beamduration", 5.0, oUser);
SetLocalFloat(oUser, "dmfi_beamduration", 5.0);
SetCampaignFloat("dmfi", "dmfi_stunduration", 1000.0, oUser);
SetLocalFloat(oUser, "dmfi_stunduration", 1000.0);
SetCampaignFloat("dmfi", "dmfi_saveamount", 5.0, oUser);
SetLocalFloat(oUser, "dmfi_saveamount", 5.0);
SetCampaignFloat("dmfi", "dmfi_effectdelay", 1.0, oUser);
SetLocalFloat(oUser, "dmfi_effectdelay", 1.0);
SendMessageToPC(oUser, "Settings: Effect Duration: 60.0");
SendMessageToPC(oUser, "Settings: Effect Delay: 1.0");
SendMessageToPC(oUser, "Settings: Beam Duration: 5.0");
SendMessageToPC(oUser, "Settings: Stun Duration: 1000.0");
SendMessageToPC(oUser, "Settings: Sound Delay: 0.2");
SendMessageToPC(oUser, "Settings: Save Adjustment: 5.0");
}
}
//********************************END INITIALIZATION***************************
dmw_CleanUp(oUser);
if (GetStringLeft(sItemTag,8) == "hlslang_")
{
//Destroy any existing Voice attached to the user
if (GetIsObjectValid(GetLocalObject(oUser, "dmfi_MyVoice")))
{
DestroyObject(GetLocalObject(oUser, "dmfi_MyVoice"));
FloatingTextStringOnCreature("You have destroyed your previous Voice", oUser, FALSE);
}
//Set the Voice to interpret language of the appropriate widget
string ssLanguage = GetStringRight(sItemTag, 2);
if (GetStringLeft(ssLanguage, 1) == "_")
ssLanguage = GetStringRight(sItemTag, 1);
SetLocalInt(oUser, "hls_MyLanguage", StringToInt(ssLanguage));
SetLocalString(oUser, "hls_MyLanguageName", GetName(oItem));
DelayCommand(1.0f, FloatingTextStringOnCreature("You are speaking " + GetName(oItem) + ". Type /dm [(what you want to say in brackets)]", oUser, FALSE));
object oArea = GetFirstObjectInArea(GetArea(oUser));
while (GetIsObjectValid(oArea))
{
if (GetObjectType(oArea) == OBJECT_TYPE_CREATURE &&
!GetIsDead(oArea) &&
GetLocalInt(oArea, "hls_Listening") &&
GetDistanceBetween(oUser, oArea) < 20.0f &&
oArea != GetLocalObject(oUser, "dmfi_MyVoice"))
{
DeleteLocalObject(oUser, "dmfi_MyVoice");
return;
}
oArea = GetNextObjectInArea(GetArea(oUser));
}
//Create the Voice
object oVoice = CreateObject(OBJECT_TYPE_CREATURE, "dmfi_voice", GetLocation(oUser));
//Set the Voice to Autofollow the User
AssignCommand(oVoice, ActionForceFollowObject(oUser, 3.0f));
//Set Ownership of the Voice to the User
SetLocalObject(oUser, "dmfi_MyVoice", oVoice);
return;
}
if (GetStringLeft(sItemTag, 8) == "dmfi_pc_")
{
if (sItemTag == "dmfi_pc_follow")
{
if (GetIsObjectValid(oOther))
{
FloatingTextStringOnCreature("Now following "+ GetName(oOther),oUser, FALSE);
DelayCommand(2.0f, AssignCommand(oUser, ActionForceFollowObject(oOther, 2.0f)));
}
return;
}
SetLocalObject(oUser, "dmfi_univ_target", oUser);
SetLocalLocation(oUser, "dmfi_univ_location", lLocation);
SetLocalString(oUser, "dmfi_univ_conv", GetStringRight(sItemTag, GetStringLength(sItemTag) - 5));
AssignCommand(oUser, ClearAllActions());
AssignCommand(oUser, ActionStartConversation(OBJECT_SELF, "dmfi_universal", TRUE));
return;
}
if (GetStringLeft(sItemTag, 5) == "dmfi_")
{
int iPass = FALSE;
if (GetIsDM(oUser) || GetIsDMPossessed(oUser))
iPass = TRUE;
if (!GetIsPC(oUser))
iPass = TRUE;
if (!iPass)
/*
(!GetIsDM(oUser) &&
!GetLocalInt(GetModule(), "dmfi_Admin" + GetPCPublicCDKey(oUser)) &&
!GetLocalInt(oUser, "hls_Listening") &&
!GetIsDMPossessed(oUser))
*/
{
FloatingTextStringOnCreature("You cannot use this item." ,oUser, FALSE);
SendMessageToAllDMs(GetName(oUser)+ " is attempting to use a DM item.");
return;
}
if (sItemTag == "dmfi_exploder")
{
if(!GetIsObjectValid(GetItemPossessedBy(oOther, "dmfi_afflict"))) CreateItemOnObject("dmfi_afflict", oOther);
if(!GetIsObjectValid(GetItemPossessedBy(oOther, "dmfi_dicebag"))) CreateItemOnObject("dmfi_dicebag", oOther);
if(!GetIsObjectValid(GetItemPossessedBy(oOther, "dmfi_pc_dicebag"))) CreateItemOnObject("dmfi_pc_dicebag", oOther);
if(!GetIsObjectValid(GetItemPossessedBy(oOther, "dmfi_pc_follow"))) CreateItemOnObject("dmfi_pc_follow", oOther);
if(!GetIsObjectValid(GetItemPossessedBy(oOther, "dmfi_pc_emote"))) CreateItemOnObject("dmfi_pc_emote", oOther);
if(!GetIsObjectValid(GetItemPossessedBy(oOther, "dmfi_server"))) CreateItemOnObject("dmfi_server", oOther);
if(!GetIsObjectValid(GetItemPossessedBy(oOther, "dmfi_emote"))) CreateItemOnObject("dmfi_emote", oOther);
if(!GetIsObjectValid(GetItemPossessedBy(oOther, "dmfi_encounter"))) CreateItemOnObject("dmfi_encounte", oOther);
if(!GetIsObjectValid(GetItemPossessedBy(oOther, "dmfi_faction"))) CreateItemOnObject("dmfi_faction", oOther);
if(!GetIsObjectValid(GetItemPossessedBy(oOther, "dmfi_fx"))) CreateItemOnObject("dmfi_fx", oOther);
if(!GetIsObjectValid(GetItemPossessedBy(oOther, "dmfi_music"))) CreateItemOnObject("dmfi_music", oOther);
if(!GetIsObjectValid(GetItemPossessedBy(oOther, "dmfi_sound"))) CreateItemOnObject("dmfi_sound", oOther);
if(!GetIsObjectValid(GetItemPossessedBy(oOther, "dmfi_voice"))) CreateItemOnObject("dmfi_voice", oOther);
if(!GetIsObjectValid(GetItemPossessedBy(oOther, "dmfi_xp"))) CreateItemOnObject("dmfi_xp", oOther);
if(!GetIsObjectValid(GetItemPossessedBy(oOther, "dmfi_500xp"))) CreateItemOnObject("dmfi_500xp", oOther);
if(!GetIsObjectValid(GetItemPossessedBy(oOther, "dmfi_en_ditto"))) CreateItemOnObject("dmfi_en_ditto", oOther);
if(!GetIsObjectValid(GetItemPossessedBy(oOther, "dmfi_mute"))) CreateItemOnObject("dmfi_mute", oOther);
if(!GetIsObjectValid(GetItemPossessedBy(oOther, "dmfi_peace"))) CreateItemOnObject("dmfi_peace", oOther);
if(!GetIsObjectValid(GetItemPossessedBy(oOther, "dmfi_voicewidget"))) CreateItemOnObject("dmfi_voicewidget", oOther);
if(!GetIsObjectValid(GetItemPossessedBy(oOther, "dmfi_dmw"))) CreateItemOnObject("dmfi_dmw", oOther);
if(!GetIsObjectValid(GetItemPossessedBy(oOther, "dmfi_target"))) CreateItemOnObject("dmfi_target", oOther);
if(!GetIsObjectValid(GetItemPossessedBy(oOther, "dmfi_buff"))) CreateItemOnObject("dmfi_buff", oOther);
if(!GetIsObjectValid(GetItemPossessedBy(oOther, "dmfi_dmbook"))) CreateItemOnObject("dmfi_dmbook", oOther);
if(!GetIsObjectValid(GetItemPossessedBy(oOther, "dmfi_playerbook"))) CreateItemOnObject("dmfi_playerbook", oOther);
return;
}
if (sItemTag == "dmfi_peace")
{ //This widget sets all creatures in the area to a neutral stance and clears combat.
object oArea = GetFirstObjectInArea(GetArea(oUser));
object oP;
while (GetIsObjectValid(oArea))
{
if (GetObjectType(oArea) == OBJECT_TYPE_CREATURE && !GetIsPC(oArea))
{
AssignCommand(oArea, ClearAllActions());
oP = GetFirstPC();
while (GetIsObjectValid(oP))
{
if (GetArea(oP) == GetArea(oUser))
{
ClearPersonalReputation(oArea, oP);
SetStandardFactionReputation(STANDARD_FACTION_HOSTILE, 25, oP);
SetStandardFactionReputation(STANDARD_FACTION_COMMONER, 91, oP);
SetStandardFactionReputation(STANDARD_FACTION_MERCHANT, 91, oP);
SetStandardFactionReputation(STANDARD_FACTION_DEFENDER, 91, oP);
}
oP = GetNextPC();
}
AssignCommand(oArea, ClearAllActions());
}
oArea = GetNextObjectInArea(GetArea(oUser));
}
}
if (sItemTag == "dmfi_voicewidget")
{
object oVoice;
//Destroy any existing Voice attached to the user
if (GetIsObjectValid(GetLocalObject(oUser, "dmfi_MyVoice")))
{
DestroyObject(GetLocalObject(oUser, "dmfi_MyVoice"));
FloatingTextStringOnCreature("You have destroyed your previous Voice", oUser, FALSE);
}
if (GetIsObjectValid(oOther))
{
if (GetObjectSeen(oUser, oOther)!=TRUE)
{
FloatingTextStringOnCreature("You must be visible to target a creature with this widget.", oUser);
return;
}
SetListening(oOther, TRUE);
SetListenPattern(oOther, "**", 20600);
SetLocalInt(oOther, "hls_Listening", 1); //listen to all text
SetLocalObject(oUser, "dmfi_VoiceTarget", oOther);
FloatingTextStringOnCreature("You have targeted " + GetName(oOther) + " with the Voice Widget", oUser, FALSE);
if(!GetIsObjectValid(GetItemPossessedBy(oOther, "dmfi_voicewidget"))) CreateItemOnObject("dmfi_voicewidget", oOther);
if (GetLocalInt(GetModule(), "dmfi_voice_initial")!=1)
{
SetLocalInt(GetModule(), "dmfi_voice_initial", 1);
SendMessageToAllDMs("Listening Initialized: .commands, .skill checks, and much more now available.");
DelayCommand(4.0, FloatingTextStringOnCreature("Listening Initialized: .commands, .skill checks, and more available", oUser));
}
object oArea = GetFirstObjectInArea(GetArea(oUser));
while (GetIsObjectValid(oArea))
{
if (GetObjectType(oArea) == OBJECT_TYPE_CREATURE &&
!GetIsDead(oArea) &&
GetLocalInt(oArea, "hls_Listening") &&
GetDistanceBetween(oUser, oArea) < 20.0f &&
oArea != GetLocalObject(oUser, "dmfi_MyVoice"))
{
DeleteLocalObject(oUser, "dmfi_MyVoice");
return;
}
oArea = GetNextObjectInArea(GetArea(oUser));
}
//Create the Voice
object oVoice = CreateObject(OBJECT_TYPE_CREATURE, "dmfi_voice", GetLocation(oUser));
//Set Ownership of the Voice to the User
AssignCommand(oVoice, ActionForceFollowObject(oUser, 3.0f));
SetLocalObject(oUser, "dmfi_MyVoice", oVoice);
return;
}
else
{
//Create the Voice
oVoice = CreateObject(OBJECT_TYPE_CREATURE, "dmfi_voice", lLocation);
AssignCommand(oVoice, ActionForceFollowObject(oUser, 3.0f));
SetLocalObject(oUser, "dmfi_VoiceTarget", oVoice);
//Set Ownership of the Voice to the User
SetLocalObject(oUser, "dmfi_MyVoice", oVoice);
DelayCommand(1.0f, FloatingTextStringOnCreature("The Voice is operational", oUser, FALSE));
return;
}
return;
}
if (sItemTag == "dmfi_mute")
{
SetLocalObject(oUser, "dmfi_univ_target", oUser);
SetLocalString(oUser, "dmfi_univ_conv", "voice");
SetLocalInt(oUser, "dmfi_univ_int", 8);
ExecuteScript("dmfi_execute", oUser);
return;
}
if (sItemTag == "dmfi_en_ditto")
{
SetLocalObject(oUser, "dmfi_univ_target", oOther);
SetLocalLocation(oUser, "dmfi_univ_location", lLocation);
SetLocalString(oUser, "dmfi_univ_conv", "encounter");
SetLocalInt(oUser, "dmfi_univ_int", GetLocalInt(oUser, "EncounterType"));
ExecuteScript("dmfi_execute", oUser);
return;
}
if (sItemTag == "dmfi_target")
{
SetLocalObject(oUser, "dmfi_univ_target", oOther);
FloatingTextStringOnCreature("DMFI Target set to " + GetName(oOther),oUser);
}
if (sItemTag == "dmfi_500xp")
{
SetLocalObject(oUser, "dmfi_univ_target", oOther);
SetLocalLocation(oUser, "dmfi_univ_location", lLocation);
SetLocalString(oUser, "dmfi_univ_conv", "xp");
SetLocalInt(oUser, "dmfi_univ_int", 53);
ExecuteScript("dmfi_execute", oUser);
return;
}
if (sItemTag == "dmfi_encounter")
{
if (GetIsObjectValid(GetWaypointByTag("DMFI_E1")))
SetCustomToken(20771, GetName(GetWaypointByTag("DMFI_E1")));
else
SetCustomToken(20771, "Encounter Invalid");
if (GetIsObjectValid(GetWaypointByTag("DMFI_E2")))
SetCustomToken(20772, GetName(GetWaypointByTag("DMFI_E2")));
else
SetCustomToken(20772, "Encounter Invalid");
if (GetIsObjectValid(GetWaypointByTag("DMFI_E3")))
SetCustomToken(20773, GetName(GetWaypointByTag("DMFI_E3")));
else
SetCustomToken(20773, "Encounter Invalid");
if (GetIsObjectValid(GetWaypointByTag("DMFI_E4")))
SetCustomToken(20774, GetName(GetWaypointByTag("DMFI_E4")));
else
SetCustomToken(20774, "Encounter Invalid");
if (GetIsObjectValid(GetWaypointByTag("DMFI_E5")))
SetCustomToken(20775, GetName(GetWaypointByTag("DMFI_E5")));
else
SetCustomToken(20775, "Encounter Invalid");
if (GetIsObjectValid(GetWaypointByTag("DMFI_E6")))
SetCustomToken(20776, GetName(GetWaypointByTag("DMFI_E6")));
else
SetCustomToken(20776, "Encounter Invalid");
if (GetIsObjectValid(GetWaypointByTag("DMFI_E7")))
SetCustomToken(20777, GetName(GetWaypointByTag("DMFI_E7")));
else
SetCustomToken(20777, "Encounter Invalid");
if (GetIsObjectValid(GetWaypointByTag("DMFI_E8")))
SetCustomToken(20778, GetName(GetWaypointByTag("DMFI_E8")));
else
SetCustomToken(20778, "Encounter Invalid");
if (GetIsObjectValid(GetWaypointByTag("DMFI_E9")))
SetCustomToken(20779, GetName(GetWaypointByTag("DMFI_E9")));
else
SetCustomToken(20779, "Encounter Invalid");
}
if (sItemTag == "dmfi_afflict")
{
int nDNum;
nDNum = GetLocalInt(oUser, "dmfi_damagemodifier");
SetCustomToken(20780, IntToString(nDNum));
}
SetLocalObject(oUser, "dmfi_univ_target", oOther);
SetLocalLocation(oUser, "dmfi_univ_location", lLocation);
SetLocalString(oUser, "dmfi_univ_conv", GetStringRight(sItemTag, GetStringLength(sItemTag) - 5));
AssignCommand(oUser, ClearAllActions());
AssignCommand(oUser, ActionStartConversation(OBJECT_SELF, "dmfi_universal", TRUE, FALSE));
}
}

View File

@@ -0,0 +1,21 @@
int StartingConditional()
{
int nMyNum = GetLocalInt(OBJECT_SELF, "dmfi_dmwOffset");
SetLocalInt(OBJECT_SELF, "dmfi_dmwOffset", nMyNum+1);
object oMySpeaker = GetPCSpeaker();
object oMyTarget = GetLocalObject(oMySpeaker, "dmfi_univ_target");
location lMyLoc = GetLocalLocation(oMySpeaker, "dmfi_univ_location");
string sMyString = GetLocalString(oMySpeaker, "dmw_dialog" + IntToString(nMyNum));
if(sMyString == "")
{
return FALSE;
}
else
{
SetCustomToken(8000 + nMyNum, sMyString);
return TRUE;
}
}

View File

@@ -0,0 +1,611 @@
// VOICE CONFIGURATION - NEW IN 1.07 and UP
// Set this to 0 if you want to DISABLE listening by NPCs for performance reasons.
// See readme for additional information regarding possible issues and effects.
const int DMFI_LISTENING_GLOBAL = 1;
// NOTE: OMW_COLORS is an invisible object that must be present in your module.
// It has high ascii characters in the name and is used to get the color codes.
// This was ripped wholeheartedly by an example posted by Richterm on the bioboards.
string DST_COLOR_TAGS = GetName(GetObjectByTag("dem_color_text"));
string DST_COLOR_WHITE = GetSubString(DST_COLOR_TAGS, 0, 6);
string DST_COLOR_YELLOW = GetSubString(DST_COLOR_TAGS, 6, 6);
string DST_COLOR_MAGENTA = GetSubString(DST_COLOR_TAGS, 12, 6);
string DST_COLOR_CYAN = GetSubString(DST_COLOR_TAGS, 18, 6);
string DST_COLOR_RED = GetSubString(DST_COLOR_TAGS, 24, 6);
string DST_COLOR_GREEN = GetSubString(DST_COLOR_TAGS, 30, 6);
string DST_COLOR_BLUE = GetSubString(DST_COLOR_TAGS, 36, 6);
// Colors for each type of roll. Change the colors if you like.
string DMFI_ROLL_COLOR = DST_COLOR_CYAN;
string DST_COLOR_NORMAL = DST_COLOR_WHITE;
int DMW_START_CUSTOM_TOKEN = 8000;
//Retrieve targetting information
object oMySpeaker = GetLastSpeaker();
object oMyTarget = GetLocalObject(oMySpeaker, "dmfi_univ_target");
location lMyLoc = GetLocalLocation(oMySpeaker, "dmfi_univ_location");
// checks if a nearby object is destroyable
int dmwand_isnearbydestroyable();
// Check if the target can be created with CreateObject
int dmwand_istargetcreateable();
//Check if target is a destroyable object
int dmwand_istargetdestroyable();
// checks if the wand was NOT clicked on an object
int dmwand_istargetinvalid();
// check if the target has an inventory
int dmwand_istargetinventory();
//Check if the target is not the wand's user
int dmwand_istargetnotme();
//Check if target is an NPC or monster
int dmwand_istargetnpc();
//Check if the target is a PC
int dmwand_istargetpc();
//Check if the target is a PC and not me
int dmwand_istargetpcnme();
// Check if the target is a PC or NPC
// uses the CON score currently
int dmwand_istargetpcornpc();
//Check if the target is a PC or an npc and not me
int dmwand_istargetpcornpcnme();
// Check if target is a placeable
int dmwand_istargetplaceable();
//bulds the conversion
int dmwand_BuildConversationDialog(int nCurrent, int nChoice, string sConversation, string sParams);
int dmw_conv_ListPlayers(int nCurrent, int nChoice, string sParams = "");
int dmw_conv_Start(int nCurrent, int nChoice, string sParams = "");
void dmwand_BuildConversation(string sConversation, string sParams);
void dmwand_StartConversation();
// DMFI Color Text function. It returns a colored string.
// sText is the string that will be colored and sColor is the color
// options: yellow, magenta, cyan, red, green, blue - truncated at first letter
// Ex: sMsg = ColorText(sMsg, "y"); //Add the include file - yields yellow colored msg.
string ColorText(string sText, string sColor);
string ColorText(string sText, string sColor)
{
string sApply = DST_COLOR_NORMAL;
string sTest = GetStringLowerCase(GetStringLeft(sColor, 1));
if (sTest=="y") sApply = DST_COLOR_YELLOW;
else if (sTest == "m") sApply = DST_COLOR_MAGENTA;
else if (sTest == "c") sApply = DST_COLOR_CYAN;
else if (sTest == "r") sApply = DST_COLOR_RED;
else if (sTest == "g") sApply = DST_COLOR_GREEN;
else if (sTest == "r") sApply = DST_COLOR_BLUE;
string sFinal = sApply + sText + DST_COLOR_NORMAL;
return sFinal;
}
int dmwand_isnearbydestroyable()
{
object oMyTest = GetFirstObjectInShape(SHAPE_CUBE, 0.6, lMyLoc, FALSE, OBJECT_TYPE_ALL);
int nTargetType = GetObjectType(oMyTest);
return (GetIsObjectValid(oMyTest) && (! GetIsPC(oMyTest)) && ((nTargetType == OBJECT_TYPE_ITEM) || (nTargetType == OBJECT_TYPE_PLACEABLE) || (nTargetType == OBJECT_TYPE_CREATURE)));
}
int dmwand_istargetcreateable()
{
if(! GetIsObjectValid(oMyTarget)) { return FALSE; }
int nTargetType = GetObjectType(oMyTarget);
return ((nTargetType == OBJECT_TYPE_ITEM) || (nTargetType == OBJECT_TYPE_PLACEABLE) || (nTargetType == OBJECT_TYPE_CREATURE));
}
int dmwand_istargetdestroyable()
{
if(! GetIsObjectValid(oMyTarget)) { return FALSE; }
int nTargetType = GetObjectType(oMyTarget);
if(! GetIsPC(oMyTarget))
{
return ((nTargetType == OBJECT_TYPE_ITEM) || (nTargetType == OBJECT_TYPE_PLACEABLE) || (nTargetType == OBJECT_TYPE_CREATURE));
}
return FALSE;
}
int dmwand_istargetinvalid()
{
return !GetIsObjectValid(oMyTarget);
}
int dmwand_istargetinventory()
{
return (GetIsObjectValid(oMyTarget) && GetHasInventory(oMyTarget));
}
int dmwand_istargetnotme()
{
return (GetIsObjectValid(oMyTarget) && (oMySpeaker != oMyTarget));
}
int dmwand_istargetpc()
{
return (GetIsObjectValid(oMyTarget) && GetIsPC(oMyTarget));
}
int dmwand_istargetpcnme()
{
return (GetIsObjectValid(oMyTarget) && GetIsPC(oMyTarget) && (oMySpeaker != oMyTarget));
}
int dmwand_istargetpcornpc()
{
return (GetIsObjectValid(oMyTarget) && GetAbilityScore(oMyTarget, ABILITY_CONSTITUTION));
}
int dmwand_istargetnpc()
{
return (dmwand_istargetpcornpc() && (!GetIsPC(oMyTarget)));
}
int dmwand_istargetpcornpcnme()
{
return (dmwand_istargetpcornpc() && (oMySpeaker != oMyTarget));
}
int dmwand_istargetplaceable()
{
if(! GetIsObjectValid(oMyTarget)) { return FALSE; }
int nTargetType = GetObjectType(oMyTarget);
return (nTargetType == OBJECT_TYPE_PLACEABLE);
}
int dmw_conv_Start(int nCurrent, int nChoice, string sParams = "")
{
string sText = "";
string sCall = "";
string sCallParams = "";
switch(nCurrent)
{
case 0:
nCurrent = 0;
sText = "Hello there, DM. What can I do for you?";
sCall = "";
sCallParams = "";
break;
case 1:
nCurrent = 1;
if(dmwand_istargetpcnme())
{
sText = "Penguin this player.";
sCall = "func_Toad";
sCallParams = "";
break;
}
case 2:
nCurrent = 2;
if(dmwand_istargetpcnme())
{
sText = "Unpenguin this player.";
sCall = "func_Untoad";
sCallParams = "";
break;
}
case 3:
nCurrent = 3;
if(dmwand_istargetpcnme())
{
sText = "Boot this player.";
sCall = "func_KickPC";
sCallParams = "";
break;
}
case 4:
nCurrent = 4;
if(dmwand_istargetinvalid())
{
sText = "List all players...";
sCall = "conv_ListPlayers";
sCallParams = "func_PlayerListConv";
break;
}
case 5:
nCurrent = 5;
if(dmwand_istargetpcnme())
{
sText = "Jump this player to my location.";
sCall = "func_JumpPlayerHere";
sCallParams = "";
break;
}
case 6:
nCurrent = 6;
if(dmwand_istargetpcnme())
{
sText = "Jump me to this player's location.";
sCall = "func_JumpToPlayer";
sCallParams = "";
break;
}
case 7:
nCurrent = 7;
if(dmwand_istargetpcnme())
{
sText = "Jump this player's party to my location.";
sCall = "func_JumpPartyHere";
sCallParams = "";
break;
}
default:
nCurrent = 0;
sText = "";
sCall = "";
sCallParams = "";
break;
}
SetLocalString(oMySpeaker, "dmw_dialog" + IntToString(nChoice), sText);
SetLocalString(oMySpeaker, "dmw_function" + IntToString(nChoice), sCall);
SetLocalString(oMySpeaker, "dmw_params" + IntToString(nChoice), sCallParams);
return nCurrent;
}
void DMFI_untoad(object oTarget, object oUser)
{
if (GetLocalInt(oTarget, "toaded")==1)
{
effect eMyEffect = GetFirstEffect(oTarget);
while(GetIsEffectValid(eMyEffect))
{
if(GetEffectType(eMyEffect) == EFFECT_TYPE_POLYMORPH ||
GetEffectType(eMyEffect) == EFFECT_TYPE_PARALYZE)
RemoveEffect(oTarget, eMyEffect);
eMyEffect = GetNextEffect(oTarget);
}
}
else
{
FloatingTextStringOnCreature("Dude, he is no toad!", oUser);
}
}
void DMFI_toad(object oTarget, object oUser)
{
effect ePenguin = EffectPolymorph(POLYMORPH_TYPE_PENGUIN);
effect eParalyze = EffectParalyze();
SendMessageToPC(oUser, "Penguin? Don't you mean toad?");
AssignCommand(oTarget, ApplyEffectToObject(DURATION_TYPE_PERMANENT, ePenguin, oTarget));
AssignCommand(oTarget, ApplyEffectToObject(DURATION_TYPE_PERMANENT, eParalyze, oTarget));
SetLocalInt(oTarget, "toaded", 1);
}
void dmwand_KickPC(object oTarget, object oUser)
{
// Create a lightning strike, thunder, scorch mark, and random small
// lightnings at target's location
location lMyLoc = GetLocation (oTarget);
AssignCommand( oUser, ApplyEffectAtLocation ( DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_LIGHTNING_M), lMyLoc));
AssignCommand ( oUser, PlaySound ("as_wt_thundercl3"));
object oScorch = CreateObject ( OBJECT_TYPE_PLACEABLE, "plc_weathmark", lMyLoc, FALSE);
object oTargetArea = GetArea(oUser);
int nXPos, nYPos, nCount;
for(nCount = 0; nCount < 5; nCount++)
{
nXPos = Random(10) - 5;
nYPos = Random(10) - 5;
vector vNewVector = GetPositionFromLocation(lMyLoc);
vNewVector.x += nXPos;
vNewVector.y += nYPos;
location lNewLoc = Location(oTargetArea, vNewVector, 0.0);
AssignCommand( oUser, ApplyEffectAtLocation ( DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_LIGHTNING_S), lNewLoc));
}
DelayCommand ( 20.0, DestroyObject ( oScorch));
SendMessageToAllDMs (GetName(oTarget) + " was booted from the game. PC CD KEY: " + GetPCPublicCDKey(oTarget) + " PC IP ADDRESS: " + GetPCIPAddress(oTarget));
PrintString(GetName(oTarget) + " was booted from the game. PC CD KEY: " + GetPCPublicCDKey(oTarget) + " PC IP ADDRESS: " + GetPCIPAddress(oTarget));
// Kick the target out of the game
BootPC(oTarget);
}
void dmwand_JumpPlayerHere()
{
location lJumpLoc = GetLocation(oMySpeaker);
AssignCommand(oMyTarget, ClearAllActions());
AssignCommand(oMyTarget, ActionJumpToLocation(lJumpLoc));
}
//Added by hahnsoo, jumps a party to the DM
void dmwand_JumpPartyHere()
{
location lJumpLoc = GetLocation(oMySpeaker);
object oParty = GetFirstFactionMember(oMyTarget);
while (GetIsObjectValid(oParty))
{
AssignCommand(oParty, ClearAllActions());
AssignCommand(oParty, ActionJumpToLocation(lJumpLoc));
oParty = GetNextFactionMember(oMyTarget);
}
}
void dmwand_JumpToPlayer()
{
location lJumpLoc = GetLocation(oMyTarget);
AssignCommand(oMySpeaker, ActionJumpToLocation(lJumpLoc));
}
void dmwand_PlayerListConv(string sParams)
{
int nPlayer = StringToInt(sParams);
int nCache;
int nCount;
object oPlayer = GetLocalObject(oMySpeaker, "dmw_playercache" + IntToString(nPlayer));
oMyTarget = oPlayer;
SetLocalObject(oMySpeaker, "dmfi_univ_target", oMyTarget);
//Go back to the first conversation level
dmwand_BuildConversation("Start", "");
}
//::///////////////////////////////////////////////
//:: File: dmw_conv_inc
//::
//:: Conversation functions for the DM's Helper
//:://////////////////////////////////////////////
int dmwand_BuildConversationDialog(int nCurrent, int nChoice, string sConversation, string sParams)
{
if(TestStringAgainstPattern(sConversation, "ListPlayers"))
{
return dmw_conv_ListPlayers(nCurrent, nChoice, sParams);
}
if(TestStringAgainstPattern(sConversation, "Start"))
{
return dmw_conv_Start(nCurrent, nChoice, sParams);
}
return FALSE;
}
void dmwand_BuildConversation(string sConversation, string sParams)
{
int nLast;
int nTemp;
int nChoice = 1;
int nCurrent = 1;
int nMatch;
if(TestStringAgainstPattern(sParams, "prev"))
{
//Get the number choice to start with
nCurrent = GetLocalInt(oMySpeaker, "dmw_dialogprev");
//Since we're going to the previous page, there will be a next
SetLocalString(oMySpeaker, "dmw_dialog9", "Next ->");
SetLocalString(oMySpeaker, "dmw_function9", "conv_" + sConversation);
SetLocalString(oMySpeaker, "dmw_params9", "next");
SetLocalInt(oMySpeaker, "dmw_dialognext", nCurrent);
nChoice = 8;
for(;nChoice >= 0; nChoice--)
{
int nTemp1 = nCurrent;
int nTemp2 = nCurrent;
nMatch = nTemp2;
while((nCurrent == nMatch) && (nTemp2 > 0))
{
nTemp2--;
nMatch = dmwand_BuildConversationDialog(nTemp2, nChoice, sConversation, sParams);
}
if(nTemp2 <= 0)
{
//we went back too far for some reason, so make this choice blank
SetLocalString(oMySpeaker, "dmw_dialog" + IntToString(nChoice), "");
SetLocalString(oMySpeaker, "dmw_function" + IntToString(nChoice), "");
SetLocalString(oMySpeaker, "dmw_params" + IntToString(nChoice), "");
}
nLast = nTemp;
nTemp = nTemp1;
nTemp1 = nMatch;
nCurrent = nMatch;
}
if(nMatch > 0)
{
SetLocalString(oMySpeaker, "dmw_dialog1", "<- previous");
SetLocalString(oMySpeaker, "dmw_function1", "conv_" + sConversation);
SetLocalString(oMySpeaker, "dmw_params1", "prev");
SetLocalInt(oMySpeaker, "dmw_dialogprev", nLast);
}
//fill the NPC's dialog spot
//(saved for last because the build process tromps on it)
dmwand_BuildConversationDialog(0, 0, sConversation, sParams);
}
else
{
//fill the NPC's dialog spot
dmwand_BuildConversationDialog(0, 0, sConversation, sParams);
//No parameters specified, start at the top of the conversation
if(sParams == "")
{
nChoice = 1;
nCurrent = 1;
}
//A "next->" choice was selected
if(TestStringAgainstPattern(sParams, "next"))
{
//get the number choice to start with
nCurrent = GetLocalInt(oMySpeaker, "dmw_dialognext");
//set this as the number for the "previous" choice to use
SetLocalInt(oMySpeaker, "dmw_dialogprev", nCurrent);
//Set the first dialog choice to be "previous"
nChoice = 2;
SetLocalString(oMySpeaker, "dmw_dialog1", "<- Previous");
SetLocalString(oMySpeaker, "dmw_function1", "conv_" + sConversation);
SetLocalString(oMySpeaker, "dmw_params1", "prev");
}
//Loop through to build the dialog list
for(;nChoice <= 10; nChoice++)
{
nMatch = dmwand_BuildConversationDialog(nCurrent, nChoice, sConversation, sParams);
//nLast will be the value of the choice before the last one
nLast = nTemp;
nTemp = nMatch;
if(nMatch > 0) { nCurrent = nMatch; }
if(nMatch == 0) { nLast = 0; }
nCurrent++;
}
//If there were enough choices to fill 10 spots, make spot 9 a "next"
if(nLast > 0)
{
SetLocalString(oMySpeaker, "dmw_dialog9", "Next ->");
SetLocalString(oMySpeaker, "dmw_function9", "conv_" + sConversation);
SetLocalString(oMySpeaker, "dmw_params9", "next");
SetLocalInt(oMySpeaker, "dmw_dialognext", nLast);
}
}
}
int dmw_conv_ListPlayers(int nCurrent, int nChoice, string sParams = "")
{
string sText = "";
string sCall = "";
string sCallParams = "";
object oPlayer;
int nCache;
if((! TestStringAgainstPattern(sParams, "next")) && (! TestStringAgainstPattern(sParams, "prev")))
{
//This is the first time running this function, so cache the objects
// of all players... we don't want our list swapping itself around every
// time you change a page
SetLocalString(oMySpeaker, "dmw_playerfunc", sParams);
int nCount = 1;
oPlayer = GetFirstPC();
while(GetIsObjectValid(oPlayer))
{
SetLocalObject(oMySpeaker, "dmw_playercache" + IntToString(nCount), oPlayer);
oPlayer = GetNextPC();
nCount++;
}
nCount--;
SetLocalInt(oMySpeaker, "dmw_playercache", nCount);
}
string sFunc = GetLocalString(oMySpeaker, "dmw_playerfunc");
nCache = GetLocalInt(oMySpeaker, "dmw_playercache");
switch(nCurrent)
{
case 0:
nCurrent = 0;
sText = "Who would you like to work on?";
sCall = "";
sCallParams = "";
break;
default:
//Find the next player in the cache who is valid
oPlayer = GetLocalObject(oMySpeaker, "dmw_playercache" + IntToString(nCurrent));
while((! GetIsObjectValid(oPlayer)) && (nCurrent <= nCache))
{
nCurrent++;
oPlayer = GetLocalObject(oMySpeaker, "dmw_playercache" + IntToString(nCurrent));
}
if(nCurrent > nCache)
{
//We've run out of cache, any other spots in this list should be
//skipped
nCurrent = 0;
sText = "";
sCall = "";
sCallParams = "";
}
else
{
//We found a player, set up the list entry
sText = GetName(oPlayer) + " (" + GetPCPlayerName(oPlayer) + ")";
sCall = sFunc;
sCallParams = IntToString(nCurrent);
}
break;
}
SetLocalString(oMySpeaker, "dmw_dialog" + IntToString(nChoice), sText);
SetLocalString(oMySpeaker, "dmw_function" + IntToString(nChoice), sCall);
SetLocalString(oMySpeaker, "dmw_params" + IntToString(nChoice), sCallParams);
return nCurrent;
}
void dmwand_DoDialogChoice(int nChoice)
{
string sCallFunction = GetLocalString(oMySpeaker, "dmw_function" + IntToString(nChoice));
string sCallParams = GetLocalString(oMySpeaker, "dmw_params" + IntToString(nChoice));
string sNav = "";
string sStart = GetStringLeft(sCallFunction, 5);
int nLen = GetStringLength(sCallFunction) - 5;
string sCall = GetSubString(sCallFunction, 5, nLen);
if(TestStringAgainstPattern("conv_", sStart))
{
dmwand_BuildConversation(sCall, sCallParams);
}
else
{
if(TestStringAgainstPattern("PlayerListConv", sCall))
{
dmwand_PlayerListConv(sCallParams);
return;
}
if(TestStringAgainstPattern("Toad", sCall))
{
DMFI_toad(oMyTarget, oMySpeaker);
return;
}
if(TestStringAgainstPattern("Untoad", sCall))
{
DMFI_untoad(oMyTarget, oMySpeaker);
return;
}
if(TestStringAgainstPattern("KickPC", sCall))
{
dmwand_KickPC(oMyTarget, oMySpeaker);
return;
}
if(TestStringAgainstPattern("JumpPlayerHere", sCall))
{
dmwand_JumpPlayerHere();
return;
}
if(TestStringAgainstPattern("JumpToPlayer", sCall))
{
dmwand_JumpToPlayer();
return;
}
if(TestStringAgainstPattern("JumpPartyHere", sCall))
{
dmwand_JumpPartyHere();
return;
}
}
}

3608
_module/nss/dmfi_execute.nss Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,26 @@
void main()
{
object oPC = GetPCSpeaker();
object oTarget = GetLocalObject(oPC, "dmfi_univ_target");
location lLocation = GetLocalLocation(oPC, "dmfi_univ_location");
string sConv = GetLocalString(oPC, "dmfi_univ_conv");
if (GetLocalInt(oPC, "Tens"))
{
SetLocalInt(oPC, "dmfi_univ_int", 10*GetLocalInt(oPC, "Tens") + 1);
ExecuteScript("dmfi_execute", oPC);
DeleteLocalInt(oPC, "Tens");
return;
}
else
{
if(sConv == "pc_emote" || sConv == "emote" || sConv == "server" || sConv == "onering")
{
SetLocalInt(oPC, "dmfi_univ_int", 1);
ExecuteScript("dmfi_execute", oPC);
}
else
SetLocalInt(oPC, "Tens", 1);
return;
}
}

View File

@@ -0,0 +1,27 @@
void main()
{
object oPC = GetPCSpeaker();
object oTarget = GetLocalObject(oPC, "dmfi_univ_target");
location lLocation = GetLocalLocation(oPC, "dmfi_univ_location");
string sConv = GetLocalString(oPC, "dmfi_univ_conv");
if (GetLocalInt(oPC, "Tens"))
{
SetLocalInt(oPC, "dmfi_univ_int", 10*GetLocalInt(oPC, "Tens"));
ExecuteScript("dmfi_execute", oPC);
DeleteLocalInt(oPC, "Tens");
return;
}
else
{
if(sConv == "voice" || sConv == "pc_emote")
{
SetLocalInt(oPC, "dmfi_univ_int", 10);
ExecuteScript("dmfi_execute", oPC);
return;
}
else
SetLocalInt(oPC, "Tens", 10);
return;
}
}

View File

@@ -0,0 +1,26 @@
void main()
{
object oPC = GetPCSpeaker();
object oTarget = GetLocalObject(oPC, "dmfi_univ_target");
location lLocation = GetLocalLocation(oPC, "dmfi_univ_location");
string sConv = GetLocalString(oPC, "dmfi_univ_conv");
if (GetLocalInt(oPC, "Tens"))
{
SetLocalInt(oPC, "dmfi_univ_int", 10*GetLocalInt(oPC, "Tens") + 2);
ExecuteScript("dmfi_execute", oPC);
DeleteLocalInt(oPC, "Tens");
return;
}
else
{
if(sConv == "pc_emote" || sConv == "emote" || sConv == "server" || sConv == "onering")
{
SetLocalInt(oPC, "dmfi_univ_int", 2);
ExecuteScript("dmfi_execute", oPC);
}
else
SetLocalInt(oPC, "Tens", 2);
return;
}
}

View File

@@ -0,0 +1,27 @@
void main()
{
object oPC = GetPCSpeaker();
object oTarget = GetLocalObject(oPC, "dmfi_univ_target");
location lLocation = GetLocalLocation(oPC, "dmfi_univ_location");
string sConv = GetLocalString(oPC, "dmfi_univ_conv");
if (GetLocalInt(oPC, "Tens"))
{
SetLocalInt(oPC, "dmfi_univ_int", 10*GetLocalInt(oPC, "Tens") + 3);
ExecuteScript("dmfi_execute", oPC);
DeleteLocalInt(oPC, "Tens");
return;
}
else
{
if(sConv == "pc_emote" || sConv == "emote" || sConv == "server" || sConv == "onering")
{
SetLocalInt(oPC, "dmfi_univ_int", 3);
ExecuteScript("dmfi_execute", oPC);
return;
}
else
SetLocalInt(oPC, "Tens", 3);
return;
}
}

View File

@@ -0,0 +1,27 @@
void main()
{
object oPC = GetPCSpeaker();
object oTarget = GetLocalObject(oPC, "dmfi_univ_target");
location lLocation = GetLocalLocation(oPC, "dmfi_univ_location");
string sConv = GetLocalString(oPC, "dmfi_univ_conv");
if (GetLocalInt(oPC, "Tens"))
{
SetLocalInt(oPC, "dmfi_univ_int", 10*GetLocalInt(oPC, "Tens") + 4);
ExecuteScript("dmfi_execute", oPC);
DeleteLocalInt(oPC, "Tens");
return;
}
else
{
if(sConv == "pc_emote" || sConv == "emote" || sConv == "server" || sConv == "onering")
{
SetLocalInt(oPC, "dmfi_univ_int", 4);
ExecuteScript("dmfi_execute", oPC);
return;
}
else
SetLocalInt(oPC, "Tens", 4);
return;
}
}

View File

@@ -0,0 +1,27 @@
void main()
{
object oPC = GetPCSpeaker();
object oTarget = GetLocalObject(oPC, "dmfi_univ_target");
location lLocation = GetLocalLocation(oPC, "dmfi_univ_location");
string sConv = GetLocalString(oPC, "dmfi_univ_conv");
if (GetLocalInt(oPC, "Tens"))
{
SetLocalInt(oPC, "dmfi_univ_int", 10*GetLocalInt(oPC, "Tens") + 5);
ExecuteScript("dmfi_execute", oPC);
DeleteLocalInt(oPC, "Tens");
return;
}
else
{
if(sConv == "pc_emote" || sConv == "emote" || sConv == "server" || sConv == "onering")
{
SetLocalInt(oPC, "dmfi_univ_int", 5);
ExecuteScript("dmfi_execute", oPC);
return;
}
else
SetLocalInt(oPC, "Tens", 5);
return;
}
}

View File

@@ -0,0 +1,28 @@
void main()
{
object oPC = GetPCSpeaker();
object oTarget = GetLocalObject(oPC, "dmfi_univ_target");
location lLocation = GetLocalLocation(oPC, "dmfi_univ_location");
string sConv = GetLocalString(oPC, "dmfi_univ_conv");
if (GetLocalInt(oPC, "Tens"))
{
SetLocalInt(oPC, "dmfi_univ_int", 10*GetLocalInt(oPC, "Tens") + 6);
ExecuteScript("dmfi_execute", oPC);
DeleteLocalInt(oPC, "Tens");
return;
}
else
{
if(sConv == "pc_emote" || sConv == "emote" ||
sConv == "server" || sConv == "onering")
{
SetLocalInt(oPC, "dmfi_univ_int", 6);
ExecuteScript("dmfi_execute", oPC);
return;
}
else
SetLocalInt(oPC, "Tens", 6);
return;
}
}

View File

@@ -0,0 +1,27 @@
void main()
{
object oPC = GetPCSpeaker();
object oTarget = GetLocalObject(oPC, "dmfi_univ_target");
location lLocation = GetLocalLocation(oPC, "dmfi_univ_location");
string sConv = GetLocalString(oPC, "dmfi_univ_conv");
if (GetLocalInt(oPC, "Tens"))
{
SetLocalInt(oPC, "dmfi_univ_int", 10*GetLocalInt(oPC, "Tens") + 7);
ExecuteScript("dmfi_execute", oPC);
DeleteLocalInt(oPC, "Tens");
return;
}
else
{
if(sConv == "pc_emote" || sConv == "emote" || sConv == "server" || sConv == "onering")
{
SetLocalInt(oPC, "dmfi_univ_int", 7);
ExecuteScript("dmfi_execute", oPC);
return;
}
else
SetLocalInt(oPC, "Tens", 7);
return;
}
}

View File

@@ -0,0 +1,28 @@
void main()
{
object oPC = GetPCSpeaker();
object oTarget = GetLocalObject(oPC, "dmfi_univ_target");
location lLocation = GetLocalLocation(oPC, "dmfi_univ_location");
string sConv = GetLocalString(oPC, "dmfi_univ_conv");
if (GetLocalInt(oPC, "Tens"))
{
SetLocalInt(oPC, "dmfi_univ_int", 10*GetLocalInt(oPC, "Tens") + 8);
ExecuteScript("dmfi_execute", oPC);
DeleteLocalInt(oPC, "Tens");
return;
}
else
{
if(( sConv == "server") || (sConv == "xp") ||
(sConv == "voice") || (sConv == "onering"))
{
SetLocalInt(oPC, "dmfi_univ_int", 8);
ExecuteScript("dmfi_execute", oPC);
return;
}
else
SetLocalInt(oPC, "Tens", 8);
return;
}
}

View File

@@ -0,0 +1,27 @@
void main()
{
object oPC = GetPCSpeaker();
object oTarget = GetLocalObject(oPC, "dmfi_univ_target");
location lLocation = GetLocalLocation(oPC, "dmfi_univ_location");
string sConv = GetLocalString(oPC, "dmfi_univ_conv");
if (GetLocalInt(oPC, "Tens"))
{
SetLocalInt(oPC, "dmfi_univ_int", 10*GetLocalInt(oPC, "Tens") + 9);
ExecuteScript("dmfi_execute", oPC);
DeleteLocalInt(oPC, "Tens");
return;
}
else
{
if(sConv == "server" || sConv == "voice" || sConv == "faction")
{
SetLocalInt(oPC, "dmfi_univ_int", 9);
ExecuteScript("dmfi_execute", oPC);
return;
}
else
SetLocalInt(oPC, "Tens", 9);
return;
}
}

View File

@@ -0,0 +1,128 @@
//DMFI Universal Wand scripts by hahnsoo
int StartingConditional()
{
object oPC = GetPCSpeaker();
DeleteLocalInt(oPC, "Tens");
int iOffset = GetLocalInt(oPC, "dmfi_univ_offset")+1;
string sOffset = GetLocalString(oPC, "dmfi_univ_conv");
SetLocalInt(oPC, "dmfi_univ_offset", iOffset);
if (sOffset == "afflict" && iOffset==1)
return TRUE;
if (sOffset == "pc_emote" && iOffset==2)
return TRUE;
if (sOffset == "emote" && iOffset==2)
return TRUE;
if (sOffset == "encounter" && iOffset==3)
return TRUE;
if (sOffset == "fx" && iOffset==4)
return TRUE;
if (sOffset == "music" && iOffset==5)
return TRUE;
if (sOffset == "sound" && iOffset==6)
return TRUE;
if (sOffset == "xp" && iOffset==7)
return TRUE;
if (sOffset == "onering" && iOffset==8)
return TRUE;
if (sOffset == "pc_dicebag" && iOffset==9)
{
SetLocalInt(oPC, "dmfi_univ_offset", 8);
if (GetLocalInt(oPC, "dmfi_dicebag")==0)
SetCustomToken(20681, "Private");
else if (GetLocalInt(oPC, "dmfi_dicebag")==1)
SetCustomToken(20681, "Global");
else if (GetLocalInt(oPC, "dmfi_dicebag")==2)
SetCustomToken(20681, "Local");
else if (GetLocalInt(oPC, "dmfi_dicebag")==3)
SetCustomToken(20681, "DM Only");
return TRUE;
}
if (sOffset == "dicebag" && iOffset==10)
{
SetLocalInt(oPC, "dmfi_univ_offset", 9);
if (GetLocalInt(oPC, "dmfi_dicebag")==0)
SetCustomToken(20681, "Private");
else if (GetLocalInt(oPC, "dmfi_dicebag")==1)
SetCustomToken(20681, "Global");
else if (GetLocalInt(oPC, "dmfi_dicebag")==2)
SetCustomToken(20681, "Local");
else if (GetLocalInt(oPC, "dmfi_dicebag")==3)
SetCustomToken(20681, "DM Only");
string sName = GetName(GetLocalObject(oPC, "dmfi_univ_target"));
SetCustomToken(20680, sName);
return TRUE;
}
if (sOffset == "voice" &&
GetIsObjectValid(GetLocalObject(oPC, "dmfi_univ_target")) &&
oPC != GetLocalObject(oPC, "dmfi_univ_target") &&
iOffset==11)
{
string sName = GetName(GetLocalObject(oPC, "dmfi_univ_target"));
SetCustomToken(20680, sName);
return TRUE;
}
if (sOffset == "voice" &&
!GetIsObjectValid(GetLocalObject(oPC, "dmfi_univ_target")) &&
iOffset==12)
{
string sName = GetName(GetLocalObject(oPC, "dmfi_univ_target"));
SetCustomToken(20680, sName);
return TRUE;
}
if (sOffset == "voice" &&
GetIsObjectValid(GetLocalObject(oPC, "dmfi_univ_target")) &&
oPC == GetLocalObject(oPC, "dmfi_univ_target") &&
iOffset==13)
{
string sName = GetName(GetLocalObject(oPC, "dmfi_univ_target"));
SetCustomToken(20680, sName);
return TRUE;
}
if (sOffset == "faction" && iOffset==14)
{
int iLoop = 1;
string sName;
object sFaction;
while (iLoop < 10)
{
sFaction = GetLocalObject(oPC, "dmfi_customfaction" + IntToString(iLoop));
sName = GetName(sFaction);
SetCustomToken(20690 + iLoop, sName + "'s Faction ");
iLoop++;
}
SetCustomToken(20690, GetName(GetLocalObject(oPC, "dmfi_henchman")));
SetCustomToken(20784, FloatToString(GetLocalFloat(oPC, "dmfi_reputation")));
sName = GetName(GetLocalObject(oPC, "dmfi_univ_target"));
SetCustomToken(20680, sName);
return TRUE;
}
if (sOffset == "dmw" && iOffset ==15)
{
SetCustomToken(20781, IntToString(GetLocalInt(oPC, "dmfi_alignshift")));
return TRUE;
}
if (sOffset == "buff" && iOffset ==16)
{
if (GetLocalInt(oPC, "dmfi_buff_party")==0)
SetCustomToken(20783, "Single Target");
else
SetCustomToken(20783, "Party");
SetCustomToken(20782, GetLocalString(oPC, "dmfi_buff_level"));
return TRUE;
}
return FALSE;
}

View File

@@ -0,0 +1,335 @@
//DMFI Universal Wand scripts by hahnsoo
int DMW_START_CUSTOM_TOKEN = 8000;
//Retrieve targetting information
object oMySpeaker = GetLastSpeaker();
object oMyTarget = GetLocalObject(oMySpeaker, "dmfi_univ_target");
location lMyLoc = GetLocalLocation(oMySpeaker, "dmfi_univ_location");
int dmwand_isnearbydestroyable()
{
object oMyTest = GetFirstObjectInShape(SHAPE_CUBE, 0.6, lMyLoc, FALSE, OBJECT_TYPE_ALL);
int nTargetType = GetObjectType(oMyTest);
return (GetIsObjectValid(oMyTest) && (! GetIsPC(oMyTest)) && ((nTargetType == OBJECT_TYPE_ITEM) || (nTargetType == OBJECT_TYPE_PLACEABLE) || (nTargetType == OBJECT_TYPE_CREATURE)));
}
int dmwand_istargetcreateable()
{
if(! GetIsObjectValid(oMyTarget)) { return FALSE; }
int nTargetType = GetObjectType(oMyTarget);
return ((nTargetType == OBJECT_TYPE_ITEM) || (nTargetType == OBJECT_TYPE_PLACEABLE) || (nTargetType == OBJECT_TYPE_CREATURE));
}
int dmwand_istargetdestroyable()
{
if(! GetIsObjectValid(oMyTarget)) { return FALSE; }
int nTargetType = GetObjectType(oMyTarget);
if(! GetIsPC(oMyTarget))
{
return ((nTargetType == OBJECT_TYPE_ITEM) || (nTargetType == OBJECT_TYPE_PLACEABLE) || (nTargetType == OBJECT_TYPE_CREATURE));
}
return FALSE;
}
int dmwand_istargetinvalid()
{
return !GetIsObjectValid(oMyTarget);
}
int dmwand_istargetinventory()
{
return (GetIsObjectValid(oMyTarget) && GetHasInventory(oMyTarget));
}
int dmwand_istargetnotme()
{
return (GetIsObjectValid(oMyTarget) && (oMySpeaker != oMyTarget));
}
int dmwand_istargetpcornpc()
{
return (GetIsObjectValid(oMyTarget) && GetAbilityScore(oMyTarget, ABILITY_CONSTITUTION));
}
int dmwand_istargetnpc()
{
return (dmwand_istargetpcornpc() && (! GetIsPC(oMyTarget)));
}
int dmwand_istargetpc()
{
return (GetIsObjectValid(oMyTarget) && GetIsPC(oMyTarget));
}
int dmwand_istargetpcnme()
{
return (GetIsObjectValid(oMyTarget) && GetIsPC(oMyTarget) && (oMySpeaker != oMyTarget));
}
int dmwand_istargetpcornpcnme()
{
return (dmwand_istargetpcornpc() && (oMySpeaker != oMyTarget));
}
int dmwand_istargetplaceable()
{
if(! GetIsObjectValid(oMyTarget)) { return FALSE; }
int nTargetType = GetObjectType(oMyTarget);
return (nTargetType == OBJECT_TYPE_PLACEABLE);
}
int dmw_conv_Start(int nCurrent, int nChoice, string sParams = "")
{
string sText = "";
string sCall = "";
string sCallParams = "";
switch(nCurrent)
{
case 0:
nCurrent = 0;
sText = "Welcome to the Server tool: This will allow you to find any player to perform simple functions.";
sCall = "";
sCallParams = "";
break;
case 1:
nCurrent = 1;
if(dmwand_istargetpcnme())
{
sText = "Penguin this player.";
sCall = "func_Toad";
sCallParams = "";
break;
}
case 2:
nCurrent = 2;
if(dmwand_istargetpcnme())
{
sText = "Unpenguin this player.";
sCall = "func_Untoad";
sCallParams = "";
break;
}
case 3:
nCurrent = 3;
if(dmwand_istargetpcnme())
{
sText = "Boot this player.";
sCall = "func_KickPC";
sCallParams = "";
break;
}
case 4:
nCurrent = 4;
if(dmwand_istargetinvalid())
{
sText = "List all players...";
sCall = "conv_ListPlayers";
sCallParams = "func_PlayerListConv";
break;
}
case 5:
nCurrent = 5;
if(dmwand_istargetpcnme())
{
sText = "Jump this player to my location.";
sCall = "func_JumpPlayerHere";
sCallParams = "";
break;
}
case 6:
nCurrent = 6;
if(dmwand_istargetpcnme())
{
sText = "Jump me to this player's location.";
sCall = "func_JumpToPlayer";
sCallParams = "";
break;
}
case 7:
nCurrent = 7;
if(dmwand_istargetpcnme())
{
sText = "Jump this player's party to my location.";
sCall = "func_JumpPartyHere";
sCallParams = "";
break;
}
default:
nCurrent = 0;
sText = "";
sCall = "";
sCallParams = "";
break;
}
SetLocalString(oMySpeaker, "dmw_dialog" + IntToString(nChoice), sText);
SetLocalString(oMySpeaker, "dmw_function" + IntToString(nChoice), sCall);
SetLocalString(oMySpeaker, "dmw_params" + IntToString(nChoice), sCallParams);
return nCurrent;
}
int dmwand_BuildConversationDialog(int nCurrent, int nChoice, string sConversation, string sParams)
{
if(TestStringAgainstPattern(sConversation, "Start"))
{
return dmw_conv_Start(nCurrent, nChoice, sParams);
}
return FALSE;
}
void dmwand_BuildConversation(string sConversation, string sParams)
{
int nLast;
int nTemp;
int nChoice = 1;
int nCurrent = 1;
int nMatch;
if(TestStringAgainstPattern(sParams, "prev"))
{
//Get the number choice to start with
nCurrent = GetLocalInt(oMySpeaker, "dmw_dialogprev");
//Since we're going to the previous page, there will be a next
SetLocalString(oMySpeaker, "dmw_dialog9", "Next ->");
SetLocalString(oMySpeaker, "dmw_function9", "conv_" + sConversation);
SetLocalString(oMySpeaker, "dmw_params9", "next");
SetLocalInt(oMySpeaker, "dmw_dialognext", nCurrent);
nChoice = 8;
for(;nChoice >= 0; nChoice--)
{
int nTemp1 = nCurrent;
int nTemp2 = nCurrent;
nMatch = nTemp2;
while((nCurrent == nMatch) && (nTemp2 > 0))
{
nTemp2--;
nMatch = dmwand_BuildConversationDialog(nTemp2, nChoice, sConversation, sParams);
}
if(nTemp2 <= 0)
{
//we went back too far for some reason, so make this choice blank
SetLocalString(oMySpeaker, "dmw_dialog" + IntToString(nChoice), "");
SetLocalString(oMySpeaker, "dmw_function" + IntToString(nChoice), "");
SetLocalString(oMySpeaker, "dmw_params" + IntToString(nChoice), "");
}
nLast = nTemp;
nTemp = nTemp1;
nTemp1 = nMatch;
nCurrent = nMatch;
}
if(nMatch > 0)
{
SetLocalString(oMySpeaker, "dmw_dialog1", "<- previous");
SetLocalString(oMySpeaker, "dmw_function1", "conv_" + sConversation);
SetLocalString(oMySpeaker, "dmw_params1", "prev");
SetLocalInt(oMySpeaker, "dmw_dialogprev", nLast);
}
//fill the NPC's dialog spot
//(saved for last because the build process tromps on it)
dmwand_BuildConversationDialog(0, 0, sConversation, sParams);
}
else
{
//fill the NPC's dialog spot
dmwand_BuildConversationDialog(0, 0, sConversation, sParams);
//No parameters specified, start at the top of the conversation
if(sParams == "")
{
nChoice = 1;
nCurrent = 1;
}
//A "next->" choice was selected
if(TestStringAgainstPattern(sParams, "next"))
{
//get the number choice to start with
nCurrent = GetLocalInt(oMySpeaker, "dmw_dialognext");
//set this as the number for the "previous" choice to use
SetLocalInt(oMySpeaker, "dmw_dialogprev", nCurrent);
//Set the first dialog choice to be "previous"
nChoice = 2;
SetLocalString(oMySpeaker, "dmw_dialog1", "<- Previous");
SetLocalString(oMySpeaker, "dmw_function1", "conv_" + sConversation);
SetLocalString(oMySpeaker, "dmw_params1", "prev");
}
//Loop through to build the dialog list
for(;nChoice <= 10; nChoice++)
{
nMatch = dmwand_BuildConversationDialog(nCurrent, nChoice, sConversation, sParams);
//nLast will be the value of the choice before the last one
nLast = nTemp;
nTemp = nMatch;
if(nMatch > 0) { nCurrent = nMatch; }
if(nMatch == 0) { nLast = 0; }
nCurrent++;
}
//If there were enough choices to fill 10 spots, make spot 9 a "next"
if(nLast > 0)
{
SetLocalString(oMySpeaker, "dmw_dialog9", "Next ->");
SetLocalString(oMySpeaker, "dmw_function9", "conv_" + sConversation);
SetLocalString(oMySpeaker, "dmw_params9", "next");
SetLocalInt(oMySpeaker, "dmw_dialognext", nLast);
}
}
}
void dmwand_StartConversation()
{
if(! GetIsObjectValid(oMySpeaker))
{
return;
}
dmwand_BuildConversation("Start", "");
}
int StartingConditional()
{
object oPC = GetPCSpeaker();
int nMyNum = 0;
DeleteLocalInt(oPC, "Tens");
DeleteLocalInt(oPC, "dmfi_univ_offset");
SetLocalInt(OBJECT_SELF, "dmfi_dmwOffset", 1);
//Check whether this conversation has been started already, start it if not.
int nStarted = GetLocalInt(oMySpeaker, "dmw_started");
if(! nStarted)
{
SetLocalInt(oMySpeaker, "dmw_started", 1);
dmwand_StartConversation();
}
string sMyString = GetLocalString(oMySpeaker, "dmw_dialog" + IntToString(nMyNum));
if(sMyString == "")
{
return FALSE;
}
else if (GetLocalString(oPC, "dmfi_univ_conv") == "server")
{
SetCustomToken(DMW_START_CUSTOM_TOKEN + nMyNum, sMyString);
return TRUE;
}
else
return FALSE;
}

View File

@@ -0,0 +1,65 @@
//::///////////////////////////////////////////////
//:: Default On Heartbeat
//:: NW_C2_DEFAULT1
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
This script will have people perform default
animations.
*/
//:://////////////////////////////////////////////
//:: Created By: Preston Watamaniuk
//:: Created On: Nov 23, 2001
//:://////////////////////////////////////////////
#include "NW_I0_GENERIC"
void main()
{
object oFollow = GetLocalObject(OBJECT_SELF, "dmfi_follow");
int iLoiter = GetLocalInt(OBJECT_SELF, "dmfi_Loiter");
// Will fire ONE time only - makes the thing hard to see
if (!GetLocalInt(OBJECT_SELF, "hls_invis"))
{
SetListenPattern(OBJECT_SELF, "**", 20600); //listen to all text
SetLocalInt(OBJECT_SELF, "hls_Listening", 1); //listen to all text
SetListening(OBJECT_SELF, TRUE); //be sure NPC is listening
//leave it here rather than add the one time loop to EVERY creature through a OS script change
ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectVisualEffect(VFX_DUR_CUTSCENE_INVISIBILITY), OBJECT_SELF);
ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectCutsceneGhost(), OBJECT_SELF);
SetLocalInt(OBJECT_SELF, "hls_invis",1);
}
if (GetIsObjectValid(oFollow))
{
if (GetArea(oFollow)==GetArea(OBJECT_SELF))
{
AssignCommand(OBJECT_SELF, ClearAllActions(TRUE));
AssignCommand(OBJECT_SELF, ActionForceFollowObject(oFollow));
}
else
{
AssignCommand(OBJECT_SELF, ClearAllActions(TRUE));
AssignCommand(OBJECT_SELF, ActionJumpToObject(oFollow));
AssignCommand(OBJECT_SELF, ActionForceFollowObject(oFollow));
}
}
// If just following and listening, then return.
if (!iLoiter)
return;
// If in loiter mode, look for a PC and make the announcement when appropraite
object oPC = GetFirstObjectInShape(SHAPE_SPHERE, 10.0f, GetLocation(OBJECT_SELF), TRUE);
while(GetIsObjectValid(oPC))
{
if (GetIsPC(oPC) &&
!GetIsDM(oPC) &&
iLoiter)
{
SpeakString(GetLocalString(OBJECT_SELF, "dmfi_LoiterSay"));
DestroyObject(OBJECT_SELF);
}
oPC = GetNextObjectInShape(SHAPE_SPHERE, 10.0f, GetLocation(OBJECT_SELF), TRUE);
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,75 @@
#include "fcb_inc_vars"
#include "fcb_inc_cvdisp"
//==========================================/
void main()
//==========================================/
{
string CMD_TXT_QUOTE = GetLocalString(FCB_HOST, CMD_QUOTE);
string BULLET_POINT = c_hid("**");
string SETCOLOR = CMD_TXT_QUOTE + "setcolor" + CMD_TXT_QUOTE;
string CONCAT = CMD_TXT_QUOTE + "concat" + CMD_TXT_QUOTE;
string SETCGRD = CMD_TXT_QUOTE + "setcgrd" + CMD_TXT_QUOTE;
string temp0 = set_string_color("setcolor(" + CMD_TXT_QUOTE + "Apple" + CMD_TXT_QUOTE + ", 255, 0, 0)", 0, 200, 200);
string temp1 = set_string_color("setcolor(" + CMD_TXT_QUOTE + "Orange" + CMD_TXT_QUOTE + ", 220, 140, 50)", 0, 200, 200);
string temp2 = set_string_color("setcgrd(" + CMD_TXT_QUOTE + "Evil Looki" + CMD_TXT_QUOTE + ", 200, 0, 0, 0, 0, 0)", 0, 200, 200);
string temp3 = set_string_color("setcgrd(" + CMD_TXT_QUOTE + "ng Club +4" + CMD_TXT_QUOTE + ", 0, 0, 0, 200, 0, 0)", 0, 200, 200);
string disp_txt =
BULLET_POINT + "NOTE: This guide will cover the various uses of custom colors in item name text. To use default white text simply type the desired name as is in the chat bar and hit enter to procede." + UI_TXT_INDENT2 +
c_hlt2("--==== Part I: Using " + SETCOLOR + " ====--") + UI_TXT_INDENT2 +
"IGIPE provides an easy method for setting item names in various colored text. To do this first go back to main menu and select " + CMD_TXT_QUOTE + UI_TXT_SETNAME_ENTER + CMD_TXT_QUOTE + ". The following message will be displayed:" + UI_TXT_INDENT2 +
c_hdr1(UI_TXT_SETNAME_NONE) + UI_TXT_INDENT2 +
BULLET_POINT + "Enter the following command in the chat bar:" + UI_TXT_INDENT +
c_hlt1("%setcolor(" + CMD_TXT_QUOTE + "item_name" + CMD_TXT_QUOTE + ", rval, gval, bval)") + UI_TXT_INDENT +
"where rval, gval and bval correspond to red, green and blue intensities respectively on a scale of 0 to 255." + UI_TXT_INDENT2 +
"Examples:" + UI_TXT_INDENT +
c_hlt1("%setcolor(" + CMD_TXT_QUOTE + "Bloody Dagger" + CMD_TXT_QUOTE + ", 255, 0, 0)") + UI_TXT_INDENT +
"will show up as " + set_string_color("Bloody Dagger", 260, 0, 0) + UI_TXT_INDENT +
c_hlt1("%setcolor(" + CMD_TXT_QUOTE + "Banana Kukri" + CMD_TXT_QUOTE + ", 255, 255, 0)") + UI_TXT_INDENT +
"will show up as " + set_string_color("Banana Kukri", 260, 260, 0) + UI_TXT_INDENT2 +
c_hlt2("--==== Part II: Using " + CONCAT + " ====--") + UI_TXT_INDENT2 +
"The " + CONCAT + " function connects multiple strings together to create one string." + UI_TXT_INDENT2 +
"For example:" + UI_TXT_INDENT +
c_hlt1("%concat(" + CMD_TXT_QUOTE + "Apple" + CMD_TXT_QUOTE + ", " + CMD_TXT_QUOTE + "Orange" + CMD_TXT_QUOTE + ")") + UI_TXT_INDENT +
"will show up as AppleOrange, which is actually just the same as having entered " + CMD_TXT_QUOTE + "AppleOrange" + CMD_TXT_QUOTE + "." + UI_TXT_INDENT2 +
"So what is the point of this?" + UI_TXT_INDENT2 +
BULLET_POINT + "This function is useful for nesting " + SETCOLOR + " as follows:" + UI_TXT_INDENT +
c_hlt1("%concat(") + temp0 + c_hlt1(", ") + temp1 + c_hlt1(")") + UI_TXT_INDENT +
"which shows up as " + set_string_color("Apple", 260, 0, 0) + set_string_color("Orange", 220, 140, 50) + "." + UI_TXT_INDENT2 +
BULLET_POINT + "Note that any number of strings may be connected together using " + CONCAT + ". Each string should be seperated by a comma as follows:" + UI_TXT_INDENT +
c_hlt1("%concat(" + CMD_TXT_QUOTE + "s0" + CMD_TXT_QUOTE + ", " + CMD_TXT_QUOTE + "s1" + CMD_TXT_QUOTE + ", " + CMD_TXT_QUOTE + "s2" + CMD_TXT_QUOTE + ", ... , " + CMD_TXT_QUOTE + "sn" + CMD_TXT_QUOTE + ")") + UI_TXT_INDENT2 +
c_hlt2("--==== Part III: Using " + SETCGRD + " ====--") + UI_TXT_INDENT2 +
"The " + SETCGRD + " function generates a color gradation from one color to another as follows:" + UI_TXT_INDENT +
set_gradation("Elite Banana Kukri +13", 260, 260, 0, 260, 260, 260) + UI_TXT_INDENT2 +
BULLET_POINT + "The following command is used:" + UI_TXT_INDENT +
c_hlt1("%setcgrd(" + CMD_TXT_QUOTE + "item_name" + CMD_TXT_QUOTE + ", r1, g1, b1, r2, g2, b2)") + UI_TXT_INDENT +
"where r1, g1, b1 correspond to the RGB values (0-255) of the left most color and r2, g2, b2 correspond to the RGB values (0-255) of the right most color." + UI_TXT_INDENT2 +
"For example:" + UI_TXT_INDENT +
c_hlt1("%setcgrd(" + CMD_TXT_QUOTE + "Evil Looking Club +4" + CMD_TXT_QUOTE + ", 200, 0, 0, 0, 0, 0)") + UI_TXT_INDENT +
"will show up as " + set_gradation("Evil Looking Club +4", 200, 0, 0, 0, 0, 0) + UI_TXT_INDENT2 +
"Finally, mixing with " + CONCAT + " as follows:" + UI_TXT_INDENT +
c_hlt1("%concat(") + temp2 + c_hlt1(", ") + temp3 + c_hlt1(")") + UI_TXT_INDENT +
"will show up as " + set_gradation("Evil Looki", 200, 0, 0, 0, 0, 0) + set_gradation("ng Club +4", 0, 0, 0, 200, 0, 0) + UI_TXT_INDENT2 +
c_hlt2("--==== Some Comments ====--") + UI_TXT_INDENT2 +
BULLET_POINT + "Color accuracy in IGIPE is VERY POOR to NON-EXSISTENT. The above functions all work on a scale of 0 to 255 but there are actually only about 17 values per color channel." + UI_TXT_INDENT2 +
"";
//--------------------------------------/
ui_set_active_disp_index();
ui_disp_set_txt(DISP_INDEX_LOCAL1, "", disp_txt);
ui_disp_state_new(DISP_INDEX_LOCAL1, 1);
}

82
_module/nss/fcb__cv.nss Normal file
View File

@@ -0,0 +1,82 @@
#include "fcb_inc_vars"
#include "fcb_inc_cvgen"
#include "fcb_inc_cvdisp"
#include "fcb_inc_general"
#include "fcb_inc_parser"
#include "fcb_inc_typespec"
//==========================================/
void main()
//==========================================/
{
object user = GetLastSpeaker();
switch(GetListenPatternNumber())
{
case LISTEN_NUMBER_STANDARD:
{
//user filtering
if(user == GetLocalObject(FCB_HOST, USER))
{
if(IsInConversation(FCB_CV))
{
string input = parse_init(GetMatchedSubstring(0));
//--------------------------------------/
switch(FILTER_F100 & GetLocalInt(FCB_HOST, SCRIPT_PARAM))
{
//--------------------------------------/
case SCRIPT_INDEX_LISTEN_SETNAME:
{
ui_disp_set_txt(DISP_INDEX_LOCAL1, UI_TXT_SETNAME_ENTERED, input);
SetLocalString(FCB_HOST, SETNAME_SEL, input);
ui_main_set_hidden_refresh(MAIN_FOLDER_INDEX_SETNAME | 1, 0);
ui_main_set_hidden_refresh(MAIN_FOLDER_INDEX_SETNAME | 2, 0);
ui_main_set_hidden_refresh(MAIN_FOLDER_INDEX_SETNAME | 3, 0);
ui_disp_refresh_txt();
//clear script number
clear_script_param();
start_conversation(user);
break;
}
}
}
}
break;
}
default:
{
object item_sel = GetFirstItemInInventory(EXT_PLACEABLE);
if(GetIsObjectValid(item_sel)
&& !GetIsObjectValid(GetNextItemInInventory(EXT_PLACEABLE)))
{
SetLocalObject(FCB_HOST, USER, user);
ui_main_initialize(MAIN_FOLDER_INDEX_MAINMENU);
ui_set_active_disp_index(DISP_INDEX_HEADER);
select_working_item(item_sel);
ui_disp_refresh_txt();
start_conversation(user);
disp_delayed_msg(user, UI_TXT_EXT_INFO);
}
else
{
//SpeakString(c_crs(UI_TXT_EXT_INVALID)); //red
SpeakString(UI_TXT_EXT_INVALID); //normal color
}
break;
}
}
}

644
_module/nss/fcb__main.nss Normal file
View File

@@ -0,0 +1,644 @@
#include "fcb_inc_vars"
#include "fcb_inc_cvgen"
#include "fcb_inc_cvdisp"
#include "fcb_inc_general"
#include "fcb_inc_typespec"
//==========================================/
void main()
//==========================================/
{
int script_param = GetLocalInt(FCB_HOST, SCRIPT_PARAM);
int stack_index_sel = FILTER_F1 & script_param;
int stack_param = GetLocalInt(FCB_HOST, STACK_PARAM_ + IntToHexString(stack_index_sel));
object user = GetLocalObject(FCB_HOST, USER);
//--------------------------------------/
switch(FILTER_F100 & script_param)
{
//--------------------------------------/
case SCRIPT_INDEX_IPRP_SEL_0:
{
int folder_index_iprp = MAIN_FOLDER_INDEX_IPRP;
int param0 = 0; //main
int param1 = 0; //subtype
int param2 = 0; //cost
int param3 = 0; //param1
string iprp_txt = "";
int file_dir_0 = FILTER_F11 & GetLocalInt(FCB_HOST, STACK_PARAM_ + IntToHexString(stack_index_sel));
//--------------------------------------/
if((FILTER_F10 & file_dir_0) == folder_index_iprp)
{
param0 = GetLocalInt(FCB_HOST, MAIN_FILE_PARAM_ + IntToHexString(file_dir_0));
//--------------------------------------/
iprp_txt = GetStringByStrRef(StringToInt(Get2DAString("itempropdef", "GameStrRef", param0)));
//--------------------------------------/
}
else
{
int file_dir_1 = FILTER_F11 & GetLocalInt(FCB_HOST, STACK_PARAM_ + IntToHexString(stack_index_sel-1));
if((FILTER_F10 & file_dir_1) == folder_index_iprp)
{
param0 = GetLocalInt(FCB_HOST, MAIN_FILE_PARAM_ + IntToHexString(file_dir_1));
param1 = GetLocalInt(FCB_HOST, MAIN_FILE_PARAM_ + IntToHexString(file_dir_0));
//--------------------------------------/
iprp_txt = GetStringByStrRef(StringToInt(Get2DAString("itempropdef", "GameStrRef", param0)));
if(file_dir_0 > 0)
{
iprp_txt += UI_TXT_SPACE + GetLocalString(FCB_HOST, MAIN_FILE_NAME_ + IntToHexString(file_dir_0));
}
//--------------------------------------/
}
else
{
int file_dir_2 = FILTER_F11 & GetLocalInt(FCB_HOST, STACK_PARAM_ + IntToHexString(stack_index_sel-2));
if((FILTER_F10 & file_dir_2) == folder_index_iprp)
{
param0 = GetLocalInt(FCB_HOST, MAIN_FILE_PARAM_ + IntToHexString(file_dir_2));
param1 = GetLocalInt(FCB_HOST, MAIN_FILE_PARAM_ + IntToHexString(file_dir_1));
param2 = GetLocalInt(FCB_HOST, MAIN_FILE_PARAM_ + IntToHexString(file_dir_0));
//--------------------------------------/
iprp_txt = GetStringByStrRef(StringToInt(Get2DAString("itempropdef", "GameStrRef", param0)));
if(file_dir_1 > 0)
{
iprp_txt += UI_TXT_SPACE + GetLocalString(FCB_HOST, MAIN_FILE_NAME_ + IntToHexString(file_dir_1));
}
if(file_dir_0 > 0)
{
iprp_txt += UI_TXT_SPACE + GetLocalString(FCB_HOST, MAIN_FILE_NAME_ + IntToHexString(file_dir_0));
}
//--------------------------------------/
}
else
{
int file_dir_3 = FILTER_F11 & GetLocalInt(FCB_HOST, STACK_PARAM_ + IntToHexString(stack_index_sel-3));
if((FILTER_F10 & file_dir_3) == folder_index_iprp)
{
param0 = GetLocalInt(FCB_HOST, MAIN_FILE_PARAM_ + IntToHexString(file_dir_3));
param1 = GetLocalInt(FCB_HOST, MAIN_FILE_PARAM_ + IntToHexString(file_dir_2));
param2 = GetLocalInt(FCB_HOST, MAIN_FILE_PARAM_ + IntToHexString(file_dir_1));
param3 = GetLocalInt(FCB_HOST, MAIN_FILE_PARAM_ + IntToHexString(file_dir_0));
//--------------------------------------/
iprp_txt = GetStringByStrRef(StringToInt(Get2DAString("itempropdef", "GameStrRef", param0)));
if(file_dir_2 > 0)
{
iprp_txt += UI_TXT_SPACE + GetLocalString(FCB_HOST, MAIN_FILE_NAME_ + IntToHexString(file_dir_2));
}
if(file_dir_1 > 0)
{
iprp_txt += UI_TXT_SPACE + GetLocalString(FCB_HOST, MAIN_FILE_NAME_ + IntToHexString(file_dir_1));
}
if(file_dir_0 > 0)
{
iprp_txt += UI_TXT_SPACE + GetLocalString(FCB_HOST, MAIN_FILE_NAME_ + IntToHexString(file_dir_0));
}
//--------------------------------------/
}
}
}
}
SetLocalString(FCB_HOST, IPRP_SEL_TXT, iprp_txt);
object item = get_working_item();
object item_copy = copy_item(item, FCB_INV);
itemproperty iprp = convert_iprp(param0, param1, param2, param3);
AddItemProperty(DURATION_TYPE_PERMANENT, iprp, item_copy);
//--------------------------------------/
//check cost and ILR restriction
int mod_enable = 1;
//--------------------------------------/
int cost = get_item_cost(item_copy) - get_item_cost(item);
int user_gold = GetGold(user);
string cost_disp = IntToString(cost) + UI_TXT_UNIT_GP;
if(cost > user_gold)
{
cost_disp = c_crs(cost_disp + UI_TXT_INDENT + UI_TXT_COST_OUTOFBOUND);
mod_enable = 0;
}
else
{
if(cost <= 0)
{
cost_disp = c_hlt2(cost_disp);
}
}
//--------------------------------------/
int item_level = get_item_level(item);
int item_copy_level = get_item_level(item_copy);
int user_level = get_character_level(user);
string item_copy_level_disp = IntToString(item_copy_level);
if(GetLocalInt(FCB_HOST, SW_ILR_ENABLE)
&& item_copy_level > user_level
&& cost > 0)
{
item_copy_level_disp = c_crs(item_copy_level_disp + UI_TXT_INDENT + UI_TXT_LEVEL_OUTOFBOUND);
mod_enable = 0;
}
//--------------------------------------/
if(mod_enable)
{
SetLocalInt(FCB_HOST, ITEM_WORKING_SEL_MOD_COST, cost);
SetLocalInt(FCB_HOST, IPRP_PARAM_SEL_0_1, (param0 << BITLEN_FILE_1) | param1);
SetLocalInt(FCB_HOST, IPRP_PARAM_SEL_2_3, (param2 << BITLEN_FILE_1) | param3);
ui_main_set_hidden_refresh(MAIN_FOLDER_INDEX_IPRP_MENU | 1, 0);
}
else
{
ui_main_set_hidden_refresh(MAIN_FOLDER_INDEX_IPRP_MENU | 1, 1);
}
//--------------------------------------/
DestroyObject(item_copy);
//--------------------------------------/
iprp_txt += UI_TXT_INDENT + c_hdr1(UI_TXT_COST) + UI_TXT_SPACE + cost_disp + UI_TXT_INDENT + c_hdr1(UI_TXT_LEVEL) + UI_TXT_SPACE + item_copy_level_disp;
/////
//--------------------------------------/
ui_disp_set_txt(DISP_INDEX_LOCAL1, "", c_hdr1(UI_TXT_IPRP_SEL) + UI_TXT_SPACE + iprp_txt);
ui_disp_state_new(DISP_INDEX_LOCAL1, 1);
//--------------------------------------/
break;
}
//--------------------------------------/
case SCRIPT_INDEX_IPRP_SEL_1:
{
//charge player
//--------------------------------------/
int cost = GetLocalInt(FCB_HOST, ITEM_WORKING_SEL_MOD_COST);
DeleteLocalInt(FCB_HOST, ITEM_WORKING_SEL_MOD_COST);
if(give_gold(-cost, user))
{
//--------------------------------------/
int param0_1 = GetLocalInt(FCB_HOST, IPRP_PARAM_SEL_0_1);
int param2_3 = GetLocalInt(FCB_HOST, IPRP_PARAM_SEL_2_3);
itemproperty iprp = convert_iprp(param0_1 >>> BITLEN_FILE_1, FILTER_F1 & param0_1, param2_3 >>> BITLEN_FILE_1, FILTER_F1 & param2_3);
if(GetIsItemPropertyValid(iprp))
{
object item = get_working_item();
iprp_addto(item, iprp);
//--------------------------------------/
ui_disp_clear_local();
}
}
ui_stack_index(1);
visual_effect();
break;
}
//--------------------------------------/
case SCRIPT_INDEX_IPRPR_SEL_0:
{
int stack_index_sel = FILTER_F1 & GetLocalInt(FCB_HOST, STACK_STATE);
int file_dir_sel = FILTER_F11 & stack_param;
string file_name = GetLocalString(FCB_HOST, MAIN_FILE_NAME_ + IntToHexString(file_dir_sel));
object item = get_working_item();
object item_copy = copy_item(GetLocalObject(FCB_HOST, ITEM_WORKING_SEL_BLANK), FCB_INV);
int file_dir_max = GetLocalInt(FCB_HOST, MAIN_FILE_INDEX_ + IntToHexString(FILTER_F10 & file_dir_sel));
int file_dir = (FILTER_F10 & file_dir_sel) | UI_MAIN_DEFAULT_OFFSET;
while(file_dir <= file_dir_max)
{
if(file_dir != file_dir_sel)
{
int file_param = GetLocalInt(FCB_HOST, MAIN_FILE_PARAM_ + IntToHexString(file_dir));
AddItemProperty(DURATION_TYPE_PERMANENT, param_to_iprp(file_param), item_copy);
}
file_dir++;
}
//--------------------------------------/
//check cost and ILR restriction
int mod_enable = 1;
//--------------------------------------/
int cost = get_item_cost(item_copy) - get_item_cost(item);
int user_gold = GetGold(user);
string cost_disp = IntToString(cost) + UI_TXT_UNIT_GP;
if(cost > user_gold)
{
cost_disp = c_crs(cost_disp + UI_TXT_INDENT + UI_TXT_COST_OUTOFBOUND);
mod_enable = 0;
}
else
{
if(cost <= 0)
{
cost_disp = c_hlt2(cost_disp);
}
}
//--------------------------------------/
int item_level = get_item_level(item);
int item_copy_level = get_item_level(item_copy);
int user_level = get_character_level(user);
string item_copy_level_disp = IntToString(item_copy_level);
if(GetLocalInt(FCB_HOST, SW_ILR_ENABLE)
&& item_copy_level > user_level
&& cost > 0)
{
item_copy_level_disp = c_crs(item_copy_level_disp + UI_TXT_INDENT + UI_TXT_LEVEL_OUTOFBOUND);
mod_enable = 0;
}
//--------------------------------------/
if(mod_enable)
{
SetLocalInt(FCB_HOST, ITEM_WORKING_SEL_MOD_COST, cost);
ui_main_set_hidden_refresh(MAIN_FOLDER_INDEX_IPRPR_MENU | 1, 0);
}
else
{
ui_main_set_hidden_refresh(MAIN_FOLDER_INDEX_IPRPR_MENU | 1, 1);
}
//--------------------------------------/
file_name += UI_TXT_INDENT + c_hdr1(UI_TXT_COST) + UI_TXT_SPACE + cost_disp + UI_TXT_INDENT + c_hdr1(UI_TXT_LEVEL) + UI_TXT_SPACE + item_copy_level_disp;
/////
//----------------------------------------//
ui_disp_set_txt(DISP_INDEX_LOCAL1, "", c_hdr1(UI_TXT_IPRPR_SEL) + UI_TXT_SPACE + file_name);
ui_disp_state_new(DISP_INDEX_LOCAL1, 1);
//--------------------------------------/
break;
}
//--------------------------------------/
case SCRIPT_INDEX_IPRPR_SEL_1:
{
//charge player
//--------------------------------------/
int cost = GetLocalInt(FCB_HOST, ITEM_WORKING_SEL_MOD_COST);
//stack: [...][offset: 10][folder_index: 10][selected: 10]
int stack_param_1 = GetLocalInt(FCB_HOST, STACK_PARAM_ + IntToHexString(stack_index_sel-1));
if(give_gold(-cost, user))
{
//--------------------------------------/
object item = get_working_item();
int item_value = cost + get_item_cost(item);
//--------------------------------------/
//set currently selected to 0
SetLocalInt(FCB_HOST, STACK_PARAM_ + IntToHexString(stack_index_sel-1), (FILTER_F110 & stack_param_1));
//--------------------------------------/
int file_dir_sel = FILTER_F11 & stack_param_1;
int file_index_sel = FILTER_F1 & stack_param_1;
int file_index_offset = stack_param_1 >>> BITLEN_FILE_2;
int folder_index = FILTER_F10 & stack_param_1;
int file_index_start = FILTER_F1 & stack_param_1;
int file_type_menu = create_main_file_type_link(SCRIPT_INDEX_IPRPR_SEL_0 | MAIN_FOLDER_INDEX_IPRPR_MENU);
//clear for new entry
//--------------------------------------/
clear_main_folder(file_dir_sel - 1);
int n = 1;
int m = 1;
string iprp_list = "";
itemproperty iprp = GetFirstItemProperty(item);
while(GetIsItemPropertyValid(iprp))
{
if(n != file_index_sel)
{
string iprp_txt = ui_iprp_display(iprp);
if(m > 1)
{
iprp_list += UI_TXT_INDENT + iprp_txt;
}
else
{
iprp_list = iprp_txt;
}
if(file_index_start <= m)
{
create_main_file_int(folder_index, iprp_txt, file_type_menu, iprp_to_param(iprp));
}
m++;
}
else
{
RemoveItemProperty(item, iprp);
}
n++;
iprp = GetNextItemProperty(item);
}
//--------------------------------------/
SetLocalString(FCB_HOST, ITEM_SEL_TXT, iprp_list);
//set disp text
//--------------------------------------/
string item_header = ui_item_header(item, item_value);
ui_disp_set_txt(DISP_INDEX_HEADER, UI_TXT_ITEM_WORKING_CURRENT, item_header);
ui_disp_set_txt(DISP_INDEX_IPRP, UI_TXT_IPRP_CURRENT, iprp_list);
ui_disp_clear_local();
}
ui_stack_index(1);
visual_effect();
break;
}
//--------------------------------------/
case SCRIPT_INDEX_SETNAME_SEL_1:
{
string name = GetLocalString(FCB_HOST, SETNAME_SEL);
object item = set_working_item_name(name);
string item_header = ui_item_header(item);
ui_disp_set_txt(DISP_INDEX_HEADER, UI_TXT_ITEM_WORKING_CURRENT, item_header);
ui_disp_clear_local();
ui_stack_index(0);
visual_effect();
break;
}
//--------------------------------------/
case SCRIPT_INDEX_SETNAME_DEFAULT:
{
string name = GetName(get_working_item(), 1);
SetLocalString(FCB_HOST, SETNAME_SEL, name);
ui_main_set_hidden_refresh(MAIN_FOLDER_INDEX_SETNAME | 1, 0);
ui_main_set_hidden_refresh(MAIN_FOLDER_INDEX_SETNAME | 2, 0);
ui_main_set_hidden_refresh(MAIN_FOLDER_INDEX_SETNAME | 3, 1);
ui_disp_set_txt(DISP_INDEX_LOCAL1, UI_TXT_SETNAME_ENTERED, name);
ui_disp_state_new(DISP_INDEX_LOCAL1, 1);
break;
}
//--------------------------------------/
case SCRIPT_INDEX_CHARGE_SEL_0:
{
object item = get_working_item();
object item_copy = copy_item(item, FCB_INV);
int chcnt = GetLocalInt(FCB_HOST, MAIN_FILE_PARAM_ + IntToHexString(FILTER_F11 & stack_param));
SetItemCharges(item_copy, chcnt);
string charge_txt = IntToString(chcnt);
//--------------------------------------/
//check cost and ILR restriction
int mod_enable = 1;
//--------------------------------------/
int cost = get_item_cost(item_copy) - get_item_cost(item);
int user_gold = GetGold(user);
string cost_disp = IntToString(cost) + UI_TXT_UNIT_GP;
if(cost > user_gold)
{
cost_disp = c_crs(cost_disp + UI_TXT_INDENT + UI_TXT_COST_OUTOFBOUND);
mod_enable = 0;
}
else
{
if(cost <= 0)
{
cost_disp = c_hlt2(cost_disp);
}
}
//--------------------------------------/
int item_level = get_item_level(item);
int item_copy_level = get_item_level(item_copy);
int user_level = get_character_level(user);
string item_copy_level_disp = IntToString(item_copy_level);
if(GetLocalInt(FCB_HOST, SW_ILR_ENABLE)
&& item_copy_level > user_level
&& cost > 0)
{
item_copy_level_disp = c_crs(item_copy_level_disp + UI_TXT_INDENT + UI_TXT_LEVEL_OUTOFBOUND);
mod_enable = 0;
}
//--------------------------------------/
if(mod_enable)
{
SetLocalInt(FCB_HOST, ITEM_WORKING_SEL_MOD_COST, cost);
SetLocalInt(FCB_HOST, CHARGE_SEL, FILTER_F11 & chcnt);
ui_main_set_hidden_refresh(MAIN_FOLDER_INDEX_CHARGE_MENU | 1, 0);
}
else
{
ui_main_set_hidden_refresh(MAIN_FOLDER_INDEX_CHARGE_MENU | 1, 1);
}
//--------------------------------------/
charge_txt += UI_TXT_INDENT + c_hdr1(UI_TXT_COST) + UI_TXT_SPACE + cost_disp + UI_TXT_INDENT + c_hdr1(UI_TXT_LEVEL) + UI_TXT_SPACE + item_copy_level_disp;
/////
//--------------------------------------/
DestroyObject(item_copy);
//--------------------------------------/
ui_disp_set_txt(DISP_INDEX_LOCAL1, "", c_hdr1(UI_TXT_CHARGE_SEL) + UI_TXT_SPACE + charge_txt);
ui_disp_state_new(DISP_INDEX_LOCAL1, 1);
//--------------------------------------/
break;
}
//--------------------------------------/
case SCRIPT_INDEX_CHARGE_SEL_1:
{
//charge player
//--------------------------------------/
int cost = GetLocalInt(FCB_HOST, ITEM_WORKING_SEL_MOD_COST);
DeleteLocalInt(FCB_HOST, ITEM_WORKING_SEL_MOD_COST);
if(give_gold(-cost, user))
{
//--------------------------------------/
int chcnt = GetLocalInt(FCB_HOST, CHARGE_SEL);
object item = get_working_item();
SetItemCharges(item, chcnt);
string item_header = ui_item_header(item);
//--------------------------------------/
ui_disp_set_txt(DISP_INDEX_HEADER, UI_TXT_ITEM_WORKING_CURRENT, item_header);
ui_disp_clear_local();
}
ui_stack_index(0);
visual_effect();
break;
}
//--------------------------------------/
case SCRIPT_INDEX_DUPE_SEL_0:
{
object item = get_working_item();
//--------------------------------------/
int cost = get_item_cost(item);
string cost_disp = IntToString(cost) + UI_TXT_UNIT_GP;
if(cost > GetGold(user))
{
cost_disp = c_crs(cost_disp + UI_TXT_INDENT + UI_TXT_COST_OUTOFBOUND);
ui_main_set_hidden_refresh(MAIN_FOLDER_INDEX_DUPE | 1, 1);
}
else
{
if(cost <= 0)
{
cost_disp = c_hlt2(cost_disp);
}
SetLocalInt(FCB_HOST, ITEM_WORKING_SEL_MOD_COST, cost);
ui_main_set_hidden_refresh(MAIN_FOLDER_INDEX_DUPE | 1, 0);
}
string disp_txt = c_hdr1(UI_TXT_DUPE_COST) + UI_TXT_SPACE + cost_disp;
//--------------------------------------/
ui_disp_set_txt(DISP_INDEX_LOCAL1, "", disp_txt);
ui_disp_state_new(DISP_INDEX_LOCAL1, 1);
break;
}
//--------------------------------------/
case SCRIPT_INDEX_DUPE_SEL_1:
{
//charge player
//--------------------------------------/
int cost = GetLocalInt(FCB_HOST, ITEM_WORKING_SEL_MOD_COST);
DeleteLocalInt(FCB_HOST, ITEM_WORKING_SEL_MOD_COST);
if(give_gold(-cost, user))
{
copy_item(get_working_item(), user);
//--------------------------------------/
ui_disp_clear_local();
}
ui_stack_index(0);
visual_effect();
break;
}
//--------------------------------------/
case SCRIPT_INDEX_COLORGUIDE:
{
ExecuteScript("fcb__colorguide", FCB_HOST);
break;
}
//--------------------------------------/
//--------------------------------------/
//--------------------------------------/
case SCRIPT_INDEX_DISP_IPRP:
{
ui_set_active_disp_index(DISP_INDEX_IPRP);
break;
}
//--------------------------------------/
case SCRIPT_INDEX_DISP_HEADER:
{
ui_set_active_disp_index(DISP_INDEX_HEADER);
break;
}
//--------------------------------------/
case SCRIPT_INDEX_DISP_BLANK:
{
ui_set_active_disp_index();
break;
}
//--------------------------------------/
//--------------------------------------/
//--------------------------------------/
case SCRIPT_INDEX_LISTEN_SETNAME:
{
ui_set_active_disp_index(DISP_INDEX_HEADER);
ui_main_set_hidden_refresh(MAIN_FOLDER_INDEX_SETNAME | 1, 1);
ui_main_set_hidden_refresh(MAIN_FOLDER_INDEX_SETNAME | 2, 1);
ui_main_set_hidden_refresh(MAIN_FOLDER_INDEX_SETNAME | 3, 0);
ui_disp_set_txt(DISP_INDEX_LOCAL1, UI_TXT_SETNAME_NONE);
ui_disp_state_new(DISP_INDEX_LOCAL1, 1);
break;
}
}
}

View File

@@ -0,0 +1,392 @@
#include "fcb_inc_prot"
//==========================================/
//create all
//==========================================/
//==========================================/
void array_main()
//==========================================/
{
//2DA file rows that will be read
//range: [lower bound 31:16][upper bound 15:0]
//invalid rows may be included - they are skipped during read.
SetLocalInt(FCB_HOST, "IPRP_ABILITIES_0", 5);
SetLocalInt(FCB_HOST, "IPRP_ACMODTYPE_0", 4);
SetLocalInt(FCB_HOST, "IPRP_ALIGNGRP_0", 5);
SetLocalInt(FCB_HOST, "IPRP_ALIGNMENT_0", 8);
SetLocalInt(FCB_HOST, "IPRP_AMMOCOST_0", 15);
SetLocalInt(FCB_HOST, "IPRP_AMMOTYPE_0", 2);
SetLocalInt(FCB_HOST, "IPRP_AMOUNT_0", 4);
SetLocalInt(FCB_HOST, "IPRP_ARCSPELL_0", 19);
//SetLocalInt(FCB_HOST, "IPRP_BASE1_0", 0);
SetLocalInt(FCB_HOST, "IPRP_BLADECOST_0", 5);
SetLocalInt(FCB_HOST, "IPRP_BONUSCOST_0", 12);
SetLocalInt(FCB_HOST, "IPRP_CHARGECOST_0", 13);
SetLocalInt(FCB_HOST, "IPRP_COLOR_0", 6);
SetLocalInt(FCB_HOST, "IPRP_COMBATDAM_0", 2);
SetLocalInt(FCB_HOST, "IPRP_COSTTABLE_0", 27);
SetLocalInt(FCB_HOST, "IPRP_DAMAGECOST_0", 30);
SetLocalInt(FCB_HOST, "IPRP_DAMAGECOST_1", 71 << BITLEN_2DA_RANGE | 80); //PRC
SetLocalInt(FCB_HOST, "IPRP_DAMAGETYPE_0", 14); //13
SetLocalInt(FCB_HOST, "IPRP_DAMVULCOST_0", 7);
SetLocalInt(FCB_HOST, "IPRP_FEATS_0", 39);
SetLocalInt(FCB_HOST, "IPRP_FEATS_1", 250 << BITLEN_2DA_RANGE | 254); //PRC
SetLocalInt(FCB_HOST, "IPRP_FEATS_2", 271 << BITLEN_2DA_RANGE | 385); //PRC
SetLocalInt(FCB_HOST, "IPRP_FEATS_3", 399 << BITLEN_2DA_RANGE | 570); //PRC
SetLocalInt(FCB_HOST, "IPRP_IMMUNCOST_0", 7);
SetLocalInt(FCB_HOST, "IPRP_IMMUNITY_0", 9);
SetLocalInt(FCB_HOST, "IPRP_KITCOST_0", 50);
SetLocalInt(FCB_HOST, "IPRP_LIGHTCOST_0", 4);
SetLocalInt(FCB_HOST, "IPRP_MELEECOST_0", 20);
SetLocalInt(FCB_HOST, "IPRP_MONSTCOST_0", 58);
SetLocalInt(FCB_HOST, "IPRP_MONSTERHIT_0", 9);
SetLocalInt(FCB_HOST, "IPRP_NEG10COST_0", 10);
SetLocalInt(FCB_HOST, "IPRP_NEG5COST_0", 10); //PRC 10
SetLocalInt(FCB_HOST, "IPRP_ONHIT_0", 25);
SetLocalInt(FCB_HOST, "IPRP_ONHITCOST_0", 70); //PRC 70
SetLocalInt(FCB_HOST, "IPRP_ONHITDUR_0", 4); //PRC 20
SetLocalInt(FCB_HOST, "IPRP_ONHITDUR_1", 20 << BITLEN_2DA_RANGE | 20);
SetLocalInt(FCB_HOST, "IPRP_ONHITSPELL_0", 140); //PRC 202
SetLocalInt(FCB_HOST, "IPRP_ONHITSPELL_1", 200 << BITLEN_2DA_RANGE | 202);
SetLocalInt(FCB_HOST, "IPRP_PARAMTABLE_0", 11);
SetLocalInt(FCB_HOST, "IPRP_POISON_0", 5);
SetLocalInt(FCB_HOST, "IPRP_PROTECTION_0", 19);
SetLocalInt(FCB_HOST, "IPRP_REDCOST_0", 5);
SetLocalInt(FCB_HOST, "IPRP_RESISTCOST_0", 10); //PRC 20
SetLocalInt(FCB_HOST, "IPRP_RESISTCOST_1", 20 << BITLEN_2DA_RANGE | 20);
SetLocalInt(FCB_HOST, "IPRP_SAVEELEMENT_0", 21);
SetLocalInt(FCB_HOST, "IPRP_SAVINGTHROW_0", 3);
SetLocalInt(FCB_HOST, "IPRP_SKILLCOST_0", 50);
//SetLocalInt(FCB_HOST, "IPRP_SLOTSCOST_0", 0);
SetLocalInt(FCB_HOST, "IPRP_SOAKCOST_0", 13); //PRC 13
SetLocalInt(FCB_HOST, "IPRP_SPELLCOST_0", 242); //PRC 242
SetLocalInt(FCB_HOST, "IPRP_SPELLCSTR_0", 39);
SetLocalInt(FCB_HOST, "IPRP_SPELLLVCOST_0", 9);
SetLocalInt(FCB_HOST, "IPRP_SPELLLVLIMM_0", 9);
SetLocalInt(FCB_HOST, "IPRP_SPELLS_0", 500); //PRC 1138
SetLocalInt(FCB_HOST, "IPRP_SPELLS_1", 511 << BITLEN_2DA_RANGE | 569);
SetLocalInt(FCB_HOST, "IPRP_SPELLS_2", 600 << BITLEN_2DA_RANGE | 802);
SetLocalInt(FCB_HOST, "IPRP_SPELLSHL_0", 7);
SetLocalInt(FCB_HOST, "IPRP_SRCOST_0", 60); //PRC 60
//SetLocalInt(FCB_HOST, "IPRP_STAMINACOAT_0", 0);
//SetLocalInt(FCB_HOST, "IPRP_TERRAINTYPE_0", 0);
SetLocalInt(FCB_HOST, "IPRP_TRAPCOAT_0", 11);
SetLocalInt(FCB_HOST, "IPRP_TRAPS_0", 4);
SetLocalInt(FCB_HOST, "IPRP_VISUALFX_0", 6);
SetLocalInt(FCB_HOST, "IPRP_WALK_0", 1);
SetLocalInt(FCB_HOST, "IPRP_WEIGHTCOST_0", 5);
SetLocalInt(FCB_HOST, "IPRP_WEIGHTINC_0", 5);
//--------------------------------------/
SetLocalInt(FCB_HOST, "itempropdef_0", 84);
SetLocalInt(FCB_HOST, "itemprops_0", 84);
SetLocalInt(FCB_HOST, "itemvalue_0", 59);
SetLocalInt(FCB_HOST, "Classes_0", 38); //PRC 254
SetLocalInt(FCB_HOST, "Classes_1", 51 << BITLEN_2DA_RANGE | 56);
SetLocalInt(FCB_HOST, "Classes_2", 65 << BITLEN_2DA_RANGE | 105);
SetLocalInt(FCB_HOST, "Classes_3", 113 << BITLEN_2DA_RANGE | 134);
SetLocalInt(FCB_HOST, "Classes_4", 149 << BITLEN_2DA_RANGE | 181);
SetLocalInt(FCB_HOST, "racialtypes_0", 253); //CEP+PRC 253
SetLocalInt(FCB_HOST, "skills_0", 26);
SetLocalInt(FCB_HOST, "Skills_0", 26);
SetLocalInt(FCB_HOST, "disease_0", 16);
SetLocalInt(FCB_HOST, "poison_0", 44); //PRC 114
SetLocalInt(FCB_HOST, "poison_1", 100 << BITLEN_2DA_RANGE | 114);
SetLocalInt(FCB_HOST, "gender_0", 4);
//--------------------------------------/
//--------------------------------------/
menu_main();
chcnt_main();
DelayCommand(0.0, iprp_main(0, 20));
DelayCommand(0.0, iprp_main(21, 50));
DelayCommand(0.0, iprp_main(51, 84));
}
//==========================================/
//main/sub menues
//==========================================/
//==========================================/
void menu_main()
//==========================================/
{
{
int file_type_iprp = create_main_file_type_link(MAIN_FOLDER_INDEX_IPRP) | SCRIPT_INDEX_DISP_IPRP;
create_main_file_int(MAIN_FOLDER_INDEX_MAINMENU, UI_TXT_IPRP_ENTER, file_type_iprp);
}
{
int file_type_iprpr = create_main_file_type_link(MAIN_FOLDER_INDEX_IPRPR) | SCRIPT_INDEX_DISP_IPRP;
create_main_file_int(MAIN_FOLDER_INDEX_MAINMENU, UI_TXT_IPRPR_ENTER, file_type_iprpr);
}
{
int file_type = create_main_file_type_link(MAIN_FOLDER_INDEX_CHARGE) | SCRIPT_INDEX_DISP_HEADER;
create_main_file_int(MAIN_FOLDER_INDEX_MAINMENU, UI_TXT_CHARGE_ENTER + UI_TXT_INDENT, file_type);
}
//--------------------------------------/
{
int file_type = create_main_file_type_link(MAIN_FOLDER_INDEX_DUPE) | SCRIPT_INDEX_DUPE_SEL_0;
create_main_file_int(MAIN_FOLDER_INDEX_MAINMENU, UI_TXT_DUPE_ENTER, file_type);
}
{
int file_type = create_main_file_type_link(MAIN_FOLDER_INDEX_SETNAME) | SCRIPT_INDEX_LISTEN_SETNAME;
create_main_file_int(MAIN_FOLDER_INDEX_MAINMENU, UI_TXT_SETNAME_ENTER, file_type);
}
{
int file_type = create_main_file_type_link(MAIN_FOLDER_INDEX_COLORGUIDE) | SCRIPT_INDEX_COLORGUIDE;
create_main_file_int(MAIN_FOLDER_INDEX_MAINMENU, UI_TXT_COLORGUIDE_ENTER, file_type);
}
set_main_folder_index_start(MAIN_FOLDER_RESERVE_INDEX);
//--------------------------------------/
//--------------------------------------/
{
create_main_file_int(MAIN_FOLDER_INDEX_IPRP_MENU, UI_TXT_IPRP_MENU_ADD_NORMAL, SCRIPT_INDEX_IPRP_SEL_1);
}
{
create_main_file_int(MAIN_FOLDER_INDEX_IPRPR_MENU, UI_TXT_IPRPR_MENU_REMOVE, SCRIPT_INDEX_IPRPR_SEL_1);
}
//--------------------------------------/
{
create_main_file_int(MAIN_FOLDER_INDEX_SETNAME, UI_TXT_SETNAME_MENU_ACCEPT, SCRIPT_INDEX_SETNAME_SEL_1);
create_main_file_int(MAIN_FOLDER_INDEX_SETNAME, UI_TXT_SETNAME_MENU_REENTER, SCRIPT_INDEX_LISTEN_SETNAME);
create_main_file_int(MAIN_FOLDER_INDEX_SETNAME, UI_TXT_SETNAME_MENU_DEFAULT, SCRIPT_INDEX_SETNAME_DEFAULT);
}
{
create_main_file_int(MAIN_FOLDER_INDEX_CHARGE_MENU, UI_TXT_CHARGE_MENU_SET, SCRIPT_INDEX_CHARGE_SEL_1);
}
{
create_main_file_int(MAIN_FOLDER_INDEX_DUPE, UI_TXT_DUPE_MENU_ACCEPT, SCRIPT_INDEX_DUPE_SEL_1);
}
}
//==========================================/
//item properties
//==========================================/
//==========================================/
void iprp_main(int iprp_main_row, int iprp_main_endrow)
//==========================================/
{
int folder_index = MAIN_FOLDER_INDEX_IPRP;
int file_type_menu = create_main_file_type_link(SCRIPT_INDEX_IPRP_SEL_0 | MAIN_FOLDER_INDEX_IPRP_MENU);
while(iprp_main_row <= iprp_main_endrow)
{
string subtype_strref = Get2DAString("itempropdef", "Name", iprp_main_row);
string subtype_resref = Get2DAString("itempropdef", "SubTypeResRef", iprp_main_row);
string costtable_resref = "";
string costtable_row = Get2DAString("itempropdef", "CostTableResRef", iprp_main_row);
if(costtable_row != "" && costtable_row != "0")
{
costtable_resref = Get2DAString("IPRP_COSTTABLE", "Name", StringToInt(costtable_row));
}
string paramtable_resref = "";
string paramtable_row = Get2DAString("itempropdef", "Param1ResRef", iprp_main_row);
if(paramtable_row != "")
{
paramtable_resref = Get2DAString("IPRP_PARAMTABLE", "TableResRef", StringToInt(paramtable_row));
}
int folder_target = 0;
if(subtype_resref != "")
{
folder_target = iprp_subtype_file(subtype_resref, costtable_resref, paramtable_resref, file_type_menu);
}
else if(costtable_resref != "" || paramtable_resref != "")
{
folder_target = iprp_cost_param1_file(costtable_resref, paramtable_resref, file_type_menu);
}
int file_type = create_main_file_type_link(folder_target, file_type_menu);
create_main_file_int(folder_index, GetStringByStrRef(StringToInt(subtype_strref)), file_type, iprp_main_row);
iprp_main_row++;
}
}
//==========================================/
int iprp_subtype_file(string subtype_resref, string costtable_resref, string paramtable_resref, int file_type_menu)
//==========================================/
{
int folder_index = GetLocalInt(FCB_HOST, MAIN_FOLDER_INDEX_LINK_ + subtype_resref + costtable_resref + paramtable_resref);
if(folder_index < 1)
{
folder_index = create_main_folder(subtype_resref + costtable_resref + paramtable_resref);
int folder_target = iprp_cost_param1_file(costtable_resref, paramtable_resref, file_type_menu);
//----------------------------------------//
int block = 0;
int subtype_range = GetLocalInt(FCB_HOST, subtype_resref + UI_TXT_UNDERSCORE + "0");
while(subtype_range > 0)
{
int subtype_endrow = FILTER_R1 & subtype_range;
int subtype_row = subtype_range >>> BITLEN_2DA_RANGE;
while(subtype_row <= subtype_endrow)
{
string subtype_strref = Get2DAString(subtype_resref, "Name", subtype_row);
if(subtype_strref != "")
{
int file_type = 0;
//param1 override
//----------------------------------------//
string paramtable_row = Get2DAString(subtype_resref, "Param1ResRef", subtype_row);
if(paramtable_row != "")
{
string paramtable_resref_override = Get2DAString("IPRP_PARAMTABLE", "TableResRef", StringToInt(paramtable_row));
int folder_target_override = iprp_cost_param1_file(costtable_resref, paramtable_resref_override, file_type_menu);
file_type = create_main_file_type_link(folder_target_override, file_type_menu);
}
//----------------------------------------//
else
{
file_type = create_main_file_type_link(folder_target, file_type_menu);
}
create_main_file_int(folder_index, GetStringByStrRef(StringToInt(subtype_strref)), file_type, subtype_row);
}
subtype_row++;
}
block++;
subtype_range = GetLocalInt(FCB_HOST, subtype_resref + UI_TXT_UNDERSCORE + IntToString(block));
}
}
return folder_index;
}
//==========================================/
int iprp_cost_param1_file(string costtable_resref, string paramtable_resref, int file_type_menu)
//==========================================/
{
int folder_index = GetLocalInt(FCB_HOST, MAIN_FOLDER_INDEX_LINK_ + costtable_resref + paramtable_resref);
if(folder_index < 1)
{
int folder_index_cost = 0;
int folder_index_param1 = 0;
//----------------------------------------//
if(paramtable_resref != "")
{
folder_index_param1 = GetLocalInt(FCB_HOST, MAIN_FOLDER_INDEX_LINK_ + paramtable_resref);
if(folder_index_param1 < 1)
{
folder_index_param1 = create_main_folder(paramtable_resref);
int block = 0;
int param1_range = GetLocalInt(FCB_HOST, paramtable_resref + UI_TXT_UNDERSCORE + "0");
while(param1_range > 0)
{
int param1_endrow = FILTER_R1 & param1_range;
int param1_row = param1_range >>> BITLEN_2DA_RANGE;
while(param1_row <= param1_endrow)
{
string param1_strref = Get2DAString(paramtable_resref , "Name", param1_row);
if(param1_strref != "")
{
create_main_file_int(folder_index_param1, GetStringByStrRef(StringToInt(param1_strref)), file_type_menu, param1_row);
}
param1_row++;
}
block++;
param1_range = GetLocalInt(FCB_HOST, paramtable_resref + UI_TXT_UNDERSCORE + IntToString(block));
}
}
folder_index = folder_index_param1;
}
//----------------------------------------//
if(costtable_resref != "")
{
folder_index_cost = create_main_folder(costtable_resref + paramtable_resref);
int block = 0;
int cost_range = GetLocalInt(FCB_HOST, costtable_resref + UI_TXT_UNDERSCORE + "0");
while(cost_range > 0)
{
int cost_endrow = FILTER_R1 & cost_range;
int cost_row = cost_range >>> BITLEN_2DA_RANGE;
while(cost_row <= cost_endrow)
{
string costtable_strref = Get2DAString(costtable_resref, "Name", cost_row);
if(costtable_strref != "")
{
int file_type = create_main_file_type_link(folder_index_param1, file_type_menu);
create_main_file_int(folder_index_cost, GetStringByStrRef(StringToInt(costtable_strref)), file_type, cost_row);
}
cost_row++;
}
block++;
cost_range = GetLocalInt(FCB_HOST, costtable_resref + UI_TXT_UNDERSCORE + IntToString(block));
}
folder_index = folder_index_cost;
}
}
return folder_index;
}
//==========================================/
//charge count
//==========================================/
//==========================================/
void chcnt_main()
//==========================================/
{
int file_type_menu = create_main_file_type_link(SCRIPT_INDEX_CHARGE_SEL_0 | MAIN_FOLDER_INDEX_CHARGE_MENU);
//make folders
//----------------------------------------//
int n = 1;
while(n <= ITEM_CHARGE_CNT_MAX)
{
create_main_file_int(MAIN_FOLDER_INDEX_CHARGE, IntToString(n) + UI_TXT_UNIT_CHARGE, file_type_menu, n);
n++;
}
}

View File

@@ -0,0 +1,729 @@
#include "fcb_inc_prot"
//==========================================/
//general
//==========================================/
//==========================================/
string c_hdr1(string s)
//==========================================/
{
return set_string_color(s, 0, 260, 260);
}
//==========================================/
string c_hdr2(string s)
//==========================================/
{
return set_string_color(s, 260, 0, 80);
}
//==========================================/
string c_hlt1(string s)
//==========================================/
{
return set_string_color(s, 160, 160, 160);
}
//==========================================/
string c_hlt2(string s)
//==========================================/
{
return set_string_color(s, 30, 230, 30);
}
//==========================================/
string c_hid(string s)
//==========================================/
{
return set_string_color(s, 60, 60, 60);
}
//==========================================/
string c_sel(string s)
//==========================================/
{
return set_string_color(s, 260, 260, 260);
}
//==========================================/
string c_fld(string s)
//==========================================/
{
return set_string_color(s, 200, 200, 260);
}
//==========================================/
string c_crs(string s)
//==========================================/
{
return set_string_color(s, 200, 40, 40);
}
//==========================================/
string get_color_string_val(int cval)
//==========================================/
{
string color_header_val = GetLocalString(FCB_HOST, COLOR_STRING_CACHE_ + IntToHexString(cval));
if(color_header_val == "")
{
color_header_val = GetSubString(GetLocalString(FCB_HOST, COLOR_STRING), cval, 1);
}
return color_header_val;
}
//==========================================/
string set_string_color(string s, int rval, int gval, int bval)
//==========================================/
{
rval = rval*(COLOR_STRING_LEN - 1)/COLOR_VAL_MAX;
gval = gval*(COLOR_STRING_LEN - 1)/COLOR_VAL_MAX;
bval = bval*(COLOR_STRING_LEN - 1)/COLOR_VAL_MAX;
string result = "<c";
string color_string = GetLocalString(FCB_HOST, COLOR_STRING);
//----------------------------------------//
string color_header_rval = GetLocalString(FCB_HOST, COLOR_STRING_CACHE_ + IntToHexString(rval));
if(color_header_rval == "")
{
color_header_rval = GetSubString(color_string, rval, 1);
SetLocalString(FCB_HOST, COLOR_STRING_CACHE_ + IntToHexString(rval), color_header_rval);
}
result += color_header_rval;
//----------------------------------------//
string color_header_gval = "";
if(gval == rval)
{
result += color_header_rval;
}
else
{
color_header_gval = GetLocalString(FCB_HOST, COLOR_STRING_CACHE_ + IntToHexString(gval));
if(color_header_gval == "")
{
color_header_gval = GetSubString(color_string, gval, 1);
SetLocalString(FCB_HOST, COLOR_STRING_CACHE_ + IntToHexString(gval), color_header_gval);
}
result += color_header_gval;
}
//----------------------------------------//
if(bval == rval)
{
result += color_header_rval;
}
else if(bval == gval)
{
result += color_header_gval;
}
else
{
string color_header_bval = GetLocalString(FCB_HOST, COLOR_STRING_CACHE_ + IntToHexString(bval));
if(color_header_bval == "")
{
color_header_bval = GetSubString(color_string, bval, 1);
SetLocalString(FCB_HOST, COLOR_STRING_CACHE_ + IntToHexString(bval), color_header_bval);
}
result += color_header_bval;
}
return (result + ">" + s + COLOR_TAG_END);
}
//==========================================/
string set_gradation(string name, int r1, int g1, int b1, int r2, int g2, int b2)
//==========================================/
{
string result = "";
int name_len = GetStringLength(name);
int dr = (r2 - r1)/name_len;
int dg = (g2 - g1)/name_len;
int db = (b2 - b1)/name_len;
int m = 0;
while(m < name_len)
{
result += set_string_color(GetSubString(name, m, 1), r1, g1, b1);
r1 += dr;
g1 += dg;
b1 += db;
m++;
}
return result;
}
//==========================================/
string ui_refresh_scroll_up(int condition)
//==========================================/
{
string disp = UI_TXT_UP;
if(!condition)
{
disp = c_hid(disp);
}
return disp;
}
//==========================================/
string ui_refresh_scroll_down(int condition)
//==========================================/
{
string disp = UI_TXT_DOWN;
if(!condition)
{
disp = c_hid(disp);
}
return disp + UI_TXT_INDENT2;
}
//==========================================/
//main related
//==========================================/
//==========================================/
void ui_main_initialize(int folder_index)
//==========================================/
{
//--------------------------------------/
ui_disp_initialize();
//--------------------------------------/
//set initial stack name
SetLocalString(FCB_HOST, STACK_NAME_ + IntToHexString(UI_STACK_DEFAULT_OFFSET), UI_TXT_STACK_ROOT);
//[offset: 10][index: 10][select: 10]
//set stack state to 1, 1, 1
SetLocalInt(FCB_HOST, STACK_STATE, (UI_STACK_DEFAULT_OFFSET << BITLEN_FILE_2) | INCR_F10 | UI_STACK_DEFAULT_SEL);
//ui_stack_refresh(UI_STACK_DEFAULT_OFFSET, 1, UI_STACK_DEFAULT_SEL);
//--------------------------------------/
//main refresh at folder index, 1, 0
ui_main_refresh(folder_index | UI_MAIN_DEFAULT_OFFSET, folder_index | UI_MAIN_DEFAULT_SEL);
//[...][offset: 10][folder_index: 10][selected: 10]
//store it to stack
int stack_param = (UI_MAIN_DEFAULT_OFFSET << BITLEN_FILE_2) | folder_index | UI_MAIN_DEFAULT_SEL;
SetLocalInt(FCB_HOST, STACK_PARAM_ + IntToHexString(UI_STACK_DEFAULT_OFFSET), stack_param);
}
//==========================================/
void ui_main_refresh_index(int file_dir, int file_dir_sel, int token_index)
//==========================================/
{
string file_name = GetLocalString(FCB_HOST, MAIN_FILE_NAME_ + IntToHexString(file_dir));
int file_type = GetLocalInt(FCB_HOST, MAIN_FILE_TYPE_ + IntToHexString(file_dir));
int color_sel = GetLocalInt(FCB_HOST, MAIN_FILE_NAME_COLOR_ + IntToHexString(file_dir));
//hidden
if(INCR_HIDDEN & file_type)
{
if(INCR_LINK & file_type)
{
file_name = c_hid(UI_TXT_LINK_PREFIX + file_name);
}
else
{
file_name = c_hid(file_name);
}
}
//selected
else if(file_dir == file_dir_sel)
{
if(INCR_LINK & file_type)
{
file_name = c_sel(UI_TXT_LINK_PREFIX + file_name);
}
else
{
file_name = c_sel(file_name);
}
}
else if(INCR_D1000 & color_sel)
{
int rval = FILTER_D1 & (color_sel >>> BITLEN_COLOR_2);
int gval = FILTER_D1 & (color_sel >>> BITLEN_COLOR_1);
int bval = FILTER_D1 & color_sel;
file_name = set_string_color(file_name, rval, gval, bval);
if(INCR_LINK & file_type)
{
file_name = UI_TXT_LINK_PREFIX + file_name;
}
}
//link
else if(INCR_LINK & file_type)
{
file_name = UI_TXT_LINK_PREFIX + c_fld(file_name);
}
SetCustomToken(UI_TOKEN_MAIN + token_index, file_name);
}
//==========================================/
void ui_main_refresh(int file_dir_offset, int file_dir_sel)
//==========================================/
{
//file_dir: [...][folder_index: 10][file_index: 10]
//--------------------------------------/
int n = 0;
//folder index is 0
if((FILTER_F10 & file_dir_offset) > 0)
{
//file_index: [...][folder_index: 10][file_index: 10]
int file_index = GetLocalInt(FCB_HOST, MAIN_FILE_INDEX_ + IntToHexString(FILTER_F10 & file_dir_offset));
while((file_dir_offset + n) <= file_index && n <= UI_MAIN_LIST_SIZE)
{
ui_main_refresh_index(file_dir_offset + n, file_dir_sel, n);
n++;
}
//--------------------------------------/
SetCustomToken(UI_TOKEN_MAIN + UI_MAIN_LIST_SIZE, ui_refresh_scroll_down((file_dir_offset + UI_MAIN_LIST_SIZE) <= file_index));
//--------------------------------------/
SetCustomToken(UI_TOKEN_MAIN + UI_MAIN_LIST_SIZE + 1, ui_refresh_scroll_up((FILTER_F1 & file_dir_offset) > UI_MAIN_DEFAULT_OFFSET));
}
SetLocalInt(FCB_HOST, UI_MAIN_LIST_LEN, n);
}
//==========================================/
void ui_main_select(int n)
//==========================================/
{
//current stack index
//[offset: 10][index: 10][select: 10]
int stack_state = GetLocalInt(FCB_HOST, STACK_STATE);
int stack_index_offset = stack_state >>> BITLEN_FILE_2;
int stack_index_sel = FILTER_F1 & stack_state;
//[...][offset: 10][folder_index: 10][selected: 10]
int stack_param = GetLocalInt(FCB_HOST, STACK_PARAM_ + IntToHexString(stack_index_sel));
//[folder_index: 10][offset: 10]
int file_dir_offset = (FILTER_F10 & stack_param) | (stack_param >>> BITLEN_FILE_2);
int file_type = GetLocalInt(FCB_HOST, MAIN_FILE_TYPE_ + IntToHexString(file_dir_offset + n));
//if not in hidden mode
//--------------------------------------/
if(INCR_HIDDEN & (~file_type))
{
//[folder_index: 10][selected: 10]
int file_dir_sel = FILTER_F11 & stack_param;
//selected different file...
if((file_dir_offset + n) != file_dir_sel)
{
//update selection selection
//[offset: 10][folder_index: 10][offset+n: 10]
SetLocalInt(FCB_HOST, STACK_PARAM_ + IntToHexString(stack_index_sel), (FILTER_F100 & stack_param) | (file_dir_offset + n));
}
//--------------------------------------/
SetLocalInt(FCB_HOST, SCRIPT_PARAM, (FILTER_F100 & file_type) | stack_index_sel);
//if link type
//--------------------------------------/
if(INCR_LINK & file_type)
{
int folder_index = FILTER_F10 & file_type;
ui_main_refresh(folder_index | UI_MAIN_DEFAULT_OFFSET, folder_index | UI_MAIN_DEFAULT_SEL);
int stack_index_sel_new = stack_index_sel+1;
//stack: [...][offset: 10][folder_index: 10][selected: 10]
SetLocalInt(FCB_HOST, STACK_PARAM_ + IntToHexString(stack_index_sel_new), (UI_MAIN_DEFAULT_OFFSET << BITLEN_FILE_2) | folder_index | UI_MAIN_DEFAULT_SEL);
string file_name = GetLocalString(FCB_HOST, MAIN_FILE_NAME_+ IntToHexString(file_dir_offset + n));
SetLocalString(FCB_HOST, STACK_NAME_ + IntToHexString(stack_index_sel_new), file_name);
//[offset: 10][index: 10][select: 10]
SetLocalInt(FCB_HOST, STACK_STATE, (FILTER_F100 & stack_state) | (stack_index_sel_new << BITLEN_FILE_1) | stack_index_sel_new);
//ui_stack_refresh(stack_state >>> BITLEN_FILE_2, stack_index_sel_new, stack_index_sel_new);
//misc
//--------------------------------------/
//ui_disp_clear_local();
}
else
{
//selected different file...
if((file_dir_offset + n) != file_dir_sel)
{
//redraw file_dir_offset + n
ui_main_refresh_index(file_dir_offset + n, file_dir_offset + n, n);
//old selection in visual range
if(file_dir_sel >= file_dir_offset && file_dir_sel < (file_dir_offset + UI_MAIN_LIST_SIZE))
{
//redraw file_dir_sel
ui_main_refresh_index(file_dir_sel, file_dir_offset + n, file_dir_sel - file_dir_offset);
}
}
}
ExecuteScript(FCB_SCRIPT_PREFIX + SCRIPT_MAIN_OPTION_HANDLER, FCB_HOST);
ui_disp_refresh_txt();
}
}
//==========================================/
void ui_main_scroll_down()
//==========================================/
{
//current stack index
//[offset: 10][index: 10][select: 10]
int stack_index_sel = FILTER_F1 & GetLocalInt(FCB_HOST, STACK_STATE);
//[...][offset: 10][folder_index: 10][selected: 10]
int stack_param = GetLocalInt(FCB_HOST, STACK_PARAM_ + IntToHexString(stack_index_sel));
int stack_index_offset = stack_param >>> BITLEN_FILE_2;
int file_index = GetLocalInt(FCB_HOST, MAIN_FILE_INDEX_ + IntToHexString(FILTER_F10 & stack_param));
//if offset < file_index
if((FILTER_F1 & file_index) >= (stack_index_offset + UI_MAIN_LIST_SIZE))
{
//stack: [...][offset: 10][folder_index: 10][selected: 10]
SetLocalInt(FCB_HOST, STACK_PARAM_ + IntToHexString(stack_index_sel), stack_param + (UI_MAIN_SCROLL_INCR << BITLEN_FILE_2));
ui_main_refresh((FILTER_F10 & stack_param) | (stack_index_offset + UI_MAIN_SCROLL_INCR), FILTER_F11 & stack_param);
}
}
//==========================================/
void ui_main_scroll_up()
//==========================================/
{
//current stack index
//[offset: 10][index: 10][select: 10]
int stack_index_sel = FILTER_F1 & GetLocalInt(FCB_HOST, STACK_STATE);
//[...][offset: 10][folder_index: 10][selected: 10]
int stack_param = GetLocalInt(FCB_HOST, STACK_PARAM_ + IntToHexString(stack_index_sel));
int stack_index_offset = stack_param >>> BITLEN_FILE_2;
if(stack_index_offset > UI_MAIN_DEFAULT_OFFSET)
{
//stack: [...][offset: 10][folder_index: 10][selected: 10]
SetLocalInt(FCB_HOST, STACK_PARAM_ + IntToHexString(stack_index_sel), stack_param - (UI_MAIN_SCROLL_INCR << BITLEN_FILE_2));
ui_main_refresh((FILTER_F10 & stack_param) | (stack_index_offset - UI_MAIN_SCROLL_INCR), FILTER_F11 & stack_param);
}
}
//==========================================/
void ui_main_set_hidden(int file_dir, int hidden)
//==========================================/
{
if(hidden)
{
int file_type = GetLocalInt(FCB_HOST, MAIN_FILE_TYPE_ + IntToHexString(file_dir));
SetLocalInt(FCB_HOST, MAIN_FILE_TYPE_ + IntToHexString(file_dir), INCR_HIDDEN | file_type);
}
else
{
int file_type = GetLocalInt(FCB_HOST, MAIN_FILE_TYPE_ + IntToHexString(file_dir));
SetLocalInt(FCB_HOST, MAIN_FILE_TYPE_ + IntToHexString(file_dir), (~INCR_HIDDEN) & file_type);
}
}
//==========================================/
void ui_main_set_hidden_refresh(int file_dir, int hidden)
//==========================================/
{
int stack_state = GetLocalInt(FCB_HOST, STACK_STATE);
//[...][offset: 10][folder_index: 10][selected: 10]
int stack_param = GetLocalInt(FCB_HOST, STACK_PARAM_ + IntToHexString(FILTER_F1 & stack_state));
if(hidden)
{
int file_type = GetLocalInt(FCB_HOST, MAIN_FILE_TYPE_ + IntToHexString(file_dir));
SetLocalInt(FCB_HOST, MAIN_FILE_TYPE_ + IntToHexString(file_dir), INCR_HIDDEN | file_type);
if((FILTER_F10 & file_dir) == (FILTER_F10 & stack_param))
{
int file_dir_offset = (FILTER_F10 & stack_param) | (stack_param >>> BITLEN_FILE_2);
if(file_dir >= file_dir_offset && file_dir <= (file_dir_offset + UI_MAIN_LIST_SIZE))
{
int file_dir_sel = FILTER_F11 & stack_param;
if(file_dir == file_dir_sel)
{
SetLocalInt(FCB_HOST, STACK_PARAM_ + IntToHexString(FILTER_F1 & stack_state), FILTER_F110 & stack_param);
ui_main_refresh_index(file_dir, 0, file_dir_sel - file_dir_offset);
}
else
{
ui_main_refresh_index(file_dir, file_dir_sel, file_dir - file_dir_offset);
}
}
}
}
else
{
int file_type = GetLocalInt(FCB_HOST, MAIN_FILE_TYPE_ + IntToHexString(file_dir));
SetLocalInt(FCB_HOST, MAIN_FILE_TYPE_ + IntToHexString(file_dir), (~INCR_HIDDEN) & file_type);
if((FILTER_F10 & file_dir) == (FILTER_F10 & stack_param))
{
int file_dir_offset = (FILTER_F10 & stack_param) | (stack_param >>> BITLEN_FILE_2);
if(file_dir >= file_dir_offset && file_dir <= (file_dir_offset + UI_MAIN_LIST_SIZE))
{
int file_dir_sel = FILTER_F11 & stack_param;
ui_main_refresh_index(file_dir, file_dir_sel, file_dir - file_dir_offset);
}
}
}
}
//==========================================/
void remove_main_file_dir(int file_dir, int token_index)
//==========================================/
{
ui_main_set_hidden(file_dir, 1);
ui_main_refresh_index(file_dir, 0, token_index);
}
//==========================================/
void clear_main_folder(int file_dir)
//==========================================/
{
SetLocalInt(FCB_HOST, MAIN_FILE_INDEX_ + IntToHexString(FILTER_F10 & file_dir), file_dir);
}
//==========================================/
void set_main_file_name_color(int file_dir, int rval, int gval, int bval)
//==========================================/
{
if(rval > COLOR_VAL_MAX)
{
rval = COLOR_VAL_MAX;
}
if(gval > COLOR_VAL_MAX)
{
gval = COLOR_VAL_MAX;
}
if(bval > COLOR_VAL_MAX)
{
bval = COLOR_VAL_MAX;
}
SetLocalInt(FCB_HOST, MAIN_FILE_NAME_COLOR_ + IntToHexString(file_dir), INCR_D1000 | (rval << BITLEN_COLOR_2) | (gval << BITLEN_COLOR_1) | bval);
}
//==========================================/
void clear_main_file_name_color(int file_dir)
//==========================================/
{
DeleteLocalInt(FCB_HOST, MAIN_FILE_NAME_COLOR_ + IntToHexString(file_dir));
}
//==========================================/
//stack related
//==========================================/
//==========================================/
void ui_stack_back()
//==========================================/
{
//[offset: 10][index: 10][select: 10]
int stack_state = GetLocalInt(FCB_HOST, STACK_STATE);
int stack_index_sel = FILTER_F1 & stack_state;
//int stack_index_offset = stack_state >>> BITLEN_FILE_2;
//selected different file...
SetLocalInt(FCB_HOST, STACK_STATE, (FILTER_F110 & stack_state) | (stack_index_sel - 1));
//stack: [...][offset: 10][folder_index: 10][selected: 10]
int stack_param = GetLocalInt(FCB_HOST, STACK_PARAM_ + IntToHexString(stack_index_sel - 1));
ui_main_refresh((FILTER_F10 & stack_param) | (stack_param >>> BITLEN_FILE_2), FILTER_F11 & stack_param);
//misc
//--------------------------------------/
ui_disp_clear_local();
ui_disp_refresh_txt();
}
//==========================================/
void ui_stack_index(int index)
//==========================================/
{
//[offset: 10][index: 10][select: 10]
int stack_state = GetLocalInt(FCB_HOST, STACK_STATE);
//int stack_index_sel = FILTER_F1 & stack_state;
//int stack_index_offset = stack_state >>> BITLEN_FILE_2;
//selected different file...
SetLocalInt(FCB_HOST, STACK_STATE, (FILTER_F110 & stack_state) | UI_STACK_DEFAULT_OFFSET + index);
//stack: [...][offset: 10][folder_index: 10][selected: 10]
int stack_param = GetLocalInt(FCB_HOST, STACK_PARAM_ + IntToHexString(UI_STACK_DEFAULT_OFFSET + index));
ui_main_refresh((FILTER_F10 & stack_param) | (stack_param >>> BITLEN_FILE_2), FILTER_F11 & stack_param);
//misc
//--------------------------------------/
ui_disp_clear_local();
ui_disp_refresh_txt();
}
//==========================================/
//resp
//==========================================/
//==========================================/
void ui_disp_initialize()
//==========================================/
{
int n = 0;
while(n <= DISP_INDEX_POS)
{
ui_disp_state_new(n, 0);
ui_disp_set_txt(n, "", "");
n++;
}
}
//==========================================/
void ui_disp_refresh_txt()
//==========================================/
{
int disp_state = GetLocalInt(FCB_HOST, DISP_STATE);
int n = 0;
int token_index = 0;
int index_pos = 1;
while(n <= DISP_INDEX_POS)
{
if(disp_state & index_pos)
{
string disp = GetLocalString(FCB_HOST, UI_DISP_TXT_ + IntToHexString(n));
disp_state &= ~index_pos;
if(disp != "")
{
if(disp_state > index_pos)
{
disp += UI_TXT_INDENT;
}
SetCustomToken(UI_TOKEN_DISP + token_index, disp);
token_index++;
}
}
index_pos <<= 1;
n++;
}
while(token_index < DISP_LIST_SIZE)
{
SetCustomToken(UI_TOKEN_DISP + token_index, "");
token_index++;
}
}
//==========================================/
void ui_disp_state_new(int n, int disp)
//==========================================/
{
if(disp)
{
SetLocalInt(FCB_HOST, DISP_STATE, GetLocalInt(FCB_HOST, DISP_STATE) | (1 << n));
}
else
{
SetLocalInt(FCB_HOST, DISP_STATE, GetLocalInt(FCB_HOST, DISP_STATE) & ~(1 << n));
}
}
//==========================================/
void ui_disp_set_txt(int n, string hdr, string txt = "")
//==========================================/
{
string disp = "";
if(hdr != "")
{
disp += c_hdr1(hdr);
if(txt != "")
{
disp += UI_TXT_INDENT + txt;
}
}
else if(txt != "")
{
disp += txt;
}
SetLocalString(FCB_HOST, UI_DISP_TXT_ + IntToHexString(n), disp);
}
//==========================================/
void ui_disp_clear_local()
//==========================================/
{
ui_disp_state_new(DISP_INDEX_LOCAL1, 0);
}
//==========================================/
void ui_set_active_disp_index(int disp_index1 = -1, int disp_index2 = -1)
//==========================================/
{
if(disp_index1 > -1)
{
ui_disp_state_new(disp_index1, 1);
}
else
{
ui_disp_state_new(disp_index1, 0);
}
if(disp_index2 > -1)
{
ui_disp_state_new(disp_index2, 1);
}
else
{
ui_disp_state_new(disp_index2, 0);
}
int n = 0;
while(n <= DISP_INDEX_POS)
{
if(n != disp_index1)
{
if(n != disp_index2)
{
ui_disp_state_new(n, 0);
}
}
n++;
}
}

View File

@@ -0,0 +1,87 @@
#include "fcb_inc_prot"
//==========================================/
void set_main_folder_index_start(int folder_index)
//==========================================/
{
SetLocalInt(FCB_HOST, MAIN_FOLDER_INDEX, folder_index);
}
//==========================================/
int create_main_folder(string folder_index_link = "")
//==========================================/
{
int folder_index = GetLocalInt(FCB_HOST, MAIN_FOLDER_INDEX) + INCR_F10;
SetLocalInt(FCB_HOST, MAIN_FOLDER_INDEX, folder_index);
if(folder_index_link != "")
{
SetLocalInt(FCB_HOST, MAIN_FOLDER_INDEX_LINK_ + folder_index_link, folder_index);
}
return folder_index;
}
//==========================================/
int create_main_file_type_link(int folder_target, int file_type_alternate = 0)
//==========================================/
{
if(folder_target > 0)
{
return INCR_LINK | folder_target;
}
else
{
return file_type_alternate;
}
}
//==========================================/
int create_main_file_int(int folder_index, string file_name, int file_type, int file_param = 0)
//==========================================/
{
//file_dir: [...][folder_index: 10][file_index: 10]
int file_dir = folder_index | GetLocalInt(FCB_HOST, MAIN_FILE_INDEX_ + IntToHexString(folder_index))+1;
SetLocalInt(FCB_HOST, MAIN_FILE_INDEX_ + IntToHexString(folder_index), file_dir);
SetLocalString(FCB_HOST, MAIN_FILE_NAME_ + IntToHexString(file_dir), file_name);
SetLocalInt(FCB_HOST, MAIN_FILE_TYPE_ + IntToHexString(file_dir), file_type);
//file_param: data to hold
SetLocalInt(FCB_HOST, MAIN_FILE_PARAM_ + IntToHexString(file_dir), file_param);
return file_dir;
}
//==========================================/
int create_main_file_str(int folder_index, string file_name, int file_type, string file_param = "")
//==========================================/
{
//file_dir: [...][folder_index: 10][file_index: 10]
int file_dir = folder_index | GetLocalInt(FCB_HOST, MAIN_FILE_INDEX_ + IntToHexString(folder_index))+1;
SetLocalInt(FCB_HOST, MAIN_FILE_INDEX_ + IntToHexString(folder_index), file_dir);
SetLocalString(FCB_HOST, MAIN_FILE_NAME_ + IntToHexString(file_dir), file_name);
SetLocalInt(FCB_HOST, MAIN_FILE_TYPE_ + IntToHexString(file_dir), file_type);
//file_param: data to hold
SetLocalString(FCB_HOST, MAIN_FILE_PARAM_ + IntToHexString(file_dir), file_param);
return file_dir;
}
//==========================================/
int create_main_file_obj(int folder_index, string file_name, int file_type, object file_param = OBJECT_INVALID)
//==========================================/
{
//file_dir: [...][folder_index: 10][file_index: 10]
int file_dir = folder_index | GetLocalInt(FCB_HOST, MAIN_FILE_INDEX_ + IntToHexString(folder_index))+1;
SetLocalInt(FCB_HOST, MAIN_FILE_INDEX_ + IntToHexString(folder_index), file_dir);
SetLocalString(FCB_HOST, MAIN_FILE_NAME_ + IntToHexString(file_dir), file_name);
SetLocalInt(FCB_HOST, MAIN_FILE_TYPE_ + IntToHexString(file_dir), file_type);
//file_param: data to hold
SetLocalObject(FCB_HOST, MAIN_FILE_PARAM_ + IntToHexString(file_dir), file_param);
return file_dir;
}

View File

@@ -0,0 +1,384 @@
#include "fcb_inc_prot"
//==========================================/
void switch_forge_enable(int enable)
//==========================================/
{
//enable/disable forge functions
//ui_main_set_hidden_refresh(MAIN_FOLDER_INDEX_MAINMENU | n, !enable);
//n defines which option to control:
//1: Add item properties
//2: Remove item properties
//3: Set charge count
//4: Duplicate item
//5: Set name
//6: Colored item names guide
//Commented menues will NOT be turned off when the forge is disabled.
ui_main_set_hidden_refresh(MAIN_FOLDER_INDEX_MAINMENU | 1, !enable);
ui_main_set_hidden_refresh(MAIN_FOLDER_INDEX_MAINMENU | 2, !enable);
ui_main_set_hidden_refresh(MAIN_FOLDER_INDEX_MAINMENU | 3, !enable);
//ui_main_set_hidden_refresh(MAIN_FOLDER_INDEX_MAINMENU | 4, !enable);
//ui_main_set_hidden_refresh(MAIN_FOLDER_INDEX_MAINMENU | 5, !enable);
//ui_main_set_hidden_refresh(MAIN_FOLDER_INDEX_MAINMENU | 6, !enable);
}
//==========================================/
void switch_ILR_enable(int enable)
//==========================================/
{
SetLocalInt(FCB_HOST, SW_ILR_ENABLE, enable);
}
//==========================================/
void start_conversation(object user)
//==========================================/
{
AssignCommand(FCB_CV, ActionStartConversation(user, CV_MAIN, 1, 0));
}
//==========================================/
int get_character_level(object user)
//==========================================/
{
int level = GetLevelByClass(GetClassByPosition(1, user), user);
level += GetLevelByClass(GetClassByPosition(2, user), user);
level += GetLevelByClass(GetClassByPosition(3, user), user);
return level;
}
//==========================================/
int get_item_cost(object item)
//==========================================/
{
int item_plot_flag = GetPlotFlag(item);
SetPlotFlag(item, 0);
int item_identified = GetIdentified(item);
SetIdentified(item, 1);
int cost = GetGoldPieceValue(item);
SetPlotFlag(item, item_plot_flag);
SetIdentified(item, item_identified);
return cost;
}
//::::::::::::::::::::::::::::::::::::::::::/
int item_level_search(int cost, int begin, int end)
//::::::::::::::::::::::::::::::::::::::::::/
{
int n = begin + (end - begin)/2;
int max_single_item_value_0 = StringToInt(Get2DAString("itemvalue", "MAXSINGLEITEMVALUE", n-1));
int max_single_item_value_1 = StringToInt(Get2DAString("itemvalue", "MAXSINGLEITEMVALUE", n));
if(cost > max_single_item_value_0)
{
if(cost <= max_single_item_value_1)
{
return n;
}
else if(n >= ITEM_LEVEL_MAX-1)
{
return ITEM_LEVEL_MAX-1;
}
else
{
return item_level_search(cost, n+1, end);
}
}
else if(n <= 0)
{
return 0;
}
else
{
return item_level_search(cost, begin, n-1);
}
}
//==========================================/
int get_item_level(object item)
//==========================================/
{
int cost = get_item_cost(item);
return item_level_search(cost, 0, ITEM_LEVEL_MAX-1) + 1;
}
//==========================================/
int get_item_level_by_cost(int cost)
//==========================================/
{
return item_level_search(cost, 0, ITEM_LEVEL_MAX-1) + 1;
}
//==========================================/
object copy_item(object item, object target_inventory)
//==========================================/
{
object item_copy = CopyItem(item, target_inventory, 0);
SetIdentified(item_copy, 1);
return item_copy;
}
//==========================================/
int get_item_stack_size(object item)
//==========================================/
{
return StringToInt(Get2DAString("baseitems", "ILRStackSize", GetBaseItemType(item)));
}
//==========================================/
int give_gold(int gp_amount, object user)
//==========================================/
{
if(gp_amount >= 0)
{
GiveGoldToCreature(user, gp_amount);
}
else
{
if((GetGold(user) + gp_amount) >= 0)
{
TakeGoldFromCreature(-gp_amount, user, 1);
}
else
{
return 0;
}
}
return 1;
}
//==========================================/
int iprp_to_param(itemproperty iprp)
//==========================================/
{
int itempropdef_row = FILTER_IPRP_TYPE & GetItemPropertyType(iprp);
int subtype_row = FILTER_IPRP_SUB; //all 1s
int cost_row = FILTER_IPRP_COST; //all 1s
int param1_row = FILTER_IPRP_PARAM1 & GetItemPropertyParam1Value(iprp);
//subtype exists
string subtype_resref = Get2DAString("itempropdef", "SubTypeResRef", itempropdef_row);
if(subtype_resref != "")
{
subtype_row &= GetItemPropertySubType(iprp);
}
//cost exists
int costtable_row = GetItemPropertyCostTable(iprp);
if(costtable_row > 0)
{
cost_row &= GetItemPropertyCostTableValue(iprp);
}
int param = (itempropdef_row << BITLEN_IPRP_SUB) | subtype_row;
param = (param << BITLEN_IPRP_COST) | cost_row;
param = (param << BITLEN_IPRP_PARAM1) | param1_row;
return param;
}
//==========================================/
itemproperty param_to_iprp(int param)
//==========================================/
{
int param0 = 0;
int param1 = 0;
int param2 = 0;
int param3 = 0;
//----------------------------------------//
//7 bits
int param1_row = FILTER_IPRP_PARAM1 & param;
param >>>= BITLEN_IPRP_PARAM1;
//8 bits
int cost_row = FILTER_IPRP_COST & param;
param >>>= BITLEN_IPRP_COST;
//10 bits
int subtype_row = FILTER_IPRP_SUB & param;
param >>>= BITLEN_IPRP_SUB;
//7 bits type
param0 = FILTER_IPRP_TYPE & param;
//----------------------------------------//
//subtype exists
if(subtype_row != FILTER_IPRP_SUB)
{
param1 = subtype_row;
if(cost_row != FILTER_IPRP_COST)
{
param2 = cost_row;
param3 = param1_row;
}
else
{
param2 = param1_row;
}
}
else
{
if(cost_row != FILTER_IPRP_COST)
{
param1 = cost_row;
param2 = param1_row;
}
}
return convert_iprp(param0, param1, param2, param3);
}
//==========================================/
itemproperty convert_iprp(int param0, int param1, int param2, int param3)
//==========================================/
{
switch(param0)
{
case 0: return ItemPropertyAbilityBonus(param1, param2);
case 1: return ItemPropertyACBonus(param1);
case 2: return ItemPropertyACBonusVsAlign(param1, param2);
case 3: return ItemPropertyACBonusVsDmgType(param1, param2);
case 4: return ItemPropertyACBonusVsRace(param1, param2);
case 5: return ItemPropertyACBonusVsSAlign(param1, param2);
case 6: return ItemPropertyEnhancementBonus(param1);
case 7: return ItemPropertyEnhancementBonusVsAlign(param1, param2);
case 8: return ItemPropertyEnhancementBonusVsRace(param1, param2);
case 9: return ItemPropertyEnhancementBonusVsSAlign(param1, param2);
case 10: return ItemPropertyEnhancementPenalty(param1);
case 11: return ItemPropertyWeightReduction(param1);
case 12: return ItemPropertyBonusFeat(param1);
case 13: return ItemPropertyBonusLevelSpell(param1, param2);
//case 14: return
case 15: return ItemPropertyCastSpell(param1, param2);
case 16: return ItemPropertyDamageBonus(param1, param2);
case 17: return ItemPropertyDamageBonusVsAlign(param1, param3, param2); //special index shift
case 18: return ItemPropertyDamageBonusVsRace(param1, param3, param2); //special index shift
case 19: return ItemPropertyDamageBonusVsSAlign(param1, param3, param2); //special index shift
case 20: return ItemPropertyDamageImmunity(param1, param2);
case 21: return ItemPropertyDamagePenalty(param1);
case 22: return ItemPropertyDamageReduction(param1, param2);
case 23: return ItemPropertyDamageResistance(param1, param2);
case 24: return ItemPropertyDamageVulnerability(param1, param2);
//case 25: return
case 26: return ItemPropertyDarkvision();
case 27: return ItemPropertyDecreaseAbility(param1, param2);
case 28: return ItemPropertyDecreaseAC(param1, param2);
case 29: return ItemPropertyDecreaseSkill(param1, param2);
//case 30: return
//case 31: return
case 32: return ItemPropertyContainerReducedWeight(param1);
case 33: return ItemPropertyExtraMeleeDamageType(param1);
case 34: return ItemPropertyExtraRangeDamageType(param1);
case 35: return ItemPropertyHaste();
case 36: return ItemPropertyHolyAvenger();
case 37: return ItemPropertyImmunityMisc(param1);
case 38: return ItemPropertyImprovedEvasion();
case 39: return ItemPropertyBonusSpellResistance(param1);
case 40: return ItemPropertyBonusSavingThrowVsX(param1, param2);
case 41: return ItemPropertyBonusSavingThrow(param1, param2);
//case 42: return
case 43: return ItemPropertyKeen();
case 44: return ItemPropertyLight(param1, param2); //special index shift*
case 45: return ItemPropertyMaxRangeStrengthMod(param1);
//case 46: return
case 47: return ItemPropertyNoDamage();
case 48: return ItemPropertyOnHitProps(param1, param2 + (param1 == IP_CONST_ONHIT_LEVELDRAIN), param3); //special index shift
case 49: return ItemPropertyReducedSavingThrowVsX(param1, param2);
case 50: return ItemPropertyReducedSavingThrow(param1, param2);
case 51: return ItemPropertyRegeneration(param1);
case 52: return ItemPropertySkillBonus(param1, param2);
case 53: return ItemPropertySpellImmunitySpecific(param1);
case 54: return ItemPropertySpellImmunitySchool(param1);
case 55: return ItemPropertyThievesTools(param1);
case 56: return ItemPropertyAttackBonus(param1);
case 57: return ItemPropertyAttackBonusVsAlign(param1, param2);
case 58: return ItemPropertyAttackBonusVsRace(param1, param2);
case 59: return ItemPropertyAttackBonusVsSAlign(param1, param2);
case 60: return ItemPropertyAttackPenalty(param1);
case 61: return ItemPropertyUnlimitedAmmo(param2);
case 62: return ItemPropertyLimitUseByAlign(param1);
case 63: return ItemPropertyLimitUseByClass(param1);
case 64: return ItemPropertyLimitUseByRace(param1);
case 65: return ItemPropertyLimitUseBySAlign(param1);
//case 66: return
case 67: return ItemPropertyVampiricRegeneration(param1);
//case 68: return
//case 69: return
case 70: return ItemPropertyTrap(param1, param2);
case 71: return ItemPropertyTrueSeeing();
case 72: return ItemPropertyOnMonsterHitProperties(param1, param2);
case 73: return ItemPropertyTurnResistance(param1);
case 74: return ItemPropertyMassiveCritical(param1);
case 75: return ItemPropertyFreeAction();
//case 76: return
case 77: return ItemPropertyMonsterDamage(param1);
case 78: return ItemPropertyImmunityToSpellLevel(param1); //special index shift*
case 79: return ItemPropertySpecialWalk(param1);
case 80: return ItemPropertyHealersKit(param1);
case 81: return ItemPropertyWeightIncrease(param1);
case 82: return ItemPropertyOnHitCastSpell(param1, param2+1); //special index shift
case 83: return ItemPropertyVisualEffect(param1);
case 84: return ItemPropertyArcaneSpellFailure(param1);
}
itemproperty ipRet;
return ipRet;
}
//==========================================/
int get_item_inventory_slot(object item, object user)
//==========================================/
{
int n = 0;
while(n < NUM_INVENTORY_SLOTS)
{
if(GetItemInSlot(n, user) == item)
{
return n;
}
n++;
}
return -1;
}
//==========================================/
void equip_item(object item, int equip_slot, object user)
//==========================================/
{
effect immobilize = ExtraordinaryEffect(EffectCutsceneImmobilize());
ApplyEffectToObject(DURATION_TYPE_PERMANENT, immobilize, user);
//----------------------------------------//
AssignCommand(user, ActionEquipItem(item, equip_slot));
RemoveEffect(user, immobilize);
}
//==========================================/
void disp_delayed_msg(object user, string msg)
//==========================================/
{
DelayCommand(INFO_MSG_DELAY, SendMessageToPC(user, c_hlt2(msg)));
}
//==========================================/
void visual_effect()
//==========================================/
{
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(MOD_VISUAL_EFFECT), EXT_PLACEABLE);
}
//==========================================/
void clear_script_param()
//==========================================/
{
SetLocalInt(FCB_HOST, SCRIPT_PARAM, (~FILTER_F100) & GetLocalInt(FCB_HOST, SCRIPT_PARAM));
}

View File

@@ -0,0 +1,509 @@
#include "fcb_inc_prot"
//==========================================/
int get_char_valid_num(string s)
//==========================================/
{
string valid = "0123456789";
return FindSubString(valid, s) + 1;
}
//==========================================/
int get_char_valid_letter(string s)
//==========================================/
{
string valid = "abcdefghijklmnopqrstuvwxyz_";
return FindSubString(valid, s) + 1;
}
//==========================================/
int get_char_valid_name(string s)
//==========================================/
{
string valid = "abcdefghijklmnopqrstuvwxyz_0123456789";
return FindSubString(valid, s) + 1;
}
//==========================================/
int get_is_number(string num)
//==========================================/
{
return (num == IntToString(StringToInt(num)));
}
//==========================================/
void store_arg(string function_arg, int exe_index)
//==========================================/
{
int args_index = GetLocalInt(FCB_HOST, CMD_ARGS_INDEX_ + IntToHexString(exe_index)) + 1;
SetLocalInt(FCB_HOST, CMD_ARGS_INDEX_ + IntToHexString(exe_index), args_index);
SetLocalString(FCB_HOST, CMD_ARGS_ + IntToHexString(exe_index | args_index), function_arg);
}
//==========================================/
string retrieve_arg(int args_index)
//==========================================/
{
int exe_index = GetLocalInt(FCB_HOST, CMD_EXE_REF_INDEX);
int args_index_max = GetLocalInt(FCB_HOST, CMD_ARGS_INDEX_ + IntToHexString(exe_index));
if(args_index_max >= args_index)
{
return GetLocalString(FCB_HOST, CMD_ARGS_ + IntToHexString(exe_index | args_index));
}
return CMD_ERROR_STRING;
}
//==========================================/
void set_function_result(string result)
//==========================================/
{
int exe_index = GetLocalInt(FCB_HOST, CMD_EXE_REF_INDEX);
SetLocalString(FCB_HOST, CMD_FUNCTION_RESULT_ + IntToHexString(exe_index), result);
}
//==========================================/
string get_function_result(int exe_index)
//==========================================/
{
return GetLocalString(FCB_HOST, CMD_FUNCTION_RESULT_ + IntToHexString(exe_index));
}
//==========================================/
void set_function_result_valid()
//==========================================/
{
int exe_index = GetLocalInt(FCB_HOST, CMD_EXE_REF_INDEX);
SetLocalInt(FCB_HOST, CMD_FUNCTION_RESP_VALID_ + IntToHexString(exe_index), CMD_VALID_BIT);
}
//==========================================/
int get_function_result_valid(int exe_index)
//==========================================/
{
int valid = CMD_VALID_BIT & GetLocalInt(FCB_HOST, CMD_FUNCTION_RESP_VALID_ + IntToHexString(exe_index));
DeleteLocalInt(FCB_HOST, CMD_FUNCTION_RESP_VALID_ + IntToHexString(exe_index));
return valid;
}
//==========================================/
string parse_init(string input)
//==========================================/
{
object user = GetLocalObject(FCB_HOST, USER);
int parse_state = INPUT_PARSE_STATE_INIT;
int cmd_str_len = GetStringLength(input);
int cmd_str_pos = 0;
//kill end spaces
string s = GetSubString(input, cmd_str_len-1, 1);
while(cmd_str_len >= 0 && s == CMD_TXT_SPACE)
{
cmd_str_len--;
s = GetSubString(input, cmd_str_len-1, 1);
}
s = GetSubString(input, cmd_str_pos, 1);
while(cmd_str_pos <= cmd_str_len)
{
switch(parse_state)
{
//--------------------------------------/
case INPUT_PARSE_STATE_INIT:
{
if(s == CMD_TXT_CMDSTART)
{
parse_state = INPUT_PARSE_STATE_CMD;
}
else if(s != CMD_TXT_SPACE)
{
return input;
}
break;
}
//--------------------------------------/
case INPUT_PARSE_STATE_CMD:
{
DeleteLocalInt(FCB_HOST, CMD_EXE_INDEX);
string parsed_cmd = parse_var(GetStringRight(input, cmd_str_len - cmd_str_pos), user);
SendMessageToPC(user, parsed_cmd);
return parsed_cmd;
break;
}
}
cmd_str_pos++;
s = GetSubString(input, cmd_str_pos, 1);
}
return input;
}
//==========================================/
string parse_var(string cmd, object user)
//==========================================/
{
string CMD_TXT_QUOTE = GetLocalString(FCB_HOST, CMD_QUOTE);
string arg = "";
int bracket_cnt = 0;
int parse_state = VAR_PARSE_STATE_INIT;
int cmd_str_len = GetStringLength(cmd);
int cmd_str_pos = 0;
//kill end spaces
string s = GetSubString(cmd, cmd_str_len-1, 1);
while(cmd_str_len >= 0 && s == CMD_TXT_SPACE)
{
cmd_str_len--;
s = GetSubString(cmd, cmd_str_len-1, 1);
}
//begin
//begin
s = GetSubString(cmd, cmd_str_pos, 1);
while(cmd_str_pos <= cmd_str_len)
{
//--------------------------------------/
if(s == CMD_TXT_BRACKET_START)
{
bracket_cnt++;
}
else if(s == CMD_TXT_BRACKET_END)
{
bracket_cnt--;
}
if(bracket_cnt < 0)
{
parse_state = VAR_PARSE_STATE_ERROR;
}
//--------------------------------------/
switch(parse_state)
{
//--------------------------------------/
case VAR_PARSE_STATE_INIT:
{
if(s == CMD_TXT_QUOTE)
{
parse_state = VAR_PARSE_STATE_STRING;
}
else if(get_char_valid_letter(s))
{
arg += s;
parse_state = VAR_PARSE_STATE_FUNCTION;
}
else if(get_char_valid_num(s))
{
arg += s;
if(cmd_str_pos == cmd_str_len-1)
{
return arg;
}
else
{
parse_state = VAR_PARSE_STATE_NUM;
}
}
else if(s != CMD_TXT_SPACE)
{
parse_state = VAR_PARSE_STATE_ERROR;
}
break;
}
//--------------------------------------/
case VAR_PARSE_STATE_STRING:
{
if(s == CMD_TXT_QUOTE)
{
if(cmd_str_pos == cmd_str_len-1)
{
return arg;
}
else
{
parse_state = VAR_PARSE_STATE_ERROR;
}
}
else
{
arg += s;
}
break;
}
//--------------------------------------/
case VAR_PARSE_STATE_FUNCTION:
{
if(s == CMD_TXT_BRACKET_START)
{
return parse_function_arg(arg, GetStringRight(cmd, cmd_str_len - cmd_str_pos-1), user);
}
else if(get_char_valid_name(s))
{
arg += s;
}
else
{
parse_state = VAR_PARSE_STATE_ERROR;
}
break;
}
//--------------------------------------/
case VAR_PARSE_STATE_NUM:
{
if(get_char_valid_num(s))
{
arg += s;
if(cmd_str_pos == cmd_str_len-1)
{
return arg;
}
}
else
{
parse_state = VAR_PARSE_STATE_ERROR;
}
break;
}
//--------------------------------------/
case VAR_PARSE_STATE_ERROR:
{
SendMessageToPC(user, "var: " + CMD_ERROR_MSG);
return CMD_ERROR_STRING;
}
}
cmd_str_pos++;
s = GetSubString(cmd, cmd_str_pos, 1);
}
////
SendMessageToPC(user, "var: " + CMD_ERROR_MSG);
return CMD_ERROR_STRING;
}
//==========================================/
string parse_function_arg(string function_name, string cmd, object user)
//==========================================/
{
string CMD_TXT_QUOTE = GetLocalString(FCB_HOST, CMD_QUOTE);
//function_name( a, b, c, d, ...)
//**************X <- begin here
int exe_index = GetLocalInt(FCB_HOST, CMD_EXE_INDEX) + INCR_F10;
SetLocalInt(FCB_HOST, CMD_EXE_INDEX, exe_index);
string function_arg = "";
int bracket_cnt = 1;
int quote_state = 0;
int parse_state = CMD_PARSE_STATE_INIT;
int cmd_str_len = GetStringLength(cmd);
int cmd_str_pos = 0;
//kill end spaces
string s = GetSubString(cmd, cmd_str_len-1, 1);
while(cmd_str_len >= 0 && s == CMD_TXT_SPACE)
{
cmd_str_len--;
s = GetSubString(cmd, cmd_str_len-1, 1);
}
//begin
s = GetSubString(cmd, cmd_str_pos, 1);
while(cmd_str_pos <= cmd_str_len)
{
//--------------------------------------/
if(s == CMD_TXT_BRACKET_START)
{
bracket_cnt++;
}
else if(s == CMD_TXT_BRACKET_END)
{
bracket_cnt--;
}
if(bracket_cnt < 0)
{
parse_state = CMD_PARSE_STATE_ERROR;
}
//--------------------------------------/
if(s == CMD_TXT_QUOTE)
{
quote_state = !quote_state;
}
/////
//SpeakString("state: " + IntToString(parse_state));
//SpeakString("arg: " + function_arg);
//--------------------------------------/
switch(parse_state)
{
//--------------------------------------/
case CMD_PARSE_STATE_INIT:
{
if(s == CMD_TXT_BRACKET_END)
{
if(cmd_str_pos == cmd_str_len-1)
{
parse_state = CMD_PARSE_STATE_END;
}
else
{
parse_state = CMD_PARSE_STATE_ERROR;
}
}
else if(s != CMD_TXT_SPACE)
{
function_arg += s;
parse_state = CMD_PARSE_STATE_ARG;
}
break;
}
//--------------------------------------/
case CMD_PARSE_STATE_ARG:
{
if(s == CMD_TXT_COMMA && bracket_cnt == 1 && !quote_state)
{
if(function_arg != CMD_TXT_BLANK)
{
string arg = parse_var(function_arg, user);
if(arg != CMD_ERROR_STRING)
{
store_arg(arg, exe_index);
function_arg = CMD_TXT_BLANK;
}
else
{
parse_state = CMD_PARSE_STATE_ERROR;
}
}
else
{
parse_state = CMD_PARSE_STATE_ERROR;
}
}
else if(s == CMD_TXT_BRACKET_END && bracket_cnt == 0 && !quote_state)
{
if(function_arg != CMD_TXT_BLANK)
{
string arg = parse_var(function_arg, user);
if(arg != CMD_ERROR_STRING)
{
store_arg(arg, exe_index);
if(cmd_str_pos == cmd_str_len-1)
{
parse_state = CMD_PARSE_STATE_END;
}
else
{
parse_state = CMD_PARSE_STATE_ERROR;
}
}
else
{
parse_state = CMD_PARSE_STATE_ERROR;
}
}
else
{
parse_state = CMD_PARSE_STATE_ERROR;
}
}
else
{
function_arg += s;
}
break;
}
//--------------------------------------/
case CMD_PARSE_STATE_END:
{
SetLocalInt(FCB_HOST, CMD_EXE_REF_INDEX, exe_index);
ExecuteScript(CMD_SCRIPT_PREFIX + function_name, FCB_HOST);
DeleteLocalInt(FCB_HOST, CMD_EXE_REF_INDEX);
DeleteLocalInt(FCB_HOST, CMD_ARGS_INDEX_ + IntToHexString(exe_index));
if(get_function_result_valid(exe_index))
{
return get_function_result(exe_index);
}
break;
}
//--------------------------------------/
case CMD_PARSE_STATE_ERROR:
{
SendMessageToPC(user, "function: " + CMD_ERROR_MSG);
DeleteLocalInt(FCB_HOST, CMD_ARGS_INDEX_ + IntToHexString(exe_index));
return CMD_ERROR_STRING;
}
}
cmd_str_pos++;
s = GetSubString(cmd, cmd_str_pos, 1);
}
////
SendMessageToPC(user, "function: " + CMD_ERROR_MSG);
DeleteLocalInt(FCB_HOST, CMD_ARGS_INDEX_ + IntToHexString(exe_index));
return CMD_ERROR_STRING;
}

View File

@@ -0,0 +1,154 @@
//::::::::::::::::::::::::::::::::::::::::::/
//core functions
//::::::::::::::::::::::::::::::::::::::::::/
//==========================================/
//cvgen
//==========================================/
void set_main_folder_index_start(int folder_index);
int create_main_folder(string folder_index_link = "");
int create_main_file_type_link(int folder_target, int file_type_alternate = 0);
int create_main_file_int(int folder_index, string file_name, int file_type, int file_param = 0);
int create_main_file_str(int folder_index, string file_name, int file_type, string file_param = "");
int create_main_file_obj(int folder_index, string file_name, int file_type, object file_param = OBJECT_INVALID);
//==========================================/
//disp_general
//==========================================/
//main header color (light blue)
string c_hdr1(string s);
//header2
string c_hdr2(string s);
//highlight1 (light grey)
string c_hlt1(string s);
//highlight2
string c_hlt2(string s);
//hidden color (dark grey)
string c_hid(string s);
//selected color (white)
string c_sel(string s);
//link file color (very light purple)
string c_fld(string s);
//invalid/out of range (red)
string c_crs(string s);
//returns the color string
string get_color_string_val(int cval);
//set string color to rval, gval, bval (0-255)
string set_string_color(string s, int rval, int gval, int bval);
string set_gradation(string name, int r1, int g1, int b1, int r2, int g2, int b2);
//wrapper for displaying scroll up/down options
string ui_refresh_scroll_up(int condition);
string ui_refresh_scroll_down(int condition);
//==========================================/
//disp_main
//==========================================/
void ui_main_initialize(int folder_index);
void ui_main_refresh_index(int file_dir, int file_dir_sel, int token_index);
void ui_main_refresh(int file_dir_offset, int file_dir_sel);
void ui_main_select(int n);
void ui_main_scroll_down();
void ui_main_scroll_up();
void ui_main_set_hidden(int file_dir, int hidden);
void ui_main_set_hidden_refresh(int file_dir, int hidden);
void remove_main_file_dir(int file_dir, int token_index);
void clear_main_folder(int file_dir);
void set_main_file_name_color(int file_dir, int rval, int gval, int bval);
void clear_main_file_name_color(int file_dir);
//==========================================/
//disp_stack
//==========================================/
void ui_stack_back();
void ui_stack_index(int index);
//==========================================/
//cvresp
//==========================================/
void ui_disp_initialize();
void ui_disp_refresh_txt();
void ui_disp_state_new(int n, int disp);
void ui_disp_set_txt(int n, string hdr, string txt = "");
void ui_disp_clear_local();
void ui_set_active_disp_index(int disp_index1 = -1, int disp_index2 = -1);
//::::::::::::::::::::::::::::::::::::::::::/
//plugin functions
//::::::::::::::::::::::::::::::::::::::::::/
//==========================================/
//parser
//==========================================/
int get_char_valid_num(string s);
int get_char_valid_letter(string s);
int get_char_valid_name(string s);
int get_is_number(string num);
void store_arg(string function_arg, int exe_index);
string retrieve_arg(int args_index);
void set_function_result(string result);
string get_function_result(int exe_index);
void set_function_result_valid();
int get_function_result_valid(int exe_index);
string parse_init(string input);
string parse_var(string cmd, object user);
string parse_function_arg(string function_name, string cmd, object user);
//==========================================/
//general
//==========================================/
void switch_forge_enable(int enable);
void switch_ILR_enable(int enable);
void start_conversation(object user);
int get_character_level(object user);
int get_item_cost(object item);
int item_level_search(int cost, int begin, int end);
int get_item_level(object item);
int get_item_level_by_cost(int cost);
object copy_item(object item, object target_inventory);
int get_item_stack_size(object item);
int give_gold(int gp_amount, object user);
int iprp_to_param(itemproperty iprp);
itemproperty param_to_iprp(int param);
itemproperty convert_iprp(int param0, int param1, int param2, int param3);
int get_item_inventory_slot(object item, object user);
void equip_item(object item, int equip_slot, object user);
void disp_delayed_msg(object user, string msg);
void visual_effect();
void clear_script_param();
//==========================================/
//general type
//==========================================/
void select_working_item(object item);
object get_working_item();
object set_working_item_name(string name);
//==========================================/
//iprp related
//==========================================/
string ui_iprp_display(itemproperty iprp);
string ui_item_flags_disp(object item);
string ui_item_stack_disp(object item);
string ui_iprp_list(object item);
string ui_item_header(object item, int item_cost = -1);
string initialize_iprp_list(object item);
string iprp_addto(object item, itemproperty iprp_add);
void iprp_remove_all(object item);
string get_item_type_2da_column(object item);
void ui_iprp_list_filter(object item);
//==========================================/
//inv related
//==========================================/
string inv_list_index_name(object item);
void initialize_inv_list(object user);
//==========================================/
//array generation
//==========================================/
void array_main();
void menu_main();
void iprp_main(int iprp_main_row, int iprp_main_endrow);
int iprp_subtype_file(string subtype_resref, string costtable_resref, string paramtable_resref, int file_type_menu);
int iprp_cost_param1_file(string costtable_resref, string paramtable_resref, int file_type_menu);
void chcnt_main();

View File

@@ -0,0 +1,331 @@
#include "fcb_inc_prot"
//==========================================/
//general
//==========================================/
//==========================================/
void select_working_item(object item)
//==========================================/
{
//--------------------------------------/
//make blank copy of item
SetIdentified(item, 1);
SetLocalObject(FCB_HOST, ITEM_WORKING_SEL, item);
DestroyObject(GetLocalObject(FCB_HOST, ITEM_WORKING_SEL_BLANK));
object item_copy = copy_item(item, FCB_INV);
iprp_remove_all(item_copy);
SetLocalObject(FCB_HOST, ITEM_WORKING_SEL_BLANK, item_copy);
//--------------------------------------/
//filter iprp list
ui_iprp_list_filter(item);
//create iprp remove list
ui_item_header(item);
initialize_iprp_list(item);
}
//==========================================/
object get_working_item()
//==========================================/
{
return GetLocalObject(FCB_HOST, ITEM_WORKING_SEL);
}
//==========================================/
object set_working_item_name(string name)
//==========================================/
{
object working_item = get_working_item();
SetName(working_item, name);
return working_item;
}
//==========================================/
//iprp related
//==========================================/
//==========================================/
string ui_iprp_display(itemproperty iprp)
//==========================================/
{
string iprp_string = "";
string paramtable_row = "";
//----------------------------------------//
int itempropdef_row = GetItemPropertyType(iprp);
string game_strref = Get2DAString("itempropdef", "GameStrRef", itempropdef_row);
if(game_strref != "")
{
iprp_string += GetStringByStrRef(StringToInt(game_strref));
}
//----------------------------------------//
int subtype_row = GetItemPropertySubType(iprp);
string subtype_resref = Get2DAString("itempropdef", "SubTypeResRef", itempropdef_row);
if(subtype_resref != "")
{
string subtype_strref = Get2DAString(subtype_resref, "Name", subtype_row);
if(subtype_strref != "")
{
iprp_string += UI_TXT_SPACE + GetStringByStrRef(StringToInt(subtype_strref));
}
//param1 override
//----------------------------------------//
paramtable_row = Get2DAString(subtype_resref, "Param1ResRef", subtype_row);
//----------------------------------------//
}
//----------------------------------------//
//string costtable_row = Get2DAString("itempropdef", "CostTableResRef", itempropdef_row);
int costtable_row = GetItemPropertyCostTable(iprp);
if(costtable_row > 0)
{
string costtable_resref = Get2DAString("IPRP_COSTTABLE", "Name", costtable_row);
string costtable_strref = Get2DAString(costtable_resref, "Name", GetItemPropertyCostTableValue(iprp));
if(costtable_strref != "")
{
iprp_string += UI_TXT_SPACE + GetStringByStrRef(StringToInt(costtable_strref));
}
}
//----------------------------------------//
if(paramtable_row == "")
{
paramtable_row = Get2DAString("itempropdef", "Param1ResRef", itempropdef_row);
}
if(paramtable_row != "")
{
string param1_resref = Get2DAString("IPRP_PARAMTABLE", "TableResRef", StringToInt(paramtable_row));
string param1_strref = Get2DAString(param1_resref, "Name", GetItemPropertyParam1Value(iprp));
if(param1_strref != "")
{
iprp_string += UI_TXT_SPACE + GetStringByStrRef(StringToInt(param1_strref));
}
}
return iprp_string;
}
//==========================================/
string ui_item_stack_disp(object item)
//==========================================/
{
return UI_TXT_BRACKET2_START + UI_TXT_UNIT_STACK + IntToString(GetItemStackSize(item)) + UI_TXT_BRACKET2_END;
}
//==========================================/
string ui_iprp_list(object item)
//==========================================/
{
string iprp_list = ui_item_header(item);
itemproperty iprp = GetFirstItemProperty(item);
while(GetIsItemPropertyValid(iprp))
{
iprp_list += UI_TXT_INDENT + ui_iprp_display(iprp);
iprp = GetNextItemProperty(item);
}
return iprp_list;
}
//==========================================/
string ui_item_header(object item, int item_cost = -1)
//==========================================/
{
string name = GetName(item);
string name_original = GetName(item, 1);
if(name != name_original)
{
name += c_hid(UI_TXT_SPACE + UI_TXT_BRACKET2_START + name_original + UI_TXT_BRACKET2_END);
}
name += UI_TXT_SPACE + c_hlt1(ui_item_stack_disp(item));
string baseitem_type = GetStringByStrRef(StringToInt(Get2DAString("baseitems", "Name", GetBaseItemType(item))));
string item_header = UI_TXT_HEADER_BASEITEM + baseitem_type;
item_header += UI_TXT_INDENT + UI_TXT_HEADER_CHARGE + IntToString(GetItemCharges(item));
//--------------------------------------/
if(item_cost < 0)
{
item_cost = get_item_cost(item);
}
item_header += UI_TXT_INDENT + UI_TXT_HEADER_COST + IntToString(item_cost) + UI_TXT_UNIT_GP + UI_TXT_SPACE;
int item_level = get_item_level_by_cost(item_cost);
if(item_level > get_character_level(GetLocalObject(FCB_HOST, USER)))
{
item_header += UI_TXT_BRACKET2_START + c_crs(UI_TXT_UNIT_LV + IntToString(item_level)) + UI_TXT_BRACKET2_END;
}
else
{
item_header += UI_TXT_BRACKET2_START + UI_TXT_UNIT_LV + IntToString(item_level) + UI_TXT_BRACKET2_END;
}
//--------------------------------------/
item_header = name + UI_TXT_INDENT + c_hlt1(item_header);
SetLocalString(FCB_HOST, ITEM_HEADER_TXT, item_header);
ui_disp_set_txt(DISP_INDEX_HEADER, UI_TXT_ITEM_WORKING_CURRENT, item_header);
return item_header;
}
//==========================================/
string initialize_iprp_list(object item)
//==========================================/
{
clear_main_folder(MAIN_FOLDER_INDEX_IPRPR);
int file_type_menu = create_main_file_type_link(SCRIPT_INDEX_IPRPR_SEL_0 | MAIN_FOLDER_INDEX_IPRPR_MENU);
string iprp_list = "";
itemproperty iprp = GetFirstItemProperty(item);
if(GetIsItemPropertyValid(iprp))
{
string iprp_txt = ui_iprp_display(iprp);
create_main_file_int(MAIN_FOLDER_INDEX_IPRPR, iprp_txt, file_type_menu, iprp_to_param(iprp));
iprp_list = ui_iprp_display(iprp);
}
iprp = GetNextItemProperty(item);
while(GetIsItemPropertyValid(iprp))
{
string iprp_txt = ui_iprp_display(iprp);
create_main_file_int(MAIN_FOLDER_INDEX_IPRPR, iprp_txt, file_type_menu, iprp_to_param(iprp));
iprp_list += UI_TXT_INDENT + iprp_txt;
iprp = GetNextItemProperty(item);
}
SetLocalString(FCB_HOST, ITEM_SEL_TXT, iprp_list);
ui_disp_set_txt(DISP_INDEX_IPRP, UI_TXT_IPRP_CURRENT, iprp_list);
return iprp_list;
}
//==========================================/
string iprp_addto(object item, itemproperty iprp_add)
//==========================================/
{
int file_type_menu = create_main_file_type_link(SCRIPT_INDEX_IPRPR_SEL_0 | MAIN_FOLDER_INDEX_IPRPR_MENU);
AddItemProperty(DURATION_TYPE_PERMANENT, iprp_add, item);
string iprp_txt = ui_iprp_display(iprp_add);
string item_header = ui_item_header(item);
string iprp_list = GetLocalString(FCB_HOST, ITEM_SEL_TXT);
if(iprp_list != "")
{
iprp_list += UI_TXT_INDENT + iprp_txt;
}
else
{
iprp_list = iprp_txt;
}
SetLocalString(FCB_HOST, ITEM_SEL_TXT, iprp_list);
create_main_file_int(MAIN_FOLDER_INDEX_IPRPR, iprp_txt, file_type_menu, iprp_to_param(iprp_add));
ui_disp_set_txt(DISP_INDEX_HEADER, UI_TXT_ITEM_WORKING_CURRENT, item_header);
ui_disp_set_txt(DISP_INDEX_IPRP, UI_TXT_IPRP_CURRENT, iprp_list);
return iprp_list;
}
//==========================================/
void iprp_remove_all(object item)
//==========================================/
{
itemproperty iprp = GetFirstItemProperty(item);
while(GetIsItemPropertyValid(iprp))
{
RemoveItemProperty(item, iprp);
iprp = GetNextItemProperty(item);
}
}
//::::::::::::::::::::::::::::::::::::::::::/
string get_item_type_2da_column(object item)
//::::::::::::::::::::::::::::::::::::::::::/
{
if(GetIsObjectValid(item))
{
int base_item_type = GetBaseItemType(item);
string column_strref = Get2DAString("baseitems", "PropColumn", base_item_type);
if(column_strref != "")
{
switch(StringToInt(column_strref))
{
case 0: return "0_Melee";
case 1: return "1_Ranged";
case 2: return "2_Thrown";
case 3: return "3_Staves";
case 4: return "4_Rods";
case 5: return "5_Ammo";
case 6: return "6_Arm_Shld";
case 7: return "7_Helm";
case 8: return "8_Potions";
case 9: return "9_Scrolls";
case 10: return "10_Wands";
case 11: return "11_Thieves";
case 12: return "12_TrapKits";
case 13: return "13_Hide";
case 14: return "14_Claw";
case 15: return "15_Misc_Uneq";
case 16: return "16_Misc";
case 17: return "17_No_Props";
case 18: return "18_Containers";
case 19: return "19_HealerKit";
case 20: return "20_Torch";
case 21: return "21_Glove";
}
}
}
return "";
}
//==========================================/
void ui_iprp_list_filter(object item)
//==========================================/
{
string column = get_item_type_2da_column(item);
int file_dir = MAIN_FOLDER_INDEX_IPRP + UI_MAIN_DEFAULT_OFFSET;
int file_dir_max = GetLocalInt(FCB_HOST, MAIN_FILE_INDEX_ + IntToHexString(FILTER_F10 & file_dir));
while(file_dir <= file_dir_max)
{
int file_param = GetLocalInt(FCB_HOST, MAIN_FILE_PARAM_ + IntToHexString(file_dir));
if(Get2DAString("itemprops", column, file_param) != "")
{
ui_main_set_hidden(file_dir, 0);
}
else
{
ui_main_set_hidden(file_dir, 1);
}
file_dir++;
}
}

View File

@@ -0,0 +1,353 @@
//--------------------------------------/
//Bit distribution guide
//--------------------------------------/
//stack_state:
//[free 31:30][stack view offset 29:20][stack index max 19:10][stack select index 9:0]
//stack param:
//[free 31:30][main view offset 29:20][main folder index 19:10][main selected index 9:0]
//file_dir:
//[free 31:20][folder index 19:10][file index 9:0]
//file type:
//[hidden bit 31][link bit 30][script index 29:20][folder target 19:10][free 9:0]
//file color:
//[free 31:25][valid bit 24][red 23:16][green 15:8][blue 7:0]
//item properties:
//[type 31:25][subtype 24:15][cost 14:7][param1 6:0]
//--------------------------------------/
//local var names for switches
//--------------------------------------/
const string SW_ILR_ENABLE = "SW_ILR_ENABLE";
//--------------------------------------/
//OBJECT REFERENCES
//--------------------------------------/
//object to store all local variables
object FCB_HOST = GetObjectByTag("CS1_ITEMPROPHELP");
//object to perform temporary item swapping/caching
object FCB_INV = GetObjectByTag("CS1_ITEMPROPHELP");
//object to start conversation with
object FCB_CV = GetObjectByTag("CS1_ITEMPROPHELP");
//listener to pickup commands
object FCB_LIS = GetObjectByTag("CS1_ITEMPROPHELP");
//put an item on this object to customize it
object EXT_PLACEABLE = GetObjectByTag("pAnvilOfWonder");
//--------------------------------------/
//MISC CONSTANTS
//--------------------------------------/
//maximum item level calculated (no enchantment restriction based on level)
const int ITEM_LEVEL_MAX = 60;
//listening numbers
const int ITEM_CHARGE_CNT_MAX = 50;
//delay constant for displaying delayed message
const float INFO_MSG_DELAY = 0.1;
//modify item visual effect
const int MOD_VISUAL_EFFECT = VFX_IMP_LIGHTNING_S;
//max color intensity: 255
const int COLOR_VAL_MAX = 0xFF;
//color string
const string COLOR_STRING = "fcb_color_string";
const int COLOR_STRING_LEN = 17;
const string COLOR_TAG_END = "</c>";
//quote stored as local var
const string CMD_QUOTE = "cmd_txt_quote";
const int LISTEN_NUMBER_STANDARD = 100;
//main conversation file
const string CV_MAIN = "fcb_cv_main";
//--------------------------------------/
//script names
//--------------------------------------/
//local variable text
const string FCB_SCRIPT_PREFIX = "fcb_";
const string SCRIPT_MAIN_OPTION_HANDLER = "_main";
//--------------------------------------/
//LOCAL VAR NAMES
//--------------------------------------/
const string COLOR_STRING_CACHE_ = "COLOR_STRING_CACHE_";
//misc
const string USER = "FCB_USER";
const string SCRIPT_PARAM = "SCRIPT_PARAM";
const string SETNAME_SEL = "SETNAME_SEL";
const string CHARGE_SEL = "CHARGE_SEL";
const string IPRP_SEL_TXT = "IPRP_SEL_TXT";
const string IPRP_PARAM_SEL_0_1 = "IPRP_PARAM_SEL_0_1";
const string IPRP_PARAM_SEL_2_3 = "IPRP_PARAM_SEL_2_3";
const string IPRP_PARAM_INDEX = "IPRP_PARAM_INDEX";
const string ITEM_SEL_TXT = "ITEM_SEL_TXT";
const string ITEM_WORKING_SEL = "ITEM_WORKING_SEL";
const string ITEM_WORKING_SEL_BLANK = "ITEM_WORKING_SEL_BLANK";
const string ITEM_WORKING_SEL_MOD_COST = "ITEM_WORKING_SEL_MOD_COST";
const string ITEM_HEADER_TXT = "ITEM_HEADER_TXT";
const string FOLDER_INDEX_MAINMENU = "MAINMENU";
const string FOLDER_INDEX_IPRP = "IPRP";
const string FOLDER_INDEX_IPRPR = "IPRPR";
const string FOLDER_INDEX_SETNAME = "SETNAME";
const string FOLDER_INDEX_CHARGE = "CHARGE";
//--------------------------------------/
//local variable strings
const string UI_MAIN_LIST_LEN = "UI_MAIN_LIST_LEN";
const string UI_STACK_LIST_LEN = "UI_STACK_LIST_LEN";
//local variable strings
const string UI_DISP_TXT_ = "UI_DISP_TXT_";
//--------------------------------------/
//local variable text
const string MAIN_FOLDER_INDEX = "MAIN_FOLDER_INDEX";
const string MAIN_FOLDER_INDEX_LINK_ = "MAIN_FOLDER_INDEX_LINK_";
const string MAIN_FILE_INDEX_ = "MAIN_FILE_INDEX_";
const string MAIN_FILE_NAME_ = "MAIN_FILE_NAME_";
const string MAIN_FILE_TYPE_ = "MAIN_FILE_TYPE_";
const string MAIN_FILE_PARAM_ = "MAIN_FILE_PARAM_";
const string MAIN_FILE_INDEX_LINK_ = "MAIN_FILE_INDEX_LINK_";
const string MAIN_FILE_NAME_COLOR_ = "MAIN_FILE_NAME_COLOR_";
//local variable text
const string STACK_STATE = "STACK_STATE";
const string STACK_NAME_ = "STACK_NAME_";
const string STACK_PARAM_ = "STACK_PARAM_";
const string STACK_DISP_SEL_ = "STACK_DISP_SEL_";
//local variable text
const string DISP_STATE = "DISP_STATE";
//--------------------------------------/
//bit lengths/filters/related
//--------------------------------------/
//bit lengths
const int BITLEN_FILE_1 = 10;
const int BITLEN_FILE_2 = 20;
const int BITLEN_COLOR_1 = 8;
const int BITLEN_COLOR_2 = 16;
const int BITLEN_IPRP_TYPE = 7;
const int BITLEN_IPRP_SUB = 10;
const int BITLEN_IPRP_COST = 8;
const int BITLEN_IPRP_PARAM1 = 7;
const int BITLEN_2DA_RANGE = 16;
//--------------------------------------/
//filters
const int FILTER_IPRP_TYPE = 0x7F;
const int FILTER_IPRP_SUB = 0x3FF;
const int FILTER_IPRP_COST = 0xFF;
const int FILTER_IPRP_PARAM1 = 0x7F;
//bit to check/set for use color mode
const int INCR_D1000 = 0x1000000; //1000000000000000000000000
const int FILTER_D1 = 0xFF; //11111111
const int FILTER_D10 = 0xFF00; //1111111100000000
const int FILTER_D100 = 0xFF0000; //111111110000000000000000
//useful filters for filtering 10 bit chunks
const int FILTER_F1 = 0x3FF; // 1111111111
const int FILTER_F10 = 0xFFC00; // 11111111110000000000
const int FILTER_F100 = 0x3FF00000; //111111111100000000000000000000
const int FILTER_F11 = 0xFFFFF; // 11111111111111111111
const int FILTER_F110 = 0x3FFFFC00; //111111111111111111110000000000
const int FILTER_R1 = 0xFFFF;
const int FILTER_R10 = 0xFFFF0000;
//--------------------------------------/
//single bit filters/incrementers
//increments folders, etc
const int INCR_F10 = 0x400; //10000000000
const int INCR_F100 = 0x100000; //100000000000000000000
//high indicates hidden file
const int INCR_HIDDEN = 0x80000000; //10000000000000000000000000000000
//high indicates link to folder
const int INCR_LINK = 0x40000000; // 1000000000000000000000000000000
const int INCR_INPUT_MODE = 0x40000000;
//--------------------------------------/
//default main option offset to set to when refreshing UI
const int UI_MAIN_DEFAULT_OFFSET = 1;
//default index selected when refreshing UI (0 = none)
const int UI_MAIN_DEFAULT_SEL = 0;
//default stack option offset to set to when refreshing UI
const int UI_STACK_DEFAULT_OFFSET = 1;
//default index selected when refreshing UI
const int UI_STACK_DEFAULT_SEL = 1;
//number of main options viewed at once
const int UI_MAIN_LIST_SIZE = 20;
//how much to scroll when using scroll up/down
const int UI_MAIN_SCROLL_INCR = 20;
//number of stack options viewed at once
const int UI_STACK_LIST_SIZE = 4;
//how much to scroll when using scroll up/down
const int UI_STACK_SCROLL_INCR = 1;
//--------------------------------------/
//custom token index start
const int UI_TOKEN_MAIN = 400;
const int UI_TOKEN_DISP = 300;
//--------------------------------------/
//folder indeces of significance pregenerated
const int MAIN_FOLDER_INDEX_MAINMENU = 0x400;
const int MAIN_FOLDER_INDEX_IPRP = 0x1000;
const int MAIN_FOLDER_INDEX_IPRPR = 0x1400;
const int MAIN_FOLDER_INDEX_SETNAME = 0x1800;
const int MAIN_FOLDER_INDEX_CHARGE = 0x2000;
const int MAIN_FOLDER_INDEX_DUPE = 0x2400;
const int MAIN_FOLDER_INDEX_COLORGUIDE = 0x2800;
//menu options folders
const int MAIN_FOLDER_INDEX_IPRP_MENU = 0x3400;
const int MAIN_FOLDER_INDEX_IPRPR_MENU = 0x3C00;
const int MAIN_FOLDER_INDEX_CHARGE_MENU = 0x4000;
//index of last pregenerated folder
const int MAIN_FOLDER_RESERVE_INDEX = 0x4000;
//--------------------------------------/
//file executed script indecies - arbitrary numbering
const int SCRIPT_INDEX_IPRP_SEL_0 = 0x300000;
const int SCRIPT_INDEX_IPRP_SEL_1 = 0x400000;
const int SCRIPT_INDEX_IPRPR_SEL_0 = 0x500000;
const int SCRIPT_INDEX_IPRPR_SEL_1 = 0x600000;
const int SCRIPT_INDEX_SETNAME_SEL_1 = 0xE00000;
const int SCRIPT_INDEX_SETNAME_DEFAULT = 0xF00000;
const int SCRIPT_INDEX_CHARGE_SEL_0 = 0x1300000;
const int SCRIPT_INDEX_CHARGE_SEL_1 = 0x1400000;
const int SCRIPT_INDEX_DUPE_SEL_0 = 0x1500000;
const int SCRIPT_INDEX_DUPE_SEL_1 = 0x1600000;
const int SCRIPT_INDEX_COLORGUIDE = 0x1700000;
//display mode toggeling
const int SCRIPT_INDEX_DISP_IPRP = 0x2000000;
const int SCRIPT_INDEX_DISP_HEADER = 0x2100000;
const int SCRIPT_INDEX_DISP_BLANK = 0x2300000;
const int SCRIPT_INDEX_LISTEN_SETNAME = 0x3000000;
//--------------------------------------/
//number of disp option that can be displayed at once
const int DISP_LIST_SIZE = 4;
//indexes for disp view options
//priority order....
const int DISP_INDEX_INFO = 1;
const int DISP_INDEX_HEADER = 2;
const int DISP_INDEX_IPRP = 3;
const int DISP_INDEX_LOCAL1 = 4;
//index position of last disp option
const int DISP_INDEX_POS = 4;
//--------------------------------------/
//UI text
const string UI_TXT_DOWN = "...scroll down...";
const string UI_TXT_UP = "...scroll up...";
const string UI_TXT_STACK_ROOT = "return to mainmenu";
const string UI_TXT_LINK_PREFIX = "";
//general stuff
const string UI_TXT_INDENT = "\n";
const string UI_TXT_INDENT2 = "\n\n";
const string UI_TXT_BRACKET_START = "[";
const string UI_TXT_BRACKET_END = "]";
const string UI_TXT_BRACKET2_START = "(";
const string UI_TXT_BRACKET2_END = ")";
const string UI_TXT_SPACE = " ";
const string UI_TXT_QUOTE = "'";
const string UI_TXT_COMMA = ",";
const string UI_TXT_UNDERSCORE = "_";
//gold unit
const string UI_TXT_UNIT_GP = " gp";
const string UI_TXT_UNIT_LV = "level ";
const string UI_TXT_UNIT_CHARGE = " charge(s)";
const string UI_TXT_UNIT_STACK = "x";
const string UI_TXT_LV0 = "level 0";
const string UI_TXT_LV1 = "level 1";
const string UI_TXT_LV2 = "level 2";
const string UI_TXT_LV3 = "level 3";
const string UI_TXT_LV4 = "level 4";
const string UI_TXT_LV5 = "level 5";
const string UI_TXT_LV6 = "level 6";
const string UI_TXT_LV7 = "level 7";
const string UI_TXT_LV8 = "level 8";
const string UI_TXT_LV9 = "level 9";
//--------------------------------------/
//menu ui texts
const string UI_TXT_EXT_INVALID = "Place a SINGLE item or a SINGLE STACK of items on the anvil and talk to me again."; //change the color in "fcb_cv"
const string UI_TXT_EXT_INFO = ""; //"Welcome to IGIPE 1.27 plugin for PGC3"; //welcome string here if any
const string UI_TXT_ITEM_WORKING_CURRENT = "Now working on:";
const string UI_TXT_IPRP_CURRENT = "Existing item properties:";
const string UI_TXT_IPRP_SEL = "Add property:";
const string UI_TXT_IPRPR_SEL = "Remove property:";
const string UI_TXT_SETNAME_NONE = "Now listening. Enter a new name for your item in the chat bar...";
const string UI_TXT_SETNAME_ENTERED = "Do you accept the following new name for this item?";
const string UI_TXT_CHARGE_SEL = "New item charge count:";
const string UI_TXT_COST = "Modification cost:";
const string UI_TXT_COST_OUTOFBOUND = "(you do not have enough gold for this modification)";
const string UI_TXT_LEVEL = "Resulting item level:";
const string UI_TXT_LEVEL_OUTOFBOUND = "(you are not high enough level to use this item)";
const string UI_TXT_DUPE_COST = "Cost to duplicate this item:";
const string UI_TXT_IPRP_ENTER = "Add properties to item";
const string UI_TXT_IPRPR_ENTER = "Remove properties from item";
const string UI_TXT_SETNAME_ENTER = "Change item name";
const string UI_TXT_CHARGE_ENTER = "Set item charge count";
const string UI_TXT_DUPE_ENTER = "Duplicate this item";
const string UI_TXT_COLORGUIDE_ENTER = "Guide to colored item names";
const string UI_TXT_IPRPR_MENU_REMOVE = "Remove selected property from item";
const string UI_TXT_IPRP_MENU_ADD_NORMAL = "Add selected property to item";
const string UI_TXT_SETNAME_MENU_ACCEPT = "Accept";
const string UI_TXT_SETNAME_MENU_REENTER = "Listen again for a new name";
const string UI_TXT_SETNAME_MENU_DEFAULT = "Restore item's original name";
const string UI_TXT_CHARGE_MENU_SET = "Accept";
const string UI_TXT_DUPE_MENU_ACCEPT = "Create duplicate in my inventory";
const string UI_TXT_HEADER_BASEITEM = "Base item: ";
const string UI_TXT_HEADER_CHARGE = "Charges: ";
const string UI_TXT_HEADER_COST = "GP value: ";
//--------------------------------------/
//parse stuff
const string CMD_TXT_BRACKET_START = "(";
const string CMD_TXT_BRACKET_END = ")";
const string CMD_TXT_SPACE = " ";
const string CMD_TXT_COMMA = ",";
const string CMD_TXT_CMDSTART = "%";
const string CMD_TXT_BLANK = "";
const int INPUT_PARSE_STATE_INIT = 0;
const int INPUT_PARSE_STATE_CMD = 1;
const int VAR_PARSE_STATE_INIT = 0;
const int VAR_PARSE_STATE_STRING = 1;
const int VAR_PARSE_STATE_FUNCTION = 2;
const int VAR_PARSE_STATE_NUM = 3;
const int VAR_PARSE_STATE_ERROR = 4;
const int CMD_PARSE_STATE_INIT = 0;
const int CMD_PARSE_STATE_ARG = 2;
const int CMD_PARSE_STATE_END = 3;
const int CMD_PARSE_STATE_ERROR = 4;
const string CMD_SCRIPT_PREFIX = "_";
const string CMD_FUNCTION_RESULT_ = "CMD_FUNCTION_RESULT_";
const string CMD_FUNCTION_RESP_VALID_ = "CMD_FUNCTION_VALID_";
const string CMD_EXE_INDEX = "CMD_EXE_INDEX";
const string CMD_EXE_REF_INDEX = "CMD_EXE_REF_INDEX";
const string CMD_ARGS_INDEX_ = "CMD_ARGS_INDEX_";
const string CMD_ARGS_ = "CMD_ARGS_";
const string CMD_ERROR_STRING = "#ERROR#";
const string CMD_ERROR_MSG = "#syntax error#";
const int CMD_VALID_BIT = 0x80000000; //10000000000000000000000000000000
const int CMD_NEG_BIT = 0x40000000;

View File

@@ -0,0 +1,63 @@
#include "fcb_inc_vars"
#include "fcb_inc_cvgen"
#include "fcb_inc_array"
#include "x2_inc_switches"
//==========================================/
void main()
//==========================================/
{
SetListening(FCB_LIS, 1);
SetListenPattern(FCB_LIS, "**", LISTEN_NUMBER_STANDARD);
//--------------------------------------/
array_main();
//--------------------------------------/
// Tag-based scripting is used for PGC3 Configurator, and possibily other things...
// * Item Event Scripts: The game's default event scripts allow routing of all item related events
// * into a single file, based on the tag of that item. If an item's tag is "test", it will fire a
// * script called "test" when an item based event (equip, unequip, acquire, unacquire, activate,...)
// * is triggered. Check "x2_it_example.nss" for an example.
// * This feature is disabled by default.
SetModuleSwitch (MODULE_SWITCH_ENABLE_TAGBASED_SCRIPTS, TRUE);
if (GetModuleSwitchValue (MODULE_SWITCH_ENABLE_TAGBASED_SCRIPTS) == TRUE)
{
// * If Tagbased scripts are enabled, and you are running a Local Vault Server
// * you should use the line below to add a layer of security to your server, preventing
// * people to execute script you don't want them to. If you use the feature below,
// * all called item scrips will be the prefix + the Tag of the item you want to execute, up to a
// * maximum of 16 chars, instead of the pure tag of the object.
// * i.e. without the line below a user activating an item with the tag "test",
// * will result in the execution of a script called "test". If you uncomment the line below
// * the script called will be "1_test.nss"
// SetUserDefinedItemEventPrefix("1_");
}
//--------------------------------------/
// styzygy added this to load items for the persistant chest object
if (GetLocalInt(OBJECT_SELF, "iAllowPChest") == TRUE)
{
object oChest = GetObjectByTag("CS_PCHEST");
string sDB = GetTag(GetModule())+"_PCHEST";
string sTag = "";
int iCount = 0;
//AssignCommand(oChest, SpeakString("Attempting to load items from campaign database."));
int iMax = GetCampaignInt(sDB, "iCount");
if (iMax > 0)
{
for (iCount = 0; iCount < iMax; iCount++)
{
sTag = "PITEM_" + IntToString(iCount);
RetrieveCampaignObject(sDB, sTag, GetLocation(oChest), oChest);
//DeleteCampaignVariable(sDB, sTag);
}
}
}
//--------------------------------------/
}

View File

@@ -0,0 +1,8 @@
#include "fcb_inc_vars"
//==========================================/
int StartingConditional()
//==========================================/
{
return GetLocalInt(FCB_HOST, UI_MAIN_LIST_LEN) > 0;
}

View File

@@ -0,0 +1,8 @@
#include "fcb_inc_vars"
//==========================================/
int StartingConditional()
//==========================================/
{
return GetLocalInt(FCB_HOST, UI_MAIN_LIST_LEN) > 1;
}

View File

@@ -0,0 +1,8 @@
#include "fcb_inc_vars"
//==========================================/
int StartingConditional()
//==========================================/
{
return GetLocalInt(FCB_HOST, UI_MAIN_LIST_LEN) > 2;
}

View File

@@ -0,0 +1,8 @@
#include "fcb_inc_vars"
//==========================================/
int StartingConditional()
//==========================================/
{
return GetLocalInt(FCB_HOST, UI_MAIN_LIST_LEN) > 3;
}

View File

@@ -0,0 +1,8 @@
#include "fcb_inc_vars"
//==========================================/
int StartingConditional()
//==========================================/
{
return GetLocalInt(FCB_HOST, UI_MAIN_LIST_LEN) > 4;
}

View File

@@ -0,0 +1,8 @@
#include "fcb_inc_vars"
//==========================================/
int StartingConditional()
//==========================================/
{
return GetLocalInt(FCB_HOST, UI_MAIN_LIST_LEN) > 5;
}

View File

@@ -0,0 +1,8 @@
#include "fcb_inc_vars"
//==========================================/
int StartingConditional()
//==========================================/
{
return GetLocalInt(FCB_HOST, UI_MAIN_LIST_LEN) > 6;
}

View File

@@ -0,0 +1,8 @@
#include "fcb_inc_vars"
//==========================================/
int StartingConditional()
//==========================================/
{
return GetLocalInt(FCB_HOST, UI_MAIN_LIST_LEN) > 7;
}

View File

@@ -0,0 +1,8 @@
#include "fcb_inc_vars"
//==========================================/
int StartingConditional()
//==========================================/
{
return GetLocalInt(FCB_HOST, UI_MAIN_LIST_LEN) > 8;
}

View File

@@ -0,0 +1,8 @@
#include "fcb_inc_vars"
//==========================================/
int StartingConditional()
//==========================================/
{
return GetLocalInt(FCB_HOST, UI_MAIN_LIST_LEN) > 9;
}

View File

@@ -0,0 +1,8 @@
#include "fcb_inc_vars"
//==========================================/
int StartingConditional()
//==========================================/
{
return GetLocalInt(FCB_HOST, UI_MAIN_LIST_LEN) > 10;
}

View File

@@ -0,0 +1,8 @@
#include "fcb_inc_vars"
//==========================================/
int StartingConditional()
//==========================================/
{
return GetLocalInt(FCB_HOST, UI_MAIN_LIST_LEN) > 11;
}

View File

@@ -0,0 +1,8 @@
#include "fcb_inc_vars"
//==========================================/
int StartingConditional()
//==========================================/
{
return GetLocalInt(FCB_HOST, UI_MAIN_LIST_LEN) > 12;
}

View File

@@ -0,0 +1,8 @@
#include "fcb_inc_vars"
//==========================================/
int StartingConditional()
//==========================================/
{
return GetLocalInt(FCB_HOST, UI_MAIN_LIST_LEN) > 13;
}

View File

@@ -0,0 +1,8 @@
#include "fcb_inc_vars"
//==========================================/
int StartingConditional()
//==========================================/
{
return GetLocalInt(FCB_HOST, UI_MAIN_LIST_LEN) > 14;
}

Some files were not shown because too many files have changed in this diff Show More