2025/12/15 Update

Updated PEPS
Hooked up new PRC8 GUI event.
Updated nim tools.
Updated readme.
This commit is contained in:
Jaysyn904
2025-12-15 21:37:12 -05:00
parent d897e0c598
commit e0803385be
1191 changed files with 139110 additions and 35267 deletions

View File

@@ -37,6 +37,9 @@ void PopupWidgetBuffGUIPanel(object oPC);
void main()
{
object oPC = OBJECT_SELF;
// Set window to not save until it has been created.
SetLocalInt(oPC, AI_NO_NUI_SAVE, TRUE);
DelayCommand(0.5f, DeleteLocalInt(oPC, AI_NO_NUI_SAVE));
// Check to make sure the database is setup before we do anything.
CheckBuffDataAndInitialize(oPC, "menudata");
json jMenuData = GetBuffDatabaseJson(oPC, "spells", "menudata");
@@ -54,22 +57,30 @@ void main()
if(StartingUp(oPC)) return;
// Row 1 (Buttons) ********************************************************* 83
json jRow = CreateButtonSelect(JsonArray(), "Save", "btn_save", 60.0f, 30.0f, "btn_save_tooltip");
CreateButton(jRow, "Clear", "btn_clear", 60.0f, 30.0f, -1.0, "btn_clear_tooltip");
CreateButton(jRow, "Buff", "btn_buff", 60.0f, 30.0f, -1.0, "btn_buff_tooltip");
CreateButtonSelect(jRow, "List 1", "btn_list1", 60.0f, 30.0f);
CreateButtonSelect(jRow, "List 2", "btn_list2", 60.0f, 30.0f);
CreateButtonSelect(jRow, "List 3", "btn_list3", 60.0f, 30.0f);
CreateButtonSelect(jRow, "List 4", "btn_list4", 60.0f, 30.0f);
jRow = CreateButton(jRow, "Clear", "btn_clear", 60.0f, 30.0f, -1.0, "btn_clear_tooltip");
jRow = CreateButton(jRow, "Buff", "btn_buff", 60.0f, 30.0f, -1.0, "btn_buff_tooltip");
jRow = CreateButtonSelect(jRow, "List 1", "btn_list1", 60.0f, 30.0f);
jRow = CreateButtonSelect(jRow, "List 2", "btn_list2", 60.0f, 30.0f);
jRow = CreateButtonSelect(jRow, "List 3", "btn_list3", 60.0f, 30.0f);
jRow = CreateButtonSelect(jRow, "List 4", "btn_list4", 60.0f, 30.0f);
jRow = CreateTextEditBox(jRow, "", "txt_spell_delay", 3, FALSE, 40.0f, 30.0f, "txt_spell_delay_tooltip");
// Add the row to the column.
json jCol = JsonArrayInsert(JsonArray(), NuiRow(jRow));
// Row 2 (Buttons) ********************************************************* 121
jRow = JsonArrayInsert(JsonArray(), NuiSpacer());
jRow = CreateCheckBox(jRow, "Buff Widget", "buff_widget", 110.0, 30.0f, "buff_widget_tooltip");
jRow = CreateCheckBox(jRow, "Lock Widget", "lock_buff_widget", 110.0, 30.0f, "lock_buff_widget_tooltip");
if(!AI_SERVER)
if(!ai_GetIsServer())
{
jRow = CreateCheckBox(jRow, "Don't Check for Monsters", "chbx_no_monster_check", 200.0, 30.0f, "chbx_no_monster_check_tooltip");
}
else
{
if(ai_GetIsDungeonMaster(oPC))
{
jRow = CreateCheckBox(jRow, "Don't Check for Monsters", "chbx_no_monster_check", 200.0, 30.0f, "chbx_no_monster_check_tooltip");
}
}
jRow = JsonArrayInsert(jRow, NuiSpacer());
// Add the row to the column.
jCol = JsonArrayInsert(jCol, NuiRow(jRow));
@@ -96,7 +107,7 @@ void main()
jCol = JsonArrayInsert(jCol, NuiRow(jRow));
// Get the window location to restore it from the database.
float fWidth = IntToFloat(nIndex) * 39;
if(fWidth < 470.0) fWidth = 470.0;
if(fWidth < 530.0) fWidth = 530.0;
float fX = JsonGetFloat(JsonArrayGet(jMenuData, 1));
float fY = JsonGetFloat(JsonArrayGet(jMenuData, 2));
if(fX == 0.0f && fY == 0.0f)
@@ -108,6 +119,8 @@ void main()
json jLayout = NuiCol(jCol);
int nToken = SetWindow(oPC, jLayout, "plbuffwin", "Fast Buffing Spells",
fX, fY, fWidth, 164.0, FALSE, FALSE, TRUE, FALSE, TRUE, "pe_buffing");
// Set event watches for window inspector and save window location.
NuiSetBindWatch(oPC, nToken, "window_geometry", TRUE);
// Set the elements to show events.
int nSelected = GetEventScript(oPC, EVENT_SCRIPT_CREATURE_ON_SPELLCASTAT) == "pc_savebuffs";
NuiSetBind(oPC, nToken, "btn_save", JsonBool(nSelected));
@@ -131,11 +144,22 @@ void main()
if(sList == "list4") NuiSetBind (oPC, nToken, "btn_list4", JsonBool (TRUE));
else NuiSetBind (oPC, nToken, "btn_list4", JsonBool(FALSE));
NuiSetBind(oPC, nToken, "btn_list4_event", JsonBool(TRUE));
NuiSetBindWatch(oPC, nToken, "txt_spell_delay", TRUE);
string sText = " Allows you to adjust the speed that spells are cast in [0.1 seconds to 6.0 seconds]";
NuiSetBind(oPC, nToken, "txt_spell_delay_event", JsonBool(TRUE));
NuiSetBind(oPC, nToken, "txt_spell_delay_tooltip", JsonString(sText));
CheckBuffDataAndInitialize(oPC, "Delay");
sText = GetBuffDatabaseString(oPC, "spells", "Delay");
float fDelay = StringToFloat(sText);
if(fDelay < 0.1f) fDelay = 0.1f;
else if(fDelay > 6.0f) fDelay = 6.0f;
sText = FloatToString(fDelay, 0, 1);
NuiSetBind(oPC, nToken, "txt_spell_delay", JsonString(sText));
int nValue = JsonGetInt(JsonArrayGet(jMenuData, 3));
NuiSetBind(oPC, nToken, "buff_widget_event", JsonBool(TRUE));
NuiSetBind(oPC, nToken, "buff_widget_check", JsonBool(nValue));
NuiSetBindWatch(oPC, nToken, "buff_widget_check", TRUE);
string sText = " Creates a set of 4 buttons on the screen for quick buffing.";
sText = " Creates a set of 4 buttons on the screen for quick buffing.";
NuiSetBind(oPC, nToken, "buff_widget_tooltip", JsonString(sText));
nValue = JsonGetInt(JsonArrayGet(jMenuData, 4));
NuiSetBind(oPC, nToken, "lock_buff_widget_event", JsonBool(TRUE));
@@ -143,7 +167,7 @@ void main()
NuiSetBindWatch(oPC, nToken, "lock_buff_widget_check", TRUE);
sText = " Locks the buffing widget in place reducing its size.";
NuiSetBind(oPC, nToken, "lock_buff_widget_tooltip", JsonString(sText));
if(!AI_SERVER)
if(!ai_GetIsServer())
{
NuiSetBind(oPC, nToken, "chbx_no_monster_check_event", JsonBool(TRUE));
nValue = GetLocalInt(oPC, FB_NO_MONSTER_CHECK);
@@ -154,7 +178,7 @@ void main()
}
// Create buttons with spells listed.
int nSpell, nClass, nLevel, nMetamagic, nDomain;
string sName, sTargetName, sResRef;
string sName, sTargetName, sCasterName, sResRef;
nCntr = 0;
nIndex = 0;
while(nCntr <= BUFF_MAX_SPELLS)
@@ -167,11 +191,13 @@ void main()
nLevel = JsonGetInt(JsonArrayGet(jSpell, 2));
nMetamagic = JsonGetInt(JsonArrayGet(jSpell, 3));
nDomain = JsonGetInt(JsonArrayGet(jSpell, 4));
sTargetName = JsonGetString(JsonArrayGet(jSpell, 5));
sCasterName = JsonGetString(JsonArrayGet(jSpell, 5));
sTargetName = JsonGetString(JsonArrayGet(jSpell, 6));
sResRef = Get2DAString("spells", "IconResRef", nSpell);
sName = " " + GetStringByStrRef(StringToInt(Get2DAString("spells", "Name", nSpell)));
sName += " (" + GetStringByStrRef(StringToInt(Get2DAString("classes", "Short", nClass)));
sName += " / " + IntToString (nLevel);
sName = " " + sCasterName + " (";
sName += GetStringByStrRef(StringToInt(Get2DAString("classes", "Short", nClass)));
sName += " / " + IntToString (nLevel) + ") casting ";
sName += GetStringByStrRef(StringToInt(Get2DAString("spells", "Name", nSpell)));
if(nMetamagic > 0)
{
if(nMetamagic == METAMAGIC_EMPOWER) sName += " / Empowered";
@@ -182,7 +208,7 @@ void main()
else if(nMetamagic == METAMAGIC_STILL) sName += " / Still";
}
if(nDomain > 0) sName += " / Domain";
sName += ") " + sTargetName;
sName += " on " + sTargetName;
sIndex = IntToString(nIndex++);
NuiSetBind(oPC, nToken, "btn_spell_" + sIndex + "_event", JsonBool(TRUE));
NuiSetBind(oPC, nToken, "btn_spell_" + sIndex + "_image", JsonString(sResRef));
@@ -190,7 +216,6 @@ void main()
}
nCntr++;
}
NuiSetBindWatch(oPC, nToken, "window_geometry", TRUE);
}
int StartingUp(object oPC)
{
@@ -295,44 +320,55 @@ void PopupWidgetBuffGUIPanel(object oPC)
SetLocalInt(oPC, AI_NO_NUI_SAVE, TRUE);
DelayCommand(0.5f, DeleteLocalInt (oPC, AI_NO_NUI_SAVE));
// Row 1 (buttons)**********************************************************
json jRow = JsonArray();
CreateButtonImage(jRow, "ir_level1", "btn_one", 35.0f, 35.0f, 0.0);
CreateButtonImage(jRow, "ir_level2", "btn_two", 35.0f, 35.0f, 0.0);
CreateButtonImage(jRow, "ir_level3", "btn_three", 35.0f, 35.0f, 0.0);
CreateButtonImage(jRow, "ir_level4", "btn_four", 35.0f, 35.0f, 0.0);
json jRow = CreateButtonImage(JsonArray(), "ir_level1", "btn_one", 35.0f, 35.0f, 0.0);
jRow = CreateButtonImage(jRow, "ir_level2", "btn_two", 35.0f, 35.0f, 0.0);
jRow = CreateButtonImage(jRow, "ir_level3", "btn_three", 35.0f, 35.0f, 0.0);
jRow = CreateButtonImage(jRow, "ir_level4", "btn_four", 35.0f, 35.0f, 0.0);
// Add the row to the column.
json jCol = JsonArrayInsert(JsonArray(), NuiRow(jRow));
json jWidget = GetBuffDatabaseJson(oPC, "spells", "menudata");
int bAIBuffWidgetLock = JsonGetInt(JsonArrayGet(jWidget, 4));
json jMenuData = GetBuffDatabaseJson(oPC, "spells", "menudata");
int bAIBuffWidgetLock = JsonGetInt(JsonArrayGet(jMenuData, 4));
// Get the window location to restore it from the database.
float fX = JsonGetFloat(JsonArrayGet(jWidget, 5));
float fY = JsonGetFloat(JsonArrayGet(jWidget, 6));
float fX = JsonGetFloat(JsonArrayGet(jMenuData, 5));
float fY = JsonGetFloat(JsonArrayGet(jMenuData, 6));
if(fX == 0.0f && fY == 0.0f)
{
fX = 10.0f;
fY = 10.0f;
}
float fGUI_Scale = IntToFloat(GetPlayerDeviceProperty(oPC, PLAYER_DEVICE_PROPERTY_GUI_SCALE)) / 100.0;
if(bAIBuffWidgetLock)
{
fX = fX + 4.0f;
fY = fY + 45.0f;
fX += 4.0f;
// GUI scales are a mess, I just figured them out per scale to keep the widget from moving.
if(fGUI_Scale == 1.0) fY += 37.0;
else if(fGUI_Scale == 1.1) fY += 38.0;
else if(fGUI_Scale == 1.2) fY += 40.0;
else if(fGUI_Scale == 1.3) fY += 42.0;
else if(fGUI_Scale == 1.4) fY += 43.0;
else if(fGUI_Scale == 1.5) fY += 45.0;
else if(fGUI_Scale == 1.6) fY += 47.0;
else if(fGUI_Scale == 1.7) fY += 48.0;
else if(fGUI_Scale == 1.8) fY += 50.0;
else if(fGUI_Scale == 1.9) fY += 52.0;
else if(fGUI_Scale == 2.0) fY += 54.0;
}
// Set the layout of the window.
json jLayout = NuiCol (jCol);
json jLayout = NuiCol(jCol);
int nToken;
if(bAIBuffWidgetLock) nToken = SetWindow(oPC, jLayout, "widgetbuffwin", "Fast Buff Widget", fX, fY, 160.0, 62.0, FALSE, FALSE, FALSE, TRUE, FALSE, "pe_buffing");
else nToken = SetWindow(oPC, jLayout, "widgetbuffwin", "Fast Buff Widget", fX, fY, 160.0, 95.0, FALSE, FALSE, FALSE, TRUE, TRUE, "pe_buffing");
if(bAIBuffWidgetLock) nToken = SetWindow (oPC, jLayout, "widgetbuffwin", "Fast Buff Widget", fX, fY, 160.0, 62.0, FALSE, FALSE, FALSE, TRUE, FALSE, "pe_buffing");
else nToken = SetWindow (oPC, jLayout, "widgetbuffwin", "Fast Buff Widget", fX, fY, 160.0, 95.0, FALSE, FALSE, FALSE, TRUE, TRUE, "pe_buffing");
// Set event watches for window inspector and save window location.
//NuiSetBindWatch(oPC, nToken, "collapsed", TRUE);
NuiSetBindWatch(oPC, nToken, "window_geometry", TRUE);
NuiSetBindWatch (oPC, nToken, "collapsed", TRUE);
NuiSetBindWatch (oPC, nToken, "window_geometry", TRUE);
// Set the buttons to show events.
//NuiSetBind (oPC, nToken, "btn_one", JsonBool (TRUE));
NuiSetBind(oPC, nToken, "btn_one_event", JsonBool(TRUE));
NuiSetBind(oPC, nToken, "btn_two", JsonBool(TRUE));
NuiSetBind(oPC, nToken, "btn_two_event", JsonBool(TRUE));
NuiSetBind(oPC, nToken, "btn_three", JsonBool(TRUE));
NuiSetBind(oPC, nToken, "btn_three_event", JsonBool(TRUE));
NuiSetBind(oPC, nToken, "btn_four", JsonBool(TRUE));
NuiSetBind(oPC, nToken, "btn_four_event", JsonBool(TRUE));
NuiSetBind (oPC, nToken, "btn_one_event", JsonBool (TRUE));
NuiSetBind (oPC, nToken, "btn_two", JsonBool (TRUE));
NuiSetBind (oPC, nToken, "btn_two_event", JsonBool (TRUE));
NuiSetBind (oPC, nToken, "btn_three", JsonBool (TRUE));
NuiSetBind (oPC, nToken, "btn_three_event", JsonBool (TRUE));
NuiSetBind (oPC, nToken, "btn_four", JsonBool (TRUE));
NuiSetBind (oPC, nToken, "btn_four_event", JsonBool (TRUE));
}