2025/06/22 Update
Fixed Vow of Poverty. Fixed Vow of Poverty bonus feats not being restored onClientEnter. Added PRC option for spontaneous casters unlearning spells (@Rakiov) Gloura was double dipping caster level. Added NUI levelup spellpicker for most AMS classes (@Rakiov) Tweaked Tactical Insight. Updated ToB maneuver TLK entries to display correct prerequisites.
This commit is contained in:
@@ -85,11 +85,11 @@ void main()
|
||||
if(nPreReq1>0 && !GetHasFeat(nPreReq1, oPC)) nAllPreReq = 0;
|
||||
if(nPreReq1==213 && GetLevelByClass(CLASS_TYPE_MONK, oPC) >= 1) nAllPreReq = 1; //for Ki Strike and monks
|
||||
if(nPreReq2>0 && !GetHasFeat(nPreReq2, oPC)) nAllPreReq = 0;
|
||||
if(nCon>0 && !GetAbilityScore(oPC,ABILITY_CONSTITUTION) >= nCon) nAllPreReq = 0;
|
||||
if(nWis>0 && !GetAbilityScore(oPC,ABILITY_CONSTITUTION) >= nWis) nAllPreReq = 0;
|
||||
if(nCha>0 && !GetAbilityScore(oPC,ABILITY_CONSTITUTION) >= nCha) nAllPreReq = 0;
|
||||
if(nBAB>0 && !GetBaseAttackBonus(oPC) >= nBAB) nAllPreReq = 0;
|
||||
if(nLaw>0 && !GetAlignmentLawChaos(oPC) == ALIGNMENT_LAWFUL) nAllPreReq = 0;
|
||||
if(nCon>0 && GetAbilityScore(oPC,ABILITY_CONSTITUTION, TRUE) < nCon) nAllPreReq = 0;
|
||||
if(nWis>0 && GetAbilityScore(oPC,ABILITY_WISDOM, TRUE) < nWis) nAllPreReq = 0;
|
||||
if(nCha>0 && GetAbilityScore(oPC,ABILITY_CHARISMA, TRUE) < nCha) nAllPreReq = 0;
|
||||
if(nBAB>0 && GetBaseAttackBonus(oPC) < nBAB) nAllPreReq = 0;
|
||||
if(nLaw>0 && !(GetAlignmentLawChaos(oPC) == ALIGNMENT_LAWFUL)) nAllPreReq = 0;
|
||||
|
||||
if (!GetHasFeat(nFeat, oPC) && !GetLocalInt(oPC, "VoPFeat"+IntToString(nFeat)) && nAllPreReq == 1) AddChoice(sName, nFeat, oPC);
|
||||
}
|
||||
@@ -122,6 +122,9 @@ void main()
|
||||
{
|
||||
SetPersistantLocalInt(oPC, "VoPFeat"+IntToString(nLevel),1); //Register the choice was made
|
||||
|
||||
// Store the feat ID for recalling onClientEnter
|
||||
SetPersistantLocalInt(oPC, "VoPFeatID" + IntToString(nChoice), 1);
|
||||
|
||||
//If it was not cancelled, give chosen feat to PC (as EffectBonusFeat)
|
||||
if(nChoice > 0)
|
||||
{
|
||||
|
27
nwn/nwnprc/trunk/scripts/prc_nui_dsc_evnt.nss
Normal file
27
nwn/nwnprc/trunk/scripts/prc_nui_dsc_evnt.nss
Normal file
@@ -0,0 +1,27 @@
|
||||
//::///////////////////////////////////////////////
|
||||
//:: PRC Spell Description NUI Events
|
||||
//:: prc_nui_dsc_evnt
|
||||
//:://////////////////////////////////////////////
|
||||
/*
|
||||
This is the event logic used for the spell description nui
|
||||
*/
|
||||
//:://////////////////////////////////////////////
|
||||
//:: Created By: Rakiov
|
||||
//:: Created On: 20.06.2005
|
||||
//:://////////////////////////////////////////////
|
||||
|
||||
#include "prc_nui_consts"
|
||||
|
||||
void main()
|
||||
{
|
||||
object oPlayer = NuiGetEventPlayer();
|
||||
int nToken = NuiGetEventWindow();
|
||||
string sEvent = NuiGetEventType();
|
||||
string sElement = NuiGetEventElement();
|
||||
string sWindowId = NuiGetWindowId(oPlayer, nToken);
|
||||
|
||||
// if the OK button was clicked then we close the window.
|
||||
if (sElement == NUI_SPELL_DESCRIPTION_OK_BUTTON)
|
||||
DelayCommand(0.1f, NuiDestroy(oPlayer, nToken));
|
||||
}
|
||||
|
90
nwn/nwnprc/trunk/scripts/prc_nui_dsc_view.nss
Normal file
90
nwn/nwnprc/trunk/scripts/prc_nui_dsc_view.nss
Normal file
@@ -0,0 +1,90 @@
|
||||
//::///////////////////////////////////////////////
|
||||
//:: PRC Spellbook Description NUI
|
||||
//:: prc_nui_dsc_view
|
||||
//:://////////////////////////////////////////////
|
||||
/*
|
||||
This is the view for the Spell Description NUI
|
||||
*/
|
||||
//:://////////////////////////////////////////////
|
||||
//:: Created By: Rakiov
|
||||
//:: Created On: 29.05.2005
|
||||
//:://////////////////////////////////////////////
|
||||
|
||||
#include "nw_inc_nui"
|
||||
#include "prc_nui_consts"
|
||||
#include "inc_2dacache"
|
||||
#include "prc_nui_com_inc"
|
||||
|
||||
void main()
|
||||
{
|
||||
int featID = GetLocalInt(OBJECT_SELF, NUI_SPELL_DESCRIPTION_FEATID_VAR);
|
||||
int spellId = GetLocalInt(OBJECT_SELF, NUI_SPELL_DESCRIPTION_SPELLID_VAR);
|
||||
int realSpellId = GetLocalInt(OBJECT_SELF, NUI_SPELL_DESCRIPTION_REAL_SPELLID_VAR);
|
||||
int nClass = GetLocalInt(OBJECT_SELF, NUI_SPELL_DESCRIPTION_CLASSID_VAR);
|
||||
|
||||
// look for existing window and destroy
|
||||
int nPreviousToken = NuiFindWindow(OBJECT_SELF, NUI_SPELL_DESCRIPTION_WINDOW_ID);
|
||||
if(nPreviousToken != 0)
|
||||
{
|
||||
NuiDestroy(OBJECT_SELF, nPreviousToken);
|
||||
}
|
||||
|
||||
// in order of accuracy for names it goes RealSpellID > SpellID > FeatID
|
||||
string spellName = GetSpellName(spellId, realSpellId, featID, nClass);
|
||||
// Descriptions and Icons are accuratly stored on the feat
|
||||
string spellDesc = GetStringByStrRef(StringToInt(Get2DACache("feat", "DESCRIPTION", featID)));
|
||||
string spellIcon = Get2DACache("feat", "ICON", featID);
|
||||
|
||||
json jRoot = JsonArray();
|
||||
json jGroup = JsonArray();
|
||||
|
||||
json jRow = JsonArray();
|
||||
|
||||
json jImage = NuiImage(JsonString(spellIcon), JsonInt(NUI_ASPECT_EXACT), JsonInt(NUI_HALIGN_LEFT), JsonInt(NUI_VALIGN_TOP));
|
||||
jImage = NuiWidth(jImage, 32.0f);
|
||||
jRow = JsonArrayInsert(jRow, jImage);
|
||||
jRow = NuiCol(jRow);
|
||||
jGroup = JsonArrayInsert(jGroup, jRow);
|
||||
|
||||
jRow = JsonArray();
|
||||
json jText = NuiText(JsonString(spellDesc), FALSE, NUI_SCROLLBARS_AUTO);
|
||||
jRow = JsonArrayInsert(jRow, jText);
|
||||
jRow = NuiCol(jRow);
|
||||
jGroup = JsonArrayInsert(jGroup, jRow);
|
||||
|
||||
jGroup = NuiRow(jGroup);
|
||||
jGroup = NuiGroup(jGroup, TRUE, NUI_SCROLLBARS_NONE);
|
||||
jRoot = JsonArrayInsert(jRoot, jGroup);
|
||||
|
||||
jRow = JsonArray();
|
||||
jRow = JsonArrayInsert(jRow, NuiSpacer());
|
||||
json jButton = NuiId(NuiButton(JsonString("OK")), NUI_SPELL_DESCRIPTION_OK_BUTTON);
|
||||
jButton = NuiWidth(jButton, 175.0f);
|
||||
jButton = NuiHeight(jButton, 48.0f);
|
||||
jRow = JsonArrayInsert(jRow, jButton);
|
||||
jRow = NuiRow(jRow);
|
||||
|
||||
jRoot = JsonArrayInsert(jRoot, jRow);
|
||||
jRoot = NuiCol(jRoot);
|
||||
|
||||
|
||||
// This is the main window with jRoot as the main pane. It includes titles and parameters (more on those later)
|
||||
json nui = NuiWindow(jRoot, JsonString(spellName), NuiBind("geometry"), NuiBind("resizable"), JsonBool(FALSE), NuiBind("closable"), NuiBind("transparent"), NuiBind("border"));
|
||||
|
||||
// finally create it and it'll return us a non-zero token.
|
||||
int nToken = NuiCreate(OBJECT_SELF, nui, NUI_SPELL_DESCRIPTION_WINDOW_ID);
|
||||
|
||||
// get the geometry of the window in case we opened this before and have a
|
||||
// preference for location
|
||||
json geometry = NuiRect(-1.0f,-1.0f, 426.0f, 446.0f);
|
||||
|
||||
// Set the binds to their default values
|
||||
NuiSetBind(OBJECT_SELF, nToken, "geometry", geometry);
|
||||
NuiSetBind(OBJECT_SELF, nToken, "resizable", JsonBool(FALSE));
|
||||
NuiSetBind(OBJECT_SELF, nToken, "closable", JsonBool(FALSE));
|
||||
NuiSetBind(OBJECT_SELF, nToken, "transparent", JsonBool(FALSE));
|
||||
NuiSetBind(OBJECT_SELF, nToken, "border", JsonBool(TRUE));
|
||||
|
||||
ClearSpellDescriptionNUI();
|
||||
}
|
||||
|
158
nwn/nwnprc/trunk/scripts/prc_nui_lv_event.nss
Normal file
158
nwn/nwnprc/trunk/scripts/prc_nui_lv_event.nss
Normal file
@@ -0,0 +1,158 @@
|
||||
//::///////////////////////////////////////////////
|
||||
//:: PRC Level Up NUI Events
|
||||
//:: prc_nui_lv_event
|
||||
//:://////////////////////////////////////////////
|
||||
/*
|
||||
This is the logic that handles the events for the Level Up NUI
|
||||
*/
|
||||
//:://////////////////////////////////////////////
|
||||
//:: Created By: Rakiov
|
||||
//:: Created On: 20.06.2005
|
||||
//:://////////////////////////////////////////////
|
||||
|
||||
#include "prc_nui_lv_inc"
|
||||
|
||||
void SetupAndCallSpellDescriptionNUI(object oPlayer, int spellbookId, int classId)
|
||||
{
|
||||
string sFile = GetClassSpellbookFile(classId);
|
||||
int featId = StringToInt(Get2DACache(sFile, "FeatID", spellbookId));
|
||||
int spellId = StringToInt(Get2DACache(sFile, "SpellID", spellbookId));
|
||||
int realSpellId = StringToInt(Get2DACache(sFile, "RealSpellID", spellbookId));
|
||||
|
||||
CreateSpellDescriptionNUI(oPlayer, featId, spellId, realSpellId, classId);
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
object oPlayer = NuiGetEventPlayer();
|
||||
int nToken = NuiGetEventWindow();
|
||||
string sEvent = NuiGetEventType();
|
||||
string sElement = NuiGetEventElement();
|
||||
string sWindowId = NuiGetWindowId(oPlayer, nToken);
|
||||
|
||||
// Not a mouseup event, nothing to do.
|
||||
if (sEvent != "mouseup")
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// we clicked a spell circle, set the selected circle to the new one and refresh the window
|
||||
if (FindSubString(sElement, NUI_LEVEL_UP_SPELL_CIRCLE_BUTTON_BASEID) >= 0)
|
||||
{
|
||||
int selectedCircle = StringToInt(RegExpReplace(NUI_LEVEL_UP_SPELL_CIRCLE_BUTTON_BASEID, sElement, ""));
|
||||
SetLocalInt(oPlayer, NUI_LEVEL_UP_SELECTED_CIRCLE_VAR, selectedCircle);
|
||||
CloseNUILevelUpWindow(oPlayer);
|
||||
ExecuteScript("prc_nui_lv_view", oPlayer);
|
||||
return;
|
||||
}
|
||||
|
||||
json jPayload = NuiGetEventPayload();
|
||||
int nButton = JsonGetInt(JsonObjectGet(jPayload, "mouse_btn"));
|
||||
|
||||
if (FindSubString(sElement, NUI_LEVEL_UP_SPELL_DISABLED_BUTTON_BASEID) >= 0)
|
||||
{
|
||||
int spellbookId = StringToInt(RegExpReplace(NUI_LEVEL_UP_SPELL_DISABLED_BUTTON_BASEID, sElement, ""));
|
||||
int classId = GetLocalInt(oPlayer, NUI_LEVEL_UP_SELECTED_CLASS_VAR);
|
||||
|
||||
// we right clicked a disabled button, tell what the spell is
|
||||
if (nButton == NUI_PAYLOAD_BUTTON_RIGHT_CLICK)
|
||||
{
|
||||
SetupAndCallSpellDescriptionNUI(oPlayer, spellbookId, classId);
|
||||
return;
|
||||
}
|
||||
// we left clicked a disabled button, tell why it was disables
|
||||
if (nButton == NUI_PAYLOAD_BUTTON_LEFT_CLICK)
|
||||
{
|
||||
SendMessageToPC(oPlayer, ReasonForDisabledSpell(classId, spellbookId, oPlayer));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (FindSubString(sElement, NUI_LEVEL_UP_SPELL_CHOSEN_DISABLED_BUTTON_BASEID) >= 0)
|
||||
{
|
||||
int spellbookId = StringToInt(RegExpReplace(NUI_LEVEL_UP_SPELL_CHOSEN_DISABLED_BUTTON_BASEID, sElement, ""));
|
||||
int classId = GetLocalInt(oPlayer, NUI_LEVEL_UP_SELECTED_CLASS_VAR);
|
||||
|
||||
// we right clicked a disabled button, tell what the spell is
|
||||
if (nButton == NUI_PAYLOAD_BUTTON_RIGHT_CLICK)
|
||||
{
|
||||
SetupAndCallSpellDescriptionNUI(oPlayer, spellbookId, classId);
|
||||
return;
|
||||
}
|
||||
// we left clicked a disabled button, tell why it was disabled
|
||||
if (nButton == NUI_PAYLOAD_BUTTON_LEFT_CLICK)
|
||||
{
|
||||
SendMessageToPC(oPlayer, ReasonForDisabledChosen(classId, spellbookId, oPlayer));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (FindSubString(sElement, NUI_LEVEL_UP_SPELL_BUTTON_BASEID) >= 0)
|
||||
{
|
||||
int spellbookId = StringToInt(RegExpReplace(NUI_LEVEL_UP_SPELL_BUTTON_BASEID, sElement, ""));
|
||||
int classId = GetLocalInt(oPlayer, NUI_LEVEL_UP_SELECTED_CLASS_VAR);
|
||||
|
||||
// If right click, open the Spell Description NUI
|
||||
if (nButton == NUI_PAYLOAD_BUTTON_RIGHT_CLICK)
|
||||
{
|
||||
SetupAndCallSpellDescriptionNUI(oPlayer, spellbookId, classId);
|
||||
return;
|
||||
}
|
||||
// we are adding the spell to the chosen spell list then refreshing the window
|
||||
if (nButton == NUI_PAYLOAD_BUTTON_LEFT_CLICK)
|
||||
{
|
||||
int chosenCircle = GetLocalInt(oPlayer, NUI_LEVEL_UP_SELECTED_CIRCLE_VAR);
|
||||
|
||||
AddSpellToChosenList(classId, spellbookId, chosenCircle, oPlayer);
|
||||
CloseNUILevelUpWindow(oPlayer);
|
||||
ExecuteScript("prc_nui_lv_view", oPlayer);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (FindSubString(sElement, NUI_LEVEL_UP_SPELL_CHOSEN_BUTTON_BASEID) >= 0)
|
||||
{
|
||||
int spellbookId = StringToInt(RegExpReplace(NUI_LEVEL_UP_SPELL_CHOSEN_BUTTON_BASEID, sElement, ""));
|
||||
int classId = GetLocalInt(oPlayer, NUI_LEVEL_UP_SELECTED_CLASS_VAR);
|
||||
|
||||
|
||||
json jPayload = NuiGetEventPayload();
|
||||
int nButton = JsonGetInt(JsonObjectGet(jPayload, "mouse_btn"));
|
||||
|
||||
// If right click, open the Spell Description NUI
|
||||
if (nButton == NUI_PAYLOAD_BUTTON_RIGHT_CLICK)
|
||||
{
|
||||
SetupAndCallSpellDescriptionNUI(oPlayer, spellbookId, classId);
|
||||
return;
|
||||
}
|
||||
// we are removing a chosen spell from the chosen list then refreshing the window
|
||||
if (nButton == NUI_PAYLOAD_BUTTON_LEFT_CLICK)
|
||||
{
|
||||
int chosenCircle = GetLocalInt(oPlayer, NUI_LEVEL_UP_SELECTED_CIRCLE_VAR);
|
||||
|
||||
RemoveSpellFromChosenList(classId, spellbookId, chosenCircle, oPlayer);
|
||||
CloseNUILevelUpWindow(oPlayer);
|
||||
ExecuteScript("prc_nui_lv_view", oPlayer);
|
||||
}
|
||||
return;
|
||||
}
|
||||
// we are resetting our choices
|
||||
if (sElement == NUI_LEVEL_UP_RESET_BUTTON)
|
||||
{
|
||||
ResetChoices(oPlayer);
|
||||
CloseNUILevelUpWindow(oPlayer);
|
||||
ExecuteScript("prc_nui_lv_view", oPlayer);
|
||||
return;
|
||||
}
|
||||
// finalize all our choices
|
||||
if (sElement == NUI_LEVEL_UP_DONE_BUTTON)
|
||||
{
|
||||
int classId = GetLocalInt(oPlayer, NUI_LEVEL_UP_SELECTED_CLASS_VAR);
|
||||
FinishLevelUp(classId, oPlayer);
|
||||
CloseNUILevelUpWindow(oPlayer);
|
||||
ExecuteScript("prc_amagsys_gain", oPlayer);
|
||||
DelayCommand(0.2f, ExecuteScript("prc_nui_sb_view", oPlayer));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
353
nwn/nwnprc/trunk/scripts/prc_nui_lv_view.nss
Normal file
353
nwn/nwnprc/trunk/scripts/prc_nui_lv_view.nss
Normal file
@@ -0,0 +1,353 @@
|
||||
//::///////////////////////////////////////////////
|
||||
//:: PRC Level Up NUI View
|
||||
//:: prc_nui_lv_view
|
||||
//:://////////////////////////////////////////////
|
||||
/*
|
||||
This is the logic that handles the view for the Level Up NUI
|
||||
*/
|
||||
//:://////////////////////////////////////////////
|
||||
//:: Created By: Rakiov
|
||||
//:: Created On: 20.06.2005
|
||||
//:://////////////////////////////////////////////
|
||||
|
||||
#include "nw_inc_nui"
|
||||
#include "prc_nui_consts"
|
||||
#include "prc_inc_function"
|
||||
#include "prc_nui_lv_inc"
|
||||
|
||||
//
|
||||
// CreateCircleButtons
|
||||
// Creates the spell circle buttons for the given class Id
|
||||
//
|
||||
// Arguments:
|
||||
// nClass:int the ClassID
|
||||
//
|
||||
// Returns:
|
||||
// json the NUI spell circle buttons
|
||||
//
|
||||
json CreateCircleButtons(int nClass)
|
||||
{
|
||||
json jRow = JsonArray();
|
||||
// get the spell list for the class
|
||||
json spellList = GetSpellListObject(nClass);
|
||||
|
||||
// get the keys which are circles
|
||||
json circleList = JsonObjectKeys(spellList);
|
||||
int totalCircles = JsonGetLength(circleList);
|
||||
int selectedCircle = GetLocalInt(OBJECT_SELF, NUI_LEVEL_UP_SELECTED_CIRCLE_VAR);
|
||||
|
||||
int i;
|
||||
for (i = 0; i < 10; i++)
|
||||
{
|
||||
json jCircle;
|
||||
// some classes have less than 10 circles, build buttons for circles
|
||||
// we have, leave the rest blank
|
||||
if (i < totalCircles)
|
||||
{
|
||||
int spellLevel = StringToInt(JsonGetString(JsonArrayGet(circleList, i)));
|
||||
// in case this isn't set, and we start at a spot higher than 0.
|
||||
// OR we switched classes and the selected circle is higher than possible
|
||||
// we set the value
|
||||
if ((selectedCircle == -1)
|
||||
&& (GetRemainingSpellChoices(nClass, spellLevel) || (i+1 == totalCircles)))
|
||||
{
|
||||
SetLocalInt(OBJECT_SELF, NUI_LEVEL_UP_SELECTED_CIRCLE_VAR, spellLevel);
|
||||
selectedCircle = spellLevel;
|
||||
}
|
||||
|
||||
jCircle = NuiId(NuiButtonImage(JsonString(GetSpellLevelIcon(spellLevel))), NUI_LEVEL_UP_SPELL_CIRCLE_BUTTON_BASEID + IntToString(spellLevel));
|
||||
jCircle = NuiTooltip(jCircle, JsonString(GetSpellLevelToolTip(spellLevel)));
|
||||
|
||||
if (selectedCircle != spellLevel)
|
||||
jCircle = GreyOutButton(jCircle, 36.0f, 36.0f);
|
||||
}
|
||||
else
|
||||
jCircle = NuiText(JsonString(""), TRUE, NUI_SCROLLBARS_NONE);
|
||||
jCircle = NuiWidth(jCircle, 36.0f);
|
||||
jCircle = NuiHeight(jCircle, 36.0f);
|
||||
jCircle = NuiMargin(jCircle, 0.0f);
|
||||
jRow = JsonArrayInsert(jRow, jCircle);
|
||||
}
|
||||
|
||||
jRow = NuiRow(jRow);
|
||||
jRow = NuiMargin(jRow, 0.0f);
|
||||
return jRow;
|
||||
}
|
||||
|
||||
json CreateSpellButtons(int nClass, int selectedCircle)
|
||||
{
|
||||
json jRow = JsonArray();
|
||||
|
||||
json spellList = GetSpellListObject(nClass);
|
||||
json currentList = JsonObjectGet(spellList, IntToString(selectedCircle));
|
||||
int totalSpells = JsonGetLength(currentList);
|
||||
|
||||
int i;
|
||||
for (i = 0; i < totalSpells; i++)
|
||||
{
|
||||
int spellbookId = JsonGetInt(JsonArrayGet(currentList, i));
|
||||
if (ShouldAddSpellToSpellButtons(nClass, spellbookId))
|
||||
{
|
||||
string sFile = GetClassSpellbookFile(nClass);
|
||||
string sRealSpellID = Get2DACache(sFile, "RealSpellID", spellbookId);
|
||||
int nRealSpellID = StringToInt(sRealSpellID);
|
||||
int spellId = StringToInt(Get2DACache(sFile, "SpellID", spellbookId));
|
||||
int featId = StringToInt(Get2DACache(sFile, "FeatID", spellbookId));
|
||||
|
||||
string spellName = GetSpellName(spellId, nRealSpellID, featId, nClass);
|
||||
|
||||
int enabled = ShouldSpellButtonBeEnabled(nClass, selectedCircle, spellbookId);
|
||||
json jSpellButton;
|
||||
if (enabled)
|
||||
jSpellButton = NuiId(NuiButton(JsonString("")), NUI_LEVEL_UP_SPELL_BUTTON_BASEID + IntToString(spellbookId));
|
||||
else
|
||||
jSpellButton = NuiId(NuiButton(JsonString("")), NUI_LEVEL_UP_SPELL_DISABLED_BUTTON_BASEID + IntToString(spellbookId));
|
||||
|
||||
json jIcons = JsonArray();
|
||||
json jIconLeft = NuiDrawListImage(JsonBool(TRUE), GetSpellIcon(spellId, featId), NuiRect(5.0f,5.0f,32.0f,32.0f), JsonInt(NUI_ASPECT_FIT), JsonInt(NUI_HALIGN_CENTER), JsonInt(NUI_VALIGN_MIDDLE), NUI_DRAW_LIST_ITEM_ORDER_AFTER);
|
||||
json jIconRight = NuiDrawListImage(JsonBool(TRUE), JsonString("nui_shld_right"), NuiRect(299.0f,8.0f,26.0f,26.0f), JsonInt(NUI_ASPECT_FIT), JsonInt(NUI_HALIGN_CENTER), JsonInt(NUI_VALIGN_MIDDLE), NUI_DRAW_LIST_ITEM_ORDER_AFTER);
|
||||
json jText = NuiDrawListText(JsonBool(TRUE), NuiColor(255, 255, 255), NuiRect(40.0f, 12.0f, 290.0f, 32.0f), JsonString(spellName));
|
||||
jIcons = JsonArrayInsert(jIcons, jIconLeft);
|
||||
jIcons = JsonArrayInsert(jIcons, jIconRight);
|
||||
jIcons = JsonArrayInsert(jIcons, jText);
|
||||
if (!enabled)
|
||||
jIcons = JsonArrayInsert(jIcons, CreateGreyOutRectangle(335.0f, 42.0f));
|
||||
jSpellButton = NuiDrawList(jSpellButton, JsonBool(FALSE), jIcons);
|
||||
jSpellButton = NuiWidth(jSpellButton, 335.0f);
|
||||
jSpellButton = NuiHeight(jSpellButton, 42.0f);
|
||||
jSpellButton = NuiMargin(jSpellButton, 0.0f);
|
||||
|
||||
jRow = JsonArrayInsert(jRow, jSpellButton);
|
||||
}
|
||||
}
|
||||
jRow = NuiCol(jRow);
|
||||
jRow = NuiGroup(jRow, TRUE, NUI_SCROLLBARS_Y);
|
||||
jRow = NuiWidth(jRow, 360.0f);
|
||||
jRow = NuiHeight(jRow, 360.0f);
|
||||
jRow = NuiMargin(jRow, 0.0f);
|
||||
|
||||
return jRow;
|
||||
}
|
||||
|
||||
json CreateChosenButtons(int nClass, int selectedCircle)
|
||||
{
|
||||
json jRow = JsonArray();
|
||||
|
||||
json selectedList = GetChosenSpellListObject(nClass);
|
||||
json currentList = JsonObjectGet(selectedList, IntToString(selectedCircle));
|
||||
if (currentList != JsonNull())
|
||||
{
|
||||
int totalSpells = JsonGetLength(currentList);
|
||||
|
||||
int i;
|
||||
for (i = 0; i < totalSpells; i++)
|
||||
{
|
||||
int spellbookId = JsonGetInt(JsonArrayGet(currentList, i));
|
||||
|
||||
string sFile = GetClassSpellbookFile(nClass);
|
||||
string sRealSpellID = Get2DACache(sFile, "RealSpellID", spellbookId);
|
||||
int nRealSpellID = StringToInt(sRealSpellID);
|
||||
int spellId = StringToInt(Get2DACache(sFile, "SpellID", spellbookId));
|
||||
int featId = StringToInt(Get2DACache(sFile, "FeatID", spellbookId));
|
||||
|
||||
int enabled = EnableChosenButton(nClass, spellbookId, selectedCircle);
|
||||
|
||||
string spellName = GetSpellName(spellId, nRealSpellID, featId, nClass);
|
||||
|
||||
json jSpellButton;
|
||||
if (enabled)
|
||||
jSpellButton = NuiId(NuiButton(JsonString("")), NUI_LEVEL_UP_SPELL_CHOSEN_BUTTON_BASEID + IntToString(spellbookId));
|
||||
else
|
||||
jSpellButton = NuiId(NuiButton(JsonString("")), NUI_LEVEL_UP_SPELL_CHOSEN_DISABLED_BUTTON_BASEID + IntToString(spellbookId));
|
||||
|
||||
json jIcons = JsonArray();
|
||||
json jIconLeft = NuiDrawListImage(JsonBool(TRUE), GetSpellIcon(spellId, featId), NuiRect(5.0f,5.0f,32.0f,32.0f), JsonInt(NUI_ASPECT_FIT), JsonInt(NUI_HALIGN_CENTER), JsonInt(NUI_VALIGN_MIDDLE), NUI_DRAW_LIST_ITEM_ORDER_AFTER);
|
||||
json jIconRight = NuiDrawListImage(JsonBool(TRUE), JsonString("nui_shld_left"), NuiRect(299.0f,8.0f,26.0f,26.0f), JsonInt(NUI_ASPECT_FIT), JsonInt(NUI_HALIGN_CENTER), JsonInt(NUI_VALIGN_MIDDLE), NUI_DRAW_LIST_ITEM_ORDER_AFTER);
|
||||
json jText = NuiDrawListText(JsonBool(TRUE), NuiColor(255, 255, 255), NuiRect(40.0f, 12.0f, 290.0f, 32.0f), JsonString(spellName));
|
||||
jIcons = JsonArrayInsert(jIcons, jIconLeft);
|
||||
jIcons = JsonArrayInsert(jIcons, jIconRight);
|
||||
jIcons = JsonArrayInsert(jIcons, jText);
|
||||
if (!enabled)
|
||||
jIcons = JsonArrayInsert(jIcons, CreateGreyOutRectangle(335.0f, 42.0f));
|
||||
jSpellButton = NuiDrawList(jSpellButton, JsonBool(FALSE), jIcons);
|
||||
jSpellButton = NuiWidth(jSpellButton, 335.0f);
|
||||
jSpellButton = NuiHeight(jSpellButton, 42.0f);
|
||||
jSpellButton = NuiMargin(jSpellButton, 0.0f);
|
||||
|
||||
jRow = JsonArrayInsert(jRow, jSpellButton);
|
||||
}
|
||||
}
|
||||
|
||||
jRow = NuiCol(jRow);
|
||||
jRow = NuiGroup(jRow, TRUE, NUI_SCROLLBARS_Y);
|
||||
jRow = NuiWidth(jRow, 360.0f);
|
||||
jRow = NuiHeight(jRow, 360.0f);
|
||||
jRow = NuiMargin(jRow, 0.0f);
|
||||
|
||||
return jRow;
|
||||
}
|
||||
|
||||
string GetRemainingText(int nClass, int selectedCircle)
|
||||
{
|
||||
if (GetIsBladeMagicClass(nClass))
|
||||
{
|
||||
string remainingMan = IntToString(GetRemainingManeuverChoices(nClass));
|
||||
string remainingStance = IntToString(GetRemainingStanceChoices(nClass));
|
||||
|
||||
return remainingMan + " Remaining Maneuevers / " + remainingStance + " Remaining Stances";
|
||||
}
|
||||
|
||||
if (GetIsTruenamingClass(nClass))
|
||||
return IntToString(GetRemainingTruenameChoices(nClass, LEXICON_EVOLVING_MIND)) + " EM / "
|
||||
+ IntToString(GetRemainingTruenameChoices(nClass, LEXICON_CRAFTED_TOOL)) + " CT / "
|
||||
+ IntToString(GetRemainingTruenameChoices(nClass, LEXICON_PERFECTED_MAP)) + " PM";
|
||||
|
||||
int remainingSpellChoices = GetRemainingSpellChoices(nClass, selectedCircle, OBJECT_SELF);
|
||||
|
||||
if (GetIsInvocationClass(nClass))
|
||||
return IntToString(remainingSpellChoices) + " Remaining Invocations";
|
||||
if (GetIsShadowMagicClass(nClass))
|
||||
return IntToString(remainingSpellChoices) + " Remaining Mysteries";
|
||||
if (GetIsPsionicClass(nClass))
|
||||
return IntToString(remainingSpellChoices) + " Remaining Powers";
|
||||
return IntToString(remainingSpellChoices) + " Remaining Spells";
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
int nClass = GetLocalInt(OBJECT_SELF, NUI_LEVEL_UP_SELECTED_CLASS_VAR);
|
||||
if (!IsClassAllowedToUseLevelUpNUI(nClass))
|
||||
{
|
||||
string name = GetStringByStrRef(StringToInt(Get2DACache("classes", "Name", nClass)));
|
||||
SendMessageToPC(OBJECT_SELF, "The class " + name + " is not allowed to use the Level Up NUI!");
|
||||
DeleteLocalInt(OBJECT_SELF, NUI_LEVEL_UP_SELECTED_CLASS_VAR);
|
||||
return;
|
||||
}
|
||||
|
||||
// First we look for any previous windows, if found (ie, non-zero) we destory them so we can start fresh.
|
||||
if (IsLevelUpNUIOpen())
|
||||
{
|
||||
// this is already rendered
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
///////////////
|
||||
// LEFT SIDE //
|
||||
///////////////
|
||||
|
||||
json jRoot = JsonArray();
|
||||
json jLeftSide = JsonArray();
|
||||
json jRightSide = JsonArray();
|
||||
|
||||
// Title
|
||||
|
||||
json jRow = JsonArray();
|
||||
json jTitle = NuiText(JsonString("Available/Known"), TRUE, NUI_SCROLLBARS_NONE);
|
||||
jTitle = NuiHeight(jTitle, 26.0f);
|
||||
jTitle = NuiWidth(jTitle, 360.0f);
|
||||
jTitle = NuiMargin(jTitle, 0.0f);
|
||||
jRow = JsonArrayInsert(jRow, jTitle);
|
||||
jRow = NuiRow(jRow);
|
||||
jRow = NuiMargin(jRow, 0.0f);
|
||||
jLeftSide = JsonArrayInsert(jLeftSide, jRow);
|
||||
|
||||
// Circles
|
||||
|
||||
jRow = CreateCircleButtons(nClass);
|
||||
jLeftSide = JsonArrayInsert(jLeftSide, jRow);
|
||||
|
||||
int selectedCircle = GetLocalInt(OBJECT_SELF, NUI_LEVEL_UP_SELECTED_CIRCLE_VAR);
|
||||
|
||||
// Spells
|
||||
|
||||
jRow = CreateSpellButtons(nClass, selectedCircle);
|
||||
jLeftSide = JsonArrayInsert(jLeftSide, jRow);
|
||||
jLeftSide = NuiCol(jLeftSide);
|
||||
|
||||
////////////////
|
||||
// RIGHT SIDE //
|
||||
////////////////
|
||||
|
||||
// Title
|
||||
|
||||
jRow = JsonArray();
|
||||
|
||||
jTitle = NuiText(JsonString("Selected/Prepared"), TRUE, NUI_SCROLLBARS_NONE);
|
||||
jTitle = NuiHeight(jTitle, 26.0f);
|
||||
jTitle = NuiWidth(jTitle, 360.0f);
|
||||
jTitle = NuiMargin(jTitle, 0.0f);
|
||||
jRow = JsonArrayInsert(jRow, jTitle);
|
||||
jRow = NuiRow(jRow);
|
||||
jRow = NuiMargin(jRow, 0.0f);
|
||||
jRightSide = JsonArrayInsert(jRightSide, jRow);
|
||||
|
||||
// Remaining Choice
|
||||
|
||||
jRow = JsonArray();
|
||||
json jAmountLeft = NuiText(JsonString(GetRemainingText(nClass, selectedCircle)), TRUE, NUI_SCROLLBARS_NONE);
|
||||
jAmountLeft = NuiHeight(jAmountLeft, 36.0f);
|
||||
jAmountLeft = NuiWidth(jAmountLeft, 360.0f);
|
||||
jAmountLeft = NuiMargin(jAmountLeft, 0.0f);
|
||||
jRow = JsonArrayInsert(jRow, jAmountLeft);
|
||||
jRow = NuiRow(jRow);
|
||||
jRow = NuiMargin(jRow, 0.0f);
|
||||
jRightSide = JsonArrayInsert(jRightSide, jRow);
|
||||
|
||||
// Selected Choices
|
||||
|
||||
jRow = CreateChosenButtons(nClass, selectedCircle);
|
||||
jRightSide = JsonArrayInsert(jRightSide, jRow);
|
||||
jRightSide = NuiCol(jRightSide);
|
||||
|
||||
// Make each side
|
||||
|
||||
json tempRow = JsonArray();
|
||||
tempRow = JsonArrayInsert(tempRow, jLeftSide);
|
||||
tempRow = JsonArrayInsert(tempRow, jRightSide);
|
||||
tempRow = NuiRow(tempRow);
|
||||
|
||||
jRoot = JsonArrayInsert(jRoot, tempRow);
|
||||
|
||||
// Done button
|
||||
|
||||
jRow = JsonArray();
|
||||
json jResetButton = NuiId(NuiButton(JsonString("Reset")), NUI_LEVEL_UP_RESET_BUTTON);
|
||||
jResetButton = NuiWidth(jResetButton, 118.0f);
|
||||
jResetButton = NuiHeight(jResetButton, 50.0f);
|
||||
json jDoneButton = NuiId(NuiButton(JsonString("Done")), NUI_LEVEL_UP_DONE_BUTTON);
|
||||
jDoneButton = NuiWidth(jDoneButton, 118.0f);
|
||||
jDoneButton = NuiHeight(jDoneButton, 50.0f);
|
||||
if (!AllSpellsAreChosen(nClass, OBJECT_SELF))
|
||||
jDoneButton = NuiEnabled(jDoneButton, JsonBool(FALSE));
|
||||
jRow = JsonArrayInsert(jRow, NuiSpacer());
|
||||
jRow = JsonArrayInsert(jRow, jResetButton);
|
||||
jRow = JsonArrayInsert(jRow, jDoneButton);
|
||||
jRow = NuiRow(jRow);
|
||||
jRoot = JsonArrayInsert(jRoot, jRow);
|
||||
|
||||
jRoot = NuiCol(jRoot);
|
||||
|
||||
string className = GetStringByStrRef(StringToInt(Get2DACache("classes", "Name", nClass)));
|
||||
string title = className + " Level Up";
|
||||
|
||||
// This is the main window with jRoot as the main pane. It includes titles and parameters (more on those later)
|
||||
json nui = NuiWindow(jRoot, JsonString(title), NuiBind("geometry"), NuiBind("resizable"), JsonBool(FALSE), NuiBind("closable"), NuiBind("transparent"), NuiBind("border"));
|
||||
|
||||
// finally create it and it'll return us a non-zero token.
|
||||
int nToken = NuiCreate(OBJECT_SELF, nui, NUI_LEVEL_UP_WINDOW_ID);
|
||||
|
||||
// get the geometry of the window in case we opened this before and have a
|
||||
// preference for location
|
||||
json geometry = NuiRect(-1.0f,-1.0f, 748.0f, 535.0f);
|
||||
|
||||
// Set the binds to their default values
|
||||
NuiSetBind(OBJECT_SELF, nToken, "geometry", geometry);
|
||||
NuiSetBind(OBJECT_SELF, nToken, "resizable", JsonBool(FALSE));
|
||||
NuiSetBind(OBJECT_SELF, nToken, "closable", JsonBool(FALSE));
|
||||
NuiSetBind(OBJECT_SELF, nToken, "transparent", JsonBool(FALSE));
|
||||
NuiSetBind(OBJECT_SELF, nToken, "border", JsonBool(TRUE));
|
||||
}
|
||||
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
//::///////////////////////////////////////////////
|
||||
//:: PRC Spellbook NUI Events
|
||||
//:: prc_nui_sc_event
|
||||
//:: prc_nui_sb_event
|
||||
//:://////////////////////////////////////////////
|
||||
/*
|
||||
This is the event script for the PRC Spellbook NUI that handles button presses
|
||||
@@ -13,7 +13,6 @@
|
||||
|
||||
#include "prc_nui_consts"
|
||||
#include "prc_nui_sb_inc"
|
||||
#include "prc_nui_sbd_inc"
|
||||
|
||||
//
|
||||
// SetWindowGeometry
|
||||
@@ -75,18 +74,9 @@ void main()
|
||||
string sElement = NuiGetEventElement();
|
||||
string sWindowId = NuiGetWindowId(oPlayer, nToken);
|
||||
|
||||
// if this was the Spell Description NUI and the OK button was clicked
|
||||
// then we close the window.
|
||||
if (sWindowId == NUI_SPELL_DESCRIPTION_WINDOW_ID)
|
||||
{
|
||||
if (sElement == NUI_SPELL_DESCRIPTION_OK_BUTTON)
|
||||
NuiDestroy(oPlayer, nToken);
|
||||
return;
|
||||
}
|
||||
|
||||
// if the window is closed, save the geometry
|
||||
if (sEvent == "close")
|
||||
if (sEvent == "watch" && sElement == "geometry")
|
||||
{
|
||||
// Save the geometry
|
||||
SetWindowGeometry(oPlayer, nToken);
|
||||
return;
|
||||
}
|
||||
@@ -97,9 +87,6 @@ void main()
|
||||
return;
|
||||
}
|
||||
|
||||
// Save the geometry first
|
||||
SetWindowGeometry(oPlayer, nToken);
|
||||
|
||||
int spellId;
|
||||
int featId;
|
||||
int realSpellId;
|
||||
@@ -192,7 +179,8 @@ void main()
|
||||
// If right click, open the Spell Description NUI
|
||||
if (nButton == NUI_PAYLOAD_BUTTON_RIGHT_CLICK)
|
||||
{
|
||||
CreateSpellDescriptionNUI(oPlayer, featId, spellId, realSpellId);
|
||||
int classId = GetLocalInt(oPlayer, PRC_SPELLBOOK_SELECTED_CLASSID_VAR);
|
||||
CreateSpellDescriptionNUI(oPlayer, featId, spellId, realSpellId, classId);
|
||||
DeleteLocalInt(oPlayer, NUI_SPELLBOOK_SELECTED_SUBSPELL_SPELLID_VAR);
|
||||
return;
|
||||
}
|
||||
@@ -209,7 +197,7 @@ void main()
|
||||
if (sRange == "P")
|
||||
{
|
||||
SetLocalInt(oPlayer, NUI_SPELLBOOK_ON_TARGET_IS_PERSONAL_FEAT, 1);
|
||||
ExecuteScript("prc_nui_sc_trggr", oPlayer);
|
||||
ExecuteScript("prc_nui_sb_trggr", oPlayer);
|
||||
}
|
||||
// otherwise enter targetting mode
|
||||
else
|
||||
@@ -228,7 +216,7 @@ void main()
|
||||
|
||||
SetEnterTargetingModeData(oPlayer, iShape, fSizeX, fSizeY, nFlags, fRange);
|
||||
EnterTargetingMode(oPlayer, iTargetType);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -10,7 +10,6 @@
|
||||
//:: Created On: 24.05.2005
|
||||
//:://////////////////////////////////////////////
|
||||
|
||||
#include "nw_inc_nui"
|
||||
//#include "nw_inc_nui_insp"
|
||||
#include "prc_nui_sb_inc"
|
||||
#include "prc_nui_consts"
|
||||
@@ -80,60 +79,6 @@ json CreateMetaMagicFeatButtons(int nClass);
|
||||
//
|
||||
json CreateMetaFeatButtonRow(json spellList);
|
||||
|
||||
//
|
||||
// GetSpellLevelIcon
|
||||
// Takes the spell circle int and gets the icon appropriate for it (i.e. 0 turns
|
||||
// into "ir_cantrips"
|
||||
//
|
||||
// Arguments:
|
||||
// spellLevel:int the spell level we want the icon for
|
||||
//
|
||||
// Returns:
|
||||
// string the spell level icon
|
||||
//
|
||||
string GetSpellLevelIcon(int spellLevel);
|
||||
|
||||
//
|
||||
// GetSpellLevelToolTip
|
||||
// Gets the spell level tool tip text based on the int spell level provided (i.e.
|
||||
// 0 turns into "Cantrips")
|
||||
//
|
||||
// Arguments:
|
||||
// spellLevel:int the spell level we want the tooltip for
|
||||
//
|
||||
// Returns:
|
||||
// string the spell level toop tip
|
||||
//
|
||||
string GetSpellLevelToolTip(int spellLevel);
|
||||
|
||||
//
|
||||
// GetSpellIcon
|
||||
// Gets the spell icon based off the spellId by using the FeatID instead
|
||||
//
|
||||
// Arguments:
|
||||
// nClass:int the class Id
|
||||
// spellId:int the spell Id we want the icon for
|
||||
//
|
||||
// Returns:
|
||||
// json:String the string of the icon we want.
|
||||
//
|
||||
json GetSpellIcon(int spellId, int nClass=0);
|
||||
|
||||
//
|
||||
// HighlightButton
|
||||
// Takes NUI Button along with it's width and height and heighlights it with a drawn
|
||||
// colored rectangle to represent it's been selected.
|
||||
//
|
||||
// Arguments:
|
||||
// jButton:json the NUI Button
|
||||
// w:float the width of the button
|
||||
// h:float the height of the button
|
||||
//
|
||||
// Returns:
|
||||
// json the NUI button highlighted
|
||||
//
|
||||
json HighlightButton(json jButton, float w, float h);
|
||||
|
||||
void main()
|
||||
{
|
||||
// look for existing window and destroy
|
||||
@@ -200,7 +145,7 @@ void main()
|
||||
// Default to put this near the middle and let the person adjust its location
|
||||
if (geometry == JsonNull())
|
||||
{
|
||||
geometry = NuiRect(893.0f,346.0f, 489.0f, 351.0f);
|
||||
geometry = NuiRect(-1.0f,-1.0f, 489.0f, 351.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -216,6 +161,8 @@ void main()
|
||||
NuiSetBind(OBJECT_SELF, nToken, "closable", JsonBool(TRUE));
|
||||
NuiSetBind(OBJECT_SELF, nToken, "transparent", JsonBool(TRUE));
|
||||
NuiSetBind(OBJECT_SELF, nToken, "border", JsonBool(FALSE));
|
||||
|
||||
NuiSetBindWatch(OBJECT_SELF, nToken, "geometry", TRUE);
|
||||
}
|
||||
|
||||
json CreateSpellBookClassButtons()
|
||||
@@ -243,8 +190,8 @@ json CreateSpellBookClassButtons()
|
||||
float height = 32.0f;
|
||||
// Get the class icon from the classes.2da
|
||||
json jClassButton = NuiId(NuiButtonImage(JsonString(Get2DACache("classes", "Icon", classId))), PRC_SPELLBOOK_NUI_CLASS_BUTTON_BASEID + IntToString(classId));
|
||||
if (classId == selectedClassId)
|
||||
jClassButton = HighlightButton(jClassButton, width, height);
|
||||
if (classId != selectedClassId)
|
||||
jClassButton = GreyOutButton(jClassButton, width, height);
|
||||
jClassButton = NuiWidth(jClassButton, width);
|
||||
jClassButton = NuiHeight(jClassButton, height);
|
||||
// Get the class name from the classes.2da and set it to the tooltip
|
||||
@@ -272,8 +219,6 @@ json CreateSpellbookCircleButtons(int nClass)
|
||||
|
||||
if (minSpellLevel >= 0)
|
||||
{
|
||||
// get what is the highest circle the class can cast at
|
||||
int currentMaxSpellLevel = GetCurrentSpellLevel(nClass, casterLevel);
|
||||
|
||||
// Get what the max circle the class can reach at is
|
||||
int totalMaxSpellLevel = GetMaxSpellLevel(nClass);
|
||||
@@ -288,9 +233,9 @@ json CreateSpellbookCircleButtons(int nClass)
|
||||
|
||||
// conversily if it is higher than the max the class has (possibly due to
|
||||
// switching classes) then set it to that.
|
||||
if (currentCircle > currentMaxSpellLevel)
|
||||
if (currentCircle > totalMaxSpellLevel)
|
||||
{
|
||||
currentCircle = currentMaxSpellLevel;
|
||||
currentCircle = totalMaxSpellLevel;
|
||||
SetLocalInt(OBJECT_SELF, PRC_SPELLBOOK_SELECTED_CIRCLE_VAR, currentCircle);
|
||||
}
|
||||
|
||||
@@ -306,13 +251,10 @@ json CreateSpellbookCircleButtons(int nClass)
|
||||
|
||||
// if the current circle is selected or if the person can't cast at
|
||||
// that circle yet then disable the button.
|
||||
if (i > currentMaxSpellLevel)
|
||||
enabled = JsonBool(FALSE);
|
||||
else
|
||||
enabled = JsonBool(TRUE);
|
||||
jButton = NuiEnabled(jButton, enabled);
|
||||
if (i == currentCircle)
|
||||
jButton = HighlightButton(jButton, width, height);
|
||||
|
||||
if (i != currentCircle)
|
||||
jButton = GreyOutButton(jButton, width, height);
|
||||
|
||||
|
||||
jRow = JsonArrayInsert(jRow, jButton);
|
||||
}
|
||||
@@ -340,22 +282,27 @@ json CreateSpellbookSpellButtons(int nClass, int circle)
|
||||
for (i = 0; i < JsonGetLength(spellListAtCircle); i++)
|
||||
{
|
||||
int spellbookId = JsonGetInt(JsonArrayGet(spellListAtCircle, i));
|
||||
int featId;
|
||||
int spellId;
|
||||
// Binders don't have a spellbook, so spellbookId is actually SpellID
|
||||
if (nClass == CLASS_TYPE_BINDER)
|
||||
{
|
||||
spellId = spellbookId;
|
||||
featId = StringToInt(Get2DACache("spells", "FeatID", spellId));
|
||||
}
|
||||
else
|
||||
{
|
||||
spellId = StringToInt(Get2DACache(sFile, "SpellID", spellbookId));
|
||||
featId = StringToInt(Get2DACache(sFile, "FeatID", spellbookId));
|
||||
}
|
||||
|
||||
json jSpellButton = NuiId(NuiButtonImage(GetSpellIcon(spellId, nClass)), PRC_SPELLBOOK_NUI_SPELL_BUTTON_BASEID + IntToString(spellbookId));
|
||||
json jSpellButton = NuiId(NuiButtonImage(GetSpellIcon(spellId, featId, nClass)), PRC_SPELLBOOK_NUI_SPELL_BUTTON_BASEID + IntToString(spellbookId));
|
||||
jSpellButton = NuiWidth(jSpellButton, 38.0f);
|
||||
jSpellButton = NuiHeight(jSpellButton, 38.0f);
|
||||
|
||||
// the RealSpellID has the accurate descriptions for the spells/abilities
|
||||
int realSpellId = StringToInt(Get2DACache(sFile, "RealSpellID", spellbookId));
|
||||
if (!realSpellId)
|
||||
realSpellId = spellId;
|
||||
jSpellButton = NuiTooltip(jSpellButton, JsonString(GetStringByStrRef(StringToInt(Get2DACache("spells", "Name", realSpellId)))));
|
||||
jSpellButton = NuiTooltip(jSpellButton, JsonString(GetSpellName(spellId, realSpellId, featId, nClass)));
|
||||
|
||||
// if the row limit has been reached, make a new row
|
||||
tempRow = JsonArrayInsert(tempRow, jSpellButton);
|
||||
@@ -465,12 +412,23 @@ json CreateMetaFeatButtonRow(json spellList)
|
||||
else
|
||||
featId = StringToInt(Get2DACache("spells", "FeatID", spellId));
|
||||
|
||||
int selectedFeatId = featId;
|
||||
if (featId == FEAT_EXTEND_SPELL_ABILITY)
|
||||
selectedFeatId = FEAT_EXTEND_SPELL;
|
||||
if (featId == FEAT_EMPOWER_SPELL_ABILITY)
|
||||
selectedFeatId = FEAT_EMPOWER_SPELL;
|
||||
if (featId == FEAT_MAXIMIZE_SPELL_ABILITY)
|
||||
selectedFeatId = FEAT_MAXIMIZE_SPELL;
|
||||
if (featId == FEAT_QUICKEN_SPELL_ABILITY)
|
||||
selectedFeatId = FEAT_QUICKEN_SPELL;
|
||||
if (featId == FEAT_STILL_SPELL_ABILITY)
|
||||
selectedFeatId = FEAT_STILL_SPELL;
|
||||
|
||||
if (GetHasFeat(featId, OBJECT_SELF, TRUE))
|
||||
if (GetHasFeat(selectedFeatId, OBJECT_SELF, TRUE))
|
||||
{
|
||||
string featName = GetStringByStrRef(StringToInt(Get2DACache("spells", "Name", spellId)));
|
||||
|
||||
json jMetaButton = NuiId(NuiButtonImage(GetSpellIcon(spellId)), PRC_SPELLBOOK_NUI_META_BUTTON_BASEID + IntToString(spellId));
|
||||
json jMetaButton = NuiId(NuiButtonImage(GetSpellIcon(spellId, featId)), PRC_SPELLBOOK_NUI_META_BUTTON_BASEID + IntToString(spellId));
|
||||
jMetaButton = NuiWidth(jMetaButton, 32.0f);
|
||||
jMetaButton = NuiHeight(jMetaButton, 32.0f);
|
||||
jMetaButton = NuiTooltip(jMetaButton, JsonString(featName));
|
||||
@@ -482,91 +440,3 @@ json CreateMetaFeatButtonRow(json spellList)
|
||||
return jRow;
|
||||
}
|
||||
|
||||
json GetSpellIcon(int spellId,int nClass=0)
|
||||
{
|
||||
// Binder's spells don't have the FeatID on the spells.2da, so we have to use
|
||||
// the mapping we constructed to get it.
|
||||
if (nClass == CLASS_TYPE_BINDER)
|
||||
{
|
||||
json binderDict = GetBinderSpellToFeatDictionary();
|
||||
int featId = JsonGetInt(JsonObjectGet(binderDict, IntToString(spellId)));
|
||||
return JsonString(Get2DACache("feat", "Icon", featId));
|
||||
}
|
||||
|
||||
int masterSpellID = StringToInt(Get2DACache("spells", "Master", spellId));
|
||||
|
||||
// if this is a sub radial spell, then we use spell's icon instead
|
||||
if (masterSpellID)
|
||||
return JsonString(Get2DACache("spells", "IconResRef", spellId));
|
||||
|
||||
// the FeatID holds the accurate spell icon, not the SpellID
|
||||
int featId = StringToInt(Get2DACache("spells", "FeatID", spellId));
|
||||
|
||||
return JsonString(Get2DACache("feat", "Icon", featId));
|
||||
}
|
||||
|
||||
json HighlightButton(json jButton, float w, float h)
|
||||
{
|
||||
json retValue = jButton;
|
||||
|
||||
json jBorders = JsonArray();
|
||||
|
||||
// set the points of the button shape
|
||||
json jPoints = JsonArray();
|
||||
jPoints = JsonArrayInsert(jPoints, JsonFloat(0.0));
|
||||
jPoints = JsonArrayInsert(jPoints, JsonFloat(0.0));
|
||||
|
||||
jPoints = JsonArrayInsert(jPoints, JsonFloat(0.0));
|
||||
jPoints = JsonArrayInsert(jPoints, JsonFloat(h));
|
||||
|
||||
jPoints = JsonArrayInsert(jPoints, JsonFloat(w));
|
||||
jPoints = JsonArrayInsert(jPoints, JsonFloat(h));
|
||||
|
||||
jPoints = JsonArrayInsert(jPoints, JsonFloat(w));
|
||||
jPoints = JsonArrayInsert(jPoints, JsonFloat(0.0));
|
||||
|
||||
jPoints = JsonArrayInsert(jPoints, JsonFloat(0.0));
|
||||
jPoints = JsonArrayInsert(jPoints, JsonFloat(0.0));
|
||||
|
||||
jBorders = JsonArrayInsert(jBorders, NuiDrawListPolyLine(JsonBool(TRUE), NuiColor(71, 140, 32), JsonBool(FALSE), JsonFloat(2.0), jPoints));
|
||||
|
||||
return NuiDrawList(jButton, JsonBool(FALSE), jBorders);
|
||||
}
|
||||
|
||||
string GetSpellLevelIcon(int spellLevel)
|
||||
{
|
||||
switch (spellLevel)
|
||||
{
|
||||
case 0: return "ir_cantrips";
|
||||
case 1: return "ir_level1";
|
||||
case 2: return "ir_level2";
|
||||
case 3: return "ir_level3";
|
||||
case 4: return "ir_level4";
|
||||
case 5: return "ir_level5";
|
||||
case 6: return "ir_level6";
|
||||
case 7: return "ir_level789";
|
||||
case 8: return "ir_level789";
|
||||
case 9: return "ir_level789";
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
string GetSpellLevelToolTip(int spellLevel)
|
||||
{
|
||||
switch (spellLevel)
|
||||
{
|
||||
case 0: return "Cantrips";
|
||||
case 1: return "Level 1";
|
||||
case 2: return "Level 2";
|
||||
case 3: return "Level 3";
|
||||
case 4: return "Level 4";
|
||||
case 5: return "Level 5";
|
||||
case 6: return "Level 6";
|
||||
case 7: return "Level 7";
|
||||
case 8: return "Level 8";
|
||||
case 9: return "Level 9";
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
@@ -217,6 +217,11 @@ void main()
|
||||
// through the .2da's, the entering player already meets.
|
||||
ExecuteScript("prc_prereq", oPC);
|
||||
ExecuteScript("prc_psi_ppoints", oPC);
|
||||
if (GetHasFeat(FEAT_VOWOFPOVERTY, oPC) == TRUE)
|
||||
{
|
||||
ExecuteScript("prc_vop_feats_oe", oPC);
|
||||
}
|
||||
|
||||
ResetTouchOfVitality(oPC);
|
||||
DelayCommand(0.15, DeleteLocalInt(oPC,"ONENTER"));
|
||||
|
||||
|
@@ -3,9 +3,9 @@
|
||||
//:: prc_onplayerchat
|
||||
//:://////////////////////////////////////////////
|
||||
/*
|
||||
A OnChat script that parses what is said and
|
||||
uses any commands or NUI associated with
|
||||
commands.
|
||||
A OnChat script that parses what is said and
|
||||
uses any commands or NUI associated with
|
||||
commands.
|
||||
*/
|
||||
//:://////////////////////////////////////////////
|
||||
//:: Updated By: Rakiov
|
||||
@@ -28,6 +28,7 @@ OR:
|
||||
#include "prc_string_inc"
|
||||
#include "prc_nui_sb_inc"
|
||||
#include "prc_nui_consts"
|
||||
#include "prc_nui_lv_inc"
|
||||
|
||||
const string CHAT_COMMAND_INDICATOR_1 = "~~";
|
||||
const string CHAT_COMMAND_INDICATOR_2 = "..";
|
||||
@@ -135,19 +136,31 @@ void main()
|
||||
|
||||
// clear message from chat
|
||||
SetPCChatMessage();
|
||||
return;
|
||||
}
|
||||
// If the first word is /sb then we open the Spellbook NUI
|
||||
if(firstWord == "/sb")
|
||||
{
|
||||
ExecuteScript("prc_nui_sc_view", oPC);
|
||||
ExecuteScript("prc_nui_sb_view", oPC);
|
||||
|
||||
// clear message from chat
|
||||
SetPCChatMessage();
|
||||
return;
|
||||
}
|
||||
if (firstWord == "/lvl")
|
||||
{
|
||||
if (JsonGetLength(sCommandSplit) >= 2)
|
||||
{
|
||||
int classPos = StringToInt(JsonGetString(JsonArrayGet(sCommandSplit, 1)));
|
||||
int nClass = GetClassByPosition(classPos, oPC);
|
||||
OpenNUILevelUpWindow(nClass, oPC);
|
||||
SetPCChatMessage();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Execute scripts hooked to this event for the player triggering it
|
||||
ExecuteAllScriptsHookedToEvent(oPC, EVENT_ONPLAYERCHAT);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -4,8 +4,8 @@
|
||||
//:://////////////////////////////////////////////
|
||||
/*
|
||||
This handles any NUI events and sends them to
|
||||
appropriate NUI Event handler depending on the
|
||||
window Id
|
||||
appropriate NUI Event handler depending on the
|
||||
window Id
|
||||
*/
|
||||
//:://////////////////////////////////////////////
|
||||
//:: Created By: Rakiov
|
||||
@@ -22,16 +22,18 @@ void main()
|
||||
|
||||
// Open the Power Attack NUI
|
||||
if(sWindowId == NUI_PRC_POWER_ATTACK_WINDOW)
|
||||
{
|
||||
ExecuteScript("prc_nui_pa_event");
|
||||
}
|
||||
|
||||
// Open the Spellbook NUI
|
||||
if(sWindowId == PRC_SPELLBOOK_NUI_WINDOW_ID
|
||||
|| sWindowId == NUI_SPELL_DESCRIPTION_WINDOW_ID)
|
||||
{
|
||||
ExecuteScript("prc_nui_sc_event");
|
||||
}
|
||||
if(sWindowId == PRC_SPELLBOOK_NUI_WINDOW_ID)
|
||||
ExecuteScript("prc_nui_sb_event");
|
||||
|
||||
if (sWindowId == NUI_SPELL_DESCRIPTION_WINDOW_ID)
|
||||
ExecuteScript("prc_nui_dsc_evnt");
|
||||
|
||||
if (sWindowId == NUI_LEVEL_UP_WINDOW_ID)
|
||||
ExecuteScript("prc_nui_lv_event");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@@ -3,9 +3,9 @@
|
||||
//:: prc_onplaytarget
|
||||
//:://////////////////////////////////////////////
|
||||
/*
|
||||
This is the OnTarget event used set up spell
|
||||
attacks with the selected spell from the PRC
|
||||
Spellbook NUI
|
||||
This is the OnTarget event used set up spell
|
||||
attacks with the selected spell from the PRC
|
||||
Spellbook NUI
|
||||
*/
|
||||
//:://////////////////////////////////////////////
|
||||
//:: Updated By: Rakiov
|
||||
@@ -20,7 +20,7 @@ void DoJump(object oPC, location lTarget, int bDoKnockdown);
|
||||
// DoSpellbookAction
|
||||
// This is a OnTarget event action handling the use of the NUI Spellbook's spell.
|
||||
// All this should do is take the manual targeting information and send it to the
|
||||
// prc_nui_sc_trggr to handle the use of the spell.
|
||||
// prc_nui_sb_trggr to handle the use of the spell.
|
||||
//
|
||||
// Arguments:
|
||||
// oPC:object the player executing the action
|
||||
@@ -85,7 +85,7 @@ void DoSpellbookAction(object oPC, object oTarget, location lTarget)
|
||||
SetLocalLocation(oPC, "TARGETING_POSITION", lTarget);
|
||||
}
|
||||
|
||||
ExecuteScript("prc_nui_sc_trggr", oPC);
|
||||
ExecuteScript("prc_nui_sb_trggr", oPC);
|
||||
ClearEventVariables(oPC);
|
||||
}
|
||||
|
||||
|
@@ -1054,15 +1054,57 @@ void TomeOfBattle(object oPC = OBJECT_SELF)
|
||||
//Master of Nine
|
||||
SetLocalInt(oPC, "PRC_PrereqMoNine", 1);
|
||||
// Needs 6 maneuvers, so check the persistent locals
|
||||
int i, nCount, nSkills;
|
||||
int nCount = 0;
|
||||
int nTotal = 0;
|
||||
|
||||
int nDesert = _CheckPrereqsByDiscipline(oPC, DISCIPLINE_DESERT_WIND);
|
||||
if (nDesert > 0) nCount += 1;
|
||||
|
||||
int nDevoted = _CheckPrereqsByDiscipline(oPC, DISCIPLINE_DEVOTED_SPIRIT);
|
||||
if (nDevoted > 0) nCount += 1;
|
||||
|
||||
int nDiamond = _CheckPrereqsByDiscipline(oPC, DISCIPLINE_DIAMOND_MIND);
|
||||
if (nDiamond > 0) nCount += 1;
|
||||
|
||||
int nTiger = _CheckPrereqsByDiscipline(oPC, DISCIPLINE_TIGER_CLAW);
|
||||
if (nTiger > 0) nCount += 1;
|
||||
|
||||
int nShadow = _CheckPrereqsByDiscipline(oPC, DISCIPLINE_SHADOW_HAND);
|
||||
if (nShadow > 0) nCount += 1;
|
||||
|
||||
int nStone = _CheckPrereqsByDiscipline(oPC, DISCIPLINE_STONE_DRAGON);
|
||||
if (nStone > 0) nCount += 1;
|
||||
|
||||
int nSun = _CheckPrereqsByDiscipline(oPC, DISCIPLINE_SETTING_SUN);
|
||||
if (nSun > 0) nCount += 1;
|
||||
|
||||
int nRaven = _CheckPrereqsByDiscipline(oPC, DISCIPLINE_WHITE_RAVEN);
|
||||
if (nRaven > 0) nCount += 1;
|
||||
|
||||
nTotal = nDevoted + nDiamond + nTiger + nShadow + nStone + nSun + nRaven + nDesert;
|
||||
|
||||
if (DEBUG) DoDebug("You have "+IntToString(nDevoted)+" Devoted Spirit Maneuvers");
|
||||
if (DEBUG) DoDebug("You have "+IntToString(nDiamond)+" Diamond Mind Maneuvers");
|
||||
if (DEBUG) DoDebug("You have "+IntToString(nTiger)+" Tiger Claw Maneuvers");
|
||||
if (DEBUG) DoDebug("You have "+IntToString(nShadow)+" Shadow Hand Maneuvers");
|
||||
if (DEBUG) DoDebug("You have "+IntToString(nStone)+" Stone Dragon Maneuvers");
|
||||
if (DEBUG) DoDebug("You have "+IntToString(nSun)+" Setting Sun Maneuvers");
|
||||
if (DEBUG) DoDebug("You have "+IntToString(nRaven)+" White Raven Maneuvers");
|
||||
if (DEBUG) DoDebug("You have "+IntToString(nDesert)+" Desert Wind Maneuvers");
|
||||
|
||||
if (DEBUG) DoDebug("You have "+IntToString(nTotal)+" total Maneuvers from "+IntToString(nCount)+" Disciplines.");
|
||||
|
||||
// Needs 6 maneuvers, so check the persistent locals
|
||||
/* int i, nCount, nSkills;
|
||||
for(i = 1; i <= 256; i <<= 1)
|
||||
{
|
||||
// Loop over all disciplines, and total up how many he knows
|
||||
if(_CheckPrereqsByDiscipline(oPC, i))
|
||||
nCount++;
|
||||
}
|
||||
} */
|
||||
|
||||
// Base ranks only
|
||||
int nSkills = 0;
|
||||
// Base ranks only
|
||||
if(GetSkillRank(SKILL_TUMBLE, oPC, TRUE) >= 10) nSkills += 1;
|
||||
if(GetSkillRank(SKILL_INTIMIDATE, oPC, TRUE) >= 10) nSkills += 1;
|
||||
if(GetSkillRank(SKILL_CONCENTRATION, oPC, TRUE) >= 10) nSkills += 1;
|
||||
@@ -1071,6 +1113,8 @@ void TomeOfBattle(object oPC = OBJECT_SELF)
|
||||
if(GetSkillRank(SKILL_HIDE, oPC, TRUE) >= 10) nSkills += 1;
|
||||
if(GetSkillRank(SKILL_JUMP, oPC, TRUE) >= 10) nSkills += 1;
|
||||
if(GetSkillRank(SKILL_PERSUADE, oPC, TRUE) >= 10) nSkills += 1;
|
||||
|
||||
if (DEBUG) DoDebug("You have "+IntToString(nSkills)+" total Skills over 10 ranks.");
|
||||
|
||||
if(nCount >= 6 && nSkills >= 4)
|
||||
SetLocalInt(oPC, "PRC_PrereqMoNine", 0);
|
||||
|
85
nwn/nwnprc/trunk/scripts/prc_vop_feats_oe.nss
Normal file
85
nwn/nwnprc/trunk/scripts/prc_vop_feats_oe.nss
Normal file
@@ -0,0 +1,85 @@
|
||||
//:://////////////////////////////////////////////
|
||||
//:: Restore VoP Bonus Feats OnClientEnter
|
||||
//:: Uses prc_vop_feats.2da
|
||||
//:://////////////////////////////////////////////
|
||||
|
||||
#include "prc_inc_function"
|
||||
#include "inc_debug"
|
||||
|
||||
void main()
|
||||
{
|
||||
object oPC = OBJECT_SELF;
|
||||
if (!GetIsPC(oPC) || GetIsDM(oPC)) return;
|
||||
|
||||
int nRow = 0;
|
||||
int nFeat;
|
||||
string sFeatTag;
|
||||
|
||||
int nRows = Get2DARowCount("prc_vop_feats");
|
||||
if (DEBUG) DoDebug("[VoPRestore] Checking " + IntToString(nRows) + " exalted feats...");
|
||||
|
||||
while (nRow < nRows)
|
||||
{
|
||||
string sIndex = Get2DAString("prc_vop_feats", "FeatIndex", nRow);
|
||||
|
||||
if (sIndex != "****" && sIndex != "")
|
||||
{
|
||||
nFeat = StringToInt(sIndex);
|
||||
sFeatTag = "VoPFeatID" + IntToString(nFeat);
|
||||
|
||||
if (GetPersistantLocalInt(oPC, sFeatTag) == 1)
|
||||
{
|
||||
if (DEBUG) DoDebug("[VoPRestore] Restoring feat ID " + IntToString(nFeat));
|
||||
|
||||
effect eFeat = EffectBonusFeat(nFeat);
|
||||
eFeat = UnyieldingEffect(eFeat);
|
||||
eFeat = TagEffect(eFeat, "VoPFeat" + IntToString(nFeat));
|
||||
|
||||
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eFeat, oPC);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Only uncomment this line if you want to see *every* non-match
|
||||
// SendMessageToPC(oPC, "[VoPRestore] Not set: " + sFeatTag);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (DEBUG) DoDebug("[VoPRestore] Invalid FeatIndex at row " + IntToString(nRow));
|
||||
}
|
||||
|
||||
nRow++;
|
||||
}
|
||||
|
||||
if (DEBUG) DoDebug("[VoPRestore] Done.");
|
||||
}
|
||||
|
||||
|
||||
/* void main()
|
||||
{
|
||||
object oPC = GetEnteringObject();
|
||||
if (!GetIsPC(oPC) || GetIsDM(oPC)) return;
|
||||
|
||||
int nRow = 0;
|
||||
int nFeat;
|
||||
string sFeatTag;
|
||||
|
||||
int nRows = Get2DARowCount("prc_vop_feats");
|
||||
while (nRow < nRows)
|
||||
{
|
||||
// Read the feat index from the 2DA
|
||||
nFeat = StringToInt(Get2DACache("prc_vop_feats", "FeatIndex", nRow));
|
||||
sFeatTag = "VoPFeat" + IntToString(nFeat);
|
||||
|
||||
// If the PC has a persistent variable set for this feat, reapply the effect
|
||||
if (GetPersistantLocalInt(oPC, sFeatTag) == 1)
|
||||
{
|
||||
effect eFeat = EffectBonusFeat(nFeat);
|
||||
eFeat = UnyieldingEffect(eFeat);
|
||||
eFeat = TagEffect(eFeat, sFeatTag);
|
||||
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eFeat, oPC);
|
||||
}
|
||||
|
||||
nRow++;
|
||||
}
|
||||
} */
|
Reference in New Issue
Block a user