diff --git a/_haks/poa_exp_abilities/nw_s1_barbrage.ncs b/_haks/poa_exp_abilities/nw_s1_barbrage.ncs index 6ca508a6..31a723de 100644 Binary files a/_haks/poa_exp_abilities/nw_s1_barbrage.ncs and b/_haks/poa_exp_abilities/nw_s1_barbrage.ncs differ diff --git a/_haks/poa_exp_abilities/psi_sk_manifmbld.ncs b/_haks/poa_exp_abilities/psi_sk_manifmbld.ncs index b9fee17f..2e383124 100644 Binary files a/_haks/poa_exp_abilities/psi_sk_manifmbld.ncs and b/_haks/poa_exp_abilities/psi_sk_manifmbld.ncs differ diff --git a/_haks/poa_top/classes.2da b/_haks/poa_top/classes.2da index 04c8539d..6e3bc1b7 100644 --- a/_haks/poa_top/classes.2da +++ b/_haks/poa_top/classes.2da @@ -40,8 +40,8 @@ 36 Dwarven_Defender 112223 76418 76419 76420 76422 IR_DWDEF 12 CLS_ATK_1 CLS_FEAT_DWDEF CLS_SAVTHR_CLER CLS_SKILL_DWDEF CLS_BFEAT_DWDEF 2 **** **** 1 0 16 8 15 14 10 12 STR 0X05 0X1 0 CLASS_TYPE_DWARVEN_DEFENDER 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 CLS_PRES_DWDEF 50 0 0 0 10 89 0 **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** 37 Dragon_Disciple 112224 16832127 16832128 16832129 16832130 IR_DRAGOND 6 CLS_ATK_2 CLS_FEAT_DRADIS CLS_SAVTHR_CLER CLS_SKILL_DRADIS CLS_BFEAT_DRADIS 2 **** **** 1 0 14 8 14 16 10 14 STR 0X00 0X0 0 CLASS_TYPE_DRAGON_DISCIPLE 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 CLS_PRES_DRADIS 50 0 0 0 10 111 0 cls_stat_dradis **** **** **** **** **** **** **** **** **** **** **** **** **** **** 38 Ooze 112225 84438 84438 84437 8154 IR_CLERIC 10 CLS_ATK_2 CLS_FEAT_CLER CLS_SAVTHR_CLER CLS_SKILL_CLER CLS_BFEAT_CLER 0 **** **** 0 0 14 8 14 16 10 14 STR 0X00 0X0 0 CLASS_TYPE_OOZE 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 **** 0 0 0 0 -1 75 0 **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** -39 Plant **** 16833077 16833078 16833079 16833080 IR_WIZARD 8 CLS_ATK_2 CLS_FEAT_CREA CLS_SAVTHR_FIGHT CLS_SKILL_CREA CLS_BFEAT_BARB 2 **** **** 1 0 10 15 11 15 14 18 STR 0X00 0X0 0 CLASS_TYPE_PLANT 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 CLS_PRES_PLANT 0 0 0 0 -1 75 0 **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** -40 **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** 0 **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** 0 **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** +39 Eye_of_Gruumsh 16852424 16824294 16824295 16824296 16824297 IR_GRUUMSH 12 CLS_ATK_1 CLS_FEAT_EOG CLS_SAVTHR_BARB CLS_SKILL_EOG CLS_BFEAT_EOG 2 **** **** 1 0 16 14 14 14 10 8 STR 0X0A 0X3 0 CLASS_TYPE_PRC_EYE_OF_GRUUMSH 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 CLS_PRES_EOG 50 0 0 0 10 17 0 cls_stat_eog **** **** **** **** **** **** **** **** **** **** **** **** **** **** +40 Shou_Disciple 16852408 16823346 16823347 16823348 16823349 IR_SHOUDISC 10 CLS_ATK_1 CLS_FEAT_SHOU CLS_SAVTHR_WILD CLS_SKILL_SHOU CLS_BFEAT_SHOU 2 **** **** 1 0 12 16 14 8 14 12 DEX 0X00 0X0 0 CLASS_TYPE_SHOU 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 CLS_PRES_SHOU 5 0 0 0 5 4 0 **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** 41 Purple_Dragon_Knight 112226 111710 111711 111712 111713 IR_PDK 10 CLS_ATK_1 CLS_FEAT_PDK CLS_SAVTHR_FIGHT CLS_SKILL_PDK CLS_BFEAT_PDK 2 **** **** 1 0 12 16 14 8 14 12 STR 0X14 0X3 0 CLASS_TYPE_PDK 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 CLS_PRES_PDK 5 0 0 0 5 131 0 **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** 42 UrPriest 16852286 16835606 16835607 16835608 16835609 IR_WARLOCK 8 CLS_ATK_2 CLS_FEAT_URPRST CLS_SAVTHR_WIZ CLS_SKILL_URPRST CLS_BFEAT_BLANK 2 CLS_SPGN_BLIGHT **** 1 1 15 9 14 13 10 15 WIS 0X09 0X2 0 CLASS_TYPE_UR_PRIEST 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 CLS_PRES_URPRST 50 0 0 0 10 10 0 **** 1 0 0 0 0 0 0 WIS Cleric 1 1 255 0 0 43 Binder 16852287 16835216 16835217 16835218 16835219 IR_HFWRLK 8 CLS_ATK_2 CLS_FEAT_BINDER CLS_SAVTHR_CLER CLS_SKILL_BINDER CLS_BFEAT_BINDER 2 **** **** 1 0 15 12 14 10 15 10 STR 0X00 0X0 0 CLASS_TYPE_BINDER 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 CLS_PRES_BINDER 0 1 0 0 -1 5 131 **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** @@ -54,7 +54,7 @@ 50 SacredPurifer 16852294 16834528 16834529 16834530 16834531 IR_MAA 8 CLS_ATK_2 CLS_FEAT_SACPUR CLS_SAVTHR_CLER CLS_SKILL_SACPUR CLS_BFEAT_SACPUR 2 **** **** 1 0 12 16 14 8 14 12 WIS 0X08 0X2 1 CLASS_TYPE_SACPUR 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 CLS_PRES_SACPUR 5 0 0 1 5 2 0 **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** 51 Ocular_Adept 16852295 16789504 16789505 16789506 16789507 IR_OCULAR 6 CLS_ATK_2 CLS_FEAT_OCU CLS_SAVTHR_CLER CLS_SKILL_OCULAR CLS_BFEAT_OCU 2 CLS_SPGN_OCU **** 1 1 14 8 14 16 10 14 WIS 0X09 0X2 0 CLASS_TYPE_OCULAR 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 CLS_PRES_OCULAR 50 0 0 0 10 2 0 **** 1 0 1 0 0 0 0 WIS Cleric 1 1 255 0 0 52 Battlerager 16852296 16789530 16789531 16789532 16789533 IR_BTLRAGE 12 CLS_ATK_1 CLS_FEAT_BRAGE CLS_SAVTHR_FIGHT CLS_SKILL_BRAGE CLS_BFEAT_BRAGE 2 **** **** 1 0 16 15 14 10 10 10 STR 0X02 0X1 0 CLASS_TYPE_BATTLERAGER 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 CLS_PRES_BRAGE 5 0 0 0 5 0 0 cls_stat_brage **** **** **** **** **** **** **** **** **** **** **** **** **** **** -53 Mystic_Thurge 16852297 16789584 16789585 16789586 16789587 IR_MYSTIC 4 CLS_ATK_3 CLS_FEAT_MYSTIC CLS_SAVTHR_WIZ CLS_SKILL_MYSTIC CLS_BFEAT_MYSTIC 2 **** **** 1 0 10 11 11 16 16 10 INT 0X00 0X0 0 CLASS_TYPE_MYSTIC_THEURGE 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 CLS_PRES_MYSTIC 50 0 1 1 10 10 0 **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** +53 Mystic_Theurge 16852297 16789584 16789585 16789586 16789587 IR_MYSTIC 4 CLS_ATK_3 CLS_FEAT_MYSTIC CLS_SAVTHR_WIZ CLS_SKILL_MYSTIC CLS_BFEAT_MYSTIC 2 **** **** 1 0 10 11 11 16 16 10 INT 0X00 0X0 0 CLASS_TYPE_MYSTIC_THEURGE 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 CLS_PRES_MYSTIC 40 0 1 1 10 10 0 **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** 54 Ninja_Spy 16852298 16789568 16789569 16789570 16789571 IR_ASASIN 8 CLS_ATK_2 CLS_FEAT_NINJA CLS_SAVTHR_MONK CLS_SKILL_NINJA CLS_BFEAT_ASASIN 6 **** **** 1 0 12 16 14 8 14 12 DEX 0X0C 0X3 0 CLASS_TYPE_NINJA_SPY 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 CLS_PRES_NINJA 50 0 0 0 10 8 0 **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** 55 Samurai 16852299 16789537 16789538 16789539 16789540 IR_SAMURAI 10 CLS_ATK_1 CLS_FEAT_SAMUR CLS_SAVTHR_CLER CLS_SKILL_SAMUR CLS_BFEAT_SAMUR 4 **** **** 1 0 16 13 16 10 10 9 STR 0X05 0X1 0 CLASS_TYPE_SAMURAI 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 CLS_PRES_SAMUR 0 1 0 0 -1 5 0 **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** 56 Warpriest 16852300 16789541 16789542 16789543 16789544 IR_CLERIC 8 CLS_ATK_1 CLS_FEAT_WARPR CLS_SAVTHR_CLER CLS_SKILL_WARPR CLS_BFEAT_CLER 2 **** **** 1 0 10 14 14 12 16 10 WIS 0X00 0X0 0 CLASS_TYPE_WARPRIEST 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 CLS_PRES_WARPR 50 0 0 2 10 2 0 **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** @@ -165,7 +165,7 @@ 161 Bow_Initiate 16852405 16826374 16826375 16826376 16826377 IR_OOTBI 8 CLS_ATK_1 CLS_FEAT_OOTBI CLS_SAVTHR_BARD CLS_SKILL_OOTBI CLS_BFEAT_OOTBI 2 **** **** 1 0 12 16 14 8 14 12 DEX 0X00 0X0 0 CLASS_TYPE_ORDER_BOW_INITIATE 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 CLS_PRES_OOTBI 50 0 0 0 10 10 0 **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** 162 Hellfire_Warlock 16852406 16789986 16789987 16789988 16789989 IR_HFWRLK 6 CLS_ATK_2 CLS_FEAT_HFWRLK CLS_SAVTHR_WIZ CLS_SKILL_HFWRLK CLS_BFEAT_HFWRLK 2 **** **** 1 0 12 14 14 10 12 15 CHA 0X00 0X0 0 CLASS_TYPE_HELLFIRE_WARLOCK 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 CLS_PRES_HFWRLK 3 0 0 0 3 0 0 **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** 163 Thrall_of_Orcus 16852407 16823320 16823321 16823322 16823323 IR_ORCUS 8 CLS_ATK_1 CLS_FEAT_ORCUS CLS_SAVTHR_CLER CLS_SKILL_ORCUS CLS_BFEAT_ORCUS 2 **** **** 1 0 12 16 14 8 14 12 INT 0X09 0X2 0 CLASS_TYPE_ORCUS 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 CLS_PRES_ORCUS 50 0 0 2 10 0 0 **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** -164 Shou_Disciple 16852408 16823346 16823347 16823348 16823349 IR_SHOUDISC 10 CLS_ATK_1 CLS_FEAT_SHOU CLS_SAVTHR_WILD CLS_SKILL_SHOU CLS_BFEAT_SHOU 2 **** **** 1 0 12 16 14 8 14 12 DEX 0X00 0X0 0 CLASS_TYPE_SHOU 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 CLS_PRES_SHOU 5 0 0 0 5 4 0 **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** +164 Plant 16852499 16833077 16833078 16833079 16833080 IR_WIZARD 8 CLS_ATK_2 CLS_FEAT_CREA CLS_SAVTHR_FIGHT CLS_SKILL_CREA CLS_BFEAT_BARB 2 **** **** 1 0 10 15 11 15 14 18 STR 0X00 0X0 0 CLASS_TYPE_PLANT 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 CLS_PRES_PLANT 0 0 0 0 -1 75 0 **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** 165 BlackFlame_Zealot 16852409 16823356 16823357 16823358 16823359 IR_BFZ 6 CLS_ATK_2 CLS_FEAT_BFZ CLS_SAVTHR_BARD CLS_SKILL_BFZ CLS_BFEAT_BFZ 4 **** **** 1 0 12 16 14 8 14 12 WIS 0X08 0X2 0 CLASS_TYPE_BFZ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 CLS_PRES_BFZ 50 0 0 2 10 8 0 **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** 166 ShiningBlade 16852410 16823444 16823445 16823446 16823447 IR_HEIRONEOUS 10 CLS_ATK_1 CLS_FEAT_SBHEIR CLS_SAVTHR_CLER CLS_SKILL_SBHEIR CLS_BFEAT_SBHEIR 2 **** **** 1 0 15 9 14 13 10 15 WIS 0X15 0X3 0 CLASS_TYPE_SHINING_BLADE 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 CLS_PRES_SBHEIR 50 0 0 2 10 6 0 **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** 167 KnightMiddleCircle 16852411 16822468 16822469 16822470 16822471 IR_KOTMC 10 CLS_ATK_1 CLS_FEAT_KOTMC CLS_SAVTHR_WIZ CLS_SKILL_KOTMC CLS_BFEAT_KOTMC 4 CLS_SPGN_KOTMC **** 1 1 15 9 14 13 10 15 WIS 0X11 0X2 0 CLASS_TYPE_KNIGHT_MIDDLECIRCLE 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 CLS_PRES_KOTMC 50 0 0 0 10 6 0 **** 1 0 0 0 0 0 0 WIS MiddleCircle 1 1 255 0 0 diff --git a/_module/are/theroadtotown.are.json b/_module/are/theroadtotown.are.json index 3667c22d..240bf81d 100644 --- a/_module/are/theroadtotown.are.json +++ b/_module/are/theroadtotown.are.json @@ -3601,7 +3601,7 @@ }, "Version": { "type": "dword", - "value": 70 + "value": 71 }, "Width": { "type": "int", diff --git a/_module/git/theroadtotown.git.json b/_module/git/theroadtotown.git.json index 4e12a88f..a719743d 100644 --- a/_module/git/theroadtotown.git.json +++ b/_module/git/theroadtotown.git.json @@ -909,7 +909,7 @@ }, "Orientation": { "type": "float", - "value": 1.748446578631047e-007 + "value": 1.748446294413952e-007 }, "X": { "type": "float", @@ -1971,7 +1971,7 @@ "__struct_id": 2, "Orientation": { "type": "float", - "value": -0.1963489353656769 + "value": -0.1963489055633545 }, "X": { "type": "float", @@ -2795,7 +2795,7 @@ "__struct_id": 2, "Orientation": { "type": "float", - "value": -0.4908723533153534 + "value": -0.4908722639083862 }, "X": { "type": "float", @@ -4071,7 +4071,7 @@ "__struct_id": 2, "Orientation": { "type": "float", - "value": 2.74888014793396 + "value": 2.748879671096802 }, "X": { "type": "float", @@ -10719,6 +10719,10 @@ "type": "resref", "value": "slumberdarts002" }, + "xModelPart1": { + "type": "word", + "value": 12 + }, "XOrientation": { "type": "float", "value": 0.0 diff --git a/_module/ifo/module.ifo.json b/_module/ifo/module.ifo.json index a888f5ac..b492946a 100644 --- a/_module/ifo/module.ifo.json +++ b/_module/ifo/module.ifo.json @@ -1166,7 +1166,7 @@ "Mod_Description": { "type": "cexolocstring", "value": { - "0": "This is the revised edition of the classic Paths of Ascension module, which is highly customized & more player friendly. This module has loads of customizing options right at your fingertips, color text, chat commands / emotes / appearances / 2 forges, if it can be created it's IN THERE!\n\nPRC'd By: Jaysyn\n\nSpell & Ability expansion by: rafhot\n\n(Requires PRC8 4.1.10+)" + "0": "This is the revised edition of the classic Paths of Ascension module, which is highly customized & more player friendly. This module has loads of customizing options right at your fingertips, color text, chat commands / emotes / appearances / 2 forges, if it can be created it's IN THERE!\n\nPRC'd By: Jaysyn\n\nSpell & Ability expansion by: rafhot\n\n(Requires PRC8 4.1.11+)" } }, "Mod_DuskHour": { @@ -1445,7 +1445,7 @@ }, "Mod_XPScale": { "type": "byte", - "value": 100 + "value": 0 }, "VarTable": { "type": "list", @@ -3084,6 +3084,36 @@ "type": "int", "value": 1 } + }, + { + "__struct_id": 0, + "Name": { + "type": "cexostring", + "value": "PRC_XP_USE_PNP_XP" + }, + "Type": { + "type": "dword", + "value": 1 + }, + "Value": { + "type": "int", + "value": 1 + } + }, + { + "__struct_id": 0, + "Name": { + "type": "cexostring", + "value": "PRC_XP_USE_ECL_NOT_CR" + }, + "Type": { + "type": "dword", + "value": 1 + }, + "Value": { + "type": "int", + "value": 1 + } } ] } diff --git a/_module/ncs/animaldeath.ncs b/_module/ncs/animaldeath.ncs index 82a4b577..7c5d7f96 100644 Binary files a/_module/ncs/animaldeath.ncs and b/_module/ncs/animaldeath.ncs differ diff --git a/_module/ncs/assadeath.ncs b/_module/ncs/assadeath.ncs index 1b172d02..04124a02 100644 Binary files a/_module/ncs/assadeath.ncs and b/_module/ncs/assadeath.ncs differ diff --git a/_module/ncs/banditdeath.ncs b/_module/ncs/banditdeath.ncs index 7c6b1074..2dcc2748 100644 Binary files a/_module/ncs/banditdeath.ncs and b/_module/ncs/banditdeath.ncs differ diff --git a/_module/ncs/brutedeath.ncs b/_module/ncs/brutedeath.ncs index 9d0f5323..68093032 100644 Binary files a/_module/ncs/brutedeath.ncs and b/_module/ncs/brutedeath.ncs differ diff --git a/_module/ncs/darkdeath.ncs b/_module/ncs/darkdeath.ncs index d0fe0cd6..626ad1b0 100644 Binary files a/_module/ncs/darkdeath.ncs and b/_module/ncs/darkdeath.ncs differ diff --git a/_module/ncs/dracodead.ncs b/_module/ncs/dracodead.ncs index 68320328..5f41364f 100644 Binary files a/_module/ncs/dracodead.ncs and b/_module/ncs/dracodead.ncs differ diff --git a/_module/ncs/dragondeath.ncs b/_module/ncs/dragondeath.ncs index 5b896582..e8849eb4 100644 Binary files a/_module/ncs/dragondeath.ncs and b/_module/ncs/dragondeath.ncs differ diff --git a/_module/ncs/drowbossdeath.ncs b/_module/ncs/drowbossdeath.ncs index c12eedaa..c5ef3ed8 100644 Binary files a/_module/ncs/drowbossdeath.ncs and b/_module/ncs/drowbossdeath.ncs differ diff --git a/_module/ncs/eq_immortalcrown.ncs b/_module/ncs/eq_immortalcrown.ncs index e1d18f6d..6e284d76 100644 Binary files a/_module/ncs/eq_immortalcrown.ncs and b/_module/ncs/eq_immortalcrown.ncs differ diff --git a/_module/ncs/firedeath.ncs b/_module/ncs/firedeath.ncs index 223abd10..18ecb407 100644 Binary files a/_module/ncs/firedeath.ncs and b/_module/ncs/firedeath.ncs differ diff --git a/_module/ncs/goblindeath.ncs b/_module/ncs/goblindeath.ncs index 0fb011f3..de800d91 100644 Binary files a/_module/ncs/goblindeath.ncs and b/_module/ncs/goblindeath.ncs differ diff --git a/_module/ncs/greaterdevildie.ncs b/_module/ncs/greaterdevildie.ncs index 34993ff7..56363ab3 100644 Binary files a/_module/ncs/greaterdevildie.ncs and b/_module/ncs/greaterdevildie.ncs differ diff --git a/_module/ncs/headmasterdeath.ncs b/_module/ncs/headmasterdeath.ncs index e64c148f..685737c2 100644 Binary files a/_module/ncs/headmasterdeath.ncs and b/_module/ncs/headmasterdeath.ncs differ diff --git a/_module/ncs/horrordeath.ncs b/_module/ncs/horrordeath.ncs index 8cd700a9..b5b12bda 100644 Binary files a/_module/ncs/horrordeath.ncs and b/_module/ncs/horrordeath.ncs differ diff --git a/_module/ncs/immortaldeath.ncs b/_module/ncs/immortaldeath.ncs index ab028bda..2ea79d94 100644 Binary files a/_module/ncs/immortaldeath.ncs and b/_module/ncs/immortaldeath.ncs differ diff --git a/_module/ncs/nwnx_util_t.ncs b/_module/ncs/nwnx_util_t.ncs deleted file mode 100644 index 14dc901d..00000000 Binary files a/_module/ncs/nwnx_util_t.ncs and /dev/null differ diff --git a/_module/ncs/ogredeath.ncs b/_module/ncs/ogredeath.ncs index 7afd1f7e..f8947387 100644 Binary files a/_module/ncs/ogredeath.ncs and b/_module/ncs/ogredeath.ncs differ diff --git a/_module/ncs/onunaquireitem.ncs b/_module/ncs/onunaquireitem.ncs index aa3346df..16a50d5c 100644 Binary files a/_module/ncs/onunaquireitem.ncs and b/_module/ncs/onunaquireitem.ncs differ diff --git a/_module/ncs/prc_pwondeath.ncs b/_module/ncs/prc_pwondeath.ncs index f466a8f9..85aa4617 100644 Binary files a/_module/ncs/prc_pwondeath.ncs and b/_module/ncs/prc_pwondeath.ncs differ diff --git a/_module/ncs/queendeath.ncs b/_module/ncs/queendeath.ncs index 5aa0d36d..89ecd54b 100644 Binary files a/_module/ncs/queendeath.ncs and b/_module/ncs/queendeath.ncs differ diff --git a/_module/ncs/queendeath2.ncs b/_module/ncs/queendeath2.ncs index fad21922..29811dac 100644 Binary files a/_module/ncs/queendeath2.ncs and b/_module/ncs/queendeath2.ncs differ diff --git a/_module/ncs/quicklingdeath.ncs b/_module/ncs/quicklingdeath.ncs index 5bc3452c..3d3525bf 100644 Binary files a/_module/ncs/quicklingdeath.ncs and b/_module/ncs/quicklingdeath.ncs differ diff --git a/_module/ncs/renderdeath.ncs b/_module/ncs/renderdeath.ncs index 2c9c7a4b..871d9e08 100644 Binary files a/_module/ncs/renderdeath.ncs and b/_module/ncs/renderdeath.ncs differ diff --git a/_module/ncs/rhazhiddeath.ncs b/_module/ncs/rhazhiddeath.ncs index faba995e..4d0f33cc 100644 Binary files a/_module/ncs/rhazhiddeath.ncs and b/_module/ncs/rhazhiddeath.ncs differ diff --git a/_module/ncs/skeletondeath.ncs b/_module/ncs/skeletondeath.ncs index 82f0c759..8d3fb96b 100644 Binary files a/_module/ncs/skeletondeath.ncs and b/_module/ncs/skeletondeath.ncs differ diff --git a/_module/ncs/trolldeath.ncs b/_module/ncs/trolldeath.ncs index 85025ace..b6b952e8 100644 Binary files a/_module/ncs/trolldeath.ncs and b/_module/ncs/trolldeath.ncs differ diff --git a/_module/ncs/x2_def_ondeath.ncs b/_module/ncs/x2_def_ondeath.ncs new file mode 100644 index 00000000..74e82518 Binary files /dev/null and b/_module/ncs/x2_def_ondeath.ncs differ diff --git a/_module/ncs/yauntdeath.ncs b/_module/ncs/yauntdeath.ncs index c9409e8d..af85331e 100644 Binary files a/_module/ncs/yauntdeath.ncs and b/_module/ncs/yauntdeath.ncs differ diff --git a/_module/ncs/zombiedeath.ncs b/_module/ncs/zombiedeath.ncs index fe54be00..724e799f 100644 Binary files a/_module/ncs/zombiedeath.ncs and b/_module/ncs/zombiedeath.ncs differ diff --git a/_module/nss/animaldeath.nss b/_module/nss/animaldeath.nss index 30128a7b..be7bc705 100644 --- a/_module/nss/animaldeath.nss +++ b/_module/nss/animaldeath.nss @@ -10,6 +10,8 @@ void main() { AdjustAlignment(oKiller, ALIGNMENT_EVIL, 5); } - ExecuteScript("sf_xp", OBJECT_SELF); + //ExecuteScript("sf_xp", OBJECT_SELF); + ExecuteScript("prc_npc_death", OBJECT_SELF); + ExecuteScript("prc_pwondeath", OBJECT_SELF); } diff --git a/_module/nss/assadeath.nss b/_module/nss/assadeath.nss index 58030cff..67672b1d 100644 --- a/_module/nss/assadeath.nss +++ b/_module/nss/assadeath.nss @@ -4,6 +4,8 @@ void main() SpeakString("NOOOO! I have failed my Queen, I deserve to die!!"); - ExecuteScript("sf_xp", OBJECT_SELF); + //ExecuteScript("sf_xp", OBJECT_SELF); + ExecuteScript("prc_npc_death", OBJECT_SELF); + ExecuteScript("prc_pwondeath", OBJECT_SELF); } diff --git a/_module/nss/banditdeath.nss b/_module/nss/banditdeath.nss index 6519f0b4..22b9c54e 100644 --- a/_module/nss/banditdeath.nss +++ b/_module/nss/banditdeath.nss @@ -7,6 +7,8 @@ void main() case 3: SpeakString("Avenge my death!"); break; case 4: SpeakString("Is that MY blood?!"); } - ExecuteScript("sf_xp", OBJECT_SELF); + //ExecuteScript("sf_xp", OBJECT_SELF); + ExecuteScript("prc_npc_death", OBJECT_SELF); + ExecuteScript("prc_pwondeath", OBJECT_SELF); } diff --git a/_module/nss/brutedeath.nss b/_module/nss/brutedeath.nss index d51c545e..02897e26 100644 --- a/_module/nss/brutedeath.nss +++ b/_module/nss/brutedeath.nss @@ -15,6 +15,8 @@ void main() { AdjustAlignment(oKiller, ALIGNMENT_EVIL, 5); } - ExecuteScript("sf_xp", OBJECT_SELF); + //ExecuteScript("sf_xp", OBJECT_SELF); + ExecuteScript("prc_npc_death", OBJECT_SELF); + ExecuteScript("prc_pwondeath", OBJECT_SELF); } diff --git a/_module/nss/darkdeath.nss b/_module/nss/darkdeath.nss index 13db8ef1..48fe8522 100644 --- a/_module/nss/darkdeath.nss +++ b/_module/nss/darkdeath.nss @@ -13,6 +13,8 @@ void main() SignalEvent(OBJECT_SELF, EventUserDefined(1007)); } - ExecuteScript("sf_xp", OBJECT_SELF); + //ExecuteScript("sf_xp", OBJECT_SELF); + ExecuteScript("prc_npc_death", OBJECT_SELF); + ExecuteScript("prc_pwondeath", OBJECT_SELF); } diff --git a/_module/nss/dracodead.nss b/_module/nss/dracodead.nss index bc68cccf..3d23f1eb 100644 --- a/_module/nss/dracodead.nss +++ b/_module/nss/dracodead.nss @@ -17,8 +17,6 @@ void main() { -ExecuteScript("sf_xp", OBJECT_SELF); - location lDeath = GetLocation(OBJECT_SELF); ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY,EffectVisualEffect( VFX_FNF_SUMMON_CELESTIAL ), lDeath, 3.0); @@ -46,4 +44,8 @@ ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY,EffectVisualEffect( VFX_FNF_SUMMON // SignalEvent(OBJECT_SELF, EventUserDefined(1007)); //} //craft_drop_items(oKiller); + + //ExecuteScript("sf_xp", OBJECT_SELF); + ExecuteScript("prc_npc_death", OBJECT_SELF); + ExecuteScript("prc_pwondeath", OBJECT_SELF); } diff --git a/_module/nss/dragondeath.nss b/_module/nss/dragondeath.nss index 939b5b6a..5c1087cb 100644 --- a/_module/nss/dragondeath.nss +++ b/_module/nss/dragondeath.nss @@ -2,6 +2,8 @@ void main() { - ExecuteScript("sf_xp", OBJECT_SELF); + //ExecuteScript("sf_xp", OBJECT_SELF); + ExecuteScript("prc_npc_death", OBJECT_SELF); + ExecuteScript("prc_pwondeath", OBJECT_SELF); } diff --git a/_module/nss/drowbossdeath.nss b/_module/nss/drowbossdeath.nss index abb24886..287b340d 100644 --- a/_module/nss/drowbossdeath.nss +++ b/_module/nss/drowbossdeath.nss @@ -2,8 +2,6 @@ void main() { -ExecuteScript("sf_xp", OBJECT_SELF); - switch (d20()) { case 1: SpeakString("You cannot stop the Queen!"); break; case 2: SpeakString("You will pay for this!"); break; @@ -27,6 +25,8 @@ ExecuteScript("sf_xp", OBJECT_SELF); case 20: SpeakString("Your power is awesome, but you are no match for the Matriarch!!!"); } - ExecuteScript("sf_xp", OBJECT_SELF); + //ExecuteScript("sf_xp", OBJECT_SELF); + ExecuteScript("prc_npc_death", OBJECT_SELF); + ExecuteScript("prc_pwondeath", OBJECT_SELF); } diff --git a/_module/nss/firedeath.nss b/_module/nss/firedeath.nss index bdaddc18..5f6c0f99 100644 --- a/_module/nss/firedeath.nss +++ b/_module/nss/firedeath.nss @@ -7,6 +7,8 @@ void main() case 3: SpeakString("You have defeated me!"); break; case 4: SpeakString("How can this be!"); } - ExecuteScript("sf_xp", OBJECT_SELF); + //ExecuteScript("sf_xp", OBJECT_SELF); + ExecuteScript("prc_npc_death", OBJECT_SELF); + ExecuteScript("prc_pwondeath", OBJECT_SELF); } diff --git a/_module/nss/goblindeath.nss b/_module/nss/goblindeath.nss index 596fb6c6..29da1164 100644 --- a/_module/nss/goblindeath.nss +++ b/_module/nss/goblindeath.nss @@ -7,6 +7,8 @@ void main() case 3: SpeakString("I can't see!"); break; case 4: SpeakString("You were too quick for me!"); } - ExecuteScript("sf_xp", OBJECT_SELF); + //ExecuteScript("sf_xp", OBJECT_SELF); + ExecuteScript("prc_npc_death", OBJECT_SELF); + ExecuteScript("prc_pwondeath", OBJECT_SELF); } diff --git a/_module/nss/greaterdevildie.nss b/_module/nss/greaterdevildie.nss index 2538dd67..9ab9edcc 100644 --- a/_module/nss/greaterdevildie.nss +++ b/_module/nss/greaterdevildie.nss @@ -1,7 +1,7 @@ #include "NW_I0_GENERIC" void main() { -ExecuteScript("sf_xp", OBJECT_SELF); +//ExecuteScript("sf_xp", OBJECT_SELF); object oKiller = GetLastKiller(); diff --git a/_module/nss/headmasterdeath.nss b/_module/nss/headmasterdeath.nss index 251bf9ff..1667d004 100644 --- a/_module/nss/headmasterdeath.nss +++ b/_module/nss/headmasterdeath.nss @@ -7,6 +7,8 @@ void main() case 3: SpeakString("I curse you!"); break; case 4: SpeakString("What happened?!"); } - ExecuteScript("sf_xp", OBJECT_SELF); + //ExecuteScript("sf_xp", OBJECT_SELF); + ExecuteScript("prc_npc_death", OBJECT_SELF); + ExecuteScript("prc_pwondeath", OBJECT_SELF); } diff --git a/_module/nss/horrordeath.nss b/_module/nss/horrordeath.nss index 39b3caf0..b0f5782e 100644 --- a/_module/nss/horrordeath.nss +++ b/_module/nss/horrordeath.nss @@ -27,6 +27,8 @@ ApplyEffectToObject(DURATION_TYPE_TEMPORARY,EffectBeam(VFX_BEAM_EVIL,OBJECT_SELF { SignalEvent(OBJECT_SELF, EventUserDefined(1007)); } - ExecuteScript("sf_xp", OBJECT_SELF); + //ExecuteScript("sf_xp", OBJECT_SELF); + ExecuteScript("prc_npc_death", OBJECT_SELF); + ExecuteScript("prc_pwondeath", OBJECT_SELF); } diff --git a/_module/nss/immortaldeath.nss b/_module/nss/immortaldeath.nss index 848d6011..606f3076 100644 --- a/_module/nss/immortaldeath.nss +++ b/_module/nss/immortaldeath.nss @@ -15,6 +15,10 @@ ApplyEffectToObject(DURATION_TYPE_TEMPORARY,EffectBeam(VFX_BEAM_EVIL,OBJECT_SELF GiveXPToCreature(oKiller, 3000); GiveGoldToCreature(oKiller, 200000); object oParty = GetNextFactionMember(oKiller); - ExecuteScript("sf_xp", OBJECT_SELF); + + //ExecuteScript("sf_xp", OBJECT_SELF); + ExecuteScript("prc_npc_death", OBJECT_SELF); + ExecuteScript("prc_pwondeath", OBJECT_SELF); + } diff --git a/_module/nss/inc_array.nss b/_module/nss/inc_array.nss new file mode 100644 index 00000000..7671723d --- /dev/null +++ b/_module/nss/inc_array.nss @@ -0,0 +1,512 @@ +/// @addtogroup data Data +/// @brief Provides a number of data structures for NWN code to use (simulated arrays) +/// @{ +/// @file nwnx_data.nss + +const int INVALID_INDEX = -1; +const int TYPE_FLOAT = 0; +const int TYPE_INTEGER = 1; +const int TYPE_OBJECT = 2; +const int TYPE_STRING = 3; + +/// @defgroup data_array_at Array At +/// @brief Returns the element at the index. +/// @ingroup data +/// @param obj The object. +/// @param tag The tag. +/// @param index The index. +/// @return The element of associated type. +/// @{ +string Array_At_Str(string tag, int index, object obj=OBJECT_INVALID); +float Array_At_Flt(string tag, int index, object obj=OBJECT_INVALID); +int Array_At_Int(string tag, int index, object obj=OBJECT_INVALID); +object Array_At_Obj(string tag, int index, object obj=OBJECT_INVALID); +/// @} + + +/// Clears the entire array, such that size==0. +void Array_Clear(string tag, object obj=OBJECT_INVALID); + +/// @defgroup data_array_contains Array Contains +/// @brief Checks if array contains the element. +/// @ingroup data +/// @param obj The object. +/// @param tag The tag. +/// @param element The element. +/// @return TRUE if the collection contains the element. +/// @{ +int Array_Contains_Flt(string tag, float element, object obj=OBJECT_INVALID); +int Array_Contains_Int(string tag, int element, object obj=OBJECT_INVALID); +int Array_Contains_Obj(string tag, object element, object obj=OBJECT_INVALID); +int Array_Contains_Str(string tag, string element, object obj=OBJECT_INVALID); +/// @} + +/// Copies the array of name otherTag over the array of name tag. +void Array_Copy(string tag, string otherTag, object obj=OBJECT_INVALID); + +/// Erases the element at index, and shuffles any elements from index size-1 to index + 1 left. +void Array_Erase(string tag, int index, object obj=OBJECT_INVALID); + +/// @defgroup data_array_find Array Find +/// @brief Get the index at which the element is located. +/// @ingroup data +/// @param obj The object. +/// @param tag The tag. +/// @param element The element. +/// @return Returns the index at which the element is located, or ARRAY_INVALID_INDEX. +/// @{ +int Array_Find_Flt(string tag, float element, object obj=OBJECT_INVALID); +int Array_Find_Int(string tag, int element, object obj=OBJECT_INVALID); +int Array_Find_Obj(string tag, object element, object obj=OBJECT_INVALID); +int Array_Find_Str(string tag, string element, object obj=OBJECT_INVALID); +/// @} + +/// @defgroup data_array_insert Array Insert +/// @brief Inserts the element at the index, where size > index >= 0. +/// @ingroup data +/// @param obj The object. +/// @param tag The tag. +/// @param index The index. +/// @param element The element. +/// @{ +void Array_Insert_Flt(string tag, int index, float element, object obj=OBJECT_INVALID); +void Array_Insert_Int(string tag, int index, int element, object obj=OBJECT_INVALID); +void Array_Insert_Obj(string tag, int index, object element, object obj=OBJECT_INVALID); +void Array_Insert_Str(string tag, int index, string element, object obj=OBJECT_INVALID); +/// @} + +/// @defgroup data_array_pushback Array Pushback +/// @brief Pushes an element to the back of the collection. +/// @remark Functionally identical to an insert at index size-1. +/// @ingroup data +/// @param obj The object. +/// @param tag The tag. +/// @param element The element. +/// @{ +void Array_PushBack_Flt(string tag, float element, object obj=OBJECT_INVALID); +void Array_PushBack_Int(string tag, int element, object obj=OBJECT_INVALID); +void Array_PushBack_Obj(string tag, object element, object obj=OBJECT_INVALID); +void Array_PushBack_Str(string tag, string element, object obj=OBJECT_INVALID); +/// @} + +/// Resizes the array. If the array is shrinking, it chops off elements at the ned. +void Array_Resize(string tag, int size, object obj=OBJECT_INVALID); + +/// Reorders the array such each possible permutation of elements has equal probability of appearance. +void Array_Shuffle(string tag, object obj=OBJECT_INVALID); + +/// Returns the size of the array. +int Array_Size(string tag, object obj=OBJECT_INVALID); + +/// Sorts the collection based on descending order. +void Array_SortAscending(string tag, int type=TYPE_STRING, object obj=OBJECT_INVALID); + +/// Sorts the collection based on descending order. +void Array_SortDescending(string tag, int type=TYPE_STRING, object obj=OBJECT_INVALID); + +/// @defgroup data_array_set Array Set +/// @brief Sets the element at the index, where size > index >= 0. +/// @ingroup data +/// @param obj The object. +/// @param tag The tag. +/// @param index The index. +/// @param element The element. +/// @{ +void Array_Set_Flt(string tag, int index, float element, object obj=OBJECT_INVALID); +void Array_Set_Int(string tag, int index, int element, object obj=OBJECT_INVALID); +void Array_Set_Obj(string tag, int index, object element, object obj=OBJECT_INVALID); +void Array_Set_Str(string tag, int index, string element, object obj=OBJECT_INVALID); +/// @} + +/// @} + +// +// Local Utility Functions. +// +string GetTableName(string tag, object obj=OBJECT_INVALID, int bare=FALSE) { + if (obj == OBJECT_INVALID) + obj = GetModule(); + + string sName = "array_" + ObjectToString(obj) + "_" + tag; + // Remove invalid characters from the tag rather than failing. + string sCleansed = RegExpReplace("[^A-Za-z0-9_\$@#]", sName, ""); + // But provide some feedback. + if (GetStringLength(sName) != GetStringLength(sCleansed) || GetStringLength(sCleansed) == 0) { + WriteTimestampedLogEntry("WARNING: Invalid table name detected for array with tag <" + tag + ">. Only characters (a-zA-Z0-9), _, @, $ and # are allowed. Using <"+sCleansed+"> instead."); + + } + + // BARE returns just the table name with no wrapping. + if (bare == TRUE) { + return sCleansed; + } + + // Table name wraped in quotes to avoid token expansion. + return "\""+sCleansed+"\""; +} + +string GetTableCreateString(string tag, object obj=OBJECT_INVALID) { + // for simplicity sake, everything is turned into a string. Possible enhancement + // to create specific tables for int/float/whatever. + return "CREATE TABLE IF NOT EXISTS " + GetTableName(tag, obj) + " ( ind INTEGER, value TEXT )"; +} + +int TableExists(string tag, object obj=OBJECT_INVALID) { + string stmt = "SELECT name FROM sqlite_master WHERE type = 'table' AND name = @tablename;"; + sqlquery sqlQuery = SqlPrepareQueryObject(GetModule(), stmt); + SqlBindString(sqlQuery, "@tablename", GetTableName(tag, obj, TRUE)); + return SqlStep(sqlQuery); +} + +void ExecuteStatement(string statement, object obj=OBJECT_INVALID) { + if (obj == OBJECT_INVALID) + obj = GetModule(); + // There's no direct "execute this.." everything has to be prepared then executed. + //WriteTimestampedLogEntry("SQL: " + statement); + sqlquery sqlQuery = SqlPrepareQueryObject(GetModule(), statement); + SqlStep(sqlQuery); +} + +void CreateArrayTable(string tag, object obj=OBJECT_INVALID) { + string createStatement = GetTableCreateString(tag, obj); + ExecuteStatement(createStatement, obj); +} + +// Get the table row count. Returns -1 on error (0 is a valid number of rows in a table) +int GetRowCount(string tag, object obj=OBJECT_INVALID) { + if (obj == OBJECT_INVALID) + obj = GetModule(); + CreateArrayTable(tag, obj); + string stmt = "SELECT COUNT(1) FROM " + GetTableName(tag, obj); + sqlquery sqlQuery = SqlPrepareQueryObject(GetModule(), stmt); + if ( SqlStep(sqlQuery) ) { + return SqlGetInt(sqlQuery, 0); + } + return -1; +} + + +//////////////////////////////////////////////////////////////////////////////// +// return the value contained in location "index" +string Array_At_Str(string tag, int index, object obj=OBJECT_INVALID) +{ + // Just "create if not exists" to ensure it exists for the insert. + CreateArrayTable(tag, obj); + + string stmt = "SELECT value FROM " + GetTableName(tag, obj) + " WHERE ind = @ind"; + sqlquery sqlQuery = SqlPrepareQueryObject(GetModule(), stmt); + SqlBindInt(sqlQuery, "@ind", index); + if ( SqlStep(sqlQuery) ) { + return SqlGetString(sqlQuery, 0); + } + return ""; +} + +float Array_At_Flt(string tag, int index, object obj=OBJECT_INVALID) +{ + string st = Array_At_Str(tag, index, obj); + if (st == "") { + return 0.0; + } + return StringToFloat(st); +} + +int Array_At_Int(string tag, int index, object obj=OBJECT_INVALID) +{ + string st = Array_At_Str(tag, index, obj); + if (st == "") { + return 0; + } + return StringToInt(st); +} + +object Array_At_Obj(string tag, int index, object obj=OBJECT_INVALID) +{ + string st = Array_At_Str(tag, index, obj); + if (st == "") { + return OBJECT_INVALID; + } + return StringToObject(st); +} + +void Array_Clear(string tag, object obj=OBJECT_INVALID) +{ + ExecuteStatement("delete from "+GetTableName(tag, obj), obj); +} + +//////////////////////////////////////////////////////////////////////////////// +// Return true/value (1/0) if the array contains the value "element" +int Array_Contains_Str(string tag, string element, object obj=OBJECT_INVALID) +{ + CreateArrayTable(tag, obj); + string stmt = "SELECT COUNT(1) FROM "+GetTableName(tag, obj)+" WHERE value = @element"; + + sqlquery sqlQuery = SqlPrepareQueryObject(GetModule(), stmt); + SqlBindString(sqlQuery, "@element", element); + + int pos = -1; + if ( SqlStep(sqlQuery) ) { + pos = SqlGetInt(sqlQuery, 0); + if (pos > 0) { + return TRUE; + } + } + return FALSE; +} + +int Array_Contains_Flt(string tag, float element, object obj=OBJECT_INVALID) +{ + return Array_Contains_Str(tag, FloatToString(element), obj); +} + +int Array_Contains_Int(string tag, int element, object obj=OBJECT_INVALID) +{ + return Array_Contains_Str(tag, IntToString(element), obj); +} + +int Array_Contains_Obj(string tag, object element, object obj=OBJECT_INVALID) +{ + return Array_Contains_Str(tag, ObjectToString(element), obj); +} + + +//////////////////////////////////////////////////////////////////////////////// +void Array_Copy(string tag, string otherTag, object obj=OBJECT_INVALID) +{ + CreateArrayTable(otherTag, obj); + ExecuteStatement("INSERT INTO "+GetTableName(otherTag, obj)+" SELECT * FROM "+GetTableName(tag, obj), obj); +} + +//////////////////////////////////////////////////////////////////////////////// +void Array_Erase(string tag, int index, object obj=OBJECT_INVALID) +{ + int rows = GetRowCount(tag, obj); + // Silently fail if "index" is outside the range of valid indicies. + if (index >= 0 && index < rows) { + string stmt = "DELETE FROM "+GetTableName(tag, obj)+" WHERE ind = @ind"; + sqlquery sqlQuery = SqlPrepareQueryObject(GetModule(), stmt); + SqlBindInt(sqlQuery, "@ind", index); + SqlStep(sqlQuery); + + stmt = "UPDATE "+GetTableName(tag, obj)+" SET ind = ind - 1 WHERE ind > @ind"; + sqlQuery = SqlPrepareQueryObject(GetModule(), stmt); + SqlBindInt(sqlQuery, "@ind", index); + SqlStep(sqlQuery); + } +} + +//////////////////////////////////////////////////////////////////////////////// +// return the index in the array containing "element" +// if not found, return INVALID_INDEX +int Array_Find_Str(string tag, string element, object obj=OBJECT_INVALID) +{ + string stmt; + sqlquery sqlQuery; + + // Just create it before trying to select in case it doesn't exist yet. + CreateArrayTable(tag, obj); + + stmt = "SELECT IFNULL(MIN(ind),@invalid_index) FROM "+GetTableName(tag, obj)+" WHERE value = @element"; + sqlQuery = SqlPrepareQueryObject(GetModule(), stmt); + + SqlBindInt(sqlQuery, "@invalid_index", INVALID_INDEX); + SqlBindString(sqlQuery, "@element", element); + if ( SqlStep(sqlQuery) ) { + return SqlGetInt(sqlQuery, 0); + } + return INVALID_INDEX; +} + +int Array_Find_Flt(string tag, float element, object obj=OBJECT_INVALID) +{ + return Array_Find_Str(tag, FloatToString(element), obj); +} + +int Array_Find_Int(string tag, int element, object obj=OBJECT_INVALID) +{ + return Array_Find_Str(tag, IntToString(element), obj); +} + +int Array_Find_Obj(string tag, object element, object obj=OBJECT_INVALID) +{ + return Array_Find_Str(tag, ObjectToString(element), obj); +} + +//////////////////////////////////////////////////////////////////////////////// +// Insert a new element into position 'index'. If index is beyond the number of rows in the array, +// this will quietly fail. This could be changed if you wanted to support sparse +// arrays. +void Array_Insert_Str(string tag, int index, string element, object obj=OBJECT_INVALID) +{ + int rows = GetRowCount(tag, obj); + // Index numbers are off by one, much like C arrays, so for "rows=10" - values are 0-9. + // It's not unreasonable to fail if you try to insert ind=10 into an array who's indexes + // only go to 9, but I guess it doesn't hurt as long as we're not allowing gaps in + // index numbers. + if (index >= 0 && index <= rows) { + // index is passed as an integer, so immune (as far as I know) to SQL injection for a one shot query. + ExecuteStatement("UPDATE "+GetTableName(tag, obj)+" SET ind = ind + 1 WHERE ind >= "+IntToString(index), obj); + // Element, however, is not. + string stmt = "INSERT INTO "+GetTableName(tag, obj)+" VALUES ( @ind, @element )"; + sqlquery sqlQuery = SqlPrepareQueryObject(GetModule(), stmt); + SqlBindInt(sqlQuery, "@ind", index); + SqlBindString(sqlQuery, "@element", element); + SqlStep(sqlQuery); + } +} + +void Array_Insert_Flt(string tag, int index, float element, object obj=OBJECT_INVALID) +{ + Array_Insert_Str(tag, index, FloatToString(element), obj); +} + +void Array_Insert_Int(string tag, int index, int element, object obj=OBJECT_INVALID) +{ + Array_Insert_Str(tag, index, IntToString(element), obj); +} + +void Array_Insert_Obj(string tag, int index, object element, object obj=OBJECT_INVALID) +{ + Array_Insert_Str(tag, index, ObjectToString(element), obj); +} + +//////////////////////////////////////////////////////////////////////////////// +// Insert a new element at the end of the array. +void Array_PushBack_Str(string tag, string element, object obj=OBJECT_INVALID) +{ + // Create it before trhing to INSERT into it. If it already exists, this is a no-op. + CreateArrayTable(tag, obj); + + // If rowCount = 10, indexes are from 0 to 9, so this becomes the 11th entry at index 10. + int rowCount = GetRowCount(tag, obj); + + string stmt = "INSERT INTO "+GetTableName(tag, obj)+" VALUES ( @ind, @element )"; + sqlquery sqlQuery = SqlPrepareQueryObject(GetModule(), stmt); + SqlBindInt(sqlQuery, "@ind", rowCount); + SqlBindString(sqlQuery, "@element", element); + SqlStep(sqlQuery); +} + +void Array_PushBack_Flt(string tag, float element, object obj=OBJECT_INVALID) +{ + Array_PushBack_Str(tag, FloatToString(element), obj); +} + +void Array_PushBack_Int(string tag, int element, object obj=OBJECT_INVALID) +{ + Array_PushBack_Str(tag, IntToString(element), obj); +} + +void Array_PushBack_Obj(string tag, object element, object obj=OBJECT_INVALID) +{ + Array_PushBack_Str(tag, ObjectToString(element), obj); +} + +//////////////////////////////////////////////////////////////////////////////// +// Cuts the array off at size 'size'. Elements beyond size are removed. +void Array_Resize(string tag, int size, object obj=OBJECT_INVALID) +{ + // Int immune to sql injection so easier to one-shot it. + ExecuteStatement("DELETE FROM "+GetTableName(tag, obj)+" WHERE ind >= " + IntToString(size), obj); +} + +//////////////////////////////////////////////////////////////////////////////// +void Array_Shuffle(string tag, object obj=OBJECT_INVALID) +{ + string table = GetTableName(tag, obj, TRUE); + ExecuteStatement("CREATE TABLE " +table+ "_temp AS SELECT ROW_NUMBER() OVER(ORDER BY RANDOM())-1, value FROM " +table, obj); + ExecuteStatement("DELETE FROM " +table , obj); + ExecuteStatement("INSERT INTO " +table+ " SELECT * FROM " +table+ "_temp", obj); + ExecuteStatement("DROP TABLE " +table+ "_TEMP", obj); +} + +//////////////////////////////////////////////////////////////////////////////// +int Array_Size(string tag, object obj=OBJECT_INVALID) +{ + return GetRowCount(tag, obj); +} + +//////////////////////////////////////////////////////////////////////////////// +// Sort the array by value according to 'direction' (ASC or DESC). +// Supplying a type allows for correct numerical sorting of integers or floats. +void Array_Sort(string tag, string dir="ASC", int type=TYPE_STRING, object obj=OBJECT_INVALID) +{ + string table = GetTableName(tag, obj, TRUE); + string direction = GetStringUpperCase(dir); + + if ( ! (direction == "ASC" || direction == "DESC") ) { + WriteTimestampedLogEntry("WARNING: Invalid sort direction <" + direction + "> supplied. Defaulting to ASC."); + direction = "ASC"; + } + + // default orderBy for strings. + string orderBy = "ORDER BY value " + direction; + switch(type) { + case TYPE_INTEGER: + orderBy = "ORDER BY CAST(value AS INTEGER)" + direction; + break; + case TYPE_FLOAT: + orderBy = "ORDER BY CAST(value AS DECIMAL)" + direction; + break; + } + ExecuteStatement("CREATE TABLE " +table+ "_temp AS SELECT ROW_NUMBER() OVER(" + orderBy + ")-1, value FROM " +table, obj); + ExecuteStatement("DELETE FROM " +table, obj); + ExecuteStatement("INSERT INTO " +table+ " SELECT * FROM " +table+ "_temp", obj); + ExecuteStatement("DROP TABLE " +table+ "_temp", obj); +} + +void Array_SortAscending(string tag, int type=TYPE_STRING, object obj=OBJECT_INVALID) +{ + Array_Sort(tag, "ASC", type, obj); +} + +void Array_SortDescending(string tag, int type=TYPE_STRING, object obj=OBJECT_INVALID) +{ + Array_Sort(tag, "DESC", type, obj); +} + +//////////////////////////////////////////////////////////////////////////////// +// Set the value of array index 'index' to a 'element' +// This will quietly eat values if index > array size +void Array_Set_Str(string tag, int index, string element, object obj=OBJECT_INVALID) +{ + int rows = GetRowCount(tag, obj); + if (index >= 0 && index <= rows) { + string stmt = "UPDATE "+GetTableName(tag, obj)+" SET value = @element WHERE ind = @ind"; + sqlquery sqlQuery = SqlPrepareQueryObject(GetModule(), stmt); + SqlBindInt(sqlQuery, "@ind", index); + SqlBindString(sqlQuery, "@element", element); + SqlStep(sqlQuery); + } +} + +void Array_Set_Flt(string tag, int index, float element, object obj=OBJECT_INVALID) +{ + Array_Set_Str(tag, index, FloatToString(element), obj); +} + +void Array_Set_Int(string tag, int index, int element, object obj=OBJECT_INVALID) +{ + Array_Set_Str(tag, index, IntToString(element), obj); +} + +void Array_Set_Obj(string tag, int index, object element, object obj=OBJECT_INVALID) +{ + Array_Set_Str(tag, index, ObjectToString(element), obj); +} + +void Array_Debug_Dump(string tag, string title = "xxx", object obj=OBJECT_INVALID) { + if (title != "xxx") { + WriteTimestampedLogEntry("== " + title + " ======================================"); + } + WriteTimestampedLogEntry("Table name = " + GetTableName(tag, obj)); + string stmt = "SELECT ind, value FROM " + GetTableName(tag, obj); + sqlquery sqlQuery = SqlPrepareQueryObject(GetModule(), stmt); + int ind = -1; + string value = ""; + while ( SqlStep(sqlQuery) ) { + ind = SqlGetInt(sqlQuery, 0); + value = SqlGetString(sqlQuery, 1); + WriteTimestampedLogEntry(tag + "[" + IntToString(ind) + "] = " + value); + } +} diff --git a/_module/nss/nwnx.nss b/_module/nss/nwnx.nss index 01506512..f7648213 100644 --- a/_module/nss/nwnx.nss +++ b/_module/nss/nwnx.nss @@ -3,6 +3,8 @@ /// @{ /// @file nwnx.nss +const string NWNX_Core = "NWNX_Core"; ///< @private + /// @brief Scripting interface to NWNX. /// @param pluginName The plugin name. /// @param functionName The function name (do not include NWNX_Plugin_). @@ -38,6 +40,12 @@ itemproperty NWNX_GetReturnValueItemProperty(); /// @copydoc NWNX_GetReturnValueInt() json NWNX_GetReturnValueJson(); +/// @brief Determines if the given plugin exists and is enabled. +/// @param sPlugin The name of the plugin to check. This is the case sensitive plugin name as used by NWNX_CallFunction, NWNX_PushArgumentX +/// @note Example usage: NWNX_PluginExists("NWNX_Creature"); +/// @return TRUE if the plugin exists and is enabled, otherwise FALSE. +int NWNX_PluginExists(string sPlugin); + /// @private const string NWNX_PUSH = "NWNXEE!ABIv2!X!Y!PUSH"; const string NWNX_POP = "NWNXEE!ABIv2!X!Y!POP"; @@ -119,3 +127,11 @@ json NWNX_GetReturnValueJson() { return GetLocalJson(OBJECT_INVALID, NWNX_POP); } + +int NWNX_PluginExists(string sPlugin) +{ + string sFunc = "PluginExists"; + NWNX_PushArgumentString(sPlugin); + NWNX_CallFunction(NWNX_Core, sFunc); + return NWNX_GetReturnValueInt(); +} diff --git a/_module/nss/nwnx_admin.nss b/_module/nss/nwnx_admin.nss index ca119d26..7cd016e5 100644 --- a/_module/nss/nwnx_admin.nss +++ b/_module/nss/nwnx_admin.nss @@ -38,6 +38,7 @@ const int NWNX_ADMINISTRATION_OPTION_RESTORE_SPELLS_USES = 24; // TRUE/FA const int NWNX_ADMINISTRATION_OPTION_RESET_ENCOUNTER_SPAWN_POOL = 25; // TRUE/FALSE const int NWNX_ADMINISTRATION_OPTION_HIDE_HITPOINTS_GAINED = 26; // TRUE/FALSE const int NWNX_ADMINISTRATION_OPTION_PLAYER_PARTY_CONTROL = 27; // TRUE/FALSE +const int NWNX_ADMINISTRATION_OPTION_SHOW_PLAYER_JOIN_MESSAGES = 28; // TRUE/FALSE /// @} /// @name Administration Debug Types diff --git a/_module/nss/nwnx_area.nss b/_module/nss/nwnx_area.nss index f9d57176..cfb90add 100644 --- a/_module/nss/nwnx_area.nss +++ b/_module/nss/nwnx_area.nss @@ -50,6 +50,15 @@ struct NWNX_Area_TileInfo int nGridY; ///< The tile's grid y position }; +/// @brief Area wind info struct +struct NWNX_Area_AreaWind +{ + vector vDirection; ///< Wind's direction + float fMagnitude; ///< Wind's magnitude + float fYaw; ///< Wind's yaw + float fPitch; ///< Wind's pitch +}; + /// @brief Gets the number of players in area. /// @param area The area object. /// @return The player count for the area. @@ -328,6 +337,18 @@ int NWNX_Area_GetAreaFlags(object oArea); /// @param nFlags The flags. void NWNX_Area_SetAreaFlags(object oArea, int nFlags); +/// @brief Get oArea's detailed win data. +/// @note vDirection returns [0.0, 0.0, 0.0] if not set previously with SetAreaWind nwscript function. +/// @param oArea The area. +struct NWNX_Area_AreaWind NWNX_Area_GetAreaWind(object oArea); + +/// @brief Set the default discoverability mask for objects in an area. +/// @param oArea The area or OBJECT_INVALID to set a global mask for all areas. Per area masks will override the global mask. +/// @param nObjectTypes A mask of OBJECT_TYPE_* constants or OBJECT_TYPE_ALL for all suitable object types. Currently only works on Creatures, Doors (Hilite only), Items and Useable Placeables. +/// @param nMask A mask of OBJECT_UI_DISCOVERY_* +/// @param bForceUpdate If TRUE, will update the discovery mask of ALL objects in the area or module(if oArea == OBJECT_INVALID), according to the current mask. Use with care. +void NWNX_Area_SetDefaultObjectUiDiscoveryMask(object oArea, int nObjectTypes, int nMask, int bForceUpdate = FALSE); + /// @} int NWNX_Area_GetNumberOfPlayersInArea(object area) @@ -836,3 +857,32 @@ void NWNX_Area_SetAreaFlags(object oArea, int nFlags) NWNX_PushArgumentObject(oArea); NWNX_CallFunction(NWNX_Area, sFunc); } + +struct NWNX_Area_AreaWind NWNX_Area_GetAreaWind(object oArea) +{ + string sFunc = "GetAreaWind"; + struct NWNX_Area_AreaWind data; + + NWNX_PushArgumentObject(oArea); + NWNX_CallFunction(NWNX_Area, sFunc); + + data.fPitch = NWNX_GetReturnValueFloat(); + data.fYaw = NWNX_GetReturnValueFloat(); + data.fMagnitude = NWNX_GetReturnValueFloat(); + data.vDirection.x = NWNX_GetReturnValueFloat(); + data.vDirection.y = NWNX_GetReturnValueFloat(); + data.vDirection.z = NWNX_GetReturnValueFloat(); + + return data; +} + +void NWNX_Area_SetDefaultObjectUiDiscoveryMask(object oArea, int nObjectTypes, int nMask, int bForceUpdate = FALSE) +{ + string sFunc = "SetDefaultObjectUiDiscoveryMask"; + + NWNX_PushArgumentInt(bForceUpdate); + NWNX_PushArgumentInt(nMask); + NWNX_PushArgumentInt(nObjectTypes); + NWNX_PushArgumentObject(oArea); + NWNX_CallFunction(NWNX_Area, sFunc); +} diff --git a/_module/nss/nwnx_creature.nss b/_module/nss/nwnx_creature.nss index 98dd4d91..275638f4 100644 --- a/_module/nss/nwnx_creature.nss +++ b/_module/nss/nwnx_creature.nss @@ -34,32 +34,6 @@ const int NWNX_CREATURE_MOVEMENT_TYPE_SIDESTEP = 3; const int NWNX_CREATURE_MOVEMENT_TYPE_WALK_BACKWARDS = 4; /// @} -/// @name Cleric Domains -/// @anchor cleric_domains -/// -/// The clerical domains. -/// @{ -const int NWNX_CREATURE_CLERIC_DOMAIN_AIR = 0; -const int NWNX_CREATURE_CLERIC_DOMAIN_ANIMAL = 1; -const int NWNX_CREATURE_CLERIC_DOMAIN_DEATH = 3; -const int NWNX_CREATURE_CLERIC_DOMAIN_DESTRUCTION = 4; -const int NWNX_CREATURE_CLERIC_DOMAIN_EARTH = 5; -const int NWNX_CREATURE_CLERIC_DOMAIN_EVIL = 6; -const int NWNX_CREATURE_CLERIC_DOMAIN_FIRE = 7; -const int NWNX_CREATURE_CLERIC_DOMAIN_GOOD = 8; -const int NWNX_CREATURE_CLERIC_DOMAIN_HEALING = 9; -const int NWNX_CREATURE_CLERIC_DOMAIN_KNOWLEDGE = 10; -const int NWNX_CREATURE_CLERIC_DOMAIN_MAGIC = 13; -const int NWNX_CREATURE_CLERIC_DOMAIN_PLANT = 14; -const int NWNX_CREATURE_CLERIC_DOMAIN_PROTECTION = 15; -const int NWNX_CREATURE_CLERIC_DOMAIN_STRENGTH = 16; -const int NWNX_CREATURE_CLERIC_DOMAIN_SUN = 17; -const int NWNX_CREATURE_CLERIC_DOMAIN_TRAVEL = 18; -const int NWNX_CREATURE_CLERIC_DOMAIN_TRICKERY = 19; -const int NWNX_CREATURE_CLERIC_DOMAIN_WAR = 20; -const int NWNX_CREATURE_CLERIC_DOMAIN_WATER = 21; -/// @} - /// @name Bonus Types /// @anchor bonus_types /// @@ -87,6 +61,8 @@ const int NWNX_CREATURE_PROJECTILE_VFX_SONIC = 5; const int NWNX_CREATURE_PROJECTILE_VFX_RANDOM = 6; ///< Random Elemental VFX /// @} +const int NWNX_CREATURE_ABILITY_NONE = 6; + /// @struct NWNX_Creature_SpecialAbility /// @brief A creature special ability. struct NWNX_Creature_SpecialAbility @@ -96,16 +72,6 @@ struct NWNX_Creature_SpecialAbility int level; ///< The level of the ability }; -/// @struct NWNX_Creature_MemorisedSpell -/// @brief A memorised spell structure. -struct NWNX_Creature_MemorisedSpell -{ - int id; ///< Spell ID - int ready; ///< Whether the spell can be cast - int meta; ///< Metamagic type, if any - int domain; ///< Clerical domain, if any -}; - /// @brief Gives the creature a feat. /// @param creature The creature object. /// @param feat The feat id. @@ -246,29 +212,6 @@ void NWNX_Creature_ModifyRawAbilityScore(object creature, int ability, int modif /// @return The raw ability score. int NWNX_Creature_GetPrePolymorphAbilityScore(object creature, int ability); -/// @brief Gets the count of memorised spells for a creature's class at a level. -/// @param creature The creature object. -/// @param class The class id from classes.2da. (Not class index 0-2) -/// @param level The spell level. -/// @return The memorised spell count. -int NWNX_Creature_GetMemorisedSpellCountByLevel(object creature, int class, int level); - -/// @brief Gets the memorised spell at a class level's index. -/// @param creature The creature object. -/// @param class The class id from classes.2da. (Not class index 0-2) -/// @param level The spell level. -/// @param index The index. Index bounds: 0 <= index < NWNX_Creature_GetMemorisedSpellCountByLevel(). -/// @return An NWNX_Creature_MemorisedSpell() struct. -struct NWNX_Creature_MemorisedSpell NWNX_Creature_GetMemorisedSpell(object creature, int class, int level, int index); - -/// @brief Sets the memorised spell at a class level's index. -/// @param creature The creature object. -/// @param class The class id from classes.2da. (Not class index 0-2) -/// @param level The spell level. -/// @param index The index. Index bounds: 0 <= index < NWNX_Creature_GetMemorisedSpellCountByLevel(). -/// @param spell An NWNX_Creature_MemorisedSpell() struct. -void NWNX_Creature_SetMemorisedSpell(object creature, int class, int level, int index, struct NWNX_Creature_MemorisedSpell spell); - /// @brief Gets the remaining spell slots (innate casting) at a class level's index. /// @param creature The creature object. /// @param class The class id from classes.2da. (Not class index 0-2) @@ -290,21 +233,6 @@ void NWNX_Creature_SetRemainingSpellSlots(object creature, int class, int level, /// @return The maximum spell slot count. int NWNX_Creature_GetMaxSpellSlots(object creature, int class, int level); -/// @brief Gets the known spell count (innate casting) at a class level. -/// @param creature The creature object. -/// @param class The class id from classes.2da. (Not class index 0-2) -/// @param level The spell level. -/// @return The known spell count. -int NWNX_Creature_GetKnownSpellCount(object creature, int class, int level); - -/// @brief Gets the known spell at a class level's index. -/// @param creature The creature object. -/// @param class The class id from classes.2da. (Not class index 0-2) -/// @param level The spell level. -/// @param index The index. Index bounds: 0 <= index < NWNX_Creature_GetKnownSpellCount(). -/// @return The spell id. -int NWNX_Creature_GetKnownSpell(object creature, int class, int level, int index); - /// @brief Add a spell to a creature's spellbook for class. /// @param creature The creature object. /// @param class The class id from classes.2da. (Not class index 0-2) @@ -319,19 +247,6 @@ void NWNX_Creature_AddKnownSpell(object creature, int class, int level, int spel /// @param spellId The spell to remove. void NWNX_Creature_RemoveKnownSpell(object creature, int class, int level, int spellId); -/// @brief Clear a specific spell from the creature's spellbook for class -/// @param creature The creature object. -/// @param class The class id from classes.2da. (Not class index 0-2) -/// @param spellId The spell to clear. -void NWNX_Creature_ClearMemorisedKnownSpells(object creature, int class, int spellId); - -/// @brief Clear the memorised spell of the creature for the class, level and index. -/// @param creature The creature object. -/// @param class The class id from classes.2da. (Not class index 0-2) -/// @param level The spell level. -/// @param index The index. Index bounds: 0 <= index < NWNX_Creature_GetMemorisedSpellCountByLevel(). -void NWNX_Creature_ClearMemorisedSpell(object creature, int class, int level, int index); - /// @brief Gets the maximum hit points for creature for level. /// @param creature The creature object. /// @param level The level. @@ -361,6 +276,12 @@ float NWNX_Creature_GetMovementRateFactor(object creature); /// @param rate The rate to set. void NWNX_Creature_SetMovementRateFactor(object creature, float rate); +/// @brief Returns the creature's maximum movement rate cap. +/// @remark Default movement rate cap is 1.5. +/// @param creature The creature object. +/// @return The maximum movement rate cap. +float NWNX_Creature_GetMovementRateFactorCap(object creature); + /// @brief Sets the creature's maximum movement rate cap. /// @note Default movement rate cap is 1.5. /// @param creature The creature object. @@ -389,16 +310,6 @@ void NWNX_Creature_SetAlignmentGoodEvil(object creature, int value); /// @param value The value to set. void NWNX_Creature_SetAlignmentLawChaos(object creature, int value); -/// @brief Get the soundset index for creature. -/// @param creature The creature object. -/// @return The soundset used by the creature. -int NWNX_Creature_GetSoundset(object creature); - -/// @brief Set the soundset index for creature. -/// @param creature The creature object. -/// @param soundset The soundset index. -void NWNX_Creature_SetSoundset(object creature, int soundset); - /// @brief Set the base ranks in a skill for creature /// @param creature The creature object. /// @param skill The skill id. @@ -455,11 +366,6 @@ void NWNX_Creature_SetBaseAttackBonus(object creature, int bab); /// @return The attacks per round. int NWNX_Creature_GetAttacksPerRound(object creature, int bBaseAPR = FALSE); -/// @brief Sets the creature gender. -/// @param creature The creature object. -/// @param gender The GENDER_ constant. -void NWNX_Creature_SetGender(object creature, int gender); - /// @brief Restore all creature feat uses. /// @param creature The creature object. void NWNX_Creature_RestoreFeats(object creature); @@ -468,11 +374,6 @@ void NWNX_Creature_RestoreFeats(object creature); /// @param creature The creature object. void NWNX_Creature_RestoreSpecialAbilities(object creature); -/// @brief Restore all creature spells per day for given level. -/// @param creature The creature object. -/// @param level The level to restore. If -1, all spells are restored. -void NWNX_Creature_RestoreSpells(object creature, int level = -1); - /// @brief Restore uses for all items carried by the creature. /// @param creature The creature object. void NWNX_Creature_RestoreItems(object creature); @@ -536,8 +437,9 @@ void NWNX_Creature_SetBaseSavingThrow(object creature, int which, int value); /// @param creature The creature object. /// @param class The class id. /// @param count The amount of levels of class to add. +/// @param package The class package to use for leveling up (PACKAGE_INVALID = starting package) /// @note This will not work on player characters. -void NWNX_Creature_LevelUp(object creature, int class, int count=1); +void NWNX_Creature_LevelUp(object creature, int class, int count = 1, int package = PACKAGE_INVALID); /// @brief Remove last levels from a creature. /// @param creature The creature object. @@ -654,13 +556,6 @@ int NWNX_Creature_GetDisarmable(object creature); /// @param disarmable Set to TRUE if the creature can be disarmed. void NWNX_Creature_SetDisarmable(object creature, int disarmable); -/// @brief Gets one of creature's domains. -/// @param creature The creature object. -/// @param class The class id from classes.2da. (Not class index 0-2) -/// @param index The first or second domain. -/// @deprecated Use GetDomain(). This will be removed in future NWNX releases. -int NWNX_Creature_GetDomain(object creature, int class, int index); - /// @brief Sets one of creature's domains. /// @param creature The creature object. /// @param class The class id from classes.2da. (Not class index 0-2) @@ -668,12 +563,6 @@ int NWNX_Creature_GetDomain(object creature, int class, int index); /// @param domain The domain constant to set. void NWNX_Creature_SetDomain(object creature, int class, int index, int domain); -/// @brief Gets the creature's specialist school. -/// @param creature The creature object. -/// @param class The class id from classes.2da. (Not class index 0-2) -/// @deprecated Use GetSpecialization(). This will be removed in future NWNX releases. -int NWNX_Creature_GetSpecialization(object creature, int class); - /// @brief Sets creature's specialist school. /// @param creature The creature object. /// @param class The class id from classes.2da. (Not class index 0-2) @@ -807,12 +696,6 @@ int NWNX_Creature_GetCriticalRangeOverride(object oCreature, int nHand = 0, int /// @param nAssociateType The associate type, one of ASSOCIATE_TYPE_*, except _NONE void NWNX_Creature_AddAssociate(object oCreature, object oAssociate, int nAssociateType); -/// @brief Set whether an effect icon is flashing or not. -/// @param oCreature The target creature. -/// @param nIconId The icon id, see effecticons.2da. -/// @param bFlashing TRUE for flashing, FALSE for not flashing. -void NWNX_Creature_SetEffectIconFlashing(object oCreature, int nIconId, int bFlashing); - /// @brief Override the damage level of oCreature. /// @note Damage levels are the damage state under a creature's name, for example: 'Near Death' /// @param oCreature The target creature. @@ -985,7 +868,9 @@ void NWNX_Creature_SetLastKiller(object oCreature, object oKiller); /// @param fProjectileTime The time in seconds for the projectile to reach the target. 0.0f for no projectile. /// @param nProjectilePathType A PROJECTILE_PATH_TYPE_* constant. /// @param nProjectileSpellID An optional spell ID which to use the projectile vfx of. -1 to use nSpellID's projectile vfx. -void NWNX_Creature_DoItemCastSpell(object oCreature, object oTarget, location locTarget, int nSpellID, int nCasterLevel, float fProjectileTime, int nProjectilePathType = PROJECTILE_PATH_TYPE_DEFAULT, int nProjectileSpellID = -1); +/// @param oItem The spell cast item retrieved by GetSpellCastItem(). +/// @param sImpactScript The spell impact script. Set to "****"" to not run any impact script. If left blank, will execute nSpellID's impact script. +void NWNX_Creature_DoItemCastSpell(object oCreature, object oTarget, location locTarget, int nSpellID, int nCasterLevel, float fProjectileTime, int nProjectilePathType = PROJECTILE_PATH_TYPE_DEFAULT, int nProjectileSpellID = -1, object oItem = OBJECT_INVALID, string sImpactScript = ""); /// @brief Have oCreature instantly equip oItem to nInventorySlot. /// @param oCreature The creature. @@ -1013,12 +898,114 @@ void NWNX_Creature_OverrideRangedProjectileVFX(object oCreature, int nProjectile /// @param bPersist Whether the modifier should persist to .bic file (for PCs) /// @note Persistence is enabled after a server reset by the first use of this function. Recommended to trigger on a dummy target OnModuleLoad to enable persistence. /// @warning This modifier takes precedence over an NWNX_Race Initiative modifier; they're not additive -void NWNX_Creature_SetInitiativeModifer(object oCreature, int nMod, int bPersist = FALSE); +void NWNX_Creature_SetInitiativeModifier(object oCreature, int nMod, int bPersist = FALSE); /// @brief Gets the custom Initiative modifier. /// @param oCreature The target creature /// @return the current custom initiative modifier for the creature -int NWNX_Creature_GetInitiativeModifer(object oCreature); +int NWNX_Creature_GetInitiativeModifier(object oCreature); + +/// @brief Gets the Body Bag of a creature +/// @param oCreature The target creature +/// @return The creatures assigned Body Bag +object NWNX_Creature_GetBodyBag(object oCreature); + +/// @brief Add a cast spell action to oCreature's action queue. +/// @param oCreature The creature casting the spell. +/// @param oTarget The target, to cast at a location use the area as target. +/// @param vTargetLocation The target location. +/// @param nSpellID The spell ID. +/// @param nMultiClass The character class position to cast the spell as. 0 = First Class, 1 = Second Class, 3 = Third Class. To cast a cheat spell use 255 and to cast a special ability use 254. +/// @param nMetaMagic A METAMAGIC_* constant, except METAMAGIC_ANY. +/// @param nDomainLevel The domain level if casting a domain spell. +/// @param nProjectilePathType A PROJECTILE_PATH_TYPE_* constant. +/// @param bInstant TRUE to instantly cast the spell. +/// @param bClearActions TRUE to clear all actions. +/// @param bAddToFront TRUE to add the cast spell action to the front of the action queue. +/// @return TRUE if the action was successfully added to oCreature's action queue. +int NWNX_Creature_AddCastSpellActions(object oCreature, object oTarget, vector vTargetLocation, int nSpellID, int nMultiClass, int nMetaMagic = METAMAGIC_NONE, int nDomainLevel = 0, int nProjectilePathType = PROJECTILE_PATH_TYPE_DEFAULT, int bInstant = FALSE, int bClearActions = FALSE, int bAddToFront = FALSE); + +/// @brief Get whether oCreature is flanking oTargetCreature. +/// @param oCreature The creature object. +/// @param oTargetCreature The target creature object. +/// @return TRUE if oCreature is flanking oTargetCreature. +int NWNX_Creature_GetIsFlanking(object oCreature, object oTargetCreature); + +/// @brief Decrements the remaining spell slots (innate casting) at a class level. +/// @param oCreature The creature object. +/// @param nClass The class id from classes.2da. (Not class index 0-2) +/// @param nSpellLevel The spell level. +void NWNX_Creature_DecrementRemainingSpellSlots(object oCreature, int nClass, int nSpellLevel); + +/// @brief Increments the remaining spell slots (innate casting) at a class level. +/// @param oCreature The creature object. +/// @param nClass The class id from classes.2da. (Not class index 0-2) +/// @param nSpellLevel The spell level. +void NWNX_Creature_IncrementRemainingSpellSlots(object oCreature, int nClass, int nSpellLevel); + +/// @brief Gets the maximum number of bonus attacks a creature can have from EffectModifyAttacks(). +/// @param oCreature The creature. +/// @return The maximum number of bonus attacks or 0 on error. +int NWNX_Creature_GetMaximumBonusAttacks(object oCreature); + +/// @brief Sets the maximum number of bonus attacks a creature can have from EffectModifyAttacks(). +/// @note This function also removes the limit of 5 bonus attacks from EffectModifyAttacks(). +/// @param oCreature The creature. +/// @param nMaxBonusAttacks The maximum number of bonus attacks. Values < 0 will set the limit back to the default of 5. +/// @param bPersist Whether the modifier should persist to .bic file (for PCs). +/// @note Persistence is enabled after a server reset by the first use of this function. Recommended to trigger on a dummy target OnModuleLoad to enable persistence. +void NWNX_Creature_SetMaximumBonusAttacks(object oCreature, int nMaxBonusAttacks, int bPersist = FALSE); + +/// @brief Inserts a cleave or great cleave attack into oCreature's current attack round against the nearest enemy within melee reach. +/// @param oCreature The creature object. +/// @note oCreature must have the cleave or great cleave feats, must be in combat, and must have available attacks remaining in their combat round to use for cleave attack. +void NWNX_Creature_DoCleaveAttack(object oCreature); + +/// @brief Gets the current object oCreature's orientation is locked to. +/// @param oCreature The creature object. +/// @return The object oCreature's orientation is locked to, or OBJECT_INVALID if oCreature's orientation is not locked. +object NWNX_Creature_GetLockOrientationToObject(object oCreature); + +/// @brief Locks oCreature's orientation to always face oTarget. +/// @param oCreature The creature object. +/// @param oTarget The target to lock oCreature's orientation to. Use OBJECT_INVALID to remove the orientation lock. +void NWNX_Creature_SetLockOrientationToObject(object oCreature, object oTarget); + +/// @brief Causes oCreature to broadcast an Attack of Opportunity against themself. +/// @param oCreature The creature object. +/// @param oSingleCreature A single creature to broadcast the Attack of Opporunity to. Use OBJECT_INVALID to broadcast to all nearby enemies. +/// @param bMovement Whether the Attack of Opportunity was caused by movement. +void NWNX_Creature_BroadcastAttackOfOpportunity(object oCreature, object oSingleCreature = OBJECT_INVALID, int bMovement = FALSE); + +/// @brief Returns the maximum price oStore will buy items from oCreature for. +/// @param oCreature The creature object. +/// @param oStore The store object. +/// @return The max buy price override. -1 = No maximum buy price, -2 = No override set. +int NWNX_Creature_GetMaxSellToStorePriceOverride(object oCreature, object oStore); + +/// @brief Overrides the maximum price oStore will buy items from oCreature for. +/// @param oCreature The creature object. +/// @param oStore The store object. +/// @param nMaxSellToPrice The maximum buy price override. -1 = No maximum buy price, -2 = Remove the override. +void NWNX_Creature_SetMaxSellToStorePriceOverride(object oCreature, object oStore, int nMaxSellToPrice); + +/// @brief Returns the creature's ability increase for nLevel. +/// @param oCreature The creature object. +/// @param nLevel The level. +/// @return An ABILITY_* constant, NWNX_CREATURE_ABILITY_NONE or -1 on error +int NWNX_Creature_GetAbilityIncreaseByLevel(object oCreature, int nLevel); + +/// @brief Sets the creature's ability increase for nLevel. +/// @param oCreature The creature object. +/// @param nLevel The level. +/// @param nAbility ABILITY_* constant or NWNX_CREATURE_ABILITY_NONE +void NWNX_Creature_SetAbilityIncreaseByLevel(object oCreature, int nLevel, int nAbility); + +/// @brief Returns the creature's maximum attack range to a target +/// @param oCreature The creature object. +/// @param oTarget The target to get the maximum attack range to +/// @return The maximum attack range for oCreature to oTarget +float NWNX_Creature_GetMaxAttackRange(object oCreature, object oTarget); /// @} @@ -1276,54 +1263,6 @@ int NWNX_Creature_GetPrePolymorphAbilityScore(object creature, int ability) return NWNX_GetReturnValueInt(); } -struct NWNX_Creature_MemorisedSpell NWNX_Creature_GetMemorisedSpell(object creature, int class, int level, int index) -{ - string sFunc = "GetMemorisedSpell"; - struct NWNX_Creature_MemorisedSpell spell; - - NWNX_PushArgumentInt(index); - NWNX_PushArgumentInt(level); - NWNX_PushArgumentInt(class); - NWNX_PushArgumentObject(creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); - - spell.domain = NWNX_GetReturnValueInt(); - spell.meta = NWNX_GetReturnValueInt(); - spell.ready = NWNX_GetReturnValueInt(); - spell.id = NWNX_GetReturnValueInt(); - return spell; -} - -int NWNX_Creature_GetMemorisedSpellCountByLevel(object creature, int class, int level) -{ - string sFunc = "GetMemorisedSpellCountByLevel"; - - NWNX_PushArgumentInt(level); - NWNX_PushArgumentInt(class); - NWNX_PushArgumentObject(creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); - return NWNX_GetReturnValueInt(); -} - -void NWNX_Creature_SetMemorisedSpell(object creature, int class, int level, int index, struct NWNX_Creature_MemorisedSpell spell) -{ - string sFunc = "SetMemorisedSpell"; - - NWNX_PushArgumentInt(spell.id); - NWNX_PushArgumentInt(spell.ready); - NWNX_PushArgumentInt(spell.meta); - NWNX_PushArgumentInt(spell.domain); - - NWNX_PushArgumentInt(index); - NWNX_PushArgumentInt(level); - NWNX_PushArgumentInt(class); - NWNX_PushArgumentObject(creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); -} - int NWNX_Creature_GetRemainingSpellSlots(object creature, int class, int level) { string sFunc = "GetRemainingSpellSlots"; @@ -1348,31 +1287,6 @@ void NWNX_Creature_SetRemainingSpellSlots(object creature, int class, int level, NWNX_CallFunction(NWNX_Creature, sFunc); } -int NWNX_Creature_GetKnownSpell(object creature, int class, int level, int index) -{ - string sFunc = "GetKnownSpell"; - - NWNX_PushArgumentInt(index); - NWNX_PushArgumentInt(level); - NWNX_PushArgumentInt(class); - NWNX_PushArgumentObject(creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); - return NWNX_GetReturnValueInt(); -} - -int NWNX_Creature_GetKnownSpellCount(object creature, int class, int level) -{ - string sFunc = "GetKnownSpellCount"; - - NWNX_PushArgumentInt(level); - NWNX_PushArgumentInt(class); - NWNX_PushArgumentObject(creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); - return NWNX_GetReturnValueInt(); -} - void NWNX_Creature_RemoveKnownSpell(object creature, int class, int level, int spellId) { string sFunc = "RemoveKnownSpell"; @@ -1397,29 +1311,6 @@ void NWNX_Creature_AddKnownSpell(object creature, int class, int level, int spel NWNX_CallFunction(NWNX_Creature, sFunc); } -void NWNX_Creature_ClearMemorisedKnownSpells(object creature, int class, int spellId) -{ - string sFunc = "ClearMemorisedKnownSpells"; - - NWNX_PushArgumentInt(spellId); - NWNX_PushArgumentInt(class); - NWNX_PushArgumentObject(creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); -} - -void NWNX_Creature_ClearMemorisedSpell(object creature, int class, int level, int index) -{ - string sFunc = "ClearMemorisedSpell"; - - NWNX_PushArgumentInt(index); - NWNX_PushArgumentInt(level); - NWNX_PushArgumentInt(class); - NWNX_PushArgumentObject(creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); -} - int NWNX_Creature_GetMaxSpellSlots(object creature, int class, int level) { string sFunc = "GetMaxSpellSlots"; @@ -1484,6 +1375,15 @@ void NWNX_Creature_SetMovementRateFactor(object creature, float factor) NWNX_CallFunction(NWNX_Creature, sFunc); } +float NWNX_Creature_GetMovementRateFactorCap(object creature) +{ + string sFunc = "GetMovementRateFactorCap"; + NWNX_PushArgumentObject(creature); + + NWNX_CallFunction(NWNX_Creature, sFunc); + return NWNX_GetReturnValueFloat(); +} + void NWNX_Creature_SetMovementRateFactorCap(object creature, float cap) { string sFunc = "SetMovementRateFactorCap"; @@ -1514,26 +1414,6 @@ void NWNX_Creature_SetAlignmentLawChaos(object creature, int value) NWNX_CallFunction(NWNX_Creature, sFunc); } -int NWNX_Creature_GetSoundset(object creature) -{ - string sFunc = "GetSoundset"; - - NWNX_PushArgumentObject(creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); - return NWNX_GetReturnValueInt(); -} - -void NWNX_Creature_SetSoundset(object creature, int soundset) -{ - string sFunc = "SetSoundset"; - - NWNX_PushArgumentInt(soundset); - NWNX_PushArgumentObject(creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); -} - void NWNX_Creature_SetSkillRank(object creature, int skill, int rank) { string sFunc = "SetSkillRank"; @@ -1608,15 +1488,6 @@ int NWNX_Creature_GetAttacksPerRound(object creature, int bBaseAPR = FALSE) return NWNX_GetReturnValueInt(); } -void NWNX_Creature_SetGender(object creature, int gender) -{ - string sFunc = "SetGender"; - NWNX_PushArgumentInt(gender); - NWNX_PushArgumentObject(creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); -} - void NWNX_Creature_RestoreFeats(object creature) { string sFunc = "RestoreFeats"; @@ -1633,15 +1504,6 @@ void NWNX_Creature_RestoreSpecialAbilities(object creature) NWNX_CallFunction(NWNX_Creature, sFunc); } -void NWNX_Creature_RestoreSpells(object creature, int level = -1) -{ - string sFunc = "RestoreSpells"; - NWNX_PushArgumentInt(level); - NWNX_PushArgumentObject(creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); -} - void NWNX_Creature_RestoreItems(object creature) { string sFunc = "RestoreItems"; @@ -1766,9 +1628,10 @@ void NWNX_Creature_SetBaseSavingThrow(object creature, int which, int value) NWNX_CallFunction(NWNX_Creature, sFunc); } -void NWNX_Creature_LevelUp(object creature, int class, int count=1) +void NWNX_Creature_LevelUp(object creature, int class, int count = 1, int package = PACKAGE_INVALID) { string sFunc = "LevelUp"; + NWNX_PushArgumentInt(package); NWNX_PushArgumentInt(count); NWNX_PushArgumentInt(class); NWNX_PushArgumentObject(creature); @@ -1977,13 +1840,6 @@ void NWNX_Creature_SetDisarmable(object creature, int disarmable) NWNX_CallFunction(NWNX_Creature, sFunc); } -int NWNX_Creature_GetDomain(object creature, int class, int index) -{ - WriteTimestampedLogEntry("NWNX_Creature: GetDomain() is deprecated. Please use the basegame's GetDomain() instead"); - - return GetDomain(creature, index, class); -} - void NWNX_Creature_SetDomain(object creature, int class, int index, int domain) { string sFunc = "SetDomain"; @@ -1996,13 +1852,6 @@ void NWNX_Creature_SetDomain(object creature, int class, int index, int domain) NWNX_CallFunction(NWNX_Creature, sFunc); } -int NWNX_Creature_GetSpecialization(object creature, int class) -{ - WriteTimestampedLogEntry("NWNX_Creature: GetSpecialization() is deprecated. Please use the basegame's GetSpecialization() instead"); - - return GetSpecialization(creature, class); -} - void NWNX_Creature_SetSpecialization(object creature, int class, int school) { string sFunc = "SetSpecialization"; @@ -2223,16 +2072,6 @@ void NWNX_Creature_AddAssociate(object oCreature, object oAssociate, int nAssoci NWNX_CallFunction(NWNX_Creature, sFunc); } -void NWNX_Creature_SetEffectIconFlashing(object oCreature, int nIconId, int bFlashing) -{ - string sFunc = "SetEffectIconFlashing"; - - NWNX_PushArgumentInt(bFlashing); - NWNX_PushArgumentInt(nIconId); - NWNX_PushArgumentObject(oCreature); - NWNX_CallFunction(NWNX_Creature, sFunc); -} - void NWNX_Creature_OverrideDamageLevel(object oCreature, int nDamageLevel) { string sFunc = "OverrideDamageLevel"; @@ -2525,13 +2364,15 @@ void NWNX_Creature_SetLastKiller(object oCreature, object oKiller) NWNX_CallFunction(NWNX_Creature, sFunc); } -void NWNX_Creature_DoItemCastSpell(object oCreature, object oTarget, location locTarget, int nSpellID, int nCasterLevel, float fProjectileTime, int nProjectilePathType = PROJECTILE_PATH_TYPE_DEFAULT, int nProjectileSpellID = -1) +void NWNX_Creature_DoItemCastSpell(object oCreature, object oTarget, location locTarget, int nSpellID, int nCasterLevel, float fProjectileTime, int nProjectilePathType = PROJECTILE_PATH_TYPE_DEFAULT, int nProjectileSpellID = -1, object oItem = OBJECT_INVALID, string sImpactScript = "") { string sFunc = "DoItemCastSpell"; object oArea = GetAreaFromLocation(locTarget); vector vPosition = GetPositionFromLocation(locTarget); + NWNX_PushArgumentString(sImpactScript); + NWNX_PushArgumentObject(oItem); NWNX_PushArgumentInt(nProjectileSpellID); NWNX_PushArgumentInt(nProjectilePathType); NWNX_PushArgumentFloat(fProjectileTime); @@ -2597,3 +2438,176 @@ int NWNX_Creature_GetInitiativeModifier(object oCreature) NWNX_CallFunction(NWNX_Creature, sFunc); return NWNX_GetReturnValueInt(); } + +object NWNX_Creature_GetBodyBag(object oCreature) +{ + string sFunc = "GetBodyBag"; + + NWNX_PushArgumentObject(oCreature); + NWNX_CallFunction(NWNX_Creature, sFunc); + return NWNX_GetReturnValueObject(); +} + +int NWNX_Creature_AddCastSpellActions(object oCreature, object oTarget, vector vTargetLocation, int nSpellID, int nMultiClass, int nMetaMagic = METAMAGIC_NONE, int nDomainLevel = 0, int nProjectilePathType = PROJECTILE_PATH_TYPE_DEFAULT, int bInstant = FALSE, int bClearActions = FALSE, int bAddToFront = FALSE) +{ + string sFunc = "AddCastSpellActions"; + + NWNX_PushArgumentInt(bAddToFront); + NWNX_PushArgumentInt(bClearActions); + NWNX_PushArgumentInt(bInstant); + NWNX_PushArgumentInt(nProjectilePathType); + NWNX_PushArgumentInt(nDomainLevel); + NWNX_PushArgumentInt(nMetaMagic); + NWNX_PushArgumentInt(nMultiClass); + NWNX_PushArgumentInt(nSpellID); + NWNX_PushArgumentFloat(vTargetLocation.z); + NWNX_PushArgumentFloat(vTargetLocation.y); + NWNX_PushArgumentFloat(vTargetLocation.x); + NWNX_PushArgumentObject(oTarget); + NWNX_PushArgumentObject(oCreature); + + NWNX_CallFunction(NWNX_Creature, sFunc); + return NWNX_GetReturnValueInt(); +} + +int NWNX_Creature_GetIsFlanking(object oCreature, object oTargetCreature) +{ + string sFunc = "GetIsFlanking"; + + NWNX_PushArgumentObject(oTargetCreature); + NWNX_PushArgumentObject(oCreature); + + NWNX_CallFunction(NWNX_Creature, sFunc); + return NWNX_GetReturnValueInt(); +} + +void NWNX_Creature_DecrementRemainingSpellSlots(object oCreature, int nClass, int nSpellLevel) +{ + string sFunc = "DecrementRemainingSpellSlots"; + + NWNX_PushArgumentInt(nSpellLevel); + NWNX_PushArgumentInt(nClass); + NWNX_PushArgumentObject(oCreature); + + NWNX_CallFunction(NWNX_Creature, sFunc); +} + +void NWNX_Creature_IncrementRemainingSpellSlots(object oCreature, int nClass, int nSpellLevel) +{ + string sFunc = "IncrementRemainingSpellSlots"; + + NWNX_PushArgumentInt(nSpellLevel); + NWNX_PushArgumentInt(nClass); + NWNX_PushArgumentObject(oCreature); + + NWNX_CallFunction(NWNX_Creature, sFunc); +} + +int NWNX_Creature_GetMaximumBonusAttacks(object oCreature) +{ + string sFunc = "GetMaximumBonusAttacks"; + + NWNX_PushArgumentObject(oCreature); + NWNX_CallFunction(NWNX_Creature, sFunc); + return NWNX_GetReturnValueInt(); +} + +void NWNX_Creature_SetMaximumBonusAttacks(object oCreature, int nMaxBonusAttacks, int bPersist = FALSE) +{ + string sFunc = "SetMaximumBonusAttacks"; + + NWNX_PushArgumentInt(bPersist); + NWNX_PushArgumentInt(nMaxBonusAttacks); + NWNX_PushArgumentObject(oCreature); + NWNX_CallFunction(NWNX_Creature, sFunc); +} + +void NWNX_Creature_DoCleaveAttack(object oCreature) +{ + string sFunc = "DoCleaveAttack"; + + NWNX_PushArgumentObject(oCreature); + NWNX_CallFunction(NWNX_Creature, sFunc); +} + +object NWNX_Creature_GetLockOrientationToObject(object oCreature) +{ + string sFunc = "GetLockOrientationToObject"; + + NWNX_PushArgumentObject(oCreature); + NWNX_CallFunction(NWNX_Creature, sFunc); + + return NWNX_GetReturnValueObject(); +} + +void NWNX_Creature_SetLockOrientationToObject(object oCreature, object oTarget) +{ + string sFunc = "SetLockOrientationToObject"; + + NWNX_PushArgumentObject(oTarget); + NWNX_PushArgumentObject(oCreature); + NWNX_CallFunction(NWNX_Creature, sFunc); +} + +void NWNX_Creature_BroadcastAttackOfOpportunity(object oCreature, object oSingleCreature = OBJECT_INVALID, int bMovement = FALSE) +{ + string sFunc = "BroadcastAttackOfOpportunity"; + + NWNX_PushArgumentInt(bMovement); + NWNX_PushArgumentObject(oSingleCreature); + NWNX_PushArgumentObject(oCreature); + NWNX_CallFunction(NWNX_Creature, sFunc); +} + +int NWNX_Creature_GetMaxSellToStorePriceOverride(object oCreature, object oStore) +{ + string sFunc = "GetMaxSellToStorePriceOverride"; + + NWNX_PushArgumentObject(oStore); + NWNX_PushArgumentObject(oCreature); + NWNX_CallFunction(NWNX_Creature, sFunc); + + return NWNX_GetReturnValueInt(); +} + +void NWNX_Creature_SetMaxSellToStorePriceOverride(object oCreature, object oStore, int nMaxSellToPrice) +{ + string sFunc = "SetMaxSellToStorePriceOverride"; + + NWNX_PushArgumentInt(nMaxSellToPrice); + NWNX_PushArgumentObject(oStore); + NWNX_PushArgumentObject(oCreature); + NWNX_CallFunction(NWNX_Creature, sFunc); +} + +int NWNX_Creature_GetAbilityIncreaseByLevel(object oCreature, int nLevel) +{ + string sFunc = "GetAbilityIncreaseByLevel"; + + NWNX_PushArgumentInt(nLevel); + NWNX_PushArgumentObject(oCreature); + NWNX_CallFunction(NWNX_Creature, sFunc); + + return NWNX_GetReturnValueInt(); +} + +void NWNX_Creature_SetAbilityIncreaseByLevel(object oCreature, int nLevel, int nAbility) +{ + string sFunc = "SetAbilityIncreaseByLevel"; + + NWNX_PushArgumentInt(nAbility); + NWNX_PushArgumentInt(nLevel); + NWNX_PushArgumentObject(oCreature); + NWNX_CallFunction(NWNX_Creature, sFunc); +} + +float NWNX_Creature_GetMaxAttackRange(object oCreature, object oTarget) +{ + string sFunc = "GetMaxAttackRange"; + + NWNX_PushArgumentObject(oTarget); + NWNX_PushArgumentObject(oCreature); + NWNX_CallFunction(NWNX_Creature, sFunc); + + return NWNX_GetReturnValueFloat(); +} diff --git a/_module/nss/nwnx_damage.nss b/_module/nss/nwnx_damage.nss index 38ed3c5c..c3977cb1 100644 --- a/_module/nss/nwnx_damage.nss +++ b/_module/nss/nwnx_damage.nss @@ -24,6 +24,25 @@ struct NWNX_Damage_DamageEventData int iPositive; ///< Positive damage int iSonic; ///< Sonic damage int iBase; ///< Base damage + int iCustom1; ///< Custom1 damage + int iCustom2; ///< Custom2 damage + int iCustom3; ///< Custom3 damage + int iCustom4; ///< Custom4 damage + int iCustom5; ///< Custom5 damage + int iCustom6; ///< Custom6 damage + int iCustom7; ///< Custom7 damage + int iCustom8; ///< Custom8 damage + int iCustom9; ///< Custom9 damage + int iCustom10; ///< Custom10 damage + int iCustom11; ///< Custom11 damage + int iCustom12; ///< Custom12 damage + int iCustom13; ///< Custom13 damage + int iCustom14; ///< Custom14 damage + int iCustom15; ///< Custom15 damage + int iCustom16; ///< Custom16 damage + int iCustom17; ///< Custom17 damage + int iCustom18; ///< Custom18 damage + int iCustom19; ///< Custom19 damage }; /// @struct NWNX_Damage_AttackEventData @@ -44,6 +63,25 @@ struct NWNX_Damage_AttackEventData int iPositive; ///< Positive damage int iSonic; ///< Sonic damage int iBase; ///< Base damage + int iCustom1; ///< Custom1 damage + int iCustom2; ///< Custom2 damage + int iCustom3; ///< Custom3 damage + int iCustom4; ///< Custom4 damage + int iCustom5; ///< Custom5 damage + int iCustom6; ///< Custom6 damage + int iCustom7; ///< Custom7 damage + int iCustom8; ///< Custom8 damage + int iCustom9; ///< Custom9 damage + int iCustom10; ///< Custom10 damage + int iCustom11; ///< Custom11 damage + int iCustom12; ///< Custom12 damage + int iCustom13; ///< Custom13 damage + int iCustom14; ///< Custom14 damage + int iCustom15; ///< Custom15 damage + int iCustom16; ///< Custom16 damage + int iCustom17; ///< Custom17 damage + int iCustom18; ///< Custom18 damage + int iCustom19; ///< Custom19 damage int iAttackNumber; ///< 1-based index of the attack in current combat round int iAttackResult; ///< 1=hit, 2=parried, 3=critical hit, 4=miss, 5=resisted, 7=automatic hit, 8=concealed, 9=miss chance, 10=devastating crit int iWeaponAttackType; ///< 1=main hand, 2=offhand, 3-5=creature, 6=extra(haste), 7=unarmed, 8=unarmed extra @@ -70,13 +108,32 @@ struct NWNX_Damage_DamageData int iNegative; ///< Negative damage int iPositive; ///< Positive damage int iSonic; ///< Sonic damage + int iCustom1; ///< Custom1 damage + int iCustom2; ///< Custom2 damage + int iCustom3; ///< Custom3 damage + int iCustom4; ///< Custom4 damage + int iCustom5; ///< Custom5 damage + int iCustom6; ///< Custom6 damage + int iCustom7; ///< Custom7 damage + int iCustom8; ///< Custom8 damage + int iCustom9; ///< Custom9 damage + int iCustom10; ///< Custom10 damage + int iCustom11; ///< Custom11 damage + int iCustom12; ///< Custom12 damage + int iCustom13; ///< Custom13 damage + int iCustom14; ///< Custom14 damage + int iCustom15; ///< Custom15 damage + int iCustom16; ///< Custom16 damage + int iCustom17; ///< Custom17 damage + int iCustom18; ///< Custom18 damage + int iCustom19; ///< Custom19 damage int iPower; ///< For overcoming DR }; /// @brief Sets the script to run with a damage event. /// @param sScript The script that will handle the damage event. /// @param oOwner An object if only executing for a specific object or OBJECT_INVALID for global. -void NWNX_Damage_SetDamageEventScript(string sScript, object oOwner=OBJECT_INVALID); +void NWNX_Damage_SetDamageEventScript(string sScript, object oOwner = OBJECT_INVALID); /// @brief Get Damage Event Data /// @return A NWNX_Damage_DamageEventData struct. @@ -91,7 +148,7 @@ void NWNX_Damage_SetDamageEventData(struct NWNX_Damage_DamageEventData data); /// @brief Sets the script to run with an attack event. /// @param sScript The script that will handle the attack event. /// @param oOwner An object if only executing for a specific object or OBJECT_INVALID for global. -void NWNX_Damage_SetAttackEventScript(string sScript, object oOwner=OBJECT_INVALID); +void NWNX_Damage_SetAttackEventScript(string sScript, object oOwner = OBJECT_INVALID); /// @brief Get Attack Event Data /// @return A NWNX_Damage_AttackEventData struct. @@ -101,6 +158,7 @@ struct NWNX_Damage_AttackEventData NWNX_Damage_GetAttackEventData(); /// @brief Set Attack Event Data /// @param data A NWNX_Damage_AttackEventData struct. /// @note To use only in the Attack Event Script. +/// @note Setting iSneakAttack will only change the attack roll message and floating text feedback. Immunities and damage will have already been resolved by the time the attack event script is ran. void NWNX_Damage_SetAttackEventData(struct NWNX_Damage_AttackEventData data); /// @brief Deal damage to a target. @@ -109,7 +167,7 @@ void NWNX_Damage_SetAttackEventData(struct NWNX_Damage_AttackEventData data); /// @param oTarget The target object on whom the damage is dealt. /// @param oSource The source of the damage. /// @param iRanged Whether the attack should be treated as ranged by the engine (for example when considering damage inflicted by Acid Sheath and other such effects) -void NWNX_Damage_DealDamage(struct NWNX_Damage_DamageData data, object oTarget, object oSource=OBJECT_SELF, int iRanged = FALSE); +void NWNX_Damage_DealDamage(struct NWNX_Damage_DamageData data, object oTarget, object oSource = OBJECT_SELF, int iRanged = FALSE); /// @} @@ -145,6 +203,25 @@ struct NWNX_Damage_DamageEventData NWNX_Damage_GetDamageEventData() data.iPositive = NWNX_GetReturnValueInt(); data.iSonic = NWNX_GetReturnValueInt(); data.iBase = NWNX_GetReturnValueInt(); + data.iCustom1 = NWNX_GetReturnValueInt(); + data.iCustom2 = NWNX_GetReturnValueInt(); + data.iCustom3 = NWNX_GetReturnValueInt(); + data.iCustom4 = NWNX_GetReturnValueInt(); + data.iCustom5 = NWNX_GetReturnValueInt(); + data.iCustom6 = NWNX_GetReturnValueInt(); + data.iCustom7 = NWNX_GetReturnValueInt(); + data.iCustom8 = NWNX_GetReturnValueInt(); + data.iCustom9 = NWNX_GetReturnValueInt(); + data.iCustom10 = NWNX_GetReturnValueInt(); + data.iCustom11 = NWNX_GetReturnValueInt(); + data.iCustom12 = NWNX_GetReturnValueInt(); + data.iCustom13 = NWNX_GetReturnValueInt(); + data.iCustom14 = NWNX_GetReturnValueInt(); + data.iCustom15 = NWNX_GetReturnValueInt(); + data.iCustom16 = NWNX_GetReturnValueInt(); + data.iCustom17 = NWNX_GetReturnValueInt(); + data.iCustom18 = NWNX_GetReturnValueInt(); + data.iCustom19 = NWNX_GetReturnValueInt(); return data; } @@ -153,6 +230,25 @@ void NWNX_Damage_SetDamageEventData(struct NWNX_Damage_DamageEventData data) { string sFunc = "SetDamageEventData"; + NWNX_PushArgumentInt(data.iCustom19); + NWNX_PushArgumentInt(data.iCustom18); + NWNX_PushArgumentInt(data.iCustom17); + NWNX_PushArgumentInt(data.iCustom16); + NWNX_PushArgumentInt(data.iCustom15); + NWNX_PushArgumentInt(data.iCustom14); + NWNX_PushArgumentInt(data.iCustom13); + NWNX_PushArgumentInt(data.iCustom12); + NWNX_PushArgumentInt(data.iCustom11); + NWNX_PushArgumentInt(data.iCustom10); + NWNX_PushArgumentInt(data.iCustom9); + NWNX_PushArgumentInt(data.iCustom8); + NWNX_PushArgumentInt(data.iCustom7); + NWNX_PushArgumentInt(data.iCustom6); + NWNX_PushArgumentInt(data.iCustom5); + NWNX_PushArgumentInt(data.iCustom4); + NWNX_PushArgumentInt(data.iCustom3); + NWNX_PushArgumentInt(data.iCustom2); + NWNX_PushArgumentInt(data.iCustom1); NWNX_PushArgumentInt(data.iBase); NWNX_PushArgumentInt(data.iSonic); NWNX_PushArgumentInt(data.iPositive); @@ -202,6 +298,25 @@ struct NWNX_Damage_AttackEventData NWNX_Damage_GetAttackEventData() data.iPositive = NWNX_GetReturnValueInt(); data.iSonic = NWNX_GetReturnValueInt(); data.iBase = NWNX_GetReturnValueInt(); + data.iCustom1 = NWNX_GetReturnValueInt(); + data.iCustom2 = NWNX_GetReturnValueInt(); + data.iCustom3 = NWNX_GetReturnValueInt(); + data.iCustom4 = NWNX_GetReturnValueInt(); + data.iCustom5 = NWNX_GetReturnValueInt(); + data.iCustom6 = NWNX_GetReturnValueInt(); + data.iCustom7 = NWNX_GetReturnValueInt(); + data.iCustom8 = NWNX_GetReturnValueInt(); + data.iCustom9 = NWNX_GetReturnValueInt(); + data.iCustom10 = NWNX_GetReturnValueInt(); + data.iCustom11 = NWNX_GetReturnValueInt(); + data.iCustom12 = NWNX_GetReturnValueInt(); + data.iCustom13 = NWNX_GetReturnValueInt(); + data.iCustom14 = NWNX_GetReturnValueInt(); + data.iCustom15 = NWNX_GetReturnValueInt(); + data.iCustom16 = NWNX_GetReturnValueInt(); + data.iCustom17 = NWNX_GetReturnValueInt(); + data.iCustom18 = NWNX_GetReturnValueInt(); + data.iCustom19 = NWNX_GetReturnValueInt(); data.iAttackNumber = NWNX_GetReturnValueInt(); data.iAttackResult = NWNX_GetReturnValueInt(); data.iWeaponAttackType = NWNX_GetReturnValueInt(); @@ -218,7 +333,27 @@ void NWNX_Damage_SetAttackEventData(struct NWNX_Damage_AttackEventData data) { string sFunc = "SetAttackEventData"; + NWNX_PushArgumentInt(data.iSneakAttack); NWNX_PushArgumentInt(data.iAttackResult); + NWNX_PushArgumentInt(data.iCustom19); + NWNX_PushArgumentInt(data.iCustom18); + NWNX_PushArgumentInt(data.iCustom17); + NWNX_PushArgumentInt(data.iCustom16); + NWNX_PushArgumentInt(data.iCustom15); + NWNX_PushArgumentInt(data.iCustom14); + NWNX_PushArgumentInt(data.iCustom13); + NWNX_PushArgumentInt(data.iCustom12); + NWNX_PushArgumentInt(data.iCustom11); + NWNX_PushArgumentInt(data.iCustom10); + NWNX_PushArgumentInt(data.iCustom9); + NWNX_PushArgumentInt(data.iCustom8); + NWNX_PushArgumentInt(data.iCustom7); + NWNX_PushArgumentInt(data.iCustom6); + NWNX_PushArgumentInt(data.iCustom5); + NWNX_PushArgumentInt(data.iCustom4); + NWNX_PushArgumentInt(data.iCustom3); + NWNX_PushArgumentInt(data.iCustom2); + NWNX_PushArgumentInt(data.iCustom1); NWNX_PushArgumentInt(data.iBase); NWNX_PushArgumentInt(data.iSonic); NWNX_PushArgumentInt(data.iPositive); @@ -242,6 +377,26 @@ void NWNX_Damage_DealDamage(struct NWNX_Damage_DamageData data, object oTarget, NWNX_PushArgumentInt(iRanged); NWNX_PushArgumentInt(data.iPower); + NWNX_PushArgumentInt(data.iCustom19); + NWNX_PushArgumentInt(data.iCustom18); + NWNX_PushArgumentInt(data.iCustom17); + NWNX_PushArgumentInt(data.iCustom16); + NWNX_PushArgumentInt(data.iCustom15); + NWNX_PushArgumentInt(data.iCustom14); + NWNX_PushArgumentInt(data.iCustom13); + NWNX_PushArgumentInt(data.iCustom12); + NWNX_PushArgumentInt(data.iCustom11); + NWNX_PushArgumentInt(data.iCustom10); + NWNX_PushArgumentInt(data.iCustom9); + NWNX_PushArgumentInt(data.iCustom8); + NWNX_PushArgumentInt(data.iCustom7); + NWNX_PushArgumentInt(data.iCustom6); + NWNX_PushArgumentInt(data.iCustom5); + NWNX_PushArgumentInt(data.iCustom4); + NWNX_PushArgumentInt(data.iCustom3); + NWNX_PushArgumentInt(data.iCustom2); + NWNX_PushArgumentInt(data.iCustom1); + NWNX_PushArgumentInt(0);// Padding for Base Damage NWNX_PushArgumentInt(data.iSonic); NWNX_PushArgumentInt(data.iPositive); NWNX_PushArgumentInt(data.iNegative); diff --git a/_module/nss/nwnx_deprecated.nss b/_module/nss/nwnx_deprecated.nss new file mode 100644 index 00000000..f3be16cf --- /dev/null +++ b/_module/nss/nwnx_deprecated.nss @@ -0,0 +1,483 @@ +// The following functions have been removed from NWNX, please replace them with their basegame implementation! +// To use this file, include it to nwnx.nss and recompile all your scripts. + +// *** NWNX_Creature + +/// @name Cleric Domains +/// @anchor cleric_domains +/// +/// The clerical domains. +/// @{ +const int NWNX_CREATURE_CLERIC_DOMAIN_AIR = 0; +const int NWNX_CREATURE_CLERIC_DOMAIN_ANIMAL = 1; +const int NWNX_CREATURE_CLERIC_DOMAIN_DEATH = 3; +const int NWNX_CREATURE_CLERIC_DOMAIN_DESTRUCTION = 4; +const int NWNX_CREATURE_CLERIC_DOMAIN_EARTH = 5; +const int NWNX_CREATURE_CLERIC_DOMAIN_EVIL = 6; +const int NWNX_CREATURE_CLERIC_DOMAIN_FIRE = 7; +const int NWNX_CREATURE_CLERIC_DOMAIN_GOOD = 8; +const int NWNX_CREATURE_CLERIC_DOMAIN_HEALING = 9; +const int NWNX_CREATURE_CLERIC_DOMAIN_KNOWLEDGE = 10; +const int NWNX_CREATURE_CLERIC_DOMAIN_MAGIC = 13; +const int NWNX_CREATURE_CLERIC_DOMAIN_PLANT = 14; +const int NWNX_CREATURE_CLERIC_DOMAIN_PROTECTION = 15; +const int NWNX_CREATURE_CLERIC_DOMAIN_STRENGTH = 16; +const int NWNX_CREATURE_CLERIC_DOMAIN_SUN = 17; +const int NWNX_CREATURE_CLERIC_DOMAIN_TRAVEL = 18; +const int NWNX_CREATURE_CLERIC_DOMAIN_TRICKERY = 19; +const int NWNX_CREATURE_CLERIC_DOMAIN_WAR = 20; +const int NWNX_CREATURE_CLERIC_DOMAIN_WATER = 21; +/// @} + +/// @struct NWNX_Creature_MemorisedSpell +/// @brief A memorised spell structure. +struct NWNX_Creature_MemorisedSpell +{ + int id; ///< Spell ID + int ready; ///< Whether the spell can be cast + int meta; ///< Metamagic type, if any + int domain; ///< Clerical domain, if any +}; + +/// @brief Gets the count of memorised spells for a creature's class at a level. +/// @param creature The creature object. +/// @param class The class id from classes.2da. (Not class index 0-2) +/// @param level The spell level. +/// @return The memorised spell count. +int NWNX_Creature_GetMemorisedSpellCountByLevel(object creature, int class, int level); + +/// @brief Gets the memorised spell at a class level's index. +/// @param creature The creature object. +/// @param class The class id from classes.2da. (Not class index 0-2) +/// @param level The spell level. +/// @param index The index. Index bounds: 0 <= index < NWNX_Creature_GetMemorisedSpellCountByLevel(). +/// @return An NWNX_Creature_MemorisedSpell() struct. +struct NWNX_Creature_MemorisedSpell NWNX_Creature_GetMemorisedSpell(object creature, int class, int level, int index); + +/// @brief Sets the memorised spell at a class level's index. +/// @param creature The creature object. +/// @param class The class id from classes.2da. (Not class index 0-2) +/// @param level The spell level. +/// @param index The index. Index bounds: 0 <= index < NWNX_Creature_GetMemorisedSpellCountByLevel(). +/// @param spell An NWNX_Creature_MemorisedSpell() struct. +void NWNX_Creature_SetMemorisedSpell(object creature, int class, int level, int index, struct NWNX_Creature_MemorisedSpell spell); + +/// @brief Gets the known spell count (innate casting) at a class level. +/// @param creature The creature object. +/// @param class The class id from classes.2da. (Not class index 0-2) +/// @param level The spell level. +/// @return The known spell count. +int NWNX_Creature_GetKnownSpellCount(object creature, int class, int level); + +/// @brief Gets the known spell at a class level's index. +/// @param creature The creature object. +/// @param class The class id from classes.2da. (Not class index 0-2) +/// @param level The spell level. +/// @param index The index. Index bounds: 0 <= index < NWNX_Creature_GetKnownSpellCount(). +/// @return The spell id. +int NWNX_Creature_GetKnownSpell(object creature, int class, int level, int index); + +/// @brief Clear a specific spell from the creature's spellbook for class +/// @param creature The creature object. +/// @param class The class id from classes.2da. (Not class index 0-2) +/// @param spellId The spell to clear. +void NWNX_Creature_ClearMemorisedKnownSpells(object creature, int class, int spellId); + +/// @brief Clear the memorised spell of the creature for the class, level and index. +/// @param creature The creature object. +/// @param class The class id from classes.2da. (Not class index 0-2) +/// @param level The spell level. +/// @param index The index. Index bounds: 0 <= index < NWNX_Creature_GetMemorisedSpellCountByLevel(). +void NWNX_Creature_ClearMemorisedSpell(object creature, int class, int level, int index); + +/// @brief Get the soundset index for creature. +/// @param creature The creature object. +/// @return The soundset used by the creature. +int NWNX_Creature_GetSoundset(object creature); + +/// @brief Set the soundset index for creature. +/// @param creature The creature object. +/// @param soundset The soundset index. +void NWNX_Creature_SetSoundset(object creature, int soundset); + +/// @brief Sets the creature gender. +/// @param creature The creature object. +/// @param gender The GENDER_ constant. +void NWNX_Creature_SetGender(object creature, int gender); + +/// @brief Restore all creature spells per day for given level. +/// @param creature The creature object. +/// @param level The level to restore. If -1, all spells are restored. +void NWNX_Creature_RestoreSpells(object creature, int level = -1); + +/// @brief Gets one of creature's domains. +/// @param creature The creature object. +/// @param class The class id from classes.2da. (Not class index 0-2) +/// @param index The first or second domain. +/// @deprecated Use GetDomain(). This will be removed in future NWNX releases. +int NWNX_Creature_GetDomain(object creature, int class, int index); + +/// @brief Gets the creature's specialist school. +/// @param creature The creature object. +/// @param class The class id from classes.2da. (Not class index 0-2) +/// @deprecated Use GetSpecialization(). This will be removed in future NWNX releases. +int NWNX_Creature_GetSpecialization(object creature, int class); + +/// @brief Get the number of uses left of a spell. +/// @note This function is for caster classes that don't need to memorize spells. +/// @param oCreature The creature. +/// @param nSpellID The spell ID. +/// @param nMultiClass The position of the class to check, 0-2 +/// @param nDomainLevel The domain level if checking a domain spell. +/// @param nMetaMagic A METAMAGIC_* constant. +/// @return The number of spell uses left or 0 on error. +int NWNX_Creature_GetSpellUsesLeft(object oCreature, int nSpellID, int nMultiClass, int nDomainLevel = 0, int nMetaMagic = METAMAGIC_NONE); + +/// @brief Get the number of memorized ready spells by spellid. +/// @note This function is for caster classes that need to memorize spells. +/// @param oCreature The creature. +/// @param nSpellID The spell ID. +/// @param nMultiClass The position of the class to check, 0-2 +/// @param nMetaMagic A METAMAGIC_* constant. +/// @return The number of spell uses left or 0 on error. +int NWNX_Creature_GetMemorizedSpellReadyCount(object oCreature, int nSpellID, int nMultiClass, int nMetaMagic = METAMAGIC_NONE); + +/// @brief Set whether an effect icon is flashing or not. +/// @param oCreature The target creature. +/// @param nIconId The icon id, see effecticons.2da. +/// @param bFlashing TRUE for flashing, FALSE for not flashing. +void NWNX_Creature_SetEffectIconFlashing(object oCreature, int nIconId, int bFlashing); + +int NWNX_Creature_GetMemorisedSpellCountByLevel(object creature, int class, int level) +{ + WriteTimestampedLogEntry("WARNING: Calling deprecated NWNX Function: NWNX_Creature_GetMemorisedSpellCountByLevel"); + return GetMemorizedSpellCountByLevel(creature, class, level); +} + +struct NWNX_Creature_MemorisedSpell NWNX_Creature_GetMemorisedSpell(object creature, int class, int level, int index) +{ + WriteTimestampedLogEntry("WARNING: Calling deprecated NWNX Function: NWNX_Creature_GetMemorisedSpell"); + struct NWNX_Creature_MemorisedSpell spell; + spell.domain = GetMemorizedSpellIsDomainSpell(creature, class, level, index); + spell.meta = GetMemorizedSpellMetaMagic(creature, class, level, index); + spell.ready = GetMemorizedSpellReady(creature, class, level, index); + spell.id = GetMemorizedSpellId(creature, class, level, index); + return spell; +} + +void NWNX_Creature_SetMemorisedSpell(object creature, int class, int level, int index, struct NWNX_Creature_MemorisedSpell spell) +{ + WriteTimestampedLogEntry("WARNING: Calling deprecated NWNX Function: NWNX_Creature_SetMemorisedSpell"); + SetMemorizedSpell(creature, class, level, index, spell.id, spell.ready, spell.meta, spell.domain); +} + +int NWNX_Creature_GetKnownSpellCount(object creature, int class, int level) +{ + WriteTimestampedLogEntry("WARNING: Calling deprecated NWNX Function: NWNX_Creature_GetKnownSpellCount"); + return GetKnownSpellCount(creature, class, level); +} + +int NWNX_Creature_GetKnownSpell(object creature, int class, int level, int index) +{ + WriteTimestampedLogEntry("WARNING: Calling deprecated NWNX Function: NWNX_Creature_GetKnownSpell"); + return GetKnownSpellId(creature, class, level, index); +} + +void NWNX_Creature_ClearMemorisedKnownSpells(object creature, int class, int spellId) +{ + WriteTimestampedLogEntry("WARNING: Calling deprecated NWNX Function: NWNX_Creature_ClearMemorisedKnownSpells"); + ClearMemorizedSpellBySpellId(creature, class, spellId); +} + +void NWNX_Creature_ClearMemorisedSpell(object creature, int class, int level, int index) +{ + WriteTimestampedLogEntry("WARNING: Calling deprecated NWNX Function: NWNX_Creature_ClearMemorisedSpell"); + ClearMemorizedSpell(creature, class, level, index); +} + +int NWNX_Creature_GetSoundset(object creature) +{ + WriteTimestampedLogEntry("WARNING: Calling deprecated NWNX Function: NWNX_Creature_GetSoundset"); + return GetSoundset(creature); +} + +void NWNX_Creature_SetSoundset(object creature, int soundset) +{ + WriteTimestampedLogEntry("WARNING: Calling deprecated NWNX Function: NWNX_Creature_SetSoundset"); + SetSoundset(creature, soundset); +} + +void NWNX_Creature_SetGender(object creature, int gender) +{ + WriteTimestampedLogEntry("WARNING: Calling deprecated NWNX Function: NWNX_Creature_SetGender"); + SetGender(creature, gender); +} + +void NWNX_Creature_RestoreSpells(object creature, int level = -1) +{ + WriteTimestampedLogEntry("WARNING: Calling deprecated NWNX Function: NWNX_Creature_RestoreSpells"); + if (level == -1) + { + int i; + for (i = 0; i < 10; i++) + { + ReadySpellLevel(creature, i); + } + } + else + ReadySpellLevel(creature, level); + +} + +int NWNX_Creature_GetDomain(object creature, int class, int index) +{ + WriteTimestampedLogEntry("WARNING: Calling deprecated NWNX Function: NWNX_Creature_GetDomain"); + return GetDomain(creature, index, class); +} + +int NWNX_Creature_GetSpecialization(object creature, int class) +{ + WriteTimestampedLogEntry("WARNING: Calling deprecated NWNX Function: NWNX_Creature_GetSpecialization"); + return GetSpecialization(creature, class); +} + +int NWNX_Creature_GetSpellUsesLeft(object oCreature, int nSpellID, int nMultiClass, int nDomainLevel = 0, int nMetaMagic = METAMAGIC_NONE) +{ + WriteTimestampedLogEntry("WARNING: Calling deprecated NWNX Function: NWNX_Creature_GetSpellUsesLeft"); + return GetSpellUsesLeft(oCreature, GetClassByPosition(nMultiClass + 1), nSpellID, nMetaMagic, nDomainLevel); +} + +int NWNX_Creature_GetMemorizedSpellReadyCount(object oCreature, int nSpellID, int nMultiClass, int nMetaMagic = METAMAGIC_NONE) +{ + WriteTimestampedLogEntry("WARNING: Calling deprecated NWNX Function: NWNX_Creature_GetMemorizedSpellReadyCount"); + return GetSpellUsesLeft(oCreature, GetClassByPosition(nMultiClass + 1), nSpellID, nMetaMagic); +} + +void NWNX_Creature_SetEffectIconFlashing(object oCreature, int nIconId, int bFlashing) +{ + WriteTimestampedLogEntry("WARNING: Calling deprecated NWNX Function: NWNX_Creature_SetEffectIconFlashing"); + SetEffectIconFlashing(oCreature, nIconId, bFlashing); +} + +// *** NWNX_Effect + +/// @brief Set a script with optional data that runs when an effect expires +/// @param e The effect. +/// @param script The script to run when the effect expires. +/// @param data Any other data you wish to send back to the script. +/// @remark OBJECT_SELF in the script is the object the effect is applied to. +/// @note Only works for TEMPORARY and PERMANENT effects applied to an object. +effect NWNX_Effect_SetEffectExpiredScript(effect e, string script, string data = ""); + +/// @brief Get the data set with NWNX_Effect_SetEffectExpiredScript() +/// @note Should only be called from a script set with NWNX_Effect_SetEffectExpiredScript(). +/// @return The data attached to the effect. +string NWNX_Effect_GetEffectExpiredData(); + +/// @brief Get the effect creator. +/// @note Should only be called from a script set with NWNX_Effect_SetEffectExpiredScript(). +/// @return The object from which the effect originated. +object NWNX_Effect_GetEffectExpiredCreator(); + +/// @brief Accessorize an EffectVisualEffect(), making it undispellable and unable to be removed by resting or death. +/// @note If linked with a non-visualeffect or a non-accessorized visualeffect it *will* get removed. +/// @param eEffect An EffectVisualEffect(), does not work for other effect types. +/// @return The accessorized effect or an unchanged effect if not an EffectVisualEffect(). +effect NWNX_Effect_AccessorizeVisualEffect(effect eEffect); + +effect NWNX_Effect_SetEffectExpiredScript(effect e, string script, string data = "") +{ + WriteTimestampedLogEntry("WARNING: Calling deprecated NWNX Function: NWNX_Effect_SetEffectExpiredScript"); + return EffectLinkEffects(EffectRunScript("", script, "", 0.0f, data), e); +} + +string NWNX_Effect_GetEffectExpiredData() +{ + WriteTimestampedLogEntry("WARNING: Calling deprecated NWNX Function: NWNX_Effect_GetEffectExpiredData"); + return GetEffectString(GetLastRunScriptEffect(), 0); +} + +object NWNX_Effect_GetEffectExpiredCreator() +{ + WriteTimestampedLogEntry("WARNING: Calling deprecated NWNX Function: NWNX_Effect_GetEffectExpiredCreator"); + return GetEffectCreator(GetLastRunScriptEffect()); +} + +effect NWNX_Effect_AccessorizeVisualEffect(effect eEffect) +{ + WriteTimestampedLogEntry("WARNING: Calling deprecated NWNX Function: NWNX_Effect_AccessorizeVisualEffect"); + if (GetEffectType(eEffect) == EFFECT_TYPE_VISUALEFFECT) + return UnyieldingEffect(eEffect); + else + return eEffect; +} + +// *** NWNX_Object + +/// @brief Convert an object id to the actual object. +/// @param id The object id. +/// @return An object from the provided object ID. +/// @remark This is the counterpart to ObjectToString. +/// @deprecated Use the basegame StringToObject() function. This will be removed in a future NWNX release. +object NWNX_Object_StringToObject(string id); + +/// @brief Check if an item can fit in an object's inventory. +/// @param obj The object with an inventory. +/// @param baseitem The base item id to check for a fit. +/// @return TRUE if an item of base item type can fit in object's inventory +int NWNX_Object_CheckFit(object obj, int baseitem); + +/// @brief Add an effect to an object that displays an icon and has no other effect. +/// @remark See effecticons.2da for a list of possible effect icons. +/// @param obj The object to apply the effect. +/// @param nIcon The icon id. +/// @param fDuration If specified the effect will be temporary and last this length in seconds, otherwise the effect +/// will be permanent. +void NWNX_Object_AddIconEffect(object obj, int nIcon, float fDuration=0.0); + +/// @brief Remove an icon effect from an object that was added by the NWNX_Object_AddIconEffect() function. +/// @param obj The object. +/// @param nIcon The icon id. +void NWNX_Object_RemoveIconEffect(object obj, int nIcon); + +/// @brief Cause oObject to face fDirection. +/// @note This function is almost identical to SetFacing(), the only difference being that it allows you to specify +/// the target object without the use of AssignCommand(). This is useful when you want to change the facing of an object +/// in an ExecuteScriptChunk() call where AssignCommand() does not work. +/// @param oObject The object to change its facing of +/// @param fDirection The direction the object should face +void NWNX_Object_SetFacing(object oObject, float fDirection); + +object NWNX_Object_StringToObject(string id) +{ + WriteTimestampedLogEntry("WARNING: Calling deprecated NWNX Function: NWNX_Object_StringToObject"); + return StringToObject(id); +} + +int NWNX_Object_CheckFit(object obj, int baseitem) +{ + WriteTimestampedLogEntry("WARNING: Calling deprecated NWNX Function: NWNX_Object_CheckFit"); + return GetBaseItemFitsInInventory(baseitem, obj); +} + +void NWNX_Object_AddIconEffect(object obj, int nIcon, float fDuration=0.0) +{ + WriteTimestampedLogEntry("WARNING: Calling deprecated NWNX Function: NWNX_Object_AddIconEffect"); + effect eEffect = GetFirstEffect(obj); + while (GetIsEffectValid(eEffect)) + { + if (GetEffectTag(eEffect) == "NWNX_Object_IconEffect" && GetEffectInteger(eEffect, 0) == nIcon) + RemoveEffect(obj, eEffect); + eEffect = GetNextEffect(obj); + } + + effect eIcon = TagEffect(SupernaturalEffect(EffectIcon(nIcon)), "NWNX_Object_IconEffect"); + ApplyEffectToObject(fDuration == 0.0 ? DURATION_TYPE_PERMANENT : DURATION_TYPE_TEMPORARY, eIcon, obj, fDuration); +} + +void NWNX_Object_RemoveIconEffect(object obj, int nIcon) +{ + WriteTimestampedLogEntry("WARNING: Calling deprecated NWNX Function: NWNX_Object_RemoveIconEffect"); + effect eEffect = GetFirstEffect(obj); + while (GetIsEffectValid(eEffect)) + { + if (GetEffectTag(eEffect) == "NWNX_Object_IconEffect" && GetEffectInteger(eEffect, 0) == nIcon) + RemoveEffect(obj, eEffect); + eEffect = GetNextEffect(obj); + } +} + +void NWNX_Object_SetFacing(object oObject, float fDirection) +{ + WriteTimestampedLogEntry("WARNING: Calling deprecated NWNX Function: NWNX_Object_SetFacing"); + AssignCommand(oObject, SetFacing(fDirection)); +} + +// *** NWNX_Regex + +/// @param str The string to search. +/// @param regex The regular expression to use when searching. +/// @return TRUE if string matches the regular expression. +int NWNX_Regex_Search(string str, string regex); + +/// @brief Replaces any matches of the regular expression with a string. +/// @param str The string to search. +/// @param regex The regular expression to use when searching. +/// @param replace The string to replace the matches with. +/// @param firstOnly Set to TRUE to only replace the first match. +/// @return A new string with any replacements made. +string NWNX_Regex_Replace(string str, string regex, string replace = "", int firstOnly = FALSE); + +/// @brief Returns all matches in a string that match the regular expression. +/// @param str The string to search. +/// @param regex The regular expression to use. +/// @return A json array with json arrays of all (sub)matches. Returns JsonNull() on error. +json NWNX_Regex_Match(string str, string regex); + +int NWNX_Regex_Search(string str, string regex) +{ + WriteTimestampedLogEntry("WARNING: Calling deprecated NWNX Function: NWNX_Regex_Search"); + return JsonGetLength(RegExpMatch(regex, str)); +} + +string NWNX_Regex_Replace(string str, string regex, string replace="", int firstOnly=0) +{ + WriteTimestampedLogEntry("WARNING: Calling deprecated NWNX Function: NWNX_Regex_Replace"); + return RegExpReplace(regex, str, replace, firstOnly ? REGEXP_FORMAT_FIRST_ONLY : REGEXP_FORMAT_DEFAULT); +} + +json NWNX_Regex_Match(string str, string regex) +{ + WriteTimestampedLogEntry("WARNING: Calling deprecated NWNX Function: NWNX_Regex_Match"); + return RegExpIterate(regex, str); +} + +// *** NWNX_Util + +/// @brief Determines if the supplied resref exists. +/// @param resref The resref to check. +/// @param type The @ref resref_types "Resref Type". +/// @return TRUE/FALSE +int NWNX_Util_IsValidResRef(string resref, int type = RESTYPE_UTC); + +/// @anchor twoda_row_count +/// @brief Gets the row count for a 2da. +/// @param str The 2da to check (do not include the .2da). +/// @return The amount of rows in the 2da. +int NWNX_Util_Get2DARowCount(string str); + +/// @brief Gets the contents of a .nss script file as a string. +/// @param sScriptName The name of the script to get the contents of. +/// @param nMaxLength The max length of the return string, -1 to get everything +/// @return The script file contents or "" on error. +string NWNX_Util_GetNSSContents(string sScriptName, int nMaxLength = -1); + +/// @brief Get the ticks per second of the server. +/// @remark Useful to dynamically detect lag and adjust behavior accordingly. +/// @return The ticks per second. +int NWNX_Util_GetServerTicksPerSecond(); + +int NWNX_Util_IsValidResRef(string resref, int type = RESTYPE_UTC) +{ + WriteTimestampedLogEntry("WARNING: Calling deprecated NWNX Function: NWNX_Util_IsValidResRef"); + return ResManGetAliasFor(resref, type) != ""; +} + +int NWNX_Util_Get2DARowCount(string str) +{ + WriteTimestampedLogEntry("WARNING: Calling deprecated NWNX Function: NWNX_Util_Get2DARowCount"); + return Get2DARowCount(str); +} + +string NWNX_Util_GetNSSContents(string sScriptName, int nMaxLength = -1) +{ + WriteTimestampedLogEntry("WARNING: Calling deprecated NWNX Function: NWNX_Util_GetNSSContents"); + string s = ResManGetFileContents(sScriptName, RESTYPE_NSS); + return nMaxLength == -1 ? s : GetStringLeft(s, nMaxLength); +} + +int NWNX_Util_GetServerTicksPerSecond() +{ + WriteTimestampedLogEntry("WARNING: Calling deprecated NWNX Function: NWNX_Util_GetServerTicksPerSecond"); + return GetTickRate(); +} diff --git a/_module/nss/nwnx_effect.nss b/_module/nss/nwnx_effect.nss index 1acb56f8..ffb619ba 100644 --- a/_module/nss/nwnx_effect.nss +++ b/_module/nss/nwnx_effect.nss @@ -6,6 +6,20 @@ const string NWNX_Effect = "NWNX_Effect"; ///< @private +/// EQUIPPED effects are always associated with a slotted item: +/// Setting this duration type requires the effect creator +/// to be set to the (already equipped) item that should remove +/// this effect when unequipped. +/// Removal behaviour for effects where the creator is NOT a equipped +/// item is undefined. +/// They are not removed by resting, cannot be dispelled, etc. +const int DURATION_TYPE_EQUIPPED = 3; + +/// These are feat/racial effects used internally by the game to +/// implement things like movement speed changes and darkvision. +/// They cannot be removed by resting, dispelling, etc. +const int DURATION_TYPE_INNATE = 4; + /// An unpacked effect struct NWNX_EffectUnpacked { @@ -69,24 +83,6 @@ struct NWNX_EffectUnpacked NWNX_Effect_UnpackEffect(effect e); /// @return The effect. effect NWNX_Effect_PackEffect(struct NWNX_EffectUnpacked e); -/// @brief Set a script with optional data that runs when an effect expires -/// @param e The effect. -/// @param script The script to run when the effect expires. -/// @param data Any other data you wish to send back to the script. -/// @remark OBJECT_SELF in the script is the object the effect is applied to. -/// @note Only works for TEMPORARY and PERMANENT effects applied to an object. -effect NWNX_Effect_SetEffectExpiredScript(effect e, string script, string data = ""); - -/// @brief Get the data set with NWNX_Effect_SetEffectExpiredScript() -/// @note Should only be called from a script set with NWNX_Effect_SetEffectExpiredScript(). -/// @return The data attached to the effect. -string NWNX_Effect_GetEffectExpiredData(); - -/// @brief Get the effect creator. -/// @note Should only be called from a script set with NWNX_Effect_SetEffectExpiredScript(). -/// @return The object from which the effect originated. -object NWNX_Effect_GetEffectExpiredCreator(); - /// @brief replace an already applied effect on an object /// Only duration, subtype, tag and spell related fields can be overwritten. /// @note eNew and eOld need to have the same type. @@ -122,11 +118,28 @@ int NWNX_Effect_RemoveEffectById(object oObject, string sID); /// @param oObject The object to apply it to. void NWNX_Effect_Apply(effect eEffect, object oObject); -/// @brief Accessorize an EffectVisualEffect(), making it undispellable and unable to be removed by resting or death. -/// @note If linked with a non-visualeffect or a non-accessorized visualeffect it *will* get removed. -/// @param eEffect An EffectVisualEffect(), does not work for other effect types. -/// @return The accessorized effect or an unchanged effect if not an EffectVisualEffect(). -effect NWNX_Effect_AccessorizeVisualEffect(effect eEffect); +/// @brief Sets an effect creator. +/// @param eEffect The effect to be modified. +/// @param oObject The effect creator. +/// @return The effect with creator field set. +effect NWNX_Effect_SetEffectCreator(effect eEffect, object oObject); + +/// @brief Checks if the given effect is valid. Unlike the game builtin, this call considers internal types too. +/// @param eEffect The effect to check +/// @return TRUE if the effect is valid (including internal types). +int NWNX_Effect_GetIsEffectValid(effect eEffect); + +/// @brief Returns the number of applied effects on the given object. +/// @param oObject The object to get the applied effect count for. +/// @return The number of applied effects, including internal. +int NWNX_Effect_GetAppliedEffectCount(object oObject); + +/// @brief Returns the nNth applied effect on a object. +/// @param oObject The object to get the applied effect copy for. +/// @param nNth The effect index to get. +/// @note Make sure to check with NWNX_Effect_GetIsEffectValid, as this iterator also includes internal effects. +/// @return A copy of the applied game effect, or a invalid effect. +effect NWNX_Effect_GetAppliedEffect(object oObject, int nNth); /// @} @@ -281,37 +294,6 @@ effect NWNX_Effect_PackEffect(struct NWNX_EffectUnpacked e) return NWNX_GetReturnValueEffect(); } -effect NWNX_Effect_SetEffectExpiredScript(effect e, string script, string data = "") -{ - string sFunc = "SetEffectExpiredScript"; - - NWNX_PushArgumentString(data); - NWNX_PushArgumentString(script); - NWNX_PushArgumentEffect(e); - - NWNX_CallFunction(NWNX_Effect, sFunc); - - return NWNX_GetReturnValueEffect(); -} - -string NWNX_Effect_GetEffectExpiredData() -{ - string sFunc = "GetEffectExpiredData"; - - NWNX_CallFunction(NWNX_Effect, sFunc); - - return NWNX_GetReturnValueString(); -} - -object NWNX_Effect_GetEffectExpiredCreator() -{ - string sFunc = "GetEffectExpiredCreator"; - - NWNX_CallFunction(NWNX_Effect, sFunc); - - return NWNX_GetReturnValueObject(); -} - int NWNX_Effect_ReplaceEffect(object obj, effect eOld, effect eNew) { string sFunc = "ReplaceEffect"; @@ -373,10 +355,48 @@ void NWNX_Effect_Apply(effect eEffect, object oObject) NWNX_CallFunction(NWNX_Effect, sFunc); } -effect NWNX_Effect_AccessorizeVisualEffect(effect eEffect) +effect NWNX_Effect_SetEffectCreator(effect eEffect, object oObject) { - string sFunc = "AccessorizeVisualEffect"; + string sFunc = "SetEffectCreator"; + + NWNX_PushArgumentObject(oObject); NWNX_PushArgumentEffect(eEffect); + NWNX_CallFunction(NWNX_Effect, sFunc); + + return NWNX_GetReturnValueEffect(); +} + +int NWNX_Effect_GetIsEffectValid(effect eEffect) +{ + string sFunc = "GetIsEffectValid"; + + NWNX_PushArgumentEffect(eEffect); + + NWNX_CallFunction(NWNX_Effect, sFunc); + + return NWNX_GetReturnValueInt(); +} + +int NWNX_Effect_GetAppliedEffectCount(object oObject) +{ + string sFunc = "GetAppliedEffectCount"; + + NWNX_PushArgumentObject(oObject); + + NWNX_CallFunction(NWNX_Effect, sFunc); + + return NWNX_GetReturnValueInt(); +} + +effect NWNX_Effect_GetAppliedEffect(object oObject, int nNth) +{ + string sFunc = "GetAppliedEffect"; + + NWNX_PushArgumentInt(nNth); + NWNX_PushArgumentObject(oObject); + + NWNX_CallFunction(NWNX_Effect, sFunc); + return NWNX_GetReturnValueEffect(); } diff --git a/_module/nss/nwnx_elc.nss b/_module/nss/nwnx_elc.nss index f22f3b39..362bac2e 100644 --- a/_module/nss/nwnx_elc.nss +++ b/_module/nss/nwnx_elc.nss @@ -21,11 +21,8 @@ const int NWNX_ELC_VALIDATION_FAILURE_TYPE_CUSTOM = 6; /// @anchor elc_fail_subtype /// @name ELC Failure Subtypes -/// @note By default these constants are commented out to avoid a -/// limitation on constants. Uncomment them as needed. /// @{ const int NWNX_ELC_SUBTYPE_NONE = 0; -/* const int NWNX_ELC_SUBTYPE_SERVER_LEVEL_RESTRICTION = 1; const int NWNX_ELC_SUBTYPE_LEVEL_HACK = 2; const int NWNX_ELC_SUBTYPE_COLORED_NAME = 3; @@ -75,7 +72,7 @@ const int NWNX_ELC_SUBTYPE_SKILL_LIST_COMPARISON = 48; const int NWNX_ELC_SUBTYPE_FEAT_LIST_COMPARISON = 49; const int NWNX_ELC_SUBTYPE_MISC_SAVING_THROW = 50; const int NWNX_ELC_SUBTYPE_NUM_FEAT_COMPARISON = 51; - */ +const int NWNX_ELC_SUBTYPE_NUM_MULTICLASS = 52; /// @} /// @brief Sets the script that runs whenever an ELC validation failure happens diff --git a/_module/nss/nwnx_encounter.nss b/_module/nss/nwnx_encounter.nss index ab0926f1..c067de31 100644 --- a/_module/nss/nwnx_encounter.nss +++ b/_module/nss/nwnx_encounter.nss @@ -15,6 +15,9 @@ struct NWNX_Encounter_CreatureListEntry int alreadyUsed; //< Creature has already been used. }; +/// @brief Immediately destroys the specified encounter object. +/// @param encounter The encounter object. +void NWNX_Encounter_Destroy(object encounter); /// @brief Get the number of creatures in the encounter list /// @param encounter The encounter object. @@ -117,6 +120,14 @@ void NWNX_Encounter_SetGeometry(object oTrigger, string sGeometry); /// @} +void NWNX_Encounter_Destroy(object encounter) +{ + string sFunc = "Destroy"; + + NWNX_PushArgumentObject(encounter); + NWNX_CallFunction(NWNX_Encounter, sFunc); +} + int NWNX_Encounter_GetNumberOfCreaturesInEncounterList(object encounter) { string sFunc = "GetNumberOfCreaturesInEncounterList"; diff --git a/_module/nss/nwnx_events.nss b/_module/nss/nwnx_events.nss index 80db6c05..cd6ce5c8 100644 --- a/_module/nss/nwnx_events.nss +++ b/_module/nss/nwnx_events.nss @@ -488,7 +488,7 @@ _______________________________________ Event Data Tag | Type | Notes ----------------------|--------|------- STAT | int | Returns ABILITY_* constant - VALUE | int | + VALUE | int | TARGET | object | Convert to object with StringToObject() SET | int | TRUE if setting stat, FALSE if modifying @@ -533,8 +533,8 @@ _______________________________________ Event Data Tag | Type | Notes ----------------------|--------|------- TARGET | object | Convert to object with StringToObject() - FACTION_ID | int | Not the STANDARD_FACTION_* constants. See nwnx_creature->GetFaction(). - FACTION_NAME | string | + FACTION_ID | int | Not the STANDARD_FACTION_* constants. See nwnx_creature->GetFaction(). + FACTION_NAME | string | _______________________________________ ## DM Other Events @@ -580,6 +580,7 @@ _______________________________________ IP_ADDRESS | string | The IP address of the connecting client VERSION_MAJOR | int | The client's major version, eg 8193, or 0 if unavailable. VERSION_MINOR | int | The client's minor version, eg 34, or 0 if unavailable. + VERSION_POSTFIX | int | The client's postfix version, eg 37, or 0 if unavailable. PLATFORM_ID | int | The client's platform id, PLAYER_DEVICE_PLATFORM_*, or 0 if unavailable. @note Skipping the _BEFORE event will cause the client's connection to be denied. @@ -652,7 +653,7 @@ _______________________________________ Event Data Tag | Type | Notes | ----------------------|--------|-------| - SPELL_MULTICLASS | int | Index of the spell casting class (0-2) | + SPELL_MULTICLASS | int | Index of the spell casting class (0-7) | SPELL_SLOT | int | | SPELL_ID | int | | SPELL_DOMAIN | int | | @@ -669,7 +670,7 @@ _______________________________________ Event Data Tag | Type | Notes | ----------------------|--------|-------| - SPELL_MULTICLASS | int | Index of the spell casting class (0-2) | + SPELL_MULTICLASS | int | Index of the spell casting class (0-7) | SPELL_LEVEL | int | | SPELL_SLOT | int | | @@ -689,6 +690,32 @@ _______________________________________ SPELL_FEAT | int | | SPELL_SPONTANEOUS | int | | +_______________________________________ + ## Spell Failed Events + - NWNX_ON_SPELL_FAILED_BEFORE + - NWNX_ON_SPELL_FAILED_AFTER + + `OBJECT_SELF` = The creature whose spell failed + + Event Data Tag | Type | Notes | + ----------------------|--------|-------| + SPELL_ID | int | | + MULTI_CLASS | int | Index of the spell casting class (0-7) | + DOMAIN | int | | + METAMAGIC | int | | + FEAT | int | | + SPELL_SPONTANEOUS | int | | + DEFENSIVELY_CAST | int | | + TARGET_OBJECT_ID | object | Convert to object with StringToObject() | + TARGET_POSITION_X | float | | + TARGET_POSITION_Y | float | | + TARGET_POSITION_Z | float | | + IS_INSTANT_SPELL | int | | + PROJECTILE_PATH_TYPE | int | | + CASTERLEVEL | int | | + IS_FAKE | int | | + REASON | int | @ref events_spellfailreason "NWNX_EVENTS_SPELLFAIL_REASON_*" | + _______________________________________ ## Healer Kit Use Events - NWNX_ON_HEALER_KIT_BEFORE @@ -925,6 +952,17 @@ _______________________________________ BARTER_INITIATOR_ITEM_* | object | Convert to object with StringToObject(), only in _BEFORE events BARTER_TARGET_ITEM_* | object | Convert to object with StringToObject(), only in _BEFORE events +_______________________________________ + ## Barter AddItem Events + - NWNX_ON_BARTER_ADD_ITEM_BEFORE + - NWNX_ON_BARTER_ADD_ITEM_AFTER + + `OBJECT_SELF` = The player trying to add an item to the barter window + + Event Data Tag | Type | Notes + ----------------------|--------|------- + ITEM | object | The item being added + BARTER_TARGET | object | The other player involved in the barter _______________________________________ ## Trap Events - NWNX_ON_TRAP_DISARM_BEFORE @@ -945,6 +983,11 @@ _______________________________________ Event Data Tag | Type | Notes ----------------------|--------|------- TRAP_OBJECT_ID | object | Convert to object with StringToObject() + TARGET_OBJECT_ID | object | Convert to object with StringToObject(), only in SET events + TARGET_POSITION_X | float | Only in SET events + TARGET_POSITION_Y | float | Only in SET events + TARGET_POSITION_Z | float | Only in SET events + NEEDS_TO_MOVE | int | TRUE/FALSE, only in _BEFORE events (not ENTER), if TRUE another _BEFORE event will be fired before the actual interaction with the trap TRAP_FORCE_SET | int | TRUE/FALSE, only in ENTER events ACTION_RESULT | int | TRUE/FALSE, only in _AFTER events (not ENTER) @@ -1295,7 +1338,24 @@ _______________________________________ SPELL_ID | int | | MULTI_CLASS | int | | FEAT | int | 65535 if a feat wasn't used, otherwise the feat ID | + TARGET_OBJECT_ID | object | Convert to object with StringToObject() | + TARGET_POSITION_X | float | | + TARGET_POSITION_Y | float | | + TARGET_POSITION_Z | float | | + SPELL_DOMAIN | int | | + SPELL_SPONTANEOUS | int | | + SPELL_METAMAGIC | int | METAMAGIC_* | + PROJECTILE_PATH_TYPE | int | PROJECTILE_PATH_TYPE_* | + @note TARGET_OBJECT_ID, TARGET_POSITION_*, SPELL_DOMAIN, SPELL_SPONTANEOUS, SPELL_METAMAGIC, and PROJECTILE_PATH_TYPE may + be invalid if BroadcastCastSpell was called outside AIActionCastSpell. + This can be tested for by checking if TARGET_OBJECT_ID is the caster's area and if all three TARGET_POSITION_* equal 0.0. + \code{.c} + if (oTarget == GetArea(oCaster) && Vector(vX, vY, fZ) == Vector()) + { + // ... + } + \endcode _______________________________________ ## RunScript Debug Event - NWNX_ON_DEBUG_RUN_SCRIPT_BEFORE @@ -1334,12 +1394,12 @@ _______________________________________ Event Data Tag | Type | Notes ----------------------|--------|------- - TARGET_OBJECT_ID | object | Convert to object with StringToObject() - VISUAL_EFFECT | int | Index into visualeffects.2da - DURATION | float | - TARGET_POSITION_X | float | Will be 0.0 when playing visual effects on an object - TARGET_POSITION_Y | float | Will be 0.0 when playing visual effects on an object - TARGET_POSITION_Z | float | Will be 0.0 when playing visual effects on an object + TARGET_OBJECT_ID | object | Convert to object with StringToObject() + VISUAL_EFFECT | int | Index into visualeffects.2da + DURATION | float | + TARGET_POSITION_X | float | Will be 0.0 when playing visual effects on an object + TARGET_POSITION_Y | float | Will be 0.0 when playing visual effects on an object + TARGET_POSITION_Z | float | Will be 0.0 when playing visual effects on an object @note This is the `dm_visualeffect` console command. `TARGET_OBJECT_ID` will be `OBJECT_INVALID` when playing visual effects at a position in an area. @@ -1360,6 +1420,15 @@ _______________________________________ PRICE | int | The buy or sell price | RESULT | int | TRUE/FALSE whether the request was successful. Only in *_AFTER events. + @warning RESULT in NWNX_ON_STORE_REQUEST_BUY_AFTER only fails if it's due to lack of gold. It will not fail if item does not fit in player's inventory. If you want to check and fail on that condition, you can do something like this in the NWNX_ON_STORE_REQUEST_BUY_AFTER event: + ```c + if (!GetBaseItemFitsInInventory(GetBaseItemType(oItem), oPlayer)) + { + NWNX_Events_SetEventResult("0"); + return; + } + ``` + _______________________________________ ## Server Send Area Events - NWNX_ON_SERVER_SEND_AREA_BEFORE @@ -1515,7 +1584,7 @@ _______________________________________ ----------------------|--------|------- EVENT_TYPE | int | EVENT_SCRIPT_* in nwscript.nss | EVENT_SCRIPT | int | Script name running (can be empty) | - + @note This event should definitely be used with the Event ID Whitelist, which is turned on by default for this event. Until you add your EVENT_SCRIPT_ to the whitelist this event will not function: ```c @@ -1524,8 +1593,539 @@ _______________________________________ ``` @warning Toggling the Whitelist to be off for this event will degrade performance. _______________________________________ + ## Object Use Events (Placeables) + - NWNX_ON_OBJECT_USE_BEFORE + - NWNX_ON_OBJECT_USE_AFTER + + `OBJECT_SELF` = The player using the object + + Event Data Tag | Type | Notes + ----------------------|--------|------- + OBJECT | object | The Object being used | +_______________________________________ + ## Placeable Open Events (Placeables with inventory) + - NWNX_ON_PLACEABLE_OPEN_BEFORE + - NWNX_ON_PLACEABLE_OPEN_AFTER + + `OBJECT_SELF` = The placeable being openeed. + + Event Data Tag | Type | Notes + ----------------------|--------|------- + OBJECT | object | The player opening. | + BEFORE_SKIPPED | int | TRUE/FALSE, only in _AFTER events| +_______________________________________ + ## Placeable Close Events (Placeables with inventory) + - NWNX_ON_PLACEABLE_CLOSE_BEFORE + - NWNX_ON_PLACEABLE_CLOSE_AFTER + + `OBJECT_SELF` = The placeable being closed. + + Event Data Tag | Type | Notes + ----------------------|--------|------- + OBJECT | object | The player closing. | + + @note Skipping event is not allowed (since otherwise client UI will hang and be glitchy) +_______________________________________ + ## Broadcast Safe Projectile Events + - NWNX_ON_BROADCAST_SAFE_PROJECTILE_BEFORE + - NWNX_ON_BROADCAST_SAFE_PROJECTILE_AFTER + + `OBJECT_SELF` = The creature casting the spell + + Event Data Tag | Type | Notes | + ----------------------|--------|-------| + TARGET_OBJECT_ID | string | Convert to object with StringToObject() | + TARGET_POSITION_X | float | | + TARGET_POSITION_Y | float | | + TARGET_POSITION_Z | float | | + DELTA | int | Time in milliseconds before the projectile reaches its destination | + PROJECTILE_TYPE | int | @ref events_projtype "NWNX_EVENTS_BROADCAST_SAFE_PROJECTILE_TYPE_*" | + SPELL_ID | int | | + ATTACK_RESULT | int | 0=n/a, 1=hit, 2=parried, 3=critical hit, 4=miss, 5=resisted, 7=automatic hit, 8=concealed, 9=miss chance, 10=devastating crit | + PROJECTILE_PATH_TYPE | int | @nwn{Projectile_path_type,PROJECTILE_PATH_TYPE_*} | + + @note This event fires for all projectiles. It's recommended to use ID whitelists with this event. You can whitelist the event by the projectile type, spell id, or both: + \code{.c} + NWNX_Events_AddIDToWhitelist("NWNX_ON_BROADCAST_SAFE_PROJECTILE_TYPE", NWNX_EVENTS_BROADCAST_SAFE_PROJECTILE_TYPE_*); + NWNX_Events_AddIDToWhitelist("NWNX_ON_BROADCAST_SAFE_PROJECTILE_SPELL", SPELL_*); + \endcode + `TARGET_OBJECT_ID` will be `OBJECT_INVALID` if the projectile is cast at a location +_______________________________________ + ## Broadcast Attack of Opportunity Events + - NWNX_ON_BROADCAST_ATTACK_OF_OPPORTUNITY_BEFORE + - NWNX_ON_BROADCAST_ATTACK_OF_OPPORTUNITY_AFTER + + `OBJECT_SELF` = The creature broadcasting the Attack of Opportunity event + + Event Data Tag | Type | Notes + ----------------------|--------|------- + TARGET_OBJECT_ID | object | A single object the attack of opportunity is being broadcast to. Convert to object with StringToObject() | + MOVEMENT | int | Whether this attack of opportunity is being triggered from movement | +_______________________________________ + ## Combat Attack of Opportunity Events + - NWNX_ON_COMBAT_ATTACK_OF_OPPORTUNITY_BEFORE + - NWNX_ON_COMBAT_ATTACK_OF_OPPORTUNITY_AFTER + + `OBJECT_SELF` = The creature performing the Attack of Opportunity against the broadcasting target. + + Event Data Tag | Type | Notes + ----------------------|--------|------- + TARGET_OBJECT_ID | object | The target of the attack of opportunity. Convert to object with StringToObject() | + + @note If the BEFORE event is skipped the broadcasting creature will still make a tumble skill roll if moving. +_______________________________________ + ## Area Play Battle Music Events + - NWNX_ON_AREA_PLAY_BATTLE_MUSIC_BEFORE + - NWNX_ON_AREA_PLAY_BATTLE_MUSIC_AFTER + + `OBJECT_SELF` = The area playing or stopping the battle music. + + Event Data Tag | Type | Notes + ----------------------|--------|------- + PLAY | int | TRUE if the area is starting to play battle music, FALSE if stopping. | +_______________________________________ + ## Combat Attack Target Change Events + - NWNX_ON_ATTACK_TARGET_CHANGE_BEFORE + - NWNX_ON_ATTACK_TARGET_CHANGE_AFTER + + `OBJECT_SELF` = The creature changing the target its attacking. + + Event Data Tag | Type | Notes + ----------------------|--------|------- + OLD_TARGET_OBJECT_ID | object | The old attack target. OBJECT_INVALID if there was no old target. Old target may be dead/invalid. Convert to object with StringToObject() | + NEW_TARGET_OBJECT_ID | object | The new attack target. OBJECT_INVALID if there is no new target. Convert to object with StringToObject() | + AUTOMATIC_CHANGE | int | TRUE if the game automatically decided on the new target, FALSE if explicitly chosen | + RETARGETABLE | int | TRUE if the new target can be changed using NWNX_Events_SetEventResult() (Only in BEFORE) | +_______________________________________ + ## Creature Tile Change Events + - NWNX_ON_CREATURE_TILE_CHANGE_BEFORE + - NWNX_ON_CREATURE_TILE_CHANGE_AFTER + + `OBJECT_SELF` = The creature changing tile positions. + + Event Data Tag | Type | Notes + ----------------------|--------|------- + OLD_TILE_INDEX | int | The index of the old tile. | + OLD_TILE_X | int | The tile grid x position of the old tile. | + OLD_TILE_Y | int | The tile grid y position of the old tile. | + NEW_TILE_INDEX | int | The index of the new tile. | + NEW_TILE_X | int | The tile grid x position of the new tile. | + NEW_TILE_Y | int | The tile grid y position of the new tile. | +_______________________________________ + ## Creature Jump To Point Events + - NWNX_ON_CREATURE_JUMP_TO_POINT_BEFORE + - NWNX_ON_CREATURE_JUMP_TO_POINT_AFTER + + `OBJECT_SELF` = The creature jumping. + + Event Data Tag | Type | Notes + ----------------------|--------|------- + TARGET_AREA | object | The target area. Convert to object with StringToObject() | + POS_X | float | The x position the target is being moved to | + POS_Y | float | The y position the target is being moved to | + POS_Z | float | The z position the target is being moved to | +_______________________________________ + ## Creature Jump To Object Events + - NWNX_ON_CREATURE_JUMP_TO_OBJECT_BEFORE + - NWNX_ON_CREATURE_JUMP_TO_OBJECT_AFTER + + `OBJECT_SELF` = The creature jumping. + + Event Data Tag | Type | Notes + ----------------------|--------|------- + OBJECT | object | The object the creature is jumping to. Convert to object with StringToObject() | +_______________________________________ + ## Item Property Effect Apply/Remove Events + - NWNX_ON_ITEMPROPERTY_EFFECT_APPLIED_BEFORE + - NWNX_ON_ITEMPROPERTY_EFFECT_APPLIED_AFTER + - NWNX_ON_ITEMPROPERTY_EFFECT_REMOVED_BEFORE + - NWNX_ON_ITEMPROPERTY_EFFECT_REMOVED_AFTER + + `OBJECT_SELF` = The item source of the item property. + + Event Data Tag | Type | Notes + ----------------------|--------|------- + CREATURE | object | The creature to which Convert to object with StringToObject() | + LOADING_GAME | int | TRUE if the itemproperty is being applied when loading into the game and not due to equipping the item. | + INVENTORY_SLOT | int | The INVENTORY_SLOT_* the item is (un)equipped to/from. | + PROPERTY | int | The ITEM_PROPERTY_* type. | + SUBTYPE | int | The subtype of the itemproperty. | + TAG | string | The optional tag set by TagItemProperty() | + COST_TABLE | int | The index into iprp_costtable.2da | + COST_TABLE_VALUE | int | The index into the 2da pointed at by COST_TABLE | + PARAM1 | int | The index into iprp_paramtable.2da | + PARAM1_VALUE | int | The index into the 2da pointed at by PARAM1 | + + @note These events fire when the game applies or removes the effects from an itemproperty. + Skipping NWNX_ON_ITEMPROPERTY_EFFECT_APPLIED_BEFORE will stop the basegame effects for that itemproperty to not be applied. + If you skip the application of ITEM_PROPERTY_BONUS_SPELL_SLOT_OF_LEVEL_N or ITEM_PROPERTY_UNLIMITED_AMMUNITION you must also skip its removal event. + + @note Any non-DURATION_TYPE_INSTANT effects applied to the creature in NWNX_ON_ITEMPROPERTY_EFFECT_APPLIED_BEFORE **must** be of type DURATION_TYPE_EQUIPPED + See the `NWNX_EFFECT_EXTEND_DURATION_TYPE` environment variable in NWNX_Effect on how to enable this duration type. + + @note See the NWNX_Events README.md for an example script! + + @note The whitelist is enabled by default for these events, to whitelist a particular itemproperty, do the following: + \code{.c} + NWNX_Events_AddIDToWhitelist("NWNX_ON_ITEMPROPERTY_EFFECT", ITEM_PROPERTY_*); + \endcode */ -/* + +/// @name Events Event Constants +/// @anchor events_events +/// @{ +const string NWNX_ON_ADD_ASSOCIATE_BEFORE = "NWNX_ON_ADD_ASSOCIATE_BEFORE"; +const string NWNX_ON_ADD_ASSOCIATE_AFTER = "NWNX_ON_ADD_ASSOCIATE_AFTER"; +const string NWNX_ON_REMOVE_ASSOCIATE_BEFORE = "NWNX_ON_REMOVE_ASSOCIATE_BEFORE"; +const string NWNX_ON_REMOVE_ASSOCIATE_AFTER = "NWNX_ON_REMOVE_ASSOCIATE_AFTER"; +const string NWNX_ON_STEALTH_ENTER_BEFORE = "NWNX_ON_STEALTH_ENTER_BEFORE"; +const string NWNX_ON_STEALTH_ENTER_AFTER = "NWNX_ON_STEALTH_ENTER_AFTER"; +const string NWNX_ON_STEALTH_EXIT_BEFORE = "NWNX_ON_STEALTH_EXIT_BEFORE"; +const string NWNX_ON_STEALTH_EXIT_AFTER = "NWNX_ON_STEALTH_EXIT_AFTER"; +const string NWNX_ON_DETECT_ENTER_BEFORE = "NWNX_ON_DETECT_ENTER_BEFORE"; +const string NWNX_ON_DETECT_ENTER_AFTER = "NWNX_ON_DETECT_ENTER_AFTER"; +const string NWNX_ON_DETECT_EXIT_BEFORE = "NWNX_ON_DETECT_EXIT_BEFORE"; +const string NWNX_ON_DETECT_EXIT_AFTER = "NWNX_ON_DETECT_EXIT_AFTER"; +const string NWNX_ON_EXAMINE_OBJECT_BEFORE = "NWNX_ON_EXAMINE_OBJECT_BEFORE"; +const string NWNX_ON_EXAMINE_OBJECT_AFTER = "NWNX_ON_EXAMINE_OBJECT_AFTER"; +const string NWNX_ON_SET_NPC_FACTION_REPUTATION_BEFORE = "NWNX_ON_SET_NPC_FACTION_REPUTATION_BEFORE"; +const string NWNX_ON_SET_NPC_FACTION_REPUTATION_AFTER = "NWNX_ON_SET_NPC_FACTION_REPUTATION_AFTER"; +const string NWNX_ON_VALIDATE_USE_ITEM_BEFORE = "NWNX_ON_VALIDATE_USE_ITEM_BEFORE"; +const string NWNX_ON_VALIDATE_USE_ITEM_AFTER = "NWNX_ON_VALIDATE_USE_ITEM_AFTER"; +const string NWNX_ON_USE_ITEM_BEFORE = "NWNX_ON_USE_ITEM_BEFORE"; +const string NWNX_ON_USE_ITEM_AFTER = "NWNX_ON_USE_ITEM_AFTER"; +const string NWNX_ON_ITEM_INVENTORY_OPEN_BEFORE = "NWNX_ON_ITEM_INVENTORY_OPEN_BEFORE"; +const string NWNX_ON_ITEM_INVENTORY_OPEN_AFTER = "NWNX_ON_ITEM_INVENTORY_OPEN_AFTER"; +const string NWNX_ON_ITEM_INVENTORY_CLOSE_BEFORE = "NWNX_ON_ITEM_INVENTORY_CLOSE_BEFORE"; +const string NWNX_ON_ITEM_INVENTORY_CLOSE_AFTER = "NWNX_ON_ITEM_INVENTORY_CLOSE_AFTER"; +const string NWNX_ON_ITEM_AMMO_RELOAD_BEFORE = "NWNX_ON_ITEM_AMMO_RELOAD_BEFORE"; +const string NWNX_ON_ITEM_AMMO_RELOAD_AFTER = "NWNX_ON_ITEM_AMMO_RELOAD_AFTER"; +const string NWNX_ON_ITEM_SCROLL_LEARN_BEFORE = "NWNX_ON_ITEM_SCROLL_LEARN_BEFORE"; +const string NWNX_ON_ITEM_SCROLL_LEARN_AFTER = "NWNX_ON_ITEM_SCROLL_LEARN_AFTER"; +const string NWNX_ON_VALIDATE_ITEM_EQUIP_BEFORE = "NWNX_ON_VALIDATE_ITEM_EQUIP_BEFORE"; +const string NWNX_ON_VALIDATE_ITEM_EQUIP_AFTER = "NWNX_ON_VALIDATE_ITEM_EQUIP_AFTER"; +const string NWNX_ON_ITEM_EQUIP_BEFORE = "NWNX_ON_ITEM_EQUIP_BEFORE"; +const string NWNX_ON_ITEM_EQUIP_AFTER = "NWNX_ON_ITEM_EQUIP_AFTER"; +const string NWNX_ON_ITEM_UNEQUIP_BEFORE = "NWNX_ON_ITEM_UNEQUIP_BEFORE"; +const string NWNX_ON_ITEM_UNEQUIP_AFTER = "NWNX_ON_ITEM_UNEQUIP_AFTER"; +const string NWNX_ON_ITEM_DESTROY_OBJECT_BEFORE = "NWNX_ON_ITEM_DESTROY_OBJECT_BEFORE"; +const string NWNX_ON_ITEM_DESTROY_OBJECT_AFTER = "NWNX_ON_ITEM_DESTROY_OBJECT_AFTER"; +const string NWNX_ON_ITEM_DECREMENT_STACKSIZE_BEFORE = "NWNX_ON_ITEM_DECREMENT_STACKSIZE_BEFORE"; +const string NWNX_ON_ITEM_DECREMENT_STACKSIZE_AFTER = "NWNX_ON_ITEM_DECREMENT_STACKSIZE_AFTER"; +const string NWNX_ON_ITEM_USE_LORE_BEFORE = "NWNX_ON_ITEM_USE_LORE_BEFORE"; +const string NWNX_ON_ITEM_USE_LORE_AFTER = "NWNX_ON_ITEM_USE_LORE_AFTER"; +const string NWNX_ON_ITEM_PAY_TO_IDENTIFY_BEFORE = "NWNX_ON_ITEM_PAY_TO_IDENTIFY_BEFORE"; +const string NWNX_ON_ITEM_PAY_TO_IDENTIFY_AFTER = "NWNX_ON_ITEM_PAY_TO_IDENTIFY_AFTER"; +const string NWNX_ON_ITEM_SPLIT_BEFORE = "NWNX_ON_ITEM_SPLIT_BEFORE"; +const string NWNX_ON_ITEM_SPLIT_AFTER = "NWNX_ON_ITEM_SPLIT_AFTER"; +const string NWNX_ON_ITEM_MERGE_BEFORE = "NWNX_ON_ITEM_MERGE_BEFORE"; +const string NWNX_ON_ITEM_MERGE_AFTER = "NWNX_ON_ITEM_MERGE_AFTER"; +const string NWNX_ON_ITEM_ACQUIRE_BEFORE = "NWNX_ON_ITEM_ACQUIRE_BEFORE"; +const string NWNX_ON_ITEM_ACQUIRE_AFTER = "NWNX_ON_ITEM_ACQUIRE_AFTER"; +const string NWNX_ON_USE_FEAT_BEFORE = "NWNX_ON_USE_FEAT_BEFORE"; +const string NWNX_ON_USE_FEAT_AFTER = "NWNX_ON_USE_FEAT_AFTER"; +const string NWNX_ON_HAS_FEAT_BEFORE = "NWNX_ON_HAS_FEAT_BEFORE"; +const string NWNX_ON_HAS_FEAT_AFTER = "NWNX_ON_HAS_FEAT_AFTER"; +const string NWNX_ON_DM_GIVE_GOLD_BEFORE = "NWNX_ON_DM_GIVE_GOLD_BEFORE"; +const string NWNX_ON_DM_GIVE_GOLD_AFTER = "NWNX_ON_DM_GIVE_GOLD_AFTER"; +const string NWNX_ON_DM_GIVE_XP_BEFORE = "NWNX_ON_DM_GIVE_XP_BEFORE"; +const string NWNX_ON_DM_GIVE_XP_AFTER = "NWNX_ON_DM_GIVE_XP_AFTER"; +const string NWNX_ON_DM_GIVE_LEVEL_BEFORE = "NWNX_ON_DM_GIVE_LEVEL_BEFORE"; +const string NWNX_ON_DM_GIVE_LEVEL_AFTER = "NWNX_ON_DM_GIVE_LEVEL_AFTER"; +const string NWNX_ON_DM_GIVE_ALIGNMENT_BEFORE = "NWNX_ON_DM_GIVE_ALIGNMENT_BEFORE"; +const string NWNX_ON_DM_GIVE_ALIGNMENT_AFTER = "NWNX_ON_DM_GIVE_ALIGNMENT_AFTER"; +const string NWNX_ON_DM_SPAWN_OBJECT_BEFORE = "NWNX_ON_DM_SPAWN_OBJECT_BEFORE"; +const string NWNX_ON_DM_SPAWN_OBJECT_AFTER = "NWNX_ON_DM_SPAWN_OBJECT_AFTER"; +const string NWNX_ON_DM_GIVE_ITEM_BEFORE = "NWNX_ON_DM_GIVE_ITEM_BEFORE"; +const string NWNX_ON_DM_GIVE_ITEM_AFTER = "NWNX_ON_DM_GIVE_ITEM_AFTER"; +const string NWNX_ON_DM_HEAL_BEFORE = "NWNX_ON_DM_HEAL_BEFORE"; +const string NWNX_ON_DM_HEAL_AFTER = "NWNX_ON_DM_HEAL_AFTER"; +const string NWNX_ON_DM_KILL_BEFORE = "NWNX_ON_DM_KILL_BEFORE"; +const string NWNX_ON_DM_KILL_AFTER = "NWNX_ON_DM_KILL_AFTER"; +const string NWNX_ON_DM_TOGGLE_INVULNERABLE_BEFORE = "NWNX_ON_DM_TOGGLE_INVULNERABLE_BEFORE"; +const string NWNX_ON_DM_TOGGLE_INVULNERABLE_AFTER = "NWNX_ON_DM_TOGGLE_INVULNERABLE_AFTER"; +const string NWNX_ON_DM_FORCE_REST_BEFORE = "NWNX_ON_DM_FORCE_REST_BEFORE"; +const string NWNX_ON_DM_FORCE_REST_AFTER = "NWNX_ON_DM_FORCE_REST_AFTER"; +const string NWNX_ON_DM_LIMBO_BEFORE = "NWNX_ON_DM_LIMBO_BEFORE"; +const string NWNX_ON_DM_LIMBO_AFTER = "NWNX_ON_DM_LIMBO_AFTER"; +const string NWNX_ON_DM_TOGGLE_AI_BEFORE = "NWNX_ON_DM_TOGGLE_AI_BEFORE"; +const string NWNX_ON_DM_TOGGLE_AI_AFTER = "NWNX_ON_DM_TOGGLE_AI_AFTER"; +const string NWNX_ON_DM_TOGGLE_IMMORTAL_BEFORE = "NWNX_ON_DM_TOGGLE_IMMORTAL_BEFORE"; +const string NWNX_ON_DM_TOGGLE_IMMORTAL_AFTER = "NWNX_ON_DM_TOGGLE_IMMORTAL_AFTER"; +const string NWNX_ON_DM_GOTO_BEFORE = "NWNX_ON_DM_GOTO_BEFORE"; +const string NWNX_ON_DM_GOTO_AFTER = "NWNX_ON_DM_GOTO_AFTER"; +const string NWNX_ON_DM_POSSESS_BEFORE = "NWNX_ON_DM_POSSESS_BEFORE"; +const string NWNX_ON_DM_POSSESS_AFTER = "NWNX_ON_DM_POSSESS_AFTER"; +const string NWNX_ON_DM_POSSESS_FULL_POWER_BEFORE = "NWNX_ON_DM_POSSESS_FULL_POWER_BEFORE"; +const string NWNX_ON_DM_POSSESS_FULL_POWER_AFTER = "NWNX_ON_DM_POSSESS_FULL_POWER_AFTER"; +const string NWNX_ON_DM_TOGGLE_LOCK_BEFORE = "NWNX_ON_DM_TOGGLE_LOCK_BEFORE"; +const string NWNX_ON_DM_TOGGLE_LOCK_AFTER = "NWNX_ON_DM_TOGGLE_LOCK_AFTER"; +const string NWNX_ON_DM_DISABLE_TRAP_BEFORE = "NWNX_ON_DM_DISABLE_TRAP_BEFORE"; +const string NWNX_ON_DM_DISABLE_TRAP_AFTER = "NWNX_ON_DM_DISABLE_TRAP_AFTER"; +const string NWNX_ON_DM_JUMP_TO_POINT_BEFORE = "NWNX_ON_DM_JUMP_TO_POINT_BEFORE"; +const string NWNX_ON_DM_JUMP_TO_POINT_AFTER = "NWNX_ON_DM_JUMP_TO_POINT_AFTER"; +const string NWNX_ON_DM_JUMP_TARGET_TO_POINT_BEFORE = "NWNX_ON_DM_JUMP_TARGET_TO_POINT_BEFORE"; +const string NWNX_ON_DM_JUMP_TARGET_TO_POINT_AFTER = "NWNX_ON_DM_JUMP_TARGET_TO_POINT_AFTER"; +const string NWNX_ON_DM_JUMP_ALL_PLAYERS_TO_POINT_BEFORE = "NWNX_ON_DM_JUMP_ALL_PLAYERS_TO_POINT_BEFORE"; +const string NWNX_ON_DM_JUMP_ALL_PLAYERS_TO_POINT_AFTER = "NWNX_ON_DM_JUMP_ALL_PLAYERS_TO_POINT_AFTER"; +const string NWNX_ON_DM_CHANGE_DIFFICULTY_BEFORE = "NWNX_ON_DM_CHANGE_DIFFICULTY_BEFORE"; +const string NWNX_ON_DM_CHANGE_DIFFICULTY_AFTER = "NWNX_ON_DM_CHANGE_DIFFICULTY_AFTER"; +const string NWNX_ON_DM_VIEW_INVENTORY_BEFORE = "NWNX_ON_DM_VIEW_INVENTORY_BEFORE"; +const string NWNX_ON_DM_VIEW_INVENTORY_AFTER = "NWNX_ON_DM_VIEW_INVENTORY_AFTER"; +const string NWNX_ON_DM_SPAWN_TRAP_ON_OBJECT_BEFORE = "NWNX_ON_DM_SPAWN_TRAP_ON_OBJECT_BEFORE"; +const string NWNX_ON_DM_SPAWN_TRAP_ON_OBJECT_AFTER = "NWNX_ON_DM_SPAWN_TRAP_ON_OBJECT_AFTER"; +const string NWNX_ON_DM_DUMP_LOCALS_BEFORE = "NWNX_ON_DM_DUMP_LOCALS_BEFORE"; +const string NWNX_ON_DM_DUMP_LOCALS_AFTER = "NWNX_ON_DM_DUMP_LOCALS_AFTER"; +const string NWNX_ON_DM_PLAYERDM_LOGIN_BEFORE = "NWNX_ON_DM_PLAYERDM_LOGIN_BEFORE"; +const string NWNX_ON_DM_PLAYERDM_LOGIN_AFTER = "NWNX_ON_DM_PLAYERDM_LOGIN_AFTER"; +const string NWNX_ON_DM_PLAYERDM_LOGOUT_BEFORE = "NWNX_ON_DM_PLAYERDM_LOGOUT_BEFORE"; +const string NWNX_ON_DM_PLAYERDM_LOGOUT_AFTER = "NWNX_ON_DM_PLAYERDM_LOGOUT_AFTER"; +const string NWNX_ON_DM_SET_STAT_BEFORE = "NWNX_ON_DM_SET_STAT_BEFORE"; +const string NWNX_ON_DM_SET_STAT_AFTER = "NWNX_ON_DM_SET_STAT_AFTER"; +const string NWNX_ON_DM_GET_VARIABLE_BEFORE = "NWNX_ON_DM_GET_VARIABLE_BEFORE"; +const string NWNX_ON_DM_GET_VARIABLE_AFTER = "NWNX_ON_DM_GET_VARIABLE_AFTER"; +const string NWNX_ON_DM_SET_VARIABLE_BEFORE = "NWNX_ON_DM_SET_VARIABLE_BEFORE"; +const string NWNX_ON_DM_SET_VARIABLE_AFTER = "NWNX_ON_DM_SET_VARIABLE_AFTER"; +const string NWNX_ON_DM_SET_FACTION_BEFORE = "NWNX_ON_DM_SET_FACTION_BEFORE"; +const string NWNX_ON_DM_SET_FACTION_AFTER = "NWNX_ON_DM_SET_FACTION_AFTER"; +const string NWNX_ON_DM_APPEAR_BEFORE = "NWNX_ON_DM_APPEAR_BEFORE"; +const string NWNX_ON_DM_APPEAR_AFTER = "NWNX_ON_DM_APPEAR_AFTER"; +const string NWNX_ON_DM_DISAPPEAR_BEFORE = "NWNX_ON_DM_DISAPPEAR_BEFORE"; +const string NWNX_ON_DM_DISAPPEAR_AFTER = "NWNX_ON_DM_DISAPPEAR_AFTER"; +const string NWNX_ON_DM_TAKE_ITEM_BEFORE = "NWNX_ON_DM_TAKE_ITEM_BEFORE"; +const string NWNX_ON_DM_TAKE_ITEM_AFTER = "NWNX_ON_DM_TAKE_ITEM_AFTER"; +const string NWNX_ON_DM_SET_TIME_BEFORE = "NWNX_ON_DM_SET_TIME_BEFORE"; +const string NWNX_ON_DM_SET_TIME_AFTER = "NWNX_ON_DM_SET_TIME_AFTER"; +const string NWNX_ON_DM_SET_DATE_BEFORE = "NWNX_ON_DM_SET_DATE_BEFORE"; +const string NWNX_ON_DM_SET_DATE_AFTER = "NWNX_ON_DM_SET_DATE_AFTER"; +const string NWNX_ON_DM_SET_FACTION_REPUTATION_BEFORE = "NWNX_ON_DM_SET_FACTION_REPUTATION_BEFORE"; +const string NWNX_ON_DM_SET_FACTION_REPUTATION_AFTER = "NWNX_ON_DM_SET_FACTION_REPUTATION_AFTER"; +const string NWNX_ON_DM_GET_FACTION_REPUTATION_BEFORE = "NWNX_ON_DM_GET_FACTION_REPUTATION_BEFORE"; +const string NWNX_ON_DM_GET_FACTION_REPUTATION_AFTER = "NWNX_ON_DM_GET_FACTION_REPUTATION_AFTER"; +const string NWNX_ON_CLIENT_DISCONNECT_BEFORE = "NWNX_ON_CLIENT_DISCONNECT_BEFORE"; +const string NWNX_ON_CLIENT_DISCONNECT_AFTER = "NWNX_ON_CLIENT_DISCONNECT_AFTER"; +const string NWNX_ON_CLIENT_CONNECT_BEFORE = "NWNX_ON_CLIENT_CONNECT_BEFORE"; +const string NWNX_ON_CLIENT_CONNECT_AFTER = "NWNX_ON_CLIENT_CONNECT_AFTER"; +const string NWNX_ON_COMBAT_ENTER_BEFORE = "NWNX_ON_COMBAT_ENTER_BEFORE"; +const string NWNX_ON_COMBAT_ENTER_AFTER = "NWNX_ON_COMBAT_ENTER_AFTER"; +const string NWNX_ON_COMBAT_EXIT_BEFORE = "NWNX_ON_COMBAT_EXIT_BEFORE"; +const string NWNX_ON_COMBAT_EXIT_AFTER = "NWNX_ON_COMBAT_EXIT_AFTER"; +const string NWNX_ON_START_COMBAT_ROUND_BEFORE = "NWNX_ON_START_COMBAT_ROUND_BEFORE"; +const string NWNX_ON_START_COMBAT_ROUND_AFTER = "NWNX_ON_START_COMBAT_ROUND_AFTER"; +const string NWNX_ON_DISARM_BEFORE = "NWNX_ON_DISARM_BEFORE"; +const string NWNX_ON_DISARM_AFTER = "NWNX_ON_DISARM_AFTER"; +const string NWNX_ON_CAST_SPELL_BEFORE = "NWNX_ON_CAST_SPELL_BEFORE"; +const string NWNX_ON_CAST_SPELL_AFTER = "NWNX_ON_CAST_SPELL_AFTER"; +const string NWNX_ON_SET_MEMORIZED_SPELL_SLOT_BEFORE = "NWNX_SET_MEMORIZED_SPELL_SLOT_BEFORE"; +const string NWNX_ON_SET_MEMORIZED_SPELL_SLOT_AFTER = "NWNX_SET_MEMORIZED_SPELL_SLOT_AFTER"; +const string NWNX_ON_CLEAR_MEMORIZED_SPELL_SLOT_BEFORE = "NWNX_CLEAR_MEMORIZED_SPELL_SLOT_BEFORE"; +const string NWNX_ON_CLEAR_MEMORIZED_SPELL_SLOT_AFTER = "NWNX_CLEAR_MEMORIZED_SPELL_SLOT_AFTER"; +const string NWNX_ON_SPELL_INTERRUPTED_BEFORE = "NWNX_ON_SPELL_INTERRUPTED_BEFORE"; +const string NWNX_ON_SPELL_INTERRUPTED_AFTER = "NWNX_ON_SPELL_INTERRUPTED_AFTER"; +const string NWNX_ON_SPELL_FAILED_BEFORE = "NWNX_ON_SPELL_FAILED_BEFORE"; +const string NWNX_ON_SPELL_FAILED_AFTER = "NWNX_ON_SPELL_FAILED_AFTER"; +const string NWNX_ON_HEALER_KIT_BEFORE = "NWNX_ON_HEALER_KIT_BEFORE"; +const string NWNX_ON_HEALER_KIT_AFTER = "NWNX_ON_HEALER_KIT_AFTER"; +const string NWNX_ON_HEAL_BEFORE = "NWNX_ON_HEAL_BEFORE"; +const string NWNX_ON_HEAL_AFTER = "NWNX_ON_HEAL_AFTER"; +const string NWNX_ON_PARTY_LEAVE_BEFORE = "NWNX_ON_PARTY_LEAVE_BEFORE"; +const string NWNX_ON_PARTY_LEAVE_AFTER = "NWNX_ON_PARTY_LEAVE_AFTER"; +const string NWNX_ON_PARTY_KICK_BEFORE = "NWNX_ON_PARTY_KICK_BEFORE"; +const string NWNX_ON_PARTY_KICK_AFTER = "NWNX_ON_PARTY_KICK_AFTER"; +const string NWNX_ON_PARTY_TRANSFER_LEADERSHIP_BEFORE = "NWNX_ON_PARTY_TRANSFER_LEADERSHIP_BEFORE"; +const string NWNX_ON_PARTY_TRANSFER_LEADERSHIP_AFTER = "NWNX_ON_PARTY_TRANSFER_LEADERSHIP_AFTER"; +const string NWNX_ON_PARTY_INVITE_BEFORE = "NWNX_ON_PARTY_INVITE_BEFORE"; +const string NWNX_ON_PARTY_INVITE_AFTER = "NWNX_ON_PARTY_INVITE_AFTER"; +const string NWNX_ON_PARTY_IGNORE_INVITATION_BEFORE = "NWNX_ON_PARTY_IGNORE_INVITATION_BEFORE"; +const string NWNX_ON_PARTY_IGNORE_INVITATION_AFTER = "NWNX_ON_PARTY_IGNORE_INVITATION_AFTER"; +const string NWNX_ON_PARTY_ACCEPT_INVITATION_BEFORE = "NWNX_ON_PARTY_ACCEPT_INVITATION_BEFORE"; +const string NWNX_ON_PARTY_ACCEPT_INVITATION_AFTER = "NWNX_ON_PARTY_ACCEPT_INVITATION_AFTER"; +const string NWNX_ON_PARTY_REJECT_INVITATION_BEFORE = "NWNX_ON_PARTY_REJECT_INVITATION_BEFORE"; +const string NWNX_ON_PARTY_REJECT_INVITATION_AFTER = "NWNX_ON_PARTY_REJECT_INVITATION_AFTER"; +const string NWNX_ON_PARTY_KICK_HENCHMAN_BEFORE = "NWNX_ON_PARTY_KICK_HENCHMAN_BEFORE"; +const string NWNX_ON_PARTY_KICK_HENCHMAN_AFTER = "NWNX_ON_PARTY_KICK_HENCHMAN_AFTER"; +const string NWNX_ON_COMBAT_MODE_ON = "NWNX_ON_COMBAT_MODE_ON"; +const string NWNX_ON_COMBAT_MODE_OFF = "NWNX_ON_COMBAT_MODE_OFF"; +const string NWNX_ON_USE_SKILL_BEFORE = "NWNX_ON_USE_SKILL_BEFORE"; +const string NWNX_ON_USE_SKILL_AFTER = "NWNX_ON_USE_SKILL_AFTER"; +const string NWNX_ON_MAP_PIN_ADD_PIN_BEFORE = "NWNX_ON_MAP_PIN_ADD_PIN_BEFORE"; +const string NWNX_ON_MAP_PIN_ADD_PIN_AFTER = "NWNX_ON_MAP_PIN_ADD_PIN_AFTER"; +const string NWNX_ON_MAP_PIN_CHANGE_PIN_BEFORE = "NWNX_ON_MAP_PIN_CHANGE_PIN_BEFORE"; +const string NWNX_ON_MAP_PIN_CHANGE_PIN_AFTER = "NWNX_ON_MAP_PIN_CHANGE_PIN_AFTER"; +const string NWNX_ON_MAP_PIN_DESTROY_PIN_BEFORE = "NWNX_ON_MAP_PIN_DESTROY_PIN_BEFORE"; +const string NWNX_ON_MAP_PIN_DESTROY_PIN_AFTER = "NWNX_ON_MAP_PIN_DESTROY_PIN_AFTER"; +const string NWNX_ON_DO_LISTEN_DETECTION_BEFORE = "NWNX_ON_DO_LISTEN_DETECTION_BEFORE"; +const string NWNX_ON_DO_LISTEN_DETECTION_AFTER = "NWNX_ON_DO_LISTEN_DETECTION_AFTER"; +const string NWNX_ON_DO_SPOT_DETECTION_BEFORE = "NWNX_ON_DO_SPOT_DETECTION_BEFORE"; +const string NWNX_ON_DO_SPOT_DETECTION_AFTER = "NWNX_ON_DO_SPOT_DETECTION_AFTER"; +const string NWNX_ON_POLYMORPH_BEFORE = "NWNX_ON_POLYMORPH_BEFORE"; +const string NWNX_ON_POLYMORPH_AFTER = "NWNX_ON_POLYMORPH_AFTER"; +const string NWNX_ON_UNPOLYMORPH_BEFORE = "NWNX_ON_UNPOLYMORPH_BEFORE"; +const string NWNX_ON_UNPOLYMORPH_AFTER = "NWNX_ON_UNPOLYMORPH_AFTER"; +const string NWNX_ON_EFFECT_APPLIED_BEFORE = "NWNX_ON_EFFECT_APPLIED_BEFORE"; +const string NWNX_ON_EFFECT_APPLIED_AFTER = "NWNX_ON_EFFECT_APPLIED_AFTER"; +const string NWNX_ON_EFFECT_REMOVED_BEFORE = "NWNX_ON_EFFECT_REMOVED_BEFORE"; +const string NWNX_ON_EFFECT_REMOVED_AFTER = "NWNX_ON_EFFECT_REMOVED_AFTER"; +const string NWNX_ON_QUICKCHAT_BEFORE = "NWNX_ON_QUICKCHAT_BEFORE"; +const string NWNX_ON_QUICKCHAT_AFTER = "NWNX_ON_QUICKCHAT_AFTER"; +const string NWNX_ON_INVENTORY_OPEN_BEFORE = "NWNX_ON_INVENTORY_OPEN_BEFORE"; +const string NWNX_ON_INVENTORY_OPEN_AFTER = "NWNX_ON_INVENTORY_OPEN_AFTER"; +const string NWNX_ON_INVENTORY_SELECT_PANEL_BEFORE = "NWNX_ON_INVENTORY_SELECT_PANEL_BEFORE"; +const string NWNX_ON_INVENTORY_SELECT_PANEL_AFTER = "NWNX_ON_INVENTORY_SELECT_PANEL_AFTER"; +const string NWNX_ON_BARTER_START_BEFORE = "NWNX_ON_BARTER_START_BEFORE"; +const string NWNX_ON_BARTER_START_AFTER = "NWNX_ON_BARTER_START_AFTER"; +const string NWNX_ON_BARTER_END_BEFORE = "NWNX_ON_BARTER_END_BEFORE"; +const string NWNX_ON_BARTER_END_AFTER = "NWNX_ON_BARTER_END_AFTER"; +const string NWNX_ON_BARTER_ADD_ITEM_BEFORE = "NWNX_ON_BARTER_ADD_ITEM_BEFORE"; +const string NWNX_ON_BARTER_ADD_ITEM_AFTER = "NWNX_ON_BARTER_ADD_ITEM_AFTER"; +const string NWNX_ON_TRAP_DISARM_BEFORE = "NWNX_ON_TRAP_DISARM_BEFORE"; +const string NWNX_ON_TRAP_DISARM_AFTER = "NWNX_ON_TRAP_DISARM_AFTER"; +const string NWNX_ON_TRAP_ENTER_BEFORE = "NWNX_ON_TRAP_ENTER_BEFORE"; +const string NWNX_ON_TRAP_ENTER_AFTER = "NWNX_ON_TRAP_ENTER_AFTER"; +const string NWNX_ON_TRAP_EXAMINE_BEFORE = "NWNX_ON_TRAP_EXAMINE_BEFORE"; +const string NWNX_ON_TRAP_EXAMINE_AFTER = "NWNX_ON_TRAP_EXAMINE_AFTER"; +const string NWNX_ON_TRAP_FLAG_BEFORE = "NWNX_ON_TRAP_FLAG_BEFORE"; +const string NWNX_ON_TRAP_FLAG_AFTER = "NWNX_ON_TRAP_FLAG_AFTER"; +const string NWNX_ON_TRAP_RECOVER_BEFORE = "NWNX_ON_TRAP_RECOVER_BEFORE"; +const string NWNX_ON_TRAP_RECOVER_AFTER = "NWNX_ON_TRAP_RECOVER_AFTER"; +const string NWNX_ON_TRAP_SET_BEFORE = "NWNX_ON_TRAP_SET_BEFORE"; +const string NWNX_ON_TRAP_SET_AFTER = "NWNX_ON_TRAP_SET_AFTER"; +const string NWNX_ON_TIMING_BAR_START_BEFORE = "NWNX_ON_TIMING_BAR_START_BEFORE"; +const string NWNX_ON_TIMING_BAR_START_AFTER = "NWNX_ON_TIMING_BAR_START_AFTER"; +const string NWNX_ON_TIMING_BAR_STOP_BEFORE = "NWNX_ON_TIMING_BAR_STOP_BEFORE"; +const string NWNX_ON_TIMING_BAR_STOP_AFTER = "NWNX_ON_TIMING_BAR_STOP_AFTER"; +const string NWNX_ON_TIMING_BAR_CANCEL_BEFORE = "NWNX_ON_TIMING_BAR_CANCEL_BEFORE"; +const string NWNX_ON_TIMING_BAR_CANCEL_AFTER = "NWNX_ON_TIMING_BAR_CANCEL_AFTER"; +const string NWNX_ON_WEBHOOK_SUCCESS = "NWNX_ON_WEBHOOK_SUCCESS"; +const string NWNX_ON_WEBHOOK_FAILURE = "NWNX_ON_WEBHOOK_FAILURE"; +const string NWNX_ON_CHECK_STICKY_PLAYER_NAME_RESERVED_BEFORE = "NWNX_ON_CHECK_STICKY_PLAYER_NAME_RESERVED_BEFORE"; +const string NWNX_ON_CHECK_STICKY_PLAYER_NAME_RESERVED_AFTER = "NWNX_ON_CHECK_STICKY_PLAYER_NAME_RESERVED_AFTER"; +const string NWNX_ON_SERVER_CHARACTER_SAVE_BEFORE = "NWNX_ON_SERVER_CHARACTER_SAVE_BEFORE"; +const string NWNX_ON_SERVER_CHARACTER_SAVE_AFTER = "NWNX_ON_SERVER_CHARACTER_SAVE_AFTER"; +const string NWNX_ON_CLIENT_EXPORT_CHARACTER_BEFORE = "NWNX_ON_CLIENT_EXPORT_CHARACTER_BEFORE"; +const string NWNX_ON_CLIENT_EXPORT_CHARACTER_AFTER = "NWNX_ON_CLIENT_EXPORT_CHARACTER_AFTER"; +const string NWNX_ON_LEVEL_UP_BEFORE = "NWNX_ON_LEVEL_UP_BEFORE"; +const string NWNX_ON_LEVEL_UP_AFTER = "NWNX_ON_LEVEL_UP_AFTER"; +const string NWNX_ON_LEVEL_UP_AUTOMATIC_BEFORE = "NWNX_ON_LEVEL_UP_AUTOMATIC_BEFORE"; +const string NWNX_ON_LEVEL_UP_AUTOMATIC_AFTER = "NWNX_ON_LEVEL_UP_AUTOMATIC_AFTER"; +const string NWNX_ON_LEVEL_DOWN_BEFORE = "NWNX_ON_LEVEL_DOWN_BEFORE"; +const string NWNX_ON_LEVEL_DOWN_AFTER = "NWNX_ON_LEVEL_DOWN_AFTER"; +const string NWNX_ON_INVENTORY_ADD_ITEM_BEFORE = "NWNX_ON_INVENTORY_ADD_ITEM_BEFORE"; +const string NWNX_ON_INVENTORY_ADD_ITEM_AFTER = "NWNX_ON_INVENTORY_ADD_ITEM_AFTER"; +const string NWNX_ON_INVENTORY_REMOVE_ITEM_BEFORE = "NWNX_ON_INVENTORY_REMOVE_ITEM_BEFORE"; +const string NWNX_ON_INVENTORY_REMOVE_ITEM_AFTER = "NWNX_ON_INVENTORY_REMOVE_ITEM_AFTER"; +const string NWNX_ON_INVENTORY_ADD_GOLD_BEFORE = "NWNX_ON_INVENTORY_ADD_GOLD_BEFORE"; +const string NWNX_ON_INVENTORY_ADD_GOLD_AFTER = "NWNX_ON_INVENTORY_ADD_GOLD_AFTER"; +const string NWNX_ON_INVENTORY_REMOVE_GOLD_BEFORE = "NWNX_ON_INVENTORY_REMOVE_GOLD_BEFORE"; +const string NWNX_ON_INVENTORY_REMOVE_GOLD_AFTER = "NWNX_ON_INVENTORY_REMOVE_GOLD_AFTER"; +const string NWNX_ON_PVP_ATTITUDE_CHANGE_BEFORE = "NWNX_ON_PVP_ATTITUDE_CHANGE_BEFORE"; +const string NWNX_ON_PVP_ATTITUDE_CHANGE_AFTER = "NWNX_ON_PVP_ATTITUDE_CHANGE_AFTER"; +const string NWNX_ON_INPUT_WALK_TO_WAYPOINT_BEFORE = "NWNX_ON_INPUT_WALK_TO_WAYPOINT_BEFORE"; +const string NWNX_ON_INPUT_WALK_TO_WAYPOINT_AFTER = "NWNX_ON_INPUT_WALK_TO_WAYPOINT_AFTER"; +const string NWNX_ON_MATERIALCHANGE_BEFORE = "NWNX_ON_MATERIALCHANGE_BEFORE"; +const string NWNX_ON_MATERIALCHANGE_AFTER = "NWNX_ON_MATERIALCHANGE_AFTER"; +const string NWNX_ON_INPUT_ATTACK_OBJECT_BEFORE = "NWNX_ON_INPUT_ATTACK_OBJECT_BEFORE"; +const string NWNX_ON_INPUT_ATTACK_OBJECT_AFTER = "NWNX_ON_INPUT_ATTACK_OBJECT_AFTER"; +const string NWNX_ON_INPUT_FORCE_MOVE_TO_OBJECT_BEFORE = "NWNX_ON_INPUT_FORCE_MOVE_TO_OBJECT_BEFORE"; +const string NWNX_ON_INPUT_FORCE_MOVE_TO_OBJECT_AFTER = "NWNX_ON_INPUT_FORCE_MOVE_TO_OBJECT_AFTER"; +const string NWNX_ON_INPUT_CAST_SPELL_BEFORE = "NWNX_ON_INPUT_CAST_SPELL_BEFORE"; +const string NWNX_ON_INPUT_CAST_SPELL_AFTER = "NWNX_ON_INPUT_CAST_SPELL_AFTER"; +const string NWNX_ON_INPUT_KEYBOARD_BEFORE = "NWNX_ON_INPUT_KEYBOARD_BEFORE"; +const string NWNX_ON_INPUT_KEYBOARD_AFTER = "NWNX_ON_INPUT_KEYBOARD_AFTER"; +const string NWNX_ON_INPUT_TOGGLE_PAUSE_BEFORE = "NWNX_ON_INPUT_TOGGLE_PAUSE_BEFORE"; +const string NWNX_ON_INPUT_TOGGLE_PAUSE_AFTER = "NWNX_ON_INPUT_TOGGLE_PAUSE_AFTER"; +const string NWNX_ON_OBJECT_LOCK_BEFORE = "NWNX_ON_OBJECT_LOCK_BEFORE"; +const string NWNX_ON_OBJECT_LOCK_AFTER = "NWNX_ON_OBJECT_LOCK_AFTER"; +const string NWNX_ON_OBJECT_UNLOCK_BEFORE = "NWNX_ON_OBJECT_UNLOCK_BEFORE"; +const string NWNX_ON_OBJECT_UNLOCK_AFTER = "NWNX_ON_OBJECT_UNLOCK_AFTER"; +const string NWNX_ON_UUID_COLLISION_BEFORE = "NWNX_ON_UUID_COLLISION_BEFORE"; +const string NWNX_ON_UUID_COLLISION_AFTER = "NWNX_ON_UUID_COLLISION_AFTER"; +const string NWNX_ON_RESOURCE_ADDED = "NWNX_ON_RESOURCE_ADDED"; +const string NWNX_ON_RESOURCE_REMOVED = "NWNX_ON_RESOURCE_REMOVED"; +const string NWNX_ON_RESOURCE_MODIFIED = "NWNX_ON_RESOURCE_MODIFIED"; +const string NWNX_ON_ELC_VALIDATE_CHARACTER_BEFORE = "NWNX_ON_ELC_VALIDATE_CHARACTER_BEFORE"; +const string NWNX_ON_ELC_VALIDATE_CHARACTER_AFTER = "NWNX_ON_ELC_VALIDATE_CHARACTER_AFTER"; +const string NWNX_ON_QUICKBAR_SET_BUTTON_BEFORE = "NWNX_ON_QUICKBAR_SET_BUTTON_BEFORE"; +const string NWNX_ON_QUICKBAR_SET_BUTTON_AFTER = "NWNX_ON_QUICKBAR_SET_BUTTON_AFTER"; +const string NWNX_ON_CALENDAR_HOUR = "NWNX_ON_CALENDAR_HOUR"; +const string NWNX_ON_CALENDAR_DAY = "NWNX_ON_CALENDAR_DAY"; +const string NWNX_ON_CALENDAR_MONTH = "NWNX_ON_CALENDAR_MONTH"; +const string NWNX_ON_CALENDAR_YEAR = "NWNX_ON_CALENDAR_YEAR"; +const string NWNX_ON_CALENDAR_DAWN = "NWNX_ON_CALENDAR_DAWN"; +const string NWNX_ON_CALENDAR_DUSK = "NWNX_ON_CALENDAR_DUSK"; +const string NWNX_ON_BROADCAST_CAST_SPELL_BEFORE = "NWNX_ON_BROADCAST_CAST_SPELL_BEFORE"; +const string NWNX_ON_BROADCAST_CAST_SPELL_AFTER = "NWNX_ON_BROADCAST_CAST_SPELL_AFTER"; +const string NWNX_ON_DEBUG_RUN_SCRIPT_BEFORE = "NWNX_ON_DEBUG_RUN_SCRIPT_BEFORE"; +const string NWNX_ON_DEBUG_RUN_SCRIPT_AFTER = "NWNX_ON_DEBUG_RUN_SCRIPT_AFTER"; +const string NWNX_ON_DEBUG_RUN_SCRIPT_CHUNK_BEFORE = "NWNX_ON_DEBUG_RUN_SCRIPT_CHUNK_BEFORE"; +const string NWNX_ON_DEBUG_RUN_SCRIPT_CHUNK_AFTER = "NWNX_ON_DEBUG_RUN_SCRIPT_CHUNK_AFTER"; +const string NWNX_ON_DEBUG_PLAY_VISUAL_EFFECT_BEFORE = "NWNX_ON_DEBUG_PLAY_VISUAL_EFFECT_BEFORE"; +const string NWNX_ON_DEBUG_PLAY_VISUAL_EFFECT_AFTER = "NWNX_ON_DEBUG_PLAY_VISUAL_EFFECT_AFTER"; +const string NWNX_ON_STORE_REQUEST_BUY_BEFORE = "NWNX_ON_STORE_REQUEST_BUY_BEFORE"; +const string NWNX_ON_STORE_REQUEST_BUY_AFTER = "NWNX_ON_STORE_REQUEST_BUY_AFTER"; +const string NWNX_ON_STORE_REQUEST_SELL_BEFORE = "NWNX_ON_STORE_REQUEST_SELL_BEFORE"; +const string NWNX_ON_STORE_REQUEST_SELL_AFTER = "NWNX_ON_STORE_REQUEST_SELL_AFTER"; +const string NWNX_ON_SERVER_SEND_AREA_BEFORE = "NWNX_ON_SERVER_SEND_AREA_BEFORE"; +const string NWNX_ON_SERVER_SEND_AREA_AFTER = "NWNX_ON_SERVER_SEND_AREA_AFTER"; +const string NWNX_ON_JOURNAL_OPEN_BEFORE = "NWNX_ON_JOURNAL_OPEN_BEFORE"; +const string NWNX_ON_JOURNAL_OPEN_AFTER = "NWNX_ON_JOURNAL_OPEN_AFTER"; +const string NWNX_ON_JOURNAL_CLOSE_BEFORE = "NWNX_ON_JOURNAL_CLOSE_BEFORE"; +const string NWNX_ON_JOURNAL_CLOSE_AFTER = "NWNX_ON_JOURNAL_CLOSE_AFTER"; +const string NWNX_ON_INPUT_EMOTE_BEFORE = "NWNX_ON_INPUT_EMOTE_BEFORE"; +const string NWNX_ON_INPUT_EMOTE_AFTER = "NWNX_ON_INPUT_EMOTE_AFTER"; +const string NWNX_ON_COMBAT_DR_BROKEN_BEFORE = "NWNX_ON_COMBAT_DR_BROKEN_BEFORE"; +const string NWNX_ON_COMBAT_DR_BROKEN_AFTER = "NWNX_ON_COMBAT_DR_BROKEN_AFTER"; +const string NWNX_ON_UNPOSSESS_FAMILIAR_BEFORE = "NWNX_ON_UNPOSSESS_FAMILIAR_BEFORE"; +const string NWNX_ON_UNPOSSESS_FAMILIAR_AFTER = "NWNX_ON_UNPOSSESS_FAMILIAR_AFTER"; +const string NWNX_ON_CLIENT_LEVEL_UP_BEGIN_BEFORE = "NWNX_ON_CLIENT_LEVEL_UP_BEGIN_BEFORE"; +const string NWNX_ON_CLIENT_LEVEL_UP_BEGIN_AFTER = "NWNX_ON_CLIENT_LEVEL_UP_BEGIN_AFTER"; +const string NWNX_ON_POSSESS_FAMILIAR_BEFORE = "NWNX_ON_POSSESS_FAMILIAR_BEFORE"; +const string NWNX_ON_POSSESS_FAMILIAR_AFTER = "NWNX_ON_POSSESS_FAMILIAR_AFTER"; +const string NWNX_ON_CHARACTER_SHEET_PERMITTED_BEFORE = "NWNX_ON_CHARACTER_SHEET_PERMITTED_BEFORE"; +const string NWNX_ON_CHARACTER_SHEET_PERMITTED_AFTER = "NWNX_ON_CHARACTER_SHEET_PERMITTED_AFTER"; +const string NWNX_ON_CHARACTER_SHEET_OPEN_BEFORE = "NWNX_ON_CHARACTER_SHEET_OPEN_BEFORE"; +const string NWNX_ON_CHARACTER_SHEET_OPEN_AFTER = "NWNX_ON_CHARACTER_SHEET_OPEN_AFTER"; +const string NWNX_ON_CHARACTER_SHEET_CLOSE_BEFORE = "NWNX_ON_CHARACTER_SHEET_CLOSE_BEFORE"; +const string NWNX_ON_CHARACTER_SHEET_CLOSE_AFTER = "NWNX_ON_CHARACTER_SHEET_CLOSE_AFTER"; +const string NWNX_ON_CLIENT_SET_DEVICE_PROPERTY_BEFORE = "NWNX_ON_CLIENT_SET_DEVICE_PROPERTY_BEFORE"; +const string NWNX_ON_CLIENT_SET_DEVICE_PROPERTY_AFTER = "NWNX_ON_CLIENT_SET_DEVICE_PROPERTY_AFTER"; +const string NWNX_ON_INPUT_DROP_ITEM_BEFORE = "NWNX_ON_INPUT_DROP_ITEM_BEFORE"; +const string NWNX_ON_INPUT_DROP_ITEM_AFTER = "NWNX_ON_INPUT_DROP_ITEM_AFTER"; +const string NWNX_ON_DECREMENT_SPELL_COUNT_BEFORE = "NWNX_ON_DECREMENT_SPELL_COUNT_BEFORE"; +const string NWNX_ON_DECREMENT_SPELL_COUNT_AFTER = "NWNX_ON_DECREMENT_SPELL_COUNT_AFTER"; +const string NWNX_ON_RUN_EVENT_SCRIPT_BEFORE = "NWNX_ON_RUN_EVENT_SCRIPT_BEFORE"; +const string NWNX_ON_RUN_EVENT_SCRIPT_AFTER = "NWNX_ON_RUN_EVENT_SCRIPT_AFTER"; +const string NWNX_ON_OBJECT_USE_BEFORE = "NWNX_ON_OBJECT_USE_BEFORE"; +const string NWNX_ON_OBJECT_USE_AFTER = "NWNX_ON_OBJECT_USE_AFTER"; +const string NWNX_ON_PLACEABLE_OPEN_BEFORE = "NWNX_ON_PLACEABLE_OPEN_BEFORE"; +const string NWNX_ON_PLACEABLE_OPEN_AFTER = "NWNX_ON_PLACEABLE_OPEN_AFTER"; +const string NWNX_ON_PLACEABLE_CLOSE_BEFORE = "NWNX_ON_PLACEABLE_CLOSE_BEFORE"; +const string NWNX_ON_PLACEABLE_CLOSE_AFTER = "NWNX_ON_PLACEABLE_CLOSE_AFTER"; +const string NWNX_ON_BROADCAST_SAFE_PROJECTILE_BEFORE = "NWNX_ON_BROADCAST_SAFE_PROJECTILE_BEFORE"; +const string NWNX_ON_BROADCAST_SAFE_PROJECTILE_AFTER = "NWNX_ON_BROADCAST_SAFE_PROJECTILE_AFTER"; +const string NWNX_ON_BROADCAST_ATTACK_OF_OPPORTUNITY_BEFORE = "NWNX_ON_BROADCAST_ATTACK_OF_OPPORTUNITY_BEFORE"; +const string NWNX_ON_BROADCAST_ATTACK_OF_OPPORTUNITY_AFTER = "NWNX_ON_BROADCAST_ATTACK_OF_OPPORTUNITY_AFTER"; +const string NWNX_ON_COMBAT_ATTACK_OF_OPPORTUNITY_BEFORE = "NWNX_ON_COMBAT_ATTACK_OF_OPPORTUNITY_BEFORE"; +const string NWNX_ON_COMBAT_ATTACK_OF_OPPORTUNITY_AFTER = "NWNX_ON_COMBAT_ATTACK_OF_OPPORTUNITY_AFTER"; +const string NWNX_ON_AREA_PLAY_BATTLE_MUSIC_BEFORE = "NWNX_ON_AREA_PLAY_BATTLE_MUSIC_BEFORE"; +const string NWNX_ON_AREA_PLAY_BATTLE_MUSIC_AFTER = "NWNX_ON_AREA_PLAY_BATTLE_MUSIC_AFTER"; +const string NWNX_ON_ATTACK_TARGET_CHANGE_BEFORE = "NWNX_ON_ATTACK_TARGET_CHANGE_BEFORE"; +const string NWNX_ON_ATTACK_TARGET_CHANGE_AFTER = "NWNX_ON_ATTACK_TARGET_CHANGE_AFTER"; +const string NWNX_ON_CREATURE_TILE_CHANGE_BEFORE = "NWNX_ON_CREATURE_TILE_CHANGE_BEFORE"; +const string NWNX_ON_CREATURE_TILE_CHANGE_AFTER = "NWNX_ON_CREATURE_TILE_CHANGE_AFTER"; +const string NWNX_ON_CREATURE_JUMP_TO_POINT_BEFORE = "NWNX_ON_CREATURE_JUMP_TO_POINT_BEFORE"; +const string NWNX_ON_CREATURE_JUMP_TO_POINT_AFTER = "NWNX_ON_CREATURE_JUMP_TO_POINT_AFTER"; +const string NWNX_ON_CREATURE_JUMP_TO_OBJECT_BEFORE = "NWNX_ON_CREATURE_JUMP_TO_OBJECT_BEFORE"; +const string NWNX_ON_CREATURE_JUMP_TO_OBJECT_AFTER = "NWNX_ON_CREATURE_JUMP_TO_OBJECT_AFTER"; +const string NWNX_ON_ITEMPROPERTY_EFFECT_APPLIED_BEFORE = "NWNX_ON_ITEMPROPERTY_EFFECT_APPLIED_BEFORE"; +const string NWNX_ON_ITEMPROPERTY_EFFECT_APPLIED_AFTER = "NWNX_ON_ITEMPROPERTY_EFFECT_APPLIED_AFTER"; +const string NWNX_ON_ITEMPROPERTY_EFFECT_REMOVED_BEFORE = "NWNX_ON_ITEMPROPERTY_EFFECT_REMOVED_BEFORE"; +const string NWNX_ON_ITEMPROPERTY_EFFECT_REMOVED_AFTER = "NWNX_ON_ITEMPROPERTY_EFFECT_REMOVED_AFTER"; +/// @} + +/// @name Events ObjectType Constants +/// @anchor events_objtype +/// @{ const int NWNX_EVENTS_OBJECT_TYPE_CREATURE = 5; const int NWNX_EVENTS_OBJECT_TYPE_ITEM = 6; const int NWNX_EVENTS_OBJECT_TYPE_TRIGGER = 7; @@ -1533,9 +2133,11 @@ const int NWNX_EVENTS_OBJECT_TYPE_PLACEABLE = 9; const int NWNX_EVENTS_OBJECT_TYPE_WAYPOINT = 12; const int NWNX_EVENTS_OBJECT_TYPE_ENCOUNTER = 13; const int NWNX_EVENTS_OBJECT_TYPE_PORTAL = 15; -*/ +/// @} -/* +/// @name Events TimingBar Constants +/// @anchor events_timingbar +/// @{ const int NWNX_EVENTS_TIMING_BAR_TRAP_FLAG = 1; const int NWNX_EVENTS_TIMING_BAR_TRAP_RECOVER = 2; const int NWNX_EVENTS_TIMING_BAR_TRAP_DISARM = 3; @@ -1545,14 +2147,45 @@ const int NWNX_EVENTS_TIMING_BAR_REST = 6; const int NWNX_EVENTS_TIMING_BAR_UNLOCK = 7; const int NWNX_EVENTS_TIMING_BAR_LOCK = 8; const int NWNX_EVENTS_TIMING_BAR_CUSTOM = 10; -*/ +/// @} -/* +/// @name Events SetVariable Constants +/// @anchor events_setvariable +/// @{ const int NWNX_EVENTS_DM_SET_VARIABLE_TYPE_INT = 0; const int NWNX_EVENTS_DM_SET_VARIABLE_TYPE_FLOAT = 1; const int NWNX_EVENTS_DM_SET_VARIABLE_TYPE_STRING = 2; const int NWNX_EVENTS_DM_SET_VARIABLE_TYPE_OBJECT = 3; -*/ +/// @} + +/// @name Events BroadcastSafeProjectile Constants +/// @anchor events_projtype +/// @{ +const int NWNX_EVENTS_BROADCAST_SAFE_PROJECTILE_TYPE_WEAPON_VFX_NONE = 0; +const int NWNX_EVENTS_BROADCAST_SAFE_PROJECTILE_TYPE_WEAPON_VFX_ACID = 1; +const int NWNX_EVENTS_BROADCAST_SAFE_PROJECTILE_TYPE_WEAPON_VFX_COLD = 2; +const int NWNX_EVENTS_BROADCAST_SAFE_PROJECTILE_TYPE_WEAPON_VFX_ELECTRICAL = 3; +const int NWNX_EVENTS_BROADCAST_SAFE_PROJECTILE_TYPE_WEAPON_VFX_FIRE = 4; +const int NWNX_EVENTS_BROADCAST_SAFE_PROJECTILE_TYPE_WEAPON_VFX_SONIC = 5; +const int NWNX_EVENTS_BROADCAST_SAFE_PROJECTILE_TYPE_SPELL_DEFAULT = 6; +const int NWNX_EVENTS_BROADCAST_SAFE_PROJECTILE_TYPE_SPELL_USE_PATH = 7; +/// @} + +/// @name Spell failed event reasons +/// @anchor events_spellfailreason +/// @{ +const int NWNX_EVENTS_SPELLFAIL_REASON_CANCELED = 0; +const int NWNX_EVENTS_SPELLFAIL_REASON_COUNTERSPELL = 1; +const int NWNX_EVENTS_SPELLFAIL_REASON_ASF = 2; +const int NWNX_EVENTS_SPELLFAIL_REASON_SPELLFAILURE = 3; +const int NWNX_EVENTS_SPELLFAIL_REASON_LOST_TARGET = 4; +const int NWNX_EVENTS_SPELLFAIL_REASON_SILENCED = 5; +const int NWNX_EVENTS_SPELLFAIL_REASON_DEFCAST_CONCENTRATION = 6; +const int NWNX_EVENTS_SPELLFAIL_REASON_ENTANGLE_CONCENTRATION = 7; +const int NWNX_EVENTS_SPELLFAIL_REASON_POLYMORPHED = 8; +const int NWNX_EVENTS_SPELLFAIL_REASON_CANT_CAST = 9; +const int NWNX_EVENTS_SPELLFAIL_REASON_CANT_USE_HANDS = 10; +/// @} /// @brief Scripts can subscribe to events. /// @@ -1567,6 +2200,10 @@ void NWNX_Events_SubscribeEvent(string evt, string script); /// @param script The script. void NWNX_Events_UnsubscribeEvent(string evt, string script); +/// @brief Unsubscribe all scripts from all events starting with prefix. +/// @param prefix the prefix to match against. Can be empty. +void NWNX_Events_UnsubscribeAllStartingWith(string prefix); + /// @brief Script chunks can subscribe to events. /// /// Some events are dispatched via the NWNX plugin (see NWNX_EVENTS_EVENT_* constants). @@ -1617,9 +2254,9 @@ string NWNX_Events_GetEventData(string tag); /// - DMAction events /// - Client connect event /// - Client Export Character event -/// - Spell events +/// - Spell events (except SPELL_FAILED) /// - QuickChat events -/// - Barter event (START only) +/// - Barter event (START/ADD_ITEM only) /// - Trap events /// - Sticky Player Name event /// - Server Character Save Events @@ -1642,6 +2279,9 @@ string NWNX_Events_GetEventData(string tag); /// - Decrement Spell Count event /// - Play Visual Effect event /// - EventScript event +/// - Broadcast Safe Projectile event +/// - Attack of Opportunity events +/// - Creature Jump events void NWNX_Events_SkipEvent(); /// Set the return value of the event. @@ -1661,6 +2301,7 @@ void NWNX_Events_SkipEvent(); /// - Stealth event -> "1" to perform HiPS (without the feat), "0" to bypass HiPS /// - Faction set reputation event -> The new reputation to apply instead. ("0" - "100") /// - CharacterSheetPermitted event -> "1" allow the player to view the character sheet or "0" to disallow +/// - Attack target change event -> The new target object. Convert to string with ObjectToString() void NWNX_Events_SetEventResult(string data); /// Returns the current event name @@ -1683,8 +2324,10 @@ void NWNX_Events_RemoveObjectFromDispatchList(string sEvent, string sScriptOrChu /// /// ONLY WORKS WITH THE FOLLOWING EVENTS -> ID TYPES: /// - NWNX_ON_CAST_SPELL -> SpellID +/// - NWNX_ON_SPELL_FAILED -> SpellID /// - NWNX_ON_HAS_FEAT -> FeatID (default enabled) /// - NWNX_ON_RUN_EVENT_SCRIPT -> EVENT_SCRIPT_* (default enabled) +/// - NWNX_ON_BROADCAST_SAFE_PROJECTILE -> NWNX_ON_BROADCAST_SAFE_PROJECTILE_TYPE for ProjectileType, NWNX_ON_BROADCAST_SAFE_PROJECTILE_SPELL for SpellID /// /// @note This enables the whitelist for ALL scripts subscribed to sEvent. /// @param sEvent The event name without _BEFORE / _AFTER. @@ -1728,6 +2371,14 @@ void NWNX_Events_UnsubscribeEvent(string evt, string script) NWNX_CallFunction(NWNX_Events, sFunc); } +void NWNX_Events_UnsubscribeAllStartingWith(string prefix) +{ + string sFunc = "UnsubscribeAllStartingWith"; + + NWNX_PushArgumentString(prefix); + NWNX_CallFunction(NWNX_Events, sFunc); +} + void NWNX_Events_SubscribeEventScriptChunk(string sEvent, string sScriptChunk, int bWrapIntoMain = TRUE) { string sFunc = "SubscribeEventScriptChunk"; diff --git a/_module/nss/nwnx_feat.nss b/_module/nss/nwnx_feat.nss index 79b432b8..19746a6d 100644 --- a/_module/nss/nwnx_feat.nss +++ b/_module/nss/nwnx_feat.nss @@ -10,34 +10,37 @@ const string NWNX_Feat = "NWNX_Feat"; ///< @private /// @anchor feat_modifiers /// /// @{ -const int NWNX_FEAT_MODIFIER_INVALID = 0; -const int NWNX_FEAT_MODIFIER_AB = 1; -const int NWNX_FEAT_MODIFIER_ABILITY = 2; -const int NWNX_FEAT_MODIFIER_ABVSRACE = 3; -const int NWNX_FEAT_MODIFIER_AC = 4; -const int NWNX_FEAT_MODIFIER_ACVSRACE = 5; -const int NWNX_FEAT_MODIFIER_ARCANESPELLFAILURE = 6; -const int NWNX_FEAT_MODIFIER_CONCEALMENT = 7; -const int NWNX_FEAT_MODIFIER_DMGIMMUNITY = 8; -const int NWNX_FEAT_MODIFIER_DMGREDUCTION = 9; -const int NWNX_FEAT_MODIFIER_DMGRESIST = 10; -const int NWNX_FEAT_MODIFIER_IMMUNITY = 11; -const int NWNX_FEAT_MODIFIER_MOVEMENTSPEED = 12; -const int NWNX_FEAT_MODIFIER_REGENERATION = 13; -const int NWNX_FEAT_MODIFIER_SAVE = 14; -const int NWNX_FEAT_MODIFIER_SAVEVSRACE = 15; -const int NWNX_FEAT_MODIFIER_SAVEVSTYPE = 16; -const int NWNX_FEAT_MODIFIER_SAVEVSTYPERACE = 17; -const int NWNX_FEAT_MODIFIER_SPELLIMMUNITY = 18; -const int NWNX_FEAT_MODIFIER_SRCHARGEN = 19; -const int NWNX_FEAT_MODIFIER_SRINCLEVEL = 20; -const int NWNX_FEAT_MODIFIER_SPELLSAVEDC = 21; -const int NWNX_FEAT_MODIFIER_BONUSSPELL = 22; -const int NWNX_FEAT_MODIFIER_TRUESEEING = 23; -const int NWNX_FEAT_MODIFIER_SEEINVISIBLE = 24; -const int NWNX_FEAT_MODIFIER_ULTRAVISION = 25; -const int NWNX_FEAT_MODIFIER_HASTE = 26; -const int NWNX_FEAT_MODIFIER_VISUALEFFECT = 27; +const int NWNX_FEAT_MODIFIER_INVALID = 0; +const int NWNX_FEAT_MODIFIER_AB = 1; +const int NWNX_FEAT_MODIFIER_ABILITY = 2; +const int NWNX_FEAT_MODIFIER_ABVSRACE = 3; +const int NWNX_FEAT_MODIFIER_AC = 4; +const int NWNX_FEAT_MODIFIER_ACVSRACE = 5; +const int NWNX_FEAT_MODIFIER_ARCANESPELLFAILURE = 6; +const int NWNX_FEAT_MODIFIER_CONCEALMENT = 7; +const int NWNX_FEAT_MODIFIER_DMGIMMUNITY = 8; +const int NWNX_FEAT_MODIFIER_DMGREDUCTION = 9; +const int NWNX_FEAT_MODIFIER_DMGRESIST = 10; +const int NWNX_FEAT_MODIFIER_IMMUNITY = 11; +const int NWNX_FEAT_MODIFIER_MOVEMENTSPEED = 12; +const int NWNX_FEAT_MODIFIER_REGENERATION = 13; +const int NWNX_FEAT_MODIFIER_SAVE = 14; +const int NWNX_FEAT_MODIFIER_SAVEVSRACE = 15; +const int NWNX_FEAT_MODIFIER_SAVEVSTYPE = 16; +const int NWNX_FEAT_MODIFIER_SAVEVSTYPERACE = 17; +const int NWNX_FEAT_MODIFIER_SPELLIMMUNITY = 18; +const int NWNX_FEAT_MODIFIER_SRCHARGEN = 19; +const int NWNX_FEAT_MODIFIER_SRINCLEVEL = 20; +const int NWNX_FEAT_MODIFIER_SPELLSAVEDC = 21; +const int NWNX_FEAT_MODIFIER_BONUSSPELL = 22; +const int NWNX_FEAT_MODIFIER_TRUESEEING = 23; +const int NWNX_FEAT_MODIFIER_SEEINVISIBLE = 24; +const int NWNX_FEAT_MODIFIER_ULTRAVISION = 25; +const int NWNX_FEAT_MODIFIER_HASTE = 26; +const int NWNX_FEAT_MODIFIER_VISUALEFFECT = 27; +const int NWNX_FEAT_MODIFIER_SPELLSAVEDCFORSCHOOL = 28; +const int NWNX_FEAT_MODIFIER_SPELLSAVEDCFORSPELL = 29; +const int NWNX_FEAT_MODIFIER_DAMAGE = 30; ///@} /// @brief Sets a feat modifier. diff --git a/_module/nss/nwnx_feat_2da.nss b/_module/nss/nwnx_feat_2da.nss new file mode 100644 index 00000000..95ba7e1a --- /dev/null +++ b/_module/nss/nwnx_feat_2da.nss @@ -0,0 +1,78 @@ +/// @ingroup feat +/// @file nwnx_feat_2da.nss +/// @brief Parse a column in the feat.2da to load the modifiers. +#include "nwnx_feat" + +/// @ingroup feat +/// @brief Translate a modifier type from a string to its constant. +/// @param featMod The string representation of the constant. +/// @return The constant for the feat modifier. +int NWNX_Feat_GetModifierConstant(string featMod); + +/// @ingroup feat +/// @brief Loops through feat.2da and checks for the column for feat modifications and sets them. +/// @param sColumnName The column name in the feat.2da that defines the 2da for the feat mods. +void NWNX_Feat_LoadFeatModifiers(string sColumnName = "FeatModsTable"); + +int NWNX_Feat_GetModifierConstant(string featMod) +{ + if (featMod == "AB") return NWNX_FEAT_MODIFIER_AB; + else if (featMod == "ABILITY") return NWNX_FEAT_MODIFIER_ABILITY; + else if (featMod == "ABVSRACE") return NWNX_FEAT_MODIFIER_ABVSRACE; + else if (featMod == "AC") return NWNX_FEAT_MODIFIER_AC; + else if (featMod == "ACVSRACE") return NWNX_FEAT_MODIFIER_ACVSRACE; + else if (featMod == "ARCANESPELLFAILURE") return NWNX_FEAT_MODIFIER_ARCANESPELLFAILURE; + else if (featMod == "BONUSSPELL") return NWNX_FEAT_MODIFIER_BONUSSPELL; + else if (featMod == "CONCEALMENT") return NWNX_FEAT_MODIFIER_CONCEALMENT; + else if (featMod == "DMGREDUCTION") return NWNX_FEAT_MODIFIER_DMGREDUCTION; + else if (featMod == "DMGRESIST") return NWNX_FEAT_MODIFIER_DMGRESIST; + else if (featMod == "DMGIMMUNITY") return NWNX_FEAT_MODIFIER_DMGIMMUNITY; + else if (featMod == "IMMUNITY") return NWNX_FEAT_MODIFIER_IMMUNITY; + else if (featMod == "HASTE") return NWNX_FEAT_MODIFIER_HASTE; + else if (featMod == "MOVEMENTSPEED") return NWNX_FEAT_MODIFIER_MOVEMENTSPEED; + else if (featMod == "REGENERATION") return NWNX_FEAT_MODIFIER_REGENERATION; + else if (featMod == "SAVE") return NWNX_FEAT_MODIFIER_SAVE; + else if (featMod == "SAVEVSRACE") return NWNX_FEAT_MODIFIER_SAVEVSRACE; + else if (featMod == "SAVEVSTYPE") return NWNX_FEAT_MODIFIER_SAVEVSTYPE; + else if (featMod == "SAVEVSTYPERACE") return NWNX_FEAT_MODIFIER_SAVEVSTYPERACE; + else if (featMod == "SEEINVISIBLE") return NWNX_FEAT_MODIFIER_SEEINVISIBLE; + else if (featMod == "SPELLIMMUNITY") return NWNX_FEAT_MODIFIER_SPELLIMMUNITY; + else if (featMod == "SRCHARGEN") return NWNX_FEAT_MODIFIER_SRCHARGEN; + else if (featMod == "SRINCLEVEL") return NWNX_FEAT_MODIFIER_SRINCLEVEL; + else if (featMod == "SPELLSAVEDC") return NWNX_FEAT_MODIFIER_SPELLSAVEDC; + else if (featMod == "TRUESEEING") return NWNX_FEAT_MODIFIER_TRUESEEING; + else if (featMod == "ULTRAVISION") return NWNX_FEAT_MODIFIER_ULTRAVISION; + else if (featMod == "VISUALEFFECT") return NWNX_FEAT_MODIFIER_VISUALEFFECT; + else if (featMod == "SPELLSAVEDCFORSCHOOL") return NWNX_FEAT_MODIFIER_SPELLSAVEDCFORSCHOOL; + else if (featMod == "SPELLSAVEDCFORSPELL") return NWNX_FEAT_MODIFIER_SPELLSAVEDCFORSPELL; + + return NWNX_FEAT_MODIFIER_INVALID; +} + +void NWNX_Feat_LoadFeatModifiers(string sColumnName = "FeatModsTable") +{ + int iFeatRows = Get2DARowCount("feat"); + int iFeat; + for (iFeat = 0; iFeat < iFeatRows; iFeat++) + { + string sFeatModTable = Get2DAString("feat", sColumnName, iFeat); + if(sFeatModTable != "") + { + int iFeatModRows = Get2DARowCount(sFeatModTable); + int iFeatMod; + for (iFeatMod = 0; iFeatMod < iFeatModRows; iFeatMod++) + { + string sType = Get2DAString(sFeatModTable, "Type", iFeatMod); + string sParam1 = Get2DAString(sFeatModTable, "Param1", iFeatMod); + string sParam2 = Get2DAString(sFeatModTable, "Param2", iFeatMod); + string sParam3 = Get2DAString(sFeatModTable, "Param3", iFeatMod); + string sParam4 = Get2DAString(sFeatModTable, "Param4", iFeatMod); + int iParam1 = sParam1 == "" ? 0xDEADBEEF : StringToInt(sParam1); + int iParam2 = sParam2 == "" ? 0xDEADBEEF : StringToInt(sParam2); + int iParam3 = sParam3 == "" ? 0xDEADBEEF : StringToInt(sParam3); + int iParam4 = sParam4 == "" ? 0xDEADBEEF : StringToInt(sParam4); + NWNX_Feat_SetFeatModifier(iFeat, NWNX_Feat_GetModifierConstant(sType), iParam1, iParam2, iParam3, iParam4); + } + } + } +} \ No newline at end of file diff --git a/_module/nss/nwnx_feedback.nss b/_module/nss/nwnx_feedback.nss index 1476c18b..3e56e075 100644 --- a/_module/nss/nwnx_feedback.nss +++ b/_module/nss/nwnx_feedback.nss @@ -18,7 +18,6 @@ const string NWNX_Feedback = "NWNX_Feedback"; ///< @private /// @anchor combat_log_msgs /// @{ const int NWNX_FEEDBACK_COMBATLOG_SIMPLE_ADJECTIVE = 1; // Simple_Adjective: : -/* const int NWNX_FEEDBACK_COMBATLOG_SIMPLE_DAMAGE = 2; // Simple_Damage: damaged : const int NWNX_FEEDBACK_COMBATLOG_COMPLEX_DAMAGE = 3; // Complex_Damage: damages : const int NWNX_FEEDBACK_COMBATLOG_COMPLEX_DEATH = 4; // Complex_Death: killed @@ -39,7 +38,6 @@ const int NWNX_FEEDBACK_COMBATLOG_VIBRATE = 19; // Controller vibrat const int NWNX_FEEDBACK_COMBATLOG_UNLOCKACHIEVEMENT = 20; // Unlock Campaign Achievement const int NWNX_FEEDBACK_COMBATLOG_POSTAURSTRING = 22; // PostString messages const int NWNX_FEEDBACK_COMBATLOG_ENTERTARGETINGMODE = 23; // Enter Targeting Mode -*/ /// @} /// @name Feedback Message Types @@ -47,7 +45,6 @@ const int NWNX_FEEDBACK_COMBATLOG_ENTERTARGETINGMODE = 23; // Enter Targeting M /// @{ const int NWNX_FEEDBACK_SKILL_CANT_USE = 0; -/* /// Skill Feedback Messages const int NWNX_FEEDBACK_SKILL_CANT_USE_TIMER = 1; const int NWNX_FEEDBACK_SKILL_ANIMALEMPATHY_VALID_TARGETS = 2; @@ -349,7 +346,6 @@ const int NWNX_FEEDBACK_CAMERA_CHASECAM = 258; const int NWNX_FEEDBACK_SAVING = 225; const int NWNX_FEEDBACK_SAVE_COMPLETE = 226; -*/ /// @} /// @brief Gets if feedback message is hidden. diff --git a/_module/nss/nwnx_item.nss b/_module/nss/nwnx_item.nss index f70569f9..71d4091f 100644 --- a/_module/nss/nwnx_item.nss +++ b/_module/nss/nwnx_item.nss @@ -16,6 +16,7 @@ void NWNX_Item_SetWeight(object oItem, int weight); /// @remark Total cost = base_value + additional_value. /// @remark Equivalent to SetGoldPieceValue NWNX2 function. /// @note Will not persist through saving. +/// @note This value will also revert if item is identified or player relogs into server. /// @param oItem The item object. /// @param gold The base gold value. void NWNX_Item_SetBaseGoldPieceValue(object oItem, int gold); @@ -91,6 +92,39 @@ int NWNX_Item_GetBaseArmorClass(object oItem); /// @return The minimum level required to equip the item. int NWNX_Item_GetMinEquipLevel(object oItem); +/// @brief Move oItem to oTarget +/// @remark Moving items from a container to the inventory of the container's owner (or the other way around) is always "silent" and won't trigger feedback messages +/// @param oItem The item object. +/// @param oTarget The target bag/creature/placeable or store object to move oItem to. +/// @param bHideAllFeedback Hides all feedback messages generated by losing/acquiring items +/// @return TRUE if the item was successfully moved to the target, otherwise FALSE +int NWNX_Item_MoveTo(object oItem, object oTarget, int bHideAllFeedback = FALSE); + +/// @brief Set a modifier to the Minimum Level to Equip (Item Level Restriction). +/// @param oItem The item object. +/// @param nModifier the modifier to apply (After any Override) +/// @param bPersist Whether the modifier should persist to gff field. Strongly Recommended to be TRUE (See warning) +/// @note This function (or override partner) must be used each server reset to reenable persistence. Recommended use on OBJECT_INVALID OnModuleLoad. +/// @warning if Persistence is FALSE, or not renabled, beware characters may trigger ELC logging in with now-invalid ItemLevelRestrictions equipped. +void NWNX_Item_SetMinEquipLevelModifier(object oItem, int nModifier, int bPersist = TRUE); + +/// @brief Gets the applied modifier to the Minimum Level to Equip (Item Level Restriction). +/// @param oItem The item object. +int NWNX_Item_GetMinEquipLevelModifier(object oItem); + +/// @brief Set an override to the Minimum Level to Equip (Item Level Restriction). +/// @param oItem The item object. +/// @param nOverride the nOverride to apply (Before any Modifier) +/// @param bPersist Whether the modifier should persist to gff field. Strongly Recommended to be TRUE (See warning) +/// @note This function (or modifier partner) must be used each server reset to reenable persistence. Recommended use on OBJECT_INVALID OnModuleLoad. +/// @warning if Persistence is FALSE, or not renabled, beware characters may trigger ELC logging in with now-invalid ItemLevelRestrictions equipped. +void NWNX_Item_SetMinEquipLevelOverride(object oItem, int nOverride, int bPersist = TRUE); + +/// @brief Gets the applied override to the Minimum Level to Equip (Item Level Restriction). +/// @param oItem The item object. +int NWNX_Item_GetMinEquipLevelOverride(object oItem); + + /// @} void NWNX_Item_SetWeight(object oItem, int w) @@ -205,3 +239,58 @@ int NWNX_Item_GetMinEquipLevel(object oItem) NWNX_CallFunction(NWNX_Item, sFunc); return NWNX_GetReturnValueInt(); } + +int NWNX_Item_MoveTo(object oItem, object oTarget, int bHideAllFeedback = FALSE) +{ + string sFunc = "MoveTo"; + + NWNX_PushArgumentInt(bHideAllFeedback); + NWNX_PushArgumentObject(oTarget); + NWNX_PushArgumentObject(oItem); + + NWNX_CallFunction(NWNX_Item, sFunc); + + return NWNX_GetReturnValueInt(); +} + +void NWNX_Item_SetMinEquipLevelModifier(object oItem, int nModifier, int bPersist = TRUE) +{ + string sFunc = "SetMinEquipLevelModifier"; + + NWNX_PushArgumentInt(bPersist); + NWNX_PushArgumentInt(nModifier); + NWNX_PushArgumentObject(oItem); + + NWNX_CallFunction(NWNX_Item, sFunc); +} + +int NWNX_Item_GetMinEquipLevelModifier(object oItem) +{ + string sFunc = "GetMinEquipLevelModifier"; + + NWNX_PushArgumentObject(oItem); + + NWNX_CallFunction(NWNX_Item, sFunc); + return NWNX_GetReturnValueInt(); +} + +void NWNX_Item_SetMinEquipLevelOverride(object oItem, int nOverride, int bPersist = TRUE) +{ + string sFunc = "SetMinEquipLevelOverride"; + + NWNX_PushArgumentInt(bPersist); + NWNX_PushArgumentInt(nOverride); + NWNX_PushArgumentObject(oItem); + + NWNX_CallFunction(NWNX_Item, sFunc); +} + +int NWNX_Item_GetMinEquipLevelOverride(object oItem) +{ + string sFunc = "GetMinEquipLevelOverride"; + + NWNX_PushArgumentObject(oItem); + + NWNX_CallFunction(NWNX_Item, sFunc); + return NWNX_GetReturnValueInt(); +} diff --git a/_module/nss/nwnx_nwsqliteext.nss b/_module/nss/nwnx_nwsqliteext.nss new file mode 100644 index 00000000..b4b6b717 --- /dev/null +++ b/_module/nss/nwnx_nwsqliteext.nss @@ -0,0 +1,25 @@ +/// @addtogroup nwsqliteextensions NWSQLiteExtensions +/// @brief Various extensions for the game's built-in sqlite database. +/// @{ +/// @file nwnx_nwsqliteext.nss +#include "nwnx" + +const string NWNX_NWSQLiteExtensions = "NWNX_NWSQLiteExtensions"; ///< @private + +/// @brief Create a virtual table for s2DA in the module sqlite database. +/// @param s2DA The 2DA name, cannot be empty. +/// @param sColumnTypeHints A string containing type hints for the 2DA columns. See this plugin's readme file for more info. +/// @param sTableName The table name, will use the 2da name if empty. +/// @return TRUE if the virtual table was created. +int NWNX_NWSQLiteExtensions_CreateVirtual2DATable(string s2DA, string sColumnTypeHints = "", string sTableName = ""); + +/// @} + +int NWNX_NWSQLiteExtensions_CreateVirtual2DATable(string s2DA, string sColumnTypeHints = "", string sTableName = "") +{ + NWNX_PushArgumentString(sTableName); + NWNX_PushArgumentString(sColumnTypeHints); + NWNX_PushArgumentString(s2DA); + NWNX_CallFunction(NWNX_NWSQLiteExtensions, "CreateVirtual2DATable"); + return NWNX_GetReturnValueInt(); +} diff --git a/_module/nss/nwnx_object.nss b/_module/nss/nwnx_object.nss index ff9d9823..03a99e4e 100644 --- a/_module/nss/nwnx_object.nss +++ b/_module/nss/nwnx_object.nss @@ -40,6 +40,13 @@ const int NWNX_OBJECT_TYPE_INTERNAL_PORTAL = 15; const int NWNX_OBJECT_TYPE_INTERNAL_SOUND = 16; /// @} +/// @anchor projectile_types +/// @name Projectile VFX Types +/// @{ +const int NWNX_OBJECT_SPELL_PROJECTILE_TYPE_DEFAULT = 6; +const int NWNX_OBJECT_SPELL_PROJECTILE_TYPE_USE_PATH = 7; +/// @} + /// A local variable structure. struct NWNX_Object_LocalVariable { @@ -68,13 +75,6 @@ int NWNX_Object_GetLocalVariableCount(object obj); /// @return An NWNX_Object_LocalVariable struct. struct NWNX_Object_LocalVariable NWNX_Object_GetLocalVariable(object obj, int index); -/// @brief Convert an object id to the actual object. -/// @param id The object id. -/// @return An object from the provided object ID. -/// @remark This is the counterpart to ObjectToString. -/// @deprecated Use the basegame StringToObject() function. This will be removed in a future NWNX release. -object NWNX_Object_StringToObject(string id); - /// @brief Set oObject's position. /// @param oObject The object. /// @param vPosition A vector position. @@ -137,12 +137,6 @@ int NWNX_Object_GetAppearance(object oPlaceable); /// @return TRUE if the object has the visual effect applied to it int NWNX_Object_GetHasVisualEffect(object obj, int nVFX); -/// @brief Check if an item can fit in an object's inventory. -/// @param obj The object with an inventory. -/// @param baseitem The base item id to check for a fit. -/// @return TRUE if an item of base item type can fit in object's inventory -int NWNX_Object_CheckFit(object obj, int baseitem); - /// @brief Get an object's damage immunity. /// @param obj The object. /// @param damageType The damage type to check for immunity. Use DAMAGE_TYPE_* constants. @@ -192,19 +186,6 @@ string NWNX_Object_GetTriggerGeometry(object oTrigger); /// @remark The minimum number of vertices is 3. void NWNX_Object_SetTriggerGeometry(object oTrigger, string sGeometry); -/// @brief Add an effect to an object that displays an icon and has no other effect. -/// @remark See effecticons.2da for a list of possible effect icons. -/// @param obj The object to apply the effect. -/// @param nIcon The icon id. -/// @param fDuration If specified the effect will be temporary and last this length in seconds, otherwise the effect -/// will be permanent. -void NWNX_Object_AddIconEffect(object obj, int nIcon, float fDuration=0.0); - -/// @brief Remove an icon effect from an object that was added by the NWNX_Object_AddIconEffect() function. -/// @param obj The object. -/// @param nIcon The icon id. -void NWNX_Object_RemoveIconEffect(object obj, int nIcon); - /// @brief Export an object to the UserDirectory/nwnx folder. /// @param sFileName The filename without extension, 16 or less characters. /// @param oObject The object to export. Valid object types: Creature, Item, Placeable, Waypoint, Door, Store, Trigger @@ -290,14 +271,6 @@ int NWNX_Object_GetInternalObjectType(object oObject); /// @return TRUE on success. int NWNX_Object_AcquireItem(object oObject, object oItem); -/// @brief Cause oObject to face fDirection. -/// @note This function is almost identical to SetFacing(), the only difference being that it allows you to specify -/// the target object without the use of AssignCommand(). This is useful when you want to change the facing of an object -/// in an ExecuteScriptChunk() call where AssignCommand() does not work. -/// @param oObject The object to change its facing of -/// @param fDirection The direction the object should face -void NWNX_Object_SetFacing(object oObject, float fDirection); - /// @brief Clear all spell effects oObject has applied to others. /// @param oObject The object that applied the spell effects. void NWNX_Object_ClearSpellEffectsOnOthers(object oObject); @@ -386,6 +359,65 @@ void NWNX_Object_SetLastTriggered(object oObject, object oLast); /// @return The remaining duration, in seconds, or the zero on failure. float NWNX_Object_GetAoEObjectDurationRemaining(object oAoE); +/// @brief Sets conversations started by oObject to be private or not. +/// @note ActionStartConversation()'s bPrivateConversation parameter will overwrite this flag. +/// @param oObject The object. +/// @param bPrivate TRUE/FALSE. +void NWNX_Object_SetConversationPrivate(object oObject, int bPrivate); + +/// @brief Sets the radius of a circle AoE object. +/// @param oAoE The AreaOfEffect object. +/// @param fRadius The radius, must be bigger than 0.0f. +void NWNX_Object_SetAoEObjectRadius(object oAoE, float fRadius); + +/// @brief Gets the radius of a circle AoE object. +/// @param oAoE The AreaOfEffect object. +/// @return The radius or 0.0f on error +float NWNX_Object_GetAoEObjectRadius(object oAoE); + +/// @brief Gets whether the last spell cast of oObject was spontaneous. +/// @note Should be called in a spell script. +/// @param oObject The object. +/// @return true if the last spell was cast spontaneously +int NWNX_Object_GetLastSpellCastSpontaneous(object oObject); + +/// @brief Gets the last spell cast domain level. +/// @note Should be called in a spell script. +/// @param oObject The object. +/// @return Domain level of the cast spell, 0 if not a domain spell +int NWNX_Object_GetLastSpellCastDomainLevel(object oObject); + +/// @brief Force the given object to carry the given UUID. Any other object currently owning the UUID is stripped of it. +/// @param oObject The object +/// @param sUUID The UUID to force +void NWNX_Object_ForceAssignUUID(object oObject, string sUUID); + +/// @brief Returns how many items are in oObject's inventory. +/// @param oObject A creature, placeable, item or store. +/// @return Returns a count of how many items are in oObject's inventory. +int NWNX_Object_GetInventoryItemCount(object oObject); + +/// @brief Override the projectile visual effect of ranged/throwing weapons and spells. +/// @param oCreature The creature. +/// @param nProjectileType A @ref projectile_types "NWNX_OBJECT_SPELL_PROJECTILE_TYPE_*" constant or -1 to remove the override. +/// @param nProjectilePathType A "PROJECTILE_PATH_TYPE_*" constant or -1 to ignore. +/// @param nSpellID A "SPELL_*" constant. -1 to ignore. +/// @param bPersist Whether the override should persist to the .bic file (for PCs). +/// @note Persistence is enabled after a server reset by the first use of this function. Recommended to trigger on a dummy target OnModuleLoad to enable persistence. +/// This will override all spell projectile VFX from oCreature until the override is removed. +void NWNX_Object_OverrideSpellProjectileVFX(object oCreature, int nProjectileType = -1, int nProjectilePathType = -1, int nSpellID = -1, int bPersist = FALSE); + +/// @brief Returns TRUE if the last spell was cast instantly. This function should only be called in a spell script. +/// @note To initialize the hooks used by this function it is recommended to call this function once in your module load script. +/// @return TRUE if the last spell was instant. +int NWNX_Object_GetLastSpellInstant(); + +/// @brief Sets the creator of a trap on door, placeable, or trigger. Also changes trap Faction to that of the new Creator. +/// @note Triggers (ground traps) will instantly update colour (Green/Red). Placeable/doors will not change if client has already seen them. +/// @param oObject Door, placeable or trigger (trap) object +/// @param oCreator The new creator of the trap. Any non-creature creator will assign OBJECT_INVALID (similar to toolset-laid traps) +void NWNX_Object_SetTrapCreator(object oObject, object oCreator); + /// @} int NWNX_Object_GetLocalVariableCount(object obj) @@ -412,13 +444,6 @@ struct NWNX_Object_LocalVariable NWNX_Object_GetLocalVariable(object obj, int in return var; } -object NWNX_Object_StringToObject(string id) -{ - WriteTimestampedLogEntry("WARNING: NWNX_Object_StringToObject() is deprecated, please use the basegame's StringToObject()"); - - return StringToObject(id); -} - void NWNX_Object_SetPosition(object oObject, vector vPosition, int bUpdateSubareas = TRUE) { string sFunc = "SetPosition"; @@ -534,18 +559,6 @@ int NWNX_Object_GetHasVisualEffect(object obj, int nVFX) return NWNX_GetReturnValueInt(); } -int NWNX_Object_CheckFit(object obj, int baseitem) -{ - string sFunc = "CheckFit"; - - NWNX_PushArgumentInt(baseitem); - NWNX_PushArgumentObject(obj); - - NWNX_CallFunction(NWNX_Object, sFunc); - - return NWNX_GetReturnValueInt(); -} - int NWNX_Object_GetDamageImmunity(object obj, int damageType) { string sFunc = "GetDamageImmunity"; @@ -629,25 +642,6 @@ void NWNX_Object_SetTriggerGeometry(object oTrigger, string sGeometry) NWNX_CallFunction(NWNX_Object, sFunc); } -void NWNX_Object_AddIconEffect(object obj, int nIcon, float fDuration=0.0) -{ - string sFunc = "AddIconEffect"; - - NWNX_PushArgumentFloat(fDuration); - NWNX_PushArgumentInt(nIcon); - NWNX_PushArgumentObject(obj); - NWNX_CallFunction(NWNX_Object, sFunc); -} - -void NWNX_Object_RemoveIconEffect(object obj, int nIcon) -{ - string sFunc = "RemoveIconEffect"; - - NWNX_PushArgumentInt(nIcon); - NWNX_PushArgumentObject(obj); - NWNX_CallFunction(NWNX_Object, sFunc); -} - void NWNX_Object_Export(object oObject, string sFileName, string sAlias = "NWNX") { string sFunc = "Export"; @@ -794,15 +788,6 @@ int NWNX_Object_AcquireItem(object oObject, object oItem) return NWNX_GetReturnValueInt(); } -void NWNX_Object_SetFacing(object oObject, float fDirection) -{ - string sFunc = "SetFacing"; - - NWNX_PushArgumentFloat(fDirection); - NWNX_PushArgumentObject(oObject); - NWNX_CallFunction(NWNX_Object, sFunc); -} - void NWNX_Object_ClearSpellEffectsOnOthers(object oObject) { string sFunc = "ClearSpellEffectsOnOthers"; @@ -957,3 +942,97 @@ float NWNX_Object_GetAoEObjectDurationRemaining(object oAoE) return NWNX_GetReturnValueFloat(); } + +void NWNX_Object_SetConversationPrivate(object oObject, int bPrivate) +{ + string sFunc = "SetConversationPrivate"; + + NWNX_PushArgumentInt(bPrivate); + NWNX_PushArgumentObject(oObject); + + NWNX_CallFunction(NWNX_Object, sFunc); +} + +void NWNX_Object_SetAoEObjectRadius(object oAoE, float fRadius) +{ + string sFunc = "SetAoEObjectRadius"; + + NWNX_PushArgumentFloat(fRadius); + NWNX_PushArgumentObject(oAoE); + NWNX_CallFunction(NWNX_Object, sFunc); +} + +float NWNX_Object_GetAoEObjectRadius(object oAoE) +{ + string sFunc = "GetAoEObjectRadius"; + + NWNX_PushArgumentObject(oAoE); + NWNX_CallFunction(NWNX_Object, sFunc); + + return NWNX_GetReturnValueFloat(); +} + +int NWNX_Object_GetLastSpellCastSpontaneous(object oObject) +{ + string sFunc = "GetLastSpellCastSpontaneous"; + + NWNX_PushArgumentObject(oObject); + NWNX_CallFunction(NWNX_Object, sFunc); + + return NWNX_GetReturnValueInt(); +} + +int NWNX_Object_GetLastSpellCastDomainLevel(object oObject) +{ + string sFunc = "GetLastSpellCastDomainLevel"; + + NWNX_PushArgumentObject(oObject); + NWNX_CallFunction(NWNX_Object, sFunc); + + return NWNX_GetReturnValueInt(); +} + +void NWNX_Object_ForceAssignUUID(object oObject, string sUUID) +{ + string sFunc = "ForceAssignUUID"; + + NWNX_PushArgumentString(sUUID); + NWNX_PushArgumentObject(oObject); + NWNX_CallFunction(NWNX_Object, sFunc); +} + +int NWNX_Object_GetInventoryItemCount(object oObject) +{ + string sFunc = "GetInventoryItemCount"; + + NWNX_PushArgumentObject(oObject); + NWNX_CallFunction(NWNX_Object, sFunc); + return NWNX_GetReturnValueInt(); +} + +void NWNX_Object_OverrideSpellProjectileVFX(object oCreature, int nProjectileType = -1, int nProjectilePathType = -1, int nSpellID = -1, int bPersist = FALSE) +{ + string sFunc = "OverrideSpellProjectileVFX"; + + NWNX_PushArgumentInt(bPersist); + NWNX_PushArgumentInt(nSpellID); + NWNX_PushArgumentInt(nProjectilePathType); + NWNX_PushArgumentInt(nProjectileType); + NWNX_PushArgumentObject(oCreature); + NWNX_CallFunction(NWNX_Object, sFunc); +} + +int NWNX_Object_GetLastSpellInstant() +{ + string sFunc = "GetLastSpellInstant"; + NWNX_CallFunction(NWNX_Object, sFunc); + return NWNX_GetReturnValueInt(); +} + +void NWNX_Object_SetTrapCreator(object oObject, object oCreator) +{ + string sFunc = "SetTrapCreator"; + NWNX_PushArgumentObject(oCreator); + NWNX_PushArgumentObject(oObject); + NWNX_CallFunction(NWNX_Object, sFunc); +} diff --git a/_module/nss/nwnx_player.nss b/_module/nss/nwnx_player.nss index ab8d5150..dfb7e3d7 100644 --- a/_module/nss/nwnx_player.nss +++ b/_module/nss/nwnx_player.nss @@ -135,7 +135,10 @@ string NWNX_Player_GetBicFileName(object player); /// @param player The player object. /// @param effectId The effect id. /// @param position The position to play the visual effect. -void NWNX_Player_ShowVisualEffect(object player, int effectId, vector position); +/// @param scale The scale of the effect +/// @param translate A translation vector to offset the position of the effect +/// @param rotate A rotation vector to rotate the effect +void NWNX_Player_ShowVisualEffect(object player, int effectId, vector position, float scale=1.0f, vector translate=[], vector rotate=[]); /// @brief Changes the daytime music track for the given player only /// @param player The player object. @@ -190,8 +193,11 @@ void NWNX_Player_SetRestDuration(object player, int duration); /// @param player The player object. /// @param target The target object to play the effect upon. /// @param visualeffect The visual effect id. +/// @param scale The scale of the effect +/// @param translate A translation vector to offset the position of the effect +/// @param rotate A rotation vector to rotate the effect /// @note Only works with instant effects: VFX_COM_*, VFX_FNF_*, VFX_IMP_* -void NWNX_Player_ApplyInstantVisualEffectToObject(object player, object target, int visualeffect); +void NWNX_Player_ApplyInstantVisualEffectToObject(object player, object target, int visualeffect, float scale=1.0f, vector translate=[], vector rotate=[]); /// @brief Refreshes the players character sheet /// @param player The player object. @@ -390,6 +396,55 @@ void NWNX_Player_CloseStore(object oPlayer); /// @note Overrides will not persist through relogging. void NWNX_Player_SetTlkOverride(object oPlayer, int nStrRef, string sOverride, int bRestoreGlobal = TRUE); +/// @brief Update wind for oPlayer only. +/// @param oPlayer The player. +/// @param vDirection The Wind's direction. +/// @param fMagnitude The Wind's magnitude. +/// @param fYaw The Wind's yaw. +/// @param fPitch The Wind's pitch. +void NWNX_Player_UpdateWind(object oPlayer, vector vDirection, float fMagnitude, float fYaw, float fPitch); + +/// @brief Update the SkyBox for oPlayer only. +/// @param oPlayer The player. +/// @param nSkyBox The Skybox ID. +void NWNX_Player_UpdateSkyBox(object oPlayer, int nSkyBox); + +/// @brief Update Sun and Moon Fog Color for oPlayer only. +/// @param oPlayer The player. +/// @param nSunFogColor The int value of Sun Fog color. +/// @param nMoonFogColor The int value of Moon Fog color. +void NWNX_Player_UpdateFogColor(object oPlayer, int nSunFogColor, int nMoonFogColor); + + +/// @brief Update Sun and Moon Fog Amount for oPlayer only. +/// @param oPlayer The player. +/// @param nSunFogAmount The int value of Sun Fog amount (range 0-255). +/// @param nMoonFogAmount The int value of Moon Fog amount (range 0-255). +void NWNX_Player_UpdateFogAmount(object oPlayer, int nSunFogAmount, int nMoonFogAmount); + +/// @brief Return's the currently-possessed game object of a player. +/// @param oPlayer The player object (e.g. from GetFirst/NextPC()). +/// @return the actual game object of oPlayer, or OBJECT_INVALID on error. +object NWNX_Player_GetGameObject(object oPlayer); + +/// @brief Override the ui discovery mask of oObject for oPlayer only +/// @param oPlayer The player object. +/// @param oObject The target object. +/// @param nMask A mask of OBJECT_UI_DISCOVERY_*, or -1 to clear the override +void NWNX_Player_SetObjectUiDiscoveryMaskOverride(object oPlayer, object oObject, int nMask); + +/// @brief Send a party invite from oInviter to oPlayer +/// @param oPlayer The player to invite +/// @param oInviter The one inviting the player +/// @param bForceInvite TRUE: Sends the invite even if the target ignores invites +/// @param bHideDialog TRUE: Does not show the party invitation dialog +void NWNX_Player_SendPartyInvite(object oPlayer, object oInviter, int bForceInvite = FALSE, int bHideDialog = FALSE); + +/// @brief Get the TURD for oPlayer +/// @param oPlayer The offline player to get the TURD from +/// @return the TURD object of oPlayer, or OBJECT_INVALID if no TURD exists +object NWNX_Player_GetTURD(object oPlayer); + /// @} void NWNX_Player_ForcePlaceableExamineWindow(object player, object placeable) @@ -527,10 +582,17 @@ string NWNX_Player_GetBicFileName(object player) return NWNX_GetReturnValueString(); } -void NWNX_Player_ShowVisualEffect(object player, int effectId, vector position) +void NWNX_Player_ShowVisualEffect(object player, int effectId, vector position, float scale=1.0f, vector translate=[], vector rotate=[]) { string sFunc = "ShowVisualEffect"; + NWNX_PushArgumentFloat(rotate.x); + NWNX_PushArgumentFloat(rotate.y); + NWNX_PushArgumentFloat(rotate.z); + NWNX_PushArgumentFloat(translate.x); + NWNX_PushArgumentFloat(translate.y); + NWNX_PushArgumentFloat(translate.z); + NWNX_PushArgumentFloat(scale); NWNX_PushArgumentFloat(position.x); NWNX_PushArgumentFloat(position.y); NWNX_PushArgumentFloat(position.z); @@ -644,10 +706,17 @@ void NWNX_Player_SetRestDuration(object player, int duration) NWNX_CallFunction(NWNX_Player, sFunc); } -void NWNX_Player_ApplyInstantVisualEffectToObject(object player, object target, int visualeffect) +void NWNX_Player_ApplyInstantVisualEffectToObject(object player, object target, int visualeffect, float scale=1.0f, vector translate=[], vector rotate=[]) { string sFunc = "ApplyInstantVisualEffectToObject"; + NWNX_PushArgumentFloat(rotate.z); + NWNX_PushArgumentFloat(rotate.y); + NWNX_PushArgumentFloat(rotate.x); + NWNX_PushArgumentFloat(translate.z); + NWNX_PushArgumentFloat(translate.y); + NWNX_PushArgumentFloat(translate.x); + NWNX_PushArgumentFloat(scale); NWNX_PushArgumentInt(visualeffect); NWNX_PushArgumentObject(target); NWNX_PushArgumentObject(player); @@ -979,4 +1048,89 @@ void NWNX_Player_SetTlkOverride(object oPlayer, int nStrRef, string sOverride, i NWNX_PushArgumentInt(nStrRef); NWNX_PushArgumentObject(oPlayer); NWNX_CallFunction(NWNX_Player, sFunc); -} \ No newline at end of file +} + +void NWNX_Player_UpdateWind(object oPlayer, vector vDirection, float fMagnitude, float fYaw, float fPitch) +{ + string sFunc = "UpdateWind"; + + NWNX_PushArgumentFloat(fPitch); + NWNX_PushArgumentFloat(fYaw); + NWNX_PushArgumentFloat(fMagnitude); + NWNX_PushArgumentFloat(vDirection.x); + NWNX_PushArgumentFloat(vDirection.y); + NWNX_PushArgumentFloat(vDirection.z); + NWNX_PushArgumentObject(oPlayer); + NWNX_CallFunction(NWNX_Player, sFunc); +} + +void NWNX_Player_UpdateSkyBox(object oPlayer, int nSkyBox) +{ + string sFunc = "UpdateSkyBox"; + + NWNX_PushArgumentInt(nSkyBox); + NWNX_PushArgumentObject(oPlayer); + NWNX_CallFunction(NWNX_Player, sFunc); +} + +void NWNX_Player_UpdateFogColor(object oPlayer, int nSunFogColor, int nMoonFogColor) +{ + string sFunc = "UpdateFogColor"; + + NWNX_PushArgumentInt(nMoonFogColor); + NWNX_PushArgumentInt(nSunFogColor); + NWNX_PushArgumentObject(oPlayer); + NWNX_CallFunction(NWNX_Player, sFunc); +} + +void NWNX_Player_UpdateFogAmount(object oPlayer, int nSunFogAmount, int nMoonFogAmount) +{ + string sFunc = "UpdateFogAmount"; + + NWNX_PushArgumentInt(nMoonFogAmount); + NWNX_PushArgumentInt(nSunFogAmount); + NWNX_PushArgumentObject(oPlayer); + NWNX_CallFunction(NWNX_Player, sFunc); +} + +object NWNX_Player_GetGameObject(object oPlayer) +{ + string sFunc = "GetGameObject"; + + NWNX_PushArgumentObject(oPlayer); + NWNX_CallFunction(NWNX_Player, sFunc); + return NWNX_GetReturnValueObject(); +} + +void NWNX_Player_SetObjectUiDiscoveryMaskOverride(object oPlayer, object oObject, int nMask) +{ + string sFunc = "SetObjectUiDiscoveryMaskOverride"; + + NWNX_PushArgumentInt(nMask); + NWNX_PushArgumentObject(oObject); + NWNX_PushArgumentObject(oPlayer); + + NWNX_CallFunction(NWNX_Player, sFunc); +} + +void NWNX_Player_SendPartyInvite(object oPlayer, object oInviter, int bForceInvite = FALSE, int bHideDialog = FALSE) +{ + string sFunc = "SendPartyInvite"; + + NWNX_PushArgumentInt(bHideDialog); + NWNX_PushArgumentInt(bForceInvite); + NWNX_PushArgumentObject(oInviter); + NWNX_PushArgumentObject(oPlayer); + + NWNX_CallFunction(NWNX_Player, sFunc); +} + +object NWNX_Player_GetTURD(object oPlayer) +{ + string sFunc = "GetTURD"; + + NWNX_PushArgumentObject(oPlayer); + NWNX_CallFunction(NWNX_Player, sFunc); + + return NWNX_GetReturnValueObject(); +} diff --git a/_module/nss/nwnx_race_2da.nss b/_module/nss/nwnx_race_2da.nss index 5b6f8021..cacd9d24 100644 --- a/_module/nss/nwnx_race_2da.nss +++ b/_module/nss/nwnx_race_2da.nss @@ -2,7 +2,6 @@ /// @file nwnx_race_2da.nss /// @brief Parse a column in the racialtypes.2da to load the modifiers. #include "nwnx_race" -#include "nwnx_util" /// @ingroup race /// @brief Translate a modifier type from a string to its constant. @@ -45,14 +44,14 @@ int NWNX_Race_GetModifierConstant(string raceMod) void NWNX_Race_LoadRacialModifiers(string sColumnName = "RacialModsTable") { - int iRaceRows = NWNX_Util_Get2DARowCount("racialtypes"); + int iRaceRows = Get2DARowCount("racialtypes"); int iRace; for (iRace = 0; iRace < iRaceRows; iRace++) { string sRaceModTable = Get2DAString("racialtypes", sColumnName, iRace); if(sRaceModTable != "") { - int iRaceModRows = NWNX_Util_Get2DARowCount(sRaceModTable); + int iRaceModRows = Get2DARowCount(sRaceModTable); int iRaceMod; for (iRaceMod = 0; iRaceMod < iRaceModRows; iRaceMod++) { diff --git a/_module/nss/nwnx_sql.nss b/_module/nss/nwnx_sql.nss index 4ef2e6d8..b3198962 100644 --- a/_module/nss/nwnx_sql.nss +++ b/_module/nss/nwnx_sql.nss @@ -102,6 +102,10 @@ string NWNX_SQL_GetLastError(); /// @return Returns the number of parameters expected by the prepared query or -1 if no query is prepared. int NWNX_SQL_GetPreparedQueryParamCount(); +/// @brief Set the next query to return full binary results **ON THE FIRST COLUMN ONLY**. +/// @note This is ONLY needed on PostgreSQL, and ONLY if you want to deserialize raw bytea in NWNX_SQL_ReadFullObjectInActiveRow with base64=FALSE. +void NWNX_SQL_PostgreSQL_SetNextQueryResultsBinaryMode(); + /// @} int NWNX_SQL_PrepareQuery(string query) @@ -261,3 +265,10 @@ int NWNX_SQL_GetPreparedQueryParamCount() NWNX_CallFunction(NWNX_SQL, sFunc); return NWNX_GetReturnValueInt(); } + +void NWNX_SQL_PostgreSQL_SetNextQueryResultsBinaryMode() +{ + string sFunc = "PostgreSQL_SetNextQueryResultsBinaryMode"; + + NWNX_CallFunction(NWNX_SQL, sFunc); +} diff --git a/_module/nss/nwnx_util.nss b/_module/nss/nwnx_util.nss index b85f80cb..e1edf7a2 100644 --- a/_module/nss/nwnx_util.nss +++ b/_module/nss/nwnx_util.nss @@ -62,6 +62,10 @@ int NWNX_Util_Hash(string str); /// @return The mtime of the module file. int NWNX_Util_GetModuleMtime(); +/// @brief Gets the module short file name. +/// @return The module file as a string. +string NWNX_Util_GetModuleFile(); + /// @brief Gets the value of customTokenNumber. /// @param customTokenNumber The token number to query. /// @return The string representation of the token value. @@ -72,7 +76,6 @@ string NWNX_Util_GetCustomToken(int customTokenNumber); /// @return The converted itemproperty. itemproperty NWNX_Util_EffectToItemProperty(effect e); -/// /// @brief Convert an itemproperty type to an effect type. /// @param ip The itemproperty to convert to an effect. /// @return The converted effect. @@ -83,12 +86,6 @@ effect NWNX_Util_ItemPropertyToEffect(itemproperty ip); /// @return The new string without any color codes. string NWNX_Util_StripColors(string str); -/// @brief Determines if the supplied resref exists. -/// @param resref The resref to check. -/// @param type The @ref resref_types "Resref Type". -/// @return TRUE/FALSE -int NWNX_Util_IsValidResRef(string resref, int type = NWNX_UTIL_RESREF_TYPE_CREATURE); - /// @brief Retrieves an environment variable. /// @param sVarname The environment variable to query. /// @return The value of the environment variable. @@ -108,12 +105,6 @@ void NWNX_Util_SetMinutesPerHour(int minutes); /// @return The url encoded string. string NWNX_Util_EncodeStringForURL(string str); -/// @anchor twoda_row_count -/// @brief Gets the row count for a 2da. -/// @param str The 2da to check (do not include the .2da). -/// @return The amount of rows in the 2da. -int NWNX_Util_Get2DARowCount(string str); - /// @brief Get the first resref of nType. /// @param nType A @ref resref_types "Resref Type". /// @param sRegexFilter Lets you filter out resrefs using a regexfilter. @@ -127,11 +118,6 @@ string NWNX_Util_GetFirstResRef(int nType, string sRegexFilter = "", int bModule /// @return The next resref found or "" if none is found. string NWNX_Util_GetNextResRef(); -/// @brief Get the ticks per second of the server. -/// @remark Useful to dynamically detect lag and adjust behavior accordingly. -/// @return The ticks per second. -int NWNX_Util_GetServerTicksPerSecond(); - /// @brief Get the last created object. /// @param nObjectType Does not take the NWScript OBJECT_TYPE_* constants. /// Use NWNX_Consts_TranslateNWScriptObjectType() to get their NWNX equivalent. @@ -148,12 +134,6 @@ object NWNX_Util_GetLastCreatedObject(int nObjectType, int nNthLast = 1); /// @return "" on success, or the compilation error. string NWNX_Util_AddScript(string sFileName, string sScriptData, int bWrapIntoMain = FALSE, string sAlias = "NWNX"); -/// @brief Gets the contents of a .nss script file as a string. -/// @param sScriptName The name of the script to get the contents of. -/// @param nMaxLength The max length of the return string, -1 to get everything -/// @return The script file contents or "" on error. -string NWNX_Util_GetNSSContents(string sScriptName, int nMaxLength = -1); - /// @brief Adds a nss file to the UserDirectory/nwnx folder, or to the location of sAlias. /// @note Will override existing nss files that are in the module /// @param sFileName The script filename without extension, 16 or less characters. @@ -262,6 +242,23 @@ string NWNX_Util_GetTTY(); /// @param nEventID The ID of the event. void NWNX_Util_SetCurrentlyRunningEvent(int nEventID); +/// @brief Calculate the levenshtein distance of two strings +/// @param sString The string to compare with. +/// @param sCompareTo The string to compare sString to. +/// @return The number of characters different between the compared strings. +int NWNX_Util_GetStringLevenshteinDistance(string sString, string sCompareTo); + +/// @brief Sends a full object update of oObjectToUpdate to all clients +/// @param oObjectToUpdate The object to update +/// @param oPlayer The player for which the objects needs to update, OBJECT_INVALID for all players +void NWNX_Util_UpdateClientObject(object oObjectToUpdate, object oPlayer = OBJECT_INVALID); + +/// @brief Clean a resource directory, deleting all files of nResType. +/// @param sAlias A resource directory alias, NWNX or one defined in the custom resource directory file. +/// @param nResType The type of file to delete or 0xFFFF for all types. +/// @return TRUE if successful, FALSE on error. +int NWNX_Util_CleanResourceDirectory(string sAlias, int nResType = 0xFFFF); + /// @} string NWNX_Util_GetCurrentScriptName(int depth = 0) @@ -293,6 +290,12 @@ int NWNX_Util_GetModuleMtime() return NWNX_GetReturnValueInt(); } +string NWNX_Util_GetModuleFile() +{ + NWNX_CallFunction(NWNX_Util, "GetModuleFile"); + return NWNX_GetReturnValueString(); +} + string NWNX_Util_GetCustomToken(int customTokenNumber) { string sFunc = "GetCustomToken"; @@ -325,15 +328,6 @@ string NWNX_Util_StripColors(string str) return NWNX_GetReturnValueString(); } -int NWNX_Util_IsValidResRef(string resref, int type = NWNX_UTIL_RESREF_TYPE_CREATURE) -{ - string sFunc = "IsValidResRef"; - NWNX_PushArgumentInt(type); - NWNX_PushArgumentString(resref); - NWNX_CallFunction(NWNX_Util, sFunc); - return NWNX_GetReturnValueInt(); -} - string NWNX_Util_GetEnvironmentVariable(string sVarname) { string sFunc = "GetEnvironmentVariable"; @@ -366,14 +360,6 @@ string NWNX_Util_EncodeStringForURL(string sURL) return NWNX_GetReturnValueString(); } -int NWNX_Util_Get2DARowCount(string str) -{ - string sFunc = "Get2DARowCount"; - NWNX_PushArgumentString(str); - NWNX_CallFunction(NWNX_Util, sFunc); - return NWNX_GetReturnValueInt(); -} - string NWNX_Util_GetFirstResRef(int nType, string sRegexFilter = "", int bModuleResourcesOnly = TRUE) { string sFunc = "GetFirstResRef"; @@ -395,15 +381,6 @@ string NWNX_Util_GetNextResRef() return NWNX_GetReturnValueString(); } -int NWNX_Util_GetServerTicksPerSecond() -{ - string sFunc = "GetServerTicksPerSecond"; - - NWNX_CallFunction(NWNX_Util, sFunc); - - return NWNX_GetReturnValueInt(); -} - object NWNX_Util_GetLastCreatedObject(int nObjectType, int nNthLast = 1) { string sFunc = "GetLastCreatedObject"; @@ -428,17 +405,6 @@ string NWNX_Util_AddScript(string sFileName, string sScriptData, int bWrapIntoMa return NWNX_GetReturnValueString(); } -string NWNX_Util_GetNSSContents(string sScriptName, int nMaxLength = -1) -{ - string sFunc = "GetNSSContents"; - - NWNX_PushArgumentInt(nMaxLength); - NWNX_PushArgumentString(sScriptName); - NWNX_CallFunction(NWNX_Util, sFunc); - - return NWNX_GetReturnValueString(); -} - int NWNX_Util_AddNSSFile(string sFileName, string sContents, string sAlias = "NWNX") { string sFunc = "AddNSSFile"; @@ -518,10 +484,8 @@ void NWNX_Util_UnregisterServerConsoleCommand(string sCommand) int NWNX_Util_PluginExists(string sPlugin) { - string sFunc = "PluginExists"; - NWNX_PushArgumentString(sPlugin); - NWNX_CallFunction(NWNX_Util, sFunc); - return NWNX_GetReturnValueInt(); + WriteTimestampedLogEntry("WARNING: NWNX_Util_PluginExists is deprecated. You should migrate to NWNX_PluginExists."); + return NWNX_PluginExists(sPlugin); } string NWNX_Util_GetUserDirectory() @@ -654,3 +618,31 @@ void NWNX_Util_SetCurrentlyRunningEvent(int nEventID) NWNX_PushArgumentInt(nEventID); NWNX_CallFunction(NWNX_Util, sFunc); } + +int NWNX_Util_GetStringLevenshteinDistance(string sString, string sCompareTo) +{ + string sFunc = "LevenshteinDistance"; + + NWNX_PushArgumentString(sCompareTo); + NWNX_PushArgumentString(sString); + NWNX_CallFunction(NWNX_Util, sFunc); + return NWNX_GetReturnValueInt(); +} + +void NWNX_Util_UpdateClientObject(object oObjectToUpdate, object oPlayer = OBJECT_INVALID) +{ + string sFunc = "UpdateClientObject"; + + NWNX_PushArgumentObject(oPlayer); + NWNX_PushArgumentObject(oObjectToUpdate); + NWNX_CallFunction(NWNX_Util, sFunc); +} + +int NWNX_Util_CleanResourceDirectory(string sAlias, int nResType = 0xFFFF) +{ + string sFunc = "CleanResourceDirectory"; + NWNX_PushArgumentInt(nResType); + NWNX_PushArgumentString(sAlias); + NWNX_CallFunction(NWNX_Util, sFunc); + return NWNX_GetReturnValueInt(); +} diff --git a/_module/nss/nwnx_util_t.nss b/_module/nss/nwnx_util_t.nss deleted file mode 100644 index 832e2e3d..00000000 --- a/_module/nss/nwnx_util_t.nss +++ /dev/null @@ -1,61 +0,0 @@ -#include "nwnx_util" -#include "nwnx_tests" -#include "x3_inc_string" - -void main() -{ - WriteTimestampedLogEntry("NWNX_Util unit test begin.."); - - string sScript = NWNX_Util_GetCurrentScriptName(0); - NWNX_Tests_Report("NWNX_Util", "GetCurrentScriptName", sScript == "nwnx_util_t"); - - string str = "string to be hashed"; - int hash = NWNX_Util_Hash(str); - NWNX_Tests_Report("NWNX_Util", "Hash", hash != 0); - - string ascii = NWNX_Util_GetAsciiTableString(); - NWNX_Tests_Report("NWNX_Util", "GetAsciiTableString", GetSubString(ascii, 65, 1) == "A"); - - SetCustomToken(1000, "Test Token 1000"); - string sToken = NWNX_Util_GetCustomToken(1000); - NWNX_Tests_Report("NWNX_Util", "GetCustomToken", sToken == "Test Token 1000"); - - effect e = EffectCurse(1,2,3,4,5,6); - e = TagEffect(e, "NWNX_UTIL_TEST"); - itemproperty ip = NWNX_Util_EffectToItemProperty(e); - e = NWNX_Util_ItemPropertyToEffect(ip); - NWNX_Tests_Report("NWNX_Util", "EffectToItemProperty_ItemPropertyToEffect", GetEffectTag(e) == "NWNX_UTIL_TEST"); - - string sRedString = StringToRGBString("stripped colors.", STRING_COLOR_RED); - str = "This is a test of "+sRedString; - string strip_colors = NWNX_Util_StripColors(str); - NWNX_Tests_Report("NWNX_Util", "RegexReplace", strip_colors == "This is a test of stripped colors."); - - string sValidResRef = "nw_undeadhigh"; - NWNX_Tests_Report("NWNX_Util", "IsValidResRef", NWNX_Util_IsValidResRef(sValidResRef, NWNX_UTIL_RESREF_TYPE_ENCOUNTER)); - string sInValidResRef = "aaaaaaaaaaaaaaaa"; - NWNX_Tests_Report("NWNX_Util", "IsValidResRef", NWNX_Util_IsValidResRef(sInValidResRef, NWNX_UTIL_RESREF_TYPE_ITEM) == 0); - - string sEnvVar = "NWNX_CORE_LOG_LEVEL"; - NWNX_Tests_Report("NWNX_Util", "GetEnvironmentVariable", StringToInt(NWNX_Util_GetEnvironmentVariable(sEnvVar)) > 0); - - int nMinsPerHour = NWNX_Util_GetMinutesPerHour(); - NWNX_Tests_Report("NWNX_Util", "GetMinutesPerHour", nMinsPerHour > 0); - NWNX_Util_SetMinutesPerHour(30); - NWNX_Tests_Report("NWNX_Util", "SetMinutesPerHour", NWNX_Util_GetMinutesPerHour() == 30); - - string sStringForURL = "This is a test, yes."; - NWNX_Tests_Report("NWNX_Util", "EncodeStringForURL", NWNX_Util_EncodeStringForURL(sStringForURL) == "This+is+a+test%2C+yes."); - - string sTwoDA = "bodybag"; - NWNX_Tests_Report("NWNX_Util", "Get2DARowCount", NWNX_Util_Get2DARowCount(sTwoDA) == 7); - - NWNX_Tests_Report("NWNX_Util", "GetFirstResRef", NWNX_Util_GetFirstResRef(NWNX_UTIL_RESREF_TYPE_NSS, "nwnx_util.*") != ""); - NWNX_Tests_Report("NWNX_Util", "GetNextResRef", NWNX_Util_GetNextResRef() != ""); - - NWNX_Tests_Report("NWNX_Util", "GetServerTicksPerSecond", NWNX_Util_GetServerTicksPerSecond() > 0); - - NWNX_Tests_Report("NWNX_Util", "GetLastCreatedObject", GetIsObjectValid(NWNX_Util_GetLastCreatedObject(4/*OBJECT_TYPE_AREA*/, 1))); - - WriteTimestampedLogEntry("NWNX_Util unit test end."); -} diff --git a/_module/nss/ogredeath.nss b/_module/nss/ogredeath.nss index 85dc0258..2d5e9552 100644 --- a/_module/nss/ogredeath.nss +++ b/_module/nss/ogredeath.nss @@ -15,6 +15,10 @@ void main() { AdjustAlignment(oKiller, ALIGNMENT_EVIL, 5); } - ExecuteScript("sf_xp", OBJECT_SELF); + + //ExecuteScript("sf_xp", OBJECT_SELF); + ExecuteScript("prc_npc_death", OBJECT_SELF); + ExecuteScript("prc_pwondeath", OBJECT_SELF); + } diff --git a/_module/nss/onunaquireitem.nss b/_module/nss/onunaquireitem.nss index d48c5c4a..58b16c3f 100644 --- a/_module/nss/onunaquireitem.nss +++ b/_module/nss/onunaquireitem.nss @@ -29,7 +29,8 @@ Scripting will still fire reguardless. //Main Script void main() { -ExecuteScript("prc_onunaquire", OBJECT_SELF); + ExecuteScript("prc_onunaquire", OBJECT_SELF); + //Declare major variables.. object oPC = GetModuleItemLostBy(); object oItem = GetModuleItemLost(); @@ -70,10 +71,10 @@ string sMsg; else { //Kill it... - SetPlotFlag(oItem, FALSE); - DestroyObject(oItem); + //SetPlotFlag(oItem, FALSE); + //DestroyObject(oItem); - FloatingTextStringOnCreature("The item you dropped was destroyed!!!", oPC); + //FloatingTextStringOnCreature("The item you dropped was destroyed!!!", oPC); return; //no need to continue... @@ -88,11 +89,11 @@ string sMsg; { //kill it... - SetPlotFlag(oItem, FALSE); - DestroyObject(oItem); + //SetPlotFlag(oItem, FALSE); + //DestroyObject(oItem); //Inform the PC it was destroyed (so they won't make a mistake later! - FloatingTextStringOnCreature("The item you dropped was destroyed!!!", oPC); + //FloatingTextStringOnCreature("The item you dropped was destroyed!!!", oPC); return; //no need to continue... diff --git a/_module/nss/prc_pwondeath.nss b/_module/nss/prc_pwondeath.nss index 12447140..e602d23f 100644 --- a/_module/nss/prc_pwondeath.nss +++ b/_module/nss/prc_pwondeath.nss @@ -63,13 +63,10 @@ void RndDropGear(object oNPC) SetDroppableFlag(oLeftRing, bDropLeftRing); SetDroppableFlag(oRightRing, bDropRightRing); -} - +} void main() { - ExecuteScript("sf_xp", OBJECT_SELF); - - RndDropGear(OBJECT_SELF); + RndDropGear(OBJECT_SELF); } \ No newline at end of file diff --git a/_module/nss/queendeath.nss b/_module/nss/queendeath.nss index aa603f8b..341323e0 100644 --- a/_module/nss/queendeath.nss +++ b/_module/nss/queendeath.nss @@ -7,7 +7,9 @@ void main() SignalEvent(OBJECT_SELF, EventUserDefined(1007)); } - ExecuteScript("sf_xp", OBJECT_SELF); + //ExecuteScript("sf_xp", OBJECT_SELF); + ExecuteScript("prc_npc_death", OBJECT_SELF); + ExecuteScript("prc_pwondeath", OBJECT_SELF); } diff --git a/_module/nss/queendeath2.nss b/_module/nss/queendeath2.nss index 69038aa2..9651d2b4 100644 --- a/_module/nss/queendeath2.nss +++ b/_module/nss/queendeath2.nss @@ -25,8 +25,9 @@ DelayCommand(0.5, ExplodeAtLocation(lSource, d10(10)+100)); SignalEvent(OBJECT_SELF, EventUserDefined(1007)); } - ExecuteScript("sf_xp", OBJECT_SELF); - ExecuteScript("prc_npc_death", OBJECT_SELF); + //ExecuteScript("sf_xp", OBJECT_SELF); + ExecuteScript("prc_npc_death", OBJECT_SELF); + ExecuteScript("prc_pwondeath", OBJECT_SELF); } diff --git a/_module/nss/quicklingdeath.nss b/_module/nss/quicklingdeath.nss index 13c7089d..01de5d46 100644 --- a/_module/nss/quicklingdeath.nss +++ b/_module/nss/quicklingdeath.nss @@ -10,6 +10,8 @@ void main() { AdjustAlignment(oKiller, ALIGNMENT_EVIL, 5); } - ExecuteScript("sf_xp", OBJECT_SELF); + //ExecuteScript("sf_xp", OBJECT_SELF); + ExecuteScript("prc_npc_death", OBJECT_SELF); + ExecuteScript("prc_pwondeath", OBJECT_SELF); } diff --git a/_module/nss/renderdeath.nss b/_module/nss/renderdeath.nss index 3ab2b496..f1958cbd 100644 --- a/_module/nss/renderdeath.nss +++ b/_module/nss/renderdeath.nss @@ -12,6 +12,8 @@ void main() SignalEvent(OBJECT_SELF, EventUserDefined(1007)); } - ExecuteScript("sf_xp", OBJECT_SELF); + //ExecuteScript("sf_xp", OBJECT_SELF); + ExecuteScript("prc_npc_death", OBJECT_SELF); + ExecuteScript("prc_pwondeath", OBJECT_SELF); } diff --git a/_module/nss/rhazhiddeath.nss b/_module/nss/rhazhiddeath.nss index b80c2946..9ba05c50 100644 --- a/_module/nss/rhazhiddeath.nss +++ b/_module/nss/rhazhiddeath.nss @@ -12,6 +12,8 @@ void main() SignalEvent(OBJECT_SELF, EventUserDefined(1007)); } - ExecuteScript("sf_xp", OBJECT_SELF); + //ExecuteScript("sf_xp", OBJECT_SELF); + ExecuteScript("prc_npc_death", OBJECT_SELF); + ExecuteScript("prc_pwondeath", OBJECT_SELF); } diff --git a/_module/nss/skeletondeath.nss b/_module/nss/skeletondeath.nss index d4a935c1..c315cd90 100644 --- a/_module/nss/skeletondeath.nss +++ b/_module/nss/skeletondeath.nss @@ -24,6 +24,7 @@ DelayCommand(0.5, ExplodeAtLocation(lSource, d6(6))); SignalEvent(OBJECT_SELF, EventUserDefined(1007)); } - ExecuteScript("sf_xp", OBJECT_SELF); - ExecuteScript("prc_npc_death", OBJECT_SELF); + //ExecuteScript("sf_xp", OBJECT_SELF); + ExecuteScript("prc_npc_death", OBJECT_SELF); + ExecuteScript("prc_pwondeath", OBJECT_SELF); } diff --git a/_module/nss/trolldeath.nss b/_module/nss/trolldeath.nss index 506ae394..d7e17b5c 100644 --- a/_module/nss/trolldeath.nss +++ b/_module/nss/trolldeath.nss @@ -13,6 +13,8 @@ void main() SignalEvent(OBJECT_SELF, EventUserDefined(1007)); } - ExecuteScript("sf_xp", OBJECT_SELF); + //ExecuteScript("sf_xp", OBJECT_SELF); + ExecuteScript("prc_npc_death", OBJECT_SELF); + ExecuteScript("prc_pwondeath", OBJECT_SELF); } diff --git a/_module/nss/x2_def_ondeath.nss b/_module/nss/x2_def_ondeath.nss new file mode 100644 index 00000000..9ae3fefd --- /dev/null +++ b/_module/nss/x2_def_ondeath.nss @@ -0,0 +1,16 @@ +//:://///////////////////////////////////////////// +//:: Name x2_def_ondeath +//:: Copyright (c) 2001 Bioware Corp. +//::////////////////////////////////////////////// +/* + Default OnDeath script +*/ +//::////////////////////////////////////////////// +//:: Created By: Keith Warner +//:: Created On: June 11/03 +//::////////////////////////////////////////////// + +void main() +{ + ExecuteScript("nw_c2_default7", OBJECT_SELF); +} diff --git a/_module/nss/yauntdeath.nss b/_module/nss/yauntdeath.nss index ecf282dd..0c00b446 100644 --- a/_module/nss/yauntdeath.nss +++ b/_module/nss/yauntdeath.nss @@ -11,7 +11,8 @@ void main() { SignalEvent(OBJECT_SELF, EventUserDefined(1007)); } - - ExecuteScript("sf_xp", OBJECT_SELF); + //ExecuteScript("sf_xp", OBJECT_SELF); + ExecuteScript("prc_npc_death", OBJECT_SELF); + ExecuteScript("prc_pwondeath", OBJECT_SELF); } diff --git a/_module/nss/zombiedeath.nss b/_module/nss/zombiedeath.nss index 0c51c95e..b3e87902 100644 --- a/_module/nss/zombiedeath.nss +++ b/_module/nss/zombiedeath.nss @@ -12,6 +12,8 @@ void main() SignalEvent(OBJECT_SELF, EventUserDefined(1007)); } - ExecuteScript("sf_xp", OBJECT_SELF); + //ExecuteScript("sf_xp", OBJECT_SELF); + ExecuteScript("prc_npc_death", OBJECT_SELF); + ExecuteScript("prc_pwondeath", OBJECT_SELF); } diff --git a/_release/PoA Public [PRC8-CEP3].7z b/_release/PoA Public [PRC8-CEP3].7z index b5cd10d9..6bfa3042 100644 Binary files a/_release/PoA Public [PRC8-CEP3].7z and b/_release/PoA Public [PRC8-CEP3].7z differ