2025/06/03 Update
Updated NUI spellcast menu (@Rakiov) Updated Tornado Throw. Updated Midnight Augmentation. Updated Lucky Dice's tlk entries. Fixed Heartwarder's marker feat.
This commit is contained in:
@@ -179,10 +179,10 @@ void main()
|
||||
if (masterSpellId)
|
||||
{
|
||||
SetLocalInt(oPlayer, NUI_SPELLBOOK_SELECTED_SUBSPELL_SPELLID_VAR, spellId);
|
||||
spellId = masterSpellId;
|
||||
featId = StringToInt(Get2DACache("spells", "FeatID", masterSpellId));
|
||||
}
|
||||
|
||||
featId = StringToInt(Get2DACache("spells", "FeatID", spellId));
|
||||
else
|
||||
featId = StringToInt(Get2DACache("spells", "FeatID", spellId));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -193,11 +193,13 @@ void main()
|
||||
if (nButton == NUI_PAYLOAD_BUTTON_RIGHT_CLICK)
|
||||
{
|
||||
CreateSpellDescriptionNUI(oPlayer, featId, spellId, realSpellId);
|
||||
DeleteLocalInt(oPlayer, NUI_SPELLBOOK_SELECTED_SUBSPELL_SPELLID_VAR);
|
||||
return;
|
||||
}
|
||||
// If left click, operate normally
|
||||
if (nButton == NUI_PAYLOAD_BUTTON_LEFT_CLICK)
|
||||
{
|
||||
|
||||
// We use the spell's FeatID to do actions, and we set the OnTarget action
|
||||
// to PRC_NUI_SPELLBOOK so the handler knows what the action is being done
|
||||
SetLocalInt(oPlayer, NUI_SPELLBOOK_SELECTED_FEATID_VAR, featId);
|
||||
|
@@ -19,20 +19,21 @@ void main()
|
||||
// Get the selected PRC spell we are going to cast
|
||||
int featId = GetLocalInt(OBJECT_SELF, NUI_SPELLBOOK_SELECTED_FEATID_VAR);
|
||||
|
||||
// if the spell has a master feat this is it. This will return 0 if not set.
|
||||
int subSpellID = GetLocalInt(OBJECT_SELF, NUI_SPELLBOOK_SELECTED_SUBSPELL_SPELLID_VAR);
|
||||
|
||||
int isPersonalFeat = GetLocalInt(OBJECT_SELF, NUI_SPELLBOOK_ON_TARGET_IS_PERSONAL_FEAT);
|
||||
|
||||
// if this is a personal feat then this was called directly since we never entered
|
||||
// targetting and this should be applied immediatly to the executing player.
|
||||
if (isPersonalFeat)
|
||||
{
|
||||
ActionUseFeat(featId);
|
||||
ActionUseFeat(featId, OBJECT_SELF, subSpellID);
|
||||
// we want to remove this just in case of weird cases.
|
||||
DeleteLocalInt(OBJECT_SELF, NUI_SPELLBOOK_ON_TARGET_IS_PERSONAL_FEAT);
|
||||
}
|
||||
else
|
||||
{
|
||||
// if the spell has a master feat this is it. This will return 0 if not set.
|
||||
int subSpellID = GetLocalInt(OBJECT_SELF, NUI_SPELLBOOK_SELECTED_SUBSPELL_SPELLID_VAR);
|
||||
|
||||
// Get the target and location data we are casting at
|
||||
object oTarget = GetLocalObject(OBJECT_SELF, "TARGETING_OBJECT");
|
||||
@@ -47,4 +48,7 @@ void main()
|
||||
|
||||
ActionUseFeat(featId, oTarget, subSpellID, spellLocation);
|
||||
}
|
||||
}
|
||||
|
||||
DeleteLocalInt(OBJECT_SELF, NUI_SPELLBOOK_SELECTED_FEATID_VAR);
|
||||
DeleteLocalInt(OBJECT_SELF, NUI_SPELLBOOK_SELECTED_SUBSPELL_SPELLID_VAR);
|
||||
}
|
@@ -119,6 +119,21 @@ string GetSpellLevelToolTip(int spellLevel);
|
||||
//
|
||||
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
|
||||
@@ -187,6 +202,12 @@ void main()
|
||||
{
|
||||
geometry = NuiRect(893.0f,346.0f, 489.0f, 351.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
float x = JsonGetFloat(JsonObjectGet(geometry, "x"));
|
||||
float y = JsonGetFloat(JsonObjectGet(geometry, "y"));
|
||||
geometry = NuiRect(x, y, 489.0f, 351.0f);
|
||||
}
|
||||
|
||||
// Set the binds to their default values
|
||||
NuiSetBind(OBJECT_SELF, nToken, "geometry", geometry);
|
||||
@@ -218,11 +239,14 @@ json CreateSpellBookClassButtons()
|
||||
selectedClassId = classId;
|
||||
SetLocalInt(OBJECT_SELF, PRC_SPELLBOOK_SELECTED_CLASSID_VAR, selectedClassId);
|
||||
}
|
||||
|
||||
float width = 32.0f;
|
||||
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));
|
||||
jClassButton = NuiWidth(jClassButton, 32.0f);
|
||||
jClassButton = NuiHeight(jClassButton, 32.0f);
|
||||
if (classId == selectedClassId)
|
||||
jClassButton = HighlightButton(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
|
||||
jClassButton = NuiTooltip(jClassButton, JsonString(GetStringByStrRef(StringToInt(Get2DACache("classes", "Name", classId)))));
|
||||
|
||||
@@ -250,6 +274,7 @@ json CreateSpellbookCircleButtons(int nClass)
|
||||
{
|
||||
// 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);
|
||||
|
||||
@@ -273,21 +298,21 @@ json CreateSpellbookCircleButtons(int nClass)
|
||||
{
|
||||
json enabled;
|
||||
json jButton = NuiId(NuiButtonImage(JsonString(GetSpellLevelIcon(i))), PRC_SPELLBOOK_NUI_CIRCLE_BUTTON_BASEID + IntToString(i));
|
||||
jButton = NuiWidth(jButton, 42.0f);
|
||||
jButton = NuiHeight(jButton, 42.0f);
|
||||
float width = 42.0f;
|
||||
float height = 42.0f;
|
||||
jButton = NuiWidth(jButton, width);
|
||||
jButton = NuiHeight(jButton, height);
|
||||
jButton = NuiTooltip(jButton, JsonString(GetSpellLevelToolTip(i)));
|
||||
|
||||
// if the current circle is selected or if the person can't cast at
|
||||
// that circle yet then disable the button.
|
||||
if (currentCircle == i || i > currentMaxSpellLevel)
|
||||
{
|
||||
if (i > currentMaxSpellLevel)
|
||||
enabled = JsonBool(FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
enabled = JsonBool(TRUE);
|
||||
}
|
||||
jButton = NuiEnabled(jButton, enabled);
|
||||
if (i == currentCircle)
|
||||
jButton = HighlightButton(jButton, width, height);
|
||||
|
||||
jRow = JsonArrayInsert(jRow, jButton);
|
||||
}
|
||||
@@ -480,6 +505,34 @@ json GetSpellIcon(int spellId,int nClass=0)
|
||||
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)
|
||||
@@ -516,4 +569,4 @@ string GetSpellLevelToolTip(int spellLevel)
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user