Major update
Created top hak for crafting dialog. Moved Bioware creature abilities to top hak. Fixed DMFI wand handouts. Added DMFI language handouts. Added CCOH 6. Disabled PC corpse system. Modified new player startup system. Full compile. Updated release archive.
This commit is contained in:
@@ -495,12 +495,12 @@ void LeaveCorpse()
|
||||
{
|
||||
//SET YOUR LOOTABLE CORPSES PREFERENCES HERE ///////////////
|
||||
//
|
||||
int nUseLootable = FALSE; // Set this to FALSE if you want disable the lootable corpse functionality //
|
||||
int nUseLootable = TRUE; // Set this to FALSE if you want disable the lootable corpse functionality //
|
||||
int nMoveEquipped = FALSE; // Set this to FALSE if you don't want to move Equipped items to the corpse //
|
||||
int nCopyArmour = FALSE; // This will use the ResRef to create a copy of the armour/helmet //
|
||||
int nMoveArmour = FALSE; // Setting this TRUE will just move the armour/helmet (Naked NPCs) //
|
||||
int nDropWeapons = TRUE; // This will use the ResRef for dropping the weapons on the ground //
|
||||
int nMoveWeapons = FALSE; // Setting this TRUE will just move the weapons to the Lootable Object //
|
||||
int nMoveWeapons = FALSE; // Setting this TRUE will just move the weapons to the Lootable Object //
|
||||
int nUseBlood = FALSE; // Set this to TRUE if you want a Bloodspot to appear under the corpse and have //
|
||||
// "gibs" when a corpse is destroyed. Undead/constructs/elementals won't leave a //
|
||||
// Bloodspot or gib. //
|
||||
|
66
_module/nss/mk_cb_deity_chk.nss
Normal file
66
_module/nss/mk_cb_deity_chk.nss
Normal file
@@ -0,0 +1,66 @@
|
||||
#include "mk_inc_debug"
|
||||
#include "mk_inc_2DA_disp"
|
||||
|
||||
void main()
|
||||
{
|
||||
object oPC = OBJECT_SELF;
|
||||
int nRow = GetLocalInt(OBJECT_SELF, MK_2DA_DISP_CALLBACK_ROW);
|
||||
|
||||
int bIgnoreRacialType = GetLocalInt(oPC, "MK_DEITY_IGNORE_RACIALTYPE");
|
||||
int bIgnoreAlignment = GetLocalInt(oPC, "MK_DEITY_IGNORE_ALIGNMENT");
|
||||
int bIgnoreClasses = GetLocalInt(oPC, "MK_DEITY_IGNORE_CLASSES");
|
||||
int bIgnoreGender = GetLocalInt(oPC, "MK_DEITY_IGNORE_GENDER");
|
||||
|
||||
string s2DA = GetLocalString(oPC, "MK_DEITY_2DAFILE");
|
||||
if (s2DA == "") s2DA = "mk_deities";
|
||||
|
||||
int bCheckRacialType = TRUE;
|
||||
if (!bIgnoreRacialType)
|
||||
{
|
||||
bCheckRacialType = MK_Get2DAInt(s2DA, "AllRaces", nRow, 0)
|
||||
|| MK_Get2DAInt("mk_deities", GetLocalString(oPC, "MK_BODY_DEITY_RACIAL_COLUMN"), nRow, 0);
|
||||
}
|
||||
|
||||
int nAlignmentGenderAdjustment = ( GetLocalInt(oPC, "MK_BODY_DEITY_ALIGNMENTGENDER_ADJUST") ? 1 : 0 );
|
||||
|
||||
int bCheckAlignment = TRUE;
|
||||
if (!bIgnoreAlignment)
|
||||
{
|
||||
int nAlignment = MK_Get2DAInt(s2DA, GetLocalString(oPC, "MK_BODY_DEITY_ALIGNMENT_COLUMN"), nRow, 0);
|
||||
if ((nAlignment>0) && (!bIgnoreClasses))
|
||||
{
|
||||
nAlignment-=nAlignmentGenderAdjustment;
|
||||
}
|
||||
bCheckAlignment = nAlignment;
|
||||
}
|
||||
|
||||
int bCheckGender = TRUE;
|
||||
if (!bIgnoreGender)
|
||||
{
|
||||
int nAlignment = MK_Get2DAInt(s2DA, GetLocalString(oPC, "MK_BODY_DEITY_GENDER_COLUMN"), nRow, 0);
|
||||
if ((nAlignment>0) && (!bIgnoreClasses))
|
||||
{
|
||||
nAlignment-=nAlignmentGenderAdjustment;
|
||||
}
|
||||
bCheckGender = nAlignment;
|
||||
}
|
||||
|
||||
int bCheckClasses = TRUE;
|
||||
if (!bIgnoreClasses)
|
||||
{
|
||||
int iClass;
|
||||
for (iClass = 1; iClass<=3; iClass++)
|
||||
{
|
||||
string sColumn = GetLocalString(oPC, "MK_BODY_DEITY_CLASS"+IntToString(iClass)+"_COLUMN");
|
||||
if (sColumn!="")
|
||||
{
|
||||
bCheckClasses = bCheckClasses && MK_Get2DAInt(s2DA, sColumn, nRow);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MK_DEBUG_TRACE("mk_cb_deity_chk: "+Get2DAString("mk_deities", "LABEL", nRow)+"["+IntToString(nRow)+"]: "+IntToString(bCheckRacialType)+", "+IntToString(bCheckAlignment)+", "+IntToString(bCheckGender)+", "+IntToString(bCheckClasses));
|
||||
int bCheck = bCheckRacialType && bCheckAlignment && bCheckGender && bCheckClasses;
|
||||
|
||||
SetLocalInt(OBJECT_SELF, MK_2DA_DISP_CALLBACK_CHECK, bCheck);
|
||||
}
|
28
_module/nss/mk_cb_hd_f_flt.nss
Normal file
28
_module/nss/mk_cb_hd_f_flt.nss
Normal file
@@ -0,0 +1,28 @@
|
||||
// mk_cb_hd_f_flt
|
||||
|
||||
#include "mk_inc_debug"
|
||||
#include "mk_inc_generic"
|
||||
#include "mk_inc_states"
|
||||
#include "mk_inc_head"
|
||||
#include "mk_inc_2da_disp"
|
||||
|
||||
void main()
|
||||
{
|
||||
int bReturn = FALSE;
|
||||
int nState = MK_GenericDialog_GetState();
|
||||
|
||||
switch (nState)
|
||||
{
|
||||
case MK_STATE_HEAD_FILTER:
|
||||
{
|
||||
object oPC = GetPCSpeaker();
|
||||
object oTarget = OBJECT_SELF;
|
||||
int nRow = GetLocalInt(OBJECT_SELF, MK_2DA_DISP_CALLBACK_ROW);
|
||||
bReturn = !MK_HEAD_GetIsFilterEmpty(oPC, oTarget, nRow);
|
||||
MK_DEBUG_TRACE("mk_cb_hd_f_flt: nRow="+IntToString(nRow)+", bReturn="+IntToString(bReturn));
|
||||
break;
|
||||
}
|
||||
}
|
||||
SetLocalInt(OBJECT_SELF, MK_2DA_DISP_CALLBACK_CHECK, bReturn);
|
||||
}
|
||||
|
23
_module/nss/mk_cb_hd_f_label.nss
Normal file
23
_module/nss/mk_cb_hd_f_label.nss
Normal file
@@ -0,0 +1,23 @@
|
||||
// mk_cb_hd_f_label
|
||||
|
||||
#include "mk_inc_tools"
|
||||
#include "mk_inc_2da_disp"
|
||||
#include "mk_inc_tlk"
|
||||
#include "mk_inc_head"
|
||||
|
||||
void main()
|
||||
{
|
||||
object oPC = GetPCSpeaker();
|
||||
object oTarget = OBJECT_SELF;
|
||||
int nRow = GetLocalInt(OBJECT_SELF, MK_2DA_DISP_CALLBACK_ROW);
|
||||
string s2DA = MK_HEAD_Get2DAFile(oPC);
|
||||
MK_DEBUG_TRACE("mk_cb_hd_f_label(oPC='"+GetName(oPC)+"', oTarget='"+GetName(oTarget)+"', s2DA='"+s2DA+"', nRow="+IntToString(nRow)+")");
|
||||
string sLabel = MK_TLK_GetStringByStrRef( MK_HEAD_GetIsFilterSelected(oTarget, nRow) ? -39 : -40 )
|
||||
+ MK_TLK_Get2DAStringByStrRef(s2DA, nRow, "STRREF", "LABEL");
|
||||
MK_DEBUG_TRACE(" > sLabel='"+sLabel+"'");
|
||||
// int nStrRef = MK_Get2DAInt(s2DA, "STRREF", nRow, 0);
|
||||
// string sLabel = (nStrRef!=0 ? MK_TLK_GetStringByStrRef(nStrRef) : Get2DAString(s2DA, "LABEL", nRow));
|
||||
// sLabel = MK_TLK_GetStringByStrRef( MK_HEAD_GetIsFilterSelected(oTarget, nRow) ? -39 : -40, GetGender(oTarget) ) + sLabel;
|
||||
|
||||
SetLocalString(OBJECT_SELF, MK_2DA_DISP_CALLBACK_LABEL, sLabel);
|
||||
}
|
15
_module/nss/mk_cb_hd_label.nss
Normal file
15
_module/nss/mk_cb_hd_label.nss
Normal file
@@ -0,0 +1,15 @@
|
||||
// mk_cb_hd_label
|
||||
|
||||
#include "mk_inc_debug"
|
||||
#include "mk_inc_2da_disp"
|
||||
#include "mk_inc_tools"
|
||||
|
||||
void main()
|
||||
{
|
||||
// object oPC = GetPCSpeaker();
|
||||
// object oTarget = OBJECT_SELF;
|
||||
int nRow = GetLocalInt(OBJECT_SELF, MK_2DA_DISP_CALLBACK_ROW);
|
||||
string sLabel = "Head " + MK_IntToString(nRow, 3, "0");
|
||||
// MK_DEBUG_TRACE("mk_cb_hd_label: nRow="+IntToString(nRow)+", sLabel='"+sLabel+"'");
|
||||
SetLocalString(OBJECT_SELF, MK_2DA_DISP_CALLBACK_LABEL, sLabel);
|
||||
}
|
14
_module/nss/mk_cb_ichrg_chk.nss
Normal file
14
_module/nss/mk_cb_ichrg_chk.nss
Normal file
@@ -0,0 +1,14 @@
|
||||
#include "mk_inc_debug"
|
||||
#include "mk_inc_itm_disp"
|
||||
|
||||
void main()
|
||||
{
|
||||
object oPC = OBJECT_SELF;
|
||||
object oItem = GetLocalObject(oPC, MK_ITM_DISP_CALLBACK_OBJECT);
|
||||
|
||||
int bShowAllItems = GetLocalInt(oPC, "MK_CHEATS_SHOWALLITEMS");
|
||||
|
||||
int bCheck = bShowAllItems || (GetItemCharges(oItem)>0);
|
||||
|
||||
SetLocalInt(OBJECT_SELF, MK_ITM_DISP_CALLBACK_CHECK, bCheck);
|
||||
}
|
22
_module/nss/mk_cb_ichrg_lbl.nss
Normal file
22
_module/nss/mk_cb_ichrg_lbl.nss
Normal file
@@ -0,0 +1,22 @@
|
||||
#include "mk_inc_itm_disp"
|
||||
#include "mk_inc_cheats"
|
||||
|
||||
void main()
|
||||
{
|
||||
object oPC = OBJECT_SELF;
|
||||
object oItem = GetLocalObject(oPC, MK_ITM_DISP_CALLBACK_OBJECT);
|
||||
object oCurrentItem = MK_CHEATS_GetCurrentItem();
|
||||
|
||||
int bIsCurrentItem = (oItem == oCurrentItem);
|
||||
string sColorTag = GetLocalString(oPC, (bIsCurrentItem ? "MK_2DA_DISP_CURRENT_COLOR" : "MK_2DA_DISP_DEFAULT_COLOR"));
|
||||
|
||||
string sLabel = sColorTag+GetName(oItem);
|
||||
int nCharges = GetItemCharges(oItem);
|
||||
if (nCharges>0)
|
||||
{
|
||||
sLabel += (" #" + IntToString(nCharges));
|
||||
}
|
||||
sLabel += "</c>";
|
||||
|
||||
SetLocalString(OBJECT_SELF, MK_ITM_DISP_CALLBACK_LABEL, sLabel);
|
||||
}
|
36
_module/nss/mk_cb_iflag_chk.nss
Normal file
36
_module/nss/mk_cb_iflag_chk.nss
Normal file
@@ -0,0 +1,36 @@
|
||||
#include "mk_inc_debug"
|
||||
#include "mk_inc_states"
|
||||
#include "mk_inc_itm_disp"
|
||||
|
||||
void main()
|
||||
{
|
||||
object oPC = OBJECT_SELF;
|
||||
object oItem = GetLocalObject(oPC, MK_ITM_DISP_CALLBACK_OBJECT);
|
||||
|
||||
int nState = MK_GenericDialog_GetState();
|
||||
|
||||
int bCheck = GetLocalInt(oPC, "MK_CHEATS_SHOWALLITEMS")
|
||||
|| GetLocalInt(oItem, "MK_CHEATS_FLAG_" + IntToString(nState));
|
||||
|
||||
if (!bCheck)
|
||||
{
|
||||
switch (nState)
|
||||
{
|
||||
case MK_STATE_CHEATS_CURSEDFLAG:
|
||||
bCheck = bCheck || GetItemCursedFlag(oItem);
|
||||
break;
|
||||
case MK_STATE_CHEATS_PLOTFLAG:
|
||||
bCheck = bCheck || GetPlotFlag(oItem);
|
||||
break;
|
||||
case MK_STATE_CHEATS_STOLENFLAG:
|
||||
bCheck = bCheck || GetStolenFlag(oItem);
|
||||
break;
|
||||
case MK_STATE_CHEATS_NOTIDENTIFIED:
|
||||
bCheck = bCheck || !GetIdentified(oItem);
|
||||
break;
|
||||
}
|
||||
}
|
||||
// MK_DEBUG_TRACE("mk_cb_iflag_chk (nState="+IntToString(nState)+"): '"+GetName(oItem)+"', bCheck="+IntToString(bCheck));
|
||||
|
||||
SetLocalInt(OBJECT_SELF, MK_ITM_DISP_CALLBACK_CHECK, bCheck);
|
||||
}
|
46
_module/nss/mk_cb_iflag_lbl.nss
Normal file
46
_module/nss/mk_cb_iflag_lbl.nss
Normal file
@@ -0,0 +1,46 @@
|
||||
#include "mk_inc_itm_disp"
|
||||
#include "mk_inc_iprp"
|
||||
#include "mk_inc_states"
|
||||
|
||||
void main()
|
||||
{
|
||||
object oPC = OBJECT_SELF;
|
||||
object oItem = GetLocalObject(oPC, MK_ITM_DISP_CALLBACK_OBJECT);
|
||||
|
||||
string sLabel = MK_IPRP_GetItemName(oItem, TRUE);
|
||||
|
||||
string sColorTag = GetLocalString(oPC, "MK_CHEATS_FLAGS_COLOR");
|
||||
string sCloseTag = "</c>";
|
||||
|
||||
int nState = MK_GenericDialog_GetState();
|
||||
|
||||
switch (nState)
|
||||
{
|
||||
case MK_STATE_CHEATS_CURSEDFLAG:
|
||||
if (GetItemCursedFlag(oItem))
|
||||
{
|
||||
sLabel += (sColorTag + " *" + GetStringByStrRef(111874) + "*" + sCloseTag);
|
||||
}
|
||||
break;
|
||||
case MK_STATE_CHEATS_PLOTFLAG:
|
||||
if (GetPlotFlag(oItem))
|
||||
{
|
||||
sLabel += (sColorTag + " *" + GetStringByStrRef(6808) + "*" + sCloseTag); // or 7520?
|
||||
}
|
||||
break;
|
||||
case MK_STATE_CHEATS_STOLENFLAG:
|
||||
if (GetStolenFlag(oItem))
|
||||
{
|
||||
sLabel += (sColorTag + " *" + GetStringByStrRef(7102) + "*" + sCloseTag);
|
||||
}
|
||||
break;
|
||||
case MK_STATE_CHEATS_NOTIDENTIFIED:
|
||||
if (!GetIdentified(oItem))
|
||||
{
|
||||
// Postfix already done by MK_IPRP_GetItemName()
|
||||
sLabel = sColorTag + sLabel + sCloseTag;
|
||||
}
|
||||
break;
|
||||
}
|
||||
SetLocalString(OBJECT_SELF, MK_ITM_DISP_CALLBACK_LABEL, sLabel);
|
||||
}
|
50
_module/nss/mk_cb_iprp_chk.nss
Normal file
50
_module/nss/mk_cb_iprp_chk.nss
Normal file
@@ -0,0 +1,50 @@
|
||||
#include "mk_inc_debug"
|
||||
#include "mk_inc_2da_disp"
|
||||
#include "mk_inc_tlk"
|
||||
#include "mk_inc_iprp"
|
||||
#include "mk_inc_cheats"
|
||||
#include "mk_inc_states"
|
||||
|
||||
const string s2DAfile = "itempropdef";
|
||||
const string sColumnStrRef = "Name";
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
object oPC = OBJECT_SELF;
|
||||
|
||||
int bCheck=TRUE;
|
||||
int bShowCurrentOnly = GetLocalInt(oPC, "MK_CHEATS_ITEMPROPS_SHOWCURRENTONLY");
|
||||
|
||||
if (bShowCurrentOnly)
|
||||
{
|
||||
int nRow = GetLocalInt(OBJECT_SELF, MK_2DA_DISP_CALLBACK_ROW);
|
||||
|
||||
object oItem = MK_CHEATS_GetCurrentItem();
|
||||
int nIProp = MK_CHEATS_GetCurrentItemPropertyID();
|
||||
int nSubType = MK_CHEATS_GetCurrentItemPropertySubType();
|
||||
int nCostTableValue = MK_CHEATS_GetCurrentItemPropertyCostTableValue();
|
||||
|
||||
int nState = MK_GenericDialog_GetState();
|
||||
|
||||
itemproperty iProp;
|
||||
switch (nState)
|
||||
{
|
||||
case MK_STATE_CHEATS_ITEMPROPS_PROPERTY:
|
||||
iProp = MK_IPRP_GetItemProperty(oItem, nRow);
|
||||
break;
|
||||
case MK_STATE_CHEATS_ITEMPROPS_SUBTYPE:
|
||||
iProp = MK_IPRP_GetItemProperty(oItem, nIProp, nRow);
|
||||
break;
|
||||
case MK_STATE_CHEATS_ITEMPROPS_COSTTABLE:
|
||||
iProp = MK_IPRP_GetItemProperty(oItem, nIProp, nSubType, nRow);
|
||||
break;
|
||||
case MK_STATE_CHEATS_ITEMPROPS_PARAM1:
|
||||
iProp = MK_IPRP_GetItemProperty(oItem, nIProp, nSubType, nCostTableValue, nRow);
|
||||
break;
|
||||
}
|
||||
bCheck = GetIsItemPropertyValid(iProp);
|
||||
}
|
||||
|
||||
SetLocalInt(OBJECT_SELF, MK_2DA_DISP_CALLBACK_CHECK, bCheck);
|
||||
}
|
42
_module/nss/mk_cb_iprp_ctlbl.nss
Normal file
42
_module/nss/mk_cb_iprp_ctlbl.nss
Normal file
@@ -0,0 +1,42 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// mk_cb_iprp_ctlbl
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// callback itemproperty costtablevalue label
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "mk_inc_debug"
|
||||
#include "mk_inc_2da_disp"
|
||||
#include "mk_inc_tlk"
|
||||
#include "mk_inc_iprp"
|
||||
#include "mk_inc_cheats"
|
||||
|
||||
//const string s2DAfile = "itempropdef";
|
||||
const string sColumnStrRef = "Name";
|
||||
|
||||
void main()
|
||||
{
|
||||
object oPC = OBJECT_SELF;
|
||||
int nRow = GetLocalInt(OBJECT_SELF, MK_2DA_DISP_CALLBACK_ROW);
|
||||
object oItem = MK_CHEATS_GetCurrentItem();
|
||||
|
||||
string s2DAFile = MK_2DA_DISPLAY_Get2DAFileName();
|
||||
|
||||
int nStrRef = MK_Get2DAInt(s2DAFile, sColumnStrRef, nRow, -1);
|
||||
|
||||
int nIPropID = MK_CHEATS_GetCurrentItemPropertyID();
|
||||
int nSubType = MK_CHEATS_GetCurrentItemPropertySubType();
|
||||
// int nParam1 = MK_CHEATS_GetCurrentItemPropertyParam1();
|
||||
|
||||
itemproperty iProp = MK_IPRP_GetItemProperty(oItem, nIPropID, nSubType, nRow);
|
||||
int bHasIProp = GetIsItemPropertyValid(iProp);
|
||||
|
||||
// MK_DEBUG_TRACE("mk_cb_iprp_ctlbl: nIProp="+IntToString(nRow)
|
||||
// +", nStrRef="+IntToString(nStrRef)
|
||||
// +", bHasIProp="+IntToString(bHasIProp));
|
||||
|
||||
int nGender = GetGender(OBJECT_SELF);
|
||||
string sColorTag = GetLocalString(oPC, (bHasIProp ? "MK_2DA_DISP_CURRENT_COLOR" : "MK_2DA_DISP_DEFAULT_COLOR"));
|
||||
string sLabel = sColorTag + GetStringByStrRef(nStrRef, nGender) + " [#"+IntToString(nRow)+"]</c>";
|
||||
|
||||
SetLocalString(OBJECT_SELF, MK_2DA_DISP_CALLBACK_LABEL, sLabel);
|
||||
}
|
21
_module/nss/mk_cb_iprp_ftchk.nss
Normal file
21
_module/nss/mk_cb_iprp_ftchk.nss
Normal file
@@ -0,0 +1,21 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// mk_cb_iprp_ftchk
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// callback itemproperty feat check
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "mk_inc_2da_disp"
|
||||
#include "mk_inc_iprp"
|
||||
|
||||
void main()
|
||||
{
|
||||
object oPC = OBJECT_SELF;
|
||||
int nRow = GetLocalInt(OBJECT_SELF, MK_2DA_DISP_CALLBACK_ROW);
|
||||
|
||||
int nFeatIndex = MK_Get2DAInt("iprp_feats", "FeatIndex", nRow);
|
||||
object oItem = GetItemInSlot(INVENTORY_SLOT_CARMOUR, oPC);
|
||||
|
||||
int bCheck = !GetHasFeat(nFeatIndex, oPC) || MK_IPRP_GetItemHasFeat(oItem, nRow);
|
||||
|
||||
SetLocalInt(OBJECT_SELF, MK_2DA_DISP_CALLBACK_CHECK, bCheck);
|
||||
}
|
41
_module/nss/mk_cb_iprp_ftlbl.nss
Normal file
41
_module/nss/mk_cb_iprp_ftlbl.nss
Normal file
@@ -0,0 +1,41 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// mk_cb_iprp_ftlbl
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// callback itemproperty feat label
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "mk_inc_debug"
|
||||
#include "mk_inc_2da_disp"
|
||||
#include "mk_inc_tlk"
|
||||
#include "mk_inc_iprp"
|
||||
|
||||
const string s2DAfile = "iprp_feats";
|
||||
const string sColumnFeatIndex = "FeatIndex";
|
||||
const string sColumnStrRef = "Name";
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
object oPC = OBJECT_SELF;
|
||||
int nRow = GetLocalInt(OBJECT_SELF, MK_2DA_DISP_CALLBACK_ROW);
|
||||
|
||||
int nFeat = nRow;
|
||||
int nFeatIndex = MK_Get2DAInt(s2DAfile, sColumnFeatIndex, nRow, -1);
|
||||
int nStrRef = MK_Get2DAInt(s2DAfile, sColumnStrRef, nRow, -1);
|
||||
|
||||
object oItem = GetItemInSlot(INVENTORY_SLOT_CARMOUR, oPC);
|
||||
|
||||
int bHasFeat = MK_IPRP_GetItemHasFeat(oItem, nFeat);
|
||||
|
||||
// MK_DEBUG_TRACE("mk_cb_iprp_ftlbl: nFeat="+IntToString(nFeat)
|
||||
// +", nFeatIndex="+IntToString(nFeatIndex)
|
||||
// +", nStrRef="+IntToString(nStrRef)
|
||||
// +", bHasFeat="+IntToString(bHasFeat));
|
||||
|
||||
int nGender = GetGender(OBJECT_SELF);
|
||||
string sColorTag = GetLocalString(oPC, (bHasFeat ? "MK_2DA_DISP_CURRENT_COLOR" : "MK_2DA_DISP_DEFAULT_COLOR"));
|
||||
string sLabel = sColorTag + MK_TLK_GetStringByStrRef( bHasFeat ? -39 : -40, nGender )
|
||||
+ GetStringByStrRef(nStrRef, nGender) + " [#"+IntToString(nFeatIndex)+"]</c>";
|
||||
|
||||
SetLocalString(OBJECT_SELF, MK_2DA_DISP_CALLBACK_LABEL, sLabel);
|
||||
}
|
48
_module/nss/mk_cb_iprp_iflbl.nss
Normal file
48
_module/nss/mk_cb_iprp_iflbl.nss
Normal file
@@ -0,0 +1,48 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// mk_cb_iprp_iflbl
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// callback itemproperty item filter label
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "mk_inc_debug"
|
||||
#include "mk_inc_2da_disp"
|
||||
#include "mk_inc_tlk"
|
||||
#include "mk_inc_cheats"
|
||||
//#include "mk_inc_iprp"
|
||||
|
||||
const string s2DAfile = "iprp_feats";
|
||||
const string sColumnFeatIndex = "FeatIndex";
|
||||
const string sColumnStrRef = "Name";
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
object oPC = OBJECT_SELF;
|
||||
int nRow = GetLocalInt(OBJECT_SELF, MK_2DA_DISP_CALLBACK_ROW);
|
||||
|
||||
int bSelected = MK_CHEATS_GetIsItemTypeSelected(oPC, nRow);
|
||||
|
||||
int nCol;
|
||||
int nStrRef;
|
||||
string sLabel="";
|
||||
int nGender = GetGender(OBJECT_SELF);
|
||||
for (nCol = 1; (nStrRef = MK_Get2DAInt("mk_iprp_cols", "StrRef"+IntToString(nCol), nRow, -1))!=-1; nCol++)
|
||||
{
|
||||
sLabel += (MK_TLK_GetStringByStrRef(nStrRef, nGender) + ", ");
|
||||
}
|
||||
if (sLabel!="")
|
||||
{
|
||||
sLabel = GetStringLeft(sLabel, GetStringLength(sLabel)-2);
|
||||
}
|
||||
|
||||
// MK_DEBUG_TRACE("mk_cb_iprp_ftlbl: nFeat="+IntToString(nFeat)
|
||||
// +", nFeatIndex="+IntToString(nFeatIndex)
|
||||
// +", nStrRef="+IntToString(nStrRef)
|
||||
// +", bHasFeat="+IntToString(bHasFeat));
|
||||
|
||||
string sColorTag = GetLocalString(oPC, (bSelected ? "MK_2DA_DISP_CURRENT_COLOR" : "MK_2DA_DISP_DEFAULT_COLOR"));
|
||||
sLabel = sColorTag + MK_TLK_GetStringByStrRef( bSelected ? -39 : -40, nGender )
|
||||
+ sLabel + "</c>";
|
||||
|
||||
SetLocalString(OBJECT_SELF, MK_2DA_DISP_CALLBACK_LABEL, sLabel);
|
||||
}
|
15
_module/nss/mk_cb_iprp_inlbl.nss
Normal file
15
_module/nss/mk_cb_iprp_inlbl.nss
Normal file
@@ -0,0 +1,15 @@
|
||||
#include "mk_inc_itm_disp"
|
||||
|
||||
void main()
|
||||
{
|
||||
object oPC = OBJECT_SELF;
|
||||
object oItem = GetLocalObject(oPC, MK_ITM_DISP_CALLBACK_OBJECT);
|
||||
|
||||
string sLabel = GetName(oItem);
|
||||
int nBaseItemType = GetBaseItemType(oItem);
|
||||
if ((GetItemStackSize(oItem)>1) || (MK_Get2DAInt("baseitems", "Stacking", nBaseItemType, 1) > 1))
|
||||
{
|
||||
sLabel += (" #" + IntToString(GetItemStackSize(oItem)));
|
||||
}
|
||||
SetLocalString(OBJECT_SELF, MK_ITM_DISP_CALLBACK_LABEL, sLabel);
|
||||
}
|
31
_module/nss/mk_cb_iprp_iplbl.nss
Normal file
31
_module/nss/mk_cb_iprp_iplbl.nss
Normal file
@@ -0,0 +1,31 @@
|
||||
#include "mk_inc_debug"
|
||||
#include "mk_inc_2da_disp"
|
||||
#include "mk_inc_tlk"
|
||||
#include "mk_inc_iprp"
|
||||
#include "mk_inc_cheats"
|
||||
|
||||
const string s2DAfile = "itempropdef";
|
||||
const string sColumnStrRef = "Name";
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
object oPC = OBJECT_SELF;
|
||||
int nRow = GetLocalInt(OBJECT_SELF, MK_2DA_DISP_CALLBACK_ROW);
|
||||
object oItem = MK_CHEATS_GetCurrentItem();
|
||||
|
||||
int nStrRef = MK_Get2DAInt(s2DAfile, sColumnStrRef, nRow, -1);
|
||||
|
||||
itemproperty iProp = MK_IPRP_GetItemProperty(oItem, nRow);
|
||||
int bHasIProp = GetIsItemPropertyValid(iProp);
|
||||
|
||||
// MK_DEBUG_TRACE("mk_cb_iprp_iplbl: nIProp="+IntToString(nRow)
|
||||
// +", nStrRef="+IntToString(nStrRef)
|
||||
// +", bHasIProp="+IntToString(bHasIProp));
|
||||
|
||||
int nGender = GetGender(OBJECT_SELF);
|
||||
string sColorTag = GetLocalString(oPC, (bHasIProp ? "MK_2DA_DISP_CURRENT_COLOR" : "MK_2DA_DISP_DEFAULT_COLOR"));
|
||||
string sLabel = sColorTag + GetStringByStrRef(nStrRef, nGender) + " [#"+IntToString(nRow)+"]</c>";
|
||||
|
||||
SetLocalString(OBJECT_SELF, MK_2DA_DISP_CALLBACK_LABEL, sLabel);
|
||||
}
|
15
_module/nss/mk_cb_iprp_itchk.nss
Normal file
15
_module/nss/mk_cb_iprp_itchk.nss
Normal file
@@ -0,0 +1,15 @@
|
||||
#include "mk_inc_debug"
|
||||
#include "mk_inc_cheats"
|
||||
#include "mk_inc_itm_disp"
|
||||
|
||||
void main()
|
||||
{
|
||||
object oPC = OBJECT_SELF;
|
||||
object oItem = GetLocalObject(oPC, MK_ITM_DISP_CALLBACK_OBJECT);
|
||||
|
||||
int nBaseItemType = GetBaseItemType(oItem);
|
||||
int nItemType = MK_Get2DAInt("baseitems", "PropColumn", nBaseItemType);
|
||||
int bCheck = MK_CHEATS_GetIsItemTypeSelected(oPC, nItemType);
|
||||
|
||||
SetLocalInt(OBJECT_SELF, MK_ITM_DISP_CALLBACK_CHECK, bCheck);
|
||||
}
|
40
_module/nss/mk_cb_iprp_p1lbl.nss
Normal file
40
_module/nss/mk_cb_iprp_p1lbl.nss
Normal file
@@ -0,0 +1,40 @@
|
||||
#include "mk_inc_debug"
|
||||
#include "mk_inc_2da_disp"
|
||||
#include "mk_inc_tlk"
|
||||
#include "mk_inc_iprp"
|
||||
#include "mk_inc_cheats"
|
||||
|
||||
//const string s2DAfile = "itempropdef";
|
||||
const string sColumnStrRef = "Name";
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
object oPC = OBJECT_SELF;
|
||||
int nRow = GetLocalInt(OBJECT_SELF, MK_2DA_DISP_CALLBACK_ROW);
|
||||
object oItem = MK_CHEATS_GetCurrentItem();
|
||||
|
||||
string s2DAFile = MK_2DA_DISPLAY_Get2DAFileName();
|
||||
|
||||
int nStrRef = MK_Get2DAInt(s2DAFile, sColumnStrRef, nRow, -1);
|
||||
|
||||
int nIPropID = MK_CHEATS_GetCurrentItemPropertyID();
|
||||
int nSubType = MK_CHEATS_GetCurrentItemPropertySubType();
|
||||
int nCostTableValue = MK_CHEATS_GetCurrentItemPropertyCostTableValue();
|
||||
|
||||
itemproperty iProp = MK_IPRP_GetItemProperty(oItem, nIPropID, nSubType, nCostTableValue, nRow);
|
||||
int bHasIProp = GetIsItemPropertyValid(iProp);
|
||||
|
||||
// MK_DEBUG_TRACE("mk_cb_iprp_p1lbl: nIProp="+IntToString(nIPropID)
|
||||
// +", nSubType="+IntToString(nSubType)
|
||||
// +", nCostTableValue="+IntToString(nCostTableValue)
|
||||
// +", nParam1Value="+IntToString(nRow)
|
||||
// +", nStrRef="+IntToString(nStrRef)
|
||||
// +", bHasIProp="+IntToString(bHasIProp));
|
||||
|
||||
int nGender = GetGender(OBJECT_SELF);
|
||||
string sColorTag = GetLocalString(oPC, (bHasIProp ? "MK_2DA_DISP_CURRENT_COLOR" : "MK_2DA_DISP_DEFAULT_COLOR"));
|
||||
string sLabel = sColorTag + GetStringByStrRef(nStrRef, nGender) + " [#"+IntToString(nRow)+"]</c>";
|
||||
|
||||
SetLocalString(OBJECT_SELF, MK_2DA_DISP_CALLBACK_LABEL, sLabel);
|
||||
}
|
32
_module/nss/mk_cb_iprp_sklbl.nss
Normal file
32
_module/nss/mk_cb_iprp_sklbl.nss
Normal file
@@ -0,0 +1,32 @@
|
||||
#include "mk_inc_debug"
|
||||
#include "mk_inc_2da_disp"
|
||||
#include "mk_inc_tlk"
|
||||
#include "mk_inc_iprp"
|
||||
#include "mk_inc_cheats"
|
||||
|
||||
const string s2DAfile = "skills";
|
||||
const string sColumnStrRef = "Name";
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
object oPC = OBJECT_SELF;
|
||||
int nRow = GetLocalInt(OBJECT_SELF, MK_2DA_DISP_CALLBACK_ROW);
|
||||
|
||||
int nSkill = nRow;
|
||||
int nStrRef = MK_Get2DAInt(s2DAfile, sColumnStrRef, nRow, -1);
|
||||
|
||||
object oItem = GetItemInSlot(INVENTORY_SLOT_CARMOUR, oPC);
|
||||
|
||||
int nSkillBonus = MK_IPRP_GetSkillBonus(oItem, nSkill, FALSE);
|
||||
int nCurrentSkill = MK_CHEATS_GetCurrentSkill();
|
||||
|
||||
int bHighlight = (nSkillBonus>0) || (nSkill==nCurrentSkill);
|
||||
|
||||
string sLabel = GetLocalString(oPC, (bHighlight ? "MK_2DA_DISP_CURRENT_COLOR" : "MK_2DA_DISP_DEFAULT_COLOR"))
|
||||
+ GetStringByStrRef(nStrRef, GetGender(oPC))
|
||||
+ (bHighlight ? " ("+IntToString(nSkillBonus)+")" : "")
|
||||
+ "</c>";
|
||||
|
||||
SetLocalString(OBJECT_SELF, MK_2DA_DISP_CALLBACK_LABEL, sLabel);
|
||||
}
|
35
_module/nss/mk_cb_iprp_stlbl.nss
Normal file
35
_module/nss/mk_cb_iprp_stlbl.nss
Normal file
@@ -0,0 +1,35 @@
|
||||
#include "mk_inc_debug"
|
||||
#include "mk_inc_2da_disp"
|
||||
#include "mk_inc_tlk"
|
||||
#include "mk_inc_iprp"
|
||||
#include "mk_inc_cheats"
|
||||
|
||||
//const string s2DAfile = "itempropdef";
|
||||
const string sColumnStrRef = "Name";
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
object oPC = OBJECT_SELF;
|
||||
int nRow = GetLocalInt(OBJECT_SELF, MK_2DA_DISP_CALLBACK_ROW);
|
||||
object oItem = MK_CHEATS_GetCurrentItem();
|
||||
|
||||
string s2DAFile = MK_2DA_DISPLAY_Get2DAFileName();
|
||||
|
||||
int nStrRef = MK_Get2DAInt(s2DAFile, sColumnStrRef, nRow, -1);
|
||||
|
||||
int nIPropID = MK_CHEATS_GetCurrentItemPropertyID();
|
||||
|
||||
itemproperty iProp = MK_IPRP_GetItemProperty(oItem, nIPropID, nRow);
|
||||
int bHasIProp = GetIsItemPropertyValid(iProp);
|
||||
|
||||
// MK_DEBUG_TRACE("mk_cb_iprp_stlbl: nIProp="+IntToString(nRow)
|
||||
// +", nStrRef="+IntToString(nStrRef)
|
||||
// +", bHasIProp="+IntToString(bHasIProp));
|
||||
|
||||
int nGender = GetGender(OBJECT_SELF);
|
||||
string sColorTag = GetLocalString(oPC, (bHasIProp ? "MK_2DA_DISP_CURRENT_COLOR" : "MK_2DA_DISP_DEFAULT_COLOR"));
|
||||
string sLabel = sColorTag + GetStringByStrRef(nStrRef, nGender) + " [#"+IntToString(nRow)+"]</c>";
|
||||
|
||||
SetLocalString(OBJECT_SELF, MK_2DA_DISP_CALLBACK_LABEL, sLabel);
|
||||
}
|
16
_module/nss/mk_cb_store_lbl.nss
Normal file
16
_module/nss/mk_cb_store_lbl.nss
Normal file
@@ -0,0 +1,16 @@
|
||||
// mk_cb_hd_f_label
|
||||
|
||||
#include "mk_inc_tools"
|
||||
#include "mk_inc_2da_disp"
|
||||
#include "mk_inc_tlk"
|
||||
#include "mk_inc_cheats"
|
||||
|
||||
void main()
|
||||
{
|
||||
object oPC = OBJECT_SELF;
|
||||
int nRow = GetLocalInt(oPC, MK_2DA_DISP_CALLBACK_ROW);
|
||||
|
||||
string sLabel = MK_CHEATS_GetStoreNameByID(nRow);
|
||||
|
||||
SetLocalString(oPC, MK_2DA_DISP_CALLBACK_LABEL, sLabel);
|
||||
}
|
38
_module/nss/mk_cb_swpip_chk.nss
Normal file
38
_module/nss/mk_cb_swpip_chk.nss
Normal file
@@ -0,0 +1,38 @@
|
||||
#include "mk_inc_debug"
|
||||
#include "mk_inc_itm_disp"
|
||||
#include "mk_inc_generic"
|
||||
#include "mk_inc_states"
|
||||
#include "mk_inc_swp_iprop"
|
||||
|
||||
void main()
|
||||
{
|
||||
object oPC = OBJECT_SELF;
|
||||
object oItem = GetLocalObject(oPC, MK_ITM_DISP_CALLBACK_OBJECT);
|
||||
int nState = MK_GenericDialog_GetState();
|
||||
|
||||
int nBaseItemType = GetBaseItemType(oItem);
|
||||
int nCharges = GetItemCharges(oItem);
|
||||
int nItemType = MK_Get2DAInt("baseitems", "PropColumn", nBaseItemType, -1);
|
||||
|
||||
int bCheck=FALSE;
|
||||
|
||||
switch (nState)
|
||||
{
|
||||
case MK_STATE_CHEATS_SWAPITEMPROPS_ITEM1:
|
||||
bCheck = MK_Get2DAInt("mk_iprp_cols", "SwpIPrp", nItemType, 0);
|
||||
break;
|
||||
case MK_STATE_CHEATS_SWAPITEMPROPS_ITEM2:
|
||||
{
|
||||
object oItem1 = MK_SWAPIPROP_GetItem(MK_STATE_CHEATS_SWAPITEMPROPS_ITEM1);
|
||||
if (GetIsObjectValid(oItem1) && (oItem1!=oItem))
|
||||
{
|
||||
int nItemType1 = MK_Get2DAInt("baseitems", "PropColumn", GetBaseItemType(oItem1), -1);
|
||||
int nCharges1 = GetItemCharges(oItem1);
|
||||
bCheck = (nItemType == nItemType1) && (((nCharges1==0) && (nCharges==0)) || ((nCharges1>0) && (nCharges>0)));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
SetLocalInt(OBJECT_SELF, MK_ITM_DISP_CALLBACK_CHECK, bCheck);
|
||||
}
|
23
_module/nss/mk_cb_vfx_check.nss
Normal file
23
_module/nss/mk_cb_vfx_check.nss
Normal file
@@ -0,0 +1,23 @@
|
||||
#include "mk_inc_debug"
|
||||
//#include "mk_inc_tools"
|
||||
#include "mk_inc_vfx"
|
||||
//#include "mk_inc_generic"
|
||||
//#include "mk_inc_states"
|
||||
#include "mk_inc_2da_disp"
|
||||
|
||||
void main()
|
||||
{
|
||||
object oPC = GetPCSpeaker();
|
||||
object oTarget = OBJECT_SELF;
|
||||
int nVFXMode = MK_VFX_GetVFXMode(oPC);
|
||||
// MK_DEBUG_TRACE("Running mk_cb_vfx_check: );
|
||||
int nRow = GetLocalInt(OBJECT_SELF, MK_2DA_DISP_CALLBACK_ROW);
|
||||
|
||||
int bCheck=MK_VFX_GetVFXIsValid(oPC, nVFXMode, nRow, oTarget);
|
||||
|
||||
// MK_DEBUG_TRACE("mk_cb_vfx_check: nVFXmode="+IntToString(nVFXmode)
|
||||
// +", nRow="+IntToString(nRow)
|
||||
// +", bCheck="+IntToString(bCheck));
|
||||
|
||||
SetLocalInt(OBJECT_SELF, MK_2DA_DISP_CALLBACK_CHECK, bCheck);
|
||||
}
|
62
_module/nss/mk_cb_vfx_filter.nss
Normal file
62
_module/nss/mk_cb_vfx_filter.nss
Normal file
@@ -0,0 +1,62 @@
|
||||
#include "mk_inc_debug"
|
||||
#include "mk_inc_generic"
|
||||
#include "mk_inc_states"
|
||||
#include "mk_inc_tools"
|
||||
#include "mk_inc_2da_disp"
|
||||
#include "mk_inc_version"
|
||||
#include "mk_inc_cep"
|
||||
#include "mk_inc_vfx"
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
int bReturn = TRUE;
|
||||
int nState = MK_GenericDialog_GetState();
|
||||
|
||||
object oPC = GetPCSpeaker();
|
||||
object oTarget = OBJECT_SELF;
|
||||
|
||||
switch (nState)
|
||||
{
|
||||
case MK_STATE_VFX_INIT_FILTER:
|
||||
{
|
||||
string s2DAFile = MK_VFX_Get_VFXModeFile(oPC);
|
||||
int nRow = GetLocalInt(OBJECT_SELF, MK_2DA_DISP_CALLBACK_ROW);
|
||||
int nMajor = MK_Get2DAInt(s2DAFile, "REQ_MAJ", nRow, -1);
|
||||
int nMinor = MK_Get2DAInt(s2DAFile, "REQ_MIN", nRow, -1);
|
||||
string sReqOther = Get2DAString(s2DAFile, "REQ_OTHER", nRow);
|
||||
string s2DA = Get2DAString(s2DAFile, "2DAFILE", nRow);
|
||||
int bDisable = MK_Get2DAInt(s2DAFile, "DISABLE", nRow, 0);
|
||||
|
||||
if (bDisable)
|
||||
{
|
||||
bReturn = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((nMajor>=0) && (nMinor>=0))
|
||||
{
|
||||
bReturn = MK_VERSION_GetIsVersionGreaterEqual(OBJECT_SELF, nMajor, nMinor);
|
||||
}
|
||||
if (bReturn && (sReqOther!=""))
|
||||
{
|
||||
if (sReqOther=="CEP")
|
||||
{
|
||||
bReturn = MK_CEP_GetIsCEPInstalled();
|
||||
}
|
||||
}
|
||||
if (bReturn && (s2DA!=""))
|
||||
{
|
||||
bReturn = (Get2DAString(s2DA, "Label", 0)!="");
|
||||
}
|
||||
|
||||
// MK_DEBUG_TRACE("mk_cb_vfx_filter: nRow="+IntToString(nRow)+", nVersion="+IntToString(nMajor)+"."+IntToString(nMinor)+", other"+sReqOther
|
||||
// +", s2DA="+s2DA
|
||||
// +": bReturn="+IntToString(bReturn));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
SetLocalInt(OBJECT_SELF, MK_2DA_DISP_CALLBACK_CHECK, bReturn);
|
||||
|
||||
}
|
43
_module/nss/mk_cb_vfx_label.nss
Normal file
43
_module/nss/mk_cb_vfx_label.nss
Normal file
@@ -0,0 +1,43 @@
|
||||
#include "mk_inc_tools"
|
||||
#include "mk_inc_2da_disp"
|
||||
#include "mk_inc_states"
|
||||
#include "mk_inc_vfx"
|
||||
#include "mk_inc_generic"
|
||||
#include "mk_inc_tlk"
|
||||
|
||||
void main()
|
||||
{
|
||||
object oPC = GetPCSpeaker();
|
||||
object oTarget = OBJECT_SELF;
|
||||
// SendMessageToPC(GetFirstPC(), "GetPCSpeaker()="+GetName(GetPCSpeaker()));
|
||||
// SendMessageToPC(GetFirstPC(), "OBJECT_SELF="+GetName(OBJECT_SELF));
|
||||
int nVFXMode = MK_VFX_GetVFXMode(oPC);
|
||||
|
||||
// MK_DEBUG_TRACE("Callback script is running! nVFXmode="+IntToString(nVFXmode)+" detected.");
|
||||
|
||||
string sLabel="";
|
||||
|
||||
if (nVFXMode!=-1)
|
||||
{
|
||||
string s2DAFile = MK_VFX_Get2DAFile(oPC, nVFXMode);
|
||||
int nRow = GetLocalInt(OBJECT_SELF, MK_2DA_DISP_CALLBACK_ROW);
|
||||
|
||||
string sName = Get2DAString(s2DAFile, "Label", nRow);
|
||||
|
||||
int nVFX = MK_VFX_GetVFX(oPC, nVFXMode, nRow, oTarget);
|
||||
|
||||
// MK_DEBUG_TRACE("s2DAFile='"+s2DAFile+"', nRow="+IntToString(nRow)+", sName='"+sName+"', sColumn='"+sColumn+"', nVFX="+IntToString(nVFX));
|
||||
|
||||
string sDescription = MK_VFX_GetDescription(nVFXMode, nVFX, sName);
|
||||
int bHasVFX = MK_VFX_GetHasVFX(oPC, nVFX, oTarget);
|
||||
|
||||
// MK_DEBUG_TRACE("s2DAFile='"+s2DAFile+"', nRow="+IntToString(nRow)+", sName='"+sName+"', sColumn='"
|
||||
// +sColumn+"', nVFX="+IntToString(nVFX)+", sDescription='"+sDescription+"', bHasVFX="+IntToString(bHasVFX));
|
||||
int nGender = GetGender(oTarget);
|
||||
|
||||
sLabel = MK_TLK_GetStringByStrRef( bHasVFX ? -39 : -40, nGender ) + sDescription;
|
||||
|
||||
// MK_DEBUG_TRACE("sLabel='"+sLabel+"'");
|
||||
}
|
||||
SetLocalString(OBJECT_SELF, MK_2DA_DISP_CALLBACK_LABEL, sLabel);
|
||||
}
|
6
_module/nss/mk_cond_00.nss
Normal file
6
_module/nss/mk_cond_00.nss
Normal file
@@ -0,0 +1,6 @@
|
||||
#include "mk_inc_generic"
|
||||
|
||||
int StartingConditional()
|
||||
{
|
||||
return MK_GenericDialog_GetCondition(0);
|
||||
}
|
7
_module/nss/mk_cond_01.nss
Normal file
7
_module/nss/mk_cond_01.nss
Normal file
@@ -0,0 +1,7 @@
|
||||
#include "mk_inc_generic"
|
||||
|
||||
int StartingConditional()
|
||||
{
|
||||
return MK_GenericDialog_GetCondition(1);
|
||||
// return (GetLocalInt(OBJECT_SELF, "MK_CONDITION_1")==1);
|
||||
}
|
7
_module/nss/mk_cond_02.nss
Normal file
7
_module/nss/mk_cond_02.nss
Normal file
@@ -0,0 +1,7 @@
|
||||
#include "mk_inc_generic"
|
||||
|
||||
int StartingConditional()
|
||||
{
|
||||
return MK_GenericDialog_GetCondition(2);
|
||||
// return (GetLocalInt(OBJECT_SELF, "MK_CONDITION_2")==1);
|
||||
}
|
7
_module/nss/mk_cond_03.nss
Normal file
7
_module/nss/mk_cond_03.nss
Normal file
@@ -0,0 +1,7 @@
|
||||
#include "mk_inc_generic"
|
||||
|
||||
int StartingConditional()
|
||||
{
|
||||
return MK_GenericDialog_GetCondition(3);
|
||||
// return (GetLocalInt(OBJECT_SELF, "MK_CONDITION_3")==1);
|
||||
}
|
7
_module/nss/mk_cond_04.nss
Normal file
7
_module/nss/mk_cond_04.nss
Normal file
@@ -0,0 +1,7 @@
|
||||
#include "mk_inc_generic"
|
||||
|
||||
int StartingConditional()
|
||||
{
|
||||
return MK_GenericDialog_GetCondition(4);
|
||||
// return (GetLocalInt(OBJECT_SELF, "MK_CONDITION_4")==1);
|
||||
}
|
7
_module/nss/mk_cond_05.nss
Normal file
7
_module/nss/mk_cond_05.nss
Normal file
@@ -0,0 +1,7 @@
|
||||
#include "mk_inc_generic"
|
||||
|
||||
int StartingConditional()
|
||||
{
|
||||
return MK_GenericDialog_GetCondition(5);
|
||||
// return (GetLocalInt(OBJECT_SELF, "MK_CONDITION_5")==1);
|
||||
}
|
7
_module/nss/mk_cond_06.nss
Normal file
7
_module/nss/mk_cond_06.nss
Normal file
@@ -0,0 +1,7 @@
|
||||
#include "mk_inc_generic"
|
||||
|
||||
int StartingConditional()
|
||||
{
|
||||
return MK_GenericDialog_GetCondition(6);
|
||||
// return (GetLocalInt(OBJECT_SELF, "MK_CONDITION_6")==1);
|
||||
}
|
7
_module/nss/mk_cond_07.nss
Normal file
7
_module/nss/mk_cond_07.nss
Normal file
@@ -0,0 +1,7 @@
|
||||
#include "mk_inc_generic"
|
||||
|
||||
int StartingConditional()
|
||||
{
|
||||
return MK_GenericDialog_GetCondition(7);
|
||||
// return (GetLocalInt(OBJECT_SELF, "MK_CONDITION_7")==1);
|
||||
}
|
7
_module/nss/mk_cond_08.nss
Normal file
7
_module/nss/mk_cond_08.nss
Normal file
@@ -0,0 +1,7 @@
|
||||
#include "mk_inc_generic"
|
||||
|
||||
int StartingConditional()
|
||||
{
|
||||
return MK_GenericDialog_GetCondition(8);
|
||||
// return (GetLocalInt(OBJECT_SELF, "MK_CONDITION_8")==1);
|
||||
}
|
7
_module/nss/mk_cond_09.nss
Normal file
7
_module/nss/mk_cond_09.nss
Normal file
@@ -0,0 +1,7 @@
|
||||
#include "mk_inc_generic"
|
||||
|
||||
int StartingConditional()
|
||||
{
|
||||
return MK_GenericDialog_GetCondition(9);
|
||||
// return (GetLocalInt(OBJECT_SELF, "MK_CONDITION_9")==1);
|
||||
}
|
7
_module/nss/mk_cond_10.nss
Normal file
7
_module/nss/mk_cond_10.nss
Normal file
@@ -0,0 +1,7 @@
|
||||
#include "mk_inc_generic"
|
||||
|
||||
int StartingConditional()
|
||||
{
|
||||
return MK_GenericDialog_GetCondition(10);
|
||||
// return (GetLocalInt(OBJECT_SELF, "MK_CONDITION_10")==1);
|
||||
}
|
6
_module/nss/mk_cond_100.nss
Normal file
6
_module/nss/mk_cond_100.nss
Normal file
@@ -0,0 +1,6 @@
|
||||
#include "mk_inc_generic"
|
||||
|
||||
int StartingConditional()
|
||||
{
|
||||
return MK_GenericDialog_GetCondition(100);
|
||||
}
|
6
_module/nss/mk_cond_101.nss
Normal file
6
_module/nss/mk_cond_101.nss
Normal file
@@ -0,0 +1,6 @@
|
||||
#include "mk_inc_generic"
|
||||
|
||||
int StartingConditional()
|
||||
{
|
||||
return MK_GenericDialog_GetCondition(101);
|
||||
}
|
6
_module/nss/mk_cond_102.nss
Normal file
6
_module/nss/mk_cond_102.nss
Normal file
@@ -0,0 +1,6 @@
|
||||
#include "mk_inc_generic"
|
||||
|
||||
int StartingConditional()
|
||||
{
|
||||
return MK_GenericDialog_GetCondition(102);
|
||||
}
|
6
_module/nss/mk_cond_103.nss
Normal file
6
_module/nss/mk_cond_103.nss
Normal file
@@ -0,0 +1,6 @@
|
||||
#include "mk_inc_generic"
|
||||
|
||||
int StartingConditional()
|
||||
{
|
||||
return MK_GenericDialog_GetCondition(103);
|
||||
}
|
7
_module/nss/mk_cond_11.nss
Normal file
7
_module/nss/mk_cond_11.nss
Normal file
@@ -0,0 +1,7 @@
|
||||
#include "mk_inc_generic"
|
||||
|
||||
int StartingConditional()
|
||||
{
|
||||
return MK_GenericDialog_GetCondition(11);
|
||||
// return (GetLocalInt(OBJECT_SELF, "MK_CONDITION_11")==1);
|
||||
}
|
7
_module/nss/mk_cond_12.nss
Normal file
7
_module/nss/mk_cond_12.nss
Normal file
@@ -0,0 +1,7 @@
|
||||
#include "mk_inc_generic"
|
||||
|
||||
int StartingConditional()
|
||||
{
|
||||
return MK_GenericDialog_GetCondition(12);
|
||||
// return (GetLocalInt(OBJECT_SELF, "MK_CONDITION_12")==1);
|
||||
}
|
6
_module/nss/mk_cond_127.nss
Normal file
6
_module/nss/mk_cond_127.nss
Normal file
@@ -0,0 +1,6 @@
|
||||
#include "mk_inc_generic"
|
||||
|
||||
int StartingConditional()
|
||||
{
|
||||
return MK_GenericDialog_GetCondition(127);
|
||||
}
|
7
_module/nss/mk_cond_13.nss
Normal file
7
_module/nss/mk_cond_13.nss
Normal file
@@ -0,0 +1,7 @@
|
||||
#include "mk_inc_generic"
|
||||
|
||||
int StartingConditional()
|
||||
{
|
||||
return MK_GenericDialog_GetCondition(13);
|
||||
// return (GetLocalInt(OBJECT_SELF, "MK_CONDITION_13")==1);
|
||||
}
|
7
_module/nss/mk_cond_14.nss
Normal file
7
_module/nss/mk_cond_14.nss
Normal file
@@ -0,0 +1,7 @@
|
||||
#include "mk_inc_generic"
|
||||
|
||||
int StartingConditional()
|
||||
{
|
||||
return MK_GenericDialog_GetCondition(14);
|
||||
// return (GetLocalInt(OBJECT_SELF, "MK_CONDITION_14")==1);
|
||||
}
|
7
_module/nss/mk_cond_15.nss
Normal file
7
_module/nss/mk_cond_15.nss
Normal file
@@ -0,0 +1,7 @@
|
||||
#include "mk_inc_generic"
|
||||
|
||||
int StartingConditional()
|
||||
{
|
||||
return MK_GenericDialog_GetCondition(15);
|
||||
// return (GetLocalInt(OBJECT_SELF, "MK_CONDITION_15")==1);
|
||||
}
|
7
_module/nss/mk_cond_16.nss
Normal file
7
_module/nss/mk_cond_16.nss
Normal file
@@ -0,0 +1,7 @@
|
||||
#include "mk_inc_generic"
|
||||
|
||||
int StartingConditional()
|
||||
{
|
||||
return MK_GenericDialog_GetCondition(16);
|
||||
// return (GetLocalInt(OBJECT_SELF, "MK_CONDITION_16")==1);
|
||||
}
|
7
_module/nss/mk_cond_17.nss
Normal file
7
_module/nss/mk_cond_17.nss
Normal file
@@ -0,0 +1,7 @@
|
||||
#include "mk_inc_generic"
|
||||
|
||||
int StartingConditional()
|
||||
{
|
||||
return MK_GenericDialog_GetCondition(17);
|
||||
// return (GetLocalInt(OBJECT_SELF, "MK_CONDITION_17")==1);
|
||||
}
|
7
_module/nss/mk_cond_18.nss
Normal file
7
_module/nss/mk_cond_18.nss
Normal file
@@ -0,0 +1,7 @@
|
||||
#include "mk_inc_generic"
|
||||
|
||||
int StartingConditional()
|
||||
{
|
||||
return MK_GenericDialog_GetCondition(18);
|
||||
// return (GetLocalInt(OBJECT_SELF, "MK_CONDITION_18")==1);
|
||||
}
|
7
_module/nss/mk_cond_19.nss
Normal file
7
_module/nss/mk_cond_19.nss
Normal file
@@ -0,0 +1,7 @@
|
||||
#include "mk_inc_generic"
|
||||
|
||||
int StartingConditional()
|
||||
{
|
||||
return MK_GenericDialog_GetCondition(19);
|
||||
// return (GetLocalInt(OBJECT_SELF, "MK_CONDITION_19")==1);
|
||||
}
|
7
_module/nss/mk_cond_20.nss
Normal file
7
_module/nss/mk_cond_20.nss
Normal file
@@ -0,0 +1,7 @@
|
||||
#include "mk_inc_generic"
|
||||
|
||||
int StartingConditional()
|
||||
{
|
||||
return MK_GenericDialog_GetCondition(20);
|
||||
// return (GetLocalInt(OBJECT_SELF, "MK_CONDITION_20")==1);
|
||||
}
|
7
_module/nss/mk_cond_21.nss
Normal file
7
_module/nss/mk_cond_21.nss
Normal file
@@ -0,0 +1,7 @@
|
||||
#include "mk_inc_generic"
|
||||
|
||||
int StartingConditional()
|
||||
{
|
||||
return MK_GenericDialog_GetCondition(21);
|
||||
// return (GetLocalInt(OBJECT_SELF, "MK_CONDITION_21")==1);
|
||||
}
|
7
_module/nss/mk_cond_22.nss
Normal file
7
_module/nss/mk_cond_22.nss
Normal file
@@ -0,0 +1,7 @@
|
||||
#include "mk_inc_generic"
|
||||
|
||||
int StartingConditional()
|
||||
{
|
||||
return MK_GenericDialog_GetCondition(22);
|
||||
// return (GetLocalInt(OBJECT_SELF, "MK_CONDITION_22")==1);
|
||||
}
|
7
_module/nss/mk_cond_23.nss
Normal file
7
_module/nss/mk_cond_23.nss
Normal file
@@ -0,0 +1,7 @@
|
||||
#include "mk_inc_generic"
|
||||
|
||||
int StartingConditional()
|
||||
{
|
||||
return MK_GenericDialog_GetCondition(23);
|
||||
// return (GetLocalInt(OBJECT_SELF, "MK_CONDITION_23")==1);
|
||||
}
|
7
_module/nss/mk_cond_24.nss
Normal file
7
_module/nss/mk_cond_24.nss
Normal file
@@ -0,0 +1,7 @@
|
||||
#include "mk_inc_generic"
|
||||
|
||||
int StartingConditional()
|
||||
{
|
||||
return MK_GenericDialog_GetCondition(24);
|
||||
// return (GetLocalInt(OBJECT_SELF, "MK_CONDITION_24")==1);
|
||||
}
|
6
_module/nss/mk_cond_249.nss
Normal file
6
_module/nss/mk_cond_249.nss
Normal file
@@ -0,0 +1,6 @@
|
||||
#include "mk_inc_generic"
|
||||
|
||||
int StartingConditional()
|
||||
{
|
||||
return MK_GenericDialog_GetCondition(249);
|
||||
}
|
7
_module/nss/mk_cond_25.nss
Normal file
7
_module/nss/mk_cond_25.nss
Normal file
@@ -0,0 +1,7 @@
|
||||
#include "mk_inc_generic"
|
||||
|
||||
int StartingConditional()
|
||||
{
|
||||
return MK_GenericDialog_GetCondition(25);
|
||||
// return (GetLocalInt(OBJECT_SELF, "MK_CONDITION_22")==1);
|
||||
}
|
7
_module/nss/mk_cond_250.nss
Normal file
7
_module/nss/mk_cond_250.nss
Normal file
@@ -0,0 +1,7 @@
|
||||
#include "mk_inc_generic"
|
||||
|
||||
int StartingConditional()
|
||||
{
|
||||
return MK_GenericDialog_GetCondition(250);
|
||||
// return (GetLocalInt(OBJECT_SELF, "MK_CONDITION_22")==1);
|
||||
}
|
7
_module/nss/mk_cond_251.nss
Normal file
7
_module/nss/mk_cond_251.nss
Normal file
@@ -0,0 +1,7 @@
|
||||
#include "mk_inc_generic"
|
||||
|
||||
int StartingConditional()
|
||||
{
|
||||
return MK_GenericDialog_GetCondition(251);
|
||||
// return (GetLocalInt(OBJECT_SELF, "MK_CONDITION_22")==1);
|
||||
}
|
7
_module/nss/mk_cond_252.nss
Normal file
7
_module/nss/mk_cond_252.nss
Normal file
@@ -0,0 +1,7 @@
|
||||
#include "mk_inc_generic"
|
||||
|
||||
int StartingConditional()
|
||||
{
|
||||
return MK_GenericDialog_GetCondition(252);
|
||||
// return (GetLocalInt(OBJECT_SELF, "MK_CONDITION_22")==1);
|
||||
}
|
7
_module/nss/mk_cond_253.nss
Normal file
7
_module/nss/mk_cond_253.nss
Normal file
@@ -0,0 +1,7 @@
|
||||
#include "mk_inc_generic"
|
||||
|
||||
int StartingConditional()
|
||||
{
|
||||
return MK_GenericDialog_GetCondition(253);
|
||||
// return (GetLocalInt(OBJECT_SELF, "MK_CONDITION_22")==1);
|
||||
}
|
7
_module/nss/mk_cond_254.nss
Normal file
7
_module/nss/mk_cond_254.nss
Normal file
@@ -0,0 +1,7 @@
|
||||
#include "mk_inc_generic"
|
||||
|
||||
int StartingConditional()
|
||||
{
|
||||
return MK_GenericDialog_GetCondition(254);
|
||||
// return (GetLocalInt(OBJECT_SELF, "MK_CONDITION_22")==1);
|
||||
}
|
7
_module/nss/mk_cond_255.nss
Normal file
7
_module/nss/mk_cond_255.nss
Normal file
@@ -0,0 +1,7 @@
|
||||
#include "mk_inc_generic"
|
||||
|
||||
int StartingConditional()
|
||||
{
|
||||
return MK_GenericDialog_GetCondition(255);
|
||||
// return (GetLocalInt(OBJECT_SELF, "MK_CONDITION_22")==1);
|
||||
}
|
6
_module/nss/mk_cond_256.nss
Normal file
6
_module/nss/mk_cond_256.nss
Normal file
@@ -0,0 +1,6 @@
|
||||
#include "mk_inc_generic"
|
||||
|
||||
int StartingConditional()
|
||||
{
|
||||
return MK_GenericDialog_GetCondition(256);
|
||||
}
|
6
_module/nss/mk_cond_257.nss
Normal file
6
_module/nss/mk_cond_257.nss
Normal file
@@ -0,0 +1,6 @@
|
||||
#include "mk_inc_generic"
|
||||
|
||||
int StartingConditional()
|
||||
{
|
||||
return MK_GenericDialog_GetCondition(257);
|
||||
}
|
7
_module/nss/mk_cond_26.nss
Normal file
7
_module/nss/mk_cond_26.nss
Normal file
@@ -0,0 +1,7 @@
|
||||
#include "mk_inc_generic"
|
||||
|
||||
int StartingConditional()
|
||||
{
|
||||
return MK_GenericDialog_GetCondition(26);
|
||||
// return (GetLocalInt(OBJECT_SELF, "MK_CONDITION_22")==1);
|
||||
}
|
7
_module/nss/mk_cond_27.nss
Normal file
7
_module/nss/mk_cond_27.nss
Normal file
@@ -0,0 +1,7 @@
|
||||
#include "mk_inc_generic"
|
||||
|
||||
int StartingConditional()
|
||||
{
|
||||
return MK_GenericDialog_GetCondition(27);
|
||||
// return (GetLocalInt(OBJECT_SELF, "MK_CONDITION_22")==1);
|
||||
}
|
7
_module/nss/mk_cond_28.nss
Normal file
7
_module/nss/mk_cond_28.nss
Normal file
@@ -0,0 +1,7 @@
|
||||
#include "mk_inc_generic"
|
||||
|
||||
int StartingConditional()
|
||||
{
|
||||
return MK_GenericDialog_GetCondition(28);
|
||||
// return (GetLocalInt(OBJECT_SELF, "MK_CONDITION_22")==1);
|
||||
}
|
7
_module/nss/mk_cond_29.nss
Normal file
7
_module/nss/mk_cond_29.nss
Normal file
@@ -0,0 +1,7 @@
|
||||
#include "mk_inc_generic"
|
||||
|
||||
int StartingConditional()
|
||||
{
|
||||
return MK_GenericDialog_GetCondition(29);
|
||||
// return (GetLocalInt(OBJECT_SELF, "MK_CONDITION_22")==1);
|
||||
}
|
7
_module/nss/mk_cond_30.nss
Normal file
7
_module/nss/mk_cond_30.nss
Normal file
@@ -0,0 +1,7 @@
|
||||
#include "mk_inc_generic"
|
||||
|
||||
int StartingConditional()
|
||||
{
|
||||
return MK_GenericDialog_GetCondition(30);
|
||||
// return (GetLocalInt(OBJECT_SELF, "MK_CONDITION_22")==1);
|
||||
}
|
7
_module/nss/mk_cond_31.nss
Normal file
7
_module/nss/mk_cond_31.nss
Normal file
@@ -0,0 +1,7 @@
|
||||
#include "mk_inc_generic"
|
||||
|
||||
int StartingConditional()
|
||||
{
|
||||
return MK_GenericDialog_GetCondition(31);
|
||||
// return (GetLocalInt(OBJECT_SELF, "MK_CONDITION_22")==1);
|
||||
}
|
7
_module/nss/mk_cond_32.nss
Normal file
7
_module/nss/mk_cond_32.nss
Normal file
@@ -0,0 +1,7 @@
|
||||
#include "mk_inc_generic"
|
||||
|
||||
int StartingConditional()
|
||||
{
|
||||
return MK_GenericDialog_GetCondition(32);
|
||||
// return (GetLocalInt(OBJECT_SELF, "MK_CONDITION_22")==1);
|
||||
}
|
7
_module/nss/mk_cond_33.nss
Normal file
7
_module/nss/mk_cond_33.nss
Normal file
@@ -0,0 +1,7 @@
|
||||
#include "mk_inc_generic"
|
||||
|
||||
int StartingConditional()
|
||||
{
|
||||
return MK_GenericDialog_GetCondition(33);
|
||||
// return (GetLocalInt(OBJECT_SELF, "MK_CONDITION_22")==1);
|
||||
}
|
7
_module/nss/mk_cond_34.nss
Normal file
7
_module/nss/mk_cond_34.nss
Normal file
@@ -0,0 +1,7 @@
|
||||
#include "mk_inc_generic"
|
||||
|
||||
int StartingConditional()
|
||||
{
|
||||
return MK_GenericDialog_GetCondition(34);
|
||||
// return (GetLocalInt(OBJECT_SELF, "MK_CONDITION_22")==1);
|
||||
}
|
7
_module/nss/mk_cond_35.nss
Normal file
7
_module/nss/mk_cond_35.nss
Normal file
@@ -0,0 +1,7 @@
|
||||
#include "mk_inc_generic"
|
||||
|
||||
int StartingConditional()
|
||||
{
|
||||
return MK_GenericDialog_GetCondition(35);
|
||||
// return (GetLocalInt(OBJECT_SELF, "MK_CONDITION_22")==1);
|
||||
}
|
7
_module/nss/mk_cond_36.nss
Normal file
7
_module/nss/mk_cond_36.nss
Normal file
@@ -0,0 +1,7 @@
|
||||
#include "mk_inc_generic"
|
||||
|
||||
int StartingConditional()
|
||||
{
|
||||
return MK_GenericDialog_GetCondition(36);
|
||||
// return (GetLocalInt(OBJECT_SELF, "MK_CONDITION_22")==1);
|
||||
}
|
7
_module/nss/mk_cond_37.nss
Normal file
7
_module/nss/mk_cond_37.nss
Normal file
@@ -0,0 +1,7 @@
|
||||
#include "mk_inc_generic"
|
||||
|
||||
int StartingConditional()
|
||||
{
|
||||
return MK_GenericDialog_GetCondition(37);
|
||||
// return (GetLocalInt(OBJECT_SELF, "MK_CONDITION_22")==1);
|
||||
}
|
7
_module/nss/mk_cond_38.nss
Normal file
7
_module/nss/mk_cond_38.nss
Normal file
@@ -0,0 +1,7 @@
|
||||
#include "mk_inc_generic"
|
||||
|
||||
int StartingConditional()
|
||||
{
|
||||
return MK_GenericDialog_GetCondition(38);
|
||||
// return (GetLocalInt(OBJECT_SELF, "MK_CONDITION_22")==1);
|
||||
}
|
7
_module/nss/mk_cond_39.nss
Normal file
7
_module/nss/mk_cond_39.nss
Normal file
@@ -0,0 +1,7 @@
|
||||
#include "mk_inc_generic"
|
||||
|
||||
int StartingConditional()
|
||||
{
|
||||
return MK_GenericDialog_GetCondition(39);
|
||||
// return (GetLocalInt(OBJECT_SELF, "MK_CONDITION_22")==1);
|
||||
}
|
6
_module/nss/mk_cond_40.nss
Normal file
6
_module/nss/mk_cond_40.nss
Normal file
@@ -0,0 +1,6 @@
|
||||
#include "mk_inc_generic"
|
||||
|
||||
int StartingConditional()
|
||||
{
|
||||
return MK_GenericDialog_GetCondition(40);
|
||||
}
|
13
_module/nss/mk_do_sel_target.nss
Normal file
13
_module/nss/mk_do_sel_target.nss
Normal file
@@ -0,0 +1,13 @@
|
||||
#include "mk_inc_craft"
|
||||
|
||||
void main()
|
||||
{
|
||||
object oPC = GetPCSpeaker();
|
||||
object oTarget = OBJECT_SELF;
|
||||
|
||||
CISetCurrentModMode(oPC,X2_CI_MODMODE_INVALID );
|
||||
MK_GenericDialog_CleanUp();
|
||||
|
||||
MK_SetPlayerTargetScript(MK_CCOH_ONPLAYERTARGETSCRIPT);
|
||||
EnterTargetingMode(oPC, OBJECT_TYPE_CREATURE, MOUSECURSOR_MAGIC);
|
||||
}
|
1134
_module/nss/mk_editor_main.nss
Normal file
1134
_module/nss/mk_editor_main.nss
Normal file
File diff suppressed because it is too large
Load Diff
6
_module/nss/mk_get_version.nss
Normal file
6
_module/nss/mk_get_version.nss
Normal file
@@ -0,0 +1,6 @@
|
||||
#include "mk_inc_version"
|
||||
|
||||
void main()
|
||||
{
|
||||
MK_VERSION_DetectGameVersionQ(OBJECT_SELF, GetLocalInt(OBJECT_SELF, "MK_NWN_VERSION_DEBUG_MESSAGE"));
|
||||
}
|
83
_module/nss/mk_im_cancel.nss
Normal file
83
_module/nss/mk_im_cancel.nss
Normal file
@@ -0,0 +1,83 @@
|
||||
//////////////////////////////////////////////////////////
|
||||
/*
|
||||
Item Appearance Modification Conversation
|
||||
Cancel Conversation Script
|
||||
*/
|
||||
//////////////////////////////////////////////////////////
|
||||
|
||||
//#include "mk_inc_init"
|
||||
#include "mk_inc_generic"
|
||||
#include "mk_inc_craft"
|
||||
#include "mk_inc_ccoh_db"
|
||||
#include "mk_inc_2da_disp"
|
||||
#include "mk_inc_ccoh_db"
|
||||
|
||||
void main()
|
||||
{
|
||||
|
||||
object oPC = GetPCSpeaker();
|
||||
|
||||
object oTarget = MK_GetCurrentTarget(oPC);
|
||||
|
||||
MK_DEBUG_TRACE("Executing 'mk_im_cancel' script. Current mod mode is '"+IntToString(CIGetCurrentModMode(oPC))+"!");
|
||||
// MK_DEBUG_TRACE(" > oPC: '"+GetName(oPC)+"'");
|
||||
// MK_DEBUG_TRACE(" > oTarget: '"+GetName(oTarget)+"'");
|
||||
|
||||
// int bDisableExtendedEditionFeatures = MK_INIT_GetAreEEFeaturesDisabled();
|
||||
|
||||
switch (CIGetCurrentModMode(oPC))
|
||||
{
|
||||
case X2_CI_MODMODE_INVALID:
|
||||
AssignCommand(oPC, ClearAllActions());
|
||||
break;
|
||||
case MK_CI_MODMODE_CHARACTER:
|
||||
MK_RestoreCharacterDescription(oPC);
|
||||
SendMessageToPC(oPC, "Canceling character description editing - original description is restored.");
|
||||
AssignCommand(oPC,ClearAllActions());
|
||||
break;
|
||||
case MK_CI_MODMODE_BODY:
|
||||
MK_CCOH_DB_RestoreBody(oTarget);
|
||||
SendMessageToPC(oPC, "Canceling body modifying - original appearance is restored.");
|
||||
MK_DoneBodyPart(oPC, oTarget);
|
||||
AssignCommand(oPC,ClearAllActions());
|
||||
break;
|
||||
case X2_CI_MODMODE_ARMOR:
|
||||
case X2_CI_MODMODE_WEAPON:
|
||||
case MK_CI_MODMODE_CLOAK:
|
||||
case MK_CI_MODMODE_HELMET:
|
||||
case MK_CI_MODMODE_SHIELD:
|
||||
SendMessageToPC(oPC, "Canceling item modifying - original appearance is restored.");
|
||||
MK_CancelModifyItem(oTarget, oPC);
|
||||
break;
|
||||
case MK_CI_MODMODE_ITEM:
|
||||
SendMessageToPC(oPC, "Canceling item modifying - original item is restored.");
|
||||
MK_CancelModifyItem(oTarget, oPC);
|
||||
break;
|
||||
}
|
||||
|
||||
CISetCurrentModMode(oPC,X2_CI_MODMODE_INVALID );
|
||||
|
||||
MK_RemoveTemporaryEffects(oPC, MK_TAG_TEMP_EFFECT, oTarget);
|
||||
|
||||
if (!GetLocalInt(oPC, MK_KEEP_CURRENT_TARGET))
|
||||
{
|
||||
MK_SetCurrentTarget(oPC, OBJECT_INVALID);
|
||||
}
|
||||
else
|
||||
{
|
||||
DeleteLocalInt(oPC, MK_KEEP_CURRENT_TARGET);
|
||||
}
|
||||
|
||||
// in case the ESC key was used to exit the dialog
|
||||
MK_Editor_CleanUp(oPC);
|
||||
|
||||
MK_CCOH_DB_Cleanup(oPC);
|
||||
MK_2DA_DISPLAY_Cleanup();
|
||||
|
||||
MK_GenericDialog_CleanUp();
|
||||
|
||||
MK_INIT_Cleanup(oPC, "MK_CCOH", "MK_CCOH_USER");
|
||||
|
||||
RestoreCameraFacing();
|
||||
|
||||
}
|
66
_module/nss/mk_im_finished.nss
Normal file
66
_module/nss/mk_im_finished.nss
Normal file
@@ -0,0 +1,66 @@
|
||||
//////////////////////////////////////////////////////////
|
||||
/*
|
||||
Item Appearance Modification Conversation
|
||||
Finish Conversation Script
|
||||
*/
|
||||
//////////////////////////////////////////////////////////
|
||||
|
||||
#include "mk_inc_generic"
|
||||
#include "mk_inc_craft"
|
||||
#include "mk_inc_body"
|
||||
#include "mk_inc_horse"
|
||||
#include "mk_inc_2da_disp"
|
||||
#include "mk_inc_ccoh_db"
|
||||
|
||||
void main()
|
||||
{
|
||||
object oPC = GetPCSpeaker();
|
||||
object oTarget = MK_GetCurrentTarget(oPC);
|
||||
// MK_DEBUG_TRACE("Executing 'mk_im_finish' script. Current mod mode is '"+IntToString(CIGetCurrentModMode(oPC))+"!");
|
||||
|
||||
switch (CIGetCurrentModMode(oPC))
|
||||
{
|
||||
case X2_CI_MODMODE_INVALID:
|
||||
AssignCommand(oPC, ClearAllActions());
|
||||
break;
|
||||
case MK_CI_MODMODE_CHARACTER:
|
||||
AssignCommand(oPC, ClearAllActions());
|
||||
SendMessageToPC(oPC, "Finishing character description editing.");
|
||||
break;
|
||||
case MK_CI_MODMODE_BODY:
|
||||
switch (MK_GetBodyPartToBeModified(oPC))
|
||||
{
|
||||
case MK_CRAFTBODY_HORSE:
|
||||
if (MK_GetIsRiding(oTarget))
|
||||
{
|
||||
SetLocalInt(oTarget, MK_VAR_CURRENT_HORSE, GetCreatureTailType(oTarget));
|
||||
}
|
||||
break;
|
||||
}
|
||||
MK_DoneBodyPart(oPC, oTarget);
|
||||
SendMessageToPC(oPC, "Finishing body modifying.");
|
||||
break;
|
||||
case X2_CI_MODMODE_ARMOR:
|
||||
case X2_CI_MODMODE_WEAPON:
|
||||
case MK_CI_MODMODE_CLOAK:
|
||||
case MK_CI_MODMODE_HELMET:
|
||||
case MK_CI_MODMODE_SHIELD:
|
||||
MK_FinishModifyItem(oTarget, oPC);
|
||||
SendMessageToPC(oPC, "Finishing item modifying.");
|
||||
break;
|
||||
}
|
||||
CISetCurrentModMode(oPC, X2_CI_MODMODE_INVALID );
|
||||
|
||||
MK_RemoveTemporaryEffects(oPC, MK_TAG_TEMP_EFFECT, oTarget);
|
||||
|
||||
MK_SetCurrentTarget(oPC, OBJECT_INVALID);
|
||||
|
||||
MK_CCOH_DB_Cleanup(oPC);
|
||||
MK_2DA_DISPLAY_Cleanup();
|
||||
|
||||
MK_GenericDialog_CleanUp();
|
||||
|
||||
MK_INIT_Cleanup(oPC, "MK_CCOH", "MK_CCOH_USER");
|
||||
|
||||
RestoreCameraFacing() ;
|
||||
}
|
27
_module/nss/mk_im_getchanged.nss
Normal file
27
_module/nss/mk_im_getchanged.nss
Normal file
@@ -0,0 +1,27 @@
|
||||
//#include "x2_inc_craft"
|
||||
#include "mk_inc_craft"
|
||||
|
||||
int StartingConditional()
|
||||
{
|
||||
object oPC = GetPCSpeaker();
|
||||
object oTarget = MK_GetCurrentTarget(oPC);
|
||||
object oBackup = CIGetCurrentModBackup(oPC);
|
||||
object oItem = CIGetCurrentModItem(oPC);
|
||||
|
||||
int iResult;
|
||||
|
||||
switch (CIGetCurrentModMode(oPC))
|
||||
{
|
||||
case MK_CI_MODMODE_CHARACTER:
|
||||
iResult = MK_GetIsDescriptionModified(oTarget);
|
||||
break;
|
||||
// case MK_CI_MODMODE_ITEM:
|
||||
// iResult = (GetIsObjectValid(oItem) && (GetLocalInt(oItem, "MK_ITEM_MODIFIED")==1));
|
||||
// break;
|
||||
default:
|
||||
iResult = MK_GetIsModified(oItem, oBackup);
|
||||
break;
|
||||
}
|
||||
|
||||
return iResult;
|
||||
}
|
172
_module/nss/mk_im_start.nss
Normal file
172
_module/nss/mk_im_start.nss
Normal file
@@ -0,0 +1,172 @@
|
||||
#include "mk_inc_craft"
|
||||
#include "mk_inc_generic"
|
||||
#include "mk_inc_ccoh_db"
|
||||
#include "mk_inc_states"
|
||||
|
||||
int StartingConditional()
|
||||
{
|
||||
object oPC = GetPCSpeaker();
|
||||
object oTarget = MK_GetCurrentTarget(oPC);
|
||||
object oItem;
|
||||
|
||||
MK_CCOH_DB_Init(oPC);
|
||||
|
||||
int nAction = MK_GenericDialog_GetAction(TRUE);
|
||||
int nState = MK_GenericDialog_GetState();
|
||||
|
||||
switch (nState)
|
||||
{
|
||||
case MK_STATE_DATABASE_3:
|
||||
MK_DEBUG_TRACE("mk_im_start: GetState=MK_STATE_DATABASE_3");
|
||||
switch (nAction)
|
||||
{
|
||||
case 250:
|
||||
{
|
||||
int nSelectedIASStrTypes = MK_CCOH_DB_GetSelectedIASStrTypes(oPC);
|
||||
switch (MK_CCOH_DB_GetReadWriteMode(oPC))
|
||||
{
|
||||
case MK_CCOH_DB_READ:
|
||||
switch (CIGetCurrentModMode(oPC))
|
||||
{
|
||||
case X2_CI_MODMODE_ARMOR:
|
||||
case X2_CI_MODMODE_WEAPON:
|
||||
case MK_CI_MODMODE_CLOAK:
|
||||
case MK_CI_MODMODE_HELMET:
|
||||
case MK_CI_MODMODE_SHIELD:
|
||||
{
|
||||
oItem = CIGetCurrentModItem(oPC);
|
||||
|
||||
object oItemQ = MK_CCOH_DB_ReadItemAppearanceFromDatabase(
|
||||
oPC, oItem,
|
||||
MK_CCOH_DB_GetCurrentSlot(oPC),
|
||||
nSelectedIASStrTypes);
|
||||
if (GetIsObjectValid(oItemQ))
|
||||
{
|
||||
DestroyObject(oItem);
|
||||
oItem = oItemQ;
|
||||
CISetCurrentModItem(oPC, oItem);
|
||||
MK_EquipModifiedItem(oTarget, oPC);
|
||||
SendMessageToPC(oPC, "Appearance read from database!");
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessageToPC(oPC, "Failed to read appearance from database!");
|
||||
}
|
||||
}
|
||||
// case MK_CI_MODMODE_BODY:
|
||||
// break;
|
||||
}
|
||||
break;
|
||||
case MK_CCOH_DB_WRITE:
|
||||
switch (CIGetCurrentModMode(oPC))
|
||||
{
|
||||
case X2_CI_MODMODE_ARMOR:
|
||||
case X2_CI_MODMODE_WEAPON:
|
||||
case MK_CI_MODMODE_CLOAK:
|
||||
case MK_CI_MODMODE_HELMET:
|
||||
case MK_CI_MODMODE_SHIELD:
|
||||
oItem = CIGetCurrentModItem(oPC);
|
||||
if (MK_CCOH_DB_WriteItemAppearanceToDatabase(
|
||||
oPC, oItem,
|
||||
MK_CCOH_DB_GetCurrentSlot(oPC),
|
||||
nSelectedIASStrTypes,
|
||||
MK_CCOH_DB_GetCurrentSlotName(oPC)))
|
||||
{
|
||||
SendMessageToPC(oPC, "Appearance written to database!");
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessageToPC(oPC, "Failed to write appearance to database!");
|
||||
}
|
||||
break;
|
||||
// case MK_CI_MODMODE_BODY:
|
||||
// break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
nState = MK_STATE_INIT;
|
||||
MK_GenericDialog_SetState(nState);
|
||||
break;
|
||||
case MK_STATE_DATABASE_1:
|
||||
MK_DEBUG_TRACE("mk_im_start: GetState=MK_STATE_DATABASE_1");
|
||||
oItem = CIGetCurrentModItem(oPC);
|
||||
nState = MK_STATE_INIT;
|
||||
MK_GenericDialog_SetState(nState);
|
||||
break;
|
||||
case MK_STATE_INIT:
|
||||
MK_DEBUG_TRACE("mk_im_start: GetState=MK_STATE_INIT");
|
||||
switch (nAction)
|
||||
{
|
||||
case X2_CI_MODMODE_ARMOR:
|
||||
case X2_CI_MODMODE_WEAPON:
|
||||
case MK_CI_MODMODE_CLOAK:
|
||||
case MK_CI_MODMODE_HELMET:
|
||||
case MK_CI_MODMODE_SHIELD:
|
||||
StoreCameraFacing();
|
||||
CISetCurrentModMode(oPC, nAction);
|
||||
MK_SetCurrentModPart(oPC, -1);
|
||||
oItem = GetItemInSlot(MK_GetCurrentInventorySlot(oPC), oTarget);
|
||||
// Make backup, make mirror item, call CISetCurrentModItem(), ...
|
||||
MK_StartModifyItem(oPC, oItem, TRUE);
|
||||
// Add light effect and immobilize player
|
||||
MK_AddTemporaryEffects(oPC, MK_TAG_TEMP_EFFECT, TRUE, oTarget);
|
||||
break;
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
float fFacing = GetFacing(oPC);
|
||||
float fDistance = 3.5f;
|
||||
float fPitch = 75.0f;
|
||||
|
||||
switch (CIGetCurrentModMode(oPC))
|
||||
{
|
||||
case X2_CI_MODMODE_ARMOR:
|
||||
fFacing += 180.0;
|
||||
break;
|
||||
case X2_CI_MODMODE_WEAPON:
|
||||
fFacing += 90.0;
|
||||
break;
|
||||
case MK_CI_MODMODE_CLOAK:
|
||||
fFacing += 315.0;
|
||||
break;
|
||||
case MK_CI_MODMODE_HELMET:
|
||||
fFacing += 180.0;
|
||||
break;
|
||||
case MK_CI_MODMODE_SHIELD:
|
||||
fFacing += 270.0;
|
||||
break;
|
||||
}
|
||||
|
||||
if (fFacing > 359.0)
|
||||
{
|
||||
fFacing -=359.0;
|
||||
}
|
||||
SetCameraFacing(fFacing, fDistance, fPitch, CAMERA_TRANSITION_TYPE_FAST);
|
||||
|
||||
// int nSlot = MK_GetCurrentInventorySlot(oPC);
|
||||
// object oItem = GetItemInSlot(nSlot, oPC);
|
||||
|
||||
if (CIGetCurrentModMode(oPC) == MK_CI_MODMODE_CLOAK)
|
||||
{
|
||||
MK_GenericDialog_SetCondition(7, MK_VERSION_GetIsVersionGreaterEqual_1_69(oPC));
|
||||
}
|
||||
|
||||
MK_GenericDialog_SetCondition(21, GetLocalInt(oPC, "MK_DISABLE_SAVE_ITEM_APPEARANCE")!=1);
|
||||
|
||||
int bDisableTextEditor = (MK_VERSION_GetIsVersionLower_1_69(oPC) && (GetLocalInt(oPC, "MK_DISABLE_TEXT_EDITOR") == 1));
|
||||
MK_GenericDialog_SetCondition(22, !bDisableTextEditor && GetLocalInt(oPC, "MK_ENABLE_RENAME_ITEMS"));
|
||||
MK_GenericDialog_SetCondition(23, !bDisableTextEditor && GetLocalInt(oPC, "MK_ENABLE_EDIT_DESCRIPTION"));
|
||||
MK_GenericDialog_SetCondition(24, !MK_GetHiddenWhenEquipped(oItem));
|
||||
|
||||
MK_SetCustomTokenByItemTypeName(oTarget, oPC);
|
||||
|
||||
// MK_VerifyCurrentModItem(oPC, "mk_im_start(end)");
|
||||
|
||||
return TRUE;
|
||||
}
|
594
_module/nss/mk_inc_2da_disp.nss
Normal file
594
_module/nss/mk_inc_2da_disp.nss
Normal file
@@ -0,0 +1,594 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// mk_inc_2da_disp.nss
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//#include "x3_inc_string"
|
||||
#include "mk_inc_debug"
|
||||
#include "mk_inc_tools"
|
||||
#include "mk_inc_math"
|
||||
#include "mk_inc_array"
|
||||
#include "mk_inc_generic"
|
||||
#include "mk_inc_tlk"
|
||||
#include "mk_inc_delimiter"
|
||||
|
||||
// const int MK_2DA_DISP_DEBUG = TRUE;
|
||||
const int MK_2DA_DISP_DEBUG = FALSE;
|
||||
|
||||
const int MK_2DA_DISP_USE_CACHE = TRUE;
|
||||
const int MK_2DA_DISP_CACHE_ITEM_SIZE = 4;
|
||||
|
||||
const string MK_2DA_DISP_ITEM_COUNT = "MK_2DA_DISP_ITEM_COUNT";
|
||||
const string MK_2DA_DISP_CURRENT_PAGE = "MK_2DA_DISP_CURRENT_PAGE";
|
||||
const string MK_2DA_DISP_ITEMS_PER_PAGE = "MK_2DA_DISP_ITEMS_PER_PAGE";
|
||||
const string MK_2DA_DISP_2DA_FILENAME = "MK_2DA_DISP_2DA_FILENAME";
|
||||
const string MK_2DA_DISP_2DA_COL_LABEL = "MK_2DA_DISP_2DA_COL_LABEL";
|
||||
const string MK_2DA_DISP_2DA_COL_STRREF = "MK_2DA_DISP_2DA_COL_STRREF";
|
||||
const string MK_2DA_DISP_2DA_COL_NOTEMPTY = "MK_2DA_DISP_2DA_COL_NOTEMPTY";
|
||||
const string MK_2DA_DISP_2DA_COL_VALUE = "MK_2DA_DISP_2DA_COL_VALUE";
|
||||
|
||||
const string MK_2DA_DISP_CURRENT_COLOR = "MK_2DA_DISP_CURRENT_COLOR";
|
||||
const string MK_2DA_DISP_DEFAULT_COLOR = "MK_2DA_DISP_DEFAULT_COLOR";
|
||||
|
||||
const string MK_2DA_DISP_2DA_CACHE = "MK_2DA_DISP_2DA_CACHE";
|
||||
|
||||
const string MK_2DA_DISP_CALLBACK_ROW = "MK_2DA_DISP_CALLBACK_ROW";
|
||||
const string MK_2DA_DISP_CALLBACK_LABEL = "MK_2DA_DISP_CALLBACK_LABEL";
|
||||
const string MK_2DA_DISP_CALLBACK_CHECK = "MK_2DA_DISP_CALLBACK_CHECK";
|
||||
|
||||
const string MK_2DA_DISP_DIALOG_TEXT = "MK_2DA_DISP_2DA_DISLOG_TEXT";
|
||||
|
||||
const int MK_2DA_DISP_TOKEN_BASE = 14440;
|
||||
const int MK_2DA_DISP_TOKEN_CURRENT_PAGE = 14431;
|
||||
const int MK_2DA_DISP_TOKEN_CURRENT_VALUE = 14430;
|
||||
|
||||
const int MK_2DA_DISPLAY_MAX_PAGE_LENGTH = 20;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Initializes the 2DA display system
|
||||
// - s2DAfile: name of the 2DA file
|
||||
// - s2DAColValue: name of the value column (if empty row number is returned
|
||||
// by MK_2DA_DISPLAY_GetValueAsInt(). MK_2DA_DISPLAY_GetValueAsString will
|
||||
// return an empty string in case s2DAColValue is empty).
|
||||
// - s2DAColLabel: name of the label column
|
||||
// - s2DAColStrRef: name of StrRef column
|
||||
// if s2DAColStrRef is not empty that column will be used to read the label
|
||||
// from tlk. If it's empty the text in s2DAColLabel will be used as label.
|
||||
// - s2DAColNotEmpty: column that's always not empty so it can be used to
|
||||
// get the number of rows in the 2DA file. If s2DAColNotEmpty is empty
|
||||
// s2DAColLabel will be used instead.
|
||||
void MK_2DA_DISPLAY_Initialize(string s2DAFile, string s2DAColValue, string s2DAColLabel, string s2DAColStrRef,
|
||||
string s2DAColNotEmpty="", int nAllowedEmptyRowsInARow=10, string sCallbackScript="");
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// returns the label for an item
|
||||
// - nItem: item whose label should be returned
|
||||
// - bShowItemID: if TRUE ' (nItem)' is added to the label
|
||||
string MK_2DA_DISPLAY_GetItemLabel(int nRow, int bShowItemID = FALSE);
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
string MK_2DA_DISPLAY_GetValueAsString(int nLine);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
int MK_2DA_DISPLAY_GetValueAsInt(int nLine);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
void MK_2DA_DISPLAY_DisplayPage(int nPage, int nCurrentValue=-1, string sCallbackScript="", int bShowItemID=TRUE);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
int MK_2DA_DISPLAY_GetPageCount();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
int MK_2DA_DISPLAY_GetItemCount();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
int MK_2DA_DISPLAY_GetPageLength();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
void MK_2DA_DISPLAY_SetPageLength(int nPageLength);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
int MK_2DA_DISPLAY_GetCurrentPage();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
int MK_2DA_DISPLAY_GetMaxPageLength();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
void MK_2DA_DISPLAY_SetCurrentPage(int nPage);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
string MK_2DA_DISPLAY_GetCache();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
void MK_2DA_DISPLAY_SetCache(string sCache);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
void MK_2DA_DISPLAY_Initialize(string s2DAFile, string s2DAColValue, string s2DAColLabel, string s2DAColStrRef, string s2DAColNotEmpty, int nAllowedEmptyRowsInARow, string sCallbackScript);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
string MK_2DA_DISPLAY_Get2DAFileName();
|
||||
|
||||
void MK_2DA_DISPLAY_DEBUG_TRACE(string sMessage)
|
||||
{
|
||||
if (MK_2DA_DISP_DEBUG)
|
||||
{
|
||||
MK_DEBUG_TRACE(sMessage);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
string MK_2DA_DISPLAY_GetCache()
|
||||
{
|
||||
return MK_ARRAY_GetLocalArrayBuffer(OBJECT_SELF, MK_2DA_DISP_2DA_CACHE);
|
||||
// return GetLocalString(OBJECT_SELF, MK_2DA_DISP_2DA_CACHE);
|
||||
}
|
||||
|
||||
void MK_2DA_DISPLAY_SetCache(string sCache)
|
||||
{
|
||||
MK_ARRAY_SetLocalArrayBuffer(OBJECT_SELF, MK_2DA_DISP_2DA_CACHE, sCache);
|
||||
// SetLocalString(OBJECT_SELF, MK_2DA_DISP_2DA_CACHE, sCache);
|
||||
}
|
||||
|
||||
int MK_2DA_DISPLAY_GetMaxPageLength()
|
||||
{
|
||||
return MK_2DA_DISPLAY_MAX_PAGE_LENGTH;
|
||||
}
|
||||
|
||||
void MK_2DA_DISPLAY_SetCurrentPage(int nPage)
|
||||
{
|
||||
int nPageCount = MK_2DA_DISPLAY_GetPageCount();
|
||||
int nCurrentPage = (nPageCount>0 ? MK_MATH_MinInt(nPage, nPageCount) : nPage);
|
||||
|
||||
SetLocalInt(OBJECT_SELF, MK_2DA_DISP_CURRENT_PAGE, nCurrentPage);
|
||||
// SetLocalInt(OBJECT_SELF, MK_2DA_DISP_CURRENT_PAGE, MK_MATH_MinInt(nPage, MK_2DA_DISPLAY_GetPageCount()));
|
||||
}
|
||||
|
||||
int MK_2DA_DISPLAY_GetCurrentPage()
|
||||
{
|
||||
return GetLocalInt(OBJECT_SELF, MK_2DA_DISP_CURRENT_PAGE);
|
||||
}
|
||||
|
||||
int MK_2DA_DISPLAY_GetPageLength()
|
||||
{
|
||||
return GetLocalInt(OBJECT_SELF, MK_2DA_DISP_ITEMS_PER_PAGE);
|
||||
}
|
||||
|
||||
void MK_2DA_DISPLAY_SetPageLength(int nPageLength)
|
||||
{
|
||||
if (nPageLength==-1)
|
||||
{
|
||||
if (MK_2DA_DISPLAY_GetItemCount()<=MK_2DA_DISPLAY_MAX_PAGE_LENGTH)
|
||||
{
|
||||
nPageLength = MK_2DA_DISPLAY_MAX_PAGE_LENGTH;
|
||||
}
|
||||
else
|
||||
{
|
||||
nPageLength = MK_2DA_DISPLAY_MAX_PAGE_LENGTH-5;
|
||||
}
|
||||
}
|
||||
SetLocalInt(OBJECT_SELF, MK_2DA_DISP_ITEMS_PER_PAGE, nPageLength);
|
||||
}
|
||||
|
||||
|
||||
int MK_2DA_DISPLAY_GetItemCount()
|
||||
{
|
||||
return GetLocalInt(OBJECT_SELF, MK_2DA_DISP_ITEM_COUNT);
|
||||
}
|
||||
|
||||
int MK_2DA_DISPLAY_GetPageCount()
|
||||
{
|
||||
int nPageLength = MK_2DA_DISPLAY_GetPageLength();
|
||||
int nPageCount = (nPageLength>0 ? (((MK_2DA_DISPLAY_GetItemCount() - 1) / nPageLength) + 1) : -1);
|
||||
return nPageCount;
|
||||
// return (((MK_2DA_DISPLAY_GetItemCount() - 1) / MK_2DA_DISPLAY_GetPageLength()) + 1);
|
||||
}
|
||||
|
||||
string MK_2DA_DISPLAY_Get2DAFileName()
|
||||
{
|
||||
return GetLocalString(OBJECT_SELF, MK_2DA_DISP_2DA_FILENAME);
|
||||
}
|
||||
|
||||
int MK_2DA_DISPLAY_ItemToRow(int nItem)
|
||||
{
|
||||
int nRow;
|
||||
if (nItem==-1)
|
||||
{
|
||||
nRow = -1;
|
||||
}
|
||||
else if (MK_2DA_DISP_USE_CACHE)
|
||||
{
|
||||
nRow = MK_ARRAY_GetLocalArraySortedInt(OBJECT_SELF, MK_2DA_DISP_2DA_CACHE, nItem);
|
||||
// string sCache = MK_2DA_DISPLAY_GetCache();
|
||||
// int nPos = nItem*MK_2DA_DISP_CACHE_ITEM_SIZE;
|
||||
// nRow = StringToInt(GetSubString(sCache, nPos, MK_2DA_DISP_CACHE_ITEM_SIZE));
|
||||
}
|
||||
else
|
||||
{
|
||||
nRow = nItem;
|
||||
}
|
||||
return nRow;
|
||||
}
|
||||
|
||||
int MK_2DA_DISPLAY_RowToItem(int nRow)
|
||||
{
|
||||
int nItem;
|
||||
if (nRow==-1)
|
||||
{
|
||||
nItem=-1;
|
||||
}
|
||||
else if (MK_2DA_DISP_USE_CACHE)
|
||||
{
|
||||
nItem = MK_ARRAY_SearchLocalArraySortedInt(OBJECT_SELF, MK_2DA_DISP_2DA_CACHE, nRow);
|
||||
}
|
||||
else
|
||||
{
|
||||
nItem = nRow;
|
||||
}
|
||||
return nItem;
|
||||
}
|
||||
|
||||
string MK_2DA_DISPLAY_GetItemLabel(int nRow, int bShowItemID)
|
||||
{
|
||||
// string sLabel;
|
||||
string s2DAFile = GetLocalString(OBJECT_SELF, MK_2DA_DISP_2DA_FILENAME);
|
||||
string sColumnStrRef = GetLocalString(OBJECT_SELF, MK_2DA_DISP_2DA_COL_STRREF);
|
||||
string sColumnLabel = GetLocalString(OBJECT_SELF, MK_2DA_DISP_2DA_COL_LABEL);
|
||||
|
||||
// int nRow = MK_2DA_DISPLAY_ItemToRow(nItem);
|
||||
|
||||
string sLabel = MK_TLK_Get2DAStringByStrRef(s2DAFile, nRow, sColumnStrRef, sColumnLabel, GetGender(OBJECT_SELF));
|
||||
|
||||
// int nStrRef = MK_Get2DAInt(s2DAFile, sColumnStrRef, nRow, 0);
|
||||
// if (nStrRef!=0)
|
||||
// {
|
||||
// sLabel = MK_TLK_GetStringByStrRef(nStrRef, GetGender(OBJECT_SELF));
|
||||
// if (GetStringLeft(sLabel, 9) == "BadStrRef")
|
||||
// {
|
||||
// sLabel = Get2DAString(s2DAFile, sColumnLabel, nRow);
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// sLabel = Get2DAString(s2DAFile, sColumnLabel, nRow);
|
||||
// }
|
||||
|
||||
if (bShowItemID)
|
||||
{
|
||||
sLabel += (" ("+IntToString(nRow)+")");
|
||||
}
|
||||
return sLabel;
|
||||
}
|
||||
|
||||
int MK_2DA_DISPLAY_CalculateItemCount(string s2DAFile, string sColumn, int nAllowedEmptyRowsInARow=10, string sCallbackScript="")
|
||||
{
|
||||
int nCount = 0;
|
||||
int nRow = 0;
|
||||
int nMaxRow = -1;
|
||||
string sValue;
|
||||
int bOk;
|
||||
int nEmptyRows = 0;
|
||||
string sCache = "";
|
||||
do
|
||||
{
|
||||
sValue = Get2DAString(s2DAFile, sColumn, nRow);
|
||||
// MK_DEBUG_TRACE("MK_2DA_DISPLAY_CalculateItemCount: s2DA="+s2DAFile+", col="+sColumn+", nRow="+IntToString(nRow)+", sValue="+sValue);
|
||||
if (sValue!="")
|
||||
{
|
||||
bOk = TRUE;
|
||||
nEmptyRows = 0;
|
||||
|
||||
if (MK_2DA_DISP_USE_CACHE)
|
||||
{
|
||||
int bCheck=TRUE;
|
||||
if (sCallbackScript!="")
|
||||
{
|
||||
SetLocalInt(OBJECT_SELF, MK_2DA_DISP_CALLBACK_ROW, nRow);
|
||||
// MK_DEBUG_TRACE("Running callback script '"+sCallbackScript+"'...");
|
||||
ExecuteScript(sCallbackScript);
|
||||
bCheck = GetLocalInt(OBJECT_SELF, MK_2DA_DISP_CALLBACK_CHECK);
|
||||
}
|
||||
|
||||
if (bCheck)
|
||||
{
|
||||
sCache+=MK_ARRAY_LocalArraySortedInt_IntToString(nRow);
|
||||
// sCache+=MK_IntToString(nRow, MK_2DA_DISP_CACHE_ITEM_SIZE, "0");
|
||||
nCount++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
nMaxRow = nRow;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
bOk = ((++nEmptyRows) <= nAllowedEmptyRowsInARow);
|
||||
}
|
||||
// MK_DEBUG_TRACE("MK_2DA_DISPLAY_CalculateItemCount: nRow="+IntToString(nRow)
|
||||
// +", sValue='"+sValue+"', nCount="+IntToString(nCount)+", nMaxRow="
|
||||
// +IntToString(nMaxRow));
|
||||
|
||||
nRow++;
|
||||
|
||||
}
|
||||
while (bOk);
|
||||
|
||||
if (MK_2DA_DISP_USE_CACHE)
|
||||
{
|
||||
MK_2DA_DISPLAY_SetCache(sCache);
|
||||
}
|
||||
else
|
||||
{
|
||||
nCount = nMaxRow+1;
|
||||
}
|
||||
// MK_DEBUG_TRACE("MK_2DA_DISPLAY_CalculateItemCount(): "+IntToString(nCount)+".");
|
||||
|
||||
return nCount;
|
||||
}
|
||||
|
||||
|
||||
void MK_2DA_DISPLAY_Initialize(string s2DAFile, string s2DAColValue, string s2DAColLabel, string s2DAColStrRef, string s2DAColNotEmpty, int nAllowedEmptyRowsInARow, string sCallbackScript)
|
||||
{
|
||||
MK_2DA_DISPLAY_DEBUG_TRACE("Initializing 2DA display system...");
|
||||
SetLocalString(OBJECT_SELF, MK_2DA_DISP_2DA_FILENAME, s2DAFile);
|
||||
SetLocalString(OBJECT_SELF, MK_2DA_DISP_2DA_COL_VALUE, s2DAColValue);
|
||||
SetLocalString(OBJECT_SELF, MK_2DA_DISP_2DA_COL_LABEL, s2DAColLabel);
|
||||
SetLocalString(OBJECT_SELF, MK_2DA_DISP_2DA_COL_STRREF, s2DAColStrRef);
|
||||
SetLocalString(OBJECT_SELF, MK_2DA_DISP_2DA_COL_NOTEMPTY, (s2DAColNotEmpty != "" ? s2DAColNotEmpty : s2DAColLabel));
|
||||
|
||||
if (s2DAFile!="")
|
||||
{
|
||||
SetLocalInt(OBJECT_SELF, MK_2DA_DISP_ITEM_COUNT,
|
||||
MK_2DA_DISPLAY_CalculateItemCount(s2DAFile, GetLocalString(OBJECT_SELF, MK_2DA_DISP_2DA_COL_NOTEMPTY), nAllowedEmptyRowsInARow, sCallbackScript));
|
||||
}
|
||||
else
|
||||
{
|
||||
SetLocalInt(OBJECT_SELF, MK_2DA_DISP_ITEM_COUNT, 0);
|
||||
}
|
||||
|
||||
MK_2DA_DISPLAY_SetCurrentPage(1);
|
||||
SetLocalInt(OBJECT_SELF, MK_2DA_DISP_ITEMS_PER_PAGE, 20);
|
||||
MK_2DA_DISPLAY_DEBUG_TRACE("2DA display system initialized (nItemCount="+IntToString(MK_2DA_DISPLAY_GetItemCount())+").");
|
||||
}
|
||||
|
||||
void MK_2DA_DISPLAY_InitializeVirtual(string sCache)
|
||||
{
|
||||
MK_2DA_DISPLAY_SetCache(sCache);
|
||||
SetLocalInt(OBJECT_SELF, MK_2DA_DISP_ITEM_COUNT, GetStringLength(sCache) / MK_2DA_DISP_CACHE_ITEM_SIZE);
|
||||
MK_2DA_DISPLAY_SetCurrentPage(1);
|
||||
MK_DEBUG_TRACE("virtual 2DA display system initialized (nItemCount="+IntToString(MK_2DA_DISPLAY_GetItemCount())+").");
|
||||
}
|
||||
|
||||
int MK_2DA_DISPLAY_UpdatePage(int nAction)
|
||||
{
|
||||
int nCurrentPage = MK_2DA_DISPLAY_GetCurrentPage();
|
||||
int nPageCount = MK_2DA_DISPLAY_GetPageCount();
|
||||
int nPageOld=nCurrentPage;
|
||||
switch (nAction)
|
||||
{
|
||||
case 250:
|
||||
// First Page
|
||||
MK_2DA_DISPLAY_SetCurrentPage(nCurrentPage=1);
|
||||
break;
|
||||
case 251:
|
||||
// Prev Page
|
||||
if (nCurrentPage>1)
|
||||
MK_2DA_DISPLAY_SetCurrentPage(--nCurrentPage);
|
||||
break;
|
||||
case 252:
|
||||
// Next Page
|
||||
if (nCurrentPage<nPageCount)
|
||||
MK_2DA_DISPLAY_SetCurrentPage(++nCurrentPage);
|
||||
break;
|
||||
case 253:
|
||||
// Last Page
|
||||
MK_2DA_DISPLAY_SetCurrentPage(nCurrentPage=nPageCount);
|
||||
break;
|
||||
}
|
||||
// MK_2DA_DISPLAY_DEBUG_TRACE("UpdatePage: nAction="+IntToString(nAction)
|
||||
// +", nCurrentPageOld="+IntToString(nPageOld)
|
||||
// +", nCurrentPage="+IntToString(nCurrentPage)
|
||||
// +", nCurrentPageNow="+IntToString(MK_2DA_DISPLAY_GetCurrentPage()));
|
||||
return nCurrentPage;
|
||||
}
|
||||
|
||||
void MK_2DA_DISPLAY_DisplayNavigationOption(int nCondition, int nStrRef, int nToken, int bEnable)
|
||||
{
|
||||
int nPageCount = MK_2DA_DISPLAY_GetPageCount();
|
||||
if (nPageCount>1)
|
||||
{
|
||||
string sText = MK_TLK_GetStringByStrRef(nStrRef, GetGender(OBJECT_SELF));
|
||||
if (!bEnable)
|
||||
{
|
||||
string sColorTag = GetLocalString(OBJECT_SELF, MK_DISABLED_OPTIONS_COLOR);
|
||||
if (sColorTag!="")
|
||||
{
|
||||
sText = sColorTag + sText + "</c>";
|
||||
//StringToRGBString(sText, sRGB);
|
||||
bEnable = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
SetCustomToken(nToken, sText);
|
||||
// MK_2DA_DISPLAY_DEBUG_TRACE("DispOptions: nToken="+IntToString(nToken)+", sText='"+sText+"', bEnable="+IntToString(bEnable));
|
||||
}
|
||||
else
|
||||
{
|
||||
bEnable = FALSE;
|
||||
}
|
||||
MK_GenericDialog_SetCondition(nCondition, bEnable);
|
||||
}
|
||||
|
||||
void MK_2DA_DISPLAY_DisplayNavigationOptions(int nPage, int nPageCount)
|
||||
{
|
||||
MK_2DA_DISPLAY_DisplayNavigationOption(250, -71, 14402, nPage>1);
|
||||
MK_2DA_DISPLAY_DisplayNavigationOption(251, -72, 14403, nPage>1);
|
||||
MK_2DA_DISPLAY_DisplayNavigationOption(252, -73, 14404, nPage<nPageCount);
|
||||
MK_2DA_DISPLAY_DisplayNavigationOption(253, -74, 14405, nPage<nPageCount);
|
||||
|
||||
// MK_DELIMITER_Initialize(nPageCount>1, 249);
|
||||
MK_DELIMITER_Initialize(TRUE, 249);
|
||||
// MK_GenericDialog_SetCondition(249, (nPageCount>1) && MK_DELIMITER_GetUseDelimiter());
|
||||
}
|
||||
|
||||
void MK_2DA_DISPLAY_DisplayPage(int nPage, int nCurrentValue, string sCallbackScript, int bShowItemID)
|
||||
{
|
||||
int iLine = 0;
|
||||
int nPageLength = MK_2DA_DISPLAY_GetPageLength();
|
||||
int nItemCount = MK_2DA_DISPLAY_GetItemCount();
|
||||
int nPageCount = MK_2DA_DISPLAY_GetPageCount();
|
||||
int nMaxPageLength = MK_2DA_DISPLAY_GetMaxPageLength();
|
||||
int iItem = (nPage-1) * nPageLength;
|
||||
|
||||
object oPC = GetPCSpeaker();
|
||||
|
||||
MK_2DA_DISPLAY_DEBUG_TRACE("DisplayPage: nPage="+IntToString(nPage)
|
||||
+", nPageCount="+IntToString(nPageCount)
|
||||
+", nPageLength="+IntToString(nPageLength)
|
||||
+", nItemCount="+IntToString(nItemCount)
|
||||
+", iItem="+IntToString(iItem)
|
||||
);
|
||||
|
||||
MK_2DA_DISPLAY_DisplayNavigationOptions(nPage, nPageCount);
|
||||
|
||||
string sLabel;
|
||||
int bEnable;
|
||||
while (iLine<nMaxPageLength)
|
||||
{
|
||||
if ((iItem<nItemCount) && (iLine < nPageLength))
|
||||
{
|
||||
sLabel = "";
|
||||
int iRow = MK_2DA_DISPLAY_ItemToRow(iItem);
|
||||
if (sCallbackScript!="")
|
||||
{
|
||||
// MK_DEBUG_TRACE("Running callback script '"+sCallbackScript+"'("
|
||||
// +"iItem="+IntToString(iItem)+", iRow="+IntToString(iRow)+") ...");
|
||||
SetLocalInt(OBJECT_SELF, MK_2DA_DISP_CALLBACK_ROW, iRow);
|
||||
ExecuteScript(sCallbackScript);
|
||||
sLabel = GetLocalString(OBJECT_SELF, MK_2DA_DISP_CALLBACK_LABEL);
|
||||
}
|
||||
else
|
||||
{
|
||||
sLabel = MK_2DA_DISPLAY_GetItemLabel(iRow, bShowItemID);
|
||||
}
|
||||
|
||||
string sColorTag;
|
||||
if (iRow==nCurrentValue)
|
||||
{
|
||||
sColorTag = GetLocalString(oPC, MK_2DA_DISP_CURRENT_COLOR);
|
||||
}
|
||||
else
|
||||
{
|
||||
sColorTag = GetLocalString(oPC, MK_2DA_DISP_DEFAULT_COLOR);
|
||||
}
|
||||
if (sColorTag!="")
|
||||
{
|
||||
sLabel = sColorTag+sLabel+"</c>";
|
||||
}
|
||||
// MK_DEBUG_TRACE("Label("+IntToString(iLine)+")="+sLabel);
|
||||
SetCustomToken(MK_2DA_DISP_TOKEN_BASE + iLine, sLabel);
|
||||
bEnable = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
bEnable = FALSE;
|
||||
}
|
||||
|
||||
MK_GenericDialog_SetCondition(iLine, bEnable);
|
||||
|
||||
iItem++;
|
||||
iLine++;
|
||||
}
|
||||
|
||||
string s = "";
|
||||
if (nPageCount>1)
|
||||
{
|
||||
s = "\n"+MK_TLK_GetStringByStrRef(-75)+" "+IntToString(nPage)+"/"+IntToString(nPageCount);
|
||||
}
|
||||
if (MK_2DA_DISP_TOKEN_CURRENT_PAGE>0)
|
||||
{
|
||||
SetCustomToken(MK_2DA_DISP_TOKEN_CURRENT_PAGE, s);
|
||||
}
|
||||
|
||||
if (nCurrentValue!=-1)
|
||||
{
|
||||
s = MK_2DA_DISPLAY_GetItemLabel(nCurrentValue, TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
s = "";
|
||||
}
|
||||
if (MK_2DA_DISP_TOKEN_CURRENT_VALUE>0)
|
||||
{
|
||||
SetCustomToken(MK_2DA_DISP_TOKEN_CURRENT_VALUE, s);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int MK_2DA_DISPLAY_GetSelectedItem(int nLine)
|
||||
{
|
||||
int nPageLength = MK_2DA_DISPLAY_GetPageLength();
|
||||
if ((nLine<0) || (nLine>=nPageLength))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
return ((MK_2DA_DISPLAY_GetCurrentPage()-1) * nPageLength) + nLine;
|
||||
}
|
||||
|
||||
int MK_2DA_DISPLAY_GetSelectedRow(int nLine)
|
||||
{
|
||||
return MK_2DA_DISPLAY_ItemToRow(MK_2DA_DISPLAY_GetSelectedItem(nLine));
|
||||
}
|
||||
|
||||
string MK_2DA_DISPLAY_GetValueAsString(int nLine)
|
||||
{
|
||||
string sResult = "";
|
||||
int nRow = MK_2DA_DISPLAY_GetSelectedRow(nLine);
|
||||
|
||||
string sColValue = GetLocalString(OBJECT_SELF, MK_2DA_DISP_2DA_COL_VALUE);
|
||||
if (sColValue!="")
|
||||
{
|
||||
string s2DAFile = GetLocalString(OBJECT_SELF, MK_2DA_DISP_2DA_FILENAME);
|
||||
sResult = Get2DAString(s2DAFile, sColValue, nRow);
|
||||
}
|
||||
return sResult;
|
||||
}
|
||||
|
||||
int MK_2DA_DISPLAY_GetValueAsInt(int nLine)
|
||||
{
|
||||
int nResult = MK_2DA_DISPLAY_GetSelectedRow(nLine);
|
||||
string sColValue = GetLocalString(OBJECT_SELF, MK_2DA_DISP_2DA_COL_VALUE);
|
||||
if (sColValue!="")
|
||||
{
|
||||
string s2DAFile = GetLocalString(OBJECT_SELF, MK_2DA_DISP_2DA_FILENAME);
|
||||
nResult = StringToInt(Get2DAString(s2DAFile, sColValue, nResult));
|
||||
}
|
||||
return nResult;
|
||||
}
|
||||
|
||||
int MK_2DA_DISPLAY_EnsureVisible(int nRow)
|
||||
{
|
||||
int nItem = MK_2DA_DISPLAY_RowToItem(nRow);
|
||||
int nCurrentPage = ( (nItem!=-1) ? (nItem / MK_2DA_DISPLAY_GetPageLength()) + 1 : MK_2DA_DISPLAY_GetCurrentPage() );
|
||||
// MK_2DA_DISPLAY_DEBUG_TRACE("MK_2DA_DISPLAY_EnsureVisible: nRow="+IntToString(nRow)
|
||||
// +", nItem="+IntToString(nItem)
|
||||
// +", PageLength="+IntToString(MK_2DA_DISPLAY_GetPageLength())
|
||||
// +", nCurPage="+IntToString(nCurrentPage));
|
||||
MK_2DA_DISPLAY_SetCurrentPage(nCurrentPage);
|
||||
return nCurrentPage;
|
||||
}
|
||||
|
||||
void MK_2DA_DISPLAY_Cleanup()
|
||||
{
|
||||
DeleteLocalInt(OBJECT_SELF, MK_2DA_DISP_CURRENT_PAGE);
|
||||
DeleteLocalInt(OBJECT_SELF, MK_2DA_DISP_ITEMS_PER_PAGE);
|
||||
DeleteLocalInt(OBJECT_SELF, MK_2DA_DISP_ITEM_COUNT);
|
||||
DeleteLocalInt(OBJECT_SELF, MK_2DA_DISP_CALLBACK_ROW);
|
||||
DeleteLocalString(OBJECT_SELF, MK_2DA_DISP_2DA_FILENAME);
|
||||
DeleteLocalString(OBJECT_SELF, MK_2DA_DISP_2DA_COL_VALUE);
|
||||
DeleteLocalString(OBJECT_SELF, MK_2DA_DISP_2DA_COL_LABEL);
|
||||
DeleteLocalString(OBJECT_SELF, MK_2DA_DISP_2DA_COL_STRREF);
|
||||
DeleteLocalString(OBJECT_SELF, MK_2DA_DISP_2DA_COL_NOTEMPTY);
|
||||
DeleteLocalString(OBJECT_SELF, MK_2DA_DISP_2DA_CACHE);
|
||||
}
|
6
_module/nss/mk_inc_app.nss
Normal file
6
_module/nss/mk_inc_app.nss
Normal file
@@ -0,0 +1,6 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// mk_inc_app.nss
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
const string g_2daAppearanceType = "appearance";
|
232
_module/nss/mk_inc_array.nss
Normal file
232
_module/nss/mk_inc_array.nss
Normal file
@@ -0,0 +1,232 @@
|
||||
// mk_inc_array
|
||||
|
||||
#include "mk_inc_tools"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// General functions
|
||||
|
||||
// Returns the buffer for the specified array
|
||||
// - oObject: object the array is stored on
|
||||
// - sArrayName: name of the array
|
||||
// * return value: buffer of specified array
|
||||
string MK_ARRAY_GetLocalArrayBuffer(object oObject, string sArrayName);
|
||||
|
||||
// Sets the buffer for the specified array
|
||||
// - oObject: object the array is stored on
|
||||
// - sArrayName: name of the array
|
||||
// - sBuffer: buffer the specified array should use.
|
||||
// sBuffer is supposed to contain only '0' and '1'.
|
||||
void MK_ARRAY_SetLocalArrayBuffer(object oObject, string sArrayName, string sBuffer);
|
||||
|
||||
// Deletes an array
|
||||
// - oObject: object the array is stored on
|
||||
// - sArrayName: name of the array
|
||||
void MK_ARRAY_DeleteLocalArray(object oObject, string sArrayName);
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Sorted Int Array:
|
||||
|
||||
// Appends a new element to the end of an array
|
||||
// - oObject: object to store the array on
|
||||
// - sArrayName: name of the array
|
||||
// - nValue: element to be appended
|
||||
// The element is appended regardless of its value
|
||||
void MK_ARRAY_AppendLocalArraySortedInt(object oObject, string sArrayName, int nValue);
|
||||
|
||||
// returns the length/size of the specified array
|
||||
// - oObject: object the array is stored on
|
||||
// - sArrayName: name of the array
|
||||
// * returns the length/size of the specified array (the number of elements)
|
||||
int MK_ARRAY_GetLocalArraySortedIntLength(object oObject, string sArrayName);
|
||||
|
||||
// returns element at specified position of an sorted int array
|
||||
// - oObject: object the array is stored on
|
||||
// - sArrayName: name of the array
|
||||
// - nPos: position in the array the value should be retrieved from
|
||||
// * returns the value stored at position nPos
|
||||
int MK_ARRAY_GetLocalArraySortedInt(object oObject, string sArrayName, int nPos);
|
||||
|
||||
// returns the position of an integer in a sorted int array
|
||||
// - oObject: object the array is stored on
|
||||
// - sArrayName: name of the array
|
||||
// - nValue: value to be searched
|
||||
// * returns position of specified element or -1 if the element is not found
|
||||
int MK_ARRAY_SearchLocalArraySortedInt(object oObject, string sArrayName, int nValue);
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Bool Array:
|
||||
|
||||
// Simulates storing a boolean value in an array
|
||||
// - oObject: object to store the array on
|
||||
// - sArrayName: name of the array
|
||||
// - nPos: position/index within the array to store the value in
|
||||
// - bValue: the (boolean) value (TRUE/FALSE) to store in the array
|
||||
void MK_ARRAY_SetLocalArrayBool(object oObject, string sArrayName, int nPos, int bValue);
|
||||
|
||||
// Simulates retrieving a boolean value from an array
|
||||
// - oObject: object the array is stored on
|
||||
// - sArrayName: name of the array
|
||||
// - nPos: the position/index in the array the value should be retrieved from
|
||||
// * return value: returns the value found at position/index nPos
|
||||
int MK_ARRAY_GetLocalArrayBool(object oObject, string sArrayName, int nPos);
|
||||
|
||||
// Returns the size/length of an array
|
||||
// - oObject: object the array is stored on
|
||||
// - sArrayName: name of the array
|
||||
// * return value: size/length of an array
|
||||
int MK_ARRAY_GetLocalArrayBoolLength(object oObject, string sArrayName);
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// General functions
|
||||
|
||||
string MK_ARRAY_GetLocalArrayBuffer(object oObject, string sArrayName)
|
||||
{
|
||||
return GetLocalString(oObject, sArrayName);
|
||||
}
|
||||
|
||||
void MK_ARRAY_SetLocalArrayBuffer(object oObject, string sArrayName, string sBuffer)
|
||||
{
|
||||
SetLocalString(oObject, sArrayName, sBuffer);
|
||||
}
|
||||
|
||||
void MK_ARRAY_DeleteLocalArray(object oObject, string sArrayName)
|
||||
{
|
||||
DeleteLocalString(oObject, sArrayName);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Sorted Int Array:
|
||||
|
||||
const int MK_ARRAY_INTEGER_SIZE = 4;
|
||||
|
||||
string MK_ARRAY_LocalArraySortedInt_IntToString(int nValue)
|
||||
{
|
||||
return MK_IntToString(nValue, MK_ARRAY_INTEGER_SIZE, " ");
|
||||
}
|
||||
|
||||
void MK_ARRAY_AppendLocalArraySortedInt(object oObject, string sArrayName, int nValue)
|
||||
{
|
||||
string sBuffer = MK_ARRAY_GetLocalArrayBuffer(oObject, sArrayName);
|
||||
sBuffer += MK_ARRAY_LocalArraySortedInt_IntToString(nValue);
|
||||
MK_ARRAY_SetLocalArrayBuffer(oObject, sArrayName, sBuffer);
|
||||
}
|
||||
|
||||
int MK_ARRAY_GetLocalArraySortedIntLength(object oObject, string sArrayName)
|
||||
{
|
||||
string sBuffer = MK_ARRAY_GetLocalArrayBuffer(oObject, sArrayName);
|
||||
int nLen = GetStringLength(sBuffer) / MK_ARRAY_INTEGER_SIZE;
|
||||
return nLen;
|
||||
}
|
||||
|
||||
int MK_ARRAY_GetLocalArraySortedInt(object oObject, string sArrayName, int nPos)
|
||||
{
|
||||
string sBuffer = MK_ARRAY_GetLocalArrayBuffer(oObject, sArrayName);
|
||||
string sValue = GetSubString(sBuffer, nPos*MK_ARRAY_INTEGER_SIZE, MK_ARRAY_INTEGER_SIZE);
|
||||
return StringToInt(sValue);
|
||||
}
|
||||
|
||||
int MK_ARRAY_SearchLocalArraySortedInt(object oObject, string sArrayName, int nValue)
|
||||
{
|
||||
string sBuffer = MK_ARRAY_GetLocalArrayBuffer(oObject, sArrayName);
|
||||
int nPos, nPos0=0, nPos1=GetStringLength(sBuffer) / MK_ARRAY_INTEGER_SIZE;
|
||||
int nValueQ;
|
||||
while (nPos0<=nPos1)
|
||||
{
|
||||
nPos = (nPos0 + nPos1) / 2;
|
||||
nValueQ = StringToInt(GetSubString(sBuffer, nPos*MK_ARRAY_INTEGER_SIZE, MK_ARRAY_INTEGER_SIZE));
|
||||
if (nValue<nValueQ)
|
||||
{
|
||||
nPos1 = nPos-1;
|
||||
}
|
||||
else if (nValue>nValueQ)
|
||||
{
|
||||
nPos0 = nPos+1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return nPos;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Bool Array:
|
||||
|
||||
int MK_ARRAY_GetLocalArrayBool(object oObject, string sArrayName, int nPos)
|
||||
{
|
||||
string sArray = MK_ARRAY_GetLocalArrayBuffer(oObject, sArrayName);
|
||||
return (GetSubString(sArray, nPos, 1)=="1");
|
||||
}
|
||||
|
||||
|
||||
int MK_ARRAY_GetLocalArrayBoolLength(object oObject, string sArrayName)
|
||||
{
|
||||
string sArray = MK_ARRAY_GetLocalArrayBuffer(oObject, sArrayName);
|
||||
return GetStringLength(sArray);
|
||||
}
|
||||
|
||||
int MK_ARRAY_GetIsLocalArrayBoolEqual(object oObject, string sArrayName, int bValue)
|
||||
{
|
||||
string sArray = MK_ARRAY_GetLocalArrayBuffer(oObject, sArrayName);
|
||||
// MK_DEBUG_TRACE("MK_ARRAY_GetIsLocalArrayBoolEqual: '"+sArray+"'");
|
||||
int iPos;
|
||||
int nLength=GetStringLength(sArray);
|
||||
string sValue = (bValue ? "1" : "0");
|
||||
for (iPos=0; iPos<nLength; iPos++)
|
||||
{
|
||||
if (GetSubString(sArray, iPos, 1)!=sValue)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void MK_ARRAY_InitializeLocalArrayBool(object oObject, string sArrayName, int nSize, int bValue)
|
||||
{
|
||||
int iPos;
|
||||
string sArray="";
|
||||
string sValue = ( bValue ? "1" : "0" );
|
||||
for (iPos=0; iPos<nSize; iPos++)
|
||||
{
|
||||
sArray += sValue;
|
||||
}
|
||||
MK_ARRAY_SetLocalArrayBuffer(oObject, sArrayName, sArray);
|
||||
}
|
||||
|
||||
void MK_ARRAY_SetLocalArrayBool(object oObject, string sArrayName, int nPos, int bValue)
|
||||
{
|
||||
string sArray = MK_ARRAY_GetLocalArrayBuffer(oObject, sArrayName);
|
||||
int nLength = GetStringLength(sArray);
|
||||
while (nLength < nPos+1)
|
||||
{
|
||||
sArray+="0";
|
||||
nLength++;
|
||||
}
|
||||
string sPrefix="", sPostfix="";
|
||||
|
||||
if (nPos>0)
|
||||
{
|
||||
sPrefix = GetStringLeft(sArray, nPos);
|
||||
}
|
||||
if (nPos+1 < nLength)
|
||||
{
|
||||
sPostfix = GetStringRight(sArray, (nLength-(nPos+1)));
|
||||
}
|
||||
|
||||
sArray = sPrefix + (bValue ? "1" : "0") + sPostfix;
|
||||
|
||||
MK_ARRAY_SetLocalArrayBuffer(oObject, sArrayName, sArray);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
void main()
|
||||
{
|
||||
|
||||
}
|
||||
/**/
|
1484
_module/nss/mk_inc_body.nss
Normal file
1484
_module/nss/mk_inc_body.nss
Normal file
File diff suppressed because it is too large
Load Diff
1836
_module/nss/mk_inc_ccoh_db.nss
Normal file
1836
_module/nss/mk_inc_ccoh_db.nss
Normal file
File diff suppressed because it is too large
Load Diff
16
_module/nss/mk_inc_cep.nss
Normal file
16
_module/nss/mk_inc_cep.nss
Normal file
@@ -0,0 +1,16 @@
|
||||
// mk_inc_cep
|
||||
|
||||
#include "mk_inc_tools"
|
||||
|
||||
|
||||
int MK_CEP_GetIsCEPInstalled()
|
||||
{
|
||||
return (MK_Get2DAInt("cepheadmodel", "HEAD_FEMALE_DWARF", 1) == 1);
|
||||
}
|
||||
|
||||
/*
|
||||
void main()
|
||||
{
|
||||
|
||||
}
|
||||
/**/
|
824
_module/nss/mk_inc_cheats.nss
Normal file
824
_module/nss/mk_inc_cheats.nss
Normal file
@@ -0,0 +1,824 @@
|
||||
// mk_inc_cheats
|
||||
|
||||
#include "x2_inc_itemprop"
|
||||
#include "mk_inc_debug"
|
||||
#include "mk_inc_tools"
|
||||
#include "mk_inc_generic"
|
||||
#include "mk_inc_states"
|
||||
#include "mk_inc_craft"
|
||||
#include "mk_inc_ccoh_db"
|
||||
#include "mk_inc_iprp"
|
||||
#include "mk_inc_array"
|
||||
#include "mk_inc_ipwrkcntn"
|
||||
|
||||
//const int MK_CHEATS_DEBUG = TRUE;
|
||||
const int MK_CHEATS_DEBUG = FALSE;
|
||||
|
||||
|
||||
const int MK_STATE_CHEATS_ITEMPROPS_ITEM_INIT = 1001;
|
||||
const int MK_STATE_CHEATS_ITEMPROPS_PROPERTY_INIT = 1002;
|
||||
const int MK_STATE_CHEATS_ITEMPROPS_SUBTYPE_INIT = 1003;
|
||||
const int MK_STATE_CHEATS_ITEMPROPS_COSTTABLE_INIT = 1004;
|
||||
const int MK_STATE_CHEATS_ITEMPROPS_PARAM1_INIT = 1005;
|
||||
const int MK_STATE_CHEATS_ITEMPROPS_FILTERITEMS_INIT = 1006;
|
||||
|
||||
/*
|
||||
string MK_CHEATS_CreateItemPropertyTag(int nType, int nSubType, int nCostTable=-1, int nParam1=-1)
|
||||
{
|
||||
return "MK_CHEATS_ITEMPROP_" + MK_IntToString(nType, 4, "0")
|
||||
+ MK_IntToString(nSubType, 4, "0")
|
||||
// + MK_IntToString(nCostTable, 4, "0")
|
||||
+ (nParam1!=-1 ? MK_IntToString(nParam1, 4, "0") : "");
|
||||
}
|
||||
*/
|
||||
|
||||
object MK_CHEATS_GetCurrentItem();
|
||||
|
||||
int MK_CHEATS_GetCurrentItemPropertyID();
|
||||
|
||||
void MK_CHEATS_SetCurrentItemPropertyID(int nIPropID);
|
||||
|
||||
int MK_CHEATS_GetCurrentItemPropertySubType();
|
||||
|
||||
void MK_CHEATS_SetCurrentItemPropertySubType(int nSubType);
|
||||
|
||||
int MK_CHEATS_GetCurrentItemPropertyCostTableValue();
|
||||
|
||||
void MK_CHEATS_SetCurrentItemPropertyCostTableValue(int nCostTableValue);
|
||||
|
||||
string MK_CHEATS_GetCurrentItemName(string sDefault="");
|
||||
|
||||
string MK_CHEATS_GetCurrentGoldPieceValueAsString(string sDefault="");
|
||||
|
||||
string MK_CHEATS_GetCurrentItemPropertyName(string sDefault="");
|
||||
|
||||
int MK_CHEATS_GetCurrentItemPropertyCount(int nType=-1, int nSubType=-1, int nCostTableValue=-1, int nParam1Value=-1);
|
||||
|
||||
int MK_CHEATS_GetHasCurrentItemValidNumberOfCastSpellProps(int bDisplayMessage=TRUE);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void MK_CHEATS_DEBUG_TRACE(string sMessage)
|
||||
{
|
||||
if (MK_CHEATS_DEBUG)
|
||||
{
|
||||
MK_DEBUG_TRACE(sMessage);
|
||||
}
|
||||
}
|
||||
|
||||
int MK_CHEATS_GetCurrentItemPropertyCount(int nType, int nSubType, int nCostTableValue, int nParam1Value)
|
||||
{
|
||||
return MK_IPRP_GetItemPropertyCount(MK_CHEATS_GetCurrentItem(), nType, nSubType, nCostTableValue, nParam1Value);
|
||||
}
|
||||
|
||||
int MK_CHEATS_GetSkillCount()
|
||||
{
|
||||
return MK_Get2DALength("skills", "Label", 10);
|
||||
}
|
||||
|
||||
void MK_CHEATS_SetCurrentSkill(int nSkill)
|
||||
{
|
||||
SetLocalInt(OBJECT_SELF, "MK_CHEATS_CURRENT_SKILL", nSkill);
|
||||
}
|
||||
|
||||
int MK_CHEATS_GetCurrentSkill()
|
||||
{
|
||||
return GetLocalInt(OBJECT_SELF, "MK_CHEATS_CURRENT_SKILL");
|
||||
}
|
||||
|
||||
void MK_CHEATS_SetCurrentStore(int nStoreID)
|
||||
{
|
||||
SetLocalInt(OBJECT_SELF, "MK_CHEATS_CURRENT_STORE", nStoreID);
|
||||
}
|
||||
|
||||
int MK_CHEATS_GetCurrentStore()
|
||||
{
|
||||
return GetLocalInt(OBJECT_SELF, "MK_CHEATS_CURRENT_STORE");
|
||||
}
|
||||
|
||||
string MK_CHEATS_GetCurrentStoreResRef()
|
||||
{
|
||||
int nStoreID = MK_CHEATS_GetCurrentStore();
|
||||
return Get2DAString("mk_cheat_stores", "RESREF", nStoreID);
|
||||
}
|
||||
|
||||
string MK_CHEATS_GetCurrentStoreTag()
|
||||
{
|
||||
int nStoreID = MK_CHEATS_GetCurrentStore();
|
||||
return Get2DAString("mk_cheat_stores", "TAG", nStoreID);
|
||||
}
|
||||
|
||||
string MK_CHEATS_GetStoreNameByID(int nStoreID)
|
||||
{
|
||||
string s2DAFile = "mk_cheat_stores";
|
||||
int nStrRef = MK_Get2DAInt(s2DAFile, "STRREF", nStoreID, 0);
|
||||
string sStoreName;
|
||||
if (nStrRef!=0)
|
||||
{
|
||||
sStoreName = MK_TLK_GetStringByStrRef(nStrRef, GetGender(OBJECT_SELF));
|
||||
string sPostfix = Get2DAString(s2DAFile, "POSTFIX", nStoreID);
|
||||
if (sPostfix!="")
|
||||
{
|
||||
sStoreName += (" " + sPostfix);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sStoreName = Get2DAString(s2DAFile, "Name", nStoreID);
|
||||
}
|
||||
return sStoreName;
|
||||
}
|
||||
|
||||
string MK_CHEATS_GetCurrentStoreName()
|
||||
{
|
||||
return MK_CHEATS_GetStoreNameByID(MK_CHEATS_GetCurrentStore());
|
||||
}
|
||||
|
||||
object MK_CHEATS_SearchCurrentStore()
|
||||
{
|
||||
object oStore = OBJECT_INVALID;
|
||||
string sTag = MK_CHEATS_GetCurrentStoreTag();
|
||||
if (sTag!="")
|
||||
{
|
||||
oStore = GetObjectByTag(sTag);
|
||||
}
|
||||
return oStore;
|
||||
}
|
||||
|
||||
int MK_CHEATS_InitializeItemAdditionalCostCalculation(object oItem)
|
||||
{
|
||||
int bReturn = FALSE;
|
||||
object oContainer = MK_IPGetIPWorkContainer();
|
||||
if (GetIsObjectValid(oContainer))
|
||||
{
|
||||
object oTempCopy = CopyItem(oItem, oContainer, FALSE);
|
||||
if (GetIsObjectValid(oTempCopy))
|
||||
{
|
||||
// SetItemStackSize(oTempCopy, 1);
|
||||
// seems to have no impact because when calculating the additional costs stacksize is the original stacksize again???
|
||||
// So we set stack size before we calculate the additional costs.
|
||||
SetPlotFlag(oTempCopy, TRUE);
|
||||
MK_IPRP_RemoveAllItemProperties(oTempCopy);
|
||||
SetLocalObject(OBJECT_SELF, "MK_CHEATS_CURRENT_ITEM_TEMPCOPY", oTempCopy);
|
||||
SetLocalInt(OBJECT_SELF, "MK_CHEATS_CURRENT_ADDITIONAL_COST", -1);
|
||||
// MK_CHEATS_DEBUG_TRACE("MK_CHEATS_InitializeItemAdditionalCostCalculation: stackSize="+IntToString(GetItemStackSize(oTempCopy)));
|
||||
// MK_CHEATS_DEBUG_TRACE("MK_CHEATS_InitializeItemAdditionalCostCalculation: stackSize="+IntToString(GetItemStackSize(GetLocalObject(OBJECT_SELF, "MK_CHEATS_CURRENT_ITEM_TEMPCOPY"))));
|
||||
bReturn = TRUE;
|
||||
MK_CHEATS_DEBUG_TRACE("Item Additional Cost Calculation initialized!");
|
||||
}
|
||||
}
|
||||
if (!bReturn)
|
||||
{
|
||||
MK_CHEATS_DEBUG_TRACE("Failed to initialize Item Additional Cost Calculation!");
|
||||
}
|
||||
return bReturn;
|
||||
}
|
||||
|
||||
int MK_CHEATS_SetCurrentItem(object oItem)
|
||||
{
|
||||
MK_CHEATS_DEBUG_TRACE("MK_CHEATS_SetCurrentItem('"+GetName(oItem)+"')");
|
||||
int bReturn=FALSE;
|
||||
|
||||
object oPC = GetPCSpeaker();
|
||||
int nState = MK_GenericDialog_GetState();
|
||||
|
||||
if (GetIsObjectValid(oItem))
|
||||
{
|
||||
switch (nState)
|
||||
{
|
||||
case MK_STATE_CHEATS_CHARGES:
|
||||
CISetCurrentModMode(oPC, MK_CI_MODMODE_ITEM);
|
||||
MK_StartModifyItem(oPC, oItem, FALSE, FALSE);
|
||||
break;
|
||||
case MK_STATE_CHEATS_ITEMPROPS:
|
||||
// case MK_STATE_CHEATS_ITEMPROPS_ITEM_INIT:
|
||||
// case MK_STATE_CHEATS_ITEMPROPS_PROPERTY_INIT:
|
||||
// case MK_STATE_CHEATS_ITEMPROPS_SUBTYPE_INIT:
|
||||
// case MK_STATE_CHEATS_ITEMPROPS_COSTTABLE_INIT:
|
||||
// case MK_STATE_CHEATS_ITEMPROPS_PARAM1_INIT:
|
||||
{
|
||||
MK_CHEATS_DEBUG_TRACE("MK_CHEATS_SetCurrentItem('"+GetName(oItem)+"'");
|
||||
int nBaseItemType = GetBaseItemType(oItem);
|
||||
if (nBaseItemType != BASE_ITEM_INVALID)
|
||||
{
|
||||
MK_CHEATS_DEBUG_TRACE(" > nBaseItemType="+IntToString(nBaseItemType));
|
||||
int nPropColumn = MK_Get2DAInt("baseitems", "PropColumn", nBaseItemType, -1);
|
||||
if (nPropColumn!=-1)
|
||||
{
|
||||
MK_CHEATS_DEBUG_TRACE(" > nPropColumn="+IntToString(nPropColumn));
|
||||
string sPropColumn = Get2DAString("mk_iprp_cols", "Column", nPropColumn);
|
||||
if (sPropColumn!="")
|
||||
{
|
||||
MK_CHEATS_DEBUG_TRACE(" > sPropColumn='"+sPropColumn+"'");
|
||||
SetLocalString(oPC, "MK_CHEATS_CURRENT_PROPCOL", sPropColumn);
|
||||
// SetLocalObject(oPC, "MK_CHEATS_CURRENT_ITEM", oItem);
|
||||
MK_CHEATS_InitializeItemAdditionalCostCalculation(oItem);
|
||||
|
||||
CISetCurrentModMode(oPC, MK_CI_MODMODE_ITEM);
|
||||
MK_StartModifyItem(oPC, oItem, FALSE, FALSE);
|
||||
|
||||
MK_CHEATS_SetCurrentItemPropertyID(-1);
|
||||
MK_CHEATS_SetCurrentItemPropertySubType(-1);
|
||||
MK_CHEATS_SetCurrentItemPropertyCostTableValue(-1);
|
||||
|
||||
bReturn = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
CISetCurrentModItem(oPC, oItem);
|
||||
// SetLocalObject(OBJECT_SELF, "MK_CHEATS_CURRENT_ITEM", oItem);
|
||||
bReturn = TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DeleteLocalString(OBJECT_SELF, "MK_CHEATS_CURRENT_PROPCOL");
|
||||
// DeleteLocalObject(OBJECT_SELF, "MK_CHEATS_CURRENT_ITEM");
|
||||
DeleteLocalInt(OBJECT_SELF, "MK_CHEATS_CURRENT_ADDITIONAL_COST");
|
||||
DeleteLocalInt(OBJECT_SELF, "MK_CHEATS_CURRENT_IPROPID");
|
||||
DeleteLocalInt(OBJECT_SELF, "MK_CHEATS_CURRENT_IPROP_SUBTYPE");
|
||||
DeleteLocalInt(OBJECT_SELF, "MK_CHEATS_CURRENT_IPROP_COSTTABLEVALUE");
|
||||
CISetCurrentModItem(oPC, OBJECT_INVALID);
|
||||
CISetCurrentModBackup(oPC, OBJECT_INVALID);
|
||||
CISetCurrentModMode(oPC, 0);
|
||||
}
|
||||
return bReturn;
|
||||
}
|
||||
|
||||
object MK_CHEATS_GetCurrentItem()
|
||||
{
|
||||
return CIGetCurrentModItem(GetPCSpeaker());
|
||||
}
|
||||
|
||||
string MK_CHEATS_GetCurrentItemName(string sDefault)
|
||||
{
|
||||
string sName=sDefault;
|
||||
object oItem = MK_CHEATS_GetCurrentItem();
|
||||
if (GetIsObjectValid(oItem))
|
||||
{
|
||||
sName = GetName(oItem);
|
||||
}
|
||||
return sName;
|
||||
}
|
||||
|
||||
int MK_CHEATS_CalculateCurrentItemAdditionalCost()
|
||||
{
|
||||
int bReturn = FALSE;
|
||||
object oTempCopy = GetLocalObject(OBJECT_SELF, "MK_CHEATS_CURRENT_ITEM_TEMPCOPY");
|
||||
if (GetIsObjectValid(oTempCopy))
|
||||
{
|
||||
// MK_CHEATS_DEBUG_TRACE("MK_CHEATS_CalculateCurrentItemAdditionalCost: stackSize="+IntToString(GetItemStackSize(oTempCopy)));
|
||||
SetItemStackSize(oTempCopy, 1);
|
||||
// MK_CHEATS_DEBUG_TRACE("MK_CHEATS_CalculateCurrentItemAdditionalCost: stackSize="+IntToString(GetItemStackSize(oTempCopy)));
|
||||
|
||||
int nAdditionalCost = MK_IPRP_GetItemAdditionalCostValue(oTempCopy);
|
||||
|
||||
DeleteLocalObject(OBJECT_SELF, "MK_CHEATS_CURRENT_ITEM_TEMPCOPY");
|
||||
DestroyObject(oTempCopy);
|
||||
|
||||
if (nAdditionalCost!=-1)
|
||||
{
|
||||
bReturn = TRUE;
|
||||
MK_CHEATS_DEBUG_TRACE("Item Additional Cost Calculation successful!");
|
||||
}
|
||||
else
|
||||
{
|
||||
MK_CHEATS_DEBUG_TRACE("Falied to calculate Item Additional Cost!");
|
||||
}
|
||||
SetLocalInt(OBJECT_SELF, "MK_CHEATS_CURRENT_ADDITIONAL_COST", MK_MATH_MaxInt(nAdditionalCost,0));
|
||||
}
|
||||
return bReturn;
|
||||
}
|
||||
|
||||
int MK_CHEATS_GetCurrentItemAdditionalCost()
|
||||
{
|
||||
return GetLocalInt(OBJECT_SELF, "MK_CHEATS_CURRENT_ADDITIONAL_COST");
|
||||
}
|
||||
|
||||
int MK_CHEATS_GetCurrentGoldPieceValue()
|
||||
{
|
||||
return MK_IPRP_GetGoldPieceValue(MK_CHEATS_GetCurrentItem());
|
||||
}
|
||||
|
||||
int MK_CHEATS_CalculateCurrentGoldPieceValue()
|
||||
{
|
||||
MK_CHEATS_DEBUG_TRACE("MK_CHEATS_CalculateCurrentGoldPieceValue()");
|
||||
int nItemValue=-1;
|
||||
int nAdditionalCost = MK_CHEATS_GetCurrentItemAdditionalCost();
|
||||
MK_CHEATS_DEBUG_TRACE(" > nAdditionalCost="+IntToString(nAdditionalCost));
|
||||
if (nAdditionalCost == -1)
|
||||
{
|
||||
nItemValue = MK_CHEATS_GetCurrentGoldPieceValue();
|
||||
}
|
||||
else
|
||||
{
|
||||
nItemValue = MK_IPRP_CalculateGoldPieceValue(MK_CHEATS_GetCurrentItem(), nAdditionalCost);
|
||||
}
|
||||
MK_CHEATS_DEBUG_TRACE(" > nItemValue="+IntToString(nItemValue));
|
||||
return nItemValue;
|
||||
}
|
||||
|
||||
string MK_CHEATS_GetCurrentGoldPieceValueAsString(string sDefault)
|
||||
{
|
||||
string sItemValue = sDefault;
|
||||
object oItem = MK_CHEATS_GetCurrentItem();
|
||||
if (GetIsObjectValid(oItem))
|
||||
{
|
||||
int nValue1 = MK_CHEATS_CalculateCurrentGoldPieceValue();
|
||||
int nValue2 = MK_CHEATS_GetCurrentGoldPieceValue();
|
||||
sItemValue = IntToString(nValue1) + " (" + IntToString(nValue2) +")";
|
||||
}
|
||||
return sItemValue;
|
||||
}
|
||||
|
||||
string MK_CHEATS_GetCurrentItemPropertyName(string sDefault)
|
||||
{
|
||||
string sItemPropertyName = sDefault;
|
||||
if (GetIsObjectValid(MK_CHEATS_GetCurrentItem()))
|
||||
{
|
||||
int nType = MK_CHEATS_GetCurrentItemPropertyID();
|
||||
int nSubType = MK_CHEATS_GetCurrentItemPropertySubType();
|
||||
int nCostTableValue = MK_CHEATS_GetCurrentItemPropertyCostTableValue();
|
||||
sItemPropertyName = MK_IPRP_GetItemPropertyNameByID(nType, nSubType, nCostTableValue);
|
||||
// MK_CHEATS_DEBUG_TRACE("MK_CHEATS_GetCurrentItemPropertyName(): nType="+IntToString(nType)
|
||||
// +", nSubType="+IntToString(nSubType)
|
||||
// +", nCostTableValue="+IntToString(nCostTableValue)
|
||||
// +", name='"+sItemPropertyName+"'");
|
||||
}
|
||||
return sItemPropertyName;
|
||||
}
|
||||
|
||||
string MK_CHEATS_GetCurrentPropColumn()
|
||||
{
|
||||
return GetLocalString(OBJECT_SELF, "MK_CHEATS_CURRENT_PROPCOL");
|
||||
}
|
||||
|
||||
void MK_CHEATS_SetCurrentItemPropertyID(int nIPropID)
|
||||
{
|
||||
SetLocalInt(OBJECT_SELF, "MK_CHEATS_CURRENT_IPROPID", nIPropID);
|
||||
}
|
||||
|
||||
int MK_CHEATS_GetCurrentItemPropertyID()
|
||||
{
|
||||
return GetLocalInt(OBJECT_SELF, "MK_CHEATS_CURRENT_IPROPID");
|
||||
}
|
||||
|
||||
string MK_CHEATS_GetCurrentItemPropertyTypeName()
|
||||
{
|
||||
string sIPropName="";
|
||||
int nIPropID = MK_CHEATS_GetCurrentItemPropertyID();
|
||||
if (nIPropID!=-1)
|
||||
{
|
||||
int nStrRef = MK_Get2DAInt("itempropdef", "Name", nIPropID, 0);
|
||||
sIPropName = GetStringByStrRef(nStrRef, GetGender(OBJECT_SELF));
|
||||
}
|
||||
return sIPropName;
|
||||
}
|
||||
|
||||
string MK_CHEATS_GetCurrentItemPropertyGameName()
|
||||
{
|
||||
string sIPropName="";
|
||||
int nIPropID = MK_CHEATS_GetCurrentItemPropertyID();
|
||||
if (nIPropID!=-1)
|
||||
{
|
||||
int nStrRef = MK_Get2DAInt("itempropdef", "GameStrRef", nIPropID, 0);
|
||||
sIPropName = GetStringByStrRef(nStrRef, GetGender(OBJECT_SELF));
|
||||
}
|
||||
return sIPropName;
|
||||
}
|
||||
|
||||
string MK_CHEATS_GetCurrentSubTypeResRef()
|
||||
{
|
||||
string sSubTypeResRef="";
|
||||
int nIPropID = MK_CHEATS_GetCurrentItemPropertyID();
|
||||
if (nIPropID!=-1)
|
||||
{
|
||||
sSubTypeResRef= Get2DAString("itempropdef", "SubTypeResRef", nIPropID);
|
||||
}
|
||||
return sSubTypeResRef;
|
||||
}
|
||||
|
||||
void MK_CHEATS_SetCurrentItemPropertySubType(int nSubType)
|
||||
{
|
||||
SetLocalInt(OBJECT_SELF, "MK_CHEATS_CURRENT_IPROP_SUBTYPE", nSubType);
|
||||
}
|
||||
|
||||
int MK_CHEATS_GetCurrentItemPropertySubType()
|
||||
{
|
||||
return GetLocalInt(OBJECT_SELF, "MK_CHEATS_CURRENT_IPROP_SUBTYPE");
|
||||
}
|
||||
|
||||
string MK_CHEATS_GetCurrentItemPropertySubTypeName()
|
||||
{
|
||||
string sSubTypeName="";
|
||||
int nSubType = MK_CHEATS_GetCurrentItemPropertySubType();
|
||||
|
||||
if (nSubType!=-1)
|
||||
{
|
||||
string sSubTypeResRef = MK_CHEATS_GetCurrentSubTypeResRef();
|
||||
sSubTypeName = GetStringByStrRef(MK_Get2DAInt(sSubTypeResRef, "Name", nSubType, 0), GetGender(OBJECT_SELF));
|
||||
}
|
||||
return sSubTypeName;
|
||||
}
|
||||
|
||||
int MK_CHEATS_GetCurrentParam1ResRefID()
|
||||
{
|
||||
int nIPropID = MK_CHEATS_GetCurrentItemPropertyID();
|
||||
int nSubType = MK_CHEATS_GetCurrentItemPropertySubType();
|
||||
|
||||
return MK_IPRP_GetParam1ResRefIDByID(nIPropID, nSubType);
|
||||
}
|
||||
|
||||
string MK_CHEATS_GetCurrentParam1ResRef()
|
||||
{
|
||||
int nIPropID = MK_CHEATS_GetCurrentItemPropertyID();
|
||||
int nSubType = MK_CHEATS_GetCurrentItemPropertySubType();
|
||||
|
||||
return MK_IPRP_GetParam1ResRefByID(nIPropID, nSubType);
|
||||
}
|
||||
|
||||
string MK_CHEATS_GetCurrentCostTableResRef()
|
||||
{
|
||||
int nIPropID = MK_CHEATS_GetCurrentItemPropertyID();
|
||||
return MK_IPRP_GetCostTableResRefByID(nIPropID);
|
||||
}
|
||||
|
||||
int MK_CHEATS_GetCurrentParam1TableStrRef()
|
||||
{
|
||||
int nStrRef = 0;
|
||||
int nIPropID = MK_CHEATS_GetCurrentItemPropertyID();
|
||||
int nSubType = MK_CHEATS_GetCurrentItemPropertySubType();
|
||||
|
||||
int nParam1ResRefID = MK_IPRP_GetParam1ResRefIDByID(nIPropID, nSubType);
|
||||
if (nParam1ResRefID!=-1)
|
||||
{
|
||||
nStrRef = MK_Get2DAInt("iprp_paramtable", "Name", nParam1ResRefID, 0);
|
||||
}
|
||||
return nStrRef;
|
||||
}
|
||||
|
||||
void MK_CHEATS_SetCurrentItemPropertyParam1Value(int nParam1)
|
||||
{
|
||||
SetLocalInt(OBJECT_SELF, "MK_CHEATS_CURRENT_IPROP_PARAM1", nParam1);
|
||||
}
|
||||
|
||||
int MK_CHEATS_GetCurrentItemPropertyParam1Value()
|
||||
{
|
||||
return GetLocalInt(OBJECT_SELF, "MK_CHEATS_CURRENT_IPROP_PARAM1");
|
||||
}
|
||||
|
||||
string MK_CHEATS_GetCurrentItemPropertyParam1Name()
|
||||
{
|
||||
string sParam1Name="";
|
||||
int nParam1 = MK_CHEATS_GetCurrentItemPropertyParam1Value();
|
||||
if (nParam1!=-1)
|
||||
{
|
||||
string s2DAFile = MK_CHEATS_GetCurrentParam1ResRef();
|
||||
|
||||
int nStrRef = MK_Get2DAInt(s2DAFile, "Name", nParam1, 0);
|
||||
|
||||
sParam1Name = GetStringByStrRef(nStrRef, GetGender(OBJECT_SELF));
|
||||
}
|
||||
return sParam1Name;
|
||||
}
|
||||
|
||||
int MK_CHEATS_GetCurrentItemPropertyCostTableValue()
|
||||
{
|
||||
return GetLocalInt(OBJECT_SELF, "MK_CHEATS_CURRENT_IPROP_COSTTABLEVALUE");
|
||||
}
|
||||
|
||||
void MK_CHEATS_SetCurrentItemPropertyCostTableValue(int nCostTableValue)
|
||||
{
|
||||
SetLocalInt(OBJECT_SELF, "MK_CHEATS_CURRENT_IPROP_COSTTABLEVALUE", nCostTableValue);
|
||||
}
|
||||
|
||||
string MK_CHEATS_GetCurrentItemPropertyCostTableValueName()
|
||||
{
|
||||
string sCostTableValueName="";
|
||||
int nCostTableValue = MK_CHEATS_GetCurrentItemPropertyCostTableValue();
|
||||
if (nCostTableValue>0)
|
||||
{
|
||||
string s2DAFile = MK_CHEATS_GetCurrentCostTableResRef();
|
||||
|
||||
int nStrRef = MK_Get2DAInt(s2DAFile, "Name", nCostTableValue, 0);
|
||||
|
||||
sCostTableValueName = GetStringByStrRef(nStrRef, GetGender(OBJECT_SELF));
|
||||
}
|
||||
return sCostTableValueName;
|
||||
}
|
||||
|
||||
void MK_CHEATS_ToggleItemProperty(object oItem, int nIPropID, int nSubType=-1, int nCostTableValue=-1, int nParam1Value=0)
|
||||
{
|
||||
MK_CHEATS_DEBUG_TRACE("MK_CHEATS_ToggleItemProperty('"+GetName(oItem)+"', nIPropID="+IntToString(nIPropID)
|
||||
+", nSubType="+IntToString(nSubType)
|
||||
+", nCostTableValue="+IntToString(nCostTableValue)
|
||||
+", nParam1Value="+IntToString(nParam1Value));
|
||||
|
||||
itemproperty iProp = MK_IPRP_GetItemProperty(oItem, nIPropID, nSubType, nCostTableValue, nParam1Value);
|
||||
if (GetIsItemPropertyValid(iProp))
|
||||
{
|
||||
MK_CHEATS_DEBUG_TRACE("MK_CHEATS_ToggleItemProperty: property removed.");
|
||||
RemoveItemProperty(oItem, iProp);
|
||||
}
|
||||
else if (MK_IPRP_CreateItemPropertyOnItem(oItem, nIPropID, nSubType, nCostTableValue, nParam1Value))
|
||||
{
|
||||
MK_CHEATS_DEBUG_TRACE("MK_CHEATS_ToggleItemProperty: property created.");
|
||||
}
|
||||
else
|
||||
{
|
||||
MK_CHEATS_DEBUG_TRACE("MK_CHEATS_ToggleItemProperty: failed to create property.");
|
||||
}
|
||||
}
|
||||
|
||||
int MK_CHEATS_GetIsCurrentItemModified()
|
||||
{
|
||||
int bResult = FALSE;
|
||||
object oPC = GetPCSpeaker();
|
||||
object oItem = CIGetCurrentModItem(oPC);
|
||||
object oBackup = CIGetCurrentModBackup(oPC);
|
||||
|
||||
// MK_CHEATS_DEBUG_TRACE("MK_CHEATS_GetIsCurrentItemModified(): '"
|
||||
// +GetName(oItem)+"', '"+GetName(oBackup)+"'");
|
||||
|
||||
if (GetIsObjectValid(oItem) && GetIsObjectValid(oBackup))
|
||||
{
|
||||
int nState = MK_GenericDialog_GetState();
|
||||
|
||||
switch (nState)
|
||||
{
|
||||
case MK_STATE_CHEATS_ITEMPROPS_ITEM:
|
||||
case MK_STATE_CHEATS_ITEMPROPS_PROPERTY:
|
||||
case MK_STATE_CHEATS_ITEMPROPS_SUBTYPE:
|
||||
case MK_STATE_CHEATS_ITEMPROPS_COSTTABLE:
|
||||
case MK_STATE_CHEATS_ITEMPROPS_PARAM1:
|
||||
{
|
||||
string sIASStrBackup = MK_CCOH_DB_ItemPropertiesToIASStr(oBackup);
|
||||
string sIASStrCurrent = MK_CCOH_DB_ItemPropertiesToIASStr(oItem);
|
||||
bResult = (sIASStrBackup != sIASStrCurrent);
|
||||
// MK_CHEATS_DEBUG_TRACE(" > '"+sIASStrCurrent+"', '"+sIASStrBackup+"': bResult="+IntToString(bResult));
|
||||
break;
|
||||
}
|
||||
case MK_STATE_CHEATS_CHARGES:
|
||||
bResult = GetItemCharges(oItem)!=GetItemCharges(oBackup);
|
||||
// MK_CHEATS_DEBUG_TRACE(" > '"+IntToString(GetItemCharges(oItem))+"', '"+IntToString(GetItemCharges(oBackup))+"': bResult="+IntToString(bResult));
|
||||
break;
|
||||
}
|
||||
}
|
||||
return bResult;
|
||||
}
|
||||
|
||||
int MK_CHEATS_GetRequiredGold(int nCurrentValue=-1)
|
||||
{
|
||||
// MK_CHEATS_DEBUG_TRACE("MK_CHEATS_GetRequiredGold("+IntToString(nCurrentValue)+")");
|
||||
object oPC = GetPCSpeaker();
|
||||
int nRequiredGold = 0;
|
||||
object oBackup = CIGetCurrentModBackup(oPC);
|
||||
if (GetIsObjectValid(oBackup))
|
||||
{
|
||||
if (nCurrentValue==-1)
|
||||
{
|
||||
nCurrentValue = MK_CHEATS_CalculateCurrentGoldPieceValue();
|
||||
}
|
||||
int nBackupValue = MK_IPRP_GetGoldPieceValue(oBackup);
|
||||
nRequiredGold = nCurrentValue - nBackupValue;
|
||||
// MK_CHEATS_DEBUG_TRACE(" > nCurrentValue="+IntToString(nCurrentValue));
|
||||
// MK_CHEATS_DEBUG_TRACE(" > nBackupValue="+IntToString(nBackupValue));
|
||||
// MK_CHEATS_DEBUG_TRACE(" > nRequiredGold="+IntToString(nRequiredGold));
|
||||
float fFactor = 1.0f;
|
||||
if (nRequiredGold > 0)
|
||||
{
|
||||
fFactor = GetLocalFloat(oPC, "MK_CHEATS_ITEM_BUY");
|
||||
}
|
||||
else if (nRequiredGold < 0)
|
||||
{
|
||||
fFactor = GetLocalFloat(oPC, "MK_CHEATS_ITEM_SELL");
|
||||
}
|
||||
nRequiredGold = FloatToInt(fFactor * nRequiredGold);
|
||||
// MK_CHEATS_DEBUG_TRACE(" > fFactor="+FloatToString(fFactor));
|
||||
// MK_CHEATS_DEBUG_TRACE(" > nRequiredGold="+IntToString(nRequiredGold));
|
||||
// MK_CHEATS_DEBUG_TRACE("MK_CHEATS_GetRequiredGold: nCurrentValue="+IntToString(nCurrentValue)
|
||||
// +", nBackupValue="+IntToString(nBackupValue)
|
||||
// +", fFactor="+FloatToString(fFactor)
|
||||
// +", nRequiredGold="+IntToString(nRequiredGold));
|
||||
// MK_CHEATS_DEBUG_TRACE(" > oBackup='"+GetName(oBackup)+"', nCalculatedValue="+IntToString(MK_IPRP_CalculateGoldPieceValue(oBackup)));
|
||||
}
|
||||
return nRequiredGold;
|
||||
}
|
||||
|
||||
int MK_CHEATS_CanModifyItem(int bDisplayMessage)
|
||||
{
|
||||
object oPC = GetPCSpeaker();
|
||||
int nState = MK_GenericDialog_GetState();
|
||||
switch (nState)
|
||||
{
|
||||
case MK_STATE_CHEATS_ITEMPROPS_PROPERTY:
|
||||
case MK_STATE_CHEATS_ITEMPROPS_SUBTYPE:
|
||||
case MK_STATE_CHEATS_ITEMPROPS_COSTTABLE:
|
||||
case MK_STATE_CHEATS_ITEMPROPS_PARAM1:
|
||||
if (!GetLocalInt(oPC, "MK_CHEATS_IGNORE_MINMAX_PROPS"))
|
||||
{
|
||||
if (!MK_CHEATS_GetHasCurrentItemValidNumberOfCastSpellProps(bDisplayMessage))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
switch (nState)
|
||||
{
|
||||
case MK_STATE_CHEATS_ITEMPROPS_PROPERTY:
|
||||
case MK_STATE_CHEATS_ITEMPROPS_SUBTYPE:
|
||||
case MK_STATE_CHEATS_ITEMPROPS_COSTTABLE:
|
||||
case MK_STATE_CHEATS_ITEMPROPS_PARAM1:
|
||||
case MK_STATE_CHEATS_CHARGES:
|
||||
{
|
||||
int nRequiredGold = MK_CHEATS_GetRequiredGold();
|
||||
int nGold = GetGold(oPC);
|
||||
if (nRequiredGold > nGold)
|
||||
{
|
||||
if (bDisplayMessage)
|
||||
{
|
||||
SendMessageToPC(oPC, "Not enough gold to modify item!");
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int MK_CHEATS_FinishModifyItem()
|
||||
{
|
||||
int bReturn = FALSE;
|
||||
object oPC = GetPCSpeaker();
|
||||
|
||||
if (MK_CHEATS_CanModifyItem(FALSE))
|
||||
{
|
||||
int nRequiredGold = MK_CHEATS_GetRequiredGold();
|
||||
int nGold = GetGold(oPC);
|
||||
if (nGold >= nRequiredGold)
|
||||
{
|
||||
MK_FinishModifyItem(oPC, oPC);
|
||||
|
||||
if (nRequiredGold > 0)
|
||||
{
|
||||
TakeGoldFromCreature(nRequiredGold, oPC, TRUE);
|
||||
}
|
||||
else if (nRequiredGold < 0)
|
||||
{
|
||||
GiveGoldToCreature(oPC, -nRequiredGold);
|
||||
}
|
||||
MK_CHEATS_SetCurrentItem(OBJECT_INVALID);
|
||||
|
||||
// CISetCurrentModItem(oPC, OBJECT_INVALID);
|
||||
// CISetCurrentModMode(oPC, 0);
|
||||
// MK_CHEATS_SetCurrentItemPropertyID(-1);
|
||||
// MK_CHEATS_SetCurrentItemPropertySubType(-1);
|
||||
// MK_CHEATS_SetCurrentItemPropertyCostTableValue(-1);
|
||||
|
||||
bReturn = TRUE;
|
||||
}
|
||||
}
|
||||
return bReturn;
|
||||
}
|
||||
|
||||
void MK_CHEATS_CancelModifyItem()
|
||||
{
|
||||
object oPC = GetPCSpeaker();
|
||||
// int nState = MK_GenericDialog_GetState();
|
||||
|
||||
// MK_GenericDialog_SetCurrentPage(nState, 1);
|
||||
// MK_2DA_DISPLAY_Cleanup();
|
||||
MK_CancelModifyItem(oPC, oPC);
|
||||
MK_CHEATS_SetCurrentItem(OBJECT_INVALID);
|
||||
// CISetCurrentModItem(oPC, OBJECT_INVALID);
|
||||
// CISetCurrentModMode(oPC, 0);
|
||||
// MK_CHEATS_SetCurrentItemPropertyID(-1);
|
||||
// MK_CHEATS_SetCurrentItemPropertySubType(-1);
|
||||
// MK_CHEATS_SetCurrentItemPropertyCostTableValue(-1);
|
||||
// MK_GenericDialog_SetState(nState = MK_STATE_CHEATS_ITEMPROPS_ITEM_INIT);
|
||||
// MK_CHEATS_DEBUG_TRACE("MK_ITEMPROP_Cancel(): *terminate*");
|
||||
// return nState;
|
||||
}
|
||||
|
||||
int MK_CHEATS_GetHasCurrentItemValidNumberOfCastSpellProps(int bDisplayMessage)
|
||||
{
|
||||
int bResult = FALSE;
|
||||
object oItem = MK_CHEATS_GetCurrentItem();
|
||||
|
||||
int nBaseItemType = GetBaseItemType(oItem);
|
||||
int nMinProps = MK_Get2DAInt("baseitems", "MinProps", nBaseItemType, 0);
|
||||
int nMaxProps = MK_Get2DAInt("baseitems", "MaxProps", nBaseItemType, 0);
|
||||
|
||||
int nCastSpellProps = MK_IPRP_GetItemPropertyCount(oItem, ITEM_PROPERTY_CAST_SPELL);
|
||||
|
||||
if ((nMinProps<=nCastSpellProps) && (nMaxProps>=nCastSpellProps))
|
||||
{
|
||||
bResult = TRUE;
|
||||
}
|
||||
else if (bDisplayMessage)
|
||||
{
|
||||
object oPC = GetPCSpeaker();
|
||||
SendMessageToPC(oPC, "Item has invalid number of Cast Spell properties: "+IntToString(nCastSpellProps)+"!");
|
||||
SendMessageToPC(oPC, "Allowed number of Cast Spell properties for this item: "+IntToString(nMinProps)+".."+IntToString(nMaxProps)+"!");
|
||||
}
|
||||
|
||||
return bResult;
|
||||
}
|
||||
|
||||
void MK_CHEATS_SetCustomToken(/*int nState*/)
|
||||
{
|
||||
object oPC = GetPCSpeaker();
|
||||
string sItemName;
|
||||
string sItemValue = "-";
|
||||
string sRequiredGold = "-";
|
||||
int nRequiredGold = 0;
|
||||
int nGold = GetGold();
|
||||
|
||||
object oItem = MK_CHEATS_GetCurrentItem();
|
||||
MK_CHEATS_DEBUG_TRACE("MK_CHEATS_SetCustomToken('"+GetName(oItem)+"'): valid="+IntToString(GetIsObjectValid(oItem)));
|
||||
if (GetIsObjectValid(oItem))
|
||||
{
|
||||
int nCurrentValue = MK_CHEATS_CalculateCurrentGoldPieceValue();
|
||||
nRequiredGold = MK_CHEATS_GetRequiredGold(nCurrentValue);
|
||||
if (MK_DEBUG_GetDebugMode())
|
||||
{
|
||||
int nGoldPieceValue = MK_CHEATS_GetCurrentGoldPieceValue();
|
||||
sItemValue = IntToString(nCurrentValue) + " / " + IntToString(nGoldPieceValue);
|
||||
MK_CHEATS_DEBUG_TRACE(" > nCurrentValue="+IntToString(nCurrentValue)+", nGoldPieceValue="+IntToString(nGoldPieceValue)+", nRequiredGold="+IntToString(nRequiredGold));
|
||||
}
|
||||
else
|
||||
{
|
||||
sItemValue = IntToString(nCurrentValue);
|
||||
}
|
||||
sRequiredGold = IntToString(nRequiredGold);
|
||||
}
|
||||
sRequiredGold += (" ("+IntToString(nGold)+")");
|
||||
|
||||
sItemName=MK_CHEATS_GetCurrentItemName("-");
|
||||
|
||||
SetCustomToken(14422, sItemName);
|
||||
SetCustomToken(14423, sItemValue);
|
||||
SetCustomToken(14426, sRequiredGold);
|
||||
|
||||
string sDisabledOptionsColor = GetLocalString(OBJECT_SELF, "MK_DISABLED_OPTIONS_COLOR");
|
||||
string sCloseColor = (sDisabledOptionsColor!="" ? "</c>" : "");
|
||||
|
||||
if (!GetLocalInt(oPC, "MK_CHEATS_IGNORE_MINMAX_PROPS") && !MK_CHEATS_GetHasCurrentItemValidNumberOfCastSpellProps())
|
||||
{
|
||||
SetCustomToken(14460, sDisabledOptionsColor);
|
||||
SetCustomToken(14470, " "+MK_TLK_GetStringByStrRef(-500)+"</c>");
|
||||
}
|
||||
else if (nRequiredGold>nGold)
|
||||
{
|
||||
SetCustomToken(14460, sDisabledOptionsColor);
|
||||
SetCustomToken(14470, " "+MK_TLK_GetStringByStrRef(-474)+"</c>");
|
||||
}
|
||||
else
|
||||
{
|
||||
SetCustomToken(14460, "");
|
||||
SetCustomToken(14470, "");
|
||||
}
|
||||
}
|
||||
|
||||
void MK_CHEATS_InitializeFilterItemArray(object oPC)
|
||||
{
|
||||
if (MK_ARRAY_GetLocalArrayBuffer(oPC, "MK_CHEATS_IPROP_ITEMFILTER") == "")
|
||||
{
|
||||
MK_ARRAY_InitializeLocalArrayBool(oPC, "MK_CHEATS_IPROP_ITEMFILTER", MK_Get2DALength("mk_iprp_cols", "Column"), TRUE);
|
||||
// MK_ARRAY_SetLocalArrayBool(oPC, "MK_CHEATS_IPROP_ITEMFILTER", 17, FALSE); // no properties
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int MK_CHEATS_GetIsItemTypeSelected(object oPC, int nItemType)
|
||||
{
|
||||
return MK_ARRAY_GetLocalArrayBool(oPC, "MK_CHEATS_IPROP_ITEMFILTER", nItemType);
|
||||
}
|
||||
|
||||
int MK_CHEATS_GetAreAllItemTypesSelected(object oPC)
|
||||
{
|
||||
return MK_ARRAY_GetIsLocalArrayBoolEqual(oPC, "MK_CHEATS_IPROP_ITEMFILTER", TRUE);
|
||||
}
|
||||
|
||||
void MK_CHEATS_SelectItemType(object oPC, int nItemType, int bSelect)
|
||||
{
|
||||
MK_ARRAY_SetLocalArrayBool(oPC, "MK_CHEATS_IPROP_ITEMFILTER", nItemType, bSelect);
|
||||
}
|
||||
|
||||
void MK_CHEATS_SelectAllItemTypes(object oPC, int bSelect)
|
||||
{
|
||||
MK_ARRAY_InitializeLocalArrayBool(oPC, "MK_CHEATS_IPROP_ITEMFILTER", MK_Get2DALength("mk_iprp_cols", "Column"), bSelect);
|
||||
}
|
||||
|
||||
/*
|
||||
void main()
|
||||
{
|
||||
|
||||
}
|
||||
/**/
|
213
_module/nss/mk_inc_color.nss
Normal file
213
_module/nss/mk_inc_color.nss
Normal file
@@ -0,0 +1,213 @@
|
||||
// mk_inc_color
|
||||
#include "mk_inc_debug"
|
||||
#include "x2_inc_craft"
|
||||
#include "mk_inc_tools"
|
||||
#include "mk_inc_modmodes"
|
||||
#include "mk_inc_body"
|
||||
#include "mk_inc_tlk"
|
||||
#include "mk_inc_array"
|
||||
|
||||
const string MK_COLOR_2DAFILE = "mk_color";
|
||||
|
||||
const int MK_COLOR_NUMBER = 0;
|
||||
const int MK_COLOR_NEXT = 1;
|
||||
const int MK_COLOR_PREV = 2;
|
||||
|
||||
const string MK_COLOR_VALID_COLORS = "mk_color_valid_colors";
|
||||
|
||||
|
||||
// returns the matching column in 'mk_color.2da'
|
||||
// - nModMode: either MK_CI_MODMODE_BODY or X2_CI_MODMODE_ARMOR,
|
||||
// MK_CI_MODMODE_HELMET or MK_CI_MODMODE_CLOAK
|
||||
// - nParam1: nModMode == MK_CI_MODMODE_BODY: MK_CRAFTBODY_COLOR
|
||||
// else: ignored
|
||||
// - nParam2: nModMode == MK_CI_MODMODE_BODY: COLOR_CHANNEL_*
|
||||
// else: ITEM_APPR_ARMOR_COLOR_*
|
||||
// * returns column
|
||||
string MK_COLOR_Get2DAColumn(int nModMode, int nParam1, int nParam2);
|
||||
|
||||
|
||||
// returns TRUE if specified color is valid
|
||||
// - sColumn: column in 'mk_color.2da'
|
||||
// - nColor: color number (0..176)
|
||||
// * returns TRUE if color is valid and FALSE otherwise.
|
||||
int MK_COLOR_GetIsColorValid(string sColumn, int nColor);
|
||||
|
||||
// returns strref for specified color
|
||||
// - sColumn: column in 'mk_color.2da'
|
||||
// - nColor: color number (0..176)
|
||||
// * returns strref if color is valid or 0.
|
||||
int MK_COLOR_GetStrRef(string sColumn, int nColor);
|
||||
|
||||
// returns color name for specified color
|
||||
// - sColumn: column in 'mk_color.2da'
|
||||
// - nColor: color number (0..176)
|
||||
// * returns color name if color is valid or an empty string otherwise.
|
||||
string MK_COLOR_GetColorName(string sColumn, int nColor);
|
||||
|
||||
// returns color name for specified color
|
||||
// - nModMode: either MK_CI_MODMODE_BODY or X2_CI_MODMODE_ARMOR,
|
||||
// MK_CI_MODMODE_HELMET or MK_CI_MODMODE_CLOAK
|
||||
// - nParam1: nModMode == MK_CI_MODMODE_BODY: MK_CRAFTBODY_COLOR
|
||||
// else: ignored
|
||||
// - nParam2: nModMode == MK_CI_MODMODE_BODY: COLOR_CHANNEL_*
|
||||
// else: ITEM_APPR_ARMOR_COLOR_*
|
||||
// - nColor: color number (0..176)
|
||||
// * returns color name if color is valid or an empty string otherwise.
|
||||
string MK_COLOR_GetColorName2(int nModMode, int nParam1, int nParam2, int nColor);
|
||||
|
||||
// sets custom tokens to color name and color number
|
||||
// - sColumn: column in 'mk_color.2da'
|
||||
// - nColor: color number (0..176)
|
||||
void MK_COLOR_SetCustomToken(string sColumn, int nColor, int nTokenName=14422, int nTokenNr=14423);
|
||||
|
||||
|
||||
int MK_COLOR_SetColor(object oCreature, int nColorChannel, int nMode, int nColor=-1, object oPC=OBJECT_INVALID);
|
||||
|
||||
|
||||
void MK_COLOR_SetValidColors(object oPC, string sValidColors)
|
||||
{
|
||||
MK_ARRAY_SetLocalArrayBuffer(oPC, MK_COLOR_VALID_COLORS, sValidColors);
|
||||
}
|
||||
|
||||
|
||||
int MK_COLOR_SetColor(object oCreature, int nColorChannel, int nMode, int nColor, object oPC)
|
||||
{
|
||||
if (!GetIsObjectValid(oPC))
|
||||
{
|
||||
oPC = oCreature;
|
||||
}
|
||||
int nNewColor=-1;
|
||||
switch (nMode)
|
||||
{
|
||||
case MK_COLOR_NUMBER:
|
||||
nNewColor = nColor;
|
||||
break;
|
||||
case MK_COLOR_NEXT:
|
||||
case MK_COLOR_PREV:
|
||||
{
|
||||
int nCurrentColor = GetColor(oCreature, nColorChannel);
|
||||
int nPosCurrent = MK_ARRAY_SearchLocalArraySortedInt(oPC, MK_COLOR_VALID_COLORS, nCurrentColor);
|
||||
int nColorCount = MK_ARRAY_GetLocalArraySortedIntLength(oPC, MK_COLOR_VALID_COLORS);
|
||||
|
||||
int nPosNew=-1;
|
||||
if (nPosCurrent==-1)
|
||||
{
|
||||
nPosNew=0;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (nMode)
|
||||
{
|
||||
case MK_COLOR_PREV:
|
||||
nPosNew = (nPosCurrent + nColorCount - 1) % nColorCount;
|
||||
break;
|
||||
case MK_COLOR_NEXT:
|
||||
nPosNew = (nPosCurrent + 1) % nColorCount;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (nPosNew>=0)
|
||||
{
|
||||
nNewColor = MK_ARRAY_GetLocalArraySortedInt(oPC, MK_COLOR_VALID_COLORS, nPosNew);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (nNewColor!=-1)
|
||||
{
|
||||
MK_SetColor(oCreature, nColorChannel, nNewColor);
|
||||
}
|
||||
return nNewColor;
|
||||
}
|
||||
|
||||
int MK_COLOR_GetStrRef(string sColumn, int nColor)
|
||||
{
|
||||
return MK_Get2DAInt(MK_COLOR_2DAFILE, sColumn, nColor, 0);
|
||||
}
|
||||
|
||||
int MK_COLOR_GetIsColorValid(string sColumn, int nColor)
|
||||
{
|
||||
int nStrRef = MK_COLOR_GetStrRef(sColumn, nColor);
|
||||
return (nStrRef!=0);
|
||||
}
|
||||
|
||||
string MK_COLOR_GetColorName(string sColumn, int nColor)
|
||||
{
|
||||
int nStrRef = MK_COLOR_GetStrRef(sColumn, nColor);
|
||||
string sColorName = MK_TLK_GetStringByStrRef(nStrRef, GetGender(OBJECT_SELF));
|
||||
// MK_DEBUG_TRACE("MK_COLOR_GetColorName('"+sColumn+"',"+IntToString(nColor)+"): nStrRef="+IntToString(nStrRef)+", sName='"+sColorName+"'");
|
||||
return sColorName;
|
||||
}
|
||||
|
||||
string MK_COLOR_GetColorName2(int nModMode, int nParam1, int nParam2, int nColor)
|
||||
{
|
||||
string sColumn = MK_COLOR_Get2DAColumn(nModMode, nParam1, nParam2);
|
||||
return MK_COLOR_GetColorName(sColumn, nColor);
|
||||
}
|
||||
|
||||
string MK_COLOR_Get2DAColumn(int nModMode, int nParam1, int nParam2)
|
||||
{
|
||||
string sColumn="";
|
||||
switch (nModMode)
|
||||
{
|
||||
case X2_CI_MODMODE_ARMOR:
|
||||
case MK_CI_MODMODE_HELMET:
|
||||
case MK_CI_MODMODE_CLOAK:
|
||||
switch (nParam2)
|
||||
{
|
||||
case ITEM_APPR_ARMOR_COLOR_LEATHER1:
|
||||
case ITEM_APPR_ARMOR_COLOR_LEATHER2:
|
||||
sColumn = "Leather";
|
||||
break;
|
||||
case ITEM_APPR_ARMOR_COLOR_CLOTH1:
|
||||
case ITEM_APPR_ARMOR_COLOR_CLOTH2:
|
||||
sColumn = "Cloth";
|
||||
break;
|
||||
case ITEM_APPR_ARMOR_COLOR_METAL1:
|
||||
case ITEM_APPR_ARMOR_COLOR_METAL2:
|
||||
sColumn = "Metal";
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case MK_CI_MODMODE_BODY:
|
||||
switch (nParam1)
|
||||
{
|
||||
case MK_CRAFTBODY_COLOR:
|
||||
switch (nParam2)
|
||||
{
|
||||
case COLOR_CHANNEL_HAIR:
|
||||
sColumn="Hair";
|
||||
break;
|
||||
case COLOR_CHANNEL_SKIN:
|
||||
sColumn="Skin";
|
||||
break;
|
||||
case COLOR_CHANNEL_TATTOO_1:
|
||||
case COLOR_CHANNEL_TATTOO_2:
|
||||
sColumn="Tattoo";
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return sColumn;
|
||||
}
|
||||
|
||||
void MK_COLOR_SetCustomToken(string sColumn, int nColor, int nTokenName, int nTokenNr)
|
||||
{
|
||||
string sColorName=MK_COLOR_GetColorName(sColumn, nColor);
|
||||
SetCustomToken(nTokenName, sColorName);
|
||||
// MK_DEBUG_TRACE("SetCustomToken("+IntToString(nTokenName)+",'"+sColorName+"')");
|
||||
SetCustomToken(nTokenNr, IntToString(nColor));
|
||||
// MK_DEBUG_TRACE("SetCustomToken("+IntToString(nTokenNr)+","+IntToString(nColor)+")");
|
||||
}
|
||||
|
||||
/*
|
||||
void main()
|
||||
{
|
||||
|
||||
}
|
||||
/**/
|
3666
_module/nss/mk_inc_craft.nss
Normal file
3666
_module/nss/mk_inc_craft.nss
Normal file
File diff suppressed because it is too large
Load Diff
18
_module/nss/mk_inc_craft_0.nss
Normal file
18
_module/nss/mk_inc_craft_0.nss
Normal file
@@ -0,0 +1,18 @@
|
||||
// mk_inc_craft_0
|
||||
|
||||
/* Defined in x2_inc_craft
|
||||
const int X2_CI_MODMODE_INVALID = 0;
|
||||
const int X2_CI_MODMODE_ARMOR = 1;
|
||||
const int X2_CI_MODMODE_WEAPON = 2;
|
||||
*/
|
||||
const int MK_CI_MODMODE_CLOAK = 3;
|
||||
const int MK_CI_MODMODE_HELMET = 4;
|
||||
const int MK_CI_MODMODE_SHIELD = 5;
|
||||
const int MK_CI_MODMODE_CHARACTER = 8; // character description
|
||||
const int MK_CI_MODMODE_BODY = 9;
|
||||
|
||||
/*
|
||||
void main(
|
||||
{
|
||||
}
|
||||
/**/
|
55
_module/nss/mk_inc_debug.nss
Normal file
55
_module/nss/mk_inc_debug.nss
Normal file
@@ -0,0 +1,55 @@
|
||||
|
||||
void MK_DEBUG_TRACE(string s);
|
||||
|
||||
int MK_DEBUG_GetDebugMode();
|
||||
|
||||
object MK_DEBUG_GetPC(object oPC = OBJECT_SELF)
|
||||
{
|
||||
if (GetIsPC(oPC))
|
||||
{
|
||||
return oPC;
|
||||
}
|
||||
oPC = GetMaster(oPC);
|
||||
if (GetIsPC(oPC))
|
||||
{
|
||||
return oPC;
|
||||
}
|
||||
return GetFirstPC();
|
||||
}
|
||||
|
||||
int MK_DEBUG_GetDebugMode()
|
||||
{
|
||||
return GetLocalInt(GetModule(), "MK_DISPLAY_DEBUG_MESSAGES");
|
||||
}
|
||||
|
||||
void MK_DEBUG_TRACE(string s)
|
||||
{
|
||||
if (!MK_DEBUG_GetDebugMode()) return;
|
||||
object oPC = MK_DEBUG_GetPC(OBJECT_SELF);
|
||||
if (GetIsObjectValid(oPC))
|
||||
{
|
||||
SendMessageToPC(oPC, s);
|
||||
}
|
||||
/**/
|
||||
}
|
||||
|
||||
/*
|
||||
void MK_DEBUG_SetCustomToken(int nCustomTokenNumber, string sTokenValue)
|
||||
{
|
||||
SetCustomToken(nCustomTokenNumber, sTokenValue);
|
||||
MK_DEBUG_TRACE("SetCustomToken("+IntToString(nCustomTokenNumber)+",'"+sTokenValue+'")");
|
||||
}
|
||||
*/
|
||||
|
||||
void MK_DEBUG_SpawnScriptDebugger()
|
||||
{
|
||||
if (!MK_DEBUG_GetDebugMode()) return;
|
||||
SpawnScriptDebugger();
|
||||
}
|
||||
|
||||
/*
|
||||
void main()
|
||||
{
|
||||
|
||||
}
|
||||
/**/
|
31
_module/nss/mk_inc_delimiter.nss
Normal file
31
_module/nss/mk_inc_delimiter.nss
Normal file
@@ -0,0 +1,31 @@
|
||||
//#include "x3_inc_string"
|
||||
#include "mk_inc_generic"
|
||||
|
||||
void MK_DELIMITER_Initialize(int bEnable=TRUE, int nCondition=MK_DELIMITER_CONDITION);
|
||||
|
||||
void MK_DELIMITER_Initialize(int bEnable, int nCondition)
|
||||
{
|
||||
bEnable = bEnable && MK_DELIMITER_GetUseDelimiter();
|
||||
string sToken="";
|
||||
if (bEnable)
|
||||
{
|
||||
// string sRGB = GetLocalString(OBJECT_SELF, MK_DELIMITER_COLOR);
|
||||
string sColorTag = GetLocalString(MK_GetObjectQ(), MK_DELIMITER_COLOR);
|
||||
string sColorEnd = "</c>";
|
||||
sToken = sColorTag + "--------------------------------------------------" + sColorEnd;
|
||||
// sToken = StringToRGBString("--------------------------------------------------",sRGB);
|
||||
}
|
||||
SetCustomToken(MK_DELIMITER_TOKEN, sToken);
|
||||
|
||||
if (nCondition!=MK_DELIMITER_CONDITION)
|
||||
{
|
||||
MK_GenericDialog_SetCondition(nCondition, bEnable);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
void main()
|
||||
{
|
||||
|
||||
}
|
||||
/**/
|
128
_module/nss/mk_inc_editor.nss
Normal file
128
_module/nss/mk_inc_editor.nss
Normal file
@@ -0,0 +1,128 @@
|
||||
#include "mk_inc_time"
|
||||
|
||||
const string g_varEditorOnExit = "MK_EditBox_OnExit";
|
||||
const string g_varEditorOnCancel = "MK_EditBox_OnCancel";
|
||||
const string g_varEditorOnInit = "MK_EditBox_OnInit";
|
||||
|
||||
const string g_varEditorHeadLine = "MK_Editor_HeadLine";
|
||||
const string g_varEditorInit = "MK_Editor_Init";
|
||||
const string g_varEditorText = "MK_Editor_Text";
|
||||
const string g_varEditorMaxLength = "MK_Editor_MaxLength";
|
||||
const string g_varEditorSingleLine = "MK_Editor_SingleLine";
|
||||
const string g_varEditorDisableColors = "MK_Editor_DisableColors";
|
||||
const string g_varEditorDisableBlock = "MK_Editor_DisableBlock";
|
||||
const string g_varEditorUseOnPlayerChatEvent = "MK_Editor_UseOnPlayerChatEvent";
|
||||
const string g_varEditorChatMessageString = "MK_Editor_ChatMessageString";
|
||||
const string g_varEditorDisableLoadSave = "MK_Editor_DisableLoadSave";
|
||||
const string g_varEditorID = "MK_Editor_ID";
|
||||
const string g_varEditorOK = "MK_Editor_OK";
|
||||
const string g_varEditorCancel = "MK_Editor_Cancel";
|
||||
|
||||
const string g_varEditorBuffer = "MK_Editor_Buffer";
|
||||
const string g_varEditorClipboard = "MK_Editor_Clipboard";
|
||||
const string g_varEditorCursor = "MK_Editor_Cursor";
|
||||
const string g_varEditorBlock = "MK_Editor_Block";
|
||||
const string g_varEditorMenuMode = "MK_Editor_MenuMode";
|
||||
const string g_varEditorRunning = "MK_Editor_Running";
|
||||
|
||||
const string g_varEditorLastAction = "MK_Editor_LastAction";
|
||||
const string g_varEditorTimeStamp = "MK_Editor_TimeStamp";
|
||||
const string g_varEditorCursorSpeedMode = "MK_Editor_CursorSpeedMode";
|
||||
|
||||
const string g_varEditorLoadSaveSlots = "MK_EditorFileSlot_";
|
||||
// MK_EditorFileSlot_01, MK_EditorFileSlot_02, ...
|
||||
|
||||
const string g_varEditorCounter = "MK_Editor_Counter";
|
||||
|
||||
const string g_varEditorColor2DA = "MK_Editor_Color2DA";
|
||||
|
||||
void MK_Editor_ExecuteScript(object oPC, string sVarName);
|
||||
|
||||
string MK_Editor_GetScript(object oPC, string sVarName);
|
||||
|
||||
void MK_Editor_CleanUp(object oPC);
|
||||
|
||||
|
||||
void MK_Editor_ExecuteScript(object oPC, string sVarName)
|
||||
{
|
||||
string sScript = MK_Editor_GetScript(oPC, sVarName);
|
||||
if (sScript!="")
|
||||
{
|
||||
ExecuteScript(sScript, oPC);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
string MK_Editor_GetScript(object oPC, string sVarName)
|
||||
{
|
||||
string sScript;
|
||||
sScript = GetLocalString(oPC, sVarName);
|
||||
if (sScript=="")
|
||||
{
|
||||
sScript = GetLocalString(GetModule(), sVarName);
|
||||
}
|
||||
return sScript;
|
||||
}
|
||||
|
||||
void MK_Editor_CleanUp(object oPC)
|
||||
{
|
||||
if (GetLocalInt(oPC, g_varEditorRunning))
|
||||
{
|
||||
DeleteLocalString(oPC, g_varEditorOnExit);
|
||||
DeleteLocalString(oPC, g_varEditorOnCancel);
|
||||
DeleteLocalString(oPC, g_varEditorOnInit);
|
||||
|
||||
DeleteLocalInt(oPC, g_varEditorInit);
|
||||
DeleteLocalInt(oPC, g_varEditorID);
|
||||
DeleteLocalInt(oPC, g_varEditorOK);
|
||||
DeleteLocalInt(oPC, g_varEditorCancel);
|
||||
|
||||
DeleteLocalString(oPC, g_varEditorText);
|
||||
DeleteLocalString(oPC, g_varEditorHeadLine);
|
||||
|
||||
DeleteLocalInt(oPC, g_varEditorMaxLength);
|
||||
DeleteLocalInt(oPC, g_varEditorSingleLine);
|
||||
DeleteLocalInt(oPC, g_varEditorDisableColors);
|
||||
DeleteLocalInt(oPC, g_varEditorDisableBlock);
|
||||
DeleteLocalInt(oPC, g_varEditorUseOnPlayerChatEvent);
|
||||
DeleteLocalString(oPC, g_varEditorChatMessageString);
|
||||
|
||||
DeleteLocalString(oPC, g_varEditorBuffer);
|
||||
DeleteLocalString(oPC, g_varEditorClipboard);
|
||||
DeleteLocalInt(oPC, g_varEditorCursor);
|
||||
DeleteLocalInt(oPC, g_varEditorBlock);
|
||||
DeleteLocalInt(oPC, g_varEditorMenuMode);
|
||||
DeleteLocalInt(oPC, g_varEditorRunning);
|
||||
|
||||
DeleteLocalInt(oPC, g_varEditorLastAction);
|
||||
DeleteLocalInt(oPC, g_varEditorCursorSpeedMode);
|
||||
|
||||
mk_deleteTimeStampOnObject(oPC, g_varEditorTimeStamp);
|
||||
|
||||
object oModule = GetModule();
|
||||
|
||||
// number of editor instances currently running (including this one)
|
||||
int nCounter = GetLocalInt(oModule, g_varEditorCounter);
|
||||
SetLocalInt(oModule, g_varEditorCounter, --nCounter);
|
||||
|
||||
if (nCounter==0)
|
||||
{
|
||||
// we're the last one so lets delete everything
|
||||
|
||||
DeleteLocalInt(oModule, g_varEditorColor2DA);
|
||||
|
||||
int i;
|
||||
for (i=1; i<50; i++)
|
||||
{
|
||||
SetCustomToken(19950+i, "");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
void main()
|
||||
{
|
||||
|
||||
}
|
||||
/* */
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user