diff --git a/_module/ifo/module.ifo.json b/_module/ifo/module.ifo.json index 5f878e9..4e2b070 100644 --- a/_module/ifo/module.ifo.json +++ b/_module/ifo/module.ifo.json @@ -1157,7 +1157,7 @@ }, "Mod_MinGameVer": { "type": "cexostring", - "value": "1.88" + "value": "1.89" }, "Mod_MinPerHour": { "type": "byte", diff --git a/_module/ncs/M1Q0EDest_D.ncs b/_module/ncs/M1Q0EDest_D.ncs index 706486e..a710f4f 100644 Binary files a/_module/ncs/M1Q0EDest_D.ncs and b/_module/ncs/M1Q0EDest_D.ncs differ diff --git a/_module/ncs/M1S3CMakeClay.ncs b/_module/ncs/M1S3CMakeClay.ncs index 608b923..0c46b0e 100644 Binary files a/_module/ncs/M1S3CMakeClay.ncs and b/_module/ncs/M1S3CMakeClay.ncs differ diff --git a/_module/ncs/M1S3CMakeFog.ncs b/_module/ncs/M1S3CMakeFog.ncs index cfacf84..73ca2da 100644 Binary files a/_module/ncs/M1S3CMakeFog.ncs and b/_module/ncs/M1S3CMakeFog.ncs differ diff --git a/_module/ncs/M1S3CMakeH2O.ncs b/_module/ncs/M1S3CMakeH2O.ncs index 150b861..5c8b050 100644 Binary files a/_module/ncs/M1S3CMakeH2O.ncs and b/_module/ncs/M1S3CMakeH2O.ncs differ diff --git a/_module/ncs/M1S3CMakeWood.ncs b/_module/ncs/M1S3CMakeWood.ncs index af685d2..3983cf7 100644 Binary files a/_module/ncs/M1S3CMakeWood.ncs and b/_module/ncs/M1S3CMakeWood.ncs differ diff --git a/_module/ncs/ac_arcanesheath.ncs b/_module/ncs/ac_arcanesheath.ncs index f3cc901..bd168aa 100644 Binary files a/_module/ncs/ac_arcanesheath.ncs and b/_module/ncs/ac_arcanesheath.ncs differ diff --git a/_module/ncs/ac_bootsofbannis.ncs b/_module/ncs/ac_bootsofbannis.ncs index c055eeb..96f0c49 100644 Binary files a/_module/ncs/ac_bootsofbannis.ncs and b/_module/ncs/ac_bootsofbannis.ncs differ diff --git a/_module/ncs/ac_druidtool.ncs b/_module/ncs/ac_druidtool.ncs index 21b23be..dca174e 100644 Binary files a/_module/ncs/ac_druidtool.ncs and b/_module/ncs/ac_druidtool.ncs differ diff --git a/_module/ncs/ac_pcplaything.ncs b/_module/ncs/ac_pcplaything.ncs index f8ab83e..c25d1e4 100644 Binary files a/_module/ncs/ac_pcplaything.ncs and b/_module/ncs/ac_pcplaything.ncs differ diff --git a/_module/ncs/ac_scalesofsente.ncs b/_module/ncs/ac_scalesofsente.ncs index b2b00e9..548a721 100644 Binary files a/_module/ncs/ac_scalesofsente.ncs and b/_module/ncs/ac_scalesofsente.ncs differ diff --git a/_module/ncs/acn_check_rdd.ncs b/_module/ncs/acn_check_rdd.ncs index dc2d3b4..3c70b25 100644 Binary files a/_module/ncs/acn_check_rdd.ncs and b/_module/ncs/acn_check_rdd.ncs differ diff --git a/_module/ncs/adventureportal1.ncs b/_module/ncs/adventureportal1.ncs index 05128e8..51cb890 100644 Binary files a/_module/ncs/adventureportal1.ncs and b/_module/ncs/adventureportal1.ncs differ diff --git a/_module/ncs/advportaljump.ncs b/_module/ncs/advportaljump.ncs index 01e423e..47cd72d 100644 Binary files a/_module/ncs/advportaljump.ncs and b/_module/ncs/advportaljump.ncs differ diff --git a/_module/ncs/ag_area_clean.ncs b/_module/ncs/ag_area_clean.ncs index e0ee8b6..83f5abe 100644 Binary files a/_module/ncs/ag_area_clean.ncs and b/_module/ncs/ag_area_clean.ncs differ diff --git a/_module/ncs/allowrandomsocky.ncs b/_module/ncs/allowrandomsocky.ncs index c204c41..f346d3b 100644 Binary files a/_module/ncs/allowrandomsocky.ncs and b/_module/ncs/allowrandomsocky.ncs differ diff --git a/_module/ncs/altarjump33.ncs b/_module/ncs/altarjump33.ncs index 9f39269..fc92ce8 100644 Binary files a/_module/ncs/altarjump33.ncs and b/_module/ncs/altarjump33.ncs differ diff --git a/_module/ncs/alterjump33.ncs b/_module/ncs/alterjump33.ncs index a21e6b4..826d39d 100644 Binary files a/_module/ncs/alterjump33.ncs and b/_module/ncs/alterjump33.ncs differ diff --git a/_module/ncs/ancruinjump1.ncs b/_module/ncs/ancruinjump1.ncs index bc08e15..f70870b 100644 Binary files a/_module/ncs/ancruinjump1.ncs and b/_module/ncs/ancruinjump1.ncs differ diff --git a/_module/ncs/array_example.ncs b/_module/ncs/array_example.ncs new file mode 100644 index 0000000..90adc90 Binary files /dev/null and b/_module/ncs/array_example.ncs differ diff --git a/_module/ncs/at_012.ncs b/_module/ncs/at_012.ncs index b087c91..11a8231 100644 Binary files a/_module/ncs/at_012.ncs and b/_module/ncs/at_012.ncs differ diff --git a/_module/ncs/autorespawn.ncs b/_module/ncs/autorespawn.ncs index 28c49a3..ad53ddd 100644 Binary files a/_module/ncs/autorespawn.ncs and b/_module/ncs/autorespawn.ncs differ diff --git a/_module/ncs/bardsecretrigg.ncs b/_module/ncs/bardsecretrigg.ncs index 8a655cc..44ef59a 100644 Binary files a/_module/ncs/bardsecretrigg.ncs and b/_module/ncs/bardsecretrigg.ncs differ diff --git a/_module/ncs/bladespawn.ncs b/_module/ncs/bladespawn.ncs index d62a8e0..5528b63 100644 Binary files a/_module/ncs/bladespawn.ncs and b/_module/ncs/bladespawn.ncs differ diff --git a/_module/ncs/bleeding.ncs b/_module/ncs/bleeding.ncs index 4191045..5cf2873 100644 Binary files a/_module/ncs/bleeding.ncs and b/_module/ncs/bleeding.ncs differ diff --git a/_module/ncs/bootnonguild.ncs b/_module/ncs/bootnonguild.ncs index 35f1ff1..73fb15d 100644 Binary files a/_module/ncs/bootnonguild.ncs and b/_module/ncs/bootnonguild.ncs differ diff --git a/_module/ncs/castingportal1.ncs b/_module/ncs/castingportal1.ncs index e2efe0b..34577ec 100644 Binary files a/_module/ncs/castingportal1.ncs and b/_module/ncs/castingportal1.ncs differ diff --git a/_module/ncs/chestdestroyer.ncs b/_module/ncs/chestdestroyer.ncs index ab6a0cd..65045ad 100644 Binary files a/_module/ncs/chestdestroyer.ncs and b/_module/ncs/chestdestroyer.ncs differ diff --git a/_module/ncs/chestrapelectric.ncs b/_module/ncs/chestrapelectric.ncs index 56ba27a..1304224 100644 Binary files a/_module/ncs/chestrapelectric.ncs and b/_module/ncs/chestrapelectric.ncs differ diff --git a/_module/ncs/chestspawnscrpt1.ncs b/_module/ncs/chestspawnscrpt1.ncs index ed120c8..7ba7dc9 100644 Binary files a/_module/ncs/chestspawnscrpt1.ncs and b/_module/ncs/chestspawnscrpt1.ncs differ diff --git a/_module/ncs/cleanemporium.ncs b/_module/ncs/cleanemporium.ncs index 796f1d6..a28284e 100644 Binary files a/_module/ncs/cleanemporium.ncs and b/_module/ncs/cleanemporium.ncs differ diff --git a/_module/ncs/cleartown.ncs b/_module/ncs/cleartown.ncs index e0ee8b6..83f5abe 100644 Binary files a/_module/ncs/cleartown.ncs and b/_module/ncs/cleartown.ncs differ diff --git a/_module/ncs/clericonly.ncs b/_module/ncs/clericonly.ncs index 97f2f16..2c3fe41 100644 Binary files a/_module/ncs/clericonly.ncs and b/_module/ncs/clericonly.ncs differ diff --git a/_module/ncs/close_door.ncs b/_module/ncs/close_door.ncs index ba5d1a2..ffd2486 100644 Binary files a/_module/ncs/close_door.ncs and b/_module/ncs/close_door.ncs differ diff --git a/_module/ncs/closedoor.ncs b/_module/ncs/closedoor.ncs index e2fbdf4..8a646cd 100644 Binary files a/_module/ncs/closedoor.ncs and b/_module/ncs/closedoor.ncs differ diff --git a/_module/ncs/closenlock.ncs b/_module/ncs/closenlock.ncs index 02a2a6f..6e3f893 100644 Binary files a/_module/ncs/closenlock.ncs and b/_module/ncs/closenlock.ncs differ diff --git a/_module/ncs/damnedstatueport.ncs b/_module/ncs/damnedstatueport.ncs index 13afde5..a2a2cde 100644 Binary files a/_module/ncs/damnedstatueport.ncs and b/_module/ncs/damnedstatueport.ncs differ diff --git a/_module/ncs/dancingbowruns.ncs b/_module/ncs/dancingbowruns.ncs index fc79f32..9114180 100644 Binary files a/_module/ncs/dancingbowruns.ncs and b/_module/ncs/dancingbowruns.ncs differ diff --git a/_module/ncs/danger.ncs b/_module/ncs/danger.ncs index 48d5d7c..fb1dd2f 100644 Binary files a/_module/ncs/danger.ncs and b/_module/ncs/danger.ncs differ diff --git a/_module/ncs/darkdeath.ncs b/_module/ncs/darkdeath.ncs index 394c9af..1366232 100644 Binary files a/_module/ncs/darkdeath.ncs and b/_module/ncs/darkdeath.ncs differ diff --git a/_module/ncs/darktrigger.ncs b/_module/ncs/darktrigger.ncs index 3678fcf..a3f08a1 100644 Binary files a/_module/ncs/darktrigger.ncs and b/_module/ncs/darktrigger.ncs differ diff --git a/_module/ncs/darktrigger2a.ncs b/_module/ncs/darktrigger2a.ncs index 0d166dc..025fa0b 100644 Binary files a/_module/ncs/darktrigger2a.ncs and b/_module/ncs/darktrigger2a.ncs differ diff --git a/_module/ncs/deathbringerspwn.ncs b/_module/ncs/deathbringerspwn.ncs index e2aa53e..81b8f66 100644 Binary files a/_module/ncs/deathbringerspwn.ncs and b/_module/ncs/deathbringerspwn.ncs differ diff --git a/_module/ncs/deathport.ncs b/_module/ncs/deathport.ncs index 1cb47c7..d90a360 100644 Binary files a/_module/ncs/deathport.ncs and b/_module/ncs/deathport.ncs differ diff --git a/_module/ncs/deathreturnscrpt.ncs b/_module/ncs/deathreturnscrpt.ncs index ce35732..35678ca 100644 Binary files a/_module/ncs/deathreturnscrpt.ncs and b/_module/ncs/deathreturnscrpt.ncs differ diff --git a/_module/ncs/despawn_grimm.ncs b/_module/ncs/despawn_grimm.ncs index a143f0d..21c9a73 100644 Binary files a/_module/ncs/despawn_grimm.ncs and b/_module/ncs/despawn_grimm.ncs differ diff --git a/_module/ncs/divide_loot_oc.ncs b/_module/ncs/divide_loot_oc.ncs index a135b47..6bcf8e8 100644 Binary files a/_module/ncs/divide_loot_oc.ncs and b/_module/ncs/divide_loot_oc.ncs differ diff --git a/_module/ncs/divnportaltrigg7.ncs b/_module/ncs/divnportaltrigg7.ncs index 7c8fa88..a834cc5 100644 Binary files a/_module/ncs/divnportaltrigg7.ncs and b/_module/ncs/divnportaltrigg7.ncs differ diff --git a/_module/ncs/dm_forg_ondist.ncs b/_module/ncs/dm_forg_ondist.ncs index b5cf9e8..9932a71 100644 Binary files a/_module/ncs/dm_forg_ondist.ncs and b/_module/ncs/dm_forg_ondist.ncs differ diff --git a/_module/ncs/doby_no_pc_chest.ncs b/_module/ncs/doby_no_pc_chest.ncs index e6c9502..27ff6f5 100644 Binary files a/_module/ncs/doby_no_pc_chest.ncs and b/_module/ncs/doby_no_pc_chest.ncs differ diff --git a/_module/ncs/drowattack.ncs b/_module/ncs/drowattack.ncs index b3d755d..9adca0b 100644 Binary files a/_module/ncs/drowattack.ncs and b/_module/ncs/drowattack.ncs differ diff --git a/_module/ncs/drowbosspercieve.ncs b/_module/ncs/drowbosspercieve.ncs index 660c9ba..25cbd29 100644 Binary files a/_module/ncs/drowbosspercieve.ncs and b/_module/ncs/drowbosspercieve.ncs differ diff --git a/_module/ncs/drowspawn.ncs b/_module/ncs/drowspawn.ncs index ac657dc..10c7bdc 100644 Binary files a/_module/ncs/drowspawn.ncs and b/_module/ncs/drowspawn.ncs differ diff --git a/_module/ncs/dummy2.ncs b/_module/ncs/dummy2.ncs index 8a16171..35149cb 100644 Binary files a/_module/ncs/dummy2.ncs and b/_module/ncs/dummy2.ncs differ diff --git a/_module/ncs/dummyspell.ncs b/_module/ncs/dummyspell.ncs index b284eeb..710a55a 100644 Binary files a/_module/ncs/dummyspell.ncs and b/_module/ncs/dummyspell.ncs differ diff --git a/_module/ncs/elemtflamedamage.ncs b/_module/ncs/elemtflamedamage.ncs index 70cdc5a..dc332a7 100644 Binary files a/_module/ncs/elemtflamedamage.ncs and b/_module/ncs/elemtflamedamage.ncs differ diff --git a/_module/ncs/enterguild.ncs b/_module/ncs/enterguild.ncs index d4515a3..eb69bd4 100644 Binary files a/_module/ncs/enterguild.ncs and b/_module/ncs/enterguild.ncs differ diff --git a/_module/ncs/epicstorejumptrg.ncs b/_module/ncs/epicstorejumptrg.ncs index c8b3b61..25735b5 100644 Binary files a/_module/ncs/epicstorejumptrg.ncs and b/_module/ncs/epicstorejumptrg.ncs differ diff --git a/_module/ncs/ew_act_drunk.ncs b/_module/ncs/ew_act_drunk.ncs index 6b0163d..c906ec1 100644 Binary files a/_module/ncs/ew_act_drunk.ncs and b/_module/ncs/ew_act_drunk.ncs differ diff --git a/_module/ncs/ew_ani_armsup.ncs b/_module/ncs/ew_ani_armsup.ncs index 19887a9..89937dd 100644 Binary files a/_module/ncs/ew_ani_armsup.ncs and b/_module/ncs/ew_ani_armsup.ncs differ diff --git a/_module/ncs/ew_ani_bowdown.ncs b/_module/ncs/ew_ani_bowdown.ncs index 31dfdca..6d34c52 100644 Binary files a/_module/ncs/ew_ani_bowdown.ncs and b/_module/ncs/ew_ani_bowdown.ncs differ diff --git a/_module/ncs/ew_ani_crouch.ncs b/_module/ncs/ew_ani_crouch.ncs index 1eae934..45285a4 100644 Binary files a/_module/ncs/ew_ani_crouch.ncs and b/_module/ncs/ew_ani_crouch.ncs differ diff --git a/_module/ncs/ew_ani_kneelout.ncs b/_module/ncs/ew_ani_kneelout.ncs index 3fd3cbf..6087ab5 100644 Binary files a/_module/ncs/ew_ani_kneelout.ncs and b/_module/ncs/ew_ani_kneelout.ncs differ diff --git a/_module/ncs/ew_ani_kneelup.ncs b/_module/ncs/ew_ani_kneelup.ncs index fee33dc..50e46f6 100644 Binary files a/_module/ncs/ew_ani_kneelup.ncs and b/_module/ncs/ew_ani_kneelup.ncs differ diff --git a/_module/ncs/ew_ani_reset.ncs b/_module/ncs/ew_ani_reset.ncs index d8582ee..5ee10de 100644 Binary files a/_module/ncs/ew_ani_reset.ncs and b/_module/ncs/ew_ani_reset.ncs differ diff --git a/_module/ncs/ew_dance.ncs b/_module/ncs/ew_dance.ncs index fbe0ea8..0a22ca9 100644 Binary files a/_module/ncs/ew_dance.ncs and b/_module/ncs/ew_dance.ncs differ diff --git a/_module/ncs/ew_lapsit0.ncs b/_module/ncs/ew_lapsit0.ncs index e50472d..9a55a00 100644 Binary files a/_module/ncs/ew_lapsit0.ncs and b/_module/ncs/ew_lapsit0.ncs differ diff --git a/_module/ncs/ew_lapsit180.ncs b/_module/ncs/ew_lapsit180.ncs index d57c19f..b6f7c3e 100644 Binary files a/_module/ncs/ew_lapsit180.ncs and b/_module/ncs/ew_lapsit180.ncs differ diff --git a/_module/ncs/ew_lapsit270.ncs b/_module/ncs/ew_lapsit270.ncs index 74b6fec..29547d8 100644 Binary files a/_module/ncs/ew_lapsit270.ncs and b/_module/ncs/ew_lapsit270.ncs differ diff --git a/_module/ncs/ew_lapsit90.ncs b/_module/ncs/ew_lapsit90.ncs index 26e9b53..e928dbd 100644 Binary files a/_module/ncs/ew_lapsit90.ncs and b/_module/ncs/ew_lapsit90.ncs differ diff --git a/_module/ncs/exitguild.ncs b/_module/ncs/exitguild.ncs index bf9cd8a..4771be6 100644 Binary files a/_module/ncs/exitguild.ncs and b/_module/ncs/exitguild.ncs differ diff --git a/_module/ncs/exmpl_treasure.ncs b/_module/ncs/exmpl_treasure.ncs index cd2ab57..9faea86 100644 Binary files a/_module/ncs/exmpl_treasure.ncs and b/_module/ncs/exmpl_treasure.ncs differ diff --git a/_module/ncs/fky_chat.ncs b/_module/ncs/fky_chat.ncs index e0d47ff..7a1c8c7 100644 Binary files a/_module/ncs/fky_chat.ncs and b/_module/ncs/fky_chat.ncs differ diff --git a/_module/ncs/flameheartbeat.ncs b/_module/ncs/flameheartbeat.ncs index 1c56438..227bc6c 100644 Binary files a/_module/ncs/flameheartbeat.ncs and b/_module/ncs/flameheartbeat.ncs differ diff --git a/_module/ncs/fuguespawn.ncs b/_module/ncs/fuguespawn.ncs index d62a8e0..5528b63 100644 Binary files a/_module/ncs/fuguespawn.ncs and b/_module/ncs/fuguespawn.ncs differ diff --git a/_module/ncs/gc_add_ability.ncs b/_module/ncs/gc_add_ability.ncs index f204029..56897da 100644 Binary files a/_module/ncs/gc_add_ability.ncs and b/_module/ncs/gc_add_ability.ncs differ diff --git a/_module/ncs/gc_add_ac.ncs b/_module/ncs/gc_add_ac.ncs index 29b89db..4dfad9f 100644 Binary files a/_module/ncs/gc_add_ac.ncs and b/_module/ncs/gc_add_ac.ncs differ diff --git a/_module/ncs/gc_add_attk_bon.ncs b/_module/ncs/gc_add_attk_bon.ncs index e028831..fba7767 100644 Binary files a/_module/ncs/gc_add_attk_bon.ncs and b/_module/ncs/gc_add_attk_bon.ncs differ diff --git a/_module/ncs/gc_add_bon_spell.ncs b/_module/ncs/gc_add_bon_spell.ncs index 48d2ba3..8a98535 100644 Binary files a/_module/ncs/gc_add_bon_spell.ncs and b/_module/ncs/gc_add_bon_spell.ncs differ diff --git a/_module/ncs/gc_add_dmg_bonus.ncs b/_module/ncs/gc_add_dmg_bonus.ncs index 422b6db..a3c3f14 100644 Binary files a/_module/ncs/gc_add_dmg_bonus.ncs and b/_module/ncs/gc_add_dmg_bonus.ncs differ diff --git a/_module/ncs/gc_add_dmg_imm.ncs b/_module/ncs/gc_add_dmg_imm.ncs index be89917..97b43af 100644 Binary files a/_module/ncs/gc_add_dmg_imm.ncs and b/_module/ncs/gc_add_dmg_imm.ncs differ diff --git a/_module/ncs/gc_add_dmg_red.ncs b/_module/ncs/gc_add_dmg_red.ncs index f5eda66..e404e2e 100644 Binary files a/_module/ncs/gc_add_dmg_red.ncs and b/_module/ncs/gc_add_dmg_red.ncs differ diff --git a/_module/ncs/gc_add_ench_bon.ncs b/_module/ncs/gc_add_ench_bon.ncs index 3a23c4a..187cae3 100644 Binary files a/_module/ncs/gc_add_ench_bon.ncs and b/_module/ncs/gc_add_ench_bon.ncs differ diff --git a/_module/ncs/gc_add_evade.ncs b/_module/ncs/gc_add_evade.ncs index 2233ead..44309fa 100644 Binary files a/_module/ncs/gc_add_evade.ncs and b/_module/ncs/gc_add_evade.ncs differ diff --git a/_module/ncs/gc_add_feat.ncs b/_module/ncs/gc_add_feat.ncs index 393d859..a3ae0b4 100644 Binary files a/_module/ncs/gc_add_feat.ncs and b/_module/ncs/gc_add_feat.ncs differ diff --git a/_module/ncs/gc_add_freedom.ncs b/_module/ncs/gc_add_freedom.ncs index 5fd11e7..6ff73fb 100644 Binary files a/_module/ncs/gc_add_freedom.ncs and b/_module/ncs/gc_add_freedom.ncs differ diff --git a/_module/ncs/gc_add_haste.ncs b/_module/ncs/gc_add_haste.ncs index cece1a5..4b479ff 100644 Binary files a/_module/ncs/gc_add_haste.ncs and b/_module/ncs/gc_add_haste.ncs differ diff --git a/_module/ncs/gc_add_immunity.ncs b/_module/ncs/gc_add_immunity.ncs index c3040f6..870594c 100644 Binary files a/_module/ncs/gc_add_immunity.ncs and b/_module/ncs/gc_add_immunity.ncs differ diff --git a/_module/ncs/gc_add_keen.ncs b/_module/ncs/gc_add_keen.ncs index 0d01a21..8ab9ef1 100644 Binary files a/_module/ncs/gc_add_keen.ncs and b/_module/ncs/gc_add_keen.ncs differ diff --git a/_module/ncs/gc_add_massv_crt.ncs b/_module/ncs/gc_add_massv_crt.ncs index 434d8d2..8f31a9a 100644 Binary files a/_module/ncs/gc_add_massv_crt.ncs and b/_module/ncs/gc_add_massv_crt.ncs differ diff --git a/_module/ncs/gc_add_mighty.ncs b/_module/ncs/gc_add_mighty.ncs index 346a5df..ba163c6 100644 Binary files a/_module/ncs/gc_add_mighty.ncs and b/_module/ncs/gc_add_mighty.ncs differ diff --git a/_module/ncs/gc_add_regen.ncs b/_module/ncs/gc_add_regen.ncs index d1bb098..251e06d 100644 Binary files a/_module/ncs/gc_add_regen.ncs and b/_module/ncs/gc_add_regen.ncs differ diff --git a/_module/ncs/gc_add_resist.ncs b/_module/ncs/gc_add_resist.ncs index 0ddc432..376c55f 100644 Binary files a/_module/ncs/gc_add_resist.ncs and b/_module/ncs/gc_add_resist.ncs differ diff --git a/_module/ncs/gc_add_save.ncs b/_module/ncs/gc_add_save.ncs index 1e144d0..21e1e4a 100644 Binary files a/_module/ncs/gc_add_save.ncs and b/_module/ncs/gc_add_save.ncs differ diff --git a/_module/ncs/gc_add_skills.ncs b/_module/ncs/gc_add_skills.ncs index fa9b133..11bdf8f 100644 Binary files a/_module/ncs/gc_add_skills.ncs and b/_module/ncs/gc_add_skills.ncs differ diff --git a/_module/ncs/gc_add_sr.ncs b/_module/ncs/gc_add_sr.ncs index bd3646c..3f04f9e 100644 Binary files a/_module/ncs/gc_add_sr.ncs and b/_module/ncs/gc_add_sr.ncs differ diff --git a/_module/ncs/gc_add_true_see.ncs b/_module/ncs/gc_add_true_see.ncs index ed87d8f..0d9fe61 100644 Binary files a/_module/ncs/gc_add_true_see.ncs and b/_module/ncs/gc_add_true_see.ncs differ diff --git a/_module/ncs/gc_add_vamp_regn.ncs b/_module/ncs/gc_add_vamp_regn.ncs index 1dc16fe..2333ae5 100644 Binary files a/_module/ncs/gc_add_vamp_regn.ncs and b/_module/ncs/gc_add_vamp_regn.ncs differ diff --git a/_module/ncs/gearchecksecret.ncs b/_module/ncs/gearchecksecret.ncs index 5e61906..d831fc5 100644 Binary files a/_module/ncs/gearchecksecret.ncs and b/_module/ncs/gearchecksecret.ncs differ diff --git a/_module/ncs/gemport2.ncs b/_module/ncs/gemport2.ncs index 4110807..fdc0a5d 100644 Binary files a/_module/ncs/gemport2.ncs and b/_module/ncs/gemport2.ncs differ diff --git a/_module/ncs/gemport3.ncs b/_module/ncs/gemport3.ncs index 8d40c68..5bd9392 100644 Binary files a/_module/ncs/gemport3.ncs and b/_module/ncs/gemport3.ncs differ diff --git a/_module/ncs/gen_treas_on_opn.ncs b/_module/ncs/gen_treas_on_opn.ncs index f7f0ed4..a2183de 100644 Binary files a/_module/ncs/gen_treas_on_opn.ncs and b/_module/ncs/gen_treas_on_opn.ncs differ diff --git a/_module/ncs/givesocketgem1.ncs b/_module/ncs/givesocketgem1.ncs index 03ce028..768e21c 100644 Binary files a/_module/ncs/givesocketgem1.ncs and b/_module/ncs/givesocketgem1.ncs differ diff --git a/_module/ncs/givesocketgem10.ncs b/_module/ncs/givesocketgem10.ncs index 5e6aee6..fa198f0 100644 Binary files a/_module/ncs/givesocketgem10.ncs and b/_module/ncs/givesocketgem10.ncs differ diff --git a/_module/ncs/givesocketgem11.ncs b/_module/ncs/givesocketgem11.ncs index a52631d..0601fed 100644 Binary files a/_module/ncs/givesocketgem11.ncs and b/_module/ncs/givesocketgem11.ncs differ diff --git a/_module/ncs/givesocketgem12.ncs b/_module/ncs/givesocketgem12.ncs index e30ac1a..18042dc 100644 Binary files a/_module/ncs/givesocketgem12.ncs and b/_module/ncs/givesocketgem12.ncs differ diff --git a/_module/ncs/givesocketgem13.ncs b/_module/ncs/givesocketgem13.ncs index dafcdde..642ba91 100644 Binary files a/_module/ncs/givesocketgem13.ncs and b/_module/ncs/givesocketgem13.ncs differ diff --git a/_module/ncs/givesocketgem14.ncs b/_module/ncs/givesocketgem14.ncs index 9ad8e4c..c456695 100644 Binary files a/_module/ncs/givesocketgem14.ncs and b/_module/ncs/givesocketgem14.ncs differ diff --git a/_module/ncs/givesocketgem15.ncs b/_module/ncs/givesocketgem15.ncs index a3f67c8..8df3e04 100644 Binary files a/_module/ncs/givesocketgem15.ncs and b/_module/ncs/givesocketgem15.ncs differ diff --git a/_module/ncs/givesocketgem16.ncs b/_module/ncs/givesocketgem16.ncs index e14ce1b..1494c19 100644 Binary files a/_module/ncs/givesocketgem16.ncs and b/_module/ncs/givesocketgem16.ncs differ diff --git a/_module/ncs/givesocketgem17.ncs b/_module/ncs/givesocketgem17.ncs index 59fa17b..2e1e8ba 100644 Binary files a/_module/ncs/givesocketgem17.ncs and b/_module/ncs/givesocketgem17.ncs differ diff --git a/_module/ncs/givesocketgem18.ncs b/_module/ncs/givesocketgem18.ncs index 0fee18f..88180e2 100644 Binary files a/_module/ncs/givesocketgem18.ncs and b/_module/ncs/givesocketgem18.ncs differ diff --git a/_module/ncs/givesocketgem2.ncs b/_module/ncs/givesocketgem2.ncs index 9e17915..5179a52 100644 Binary files a/_module/ncs/givesocketgem2.ncs and b/_module/ncs/givesocketgem2.ncs differ diff --git a/_module/ncs/givesocketgem20.ncs b/_module/ncs/givesocketgem20.ncs index 275d6ee..fa764ef 100644 Binary files a/_module/ncs/givesocketgem20.ncs and b/_module/ncs/givesocketgem20.ncs differ diff --git a/_module/ncs/givesocketgem21.ncs b/_module/ncs/givesocketgem21.ncs index 954639d..b068df4 100644 Binary files a/_module/ncs/givesocketgem21.ncs and b/_module/ncs/givesocketgem21.ncs differ diff --git a/_module/ncs/givesocketgem22.ncs b/_module/ncs/givesocketgem22.ncs index e48840e..c090d6c 100644 Binary files a/_module/ncs/givesocketgem22.ncs and b/_module/ncs/givesocketgem22.ncs differ diff --git a/_module/ncs/givesocketgem23.ncs b/_module/ncs/givesocketgem23.ncs index 4d94d27..9d48e5a 100644 Binary files a/_module/ncs/givesocketgem23.ncs and b/_module/ncs/givesocketgem23.ncs differ diff --git a/_module/ncs/givesocketgem24.ncs b/_module/ncs/givesocketgem24.ncs index 00b13e0..ca64ff2 100644 Binary files a/_module/ncs/givesocketgem24.ncs and b/_module/ncs/givesocketgem24.ncs differ diff --git a/_module/ncs/givesocketgem3.ncs b/_module/ncs/givesocketgem3.ncs index f2c3ab8..ee55dda 100644 Binary files a/_module/ncs/givesocketgem3.ncs and b/_module/ncs/givesocketgem3.ncs differ diff --git a/_module/ncs/givesocketgem30.ncs b/_module/ncs/givesocketgem30.ncs index 826ba00..8122be7 100644 Binary files a/_module/ncs/givesocketgem30.ncs and b/_module/ncs/givesocketgem30.ncs differ diff --git a/_module/ncs/givesocketgem31.ncs b/_module/ncs/givesocketgem31.ncs index bb9807c..3a06b6b 100644 Binary files a/_module/ncs/givesocketgem31.ncs and b/_module/ncs/givesocketgem31.ncs differ diff --git a/_module/ncs/givesocketgem32.ncs b/_module/ncs/givesocketgem32.ncs index 62465d8..0f17657 100644 Binary files a/_module/ncs/givesocketgem32.ncs and b/_module/ncs/givesocketgem32.ncs differ diff --git a/_module/ncs/givesocketgem33.ncs b/_module/ncs/givesocketgem33.ncs index d6468c7..96d0b00 100644 Binary files a/_module/ncs/givesocketgem33.ncs and b/_module/ncs/givesocketgem33.ncs differ diff --git a/_module/ncs/givesocketgem34.ncs b/_module/ncs/givesocketgem34.ncs index e4a5dfc..0a57bc5 100644 Binary files a/_module/ncs/givesocketgem34.ncs and b/_module/ncs/givesocketgem34.ncs differ diff --git a/_module/ncs/givesocketgem35.ncs b/_module/ncs/givesocketgem35.ncs index 7341490..b56612f 100644 Binary files a/_module/ncs/givesocketgem35.ncs and b/_module/ncs/givesocketgem35.ncs differ diff --git a/_module/ncs/givesocketgem4.ncs b/_module/ncs/givesocketgem4.ncs index 26b2a63..5c0c697 100644 Binary files a/_module/ncs/givesocketgem4.ncs and b/_module/ncs/givesocketgem4.ncs differ diff --git a/_module/ncs/givesocketgem5.ncs b/_module/ncs/givesocketgem5.ncs index 718d6c9..3faead0 100644 Binary files a/_module/ncs/givesocketgem5.ncs and b/_module/ncs/givesocketgem5.ncs differ diff --git a/_module/ncs/givesocketgem6.ncs b/_module/ncs/givesocketgem6.ncs index c6491e4..c76fd9f 100644 Binary files a/_module/ncs/givesocketgem6.ncs and b/_module/ncs/givesocketgem6.ncs differ diff --git a/_module/ncs/givesocketgem7.ncs b/_module/ncs/givesocketgem7.ncs index 33eaff3..dda34d4 100644 Binary files a/_module/ncs/givesocketgem7.ncs and b/_module/ncs/givesocketgem7.ncs differ diff --git a/_module/ncs/givesocketgem8.ncs b/_module/ncs/givesocketgem8.ncs index 4d5bb56..92f3a13 100644 Binary files a/_module/ncs/givesocketgem8.ncs and b/_module/ncs/givesocketgem8.ncs differ diff --git a/_module/ncs/givesocketgem9.ncs b/_module/ncs/givesocketgem9.ncs index 194b35f..322ea44 100644 Binary files a/_module/ncs/givesocketgem9.ncs and b/_module/ncs/givesocketgem9.ncs differ diff --git a/_module/ncs/givesocketgems93.ncs b/_module/ncs/givesocketgems93.ncs index c9ab138..a967bdb 100644 Binary files a/_module/ncs/givesocketgems93.ncs and b/_module/ncs/givesocketgems93.ncs differ diff --git a/_module/ncs/goddoordkeychk.ncs b/_module/ncs/goddoordkeychk.ncs index adf4749..9d94152 100644 Binary files a/_module/ncs/goddoordkeychk.ncs and b/_module/ncs/goddoordkeychk.ncs differ diff --git a/_module/ncs/guild_door.ncs b/_module/ncs/guild_door.ncs index d4515a3..eb69bd4 100644 Binary files a/_module/ncs/guild_door.ncs and b/_module/ncs/guild_door.ncs differ diff --git a/_module/ncs/guildbootspc.ncs b/_module/ncs/guildbootspc.ncs index 5498bb4..6890e4d 100644 Binary files a/_module/ncs/guildbootspc.ncs and b/_module/ncs/guildbootspc.ncs differ diff --git a/_module/ncs/guilesplanargate.ncs b/_module/ncs/guilesplanargate.ncs index 97cd87b..61bf22c 100644 Binary files a/_module/ncs/guilesplanargate.ncs and b/_module/ncs/guilesplanargate.ncs differ diff --git a/_module/ncs/guilestatuescrpt.ncs b/_module/ncs/guilestatuescrpt.ncs index 98b8fde..4dae0f7 100644 Binary files a/_module/ncs/guilestatuescrpt.ncs and b/_module/ncs/guilestatuescrpt.ncs differ diff --git a/_module/ncs/guileteleportspc.ncs b/_module/ncs/guileteleportspc.ncs index 0162d2f..f40cf8e 100644 Binary files a/_module/ncs/guileteleportspc.ncs and b/_module/ncs/guileteleportspc.ncs differ diff --git a/_module/ncs/hackerkillscript.ncs b/_module/ncs/hackerkillscript.ncs index 99fb0fe..f96c906 100644 Binary files a/_module/ncs/hackerkillscript.ncs and b/_module/ncs/hackerkillscript.ncs differ diff --git a/_module/ncs/hackersenttohell.ncs b/_module/ncs/hackersenttohell.ncs index 2e61bee..ecdb877 100644 Binary files a/_module/ncs/hackersenttohell.ncs and b/_module/ncs/hackersenttohell.ncs differ diff --git a/_module/ncs/hc_grenade.ncs b/_module/ncs/hc_grenade.ncs index 824a6c5..dde68d8 100644 Binary files a/_module/ncs/hc_grenade.ncs and b/_module/ncs/hc_grenade.ncs differ diff --git a/_module/ncs/healworshiper.ncs b/_module/ncs/healworshiper.ncs index 1ec8279..825b7f9 100644 Binary files a/_module/ncs/healworshiper.ncs and b/_module/ncs/healworshiper.ncs differ diff --git a/_module/ncs/heavensportspc3.ncs b/_module/ncs/heavensportspc3.ncs index e410acf..9830494 100644 Binary files a/_module/ncs/heavensportspc3.ncs and b/_module/ncs/heavensportspc3.ncs differ diff --git a/_module/ncs/henchrezscript.ncs b/_module/ncs/henchrezscript.ncs index 846a1a3..9d6bb40 100644 Binary files a/_module/ncs/henchrezscript.ncs and b/_module/ncs/henchrezscript.ncs differ diff --git a/_module/ncs/herodoorlocks.ncs b/_module/ncs/herodoorlocks.ncs index d9e8fe8..8ca5e62 100644 Binary files a/_module/ncs/herodoorlocks.ncs and b/_module/ncs/herodoorlocks.ncs differ diff --git a/_module/ncs/herodoorlocks2.ncs b/_module/ncs/herodoorlocks2.ncs index db08c94..a6ad5c2 100644 Binary files a/_module/ncs/herodoorlocks2.ncs and b/_module/ncs/herodoorlocks2.ncs differ diff --git a/_module/ncs/herodoorlocks3.ncs b/_module/ncs/herodoorlocks3.ncs index 85a5834..8c84ae6 100644 Binary files a/_module/ncs/herodoorlocks3.ncs and b/_module/ncs/herodoorlocks3.ncs differ diff --git a/_module/ncs/heroportalscrpt.ncs b/_module/ncs/heroportalscrpt.ncs index 65272f0..a3ed00c 100644 Binary files a/_module/ncs/heroportalscrpt.ncs and b/_module/ncs/heroportalscrpt.ncs differ diff --git a/_module/ncs/herostatueused.ncs b/_module/ncs/herostatueused.ncs index 45f00b6..d4f45bc 100644 Binary files a/_module/ncs/herostatueused.ncs and b/_module/ncs/herostatueused.ncs differ diff --git a/_module/ncs/hgll_lvl_portal.ncs b/_module/ncs/hgll_lvl_portal.ncs index 9d1af8f..2a582df 100644 Binary files a/_module/ncs/hgll_lvl_portal.ncs and b/_module/ncs/hgll_lvl_portal.ncs differ diff --git a/_module/ncs/homagicportaljmp.ncs b/_module/ncs/homagicportaljmp.ncs index 7f02513..e59d661 100644 Binary files a/_module/ncs/homagicportaljmp.ncs and b/_module/ncs/homagicportaljmp.ncs differ diff --git a/_module/ncs/horrordying.ncs b/_module/ncs/horrordying.ncs index 8bf05a8..b68f41b 100644 Binary files a/_module/ncs/horrordying.ncs and b/_module/ncs/horrordying.ncs differ diff --git a/_module/ncs/invroom_teleport.ncs b/_module/ncs/invroom_teleport.ncs index 00d7565..d56f3c3 100644 Binary files a/_module/ncs/invroom_teleport.ncs and b/_module/ncs/invroom_teleport.ncs differ diff --git a/_module/ncs/item_namer_oo.ncs b/_module/ncs/item_namer_oo.ncs index 3f5230e..475cf4d 100644 Binary files a/_module/ncs/item_namer_oo.ncs and b/_module/ncs/item_namer_oo.ncs differ diff --git a/_module/ncs/jailbreak.ncs b/_module/ncs/jailbreak.ncs index 5ad8283..2b32b46 100644 Binary files a/_module/ncs/jailbreak.ncs and b/_module/ncs/jailbreak.ncs differ diff --git a/_module/ncs/judgementscript.ncs b/_module/ncs/judgementscript.ncs index b86f428..1ddf798 100644 Binary files a/_module/ncs/judgementscript.ncs and b/_module/ncs/judgementscript.ncs differ diff --git a/_module/ncs/judgementtrigger.ncs b/_module/ncs/judgementtrigger.ncs index cd865ba..92e74f6 100644 Binary files a/_module/ncs/judgementtrigger.ncs and b/_module/ncs/judgementtrigger.ncs differ diff --git a/_module/ncs/jumpdustrigg2.ncs b/_module/ncs/jumpdustrigg2.ncs index b05efda..0e8f0a7 100644 Binary files a/_module/ncs/jumpdustrigg2.ncs and b/_module/ncs/jumpdustrigg2.ncs differ diff --git a/_module/ncs/jumpdusttrig.ncs b/_module/ncs/jumpdusttrig.ncs index 05ffe43..be97960 100644 Binary files a/_module/ncs/jumpdusttrig.ncs and b/_module/ncs/jumpdusttrig.ncs differ diff --git a/_module/ncs/jumpnonmonkhome.ncs b/_module/ncs/jumpnonmonkhome.ncs index 1682863..6f48851 100644 Binary files a/_module/ncs/jumpnonmonkhome.ncs and b/_module/ncs/jumpnonmonkhome.ncs differ diff --git a/_module/ncs/keepopen.ncs b/_module/ncs/keepopen.ncs index db0c55e..5a6bcf6 100644 Binary files a/_module/ncs/keepopen.ncs and b/_module/ncs/keepopen.ncs differ diff --git a/_module/ncs/lastwish.ncs b/_module/ncs/lastwish.ncs index 92e5f47..56dfba3 100644 Binary files a/_module/ncs/lastwish.ncs and b/_module/ncs/lastwish.ncs differ diff --git a/_module/ncs/levelertalks.ncs b/_module/ncs/levelertalks.ncs index a1cadb1..4f189d6 100644 Binary files a/_module/ncs/levelertalks.ncs and b/_module/ncs/levelertalks.ncs differ diff --git a/_module/ncs/lichattackspc03.ncs b/_module/ncs/lichattackspc03.ncs index 228fd94..e34618e 100644 Binary files a/_module/ncs/lichattackspc03.ncs and b/_module/ncs/lichattackspc03.ncs differ diff --git a/_module/ncs/limbojumpportal.ncs b/_module/ncs/limbojumpportal.ncs index 014ca33..1197a1b 100644 Binary files a/_module/ncs/limbojumpportal.ncs and b/_module/ncs/limbojumpportal.ncs differ diff --git a/_module/ncs/limboportal1.ncs b/_module/ncs/limboportal1.ncs index 275ec22..f9a9c26 100644 Binary files a/_module/ncs/limboportal1.ncs and b/_module/ncs/limboportal1.ncs differ diff --git a/_module/ncs/livingstatue37.ncs b/_module/ncs/livingstatue37.ncs index eeb90c1..4ccb696 100644 Binary files a/_module/ncs/livingstatue37.ncs and b/_module/ncs/livingstatue37.ncs differ diff --git a/_module/ncs/lockdoorspec1.ncs b/_module/ncs/lockdoorspec1.ncs index 37d3949..7b7ea2d 100644 Binary files a/_module/ncs/lockdoorspec1.ncs and b/_module/ncs/lockdoorspec1.ncs differ diff --git a/_module/ncs/lockdoorspec2.ncs b/_module/ncs/lockdoorspec2.ncs index 15742fd..1c34c75 100644 Binary files a/_module/ncs/lockdoorspec2.ncs and b/_module/ncs/lockdoorspec2.ncs differ diff --git a/_module/ncs/lockdoorspec3.ncs b/_module/ncs/lockdoorspec3.ncs index 00bbd53..ca991eb 100644 Binary files a/_module/ncs/lockdoorspec3.ncs and b/_module/ncs/lockdoorspec3.ncs differ diff --git a/_module/ncs/lvl40restriction.ncs b/_module/ncs/lvl40restriction.ncs index 2762935..f9ab18c 100644 Binary files a/_module/ncs/lvl40restriction.ncs and b/_module/ncs/lvl40restriction.ncs differ diff --git a/_module/ncs/lvljumpscript2.ncs b/_module/ncs/lvljumpscript2.ncs index 41c97db..7046050 100644 Binary files a/_module/ncs/lvljumpscript2.ncs and b/_module/ncs/lvljumpscript2.ncs differ diff --git a/_module/ncs/m0q0_archery_2.ncs b/_module/ncs/m0q0_archery_2.ncs index 6329700..f77eee6 100644 Binary files a/_module/ncs/m0q0_archery_2.ncs and b/_module/ncs/m0q0_archery_2.ncs differ diff --git a/_module/ncs/m1q0bdendy_5.ncs b/_module/ncs/m1q0bdendy_5.ncs index aeafdae..8b9f445 100644 Binary files a/_module/ncs/m1q0bdendy_5.ncs and b/_module/ncs/m1q0bdendy_5.ncs differ diff --git a/_module/ncs/m1q0dchest1.ncs b/_module/ncs/m1q0dchest1.ncs index 6a6b11c..c291f85 100644 Binary files a/_module/ncs/m1q0dchest1.ncs and b/_module/ncs/m1q0dchest1.ncs differ diff --git a/_module/ncs/m1q0dchest2.ncs b/_module/ncs/m1q0dchest2.ncs index 59d4a36..eacd713 100644 Binary files a/_module/ncs/m1q0dchest2.ncs and b/_module/ncs/m1q0dchest2.ncs differ diff --git a/_module/ncs/mageonly.ncs b/_module/ncs/mageonly.ncs index 48d2845..f5349a9 100644 Binary files a/_module/ncs/mageonly.ncs and b/_module/ncs/mageonly.ncs differ diff --git a/_module/ncs/mageonly2.ncs b/_module/ncs/mageonly2.ncs index 1cf6aca..566f530 100644 Binary files a/_module/ncs/mageonly2.ncs and b/_module/ncs/mageonly2.ncs differ diff --git a/_module/ncs/magicdoor21scrpt.ncs b/_module/ncs/magicdoor21scrpt.ncs index 1a5197f..f46d5f6 100644 Binary files a/_module/ncs/magicdoor21scrpt.ncs and b/_module/ncs/magicdoor21scrpt.ncs differ diff --git a/_module/ncs/magicportaltrig1.ncs b/_module/ncs/magicportaltrig1.ncs index 90754f6..690e0dd 100644 Binary files a/_module/ncs/magicportaltrig1.ncs and b/_module/ncs/magicportaltrig1.ncs differ diff --git a/_module/ncs/meremtalks.ncs b/_module/ncs/meremtalks.ncs index 3386fbc..b6ae7de 100644 Binary files a/_module/ncs/meremtalks.ncs and b/_module/ncs/meremtalks.ncs differ diff --git a/_module/ncs/modspawn.ncs b/_module/ncs/modspawn.ncs index ac657dc..10c7bdc 100644 Binary files a/_module/ncs/modspawn.ncs and b/_module/ncs/modspawn.ncs differ diff --git a/_module/ncs/moduleheartbeat.ncs b/_module/ncs/moduleheartbeat.ncs index 92a8f2f..03780e5 100644 Binary files a/_module/ncs/moduleheartbeat.ncs and b/_module/ncs/moduleheartbeat.ncs differ diff --git a/_module/ncs/myhook.ncs b/_module/ncs/myhook.ncs index 1dbde2e..33d5054 100644 Binary files a/_module/ncs/myhook.ncs and b/_module/ncs/myhook.ncs differ diff --git a/_module/ncs/newchest.ncs b/_module/ncs/newchest.ncs index 938938e..47633af 100644 Binary files a/_module/ncs/newchest.ncs and b/_module/ncs/newchest.ncs differ diff --git a/_module/ncs/newdeathscript.ncs b/_module/ncs/newdeathscript.ncs index cad2c8a..e1d5e91 100644 Binary files a/_module/ncs/newdeathscript.ncs and b/_module/ncs/newdeathscript.ncs differ diff --git a/_module/ncs/nongodjump.ncs b/_module/ncs/nongodjump.ncs index 54ae315..66526a4 100644 Binary files a/_module/ncs/nongodjump.ncs and b/_module/ncs/nongodjump.ncs differ diff --git a/_module/ncs/npcattack.ncs b/_module/ncs/npcattack.ncs index 67b4b6d..f844acb 100644 Binary files a/_module/ncs/npcattack.ncs and b/_module/ncs/npcattack.ncs differ diff --git a/_module/ncs/npcspellattack.ncs b/_module/ncs/npcspellattack.ncs index fd4f902..a2858d5 100644 Binary files a/_module/ncs/npcspellattack.ncs and b/_module/ncs/npcspellattack.ncs differ diff --git a/_module/ncs/nw_c2_bossspawn.ncs b/_module/ncs/nw_c2_bossspawn.ncs index 9ed5af0..7330f43 100644 Binary files a/_module/ncs/nw_c2_bossspawn.ncs and b/_module/ncs/nw_c2_bossspawn.ncs differ diff --git a/_module/ncs/nw_c2_default1.ncs b/_module/ncs/nw_c2_default1.ncs index 29a849d..4f5b1f9 100644 Binary files a/_module/ncs/nw_c2_default1.ncs and b/_module/ncs/nw_c2_default1.ncs differ diff --git a/_module/ncs/nw_c2_default2.ncs b/_module/ncs/nw_c2_default2.ncs index 36e2a9c..c3a4f7e 100644 Binary files a/_module/ncs/nw_c2_default2.ncs and b/_module/ncs/nw_c2_default2.ncs differ diff --git a/_module/ncs/nw_c2_default3.ncs b/_module/ncs/nw_c2_default3.ncs index 30c94d3..c54384c 100644 Binary files a/_module/ncs/nw_c2_default3.ncs and b/_module/ncs/nw_c2_default3.ncs differ diff --git a/_module/ncs/nw_c2_default4.ncs b/_module/ncs/nw_c2_default4.ncs index e3239a7..b8652e3 100644 Binary files a/_module/ncs/nw_c2_default4.ncs and b/_module/ncs/nw_c2_default4.ncs differ diff --git a/_module/ncs/nw_c2_default5.ncs b/_module/ncs/nw_c2_default5.ncs index 85befee..1502fbc 100644 Binary files a/_module/ncs/nw_c2_default5.ncs and b/_module/ncs/nw_c2_default5.ncs differ diff --git a/_module/ncs/nw_c2_default6.ncs b/_module/ncs/nw_c2_default6.ncs index 72ba74c..1727698 100644 Binary files a/_module/ncs/nw_c2_default6.ncs and b/_module/ncs/nw_c2_default6.ncs differ diff --git a/_module/ncs/nw_c2_default8.ncs b/_module/ncs/nw_c2_default8.ncs index d2e3160..2df2091 100644 Binary files a/_module/ncs/nw_c2_default8.ncs and b/_module/ncs/nw_c2_default8.ncs differ diff --git a/_module/ncs/nw_c2_defaultb.ncs b/_module/ncs/nw_c2_defaultb.ncs index e1c0797..146034f 100644 Binary files a/_module/ncs/nw_c2_defaultb.ncs and b/_module/ncs/nw_c2_defaultb.ncs differ diff --git a/_module/ncs/nw_g0_confuse2.ncs b/_module/ncs/nw_g0_confuse2.ncs index a5c353f..8ecb114 100644 Binary files a/_module/ncs/nw_g0_confuse2.ncs and b/_module/ncs/nw_g0_confuse2.ncs differ diff --git a/_module/ncs/nw_o2_bookshelf.ncs b/_module/ncs/nw_o2_bookshelf.ncs index c26a096..7063a1f 100644 Binary files a/_module/ncs/nw_o2_bookshelf.ncs and b/_module/ncs/nw_o2_bookshelf.ncs differ diff --git a/_module/ncs/nw_o2_boss.ncs b/_module/ncs/nw_o2_boss.ncs index fb546e8..57cdce6 100644 Binary files a/_module/ncs/nw_o2_boss.ncs and b/_module/ncs/nw_o2_boss.ncs differ diff --git a/_module/ncs/nw_o2_classweap.ncs b/_module/ncs/nw_o2_classweap.ncs index f7d00fa..354ca56 100644 Binary files a/_module/ncs/nw_o2_classweap.ncs and b/_module/ncs/nw_o2_classweap.ncs differ diff --git a/_module/ncs/nw_o2_generalhig.ncs b/_module/ncs/nw_o2_generalhig.ncs index c2810c2..3529707 100644 Binary files a/_module/ncs/nw_o2_generalhig.ncs and b/_module/ncs/nw_o2_generalhig.ncs differ diff --git a/_module/ncs/nw_o2_generallow.ncs b/_module/ncs/nw_o2_generallow.ncs index 41da7bf..55674bc 100644 Binary files a/_module/ncs/nw_o2_generallow.ncs and b/_module/ncs/nw_o2_generallow.ncs differ diff --git a/_module/ncs/nw_o2_generalmed.ncs b/_module/ncs/nw_o2_generalmed.ncs index cc8bf8e..169bf90 100644 Binary files a/_module/ncs/nw_o2_generalmed.ncs and b/_module/ncs/nw_o2_generalmed.ncs differ diff --git a/_module/ncs/nw_t0_walk.ncs b/_module/ncs/nw_t0_walk.ncs index 08231bd..29a8afb 100644 Binary files a/_module/ncs/nw_t0_walk.ncs and b/_module/ncs/nw_t0_walk.ncs differ diff --git a/_module/ncs/objectattack.ncs b/_module/ncs/objectattack.ncs index 77e17b8..e61373d 100644 Binary files a/_module/ncs/objectattack.ncs and b/_module/ncs/objectattack.ncs differ diff --git a/_module/ncs/objectspellattak.ncs b/_module/ncs/objectspellattak.ncs index f08a5fb..394d017 100644 Binary files a/_module/ncs/objectspellattak.ncs and b/_module/ncs/objectspellattak.ncs differ diff --git a/_module/ncs/on_pc_equip.ncs b/_module/ncs/on_pc_equip.ncs index 4bc1b74..045e54a 100644 Binary files a/_module/ncs/on_pc_equip.ncs and b/_module/ncs/on_pc_equip.ncs differ diff --git a/_module/ncs/on_player_chat.ncs b/_module/ncs/on_player_chat.ncs index c05f351..d6ffcfd 100644 Binary files a/_module/ncs/on_player_chat.ncs and b/_module/ncs/on_player_chat.ncs differ diff --git a/_module/ncs/on_pubsub.ncs b/_module/ncs/on_pubsub.ncs index fe12d82..2860bcc 100644 Binary files a/_module/ncs/on_pubsub.ncs and b/_module/ncs/on_pubsub.ncs differ diff --git a/_module/ncs/oncliententer.ncs b/_module/ncs/oncliententer.ncs index 197ac86..aadb833 100644 Binary files a/_module/ncs/oncliententer.ncs and b/_module/ncs/oncliententer.ncs differ diff --git a/_module/ncs/ondeath_od.ncs b/_module/ncs/ondeath_od.ncs index 7e42ca1..3ee7fe4 100644 Binary files a/_module/ncs/ondeath_od.ncs and b/_module/ncs/ondeath_od.ncs differ diff --git a/_module/ncs/onheartbeat.ncs b/_module/ncs/onheartbeat.ncs index 6135272..6fc43f1 100644 Binary files a/_module/ncs/onheartbeat.ncs and b/_module/ncs/onheartbeat.ncs differ diff --git a/_module/ncs/onmoduleload.ncs b/_module/ncs/onmoduleload.ncs index 5a461f8..11cf145 100644 Binary files a/_module/ncs/onmoduleload.ncs and b/_module/ncs/onmoduleload.ncs differ diff --git a/_module/ncs/onplayerdeath.ncs b/_module/ncs/onplayerdeath.ncs index 8da722a..3e7648f 100644 Binary files a/_module/ncs/onplayerdeath.ncs and b/_module/ncs/onplayerdeath.ncs differ diff --git a/_module/ncs/onplayerdying.ncs b/_module/ncs/onplayerdying.ncs index 0fb6295..2a4e8ff 100644 Binary files a/_module/ncs/onplayerdying.ncs and b/_module/ncs/onplayerdying.ncs differ diff --git a/_module/ncs/onplayerrespawn.ncs b/_module/ncs/onplayerrespawn.ncs index 6ea54b6..3ed992c 100644 Binary files a/_module/ncs/onplayerrespawn.ncs and b/_module/ncs/onplayerrespawn.ncs differ diff --git a/_module/ncs/onplayerrest.ncs b/_module/ncs/onplayerrest.ncs index 2f55ff9..702b278 100644 Binary files a/_module/ncs/onplayerrest.ncs and b/_module/ncs/onplayerrest.ncs differ diff --git a/_module/ncs/onunequipitem.ncs b/_module/ncs/onunequipitem.ncs index ee8cf58..8c9e741 100644 Binary files a/_module/ncs/onunequipitem.ncs and b/_module/ncs/onunequipitem.ncs differ diff --git a/_module/ncs/openabyssstore.ncs b/_module/ncs/openabyssstore.ncs index 22ec668..3f87f97 100644 Binary files a/_module/ncs/openabyssstore.ncs and b/_module/ncs/openabyssstore.ncs differ diff --git a/_module/ncs/openabyswpnstore.ncs b/_module/ncs/openabyswpnstore.ncs index 1ea4f82..328d8c4 100644 Binary files a/_module/ncs/openabyswpnstore.ncs and b/_module/ncs/openabyswpnstore.ncs differ diff --git a/_module/ncs/openarcanestore.ncs b/_module/ncs/openarcanestore.ncs index 381bf77..754df40 100644 Binary files a/_module/ncs/openarcanestore.ncs and b/_module/ncs/openarcanestore.ncs differ diff --git a/_module/ncs/openarenawpns.ncs b/_module/ncs/openarenawpns.ncs index 9c1f2f2..1023fa8 100644 Binary files a/_module/ncs/openarenawpns.ncs and b/_module/ncs/openarenawpns.ncs differ diff --git a/_module/ncs/opengwpnstore2.ncs b/_module/ncs/opengwpnstore2.ncs index d2a3fb5..08f94d0 100644 Binary files a/_module/ncs/opengwpnstore2.ncs and b/_module/ncs/opengwpnstore2.ncs differ diff --git a/_module/ncs/openheavenwpns.ncs b/_module/ncs/openheavenwpns.ncs index 04a79c4..242bb97 100644 Binary files a/_module/ncs/openheavenwpns.ncs and b/_module/ncs/openheavenwpns.ncs differ diff --git a/_module/ncs/openpotstore.ncs b/_module/ncs/openpotstore.ncs index ff30b3b..cf4324c 100644 Binary files a/_module/ncs/openpotstore.ncs and b/_module/ncs/openpotstore.ncs differ diff --git a/_module/ncs/openstore006.ncs b/_module/ncs/openstore006.ncs index 411d2c1..a906894 100644 Binary files a/_module/ncs/openstore006.ncs and b/_module/ncs/openstore006.ncs differ diff --git a/_module/ncs/openstore008.ncs b/_module/ncs/openstore008.ncs index 7afee9d..a08787c 100644 Binary files a/_module/ncs/openstore008.ncs and b/_module/ncs/openstore008.ncs differ diff --git a/_module/ncs/pa_bossdrain.ncs b/_module/ncs/pa_bossdrain.ncs index f6a6cef..b35c006 100644 Binary files a/_module/ncs/pa_bossdrain.ncs and b/_module/ncs/pa_bossdrain.ncs differ diff --git a/_module/ncs/pa_bossdrain2.ncs b/_module/ncs/pa_bossdrain2.ncs index 9483cd4..d2e62a1 100644 Binary files a/_module/ncs/pa_bossdrain2.ncs and b/_module/ncs/pa_bossdrain2.ncs differ diff --git a/_module/ncs/partyroomport2.ncs b/_module/ncs/partyroomport2.ncs index f3c978b..6919c05 100644 Binary files a/_module/ncs/partyroomport2.ncs and b/_module/ncs/partyroomport2.ncs differ diff --git a/_module/ncs/pc_wand_rest_sys.ncs b/_module/ncs/pc_wand_rest_sys.ncs index ecdd3a1..fd0ec45 100644 Binary files a/_module/ncs/pc_wand_rest_sys.ncs and b/_module/ncs/pc_wand_rest_sys.ncs differ diff --git a/_module/ncs/pcworshipsguile.ncs b/_module/ncs/pcworshipsguile.ncs index 7b951f0..01cca45 100644 Binary files a/_module/ncs/pcworshipsguile.ncs and b/_module/ncs/pcworshipsguile.ncs differ diff --git a/_module/ncs/poamodheartbeat.ncs b/_module/ncs/poamodheartbeat.ncs index 92a8f2f..03780e5 100644 Binary files a/_module/ncs/poamodheartbeat.ncs and b/_module/ncs/poamodheartbeat.ncs differ diff --git a/_module/ncs/port2guild1.ncs b/_module/ncs/port2guild1.ncs index 5141fd1..69b5427 100644 Binary files a/_module/ncs/port2guild1.ncs and b/_module/ncs/port2guild1.ncs differ diff --git a/_module/ncs/portguild2aduin.ncs b/_module/ncs/portguild2aduin.ncs index b7ad22b..e95b39c 100644 Binary files a/_module/ncs/portguild2aduin.ncs and b/_module/ncs/portguild2aduin.ncs differ diff --git a/_module/ncs/portguild2dracs.ncs b/_module/ncs/portguild2dracs.ncs index 1968694..ba9cbcc 100644 Binary files a/_module/ncs/portguild2dracs.ncs and b/_module/ncs/portguild2dracs.ncs differ diff --git a/_module/ncs/portguild2mana.ncs b/_module/ncs/portguild2mana.ncs index eab84cb..c0a2d43 100644 Binary files a/_module/ncs/portguild2mana.ncs and b/_module/ncs/portguild2mana.ncs differ diff --git a/_module/ncs/portguild2thief.ncs b/_module/ncs/portguild2thief.ncs index df13540..2883f5e 100644 Binary files a/_module/ncs/portguild2thief.ncs and b/_module/ncs/portguild2thief.ncs differ diff --git a/_module/ncs/portguild2woods.ncs b/_module/ncs/portguild2woods.ncs index da00f1f..5bda496 100644 Binary files a/_module/ncs/portguild2woods.ncs and b/_module/ncs/portguild2woods.ncs differ diff --git a/_module/ncs/portpc2guild.ncs b/_module/ncs/portpc2guild.ncs index 16bb9ea..cf20f7d 100644 Binary files a/_module/ncs/portpc2guild.ncs and b/_module/ncs/portpc2guild.ncs differ diff --git a/_module/ncs/portpchome.ncs b/_module/ncs/portpchome.ncs index e7bcf77..47d8f5a 100644 Binary files a/_module/ncs/portpchome.ncs and b/_module/ncs/portpchome.ncs differ diff --git a/_module/ncs/powerportal3.ncs b/_module/ncs/powerportal3.ncs index 19624f9..bd9a699 100644 Binary files a/_module/ncs/powerportal3.ncs and b/_module/ncs/powerportal3.ncs differ diff --git a/_module/ncs/practchambport1.ncs b/_module/ncs/practchambport1.ncs index f460f86..b19edce 100644 Binary files a/_module/ncs/practchambport1.ncs and b/_module/ncs/practchambport1.ncs differ diff --git a/_module/ncs/prevappearance1.ncs b/_module/ncs/prevappearance1.ncs index 16105a9..abfe1b7 100644 Binary files a/_module/ncs/prevappearance1.ncs and b/_module/ncs/prevappearance1.ncs differ diff --git a/_module/ncs/prevappearance2.ncs b/_module/ncs/prevappearance2.ncs index 0b37391..8dee25b 100644 Binary files a/_module/ncs/prevappearance2.ncs and b/_module/ncs/prevappearance2.ncs differ diff --git a/_module/ncs/prevent_theft2.ncs b/_module/ncs/prevent_theft2.ncs index 9d3f149..6289ccd 100644 Binary files a/_module/ncs/prevent_theft2.ncs and b/_module/ncs/prevent_theft2.ncs differ diff --git a/_module/ncs/preventpctrigg1.ncs b/_module/ncs/preventpctrigg1.ncs index 5953b99..2d6fa0f 100644 Binary files a/_module/ncs/preventpctrigg1.ncs and b/_module/ncs/preventpctrigg1.ncs differ diff --git a/_module/ncs/punkrod.ncs b/_module/ncs/punkrod.ncs index 1790b59..93de474 100644 Binary files a/_module/ncs/punkrod.ncs and b/_module/ncs/punkrod.ncs differ diff --git a/_module/ncs/q2a_enter_rooms.ncs b/_module/ncs/q2a_enter_rooms.ncs index 7a68b51..cb37c00 100644 Binary files a/_module/ncs/q2a_enter_rooms.ncs and b/_module/ncs/q2a_enter_rooms.ncs differ diff --git a/_module/ncs/q4a_statue_cut.ncs b/_module/ncs/q4a_statue_cut.ncs index c2fe15c..18afd25 100644 Binary files a/_module/ncs/q4a_statue_cut.ncs and b/_module/ncs/q4a_statue_cut.ncs differ diff --git a/_module/ncs/queenattackspcs.ncs b/_module/ncs/queenattackspcs.ncs index b3d755d..9adca0b 100644 Binary files a/_module/ncs/queenattackspcs.ncs and b/_module/ncs/queenattackspcs.ncs differ diff --git a/_module/ncs/queendammaged.ncs b/_module/ncs/queendammaged.ncs index 4d9fda2..e80427b 100644 Binary files a/_module/ncs/queendammaged.ncs and b/_module/ncs/queendammaged.ncs differ diff --git a/_module/ncs/queenpercieve.ncs b/_module/ncs/queenpercieve.ncs index 22f21b2..39612de 100644 Binary files a/_module/ncs/queenpercieve.ncs and b/_module/ncs/queenpercieve.ncs differ diff --git a/_module/ncs/queentriggeer.ncs b/_module/ncs/queentriggeer.ncs index 64569ff..d35a7e6 100644 Binary files a/_module/ncs/queentriggeer.ncs and b/_module/ncs/queentriggeer.ncs differ diff --git a/_module/ncs/randomsockeygive.ncs b/_module/ncs/randomsockeygive.ncs index 3283cda..9d4e3e9 100644 Binary files a/_module/ncs/randomsockeygive.ncs and b/_module/ncs/randomsockeygive.ncs differ diff --git a/_module/ncs/rangersecrets44.ncs b/_module/ncs/rangersecrets44.ncs index 15e1e47..de0e138 100644 Binary files a/_module/ncs/rangersecrets44.ncs and b/_module/ncs/rangersecrets44.ncs differ diff --git a/_module/ncs/replicate_invent.ncs b/_module/ncs/replicate_invent.ncs index ad5bbf0..46bc2ac 100644 Binary files a/_module/ncs/replicate_invent.ncs and b/_module/ncs/replicate_invent.ncs differ diff --git a/_module/ncs/respawnhigh.ncs b/_module/ncs/respawnhigh.ncs index d97fab0..aaff4f8 100644 Binary files a/_module/ncs/respawnhigh.ncs and b/_module/ncs/respawnhigh.ncs differ diff --git a/_module/ncs/respawnhigh_oo.ncs b/_module/ncs/respawnhigh_oo.ncs index 3a1e83a..4b66494 100644 Binary files a/_module/ncs/respawnhigh_oo.ncs and b/_module/ncs/respawnhigh_oo.ncs differ diff --git a/_module/ncs/respawning.ncs b/_module/ncs/respawning.ncs index 9276edf..fcbf812 100644 Binary files a/_module/ncs/respawning.ncs and b/_module/ncs/respawning.ncs differ diff --git a/_module/ncs/respawnlow.ncs b/_module/ncs/respawnlow.ncs index 1ce44a6..fa12ff2 100644 Binary files a/_module/ncs/respawnlow.ncs and b/_module/ncs/respawnlow.ncs differ diff --git a/_module/ncs/respawnlow_oo.ncs b/_module/ncs/respawnlow_oo.ncs index fa914a2..d14beb8 100644 Binary files a/_module/ncs/respawnlow_oo.ncs and b/_module/ncs/respawnlow_oo.ncs differ diff --git a/_module/ncs/respawnmed.ncs b/_module/ncs/respawnmed.ncs index 94a569f..862cb81 100644 Binary files a/_module/ncs/respawnmed.ncs and b/_module/ncs/respawnmed.ncs differ diff --git a/_module/ncs/respawnmed_oo.ncs b/_module/ncs/respawnmed_oo.ncs index 85e1d64..b4aabe9 100644 Binary files a/_module/ncs/respawnmed_oo.ncs and b/_module/ncs/respawnmed_oo.ncs differ diff --git a/_module/ncs/respawnpak1.ncs b/_module/ncs/respawnpak1.ncs index 426ffd6..200335b 100644 Binary files a/_module/ncs/respawnpak1.ncs and b/_module/ncs/respawnpak1.ncs differ diff --git a/_module/ncs/respawnuniqchest.ncs b/_module/ncs/respawnuniqchest.ncs index 0a46f85..c985123 100644 Binary files a/_module/ncs/respawnuniqchest.ncs and b/_module/ncs/respawnuniqchest.ncs differ diff --git a/_module/ncs/respawnunique.ncs b/_module/ncs/respawnunique.ncs index 7651ac1..701f1cf 100644 Binary files a/_module/ncs/respawnunique.ncs and b/_module/ncs/respawnunique.ncs differ diff --git a/_module/ncs/respawnunique_oo.ncs b/_module/ncs/respawnunique_oo.ncs index d8ba7c7..50b790d 100644 Binary files a/_module/ncs/respawnunique_oo.ncs and b/_module/ncs/respawnunique_oo.ncs differ diff --git a/_module/ncs/roguebanetrigger.ncs b/_module/ncs/roguebanetrigger.ncs index 2b098da..8bfd90b 100644 Binary files a/_module/ncs/roguebanetrigger.ncs and b/_module/ncs/roguebanetrigger.ncs differ diff --git a/_module/ncs/roguespawn.ncs b/_module/ncs/roguespawn.ncs index 8205395..4b9e3d3 100644 Binary files a/_module/ncs/roguespawn.ncs and b/_module/ncs/roguespawn.ncs differ diff --git a/_module/ncs/satanbeat.ncs b/_module/ncs/satanbeat.ncs index 61ce054..8bd597d 100644 Binary files a/_module/ncs/satanbeat.ncs and b/_module/ncs/satanbeat.ncs differ diff --git a/_module/ncs/savecharacters.ncs b/_module/ncs/savecharacters.ncs index 3b47801..8fac470 100644 Binary files a/_module/ncs/savecharacters.ncs and b/_module/ncs/savecharacters.ncs differ diff --git a/_module/ncs/sc_npc_attacked.ncs b/_module/ncs/sc_npc_attacked.ncs index 8b70bf0..1df6c52 100644 Binary files a/_module/ncs/sc_npc_attacked.ncs and b/_module/ncs/sc_npc_attacked.ncs differ diff --git a/_module/ncs/sc_npc_spelled.ncs b/_module/ncs/sc_npc_spelled.ncs index 3a0c74c..5f022c9 100644 Binary files a/_module/ncs/sc_npc_spelled.ncs and b/_module/ncs/sc_npc_spelled.ncs differ diff --git a/_module/ncs/sc_object_attack.ncs b/_module/ncs/sc_object_attack.ncs index 1cdb585..5c7e568 100644 Binary files a/_module/ncs/sc_object_attack.ncs and b/_module/ncs/sc_object_attack.ncs differ diff --git a/_module/ncs/sc_object_attked.ncs b/_module/ncs/sc_object_attked.ncs index 1cdb585..5c7e568 100644 Binary files a/_module/ncs/sc_object_attked.ncs and b/_module/ncs/sc_object_attked.ncs differ diff --git a/_module/ncs/sc_object_spelld.ncs b/_module/ncs/sc_object_spelld.ncs index 514b9c0..6bed40b 100644 Binary files a/_module/ncs/sc_object_spelld.ncs and b/_module/ncs/sc_object_spelld.ncs differ diff --git a/_module/ncs/sc_on_lock.ncs b/_module/ncs/sc_on_lock.ncs index c927f25..482386f 100644 Binary files a/_module/ncs/sc_on_lock.ncs and b/_module/ncs/sc_on_lock.ncs differ diff --git a/_module/ncs/scanswitch.ncs b/_module/ncs/scanswitch.ncs index 90c2b2d..9ee4dae 100644 Binary files a/_module/ncs/scanswitch.ncs and b/_module/ncs/scanswitch.ncs differ diff --git a/_module/ncs/searchtrigger45.ncs b/_module/ncs/searchtrigger45.ncs index d1f7f55..fe01fd3 100644 Binary files a/_module/ncs/searchtrigger45.ncs and b/_module/ncs/searchtrigger45.ncs differ diff --git a/_module/ncs/secretbazmottrig.ncs b/_module/ncs/secretbazmottrig.ncs index d652db6..17e1b66 100644 Binary files a/_module/ncs/secretbazmottrig.ncs and b/_module/ncs/secretbazmottrig.ncs differ diff --git a/_module/ncs/secretlichtrigg.ncs b/_module/ncs/secretlichtrigg.ncs index f451baf..f7191cc 100644 Binary files a/_module/ncs/secretlichtrigg.ncs and b/_module/ncs/secretlichtrigg.ncs differ diff --git a/_module/ncs/secure_chest_oo.ncs b/_module/ncs/secure_chest_oo.ncs index 1dc2f4d..184bfe7 100644 Binary files a/_module/ncs/secure_chest_oo.ncs and b/_module/ncs/secure_chest_oo.ncs differ diff --git a/_module/ncs/secure_chest_ou.ncs b/_module/ncs/secure_chest_ou.ncs index 37753fa..68db980 100644 Binary files a/_module/ncs/secure_chest_ou.ncs and b/_module/ncs/secure_chest_ou.ncs differ diff --git a/_module/ncs/sendpestaway.ncs b/_module/ncs/sendpestaway.ncs index cd9ca60..83c8f6e 100644 Binary files a/_module/ncs/sendpestaway.ncs and b/_module/ncs/sendpestaway.ncs differ diff --git a/_module/ncs/setappearance2.ncs b/_module/ncs/setappearance2.ncs index fd26b4f..551b1ae 100644 Binary files a/_module/ncs/setappearance2.ncs and b/_module/ncs/setappearance2.ncs differ diff --git a/_module/ncs/setbaseappearanc.ncs b/_module/ncs/setbaseappearanc.ncs index fe4b8b7..1fb2e2d 100644 Binary files a/_module/ncs/setbaseappearanc.ncs and b/_module/ncs/setbaseappearanc.ncs differ diff --git a/_module/ncs/sf_door.ncs b/_module/ncs/sf_door.ncs index 7b49b17..a68677c 100644 Binary files a/_module/ncs/sf_door.ncs and b/_module/ncs/sf_door.ncs differ diff --git a/_module/ncs/sf_wingwand.ncs b/_module/ncs/sf_wingwand.ncs index a416ab9..43b1f98 100644 Binary files a/_module/ncs/sf_wingwand.ncs and b/_module/ncs/sf_wingwand.ncs differ diff --git a/_module/ncs/sf_xp.ncs b/_module/ncs/sf_xp.ncs index b586063..87ce4c7 100644 Binary files a/_module/ncs/sf_xp.ncs and b/_module/ncs/sf_xp.ncs differ diff --git a/_module/ncs/sfcs_ac.ncs b/_module/ncs/sfcs_ac.ncs index 3a6267f..9cc9b98 100644 Binary files a/_module/ncs/sfcs_ac.ncs and b/_module/ncs/sfcs_ac.ncs differ diff --git a/_module/ncs/sfcs_acid.ncs b/_module/ncs/sfcs_acid.ncs index ab1e11e..55bc860 100644 Binary files a/_module/ncs/sfcs_acid.ncs and b/_module/ncs/sfcs_acid.ncs differ diff --git a/_module/ncs/sfcs_magical.ncs b/_module/ncs/sfcs_magical.ncs index 4504219..fb43564 100644 Binary files a/_module/ncs/sfcs_magical.ncs and b/_module/ncs/sfcs_magical.ncs differ diff --git a/_module/ncs/sfpb_close.ncs b/_module/ncs/sfpb_close.ncs index a6a0b07..354c00f 100644 Binary files a/_module/ncs/sfpb_close.ncs and b/_module/ncs/sfpb_close.ncs differ diff --git a/_module/ncs/sfpb_open.ncs b/_module/ncs/sfpb_open.ncs index df2579b..168fa1f 100644 Binary files a/_module/ncs/sfpb_open.ncs and b/_module/ncs/sfpb_open.ncs differ diff --git a/_module/ncs/sfpb_used.ncs b/_module/ncs/sfpb_used.ncs index 4190387..b9f628c 100644 Binary files a/_module/ncs/sfpb_used.ncs and b/_module/ncs/sfpb_used.ncs differ diff --git a/_module/ncs/shopdoor.ncs b/_module/ncs/shopdoor.ncs index e2fbdf4..8a646cd 100644 Binary files a/_module/ncs/shopdoor.ncs and b/_module/ncs/shopdoor.ncs differ diff --git a/_module/ncs/shopdoor2.ncs b/_module/ncs/shopdoor2.ncs index 8c8dda5..2c41c89 100644 Binary files a/_module/ncs/shopdoor2.ncs and b/_module/ncs/shopdoor2.ncs differ diff --git a/_module/ncs/shopdoor3.ncs b/_module/ncs/shopdoor3.ncs index b477df9..aa3d87e 100644 Binary files a/_module/ncs/shopdoor3.ncs and b/_module/ncs/shopdoor3.ncs differ diff --git a/_module/ncs/shopdoorfast.ncs b/_module/ncs/shopdoorfast.ncs index 600074d..e4779eb 100644 Binary files a/_module/ncs/shopdoorfast.ncs and b/_module/ncs/shopdoorfast.ncs differ diff --git a/_module/ncs/shopdoorquick.ncs b/_module/ncs/shopdoorquick.ncs index 95d13eb..b18c21f 100644 Binary files a/_module/ncs/shopdoorquick.ncs and b/_module/ncs/shopdoorquick.ncs differ diff --git a/_module/ncs/shroudondeath.ncs b/_module/ncs/shroudondeath.ncs index 0b5d67c..31446d4 100644 Binary files a/_module/ncs/shroudondeath.ncs and b/_module/ncs/shroudondeath.ncs differ diff --git a/_module/ncs/shutguilddoor.ncs b/_module/ncs/shutguilddoor.ncs index 60607d5..3e898b4 100644 Binary files a/_module/ncs/shutguilddoor.ncs and b/_module/ncs/shutguilddoor.ncs differ diff --git a/_module/ncs/silenttrigger2.ncs b/_module/ncs/silenttrigger2.ncs index 90e8f4e..2274260 100644 Binary files a/_module/ncs/silenttrigger2.ncs and b/_module/ncs/silenttrigger2.ncs differ diff --git a/_module/ncs/spawn_corpse_dcy.ncs b/_module/ncs/spawn_corpse_dcy.ncs index cf568b4..a88991b 100644 Binary files a/_module/ncs/spawn_corpse_dcy.ncs and b/_module/ncs/spawn_corpse_dcy.ncs differ diff --git a/_module/ncs/spawn_corpse_dth.ncs b/_module/ncs/spawn_corpse_dth.ncs index 94ccc65..06e4cd7 100644 Binary files a/_module/ncs/spawn_corpse_dth.ncs and b/_module/ncs/spawn_corpse_dth.ncs differ diff --git a/_module/ncs/spawn_dist_corps.ncs b/_module/ncs/spawn_dist_corps.ncs index 66d26f5..3d96673 100644 Binary files a/_module/ncs/spawn_dist_corps.ncs and b/_module/ncs/spawn_dist_corps.ncs differ diff --git a/_module/ncs/spawn_gem.ncs b/_module/ncs/spawn_gem.ncs index 90d2b8a..7ba293d 100644 Binary files a/_module/ncs/spawn_gem.ncs and b/_module/ncs/spawn_gem.ncs differ diff --git a/_module/ncs/spawn_gems.ncs b/_module/ncs/spawn_gems.ncs index 90d2b8a..7ba293d 100644 Binary files a/_module/ncs/spawn_gems.ncs and b/_module/ncs/spawn_gems.ncs differ diff --git a/_module/ncs/spawn_grimm.ncs b/_module/ncs/spawn_grimm.ncs index 9e3196c..5c810c4 100644 Binary files a/_module/ncs/spawn_grimm.ncs and b/_module/ncs/spawn_grimm.ncs differ diff --git a/_module/ncs/spawn_oncloscrp.ncs b/_module/ncs/spawn_oncloscrp.ncs index 3557f5b..7b33f7d 100644 Binary files a/_module/ncs/spawn_oncloscrp.ncs and b/_module/ncs/spawn_oncloscrp.ncs differ diff --git a/_module/ncs/spawn_onopencrp.ncs b/_module/ncs/spawn_onopencrp.ncs index 67eda7c..8fd022d 100644 Binary files a/_module/ncs/spawn_onopencrp.ncs and b/_module/ncs/spawn_onopencrp.ncs differ diff --git a/_module/ncs/spawn_orig_hb.ncs b/_module/ncs/spawn_orig_hb.ncs index 77d2eb4..1ec60f8 100644 Binary files a/_module/ncs/spawn_orig_hb.ncs and b/_module/ncs/spawn_orig_hb.ncs differ diff --git a/_module/ncs/spawn_sample_hb.ncs b/_module/ncs/spawn_sample_hb.ncs index 77d2eb4..1ec60f8 100644 Binary files a/_module/ncs/spawn_sample_hb.ncs and b/_module/ncs/spawn_sample_hb.ncs differ diff --git a/_module/ncs/spawn_sc_cmptrig.ncs b/_module/ncs/spawn_sc_cmptrig.ncs index 488916f..c86acfb 100644 Binary files a/_module/ncs/spawn_sc_cmptrig.ncs and b/_module/ncs/spawn_sc_cmptrig.ncs differ diff --git a/_module/ncs/spawn_sc_hbeat.ncs b/_module/ncs/spawn_sc_hbeat.ncs index 9da1da9..e139137 100644 Binary files a/_module/ncs/spawn_sc_hbeat.ncs and b/_module/ncs/spawn_sc_hbeat.ncs differ diff --git a/_module/ncs/spawn_sc_spawn.ncs b/_module/ncs/spawn_sc_spawn.ncs index 6613568..21ed547 100644 Binary files a/_module/ncs/spawn_sc_spawn.ncs and b/_module/ncs/spawn_sc_spawn.ncs differ diff --git a/_module/ncs/spawn_scribe_onc.ncs b/_module/ncs/spawn_scribe_onc.ncs index 1957eda..2d3063c 100644 Binary files a/_module/ncs/spawn_scribe_onc.ncs and b/_module/ncs/spawn_scribe_onc.ncs differ diff --git a/_module/ncs/spawnb_cc_activ.ncs b/_module/ncs/spawnb_cc_activ.ncs index b571555..de4d166 100644 Binary files a/_module/ncs/spawnb_cc_activ.ncs and b/_module/ncs/spawnb_cc_activ.ncs differ diff --git a/_module/ncs/spawnb_cc_dactiv.ncs b/_module/ncs/spawnb_cc_dactiv.ncs index 77e80d7..7e94385 100644 Binary files a/_module/ncs/spawnb_cc_dactiv.ncs and b/_module/ncs/spawnb_cc_dactiv.ncs differ diff --git a/_module/ncs/stargateportspc.ncs b/_module/ncs/stargateportspc.ncs index f1f05ed..c4c82a2 100644 Binary files a/_module/ncs/stargateportspc.ncs and b/_module/ncs/stargateportspc.ncs differ diff --git a/_module/ncs/startingvisual.ncs b/_module/ncs/startingvisual.ncs index 0e4b0bb..70b895b 100644 Binary files a/_module/ncs/startingvisual.ncs and b/_module/ncs/startingvisual.ncs differ diff --git a/_module/ncs/startmessage.ncs b/_module/ncs/startmessage.ncs index bb61900..cdd18b2 100644 Binary files a/_module/ncs/startmessage.ncs and b/_module/ncs/startmessage.ncs differ diff --git a/_module/ncs/startmessage3.ncs b/_module/ncs/startmessage3.ncs index 06ca127..c6a899c 100644 Binary files a/_module/ncs/startmessage3.ncs and b/_module/ncs/startmessage3.ncs differ diff --git a/_module/ncs/statuejudespc.ncs b/_module/ncs/statuejudespc.ncs index 1e5af7a..5ef2b8a 100644 Binary files a/_module/ncs/statuejudespc.ncs and b/_module/ncs/statuejudespc.ncs differ diff --git a/_module/ncs/statuejumptrig1.ncs b/_module/ncs/statuejumptrig1.ncs index 71b0028..36b0e08 100644 Binary files a/_module/ncs/statuejumptrig1.ncs and b/_module/ncs/statuejumptrig1.ncs differ diff --git a/_module/ncs/stoneport2guild.ncs b/_module/ncs/stoneport2guild.ncs index 8e90933..a9d1996 100644 Binary files a/_module/ncs/stoneport2guild.ncs and b/_module/ncs/stoneport2guild.ncs differ diff --git a/_module/ncs/stoneportshome.ncs b/_module/ncs/stoneportshome.ncs index bb8805a..2a71cb4 100644 Binary files a/_module/ncs/stoneportshome.ncs and b/_module/ncs/stoneportshome.ncs differ diff --git a/_module/ncs/stonerecallspc.ncs b/_module/ncs/stonerecallspc.ncs index d740692..8c5d521 100644 Binary files a/_module/ncs/stonerecallspc.ncs and b/_module/ncs/stonerecallspc.ncs differ diff --git a/_module/ncs/stripperspawn.ncs b/_module/ncs/stripperspawn.ncs index 6fcf57c..b2e4df7 100644 Binary files a/_module/ncs/stripperspawn.ncs and b/_module/ncs/stripperspawn.ncs differ diff --git a/_module/ncs/stripwalk.ncs b/_module/ncs/stripwalk.ncs index 5561596..b4a9417 100644 Binary files a/_module/ncs/stripwalk.ncs and b/_module/ncs/stripwalk.ncs differ diff --git a/_module/ncs/sumchambport1.ncs b/_module/ncs/sumchambport1.ncs index 76e9341..11ca58d 100644 Binary files a/_module/ncs/sumchambport1.ncs and b/_module/ncs/sumchambport1.ncs differ diff --git a/_module/ncs/sumcirclespawn01.ncs b/_module/ncs/sumcirclespawn01.ncs index 3473419..0efeb7e 100644 Binary files a/_module/ncs/sumcirclespawn01.ncs and b/_module/ncs/sumcirclespawn01.ncs differ diff --git a/_module/ncs/sumcirclespawn02.ncs b/_module/ncs/sumcirclespawn02.ncs index a623451..1f8d265 100644 Binary files a/_module/ncs/sumcirclespawn02.ncs and b/_module/ncs/sumcirclespawn02.ncs differ diff --git a/_module/ncs/sumcirclespawn03.ncs b/_module/ncs/sumcirclespawn03.ncs index 779cf28..86c3c5f 100644 Binary files a/_module/ncs/sumcirclespawn03.ncs and b/_module/ncs/sumcirclespawn03.ncs differ diff --git a/_module/ncs/sumcirclespawn04.ncs b/_module/ncs/sumcirclespawn04.ncs index 3e8dca7..6a03451 100644 Binary files a/_module/ncs/sumcirclespawn04.ncs and b/_module/ncs/sumcirclespawn04.ncs differ diff --git a/_module/ncs/sumcirclespawn05.ncs b/_module/ncs/sumcirclespawn05.ncs index 6c17492..1029ded 100644 Binary files a/_module/ncs/sumcirclespawn05.ncs and b/_module/ncs/sumcirclespawn05.ncs differ diff --git a/_module/ncs/sumcirclespawn06.ncs b/_module/ncs/sumcirclespawn06.ncs index a977563..4a1fe07 100644 Binary files a/_module/ncs/sumcirclespawn06.ncs and b/_module/ncs/sumcirclespawn06.ncs differ diff --git a/_module/ncs/sumcirclespawn07.ncs b/_module/ncs/sumcirclespawn07.ncs index d71c08f..44180ac 100644 Binary files a/_module/ncs/sumcirclespawn07.ncs and b/_module/ncs/sumcirclespawn07.ncs differ diff --git a/_module/ncs/sumcirclespawn08.ncs b/_module/ncs/sumcirclespawn08.ncs index 7bc5d0e..85f9cf3 100644 Binary files a/_module/ncs/sumcirclespawn08.ncs and b/_module/ncs/sumcirclespawn08.ncs differ diff --git a/_module/ncs/sumcirclespawn11.ncs b/_module/ncs/sumcirclespawn11.ncs index f531b68..cb56cec 100644 Binary files a/_module/ncs/sumcirclespawn11.ncs and b/_module/ncs/sumcirclespawn11.ncs differ diff --git a/_module/ncs/sumcirclespawn12.ncs b/_module/ncs/sumcirclespawn12.ncs index 0505592..baf312c 100644 Binary files a/_module/ncs/sumcirclespawn12.ncs and b/_module/ncs/sumcirclespawn12.ncs differ diff --git a/_module/ncs/sumcirclespawn6.ncs b/_module/ncs/sumcirclespawn6.ncs index a55f8a6..2dc5e9a 100644 Binary files a/_module/ncs/sumcirclespawn6.ncs and b/_module/ncs/sumcirclespawn6.ncs differ diff --git a/_module/ncs/summon1.ncs b/_module/ncs/summon1.ncs index 0be9ddd..3b33c10 100644 Binary files a/_module/ncs/summon1.ncs and b/_module/ncs/summon1.ncs differ diff --git a/_module/ncs/summon10.ncs b/_module/ncs/summon10.ncs index 972975b..c6acf42 100644 Binary files a/_module/ncs/summon10.ncs and b/_module/ncs/summon10.ncs differ diff --git a/_module/ncs/summon11.ncs b/_module/ncs/summon11.ncs index bd86f35..288ebe5 100644 Binary files a/_module/ncs/summon11.ncs and b/_module/ncs/summon11.ncs differ diff --git a/_module/ncs/summon12.ncs b/_module/ncs/summon12.ncs index f9daa4a..710ca71 100644 Binary files a/_module/ncs/summon12.ncs and b/_module/ncs/summon12.ncs differ diff --git a/_module/ncs/summon2.ncs b/_module/ncs/summon2.ncs index 8721cf1..a9338d3 100644 Binary files a/_module/ncs/summon2.ncs and b/_module/ncs/summon2.ncs differ diff --git a/_module/ncs/summon3.ncs b/_module/ncs/summon3.ncs index 068205e..c9b222c 100644 Binary files a/_module/ncs/summon3.ncs and b/_module/ncs/summon3.ncs differ diff --git a/_module/ncs/summon4.ncs b/_module/ncs/summon4.ncs index e2fe8c3..76b6646 100644 Binary files a/_module/ncs/summon4.ncs and b/_module/ncs/summon4.ncs differ diff --git a/_module/ncs/summon5.ncs b/_module/ncs/summon5.ncs index 136fb39..7c1dba7 100644 Binary files a/_module/ncs/summon5.ncs and b/_module/ncs/summon5.ncs differ diff --git a/_module/ncs/summon6.ncs b/_module/ncs/summon6.ncs index 601167e..dd96a67 100644 Binary files a/_module/ncs/summon6.ncs and b/_module/ncs/summon6.ncs differ diff --git a/_module/ncs/summon7.ncs b/_module/ncs/summon7.ncs index e3cb469..89bea06 100644 Binary files a/_module/ncs/summon7.ncs and b/_module/ncs/summon7.ncs differ diff --git a/_module/ncs/summon8.ncs b/_module/ncs/summon8.ncs index f58df9d..959e6e8 100644 Binary files a/_module/ncs/summon8.ncs and b/_module/ncs/summon8.ncs differ diff --git a/_module/ncs/summon9.ncs b/_module/ncs/summon9.ncs index f3dc74b..dbeb2df 100644 Binary files a/_module/ncs/summon9.ncs and b/_module/ncs/summon9.ncs differ diff --git a/_module/ncs/supmastrvsmonkpc.ncs b/_module/ncs/supmastrvsmonkpc.ncs index 14fb3ec..6a4fce7 100644 Binary files a/_module/ncs/supmastrvsmonkpc.ncs and b/_module/ncs/supmastrvsmonkpc.ncs differ diff --git a/_module/ncs/talkingnpc.ncs b/_module/ncs/talkingnpc.ncs index a1c6a36..5ce99b7 100644 Binary files a/_module/ncs/talkingnpc.ncs and b/_module/ncs/talkingnpc.ncs differ diff --git a/_module/ncs/teleport1.ncs b/_module/ncs/teleport1.ncs index 2f0cd26..c7bff3c 100644 Binary files a/_module/ncs/teleport1.ncs and b/_module/ncs/teleport1.ncs differ diff --git a/_module/ncs/teleport2.ncs b/_module/ncs/teleport2.ncs index 9017d38..092da72 100644 Binary files a/_module/ncs/teleport2.ncs and b/_module/ncs/teleport2.ncs differ diff --git a/_module/ncs/teleport3.ncs b/_module/ncs/teleport3.ncs index c75e533..ef47ea3 100644 Binary files a/_module/ncs/teleport3.ncs and b/_module/ncs/teleport3.ncs differ diff --git a/_module/ncs/teleport4.ncs b/_module/ncs/teleport4.ncs index a3cc8af..1ab8b1a 100644 Binary files a/_module/ncs/teleport4.ncs and b/_module/ncs/teleport4.ncs differ diff --git a/_module/ncs/teleport5.ncs b/_module/ncs/teleport5.ncs index 013b397..94f9f57 100644 Binary files a/_module/ncs/teleport5.ncs and b/_module/ncs/teleport5.ncs differ diff --git a/_module/ncs/teleport6.ncs b/_module/ncs/teleport6.ncs index 6af5ea4..6a81e58 100644 Binary files a/_module/ncs/teleport6.ncs and b/_module/ncs/teleport6.ncs differ diff --git a/_module/ncs/teleport7.ncs b/_module/ncs/teleport7.ncs index 443118e..925a3c1 100644 Binary files a/_module/ncs/teleport7.ncs and b/_module/ncs/teleport7.ncs differ diff --git a/_module/ncs/teleportusegreen.ncs b/_module/ncs/teleportusegreen.ncs index 5cc0507..af0df94 100644 Binary files a/_module/ncs/teleportusegreen.ncs and b/_module/ncs/teleportusegreen.ncs differ diff --git a/_module/ncs/teleportusered.ncs b/_module/ncs/teleportusered.ncs index 82adb8d..3edc9e0 100644 Binary files a/_module/ncs/teleportusered.ncs and b/_module/ncs/teleportusered.ncs differ diff --git a/_module/ncs/test.ncs b/_module/ncs/test.ncs index 1d04186..7094583 100644 Binary files a/_module/ncs/test.ncs and b/_module/ncs/test.ncs differ diff --git a/_module/ncs/tlr_onconv.ncs b/_module/ncs/tlr_onconv.ncs index 24eff9a..49dbcf1 100644 Binary files a/_module/ncs/tlr_onconv.ncs and b/_module/ncs/tlr_onconv.ncs differ diff --git a/_module/ncs/tlr_rotateclock.ncs b/_module/ncs/tlr_rotateclock.ncs index fee35c7..2567ee4 100644 Binary files a/_module/ncs/tlr_rotateclock.ncs and b/_module/ncs/tlr_rotateclock.ncs differ diff --git a/_module/ncs/tlr_rotatecountr.ncs b/_module/ncs/tlr_rotatecountr.ncs index 03e710f..3927a09 100644 Binary files a/_module/ncs/tlr_rotatecountr.ncs and b/_module/ncs/tlr_rotatecountr.ncs differ diff --git a/_module/ncs/toothchest.ncs b/_module/ncs/toothchest.ncs index 1c13a17..28550bd 100644 Binary files a/_module/ncs/toothchest.ncs and b/_module/ncs/toothchest.ncs differ diff --git a/_module/ncs/tresurescript1.ncs b/_module/ncs/tresurescript1.ncs index e721288..9d616a0 100644 Binary files a/_module/ncs/tresurescript1.ncs and b/_module/ncs/tresurescript1.ncs differ diff --git a/_module/ncs/vamp.ncs b/_module/ncs/vamp.ncs index d1db1e1..0b8cb7c 100644 Binary files a/_module/ncs/vamp.ncs and b/_module/ncs/vamp.ncs differ diff --git a/_module/ncs/vandalism.ncs b/_module/ncs/vandalism.ncs index 77e17b8..e61373d 100644 Binary files a/_module/ncs/vandalism.ncs and b/_module/ncs/vandalism.ncs differ diff --git a/_module/ncs/vandalspell.ncs b/_module/ncs/vandalspell.ncs index f08a5fb..394d017 100644 Binary files a/_module/ncs/vandalspell.ncs and b/_module/ncs/vandalspell.ncs differ diff --git a/_module/ncs/vastportal1.ncs b/_module/ncs/vastportal1.ncs index cda9870..f36c250 100644 Binary files a/_module/ncs/vastportal1.ncs and b/_module/ncs/vastportal1.ncs differ diff --git a/_module/ncs/wardenspawn.ncs b/_module/ncs/wardenspawn.ncs index ac657dc..10c7bdc 100644 Binary files a/_module/ncs/wardenspawn.ncs and b/_module/ncs/wardenspawn.ncs differ diff --git a/_module/ncs/wardenwalks.ncs b/_module/ncs/wardenwalks.ncs index 243ba90..b72b436 100644 Binary files a/_module/ncs/wardenwalks.ncs and b/_module/ncs/wardenwalks.ncs differ diff --git a/_module/ncs/wardenwalks2.ncs b/_module/ncs/wardenwalks2.ncs index 405f543..979fe7e 100644 Binary files a/_module/ncs/wardenwalks2.ncs and b/_module/ncs/wardenwalks2.ncs differ diff --git a/_module/ncs/warfront_port.ncs b/_module/ncs/warfront_port.ncs index e953654..455ef8f 100644 Binary files a/_module/ncs/warfront_port.ncs and b/_module/ncs/warfront_port.ncs differ diff --git a/_module/ncs/warn1_pc_oo.ncs b/_module/ncs/warn1_pc_oo.ncs index d62b765..d3b496d 100644 Binary files a/_module/ncs/warn1_pc_oo.ncs and b/_module/ncs/warn1_pc_oo.ncs differ diff --git a/_module/ncs/weaponmasterbeat.ncs b/_module/ncs/weaponmasterbeat.ncs index aea19fc..ee34ef2 100644 Binary files a/_module/ncs/weaponmasterbeat.ncs and b/_module/ncs/weaponmasterbeat.ncs differ diff --git a/_module/ncs/wheelscript.ncs b/_module/ncs/wheelscript.ncs index 4f9c7b3..3f0c7db 100644 Binary files a/_module/ncs/wheelscript.ncs and b/_module/ncs/wheelscript.ncs differ diff --git a/_module/ncs/witchspawn.ncs b/_module/ncs/witchspawn.ncs index 6fcf57c..b2e4df7 100644 Binary files a/_module/ncs/witchspawn.ncs and b/_module/ncs/witchspawn.ncs differ diff --git a/_module/ncs/ww_modrest.ncs b/_module/ncs/ww_modrest.ncs index 7d48aa7..7299057 100644 Binary files a/_module/ncs/ww_modrest.ncs and b/_module/ncs/ww_modrest.ncs differ diff --git a/_module/ncs/x2_acquired.ncs b/_module/ncs/x2_acquired.ncs index 2808030..cfd7b5e 100644 Binary files a/_module/ncs/x2_acquired.ncs and b/_module/ncs/x2_acquired.ncs differ diff --git a/_module/ncs/x2_mod_def_rest.ncs b/_module/ncs/x2_mod_def_rest.ncs index a43ade4..e8a7693 100644 Binary files a/_module/ncs/x2_mod_def_rest.ncs and b/_module/ncs/x2_mod_def_rest.ncs differ diff --git a/_module/ncs/x_o2_preset.ncs b/_module/ncs/x_o2_preset.ncs index db2faa2..bc67914 100644 Binary files a/_module/ncs/x_o2_preset.ncs and b/_module/ncs/x_o2_preset.ncs differ diff --git a/_module/ncs/zep_cr_nextcolor.ncs b/_module/ncs/zep_cr_nextcolor.ncs index 46ca694..ac6f263 100644 Binary files a/_module/ncs/zep_cr_nextcolor.ncs and b/_module/ncs/zep_cr_nextcolor.ncs differ diff --git a/_module/ncs/zep_cr_nextpart.ncs b/_module/ncs/zep_cr_nextpart.ncs index 54c6569..4b00887 100644 Binary files a/_module/ncs/zep_cr_nextpart.ncs and b/_module/ncs/zep_cr_nextpart.ncs differ diff --git a/_module/ncs/zep_cr_prevcolor.ncs b/_module/ncs/zep_cr_prevcolor.ncs index 6cbd1bb..7e3d3ca 100644 Binary files a/_module/ncs/zep_cr_prevcolor.ncs and b/_module/ncs/zep_cr_prevcolor.ncs differ diff --git a/_module/ncs/zep_cr_prevpart.ncs b/_module/ncs/zep_cr_prevpart.ncs index fa402e3..956ba80 100644 Binary files a/_module/ncs/zep_cr_prevpart.ncs and b/_module/ncs/zep_cr_prevpart.ncs differ diff --git a/_module/ncs/zep_cr_stop_abrt.ncs b/_module/ncs/zep_cr_stop_abrt.ncs index 46cc7c3..d49b1f8 100644 Binary files a/_module/ncs/zep_cr_stop_abrt.ncs and b/_module/ncs/zep_cr_stop_abrt.ncs differ diff --git a/_module/ncs/zep_cr_stop_make.ncs b/_module/ncs/zep_cr_stop_make.ncs index c503d8f..01df7c6 100644 Binary files a/_module/ncs/zep_cr_stop_make.ncs and b/_module/ncs/zep_cr_stop_make.ncs differ diff --git a/_module/nss/array_example.nss b/_module/nss/array_example.nss new file mode 100644 index 0000000..53f13f8 --- /dev/null +++ b/_module/nss/array_example.nss @@ -0,0 +1,143 @@ +//#include "inc_array" +#include "nwnx_time" + +// nwnx_data also includes inc_array, so don't double dip. +#include "nwnx_data" + +void Log(string msg) +{ + WriteTimestampedLogEntry(msg); +} + +void TestArrayOnModule() +{ + + string array = "test"; + + // By default, temporary arrays are created on the module. + Array_PushBack_Str(array, "BItem1"); + Array_PushBack_Str(array, "AItem2"); + Array_PushBack_Str(array, "AItem3"); + Array_PushBack_Str(array, "BItem2"); + Array_Debug_Dump(array, "After first load"); + + int foo = Array_Find_Str(array, "AItem3"); + Log("Found element AItem3 at index = " + IntToString(foo)); + + Array_Set_Str(array, 2, "Suck it up..."); + Array_Debug_Dump(array, "After set 2 = 'Suck it up...'"); + + Array_Erase(array, 1); + Array_Debug_Dump(array, "After delete 1"); + + Array_PushBack_Str(array, "MItem1"); + Array_PushBack_Str(array, "QItem2"); + Array_PushBack_Str(array, "NItem3"); + Array_PushBack_Str(array, "KItem2"); + + Array_Debug_Dump(array, "After add more"); + Array_SortAscending(array); + + Array_Debug_Dump(array, "After sort"); + + Array_Shuffle(array); + Array_Debug_Dump(array, "After shuffle"); + + Log( (Array_Contains_Str(array, "NItem3")) ? "Passed.. found it" : "Failed.. should have found it" ); + Log( (Array_Contains_Str(array, "KItem2")) ? "Passed.. found it" : "Failed.. should have found it" ); + Log( (Array_Contains_Str(array, "xxxxxx")) ? "Failed.. not found" : "Passed.. should not exist" ); + + Array_Clear(array); + // Load up the array with 100 entries + int i; + + struct NWNX_Time_HighResTimestamp b; + b = NWNX_Time_GetHighResTimeStamp(); + Log("Start Time: " + IntToString(b.seconds) + "." + IntToString(b.microseconds)); + for (i=0; i<1000; i++) + { + Array_PushBack_Str(array, IntToString(d100()) + " xxx " + IntToString(i)); + } + b = NWNX_Time_GetHighResTimeStamp(); + Log("Loaded 1000: " + IntToString(b.seconds) + "." + IntToString(b.microseconds)); + Array_Shuffle(array); + b = NWNX_Time_GetHighResTimeStamp(); + Log("Shuffled 1000: " + IntToString(b.seconds) + "." + IntToString(b.microseconds)); + for (i=5; i<995; i++) + { + // Delete the third entry a bunch of times + Array_Erase(array, 3); + } + b = NWNX_Time_GetHighResTimeStamp(); + Log("Delete ~990: " + IntToString(b.seconds) + "." + IntToString(b.microseconds)); + Array_Debug_Dump(array, "After mass insert/delete"); + +} + +void TestArrayOnChicken() +{ + string array="chicken"; + // Let's create an array "on" our favorite creature: the deadly nw_chicken + // Note - arrays aren't really attached to the item, but the module, and they + // are tagged with the objects string representation. + object oCreature = CreateObject(OBJECT_TYPE_CREATURE, "nw_chicken", GetStartingLocation()); + if (!GetIsObjectValid(oCreature)) + { + Log("NWNX_Creature test: Failed to create creature"); + return; + } + + Array_PushBack_Str(array, "BItem1", oCreature); + Array_PushBack_Str(array, "AItem2", oCreature); + Array_PushBack_Str(array, "AItem3", oCreature); + Array_PushBack_Str(array, "BItem2", oCreature); + Array_Debug_Dump(array, "After Chicken array load", oCreature); + +} + +void TestNWNXArray() +{ + Log(""); + Log("Start NWNX_Data test."); + string array = "test2"; + + NWNX_Data_Array_PushBack_Str(GetModule(), array, "XItem1"); + NWNX_Data_Array_PushBack_Str(GetModule(), array, "ZItem2"); + NWNX_Data_Array_PushBack_Str(GetModule(), array, "ZItem3"); + NWNX_Data_Array_PushBack_Str(GetModule(), array, "XItem2"); + Array_Debug_Dump(array, "After first load"); + + int foo = NWNX_Data_Array_Find_Str(GetModule(), array, "ZItem3"); + Log("Found element AItem3 at index = " + IntToString(foo)); + + NWNX_Data_Array_Set_Str(GetModule(), array, 2, "Suck it up..."); + Array_Debug_Dump(array, "After set 2 = 'Suck it up...'"); + + NWNX_Data_Array_Erase(NWNX_DATA_TYPE_STRING, GetModule(), array, 1); + Array_Debug_Dump(array, "After delete 1"); + + NWNX_Data_Array_PushBack_Str(GetModule(), array, "MItem1"); + NWNX_Data_Array_PushBack_Str(GetModule(), array, "QItem2"); + NWNX_Data_Array_PushBack_Str(GetModule(), array, "NItem3"); + NWNX_Data_Array_PushBack_Str(GetModule(), array, "KItem2"); + + Array_Debug_Dump(array, "After add more"); + NWNX_Data_Array_SortAscending(NWNX_DATA_TYPE_STRING, GetModule(), array); + + Array_Debug_Dump(array, "After sort"); + +} + +// Uncomment and assign to some event click. +/* */ +void main() +{ + Log("Start"); + + TestArrayOnModule(); + + TestArrayOnChicken(); + + TestNWNXArray(); +} +/* */ diff --git a/_module/nss/inc_array.nss b/_module/nss/inc_array.nss new file mode 100644 index 0000000..7671723 --- /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/inc_sqlite_time.nss b/_module/nss/inc_sqlite_time.nss new file mode 100644 index 0000000..f8dddeb --- /dev/null +++ b/_module/nss/inc_sqlite_time.nss @@ -0,0 +1,68 @@ +/// @addtogroup time Time +/// @brief Provides various time related functions. +/// @{ +/// @file inc_sqlite_time.nss + +/// @brief Returns the current time formatted according to the provided sqlite date time format string. +/// @param format Format string as used by sqlites STRFTIME(). +/// @return The current time in the requested format. Empty string on error. +string SQLite_GetFormattedSystemTime(string format); + +/// @return Returns the number of seconds since midnight on January 1, 1970. +int SQLite_GetTimeStamp(); + +/// @brief A millisecond timestamp +struct SQLite_MillisecondTimeStamp +{ + int seconds; ///< Seconds since epoch + int milliseconds; ///< Milliseconds +}; + +/// @remark For mircosecond timestamps use NWNX_Utility_GetHighResTimeStamp(). +/// @return Returns the number of milliseconds since midnight on January 1, 1970. +struct SQLite_MillisecondTimeStamp SQLite_GetMillisecondTimeStamp(); + +/// @brief Returns the current date. +/// @return The date in the format (mm/dd/yyyy). +string SQLite_GetSystemDate(); + +/// @brief Returns current time. +/// @return The current time in the format (24:mm:ss). +string SQLite_GetSystemTime(); + +/// @} + +string SQLite_GetFormattedSystemTime(string format) +{ + sqlquery query = SqlPrepareQueryObject(GetModule(), "SELECT STRFTIME(@format, 'now', 'localtime')"); + SqlBindString(query, "@format", format); + SqlStep(query); // sqlite returns NULL for invalid format in STRFTIME() + return SqlGetString(query, 0); +} + +int SQLite_GetTimeStamp() +{ + sqlquery query = SqlPrepareQueryObject(GetModule(), "SELECT STRFTIME('%s', 'now')"); + SqlStep(query); + return SqlGetInt(query, 0); +} + +struct SQLite_MillisecondTimeStamp SQLite_GetMillisecondTimeStamp() +{ + sqlquery query = SqlPrepareQueryObject(GetModule(), "SELECT STRFTIME('%s', 'now'), SUBSTR(STRFTIME('%f', 'now'), 4)"); + SqlStep(query); + struct SQLite_MillisecondTimeStamp t; + t.seconds = SqlGetInt(query, 0); + t.milliseconds = SqlGetInt(query, 1); + return t; +} + +string SQLite_GetSystemDate() +{ + return SQLite_GetFormattedSystemTime("%m/%d/%Y"); +} + +string SQLite_GetSystemTime() +{ + return SQLite_GetFormattedSystemTime("%H:%M:%S"); +} diff --git a/_module/nss/nwnx.nss b/_module/nss/nwnx.nss index fe8942c..f764821 100644 --- a/_module/nss/nwnx.nss +++ b/_module/nss/nwnx.nss @@ -3,111 +3,135 @@ /// @{ /// @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_). void NWNX_CallFunction(string pluginName, string functionName); /// @brief Pushes the specified type to the c++ side -/// @param pluginName The plugin name. -/// @param functionName The function name (do not include NWNX_Plugin_). /// @param value The value of specified type to push. -void NWNX_PushArgumentInt(string pluginName, string functionName, int value); +void NWNX_PushArgumentInt(int value); /// @copydoc NWNX_PushArgumentInt() -void NWNX_PushArgumentFloat(string pluginName, string functionName, float value); +void NWNX_PushArgumentFloat(float value); /// @copydoc NWNX_PushArgumentInt() -void NWNX_PushArgumentObject(string pluginName, string functionName, object value); +void NWNX_PushArgumentObject(object value); /// @copydoc NWNX_PushArgumentInt() -void NWNX_PushArgumentString(string pluginName, string functionName, string value); +void NWNX_PushArgumentString(string value); /// @copydoc NWNX_PushArgumentInt() -void NWNX_PushArgumentEffect(string pluginName, string functionName, effect value); +void NWNX_PushArgumentEffect(effect value); /// @copydoc NWNX_PushArgumentInt() -void NWNX_PushArgumentItemProperty(string pluginName, string functionName, itemproperty value); +void NWNX_PushArgumentItemProperty(itemproperty value); +/// @copydoc NWNX_PushArgumentInt() +void NWNX_PushArgumentJson(json value); /// @brief Returns the specified type from the c++ side -/// @param pluginName The plugin name. -/// @param functionName The function name (do not include NWNX_Plugin_). /// @return The value of specified type. -int NWNX_GetReturnValueInt(string pluginName, string functionName); +int NWNX_GetReturnValueInt(); /// @copydoc NWNX_GetReturnValueInt() -float NWNX_GetReturnValueFloat(string pluginName, string functionName); +float NWNX_GetReturnValueFloat(); /// @copydoc NWNX_GetReturnValueInt() -object NWNX_GetReturnValueObject(string pluginName, string functionName); +object NWNX_GetReturnValueObject(); /// @copydoc NWNX_GetReturnValueInt() -string NWNX_GetReturnValueString(string pluginName, string functionName); +string NWNX_GetReturnValueString(); /// @copydoc NWNX_GetReturnValueInt() -effect NWNX_GetReturnValueEffect(string pluginName, string functionName); +effect NWNX_GetReturnValueEffect(); /// @copydoc NWNX_GetReturnValueInt() -itemproperty NWNX_GetReturnValueItemProperty(string pluginName, string functionName); +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 -string NWNX_INTERNAL_BuildString(string pluginName, string functionName, string operation) -{ - return "NWNXEE!ABIv2!" + pluginName + "!" + functionName + "!" + operation; -} +const string NWNX_PUSH = "NWNXEE!ABIv2!X!Y!PUSH"; +const string NWNX_POP = "NWNXEE!ABIv2!X!Y!POP"; /// @} void NWNX_CallFunction(string pluginName, string functionName) { - PlaySound(NWNX_INTERNAL_BuildString(pluginName, functionName, "CALL")); + PlaySound("NWNXEE!ABIv2!" + pluginName + "!" + functionName + "!CALL"); } -void NWNX_PushArgumentInt(string pluginName, string functionName, int value) +void NWNX_PushArgumentInt(int value) { - SetLocalInt(OBJECT_INVALID, NWNX_INTERNAL_BuildString(pluginName, functionName, "PUSH"), value); + SetLocalInt(OBJECT_INVALID, NWNX_PUSH, value); } -void NWNX_PushArgumentFloat(string pluginName, string functionName, float value) +void NWNX_PushArgumentFloat(float value) { - SetLocalFloat(OBJECT_INVALID, NWNX_INTERNAL_BuildString(pluginName, functionName, "PUSH"), value); + SetLocalFloat(OBJECT_INVALID, NWNX_PUSH, value); } -void NWNX_PushArgumentObject(string pluginName, string functionName, object value) +void NWNX_PushArgumentObject(object value) { - SetLocalObject(OBJECT_INVALID, NWNX_INTERNAL_BuildString(pluginName, functionName, "PUSH"), value); + SetLocalObject(OBJECT_INVALID, NWNX_PUSH, value); } -void NWNX_PushArgumentString(string pluginName, string functionName, string value) +void NWNX_PushArgumentString(string value) { - SetLocalString(OBJECT_INVALID, NWNX_INTERNAL_BuildString(pluginName, functionName, "PUSH"), value); + SetLocalString(OBJECT_INVALID, NWNX_PUSH, value); } -void NWNX_PushArgumentEffect(string pluginName, string functionName, effect value) +void NWNX_PushArgumentEffect(effect value) { - TagEffect(value, NWNX_INTERNAL_BuildString(pluginName, functionName, "PUSH")); + TagEffect(value, NWNX_PUSH); } -void NWNX_PushArgumentItemProperty(string pluginName, string functionName, itemproperty value) +void NWNX_PushArgumentItemProperty(itemproperty value) { - TagItemProperty(value, NWNX_INTERNAL_BuildString(pluginName, functionName, "PUSH")); + TagItemProperty(value, NWNX_PUSH); } -int NWNX_GetReturnValueInt(string pluginName, string functionName) +void NWNX_PushArgumentJson(json value) { - return GetLocalInt(OBJECT_INVALID, NWNX_INTERNAL_BuildString(pluginName, functionName, "POP")); + SetLocalJson(OBJECT_INVALID, NWNX_PUSH, value); } -float NWNX_GetReturnValueFloat(string pluginName, string functionName) +int NWNX_GetReturnValueInt() { - return GetLocalFloat(OBJECT_INVALID, NWNX_INTERNAL_BuildString(pluginName, functionName, "POP")); + return GetLocalInt(OBJECT_INVALID, NWNX_POP); } -object NWNX_GetReturnValueObject(string pluginName, string functionName) +float NWNX_GetReturnValueFloat() { - return GetLocalObject(OBJECT_INVALID, NWNX_INTERNAL_BuildString(pluginName, functionName, "POP")); + return GetLocalFloat(OBJECT_INVALID, NWNX_POP); } -string NWNX_GetReturnValueString(string pluginName, string functionName) +object NWNX_GetReturnValueObject() { - return GetLocalString(OBJECT_INVALID, NWNX_INTERNAL_BuildString(pluginName, functionName, "POP")); + return GetLocalObject(OBJECT_INVALID, NWNX_POP); } -effect NWNX_GetReturnValueEffect(string pluginName, string functionName) +string NWNX_GetReturnValueString() +{ + return GetLocalString(OBJECT_INVALID, NWNX_POP); +} + +effect NWNX_GetReturnValueEffect() { effect e; - return TagEffect(e, NWNX_INTERNAL_BuildString(pluginName, functionName, "POP")); + return TagEffect(e, NWNX_POP); } -itemproperty NWNX_GetReturnValueItemProperty(string pluginName, string functionName) +itemproperty NWNX_GetReturnValueItemProperty() { itemproperty ip; - return TagItemProperty(ip, NWNX_INTERNAL_BuildString(pluginName, functionName, "POP")); + return TagItemProperty(ip, NWNX_POP); +} + +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 19a6bb9..86cb319 100644 --- a/_module/nss/nwnx_admin.nss +++ b/_module/nss/nwnx_admin.nss @@ -2,7 +2,6 @@ /// @brief Various admin related functions /// @{ /// @file nwnx_admin.nss -#include "nwnx" const string NWNX_Administration = "NWNX_Administration"; ///< @private @@ -10,16 +9,16 @@ const string NWNX_Administration = "NWNX_Administration"; ///< @private /// @anchor admin_opts /// /// @{ -const int NWNX_ADMINISTRATION_OPTION_ALL_KILLABLE = 0; // TRUE/FALSE -const int NWNX_ADMINISTRATION_OPTION_NON_PARTY_KILLABLE = 1; // TRUE/FALSE -const int NWNX_ADMINISTRATION_OPTION_REQUIRE_RESURRECTION = 2; // TRUE/FALSE -const int NWNX_ADMINISTRATION_OPTION_LOSE_STOLEN_ITEMS = 3; // TRUE/FALSE -const int NWNX_ADMINISTRATION_OPTION_LOSE_ITEMS = 4; // TRUE/FALSE -const int NWNX_ADMINISTRATION_OPTION_LOSE_EXP = 5; // TRUE/FALSE -const int NWNX_ADMINISTRATION_OPTION_LOSE_GOLD = 6; // TRUE/FALSE -const int NWNX_ADMINISTRATION_OPTION_LOSE_GOLD_NUM = 7; -const int NWNX_ADMINISTRATION_OPTION_LOSE_EXP_NUM = 8; -const int NWNX_ADMINISTRATION_OPTION_LOSE_ITEMS_NUM = 9; +const int NWNX_ADMINISTRATION_OPTION_ALL_KILLABLE = 0; // DOES NOT DO ANYTHING +const int NWNX_ADMINISTRATION_OPTION_NON_PARTY_KILLABLE = 1; // DOES NOT DO ANYTHING +const int NWNX_ADMINISTRATION_OPTION_REQUIRE_RESURRECTION = 2; // DOES NOT DO ANYTHING +const int NWNX_ADMINISTRATION_OPTION_LOSE_STOLEN_ITEMS = 3; // DOES NOT DO ANYTHING +const int NWNX_ADMINISTRATION_OPTION_LOSE_ITEMS = 4; // DOES NOT DO ANYTHING +const int NWNX_ADMINISTRATION_OPTION_LOSE_EXP = 5; // DOES NOT DO ANYTHING +const int NWNX_ADMINISTRATION_OPTION_LOSE_GOLD = 6; // DOES NOT DO ANYTHING +const int NWNX_ADMINISTRATION_OPTION_LOSE_GOLD_NUM = 7; // DOES NOT DO ANYTHING +const int NWNX_ADMINISTRATION_OPTION_LOSE_EXP_NUM = 8; // DOES NOT DO ANYTHING +const int NWNX_ADMINISTRATION_OPTION_LOSE_ITEMS_NUM = 9; // DOES NOT DO ANYTHING const int NWNX_ADMINISTRATION_OPTION_PVP_SETTING = 10; // 0 = No PVP, 1 = Party PVP, 2 = Full PVP const int NWNX_ADMINISTRATION_OPTION_PAUSE_AND_PLAY = 11; // TRUE/FALSE const int NWNX_ADMINISTRATION_OPTION_ONE_PARTY_ONLY = 12; // TRUE/FALSE @@ -37,6 +36,8 @@ const int NWNX_ADMINISTRATION_OPTION_USE_MAX_HITPOINTS = 23; // TRUE/FA const int NWNX_ADMINISTRATION_OPTION_RESTORE_SPELLS_USES = 24; // TRUE/FALSE 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 @@ -77,7 +78,8 @@ void NWNX_Administration_ShutdownServer(); /// /// @param oPC The player to delete. /// @param bPreserveBackup If true, it will leave the file on server, only appending ".deleted0" to the bic filename. -void NWNX_Administration_DeletePlayerCharacter(object oPC, int bPreserveBackup = TRUE); +/// @param sKickMessage An optional kick message, if left blank it will default to "Delete Character" as reason. +void NWNX_Administration_DeletePlayerCharacter(object oPC, int bPreserveBackup = TRUE, string sKickMessage = ""); /// @brief Bans the provided IP. /// @param ip The IP Address to ban. @@ -155,188 +157,182 @@ void NWNX_Administration_SetDebugValue(int type, int state); /// @warning DANGER, DRAGONS. Bad things may or may not happen. void NWNX_Administration_ReloadRules(); +/// @brief Get the servers minimum level. +/// @return The minimum level for the server. +int NWNX_Administration_GetMinLevel(); + +/// @brief Set the servers minimum level. +/// @param nLevel The minimum level for the server. +void NWNX_Administration_SetMinLevel(int nLevel); + +/// @brief Get the servers maximum level. +/// @return The maximum level for the server. +int NWNX_Administration_GetMaxLevel(); + +/// @brief Set the servers maximum level. +/// @note Attention when using this and the MaxLevel plugin. They both change the same value. +/// @param nLevel The maximum level for the server. +void NWNX_Administration_SetMaxLevel(int nLevel); + /// @} string NWNX_Administration_GetPlayerPassword() { - string sFunc = "GetPlayerPassword"; - - NWNX_CallFunction(NWNX_Administration, sFunc); - return NWNX_GetReturnValueString(NWNX_Administration, sFunc); + NWNXCall(NWNX_Administration, "GetPlayerPassword"); + return NWNXPopString(); } void NWNX_Administration_SetPlayerPassword(string password) { - string sFunc = "SetPlayerPassword"; - - NWNX_PushArgumentString(NWNX_Administration, sFunc, password); - NWNX_CallFunction(NWNX_Administration, sFunc); + NWNXPushString(password); + NWNXCall(NWNX_Administration, "SetPlayerPassword"); } void NWNX_Administration_ClearPlayerPassword() { - string sFunc = "ClearPlayerPassword"; - - NWNX_CallFunction(NWNX_Administration, sFunc); + NWNXCall(NWNX_Administration, "ClearPlayerPassword"); } string NWNX_Administration_GetDMPassword() { - string sFunc = "GetDMPassword"; - - NWNX_CallFunction(NWNX_Administration, sFunc); - return NWNX_GetReturnValueString(NWNX_Administration, sFunc); + NWNXCall(NWNX_Administration, "GetDMPassword"); + return NWNXPopString(); } void NWNX_Administration_SetDMPassword(string password) { - string sFunc = "SetDMPassword"; - - NWNX_PushArgumentString(NWNX_Administration, sFunc, password); - NWNX_CallFunction(NWNX_Administration, sFunc); + NWNXPushString(password); + NWNXCall(NWNX_Administration, "SetDMPassword"); } void NWNX_Administration_ShutdownServer() { - string sFunc = "ShutdownServer"; - - NWNX_CallFunction(NWNX_Administration, sFunc); + NWNXCall(NWNX_Administration, "ShutdownServer"); } -void NWNX_Administration_DeletePlayerCharacter(object oPC, int bPreserveBackup) +void NWNX_Administration_DeletePlayerCharacter(object oPC, int bPreserveBackup = TRUE, string sKickMessage = "") { - string sFunc = "DeletePlayerCharacter"; - - NWNX_PushArgumentInt(NWNX_Administration, sFunc, bPreserveBackup); - NWNX_PushArgumentObject(NWNX_Administration, sFunc, oPC); - NWNX_CallFunction(NWNX_Administration, sFunc); + NWNXPushString(sKickMessage); + NWNXPushInt(bPreserveBackup); + NWNXPushObject(oPC); + NWNXCall(NWNX_Administration, "DeletePlayerCharacter"); } void NWNX_Administration_AddBannedIP(string ip) { - string sFunc = "AddBannedIP"; - - NWNX_PushArgumentString(NWNX_Administration, sFunc, ip); - NWNX_CallFunction(NWNX_Administration, sFunc); + NWNXPushString(ip); + NWNXCall(NWNX_Administration, "AddBannedIP"); } void NWNX_Administration_RemoveBannedIP(string ip) { - string sFunc = "RemoveBannedIP"; - - NWNX_PushArgumentString(NWNX_Administration, sFunc, ip); - NWNX_CallFunction(NWNX_Administration, sFunc); + NWNXPushString(ip); + NWNXCall(NWNX_Administration, "RemoveBannedIP"); } void NWNX_Administration_AddBannedCDKey(string key) { - string sFunc = "AddBannedCDKey"; - - NWNX_PushArgumentString(NWNX_Administration, sFunc, key); - NWNX_CallFunction(NWNX_Administration, sFunc); + NWNXPushString(key); + NWNXCall(NWNX_Administration, "AddBannedCDKey"); } void NWNX_Administration_RemoveBannedCDKey(string key) { - string sFunc = "RemoveBannedCDKey"; - - NWNX_PushArgumentString(NWNX_Administration, sFunc, key); - NWNX_CallFunction(NWNX_Administration, sFunc); + NWNXPushString(key); + NWNXCall(NWNX_Administration, "RemoveBannedCDKey"); } void NWNX_Administration_AddBannedPlayerName(string playerName) { - string sFunc = "AddBannedPlayerName"; - - NWNX_PushArgumentString(NWNX_Administration, sFunc, playerName); - NWNX_CallFunction(NWNX_Administration, sFunc); + NWNXPushString(playerName); + NWNXCall(NWNX_Administration, "AddBannedPlayerName"); } void NWNX_Administration_RemoveBannedPlayerName(string playerName) { - string sFunc = "RemoveBannedPlayerName"; - - NWNX_PushArgumentString(NWNX_Administration, sFunc, playerName); - NWNX_CallFunction(NWNX_Administration, sFunc); + NWNXPushString(playerName); + NWNXCall(NWNX_Administration, "RemoveBannedPlayerName"); } string NWNX_Administration_GetBannedList() { - string sFunc = "GetBannedList"; - - NWNX_CallFunction(NWNX_Administration, sFunc); - return NWNX_GetReturnValueString(NWNX_Administration, sFunc); + NWNXCall(NWNX_Administration, "GetBannedList"); + return NWNXPopString(); } void NWNX_Administration_SetModuleName(string name) { - string sFunc = "SetModuleName"; - - NWNX_PushArgumentString(NWNX_Administration, sFunc, name); - NWNX_CallFunction(NWNX_Administration, sFunc); + NWNXPushString(name); + NWNXCall(NWNX_Administration, "SetModuleName"); } void NWNX_Administration_SetServerName(string name) { - string sFunc = "SetServerName"; - - NWNX_PushArgumentString(NWNX_Administration, sFunc, name); - NWNX_CallFunction(NWNX_Administration, sFunc); + NWNXPushString(name); + NWNXCall(NWNX_Administration, "SetServerName"); } string NWNX_Administration_GetServerName() { - string sFunc = "GetServerName"; - NWNX_CallFunction(NWNX_Administration, sFunc); - return NWNX_GetReturnValueString(NWNX_Administration, sFunc); + NWNXCall(NWNX_Administration, "GetServerName"); + return NWNXPopString(); } int NWNX_Administration_GetPlayOption(int option) { - string sFunc = "GetPlayOption"; - - NWNX_PushArgumentInt(NWNX_Administration, sFunc, option); - NWNX_CallFunction(NWNX_Administration, sFunc); - - return NWNX_GetReturnValueInt(NWNX_Administration, sFunc); + NWNXPushInt(option); + NWNXCall(NWNX_Administration, "GetPlayOption"); + return NWNXPopInt(); } void NWNX_Administration_SetPlayOption(int option, int value) { - string sFunc = "SetPlayOption"; - - NWNX_PushArgumentInt(NWNX_Administration, sFunc, value); - NWNX_PushArgumentInt(NWNX_Administration, sFunc, option); - NWNX_CallFunction(NWNX_Administration, sFunc); + NWNXPushInt(value); + NWNXPushInt(option); + NWNXCall(NWNX_Administration, "SetPlayOption"); } int NWNX_Administration_DeleteTURD(string playerName, string characterName) { - string sFunc = "DeleteTURD"; - - NWNX_PushArgumentString(NWNX_Administration, sFunc, characterName); - NWNX_PushArgumentString(NWNX_Administration, sFunc, playerName); - NWNX_CallFunction(NWNX_Administration, sFunc); - - return NWNX_GetReturnValueInt(NWNX_Administration, sFunc); + NWNXPushString(characterName); + NWNXPushString(playerName); + NWNXCall(NWNX_Administration, "DeleteTURD"); + return NWNXPopInt(); } int NWNX_Administration_GetDebugValue(int type) { - string sFunc = "GetDebugValue"; - - NWNX_PushArgumentInt(NWNX_Administration, sFunc, type); - NWNX_CallFunction(NWNX_Administration, sFunc); - - return NWNX_GetReturnValueInt(NWNX_Administration, sFunc); + NWNXPushInt(type); + NWNXCall(NWNX_Administration, "GetDebugValue"); + return NWNXPopInt(); } void NWNX_Administration_SetDebugValue(int type, int state) { - string sFunc = "SetDebugValue"; - - NWNX_PushArgumentInt(NWNX_Administration, sFunc, state); - NWNX_PushArgumentInt(NWNX_Administration, sFunc, type); - NWNX_CallFunction(NWNX_Administration, sFunc); + NWNXPushInt(state); + NWNXPushInt(type); + NWNXCall(NWNX_Administration, "SetDebugValue"); } void NWNX_Administration_ReloadRules() { - string sFunc = "ReloadRules"; - - NWNX_CallFunction(NWNX_Administration, sFunc); + NWNXCall(NWNX_Administration, "ReloadRules"); +} + +int NWNX_Administration_GetMinLevel() +{ + NWNXCall(NWNX_Administration, "GetMinLevel"); + return NWNXPopInt(); +} + +void NWNX_Administration_SetMinLevel(int nLevel) +{ + NWNXPushInt(nLevel); + NWNXCall(NWNX_Administration, "SetMinLevel"); +} + +int NWNX_Administration_GetMaxLevel() +{ + NWNXCall(NWNX_Administration, "GetMaxLevel"); + return NWNXPopInt(); +} + +void NWNX_Administration_SetMaxLevel(int nLevel) +{ + NWNXPushInt(nLevel); + NWNXCall(NWNX_Administration, "SetMaxLevel"); } diff --git a/_module/nss/nwnx_appearance.nss b/_module/nss/nwnx_appearance.nss index 6f31140..4c85eb1 100644 --- a/_module/nss/nwnx_appearance.nss +++ b/_module/nss/nwnx_appearance.nss @@ -2,7 +2,6 @@ /// @brief Allows the appearance and some other things of creatures to be overridden per player. /// @{ /// @file nwnx_appearance.nss -#include "nwnx" const string NWNX_Appearance = "NWNX_Appearance"; ///< @private @@ -49,25 +48,18 @@ int NWNX_Appearance_GetOverride(object oPlayer, object oCreature, int nType); void NWNX_Appearance_SetOverride(object oPlayer, object oCreature, int nType, int nValue) { - string sFunc = "SetOverride"; - - NWNX_PushArgumentInt(NWNX_Appearance, sFunc, nValue); - NWNX_PushArgumentInt(NWNX_Appearance, sFunc, nType); - NWNX_PushArgumentObject(NWNX_Appearance, sFunc, oCreature); - NWNX_PushArgumentObject(NWNX_Appearance, sFunc, oPlayer); - - NWNX_CallFunction(NWNX_Appearance, sFunc); + NWNXPushInt(nValue); + NWNXPushInt(nType); + NWNXPushObject(oCreature); + NWNXPushObject(oPlayer); + NWNXCall(NWNX_Appearance, "SetOverride"); } int NWNX_Appearance_GetOverride(object oPlayer, object oCreature, int nType) { - string sFunc = "GetOverride"; - - NWNX_PushArgumentInt(NWNX_Appearance, sFunc, nType); - NWNX_PushArgumentObject(NWNX_Appearance, sFunc, oCreature); - NWNX_PushArgumentObject(NWNX_Appearance, sFunc, oPlayer); - - NWNX_CallFunction(NWNX_Appearance, sFunc); - - return NWNX_GetReturnValueInt(NWNX_Appearance, sFunc); + NWNXPushInt(nType); + NWNXPushObject(oCreature); + NWNXPushObject(oPlayer); + NWNXCall(NWNX_Appearance, "GetOverride"); + return NWNXPopInt(); } diff --git a/_module/nss/nwnx_area.nss b/_module/nss/nwnx_area.nss index 2bdba08..d096c8a 100644 --- a/_module/nss/nwnx_area.nss +++ b/_module/nss/nwnx_area.nss @@ -2,7 +2,6 @@ /// @brief Functions exposing additional area properties as well as creating transitions. /// @{ /// @file nwnx_area.nss -#include "nwnx" const string NWNX_Area = "NWNX_Area"; ///< @private @@ -40,6 +39,25 @@ const int NWNX_AREA_COLOR_TYPE_SUN_AMBIENT = 2; const int NWNX_AREA_COLOR_TYPE_SUN_DIFFUSE = 3; /// @} +/// @brief A tile info struct +struct NWNX_Area_TileInfo +{ + int nID; ///< The tile's ID + int nHeight; ///< The tile's height + int nOrientation; ///< The tile's orientation + int nGridX; ///< The tile's grid x position + 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. @@ -223,328 +241,507 @@ int NWNX_Area_GetMusicIsPlaying(object oArea, int bBattleMusic = FALSE); /// @sa NWNX_Object_SetTriggerGeometry() if you wish to draw the trigger as something other than a square. object NWNX_Area_CreateGenericTrigger(object oArea, float fX, float fY, float fZ, string sTag = "", float fSize = 1.0f); +/// @brief Add oObject to the ExportGIT exclusion list, objects on this list won't be exported when NWNX_Area_ExportGIT() is called. +/// @param oObject The object to add +void NWNX_Area_AddObjectToExclusionList(object oObject); + +/// @brief Remove oObject from the ExportGIT exclusion list. +/// @param oObject The object to add +void NWNX_Area_RemoveObjectFromExclusionList(object oObject); + +/// @brief Export the .git file of oArea to the UserDirectory/nwnx folder, or to the location of sAlias. +/// @note Take care with local objects set on objects, they will likely not reference the same object after a server restart. +/// @param oArea The area to export the .git file of. +/// @param sFileName The filename, 16 characters or less and should be lowercase. If left blank the resref of oArea will be used. +/// @param bExportVarTable If TRUE, local variables set on oArea will be exported too. +/// @param bExportUUID If TRUE, the UUID of oArea will be exported, if it has one. +/// @param nObjectFilter One or more OBJECT_TYPE_* constants. These object will not be exported. For example OBJECT_TYPE_CREATURE | OBJECT_TYPE_DOOR +/// will not export creatures and doors. Use OBJECT_TYPE_ALL to filter all objects or 0 to export all objects. +/// @param sAlias The alias of the resource directory to add the .git file to. Default: UserDirectory/nwnx +/// @return TRUE if exported successfully, FALSE if not. +int NWNX_Area_ExportGIT(object oArea, string sFileName = "", int bExportVarTable = TRUE, int bExportUUID = TRUE, int nObjectFilter = 0, string sAlias = "NWNX"); + +/// @brief Get the tile info of the tile at [fTileX, fTileY] in oArea. +/// @param oArea The area name. +/// @param fTileX, fTileY The coordinates of the tile. +/// @return A NWNX_Area_TileInfo struct with tile info. +struct NWNX_Area_TileInfo NWNX_Area_GetTileInfo(object oArea, float fTileX, float fTileY); + +/// @brief Export the .are file of oArea to the UserDirectory/nwnx folder, or to the location of sAlias. +/// @param oArea The area to export the .are file of. +/// @param sFileName The filename, 16 characters or less and should be lowercase. This will also be the resref of the area. +/// @param sNewName Optional new name of the area. Leave blank to use the current name. +/// @param sNewTag Optional new tag of the area. Leave blank to use the current tag. +/// @param sAlias The alias of the resource directory to add the .are file to. Default: UserDirectory/nwnx +/// @return TRUE if exported successfully, FALSE if not. +int NWNX_Area_ExportARE(object oArea, string sFileName, string sNewName = "", string sNewTag = "", string sAlias = "NWNX"); + +/// @brief Get the ambient sound playing in an area during the day. +/// @param oArea The area to get the sound of. +/// @return The ambient soundtrack. See ambientsound.2da. +int NWNX_Area_GetAmbientSoundDay(object oArea); + +/// @brief Get the ambient sound playing in an area during the night. +/// @param oArea The area to get the sound of. +/// @return The ambient soundtrack. See ambientsound.2da. +int NWNX_Area_GetAmbientSoundNight(object oArea); + +/// @brief Get the volume of the ambient sound playing in an area during the day. +/// @param oArea The area to get the sound volume of. +/// @return The volume. +int NWNX_Area_GetAmbientSoundDayVolume(object oArea); + +/// @brief Get the volume of the ambient sound playing in an area during the night. +/// @param oArea The area to get the sound volume of. +/// @return The volume. +int NWNX_Area_GetAmbientSoundNightVolume(object oArea); + +/// @brief Create a sound object. +/// @param oArea The area where to create the sound object. +/// @param vPosition The area position where to create the sound object. +/// @param sResRef The ResRef of the sound object. +/// @return The sound object. +object NWNX_Area_CreateSoundObject(object oArea, vector vPosition, string sResRef); + +/// @brief Rotates an existing area, including all objects within (excluding PCs). +/// @note Functions while clients are in the area, but not recommended as tiles/walkmesh only updates on area load, and this may result in unexpected clientside results. +/// @param oArea The area to be rotated +/// @param nRotation How many 90 degrees clockwise to rotate (1-3). +void NWNX_Area_RotateArea(object oArea, int nRotation); + +/// @brief Get the tile info of the tile at nIndex in the tile array. +/// @param oArea The area. +/// @param nIndex The index of the tile. +/// @return A NWNX_Area_TileInfo struct with tile info. +struct NWNX_Area_TileInfo NWNX_Area_GetTileInfoByTileIndex(object oArea, int nIndex); + +/// @brief Check if there is a path between two positions in an area. +/// @note Does not care about doors or placeables, only checks tile path nodes. +/// @param oArea The area. +/// @param vStartPosition The start position. +/// @param vEndPosition The end position. +/// @param nMaxDepth The max depth of the DFS tree. A good value is AreaWidth * AreaHeight. +/// @return TRUE if there is a path between vStartPosition and vEndPosition, FALSE if not or on error. +int NWNX_Area_GetPathExists(object oArea, vector vStartPosition, vector vEndPosition, int nMaxDepth); + +/// @brief Get oArea's flags, interior/underground etc. +/// @param oArea The area. +/// @return The raw flags bitmask or -1 on error. +int NWNX_Area_GetAreaFlags(object oArea); + +/// @brief Set oArea's raw flags bitmask. +/// @note You'll have to do any bitwise operations yourself. +/// @note Requires clients to reload the area to get any updated flags. +/// @param oArea The area. +/// @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) { - string sFunc = "GetNumberOfPlayersInArea"; - - NWNX_PushArgumentObject(NWNX_Area, sFunc, area); - NWNX_CallFunction(NWNX_Area, sFunc); - - return NWNX_GetReturnValueInt(NWNX_Area, sFunc); + NWNXPushObject(area); + NWNXCall(NWNX_Area, "GetNumberOfPlayersInArea"); + return NWNXPopInt(); } object NWNX_Area_GetLastEntered(object area) { - string sFunc = "GetLastEntered"; - - NWNX_PushArgumentObject(NWNX_Area, sFunc, area); - NWNX_CallFunction(NWNX_Area, sFunc); - - return NWNX_GetReturnValueObject(NWNX_Area, sFunc); + NWNXPushObject(area); + NWNXCall(NWNX_Area, "GetLastEntered"); + return NWNXPopObject(); } object NWNX_Area_GetLastLeft(object area) { - string sFunc = "GetLastLeft"; - - NWNX_PushArgumentObject(NWNX_Area, sFunc, area); - NWNX_CallFunction(NWNX_Area, sFunc); - - return NWNX_GetReturnValueObject(NWNX_Area, sFunc); + NWNXPushObject(area); + NWNXCall(NWNX_Area, "GetLastLeft"); + return NWNXPopObject(); } int NWNX_Area_GetPVPSetting(object area) { - string sFunc = "GetPVPSetting"; - - NWNX_PushArgumentObject(NWNX_Area, sFunc, area); - NWNX_CallFunction(NWNX_Area, sFunc); - - return NWNX_GetReturnValueInt(NWNX_Area, sFunc); + NWNXPushObject(area); + NWNXCall(NWNX_Area, "GetPVPSetting"); + return NWNXPopInt(); } void NWNX_Area_SetPVPSetting(object area, int pvpSetting) { - string sFunc = "SetPVPSetting"; - - NWNX_PushArgumentInt(NWNX_Area, sFunc, pvpSetting); - NWNX_PushArgumentObject(NWNX_Area, sFunc, area); - NWNX_CallFunction(NWNX_Area, sFunc); + NWNXPushInt(pvpSetting); + NWNXPushObject(area); + NWNXCall(NWNX_Area, "SetPVPSetting"); } int NWNX_Area_GetAreaSpotModifier(object area) { - string sFunc = "GetAreaSpotModifier"; - - NWNX_PushArgumentObject(NWNX_Area, sFunc, area); - NWNX_CallFunction(NWNX_Area, sFunc); - - return NWNX_GetReturnValueInt(NWNX_Area, sFunc); + NWNXPushObject(area); + NWNXCall(NWNX_Area, "GetAreaSpotModifier"); + return NWNXPopInt(); } void NWNX_Area_SetAreaSpotModifier(object area, int spotModifier) { - string sFunc = "SetAreaSpotModifier"; - - NWNX_PushArgumentInt(NWNX_Area, sFunc, spotModifier); - NWNX_PushArgumentObject(NWNX_Area, sFunc, area); - NWNX_CallFunction(NWNX_Area, sFunc); + NWNXPushInt(spotModifier); + NWNXPushObject(area); + NWNXCall(NWNX_Area, "SetAreaSpotModifier"); } int NWNX_Area_GetAreaListenModifier(object area) { - string sFunc = "GetAreaListenModifier"; - - NWNX_PushArgumentObject(NWNX_Area, sFunc, area); - NWNX_CallFunction(NWNX_Area, sFunc); - - return NWNX_GetReturnValueInt(NWNX_Area, sFunc); + NWNXPushObject(area); + NWNXCall(NWNX_Area, "GetAreaListenModifier"); + return NWNXPopInt(); } void NWNX_Area_SetAreaListenModifier(object area, int listenModifier) { - string sFunc = "SetAreaListenModifier"; - - NWNX_PushArgumentInt(NWNX_Area, sFunc, listenModifier); - NWNX_PushArgumentObject(NWNX_Area, sFunc, area); - NWNX_CallFunction(NWNX_Area, sFunc); + NWNXPushInt(listenModifier); + NWNXPushObject(area); + NWNXCall(NWNX_Area, "SetAreaListenModifier"); } int NWNX_Area_GetNoRestingAllowed(object area) { - string sFunc = "GetNoRestingAllowed"; - - NWNX_PushArgumentObject(NWNX_Area, sFunc, area); - NWNX_CallFunction(NWNX_Area, sFunc); - - return NWNX_GetReturnValueInt(NWNX_Area, sFunc); + NWNXPushObject(area); + NWNXCall(NWNX_Area, "GetNoRestingAllowed"); + return NWNXPopInt(); } void NWNX_Area_SetNoRestingAllowed(object area, int bNoRestingAllowed) { - string sFunc = "SetNoRestingAllowed"; - - NWNX_PushArgumentInt(NWNX_Area, sFunc, bNoRestingAllowed); - NWNX_PushArgumentObject(NWNX_Area, sFunc, area); - NWNX_CallFunction(NWNX_Area, sFunc); + NWNXPushInt(bNoRestingAllowed); + NWNXPushObject(area); + NWNXCall(NWNX_Area, "SetNoRestingAllowed"); } int NWNX_Area_GetWindPower(object area) { - string sFunc = "GetWindPower"; - - NWNX_PushArgumentObject(NWNX_Area, sFunc, area); - NWNX_CallFunction(NWNX_Area, sFunc); - - return NWNX_GetReturnValueInt(NWNX_Area, sFunc); + NWNXPushObject(area); + NWNXCall(NWNX_Area, "GetWindPower"); + return NWNXPopInt(); } void NWNX_Area_SetWindPower(object area, int windPower) { - string sFunc = "SetWindPower"; - - NWNX_PushArgumentInt(NWNX_Area, sFunc, windPower); - NWNX_PushArgumentObject(NWNX_Area, sFunc, area); - NWNX_CallFunction(NWNX_Area, sFunc); + NWNXPushInt(windPower); + NWNXPushObject(area); + NWNXCall(NWNX_Area, "SetWindPower"); } int NWNX_Area_GetWeatherChance(object area, int type) { - string sFunc = "GetWeatherChance"; - - NWNX_PushArgumentInt(NWNX_Area, sFunc, type); - NWNX_PushArgumentObject(NWNX_Area, sFunc, area); - NWNX_CallFunction(NWNX_Area, sFunc); - - return NWNX_GetReturnValueInt(NWNX_Area, sFunc); + NWNXPushInt(type); + NWNXPushObject(area); + NWNXCall(NWNX_Area, "GetWeatherChance"); + return NWNXPopInt(); } void NWNX_Area_SetWeatherChance(object area, int type, int chance) { - string sFunc = "SetWeatherChance"; - - NWNX_PushArgumentInt(NWNX_Area, sFunc, chance); - NWNX_PushArgumentInt(NWNX_Area, sFunc, type); - NWNX_PushArgumentObject(NWNX_Area, sFunc, area); - NWNX_CallFunction(NWNX_Area, sFunc); + NWNXPushInt(chance); + NWNXPushInt(type); + NWNXPushObject(area); + NWNXCall(NWNX_Area, "SetWeatherChance"); } float NWNX_Area_GetFogClipDistance(object area) { - string sFunc = "GetFogClipDistance"; - - NWNX_PushArgumentObject(NWNX_Area, sFunc, area); - NWNX_CallFunction(NWNX_Area, sFunc); - - return NWNX_GetReturnValueFloat(NWNX_Area, sFunc); + NWNXPushObject(area); + NWNXCall(NWNX_Area, "GetFogClipDistance"); + return NWNXPopFloat(); } void NWNX_Area_SetFogClipDistance(object area, float distance) { - string sFunc = "SetFogClipDistance"; - - NWNX_PushArgumentFloat(NWNX_Area, sFunc, distance); - NWNX_PushArgumentObject(NWNX_Area, sFunc, area); - NWNX_CallFunction(NWNX_Area, sFunc); + NWNXPushFloat(distance); + NWNXPushObject(area); + NWNXCall(NWNX_Area, "SetFogClipDistance"); } int NWNX_Area_GetShadowOpacity(object area) { - string sFunc = "GetShadowOpacity"; - - NWNX_PushArgumentObject(NWNX_Area, sFunc, area); - NWNX_CallFunction(NWNX_Area, sFunc); - - return NWNX_GetReturnValueInt(NWNX_Area, sFunc); + NWNXPushObject(area); + NWNXCall(NWNX_Area, "GetShadowOpacity"); + return NWNXPopInt(); } void NWNX_Area_SetShadowOpacity(object area, int shadowOpacity) { - string sFunc = "SetShadowOpacity"; - - NWNX_PushArgumentInt(NWNX_Area, sFunc, shadowOpacity); - NWNX_PushArgumentObject(NWNX_Area, sFunc, area); - NWNX_CallFunction(NWNX_Area, sFunc); + NWNXPushInt(shadowOpacity); + NWNXPushObject(area); + NWNXCall(NWNX_Area, "SetShadowOpacity"); } int NWNX_Area_GetDayNightCycle(object area) { - string sFunc = "GetDayNightCycle"; - - NWNX_PushArgumentObject(NWNX_Area, sFunc, area); - NWNX_CallFunction(NWNX_Area, sFunc); - - return NWNX_GetReturnValueInt(NWNX_Area, sFunc); + NWNXPushObject(area); + NWNXCall(NWNX_Area, "GetDayNightCycle"); + return NWNXPopInt(); } void NWNX_Area_SetDayNightCycle(object area, int type) { - string sFunc = "SetDayNightCycle"; - - NWNX_PushArgumentInt(NWNX_Area, sFunc, type); - NWNX_PushArgumentObject(NWNX_Area, sFunc, area); - NWNX_CallFunction(NWNX_Area, sFunc); + NWNXPushInt(type); + NWNXPushObject(area); + NWNXCall(NWNX_Area, "SetDayNightCycle"); } int NWNX_Area_GetSunMoonColors(object area, int type) { - string sFunc = "GetSunMoonColors"; - - NWNX_PushArgumentInt(NWNX_Area, sFunc, type); - NWNX_PushArgumentObject(NWNX_Area, sFunc, area); - NWNX_CallFunction(NWNX_Area, sFunc); - - return NWNX_GetReturnValueInt(NWNX_Area, sFunc); + NWNXPushInt(type); + NWNXPushObject(area); + NWNXCall(NWNX_Area, "GetSunMoonColors"); + return NWNXPopInt(); } void NWNX_Area_SetSunMoonColors(object area, int type, int color) { - string sFunc = "SetSunMoonColors"; - - NWNX_PushArgumentInt(NWNX_Area, sFunc, color); - NWNX_PushArgumentInt(NWNX_Area, sFunc, type); - NWNX_PushArgumentObject(NWNX_Area, sFunc, area); - NWNX_CallFunction(NWNX_Area, sFunc); + NWNXPushInt(color); + NWNXPushInt(type); + NWNXPushObject(area); + NWNXCall(NWNX_Area, "SetSunMoonColors"); } object NWNX_Area_CreateTransition(object area, object target, float x, float y, float z, float size = 2.0f, string tag="") { - string sFunc = "CreateTransition"; - - NWNX_PushArgumentString(NWNX_Area, sFunc, tag); - NWNX_PushArgumentFloat(NWNX_Area, sFunc, size); - NWNX_PushArgumentFloat(NWNX_Area, sFunc, z); - NWNX_PushArgumentFloat(NWNX_Area, sFunc, y); - NWNX_PushArgumentFloat(NWNX_Area, sFunc, x); - NWNX_PushArgumentObject(NWNX_Area, sFunc, target); - NWNX_PushArgumentObject(NWNX_Area, sFunc, area); - NWNX_CallFunction(NWNX_Area, sFunc); - - return NWNX_GetReturnValueObject(NWNX_Area, sFunc); + NWNXPushString(tag); + NWNXPushFloat(size); + NWNXPushFloat(z); + NWNXPushFloat(y); + NWNXPushFloat(x); + NWNXPushObject(target); + NWNXPushObject(area); + NWNXCall(NWNX_Area, "CreateTransition"); + return NWNXPopObject(); } int NWNX_Area_GetTileAnimationLoop(object oArea, float fTileX, float fTileY, int nAnimLoop) { - string sFunc = "GetTileAnimationLoop"; + NWNXPushInt(nAnimLoop); + NWNXPushFloat(fTileY); + NWNXPushFloat(fTileX); + NWNXPushObject(oArea); - NWNX_PushArgumentInt(NWNX_Area, sFunc, nAnimLoop); - NWNX_PushArgumentFloat(NWNX_Area, sFunc, fTileY); - NWNX_PushArgumentFloat(NWNX_Area, sFunc, fTileX); - NWNX_PushArgumentObject(NWNX_Area, sFunc, oArea); - - NWNX_CallFunction(NWNX_Area, sFunc); - - return NWNX_GetReturnValueInt(NWNX_Area, sFunc); + NWNXCall(NWNX_Area, "GetTileAnimationLoop"); + return NWNXPopInt(); } void NWNX_Area_SetTileAnimationLoop(object oArea, float fTileX, float fTileY, int nAnimLoop, int bEnabled) { - string sFunc = "SetTileAnimationLoop"; - - NWNX_PushArgumentInt(NWNX_Area, sFunc, bEnabled); - NWNX_PushArgumentInt(NWNX_Area, sFunc, nAnimLoop); - NWNX_PushArgumentFloat(NWNX_Area, sFunc, fTileY); - NWNX_PushArgumentFloat(NWNX_Area, sFunc, fTileX); - NWNX_PushArgumentObject(NWNX_Area, sFunc, oArea); - - NWNX_CallFunction(NWNX_Area, sFunc); + NWNXPushInt(bEnabled); + NWNXPushInt(nAnimLoop); + NWNXPushFloat(fTileY); + NWNXPushFloat(fTileX); + NWNXPushObject(oArea); + NWNXCall(NWNX_Area, "SetTileAnimationLoop"); } string NWNX_Area_GetTileModelResRef(object oArea, float fTileX, float fTileY) { - string sFunc = "GetTileModelResRef"; - NWNX_PushArgumentFloat(NWNX_Area, sFunc, fTileY); - NWNX_PushArgumentFloat(NWNX_Area, sFunc, fTileX); - NWNX_PushArgumentObject(NWNX_Area, sFunc, oArea); - - NWNX_CallFunction(NWNX_Area, sFunc); - - return NWNX_GetReturnValueString(NWNX_Area, sFunc); + NWNXPushFloat(fTileY); + NWNXPushFloat(fTileX); + NWNXPushObject(oArea); + NWNXCall(NWNX_Area, "GetTileModelResRef"); + return NWNXPopString(); } int NWNX_Area_TestDirectLine(object oArea, float fStartX, float fStartY, float fEndX, float fEndY, float fPerSpace, float fHeight, int bIgnoreDoors=FALSE) { - string sFunc = "TestDirectLine"; - - NWNX_PushArgumentInt(NWNX_Area, sFunc, bIgnoreDoors); - NWNX_PushArgumentFloat(NWNX_Area, sFunc, fHeight); - NWNX_PushArgumentFloat(NWNX_Area, sFunc, fPerSpace); - NWNX_PushArgumentFloat(NWNX_Area, sFunc, fEndY); - NWNX_PushArgumentFloat(NWNX_Area, sFunc, fEndX); - NWNX_PushArgumentFloat(NWNX_Area, sFunc, fStartY); - NWNX_PushArgumentFloat(NWNX_Area, sFunc, fStartX); - NWNX_PushArgumentObject(NWNX_Area, sFunc, oArea); - - NWNX_CallFunction(NWNX_Area, sFunc); - - return NWNX_GetReturnValueInt(NWNX_Area, sFunc); + NWNXPushInt(bIgnoreDoors); + NWNXPushFloat(fHeight); + NWNXPushFloat(fPerSpace); + NWNXPushFloat(fEndY); + NWNXPushFloat(fEndX); + NWNXPushFloat(fStartY); + NWNXPushFloat(fStartX); + NWNXPushObject(oArea); + NWNXCall(NWNX_Area, "TestDirectLine"); + return NWNXPopInt(); } int NWNX_Area_GetMusicIsPlaying(object oArea, int bBattleMusic = FALSE) { - string sFunc = "GetMusicIsPlaying"; - - NWNX_PushArgumentInt(NWNX_Area, sFunc, bBattleMusic); - NWNX_PushArgumentObject(NWNX_Area, sFunc, oArea); - NWNX_CallFunction(NWNX_Area, sFunc); - - return NWNX_GetReturnValueInt(NWNX_Area, sFunc); + NWNXPushInt(bBattleMusic); + NWNXPushObject(oArea); + NWNXCall(NWNX_Area, "GetMusicIsPlaying"); + return NWNXPopInt(); } object NWNX_Area_CreateGenericTrigger(object oArea, float fX, float fY, float fZ, string sTag = "", float fSize = 1.0f) { - string sFunc = "CreateGenericTrigger"; - - NWNX_PushArgumentFloat(NWNX_Area, sFunc, fSize); - NWNX_PushArgumentString(NWNX_Area, sFunc, sTag); - NWNX_PushArgumentFloat(NWNX_Area, sFunc, fZ); - NWNX_PushArgumentFloat(NWNX_Area, sFunc, fY); - NWNX_PushArgumentFloat(NWNX_Area, sFunc, fX); - NWNX_PushArgumentObject(NWNX_Area, sFunc, oArea); - NWNX_CallFunction(NWNX_Area, sFunc); - - return NWNX_GetReturnValueObject(NWNX_Area, sFunc); + NWNXPushFloat(fSize); + NWNXPushString(sTag); + NWNXPushFloat(fZ); + NWNXPushFloat(fY); + NWNXPushFloat(fX); + NWNXPushObject(oArea); + NWNXCall(NWNX_Area, "CreateGenericTrigger"); + return NWNXPopObject(); +} + +void NWNX_Area_AddObjectToExclusionList(object oObject) +{ + NWNXPushObject(oObject); + NWNXCall(NWNX_Area, "AddObjectToExclusionList"); +} + +void NWNX_Area_RemoveObjectFromExclusionList(object oObject) +{ + NWNXPushObject(oObject); + NWNXCall(NWNX_Area, "RemoveObjectFromExclusionList"); +} + +int NWNX_Area_ExportGIT(object oArea, string sFileName = "", int bExportVarTable = TRUE, int bExportUUID = TRUE, int nObjectFilter = 0, string sAlias = "NWNX") +{ + NWNXPushString(sAlias); + NWNXPushInt(nObjectFilter); + NWNXPushInt(bExportUUID); + NWNXPushInt(bExportVarTable); + NWNXPushString(sFileName); + NWNXPushObject(oArea); + NWNXCall(NWNX_Area, "ExportGIT"); + return NWNXPopInt(); +} + +struct NWNX_Area_TileInfo NWNX_Area_GetTileInfo(object oArea, float fTileX, float fTileY) +{ + NWNXPushFloat(fTileY); + NWNXPushFloat(fTileX); + NWNXPushObject(oArea); + NWNXCall(NWNX_Area, "GetTileInfo"); + struct NWNX_Area_TileInfo str; + str.nGridY = NWNXPopInt(); + str.nGridX = NWNXPopInt(); + str.nOrientation = NWNXPopInt(); + str.nHeight = NWNXPopInt(); + str.nID = NWNXPopInt(); + return str; +} + +int NWNX_Area_ExportARE(object oArea, string sFileName, string sNewName = "", string sNewTag = "", string sAlias = "NWNX") +{ + NWNXPushString(sAlias); + NWNXPushString(sNewTag); + NWNXPushString(sNewName); + NWNXPushString(sFileName); + NWNXPushObject(oArea); + NWNXCall(NWNX_Area, "ExportARE"); + return NWNXPopInt(); +} + +int NWNX_Area_GetAmbientSoundDay(object oArea) +{ + NWNXPushObject(oArea); + NWNXCall(NWNX_Area, "GetAmbientSoundDay"); + return NWNXPopInt(); +} + +int NWNX_Area_GetAmbientSoundNight(object oArea) +{ + NWNXPushObject(oArea); + NWNXCall(NWNX_Area, "GetAmbientSoundNight"); + return NWNXPopInt(); +} + +int NWNX_Area_GetAmbientSoundDayVolume(object oArea) +{ + NWNXPushObject(oArea); + NWNXCall(NWNX_Area, "GetAmbientSoundDayVolume"); + return NWNXPopInt(); +} + +int NWNX_Area_GetAmbientSoundNightVolume(object oArea) +{ + NWNXPushObject(oArea); + NWNXCall(NWNX_Area, "GetAmbientSoundNightVolume"); + return NWNXPopInt(); +} + +object NWNX_Area_CreateSoundObject(object oArea, vector vPosition, string sResRef) +{ + NWNXPushString(sResRef); + NWNXPushVector(vPosition); + NWNXPushObject(oArea); + NWNXCall(NWNX_Area, "CreateSoundObject"); + return NWNXPopObject(); +} + +void NWNX_Area_RotateArea(object oArea, int nRotation) +{ + NWNXPushInt(nRotation); + NWNXPushObject(oArea); + NWNXCall(NWNX_Area, "RotateArea"); +} + +struct NWNX_Area_TileInfo NWNX_Area_GetTileInfoByTileIndex(object oArea, int nIndex) +{ + NWNXPushInt(nIndex); + NWNXPushObject(oArea); + NWNXCall(NWNX_Area, "GetTileInfoByTileIndex"); + struct NWNX_Area_TileInfo str; + str.nGridY = NWNXPopInt(); + str.nGridX = NWNXPopInt(); + str.nOrientation = NWNXPopInt(); + str.nHeight = NWNXPopInt(); + str.nID = NWNXPopInt(); + return str; +} + +int NWNX_Area_GetPathExists(object oArea, vector vStartPosition, vector vEndPosition, int nMaxDepth) +{ + NWNXPushInt(nMaxDepth); + NWNXPushVector(vEndPosition); + NWNXPushVector(vStartPosition); + NWNXPushObject(oArea); + NWNXCall(NWNX_Area, "GetPathExists"); + return NWNXPopInt(); +} + +int NWNX_Area_GetAreaFlags(object oArea) +{ + NWNXPushObject(oArea); + NWNXCall(NWNX_Area, "GetAreaFlags"); + return NWNXPopInt(); +} + +void NWNX_Area_SetAreaFlags(object oArea, int nFlags) +{ + NWNXPushInt(nFlags); + NWNXPushObject(oArea); + NWNXCall(NWNX_Area, "SetAreaFlags"); +} + +struct NWNX_Area_AreaWind NWNX_Area_GetAreaWind(object oArea) +{ + struct NWNX_Area_AreaWind data; + NWNXPushObject(oArea); + NWNXCall(NWNX_Area, "GetAreaWind"); + data.fPitch = NWNXPopFloat(); + data.fYaw = NWNXPopFloat(); + data.fMagnitude = NWNXPopFloat(); + data.vDirection = NWNXPopVector(); + return data; +} + +void NWNX_Area_SetDefaultObjectUiDiscoveryMask(object oArea, int nObjectTypes, int nMask, int bForceUpdate = FALSE) +{ + NWNXPushInt(bForceUpdate); + NWNXPushInt(nMask); + NWNXPushInt(nObjectTypes); + NWNXPushObject(oArea); + NWNXCall(NWNX_Area, "SetDefaultObjectUiDiscoveryMask"); } diff --git a/_module/nss/nwnx_chat.nss b/_module/nss/nwnx_chat.nss index 90ca95e..538fb2b 100644 --- a/_module/nss/nwnx_chat.nss +++ b/_module/nss/nwnx_chat.nss @@ -2,7 +2,6 @@ /// @brief Functions related to chat. /// @{ /// @file nwnx_chat.nss -#include "nwnx" const string NWNX_Chat = "NWNX_Chat"; ///< @private @@ -80,79 +79,61 @@ float NWNX_Chat_GetChatHearingDistance(object listener = OBJECT_INVALID, int cha int NWNX_Chat_SendMessage(int channel, string message, object sender = OBJECT_SELF, object target = OBJECT_INVALID) { - string sFunc = "SendMessage"; - - NWNX_PushArgumentObject(NWNX_Chat, sFunc, target); - NWNX_PushArgumentObject(NWNX_Chat, sFunc, sender); - NWNX_PushArgumentString(NWNX_Chat, sFunc, message); - NWNX_PushArgumentInt(NWNX_Chat, sFunc, channel); - NWNX_CallFunction(NWNX_Chat, sFunc); - return NWNX_GetReturnValueInt(NWNX_Chat, sFunc); + NWNXPushObject(target); + NWNXPushObject(sender); + NWNXPushString(message); + NWNXPushInt(channel); + NWNXCall(NWNX_Chat, "SendMessage"); + return NWNXPopInt(); } void NWNX_Chat_RegisterChatScript(string script) { - string sFunc = "RegisterChatScript"; - - NWNX_PushArgumentString(NWNX_Chat, sFunc, script); - NWNX_CallFunction(NWNX_Chat, sFunc); + NWNXPushString(script); + NWNXCall(NWNX_Chat, "RegisterChatScript"); } void NWNX_Chat_SkipMessage() { - string sFunc = "SkipMessage"; - - NWNX_CallFunction(NWNX_Chat, sFunc); + NWNXCall(NWNX_Chat, "SkipMessage"); } int NWNX_Chat_GetChannel() { - string sFunc = "GetChannel"; - - NWNX_CallFunction(NWNX_Chat, sFunc); - return NWNX_GetReturnValueInt(NWNX_Chat, sFunc); + NWNXCall(NWNX_Chat, "GetChannel"); + return NWNXPopInt(); } string NWNX_Chat_GetMessage() { - string sFunc = "GetMessage"; - - NWNX_CallFunction(NWNX_Chat, sFunc); - return NWNX_GetReturnValueString(NWNX_Chat, sFunc); + NWNXCall(NWNX_Chat, "GetMessage"); + return NWNXPopString(); } object NWNX_Chat_GetSender() { - string sFunc = "GetSender"; - - NWNX_CallFunction(NWNX_Chat, sFunc); - return NWNX_GetReturnValueObject(NWNX_Chat, sFunc); + NWNXCall(NWNX_Chat, "GetSender"); + return NWNXPopObject(); } object NWNX_Chat_GetTarget() { - string sFunc = "GetTarget"; - - NWNX_CallFunction(NWNX_Chat, sFunc); - return NWNX_GetReturnValueObject(NWNX_Chat, sFunc); + NWNXCall(NWNX_Chat, "GetTarget"); + return NWNXPopObject(); } void NWNX_Chat_SetChatHearingDistance(float distance, object listener = OBJECT_INVALID, int channel = NWNX_CHAT_CHANNEL_PLAYER_TALK) { - string sFunc = "SetChatHearingDistance"; - - NWNX_PushArgumentInt(NWNX_Chat, sFunc, channel); - NWNX_PushArgumentObject(NWNX_Chat, sFunc, listener); - NWNX_PushArgumentFloat(NWNX_Chat, sFunc, distance); - NWNX_CallFunction(NWNX_Chat, sFunc); + NWNXPushInt(channel); + NWNXPushObject(listener); + NWNXPushFloat(distance); + NWNXCall(NWNX_Chat, "SetChatHearingDistance"); } float NWNX_Chat_GetChatHearingDistance(object listener = OBJECT_INVALID, int channel = NWNX_CHAT_CHANNEL_PLAYER_TALK) { - string sFunc = "GetChatHearingDistance"; - - NWNX_PushArgumentInt(NWNX_Chat, sFunc, channel); - NWNX_PushArgumentObject(NWNX_Chat, sFunc, listener); - NWNX_CallFunction(NWNX_Chat, sFunc); - return NWNX_GetReturnValueFloat(NWNX_Chat, sFunc); + NWNXPushInt(channel); + NWNXPushObject(listener); + NWNXCall(NWNX_Chat, "GetChatHearingDistance"); + return NWNXPopFloat(); } diff --git a/_module/nss/nwnx_consts.nss b/_module/nss/nwnx_consts.nss index d89a88a..3562ec7 100644 --- a/_module/nss/nwnx_consts.nss +++ b/_module/nss/nwnx_consts.nss @@ -1,17 +1,22 @@ /// @ingroup nwnx /// @addtogroup consts NWNX Constants -/// @brief Provides various NWScript <-> NWNX Constants Translation Table functions +/// @brief Provides various NWScript <-> Engine Constants Translation Table functions /// @{ /// @file nwnx_consts.nss -/// @brief Translates ANIMATION_LOOPING_* and ANIMATION_FIREFORGET_* constants to their NWNX equivalent. +/// @brief Translates ANIMATION_LOOPING_* and ANIMATION_FIREFORGET_* constants to their engine equivalent. /// @param nAnimation The nwn animation constant -/// @return The NWNX equivalent of the constant +/// @return The engine equivalent of the constant int NWNX_Consts_TranslateNWScriptAnimation(int nAnimation); -/// @brief Translates OBJECT_TYPE_* constants to their NWNX equivalent. +/// @brief Translates engine animation constants to their ANIMATION_LOOPING_* and ANIMATION_FIREFORGET_* equivalent. +/// @param nAnimation The engine animation constant +/// @return The NWScript equivalent of the constant or -1 if a nwscript equivalent doesn't exist +int NWNX_Consts_TranslateEngineAnimation(int nAnimation); + +/// @brief Translates OBJECT_TYPE_* constants to their engine equivalent. /// @param nObjectType The nwn object type -/// @return The NWNX equivalent of the constant +/// @return The engine equivalent of the constant int NWNX_Consts_TranslateNWScriptObjectType(int nObjectType); @@ -85,6 +90,76 @@ int NWNX_Consts_TranslateNWScriptAnimation(int nAnimation) return nAnimation; } +int NWNX_Consts_TranslateEngineAnimation(int nAnimation) +{ + switch (nAnimation) + { + case 0: nAnimation = ANIMATION_LOOPING_PAUSE; break; + case 52: nAnimation = ANIMATION_LOOPING_PAUSE2; break; + case 30: nAnimation = ANIMATION_LOOPING_LISTEN; break; + case 32: nAnimation = ANIMATION_LOOPING_MEDITATE; break; + case 33: nAnimation = ANIMATION_LOOPING_WORSHIP; break; + case 48: nAnimation = ANIMATION_LOOPING_LOOK_FAR; break; + case 36: nAnimation = ANIMATION_LOOPING_SIT_CHAIR; break; + case 47: nAnimation = ANIMATION_LOOPING_SIT_CROSS; break; + case 38: nAnimation = ANIMATION_LOOPING_TALK_NORMAL; break; + case 39: nAnimation = ANIMATION_LOOPING_TALK_PLEADING; break; + case 40: nAnimation = ANIMATION_LOOPING_TALK_FORCEFUL; break; + case 41: nAnimation = ANIMATION_LOOPING_TALK_LAUGHING; break; + case 59: nAnimation = ANIMATION_LOOPING_GET_LOW; break; + case 60: nAnimation = ANIMATION_LOOPING_GET_MID; break; + case 57: nAnimation = ANIMATION_LOOPING_PAUSE_TIRED; break; + case 58: nAnimation = ANIMATION_LOOPING_PAUSE_DRUNK; break; + case 6: nAnimation = ANIMATION_LOOPING_DEAD_FRONT; break; + case 8: nAnimation = ANIMATION_LOOPING_DEAD_BACK; break; + case 15: nAnimation = ANIMATION_LOOPING_CONJURE1; break; + case 16: nAnimation = ANIMATION_LOOPING_CONJURE2; break; + case 93: nAnimation = ANIMATION_LOOPING_SPASM; break; + case 97: nAnimation = ANIMATION_LOOPING_CUSTOM1; break; + case 98: nAnimation = ANIMATION_LOOPING_CUSTOM2; break; + case 101: nAnimation = ANIMATION_LOOPING_CUSTOM3; break; + case 102: nAnimation = ANIMATION_LOOPING_CUSTOM4; break; + case 103: nAnimation = ANIMATION_LOOPING_CUSTOM5; break; + case 104: nAnimation = ANIMATION_LOOPING_CUSTOM6; break; + case 105: nAnimation = ANIMATION_LOOPING_CUSTOM7; break; + case 106: nAnimation = ANIMATION_LOOPING_CUSTOM8; break; + case 107: nAnimation = ANIMATION_LOOPING_CUSTOM9; break; + case 108: nAnimation = ANIMATION_LOOPING_CUSTOM10; break; + case 109: nAnimation = ANIMATION_LOOPING_CUSTOM11; break; + case 110: nAnimation = ANIMATION_LOOPING_CUSTOM12; break; + case 111: nAnimation = ANIMATION_LOOPING_CUSTOM13; break; + case 112: nAnimation = ANIMATION_LOOPING_CUSTOM14; break; + case 113: nAnimation = ANIMATION_LOOPING_CUSTOM15; break; + case 114: nAnimation = ANIMATION_LOOPING_CUSTOM16; break; + case 115: nAnimation = ANIMATION_LOOPING_CUSTOM17; break; + case 116: nAnimation = ANIMATION_LOOPING_CUSTOM18; break; + case 117: nAnimation = ANIMATION_LOOPING_CUSTOM19; break; + case 118: nAnimation = ANIMATION_LOOPING_CUSTOM20; break; + case 119: nAnimation = ANIMATION_MOUNT1; break; + case 120: nAnimation = ANIMATION_DISMOUNT1; break; + case 53: nAnimation = ANIMATION_FIREFORGET_HEAD_TURN_LEFT; break; + case 54: nAnimation = ANIMATION_FIREFORGET_HEAD_TURN_RIGHT; break; + case 55: nAnimation = ANIMATION_FIREFORGET_PAUSE_SCRATCH_HEAD; break; + case 56: nAnimation = ANIMATION_FIREFORGET_PAUSE_BORED; break; + case 34: nAnimation = ANIMATION_FIREFORGET_SALUTE; break; + case 35: nAnimation = ANIMATION_FIREFORGET_BOW; break; + case 37: nAnimation = ANIMATION_FIREFORGET_STEAL; break; + case 29: nAnimation = ANIMATION_FIREFORGET_GREETING; break; + case 28: nAnimation = ANIMATION_FIREFORGET_TAUNT; break; + case 44: nAnimation = ANIMATION_FIREFORGET_VICTORY1; break; + case 45: nAnimation = ANIMATION_FIREFORGET_VICTORY2; break; + case 46: nAnimation = ANIMATION_FIREFORGET_VICTORY3; break; + case 71: nAnimation = ANIMATION_FIREFORGET_READ; break; + case 70: nAnimation = ANIMATION_FIREFORGET_DRINK; break; + case 90: nAnimation = ANIMATION_FIREFORGET_DODGE_SIDE; break; + case 91: nAnimation = ANIMATION_FIREFORGET_DODGE_DUCK; break; + case 23: nAnimation = ANIMATION_FIREFORGET_SPASM; break; + default: nAnimation = -1; break; + } + + return nAnimation; +} + int NWNX_Consts_TranslateNWScriptObjectType(int nObjectType) { switch(nObjectType) diff --git a/_module/nss/nwnx_core.nss b/_module/nss/nwnx_core.nss new file mode 100644 index 0000000..74b0237 --- /dev/null +++ b/_module/nss/nwnx_core.nss @@ -0,0 +1,21 @@ +/// @addtogroup nwnx NWNX +/// @brief Core NWNX Functions. +/// @{ +/// @file nwnx_core.nss + +const string NWNX_Core = "NWNX_Core"; ///< @private + +/// @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 NWNXCall +/// @note Example usage: NWNX_PluginExists("NWNX_Creature"); +/// @return TRUE if the plugin exists and is enabled, otherwise FALSE. +int NWNX_Core_PluginExists(string sPlugin); + +/// @} + +int NWNX_Core_PluginExists(string sPlugin) +{ + NWNXPushString(sPlugin); + NWNXCall(NWNX_Core, "PluginExists"); + return NWNXPopInt(); +} diff --git a/_module/nss/nwnx_creature.nss b/_module/nss/nwnx_creature.nss index b688b9d..e921e19 100644 --- a/_module/nss/nwnx_creature.nss +++ b/_module/nss/nwnx_creature.nss @@ -2,7 +2,6 @@ /// @brief Functions exposing additional creature properties. /// @{ /// @file nwnx_creature.nss -#include "nwnx" const string NWNX_Creature = "NWNX_Creature"; ///< @private @@ -34,32 +33,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 /// @@ -73,6 +46,22 @@ const int NWNX_CREATURE_BONUS_TYPE_SKILL = 5; const int NWNX_CREATURE_BONUS_TYPE_TOUCH_ATTACK = 6; /// @} +/// @name Ranged Projectile VFX +/// @anchor ranged_projectile_vfx +/// +/// Used with NWNX_Creature_OverrideRangedProjectileVFX() these are the projectile vfx types. +/// @{ +const int NWNX_CREATURE_PROJECTILE_VFX_NONE = 0; ///< No VFX +const int NWNX_CREATURE_PROJECTILE_VFX_ACID = 1; +const int NWNX_CREATURE_PROJECTILE_VFX_COLD = 2; +const int NWNX_CREATURE_PROJECTILE_VFX_ELECTRICAL = 3; +const int NWNX_CREATURE_PROJECTILE_VFX_FIRE = 4; +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 @@ -82,16 +71,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. @@ -110,6 +89,14 @@ void NWNX_Creature_AddFeatByLevel(object creature, int feat, int level); /// @param feat The feat id. void NWNX_Creature_RemoveFeat(object creature, int feat); +/// @brief Removes the creature a feat assigned at a level +/// @param creature The creature object. +/// @param feat The feat id. +/// @param level The level they gained the feat. +/// @remark Removes the feat from the stat list at the provided level. Does not remove the feat from the creature, use +/// NWNX_Creature_RemoveFeat for this. +void NWNX_Creature_RemoveFeatByLevel(object creature, int feat, int level); + /// @brief Determines if the creature knows a feat. /// @note This differs from native @nwn{GetHasFeat} which returns FALSE if the feat has no more uses per day. /// @param creature The creature object. @@ -196,13 +183,6 @@ void NWNX_Creature_SetBaseAC(object creature, int ac); /// @return The base AC. int NWNX_Creature_GetBaseAC(object creature); -/// @brief Sets the ability score of the creature to the value. -/// @param creature The creature object. -/// @param ability The ability constant. -/// @param value The value to set. -/// @deprecated Use NWNX_Creature_SetRawAbilityScore(). This will be removed in future NWNX releases. -void NWNX_Creature_SetAbilityScore(object creature, int ability, int value); - /// @brief Sets the ability score of the creature to the provided value. /// @note Does not apply racial bonuses/penalties. /// @param creature The creature object. @@ -231,29 +211,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) @@ -275,21 +232,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) @@ -304,31 +246,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 whether or not creature has a specialist school of wizardry. -/// @param creature The creature object. -/// @return TRUE if the wizard specializes. -/// @deprecated Use GetSpecialization(). This will be removed in future NWNX releases. -int NWNX_Creature_GetWizardSpecialization(object creature); - -/// @brief Sets creature's wizard specialist school. -/// @param creature The creature object. -/// @param school The wizard school constant. -/// @deprecated Use NWNX_Creature_SetSpecialization(). This will be removed in future NWNX releases. -void NWNX_Creature_SetWizardSpecialization(object creature, int school); - /// @brief Gets the maximum hit points for creature for level. /// @param creature The creature object. /// @param level The level. @@ -358,6 +275,18 @@ 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. +/// @param cap The cap to set. +void NWNX_Creature_SetMovementRateFactorCap(object creature, float cap); + /// @brief Returns the creature's current movement type /// @param creature The creature object. /// @return An NWNX_CREATURE_MOVEMENT_TYPE_* constant. @@ -380,41 +309,35 @@ void NWNX_Creature_SetAlignmentGoodEvil(object creature, int value); /// @param value The value to set. void NWNX_Creature_SetAlignmentLawChaos(object creature, int value); -/// @brief Gets one of creature's cleric domains. -/// @param creature The creature object. -/// @param index The first or second domain. -/// @deprecated Use GetDomain(). This will be removed in future NWNX releases. -int NWNX_Creature_GetClericDomain(object creature, int index); - -/// @brief Sets one of creature's cleric domains. -/// @param creature The creature object. -/// @param index The first or second domain. -/// @param domain The domain constant to set. -/// @deprecated Use NWNX_Creature_SetDomain(). This will be removed in future NWNX releases. -void NWNX_Creature_SetClericDomain(object creature, int index, int domain); - -/// @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. /// @param rank The value to set as the skill rank. void NWNX_Creature_SetSkillRank(object creature, int skill, int rank); +/// @brief Get the ranks in a skill for creature assigned at a level. +/// @param creature The creature object. +/// @param skill The skill id. +/// @param level The level they gained skill ranks. +/// @return The rank in a skill assigned at a level (-1 on error). +int NWNX_Creature_GetSkillRankByLevel(object creature, int skill, int level); + +/// @brief Set the ranks in a skill for creature assigned at a level. +/// @note It only affect the leveling array, to know what to do on level-down. To effectivly change the skill rank on the current level, NWNX_Creature_SetSkillRank is also needed. +/// @param creature The creature object. +/// @param skill The skill id. +/// @param level The level they gained skill ranks. +/// @param rank The value to set as the skill rank. +void NWNX_Creature_SetSkillRankByLevel(object creature, int skill, int rank, int level); + /// @brief Set the class ID in a particular position for a creature. /// @param creature The creature object. /// @param position Should be 0, 1, or 2 depending on how many classes the creature /// has and which is to be modified. /// @param classID A valid ID number in classes.2da and between 0 and 255. -void NWNX_Creature_SetClassByPosition(object creature, int position, int classID); +/// @param bUpdateLevels determines whether the method will replace all occurrences +/// of the old class in CNWLevelStats with the new classID. +void NWNX_Creature_SetClassByPosition(object creature, int position, int classID, int bUpdateLevels = TRUE); /// @brief Set the level at the given position for a creature. /// @note A creature should already have a class in that position. @@ -442,11 +365,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); @@ -455,11 +373,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); @@ -479,6 +392,18 @@ int NWNX_Creature_GetSkillPointsRemaining(object creature); /// @param skillpoints The value to set. void NWNX_Creature_SetSkillPointsRemaining(object creature, int skillpoints); +/// @brief Gets the creature's remaining unspent skill points for level. +/// @param creature The creature object. +/// @param level The level. +/// @return The remaining unspent skill points for level. +int NWNX_Creature_GetSkillPointsRemainingByLevel(object creature, int level); + +/// @brief Sets the creature's remaining unspent skill points for level. +/// @param creature The creature object. +/// @param level The level. +/// @param value The value to set for level. +void NWNX_Creature_SetSkillPointsRemainingByLevel(object creature, int level, int value); + /// @brief Sets the creature's racial type /// @param creature The creature object. /// @param racialtype The racial type to set. @@ -511,8 +436,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. @@ -629,13 +555,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) @@ -643,12 +562,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) @@ -666,7 +579,7 @@ void NWNX_Creature_SetFaction(object oCreature, int nFactionId); int NWNX_Creature_GetFaction(object oCreature); /// @brief Get whether a creature is flat-footed. -/// @param The creature object. +/// @param oCreature The creature object. /// @return TRUE if the creature is flat-footed. int NWNX_Creature_GetFlatFooted(object oCreature); @@ -685,10 +598,10 @@ int NWNX_Creature_DeserializeQuickbar(object oCreature, string sSerializedQuickb /// @param oCreature the target creature /// @param nClass the class that this modifier will apply to /// @param nModifier the modifier to apply -/// @param bModifier whether the modifier should be persisted to the .bic file if applicable +/// @param bPersist whether the modifier should be persisted to the .bic file if applicable void NWNX_Creature_SetCasterLevelModifier(object oCreature, int nClass, int nModifier, int bPersist = FALSE); -/// @brief Sets the current caster level modifier for oCreature +/// @brief Gets the current caster level modifier for oCreature /// @param oCreature the target creature /// @param nClass the creature caster class /// @return the current caster level modifier for the creature @@ -698,7 +611,7 @@ int NWNX_Creature_GetCasterLevelModifier(object oCreature, int nClass); /// @param oCreature the target creature /// @param nClass the class that this modifier will apply to /// @param nCasterLevel the caster level override to apply -/// @param bModifier whether the override should be persisted to the .bic file if applicable +/// @param bPersist whether the override should be persisted to the .bic file if applicable void NWNX_Creature_SetCasterLevelOverride(object oCreature, int nClass, int nCasterLevel, int bPersist = FALSE); /// @brief Gets the current caster level override for oCreature @@ -708,748 +621,896 @@ void NWNX_Creature_SetCasterLevelOverride(object oCreature, int nClass, int nCas int NWNX_Creature_GetCasterLevelOverride(object oCreature, int nClass); /// @brief Move a creature to limbo. -/// @param The creature object. +/// @param oCreature The creature object. void NWNX_Creature_JumpToLimbo(object oCreature); +/// @brief Sets the critical hit multiplier modifier for the Creature +/// @param oCreature The target creature +/// @param nModifier The modifier to apply +/// @param nHand 0 for all attacks, 1 for Mainhand, 2 for Offhand +/// @param bPersist Whether the modifier should persist to .bic file if applicable +/// @param nBaseItem Applies the.modifier only when the attack used this baseitem. BASE_ITEM_GLOVES for Unarmed, '-1' for all +/// @note Persistence is activated each server reset by the first use of either 'SetCriticalMultiplier*' functions. Recommended to trigger on a dummy target OnModuleLoad to enable persistence. +void NWNX_Creature_SetCriticalMultiplierModifier(object oCreature, int nModifier, int nHand = 0, int bPersist = FALSE, int nBaseItem = -1); + +/// @brief Gets the critical hit multiplier modifier for the Creature +/// @param oCreature The target creature +/// @param nHand 0 for all attacks, 1 for Mainhand, 2 for Offhand +/// @param nBaseItem The baseitem modifer to retrieve. BASE_ITEM_GLOVES for Unarmed, '-1' for all +/// @return the current critical hit multiplier modifier for the creature +int NWNX_Creature_GetCriticalMultiplierModifier(object oCreature, int nHand = 0, int nBaseItem = -1); + +/// @brief Sets the critical hit multiplier override for the Creature. +/// @param oCreature The target creature +/// @param nOverride The override value to apply. -1 to clear override. +/// @param nHand 0 for all attacks, 1 for Mainhand, 2 for Offhand +/// @param bPersist Whether the modifier should persist to .bic file if applicable +/// @param nBaseItem Applies the.Override only when the attack used this baseitem. BASE_ITEM_GLOVES for Unarmed, '-1' for all +/// @note Persistence is activated each server reset by the first use of either 'SetCriticalMultiplier*' functions. Recommended to trigger on a dummy target OnModuleLoad to enable persistence. +void NWNX_Creature_SetCriticalMultiplierOverride(object oCreature, int nOverride, int nHand = 0, int bPersist = FALSE, int nBaseItem = -1); + +/// @brief Gets the critical hit multiplier override for the Creature +/// @param oCreature The target creature +/// @param nHand 0 for all attacks, 1 for Mainhand, 2 for Offhand +/// @param nBaseItem The baseitem Override to retrieve. BASE_ITEM_GLOVES for Unarmed, '-1' for all +/// @return the current critical hit multiplier override for the creature. No override == -1 +int NWNX_Creature_GetCriticalMultiplierOverride(object oCreature, int nHand = 0, int nBaseItem = -1); + +/// @brief Sets the critical hit range modifier for the creature. +/// @param oCreature The target creature +/// @param nModifier The modifier to apply. Positive modifiers reduce critical chance. (I.e. From 18-20, a +1 results in crit range of 19-20) +/// @param nHand 0 for all attacks, 1 for Mainhand, 2 for Offhand +/// @param bPersist Whether the modifier should persist to .bic file if applicable +/// @param nBaseItem Applies the.modifier only when the attack used this baseitem. BASE_ITEM_GLOVES for Unarmed, '-1' for all +/// @note Persistence is activated each server reset by the first use of either 'SetCriticalRange*' functions. Recommended to trigger on a dummy target OnModuleLoad to enable persistence. +void NWNX_Creature_SetCriticalRangeModifier(object oCreature, int nModifier, int nHand = 0, int bPersist = FALSE, int nBaseItem = -1); + +/// @brief Gets the critical hit range modifier for the creature. +/// @param oCreature The target creature +/// @param nHand 0 for all attacks, 1 for Mainhand, 2 for Offhand +/// @param nBaseItem The baseitem modifer to retrieve. BASE_ITEM_GLOVES for Unarmed, '-1' for all +/// @return the current critical hit range modifier for the creature +int NWNX_Creature_GetCriticalRangeModifier(object oCreature, int nHand = 0, int nBaseItem = -1); + +/// @brief Sets the critical hit range Override for the creature. +/// @param oCreature The target creature +/// @param nOverride The new minimum roll to crit. i.e nOverride of 15 results in crit range of 15-20. -1 to clear override. +/// @param nHand 0 for all attacks, 1 for Mainhand, 2 for Offhand +/// @param bPersist Whether the modifier should persist to .bic file if applicable +/// @param nBaseItem Applies the.Override only when the attack used this baseitem. BASE_ITEM_GLOVES for Unarmed, '-1' for all +/// @note Persistence is activated each server reset by the first use of either 'SetCriticalRange*' functions. Recommended to trigger on a dummy target OnModuleLoad to enable persistence. +void NWNX_Creature_SetCriticalRangeOverride(object oCreature, int nOverride, int nHand = 0, int bPersist = FALSE, int nBaseItem = -1); + +/// @brief Sets the critical hit range Override for the creature. +/// @param oCreature The target creature +/// @param nHand 0 for all attacks, 1 for Mainhand, 2 for Offhand +/// @param nBaseItem The baseitem Override to retrieve. BASE_ITEM_GLOVES for Unarmed, '-1' for all +/// @return the current critical hit range override for the creature. No override == -1 +int NWNX_Creature_GetCriticalRangeOverride(object oCreature, int nHand = 0, int nBaseItem = -1); + +/// @brief Add oAssociate as nAssociateType to oCreature +/// @warning Only basic checks are done so care must be taken when using this function +/// @param oCreature The creature to add oAssociate to +/// @param oAssociate The associate, must be a NPC +/// @param nAssociateType The associate type, one of ASSOCIATE_TYPE_*, except _NONE +void NWNX_Creature_AddAssociate(object oCreature, object oAssociate, int nAssociateType); + +/// @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. +/// @param nDamageLevel A damage level, see damagelevels.2da. Allowed values: 0-255 or -1 to remove the override. +void NWNX_Creature_OverrideDamageLevel(object oCreature, int nDamageLevel); + +/// @brief Set the encounter source of oCreature. +/// @param oCreature The target creature. +/// @param oEncounter The source encounter +void NWNX_Creature_SetEncounter(object oCreature, object oEncounter); + +/// @brief Get the encounter source of oCreature. +/// @param oCreature The target creature. +/// @return The encounter, OBJECT_INVALID if not part of an encounter or on error +object NWNX_Creature_GetEncounter(object oCreature); + +/// @brief Get if oCreature is currently bartering. +/// @param oCreature The target creature. +/// @return TRUE if oCreature is bartering, FALSE if not or on error. +int NWNX_Creature_GetIsBartering(object oCreature); + +/// @brief Sets caster level for the last item used. Use in a spellhook or spell event before to set caster level for any spells cast from the item. +/// @param oCreature the creature who used the item. +/// @param nCasterLvl the desired caster level. +void NWNX_Creature_SetLastItemCasterLevel(object oCreature, int nCasterLvl); + +/// @brief Gets the caster level of the last item used. +/// @param oCreature the creature who used the item. +/// @return returns the creatures last used item's level. +int NWNX_Creature_GetLastItemCasterLevel(object oCreature); + +/// @brief Gets the Armor classed of attacked against versus +/// @param oAttacked The one being attacked +/// @param oVersus The one doing the attacking +/// @param nTouch TRUE for touch attacks +/// @return -255 on Error, Flat footed AC if oVersus is invalid or the Attacked AC versus oVersus. +int NWNX_Creature_GetArmorClassVersus(object oAttacked, object oVersus, int nTouch=FALSE); + +/// @brief Gets the current walk animation of oCreature. +/// @param oCreature The target creature. +/// @return -1 on Error, otherwise the walk animation number +int NWNX_Creature_GetWalkAnimation(object oCreature); + +/// @brief Sets the current walk animation of oCreature. +/// @param oCreature The target creature. +/// @param nAnimation The walk animation number. +void NWNX_Creature_SetWalkAnimation(object oCreature, int nAnimation); + +/// @brief Changes the attack modifier depending on the dice roll. Used to skip autofail on 1 and autosucceed on 20 as well. +/// @param oCreature The attacking creature, use OBJECT_INVALID for all. +/// @param nRoll The dice roll to modify. +/// @param nModifier The modifier to the attack, use 0 to turn off autofail for 1/autosucceed for 20 with no attack modifier value. +void NWNX_Creature_SetAttackRollOverride(object oCreature, int nRoll, int nModifier); + +/// @brief Works like the tweak but can be turned on and off for all creatures or single ones. +/// @param oCreature The parrying creature, use OBJECT_INVALID for all. +/// @param bParry TRUE to parry all attacks. +/// @note Use this command on_module_load instead of the NWNX_TWEAKS_PARRY_ALL_ATTACKS tweak if using NWNX_Creature_SetAttackRollOverride() +void NWNX_Creature_SetParryAllAttacks(object oCreature, int bParry); + +/// @brief Gets the NoPermanentDeath flag of oCreature. +/// @param oCreature The target creature. +/// @return TRUE/FALSE or -1 on error. +int NWNX_Creature_GetNoPermanentDeath(object oCreature); + +/// @brief Sets the NoPermanentDeath flag of oCreature. +/// @param oCreature The target creature. +/// @param bNoPermanentDeath TRUE/FALSE. +void NWNX_Creature_SetNoPermanentDeath(object oCreature, int bNoPermanentDeath); + +/// @brief Compute a safe location for oCreature. +/// @param oCreature The target creature. +/// @param vPosition The starting position. +/// @param fRadius The search radius around vPosition. +/// @param bWalkStraightLineRequired Whether the creature must be able to walk in a straight line to the position. +/// @return A safe location as vector, will return vPosition if one wasn't found. Returns {0.0, 0.0, 0.0} on error. +vector NWNX_Creature_ComputeSafeLocation(object oCreature, vector vPosition, float fRadius = 20.0f, int bWalkStraightLineRequired = TRUE); + +/// @brief Update oCreature's perception of oTargetCreature. +/// @param oCreature The creature. +/// @param oTargetCreature The target creature. +void NWNX_Creature_DoPerceptionUpdateOnCreature(object oCreature, object oTargetCreature); + +/// @brief Get a creatures personal space (meters from center to non-creature objects). +/// @param oCreature The creature. +/// @return The creatures personal space. +float NWNX_Creature_GetPersonalSpace(object oCreature); + +/// @brief Set a creatures personal space (meters from center to non-creature objects). +/// @param oCreature The creature. +/// @param fPerspace The creatures personal space. +void NWNX_Creature_SetPersonalSpace(object oCreature, float fPerspace); + +/// @brief Get a creatures creature personal space (meters from center to other creatures). +/// @param oCreature The creature. +/// @return The creatures creature personal space. +float NWNX_Creature_GetCreaturePersonalSpace(object oCreature); + +/// @brief Set a creatures creature personal space (meters from center to other creatures). +/// @param oCreature The creature. +/// @param fCrePerspace The creatures creature personal space. +void NWNX_Creature_SetCreaturePersonalSpace(object oCreature, float fCrePerspace); + +/// @brief Get a creatures height. +/// @param oCreature The creature. +/// @return The creatures height. +float NWNX_Creature_GetHeight(object oCreature); + +/// @brief Set a creatures height. +/// @param oCreature The creature. +/// @param fHeight The creatures height. +void NWNX_Creature_SetHeight(object oCreature, float fHeight); + +/// @brief Get a creatures hit distance. +/// @param oCreature The creature. +/// @return The creatures hit distance. +float NWNX_Creature_GetHitDistance(object oCreature); + +/// @brief Set a creatures hit distance. +/// @param oCreature The creature. +/// @param fHitDist The creatures hit distance. +void NWNX_Creature_SetHitDistance(object oCreature, float fHitDist); + +/// @brief Get a creatures preferred attack distance. +/// @param oCreature The creature. +/// @return The creatures preferred attack distance. +float NWNX_Creature_GetPreferredAttackDistance(object oCreature); + +/// @brief Set a creatures preferred attack distance. +/// @param oCreature The creature. +/// @param fPrefAtckDist The creatures preferred attack distance. +void NWNX_Creature_SetPreferredAttackDistance(object oCreature, float fPrefAtckDist); + +/// @brief Get the skill penalty from wearing armor. +/// @param oCreature The creature. +int NWNX_Creature_GetArmorCheckPenalty(object oCreature); + +/// @brief Get the skill penalty from wearing a shield. +/// @param oCreature The creature. +int NWNX_Creature_GetShieldCheckPenalty(object oCreature); + +/// @brief Sets a chance for normal Effect Immunities to be bypassed +/// @param oCreature The affected creature +/// @param nImmunityType 'IMMUNITY_TYPE_*' to bypass. By default affects outgoing effects (oCreature -> another creature). Use a negative (-IMMUNITY_TYPE_*) to affect incoming effects instead (another creature -> oCreature) use 255/-255 to bypass ALL Immunities. +/// @param nChance The chance (of 100%) to bypass the immunity check. A Positive chance results in NOT IMMUNE. A Negative chance results in IMMUNE. +/// @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. +/// @note Where an Outgoing and Incoming bypass both attempt opposing outcomes, both are ignored and the immunity status without bypass will apply. +void NWNX_Creature_SetBypassEffectImmunity(object oCreature, int nImmunityType, int nChance = 100, int bPersist = FALSE); + +/// @brief Gets a chance for normal Effect Immunities to be bypassed +/// @param oCreature The target creature +/// @param nImmunityType 'IMMUNITY_TYPE_*' to retrieve the current chance for bypass: Positive gets outgoing effects (oCreature -> another creature). Negative (-IMMUNITY_TYPE_*) gets incoming effects (another creature -> oCreature). +/// @return the current critical hit multiplier modifier for the creature +int NWNX_Creature_GetBypassEffectImmunity(object oCreature, int nImmunityType); + +/// @brief Sets the killer of oCreature to oKiller. +/// @param oCreature The target creature. +/// @param oKiller The killer. +void NWNX_Creature_SetLastKiller(object oCreature, object oKiller); + +/// @brief Instantly cast a spell at a target or location. +/// @note oCreature must be in the same area as oTarget or locTarget. +/// @note Does not care if oCreature can't cast spells or doesn't know the spell. Does not consume spell slots. +/// @param oCreature The caster. +/// @param oTarget The target, use OBJECT_INVALID to cast at a location. +/// @param locTarget The location, only used when oTarget is OBJECT_INVALID. +/// @param nSpellID The spell ID. +/// @param nCasterLevel The caster level of the spell. +/// @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. +/// @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. +/// @param oItem The item, must be possessed by oCreature. +/// @param nInventorySlot An INVENTORY_SLOT_* constant. +/// @return TRUE on success, FALSE on failure. +int NWNX_Creature_RunEquip(object oCreature, object oItem, int nInventorySlot); + +/// @brief Have oCreature instantly unequip oItem. +/// @param oCreature The creature. +/// @param oItem The item, must be possessed by oCreature. +/// @return TRUE on success, FALSE on failure. +int NWNX_Creature_RunUnequip(object oCreature, object oItem); + +/// @brief Override the elemental projectile visual effect of ranged/throwing weapons. +/// @param oCreature The creature. +/// @param nProjectileVFX A @ref ranged_projectile_vfx "NWNX_CREATURE_PROJECTILE_VFX_*" constant or -1 to remove the override. +/// @param bPersist Whether the vfx 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. +void NWNX_Creature_OverrideRangedProjectileVFX(object oCreature, int nProjectileVFX, int bPersist = FALSE); + +/// @brief Sets a custom Initiative modifier +/// @param oCreature The affected creature +/// @param nMod The amount to adjust their initiative (+/-). +/// @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_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_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); + +/// @brief Returns the creature's multiclass limit. +/// @note Only works on player characters. +/// @param oCreature The creature object. Has to be a player character. +/// @return The PCs multiclass limit. Returns 0 if no limit is set. +int NWNX_Creature_GetMulticlassLimit(object oCreature); + +/// @brief Sets the creature's multiclass limit. +/// @note Only works on player characters and only for future level ups. +/// Classes already taken will continue to be available on level up. +/// The limit must be lower than the server limit set in ruleset.2da MULTICLASS_LIMIT. +/// Setting a value of 0 will remove the limit. +/// @param oCreature The creature object. Has to be a player character. +/// @param nLimit The multiclass limit. +/// @param bPersist Whether the limit should persist to the .bic file. +/// @note Persistence is enabled after a server reset by the first use of this function. +void NWNX_Creature_SetMulticlassLimit(object oCreature, int nLimit, int bPersist = FALSE); + /// @} void NWNX_Creature_AddFeat(object creature, int feat) { - string sFunc = "AddFeat"; - NWNX_PushArgumentInt(NWNX_Creature, sFunc, feat); - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); + NWNXPushInt(feat); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "AddFeat"); } void NWNX_Creature_AddFeatByLevel(object creature, int feat, int level) { - string sFunc = "AddFeatByLevel"; - - NWNX_PushArgumentInt(NWNX_Creature, sFunc, level); - NWNX_PushArgumentInt(NWNX_Creature, sFunc, feat); - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); + NWNXPushInt(level); + NWNXPushInt(feat); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "AddFeatByLevel"); } void NWNX_Creature_RemoveFeat(object creature, int feat) { - string sFunc = "RemoveFeat"; - NWNX_PushArgumentInt(NWNX_Creature, sFunc, feat); - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); + NWNXPushInt(feat); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "RemoveFeat"); +} - NWNX_CallFunction(NWNX_Creature, sFunc); +void NWNX_Creature_RemoveFeatByLevel(object creature, int feat, int level) +{ + NWNXPushInt(level); + NWNXPushInt(feat); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "RemoveFeatByLevel"); } int NWNX_Creature_GetKnowsFeat(object creature, int feat) { - string sFunc = "GetKnowsFeat"; - - NWNX_PushArgumentInt(NWNX_Creature, sFunc, feat); - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); - return NWNX_GetReturnValueInt(NWNX_Creature, sFunc); + NWNXPushInt(feat); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "GetKnowsFeat"); + return NWNXPopInt(); } int NWNX_Creature_GetFeatCountByLevel(object creature, int level) { - string sFunc = "GetFeatCountByLevel"; - - NWNX_PushArgumentInt(NWNX_Creature, sFunc, level); - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); - return NWNX_GetReturnValueInt(NWNX_Creature, sFunc); + NWNXPushInt(level); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "GetFeatCountByLevel"); + return NWNXPopInt(); } int NWNX_Creature_GetFeatByLevel(object creature, int level, int index) { - string sFunc = "GetFeatByLevel"; - - NWNX_PushArgumentInt(NWNX_Creature, sFunc, index); - NWNX_PushArgumentInt(NWNX_Creature, sFunc, level); - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); - return NWNX_GetReturnValueInt(NWNX_Creature, sFunc); + NWNXPushInt(index); + NWNXPushInt(level); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "GetFeatByLevel"); + return NWNXPopInt(); } int NWNX_Creature_GetFeatCount(object creature) { - string sFunc = "GetFeatCount"; - - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); - return NWNX_GetReturnValueInt(NWNX_Creature, sFunc); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "GetFeatCount"); + return NWNXPopInt(); } int NWNX_Creature_GetFeatGrantLevel(object creature, int feat) { - string sFunc = "GetFeatGrantLevel"; - - NWNX_PushArgumentInt(NWNX_Creature, sFunc, feat); - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); - return NWNX_GetReturnValueInt(NWNX_Creature, sFunc); + NWNXPushInt(feat); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "GetFeatGrantLevel"); + return NWNXPopInt(); } int NWNX_Creature_GetFeatByIndex(object creature, int index) { - string sFunc = "GetFeatByIndex"; - - NWNX_PushArgumentInt(NWNX_Creature, sFunc, index); - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); - return NWNX_GetReturnValueInt(NWNX_Creature, sFunc); + NWNXPushInt(index); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "GetFeatByIndex"); + return NWNXPopInt(); } int NWNX_Creature_GetMeetsFeatRequirements(object creature, int feat) { - string sFunc = "GetMeetsFeatRequirements"; - - NWNX_PushArgumentInt(NWNX_Creature, sFunc, feat); - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); - return NWNX_GetReturnValueInt(NWNX_Creature, sFunc); + NWNXPushInt(feat); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "GetMeetsFeatRequirements"); + return NWNXPopInt(); } struct NWNX_Creature_SpecialAbility NWNX_Creature_GetSpecialAbility(object creature, int index) { - string sFunc = "GetSpecialAbility"; - struct NWNX_Creature_SpecialAbility ability; - - NWNX_PushArgumentInt(NWNX_Creature, sFunc, index); - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); - - ability.level = NWNX_GetReturnValueInt(NWNX_Creature, sFunc); - ability.ready = NWNX_GetReturnValueInt(NWNX_Creature, sFunc); - ability.id = NWNX_GetReturnValueInt(NWNX_Creature, sFunc); - + NWNXPushInt(index); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "GetSpecialAbility"); + ability.level = NWNXPopInt(); + ability.ready = NWNXPopInt(); + ability.id = NWNXPopInt(); return ability; } int NWNX_Creature_GetSpecialAbilityCount(object creature) { - string sFunc = "GetSpecialAbilityCount"; - - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); - NWNX_CallFunction(NWNX_Creature, sFunc); - - return NWNX_GetReturnValueInt(NWNX_Creature, sFunc); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "GetSpecialAbilityCount"); + return NWNXPopInt(); } void NWNX_Creature_AddSpecialAbility(object creature, struct NWNX_Creature_SpecialAbility ability) { - string sFunc = "AddSpecialAbility"; - - NWNX_PushArgumentInt(NWNX_Creature, sFunc, ability.id); - NWNX_PushArgumentInt(NWNX_Creature, sFunc, ability.ready); - NWNX_PushArgumentInt(NWNX_Creature, sFunc, ability.level); - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); + NWNXPushInt(ability.id); + NWNXPushInt(ability.ready); + NWNXPushInt(ability.level); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "AddSpecialAbility"); } void NWNX_Creature_RemoveSpecialAbility(object creature, int index) { - string sFunc = "RemoveSpecialAbility"; - - NWNX_PushArgumentInt(NWNX_Creature, sFunc, index); - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); + NWNXPushInt(index); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "RemoveSpecialAbility"); } void NWNX_Creature_SetSpecialAbility(object creature, int index, struct NWNX_Creature_SpecialAbility ability) { - string sFunc = "SetSpecialAbility"; - - NWNX_PushArgumentInt(NWNX_Creature, sFunc, ability.id); - NWNX_PushArgumentInt(NWNX_Creature, sFunc, ability.ready); - NWNX_PushArgumentInt(NWNX_Creature, sFunc, ability.level); - NWNX_PushArgumentInt(NWNX_Creature, sFunc, index); - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); + NWNXPushInt(ability.id); + NWNXPushInt(ability.ready); + NWNXPushInt(ability.level); + NWNXPushInt(index); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "SetSpecialAbility"); } int NWNX_Creature_GetClassByLevel(object creature, int level) { - string sFunc = "GetClassByLevel"; - - NWNX_PushArgumentInt(NWNX_Creature, sFunc, level); - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); - return NWNX_GetReturnValueInt(NWNX_Creature, sFunc); + NWNXPushInt(level); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "GetClassByLevel"); + return NWNXPopInt(); } void NWNX_Creature_SetBaseAC(object creature, int ac) { - string sFunc = "SetBaseAC"; - - NWNX_PushArgumentInt(NWNX_Creature, sFunc, ac); - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); + NWNXPushInt(ac); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "SetBaseAC"); } int NWNX_Creature_GetBaseAC(object creature) { - string sFunc = "GetBaseAC"; - - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); - return NWNX_GetReturnValueInt(NWNX_Creature, sFunc); -} - -void NWNX_Creature_SetAbilityScore(object creature, int ability, int value) -{ - WriteTimestampedLogEntry("NWNX_Creature: SetAbilityScore() is deprecated. Use native NWNX_Creature_SetRawAbilityScore() instead"); - NWNX_Creature_SetRawAbilityScore(creature, ability, value); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "GetBaseAC"); + return NWNXPopInt(); } void NWNX_Creature_SetRawAbilityScore(object creature, int ability, int value) { - string sFunc = "SetRawAbilityScore"; - - NWNX_PushArgumentInt(NWNX_Creature, sFunc, value); - NWNX_PushArgumentInt(NWNX_Creature, sFunc, ability); - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); + NWNXPushInt(value); + NWNXPushInt(ability); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "SetRawAbilityScore"); } int NWNX_Creature_GetRawAbilityScore(object creature, int ability) { - string sFunc = "GetRawAbilityScore"; - - NWNX_PushArgumentInt(NWNX_Creature, sFunc, ability); - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); - return NWNX_GetReturnValueInt(NWNX_Creature, sFunc); + NWNXPushInt(ability); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "GetRawAbilityScore"); + return NWNXPopInt(); } void NWNX_Creature_ModifyRawAbilityScore(object creature, int ability, int modifier) { - string sFunc = "ModifyRawAbilityScore"; - - NWNX_PushArgumentInt(NWNX_Creature, sFunc, modifier); - NWNX_PushArgumentInt(NWNX_Creature, sFunc, ability); - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); + NWNXPushInt(modifier); + NWNXPushInt(ability); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "ModifyRawAbilityScore"); } int NWNX_Creature_GetPrePolymorphAbilityScore(object creature, int ability) { - string sFunc = "GetPrePolymorphAbilityScore"; - - NWNX_PushArgumentInt(NWNX_Creature, sFunc, ability); - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); - return NWNX_GetReturnValueInt(NWNX_Creature, sFunc); -} - -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(NWNX_Creature, sFunc, index); - NWNX_PushArgumentInt(NWNX_Creature, sFunc, level); - NWNX_PushArgumentInt(NWNX_Creature, sFunc, class); - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); - - spell.domain = NWNX_GetReturnValueInt(NWNX_Creature, sFunc); - spell.meta = NWNX_GetReturnValueInt(NWNX_Creature, sFunc); - spell.ready = NWNX_GetReturnValueInt(NWNX_Creature, sFunc); - spell.id = NWNX_GetReturnValueInt(NWNX_Creature, sFunc); - return spell; -} - -int NWNX_Creature_GetMemorisedSpellCountByLevel(object creature, int class, int level) -{ - string sFunc = "GetMemorisedSpellCountByLevel"; - - NWNX_PushArgumentInt(NWNX_Creature, sFunc, level); - NWNX_PushArgumentInt(NWNX_Creature, sFunc, class); - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); - return NWNX_GetReturnValueInt(NWNX_Creature, sFunc); -} - -void NWNX_Creature_SetMemorisedSpell(object creature, int class, int level, int index, struct NWNX_Creature_MemorisedSpell spell) -{ - string sFunc = "SetMemorisedSpell"; - - NWNX_PushArgumentInt(NWNX_Creature, sFunc, spell.id); - NWNX_PushArgumentInt(NWNX_Creature, sFunc, spell.ready); - NWNX_PushArgumentInt(NWNX_Creature, sFunc, spell.meta); - NWNX_PushArgumentInt(NWNX_Creature, sFunc, spell.domain); - - NWNX_PushArgumentInt(NWNX_Creature, sFunc, index); - NWNX_PushArgumentInt(NWNX_Creature, sFunc, level); - NWNX_PushArgumentInt(NWNX_Creature, sFunc, class); - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); + NWNXPushInt(ability); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "GetPrePolymorphAbilityScore"); + return NWNXPopInt(); } int NWNX_Creature_GetRemainingSpellSlots(object creature, int class, int level) { - string sFunc = "GetRemainingSpellSlots"; - - NWNX_PushArgumentInt(NWNX_Creature, sFunc, level); - NWNX_PushArgumentInt(NWNX_Creature, sFunc, class); - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); - return NWNX_GetReturnValueInt(NWNX_Creature, sFunc); + NWNXPushInt(level); + NWNXPushInt(class); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "GetRemainingSpellSlots"); + return NWNXPopInt(); } void NWNX_Creature_SetRemainingSpellSlots(object creature, int class, int level, int slots) { - string sFunc = "SetRemainingSpellSlots"; - - NWNX_PushArgumentInt(NWNX_Creature, sFunc, slots); - NWNX_PushArgumentInt(NWNX_Creature, sFunc, level); - NWNX_PushArgumentInt(NWNX_Creature, sFunc, class); - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); -} - -int NWNX_Creature_GetKnownSpell(object creature, int class, int level, int index) -{ - string sFunc = "GetKnownSpell"; - - NWNX_PushArgumentInt(NWNX_Creature, sFunc, index); - NWNX_PushArgumentInt(NWNX_Creature, sFunc, level); - NWNX_PushArgumentInt(NWNX_Creature, sFunc, class); - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); - return NWNX_GetReturnValueInt(NWNX_Creature, sFunc); -} - -int NWNX_Creature_GetKnownSpellCount(object creature, int class, int level) -{ - string sFunc = "GetKnownSpellCount"; - - NWNX_PushArgumentInt(NWNX_Creature, sFunc, level); - NWNX_PushArgumentInt(NWNX_Creature, sFunc, class); - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); - return NWNX_GetReturnValueInt(NWNX_Creature, sFunc); + NWNXPushInt(slots); + NWNXPushInt(level); + NWNXPushInt(class); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "SetRemainingSpellSlots"); } void NWNX_Creature_RemoveKnownSpell(object creature, int class, int level, int spellId) { - string sFunc = "RemoveKnownSpell"; + NWNXPushInt(spellId); + NWNXPushInt(level); + NWNXPushInt(class); + NWNXPushObject(creature); - NWNX_PushArgumentInt(NWNX_Creature, sFunc, spellId); - NWNX_PushArgumentInt(NWNX_Creature, sFunc, level); - NWNX_PushArgumentInt(NWNX_Creature, sFunc, class); - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); + NWNXCall(NWNX_Creature, "RemoveKnownSpell"); } void NWNX_Creature_AddKnownSpell(object creature, int class, int level, int spellId) { - string sFunc = "AddKnownSpell"; - - NWNX_PushArgumentInt(NWNX_Creature, sFunc, spellId); - NWNX_PushArgumentInt(NWNX_Creature, sFunc, level); - NWNX_PushArgumentInt(NWNX_Creature, sFunc, class); - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); -} - -void NWNX_Creature_ClearMemorisedKnownSpells(object creature, int class, int spellId) -{ - string sFunc = "ClearMemorisedKnownSpells"; - - NWNX_PushArgumentInt(NWNX_Creature, sFunc, spellId); - NWNX_PushArgumentInt(NWNX_Creature, sFunc, class); - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); -} - -void NWNX_Creature_ClearMemorisedSpell(object creature, int class, int level, int index) -{ - string sFunc = "ClearMemorisedSpell"; - - NWNX_PushArgumentInt(NWNX_Creature, sFunc, index); - NWNX_PushArgumentInt(NWNX_Creature, sFunc, level); - NWNX_PushArgumentInt(NWNX_Creature, sFunc, class); - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); + NWNXPushInt(spellId); + NWNXPushInt(level); + NWNXPushInt(class); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "AddKnownSpell"); } int NWNX_Creature_GetMaxSpellSlots(object creature, int class, int level) { - string sFunc = "GetMaxSpellSlots"; - - NWNX_PushArgumentInt(NWNX_Creature, sFunc, level); - NWNX_PushArgumentInt(NWNX_Creature, sFunc, class); - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); - return NWNX_GetReturnValueInt(NWNX_Creature, sFunc); + NWNXPushInt(level); + NWNXPushInt(class); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "GetMaxSpellSlots"); + return NWNXPopInt(); } int NWNX_Creature_GetMaxHitPointsByLevel(object creature, int level) { - string sFunc = "GetMaxHitPointsByLevel"; - - NWNX_PushArgumentInt(NWNX_Creature, sFunc, level); - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); - return NWNX_GetReturnValueInt(NWNX_Creature, sFunc); + NWNXPushInt(level); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "GetMaxHitPointsByLevel"); + return NWNXPopInt(); } void NWNX_Creature_SetMaxHitPointsByLevel(object creature, int level, int value) { - string sFunc = "SetMaxHitPointsByLevel"; - - NWNX_PushArgumentInt(NWNX_Creature, sFunc, value); - NWNX_PushArgumentInt(NWNX_Creature, sFunc, level); - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); + NWNXPushInt(value); + NWNXPushInt(level); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "SetMaxHitPointsByLevel"); } void NWNX_Creature_SetMovementRate(object creature, int rate) { - string sFunc = "SetMovementRate"; - - NWNX_PushArgumentInt(NWNX_Creature, sFunc, rate); - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); + NWNXPushInt(rate); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "SetMovementRate"); } float NWNX_Creature_GetMovementRateFactor(object creature) { - string sFunc = "GetMovementRateFactor"; - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); - return NWNX_GetReturnValueFloat(NWNX_Creature, sFunc); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "GetMovementRateFactor"); + return NWNXPopFloat(); } void NWNX_Creature_SetMovementRateFactor(object creature, float factor) { - string sFunc = "SetMovementRateFactor"; + NWNXPushFloat(factor); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "SetMovementRateFactor"); +} - NWNX_PushArgumentFloat(NWNX_Creature, sFunc, factor); - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); +float NWNX_Creature_GetMovementRateFactorCap(object creature) +{ + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "GetMovementRateFactorCap"); + return NWNXPopFloat(); +} - NWNX_CallFunction(NWNX_Creature, sFunc); +void NWNX_Creature_SetMovementRateFactorCap(object creature, float cap) +{ + NWNXPushFloat(cap); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "SetMovementRateFactorCap"); } void NWNX_Creature_SetAlignmentGoodEvil(object creature, int value) { - string sFunc = "SetAlignmentGoodEvil"; - - NWNX_PushArgumentInt(NWNX_Creature, sFunc, value); - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); + NWNXPushInt(value); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "SetAlignmentGoodEvil"); } void NWNX_Creature_SetAlignmentLawChaos(object creature, int value) { - string sFunc = "SetAlignmentLawChaos"; - - NWNX_PushArgumentInt(NWNX_Creature, sFunc, value); - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); -} - -int NWNX_Creature_GetClericDomain(object creature, int index) -{ - WriteTimestampedLogEntry("NWNX_Creature: GetClericDomain() is deprecated. Please use the basegame's GetDomain() instead"); - return GetDomain(creature, index, CLASS_TYPE_CLERIC); -} - -void NWNX_Creature_SetClericDomain(object creature, int index, int domain) -{ - WriteTimestampedLogEntry("NWNX_Creature: SetClericDomain() is deprecated. Please use NWNX_Creature_SetDomain() instead"); - NWNX_Creature_SetDomain(creature, CLASS_TYPE_CLERIC, index, domain); -} - -int NWNX_Creature_GetWizardSpecialization(object creature) -{ - WriteTimestampedLogEntry("NWNX_Creature: GetWizardSpecialization() is deprecated. Please use the basegame's GetSpecialization() instead"); - return GetSpecialization(creature, CLASS_TYPE_WIZARD); -} - -void NWNX_Creature_SetWizardSpecialization(object creature, int school) -{ - WriteTimestampedLogEntry("NWNX_Creature: SetWizardSpecialization() is deprecated. Please use NWNX_Creature_SetSpecialization() instead"); - NWNX_Creature_SetSpecialization(creature, CLASS_TYPE_WIZARD, school); -} - -int NWNX_Creature_GetSoundset(object creature) -{ - string sFunc = "GetSoundset"; - - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); - return NWNX_GetReturnValueInt(NWNX_Creature, sFunc); -} - -void NWNX_Creature_SetSoundset(object creature, int soundset) -{ - string sFunc = "SetSoundset"; - - NWNX_PushArgumentInt(NWNX_Creature, sFunc, soundset); - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); + NWNXPushInt(value); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "SetAlignmentLawChaos"); } void NWNX_Creature_SetSkillRank(object creature, int skill, int rank) { - string sFunc = "SetSkillRank"; - NWNX_PushArgumentInt(NWNX_Creature, sFunc, rank); - NWNX_PushArgumentInt(NWNX_Creature, sFunc, skill); - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); + NWNXPushInt(rank); + NWNXPushInt(skill); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "SetSkillRank"); } -void NWNX_Creature_SetClassByPosition(object creature, int position, int classID) +int NWNX_Creature_GetSkillRankByLevel(object creature, int skill, int level) { - string sFunc = "SetClassByPosition"; - NWNX_PushArgumentInt(NWNX_Creature, sFunc, classID); - NWNX_PushArgumentInt(NWNX_Creature, sFunc, position); - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); + NWNXPushInt(level); + NWNXPushInt(skill); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "GetSkillRankByLevel"); + return NWNXPopInt(); +} - NWNX_CallFunction(NWNX_Creature, sFunc); +void NWNX_Creature_SetSkillRankByLevel(object creature, int skill, int rank, int level) +{ + NWNXPushInt(level); + NWNXPushInt(rank); + NWNXPushInt(skill); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "SetSkillRankByLevel"); +} + +void NWNX_Creature_SetClassByPosition(object creature, int position, int classID, int bUpdateLevels = TRUE) +{ + NWNXPushInt(bUpdateLevels); + NWNXPushInt(classID); + NWNXPushInt(position); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "SetClassByPosition"); } void NWNX_Creature_SetLevelByPosition(object creature, int position, int level) { - string sFunc = "SetLevelByPosition"; - NWNX_PushArgumentInt(NWNX_Creature, sFunc, level); - NWNX_PushArgumentInt(NWNX_Creature, sFunc, position); - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); + NWNXPushInt(level); + NWNXPushInt(position); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "SetLevelByPosition"); } void NWNX_Creature_SetBaseAttackBonus(object creature, int bab) { - string sFunc = "SetBaseAttackBonus"; - NWNX_PushArgumentInt(NWNX_Creature, sFunc, bab); - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); + NWNXPushInt(bab); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "SetBaseAttackBonus"); } int NWNX_Creature_GetAttacksPerRound(object creature, int bBaseAPR = FALSE) { - string sFunc = "GetAttacksPerRound"; - NWNX_PushArgumentInt(NWNX_Creature, sFunc, bBaseAPR); - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); - return NWNX_GetReturnValueInt(NWNX_Creature, sFunc); -} - -void NWNX_Creature_SetGender(object creature, int gender) -{ - string sFunc = "SetGender"; - NWNX_PushArgumentInt(NWNX_Creature, sFunc, gender); - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); + NWNXPushInt(bBaseAPR); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "GetAttacksPerRound"); + return NWNXPopInt(); } void NWNX_Creature_RestoreFeats(object creature) { - string sFunc = "RestoreFeats"; - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "RestoreFeats"); } void NWNX_Creature_RestoreSpecialAbilities(object creature) { - string sFunc = "RestoreSpecialAbilities"; - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); -} - -void NWNX_Creature_RestoreSpells(object creature, int level = -1) -{ - string sFunc = "RestoreSpells"; - NWNX_PushArgumentInt(NWNX_Creature, sFunc, level); - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "RestoreSpecialAbilities"); } void NWNX_Creature_RestoreItems(object creature) { - string sFunc = "RestoreItems"; - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "RestoreItems"); } void NWNX_Creature_SetSize(object creature, int size) { - string sFunc = "SetSize"; - NWNX_PushArgumentInt(NWNX_Creature, sFunc, size); - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); + NWNXPushInt(size); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "SetSize"); } int NWNX_Creature_GetSkillPointsRemaining(object creature) { - string sFunc = "GetSkillPointsRemaining"; - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); - return NWNX_GetReturnValueInt(NWNX_Creature, sFunc); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "GetSkillPointsRemaining"); + return NWNXPopInt(); } - void NWNX_Creature_SetSkillPointsRemaining(object creature, int skillpoints) { - string sFunc = "SetSkillPointsRemaining"; - NWNX_PushArgumentInt(NWNX_Creature, sFunc, skillpoints); - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); + NWNXPushInt(skillpoints); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "SetSkillPointsRemaining"); +} - NWNX_CallFunction(NWNX_Creature, sFunc); +int NWNX_Creature_GetSkillPointsRemainingByLevel(object creature, int level) +{ + NWNXPushInt(level); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "GetSkillPointsRemainingByLevel"); + return NWNXPopInt(); +} + +void NWNX_Creature_SetSkillPointsRemainingByLevel(object creature, int level, int value) +{ + NWNXPushInt(value); + NWNXPushInt(level); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "SetSkillPointsRemainingByLevel"); } void NWNX_Creature_SetRacialType(object creature, int racialtype) { - string sFunc = "SetRacialType"; - NWNX_PushArgumentInt(NWNX_Creature, sFunc, racialtype); - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); + NWNXPushInt(racialtype); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "SetRacialType"); } int NWNX_Creature_GetMovementType(object creature) { - string sFunc = "GetMovementType"; - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); - return NWNX_GetReturnValueInt(NWNX_Creature, sFunc); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "GetMovementType"); + return NWNXPopInt(); } void NWNX_Creature_SetWalkRateCap(object creature, float fWalkRate = 2000.0f) { - string sFunc = "SetWalkRateCap"; - NWNX_PushArgumentFloat(NWNX_Creature, sFunc, fWalkRate); - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); + NWNXPushFloat(fWalkRate); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "SetWalkRateCap"); } void NWNX_Creature_SetGold(object creature, int gold) { - string sFunc = "SetGold"; - NWNX_PushArgumentInt(NWNX_Creature, sFunc, gold); - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); + NWNXPushInt(gold); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "SetGold"); } void NWNX_Creature_SetCorpseDecayTime(object creature, int nDecayTime) { - string sFunc = "SetCorpseDecayTime"; - NWNX_PushArgumentInt(NWNX_Creature, sFunc, nDecayTime); - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); + NWNXPushInt(nDecayTime); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "SetCorpseDecayTime"); } - int NWNX_Creature_GetBaseSavingThrow(object creature, int which) { - string sFunc = "GetBaseSavingThrow"; - NWNX_PushArgumentInt(NWNX_Creature, sFunc, which); - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); - return NWNX_GetReturnValueInt(NWNX_Creature, sFunc); + NWNXPushInt(which); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "GetBaseSavingThrow"); + return NWNXPopInt(); } void NWNX_Creature_SetBaseSavingThrow(object creature, int which, int value) { - string sFunc = "SetBaseSavingThrow"; - NWNX_PushArgumentInt(NWNX_Creature, sFunc, value); - NWNX_PushArgumentInt(NWNX_Creature, sFunc, which); - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); + NWNXPushInt(value); + NWNXPushInt(which); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "SetBaseSavingThrow"); } -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(NWNX_Creature, sFunc, count); - NWNX_PushArgumentInt(NWNX_Creature, sFunc, class); - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); + NWNXPushInt(package); + NWNXPushInt(count); + NWNXPushInt(class); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "LevelUp"); } void NWNX_Creature_LevelDown(object creature, int count=1) { - string sFunc = "LevelDown"; - NWNX_PushArgumentInt(NWNX_Creature, sFunc, count); - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); + NWNXPushInt(count); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "LevelDown"); } void NWNX_Creature_SetChallengeRating(object creature, float fCR) { - string sFunc = "SetChallengeRating"; - NWNX_PushArgumentFloat(NWNX_Creature, sFunc, fCR); - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); + NWNXPushFloat(fCR); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "SetChallengeRating"); } int NWNX_Creature_GetAttackBonus(object creature, int isMelee = -1, int isTouchAttack = FALSE, int isOffhand = FALSE, int includeBaseAttackBonus = TRUE) { - string sFunc = "GetAttackBonus"; - if (isMelee == -1) { object oWeapon = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, creature); @@ -1463,303 +1524,727 @@ int NWNX_Creature_GetAttackBonus(object creature, int isMelee = -1, int isTouchA isMelee = TRUE; } } - - NWNX_PushArgumentInt(NWNX_Creature, sFunc, includeBaseAttackBonus); - NWNX_PushArgumentInt(NWNX_Creature, sFunc, isOffhand); - NWNX_PushArgumentInt(NWNX_Creature, sFunc, isTouchAttack); - NWNX_PushArgumentInt(NWNX_Creature, sFunc, isMelee); - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); - return NWNX_GetReturnValueInt(NWNX_Creature, sFunc); + NWNXPushInt(includeBaseAttackBonus); + NWNXPushInt(isOffhand); + NWNXPushInt(isTouchAttack); + NWNXPushInt(isMelee); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "GetAttackBonus"); + return NWNXPopInt(); } int NWNX_Creature_GetHighestLevelOfFeat(object creature, int feat) { - string sFunc = "GetHighestLevelOfFeat"; - - NWNX_PushArgumentInt(NWNX_Creature, sFunc, feat); - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); - return NWNX_GetReturnValueInt(NWNX_Creature, sFunc); + NWNXPushInt(feat); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "GetHighestLevelOfFeat"); + return NWNXPopInt(); } int NWNX_Creature_GetFeatRemainingUses(object creature, int feat) { - string sFunc = "GetFeatRemainingUses"; - - NWNX_PushArgumentInt(NWNX_Creature, sFunc, feat); - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); - return NWNX_GetReturnValueInt(NWNX_Creature, sFunc); + NWNXPushInt(feat); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "GetFeatRemainingUses"); + return NWNXPopInt(); } int NWNX_Creature_GetFeatTotalUses(object creature, int feat) { - string sFunc = "GetFeatTotalUses"; - - NWNX_PushArgumentInt(NWNX_Creature, sFunc, feat); - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); - return NWNX_GetReturnValueInt(NWNX_Creature, sFunc); + NWNXPushInt(feat); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "GetFeatTotalUses"); + return NWNXPopInt(); } void NWNX_Creature_SetFeatRemainingUses(object creature, int feat, int uses) { - string sFunc = "SetFeatRemainingUses"; - - NWNX_PushArgumentInt(NWNX_Creature, sFunc, uses); - NWNX_PushArgumentInt(NWNX_Creature, sFunc, feat); - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); + NWNXPushInt(uses); + NWNXPushInt(feat); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "SetFeatRemainingUses"); } int NWNX_Creature_GetTotalEffectBonus(object creature, int bonusType=NWNX_CREATURE_BONUS_TYPE_ATTACK, object target=OBJECT_INVALID, int isElemental=0, int isForceMax=0, int savetype=-1, int saveSpecificType=-1, int skill=-1, int abilityScore=-1, int isOffhand=FALSE) { - string sFunc = "GetTotalEffectBonus"; - - NWNX_PushArgumentInt(NWNX_Creature, sFunc, isOffhand); - NWNX_PushArgumentInt(NWNX_Creature, sFunc, abilityScore); - NWNX_PushArgumentInt(NWNX_Creature, sFunc, skill); - NWNX_PushArgumentInt(NWNX_Creature, sFunc, saveSpecificType); - NWNX_PushArgumentInt(NWNX_Creature, sFunc, savetype); - NWNX_PushArgumentInt(NWNX_Creature, sFunc, isForceMax); - NWNX_PushArgumentInt(NWNX_Creature, sFunc, isElemental); - NWNX_PushArgumentObject(NWNX_Creature, sFunc, target); - NWNX_PushArgumentInt(NWNX_Creature, sFunc, bonusType); - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); - return NWNX_GetReturnValueInt(NWNX_Creature, sFunc); + NWNXPushInt(isOffhand); + NWNXPushInt(abilityScore); + NWNXPushInt(skill); + NWNXPushInt(saveSpecificType); + NWNXPushInt(savetype); + NWNXPushInt(isForceMax); + NWNXPushInt(isElemental); + NWNXPushObject(target); + NWNXPushInt(bonusType); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "GetTotalEffectBonus"); + return NWNXPopInt(); } void NWNX_Creature_SetOriginalName(object creature, string name, int isLastName) { - string sFunc = "SetOriginalName"; - - NWNX_PushArgumentInt(NWNX_Creature, sFunc, isLastName); - NWNX_PushArgumentString(NWNX_Creature, sFunc, name); - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); + NWNXPushInt(isLastName); + NWNXPushString(name); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "SetOriginalName"); } string NWNX_Creature_GetOriginalName(object creature, int isLastName) { - string sFunc = "GetOriginalName"; - - NWNX_PushArgumentInt(NWNX_Creature, sFunc, isLastName); - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); - return NWNX_GetReturnValueString(NWNX_Creature, sFunc); + NWNXPushInt(isLastName); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "GetOriginalName"); + return NWNXPopString(); } void NWNX_Creature_SetSpellResistance(object creature, int sr) { - string sFunc = "SetSpellResistance"; - - NWNX_PushArgumentInt(NWNX_Creature, sFunc, sr); - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); + NWNXPushInt(sr); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "SetSpellResistance"); } void NWNX_Creature_SetAnimalCompanionCreatureType(object creature, int type) { - string sFunc = "SetAnimalCompanionCreatureType"; - - NWNX_PushArgumentInt(NWNX_Creature, sFunc, type); - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); + NWNXPushInt(type); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "SetAnimalCompanionCreatureType"); } void NWNX_Creature_SetFamiliarCreatureType(object creature, int type) { - string sFunc = "SetFamiliarCreatureType"; - - NWNX_PushArgumentInt(NWNX_Creature, sFunc, type); - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); + NWNXPushInt(type); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "SetFamiliarCreatureType"); } void NWNX_Creature_SetAnimalCompanionName(object creature, string name) { - string sFunc = "SetAnimalCompanionName"; - - NWNX_PushArgumentString(NWNX_Creature, sFunc, name); - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); + NWNXPushString(name); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "SetAnimalCompanionName"); } void NWNX_Creature_SetFamiliarName(object creature, string name) { - string sFunc = "SetFamiliarName"; - - NWNX_PushArgumentString(NWNX_Creature, sFunc, name); - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); + NWNXPushString(name); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "SetFamiliarName"); } int NWNX_Creature_GetDisarmable(object creature) { - string sFunc = "GetDisarmable"; - - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); - return NWNX_GetReturnValueInt(NWNX_Creature, sFunc); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "GetDisarmable"); + return NWNXPopInt(); } void NWNX_Creature_SetDisarmable(object creature, int disarmable) { - string sFunc = "SetDisarmable"; - - NWNX_PushArgumentInt(NWNX_Creature, sFunc, disarmable); - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); - - 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); + NWNXPushInt(disarmable); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "SetDisarmable"); } void NWNX_Creature_SetDomain(object creature, int class, int index, int domain) { - string sFunc = "SetDomain"; - - NWNX_PushArgumentInt(NWNX_Creature, sFunc, domain); - NWNX_PushArgumentInt(NWNX_Creature, sFunc, index); - NWNX_PushArgumentInt(NWNX_Creature, sFunc, class); - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); - - 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); + NWNXPushInt(domain); + NWNXPushInt(index); + NWNXPushInt(class); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "SetDomain"); } void NWNX_Creature_SetSpecialization(object creature, int class, int school) { - string sFunc = "SetSpecialization"; - - NWNX_PushArgumentInt(NWNX_Creature, sFunc, school); - NWNX_PushArgumentInt(NWNX_Creature, sFunc, class); - NWNX_PushArgumentObject(NWNX_Creature, sFunc, creature); - - NWNX_CallFunction(NWNX_Creature, sFunc); + NWNXPushInt(school); + NWNXPushInt(class); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "SetSpecialization"); } void NWNX_Creature_SetFaction(object oCreature, int nFactionId) { - string sFunc = "SetFaction"; - NWNX_PushArgumentInt(NWNX_Creature, sFunc, nFactionId); - NWNX_PushArgumentObject(NWNX_Creature, sFunc, oCreature); - NWNX_CallFunction(NWNX_Creature, sFunc); + NWNXPushInt(nFactionId); + NWNXPushObject(oCreature); + NWNXCall(NWNX_Creature, "SetFaction"); } int NWNX_Creature_GetFaction(object oCreature) { - string sFunc = "GetFaction"; - NWNX_PushArgumentObject(NWNX_Creature, sFunc, oCreature); - NWNX_CallFunction(NWNX_Creature, sFunc); - return NWNX_GetReturnValueInt(NWNX_Creature, sFunc); + NWNXPushObject(oCreature); + NWNXCall(NWNX_Creature, "GetFaction"); + return NWNXPopInt(); } int NWNX_Creature_GetFlatFooted(object oCreature) { - string sFunc = "GetFlatFooted"; - NWNX_PushArgumentObject(NWNX_Creature, sFunc, oCreature); - NWNX_CallFunction(NWNX_Creature, sFunc); - return NWNX_GetReturnValueInt(NWNX_Creature, sFunc); + NWNXPushObject(oCreature); + NWNXCall(NWNX_Creature, "GetFlatFooted"); + return NWNXPopInt(); } string NWNX_Creature_SerializeQuickbar(object oCreature) { - string sFunc = "SerializeQuickbar"; - - NWNX_PushArgumentObject(NWNX_Creature, sFunc, oCreature); - NWNX_CallFunction(NWNX_Creature, sFunc); - - return NWNX_GetReturnValueString(NWNX_Creature, sFunc); + NWNXPushObject(oCreature); + NWNXCall(NWNX_Creature, "SerializeQuickbar"); + return NWNXPopString(); } int NWNX_Creature_DeserializeQuickbar(object oCreature, string sSerializedQuickbar) { - string sFunc = "DeserializeQuickbar"; - - NWNX_PushArgumentString(NWNX_Creature, sFunc, sSerializedQuickbar); - NWNX_PushArgumentObject(NWNX_Creature, sFunc, oCreature); - - NWNX_CallFunction(NWNX_Creature, sFunc); - return NWNX_GetReturnValueInt(NWNX_Creature, sFunc); + NWNXPushString(sSerializedQuickbar); + NWNXPushObject(oCreature); + NWNXCall(NWNX_Creature, "DeserializeQuickbar"); + return NWNXPopInt(); } void NWNX_Creature_SetCasterLevelModifier(object oCreature, int nClass, int nModifier, int bPersist = FALSE) { - string sFunc = "SetCasterLevelModifier"; - - NWNX_PushArgumentInt(NWNX_Creature, sFunc, bPersist); - NWNX_PushArgumentInt(NWNX_Creature, sFunc, nModifier); - NWNX_PushArgumentInt(NWNX_Creature, sFunc, nClass); - NWNX_PushArgumentObject(NWNX_Creature, sFunc, oCreature); - - NWNX_CallFunction(NWNX_Creature, sFunc); + NWNXPushInt(bPersist); + NWNXPushInt(nModifier); + NWNXPushInt(nClass); + NWNXPushObject(oCreature); + NWNXCall(NWNX_Creature, "SetCasterLevelModifier"); } int NWNX_Creature_GetCasterLevelModifier(object oCreature, int nClass) { - string sFunc = "GetCasterLevelModifier"; - - NWNX_PushArgumentInt(NWNX_Creature, sFunc, nClass); - NWNX_PushArgumentObject(NWNX_Creature, sFunc, oCreature); - - NWNX_CallFunction(NWNX_Creature, sFunc); - return NWNX_GetReturnValueInt(NWNX_Creature, sFunc); + NWNXPushInt(nClass); + NWNXPushObject(oCreature); + NWNXCall(NWNX_Creature, "GetCasterLevelModifier"); + return NWNXPopInt(); } void NWNX_Creature_SetCasterLevelOverride(object oCreature, int nClass, int nCasterLevel, int bPersist = FALSE) { - string sFunc = "SetCasterLevelOverride"; - - NWNX_PushArgumentInt(NWNX_Creature, sFunc, bPersist); - NWNX_PushArgumentInt(NWNX_Creature, sFunc, nCasterLevel); - NWNX_PushArgumentInt(NWNX_Creature, sFunc, nClass); - NWNX_PushArgumentObject(NWNX_Creature, sFunc, oCreature); - - NWNX_CallFunction(NWNX_Creature, sFunc); + NWNXPushInt(bPersist); + NWNXPushInt(nCasterLevel); + NWNXPushInt(nClass); + NWNXPushObject(oCreature); + NWNXCall(NWNX_Creature, "SetCasterLevelOverride"); } int NWNX_Creature_GetCasterLevelOverride(object oCreature, int nClass) { - string sFunc = "GetCasterLevelOverride"; - - NWNX_PushArgumentInt(NWNX_Creature, sFunc, nClass); - NWNX_PushArgumentObject(NWNX_Creature, sFunc, oCreature); - - NWNX_CallFunction(NWNX_Creature, sFunc); - return NWNX_GetReturnValueInt(NWNX_Creature, sFunc); + NWNXPushInt(nClass); + NWNXPushObject(oCreature); + NWNXCall(NWNX_Creature, "GetCasterLevelOverride"); + return NWNXPopInt(); } void NWNX_Creature_JumpToLimbo(object oCreature) { - string sFunc = "JumpToLimbo"; - NWNX_PushArgumentObject(NWNX_Creature, sFunc, oCreature); - NWNX_CallFunction(NWNX_Creature, sFunc); + NWNXPushObject(oCreature); + NWNXCall(NWNX_Creature, "JumpToLimbo"); +} + +void NWNX_Creature_SetCriticalMultiplierModifier(object oCreature, int nModifier, int nHand = 0, int bPersist = FALSE, int nBaseItem = -1) +{ + NWNXPushInt(nBaseItem); + NWNXPushInt(bPersist); + NWNXPushInt(nHand); + NWNXPushInt(nModifier); + NWNXPushObject(oCreature); + NWNXCall(NWNX_Creature, "SetCriticalMultiplierModifier"); +} + +int NWNX_Creature_GetCriticalMultiplierModifier(object oCreature, int nHand = 0, int nBaseItem = -1) +{ + NWNXPushInt(nBaseItem); + NWNXPushInt(nHand); + NWNXPushObject(oCreature); + NWNXCall(NWNX_Creature, "GetCriticalMultiplierModifier"); + return NWNXPopInt(); +} + +void NWNX_Creature_SetCriticalMultiplierOverride(object oCreature, int nOverride, int nHand = 0, int bPersist = FALSE, int nBaseItem = -1) +{ + NWNXPushInt(nBaseItem); + NWNXPushInt(bPersist); + NWNXPushInt(nHand); + NWNXPushInt(nOverride); + NWNXPushObject(oCreature); + NWNXCall(NWNX_Creature, "SetCriticalMultiplierOverride"); +} + +int NWNX_Creature_GetCriticalMultiplierOverride(object oCreature, int nHand = 0, int nBaseItem = -1) +{ + NWNXPushInt(nBaseItem); + NWNXPushInt(nHand); + NWNXPushObject(oCreature); + NWNXCall(NWNX_Creature, "GetCriticalMultiplierOverride"); + return NWNXPopInt(); +} + +void NWNX_Creature_SetCriticalRangeModifier(object oCreature, int nModifier, int nHand = 0, int bPersist = FALSE, int nBaseItem = -1) +{ + NWNXPushInt(nBaseItem); + NWNXPushInt(bPersist); + NWNXPushInt(nHand); + NWNXPushInt(nModifier); + NWNXPushObject(oCreature); + NWNXCall(NWNX_Creature, "SetCriticalRangeModifier"); +} + +int NWNX_Creature_GetCriticalRangeModifier(object oCreature, int nHand = 0, int nBaseItem = -1) +{ + NWNXPushInt(nBaseItem); + NWNXPushInt(nHand); + NWNXPushObject(oCreature); + + NWNXCall(NWNX_Creature, "GetCriticalRangeModifier"); + return NWNXPopInt(); +} + +void NWNX_Creature_SetCriticalRangeOverride(object oCreature, int nOverride, int nHand = 0, int bPersist = FALSE, int nBaseItem = -1) +{ + NWNXPushInt(nBaseItem); + NWNXPushInt(bPersist); + NWNXPushInt(nHand); + NWNXPushInt(nOverride); + NWNXPushObject(oCreature); + NWNXCall(NWNX_Creature, "SetCriticalRangeOverride"); +} + +int NWNX_Creature_GetCriticalRangeOverride(object oCreature, int nHand = 0, int nBaseItem = -1) +{ + NWNXPushInt(nBaseItem); + NWNXPushInt(nHand); + NWNXPushObject(oCreature); + + NWNXCall(NWNX_Creature, "GetCriticalRangeOverride"); + return NWNXPopInt(); +} + +void NWNX_Creature_AddAssociate(object oCreature, object oAssociate, int nAssociateType) +{ + NWNXPushInt(nAssociateType); + NWNXPushObject(oAssociate); + NWNXPushObject(oCreature); + + NWNXCall(NWNX_Creature, "AddAssociate"); +} + +void NWNX_Creature_OverrideDamageLevel(object oCreature, int nDamageLevel) +{ + NWNXPushInt(nDamageLevel); + NWNXPushObject(oCreature); + NWNXCall(NWNX_Creature, "OverrideDamageLevel"); +} + +void NWNX_Creature_SetEncounter(object oCreature, object oEncounter) +{ + NWNXPushObject(oEncounter); + NWNXPushObject(oCreature); + NWNXCall(NWNX_Creature, "SetEncounter"); +} + +object NWNX_Creature_GetEncounter(object oCreature) +{ + NWNXPushObject(oCreature); + NWNXCall(NWNX_Creature, "GetEncounter"); + return NWNXPopObject(); +} + +int NWNX_Creature_GetIsBartering(object oCreature) +{ + NWNXPushObject(oCreature); + NWNXCall(NWNX_Creature, "GetIsBartering"); + return NWNXPopInt(); +} + +void NWNX_Creature_SetLastItemCasterLevel(object oCreature, int nCasterLvl) +{ + NWNXPushInt(nCasterLvl); + NWNXPushObject(oCreature); + NWNXCall(NWNX_Creature, "SetLastItemCasterLevel"); +} + + +int NWNX_Creature_GetLastItemCasterLevel(object oCreature) +{ + NWNXPushObject(oCreature); + NWNXCall(NWNX_Creature, "GetLastItemCasterLevel"); + return NWNXPopInt(); +} + +int NWNX_Creature_GetArmorClassVersus(object oAttacked, object oVersus, int nTouch=FALSE) +{ + NWNXPushInt(nTouch); + NWNXPushObject(oVersus); + NWNXPushObject(oAttacked); + NWNXCall(NWNX_Creature, "GetArmorClassVersus"); + return NWNXPopInt(); +} + +int NWNX_Creature_GetWalkAnimation(object oCreature) +{ + NWNXPushObject(oCreature); + NWNXCall(NWNX_Creature, "GetWalkAnimation"); + return NWNXPopInt(); +} + +void NWNX_Creature_SetWalkAnimation(object oCreature, int nAnimation) +{ + NWNXPushInt(nAnimation); + NWNXPushObject(oCreature); + NWNXCall(NWNX_Creature, "SetWalkAnimation"); +} + +void NWNX_Creature_SetAttackRollOverride(object oCreature, int nRoll, int nModifier) +{ + NWNXPushInt(nModifier); + NWNXPushInt(nRoll); + NWNXPushObject(oCreature); + NWNXCall(NWNX_Creature, "SetAttackRollOverride"); +} + +void NWNX_Creature_SetParryAllAttacks(object oCreature, int bParry) +{ + NWNXPushInt(bParry); + NWNXPushObject(oCreature); + NWNXCall(NWNX_Creature, "SetParryAllAttacks"); +} + +int NWNX_Creature_GetNoPermanentDeath(object oCreature) +{ + NWNXPushObject(oCreature); + NWNXCall(NWNX_Creature, "GetNoPermanentDeath"); + return NWNXPopInt(); +} + +void NWNX_Creature_SetNoPermanentDeath(object oCreature, int bNoPermanentDeath) +{ + NWNXPushInt(bNoPermanentDeath); + NWNXPushObject(oCreature); + NWNXCall(NWNX_Creature, "SetNoPermanentDeath"); +} + +vector NWNX_Creature_ComputeSafeLocation(object oCreature, vector vPosition, float fRadius = 20.0f, int bWalkStraightLineRequired = TRUE) +{ + NWNXPushInt(bWalkStraightLineRequired); + NWNXPushFloat(fRadius); + NWNXPushVector(vPosition); + NWNXPushObject(oCreature); + NWNXCall(NWNX_Creature, "ComputeSafeLocation"); + return NWNXPopVector(); +} + +void NWNX_Creature_DoPerceptionUpdateOnCreature(object oCreature, object oTargetCreature) +{ + NWNXPushObject(oTargetCreature); + NWNXPushObject(oCreature); + NWNXCall(NWNX_Creature, "DoPerceptionUpdateOnCreature"); +} + +float NWNX_Creature_GetPersonalSpace(object oCreature) +{ + NWNXPushObject(oCreature); + NWNXCall(NWNX_Creature, "GetPersonalSpace"); + return NWNXPopFloat(); +} + +void NWNX_Creature_SetPersonalSpace(object oCreature, float fPerspace) +{ + NWNXPushFloat(fPerspace); + NWNXPushObject(oCreature); + NWNXCall(NWNX_Creature, "SetPersonalSpace"); +} + +float NWNX_Creature_GetCreaturePersonalSpace(object oCreature) +{ + NWNXPushObject(oCreature); + NWNXCall(NWNX_Creature, "GetCreaturePersonalSpace"); + return NWNXPopFloat(); +} + +void NWNX_Creature_SetCreaturePersonalSpace(object oCreature, float fCrePerspace) +{ + NWNXPushFloat(fCrePerspace); + NWNXPushObject(oCreature); + NWNXCall(NWNX_Creature, "SetCreaturePersonalSpace"); +} + +float NWNX_Creature_GetHeight(object oCreature) +{ + NWNXPushObject(oCreature); + NWNXCall(NWNX_Creature, "GetHeight"); + return NWNXPopFloat(); +} + +void NWNX_Creature_SetHeight(object oCreature, float fHeight) +{ + NWNXPushFloat(fHeight); + NWNXPushObject(oCreature); + NWNXCall(NWNX_Creature, "SetHeight"); +} + +float NWNX_Creature_GetHitDistance(object oCreature) +{ + NWNXPushObject(oCreature); + NWNXCall(NWNX_Creature, "GetHitDistance"); + return NWNXPopFloat(); +} + +void NWNX_Creature_SetHitDistance(object oCreature, float fHitDist) +{ + NWNXPushFloat(fHitDist); + NWNXPushObject(oCreature); + NWNXCall(NWNX_Creature, "SetHitDistance"); +} + +float NWNX_Creature_GetPreferredAttackDistance(object oCreature) +{ + NWNXPushObject(oCreature); + NWNXCall(NWNX_Creature, "GetPreferredAttackDistance"); + return NWNXPopFloat(); +} + +void NWNX_Creature_SetPreferredAttackDistance(object oCreature, float fPrefAtckDist) +{ + NWNXPushFloat(fPrefAtckDist); + NWNXPushObject(oCreature); + NWNXCall(NWNX_Creature, "SetPreferredAttackDistance"); +} + +int NWNX_Creature_GetArmorCheckPenalty(object oCreature) +{ + NWNXPushObject(oCreature); + NWNXCall(NWNX_Creature, "GetArmorCheckPenalty"); + return NWNXPopInt(); +} + +int NWNX_Creature_GetShieldCheckPenalty(object oCreature) +{ + NWNXPushObject(oCreature); + NWNXCall(NWNX_Creature, "GetShieldCheckPenalty"); + return NWNXPopInt(); +} + +void NWNX_Creature_SetBypassEffectImmunity(object oCreature, int nImmunityType, int nChance = 100, int bPersist = FALSE) +{ + NWNXPushInt(bPersist); + NWNXPushInt(nChance); + NWNXPushInt(nImmunityType); + NWNXPushObject(oCreature); + NWNXCall(NWNX_Creature, "SetBypassEffectImmunity"); +} + +int NWNX_Creature_GetBypassEffectImmunity(object oCreature, int nImmunityType) +{ + NWNXPushInt(nImmunityType); + NWNXPushObject(oCreature); + NWNXCall(NWNX_Creature, "GetBypassEffectImmunity"); + return NWNXPopInt(); +} + +void NWNX_Creature_SetLastKiller(object oCreature, object oKiller) +{ + NWNXPushObject(oKiller); + NWNXPushObject(oCreature); + NWNXCall(NWNX_Creature, "SetLastKiller"); +} + +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 = "") +{ + NWNXPushString(sImpactScript); + NWNXPushObject(oItem); + NWNXPushInt(nProjectileSpellID); + NWNXPushInt(nProjectilePathType); + NWNXPushFloat(fProjectileTime); + NWNXPushInt(nCasterLevel); + NWNXPushInt(nSpellID); + NWNXPushLocation(locTarget); + NWNXPushObject(oTarget); + NWNXPushObject(oCreature); + NWNXCall(NWNX_Creature, "DoItemCastSpell"); +} + +int NWNX_Creature_RunEquip(object oCreature, object oItem, int nInventorySlot) +{ + NWNXPushInt(nInventorySlot); + NWNXPushObject(oItem); + NWNXPushObject(oCreature); + NWNXCall(NWNX_Creature, "RunEquip"); + return NWNXPopInt(); +} + +int NWNX_Creature_RunUnequip(object oCreature, object oItem) +{ + NWNXPushObject(oItem); + NWNXPushObject(oCreature); + NWNXCall(NWNX_Creature, "RunUnequip"); + return NWNXPopInt(); +} + +void NWNX_Creature_OverrideRangedProjectileVFX(object oCreature, int nProjectileVFX, int bPersist = FALSE) +{ + NWNXPushInt(bPersist); + NWNXPushInt(nProjectileVFX); + NWNXPushObject(oCreature); + NWNXCall(NWNX_Creature, "OverrideRangedProjectileVFX"); +} + +void NWNX_Creature_SetInitiativeModifier(object oCreature, int nMod, int bPersist = FALSE) +{ + NWNXPushInt(bPersist); + NWNXPushInt(nMod); + NWNXPushObject(oCreature); + NWNXCall(NWNX_Creature, "SetInitiativeModifier"); +} + +int NWNX_Creature_GetInitiativeModifier(object oCreature) +{ + NWNXPushObject(oCreature); + NWNXCall(NWNX_Creature, "GetInitiativeModifier"); + return NWNXPopInt(); +} + +object NWNX_Creature_GetBodyBag(object oCreature) +{ + NWNXPushObject(oCreature); + NWNXCall(NWNX_Creature, "GetBodyBag"); + return NWNXPopObject(); +} + +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) +{ + NWNXPushInt(bAddToFront); + NWNXPushInt(bClearActions); + NWNXPushInt(bInstant); + NWNXPushInt(nProjectilePathType); + NWNXPushInt(nDomainLevel); + NWNXPushInt(nMetaMagic); + NWNXPushInt(nMultiClass); + NWNXPushInt(nSpellID); + NWNXPushVector(vTargetLocation); + NWNXPushObject(oTarget); + NWNXPushObject(oCreature); + NWNXCall(NWNX_Creature, "AddCastSpellActions"); + return NWNXPopInt(); +} + +int NWNX_Creature_GetIsFlanking(object oCreature, object oTargetCreature) +{ + NWNXPushObject(oTargetCreature); + NWNXPushObject(oCreature); + NWNXCall(NWNX_Creature, "GetIsFlanking"); + return NWNXPopInt(); +} + +void NWNX_Creature_DecrementRemainingSpellSlots(object oCreature, int nClass, int nSpellLevel) +{ + NWNXPushInt(nSpellLevel); + NWNXPushInt(nClass); + NWNXPushObject(oCreature); + NWNXCall(NWNX_Creature, "DecrementRemainingSpellSlots"); +} + +void NWNX_Creature_IncrementRemainingSpellSlots(object oCreature, int nClass, int nSpellLevel) +{ + NWNXPushInt(nSpellLevel); + NWNXPushInt(nClass); + NWNXPushObject(oCreature); + NWNXCall(NWNX_Creature, "IncrementRemainingSpellSlots"); +} + +int NWNX_Creature_GetMaximumBonusAttacks(object oCreature) +{ + NWNXPushObject(oCreature); + NWNXCall(NWNX_Creature, "GetMaximumBonusAttacks"); + return NWNXPopInt(); +} + +void NWNX_Creature_SetMaximumBonusAttacks(object oCreature, int nMaxBonusAttacks, int bPersist = FALSE) +{ + NWNXPushInt(bPersist); + NWNXPushInt(nMaxBonusAttacks); + NWNXPushObject(oCreature); + NWNXCall(NWNX_Creature, "SetMaximumBonusAttacks"); +} + +void NWNX_Creature_DoCleaveAttack(object oCreature) +{ + NWNXPushObject(oCreature); + NWNXCall(NWNX_Creature, "DoCleaveAttack"); +} + +object NWNX_Creature_GetLockOrientationToObject(object oCreature) +{ + NWNXPushObject(oCreature); + NWNXCall(NWNX_Creature, "GetLockOrientationToObject"); + return NWNXPopObject(); +} + +void NWNX_Creature_SetLockOrientationToObject(object oCreature, object oTarget) +{ + NWNXPushObject(oTarget); + NWNXPushObject(oCreature); + NWNXCall(NWNX_Creature, "SetLockOrientationToObject"); +} + +void NWNX_Creature_BroadcastAttackOfOpportunity(object oCreature, object oSingleCreature = OBJECT_INVALID, int bMovement = FALSE) +{ + NWNXPushInt(bMovement); + NWNXPushObject(oSingleCreature); + NWNXPushObject(oCreature); + NWNXCall(NWNX_Creature, "BroadcastAttackOfOpportunity"); +} + +int NWNX_Creature_GetMaxSellToStorePriceOverride(object oCreature, object oStore) +{ + NWNXPushObject(oStore); + NWNXPushObject(oCreature); + NWNXCall(NWNX_Creature, "GetMaxSellToStorePriceOverride"); + + return NWNXPopInt(); +} + +void NWNX_Creature_SetMaxSellToStorePriceOverride(object oCreature, object oStore, int nMaxSellToPrice) +{ + NWNXPushInt(nMaxSellToPrice); + NWNXPushObject(oStore); + NWNXPushObject(oCreature); + NWNXCall(NWNX_Creature, "SetMaxSellToStorePriceOverride"); +} + +int NWNX_Creature_GetAbilityIncreaseByLevel(object oCreature, int nLevel) +{ + NWNXPushInt(nLevel); + NWNXPushObject(oCreature); + NWNXCall(NWNX_Creature, "GetAbilityIncreaseByLevel"); + return NWNXPopInt(); +} + +void NWNX_Creature_SetAbilityIncreaseByLevel(object oCreature, int nLevel, int nAbility) +{ + NWNXPushInt(nAbility); + NWNXPushInt(nLevel); + NWNXPushObject(oCreature); + NWNXCall(NWNX_Creature, "SetAbilityIncreaseByLevel"); +} + +float NWNX_Creature_GetMaxAttackRange(object oCreature, object oTarget) +{ + NWNXPushObject(oTarget); + NWNXPushObject(oCreature); + NWNXCall(NWNX_Creature, "GetMaxAttackRange"); + return NWNXPopFloat(); +} + +int NWNX_Creature_GetMulticlassLimit(object oCreature) +{ + NWNXPushObject(oCreature); + NWNXCall(NWNX_Creature, "GetMulticlassLimit"); + return NWNXPopInt(); +} + + +void NWNX_Creature_SetMulticlassLimit(object oCreature, int nLimit, int bPersist = FALSE) +{ + NWNXPushInt(bPersist); + NWNXPushInt(nLimit); + NWNXPushObject(oCreature); + NWNXCall(NWNX_Creature, "SetMulticlassLimit"); } diff --git a/_module/nss/nwnx_damage.nss b/_module/nss/nwnx_damage.nss index 3e206ea..1f4d13c 100644 --- a/_module/nss/nwnx_damage.nss +++ b/_module/nss/nwnx_damage.nss @@ -2,7 +2,6 @@ /// @brief Run a script before damage and attack events allowing for modification. Includes function to arbitrarily apply damage. /// @{ /// @file nwnx_damage.nss -#include "nwnx" const string NWNX_Damage = "NWNX_Damage"; ///< @private @@ -24,6 +23,26 @@ 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 + int iSpellId; ///< The spell id associated with the damage or -1 if not known. }; /// @struct NWNX_Damage_AttackEventData @@ -44,10 +63,33 @@ 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, 3=critical hit, 4=miss, 8=concealed - int iAttackType; ///< 1=main hand, 2=offhand, 3-5=creature, 6=haste - int iSneakAttack; ///< 0=neither, 1=sneak attack, 2=death attack, 3=both + 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 + int iSneakAttack; ///< 0=neither, 1=sneak attack, 2=death attack, 3=both + int iAttackType; ///< 65002=Attack of Opportunity, 65003=Riposte or a FeatID like KnockDown or some other special attack. + int bKillingBlow; ///< TRUE if the hit is a killing blow + int iToHitRoll; ///< The to hit roll of the attack + int iToHitModifier; ///< The to hit modifier of the attack }; /// @struct NWNX_Damage_DamageData @@ -66,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. @@ -87,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. @@ -97,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. @@ -105,149 +167,229 @@ 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); /// @} void NWNX_Damage_SetDamageEventScript(string sScript, object oOwner=OBJECT_INVALID) { - string sFunc = "SetEventScript"; - - NWNX_PushArgumentObject(NWNX_Damage, sFunc, oOwner); - NWNX_PushArgumentString(NWNX_Damage, sFunc, sScript); - NWNX_PushArgumentString(NWNX_Damage, sFunc, "DAMAGE"); - - NWNX_CallFunction(NWNX_Damage, sFunc); + NWNXPushObject(oOwner); + NWNXPushString(sScript); + NWNXPushString("DAMAGE"); + NWNXCall(NWNX_Damage, "SetEventScript"); } struct NWNX_Damage_DamageEventData NWNX_Damage_GetDamageEventData() { - string sFunc = "GetDamageEventData"; struct NWNX_Damage_DamageEventData data; - - NWNX_CallFunction(NWNX_Damage, sFunc); - - data.oDamager = NWNX_GetReturnValueObject(NWNX_Damage, sFunc); - data.iBludgeoning = NWNX_GetReturnValueInt(NWNX_Damage, sFunc); - data.iPierce = NWNX_GetReturnValueInt(NWNX_Damage, sFunc); - data.iSlash = NWNX_GetReturnValueInt(NWNX_Damage, sFunc); - data.iMagical = NWNX_GetReturnValueInt(NWNX_Damage, sFunc); - data.iAcid = NWNX_GetReturnValueInt(NWNX_Damage, sFunc); - data.iCold = NWNX_GetReturnValueInt(NWNX_Damage, sFunc); - data.iDivine = NWNX_GetReturnValueInt(NWNX_Damage, sFunc); - data.iElectrical = NWNX_GetReturnValueInt(NWNX_Damage, sFunc); - data.iFire = NWNX_GetReturnValueInt(NWNX_Damage, sFunc); - data.iNegative = NWNX_GetReturnValueInt(NWNX_Damage, sFunc); - data.iPositive = NWNX_GetReturnValueInt(NWNX_Damage, sFunc); - data.iSonic = NWNX_GetReturnValueInt(NWNX_Damage, sFunc); - data.iBase = NWNX_GetReturnValueInt(NWNX_Damage, sFunc); - + NWNXCall(NWNX_Damage, "GetDamageEventData"); + data.oDamager = NWNXPopObject(); + data.iBludgeoning = NWNXPopInt(); + data.iPierce = NWNXPopInt(); + data.iSlash = NWNXPopInt(); + data.iMagical = NWNXPopInt(); + data.iAcid = NWNXPopInt(); + data.iCold = NWNXPopInt(); + data.iDivine = NWNXPopInt(); + data.iElectrical = NWNXPopInt(); + data.iFire = NWNXPopInt(); + data.iNegative = NWNXPopInt(); + data.iPositive = NWNXPopInt(); + data.iSonic = NWNXPopInt(); + data.iBase = NWNXPopInt(); + data.iCustom1 = NWNXPopInt(); + data.iCustom2 = NWNXPopInt(); + data.iCustom3 = NWNXPopInt(); + data.iCustom4 = NWNXPopInt(); + data.iCustom5 = NWNXPopInt(); + data.iCustom6 = NWNXPopInt(); + data.iCustom7 = NWNXPopInt(); + data.iCustom8 = NWNXPopInt(); + data.iCustom9 = NWNXPopInt(); + data.iCustom10 = NWNXPopInt(); + data.iCustom11 = NWNXPopInt(); + data.iCustom12 = NWNXPopInt(); + data.iCustom13 = NWNXPopInt(); + data.iCustom14 = NWNXPopInt(); + data.iCustom15 = NWNXPopInt(); + data.iCustom16 = NWNXPopInt(); + data.iCustom17 = NWNXPopInt(); + data.iCustom18 = NWNXPopInt(); + data.iCustom19 = NWNXPopInt(); + data.iSpellId = NWNXPopInt(); return data; } void NWNX_Damage_SetDamageEventData(struct NWNX_Damage_DamageEventData data) { - string sFunc = "SetDamageEventData"; + NWNXPushInt(data.iCustom19); + NWNXPushInt(data.iCustom18); + NWNXPushInt(data.iCustom17); + NWNXPushInt(data.iCustom16); + NWNXPushInt(data.iCustom15); + NWNXPushInt(data.iCustom14); + NWNXPushInt(data.iCustom13); + NWNXPushInt(data.iCustom12); + NWNXPushInt(data.iCustom11); + NWNXPushInt(data.iCustom10); + NWNXPushInt(data.iCustom9); + NWNXPushInt(data.iCustom8); + NWNXPushInt(data.iCustom7); + NWNXPushInt(data.iCustom6); + NWNXPushInt(data.iCustom5); + NWNXPushInt(data.iCustom4); + NWNXPushInt(data.iCustom3); + NWNXPushInt(data.iCustom2); + NWNXPushInt(data.iCustom1); + NWNXPushInt(data.iBase); + NWNXPushInt(data.iSonic); + NWNXPushInt(data.iPositive); + NWNXPushInt(data.iNegative); + NWNXPushInt(data.iFire); + NWNXPushInt(data.iElectrical); + NWNXPushInt(data.iDivine); + NWNXPushInt(data.iCold); + NWNXPushInt(data.iAcid); + NWNXPushInt(data.iMagical); + NWNXPushInt(data.iSlash); + NWNXPushInt(data.iPierce); + NWNXPushInt(data.iBludgeoning); - NWNX_PushArgumentInt(NWNX_Damage, sFunc, data.iBase); - NWNX_PushArgumentInt(NWNX_Damage, sFunc, data.iSonic); - NWNX_PushArgumentInt(NWNX_Damage, sFunc, data.iPositive); - NWNX_PushArgumentInt(NWNX_Damage, sFunc, data.iNegative); - NWNX_PushArgumentInt(NWNX_Damage, sFunc, data.iFire); - NWNX_PushArgumentInt(NWNX_Damage, sFunc, data.iElectrical); - NWNX_PushArgumentInt(NWNX_Damage, sFunc, data.iDivine); - NWNX_PushArgumentInt(NWNX_Damage, sFunc, data.iCold); - NWNX_PushArgumentInt(NWNX_Damage, sFunc, data.iAcid); - NWNX_PushArgumentInt(NWNX_Damage, sFunc, data.iMagical); - NWNX_PushArgumentInt(NWNX_Damage, sFunc, data.iSlash); - NWNX_PushArgumentInt(NWNX_Damage, sFunc, data.iPierce); - NWNX_PushArgumentInt(NWNX_Damage, sFunc, data.iBludgeoning); - - NWNX_CallFunction(NWNX_Damage, sFunc); + NWNXCall(NWNX_Damage, "SetDamageEventData"); } void NWNX_Damage_SetAttackEventScript(string sScript, object oOwner=OBJECT_INVALID) { - string sFunc = "SetEventScript"; - - NWNX_PushArgumentObject(NWNX_Damage, sFunc, oOwner); - NWNX_PushArgumentString(NWNX_Damage, sFunc, sScript); - NWNX_PushArgumentString(NWNX_Damage, sFunc, "ATTACK"); - - NWNX_CallFunction(NWNX_Damage, sFunc); + NWNXPushObject(oOwner); + NWNXPushString(sScript); + NWNXPushString("ATTACK"); + NWNXCall(NWNX_Damage, "SetEventScript"); } struct NWNX_Damage_AttackEventData NWNX_Damage_GetAttackEventData() { - string sFunc = "GetAttackEventData"; struct NWNX_Damage_AttackEventData data; - - NWNX_CallFunction(NWNX_Damage, sFunc); - - data.oTarget = NWNX_GetReturnValueObject(NWNX_Damage, sFunc); - data.iBludgeoning = NWNX_GetReturnValueInt(NWNX_Damage, sFunc); - data.iPierce = NWNX_GetReturnValueInt(NWNX_Damage, sFunc); - data.iSlash = NWNX_GetReturnValueInt(NWNX_Damage, sFunc); - data.iMagical = NWNX_GetReturnValueInt(NWNX_Damage, sFunc); - data.iAcid = NWNX_GetReturnValueInt(NWNX_Damage, sFunc); - data.iCold = NWNX_GetReturnValueInt(NWNX_Damage, sFunc); - data.iDivine = NWNX_GetReturnValueInt(NWNX_Damage, sFunc); - data.iElectrical = NWNX_GetReturnValueInt(NWNX_Damage, sFunc); - data.iFire = NWNX_GetReturnValueInt(NWNX_Damage, sFunc); - data.iNegative = NWNX_GetReturnValueInt(NWNX_Damage, sFunc); - data.iPositive = NWNX_GetReturnValueInt(NWNX_Damage, sFunc); - data.iSonic = NWNX_GetReturnValueInt(NWNX_Damage, sFunc); - data.iBase = NWNX_GetReturnValueInt(NWNX_Damage, sFunc); - data.iAttackNumber = NWNX_GetReturnValueInt(NWNX_Damage, sFunc); - data.iAttackResult = NWNX_GetReturnValueInt(NWNX_Damage, sFunc); - data.iAttackType = NWNX_GetReturnValueInt(NWNX_Damage, sFunc); - data.iSneakAttack = NWNX_GetReturnValueInt(NWNX_Damage, sFunc); - + NWNXCall(NWNX_Damage, "GetAttackEventData"); + data.oTarget = NWNXPopObject(); + data.iBludgeoning = NWNXPopInt(); + data.iPierce = NWNXPopInt(); + data.iSlash = NWNXPopInt(); + data.iMagical = NWNXPopInt(); + data.iAcid = NWNXPopInt(); + data.iCold = NWNXPopInt(); + data.iDivine = NWNXPopInt(); + data.iElectrical = NWNXPopInt(); + data.iFire = NWNXPopInt(); + data.iNegative = NWNXPopInt(); + data.iPositive = NWNXPopInt(); + data.iSonic = NWNXPopInt(); + data.iBase = NWNXPopInt(); + data.iCustom1 = NWNXPopInt(); + data.iCustom2 = NWNXPopInt(); + data.iCustom3 = NWNXPopInt(); + data.iCustom4 = NWNXPopInt(); + data.iCustom5 = NWNXPopInt(); + data.iCustom6 = NWNXPopInt(); + data.iCustom7 = NWNXPopInt(); + data.iCustom8 = NWNXPopInt(); + data.iCustom9 = NWNXPopInt(); + data.iCustom10 = NWNXPopInt(); + data.iCustom11 = NWNXPopInt(); + data.iCustom12 = NWNXPopInt(); + data.iCustom13 = NWNXPopInt(); + data.iCustom14 = NWNXPopInt(); + data.iCustom15 = NWNXPopInt(); + data.iCustom16 = NWNXPopInt(); + data.iCustom17 = NWNXPopInt(); + data.iCustom18 = NWNXPopInt(); + data.iCustom19 = NWNXPopInt(); + data.iAttackNumber = NWNXPopInt(); + data.iAttackResult = NWNXPopInt(); + data.iWeaponAttackType = NWNXPopInt(); + data.iSneakAttack = NWNXPopInt(); + data.bKillingBlow = NWNXPopInt(); + data.iAttackType = NWNXPopInt(); + data.iToHitRoll = NWNXPopInt(); + data.iToHitModifier = NWNXPopInt(); return data; } void NWNX_Damage_SetAttackEventData(struct NWNX_Damage_AttackEventData data) { - string sFunc = "SetAttackEventData"; - - NWNX_PushArgumentInt(NWNX_Damage, sFunc, data.iAttackResult); - NWNX_PushArgumentInt(NWNX_Damage, sFunc, data.iBase); - NWNX_PushArgumentInt(NWNX_Damage, sFunc, data.iSonic); - NWNX_PushArgumentInt(NWNX_Damage, sFunc, data.iPositive); - NWNX_PushArgumentInt(NWNX_Damage, sFunc, data.iNegative); - NWNX_PushArgumentInt(NWNX_Damage, sFunc, data.iFire); - NWNX_PushArgumentInt(NWNX_Damage, sFunc, data.iElectrical); - NWNX_PushArgumentInt(NWNX_Damage, sFunc, data.iDivine); - NWNX_PushArgumentInt(NWNX_Damage, sFunc, data.iCold); - NWNX_PushArgumentInt(NWNX_Damage, sFunc, data.iAcid); - NWNX_PushArgumentInt(NWNX_Damage, sFunc, data.iMagical); - NWNX_PushArgumentInt(NWNX_Damage, sFunc, data.iSlash); - NWNX_PushArgumentInt(NWNX_Damage, sFunc, data.iPierce); - NWNX_PushArgumentInt(NWNX_Damage, sFunc, data.iBludgeoning); - - NWNX_CallFunction(NWNX_Damage, sFunc); + NWNXPushInt(data.iSneakAttack); + NWNXPushInt(data.iAttackResult); + NWNXPushInt(data.iCustom19); + NWNXPushInt(data.iCustom18); + NWNXPushInt(data.iCustom17); + NWNXPushInt(data.iCustom16); + NWNXPushInt(data.iCustom15); + NWNXPushInt(data.iCustom14); + NWNXPushInt(data.iCustom13); + NWNXPushInt(data.iCustom12); + NWNXPushInt(data.iCustom11); + NWNXPushInt(data.iCustom10); + NWNXPushInt(data.iCustom9); + NWNXPushInt(data.iCustom8); + NWNXPushInt(data.iCustom7); + NWNXPushInt(data.iCustom6); + NWNXPushInt(data.iCustom5); + NWNXPushInt(data.iCustom4); + NWNXPushInt(data.iCustom3); + NWNXPushInt(data.iCustom2); + NWNXPushInt(data.iCustom1); + NWNXPushInt(data.iBase); + NWNXPushInt(data.iSonic); + NWNXPushInt(data.iPositive); + NWNXPushInt(data.iNegative); + NWNXPushInt(data.iFire); + NWNXPushInt(data.iElectrical); + NWNXPushInt(data.iDivine); + NWNXPushInt(data.iCold); + NWNXPushInt(data.iAcid); + NWNXPushInt(data.iMagical); + NWNXPushInt(data.iSlash); + NWNXPushInt(data.iPierce); + NWNXPushInt(data.iBludgeoning); + NWNXCall(NWNX_Damage, "SetAttackEventData"); } void NWNX_Damage_DealDamage(struct NWNX_Damage_DamageData data, object oTarget, object oSource, int iRanged = FALSE) { - string sFunc = "DealDamage"; - - NWNX_PushArgumentInt(NWNX_Damage, sFunc, iRanged); - NWNX_PushArgumentInt(NWNX_Damage, sFunc, data.iPower); - NWNX_PushArgumentInt(NWNX_Damage, sFunc, data.iSonic); - NWNX_PushArgumentInt(NWNX_Damage, sFunc, data.iPositive); - NWNX_PushArgumentInt(NWNX_Damage, sFunc, data.iNegative); - NWNX_PushArgumentInt(NWNX_Damage, sFunc, data.iFire); - NWNX_PushArgumentInt(NWNX_Damage, sFunc, data.iElectrical); - NWNX_PushArgumentInt(NWNX_Damage, sFunc, data.iDivine); - NWNX_PushArgumentInt(NWNX_Damage, sFunc, data.iCold); - NWNX_PushArgumentInt(NWNX_Damage, sFunc, data.iAcid); - NWNX_PushArgumentInt(NWNX_Damage, sFunc, data.iMagical); - NWNX_PushArgumentInt(NWNX_Damage, sFunc, data.iSlash); - NWNX_PushArgumentInt(NWNX_Damage, sFunc, data.iPierce); - NWNX_PushArgumentInt(NWNX_Damage, sFunc, data.iBludgeoning); - NWNX_PushArgumentObject(NWNX_Damage, sFunc, oTarget); - NWNX_PushArgumentObject(NWNX_Damage, sFunc, oSource); - - NWNX_CallFunction(NWNX_Damage, sFunc); + NWNXPushInt(iRanged); + NWNXPushInt(data.iPower); + NWNXPushInt(data.iCustom19); + NWNXPushInt(data.iCustom18); + NWNXPushInt(data.iCustom17); + NWNXPushInt(data.iCustom16); + NWNXPushInt(data.iCustom15); + NWNXPushInt(data.iCustom14); + NWNXPushInt(data.iCustom13); + NWNXPushInt(data.iCustom12); + NWNXPushInt(data.iCustom11); + NWNXPushInt(data.iCustom10); + NWNXPushInt(data.iCustom9); + NWNXPushInt(data.iCustom8); + NWNXPushInt(data.iCustom7); + NWNXPushInt(data.iCustom6); + NWNXPushInt(data.iCustom5); + NWNXPushInt(data.iCustom4); + NWNXPushInt(data.iCustom3); + NWNXPushInt(data.iCustom2); + NWNXPushInt(data.iCustom1); + NWNXPushInt(0);// Padding for Base Damage + NWNXPushInt(data.iSonic); + NWNXPushInt(data.iPositive); + NWNXPushInt(data.iNegative); + NWNXPushInt(data.iFire); + NWNXPushInt(data.iElectrical); + NWNXPushInt(data.iDivine); + NWNXPushInt(data.iCold); + NWNXPushInt(data.iAcid); + NWNXPushInt(data.iMagical); + NWNXPushInt(data.iSlash); + NWNXPushInt(data.iPierce); + NWNXPushInt(data.iBludgeoning); + NWNXPushObject(oTarget); + NWNXPushObject(oSource); + NWNXCall(NWNX_Damage, "DealDamage"); } diff --git a/_module/nss/nwnx_data.nss b/_module/nss/nwnx_data.nss index afbfbdc..b900de5 100644 --- a/_module/nss/nwnx_data.nss +++ b/_module/nss/nwnx_data.nss @@ -2,15 +2,17 @@ /// @brief Provides a number of data structures for NWN code to use (simulated arrays) /// @{ /// @file nwnx_data.nss -#include "nwnx" -const string NWNX_Data = "NWNX_Data"; ///< @private +#include "inc_array" -const int NWNX_DATA_INVALID_INDEX = -1; -const int NWNX_DATA_TYPE_FLOAT = 0; -const int NWNX_DATA_TYPE_INTEGER = 1; -const int NWNX_DATA_TYPE_OBJECT = 2; -const int NWNX_DATA_TYPE_STRING = 3; +// All these calls just pass through to the Array code in inc_array to provide +// an NWNX_Data compatible API for ease of transition. + +const int NWNX_DATA_INVALID_INDEX = INVALID_INDEX; +const int NWNX_DATA_TYPE_FLOAT = TYPE_FLOAT; +const int NWNX_DATA_TYPE_INTEGER = TYPE_INTEGER; +const int NWNX_DATA_TYPE_OBJECT = TYPE_OBJECT; +const int NWNX_DATA_TYPE_STRING = TYPE_STRING; /// @defgroup data_array_at Array At /// @brief Returns the element at the index. @@ -20,10 +22,10 @@ const int NWNX_DATA_TYPE_STRING = 3; /// @param index The index. /// @return The element of associated type. /// @{ -float NWNX_Data_Array_At_Flt(object obj, string tag, int index); -int NWNX_Data_Array_At_Int(object obj, string tag, int index); -object NWNX_Data_Array_At_Obj(object obj, string tag, int index); string NWNX_Data_Array_At_Str(object obj, string tag, int index); +float NWNX_Data_Array_At_Flt(object obj, string tag, int index); +int NWNX_Data_Array_At_Int(object obj, string tag, int index); +object NWNX_Data_Array_At_Obj(object obj, string tag, int index); /// @} @@ -38,8 +40,8 @@ void NWNX_Data_Array_Clear(int type, object obj, string tag); /// @param element The element. /// @return TRUE if the collection contains the element. /// @{ -int NWNX_Data_Array_Contains_Flt(object obj, string tag, float element); -int NWNX_Data_Array_Contains_Int(object obj, string tag, int element); +int NWNX_Data_Array_Contains_Flt(object obj, string tag, float element); +int NWNX_Data_Array_Contains_Int(object obj, string tag, int element); int NWNX_Data_Array_Contains_Obj(object obj, string tag, object element); int NWNX_Data_Array_Contains_Str(object obj, string tag, string element); /// @} @@ -58,8 +60,8 @@ void NWNX_Data_Array_Erase(int type, object obj, string tag, int index); /// @param element The element. /// @return Returns the index at which the element is located, or ARRAY_INVALID_INDEX. /// @{ -int NWNX_Data_Array_Find_Flt(object obj, string tag, float element); -int NWNX_Data_Array_Find_Int(object obj, string tag, int element); +int NWNX_Data_Array_Find_Flt(object obj, string tag, float element); +int NWNX_Data_Array_Find_Int(object obj, string tag, int element); int NWNX_Data_Array_Find_Obj(object obj, string tag, object element); int NWNX_Data_Array_Find_Str(object obj, string tag, string element); /// @} @@ -72,8 +74,8 @@ int NWNX_Data_Array_Find_Str(object obj, string tag, string element); /// @param index The index. /// @param element The element. /// @{ -void NWNX_Data_Array_Insert_Flt(object obj, string tag, int index, float element); -void NWNX_Data_Array_Insert_Int(object obj, string tag, int index, int element); +void NWNX_Data_Array_Insert_Flt(object obj, string tag, int index, float element); +void NWNX_Data_Array_Insert_Int(object obj, string tag, int index, int element); void NWNX_Data_Array_Insert_Obj(object obj, string tag, int index, object element); void NWNX_Data_Array_Insert_Str(object obj, string tag, int index, string element); /// @} @@ -86,8 +88,8 @@ void NWNX_Data_Array_Insert_Str(object obj, string tag, int index, string elemen /// @param tag The tag. /// @param element The element. /// @{ -void NWNX_Data_Array_PushBack_Flt(object obj, string tag, float element); -void NWNX_Data_Array_PushBack_Int(object obj, string tag, int element); +void NWNX_Data_Array_PushBack_Flt(object obj, string tag, float element); +void NWNX_Data_Array_PushBack_Int(object obj, string tag, int element); void NWNX_Data_Array_PushBack_Obj(object obj, string tag, object element); void NWNX_Data_Array_PushBack_Str(object obj, string tag, string element); /// @} @@ -115,346 +117,235 @@ void NWNX_Data_Array_SortDescending(int type, object obj, string tag); /// @param index The index. /// @param element The element. /// @{ -void NWNX_Data_Array_Set_Flt(object obj, string tag, int index, float element); -void NWNX_Data_Array_Set_Int(object obj, string tag, int index, int element); +void NWNX_Data_Array_Set_Flt(object obj, string tag, int index, float element); +void NWNX_Data_Array_Set_Int(object obj, string tag, int index, int element); void NWNX_Data_Array_Set_Obj(object obj, string tag, int index, object element); void NWNX_Data_Array_Set_Str(object obj, string tag, int index, string element); /// @} /// @} +//////////////////////////////////////////////////////////////////////////////// +// return the value contained in location "index" +string NWNX_Data_Array_At_Str(object obj, string tag, int index) +{ + WriteTimestampedLogEntry("WARNING: NWNX_Data is deprecated. You should migrate to Array (see inc_array)"); + return Array_At_Str(tag, index, obj); +} + float NWNX_Data_Array_At_Flt(object obj, string tag, int index) { - string sFunc = "ArrayAt"; - NWNX_PushArgumentInt(NWNX_Data, sFunc, index); - NWNX_PushArgumentString(NWNX_Data, sFunc, tag); - NWNX_PushArgumentObject(NWNX_Data, sFunc, obj); - NWNX_PushArgumentInt(NWNX_Data, sFunc, NWNX_DATA_TYPE_FLOAT); - NWNX_CallFunction(NWNX_Data, sFunc); - return NWNX_GetReturnValueFloat(NWNX_Data, sFunc); + WriteTimestampedLogEntry("WARNING: NWNX_Data is deprecated. You should migrate to Array (see inc_array)"); + return Array_At_Flt(tag, index, obj); } int NWNX_Data_Array_At_Int(object obj, string tag, int index) { - string sFunc = "ArrayAt"; - NWNX_PushArgumentInt(NWNX_Data, sFunc, index); - NWNX_PushArgumentString(NWNX_Data, sFunc, tag); - NWNX_PushArgumentObject(NWNX_Data, sFunc, obj); - NWNX_PushArgumentInt(NWNX_Data, sFunc, NWNX_DATA_TYPE_INTEGER); - NWNX_CallFunction(NWNX_Data, sFunc); - return NWNX_GetReturnValueInt(NWNX_Data, sFunc); + WriteTimestampedLogEntry("WARNING: NWNX_Data is deprecated. You should migrate to Array (see inc_array)"); + return Array_At_Int(tag, index, obj); } object NWNX_Data_Array_At_Obj(object obj, string tag, int index) { - string sFunc = "ArrayAt"; - NWNX_PushArgumentInt(NWNX_Data, sFunc, index); - NWNX_PushArgumentString(NWNX_Data, sFunc, tag); - NWNX_PushArgumentObject(NWNX_Data, sFunc, obj); - NWNX_PushArgumentInt(NWNX_Data, sFunc, NWNX_DATA_TYPE_OBJECT); - NWNX_CallFunction(NWNX_Data, sFunc); - return NWNX_GetReturnValueObject(NWNX_Data, sFunc); -} - -string NWNX_Data_Array_At_Str(object obj, string tag, int index) -{ - string sFunc = "ArrayAt"; - NWNX_PushArgumentInt(NWNX_Data, sFunc, index); - NWNX_PushArgumentString(NWNX_Data, sFunc, tag); - NWNX_PushArgumentObject(NWNX_Data, sFunc, obj); - NWNX_PushArgumentInt(NWNX_Data, sFunc, NWNX_DATA_TYPE_STRING); - NWNX_CallFunction(NWNX_Data, sFunc); - return NWNX_GetReturnValueString(NWNX_Data, sFunc); + WriteTimestampedLogEntry("WARNING: NWNX_Data is deprecated. You should migrate to Array (see inc_array)"); + return Array_At_Obj(tag, index, obj); } void NWNX_Data_Array_Clear(int type, object obj, string tag) { - string sFunc = "ArrayClear"; - NWNX_PushArgumentString(NWNX_Data, sFunc, tag); - NWNX_PushArgumentObject(NWNX_Data, sFunc, obj); - NWNX_PushArgumentInt(NWNX_Data, sFunc, type); - NWNX_CallFunction(NWNX_Data, sFunc); + WriteTimestampedLogEntry("WARNING: NWNX_Data is deprecated. You should migrate to Array (see inc_array)"); + Array_Clear(tag, obj); +} + +//////////////////////////////////////////////////////////////////////////////// +// Return true/value (1/0) if the array contains the value "element" +int NWNX_Data_Array_Contains_Str(object obj, string tag, string element) +{ + WriteTimestampedLogEntry("WARNING: NWNX_Data is deprecated. You should migrate to Array (see inc_array)"); + return Array_Contains_Str(tag, element, obj); } int NWNX_Data_Array_Contains_Flt(object obj, string tag, float element) { - string sFunc = "ArrayContains"; - NWNX_PushArgumentFloat(NWNX_Data, sFunc, element); - NWNX_PushArgumentString(NWNX_Data, sFunc, tag); - NWNX_PushArgumentObject(NWNX_Data, sFunc, obj); - NWNX_PushArgumentInt(NWNX_Data, sFunc, NWNX_DATA_TYPE_FLOAT); - NWNX_CallFunction(NWNX_Data, sFunc); - return NWNX_GetReturnValueInt(NWNX_Data, sFunc); + WriteTimestampedLogEntry("WARNING: NWNX_Data is deprecated. You should migrate to Array (see inc_array)"); + return Array_Contains_Flt(tag, element, obj); } int NWNX_Data_Array_Contains_Int(object obj, string tag, int element) { - string sFunc = "ArrayContains"; - NWNX_PushArgumentInt(NWNX_Data, sFunc, element); - NWNX_PushArgumentString(NWNX_Data, sFunc, tag); - NWNX_PushArgumentObject(NWNX_Data, sFunc, obj); - NWNX_PushArgumentInt(NWNX_Data, sFunc, NWNX_DATA_TYPE_INTEGER); - NWNX_CallFunction(NWNX_Data, sFunc); - return NWNX_GetReturnValueInt(NWNX_Data, sFunc); + WriteTimestampedLogEntry("WARNING: NWNX_Data is deprecated. You should migrate to Array (see inc_array)"); + return Array_Contains_Int(tag, element, obj); } int NWNX_Data_Array_Contains_Obj(object obj, string tag, object element) { - string sFunc = "ArrayContains"; - NWNX_PushArgumentObject(NWNX_Data, sFunc, element); - NWNX_PushArgumentString(NWNX_Data, sFunc, tag); - NWNX_PushArgumentObject(NWNX_Data, sFunc, obj); - NWNX_PushArgumentInt(NWNX_Data, sFunc, NWNX_DATA_TYPE_OBJECT); - NWNX_CallFunction(NWNX_Data, sFunc); - return NWNX_GetReturnValueInt(NWNX_Data, sFunc); + WriteTimestampedLogEntry("WARNING: NWNX_Data is deprecated. You should migrate to Array (see inc_array)"); + return Array_Contains_Obj(tag, element, obj); } -int NWNX_Data_Array_Contains_Str(object obj, string tag, string element) -{ - string sFunc = "ArrayContains"; - NWNX_PushArgumentString(NWNX_Data, sFunc, element); - NWNX_PushArgumentString(NWNX_Data, sFunc, tag); - NWNX_PushArgumentObject(NWNX_Data, sFunc, obj); - NWNX_PushArgumentInt(NWNX_Data, sFunc, NWNX_DATA_TYPE_STRING); - NWNX_CallFunction(NWNX_Data, sFunc); - return NWNX_GetReturnValueInt(NWNX_Data, sFunc); -} +//////////////////////////////////////////////////////////////////////////////// void NWNX_Data_Array_Copy(int type, object obj, string tag, string otherTag) { - string sFunc = "ArrayCopy"; - NWNX_PushArgumentString(NWNX_Data, sFunc, otherTag); - NWNX_PushArgumentString(NWNX_Data, sFunc, tag); - NWNX_PushArgumentObject(NWNX_Data, sFunc, obj); - NWNX_PushArgumentInt(NWNX_Data, sFunc, type); - NWNX_CallFunction(NWNX_Data, sFunc); + WriteTimestampedLogEntry("WARNING: NWNX_Data is deprecated. You should migrate to Array (see inc_array)"); + Array_Copy(tag, otherTag, obj); } +//////////////////////////////////////////////////////////////////////////////// void NWNX_Data_Array_Erase(int type, object obj, string tag, int index) { - string sFunc = "ArrayErase"; - NWNX_PushArgumentInt(NWNX_Data, sFunc, index); - NWNX_PushArgumentString(NWNX_Data, sFunc, tag); - NWNX_PushArgumentObject(NWNX_Data, sFunc, obj); - NWNX_PushArgumentInt(NWNX_Data, sFunc, type); - NWNX_CallFunction(NWNX_Data, sFunc); + WriteTimestampedLogEntry("WARNING: NWNX_Data is deprecated. You should migrate to Array (see inc_array)"); + Array_Erase(tag, index, obj); +} + +//////////////////////////////////////////////////////////////////////////////// +// return the index in the array containing "element" +// if not found, return NWNX_DATA_INVALID_INDEX +int NWNX_Data_Array_Find_Str(object obj, string tag, string element) +{ + WriteTimestampedLogEntry("WARNING: NWNX_Data is deprecated. You should migrate to Array (see inc_array)"); + return Array_Find_Str(tag, element, obj); } int NWNX_Data_Array_Find_Flt(object obj, string tag, float element) { - string sFunc = "ArrayFind"; - NWNX_PushArgumentFloat(NWNX_Data, sFunc, element); - NWNX_PushArgumentString(NWNX_Data, sFunc, tag); - NWNX_PushArgumentObject(NWNX_Data, sFunc, obj); - NWNX_PushArgumentInt(NWNX_Data, sFunc, NWNX_DATA_TYPE_FLOAT); - NWNX_CallFunction(NWNX_Data, sFunc); - return NWNX_GetReturnValueInt(NWNX_Data, sFunc); + WriteTimestampedLogEntry("WARNING: NWNX_Data is deprecated. You should migrate to Array (see inc_array)"); + return Array_Find_Flt(tag, element, obj); } int NWNX_Data_Array_Find_Int(object obj, string tag, int element) { - string sFunc = "ArrayFind"; - NWNX_PushArgumentInt(NWNX_Data, sFunc, element); - NWNX_PushArgumentString(NWNX_Data, sFunc, tag); - NWNX_PushArgumentObject(NWNX_Data, sFunc, obj); - NWNX_PushArgumentInt(NWNX_Data, sFunc, NWNX_DATA_TYPE_INTEGER); - NWNX_CallFunction(NWNX_Data, sFunc); - return NWNX_GetReturnValueInt(NWNX_Data, sFunc); + WriteTimestampedLogEntry("WARNING: NWNX_Data is deprecated. You should migrate to Array (see inc_array)"); + return Array_Find_Int(tag, element, obj); } int NWNX_Data_Array_Find_Obj(object obj, string tag, object element) { - string sFunc = "ArrayFind"; - NWNX_PushArgumentObject(NWNX_Data, sFunc, element); - NWNX_PushArgumentString(NWNX_Data, sFunc, tag); - NWNX_PushArgumentObject(NWNX_Data, sFunc, obj); - NWNX_PushArgumentInt(NWNX_Data, sFunc, NWNX_DATA_TYPE_OBJECT); - NWNX_CallFunction(NWNX_Data, sFunc); - return NWNX_GetReturnValueInt(NWNX_Data, sFunc); + WriteTimestampedLogEntry("WARNING: NWNX_Data is deprecated. You should migrate to Array (see inc_array)"); + return Array_Find_Obj(tag, element, obj); } -int NWNX_Data_Array_Find_Str(object obj, string tag, string element) +//////////////////////////////////////////////////////////////////////////////// +// 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 NWNX_Data_Array_Insert_Str(object obj, string tag, int index, string element) { - string sFunc = "ArrayFind"; - NWNX_PushArgumentString(NWNX_Data, sFunc, element); - NWNX_PushArgumentString(NWNX_Data, sFunc, tag); - NWNX_PushArgumentObject(NWNX_Data, sFunc, obj); - NWNX_PushArgumentInt(NWNX_Data, sFunc, NWNX_DATA_TYPE_STRING); - NWNX_CallFunction(NWNX_Data, sFunc); - return NWNX_GetReturnValueInt(NWNX_Data, sFunc); + WriteTimestampedLogEntry("WARNING: NWNX_Data is deprecated. You should migrate to Array (see inc_array)"); + Array_Insert_Str(tag, index, element, obj); } void NWNX_Data_Array_Insert_Flt(object obj, string tag, int index, float element) { - string sFunc = "ArrayInsert"; - NWNX_PushArgumentFloat(NWNX_Data, sFunc, element); - NWNX_PushArgumentInt(NWNX_Data, sFunc, index); - NWNX_PushArgumentString(NWNX_Data, sFunc, tag); - NWNX_PushArgumentObject(NWNX_Data, sFunc, obj); - NWNX_PushArgumentInt(NWNX_Data, sFunc, NWNX_DATA_TYPE_FLOAT); - NWNX_CallFunction(NWNX_Data, sFunc); + WriteTimestampedLogEntry("WARNING: NWNX_Data is deprecated. You should migrate to Array (see inc_array)"); + Array_Insert_Flt(tag, index, element, obj); } void NWNX_Data_Array_Insert_Int(object obj, string tag, int index, int element) { - string sFunc = "ArrayInsert"; - NWNX_PushArgumentInt(NWNX_Data, sFunc, element); - NWNX_PushArgumentInt(NWNX_Data, sFunc, index); - NWNX_PushArgumentString(NWNX_Data, sFunc, tag); - NWNX_PushArgumentObject(NWNX_Data, sFunc, obj); - NWNX_PushArgumentInt(NWNX_Data, sFunc, NWNX_DATA_TYPE_INTEGER); - NWNX_CallFunction(NWNX_Data, sFunc); + WriteTimestampedLogEntry("WARNING: NWNX_Data is deprecated. You should migrate to Array (see inc_array)"); + Array_Insert_Int(tag, index, element, obj); } void NWNX_Data_Array_Insert_Obj(object obj, string tag, int index, object element) { - string sFunc = "ArrayInsert"; - NWNX_PushArgumentObject(NWNX_Data, sFunc, element); - NWNX_PushArgumentInt(NWNX_Data, sFunc, index); - NWNX_PushArgumentString(NWNX_Data, sFunc, tag); - NWNX_PushArgumentObject(NWNX_Data, sFunc, obj); - NWNX_PushArgumentInt(NWNX_Data, sFunc, NWNX_DATA_TYPE_OBJECT); - NWNX_CallFunction(NWNX_Data, sFunc); + WriteTimestampedLogEntry("WARNING: NWNX_Data is deprecated. You should migrate to Array (see inc_array)"); + Array_Insert_Obj(tag, index, element, obj); } -void NWNX_Data_Array_Insert_Str(object obj, string tag, int index, string element) +//////////////////////////////////////////////////////////////////////////////// +// Insert a new element at the end of the array. +void NWNX_Data_Array_PushBack_Str(object obj, string tag, string element) { - string sFunc = "ArrayInsert"; - NWNX_PushArgumentString(NWNX_Data, sFunc, element); - NWNX_PushArgumentInt(NWNX_Data, sFunc, index); - NWNX_PushArgumentString(NWNX_Data, sFunc, tag); - NWNX_PushArgumentObject(NWNX_Data, sFunc, obj); - NWNX_PushArgumentInt(NWNX_Data, sFunc, NWNX_DATA_TYPE_STRING); - NWNX_CallFunction(NWNX_Data, sFunc); + WriteTimestampedLogEntry("WARNING: NWNX_Data is deprecated. You should migrate to Array (see inc_array)"); + Array_PushBack_Str(tag, element, obj); } void NWNX_Data_Array_PushBack_Flt(object obj, string tag, float element) { - string sFunc = "ArrayPushBack"; - NWNX_PushArgumentFloat(NWNX_Data, sFunc, element); - NWNX_PushArgumentString(NWNX_Data, sFunc, tag); - NWNX_PushArgumentObject(NWNX_Data, sFunc, obj); - NWNX_PushArgumentInt(NWNX_Data, sFunc, NWNX_DATA_TYPE_FLOAT); - NWNX_CallFunction(NWNX_Data, sFunc); + WriteTimestampedLogEntry("WARNING: NWNX_Data is deprecated. You should migrate to Array (see inc_array)"); + Array_PushBack_Flt(tag, element, obj); } void NWNX_Data_Array_PushBack_Int(object obj, string tag, int element) { - string sFunc = "ArrayPushBack"; - NWNX_PushArgumentInt(NWNX_Data, sFunc, element); - NWNX_PushArgumentString(NWNX_Data, sFunc, tag); - NWNX_PushArgumentObject(NWNX_Data, sFunc, obj); - NWNX_PushArgumentInt(NWNX_Data, sFunc, NWNX_DATA_TYPE_INTEGER); - NWNX_CallFunction(NWNX_Data, sFunc); + WriteTimestampedLogEntry("WARNING: NWNX_Data is deprecated. You should migrate to Array (see inc_array)"); + Array_PushBack_Int(tag, element, obj); } void NWNX_Data_Array_PushBack_Obj(object obj, string tag, object element) { - string sFunc = "ArrayPushBack"; - NWNX_PushArgumentObject(NWNX_Data, sFunc, element); - NWNX_PushArgumentString(NWNX_Data, sFunc, tag); - NWNX_PushArgumentObject(NWNX_Data, sFunc, obj); - NWNX_PushArgumentInt(NWNX_Data, sFunc, NWNX_DATA_TYPE_OBJECT); - NWNX_CallFunction(NWNX_Data, sFunc); -} - -void NWNX_Data_Array_PushBack_Str(object obj, string tag, string element) -{ - string sFunc = "ArrayPushBack"; - NWNX_PushArgumentString(NWNX_Data, sFunc, element); - NWNX_PushArgumentString(NWNX_Data, sFunc, tag); - NWNX_PushArgumentObject(NWNX_Data, sFunc, obj); - NWNX_PushArgumentInt(NWNX_Data, sFunc, NWNX_DATA_TYPE_STRING); - NWNX_CallFunction(NWNX_Data, sFunc); + WriteTimestampedLogEntry("WARNING: NWNX_Data is deprecated. You should migrate to Array (see inc_array)"); + Array_PushBack_Obj(tag, element, obj); } +//////////////////////////////////////////////////////////////////////////////// +// Cuts the array off at size 'size'. Elements beyond size are removed. void NWNX_Data_Array_Resize(int type, object obj, string tag, int size) { - string sFunc = "ArrayResize"; - NWNX_PushArgumentInt(NWNX_Data, sFunc, size); - NWNX_PushArgumentString(NWNX_Data, sFunc, tag); - NWNX_PushArgumentObject(NWNX_Data, sFunc, obj); - NWNX_PushArgumentInt(NWNX_Data, sFunc, type); - NWNX_CallFunction(NWNX_Data, sFunc); + WriteTimestampedLogEntry("WARNING: NWNX_Data is deprecated. You should migrate to Array (see inc_array)"); + Array_Resize(tag, size, obj); } +//////////////////////////////////////////////////////////////////////////////// void NWNX_Data_Array_Shuffle(int type, object obj, string tag) { - string sFunc = "ArrayShuffle"; - NWNX_PushArgumentString(NWNX_Data, sFunc, tag); - NWNX_PushArgumentObject(NWNX_Data, sFunc, obj); - NWNX_PushArgumentInt(NWNX_Data, sFunc, type); - NWNX_CallFunction(NWNX_Data, sFunc); + WriteTimestampedLogEntry("WARNING: NWNX_Data is deprecated. You should migrate to Array (see inc_array)"); + Array_Shuffle(tag, obj); } +//////////////////////////////////////////////////////////////////////////////// int NWNX_Data_Array_Size(int type, object obj, string tag) { - string sFunc = "ArraySize"; - NWNX_PushArgumentString(NWNX_Data, sFunc, tag); - NWNX_PushArgumentObject(NWNX_Data, sFunc, obj); - NWNX_PushArgumentInt(NWNX_Data, sFunc, type); - NWNX_CallFunction(NWNX_Data, sFunc); - return NWNX_GetReturnValueInt(NWNX_Data, sFunc); + WriteTimestampedLogEntry("WARNING: NWNX_Data is deprecated. You should migrate to Array (see inc_array)"); + return Array_Size(tag, obj); +} + +//////////////////////////////////////////////////////////////////////////////// +// Sort the array by value according to 'direciton' (ASC or DESC) +// Note that this is a lexical sort, so sorting an array of ints or floats will have +// odd results +void NWNX_Data_Array_Sort(object obj, string tag, string direction) +{ + WriteTimestampedLogEntry("WARNING: NWNX_Data is deprecated. You should migrate to Array (see inc_array)"); + Array_Sort(tag, direction, TYPE_STRING, obj); } void NWNX_Data_Array_SortAscending(int type, object obj, string tag) { - string sFunc = "ArraySortAscending"; - NWNX_PushArgumentString(NWNX_Data, sFunc, tag); - NWNX_PushArgumentObject(NWNX_Data, sFunc, obj); - NWNX_PushArgumentInt(NWNX_Data, sFunc, type); - NWNX_CallFunction(NWNX_Data, sFunc); + WriteTimestampedLogEntry("WARNING: NWNX_Data is deprecated. You should migrate to Array (see inc_array)"); + Array_SortAscending(tag, TYPE_STRING, obj); } void NWNX_Data_Array_SortDescending(int type, object obj, string tag) { - string sFunc = "ArraySortDescending"; - NWNX_PushArgumentString(NWNX_Data, sFunc, tag); - NWNX_PushArgumentObject(NWNX_Data, sFunc, obj); - NWNX_PushArgumentInt(NWNX_Data, sFunc, type); - NWNX_CallFunction(NWNX_Data, sFunc); + WriteTimestampedLogEntry("WARNING: NWNX_Data is deprecated. You should migrate to Array (see inc_array)"); + Array_SortDescending(tag, TYPE_STRING, obj); +} + +//////////////////////////////////////////////////////////////////////////////// +// Set the value of array index 'index' to a 'element' +// This will quietly eat values if index > array size +void NWNX_Data_Array_Set_Str(object obj, string tag, int index, string element) +{ + WriteTimestampedLogEntry("WARNING: NWNX_Data is deprecated. You should migrate to Array (see inc_array)"); + Array_Set_Str(tag, index, element, obj); } void NWNX_Data_Array_Set_Flt(object obj, string tag, int index, float element) { - string sFunc = "ArraySet"; - NWNX_PushArgumentFloat(NWNX_Data, sFunc, element); - NWNX_PushArgumentInt(NWNX_Data, sFunc, index); - NWNX_PushArgumentString(NWNX_Data, sFunc, tag); - NWNX_PushArgumentObject(NWNX_Data, sFunc, obj); - NWNX_PushArgumentInt(NWNX_Data, sFunc, NWNX_DATA_TYPE_FLOAT); - NWNX_CallFunction(NWNX_Data, sFunc); + WriteTimestampedLogEntry("WARNING: NWNX_Data is deprecated. You should migrate to Array (see inc_array)"); + Array_Set_Flt(tag, index, element, obj); } void NWNX_Data_Array_Set_Int(object obj, string tag, int index, int element) { - string sFunc = "ArraySet"; - NWNX_PushArgumentInt(NWNX_Data, sFunc, element); - NWNX_PushArgumentInt(NWNX_Data, sFunc, index); - NWNX_PushArgumentString(NWNX_Data, sFunc, tag); - NWNX_PushArgumentObject(NWNX_Data, sFunc, obj); - NWNX_PushArgumentInt(NWNX_Data, sFunc, NWNX_DATA_TYPE_INTEGER); - NWNX_CallFunction(NWNX_Data, sFunc); + WriteTimestampedLogEntry("WARNING: NWNX_Data is deprecated. You should migrate to Array (see inc_array)"); + Array_Set_Int(tag, index, element, obj); } void NWNX_Data_Array_Set_Obj(object obj, string tag, int index, object element) { - string sFunc = "ArraySet"; - NWNX_PushArgumentObject(NWNX_Data, sFunc, element); - NWNX_PushArgumentInt(NWNX_Data, sFunc, index); - NWNX_PushArgumentString(NWNX_Data, sFunc, tag); - NWNX_PushArgumentObject(NWNX_Data,sFunc, obj); - NWNX_PushArgumentInt(NWNX_Data, sFunc, NWNX_DATA_TYPE_OBJECT); - NWNX_CallFunction(NWNX_Data, sFunc); -} - -void NWNX_Data_Array_Set_Str(object obj, string tag, int index, string element) -{ - string sFunc = "ArraySet"; - NWNX_PushArgumentString(NWNX_Data, sFunc, element); - NWNX_PushArgumentInt(NWNX_Data, sFunc, index); - NWNX_PushArgumentString(NWNX_Data, sFunc, tag); - NWNX_PushArgumentObject(NWNX_Data, sFunc, obj); - NWNX_PushArgumentInt(NWNX_Data, sFunc, NWNX_DATA_TYPE_STRING); - NWNX_CallFunction(NWNX_Data, sFunc); + WriteTimestampedLogEntry("WARNING: NWNX_Data is deprecated. You should migrate to Array (see inc_array)"); + Array_Set_Obj(tag, index, element, obj); } diff --git a/_module/nss/nwnx_deprecated.nss b/_module/nss/nwnx_deprecated.nss new file mode 100644 index 0000000..f3be16c --- /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_dialog.nss b/_module/nss/nwnx_dialog.nss index 744943b..f270c5c 100644 --- a/_module/nss/nwnx_dialog.nss +++ b/_module/nss/nwnx_dialog.nss @@ -3,8 +3,6 @@ /// @{ /// @file nwnx_dialog.nss -#include "nwnx" - const string NWNX_Dialog = "NWNX_Dialog"; ///< @private /// @name Dialog Node Types @@ -80,60 +78,46 @@ void NWNX_Dialog_End(object oObject); int NWNX_Dialog_GetCurrentNodeType() { - string sFunc = "GetCurrentNodeType"; - - NWNX_CallFunction(NWNX_Dialog, sFunc); - return NWNX_GetReturnValueInt(NWNX_Dialog, sFunc); + NWNXCall(NWNX_Dialog, "GetCurrentNodeType"); + return NWNXPopInt(); } int NWNX_Dialog_GetCurrentScriptType() { - string sFunc = "GetCurrentScriptType"; - - NWNX_CallFunction(NWNX_Dialog, sFunc); - return NWNX_GetReturnValueInt(NWNX_Dialog, sFunc); + NWNXCall(NWNX_Dialog, "GetCurrentScriptType"); + return NWNXPopInt(); } int NWNX_Dialog_GetCurrentNodeID() { - string sFunc = "GetCurrentNodeID"; - - NWNX_CallFunction(NWNX_Dialog, sFunc); - return NWNX_GetReturnValueInt(NWNX_Dialog, sFunc); + NWNXCall(NWNX_Dialog, "GetCurrentNodeID"); + return NWNXPopInt(); } int NWNX_Dialog_GetCurrentNodeIndex() { - string sFunc = "GetCurrentNodeIndex"; - - NWNX_CallFunction(NWNX_Dialog, sFunc); - return NWNX_GetReturnValueInt(NWNX_Dialog, sFunc); + NWNXCall(NWNX_Dialog, "GetCurrentNodeIndex"); + return NWNXPopInt(); } string NWNX_Dialog_GetCurrentNodeText(int language=NWNX_DIALOG_LANGUAGE_ENGLISH, int gender=GENDER_MALE) { - string sFunc = "GetCurrentNodeText"; - - NWNX_PushArgumentInt(NWNX_Dialog, sFunc, gender); - NWNX_PushArgumentInt(NWNX_Dialog, sFunc, language); - NWNX_CallFunction(NWNX_Dialog, sFunc); - return NWNX_GetReturnValueString(NWNX_Dialog, sFunc); + NWNXPushInt(gender); + NWNXPushInt(language); + NWNXCall(NWNX_Dialog, "GetCurrentNodeText"); + return NWNXPopString(); } void NWNX_Dialog_SetCurrentNodeText(string text, int language=NWNX_DIALOG_LANGUAGE_ENGLISH, int gender=GENDER_MALE) { - string sFunc = "SetCurrentNodeText"; - - NWNX_PushArgumentInt(NWNX_Dialog, sFunc, gender); - NWNX_PushArgumentInt(NWNX_Dialog, sFunc, language); - NWNX_PushArgumentString(NWNX_Dialog, sFunc, text); - NWNX_CallFunction(NWNX_Dialog, sFunc); + NWNXPushInt(gender); + NWNXPushInt(language); + NWNXPushString(text); + NWNXCall(NWNX_Dialog, "SetCurrentNodeText"); } void NWNX_Dialog_End(object oObject) { - string sFunc = "End"; - - NWNX_PushArgumentObject(NWNX_Dialog, sFunc, oObject); - NWNX_CallFunction(NWNX_Dialog, sFunc); + NWNXPushObject(oObject); + NWNXCall(NWNX_Dialog, "End"); } diff --git a/_module/nss/nwnx_effect.nss b/_module/nss/nwnx_effect.nss index 40d8d87..1107db3 100644 --- a/_module/nss/nwnx_effect.nss +++ b/_module/nss/nwnx_effect.nss @@ -2,13 +2,27 @@ /// @brief Utility functions to manipulate the builtin effect type. /// @{ /// @file nwnx_effect.nss -#include "nwnx" 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 { + string sID; ///< @todo Describe int nType; ///< @todo Describe int nSubType; ///< @todo Describe @@ -50,8 +64,12 @@ struct NWNX_EffectUnpacked object oParam1; ///< @todo Describe object oParam2; ///< @todo Describe object oParam3; ///< @todo Describe + vector vParam0; ///< @todo Describe + vector vParam1; ///< @todo Describe string sTag; ///< @todo Describe + + string sItemProp; ///< @todo Describe }; /// @brief Convert native effect type to unpacked structure. @@ -64,159 +82,273 @@ 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 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. +/// @return Number of internal effects updated. +int NWNX_Effect_ReplaceEffect(object obj, effect eOld, effect eNew); -/// @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 Gets the true effect count +/// @param oObject The object to get the count of. +/// @return the number of effects (item properties and other non-exposed effects included) +int NWNX_Effect_GetTrueEffectCount(object oObject); -/// @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 Gets a specific effect on an object. This can grab effects normally hidden from developers, such as item properties. +/// @param oObject The object with the effect +/// @param nIndex The point in the array to retrieve (0 to GetTrueEffectCount()) +/// @return A constructed NWNX_EffectUnpacked. +struct NWNX_EffectUnpacked NWNX_Effect_GetTrueEffect(object oObject, int nIndex); + +/// @brief Replaces an already applied effect with another. +/// @param oObject The object with the effect to replace +/// @param nIndex The array element to be replaced +/// @param e The unpacked effect to replace it with. +/// @note Cannot replace an effect with a different type or ID. +void NWNX_Effect_ReplaceEffectByIndex(object oObject, int nIndex, struct NWNX_EffectUnpacked e); + +/// @brief Removes effect by ID +/// @param oObject The object to remove the effect from +/// @param sID The id of the effect, can be retrieved by unpacking effects. +/// @return FALSE/0 on failure TRUE/1 on success. +int NWNX_Effect_RemoveEffectById(object oObject, string sID); + +/// @brief Applys an effect, bypassing any processing done by ApplyEffectToObject +/// @param eEffect The effect to be applied. +/// @param oObject The object to apply it to. +void NWNX_Effect_Apply(effect eEffect, object oObject); + +/// @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); /// @} -struct NWNX_EffectUnpacked NWNX_Effect_UnpackEffect(effect e) +struct NWNX_EffectUnpacked __NWNX_Effect_ResolveUnpack(int bLink=TRUE) { - string sFunc = "UnpackEffect"; - - NWNX_PushArgumentEffect(NWNX_Effect, sFunc, e); - NWNX_CallFunction(NWNX_Effect, sFunc); - struct NWNX_EffectUnpacked n; - n.sTag = NWNX_GetReturnValueString(NWNX_Effect, sFunc); - n.oParam3 = NWNX_GetReturnValueObject(NWNX_Effect, sFunc); - n.oParam2 = NWNX_GetReturnValueObject(NWNX_Effect, sFunc); - n.oParam1 = NWNX_GetReturnValueObject(NWNX_Effect, sFunc); - n.oParam0 = NWNX_GetReturnValueObject(NWNX_Effect, sFunc); - n.sParam5 = NWNX_GetReturnValueString(NWNX_Effect, sFunc); - n.sParam4 = NWNX_GetReturnValueString(NWNX_Effect, sFunc); - n.sParam3 = NWNX_GetReturnValueString(NWNX_Effect, sFunc); - n.sParam2 = NWNX_GetReturnValueString(NWNX_Effect, sFunc); - n.sParam1 = NWNX_GetReturnValueString(NWNX_Effect, sFunc); - n.sParam0 = NWNX_GetReturnValueString(NWNX_Effect, sFunc); - n.fParam3 = NWNX_GetReturnValueFloat(NWNX_Effect, sFunc); - n.fParam2 = NWNX_GetReturnValueFloat(NWNX_Effect, sFunc); - n.fParam1 = NWNX_GetReturnValueFloat(NWNX_Effect, sFunc); - n.fParam0 = NWNX_GetReturnValueFloat(NWNX_Effect, sFunc); - n.nParam7 = NWNX_GetReturnValueInt(NWNX_Effect, sFunc); - n.nParam6 = NWNX_GetReturnValueInt(NWNX_Effect, sFunc); - n.nParam5 = NWNX_GetReturnValueInt(NWNX_Effect, sFunc); - n.nParam4 = NWNX_GetReturnValueInt(NWNX_Effect, sFunc); - n.nParam3 = NWNX_GetReturnValueInt(NWNX_Effect, sFunc); - n.nParam2 = NWNX_GetReturnValueInt(NWNX_Effect, sFunc); - n.nParam1 = NWNX_GetReturnValueInt(NWNX_Effect, sFunc); - n.nParam0 = NWNX_GetReturnValueInt(NWNX_Effect, sFunc); - n.nNumIntegers = NWNX_GetReturnValueInt(NWNX_Effect, sFunc); + n.sItemProp = NWNXPopString(); - n.bLinkRightValid = NWNX_GetReturnValueInt(NWNX_Effect, sFunc); - n.eLinkRight = NWNX_GetReturnValueEffect(NWNX_Effect, sFunc); - n.bLinkLeftValid = NWNX_GetReturnValueInt(NWNX_Effect, sFunc); - n.eLinkLeft = NWNX_GetReturnValueEffect(NWNX_Effect, sFunc); + n.sTag = NWNXPopString(); - n.nCasterLevel = NWNX_GetReturnValueInt(NWNX_Effect, sFunc); - n.bShowIcon = NWNX_GetReturnValueInt(NWNX_Effect, sFunc); - n.bExpose = NWNX_GetReturnValueInt(NWNX_Effect, sFunc); - n.nSpellId = NWNX_GetReturnValueInt(NWNX_Effect, sFunc); - n.oCreator = NWNX_GetReturnValueObject(NWNX_Effect, sFunc); + n.vParam1 = NWNXPopVector(); + n.vParam0 = NWNXPopVector(); + n.oParam3 = NWNXPopObject(); + n.oParam2 = NWNXPopObject(); + n.oParam1 = NWNXPopObject(); + n.oParam0 = NWNXPopObject(); + n.sParam5 = NWNXPopString(); + n.sParam4 = NWNXPopString(); + n.sParam3 = NWNXPopString(); + n.sParam2 = NWNXPopString(); + n.sParam1 = NWNXPopString(); + n.sParam0 = NWNXPopString(); + n.fParam3 = NWNXPopFloat(); + n.fParam2 = NWNXPopFloat(); + n.fParam1 = NWNXPopFloat(); + n.fParam0 = NWNXPopFloat(); + n.nParam7 = NWNXPopInt(); + n.nParam6 = NWNXPopInt(); + n.nParam5 = NWNXPopInt(); + n.nParam4 = NWNXPopInt(); + n.nParam3 = NWNXPopInt(); + n.nParam2 = NWNXPopInt(); + n.nParam1 = NWNXPopInt(); + n.nParam0 = NWNXPopInt(); + n.nNumIntegers = NWNXPopInt(); - n.nExpiryTimeOfDay = NWNX_GetReturnValueInt(NWNX_Effect, sFunc); - n.nExpiryCalendarDay = NWNX_GetReturnValueInt(NWNX_Effect, sFunc); - n.fDuration = NWNX_GetReturnValueFloat(NWNX_Effect, sFunc); + if(bLink) + { + n.bLinkRightValid = NWNXPopInt(); + n.eLinkRight = NWNXPopEffect(); + n.bLinkLeftValid = NWNXPopInt(); + n.eLinkLeft = NWNXPopEffect(); + } + else + { + n.bLinkRightValid = FALSE; + n.bLinkLeftValid = FALSE; + } - n.nSubType = NWNX_GetReturnValueInt(NWNX_Effect, sFunc); - n.nType = NWNX_GetReturnValueInt(NWNX_Effect, sFunc); + n.nCasterLevel = NWNXPopInt(); + n.bShowIcon = NWNXPopInt(); + n.bExpose = NWNXPopInt(); + n.nSpellId = NWNXPopInt(); + n.oCreator = NWNXPopObject(); + + n.nExpiryTimeOfDay = NWNXPopInt(); + n.nExpiryCalendarDay = NWNXPopInt(); + n.fDuration = NWNXPopFloat(); + + n.nSubType = NWNXPopInt(); + n.nType = NWNXPopInt(); + n.sID = NWNXPopString(); return n; } + +void __NWNX_Effect_ResolvePack(struct NWNX_EffectUnpacked e, int bReplace=FALSE) +{ + if(!bReplace) + NWNXPushInt(e.nType); + + NWNXPushInt(e.nSubType); + + NWNXPushFloat(e.fDuration); + NWNXPushInt(e.nExpiryCalendarDay); + NWNXPushInt(e.nExpiryTimeOfDay); + + NWNXPushObject(e.oCreator); + NWNXPushInt(e.nSpellId); + NWNXPushInt(e.bExpose); + NWNXPushInt(e.bShowIcon); + NWNXPushInt(e.nCasterLevel); + + if(!bReplace) + { + NWNXPushEffect(e.eLinkLeft); + NWNXPushInt(e.bLinkLeftValid); + NWNXPushEffect(e.eLinkRight); + NWNXPushInt(e.bLinkRightValid); + } + + NWNXPushInt(e.nNumIntegers); + NWNXPushInt(e.nParam0); + NWNXPushInt(e.nParam1); + NWNXPushInt(e.nParam2); + NWNXPushInt(e.nParam3); + NWNXPushInt(e.nParam4); + NWNXPushInt(e.nParam5); + NWNXPushInt(e.nParam6); + NWNXPushInt(e.nParam7); + NWNXPushFloat(e.fParam0); + NWNXPushFloat(e.fParam1); + NWNXPushFloat(e.fParam2); + NWNXPushFloat(e.fParam3); + NWNXPushString(e.sParam0); + NWNXPushString(e.sParam1); + NWNXPushString(e.sParam2); + NWNXPushString(e.sParam3); + NWNXPushString(e.sParam4); + NWNXPushString(e.sParam5); + NWNXPushObject(e.oParam0); + NWNXPushObject(e.oParam1); + NWNXPushObject(e.oParam2); + NWNXPushObject(e.oParam3); + + NWNXPushVector(e.vParam0); + NWNXPushVector(e.vParam1); + + NWNXPushString(e.sTag); + + NWNXPushString(e.sItemProp); +} + +struct NWNX_EffectUnpacked NWNX_Effect_UnpackEffect(effect e) +{ + NWNXPushEffect(e); + NWNXCall(NWNX_Effect, "UnpackEffect"); + return __NWNX_Effect_ResolveUnpack(); +} effect NWNX_Effect_PackEffect(struct NWNX_EffectUnpacked e) { - string sFunc = "PackEffect"; - - NWNX_PushArgumentInt(NWNX_Effect, sFunc, e.nType); - NWNX_PushArgumentInt(NWNX_Effect, sFunc, e.nSubType); - - NWNX_PushArgumentFloat(NWNX_Effect, sFunc, e.fDuration); - NWNX_PushArgumentInt(NWNX_Effect, sFunc, e.nExpiryCalendarDay); - NWNX_PushArgumentInt(NWNX_Effect, sFunc, e.nExpiryTimeOfDay); - - NWNX_PushArgumentObject(NWNX_Effect, sFunc, e.oCreator); - NWNX_PushArgumentInt(NWNX_Effect, sFunc, e.nSpellId); - NWNX_PushArgumentInt(NWNX_Effect, sFunc, e.bExpose); - NWNX_PushArgumentInt(NWNX_Effect, sFunc, e.bShowIcon); - NWNX_PushArgumentInt(NWNX_Effect, sFunc, e.nCasterLevel); - - NWNX_PushArgumentEffect(NWNX_Effect, sFunc, e.eLinkLeft); - NWNX_PushArgumentInt(NWNX_Effect, sFunc, e.bLinkLeftValid); - NWNX_PushArgumentEffect(NWNX_Effect, sFunc, e.eLinkRight); - NWNX_PushArgumentInt(NWNX_Effect, sFunc, e.bLinkRightValid); - - NWNX_PushArgumentInt(NWNX_Effect, sFunc, e.nNumIntegers); - NWNX_PushArgumentInt(NWNX_Effect, sFunc, e.nParam0); - NWNX_PushArgumentInt(NWNX_Effect, sFunc, e.nParam1); - NWNX_PushArgumentInt(NWNX_Effect, sFunc, e.nParam2); - NWNX_PushArgumentInt(NWNX_Effect, sFunc, e.nParam3); - NWNX_PushArgumentInt(NWNX_Effect, sFunc, e.nParam4); - NWNX_PushArgumentInt(NWNX_Effect, sFunc, e.nParam5); - NWNX_PushArgumentInt(NWNX_Effect, sFunc, e.nParam6); - NWNX_PushArgumentInt(NWNX_Effect, sFunc, e.nParam7); - NWNX_PushArgumentFloat(NWNX_Effect, sFunc, e.fParam0); - NWNX_PushArgumentFloat(NWNX_Effect, sFunc, e.fParam1); - NWNX_PushArgumentFloat(NWNX_Effect, sFunc, e.fParam2); - NWNX_PushArgumentFloat(NWNX_Effect, sFunc, e.fParam3); - NWNX_PushArgumentString(NWNX_Effect, sFunc, e.sParam0); - NWNX_PushArgumentString(NWNX_Effect, sFunc, e.sParam1); - NWNX_PushArgumentString(NWNX_Effect, sFunc, e.sParam2); - NWNX_PushArgumentString(NWNX_Effect, sFunc, e.sParam3); - NWNX_PushArgumentString(NWNX_Effect, sFunc, e.sParam4); - NWNX_PushArgumentString(NWNX_Effect, sFunc, e.sParam5); - NWNX_PushArgumentObject(NWNX_Effect, sFunc, e.oParam0); - NWNX_PushArgumentObject(NWNX_Effect, sFunc, e.oParam1); - NWNX_PushArgumentObject(NWNX_Effect, sFunc, e.oParam2); - NWNX_PushArgumentObject(NWNX_Effect, sFunc, e.oParam3); - - NWNX_PushArgumentString(NWNX_Effect, sFunc, e.sTag); - - NWNX_CallFunction(NWNX_Effect, sFunc); - return NWNX_GetReturnValueEffect(NWNX_Effect, sFunc); + __NWNX_Effect_ResolvePack(e); + NWNXCall(NWNX_Effect, "PackEffect"); + return NWNXPopEffect(); } -effect NWNX_Effect_SetEffectExpiredScript(effect e, string script, string data = "") +int NWNX_Effect_ReplaceEffect(object obj, effect eOld, effect eNew) { - string sFunc = "SetEffectExpiredScript"; - - NWNX_PushArgumentString(NWNX_Effect, sFunc, data); - NWNX_PushArgumentString(NWNX_Effect, sFunc, script); - NWNX_PushArgumentEffect(NWNX_Effect, sFunc, e); - - NWNX_CallFunction(NWNX_Effect, sFunc); - - return NWNX_GetReturnValueEffect(NWNX_Effect, sFunc); + NWNXPushEffect(eNew); + NWNXPushEffect(eOld); + NWNXPushObject(obj); + NWNXCall(NWNX_Effect, "ReplaceEffect"); + return NWNXPopInt(); } -string NWNX_Effect_GetEffectExpiredData() +int NWNX_Effect_GetTrueEffectCount(object oObject) { - string sFunc = "GetEffectExpiredData"; - - NWNX_CallFunction(NWNX_Effect, sFunc); - - return NWNX_GetReturnValueString(NWNX_Effect, sFunc); + NWNXPushObject(oObject); + NWNXCall(NWNX_Effect, "GetTrueEffectCount"); + return NWNXPopInt(); } -object NWNX_Effect_GetEffectExpiredCreator() +struct NWNX_EffectUnpacked NWNX_Effect_GetTrueEffect(object oObject, int nIndex) { - string sFunc = "GetEffectExpiredCreator"; - - NWNX_CallFunction(NWNX_Effect, sFunc); - - return NWNX_GetReturnValueObject(NWNX_Effect, sFunc); + NWNXPushInt(nIndex); + NWNXPushObject(oObject); + NWNXCall(NWNX_Effect, "GetTrueEffect"); + return __NWNX_Effect_ResolveUnpack(FALSE); +} + +void NWNX_Effect_ReplaceEffectByIndex(object oObject, int nIndex, struct NWNX_EffectUnpacked e) +{ + __NWNX_Effect_ResolvePack(e, TRUE); + NWNXPushInt(nIndex); + NWNXPushObject(oObject); + NWNXCall(NWNX_Effect, "ReplaceEffectByIndex"); +} + +int NWNX_Effect_RemoveEffectById(object oObject, string sID) +{ + NWNXPushString(sID); + NWNXPushObject(oObject); + NWNXCall(NWNX_Effect, "RemoveEffectById"); + return NWNXPopInt(); +} + +void NWNX_Effect_Apply(effect eEffect, object oObject) +{ + NWNXPushObject(oObject); + NWNXPushEffect(eEffect); + NWNXCall(NWNX_Effect, "Apply"); +} + +effect NWNX_Effect_SetEffectCreator(effect eEffect, object oObject) +{ + NWNXPushObject(oObject); + NWNXPushEffect(eEffect); + NWNXCall(NWNX_Effect, "SetEffectCreator"); + return NWNXPopEffect(); +} + +int NWNX_Effect_GetIsEffectValid(effect eEffect) +{ + NWNXPushEffect(eEffect); + NWNXCall(NWNX_Effect, "GetIsEffectValid"); + return NWNXPopInt(); +} + +int NWNX_Effect_GetAppliedEffectCount(object oObject) +{ + NWNXPushObject(oObject); + NWNXCall(NWNX_Effect, "GetAppliedEffectCount"); + return NWNXPopInt(); +} + +effect NWNX_Effect_GetAppliedEffect(object oObject, int nNth) +{ + NWNXPushInt(nNth); + NWNXPushObject(oObject); + NWNXCall(NWNX_Effect, "GetAppliedEffect"); + return NWNXPopEffect(); } diff --git a/_module/nss/nwnx_elc.nss b/_module/nss/nwnx_elc.nss index 0504963..57bb7fb 100644 --- a/_module/nss/nwnx_elc.nss +++ b/_module/nss/nwnx_elc.nss @@ -2,7 +2,6 @@ /// @brief Replacement for ValidateCharacter: ELC & ILR /// @{ /// @file nwnx_elc.nss -#include "nwnx" const string NWNX_ELC = "NWNX_ELC"; ///< @private @@ -21,11 +20,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 +71,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 @@ -150,95 +146,71 @@ int NWNX_ELC_GetValidationFailureSpellID(); void NWNX_ELC_SetELCScript(string sScript) { - string sFunc = "SetELCScript"; - - NWNX_PushArgumentString(NWNX_ELC, sFunc, sScript); - NWNX_CallFunction(NWNX_ELC, sFunc); + NWNXPushString(sScript); + NWNXCall(NWNX_ELC, "SetELCScript"); } void NWNX_ELC_EnableCustomELCCheck(int bEnabled) { - string sFunc = "EnableCustomELCCheck"; - - NWNX_PushArgumentInt(NWNX_ELC, sFunc, bEnabled); - NWNX_CallFunction(NWNX_ELC, sFunc); + NWNXPushInt(bEnabled); + NWNXCall(NWNX_ELC, "EnableCustomELCCheck"); } void NWNX_ELC_SkipValidationFailure() { - string sFunc = "SkipValidationFailure"; - - NWNX_CallFunction(NWNX_ELC, sFunc); + NWNXCall(NWNX_ELC, "SkipValidationFailure"); } int NWNX_ELC_GetValidationFailureType() { - string sFunc = "GetValidationFailureType"; - - NWNX_CallFunction(NWNX_ELC, sFunc); - return NWNX_GetReturnValueInt(NWNX_ELC, sFunc); + NWNXCall(NWNX_ELC, "GetValidationFailureType"); + return NWNXPopInt(); } int NWNX_ELC_GetValidationFailureSubType() { - string sFunc = "GetValidationFailureSubType"; - - NWNX_CallFunction(NWNX_ELC, sFunc); - return NWNX_GetReturnValueInt(NWNX_ELC, sFunc); + NWNXCall(NWNX_ELC, "GetValidationFailureSubType"); + return NWNXPopInt(); } int NWNX_ELC_GetValidationFailureMessageStrRef() { - string sFunc = "GetValidationFailureMessageStrRef"; - - NWNX_CallFunction(NWNX_ELC, sFunc); - return NWNX_GetReturnValueInt(NWNX_ELC, sFunc); + NWNXCall(NWNX_ELC, "GetValidationFailureMessageStrRef"); + return NWNXPopInt(); } void NWNX_ELC_SetValidationFailureMessageStrRef(int nStrRef) { - string sFunc = "SetValidationFailureMessageStrRef"; - - NWNX_PushArgumentInt(NWNX_ELC, sFunc, nStrRef); - NWNX_CallFunction(NWNX_ELC, sFunc); + NWNXPushInt(nStrRef); + NWNXCall(NWNX_ELC, "SetValidationFailureMessageStrRef"); } object NWNX_ELC_GetValidationFailureItem() { - string sFunc = "GetValidationFailureItem"; - - NWNX_CallFunction(NWNX_ELC, sFunc); - return NWNX_GetReturnValueObject(NWNX_ELC, sFunc); + NWNXCall(NWNX_ELC, "GetValidationFailureItem"); + return NWNXPopObject(); } int NWNX_ELC_GetValidationFailureLevel() { - string sFunc = "GetValidationFailureLevel"; - - NWNX_CallFunction(NWNX_ELC, sFunc); - return NWNX_GetReturnValueInt(NWNX_ELC, sFunc); + NWNXCall(NWNX_ELC, "GetValidationFailureLevel"); + return NWNXPopInt(); } int NWNX_ELC_GetValidationFailureSkillID() { - string sFunc = "GetValidationFailureSkillID"; - - NWNX_CallFunction(NWNX_ELC, sFunc); - return NWNX_GetReturnValueInt(NWNX_ELC, sFunc); + NWNXCall(NWNX_ELC, "GetValidationFailureSkillID"); + return NWNXPopInt(); } int NWNX_ELC_GetValidationFailureFeatID() { - string sFunc = "GetValidationFailureFeatID"; - - NWNX_CallFunction(NWNX_ELC, sFunc); - return NWNX_GetReturnValueInt(NWNX_ELC, sFunc); + NWNXCall(NWNX_ELC, "GetValidationFailureFeatID"); + return NWNXPopInt(); } int NWNX_ELC_GetValidationFailureSpellID() { - string sFunc = "GetValidationFailureSpellID"; - - NWNX_CallFunction(NWNX_ELC, sFunc); - return NWNX_GetReturnValueInt(NWNX_ELC, sFunc); + NWNXCall(NWNX_ELC, "GetValidationFailureSpellID"); + return NWNXPopInt(); } diff --git a/_module/nss/nwnx_encounter.nss b/_module/nss/nwnx_encounter.nss index e97ebec..8aadcab 100644 --- a/_module/nss/nwnx_encounter.nss +++ b/_module/nss/nwnx_encounter.nss @@ -2,7 +2,6 @@ /// @brief Functions exposing additional encounter properties. /// @{ /// @file nwnx_encounter.nss -#include "nwnx" const string NWNX_Encounter = "NWNX_Encounter"; ///< @private @@ -12,8 +11,13 @@ struct NWNX_Encounter_CreatureListEntry string resref; ///< The resref. float challengeRating; ///< The challenge rating. int unique; ///< Creature will be unique to the encounter. + 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. /// @return The number of creatures in the encounter list. @@ -43,7 +47,7 @@ void NWNX_Encounter_SetFactionId(object encounter, int factionId); /// @brief Get if encounter is player triggered only. /// @param encounter The encounter object. -/// @return TRUE is encounter is player triggered only. +/// @return TRUE if encounter is player triggered only. int NWNX_Encounter_GetPlayerTriggeredOnly(object encounter); /// @brief Set if encounter is player triggered only. @@ -51,6 +55,16 @@ int NWNX_Encounter_GetPlayerTriggeredOnly(object encounter); /// @param playerTriggeredOnly TRUE/FALSE void NWNX_Encounter_SetPlayerTriggeredOnly(object encounter, int playerTriggeredOnly); +/// @brief Get if the encounter respawns or not. +/// @param encounter The encounter object. +/// @return TRUE if the encounter does respawn, FALSE otherwise. +int NWNX_Encounter_GetCanReset(object encounter); + +/// @brief Set if the encounter respawns or not. +/// @param encounter The encounter object. +/// @param reset Does the encounter respawn TRUE or FALSE. +void NWNX_Encounter_SetCanReset(object encounter, int reset); + /// @brief Get the reset time of encounter. /// @param encounter The encounter object. /// @return The seconds the encounter is defined to reset. @@ -61,104 +75,192 @@ int NWNX_Encounter_GetResetTime(object encounter); /// @param resetTime The seconds the encounter will reset. void NWNX_Encounter_SetResetTime(object encounter, int resetTime); +/// @brief Get the number of spawn points of encounter. +/// @param encounter The encounter object. +/// @return The count of the spawn points for the encounter. +int NWNX_Encounter_GetNumberOfSpawnPoints(object encounter); + +/// @brief Gets the spawn point list entry at the specified index +/// @param encounter The encounter object. +/// @param index The index of the spawn point in the encounter list. +/// @return Location of spawn point. +location NWNX_Encounter_GetSpawnPointByIndex(object encounter, int index); + +/// @brief Get the minimum amount of creatures that encounter will spawn. +/// @param encounter The encounter object. +/// @return the minimal amount. +int NWNX_Encounter_GetMinNumSpawned(object encounter); + +/// @brief Get the maximum amount of creatures that encounter will spawn. +/// @param encounter The encounter object. +/// @return the maximal amount. +int NWNX_Encounter_GetMaxNumSpawned(object encounter); + +/// @brief Get the current number of creatures that are spawned and alive +/// @param encounter The encounter object. +/// @return amount of creatures +int NWNX_Encounter_GetCurrentNumSpawned(object encounter); + +/// @brief Get the geometry of an encounter +/// @param oEncounter: The encounter object. +/// @return A string of vertex positions. +string NWNX_Encounter_GetGeometry(object oEncounter); + +/// @brief Set the geometry of an encounter with a list of vertex positions +/// @param oTrigger The encounter object. +/// @param sGeometry Needs to be in the following format -> {x.x, y.y, z.z} or {x.x, y.y} +/// Example Geometry: "{1.0, 1.0, 0.0}{4.0, 1.0, 0.0}{4.0, 4.0, 0.0}{1.0, 4.0, 0.0}" +/// +/// @remark The Z position is optional and will be calculated dynamically based +/// on terrain height if it's not provided. +/// +/// @remark The minimum number of vertices is 3. +void NWNX_Encounter_SetGeometry(object oTrigger, string sGeometry); + /// @} +void NWNX_Encounter_Destroy(object encounter) +{ + NWNXPushObject(encounter); + NWNXCall(NWNX_Encounter, "Destroy"); +} + int NWNX_Encounter_GetNumberOfCreaturesInEncounterList(object encounter) { - string sFunc = "GetNumberOfCreaturesInEncounterList"; - - NWNX_PushArgumentObject(NWNX_Encounter, sFunc, encounter); - NWNX_CallFunction(NWNX_Encounter, sFunc); - - return NWNX_GetReturnValueInt(NWNX_Encounter, sFunc); + NWNXPushObject(encounter); + NWNXCall(NWNX_Encounter, "GetNumberOfCreaturesInEncounterList"); + return NWNXPopInt(); } struct NWNX_Encounter_CreatureListEntry NWNX_Encounter_GetEncounterCreatureByIndex(object encounter, int index) { - string sFunc = "GetEncounterCreatureByIndex"; struct NWNX_Encounter_CreatureListEntry creatureEntry; - - NWNX_PushArgumentInt(NWNX_Encounter, sFunc, index); - NWNX_PushArgumentObject(NWNX_Encounter, sFunc, encounter); - - NWNX_CallFunction(NWNX_Encounter, sFunc); - - creatureEntry.unique = NWNX_GetReturnValueInt(NWNX_Encounter, sFunc); - creatureEntry.challengeRating = NWNX_GetReturnValueFloat(NWNX_Encounter, sFunc); - creatureEntry.resref = NWNX_GetReturnValueString(NWNX_Encounter, sFunc); - + NWNXPushInt(index); + NWNXPushObject(encounter); + NWNXCall(NWNX_Encounter, "GetEncounterCreatureByIndex"); + creatureEntry.alreadyUsed = NWNXPopInt(); + creatureEntry.unique = NWNXPopInt(); + creatureEntry.challengeRating = NWNXPopFloat(); + creatureEntry.resref = NWNXPopString(); return creatureEntry; } void NWNX_Encounter_SetEncounterCreatureByIndex(object encounter, int index, struct NWNX_Encounter_CreatureListEntry creatureEntry) { - string sFunc = "SetEncounterCreatureByIndex"; - - NWNX_PushArgumentInt(NWNX_Encounter, sFunc, creatureEntry.unique); - NWNX_PushArgumentFloat(NWNX_Encounter, sFunc, creatureEntry.challengeRating); - NWNX_PushArgumentString(NWNX_Encounter, sFunc, creatureEntry.resref); - NWNX_PushArgumentInt(NWNX_Encounter, sFunc, index); - NWNX_PushArgumentObject(NWNX_Encounter, sFunc, encounter); - - NWNX_CallFunction(NWNX_Encounter, sFunc); + NWNXPushInt(creatureEntry.alreadyUsed); + NWNXPushInt(creatureEntry.unique); + NWNXPushFloat(creatureEntry.challengeRating); + NWNXPushString(creatureEntry.resref); + NWNXPushInt(index); + NWNXPushObject(encounter); + NWNXCall(NWNX_Encounter, "SetEncounterCreatureByIndex"); } int NWNX_Encounter_GetFactionId(object encounter) { - string sFunc = "GetFactionId"; - - NWNX_PushArgumentObject(NWNX_Encounter, sFunc, encounter); - NWNX_CallFunction(NWNX_Encounter, sFunc); - - return NWNX_GetReturnValueInt(NWNX_Encounter, sFunc); + NWNXPushObject(encounter); + NWNXCall(NWNX_Encounter, "GetFactionId"); + return NWNXPopInt(); } void NWNX_Encounter_SetFactionId(object encounter, int factionId) { - string sFunc = "SetFactionId"; - - NWNX_PushArgumentInt(NWNX_Encounter, sFunc, factionId); - NWNX_PushArgumentObject(NWNX_Encounter, sFunc, encounter); - - NWNX_CallFunction(NWNX_Encounter, sFunc); + NWNXPushInt(factionId); + NWNXPushObject(encounter); + NWNXCall(NWNX_Encounter, "SetFactionId"); } int NWNX_Encounter_GetPlayerTriggeredOnly(object encounter) { - string sFunc = "GetPlayerTriggeredOnly"; - - NWNX_PushArgumentObject(NWNX_Encounter, sFunc, encounter); - NWNX_CallFunction(NWNX_Encounter, sFunc); - - return NWNX_GetReturnValueInt(NWNX_Encounter, sFunc); + NWNXPushObject(encounter); + NWNXCall(NWNX_Encounter, "GetPlayerTriggeredOnly"); + return NWNXPopInt(); } void NWNX_Encounter_SetPlayerTriggeredOnly(object encounter, int playerTriggeredOnly) { - string sFunc = "SetPlayerTriggeredOnly"; - NWNX_PushArgumentInt(NWNX_Encounter, sFunc, playerTriggeredOnly); - NWNX_PushArgumentObject(NWNX_Encounter, sFunc, encounter); + NWNXPushInt(playerTriggeredOnly); + NWNXPushObject(encounter); + NWNXCall(NWNX_Encounter, "SetPlayerTriggeredOnly"); +} - NWNX_CallFunction(NWNX_Encounter, sFunc); +int NWNX_Encounter_GetCanReset(object encounter) +{ + NWNXPushObject(encounter); + NWNXCall(NWNX_Encounter, "GetCanReset"); + return NWNXPopInt(); +} + +void NWNX_Encounter_SetCanReset(object encounter, int reset) +{ + NWNXPushInt(reset); + NWNXPushObject(encounter); + NWNXCall(NWNX_Encounter, "SetCanReset"); } int NWNX_Encounter_GetResetTime(object encounter) { - string sFunc = "GetResetTime"; - - NWNX_PushArgumentObject(NWNX_Encounter, sFunc, encounter); - NWNX_CallFunction(NWNX_Encounter, sFunc); - - return NWNX_GetReturnValueInt(NWNX_Encounter, sFunc); + NWNXPushObject(encounter); + NWNXCall(NWNX_Encounter, "GetResetTime"); + return NWNXPopInt(); } void NWNX_Encounter_SetResetTime(object encounter, int resetTime) { - string sFunc = "SetResetTime"; - - NWNX_PushArgumentInt(NWNX_Encounter, sFunc, resetTime); - NWNX_PushArgumentObject(NWNX_Encounter, sFunc, encounter); - - NWNX_CallFunction(NWNX_Encounter, sFunc); + NWNXPushInt(resetTime); + NWNXPushObject(encounter); + NWNXCall(NWNX_Encounter, "SetResetTime"); +} + +int NWNX_Encounter_GetNumberOfSpawnPoints(object encounter) +{ + NWNXPushObject(encounter); + NWNXCall(NWNX_Encounter, "GetNumberOfSpawnPoints"); + return NWNXPopInt(); +} + +location NWNX_Encounter_GetSpawnPointByIndex(object encounter, int index) +{ + NWNXPushInt(index); + NWNXPushObject(encounter); + NWNXCall(NWNX_Encounter, "GetSpawnPointByIndex"); + float fOrientation = NWNXPopFloat(); + vector vPosition = NWNXPopVector(); + return Location(GetArea(encounter), vPosition, fOrientation); +} + +int NWNX_Encounter_GetMinNumSpawned(object encounter) +{ + NWNXPushObject(encounter); + NWNXCall(NWNX_Encounter, "GetMinNumSpawned"); + return NWNXPopInt(); +} + +int NWNX_Encounter_GetMaxNumSpawned(object encounter) +{ + NWNXPushObject(encounter); + NWNXCall(NWNX_Encounter, "GetMaxNumSpawned"); + return NWNXPopInt(); +} + +int NWNX_Encounter_GetCurrentNumSpawned(object encounter) +{ + NWNXPushObject(encounter); + NWNXCall(NWNX_Encounter, "GetCurrentNumSpawned"); + return NWNXPopInt(); +} + +string NWNX_Encounter_GetGeometry(object oEncounter) +{ + NWNXPushObject(oEncounter); + NWNXCall(NWNX_Encounter, "GetGeometry"); + return NWNXPopString(); +} + +void NWNX_Encounter_SetGeometry(object oEncounter, string sGeometry) +{ + NWNXPushString(sGeometry); + NWNXPushObject(oEncounter); + NWNXCall(NWNX_Encounter, "SetGeometry"); } diff --git a/_module/nss/nwnx_events.nss b/_module/nss/nwnx_events.nss index 018f6e6..41c0f47 100644 --- a/_module/nss/nwnx_events.nss +++ b/_module/nss/nwnx_events.nss @@ -1,8 +1,7 @@ -/// @addtogroup events Events +/// @addtogroup events Events /// @brief Provides an interface for plugins to create event-based systems, and exposes some events through that interface. /// @{ /// @file nwnx_events.nss -#include "nwnx" const string NWNX_Events = "NWNX_Events"; ///< @private @@ -19,17 +18,27 @@ __________________________________________ Event Data Tag | Type | Notes ----------------------|--------|------- - ASSOCIATE_OBJECT_ID | object | Convert to object with NWNX_Object_StringToObject() + ASSOCIATE_OBJECT_ID | object | Convert to object with StringToObject() _______________________________________ ## Stealth Events - - NWNX_ON_ENTER_STEALTH_BEFORE - - NWNX_ON_ENTER_STEALTH_AFTER - - NWNX_ON_EXIT_STEALTH_BEFORE - - NWNX_ON_EXIT_STEALTH_AFTER + - NWNX_ON_STEALTH_ENTER_BEFORE + - NWNX_ON_STEALTH_ENTER_AFTER + - NWNX_ON_STEALTH_EXIT_BEFORE + - NWNX_ON_STEALTH_EXIT_AFTER `OBJECT_SELF` = The creature entering or exiting stealth. + @note NWNX_ON_{ENTER|EXIT}_STEALTH_{BEFORE|AFTER} has been deprecated. Please use these new event names. +_______________________________________ + ## Detect Events + - NWNX_ON_DETECT_ENTER_BEFORE + - NWNX_ON_DETECT_ENTER_AFTER + - NWNX_ON_DETECT_EXIT_BEFORE + - NWNX_ON_DETECT_EXIT_AFTER + + `OBJECT_SELF` = The creature entering or exiting detect mode. + _______________________________________ ## Examine Events - NWNX_ON_EXAMINE_OBJECT_BEFORE @@ -39,9 +48,23 @@ _______________________________________ Event Data Tag | Type | Notes ----------------------|--------|------- - EXAMINEE_OBJECT_ID | object | Convert to object with NWNX_Object_StringToObject() + EXAMINEE_OBJECT_ID | object | Convert to object with StringToObject() TRAP_EXAMINE_SUCCESS | int | For trap examine only, whether the examine succeeded +_______________________________________ + ## Faction Events + - NWNX_ON_SET_NPC_FACTION_REPUTATION_BEFORE + - NWNX_ON_SET_NPC_FACTION_REPUTATION_AFTER + + `OBJECT_SELF` = The module + + Event Data Tag | Type | Notes + ----------------------|--------|------- + FACTION_ID | int | Not the STANDARD_FACTION_* constants. See nwnx_creature->GetFaction(). | + SUBJECT_FACTION_ID | int | Not the STANDARD_FACTION_* constants. See nwnx_creature->GetFaction(). | + PREVIOUS_REPUTATION | int | | + NEW_REPUTATION | int | Not yet clamped between 0-100. In the AFTER event, this will equal the EventResult set in the BEFORE event. | + _______________________________________ ## Validate Use Item Events - NWNX_ON_VALIDATE_USE_ITEM_BEFORE @@ -51,10 +74,14 @@ _______________________________________ Event Data Tag | Type | Notes | ------------------------|--------|-------| - ITEM_OBJECT_ID | object | Convert to object with NWNX_Object_StringToObject()| + ITEM_OBJECT_ID | object | Convert to object with StringToObject()| BEFORE_RESULT | int | TRUE/FALSE, only in _AFTER events| - @note Setting the result to "0" will cause the item to appear unusable (red) in the inventory. + @note The event result should be one of: + "0" - Equip denied + "1" - Equip okay + "2" - Swap currently equipped item + "3" - Unequip items in both hands before equipping @note Setting the result of this event will NOT prevent the item from being equipped, only used (e.g. scrolls/wands). See the "NWNX_ON_VALIDATE_ITEM_EQUIP_*" events to control equip behaviour. @note If the BEFORE event is not skipped, BEFORE_RESULT is the value of running the function normally. Otherwise, this is the set result value. @@ -67,13 +94,14 @@ _______________________________________ Event Data Tag | Type | Notes | ------------------------|--------|-------| - ITEM_OBJECT_ID | object | Convert to object with NWNX_Object_StringToObject()| - TARGET_OBJECT_ID | object | Convert to object with NWNX_Object_StringToObject()| + ITEM_OBJECT_ID | object | Convert to object with StringToObject()| + TARGET_OBJECT_ID | object | Convert to object with StringToObject()| ITEM_PROPERTY_INDEX | int | | ITEM_SUB_PROPERTY_INDEX | int | | TARGET_POSITION_X | float | | TARGET_POSITION_Y | float | | TARGET_POSITION_Z | float | | + USE_CHARGES | int | | @note You can set the event result to "0" (send feedback to the client that the item cannot be used, default) or "1" to suppress that feedback. @@ -89,7 +117,7 @@ _______________________________________ Event Data Tag | Type | Notes ----------------------|--------|------- - OWNER | object |Convert to object with NWNX_Object_StringToObject() + OWNER | object |Convert to object with StringToObject() _______________________________________ ## Ammunition Reload Events @@ -113,7 +141,8 @@ _______________________________________ Event Data Tag | Type | Notes ----------------------|--------|------- - SCROLL | object | Convert to object with NWNX_Object_StringToObject() + SCROLL | object | Convert to object with StringToObject() + RESULT | int | Returns TRUE in the _AFTER if the learning was successful, FALSE otherwise _______________________________________ ## Validate Item Equip Events @@ -124,7 +153,7 @@ _______________________________________ Event Data Tag | Type | Notes | ----------------------|--------|-------| - ITEM | object | Convert to object with NWNX_Object_StringToObject()| + ITEM_OBJECT_ID | object | Convert to object with StringToObject()| SLOT | int | INVENTORY_SLOT_* Constant| BEFORE_RESULT | int | TRUE/FALSE, only in _AFTER events| @@ -141,9 +170,12 @@ _______________________________________ Event Data Tag | Type | Notes | ----------------------|--------|-------| - ITEM | object | Convert to object with NWNX_Object_StringToObject()| + ITEM | object | Convert to object with StringToObject()| SLOT | int | | + @note This event does not run on login as the base game OnPlayerEquipItem event does. (Because this event hooks CNWSCreature::RunEquip which calls CNWSCreature::EquipItem. When the player character is first loaded, EquipItem is called directly.) + @note If the goal is to prevent items from being equiped under certain conditions, and since this event does not run on login, it could be helpful to additionally use NWNX_Creature_RunUnequip() in the OnClientEnter (or similar) event. + _______________________________________ ## Item Unequip Events - NWNX_ON_ITEM_UNEQUIP_BEFORE @@ -153,7 +185,7 @@ _______________________________________ Event Data Tag | Type | Notes ----------------------|--------|------- - ITEM | object | Convert to object with NWNX_Object_StringToObject() + ITEM | object | Convert to object with StringToObject() @note These events do not trigger when equipment is replaced by equipping another item. _______________________________________ @@ -176,7 +208,7 @@ _______________________________________ Event Data Tag | Type | Notes ----------------------|--------|------- - ITEM | object |Convert to object with NWNX_Object_StringToObject() + ITEM | object |Convert to object with StringToObject() _______________________________________ ## Item Pay To Identify Events @@ -187,8 +219,8 @@ _______________________________________ Event Data Tag | Type | Notes ----------------------|--------|------- - ITEM | object | Convert to object with NWNX_Object_StringToObject() - STORE | object | Convert to object with NWNX_Object_StringToObject() + ITEM | object | Convert to object with StringToObject() + STORE | object | Convert to object with StringToObject() _______________________________________ ## Item Split Events @@ -199,9 +231,36 @@ _______________________________________ Event Data Tag | Type | Notes| ----------------------|--------|-------| - ITEM | object | Convert to object with NWNX_Object_StringToObject()| + ITEM | object | Convert to object with StringToObject()| NUMBER_SPLIT_OFF | int | | +_______________________________________ + ## Item Merge Events + - NWNX_ON_ITEM_MERGE_BEFORE + - NWNX_ON_ITEM_MERGE_AFTER + + `OBJECT_SELF` = The player attempting to merge an item + + Event Data Tag | Type | Notes | + ----------------------|--------|-----------------------------------------------------------------------------------| + ITEM_TO_MERGE_INTO | object | Convert to object with StringToObject() | + ITEM_TO_MERGE | object | Convert to object with StringToObject() (May be OBJECT_INVALID in the AFTER event)| + +_______________________________________ + ## Acquire Item Events + - NWNX_ON_ITEM_ACQUIRE_BEFORE + - NWNX_ON_ITEM_ACQUIRE_AFTER + + `OBJECT_SELF` = The creature trying to acquire the item + + Event Data Tag | Type | Notes | + ----------------------|--------|-------| + ITEM | object | Convert to object with StringToObject() (May be OBJECT_INVALID in the AFTER event) | + GIVER | object | Convert to object with StringToObject() (will be INVALID if picked up from ground)| + RESULT | int | Returns TRUE in the _AFTER if the acquisition was successful, FALSE otherwise + + @note This event currently only works with creatures + _______________________________________ ## Feat Use Events - NWNX_ON_USE_FEAT_BEFORE @@ -213,12 +272,34 @@ _______________________________________ ----------------------|--------|-------| FEAT_ID | int | | SUBFEAT_ID | int | | - TARGET_OBJECT_ID | object | Convert to object with NWNX_Object_StringToObject() | - AREA_OBJECT_ID | object | Convert to object with NWNX_Object_StringToObject() | + TARGET_OBJECT_ID | object | Convert to object with StringToObject() | + AREA_OBJECT_ID | object | Convert to object with StringToObject() | TARGET_POSITION_X | float | | TARGET_POSITION_Y | float | | TARGET_POSITION_Z | float | | + ACTION_RESULT | int | TRUE/FALSE, only in _AFTER events +_______________________________________ + ## Has Feat Events + - NWNX_ON_HAS_FEAT_BEFORE + - NWNX_ON_HAS_FEAT_AFTER + + `OBJECT_SELF` = The player being checked for the feat + + Event Data Tag | Type | Notes | + ----------------------|--------|-------| + FEAT_ID | int | | + HAS_FEAT | int | Whether they truly have the feat or not | + + @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 Feat ID to the whitelist on module load this event will not function. + For example if you wish an event to fire when nwn is checking if the creature has Epic Dodge you would perform + the following functions on_module_load. + ```c + NWNX_Events_SubscribeEvent("NWNX_ON_HAS_FEAT_BEFORE", "event_has_feat"); + NWNX_Events_AddIDToWhitelist("NWNX_ON_HAS_FEAT", FEAT_EPIC_DODGE); + ``` + @warning Toggling the Whitelist to be off for this event will degrade performance. _______________________________________ ## DM Give Events - NWNX_ON_DM_GIVE_GOLD_BEFORE @@ -235,7 +316,7 @@ _______________________________________ Event Data Tag | Type | Notes | ----------------------|--------|-------| AMOUNT | int | | - OBJECT | object | Convert to object with NWNX_Object_StringToObject() | + OBJECT | object | Convert to object with StringToObject() | ALIGNMENT_TYPE | int | Only valid for `NWNX_ON_DM_GIVE_ALIGNMENT_*` | _______________________________________ @@ -247,12 +328,15 @@ _______________________________________ Event Data Tag | Type | Notes | ----------------------|--------|-------| - AREA | object | Convert to object with NWNX_Object_StringToObject() | + AREA | object | Convert to object with StringToObject() | OBJECT | object | Only returns a valid object in *_AFTER | OBJECT_TYPE | int | Returns `NWNX_EVENTS_OBJECT_TYPE_*` | POS_X | float | | POS_Y | float | | POS_Z | float | | + RESREF | string | The resref of the object that's being spawned. | + + @note When spawning a standard trap, the resref will be an index into traps.2da. _______________________________________ ## DM Give Item Events @@ -263,7 +347,7 @@ _______________________________________ Event Data Tag | Type | Notes ----------------------|--------|------- - TARGET | object | Convert to object with NWNX_Object_StringToObject() + TARGET | object | Convert to object with StringToObject() ITEM | object | Only returns a valid object in *_AFTER _______________________________________ @@ -307,7 +391,7 @@ _______________________________________ Event Data Tag | Type | Notes ----------------------|--------|------- - TARGET | object | Convert to object with NWNX_Object_StringToObject() + TARGET | object | Convert to object with StringToObject() @note If `TARGET` is `OBJECT_INVALID` for `NWNX_ON_DM_POSSESS_*`, the DM is unpossessing. @@ -324,7 +408,7 @@ _______________________________________ Event Data Tag | Type | Notes | ----------------------|--------|-------| - TARGET_AREA | object | Convert to object with NWNX_Object_StringToObject() | + TARGET_AREA | object | Convert to object with StringToObject() | POS_X | float | | POS_Y | float | | POS_Z | float | | @@ -352,7 +436,7 @@ _______________________________________ Event Data Tag | Type | Notes ----------------------|--------|------- OPEN_INVENTORY | int | TRUE if opening an inventory, FALSE if closing - TARGET | object | Convert to object with NWNX_Object_StringToObject() + TARGET | object | Convert to object with StringToObject() _______________________________________ ## DM Spawn Trap Events @@ -363,8 +447,8 @@ _______________________________________ Event Data Tag | Type | Notes ----------------------|--------|------- - AREA | object | Convert to object with NWNX_Object_StringToObject() - TARGET | object | Convert to object with NWNX_Object_StringToObject() + AREA | object | Convert to object with StringToObject() + TARGET | object | Convert to object with StringToObject() _______________________________________ ## DM Dump Locals Events @@ -376,26 +460,89 @@ _______________________________________ Event Data Tag | Type | Notes ----------------------|--------|------- TYPE | int | 0 = dm_dumplocals, 1 = dm_dumparealocals, 3 = dm_dumpmodulelocals - TARGET | object | Convert to object with NWNX_Object_StringToObject() + TARGET | object | Convert to object with StringToObject() Note: For TYPE 1/2, use GetArea(TARGET) or GetModule() +_______________________________________ + ## DM PlayerDM Login/Logout Events + - NWNX_ON_DM_PLAYERDM_LOGIN_BEFORE + - NWNX_ON_DM_PLAYERDM_LOGIN_AFTER + - NWNX_ON_DM_PLAYERDM_LOGOUT_BEFORE + - NWNX_ON_DM_PLAYERDM_LOGOUT_AFTER + + `OBJECT_SELF` = The DM + + Event Data Tag | Type | Notes + ----------------------|--------|------- + PASSWORD | string | The password the DM provided, only valid for NWNX_ON_DM_PLAYERDM_LOGIN_* + +_______________________________________ + ## DM Set Stat Events + - NWNX_ON_DM_SET_STAT_BEFORE + - NWNX_ON_DM_SET_STAT_AFTER + + `OBJECT_SELF` = The DM + + Event Data Tag | Type | Notes + ----------------------|--------|------- + STAT | int | Returns ABILITY_* constant + VALUE | int | + TARGET | object | Convert to object with StringToObject() + SET | int | TRUE if setting stat, FALSE if modifying + +_______________________________________ + ## DM Get Variable Events + - NWNX_ON_DM_GET_VARIABLE_BEFORE + - NWNX_ON_DM_GET_VARIABLE_AFTER + + `OBJECT_SELF` = The DM + + Event Data Tag | Type | Notes + ----------------------|--------|------- + TYPE | int | Returns NWNX_EVENTS_DM_SET_VARIABLE_TYPE_* + TARGET | object | Convert to object with StringToObject() + KEY | string | Variable name + + @note Vector variable types aren't supported. + +_______________________________________ + ## DM Set Variable Events + - NWNX_ON_DM_SET_VARIABLE_BEFORE + - NWNX_ON_DM_SET_VARIABLE_AFTER + + `OBJECT_SELF` = The DM + + Event Data Tag | Type | Notes + ----------------------|--------|------- + TYPE | int | Returns NWNX_EVENTS_DM_SET_VARIABLE_TYPE_* + TARGET | object | Convert to object with StringToObject() + KEY | string | Variable name + VALUE | string | Variable value + + @note Vector variable types aren't supported. + +_______________________________________ + ## DM Set Faction Events + - NWNX_ON_DM_SET_FACTION_BEFORE + - NWNX_ON_DM_SET_FACTION_AFTER + + `OBJECT_SELF` = The DM + + 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 | + _______________________________________ ## DM Other Events - NWNX_ON_DM_APPEAR_BEFORE - NWNX_ON_DM_APPEAR_AFTER - NWNX_ON_DM_DISAPPEAR_BEFORE - NWNX_ON_DM_DISAPPEAR_AFTER - - NWNX_ON_DM_SET_FACTION_BEFORE - - NWNX_ON_DM_SET_FACTION_AFTER - NWNX_ON_DM_TAKE_ITEM_BEFORE - NWNX_ON_DM_TAKE_ITEM_AFTER - - NWNX_ON_DM_SET_STAT_BEFORE - - NWNX_ON_DM_SET_STAT_AFTER - - NWNX_ON_DM_GET_VARIABLE_BEFORE - - NWNX_ON_DM_GET_VARIABLE_AFTER - - NWNX_ON_DM_SET_VARIABLE_BEFORE - - NWNX_ON_DM_SET_VARIABLE_AFTER - NWNX_ON_DM_SET_TIME_BEFORE - NWNX_ON_DM_SET_TIME_AFTER - NWNX_ON_DM_SET_DATE_BEFORE @@ -414,6 +561,11 @@ _______________________________________ `OBJECT_SELF` = The player disconnecting from the server + Event Data Tag | Type | Notes + ----------------------|--------|------- + PLAYER_NAME | string | Player name of the disconnecting client + CDKEY | string | Public cdkey of the disconnecting client + @note This event also runs when a player connects to the server but cancels out of character select. OBJECT_SELF will be OBJECT_INVALID in this case. @@ -430,10 +582,25 @@ _______________________________________ CDKEY | string | Public cdkey of the connecting client IS_DM | int | Whether the client is connect as DM (1/0) 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. You can optionally pass a reason for this in the event result. +_______________________________________ + ## CombatEnter/Exit Events + - NWNX_ON_COMBAT_ENTER_BEFORE + - NWNX_ON_COMBAT_ENTER_AFTER + - NWNX_ON_COMBAT_EXIT_BEFORE + - NWNX_ON_COMBAT_EXIT_AFTER + + `OBJECT_SELF` = The player entering/exiting combat. + + @note Only works for PCs. + _______________________________________ ## Combat Round Start Events - NWNX_ON_START_COMBAT_ROUND_BEFORE @@ -443,7 +610,20 @@ _______________________________________ Event Data Tag | Type | Notes ----------------------|--------|------- - TARGET_OBJECT_ID | object | Convert to object with NWNX_Object_StringToObject() + TARGET_OBJECT_ID | object | Convert to object with StringToObject() + +_______________________________________ + ## Disarm Events + - NWNX_ON_DISARM_BEFORE + - NWNX_ON_DISARM_AFTER + + `OBJECT_SELF` = The creature who is being disarmed + + Event Data Tag | Type | Notes + ----------------------|--------|------- + DISARMER_OBJECT_ID | object | The object disarming the creature + FEAT_ID | int | The feat used to perform the disarming (Normal vs Improved Disarm) + ACTION_RESULT | int | TRUE/FALSE, only in _AFTER events _______________________________________ ## Cast Spell Events @@ -458,8 +638,8 @@ _______________________________________ TARGET_POSITION_X | float | | TARGET_POSITION_Y | float | | TARGET_POSITION_Z | float | | - TARGET_OBJECT_ID | object | Convert to object with NWNX_Object_StringToObject() | - ITEM_OBJECT_ID | object | Convert to object with NWNX_Object_StringToObject() | + TARGET_OBJECT_ID | object | Convert to object with StringToObject() | + ITEM_OBJECT_ID | object | Convert to object with StringToObject() | MULTI_CLASS | int | | SPELL_COUNTERED | int | Returns TRUE if spell was countered else FALSE | COUNTERING_SPELL | int | Returns TRUE if cast as counter else FALSE | @@ -477,8 +657,7 @@ _______________________________________ Event Data Tag | Type | Notes | ----------------------|--------|-------| - SPELL_MULTICLASS | int | Index of the spell casting class (0-2) | - SPELL_LEVEL | int | | + SPELL_MULTICLASS | int | Index of the spell casting class (0-7) | SPELL_SLOT | int | | SPELL_ID | int | | SPELL_DOMAIN | int | | @@ -495,10 +674,52 @@ _______________________________________ 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 | | +_______________________________________ + ## Spell Interrupted Events + - NWNX_ON_SPELL_INTERRUPTED_BEFORE + - NWNX_ON_SPELL_INTERRUPTED_AFTER + + `OBJECT_SELF` = The creature whose spell was interrupted + + Event Data Tag | Type | Notes | + ----------------------|--------|-------| + SPELL_ID | int | | + SPELL_CLASS | int | Index of the spell casting class (0-2) | + SPELL_DOMAIN | int | | + SPELL_METAMAGIC | int | | + 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 @@ -508,12 +729,24 @@ _______________________________________ Event Data Tag | Type | Notes | ----------------------|--------|-------| - TARGET_OBJECT_ID | object | Convert to object with NWNX_Object_StringToObject() | - ITEM_OBJECT_ID | object | Convert to object with NWNX_Object_StringToObject() | + TARGET_OBJECT_ID | object | Convert to object with StringToObject() | + ITEM_OBJECT_ID | object | Convert to object with StringToObject() | ITEM_PROPERTY_INDEX | int | | MOVE_TO_TARGET | int | | ACTION_RESULT | int | | +_______________________________________ + ## Healing Events + - NWNX_ON_HEAL_BEFORE + - NWNX_ON_HEAL_AFTER + + `OBJECT_SELF` = The creature performing the heal + + Event Data Tag | Type | Notes | + ----------------------|--------|-------| + TARGET_OBJECT_ID | object | Convert to object with StringToObject() | + HEAL_AMOUNT | int | How many HP the heal will provide | + _______________________________________ ## Party Action Events - NWNX_ON_PARTY_*_BEFORE @@ -525,14 +758,14 @@ _______________________________________ Event | Event Data Tag | Type | Notes | ----------------|-----------------------|--------|-------| - LEAVE | LEAVING | object | Convert to object with NWNX_Object_StringToObject() | - KICK | KICKED | object | Convert to object with NWNX_Object_StringToObject() | - TRANSFER_LEADERSHIP | NEW_LEADER | object | Convert to object with NWNX_Object_StringToObject() | - INVITE | INVITED | object | Convert to object with NWNX_Object_StringToObject() | - IGNORE_INVITATION | INVITED_BY | object | Convert to object with NWNX_Object_StringToObject() | - ACCEPT_INVITATION | INVITED_BY | object | Convert to object with NWNX_Object_StringToObject() | - REJECT_INVITATION | INVITED_BY | object | Convert to object with NWNX_Object_StringToObject() | - KICK_HENCHMAN | INVITED_BY | object | Convert to object with NWNX_Object_StringToObject() | + LEAVE | LEAVING | object | Convert to object with StringToObject() | + KICK | KICKED | object | Convert to object with StringToObject() | + TRANSFER_LEADERSHIP | NEW_LEADER | object | Convert to object with StringToObject() | + INVITE | INVITED | object | Convert to object with StringToObject() | + IGNORE_INVITATION | INVITED_BY | object | Convert to object with StringToObject() | + ACCEPT_INVITATION | INVITED_BY | object | Convert to object with StringToObject() | + REJECT_INVITATION | INVITED_BY | object | Convert to object with StringToObject() | + KICK_HENCHMAN | INVITED_BY | object | Convert to object with StringToObject() | _______________________________________ ## Combat Mode Toggle Events @@ -561,8 +794,6 @@ _______________________________________ DIRTY_FIGHTING | 10 DEFENSIVE_STANCE | 11 - @note Requires @ref combatmodes "NWNX_CombatModes" plugin to work. - _______________________________________ ## Use Skill Events - NWNX_ON_USE_SKILL_BEFORE @@ -572,13 +803,14 @@ _______________________________________ Event Data Tag | Type | Notes | ----------------------|--------|-------| - USED_ITEM_OBJECT_ID | object | Convert to object with NWNX_Object_StringToObject() | - TARGET_OBJECT_ID | object | Convert to object with NWNX_Object_StringToObject() | + USED_ITEM_OBJECT_ID | object | Convert to object with StringToObject() | + TARGET_OBJECT_ID | object | Convert to object with StringToObject() | SKILL_ID | int | | SUB_SKILL_ID | int | | TARGET_POSITION_X | float | | TARGET_POSITION_Y | float | | TARGET_POSITION_Z | float | | + ACTION_RESULT | int | TRUE/FALSE, only in _AFTER events @note Probably only really works with the following activated skills: `SKILL_ANIMAL_EMPATHY`, `SKILL_DISABLE_TRAP`, `SKILL_HEAL`, `SKILL_OPEN_LOCK`, @@ -613,7 +845,7 @@ _______________________________________ Event Data Tag | Type | Notes ----------------------|--------|------- - TARGET | object | Convert to object with NWNX_Object_StringToObject() + TARGET | object | Convert to object with StringToObject() TARGET_INVISIBLE | int | TRUE/FALSE BEFORE_RESULT | int | TRUE/FALSE, only in _AFTER events @@ -648,7 +880,7 @@ _______________________________________ Event Data Tag | Type | Notes | ----------------------|--------|-------| UNIQUE_ID | int | | - CREATOR | object | Convert to object with NWNX_Object_StringToObject() | + CREATOR | object | Convert to object with StringToObject() | TYPE | int | The effect type, does not match NWScript constants See: https://github.com/nwnxee/unified/blob/master/NWNXLib/API/Constants/Effect.hpp#L8 | SUB_TYPE | int | SUBTYPE_* | DURATION_TYPE | int | DURATION_TYPE_* | @@ -659,7 +891,7 @@ _______________________________________ INT_PARAM_* | int | * = 1-8 | FLOAT_PARAM_* | float | * = 1-4 | STRING_PARAM_* | string | * = 1-6 | - OBJECT_PARAM_* | object | * = 1-4, Convert to object with NWNX_Object_StringToObject() | + OBJECT_PARAM_* | object | * = 1-4, Convert to object with StringToObject() | @note Only fires for Temporary or Permanent effects, does not include VisualEffects or ItemProperty effects. @@ -721,9 +953,20 @@ _______________________________________ BARTER_COMPLETE | int | TRUE/FALSE - whether the barter completed successfully BARTER_INITIATOR_ITEM_COUNT | int | How many items the initiator traded away, only in _BEFORE events BARTER_TARGET_ITEM_COUNT | int | How many items the target traded away, only in _BEFORE events - BARTER_INITIATOR_ITEM_* | object | Convert to object with NWNX_Object_StringToObject(), only in _BEFORE events - BARTER_TARGET_ITEM_* | object | Convert to object with NWNX_Object_StringToObject(), only in _BEFORE events + 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 @@ -743,7 +986,12 @@ _______________________________________ Event Data Tag | Type | Notes ----------------------|--------|------- - TRAP_OBJECT_ID | object | Convert to object with NWNX_Object_StringToObject() + 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) @@ -842,7 +1090,7 @@ _______________________________________ Event Data Tag | Type | Notes ----------------------|--------|------- - ITEM | object | Convert to object with NWNX_Object_StringToObject() + ITEM | object | Convert to object with StringToObject() _______________________________________ ## Gold Events @@ -869,7 +1117,7 @@ _______________________________________ Event Data Tag | Type | Notes ----------------------|--------|------- - TARGET_OBJECT_ID | object | Convert to object with NWNX_Object_StringToObject() + TARGET_OBJECT_ID | object | Convert to object with StringToObject() ATTITUDE | int | 0 = Dislike, 1 = Like _______________________________________ @@ -881,7 +1129,7 @@ _______________________________________ Event Data Tag | Type | Notes | ----------------------|--------|-------| - AREA | object | Convert to object with NWNX_Object_StringToObject() | + AREA | object | Convert to object with StringToObject() | POS_X | float | | POS_Y | float | | POS_Z | float | | @@ -910,7 +1158,7 @@ _______________________________________ Event Data Tag | Type | Notes ----------------------|--------|------- - TARGET | object | Convert to object with NWNX_Object_StringToObject() + TARGET | object | Convert to object with StringToObject() PASSIVE | int | TRUE / FALSE CLEAR_ALL_ACTIONS | int | TRUE / FALSE ADD_TO_FRONT | int | TRUE / FALSE @@ -924,10 +1172,10 @@ _______________________________________ Event Data Tag | Type | Notes ----------------------|--------|------- - TARGET | object | Convert to object with NWNX_Object_StringToObject() + TARGET | object | Convert to object with StringToObject() _______________________________________ - ## Input Cast Spell Evens + ## Input Cast Spell Events - NWNX_ON_INPUT_CAST_SPELL_BEFORE - NWNX_ON_INPUT_CAST_SPELL_AFTER @@ -935,21 +1183,21 @@ _______________________________________ Event Data Tag | Type | Notes ----------------------|--------|------- - TARGET | object | Convert to object with NWNX_Object_StringToObject() - SPELL_ID | int | - MULTICLASS | int | - DOMAIN_LEVEL | int | - META_TYPE | int | - INSTANT | int | TRUE / FALSE - PROJECTILE_PATH | int | - SPONTANEOUS | int | TRUE / FALSE - FAKE | int | TRUE / FALSE - FEAT | int | -1 when not cast from a feat - CASTER_LEVEL | int | - IS_AREA_TARGET | int | TRUE / FALSE - POS_X | float | - POS_Y | float | - POS_Z | float | + TARGET | object | Convert to object with StringToObject() | + SPELL_ID | int | | + MULTICLASS | int | | + DOMAIN_LEVEL | int | | + META_TYPE | int | | + INSTANT | int | TRUE / FALSE | + PROJECTILE_PATH | int | | + SPONTANEOUS | int | TRUE / FALSE | + FAKE | int | TRUE / FALSE | + FEAT | int | -1 when not cast from a feat | + CASTER_LEVEL | int | | + IS_AREA_TARGET | int | TRUE / FALSE | + POS_X | float | | + POS_Y | float | | + POS_Z | float | | @note This event runs the moment a creature starts casting @@ -972,7 +1220,20 @@ _______________________________________ NWNX_Object_SetPosition(oPlayer, GetPositionFromLocation(locPlayer)); ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectVisualEffect(VFX_DUR_CUTSCENE_INVISIBILITY), oBoulder); - _______________________________________ +_______________________________________ + ## Input Keyboard Events + - NWNX_ON_INPUT_TOGGLE_PAUSE_BEFORE + - NWNX_ON_INPUT_TOGGLE_PAUSE_AFTER + + `OBJECT_SELF` = The player or DM + + Event Data Tag | Type | Notes + ----------------------|--------|------- + PAUSE_STATE | int | TRUE = Pausing, FALSE = Unpausing + + @note This event also fires when a non-dm player presses the spacebar. + +_______________________________________ ## Object Lock Events - NWNX_ON_OBJECT_LOCK_BEFORE - NWNX_ON_OBJECT_LOCK_AFTER @@ -981,7 +1242,8 @@ _______________________________________ Event Data Tag | Type | Notes ----------------------|--------|------- - DOOR | object | Convert to object with NWNX_Object_StringToObject() + DOOR | object | Convert to object with StringToObject() + ACTION_RESULT | int | TRUE/FALSE, only in _AFTER events _______________________________________ ## Object Unlock Events @@ -992,9 +1254,10 @@ _______________________________________ Event Data Tag | Type | Notes ----------------------|--------|------- - DOOR | object | Convert to object with NWNX_Object_StringToObject() - THIEVES_TOOL | object | Convert to object with NWNX_Object_StringToObject() - ACTIVE_PROPERTY_INDEX | int | + DOOR | object | Convert to object with StringToObject() | + THIEVES_TOOL | object | Convert to object with StringToObject() | + ACTIVE_PROPERTY_INDEX | int | | + ACTION_RESULT | int | TRUE/FALSE, only in _AFTER events | _______________________________________ ## UUID Collision Events @@ -1020,11 +1283,11 @@ _______________________________________ Event Data Tag | Type | Notes ----------------------|--------|------- - ALIAS | string | NWNX for /nwnx, DEVELOPMENT for /development + ALIAS | string | NWNX for /nwnx, DEVELOPMENT for /development. Also supports valid aliases from the Custom Resman Definition File RESREF | string | The ResRef of the file TYPE | int | The type of the file, see NWNX_UTIL_RESREF_TYPE_* - Note: These events fire when a file gets added/removed/modified in the /nwnx or /development folder + Note: These events fire when a file gets added/removed/modified in resource folders like /nwnx, /development and those defined in the Custom Resman Definition File _______________________________________ ## ELC Events @@ -1068,8 +1331,817 @@ _______________________________________ NEW | int | The (Hour/Day/Month/Year) after the change. Not available in DAWN/DUSK. _______________________________________ + ## Broadcast Spell Cast Events + - NWNX_ON_BROADCAST_CAST_SPELL_BEFORE + - NWNX_ON_BROADCAST_CAST_SPELL_AFTER + + `OBJECT_SELF` = The creature casting the spell + + Event Data Tag | Type | Notes | + ----------------------|--------|-------| + 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 + - NWNX_ON_DEBUG_RUN_SCRIPT_AFTER + + `OBJECT_SELF` = The player executing the RunScript debug command + + Event Data Tag | Type | Notes | + ----------------------|--------|-------| + SCRIPT_NAME | string | The script to execute | + TARGET | object | The target to run the script on. Convert to object with StringToObject() | + + @note This event also runs for players that do not have permission to execute the command. + +_______________________________________ + ## RunScriptChunk Debug Event + - NWNX_ON_DEBUG_RUN_SCRIPT_CHUNK_BEFORE + - NWNX_ON_DEBUG_RUN_SCRIPT_CHUNK_AFTER + + `OBJECT_SELF` = The player executing the RunScriptChunk debug command + + Event Data Tag | Type | Notes | + ----------------------|--------|-------| + SCRIPT_CHUNK | string | The script chunk | + TARGET | object | The target to run the script chunk on. Convert to object with StringToObject() | + WRAP_INTO_MAIN | int | TRUE if the WrapIntoMain checkbox is checked, otherwise FALSE | + + @note This event also runs for players that do not have permission to execute the command. + +_______________________________________ + ## Play Visual Effect Event + - NWNX_ON_DEBUG_PLAY_VISUAL_EFFECT_BEFORE + - NWNX_ON_DEBUG_PLAY_VISUAL_EFFECT_AFTER + + `OBJECT_SELF` = The DM + + 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 + + @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. + +_______________________________________ + ## Buy/Sell Store Events + - NWNX_ON_STORE_REQUEST_BUY_BEFORE + - NWNX_ON_STORE_REQUEST_BUY_AFTER + - NWNX_ON_STORE_REQUEST_SELL_BEFORE + - NWNX_ON_STORE_REQUEST_SELL_AFTER + + `OBJECT_SELF` = The creature buying or selling an item + + Event Data Tag | Type | Notes | + ----------------------|--------|-------| + ITEM | object | The item being bought or sold. Convert to object with StringToObject() | + STORE | object | The store the item is being sold to or bought from. Convert to object with StringToObject() | + 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 + - NWNX_ON_SERVER_SEND_AREA_AFTER + + `OBJECT_SELF` = The player + + Event Data Tag | Type | Notes + ----------------------|--------|------- + AREA | object | The area the server is sending. Convert to object with StringToObject() | + PLAYER_NEW_TO_MODULE | int | TRUE if it's the player's first time logging into the server since a restart | + +_______________________________________ + ## Journal Open/Close Events + - NWNX_ON_JOURNAL_OPEN_BEFORE + - NWNX_ON_JOURNAL_OPEN_AFTER + - NWNX_ON_JOURNAL_CLOSE_BEFORE + - NWNX_ON_JOURNAL_CLOSE_AFTER + + `OBJECT_SELF` = The player + + Event Data Tag | Type | Notes + ----------------------|--------|------- + +_______________________________________ + ## Input Emote Event + - NWNX_ON_INPUT_EMOTE_BEFORE + - NWNX_ON_INPUT_EMOTE_AFTER + + `OBJECT_SELF` = The creature using a radial menu emote + + Event Data Tag | Type | Notes + ----------------------|--------|------- + ANIMATION | int | An engine animation constant, convent to NWScript animation constant with NWNX_Consts_TranslateEngineAnimation() | + + @note Some emotes have a voiceline that will still play when the event is skipped. These voicelines can be skipped in the NWNX_ON_QUICKCHAT_* event. + +_______________________________________ + ## Combat Damage Resistance/Reduction Broken Event + - NWNX_ON_COMBAT_DR_BROKEN_BEFORE + - NWNX_ON_COMBAT_DR_BROKEN_AFTER + + `OBJECT_SELF` = The creature whose DR gets broken + + Event Data Tag | Type | Notes + ----------------------|--------|------- + TYPE | int | 1 for DamageResistance, 0 for DamageReduction | + + @note This event only fires when DR gets broken in combat. + +_______________________________________ + ## Creature Unpossess Familiar Event + - NWNX_ON_UNPOSSESS_FAMILIAR_BEFORE + - NWNX_ON_UNPOSSESS_FAMILIAR_AFTER + + `OBJECT_SELF` = The creature unpossessing a familiar + + Event Data Tag | Type | Notes + ----------------------|--------|------- + FAMILIAR | object | The familiar. Convert to object with StringToObject() | + +_______________________________________ + ## Client Levelup Begin Event + - NWNX_ON_CLIENT_LEVEL_UP_BEGIN_BEFORE + - NWNX_ON_CLIENT_LEVEL_UP_BEGIN_AFTER + + `OBJECT_SELF` = The player clicking the levelup button + + Event Data Tag | Type | Notes + ----------------------|--------|------- + +_______________________________________ + ## Creature Possess Familiar Event + - NWNX_ON_POSSESS_FAMILIAR_BEFORE + - NWNX_ON_POSSESS_FAMILIAR_AFTER + + `OBJECT_SELF` = The creature possessing a familiar + + Event Data Tag | Type | Notes + ----------------------|--------|------- + FAMILIAR | object | The familiar. Convert to object with StringToObject() | +_______________________________________ + ## Player CharacterSheet Permitted Event + - NWNX_ON_CHARACTER_SHEET_PERMITTED_BEFORE + - NWNX_ON_CHARACTER_SHEET_PERMITTED_AFTER + + `OBJECT_SELF` = The player trying to view a charactersheet + + Event Data Tag | Type | Notes + ----------------------|--------|------- + TARGET | object | Convert to object with StringToObject() | + + @note When skipping this event, be sure to set the event result. +_______________________________________ + ## Player CharacterSheet Open/Close Events + - NWNX_ON_CHARACTER_SHEET_OPEN_BEFORE + - NWNX_ON_CHARACTER_SHEET_OPEN_AFTER + - NWNX_ON_CHARACTER_SHEET_CLOSE_BEFORE + - NWNX_ON_CHARACTER_SHEET_CLOSE_AFTER + + `OBJECT_SELF` = The player opening or closing a charactersheet + + Event Data Tag | Type | Notes + ----------------------|--------|------- + TARGET | object | Convert to object with StringToObject() | +_______________________________________ + ## Player Device Property Events + - NWNX_ON_CLIENT_SET_DEVICE_PROPERTY_BEFORE + - NWNX_ON_CLIENT_SET_DEVICE_PROPERTY_AFTER + + `OBJECT_SELF` = The player changing a device property (window size/gui scale) + + Event Data Tag | Type | Notes + ----------------------|--------|------- + PROPERTY | string | A PLAYER_DEVICE_PROPERTY_GUI_* constant | + OLD_VALUE | int | | + NEW_VALUE | int | | +_______________________________________ + ## Input Drop Item Events + - NWNX_ON_INPUT_DROP_ITEM_BEFORE + - NWNX_ON_INPUT_DROP_ITEM_AFTER + + `OBJECT_SELF` = The player dropping an item + + Event Data Tag | Type | Notes + ----------------------|--------|------- + ITEM | object | Convert to object with StringToObject() | + POS_X | float | | + POS_Y | float | | + POS_Z | float | | +_______________________________________ + ## Decrement Spell Count Events + - NWNX_ON_DECREMENT_SPELL_COUNT_BEFORE + - NWNX_ON_DECREMENT_SPELL_COUNT_AFTER + + `OBJECT_SELF` = The player losing a spell slot + + Event Data Tag | Type | Notes + ----------------------|--------|------- + SPELL_ID | int | | + CLASS | int | Index of the spell casting class (0-2). Returns 254 for spell-like abilities | + DOMAIN | int | Spell level if non-default due to Domain | + METAMAGIC | int | | + CASTERLEVEL | int | Only returns for spell-like abilities | +_______________________________________ + ## EventScript Events + - NWNX_ON_RUN_EVENT_SCRIPT_BEFORE + - NWNX_ON_RUN_EVENT_SCRIPT_AFTER + + `OBJECT_SELF` = The object the event script is running on + + Event Data Tag | Type | Notes + ----------------------|--------|------- + 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 + NWNX_Events_SubscribeEvent("NWNX_ON_RUN_EVENT_SCRIPT_BEFORE", "creature_hb_ovr"); + NWNX_Events_AddIDToWhitelist("NWNX_ON_RUN_EVENT_SCRIPT", EVENT_SCRIPT_MODULE_ON_HEARTBEAT); + ``` + @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 +_______________________________________ + ## SetExperience Events + - NWNX_ON_SET_EXPERIENCE_BEFORE + - NWNX_ON_SET_EXPERIENCE_AFTER + + `OBJECT_SELF` = The player the xp is being set on + + Event Data Tag | Type | Notes + ----------------------|--------|------- + XP | int | The xp value to be set. | + + @note To set a different xp value in the BEFORE event: Skip the event and call NWNX_Events_SetEventResult() with the new value. +_______________________________________ + ## 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; @@ -1077,9 +2149,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; @@ -1089,7 +2163,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. /// @@ -1104,12 +2216,32 @@ 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). +/// Others can be signalled via script code via NWNX_Events_SignalEvent(). +/// @param sEvent The event name. +/// @param sScriptChunk The script chunk to execute when the event fires. +/// @param bWrapIntoMain TRUE if the script chunk needs to be wrapped into a void main(){}. +void NWNX_Events_SubscribeEventScriptChunk(string sEvent, string sScriptChunk, int bWrapIntoMain = TRUE); + +/// @brief Unsubscribe a script chunk from an event +/// @param sEvent The event name. +/// @param sScriptChunk The script chunk. +/// @param bWrapIntoMain TRUE if the script chunk needs to be wrapped into a void main(){}. Must match the value used when subscribing. +void NWNX_Events_UnsubscribeEventScriptChunk(string sEvent, string sScriptChunk, int bWrapIntoMain = TRUE); + /// Pushes event data at the provided tag, which subscribers can access with GetEventData. /// This should be called BEFORE SignalEvent. void NWNX_Events_PushEventData(string tag, string data); /// Signals an event. This will dispatch a notification to all subscribed handlers. /// Returns TRUE if anyone was subscribed to the event, FALSE otherwise. +/// @remark target will be available as OBJECT_SELF in subscribed event scripts. int NWNX_Events_SignalEvent(string evt, object target); /// Retrieves the event data for the currently executing script. @@ -1128,7 +2260,7 @@ string NWNX_Events_GetEventData(string tag); /// ONLY WORKS WITH THE FOLLOWING EVENTS: /// - Feat events /// - Item events -/// - Healer's Kit event +/// - Healing events /// - CombatMode events /// - Party events /// - Skill events @@ -1138,9 +2270,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 @@ -1149,6 +2281,24 @@ string NWNX_Events_GetEventData(string tag); /// - {Enter|Exit}Stealth events /// - Object {Lock|Unlock} events /// - Quickbar Events +/// - Input Pause Event +/// - Input Emote Event +/// - Debug events +/// - Store events +/// - Disarm event +/// - {Enter|Exit}Detect events +/// - Faction events +/// - UnpossessFamiliar event +/// - ClientLevelUpBegin event +/// - CharacterSheetPermitted event +/// - Input Drop Item +/// - Decrement Spell Count event +/// - Play Visual Effect event +/// - EventScript event +/// - Broadcast Safe Projectile event +/// - Attack of Opportunity events +/// - Creature Jump events +/// - SetExperience Events void NWNX_Events_SkipEvent(); /// Set the return value of the event. @@ -1163,6 +2313,12 @@ void NWNX_Events_SkipEvent(); /// - Ammo Reload event -> Forced ammunition returned /// - Trap events -> "1" or "0" /// - Sticky Player Name event -> "1" or "0" +/// - Heal event -> Amount of HP to heal +/// - Has Feat event -> "1" or "0" +/// - 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 @@ -1170,113 +2326,173 @@ void NWNX_Events_SetEventResult(string data); /// Returns "" on error string NWNX_Events_GetCurrentEvent(); -/// Toggles DispatchListMode for sEvent+sScript -/// If enabled, sEvent for sScript will only be signalled if the target object is on its dispatch list. -void NWNX_Events_ToggleDispatchListMode(string sEvent, string sScript, int bEnable); +/// Toggles DispatchListMode for sEvent+sScript(Chunk) +/// If enabled, sEvent for sScript(Chunk) will only be signalled if the target object is on its dispatch list. +void NWNX_Events_ToggleDispatchListMode(string sEvent, string sScriptOrChunk, int bEnable); -/// Add oObject to the dispatch list for sEvent+sScript. -void NWNX_Events_AddObjectToDispatchList(string sEvent, string sScript, object oObject); +/// Add oObject to the dispatch list for sEvent+sScript(Chunk). +void NWNX_Events_AddObjectToDispatchList(string sEvent, string sScriptOrChunk, object oObject); -/// Remove oObject from the dispatch list for sEvent+sScript. -void NWNX_Events_RemoveObjectFromDispatchList(string sEvent, string sScript, object oObject); +/// Remove oObject from the dispatch list for sEvent+sScript(Chunk). +void NWNX_Events_RemoveObjectFromDispatchList(string sEvent, string sScriptOrChunk, object oObject); + +/// @brief Toggle the whitelisting of IDs for sEvent. If whitelisting is enabled, the event will only fire for IDs that are +/// on its whitelist. +/// +/// 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. +/// @param bEnable TRUE to enable the whitelist, FALSE to disable +void NWNX_Events_ToggleIDWhitelist(string sEvent, int bEnable); + +/// @brief Add nID to the whitelist of sEvent. +/// @note See NWNX_Events_ToggleIDWhitelist for valid events and ID types. +/// @param sEvent The event name without _BEFORE / _AFTER. +/// @param nID The ID. +void NWNX_Events_AddIDToWhitelist(string sEvent, int nID); + +/// @brief Remove nID from the whitelist of sEvent. +/// @note See NWNX_Events_ToggleIDWhitelist for valid events and ID types. +/// @param sEvent The event name without _BEFORE / _AFTER. +/// @param nID The ID. +void NWNX_Events_RemoveIDFromWhitelist(string sEvent, int nID); + +/// @brief Get the number of subscribers to sEvent. +/// @param sEvent The event. +/// @return The number of subscribers sEvent has or 0 on error. +int NWNX_Events_GetNumSubscribers(string sEvent); /// @} void NWNX_Events_SubscribeEvent(string evt, string script) { - string sFunc = "SubscribeEvent"; - - NWNX_PushArgumentString(NWNX_Events, sFunc, script); - NWNX_PushArgumentString(NWNX_Events, sFunc, evt); - NWNX_CallFunction(NWNX_Events, sFunc); + NWNXPushString(script); + NWNXPushString(evt); + NWNXCall(NWNX_Events, "SubscribeEvent"); } void NWNX_Events_UnsubscribeEvent(string evt, string script) { - string sFunc = "UnsubscribeEvent"; + NWNXPushString(script); + NWNXPushString(evt); + NWNXCall(NWNX_Events, "UnsubscribeEvent"); +} - NWNX_PushArgumentString(NWNX_Events, sFunc, script); - NWNX_PushArgumentString(NWNX_Events, sFunc, evt); - NWNX_CallFunction(NWNX_Events, sFunc); +void NWNX_Events_UnsubscribeAllStartingWith(string prefix) +{ + NWNXPushString(prefix); + NWNXCall(NWNX_Events, "UnsubscribeAllStartingWith"); +} + +void NWNX_Events_SubscribeEventScriptChunk(string sEvent, string sScriptChunk, int bWrapIntoMain = TRUE) +{ + NWNXPushInt(bWrapIntoMain); + NWNXPushString(sScriptChunk); + NWNXPushString(sEvent); + NWNXCall(NWNX_Events, "SubscribeEventScriptChunk"); +} + +void NWNX_Events_UnsubscribeEventScriptChunk(string sEvent, string sScriptChunk, int bWrapIntoMain = TRUE) +{ + NWNXPushInt(bWrapIntoMain); + NWNXPushString(sScriptChunk); + NWNXPushString(sEvent); + NWNXCall(NWNX_Events, "UnsubscribeEventScriptChunk"); } void NWNX_Events_PushEventData(string tag, string data) { - string sFunc = "PushEventData"; - - NWNX_PushArgumentString(NWNX_Events, sFunc, data); - NWNX_PushArgumentString(NWNX_Events, sFunc, tag); - NWNX_CallFunction(NWNX_Events, sFunc); + NWNXPushString(data); + NWNXPushString(tag); + NWNXCall(NWNX_Events, "PushEventData"); } int NWNX_Events_SignalEvent(string evt, object target) { - string sFunc = "SignalEvent"; - - NWNX_PushArgumentObject(NWNX_Events, sFunc, target); - NWNX_PushArgumentString(NWNX_Events, sFunc, evt); - NWNX_CallFunction(NWNX_Events, sFunc); - return NWNX_GetReturnValueInt(NWNX_Events, sFunc); + NWNXPushObject(target); + NWNXPushString(evt); + NWNXCall(NWNX_Events, "SignalEvent"); + return NWNXPopInt(); } string NWNX_Events_GetEventData(string tag) { - string sFunc = "GetEventData"; - - NWNX_PushArgumentString(NWNX_Events, sFunc, tag); - NWNX_CallFunction(NWNX_Events, sFunc); - return NWNX_GetReturnValueString(NWNX_Events, sFunc); + NWNXPushString(tag); + NWNXCall(NWNX_Events, "GetEventData"); + return NWNXPopString(); } void NWNX_Events_SkipEvent() { - string sFunc = "SkipEvent"; - - NWNX_CallFunction(NWNX_Events, sFunc); + NWNXCall(NWNX_Events, "SkipEvent"); } void NWNX_Events_SetEventResult(string data) { - string sFunc = "SetEventResult"; - - NWNX_PushArgumentString(NWNX_Events, sFunc, data); - NWNX_CallFunction(NWNX_Events, sFunc); + NWNXPushString(data); + NWNXCall(NWNX_Events, "SetEventResult"); } string NWNX_Events_GetCurrentEvent() { - string sFunc = "GetCurrentEvent"; - - NWNX_CallFunction(NWNX_Events, sFunc); - return NWNX_GetReturnValueString(NWNX_Events, sFunc); + NWNXCall(NWNX_Events, "GetCurrentEvent"); + return NWNXPopString(); } -void NWNX_Events_ToggleDispatchListMode(string sEvent, string sScript, int bEnable) +void NWNX_Events_ToggleDispatchListMode(string sEvent, string sScriptOrChunk, int bEnable) { - string sFunc = "ToggleDispatchListMode"; - - NWNX_PushArgumentInt(NWNX_Events, sFunc, bEnable); - NWNX_PushArgumentString(NWNX_Events, sFunc, sScript); - NWNX_PushArgumentString(NWNX_Events, sFunc, sEvent); - NWNX_CallFunction(NWNX_Events, sFunc); + NWNXPushInt(bEnable); + NWNXPushString(sScriptOrChunk); + NWNXPushString(sEvent); + NWNXCall(NWNX_Events, "ToggleDispatchListMode"); } -void NWNX_Events_AddObjectToDispatchList(string sEvent, string sScript, object oObject) +void NWNX_Events_AddObjectToDispatchList(string sEvent, string sScriptOrChunk, object oObject) { - string sFunc = "AddObjectToDispatchList"; - - NWNX_PushArgumentObject(NWNX_Events, sFunc, oObject); - NWNX_PushArgumentString(NWNX_Events, sFunc, sScript); - NWNX_PushArgumentString(NWNX_Events, sFunc, sEvent); - NWNX_CallFunction(NWNX_Events, sFunc); + NWNXPushObject(oObject); + NWNXPushString(sScriptOrChunk); + NWNXPushString(sEvent); + NWNXCall(NWNX_Events, "AddObjectToDispatchList"); } -void NWNX_Events_RemoveObjectFromDispatchList(string sEvent, string sScript, object oObject) +void NWNX_Events_RemoveObjectFromDispatchList(string sEvent, string sScriptOrChunk, object oObject) { - string sFunc = "RemoveObjectFromDispatchList"; - - NWNX_PushArgumentObject(NWNX_Events, sFunc, oObject); - NWNX_PushArgumentString(NWNX_Events, sFunc, sScript); - NWNX_PushArgumentString(NWNX_Events, sFunc, sEvent); - NWNX_CallFunction(NWNX_Events, sFunc); + NWNXPushObject(oObject); + NWNXPushString(sScriptOrChunk); + NWNXPushString(sEvent); + NWNXCall(NWNX_Events, "RemoveObjectFromDispatchList"); +} + +void NWNX_Events_ToggleIDWhitelist(string sEvent, int bEnable) +{ + NWNXPushInt(bEnable); + NWNXPushString(sEvent); + NWNXCall(NWNX_Events, "ToggleIDWhitelist"); +} + +void NWNX_Events_AddIDToWhitelist(string sEvent, int nID) +{ + NWNXPushInt(nID); + NWNXPushString(sEvent); + NWNXCall(NWNX_Events, "AddIDToWhitelist"); +} + +void NWNX_Events_RemoveIDFromWhitelist(string sEvent, int nID) +{ + NWNXPushInt(nID); + NWNXPushString(sEvent); + NWNXCall(NWNX_Events, "RemoveIDFromWhitelist"); +} + +int NWNX_Events_GetNumSubscribers(string sEvent) +{ + NWNXPushString(sEvent); + NWNXCall(NWNX_Events, "GetNumSubscribers"); + return NWNXPopInt(); } diff --git a/_module/nss/nwnx_feat.nss b/_module/nss/nwnx_feat.nss new file mode 100644 index 0000000..8b9468e --- /dev/null +++ b/_module/nss/nwnx_feat.nss @@ -0,0 +1,62 @@ +/// @addtogroup feat Feat +/// @brief Define feat bonuses/penalties +/// @{ +/// @file nwnx_feat.nss + +const string NWNX_Feat = "NWNX_Feat"; ///< @private + +/// @name Feat Modifiers +/// @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_SPELLSAVEDCFORSCHOOL = 28; +const int NWNX_FEAT_MODIFIER_SPELLSAVEDCFORSPELL = 29; +const int NWNX_FEAT_MODIFIER_DAMAGE = 30; +///@} + +/// @brief Sets a feat modifier. +/// @param iFeat The Feat constant or value in feat.2da. +/// @param iMod The @ref feat_modifiers "feat modifier" to set. +/// @param iParam1, iParam2, iParam3, iParam4 The parameters for this feat modifier. +void NWNX_Feat_SetFeatModifier(int iFeat, int iMod, int iParam1 = 0xDEADBEEF, int iParam2 = 0xDEADBEEF, int iParam3 = 0xDEADBEEF, int iParam4 = 0xDEADBEEF); + +/// @} + +void NWNX_Feat_SetFeatModifier(int iFeat, int iMod, int iParam1 = 0xDEADBEEF, int iParam2 = 0xDEADBEEF, int iParam3 = 0xDEADBEEF, int iParam4 = 0xDEADBEEF) +{ + NWNXPushInt(iParam4); + NWNXPushInt(iParam3); + NWNXPushInt(iParam2); + NWNXPushInt(iParam1); + NWNXPushInt(iMod); + NWNXPushInt(iFeat); + NWNXCall(NWNX_Feat, "SetFeatModifier"); +} diff --git a/_module/nss/nwnx_feat_2da.nss b/_module/nss/nwnx_feat_2da.nss new file mode 100644 index 0000000..95ba7e1 --- /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 19aa0df..daf3280 100644 --- a/_module/nss/nwnx_feedback.nss +++ b/_module/nss/nwnx_feedback.nss @@ -10,55 +10,33 @@ /// * -1 = Personal state is not set for Message /// @{ /// @file nwnx_feedback.nss -#include "nwnx" const string NWNX_Feedback = "NWNX_Feedback"; ///< @private /// @name Combat Log Message Types /// @anchor combat_log_msgs /// @{ -const int NWNX_FEEDBACK_COMBATLOG_SIMPLE_ADJECTIVE = 1; -/* -const int NWNX_FEEDBACK_COMBATLOG_SIMPLE_DAMAGE = 2; -const int NWNX_FEEDBACK_COMBATLOG_COMPLEX_DAMAGE = 3; -const int NWNX_FEEDBACK_COMBATLOG_COMPLEX_DEATH = 4; -const int NWNX_FEEDBACK_COMBATLOG_COMPLEX_ATTACK = 5; -const int NWNX_FEEDBACK_COMBATLOG_SPECIAL_ATTACK = 6; -const int NWNX_FEEDBACK_COMBATLOG_SAVING_THROW = 7; -const int NWNX_FEEDBACK_COMBATLOG_CAST_SPELL = 8; -const int NWNX_FEEDBACK_COMBATLOG_USE_SKILL = 9; -const int NWNX_FEEDBACK_COMBATLOG_SPELL_RESISTANCE = 10; -const int NWNX_FEEDBACK_COMBATLOG_FEEDBACK = 11; // NOTE: This hides ALL feedback messages, to hide individual messages use NWNX_Feedback_SetFeedbackMessageHidden() -const int NWNX_FEEDBACK_COMBATLOG_COUNTERSPELL = 12; -const int NWNX_FEEDBACK_COMBATLOG_TOUCHATTACK = 13; -const int NWNX_FEEDBACK_COMBATLOG_INITIATIVE = 14; -const int NWNX_FEEDBACK_COMBATLOG_DISPEL_MAGIC = 15; -const int NWNX_FEEDBACK_COMBATLOG_POLYMORPH = 17; -const int NWNX_FEEDBACK_COMBATLOG_FEEDBACKSTRING = 18; -const int NWNX_FEEDBACK_COMBATLOG_VIBRATE = 19; -const int NWNX_FEEDBACK_COMBATLOG_UNLOCKACHIEVEMENT = 20; - -// 1 -> Simple_Adjective: : -// 2 -> Simple_Damage: damaged : -// 3 -> Complex_Damage: damages : -// 4 -> Complex_Death: killed -// 5 -> Complex_Attack: attacks : *hit* / *miss* / *parried* : ( + = ) -// 6 -> Special_Attack: attempts on : *success* / *failure* : ( + = ) -// 7 -> Saving_Throw: : : *success* / *failure* : ( + = ) -// 8 -> Cast_Spell: casts : Spellcraft check *failure* / *success* -// 9 -> Use_Skill: : : *success* / *failure* : ( + = vs ) -// 10 -> Spell_Resistance: : Spell Resistance : *success* / *failure* -// 11 -> Feedback: Reason skill/feat/ability failed. -// 12 -> Counterspel: casts : *spell countered by* : casting -// 13 -> TouchAttack: attempts on : *hit/miss/critical* : ( + = ) -// 14 -> Initiative: : Initiative Roll : : ( + = ) -// 15 -> Dispel_Magic: Dispel Magic : : , , ... -// 17 -> Unused, probably -// 18 -> Same as 11, maybe. Might be unused too -// 19 -> Unused -// 20 -> Unused -*/ - +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 +const int NWNX_FEEDBACK_COMBATLOG_COMPLEX_ATTACK = 5; // Complex_Attack: attacks : *hit* / *miss* / *parried* : ( + = ) +const int NWNX_FEEDBACK_COMBATLOG_SPECIAL_ATTACK = 6; // Special_Attack: attempts on : *success* / *failure* : ( + = ) +const int NWNX_FEEDBACK_COMBATLOG_SAVING_THROW = 7; // Saving_Throw: : : *success* / *failure* : ( + = ) +const int NWNX_FEEDBACK_COMBATLOG_CAST_SPELL = 8; // Cast_Spell: casts : Spellcraft check *failure* / *success* +const int NWNX_FEEDBACK_COMBATLOG_USE_SKILL = 9; // Use_Skill: : : *success* / *failure* : ( + = vs ) +const int NWNX_FEEDBACK_COMBATLOG_SPELL_RESISTANCE = 10; // Spell_Resistance: : Spell Resistance : *success* / *failure* +const int NWNX_FEEDBACK_COMBATLOG_FEEDBACK = 11; // Reason skill/feat/ability failed, SendMessageToPC() NOTE: This hides ALL feedback messages, to hide individual messages use NWNX_Feedback_SetFeedbackMessageHidden() +const int NWNX_FEEDBACK_COMBATLOG_COUNTERSPELL = 12; // Counterspel: casts : *spell countered by* : casting +const int NWNX_FEEDBACK_COMBATLOG_TOUCHATTACK = 13; // TouchAttack: attempts on : *hit/miss/critical* : ( + = ) +const int NWNX_FEEDBACK_COMBATLOG_INITIATIVE = 14; // Initiative: : Initiative Roll : : ( + = ) +const int NWNX_FEEDBACK_COMBATLOG_DISPEL_MAGIC = 15; // Dispel_Magic: Dispel Magic : : , , ... +const int NWNX_FEEDBACK_COMBATLOG_POLYMORPH = 17; // Doesn't go through the function that the plugin hooks, so does nothing. +const int NWNX_FEEDBACK_COMBATLOG_FEEDBACKSTRING = 18; // Custom feedback for objects requiring a key +const int NWNX_FEEDBACK_COMBATLOG_VIBRATE = 19; // Controller vibration +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 @@ -66,7 +44,6 @@ const int NWNX_FEEDBACK_COMBATLOG_UNLOCKACHIEVEMENT = 20; /// @{ 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; @@ -368,7 +345,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. @@ -425,95 +401,69 @@ void NWNX_Feedback_SetCombatLogMessageMode(int bWhitelist); int NWNX_Feedback_GetFeedbackMessageHidden(int nMessage, object oPC = OBJECT_INVALID) { - string sFunc = "GetMessageHidden"; - int nMessageType = 0; - - NWNX_PushArgumentInt(NWNX_Feedback, sFunc, nMessage); - NWNX_PushArgumentInt(NWNX_Feedback, sFunc, nMessageType); - NWNX_PushArgumentObject(NWNX_Feedback, sFunc, oPC); - NWNX_CallFunction(NWNX_Feedback, sFunc); - - return NWNX_GetReturnValueInt(NWNX_Feedback, sFunc); + NWNXPushInt(nMessage); + NWNXPushInt(0); + NWNXPushObject(oPC); + NWNXCall(NWNX_Feedback, "GetMessageHidden"); + return NWNXPopInt(); } void NWNX_Feedback_SetFeedbackMessageHidden(int nMessage, int isHidden, object oPC = OBJECT_INVALID) { - string sFunc = "SetMessageHidden"; - int nMessageType = 0; - - NWNX_PushArgumentInt(NWNX_Feedback, sFunc, isHidden); - NWNX_PushArgumentInt(NWNX_Feedback, sFunc, nMessage); - NWNX_PushArgumentInt(NWNX_Feedback, sFunc, nMessageType); - NWNX_PushArgumentObject(NWNX_Feedback, sFunc, oPC); - NWNX_CallFunction(NWNX_Feedback, sFunc); + NWNXPushInt(isHidden); + NWNXPushInt(nMessage); + NWNXPushInt(0); + NWNXPushObject(oPC); + NWNXCall(NWNX_Feedback, "SetMessageHidden"); } int NWNX_Feedback_GetCombatLogMessageHidden(int nMessage, object oPC = OBJECT_INVALID) { - string sFunc = "GetMessageHidden"; - int nMessageType = 1; + NWNXPushInt(nMessage); + NWNXPushInt(1); + NWNXPushObject(oPC); + NWNXCall(NWNX_Feedback, "GetMessageHidden"); - NWNX_PushArgumentInt(NWNX_Feedback, sFunc, nMessage); - NWNX_PushArgumentInt(NWNX_Feedback, sFunc, nMessageType); - NWNX_PushArgumentObject(NWNX_Feedback, sFunc, oPC); - NWNX_CallFunction(NWNX_Feedback, sFunc); - - return NWNX_GetReturnValueInt(NWNX_Feedback, sFunc); + return NWNXPopInt(); } void NWNX_Feedback_SetCombatLogMessageHidden(int nMessage, int isHidden, object oPC = OBJECT_INVALID) { - string sFunc = "SetMessageHidden"; - int nMessageType = 1; - - NWNX_PushArgumentInt(NWNX_Feedback, sFunc, isHidden); - NWNX_PushArgumentInt(NWNX_Feedback, sFunc, nMessage); - NWNX_PushArgumentInt(NWNX_Feedback, sFunc, nMessageType); - NWNX_PushArgumentObject(NWNX_Feedback, sFunc, oPC); - NWNX_CallFunction(NWNX_Feedback, sFunc); + NWNXPushInt(isHidden); + NWNXPushInt(nMessage); + NWNXPushInt(1); + NWNXPushObject(oPC); + NWNXCall(NWNX_Feedback, "SetMessageHidden"); } int NWNX_Feedback_GetJournalUpdatedMessageHidden(object oPC = OBJECT_INVALID) { - string sFunc = "GetMessageHidden"; - int nMessageType = 2; - - NWNX_PushArgumentInt(NWNX_Feedback, sFunc, 0); - NWNX_PushArgumentInt(NWNX_Feedback, sFunc, nMessageType); - NWNX_PushArgumentObject(NWNX_Feedback, sFunc, oPC); - NWNX_CallFunction(NWNX_Feedback, sFunc); - - return NWNX_GetReturnValueInt(NWNX_Feedback, sFunc); + NWNXPushInt(0); + NWNXPushInt(2); + NWNXPushObject(oPC); + NWNXCall(NWNX_Feedback, "GetMessageHidden"); + return NWNXPopInt(); } void NWNX_Feedback_SetJournalUpdatedMessageHidden(int isHidden, object oPC = OBJECT_INVALID) { - string sFunc = "SetMessageHidden"; - int nMessageType = 2; - - NWNX_PushArgumentInt(NWNX_Feedback, sFunc, isHidden); - NWNX_PushArgumentInt(NWNX_Feedback, sFunc, 0); - NWNX_PushArgumentInt(NWNX_Feedback, sFunc, nMessageType); - NWNX_PushArgumentObject(NWNX_Feedback, sFunc, oPC); - NWNX_CallFunction(NWNX_Feedback, sFunc); + NWNXPushInt(isHidden); + NWNXPushInt(0); + NWNXPushInt(2); + NWNXPushObject(oPC); + NWNXCall(NWNX_Feedback, "SetMessageHidden"); } void NWNX_Feedback_SetFeedbackMessageMode(int bWhitelist) { - string sFunc = "SetFeedbackMode"; - int nMessageType = 0; - - NWNX_PushArgumentInt(NWNX_Feedback, sFunc, bWhitelist); - NWNX_PushArgumentInt(NWNX_Feedback, sFunc, nMessageType); - NWNX_CallFunction(NWNX_Feedback, sFunc); + NWNXPushInt(bWhitelist); + NWNXPushInt(0); + NWNXCall(NWNX_Feedback, "SetFeedbackMode"); } void NWNX_Feedback_SetCombatLogMessageMode(int bWhitelist) { - string sFunc = "SetFeedbackMode"; - int nMessageType = 1; - - NWNX_PushArgumentInt(NWNX_Feedback, sFunc, bWhitelist); - NWNX_PushArgumentInt(NWNX_Feedback, sFunc, nMessageType); - NWNX_CallFunction(NWNX_Feedback, sFunc); + NWNXPushInt(bWhitelist); + NWNXPushInt(1); + NWNXCall(NWNX_Feedback, "SetFeedbackMode"); } diff --git a/_module/nss/nwnx_httpclient.nss b/_module/nss/nwnx_httpclient.nss new file mode 100644 index 0000000..878dc3d --- /dev/null +++ b/_module/nss/nwnx_httpclient.nss @@ -0,0 +1,107 @@ +/// @addtogroup httpclient HTTPClient +/// @brief NWNX HTTPClient +/// @{ +/// @file nwnx_httpclient.nss + +const string NWNX_HTTPClient = "NWNX_HTTPClient"; ///< @private + +/// @name Request Types +/// @anchor request_types +/// +/// @{ +const int NWNX_HTTPCLIENT_REQUEST_METHOD_GET = 0; +const int NWNX_HTTPCLIENT_REQUEST_METHOD_POST = 1; +const int NWNX_HTTPCLIENT_REQUEST_METHOD_DELETE = 2; +const int NWNX_HTTPCLIENT_REQUEST_METHOD_PATCH = 3; +const int NWNX_HTTPCLIENT_REQUEST_METHOD_PUT = 4; +const int NWNX_HTTPCLIENT_REQUEST_METHOD_OPTION = 5; +const int NWNX_HTTPCLIENT_REQUEST_METHOD_HEAD = 6; +///@} + +/// @name Content Types +/// @anchor content_types +/// +/// @{ +const int NWNX_HTTPCLIENT_CONTENT_TYPE_HTML = 0; +const int NWNX_HTTPCLIENT_CONTENT_TYPE_PLAINTEXT = 1; +const int NWNX_HTTPCLIENT_CONTENT_TYPE_JSON = 2; +const int NWNX_HTTPCLIENT_CONTENT_TYPE_FORM_URLENCODED = 3; +const int NWNX_HTTPCLIENT_CONTENT_TYPE_XML = 4; +///@} + +/// @name HTTP Authentication Types +/// @anchor auth_types +/// +/// @{ +const int NWNX_HTTPCLIENT_AUTH_TYPE_NONE = 0; +const int NWNX_HTTPCLIENT_AUTH_TYPE_BASIC = 1; +const int NWNX_HTTPCLIENT_AUTH_TYPE_DIGEST = 2; +const int NWNX_HTTPCLIENT_AUTH_TYPE_BEARER_TOKEN = 3; +///@} + +/// A structure for an HTTP Client Request +struct NWNX_HTTPClient_Request +{ + int nRequestMethod; ///< A @ref request_types "Request Type" + string sTag; ///< A unique tag for this request + string sHost; ///< The host domain name/IP address + string sPath; ///< The path for the url (include the leading /) + string sData; ///< The data being sent + int nContentType; ///< A @ref content_types "Content Type" + int nAuthType; ///< An @ref auth_types "Authentication Type" + string sAuthUserOrToken; ///< The authentication username or token + string sAuthPassword; ///< The authentication password (ignored if just using a token) + int nPort; ///< The host port + string sHeaders; ///< Pipe (|) delimited header pairs, e.g. "User-Agent: My NWNX HTTP Client|Accept: application/vnd.github.v3+json" +}; + +/// @brief Sends an http method to the given host. +/// @param s The structured NWNX_HTTPClient_Request information. +/// @return A unique identifier for the request for later access in the REQUEST_ID event data. +int NWNX_HTTPClient_SendRequest(struct NWNX_HTTPClient_Request s); + +/// @brief Returns an NWNX_HTTP_Client_Request structure +/// @param nRequestId The request id returned from NWNX_HTTPClient_SendRequest() +/// @return The structured NWNX_HTTPClient_Request information +struct NWNX_HTTPClient_Request NWNX_HTTPClient_GetRequest(int nRequestId); + +/// @} + +int NWNX_HTTPClient_SendRequest(struct NWNX_HTTPClient_Request s) +{ + NWNXPushString(s.sHeaders); + NWNXPushInt(s.nPort); + NWNXPushString(s.sAuthPassword); + NWNXPushString(s.sAuthUserOrToken); + NWNXPushInt(s.nAuthType); + NWNXPushString(s.sData); + NWNXPushInt(s.nContentType); + NWNXPushString(s.sPath); + NWNXPushString(s.sHost); + NWNXPushInt(s.nRequestMethod); + NWNXPushString(s.sTag); + NWNXCall(NWNX_HTTPClient, "SendRequest"); + return NWNXPopInt(); +} + +struct NWNX_HTTPClient_Request NWNX_HTTPClient_GetRequest(int nRequestId) +{ + NWNXPushInt(nRequestId); + NWNXCall(NWNX_HTTPClient, "GetRequest"); + + struct NWNX_HTTPClient_Request s; + + s.sTag = NWNXPopString(); + s.nRequestMethod = NWNXPopInt(); + s.sHost = NWNXPopString(); + s.sPath = NWNXPopString(); + s.nContentType = NWNXPopInt(); + s.sData = NWNXPopString(); + s.nAuthType = NWNXPopInt(); + s.sAuthUserOrToken = NWNXPopString(); + s.sAuthPassword = NWNXPopString(); + s.nPort = NWNXPopInt(); + s.sHeaders = NWNXPopString(); + + return s; +} diff --git a/_module/nss/nwnx_item.nss b/_module/nss/nwnx_item.nss index ce83ef8..c1d8779 100644 --- a/_module/nss/nwnx_item.nss +++ b/_module/nss/nwnx_item.nss @@ -2,7 +2,6 @@ /// @brief Functions exposing additional item properties. /// @{ /// @file nwnx_item.nss -#include "nwnx" const string NWNX_Item = "NWNX_Item"; ///< @private @@ -16,6 +15,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); @@ -68,7 +68,12 @@ void NWNX_Item_SetBaseItemType(object oItem, int nBaseItem); /// /// [1] When specifying per-part coloring, the value 255 corresponds with the logical /// function 'clear colour override', which clears the per-part override for that part. -void NWNX_Item_SetItemAppearance(object oItem, int nType, int nIndex, int nValue); +/// @param oItem The item +/// @param nType The type +/// @param nIndex The index +/// @param nValue The value +/// @param bUpdateCreatureAppearance If TRUE, also update the appearance of oItem's possessor. Only works for armor/helmets/cloaks. Will remove the item from the quickbar as side effect. +void NWNX_Item_SetItemAppearance(object oItem, int nType, int nIndex, int nValue, int bUpdateCreatureAppearance = FALSE); /// @brief Return a string containing the entire appearance for an item. /// @sa NWNX_Item_RestoreItemAppearance @@ -91,117 +96,157 @@ 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) { - string sFunc = "SetWeight"; - - NWNX_PushArgumentInt(NWNX_Item, sFunc, w); - NWNX_PushArgumentObject(NWNX_Item, sFunc, oItem); - - NWNX_CallFunction(NWNX_Item, sFunc); + NWNXPushInt(w); + NWNXPushObject(oItem); + NWNXCall(NWNX_Item, "SetWeight"); } void NWNX_Item_SetBaseGoldPieceValue(object oItem, int g) { - string sFunc = "SetBaseGoldPieceValue"; - - NWNX_PushArgumentInt(NWNX_Item, sFunc, g); - NWNX_PushArgumentObject(NWNX_Item, sFunc, oItem); - - NWNX_CallFunction(NWNX_Item, sFunc); + NWNXPushInt(g); + NWNXPushObject(oItem); + NWNXCall(NWNX_Item, "SetBaseGoldPieceValue"); } void NWNX_Item_SetAddGoldPieceValue(object oItem, int g) { - string sFunc = "SetAddGoldPieceValue"; - - NWNX_PushArgumentInt(NWNX_Item, sFunc, g); - NWNX_PushArgumentObject(NWNX_Item, sFunc, oItem); - - NWNX_CallFunction(NWNX_Item, sFunc); + NWNXPushInt(g); + NWNXPushObject(oItem); + NWNXCall(NWNX_Item, "SetAddGoldPieceValue"); } int NWNX_Item_GetBaseGoldPieceValue(object oItem) { - string sFunc = "GetBaseGoldPieceValue"; - - NWNX_PushArgumentObject(NWNX_Item, sFunc, oItem); - - NWNX_CallFunction(NWNX_Item, sFunc); - return NWNX_GetReturnValueInt(NWNX_Item, sFunc); + NWNXPushObject(oItem); + NWNXCall(NWNX_Item, "GetBaseGoldPieceValue"); + return NWNXPopInt(); } int NWNX_Item_GetAddGoldPieceValue(object oItem) { - string sFunc = "GetAddGoldPieceValue"; - - NWNX_PushArgumentObject(NWNX_Item, sFunc, oItem); - - NWNX_CallFunction(NWNX_Item, sFunc); - return NWNX_GetReturnValueInt(NWNX_Item, sFunc); + NWNXPushObject(oItem); + NWNXCall(NWNX_Item, "GetAddGoldPieceValue"); + return NWNXPopInt(); } void NWNX_Item_SetBaseItemType(object oItem, int nBaseItem) { - string sFunc = "SetBaseItemType"; - - NWNX_PushArgumentInt(NWNX_Item, sFunc, nBaseItem); - NWNX_PushArgumentObject(NWNX_Item, sFunc, oItem); - - NWNX_CallFunction(NWNX_Item, sFunc); + NWNXPushInt(nBaseItem); + NWNXPushObject(oItem); + NWNXCall(NWNX_Item, "SetBaseItemType"); } -void NWNX_Item_SetItemAppearance(object oItem, int nType, int nIndex, int nValue) +void NWNX_Item_SetItemAppearance(object oItem, int nType, int nIndex, int nValue, int bUpdateCreatureAppearance = FALSE) { - string sFunc = "SetItemAppearance"; - - NWNX_PushArgumentInt(NWNX_Item, sFunc, nValue); - NWNX_PushArgumentInt(NWNX_Item, sFunc, nIndex); - NWNX_PushArgumentInt(NWNX_Item, sFunc, nType); - NWNX_PushArgumentObject(NWNX_Item, sFunc, oItem); - - NWNX_CallFunction(NWNX_Item, sFunc); - + NWNXPushInt(bUpdateCreatureAppearance); + NWNXPushInt(nValue); + NWNXPushInt(nIndex); + NWNXPushInt(nType); + NWNXPushObject(oItem); + NWNXCall(NWNX_Item, "SetItemAppearance"); } string NWNX_Item_GetEntireItemAppearance(object oItem) { - string sFunc = "GetEntireItemAppearance"; - - NWNX_PushArgumentObject(NWNX_Item, sFunc, oItem); - - NWNX_CallFunction(NWNX_Item, sFunc); - return NWNX_GetReturnValueString(NWNX_Item, sFunc); + NWNXPushObject(oItem); + NWNXCall(NWNX_Item, "GetEntireItemAppearance"); + return NWNXPopString(); } void NWNX_Item_RestoreItemAppearance(object oItem, string sApp) { - string sFunc = "RestoreItemAppearance"; - - NWNX_PushArgumentString(NWNX_Item, sFunc, sApp); - NWNX_PushArgumentObject(NWNX_Item, sFunc, oItem); - - NWNX_CallFunction(NWNX_Item, sFunc); + NWNXPushString(sApp); + NWNXPushObject(oItem); + NWNXCall(NWNX_Item, "RestoreItemAppearance"); } int NWNX_Item_GetBaseArmorClass(object oItem) { - string sFunc = "GetBaseArmorClass"; - - NWNX_PushArgumentObject(NWNX_Item, sFunc, oItem); - - NWNX_CallFunction(NWNX_Item, sFunc); - return NWNX_GetReturnValueInt(NWNX_Item, sFunc); + NWNXPushObject(oItem); + NWNXCall(NWNX_Item, "GetBaseArmorClass"); + return NWNXPopInt(); } int NWNX_Item_GetMinEquipLevel(object oItem) { - string sFunc = "GetMinEquipLevel"; - - NWNX_PushArgumentObject(NWNX_Item, sFunc, oItem); - - NWNX_CallFunction(NWNX_Item, sFunc); - return NWNX_GetReturnValueInt(NWNX_Item, sFunc); + NWNXPushObject(oItem); + NWNXCall(NWNX_Item, "GetMinEquipLevel"); + return NWNXPopInt(); +} + +int NWNX_Item_MoveTo(object oItem, object oTarget, int bHideAllFeedback = FALSE) +{ + NWNXPushInt(bHideAllFeedback); + NWNXPushObject(oTarget); + NWNXPushObject(oItem); + NWNXCall(NWNX_Item, "MoveTo"); + return NWNXPopInt(); +} + +void NWNX_Item_SetMinEquipLevelModifier(object oItem, int nModifier, int bPersist = TRUE) +{ + NWNXPushInt(bPersist); + NWNXPushInt(nModifier); + NWNXPushObject(oItem); + NWNXCall(NWNX_Item, "SetMinEquipLevelModifier"); +} + +int NWNX_Item_GetMinEquipLevelModifier(object oItem) +{ + NWNXPushObject(oItem); + NWNXCall(NWNX_Item, "GetMinEquipLevelModifier"); + return NWNXPopInt(); +} + +void NWNX_Item_SetMinEquipLevelOverride(object oItem, int nOverride, int bPersist = TRUE) +{ + + NWNXPushInt(bPersist); + NWNXPushInt(nOverride); + NWNXPushObject(oItem); + NWNXCall(NWNX_Item, "SetMinEquipLevelOverride"); +} + +int NWNX_Item_GetMinEquipLevelOverride(object oItem) +{ + NWNXPushObject(oItem); + NWNXCall(NWNX_Item, "GetMinEquipLevelOverride"); + return NWNXPopInt(); } diff --git a/_module/nss/nwnx_itemprop.nss b/_module/nss/nwnx_itemprop.nss index 6937155..d956add 100644 --- a/_module/nss/nwnx_itemprop.nss +++ b/_module/nss/nwnx_itemprop.nss @@ -2,13 +2,13 @@ /// @brief Utility functions to manipulate the builtin itemproperty type. /// @{ /// @file nwnx_itemprop.nss -#include "nwnx" const string NWNX_ItemProperty = "NWNX_ItemProperty"; ///< @private /// @brief An unpacked itemproperty. struct NWNX_IPUnpacked { + string sID; ///< @todo Describe int nProperty; ///< @todo Describe int nSubType; ///< @todo Describe int nCostTable; ///< @todo Describe @@ -33,49 +33,68 @@ struct NWNX_IPUnpacked NWNX_ItemProperty_UnpackIP(itemproperty ip); /// @return The itemproperty. itemproperty NWNX_ItemProperty_PackIP(struct NWNX_IPUnpacked ip); +/// @brief Gets the active item property at the index +/// @param oItem - the item with the property +/// @param nIndex - the index such as returned by some Item Events +/// @return A constructed NWNX_IPUnpacked, except for creator, and spell id. +struct NWNX_IPUnpacked NWNX_ItemProperty_GetActiveProperty(object oItem, int nIndex); + /// @} struct NWNX_IPUnpacked NWNX_ItemProperty_UnpackIP(itemproperty ip) { - string sFunc = "UnpackIP"; - - NWNX_PushArgumentItemProperty(NWNX_ItemProperty, sFunc, ip); - NWNX_CallFunction(NWNX_ItemProperty, sFunc); - + NWNXPushItemProperty(ip); + NWNXCall(NWNX_ItemProperty, "UnpackIP"); struct NWNX_IPUnpacked n; - - n.nProperty = NWNX_GetReturnValueInt(NWNX_ItemProperty, sFunc); - n.nSubType = NWNX_GetReturnValueInt(NWNX_ItemProperty, sFunc); - n.nCostTable = NWNX_GetReturnValueInt(NWNX_ItemProperty, sFunc); - n.nCostTableValue = NWNX_GetReturnValueInt(NWNX_ItemProperty, sFunc); - n.nParam1 = NWNX_GetReturnValueInt(NWNX_ItemProperty, sFunc); - n.nParam1Value = NWNX_GetReturnValueInt(NWNX_ItemProperty, sFunc); - n.nUsesPerDay = NWNX_GetReturnValueInt(NWNX_ItemProperty, sFunc); - n.nChanceToAppear = NWNX_GetReturnValueInt(NWNX_ItemProperty, sFunc); - n.bUsable = NWNX_GetReturnValueInt(NWNX_ItemProperty, sFunc); - n.nSpellId = NWNX_GetReturnValueInt(NWNX_ItemProperty, sFunc); - n.oCreator = NWNX_GetReturnValueObject(NWNX_ItemProperty, sFunc); - n.sTag = NWNX_GetReturnValueString(NWNX_ItemProperty, sFunc); - + n.sID = NWNXPopString(); + n.nProperty = NWNXPopInt(); + n.nSubType = NWNXPopInt(); + n.nCostTable = NWNXPopInt(); + n.nCostTableValue = NWNXPopInt(); + n.nParam1 = NWNXPopInt(); + n.nParam1Value = NWNXPopInt(); + n.nUsesPerDay = NWNXPopInt(); + n.nChanceToAppear = NWNXPopInt(); + n.bUsable = NWNXPopInt(); + n.nSpellId = NWNXPopInt(); + n.oCreator = NWNXPopObject(); + n.sTag = NWNXPopString(); return n; } + itemproperty NWNX_ItemProperty_PackIP(struct NWNX_IPUnpacked n) { - string sFunc = "PackIP"; - - NWNX_PushArgumentString(NWNX_ItemProperty, sFunc, n.sTag); - NWNX_PushArgumentObject(NWNX_ItemProperty, sFunc, n.oCreator); - NWNX_PushArgumentInt(NWNX_ItemProperty, sFunc, n.nSpellId); - NWNX_PushArgumentInt(NWNX_ItemProperty, sFunc, n.bUsable); - NWNX_PushArgumentInt(NWNX_ItemProperty, sFunc, n.nChanceToAppear); - NWNX_PushArgumentInt(NWNX_ItemProperty, sFunc, n.nUsesPerDay); - NWNX_PushArgumentInt(NWNX_ItemProperty, sFunc, n.nParam1Value); - NWNX_PushArgumentInt(NWNX_ItemProperty, sFunc, n.nParam1); - NWNX_PushArgumentInt(NWNX_ItemProperty, sFunc, n.nCostTableValue); - NWNX_PushArgumentInt(NWNX_ItemProperty, sFunc, n.nCostTable); - NWNX_PushArgumentInt(NWNX_ItemProperty, sFunc, n.nSubType); - NWNX_PushArgumentInt(NWNX_ItemProperty, sFunc, n.nProperty); - - NWNX_CallFunction(NWNX_ItemProperty, sFunc); - return NWNX_GetReturnValueItemProperty(NWNX_ItemProperty, sFunc); + NWNXPushString(n.sTag); + NWNXPushObject(n.oCreator); + NWNXPushInt(n.nSpellId); + NWNXPushInt(n.bUsable); + NWNXPushInt(n.nChanceToAppear); + NWNXPushInt(n.nUsesPerDay); + NWNXPushInt(n.nParam1Value); + NWNXPushInt(n.nParam1); + NWNXPushInt(n.nCostTableValue); + NWNXPushInt(n.nCostTable); + NWNXPushInt(n.nSubType); + NWNXPushInt(n.nProperty); + NWNXCall(NWNX_ItemProperty, "PackIP"); + return NWNXPopItemProperty(); +} + +struct NWNX_IPUnpacked NWNX_ItemProperty_GetActiveProperty(object oItem, int nIndex) +{ + NWNXPushInt(nIndex); + NWNXPushObject(oItem); + NWNXCall(NWNX_ItemProperty, "GetActiveProperty"); + struct NWNX_IPUnpacked n; + n.nProperty = NWNXPopInt(); + n.nSubType = NWNXPopInt(); + n.nCostTable = NWNXPopInt(); + n.nCostTableValue = NWNXPopInt(); + n.nParam1 = NWNXPopInt(); + n.nParam1Value = NWNXPopInt(); + n.nUsesPerDay = NWNXPopInt(); + n.nChanceToAppear = NWNXPopInt(); + n.bUsable = NWNXPopInt(); + n.sTag = NWNXPopString(); + return n; } diff --git a/_module/nss/nwnx_lua.nss b/_module/nss/nwnx_lua.nss index 70eb707..42bf158 100644 --- a/_module/nss/nwnx_lua.nss +++ b/_module/nss/nwnx_lua.nss @@ -2,7 +2,6 @@ /// @brief Execute Lua code and generate events in NWScript /// @{ /// @file nwnx_lua.nss -#include "nwnx" const string NWNX_Lua = "NWNX_Lua"; ///< @private @@ -25,27 +24,21 @@ void NWNX_Lua_RunEvent(string sEvent, object oObject, string sExtra=""); void NWNX_Lua_EvalVoid(string sCode) { - string sFunc = "EvalVoid"; - - NWNX_PushArgumentString(NWNX_Lua, sFunc, sCode); - NWNX_CallFunction(NWNX_Lua, sFunc); + NWNXPushString(sCode); + NWNXCall(NWNX_Lua, "EvalVoid"); } string NWNX_Lua_Eval(string sCode) { - string sFunc = "Eval"; - - NWNX_PushArgumentString(NWNX_Lua, sFunc, sCode); - NWNX_CallFunction(NWNX_Lua, sFunc); - return NWNX_GetReturnValueString(NWNX_Lua, sFunc); + NWNXPushString(sCode); + NWNXCall(NWNX_Lua, "Eval"); + return NWNXPopString(); } void NWNX_Lua_RunEvent(string sEvent, object oObject, string sExtra="") { - string sFunc = "RunEvent"; - - NWNX_PushArgumentString(NWNX_Lua, sFunc, sExtra); - NWNX_PushArgumentObject(NWNX_Lua, sFunc, oObject); - NWNX_PushArgumentString(NWNX_Lua, sFunc, sEvent); - NWNX_CallFunction(NWNX_Lua, sFunc); + NWNXPushString(sExtra); + NWNXPushObject(oObject); + NWNXPushString(sEvent); + NWNXCall(NWNX_Lua, "RunEvent"); } diff --git a/_module/nss/nwnx_nostack.nss b/_module/nss/nwnx_nostack.nss new file mode 100644 index 0000000..159214f --- /dev/null +++ b/_module/nss/nwnx_nostack.nss @@ -0,0 +1,36 @@ +/// @addtogroup nostack NoStack +/// @brief Functions to allow more control over ability/skill/bonuses stacking. +/// @{ +/// @file nwnx_nostack.nss + +const string NWNX_NoStack = "NWNX_NoStack"; ///< @private + +/// @name Spell Effect Bonus Types +/// @anchor spell_bonus_types +/// +/// Used with NWNX_NoStack_SetSpellBonusType() these are the effect bonus types. +/// @{ +const int NWNX_NOSTACK_EFFECT_TYPE_ENHANCEMENT = 0; +const int NWNX_NOSTACK_EFFECT_TYPE_CIRCUMSTANCE = 1; +const int NWNX_NOSTACK_EFFECT_TYPE_COMPETENCE = 2; +const int NWNX_NOSTACK_EFFECT_TYPE_INSIGHT = 3; +const int NWNX_NOSTACK_EFFECT_TYPE_LUCK = 4; +const int NWNX_NOSTACK_EFFECT_TYPE_MORALE = 5; +const int NWNX_NOSTACK_EFFECT_TYPE_PROFANE = 6; +const int NWNX_NOSTACK_EFFECT_TYPE_RESISTANCE = 7; +const int NWNX_NOSTACK_EFFECT_TYPE_SACRED = 8; +/// @} + +/// @brief Sets a spell bonus type to be used by the NoStack feature. +/// @param spell The spell ID from spells.2da. +/// @param type The new type. +void NWNX_NoStack_SetSpellBonusType(int spell, int type); + +/// @} + +void NWNX_NoStack_SetSpellBonusType(int spell, int type) +{ + NWNXPushInt(type); + NWNXPushInt(spell); + NWNXCall(NWNX_NoStack, "SetSpellBonusType"); +} diff --git a/_module/nss/nwnx_nwsqliteext.nss b/_module/nss/nwnx_nwsqliteext.nss new file mode 100644 index 0000000..953a863 --- /dev/null +++ b/_module/nss/nwnx_nwsqliteext.nss @@ -0,0 +1,24 @@ +/// @addtogroup nwsqliteextensions NWSQLiteExtensions +/// @brief Various extensions for the game's built-in sqlite database. +/// @{ +/// @file nwnx_nwsqliteext.nss + +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 = "") +{ + NWNXPushString(sTableName); + NWNXPushString(sColumnTypeHints); + NWNXPushString(s2DA); + NWNXCall(NWNX_NWSQLiteExtensions, "CreateVirtual2DATable"); + return NWNXPopInt(); +} diff --git a/_module/nss/nwnx_object.nss b/_module/nss/nwnx_object.nss index da73fde..9e51a5e 100644 --- a/_module/nss/nwnx_object.nss +++ b/_module/nss/nwnx_object.nss @@ -2,18 +2,19 @@ /// @brief Functions exposing additional object properties. /// @{ /// @file nwnx_object.nss -#include "nwnx" const string NWNX_Object = "NWNX_Object"; ///< @private /// @anchor object_localvar_types /// @name Local Variable Types /// @{ +const int NWNX_OBJECT_LOCALVAR_TYPE_UNKNOWN = 0; const int NWNX_OBJECT_LOCALVAR_TYPE_INT = 1; const int NWNX_OBJECT_LOCALVAR_TYPE_FLOAT = 2; const int NWNX_OBJECT_LOCALVAR_TYPE_STRING = 3; const int NWNX_OBJECT_LOCALVAR_TYPE_OBJECT = 4; const int NWNX_OBJECT_LOCALVAR_TYPE_LOCATION = 5; +const int NWNX_OBJECT_LOCALVAR_TYPE_JSON = 6; /// @} /// @anchor object_internal_types @@ -38,6 +39,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 { @@ -54,19 +62,29 @@ int NWNX_Object_GetLocalVariableCount(object obj); /// @param obj The object. /// @param index The index. /// @note Index bounds: 0 >= index < NWNX_Object_GetLocalVariableCount(). +/// @note As of build 8193.14 local variables no longer have strict ordering. +/// this means that any change to the variables can result in drastically +/// different order when iterating. +/// @note As of build 8193.14, this function takes O(n) time, where n is the number +/// of locals on the object. Individual variable access with GetLocalXxx() +/// is now O(1) though. +/// @note As of build 8193.14, this function will not return a variable if the value is +/// the default (0/0.0/""/OBJECT_INVALID/JsonNull()) for the type. They are considered not set. +/// @note Will return type UNKNOWN for cassowary variables. /// @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. -object NWNX_Object_StringToObject(string id); +/// @brief Set oObject's position. +/// @param oObject The object. +/// @param vPosition A vector position. +/// @param bUpdateSubareas If TRUE and oObject is a creature, any triggers/traps at vPosition will fire their events. +void NWNX_Object_SetPosition(object oObject, vector vPosition, int bUpdateSubareas = TRUE); -/// @brief Set an object's position. +/// @brief Get an object's hit points. +/// @note Unlike the native GetCurrentHitpoints function, this excludes temporary hitpoints. /// @param obj The object. -/// @param pos A vector position. -void NWNX_Object_SetPosition(object obj, vector pos); +/// @return The hit points. +int NWNX_Object_GetCurrentHitPoints(object obj); /// @brief Set an object's hit points. /// @param obj The object. @@ -101,16 +119,16 @@ string NWNX_Object_GetDialogResref(object obj); /// @param dialog The name of the dialog resref. void NWNX_Object_SetDialogResref(object obj, string dialog); -/// @brief Set an object's appearance. +/// @brief Set oPlaceable's appearance. /// @note Will not update for PCs until they re-enter the area. -/// @param obj The object. -/// @param app The appearance id. -void NWNX_Object_SetAppearance(object obj, int app); +/// @param oPlaceable The placeable. +/// @param nAppearance The appearance id. +void NWNX_Object_SetAppearance(object oPlaceable, int nAppearance); -/// @brief Get an object's appearance. -/// @param obj The object. +/// @brief Get oPlaceable's appearance. +/// @param oPlaceable The placeable. /// @return The appearance id. -int NWNX_Object_GetAppearance(object obj); +int NWNX_Object_GetAppearance(object oPlaceable); /// @brief Determine if an object has a visual effect. /// @param obj The object. @@ -118,12 +136,6 @@ int NWNX_Object_GetAppearance(object obj); /// @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. @@ -173,86 +185,11 @@ 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 -void NWNX_Object_Export(string sFileName, object oObject); - -/// @brief Get oObject's persistent integer variable sVarName. -/// @param oObject The object to set the variable on. -/// @param sVarName The variable name. -/// @return The value or 0 on error. -/// @deprecated Please use NWNX_Object_GetInt() -int NWNX_Object_GetPersistentInt(object oObject, string sVarName); - -/// @brief Set oObject's persistent integer variable sVarName to nValue. -/// @note The value is persisted to GFF, this means that it'll be saved in the .bic file of a player's character or when an object is serialized. -/// @param oObject The object to set the variable on. -/// @param sVarName The variable name. -/// @param nValue The integer value to to set -/// @deprecated Please use NWNX_Object_SetInt() -void NWNX_Object_SetPersistentInt(object oObject, string sVarName, int nValue); - -/// @brief Delete oObject's persistent integer variable sVarName. -/// @param oObject The object to set the variable on. -/// @param sVarName The variable name. -/// @deprecated Please use NWNX_Object_DeleteInt() -void NWNX_Object_DeletePersistentInt(object oObject, string sVarName); - -/// @brief Get oObject's persistent string variable sVarName. -/// @param oObject The object to set the variable on. -/// @param sVarName The variable name. -/// @return The value or "" on error. -/// @deprecated Please use NWNX_Object_GetString() -string NWNX_Object_GetPersistentString(object oObject, string sVarName); - -/// @brief Set oObject's persistent string variable sVarName to sValue. -/// @note The value is persisted to GFF, this means that it'll be saved in the .bic file of a player's character or when an object is serialized. -/// @param oObject The object to set the variable on. -/// @param sVarName The variable name. -/// @param sValue The string value to to set -/// @deprecated Please use NWNX_Object_SetString() -void NWNX_Object_SetPersistentString(object oObject, string sVarName, string sValue); - -/// @brief Delete oObject's persistent string variable sVarName. -/// @param oObject The object to set the variable on. -/// @param sVarName The variable name. -/// @deprecated Please use NWNX_Object_DeleteString() -void NWNX_Object_DeletePersistentString(object oObject, string sVarName); - -/// @brief Get oObject's persistent float variable sVarName. -/// @param oObject The object to set the variable on. -/// @param sVarName The variable name. -/// @return The value or 0.0f on error. -/// @deprecated Please use NWNX_Object_GetFloat() -float NWNX_Object_GetPersistentFloat(object oObject, string sVarName); - -/// @brief Set oObject's persistent float variable sVarName to fValue. -/// @note The value is persisted to GFF, this means that it'll be saved in the .bic file of a player's character or when an object is serialized. -/// @param oObject The object to set the variable on. -/// @param sVarName The variable name. -/// @param fValue The float value to to set -/// @deprecated Please use NWNX_Object_SetFloat() -void NWNX_Object_SetPersistentFloat(object oObject, string sVarName, float fValue); - -/// @brief Delete oObject's persistent float variable sVarName. -/// @param oObject The object to set the variable on. -/// @param sVarName The variable name. -/// @deprecated Please use NWNX_Object_DeleteFloat() -void NWNX_Object_DeletePersistentFloat(object oObject, string sVarName); +/// @param sAlias The alias of the resource directory to add the .git file to. Default: UserDirectory/nwnx +void NWNX_Object_Export(object oObject, string sFileName, string sAlias = "NWNX"); /// @brief Get oObject's integer variable sVarName. /// @param oObject The object to get the variable from. @@ -333,14 +270,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); @@ -350,490 +279,632 @@ void NWNX_Object_ClearSpellEffectsOnOthers(object oObject); /// @return The UUID or "" when the object does not have or cannot have an UUID string NWNX_Object_PeekUUID(object oObject); +/// @brief Get if oDoor has a visible model. +/// @param oDoor The door +/// @return TRUE if oDoor has a visible model +int NWNX_Object_GetDoorHasVisibleModel(object oDoor); + +/// @brief Get if oObject is destroyable. +/// @param oObject The object +/// @return TRUE if oObject is destroyable. +int NWNX_Object_GetIsDestroyable(object oObject); + +/// @brief Checks for specific spell immunity. Should only be called in spellscripts +/// @param oDefender The object defending against the spell. +/// @param oCaster The object casting the spell. +/// @param nSpellId The casted spell id. Default value is -1, which corrresponds to the normal game behaviour. +/// @return -1 if defender has no immunity, 2 if the defender is immune +int NWNX_Object_DoSpellImmunity(object oDefender, object oCaster, int nSpellId=-1); + +/// @brief Checks for spell school/level immunities and mantles. Should only be called in spellscripts +/// @param oDefender The object defending against the spell. +/// @param oCaster The object casting the spell. +/// @param nSpellId The casted spell id. Default value is -1, which corrresponds to the normal game behaviour. +/// @param nSpellLevel The level of the casted spell. Default value is -1, which corrresponds to the normal game behaviour. +/// @param nSpellSchool The school of the casted spell (SPELL_SCHOOL_* constant). Default value is -1, which corrresponds to the normal game behaviour. +/// @return -1 defender no immunity. 2 if immune. 3 if immune, but the immunity has a limit (example: mantles) +int NWNX_Object_DoSpellLevelAbsorption(object oDefender, object oCaster, int nSpellId=-1, int nSpellLevel=-1, int nSpellSchool=-1); + +/// @brief Sets if a placeable has an inventory. +/// @param obj The placeable. +/// @param bHasInventory TRUE/FALSE +/// @note Only works on placeables. +void NWNX_Object_SetHasInventory(object obj, int bHasInventory); + +/// @brief Get the current animation of oObject +/// @note The returned value will be an engine animation constant, not a NWScript ANIMATION_ constant. +/// See: https://github.com/nwnxee/unified/blob/master/NWNXLib/API/Constants/Animation.hpp +/// @param oObject The object +/// @return -1 on error or the engine animation constant +int NWNX_Object_GetCurrentAnimation(object oObject); + +/// @brief Gets the AI level of an object. +/// @param oObject The object. +/// @return The AI level (AI_LEVEL_* -1 to 4). +int NWNX_Object_GetAILevel(object oObject); + +/// @brief Sets the AI level of an object. +/// @param oObject The object. +/// @param nLevel The level to set (AI_LEVEL_* -1 to 4). +void NWNX_Object_SetAILevel(object oObject, int nLevel); + +/// @brief Retrieves the Map Note (AKA Map Pin) from a waypoint - Returns even if currently disabled. +/// @param oObject The Waypoint object +/// @param nID The Language ID (default English) +/// @param nGender 0 = Male, 1 = Female +string NWNX_Object_GetMapNote(object oObject, int nID = 0, int nGender = 0); + +/// @brief Sets a Map Note (AKA Map Pin) to any waypoint, even if no previous map note. Only updates for clients on area-load. Use SetMapPinEnabled() as required. +/// @param oObject The Waypoint object +/// @param sMapNote The contents to set as the Map Note. +/// @param nID The Language ID (default English) +/// @param nGender 0 = Male, 1 = Female +void NWNX_Object_SetMapNote(object oObject, string sMapNote, int nID = 0, int nGender = 0); + +/// @brief Gets the last spell cast feat of oObject. +/// @note Should be called in a spell script. +/// @param oObject The object. +/// @return The feat ID, or 65535 when not cast by a feat, or -1 on error. +int NWNX_Object_GetLastSpellCastFeat(object oObject); + +/// @brief Sets the last object that triggered door or placeable trap. +/// @note Should be retrieved with GetEnteringObject. +/// @param oObject Door or placeable object +/// @param oLast Object that last triggered trap. +void NWNX_Object_SetLastTriggered(object oObject, object oLast); + +/// @brief Gets the remaining duration of the AoE object. +/// @param oAoE The AreaOfEffect object. +/// @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); + +/// @brief Return the name of the object for nLanguage. +/// @param oObject an object +/// @param nLanguage A PLAYER_LANGUAGE constant. +/// @param nGender Gender to use, 0 or 1. +/// @return The localized string. +string NWNX_Object_GetLocalizedName(object oObject, int nLanguage, int nGender = 0); + +/// @brief Set the name of the object as set in the toolset for nLanguage. +/// @note You may have to SetName(oObject, "") for the translated string to show. +/// @param oObject an object +/// @param sName New value to set +/// @param nLanguage A PLAYER_LANGUAGE constant. +/// @param nGender Gender to use, 0 or 1. +void NWNX_Object_SetLocalizedName(object oObject, string sName, int nLanguage, int nGender = 0); + /// @} int NWNX_Object_GetLocalVariableCount(object obj) { - string sFunc = "GetLocalVariableCount"; - - NWNX_PushArgumentObject(NWNX_Object, sFunc, obj); - NWNX_CallFunction(NWNX_Object, sFunc); - - return NWNX_GetReturnValueInt(NWNX_Object, sFunc); + NWNXPushObject(obj); + NWNXCall(NWNX_Object, "GetLocalVariableCount"); + return NWNXPopInt(); } struct NWNX_Object_LocalVariable NWNX_Object_GetLocalVariable(object obj, int index) { - string sFunc = "GetLocalVariable"; - - NWNX_PushArgumentInt(NWNX_Object, sFunc, index); - NWNX_PushArgumentObject(NWNX_Object, sFunc, obj); - NWNX_CallFunction(NWNX_Object, sFunc); - + NWNXPushInt(index); + NWNXPushObject(obj); + NWNXCall(NWNX_Object, "GetLocalVariable"); struct NWNX_Object_LocalVariable var; - var.key = NWNX_GetReturnValueString(NWNX_Object, sFunc); - var.type = NWNX_GetReturnValueInt(NWNX_Object, sFunc); + var.key = NWNXPopString(); + var.type = NWNXPopInt(); return var; } -object NWNX_Object_StringToObject(string id) +void NWNX_Object_SetPosition(object oObject, vector vPosition, int bUpdateSubareas = TRUE) { - string sFunc = "StringToObject"; - - NWNX_PushArgumentString(NWNX_Object, sFunc, id); - NWNX_CallFunction(NWNX_Object, sFunc); - return NWNX_GetReturnValueObject(NWNX_Object, sFunc); + NWNXPushInt(bUpdateSubareas); + NWNXPushVector(vPosition); + NWNXPushObject(oObject); + NWNXCall(NWNX_Object, "SetPosition"); } -void NWNX_Object_SetPosition(object obj, vector pos) +int NWNX_Object_GetCurrentHitPoints(object creature) { - string sFunc = "SetPosition"; - - NWNX_PushArgumentFloat(NWNX_Object, sFunc, pos.x); - NWNX_PushArgumentFloat(NWNX_Object, sFunc, pos.y); - NWNX_PushArgumentFloat(NWNX_Object, sFunc, pos.z); - NWNX_PushArgumentObject(NWNX_Object, sFunc, obj); - NWNX_CallFunction(NWNX_Object, sFunc); - + NWNXPushObject(creature); + NWNXCall(NWNX_Object, "GetCurrentHitPoints"); + return NWNXPopInt(); } void NWNX_Object_SetCurrentHitPoints(object creature, int hp) { - string sFunc = "SetCurrentHitPoints"; - - NWNX_PushArgumentInt(NWNX_Object, sFunc, hp); - NWNX_PushArgumentObject(NWNX_Object, sFunc, creature); - - NWNX_CallFunction(NWNX_Object, sFunc); + NWNXPushInt(hp); + NWNXPushObject(creature); + NWNXCall(NWNX_Object, "SetCurrentHitPoints"); } void NWNX_Object_SetMaxHitPoints(object creature, int hp) { - string sFunc = "SetMaxHitPoints"; - - NWNX_PushArgumentInt(NWNX_Object, sFunc, hp); - NWNX_PushArgumentObject(NWNX_Object, sFunc, creature); - - NWNX_CallFunction(NWNX_Object, sFunc); + NWNXPushInt(hp); + NWNXPushObject(creature); + NWNXCall(NWNX_Object, "SetMaxHitPoints"); } string NWNX_Object_Serialize(object obj) { - string sFunc = "Serialize"; - - NWNX_PushArgumentObject(NWNX_Object, sFunc, obj); - - NWNX_CallFunction(NWNX_Object, sFunc); - return NWNX_GetReturnValueString(NWNX_Object, sFunc); + NWNXPushObject(obj); + NWNXCall(NWNX_Object, "Serialize"); + return NWNXPopString(); } object NWNX_Object_Deserialize(string serialized) { - string sFunc = "Deserialize"; - - NWNX_PushArgumentString(NWNX_Object, sFunc, serialized); - - NWNX_CallFunction(NWNX_Object, sFunc); - return NWNX_GetReturnValueObject(NWNX_Object, sFunc); + NWNXPushString(serialized); + NWNXCall(NWNX_Object, "Deserialize"); + return NWNXPopObject(); } string NWNX_Object_GetDialogResref(object obj) { - string sFunc = "GetDialogResref"; - - NWNX_PushArgumentObject(NWNX_Object, sFunc, obj); - - NWNX_CallFunction(NWNX_Object, sFunc); - return NWNX_GetReturnValueString(NWNX_Object, sFunc); + NWNXPushObject(obj); + NWNXCall(NWNX_Object, "GetDialogResref"); + return NWNXPopString(); } void NWNX_Object_SetDialogResref(object obj, string dialog) { - string sFunc = "SetDialogResref"; - - NWNX_PushArgumentString(NWNX_Object, sFunc, dialog); - NWNX_PushArgumentObject(NWNX_Object, sFunc, obj); - - NWNX_CallFunction(NWNX_Object, sFunc); + NWNXPushString(dialog); + NWNXPushObject(obj); + NWNXCall(NWNX_Object, "SetDialogResref"); } -void NWNX_Object_SetAppearance(object obj, int app) +void NWNX_Object_SetAppearance(object oPlaceable, int nAppearance) { - string sFunc = "SetAppearance"; - - NWNX_PushArgumentInt(NWNX_Object, sFunc, app); - NWNX_PushArgumentObject(NWNX_Object, sFunc, obj); - - NWNX_CallFunction(NWNX_Object, sFunc); + NWNXPushInt(nAppearance); + NWNXPushObject(oPlaceable); + NWNXCall(NWNX_Object, "SetAppearance"); } -int NWNX_Object_GetAppearance(object obj) +int NWNX_Object_GetAppearance(object oPlaceable) { - string sFunc = "GetAppearance"; - - NWNX_PushArgumentObject(NWNX_Object, sFunc, obj); - - NWNX_CallFunction(NWNX_Object, sFunc); - return NWNX_GetReturnValueInt(NWNX_Object, sFunc); + NWNXPushObject(oPlaceable); + NWNXCall(NWNX_Object, "GetAppearance"); + return NWNXPopInt(); } int NWNX_Object_GetHasVisualEffect(object obj, int nVFX) { - string sFunc = "GetHasVisualEffect"; - - NWNX_PushArgumentInt(NWNX_Object, sFunc, nVFX); - NWNX_PushArgumentObject(NWNX_Object, sFunc, obj); - - NWNX_CallFunction(NWNX_Object, sFunc); - - return NWNX_GetReturnValueInt(NWNX_Object, sFunc); -} - -int NWNX_Object_CheckFit(object obj, int baseitem) -{ - string sFunc = "CheckFit"; - - NWNX_PushArgumentInt(NWNX_Object, sFunc, baseitem); - NWNX_PushArgumentObject(NWNX_Object, sFunc, obj); - - NWNX_CallFunction(NWNX_Object, sFunc); - - return NWNX_GetReturnValueInt(NWNX_Object, sFunc); + NWNXPushInt(nVFX); + NWNXPushObject(obj); + NWNXCall(NWNX_Object, "GetHasVisualEffect"); + return NWNXPopInt(); } int NWNX_Object_GetDamageImmunity(object obj, int damageType) { - string sFunc = "GetDamageImmunity"; - - NWNX_PushArgumentInt(NWNX_Object, sFunc, damageType); - NWNX_PushArgumentObject(NWNX_Object, sFunc, obj); - - NWNX_CallFunction(NWNX_Object, sFunc); - - return NWNX_GetReturnValueInt(NWNX_Object, sFunc); + NWNXPushInt(damageType); + NWNXPushObject(obj); + NWNXCall(NWNX_Object, "GetDamageImmunity"); + return NWNXPopInt(); } void NWNX_Object_AddToArea(object obj, object area, vector pos) { - string sFunc = "AddToArea"; - - NWNX_PushArgumentFloat(NWNX_Object, sFunc, pos.z); - NWNX_PushArgumentFloat(NWNX_Object, sFunc, pos.y); - NWNX_PushArgumentFloat(NWNX_Object, sFunc, pos.x); - NWNX_PushArgumentObject(NWNX_Object, sFunc, area); - NWNX_PushArgumentObject(NWNX_Object, sFunc, obj); - NWNX_CallFunction(NWNX_Object, sFunc); + NWNXPushVector(pos); + NWNXPushObject(area); + NWNXPushObject(obj); + NWNXCall(NWNX_Object, "AddToArea"); } int NWNX_Object_GetPlaceableIsStatic(object obj) { - string sFunc = "GetPlaceableIsStatic"; - - NWNX_PushArgumentObject(NWNX_Object, sFunc, obj); - - NWNX_CallFunction(NWNX_Object, sFunc); - return NWNX_GetReturnValueInt(NWNX_Object, sFunc); + NWNXPushObject(obj); + NWNXCall(NWNX_Object, "GetPlaceableIsStatic"); + return NWNXPopInt(); } void NWNX_Object_SetPlaceableIsStatic(object obj, int isStatic) { - string sFunc = "SetPlaceableIsStatic"; - - NWNX_PushArgumentInt(NWNX_Object, sFunc, isStatic); - NWNX_PushArgumentObject(NWNX_Object, sFunc, obj); - - NWNX_CallFunction(NWNX_Object, sFunc); + NWNXPushInt(isStatic); + NWNXPushObject(obj); + NWNXCall(NWNX_Object, "SetPlaceableIsStatic"); } int NWNX_Object_GetAutoRemoveKey(object obj) { - string sFunc = "GetAutoRemoveKey"; - - NWNX_PushArgumentObject(NWNX_Object, sFunc, obj); - NWNX_CallFunction(NWNX_Object, sFunc); - - return NWNX_GetReturnValueInt(NWNX_Object, sFunc); + NWNXPushObject(obj); + NWNXCall(NWNX_Object, "GetAutoRemoveKey"); + return NWNXPopInt(); } void NWNX_Object_SetAutoRemoveKey(object obj, int bRemoveKey) { - string sFunc = "SetAutoRemoveKey"; - - NWNX_PushArgumentInt(NWNX_Object, sFunc, bRemoveKey); - NWNX_PushArgumentObject(NWNX_Object, sFunc, obj); - - NWNX_CallFunction(NWNX_Object, sFunc); + NWNXPushInt(bRemoveKey); + NWNXPushObject(obj); + NWNXCall(NWNX_Object, "SetAutoRemoveKey"); } string NWNX_Object_GetTriggerGeometry(object oTrigger) { - string sFunc = "GetTriggerGeometry"; - - NWNX_PushArgumentObject(NWNX_Object, sFunc, oTrigger); - NWNX_CallFunction(NWNX_Object, sFunc); - - return NWNX_GetReturnValueString(NWNX_Object, sFunc); + NWNXPushObject(oTrigger); + NWNXCall(NWNX_Object, "GetTriggerGeometry"); + return NWNXPopString(); } void NWNX_Object_SetTriggerGeometry(object oTrigger, string sGeometry) { - string sFunc = "SetTriggerGeometry"; - - NWNX_PushArgumentString(NWNX_Object, sFunc, sGeometry); - NWNX_PushArgumentObject(NWNX_Object, sFunc, oTrigger); - NWNX_CallFunction(NWNX_Object, sFunc); + NWNXPushString(sGeometry); + NWNXPushObject(oTrigger); + NWNXCall(NWNX_Object, "SetTriggerGeometry"); } -void NWNX_Object_AddIconEffect(object obj, int nIcon, float fDuration=0.0) +void NWNX_Object_Export(object oObject, string sFileName, string sAlias = "NWNX") { - string sFunc = "AddIconEffect"; - - NWNX_PushArgumentFloat(NWNX_Object, sFunc, fDuration); - NWNX_PushArgumentInt(NWNX_Object, sFunc, nIcon); - NWNX_PushArgumentObject(NWNX_Object, sFunc, obj); - NWNX_CallFunction(NWNX_Object, sFunc); -} - -void NWNX_Object_RemoveIconEffect(object obj, int nIcon) -{ - string sFunc = "RemoveIconEffect"; - - NWNX_PushArgumentInt(NWNX_Object, sFunc, nIcon); - NWNX_PushArgumentObject(NWNX_Object, sFunc, obj); - NWNX_CallFunction(NWNX_Object, sFunc); -} - -void NWNX_Object_Export(string sFileName, object oObject) -{ - string sFunc = "Export"; - - NWNX_PushArgumentObject(NWNX_Object, sFunc, oObject); - NWNX_PushArgumentString(NWNX_Object, sFunc, sFileName); - NWNX_CallFunction(NWNX_Object, sFunc); -} - -int NWNX_Object_GetPersistentInt(object oObject, string sVarName) -{ - WriteTimestampedLogEntry("WARNING: NWNX_Object_GetPersistentInt() is deprecated, please use NWNX_Object_GetInt()"); - - return NWNX_Object_GetInt(oObject, sVarName); -} - -void NWNX_Object_SetPersistentInt(object oObject, string sVarName, int nValue) -{ - WriteTimestampedLogEntry("WARNING: NWNX_Object_SetPersistentInt() is deprecated, please use NWNX_Object_SetInt()"); - - NWNX_Object_SetInt(oObject, sVarName, nValue, TRUE); -} - -void NWNX_Object_DeletePersistentInt(object oObject, string sVarName) -{ - WriteTimestampedLogEntry("WARNING: NWNX_Object_DeletePersistentInt() is deprecated, please use NWNX_Object_DeleteInt()"); - - NWNX_Object_DeleteInt(oObject, sVarName); -} - -string NWNX_Object_GetPersistentString(object oObject, string sVarName) -{ - WriteTimestampedLogEntry("WARNING: NWNX_Object_GetPersistentString() is deprecated, please use NWNX_Object_GetString()"); - - return NWNX_Object_GetString(oObject, sVarName); -} - -void NWNX_Object_SetPersistentString(object oObject, string sVarName, string sValue) -{ - WriteTimestampedLogEntry("WARNING: NWNX_Object_SetPersistentString() is deprecated, please use NWNX_Object_SetString()"); - - NWNX_Object_SetString(oObject, sVarName, sValue, TRUE); -} - -void NWNX_Object_DeletePersistentString(object oObject, string sVarName) -{ - WriteTimestampedLogEntry("WARNING: NWNX_Object_DeletePersistentString() is deprecated, please use NWNX_Object_DeleteString()"); - - NWNX_Object_DeleteString(oObject, sVarName); -} - -float NWNX_Object_GetPersistentFloat(object oObject, string sVarName) -{ - WriteTimestampedLogEntry("WARNING: NWNX_Object_GetPersistentFloat() is deprecated, please use NWNX_Object_GetFloat()"); - - return NWNX_Object_GetFloat(oObject, sVarName); -} - -void NWNX_Object_SetPersistentFloat(object oObject, string sVarName, float fValue) -{ - WriteTimestampedLogEntry("WARNING: NWNX_Object_SetPersistentFloat() is deprecated, please use NWNX_Object_SetFloat()"); - - NWNX_Object_SetFloat(oObject, sVarName, fValue, TRUE); -} - -void NWNX_Object_DeletePersistentFloat(object oObject, string sVarName) -{ - WriteTimestampedLogEntry("WARNING: NWNX_Object_DeletePersistentFloat() is deprecated, please use NWNX_Object_DeleteFloat()"); - - NWNX_Object_DeleteFloat(oObject, sVarName); + NWNXPushString(sAlias); + NWNXPushString(sFileName); + NWNXPushObject(oObject); + NWNXCall(NWNX_Object, "Export"); } int NWNX_Object_GetInt(object oObject, string sVarName) { - string sFunc = "GetInt"; - - NWNX_PushArgumentString(NWNX_Object, sFunc, sVarName); - NWNX_PushArgumentObject(NWNX_Object, sFunc, oObject); - NWNX_CallFunction(NWNX_Object, sFunc); - - return NWNX_GetReturnValueInt(NWNX_Object, sFunc); + NWNXPushString(sVarName); + NWNXPushObject(oObject); + NWNXCall(NWNX_Object, "GetInt"); + return NWNXPopInt(); } void NWNX_Object_SetInt(object oObject, string sVarName, int nValue, int bPersist) { - string sFunc = "SetInt"; - - NWNX_PushArgumentInt(NWNX_Object, sFunc, bPersist); - NWNX_PushArgumentInt(NWNX_Object, sFunc, nValue); - NWNX_PushArgumentString(NWNX_Object, sFunc, sVarName); - NWNX_PushArgumentObject(NWNX_Object, sFunc, oObject); - NWNX_CallFunction(NWNX_Object, sFunc); + NWNXPushInt(bPersist); + NWNXPushInt(nValue); + NWNXPushString(sVarName); + NWNXPushObject(oObject); + NWNXCall(NWNX_Object, "SetInt"); } void NWNX_Object_DeleteInt(object oObject, string sVarName) { - string sFunc = "DeleteInt"; - - NWNX_PushArgumentString(NWNX_Object, sFunc, sVarName); - NWNX_PushArgumentObject(NWNX_Object, sFunc, oObject); - NWNX_CallFunction(NWNX_Object, sFunc); + NWNXPushString(sVarName); + NWNXPushObject(oObject); + NWNXCall(NWNX_Object, "DeleteInt"); } string NWNX_Object_GetString(object oObject, string sVarName) { - string sFunc = "GetString"; - - NWNX_PushArgumentString(NWNX_Object, sFunc, sVarName); - NWNX_PushArgumentObject(NWNX_Object, sFunc, oObject); - NWNX_CallFunction(NWNX_Object, sFunc); - - return NWNX_GetReturnValueString(NWNX_Object, sFunc); + NWNXPushString(sVarName); + NWNXPushObject(oObject); + NWNXCall(NWNX_Object, "GetString"); + return NWNXPopString(); } void NWNX_Object_SetString(object oObject, string sVarName, string sValue, int bPersist) { - string sFunc = "SetString"; - - NWNX_PushArgumentInt(NWNX_Object, sFunc, bPersist); - NWNX_PushArgumentString(NWNX_Object, sFunc, sValue); - NWNX_PushArgumentString(NWNX_Object, sFunc, sVarName); - NWNX_PushArgumentObject(NWNX_Object, sFunc, oObject); - NWNX_CallFunction(NWNX_Object, sFunc); + NWNXPushInt(bPersist); + NWNXPushString(sValue); + NWNXPushString(sVarName); + NWNXPushObject(oObject); + NWNXCall(NWNX_Object, "SetString"); } void NWNX_Object_DeleteString(object oObject, string sVarName) { - string sFunc = "DeleteString"; - - NWNX_PushArgumentString(NWNX_Object, sFunc, sVarName); - NWNX_PushArgumentObject(NWNX_Object, sFunc, oObject); - NWNX_CallFunction(NWNX_Object, sFunc); + NWNXPushString(sVarName); + NWNXPushObject(oObject); + NWNXCall(NWNX_Object, "DeleteString"); } float NWNX_Object_GetFloat(object oObject, string sVarName) { - string sFunc = "GetFloat"; - - NWNX_PushArgumentString(NWNX_Object, sFunc, sVarName); - NWNX_PushArgumentObject(NWNX_Object, sFunc, oObject); - NWNX_CallFunction(NWNX_Object, sFunc); - - return NWNX_GetReturnValueFloat(NWNX_Object, sFunc); + NWNXPushString(sVarName); + NWNXPushObject(oObject); + NWNXCall(NWNX_Object, "GetFloat"); + return NWNXPopFloat(); } void NWNX_Object_SetFloat(object oObject, string sVarName, float fValue, int bPersist) { - string sFunc = "SetFloat"; - - NWNX_PushArgumentInt(NWNX_Object, sFunc, bPersist); - NWNX_PushArgumentFloat(NWNX_Object, sFunc, fValue); - NWNX_PushArgumentString(NWNX_Object, sFunc, sVarName); - NWNX_PushArgumentObject(NWNX_Object, sFunc, oObject); - NWNX_CallFunction(NWNX_Object, sFunc); + NWNXPushInt(bPersist); + NWNXPushFloat(fValue); + NWNXPushString(sVarName); + NWNXPushObject(oObject); + NWNXCall(NWNX_Object, "SetFloat"); } void NWNX_Object_DeleteFloat(object oObject, string sVarName) { - string sFunc = "DeleteFloat"; - - NWNX_PushArgumentString(NWNX_Object, sFunc, sVarName); - NWNX_PushArgumentObject(NWNX_Object, sFunc, oObject); - NWNX_CallFunction(NWNX_Object, sFunc); + NWNXPushString(sVarName); + NWNXPushObject(oObject); + NWNXCall(NWNX_Object, "DeleteFloat"); } void NWNX_Object_DeleteVarRegex(object oObject, string sRegex) { - string sFunc = "DeleteVarRegex"; - - NWNX_PushArgumentString(NWNX_Object, sFunc, sRegex); - NWNX_PushArgumentObject(NWNX_Object, sFunc, oObject); - NWNX_CallFunction(NWNX_Object, sFunc); + NWNXPushString(sRegex); + NWNXPushObject(oObject); + NWNXCall(NWNX_Object, "DeleteVarRegex"); } int NWNX_Object_GetPositionIsInTrigger(object oTrigger, vector vPosition) { - string sFunc = "GetPositionIsInTrigger"; - - NWNX_PushArgumentFloat(NWNX_Object, sFunc, vPosition.z); - NWNX_PushArgumentFloat(NWNX_Object, sFunc, vPosition.y); - NWNX_PushArgumentFloat(NWNX_Object, sFunc, vPosition.x); - NWNX_PushArgumentObject(NWNX_Object, sFunc, oTrigger); - NWNX_CallFunction(NWNX_Object, sFunc); - - return NWNX_GetReturnValueInt(NWNX_Object, sFunc); + NWNXPushVector(vPosition); + NWNXPushObject(oTrigger); + NWNXCall(NWNX_Object, "GetPositionIsInTrigger"); + return NWNXPopInt(); } int NWNX_Object_GetInternalObjectType(object oObject) { - string sFunc = "GetInternalObjectType"; - - NWNX_PushArgumentObject(NWNX_Object, sFunc, oObject); - NWNX_CallFunction(NWNX_Object, sFunc); - - return NWNX_GetReturnValueInt(NWNX_Object, sFunc); + NWNXPushObject(oObject); + NWNXCall(NWNX_Object, "GetInternalObjectType"); + return NWNXPopInt(); } int NWNX_Object_AcquireItem(object oObject, object oItem) { - string sFunc = "AcquireItem"; - - NWNX_PushArgumentObject(NWNX_Object, sFunc, oItem); - NWNX_PushArgumentObject(NWNX_Object, sFunc, oObject); - NWNX_CallFunction(NWNX_Object, sFunc); - - return NWNX_GetReturnValueInt(NWNX_Object, sFunc); -} - -void NWNX_Object_SetFacing(object oObject, float fDirection) -{ - string sFunc = "SetFacing"; - - NWNX_PushArgumentFloat(NWNX_Object, sFunc, fDirection); - NWNX_PushArgumentObject(NWNX_Object, sFunc, oObject); - NWNX_CallFunction(NWNX_Object, sFunc); + NWNXPushObject(oItem); + NWNXPushObject(oObject); + NWNXCall(NWNX_Object, "AcquireItem"); + return NWNXPopInt(); } void NWNX_Object_ClearSpellEffectsOnOthers(object oObject) { - string sFunc = "ClearSpellEffectsOnOthers"; - - NWNX_PushArgumentObject(NWNX_Object, sFunc, oObject); - NWNX_CallFunction(NWNX_Object, sFunc); + NWNXPushObject(oObject); + NWNXCall(NWNX_Object, "ClearSpellEffectsOnOthers"); } string NWNX_Object_PeekUUID(object oObject) { - string sFunc = "PeekUUID"; - - NWNX_PushArgumentObject(NWNX_Object, sFunc, oObject); - NWNX_CallFunction(NWNX_Object, sFunc); - - return NWNX_GetReturnValueString(NWNX_Object, sFunc); + NWNXPushObject(oObject); + NWNXCall(NWNX_Object, "PeekUUID"); + return NWNXPopString(); +} + +int NWNX_Object_GetDoorHasVisibleModel(object oDoor) +{ + NWNXPushObject(oDoor); + NWNXCall(NWNX_Object, "GetDoorHasVisibleModel"); + return NWNXPopInt(); +} + +int NWNX_Object_GetIsDestroyable(object oObject) +{ + NWNXPushObject(oObject); + NWNXCall(NWNX_Object, "GetIsDestroyable"); + return NWNXPopInt(); +} + +int NWNX_Object_DoSpellImmunity(object oDefender, object oCaster, int nSpellId=-1) +{ + NWNXPushInt(nSpellId); + NWNXPushObject(oCaster); + NWNXPushObject(oDefender); + NWNXCall(NWNX_Object, "DoSpellImmunity"); + return NWNXPopInt(); +} + +int NWNX_Object_DoSpellLevelAbsorption(object oDefender, object oCaster, int nSpellId=-1, int nSpellLevel=-1, int nSpellSchool=-1) +{ + NWNXPushInt(nSpellSchool); + NWNXPushInt(nSpellLevel); + NWNXPushInt(nSpellId); + NWNXPushObject(oCaster); + NWNXPushObject(oDefender); + NWNXCall(NWNX_Object, "DoSpellLevelAbsorption"); + return NWNXPopInt(); +} + +void NWNX_Object_SetHasInventory(object obj, int bHasInventory) +{ + NWNXPushInt(bHasInventory); + NWNXPushObject(obj); + NWNXCall(NWNX_Object, "SetHasInventory"); +} + +int NWNX_Object_GetCurrentAnimation(object oObject) +{ + NWNXPushObject(oObject); + NWNXCall(NWNX_Object, "GetCurrentAnimation"); + return NWNXPopInt(); +} + +int NWNX_Object_GetAILevel(object oObject) +{ + NWNXPushObject(oObject); + NWNXCall(NWNX_Object, "GetAILevel"); + return NWNXPopInt(); +} + +void NWNX_Object_SetAILevel(object oObject, int nLevel) +{ + NWNXPushInt(nLevel); + NWNXPushObject(oObject); + NWNXCall(NWNX_Object, "SetAILevel"); +} + +string NWNX_Object_GetMapNote(object oObject, int nID = 0, int nGender = 0) +{ + NWNXPushInt(nGender); + NWNXPushInt(nID); + NWNXPushObject(oObject); + NWNXCall(NWNX_Object, "GetMapNote"); + return NWNXPopString(); +} + +void NWNX_Object_SetMapNote(object oObject, string sMapNote, int nID = 0, int nGender = 0) +{ + NWNXPushInt(nGender); + NWNXPushInt(nID); + NWNXPushString(sMapNote); + NWNXPushObject(oObject); + NWNXCall(NWNX_Object, "SetMapNote"); +} + +int NWNX_Object_GetLastSpellCastFeat(object oObject) +{ + NWNXPushObject(oObject); + NWNXCall(NWNX_Object, "GetLastSpellCastFeat"); + return NWNXPopInt(); +} + +void NWNX_Object_SetLastTriggered(object oObject, object oLast) +{ + NWNXPushObject(oLast); + NWNXPushObject(oObject); + NWNXCall(NWNX_Object, "SetLastTriggered"); +} + +float NWNX_Object_GetAoEObjectDurationRemaining(object oAoE) +{ + NWNXPushObject(oAoE); + NWNXCall(NWNX_Object, "GetAoEObjectDurationRemaining"); + return NWNXPopFloat(); +} + +void NWNX_Object_SetConversationPrivate(object oObject, int bPrivate) +{ + NWNXPushInt(bPrivate); + NWNXPushObject(oObject); + NWNXCall(NWNX_Object, "SetConversationPrivate"); +} + +void NWNX_Object_SetAoEObjectRadius(object oAoE, float fRadius) +{ + NWNXPushFloat(fRadius); + NWNXPushObject(oAoE); + NWNXCall(NWNX_Object, "SetAoEObjectRadius"); +} + +float NWNX_Object_GetAoEObjectRadius(object oAoE) +{ + NWNXPushObject(oAoE); + NWNXCall(NWNX_Object, "GetAoEObjectRadius"); + return NWNXPopFloat(); +} + +int NWNX_Object_GetLastSpellCastSpontaneous(object oObject) +{ + NWNXPushObject(oObject); + NWNXCall(NWNX_Object, "GetLastSpellCastSpontaneous"); + return NWNXPopInt(); +} + +int NWNX_Object_GetLastSpellCastDomainLevel(object oObject) +{ + NWNXPushObject(oObject); + NWNXCall(NWNX_Object, "GetLastSpellCastDomainLevel"); + return NWNXPopInt(); +} + +void NWNX_Object_ForceAssignUUID(object oObject, string sUUID) +{ + NWNXPushString(sUUID); + NWNXPushObject(oObject); + NWNXCall(NWNX_Object, "ForceAssignUUID"); +} + +int NWNX_Object_GetInventoryItemCount(object oObject) +{ + NWNXPushObject(oObject); + NWNXCall(NWNX_Object, "GetInventoryItemCount"); + return NWNXPopInt(); +} + +void NWNX_Object_OverrideSpellProjectileVFX(object oCreature, int nProjectileType = -1, int nProjectilePathType = -1, int nSpellID = -1, int bPersist = FALSE) +{ + NWNXPushInt(bPersist); + NWNXPushInt(nSpellID); + NWNXPushInt(nProjectilePathType); + NWNXPushInt(nProjectileType); + NWNXPushObject(oCreature); + NWNXCall(NWNX_Object, "OverrideSpellProjectileVFX"); +} + +int NWNX_Object_GetLastSpellInstant() +{ + NWNXCall(NWNX_Object, "GetLastSpellInstant"); + return NWNXPopInt(); +} + +void NWNX_Object_SetTrapCreator(object oObject, object oCreator) +{ + NWNXPushObject(oCreator); + NWNXPushObject(oObject); + NWNXCall(NWNX_Object, "SetTrapCreator"); +} + +string NWNX_Object_GetLocalizedName(object oObject, int nLanguage, int nGender = 0) +{ + string sFunc = "GetLocalizedName"; + + NWNXPushInt(nGender); + NWNXPushInt(nLanguage); + NWNXPushObject(oObject); + + NWNXCall(NWNX_Object, sFunc); + return NWNXPopString(); +} + +void NWNX_Object_SetLocalizedName(object oObject, string sName, int nLanguage, int nGender = 0) +{ + string sFunc = "SetLocalizedName"; + + NWNXPushInt(nGender); + NWNXPushInt(nLanguage); + NWNXPushString(sName); + NWNXPushObject(oObject); + + NWNXCall(NWNX_Object, sFunc); } diff --git a/_module/nss/nwnx_player.nss b/_module/nss/nwnx_player.nss index d2c2191..95d0bcd 100644 --- a/_module/nss/nwnx_player.nss +++ b/_module/nss/nwnx_player.nss @@ -2,7 +2,6 @@ /// @brief Functions exposing additional player properties. /// @{ /// @file nwnx_player.nss -#include "nwnx" const string NWNX_Player = "NWNX_Player"; ///< @private @@ -24,6 +23,22 @@ struct NWNX_Player_QuickBarSlot object oAssociate; ///< @todo Describe }; +/// @brief A journal entry. +struct NWNX_Player_JournalEntry +{ + string sName;///< @todo Describe + string sText;///< @todo Describe + string sTag;///< @todo Describe + int nState;///< @todo Describe + int nPriority;///< @todo Describe + int nQuestCompleted;///< @todo Describe + int nQuestDisplayed;///< @todo Describe + int nUpdated;///< @todo Describe + int nCalendarDay;///< @todo Describe + int nTimeOfDay;///< @todo Describe +}; + + /// @name Timing Bar Types /// @anchor timing_bar_types /// @@ -119,7 +134,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. @@ -174,8 +192,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. @@ -289,26 +310,163 @@ int NWNX_Player_GetLanguage(object oPlayer); /// @param sNewResName The new res name or "" to clear a previous override, 16 characters or less. void NWNX_Player_SetResManOverride(object oPlayer, int nResType, string sOldResName, string sNewResName); +/// @brief Set nCustomTokenNumber to sTokenValue for oPlayer only. +/// @note The basegame SetCustomToken() will override any personal tokens. +/// @param oPlayer The player object. +/// @param nCustomTokenNumber The token number. +/// @param sTokenValue The token text. +void NWNX_Player_SetCustomToken(object oPlayer, int nCustomTokenNumber, string sTokenValue); + +/// @brief Override the name of creature for player only +/// @param oPlayer The player object. +/// @param oCreature The creature object. +/// @param sName The name for the creature for this player, "" to clear the override. +void NWNX_Player_SetCreatureNameOverride(object oPlayer, object oCreature, string sName); + +/// @brief Display floaty text above oCreature for oPlayer only. +/// @note This will also display the floaty text above creatures that are not part of oPlayer's faction. +/// @param oPlayer The player to display the text to. +/// @param oCreature The creature to display the text above. +/// @param sText The text to display. +/// @param bChatWindow If TRUE, sText will be displayed in oPlayer's chat window. +void NWNX_Player_FloatingTextStringOnCreature(object oPlayer, object oCreature, string sText, int bChatWindow = TRUE); + +/// @brief Toggle oPlayer's PlayerDM status. +/// @note This function does nothing for actual DMClient DMs or players with a client version < 8193.14 +/// @param oPlayer The player. +/// @param bIsDM TRUE to toggle dm mode on, FALSE for off. +void NWNX_Player_ToggleDM(object oPlayer, int bIsDM); + +/// @brief Override the mouse cursor of oObject for oPlayer only +/// @param oPlayer The player object. +/// @param oObject The object. +/// @param nCursor The cursor, one of MOUSECURSOR_*. -1 to clear the override. +void NWNX_Player_SetObjectMouseCursorOverride(object oPlayer, object oObject, int nCursor); + +/// @brief Override the hilite color of oObject for oPlayer only +/// @param oPlayer The player object. +/// @param oObject The object. +/// @param nColor The color in 0xRRGGBB format, -1 to clear the override. +void NWNX_Player_SetObjectHiliteColorOverride(object oPlayer, object oObject, int nColor); + +/// @brief Remove effects with sEffectTag from oPlayer's TURD +/// @note This function should be called in the NWNX_ON_CLIENT_DISCONNECT_AFTER event, OnClientLeave is too early for the TURD to exist. +/// @param oPlayer The player object. +/// @param sEffectTag The effect tag. +void NWNX_Player_RemoveEffectFromTURD(object oPlayer, string sEffectTag); + +/// @brief Set the location oPlayer will spawn when logging in to the server. +/// @note This function is best called in the NWNX_ON_ELC_VALIDATE_CHARACTER_BEFORE event, OnClientEnter will be too late. +/// @param oPlayer The player object. +/// @param locSpawn The location. +void NWNX_Player_SetSpawnLocation(object oPlayer, location locSpawn); + +/// @brief Resends palettes to a DM. +/// @param oPlayer - the DM to send them to. +void NWNX_Player_SendDMAllCreatorLists(object oPlayer); + +/// @brief Give a custom journal entry to oPlayer. +/// @warning Custom entries are wiped on client enter - they must be reapplied. +/// @param oPlayer The player object. +/// @param journalEntry The journal entry in the form of a struct. +/// @param nSilentUpdate 0 = Notify player via sound effects and feedback message, 1 = Suppress sound effects and feedback message +/// @return a positive number to indicate the new amount of journal entries on the player. +/// @note In contrast to conventional nwn journal entries - this method will overwrite entries with the same tag, so the index / count of entries +/// will only increase if you add new entries with unique tags +int NWNX_Player_AddCustomJournalEntry(object oPlayer, struct NWNX_Player_JournalEntry journalEntry, int nSilentUpdate = 0); + +/// @brief Returns a struct containing a journal entry that can then be modified. +/// @param oPlayer The player object. +/// @param questTag The quest tag you wish to get the journal entry for. +/// @return a struct containing the journal entry data. +/// @note This method will return -1 for the Updated field in the event that no matching journal entry was found, +/// only the last matching quest tag will be returned. Eg: If you add 3 journal updates to a player, only the 3rd one will be returned as +/// that is the active one that the player currently sees. +struct NWNX_Player_JournalEntry NWNX_Player_GetJournalEntry(object oPlayer, string questTag); + +/// @brief Closes any store oPlayer may have open. +/// @param oPlayer The player object. +void NWNX_Player_CloseStore(object oPlayer); + +/// @brief Override nStrRef from the TlkTable with sOverride for oPlayer only. +/// @param oPlayer The player. +/// @param nStrRef The StrRef. +/// @param sOverride The new value for nStrRef or "" to remove the override. +/// @param bRestoreGlobal If TRUE, when removing a personal override it will attempt to restore the global override if it exists. +/// @note Overrides will not persist through relogging. +void NWNX_Player_SetTlkOverride(object oPlayer, int nStrRef, string sOverride, int bRestoreGlobal = TRUE); + +/// @brief Make the player reload it's TlkTable. +/// @param oPlayer The player. +void NWNX_Player_ReloadTlk(object oPlayer); + +/// @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); + +/// @brief Reloads the color palettes for oPlayer +/// @param oPlayer The player to reload the color palette for +void NWNX_Player_ReloadColorPalettes(object oPlayer); + /// @} void NWNX_Player_ForcePlaceableExamineWindow(object player, object placeable) { - string sFunc = "ForcePlaceableExamineWindow"; - - NWNX_PushArgumentObject(NWNX_Player, sFunc, placeable); - NWNX_PushArgumentObject(NWNX_Player, sFunc, player); - - NWNX_CallFunction(NWNX_Player, sFunc); + NWNXPushObject(placeable); + NWNXPushObject(player); + NWNXCall(NWNX_Player, "ForcePlaceableExamineWindow"); } void NWNX_Player_ForcePlaceableInventoryWindow(object player, object placeable) { - string sFunc = "ForcePlaceableInventoryWindow"; - - NWNX_PushArgumentObject(NWNX_Player, sFunc, placeable); - NWNX_PushArgumentObject(NWNX_Player, sFunc, player); - - NWNX_CallFunction(NWNX_Player, sFunc); + NWNXPushObject(placeable); + NWNXPushObject(player); + NWNXCall(NWNX_Player, "ForcePlaceableInventoryWindow"); } void NWNX_Player_INTERNAL_StopGuiTimingBar(object player, string script = "", int id = -1) ///< @private @@ -317,17 +475,12 @@ void NWNX_Player_INTERNAL_StopGuiTimingBar(object player, string script = "", in // Either the timing event was never started, or it already finished. if (activeId == 0) return; - // If id != -1, we ended up here through DelayCommand. Make sure it's for the right ID if (id != -1 && id != activeId) return; - DeleteLocalInt(player, "NWNX_PLAYER_GUI_TIMING_ACTIVE"); - - string sFunc = "StopGuiTimingBar"; - NWNX_PushArgumentObject(NWNX_Player, sFunc, player); - NWNX_CallFunction(NWNX_Player, sFunc); - + NWNXPushObject(player); + NWNXCall(NWNX_Player, "StopGuiTimingBar"); if(script != "") { ExecuteScript(script, player); @@ -338,18 +491,13 @@ void NWNX_Player_StartGuiTimingBar(object player, float seconds, string script = { if (GetLocalInt(player, "NWNX_PLAYER_GUI_TIMING_ACTIVE")) return; - - string sFunc = "StartGuiTimingBar"; - NWNX_PushArgumentInt(NWNX_Player, sFunc, type); - NWNX_PushArgumentFloat(NWNX_Player, sFunc, seconds); - NWNX_PushArgumentObject(NWNX_Player, sFunc, player); - - NWNX_CallFunction(NWNX_Player, sFunc); - + NWNXPushInt(type); + NWNXPushFloat(seconds); + NWNXPushObject(player); + NWNXCall(NWNX_Player, "StartGuiTimingBar"); int id = GetLocalInt(player, "NWNX_PLAYER_GUI_TIMING_ID") + 1; SetLocalInt(player, "NWNX_PLAYER_GUI_TIMING_ACTIVE", id); SetLocalInt(player, "NWNX_PLAYER_GUI_TIMING_ID", id); - DelayCommand(seconds, NWNX_Player_INTERNAL_StopGuiTimingBar(player, script, id)); } @@ -360,360 +508,471 @@ void NWNX_Player_StopGuiTimingBar(object player, string script = "") void NWNX_Player_SetAlwaysWalk(object player, int bWalk=TRUE) { - string sFunc = "SetAlwaysWalk"; - - NWNX_PushArgumentInt(NWNX_Player, sFunc, bWalk); - NWNX_PushArgumentObject(NWNX_Player, sFunc, player); - - NWNX_CallFunction(NWNX_Player, sFunc); + NWNXPushInt(bWalk); + NWNXPushObject(player); + NWNXCall(NWNX_Player, "SetAlwaysWalk"); } struct NWNX_Player_QuickBarSlot NWNX_Player_GetQuickBarSlot(object player, int slot) { - string sFunc = "GetQuickBarSlot"; struct NWNX_Player_QuickBarSlot qbs; - - NWNX_PushArgumentInt(NWNX_Player, sFunc, slot); - NWNX_PushArgumentObject(NWNX_Player, sFunc, player); - NWNX_CallFunction(NWNX_Player, sFunc); - - qbs.oAssociate = NWNX_GetReturnValueObject(NWNX_Player, sFunc); - qbs.nAssociateType = NWNX_GetReturnValueInt(NWNX_Player, sFunc); - qbs.nDomainLevel = NWNX_GetReturnValueInt(NWNX_Player, sFunc); - qbs.nMetaType = NWNX_GetReturnValueInt(NWNX_Player, sFunc); - qbs.nINTParam1 = NWNX_GetReturnValueInt(NWNX_Player, sFunc); - qbs.sToolTip = NWNX_GetReturnValueString(NWNX_Player, sFunc); - qbs.sCommandLine = NWNX_GetReturnValueString(NWNX_Player, sFunc); - qbs.sCommandLabel = NWNX_GetReturnValueString(NWNX_Player, sFunc); - qbs.sResRef = NWNX_GetReturnValueString(NWNX_Player, sFunc); - qbs.nMultiClass = NWNX_GetReturnValueInt(NWNX_Player, sFunc); - qbs.nObjectType = NWNX_GetReturnValueInt(NWNX_Player, sFunc); - qbs.oSecondaryItem = NWNX_GetReturnValueObject(NWNX_Player, sFunc); - qbs.oItem = NWNX_GetReturnValueObject(NWNX_Player, sFunc); - + NWNXPushInt(slot); + NWNXPushObject(player); + NWNXCall(NWNX_Player, "GetQuickBarSlot"); + qbs.oAssociate = NWNXPopObject(); + qbs.nAssociateType = NWNXPopInt(); + qbs.nDomainLevel = NWNXPopInt(); + qbs.nMetaType = NWNXPopInt(); + qbs.nINTParam1 = NWNXPopInt(); + qbs.sToolTip = NWNXPopString(); + qbs.sCommandLine = NWNXPopString(); + qbs.sCommandLabel = NWNXPopString(); + qbs.sResRef = NWNXPopString(); + qbs.nMultiClass = NWNXPopInt(); + qbs.nObjectType = NWNXPopInt(); + qbs.oSecondaryItem = NWNXPopObject(); + qbs.oItem = NWNXPopObject(); return qbs; } void NWNX_Player_SetQuickBarSlot(object player, int slot, struct NWNX_Player_QuickBarSlot qbs) { - string sFunc = "SetQuickBarSlot"; - - NWNX_PushArgumentObject(NWNX_Player, sFunc, qbs.oItem); - NWNX_PushArgumentObject(NWNX_Player, sFunc, qbs.oSecondaryItem); - NWNX_PushArgumentInt(NWNX_Player, sFunc, qbs.nObjectType); - NWNX_PushArgumentInt(NWNX_Player, sFunc, qbs.nMultiClass); - NWNX_PushArgumentString(NWNX_Player, sFunc, qbs.sResRef); - NWNX_PushArgumentString(NWNX_Player, sFunc, qbs.sCommandLabel); - NWNX_PushArgumentString(NWNX_Player, sFunc, qbs.sCommandLine); - NWNX_PushArgumentString(NWNX_Player, sFunc, qbs.sToolTip); - NWNX_PushArgumentInt(NWNX_Player, sFunc, qbs.nINTParam1); - NWNX_PushArgumentInt(NWNX_Player, sFunc, qbs.nMetaType); - NWNX_PushArgumentInt(NWNX_Player, sFunc, qbs.nDomainLevel); - NWNX_PushArgumentInt(NWNX_Player, sFunc, qbs.nAssociateType); - NWNX_PushArgumentObject(NWNX_Player, sFunc, qbs.oAssociate); - - NWNX_PushArgumentInt(NWNX_Player, sFunc, slot); - NWNX_PushArgumentObject(NWNX_Player, sFunc, player); - NWNX_CallFunction(NWNX_Player, sFunc); + NWNXPushObject(qbs.oItem); + NWNXPushObject(qbs.oSecondaryItem); + NWNXPushInt(qbs.nObjectType); + NWNXPushInt(qbs.nMultiClass); + NWNXPushString(qbs.sResRef); + NWNXPushString(qbs.sCommandLabel); + NWNXPushString(qbs.sCommandLine); + NWNXPushString(qbs.sToolTip); + NWNXPushInt(qbs.nINTParam1); + NWNXPushInt(qbs.nMetaType); + NWNXPushInt(qbs.nDomainLevel); + NWNXPushInt(qbs.nAssociateType); + NWNXPushObject(qbs.oAssociate); + NWNXPushInt(slot); + NWNXPushObject(player); + NWNXCall(NWNX_Player, "SetQuickBarSlot"); } string NWNX_Player_GetBicFileName(object player) { - string sFunc = "GetBicFileName"; - - NWNX_PushArgumentObject(NWNX_Player, sFunc, player); - NWNX_CallFunction(NWNX_Player, sFunc); - return NWNX_GetReturnValueString(NWNX_Player, sFunc); + NWNXPushObject(player); + NWNXCall(NWNX_Player, "GetBicFileName"); + return NWNXPopString(); } -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(NWNX_Player, sFunc, position.x); - NWNX_PushArgumentFloat(NWNX_Player, sFunc, position.y); - NWNX_PushArgumentFloat(NWNX_Player, sFunc, position.z); - NWNX_PushArgumentInt(NWNX_Player, sFunc, effectId); - NWNX_PushArgumentObject(NWNX_Player, sFunc, player); - - NWNX_CallFunction(NWNX_Player, sFunc); + NWNXPushVector(rotate); + NWNXPushVector(translate); + NWNXPushFloat(scale); + NWNXPushVector(position); + NWNXPushInt(effectId); + NWNXPushObject(player); + NWNXCall(NWNX_Player, "ShowVisualEffect"); } void NWNX_Player_MusicBackgroundChangeDay(object player, int track) { - string sFunc = "ChangeBackgroundMusic"; - - NWNX_PushArgumentInt(NWNX_Player, sFunc, track); - NWNX_PushArgumentInt(NWNX_Player, sFunc, TRUE); // bool day = TRUE - NWNX_PushArgumentObject(NWNX_Player, sFunc, player); - - NWNX_CallFunction(NWNX_Player, sFunc); + NWNXPushInt(track); + NWNXPushInt(TRUE); + NWNXPushObject(player); + NWNXCall(NWNX_Player, "ChangeBackgroundMusic"); } void NWNX_Player_MusicBackgroundChangeNight(object player, int track) { - string sFunc = "ChangeBackgroundMusic"; - - NWNX_PushArgumentInt(NWNX_Player, sFunc, track); - NWNX_PushArgumentInt(NWNX_Player, sFunc, FALSE); // bool day = FALSE - NWNX_PushArgumentObject(NWNX_Player, sFunc, player); - - NWNX_CallFunction(NWNX_Player, sFunc); + NWNXPushInt(track); + NWNXPushInt(FALSE); + NWNXPushObject(player); + NWNXCall(NWNX_Player, "ChangeBackgroundMusic"); } void NWNX_Player_MusicBackgroundStart(object player) { - string sFunc = "PlayBackgroundMusic"; - - NWNX_PushArgumentInt(NWNX_Player, sFunc, TRUE); // bool play = TRUE - NWNX_PushArgumentObject(NWNX_Player, sFunc, player); - - NWNX_CallFunction(NWNX_Player, sFunc); + NWNXPushInt(TRUE); + NWNXPushObject(player); + NWNXCall(NWNX_Player, "PlayBackgroundMusic"); } void NWNX_Player_MusicBackgroundStop(object player) { - string sFunc = "PlayBackgroundMusic"; - - NWNX_PushArgumentInt(NWNX_Player, sFunc, FALSE); // bool play = FALSE - NWNX_PushArgumentObject(NWNX_Player, sFunc, player); - - NWNX_CallFunction(NWNX_Player, sFunc); + NWNXPushInt(FALSE); + NWNXPushObject(player); + NWNXCall(NWNX_Player, "PlayBackgroundMusic"); } void NWNX_Player_MusicBattleChange(object player, int track) { - string sFunc = "ChangeBattleMusic"; - - NWNX_PushArgumentInt(NWNX_Player, sFunc, track); - NWNX_PushArgumentObject(NWNX_Player, sFunc, player); - - NWNX_CallFunction(NWNX_Player, sFunc); + NWNXPushInt(track); + NWNXPushObject(player); + NWNXCall(NWNX_Player, "ChangeBattleMusic"); } void NWNX_Player_MusicBattleStart(object player) { - string sFunc = "PlayBattleMusic"; - - NWNX_PushArgumentInt(NWNX_Player, sFunc, TRUE); // bool play = TRUE - NWNX_PushArgumentObject(NWNX_Player, sFunc, player); - - NWNX_CallFunction(NWNX_Player, sFunc); + NWNXPushInt(TRUE); + NWNXPushObject(player); + NWNXCall(NWNX_Player, "PlayBattleMusic"); } void NWNX_Player_MusicBattleStop(object player) { - string sFunc = "PlayBattleMusic"; - - NWNX_PushArgumentInt(NWNX_Player, sFunc, FALSE); // bool play = FALSE - NWNX_PushArgumentObject(NWNX_Player, sFunc, player); - - NWNX_CallFunction(NWNX_Player, sFunc); + NWNXPushInt(FALSE); + NWNXPushObject(player); + NWNXCall(NWNX_Player, "PlayBattleMusic"); } void NWNX_Player_PlaySound(object player, string sound, object target = OBJECT_INVALID) { - string sFunc = "PlaySound"; - - NWNX_PushArgumentObject(NWNX_Player, sFunc, target); - NWNX_PushArgumentString(NWNX_Player, sFunc, sound); - NWNX_PushArgumentObject(NWNX_Player, sFunc, player); - - NWNX_CallFunction(NWNX_Player, sFunc); + NWNXPushObject(target); + NWNXPushString(sound); + NWNXPushObject(player); + NWNXCall(NWNX_Player, "PlaySound"); } void NWNX_Player_SetPlaceableUsable(object player, object placeable, int usable) { - string sFunc = "SetPlaceableUsable"; - - NWNX_PushArgumentInt(NWNX_Player, sFunc, usable); - NWNX_PushArgumentObject(NWNX_Player, sFunc, placeable); - NWNX_PushArgumentObject(NWNX_Player, sFunc, player); - - NWNX_CallFunction(NWNX_Player, sFunc); + NWNXPushInt(usable); + NWNXPushObject(placeable); + NWNXPushObject(player); + NWNXCall(NWNX_Player, "SetPlaceableUsable"); } void NWNX_Player_SetRestDuration(object player, int duration) { - string sFunc = "SetRestDuration"; - - NWNX_PushArgumentInt(NWNX_Player, sFunc, duration); - NWNX_PushArgumentObject(NWNX_Player, sFunc, player); - - NWNX_CallFunction(NWNX_Player, sFunc); + NWNXPushInt(duration); + NWNXPushObject(player); + NWNXCall(NWNX_Player, "SetRestDuration"); } -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_PushArgumentInt(NWNX_Player, sFunc, visualeffect); - NWNX_PushArgumentObject(NWNX_Player, sFunc, target); - NWNX_PushArgumentObject(NWNX_Player, sFunc, player); - - NWNX_CallFunction(NWNX_Player, sFunc); + NWNXPushVector(rotate); + NWNXPushVector(translate); + NWNXPushFloat(scale); + NWNXPushInt(visualeffect); + NWNXPushObject(target); + NWNXPushObject(player); + NWNXCall(NWNX_Player, "ApplyInstantVisualEffectToObject"); } void NWNX_Player_UpdateCharacterSheet(object player) { - string sFunc = "UpdateCharacterSheet"; - - NWNX_PushArgumentObject(NWNX_Player, sFunc, player); - - NWNX_CallFunction(NWNX_Player, sFunc); + NWNXPushObject(player); + NWNXCall(NWNX_Player, "UpdateCharacterSheet"); } void NWNX_Player_OpenInventory(object player, object target, int open = TRUE) { - string sFunc = "OpenInventory"; - - NWNX_PushArgumentInt(NWNX_Player, sFunc, open); - NWNX_PushArgumentObject(NWNX_Player, sFunc, target); - NWNX_PushArgumentObject(NWNX_Player, sFunc, player); - - NWNX_CallFunction(NWNX_Player, sFunc); + NWNXPushInt(open); + NWNXPushObject(target); + NWNXPushObject(player); + NWNXCall(NWNX_Player, "OpenInventory"); } string NWNX_Player_GetAreaExplorationState(object player, object area) { - string sFunc = "GetAreaExplorationState"; - - NWNX_PushArgumentObject(NWNX_Player, sFunc, area); - NWNX_PushArgumentObject(NWNX_Player, sFunc, player); - - NWNX_CallFunction(NWNX_Player, sFunc); - return NWNX_GetReturnValueString(NWNX_Player, sFunc); + NWNXPushObject(area); + NWNXPushObject(player); + NWNXCall(NWNX_Player, "GetAreaExplorationState"); + return NWNXPopString(); } void NWNX_Player_SetAreaExplorationState(object player, object area, string str) { - string sFunc = "SetAreaExplorationState"; - - NWNX_PushArgumentString(NWNX_Player, sFunc, str); - NWNX_PushArgumentObject(NWNX_Player, sFunc, area); - NWNX_PushArgumentObject(NWNX_Player, sFunc, player); - - NWNX_CallFunction(NWNX_Player, sFunc); + NWNXPushString(str); + NWNXPushObject(area); + NWNXPushObject(player); + NWNXCall(NWNX_Player, "SetAreaExplorationState"); } void NWNX_Player_SetRestAnimation(object oPlayer, int nAnimation) { - string sFunc = "SetRestAnimation"; - - NWNX_PushArgumentInt(NWNX_Player, sFunc, nAnimation); - NWNX_PushArgumentObject(NWNX_Player, sFunc, oPlayer); - - NWNX_CallFunction(NWNX_Player, sFunc); + NWNXPushInt(nAnimation); + NWNXPushObject(oPlayer); + NWNXCall(NWNX_Player, "SetRestAnimation"); } void NWNX_Player_SetObjectVisualTransformOverride(object oPlayer, object oObject, int nTransform, float fValue) { - string sFunc = "SetObjectVisualTransformOverride"; - - NWNX_PushArgumentFloat(NWNX_Player, sFunc, fValue); - NWNX_PushArgumentInt(NWNX_Player, sFunc, nTransform); - NWNX_PushArgumentObject(NWNX_Player, sFunc, oObject); - NWNX_PushArgumentObject(NWNX_Player, sFunc, oPlayer); - - NWNX_CallFunction(NWNX_Player, sFunc); + NWNXPushFloat(fValue); + NWNXPushInt(nTransform); + NWNXPushObject(oObject); + NWNXPushObject(oPlayer); + NWNXCall(NWNX_Player, "SetObjectVisualTransformOverride"); } void NWNX_Player_ApplyLoopingVisualEffectToObject(object player, object target, int visualeffect) { - string sFunc = "ApplyLoopingVisualEffectToObject"; - - NWNX_PushArgumentInt(NWNX_Player, sFunc, visualeffect); - NWNX_PushArgumentObject(NWNX_Player, sFunc, target); - NWNX_PushArgumentObject(NWNX_Player, sFunc, player); - - NWNX_CallFunction(NWNX_Player, sFunc); + NWNXPushInt(visualeffect); + NWNXPushObject(target); + NWNXPushObject(player); + NWNXCall(NWNX_Player, "ApplyLoopingVisualEffectToObject"); } void NWNX_Player_SetPlaceableNameOverride(object player, object placeable, string name) { - string sFunc = "SetPlaceableNameOverride"; - - NWNX_PushArgumentString(NWNX_Player, sFunc, name); - NWNX_PushArgumentObject(NWNX_Player, sFunc, placeable); - NWNX_PushArgumentObject(NWNX_Player, sFunc, player); - - NWNX_CallFunction(NWNX_Player, sFunc); + NWNXPushString(name); + NWNXPushObject(placeable); + NWNXPushObject(player); + NWNXCall(NWNX_Player, "SetPlaceableNameOverride"); } int NWNX_Player_GetQuestCompleted(object player, string sQuestName) { - string sFunc = "GetQuestCompleted"; - - NWNX_PushArgumentString(NWNX_Player, sFunc, sQuestName); - NWNX_PushArgumentObject(NWNX_Player, sFunc, player); - - NWNX_CallFunction(NWNX_Player, sFunc); - return NWNX_GetReturnValueInt(NWNX_Player, sFunc); + NWNXPushString(sQuestName); + NWNXPushObject(player); + NWNXCall(NWNX_Player, "GetQuestCompleted"); + return NWNXPopInt(); } void NWNX_Player_SetPersistentLocation(string sCDKeyOrCommunityName, string sBicFileName, object oWP, int bFirstConnectOnly = TRUE) { - string sFunc = "SetPersistentLocation"; - - NWNX_PushArgumentInt(NWNX_Player, sFunc, bFirstConnectOnly); - NWNX_PushArgumentObject(NWNX_Player, sFunc, oWP); - NWNX_PushArgumentString(NWNX_Player, sFunc, sBicFileName); - NWNX_PushArgumentString(NWNX_Player, sFunc, sCDKeyOrCommunityName); - - NWNX_CallFunction(NWNX_Player, sFunc); + NWNXPushInt(bFirstConnectOnly); + NWNXPushObject(oWP); + NWNXPushString(sBicFileName); + NWNXPushString(sCDKeyOrCommunityName); + NWNXCall(NWNX_Player, "SetPersistentLocation"); } void NWNX_Player_UpdateItemName(object oPlayer, object oItem) { - string sFunc = "UpdateItemName"; - - NWNX_PushArgumentObject(NWNX_Player, sFunc, oItem); - NWNX_PushArgumentObject(NWNX_Player, sFunc, oPlayer); - - NWNX_CallFunction(NWNX_Player, sFunc); + NWNXPushObject(oItem); + NWNXPushObject(oPlayer); + NWNXCall(NWNX_Player, "UpdateItemName"); } int NWNX_Player_PossessCreature(object oPossessor, object oPossessed, int bMindImmune = TRUE, int bCreateDefaultQB = FALSE) { - string sFunc = "PossessCreature"; - - NWNX_PushArgumentInt(NWNX_Player, sFunc, bCreateDefaultQB); - NWNX_PushArgumentInt(NWNX_Player, sFunc, bMindImmune); - NWNX_PushArgumentObject(NWNX_Player, sFunc, oPossessed); - NWNX_PushArgumentObject(NWNX_Player, sFunc, oPossessor); - - NWNX_CallFunction(NWNX_Player, sFunc); - return NWNX_GetReturnValueInt(NWNX_Player, sFunc); + NWNXPushInt(bCreateDefaultQB); + NWNXPushInt(bMindImmune); + NWNXPushObject(oPossessed); + NWNXPushObject(oPossessor); + NWNXCall(NWNX_Player, "PossessCreature"); + return NWNXPopInt(); } int NWNX_Player_GetPlatformId(object oPlayer) { - string sFunc = "GetPlatformId"; - - NWNX_PushArgumentObject(NWNX_Player, sFunc, oPlayer); - - NWNX_CallFunction(NWNX_Player, sFunc); - return NWNX_GetReturnValueInt(NWNX_Player, sFunc); + NWNXPushObject(oPlayer); + NWNXCall(NWNX_Player, "GetPlatformId"); + return NWNXPopInt(); } int NWNX_Player_GetLanguage(object oPlayer) { - string sFunc = "GetLanguage"; - - NWNX_PushArgumentObject(NWNX_Player, sFunc, oPlayer); - - NWNX_CallFunction(NWNX_Player, sFunc); - return NWNX_GetReturnValueInt(NWNX_Player, sFunc); + NWNXPushObject(oPlayer); + NWNXCall(NWNX_Player, "GetLanguage"); + return NWNXPopInt(); } void NWNX_Player_SetResManOverride(object oPlayer, int nResType, string sOldResName, string sNewResName) { - string sFunc = "SetResManOverride"; - - NWNX_PushArgumentString(NWNX_Player, sFunc, sNewResName); - NWNX_PushArgumentString(NWNX_Player, sFunc, sOldResName); - NWNX_PushArgumentInt(NWNX_Player, sFunc, nResType); - NWNX_PushArgumentObject(NWNX_Player, sFunc, oPlayer); - - NWNX_CallFunction(NWNX_Player, sFunc); + NWNXPushString(sNewResName); + NWNXPushString(sOldResName); + NWNXPushInt(nResType); + NWNXPushObject(oPlayer); + NWNXCall(NWNX_Player, "SetResManOverride"); +} + +void NWNX_Player_SetCustomToken(object oPlayer, int nCustomTokenNumber, string sTokenValue) +{ + NWNXPushString(sTokenValue); + NWNXPushInt(nCustomTokenNumber); + NWNXPushObject(oPlayer); + NWNXCall(NWNX_Player, "SetCustomToken"); +} + +void NWNX_Player_SetCreatureNameOverride(object oPlayer, object oCreature, string sName) +{ + NWNXPushString(sName); + NWNXPushObject(oCreature); + NWNXPushObject(oPlayer); + NWNXCall(NWNX_Player, "SetCreatureNameOverride"); +} + +void NWNX_Player_FloatingTextStringOnCreature(object oPlayer, object oCreature, string sText, int bChatWindow = TRUE) +{ + NWNXPushInt(bChatWindow); + NWNXPushString(sText); + NWNXPushObject(oCreature); + NWNXPushObject(oPlayer); + NWNXCall(NWNX_Player, "FloatingTextStringOnCreature"); +} + +void NWNX_Player_ToggleDM(object oPlayer, int bIsDM) +{ + NWNXPushInt(bIsDM); + NWNXPushObject(oPlayer); + NWNXCall(NWNX_Player, "ToggleDM"); +} + +void NWNX_Player_SetObjectMouseCursorOverride(object oPlayer, object oObject, int nCursor) +{ + NWNXPushInt(nCursor); + NWNXPushObject(oObject); + NWNXPushObject(oPlayer); + NWNXCall(NWNX_Player, "SetObjectMouseCursorOverride"); +} + +void NWNX_Player_SetObjectHiliteColorOverride(object oPlayer, object oObject, int nColor) +{ + NWNXPushInt(nColor); + NWNXPushObject(oObject); + NWNXPushObject(oPlayer); + NWNXCall(NWNX_Player, "SetObjectHiliteColorOverride"); +} + +void NWNX_Player_RemoveEffectFromTURD(object oPlayer, string sEffectTag) +{ + NWNXPushString(sEffectTag); + NWNXPushObject(oPlayer); + NWNXCall(NWNX_Player, "RemoveEffectFromTURD"); +} + +void NWNX_Player_SetSpawnLocation(object oPlayer, location locSpawn) +{ + NWNXPushLocation(locSpawn); + NWNXPushObject(oPlayer); + NWNXCall(NWNX_Player, "SetSpawnLocation"); +} + +void NWNX_Player_SendDMAllCreatorLists(object oPlayer) +{ + NWNXPushObject(oPlayer); + NWNXCall(NWNX_Player, "SendDMAllCreatorLists"); +} + +int NWNX_Player_AddCustomJournalEntry(object oPlayer, struct NWNX_Player_JournalEntry journalEntry, int nSilentUpdate = 0) +{ + NWNXPushInt(nSilentUpdate); + NWNXPushInt(journalEntry.nTimeOfDay); + NWNXPushInt(journalEntry.nCalendarDay); + NWNXPushInt(journalEntry.nUpdated); + NWNXPushInt(journalEntry.nQuestDisplayed); + NWNXPushInt(journalEntry.nQuestCompleted); + NWNXPushInt(journalEntry.nPriority); + NWNXPushInt(journalEntry.nState); + NWNXPushString(journalEntry.sTag); + NWNXPushString(journalEntry.sText); + NWNXPushString(journalEntry.sName); + NWNXPushObject(oPlayer); + NWNXCall(NWNX_Player, "AddCustomJournalEntry"); + return NWNXPopInt(); +} + +struct NWNX_Player_JournalEntry NWNX_Player_GetJournalEntry(object oPlayer, string questTag) +{ + struct NWNX_Player_JournalEntry entry; + NWNXPushString(questTag); + NWNXPushObject(oPlayer); + NWNXCall(NWNX_Player, "GetJournalEntry"); + entry.nUpdated = NWNXPopInt(); + if(entry.nUpdated == -1) // -1 set as an indicator to say that the entry was not found + { + return entry; + } + entry.nQuestDisplayed = NWNXPopInt(); + entry.nQuestCompleted = NWNXPopInt(); + entry.nPriority = NWNXPopInt(); + entry.nState = NWNXPopInt(); + entry.nTimeOfDay = NWNXPopInt(); + entry.nCalendarDay = NWNXPopInt(); + entry.sName = NWNXPopString(); + entry.sText = NWNXPopString(); + entry.sTag = questTag; + return entry; +} + +void NWNX_Player_CloseStore(object oPlayer) +{ + NWNXPushObject(oPlayer); + NWNXCall(NWNX_Player, "CloseStore"); +} + +void NWNX_Player_SetTlkOverride(object oPlayer, int nStrRef, string sOverride, int bRestoreGlobal = TRUE) +{ + NWNXPushInt(bRestoreGlobal); + NWNXPushString(sOverride); + NWNXPushInt(nStrRef); + NWNXPushObject(oPlayer); + NWNXCall(NWNX_Player, "SetTlkOverride"); +} + +void NWNX_Player_ReloadTlk(object oPlayer) +{ + NWNXPushObject(oPlayer); + NWNXCall(NWNX_Player, "ReloadTlk"); +} + +void NWNX_Player_UpdateWind(object oPlayer, vector vDirection, float fMagnitude, float fYaw, float fPitch) +{ + NWNXPushFloat(fPitch); + NWNXPushFloat(fYaw); + NWNXPushFloat(fMagnitude); + NWNXPushVector(vDirection); + NWNXPushObject(oPlayer); + NWNXCall(NWNX_Player, "UpdateWind"); +} + +void NWNX_Player_UpdateSkyBox(object oPlayer, int nSkyBox) +{ + NWNXPushInt(nSkyBox); + NWNXPushObject(oPlayer); + NWNXCall(NWNX_Player, "UpdateSkyBox"); +} + +void NWNX_Player_UpdateFogColor(object oPlayer, int nSunFogColor, int nMoonFogColor) +{ + NWNXPushInt(nMoonFogColor); + NWNXPushInt(nSunFogColor); + NWNXPushObject(oPlayer); + NWNXCall(NWNX_Player, "UpdateFogColor"); +} + +void NWNX_Player_UpdateFogAmount(object oPlayer, int nSunFogAmount, int nMoonFogAmount) +{ + NWNXPushInt(nMoonFogAmount); + NWNXPushInt(nSunFogAmount); + NWNXPushObject(oPlayer); + NWNXCall(NWNX_Player, "UpdateFogAmount"); +} + +object NWNX_Player_GetGameObject(object oPlayer) +{ + NWNXPushObject(oPlayer); + NWNXCall(NWNX_Player, "GetGameObject"); + return NWNXPopObject(); +} + +void NWNX_Player_SetObjectUiDiscoveryMaskOverride(object oPlayer, object oObject, int nMask) +{ + NWNXPushInt(nMask); + NWNXPushObject(oObject); + NWNXPushObject(oPlayer); + NWNXCall(NWNX_Player, "SetObjectUiDiscoveryMaskOverride"); +} + +void NWNX_Player_SendPartyInvite(object oPlayer, object oInviter, int bForceInvite = FALSE, int bHideDialog = FALSE) +{ + NWNXPushInt(bHideDialog); + NWNXPushInt(bForceInvite); + NWNXPushObject(oInviter); + NWNXPushObject(oPlayer); + NWNXCall(NWNX_Player, "SendPartyInvite"); +} + +object NWNX_Player_GetTURD(object oPlayer) +{ + NWNXPushObject(oPlayer); + NWNXCall(NWNX_Player, "GetTURD"); + return NWNXPopObject(); +} + +void NWNX_Player_ReloadColorPalettes(object oPlayer) +{ + NWNXPushObject(oPlayer); + NWNXCall(NWNX_Player, "ReloadColorPalettes"); } diff --git a/_module/nss/nwnx_profiler.nss b/_module/nss/nwnx_profiler.nss index 4c7393e..9eba072 100644 --- a/_module/nss/nwnx_profiler.nss +++ b/_module/nss/nwnx_profiler.nss @@ -3,7 +3,6 @@ /// @remark These functions are for advanced users. /// @{ /// @file nwnx_profiler.nss -#include "nwnx" const string NWNX_Profiler = "NWNX_Profiler"; ///< @private @@ -39,22 +38,17 @@ void NWNX_Profiler_PopPerfScope(); void NWNX_Profiler_PushPerfScope(string name, string tag0_tag = "", string tag0_value = "") { - string sFunc = "PushPerfScope"; - - NWNX_PushArgumentString(NWNX_Profiler, sFunc, name); - if (tag0_value != "" && tag0_tag != "") { - NWNX_PushArgumentString(NWNX_Profiler, sFunc, tag0_value); - NWNX_PushArgumentString(NWNX_Profiler, sFunc, tag0_tag); + NWNXPushString(tag0_value); + NWNXPushString(tag0_tag); } - - NWNX_CallFunction(NWNX_Profiler, sFunc); + NWNXPushString(name); + NWNXCall(NWNX_Profiler, "PushPerfScope"); } void NWNX_Profiler_PopPerfScope() { - string sFunc = "PopPerfScope"; + NWNXCall(NWNX_Profiler, "PopPerfScope"); +} - NWNX_CallFunction(NWNX_Profiler, sFunc); -} \ No newline at end of file diff --git a/_module/nss/nwnx_race.nss b/_module/nss/nwnx_race.nss index 796632b..3b89228 100644 --- a/_module/nss/nwnx_race.nss +++ b/_module/nss/nwnx_race.nss @@ -2,7 +2,6 @@ /// @brief Define racial and subrace characteristics. /// @{ /// @file nwnx_race.nss -#include "nwnx" const string NWNX_Race = "NWNX_Race"; ///< @private @@ -46,27 +45,58 @@ void NWNX_Race_SetRacialModifier(int iRace, int iMod, int iParam1, int iParam2 = /// @return The parent race if applicable, if not it just returns the race passed in. int NWNX_Race_GetParentRace(int iRace); +/// @brief Associates the race with its favored enemy feat. +/// @param iRace The race +/// @param iFeat The feat +/// @note If a creature has a race that has a parent race then favored enemy bonuses will work for either race against that creature. +/// For example a creature is a Wild Elf which has a parent race of Elf, an attacker would benefit if they had either Favored Enemy: Elf +/// or Favored Enemy: Wild Elf +void NWNX_Race_SetFavoredEnemyFeat(int iRace, int iFeat); + +/// @brief Removes any nwnx_race 'Effects' on the targeted creature. Suppression lasts until levelup, next login, or Reactivated by function. +/// @param oCreature The creature to suppress +/// @note Not all nwnx_race modifiers are achieved via effect. Those that are not directly consider the creatures current race. +void NWNX_Race_SuppressCreatureRaceEffects(object oCreature); + +/// @brief Reactivates the nwnx_race 'Effects' on the targeted creature after they were Suppressed. +/// @param oCreature The creature to reactive +/// @note Safe to use on non-suppressed creatures - Triggers a refresh of effects but won't stack. +void NWNX_Race_ReactivateCreatureRaceEffects(object oCreature); + /// @} void NWNX_Race_SetRacialModifier(int iRace, int iMod, int iParam1, int iParam2 = 0xDEADBEEF, int iParam3 = 0xDEADBEEF) { - string sFunc = "SetRacialModifier"; - - NWNX_PushArgumentInt(NWNX_Race, sFunc, iParam3); - NWNX_PushArgumentInt(NWNX_Race, sFunc, iParam2); - NWNX_PushArgumentInt(NWNX_Race, sFunc, iParam1); - NWNX_PushArgumentInt(NWNX_Race, sFunc, iMod); - NWNX_PushArgumentInt(NWNX_Race, sFunc, iRace); - - NWNX_CallFunction(NWNX_Race, sFunc); + NWNXPushInt(iParam3); + NWNXPushInt(iParam2); + NWNXPushInt(iParam1); + NWNXPushInt(iMod); + NWNXPushInt(iRace); + NWNXCall(NWNX_Race, "SetRacialModifier"); } int NWNX_Race_GetParentRace(int iRace) { - string sFunc = "GetParentRace"; - - NWNX_PushArgumentInt(NWNX_Race, sFunc, iRace); - - NWNX_CallFunction(NWNX_Race, sFunc); - return NWNX_GetReturnValueInt(NWNX_Race, sFunc); + NWNXPushInt(iRace); + NWNXCall(NWNX_Race, "GetParentRace"); + return NWNXPopInt(); +} + +void NWNX_Race_SetFavoredEnemyFeat(int iRace, int iFeat) +{ + NWNXPushInt(iFeat); + NWNXPushInt(iRace); + NWNXCall(NWNX_Race, "SetFavoredEnemyFeat"); +} + +void NWNX_Race_SuppressCreatureRaceEffects(object creature) +{ + NWNXPushObject(creature); + NWNXCall(NWNX_Race, "SuppressCreatureRaceEffects"); +} + +void NWNX_Race_ReactivateCreatureRaceEffects(object oCreature) +{ + NWNXPushObject(oCreature); + NWNXCall(NWNX_Race, "ReactivateCreatureRaceEffects"); } diff --git a/_module/nss/nwnx_race_2da.nss b/_module/nss/nwnx_race_2da.nss index 66e03e4..cacd9d2 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. @@ -11,7 +10,7 @@ int NWNX_Race_GetModifierConstant(string raceMod); /// @ingroup race -/// @brief Loops through racialtypes.2da and checks for a the column for racial modifications and sets them. +/// @brief Loops through racialtypes.2da and checks for the column for racial modifications and sets them. /// @note Requires NWNX_Util_Get2DARowCount() /// @param sColumnName The column name in the racialtypes.2da that defines the 2da for the racial mods. void NWNX_Race_LoadRacialModifiers(string sColumnName = "RacialModsTable"); @@ -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_redis.nss b/_module/nss/nwnx_redis.nss index 56d0096..0ead815 100644 --- a/_module/nss/nwnx_redis.nss +++ b/_module/nss/nwnx_redis.nss @@ -3,7 +3,6 @@ /// @{ /// @file nwnx_redis.nss /// @name Redis Commands -#include "nwnx" #include "nwnx_redis_lib" @@ -77,7 +76,7 @@ int NWNX_Redis_BITCOUNT( * Perform arbitrary bitfield integer operations on strings * * Time complexity: O(1) for each subcommand specified - * Annotated return value: + * Annotated return value: */ int NWNX_Redis_BITFIELD( string key, @@ -211,7 +210,7 @@ int NWNX_Redis_BZPOPMAX( * Returns the client ID for the current connection * * Time complexity: O(1) - * Annotated return value: + * Annotated return value: */ int NWNX_Redis_CLIENT_ID(); @@ -299,7 +298,7 @@ int NWNX_Redis_CLIENT_SETNAME( * Time complexity: O(log N) where N is the number of client connections * - Valid values for unblock_type: "TIMEOUT", "ERROR" - * Annotated return value: + * Annotated return value: */ int NWNX_Redis_CLIENT_UNBLOCK( string client_id, @@ -521,7 +520,7 @@ int NWNX_Redis_CLUSTER_SETSLOT( * List replica nodes of the specified master node * * Time complexity: O(1) - * Annotated return value: + * Annotated return value: */ int NWNX_Redis_CLUSTER_SLAVES( string node_id @@ -533,7 +532,7 @@ int NWNX_Redis_CLUSTER_SLAVES( * List replica nodes of the specified master node * * Time complexity: O(1) - * Annotated return value: + * Annotated return value: */ int NWNX_Redis_CLUSTER_REPLICAS( string node_id @@ -736,7 +735,7 @@ int NWNX_Redis_ECHO( * Execute a Lua script server side * * Time complexity: Depends on the script that is executed. - * Annotated return value: + * Annotated return value: */ int NWNX_Redis_EVAL( string script, @@ -752,7 +751,7 @@ int NWNX_Redis_EVAL( * Execute a Lua script server side * * Time complexity: Depends on the script that is executed. - * Annotated return value: + * Annotated return value: */ int NWNX_Redis_EVALSHA( string sha1, @@ -961,7 +960,7 @@ int NWNX_Redis_GEORADIUS( * - Valid values for withhash: "WITHHASH" * - Valid values for order: "ASC", "DESC" - * Annotated return value: + * Annotated return value: */ int NWNX_Redis_GEORADIUSBYMEMBER( string key, @@ -1557,7 +1556,7 @@ int NWNX_Redis_MIGRATE( * MONITOR * * Listen for all requests received by the server in real time - * Annotated return value: + * Annotated return value: */ int NWNX_Redis_MONITOR(); @@ -1615,7 +1614,7 @@ int NWNX_Redis_MULTI(); * Inspect the internals of Redis objects * * Time complexity: O(1) for all the currently implemented subcommands. - * Annotated return value: + * Annotated return value: */ int NWNX_Redis_OBJECT( string subcommand, @@ -1720,7 +1719,7 @@ int NWNX_Redis_PING( * Set the value and expiration in milliseconds of a key * * Time complexity: O(1) - * Annotated return value: + * Annotated return value: */ int NWNX_Redis_PSETEX( string key, @@ -2218,7 +2217,7 @@ int NWNX_Redis_REPLICAOF( * SLOWLOG * * Manages the Redis slow queries log - * Annotated return value: + * Annotated return value: */ int NWNX_Redis_SLOWLOG( string subcommand, @@ -2382,7 +2381,7 @@ int NWNX_Redis_SWAPDB( * SYNC * * Internal command used for replication - * Annotated return value: + * Annotated return value: */ int NWNX_Redis_SYNC(); @@ -2889,7 +2888,7 @@ int NWNX_Redis_ZUNIONSTORE( * Time complexity: O(1) for every call. O(N) for a complete iteration, including enough command * calls for the cursor to return back to 0. N is the number of elements inside * the collection. - * Annotated return value: + * Annotated return value: */ int NWNX_Redis_SCAN( // Redis type: integer @@ -2909,7 +2908,7 @@ int NWNX_Redis_SCAN( * Time complexity: O(1) for every call. O(N) for a complete iteration, including enough command * calls for the cursor to return back to 0. N is the number of elements inside * the collection.. - * Annotated return value: + * Annotated return value: */ int NWNX_Redis_SSCAN( string key, @@ -2929,7 +2928,7 @@ int NWNX_Redis_SSCAN( * Time complexity: O(1) for every call. O(N) for a complete iteration, including enough command * calls for the cursor to return back to 0. N is the number of elements inside * the collection.. - * Annotated return value: + * Annotated return value: */ int NWNX_Redis_HSCAN( string key, @@ -2949,7 +2948,7 @@ int NWNX_Redis_HSCAN( * Time complexity: O(1) for every call. O(N) for a complete iteration, including enough command * calls for the cursor to return back to 0. N is the number of elements inside * the collection.. - * Annotated return value: + * Annotated return value: */ int NWNX_Redis_ZSCAN( string key, @@ -2971,7 +2970,7 @@ int NWNX_Redis_ZSCAN( * items in the stream. * - Valid values for help: "HELP" - * Annotated return value: + * Annotated return value: */ int NWNX_Redis_XINFO( // Redis type: key @@ -3119,7 +3118,7 @@ int NWNX_Redis_XREAD( * Time complexity: O(1) for all the subcommands, with the exception of the DESTROY subcommand * which takes an additional O(M) time in order to delete the M entries inside * the consumer group pending entries list (PEL). - * Annotated return value: + * Annotated return value: */ int NWNX_Redis_XGROUP( // Redis type: key @@ -3153,7 +3152,7 @@ int NWNX_Redis_XGROUP( * - Valid values for noack: "NOACK" * - Valid values for streams: "STREAMS" - * Annotated return value: + * Annotated return value: */ int NWNX_Redis_XREADGROUP( string group_group, @@ -3235,32 +3234,32 @@ int NWNX_Redis_APPEND( string key, string value ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "APPEND"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", value); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("APPEND"); + NWNXPushString(key); + NWNXPushString(value); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_AUTH( string password ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "AUTH"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", password); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("AUTH"); + NWNXPushString(password); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_BGREWRITEAOF() { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "BGREWRITEAOF"); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("BGREWRITEAOF"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_BGSAVE() { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "BGSAVE"); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("BGSAVE"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_BITCOUNT( @@ -3270,12 +3269,12 @@ int NWNX_Redis_BITCOUNT( // Redis type: integer int end = 0 ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "BITCOUNT"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - if (start != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(start)); - if (end != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(end)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("BITCOUNT"); + NWNXPushString(key); + if (start != 0) NWNXPushString(IntToString(start)); + if (end != 0) NWNXPushString(IntToString(end)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_BITFIELD( @@ -3297,18 +3296,18 @@ int NWNX_Redis_BITFIELD( // Redis type: integer int incrby_increment = 0 ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "BITFIELD"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - if (get_type != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", get_type); - if (get_offset != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(get_offset)); - if (set_type != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", set_type); - if (set_offset != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(set_offset)); - if (set_value != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(set_value)); - if (incrby_type != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", incrby_type); - if (incrby_offset != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(incrby_offset)); - if (incrby_increment != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(incrby_increment)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("BITFIELD"); + NWNXPushString(key); + if (get_type != "") NWNXPushString(get_type); + if (get_offset != 0) NWNXPushString(IntToString(get_offset)); + if (set_type != "") NWNXPushString(set_type); + if (set_offset != 0) NWNXPushString(IntToString(set_offset)); + if (set_value != 0) NWNXPushString(IntToString(set_value)); + if (incrby_type != "") NWNXPushString(incrby_type); + if (incrby_offset != 0) NWNXPushString(IntToString(incrby_offset)); + if (incrby_increment != 0) NWNXPushString(IntToString(incrby_increment)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_BITOP( @@ -3317,12 +3316,12 @@ int NWNX_Redis_BITOP( string destkey, string key ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "BITOP"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", operation); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", destkey); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("BITOP"); + NWNXPushString(operation); + NWNXPushString(destkey); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_BITPOS( @@ -3334,13 +3333,13 @@ int NWNX_Redis_BITPOS( // Redis type: integer int end = 0 ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "BITPOS"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(bit)); - if (start != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(start)); - if (end != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(end)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("BITPOS"); + NWNXPushString(key); + NWNXPushString(IntToString(bit)); + if (start != 0) NWNXPushString(IntToString(start)); + if (end != 0) NWNXPushString(IntToString(end)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_BLPOP( @@ -3348,11 +3347,11 @@ int NWNX_Redis_BLPOP( // Redis type: integer int timeout ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "BLPOP"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(timeout)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("BLPOP"); + NWNXPushString(key); + NWNXPushString(IntToString(timeout)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_BRPOP( @@ -3360,11 +3359,11 @@ int NWNX_Redis_BRPOP( // Redis type: integer int timeout ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "BRPOP"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(timeout)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("BRPOP"); + NWNXPushString(key); + NWNXPushString(IntToString(timeout)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_BRPOPLPUSH( @@ -3375,12 +3374,12 @@ int NWNX_Redis_BRPOPLPUSH( // Redis type: integer int timeout ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "BRPOPLPUSH"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", source); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", destination); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(timeout)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("BRPOPLPUSH"); + NWNXPushString(source); + NWNXPushString(destination); + NWNXPushString(IntToString(timeout)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_BZPOPMIN( @@ -3388,11 +3387,11 @@ int NWNX_Redis_BZPOPMIN( // Redis type: integer int timeout ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "BZPOPMIN"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(timeout)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("BZPOPMIN"); + NWNXPushString(key); + NWNXPushString(IntToString(timeout)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_BZPOPMAX( @@ -3400,17 +3399,17 @@ int NWNX_Redis_BZPOPMAX( // Redis type: integer int timeout ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "BZPOPMAX"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(timeout)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("BZPOPMAX"); + NWNXPushString(key); + NWNXPushString(IntToString(timeout)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_CLIENT_ID() { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "CLIENT_ID"); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("CLIENT_ID"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_CLIENT_KILL( @@ -3420,54 +3419,54 @@ int NWNX_Redis_CLIENT_KILL( string addr_ip_port = "", string skipme_yes_no = "" ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "CLIENT_KILL"); - if (ip_port != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", ip_port); - if (id_client_id != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(id_client_id)); - if (addr_ip_port != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", addr_ip_port); - if (skipme_yes_no != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", skipme_yes_no); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("CLIENT_KILL"); + if (ip_port != "") NWNXPushString(ip_port); + if (id_client_id != 0) NWNXPushString(IntToString(id_client_id)); + if (addr_ip_port != "") NWNXPushString(addr_ip_port); + if (skipme_yes_no != "") NWNXPushString(skipme_yes_no); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_CLIENT_LIST() { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "CLIENT_LIST"); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("CLIENT_LIST"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_CLIENT_GETNAME() { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "CLIENT_GETNAME"); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("CLIENT_GETNAME"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_CLIENT_PAUSE( // Redis type: integer int timeout ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "CLIENT_PAUSE"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(timeout)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("CLIENT_PAUSE"); + NWNXPushString(IntToString(timeout)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_CLIENT_REPLY( // Redis type: enum string reply_mode ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "CLIENT_REPLY"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", reply_mode); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("CLIENT_REPLY"); + NWNXPushString(reply_mode); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_CLIENT_SETNAME( string connection_name ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "CLIENT_SETNAME"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", connection_name); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("CLIENT_SETNAME"); + NWNXPushString(connection_name); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_CLIENT_UNBLOCK( @@ -3475,69 +3474,69 @@ int NWNX_Redis_CLIENT_UNBLOCK( // Redis type: enum string unblock_type = "" ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "CLIENT_UNBLOCK"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", client_id); - if (unblock_type != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", unblock_type); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("CLIENT_UNBLOCK"); + NWNXPushString(client_id); + if (unblock_type != "") NWNXPushString(unblock_type); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_CLUSTER_ADDSLOTS( // Redis type: integer int slot ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "CLUSTER_ADDSLOTS"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(slot)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("CLUSTER_ADDSLOTS"); + NWNXPushString(IntToString(slot)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_CLUSTER_COUNT_FAILURE_REPORTS( string node_id ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "CLUSTER_COUNT_FAILURE_REPORTS"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", node_id); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("CLUSTER_COUNT_FAILURE_REPORTS"); + NWNXPushString(node_id); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_CLUSTER_COUNTKEYSINSLOT( // Redis type: integer int slot ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "CLUSTER_COUNTKEYSINSLOT"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(slot)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("CLUSTER_COUNTKEYSINSLOT"); + NWNXPushString(IntToString(slot)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_CLUSTER_DELSLOTS( // Redis type: integer int slot ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "CLUSTER_DELSLOTS"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(slot)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("CLUSTER_DELSLOTS"); + NWNXPushString(IntToString(slot)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_CLUSTER_FAILOVER( // Redis type: enum string options = "" ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "CLUSTER_FAILOVER"); - if (options != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", options); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("CLUSTER_FAILOVER"); + if (options != "") NWNXPushString(options); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_CLUSTER_FORGET( string node_id ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "CLUSTER_FORGET"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", node_id); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("CLUSTER_FORGET"); + NWNXPushString(node_id); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_CLUSTER_GETKEYSINSLOT( @@ -3546,26 +3545,26 @@ int NWNX_Redis_CLUSTER_GETKEYSINSLOT( // Redis type: integer int count ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "CLUSTER_GETKEYSINSLOT"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(slot)); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(count)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("CLUSTER_GETKEYSINSLOT"); + NWNXPushString(IntToString(slot)); + NWNXPushString(IntToString(count)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_CLUSTER_INFO() { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "CLUSTER_INFO"); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("CLUSTER_INFO"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_CLUSTER_KEYSLOT( string key ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "CLUSTER_KEYSLOT"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("CLUSTER_KEYSLOT"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_CLUSTER_MEET( @@ -3573,52 +3572,52 @@ int NWNX_Redis_CLUSTER_MEET( // Redis type: integer int port ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "CLUSTER_MEET"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", ip); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(port)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("CLUSTER_MEET"); + NWNXPushString(ip); + NWNXPushString(IntToString(port)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_CLUSTER_NODES() { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "CLUSTER_NODES"); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("CLUSTER_NODES"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_CLUSTER_REPLICATE( string node_id ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "CLUSTER_REPLICATE"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", node_id); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("CLUSTER_REPLICATE"); + NWNXPushString(node_id); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_CLUSTER_RESET( // Redis type: enum string reset_type = "" ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "CLUSTER_RESET"); - if (reset_type != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", reset_type); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("CLUSTER_RESET"); + if (reset_type != "") NWNXPushString(reset_type); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_CLUSTER_SAVECONFIG() { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "CLUSTER_SAVECONFIG"); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("CLUSTER_SAVECONFIG"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_CLUSTER_SET_CONFIG_EPOCH( // Redis type: integer int config_epoch ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "CLUSTER_SET_CONFIG_EPOCH"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(config_epoch)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("CLUSTER_SET_CONFIG_EPOCH"); + NWNXPushString(IntToString(config_epoch)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_CLUSTER_SETSLOT( @@ -3628,125 +3627,125 @@ int NWNX_Redis_CLUSTER_SETSLOT( string subcommand, string node_id = "" ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "CLUSTER_SETSLOT"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(slot)); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", subcommand); - if (node_id != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", node_id); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("CLUSTER_SETSLOT"); + NWNXPushString(IntToString(slot)); + NWNXPushString(subcommand); + if (node_id != "") NWNXPushString(node_id); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_CLUSTER_SLAVES( string node_id ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "CLUSTER_SLAVES"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", node_id); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("CLUSTER_SLAVES"); + NWNXPushString(node_id); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_CLUSTER_REPLICAS( string node_id ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "CLUSTER_REPLICAS"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", node_id); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("CLUSTER_REPLICAS"); + NWNXPushString(node_id); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_CLUSTER_SLOTS() { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "CLUSTER_SLOTS"); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("CLUSTER_SLOTS"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_COMMAND() { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "COMMAND"); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("COMMAND"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_COMMAND_COUNT() { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "COMMAND_COUNT"); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("COMMAND_COUNT"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_COMMAND_GETKEYS() { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "COMMAND_GETKEYS"); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("COMMAND_GETKEYS"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_COMMAND_INFO( string command_name ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "COMMAND_INFO"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", command_name); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("COMMAND_INFO"); + NWNXPushString(command_name); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_CONFIG_GET( string parameter ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "CONFIG_GET"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", parameter); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("CONFIG_GET"); + NWNXPushString(parameter); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_CONFIG_REWRITE() { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "CONFIG_REWRITE"); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("CONFIG_REWRITE"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_CONFIG_SET( string parameter, string value ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "CONFIG_SET"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", parameter); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", value); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("CONFIG_SET"); + NWNXPushString(parameter); + NWNXPushString(value); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_CONFIG_RESETSTAT() { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "CONFIG_RESETSTAT"); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("CONFIG_RESETSTAT"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_DBSIZE() { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "DBSIZE"); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("DBSIZE"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_DEBUG_OBJECT( string key ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "DEBUG_OBJECT"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("DEBUG_OBJECT"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_DEBUG_SEGFAULT() { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "DEBUG_SEGFAULT"); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("DEBUG_SEGFAULT"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_DECR( string key ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "DECR"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("DECR"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_DECRBY( @@ -3754,44 +3753,44 @@ int NWNX_Redis_DECRBY( // Redis type: integer int decrement ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "DECRBY"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(decrement)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("DECRBY"); + NWNXPushString(key); + NWNXPushString(IntToString(decrement)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_DEL( string key ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "DEL"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("DEL"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_DISCARD() { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "DISCARD"); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("DISCARD"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_DUMP( string key ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "DUMP"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("DUMP"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_ECHO( string message ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "ECHO"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", message); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("ECHO"); + NWNXPushString(message); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_EVAL( @@ -3801,13 +3800,13 @@ int NWNX_Redis_EVAL( string key, string arg ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "EVAL"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", script); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(numkeys)); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", arg); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("EVAL"); + NWNXPushString(script); + NWNXPushString(IntToString(numkeys)); + NWNXPushString(key); + NWNXPushString(arg); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_EVALSHA( @@ -3817,28 +3816,28 @@ int NWNX_Redis_EVALSHA( string key, string arg ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "EVALSHA"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", sha1); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(numkeys)); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", arg); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("EVALSHA"); + NWNXPushString(sha1); + NWNXPushString(IntToString(numkeys)); + NWNXPushString(key); + NWNXPushString(arg); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_EXEC() { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "EXEC"); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("EXEC"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_EXISTS( string key ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "EXISTS"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("EXISTS"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_EXPIRE( @@ -3846,11 +3845,11 @@ int NWNX_Redis_EXPIRE( // Redis type: integer int seconds ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "EXPIRE"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(seconds)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("EXPIRE"); + NWNXPushString(key); + NWNXPushString(IntToString(seconds)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_EXPIREAT( @@ -3858,31 +3857,31 @@ int NWNX_Redis_EXPIREAT( // Redis type: posix time string timestamp ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "EXPIREAT"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", timestamp); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("EXPIREAT"); + NWNXPushString(key); + NWNXPushString(timestamp); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_FLUSHALL( // Redis type: enum string async = "" ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "FLUSHALL"); - if (async != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", async); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("FLUSHALL"); + if (async != "") NWNXPushString(async); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_FLUSHDB( // Redis type: enum string async = "" ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "FLUSHDB"); - if (async != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", async); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("FLUSHDB"); + if (async != "") NWNXPushString(async); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_GEOADD( @@ -3893,35 +3892,35 @@ int NWNX_Redis_GEOADD( float latitude, string member ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "GEOADD"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", FloatToString(longitude, 0)); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", FloatToString(latitude, 0)); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", member); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("GEOADD"); + NWNXPushString(key); + NWNXPushString(FloatToString(longitude, 0)); + NWNXPushString(FloatToString(latitude, 0)); + NWNXPushString(member); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_GEOHASH( string key, string member ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "GEOHASH"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", member); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("GEOHASH"); + NWNXPushString(key); + NWNXPushString(member); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_GEOPOS( string key, string member ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "GEOPOS"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", member); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("GEOPOS"); + NWNXPushString(key); + NWNXPushString(member); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_GEODIST( @@ -3930,13 +3929,13 @@ int NWNX_Redis_GEODIST( string member2, string unit = "" ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "GEODIST"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", member1); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", member2); - if (unit != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", unit); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("GEODIST"); + NWNXPushString(key); + NWNXPushString(member1); + NWNXPushString(member2); + if (unit != "") NWNXPushString(unit); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_GEORADIUS( @@ -3964,21 +3963,21 @@ int NWNX_Redis_GEORADIUS( // Redis type: key string storedist_key = "" ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "GEORADIUS"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", FloatToString(longitude, 0)); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", FloatToString(latitude, 0)); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", FloatToString(radius, 0)); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", unit); - if (withcoord != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", withcoord); - if (withdist != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", withdist); - if (withhash != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", withhash); - if (count_count != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(count_count)); - if (order != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", order); - if (store_key != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", store_key); - if (storedist_key != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", storedist_key); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("GEORADIUS"); + NWNXPushString(key); + NWNXPushString(FloatToString(longitude, 0)); + NWNXPushString(FloatToString(latitude, 0)); + NWNXPushString(FloatToString(radius, 0)); + NWNXPushString(unit); + if (withcoord != "") NWNXPushString(withcoord); + if (withdist != "") NWNXPushString(withdist); + if (withhash != "") NWNXPushString(withhash); + if (count_count != 0) NWNXPushString(IntToString(count_count)); + if (order != "") NWNXPushString(order); + if (store_key != "") NWNXPushString(store_key); + if (storedist_key != "") NWNXPushString(storedist_key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_GEORADIUSBYMEMBER( @@ -4003,29 +4002,29 @@ int NWNX_Redis_GEORADIUSBYMEMBER( // Redis type: key string storedist_key = "" ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "GEORADIUSBYMEMBER"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", member); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", FloatToString(radius, 0)); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", unit); - if (withcoord != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", withcoord); - if (withdist != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", withdist); - if (withhash != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", withhash); - if (count_count != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(count_count)); - if (order != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", order); - if (store_key != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", store_key); - if (storedist_key != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", storedist_key); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("GEORADIUSBYMEMBER"); + NWNXPushString(key); + NWNXPushString(member); + NWNXPushString(FloatToString(radius, 0)); + NWNXPushString(unit); + if (withcoord != "") NWNXPushString(withcoord); + if (withdist != "") NWNXPushString(withdist); + if (withhash != "") NWNXPushString(withhash); + if (count_count != 0) NWNXPushString(IntToString(count_count)); + if (order != "") NWNXPushString(order); + if (store_key != "") NWNXPushString(store_key); + if (storedist_key != "") NWNXPushString(storedist_key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_GET( string key ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "GET"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("GET"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_GETBIT( @@ -4033,11 +4032,11 @@ int NWNX_Redis_GETBIT( // Redis type: integer int offset ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "GETBIT"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(offset)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("GETBIT"); + NWNXPushString(key); + NWNXPushString(IntToString(offset)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_GETRANGE( @@ -4047,65 +4046,65 @@ int NWNX_Redis_GETRANGE( // Redis type: integer int end ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "GETRANGE"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(start)); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(end)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("GETRANGE"); + NWNXPushString(key); + NWNXPushString(IntToString(start)); + NWNXPushString(IntToString(end)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_GETSET( string key, string value ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "GETSET"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", value); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("GETSET"); + NWNXPushString(key); + NWNXPushString(value); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_HDEL( string key, string field ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "HDEL"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", field); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("HDEL"); + NWNXPushString(key); + NWNXPushString(field); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_HEXISTS( string key, string field ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "HEXISTS"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", field); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("HEXISTS"); + NWNXPushString(key); + NWNXPushString(field); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_HGET( string key, string field ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "HGET"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", field); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("HGET"); + NWNXPushString(key); + NWNXPushString(field); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_HGETALL( string key ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "HGETALL"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("HGETALL"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_HINCRBY( @@ -4114,12 +4113,12 @@ int NWNX_Redis_HINCRBY( // Redis type: integer int increment ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "HINCRBY"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", field); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(increment)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("HINCRBY"); + NWNXPushString(key); + NWNXPushString(field); + NWNXPushString(IntToString(increment)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_HINCRBYFLOAT( @@ -4128,41 +4127,41 @@ int NWNX_Redis_HINCRBYFLOAT( // Redis type: double float increment ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "HINCRBYFLOAT"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", field); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", FloatToString(increment, 0)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("HINCRBYFLOAT"); + NWNXPushString(key); + NWNXPushString(field); + NWNXPushString(FloatToString(increment, 0)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_HKEYS( string key ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "HKEYS"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("HKEYS"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_HLEN( string key ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "HLEN"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("HLEN"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_HMGET( string key, string field ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "HMGET"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", field); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("HMGET"); + NWNXPushString(key); + NWNXPushString(field); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_HMSET( @@ -4170,12 +4169,12 @@ int NWNX_Redis_HMSET( string field, string value ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "HMSET"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", field); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", value); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("HMSET"); + NWNXPushString(key); + NWNXPushString(field); + NWNXPushString(value); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_HSET( @@ -4183,12 +4182,12 @@ int NWNX_Redis_HSET( string field, string value ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "HSET"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", field); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", value); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("HSET"); + NWNXPushString(key); + NWNXPushString(field); + NWNXPushString(value); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_HSETNX( @@ -4196,41 +4195,41 @@ int NWNX_Redis_HSETNX( string field, string value ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "HSETNX"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", field); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", value); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("HSETNX"); + NWNXPushString(key); + NWNXPushString(field); + NWNXPushString(value); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_HSTRLEN( string key, string field ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "HSTRLEN"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", field); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("HSTRLEN"); + NWNXPushString(key); + NWNXPushString(field); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_HVALS( string key ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "HVALS"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("HVALS"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_INCR( string key ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "INCR"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("INCR"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_INCRBY( @@ -4238,11 +4237,11 @@ int NWNX_Redis_INCRBY( // Redis type: integer int increment ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "INCRBY"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(increment)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("INCRBY"); + NWNXPushString(key); + NWNXPushString(IntToString(increment)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_INCRBYFLOAT( @@ -4250,35 +4249,35 @@ int NWNX_Redis_INCRBYFLOAT( // Redis type: double float increment ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "INCRBYFLOAT"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", FloatToString(increment, 0)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("INCRBYFLOAT"); + NWNXPushString(key); + NWNXPushString(FloatToString(increment, 0)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_INFO( string section = "" ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "INFO"); - if (section != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", section); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("INFO"); + if (section != "") NWNXPushString(section); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_KEYS( string pattern ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "KEYS"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", pattern); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("KEYS"); + NWNXPushString(pattern); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_LASTSAVE() { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "LASTSAVE"); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("LASTSAVE"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_LINDEX( @@ -4286,11 +4285,11 @@ int NWNX_Redis_LINDEX( // Redis type: integer int index ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "LINDEX"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(index)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("LINDEX"); + NWNXPushString(key); + NWNXPushString(IntToString(index)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_LINSERT( @@ -4300,53 +4299,53 @@ int NWNX_Redis_LINSERT( string pivot, string value ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "LINSERT"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", where); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", pivot); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", value); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("LINSERT"); + NWNXPushString(key); + NWNXPushString(where); + NWNXPushString(pivot); + NWNXPushString(value); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_LLEN( string key ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "LLEN"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("LLEN"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_LPOP( string key ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "LPOP"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("LPOP"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_LPUSH( string key, string value ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "LPUSH"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", value); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("LPUSH"); + NWNXPushString(key); + NWNXPushString(value); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_LPUSHX( string key, string value ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "LPUSHX"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", value); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("LPUSHX"); + NWNXPushString(key); + NWNXPushString(value); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_LRANGE( @@ -4356,12 +4355,12 @@ int NWNX_Redis_LRANGE( // Redis type: integer int stop ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "LRANGE"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(start)); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(stop)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("LRANGE"); + NWNXPushString(key); + NWNXPushString(IntToString(start)); + NWNXPushString(IntToString(stop)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_LREM( @@ -4370,12 +4369,12 @@ int NWNX_Redis_LREM( int count, string value ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "LREM"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(count)); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", value); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("LREM"); + NWNXPushString(key); + NWNXPushString(IntToString(count)); + NWNXPushString(value); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_LSET( @@ -4384,12 +4383,12 @@ int NWNX_Redis_LSET( int index, string value ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "LSET"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(index)); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", value); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("LSET"); + NWNXPushString(key); + NWNXPushString(IntToString(index)); + NWNXPushString(value); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_LTRIM( @@ -4399,42 +4398,42 @@ int NWNX_Redis_LTRIM( // Redis type: integer int stop ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "LTRIM"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(start)); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(stop)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("LTRIM"); + NWNXPushString(key); + NWNXPushString(IntToString(start)); + NWNXPushString(IntToString(stop)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_MEMORY_DOCTOR() { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "MEMORY_DOCTOR"); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("MEMORY_DOCTOR"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_MEMORY_HELP() { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "MEMORY_HELP"); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("MEMORY_HELP"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_MEMORY_MALLOC_STATS() { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "MEMORY_MALLOC_STATS"); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("MEMORY_MALLOC_STATS"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_MEMORY_PURGE() { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "MEMORY_PURGE"); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("MEMORY_PURGE"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_MEMORY_STATS() { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "MEMORY_STATS"); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("MEMORY_STATS"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_MEMORY_USAGE( @@ -4442,20 +4441,20 @@ int NWNX_Redis_MEMORY_USAGE( // Redis type: integer int samples_count = 0 ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "MEMORY_USAGE"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - if (samples_count != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(samples_count)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("MEMORY_USAGE"); + NWNXPushString(key); + if (samples_count != 0) NWNXPushString(IntToString(samples_count)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_MGET( string key ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "MGET"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("MGET"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_MIGRATE( @@ -4475,24 +4474,24 @@ int NWNX_Redis_MIGRATE( // Redis type: key string keys_key = "" ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "MIGRATE"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", host); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", port); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(destination_db)); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(timeout)); - if (copy != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", copy); - if (replace != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", replace); - if (auth_password != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", auth_password); - if (keys_key != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", keys_key); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("MIGRATE"); + NWNXPushString(host); + NWNXPushString(port); + NWNXPushString(key); + NWNXPushString(IntToString(destination_db)); + NWNXPushString(IntToString(timeout)); + if (copy != "") NWNXPushString(copy); + if (replace != "") NWNXPushString(replace); + if (auth_password != "") NWNXPushString(auth_password); + if (keys_key != "") NWNXPushString(keys_key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_MONITOR() { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "MONITOR"); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("MONITOR"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_MOVE( @@ -4500,59 +4499,59 @@ int NWNX_Redis_MOVE( // Redis type: integer int db ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "MOVE"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(db)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("MOVE"); + NWNXPushString(key); + NWNXPushString(IntToString(db)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_MSET( string key, string value ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "MSET"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", value); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("MSET"); + NWNXPushString(key); + NWNXPushString(value); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_MSETNX( string key, string value ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "MSETNX"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", value); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("MSETNX"); + NWNXPushString(key); + NWNXPushString(value); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_MULTI() { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "MULTI"); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("MULTI"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_OBJECT( string subcommand, string arguments = "" ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "OBJECT"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", subcommand); - if (arguments != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", arguments); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("OBJECT"); + NWNXPushString(subcommand); + if (arguments != "") NWNXPushString(arguments); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_PERSIST( string key ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "PERSIST"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("PERSIST"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_PEXPIRE( @@ -4560,11 +4559,11 @@ int NWNX_Redis_PEXPIRE( // Redis type: integer int milliseconds ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "PEXPIRE"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(milliseconds)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("PEXPIRE"); + NWNXPushString(key); + NWNXPushString(IntToString(milliseconds)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_PEXPIREAT( @@ -4572,31 +4571,31 @@ int NWNX_Redis_PEXPIREAT( // Redis type: posix time string milliseconds_timestamp ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "PEXPIREAT"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", milliseconds_timestamp); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("PEXPIREAT"); + NWNXPushString(key); + NWNXPushString(milliseconds_timestamp); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_PFADD( string key, string element ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "PFADD"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", element); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("PFADD"); + NWNXPushString(key); + NWNXPushString(element); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_PFCOUNT( string key ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "PFCOUNT"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("PFCOUNT"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_PFMERGE( @@ -4605,20 +4604,20 @@ int NWNX_Redis_PFMERGE( // Redis type: key string sourcekey ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "PFMERGE"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", destkey); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", sourcekey); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("PFMERGE"); + NWNXPushString(destkey); + NWNXPushString(sourcekey); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_PING( string message = "" ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "PING"); - if (message != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", message); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("PING"); + if (message != "") NWNXPushString(message); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_PSETEX( @@ -4627,67 +4626,67 @@ int NWNX_Redis_PSETEX( int milliseconds, string value ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "PSETEX"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(milliseconds)); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", value); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("PSETEX"); + NWNXPushString(key); + NWNXPushString(IntToString(milliseconds)); + NWNXPushString(value); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_PUBSUB( string subcommand, string argument = "" ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "PUBSUB"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", subcommand); - if (argument != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", argument); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("PUBSUB"); + NWNXPushString(subcommand); + if (argument != "") NWNXPushString(argument); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_PTTL( string key ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "PTTL"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("PTTL"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_PUBLISH( string channel, string message ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "PUBLISH"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", channel); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", message); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("PUBLISH"); + NWNXPushString(channel); + NWNXPushString(message); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_QUIT() { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "QUIT"); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("QUIT"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_RANDOMKEY() { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "RANDOMKEY"); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("RANDOMKEY"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_READONLY() { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "READONLY"); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("READONLY"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_READWRITE() { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "READWRITE"); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("READWRITE"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_RENAME( @@ -4695,11 +4694,11 @@ int NWNX_Redis_RENAME( // Redis type: key string newkey ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "RENAME"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", newkey); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("RENAME"); + NWNXPushString(key); + NWNXPushString(newkey); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_RENAMENX( @@ -4707,11 +4706,11 @@ int NWNX_Redis_RENAMENX( // Redis type: key string newkey ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "RENAMENX"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", newkey); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("RENAMENX"); + NWNXPushString(key); + NWNXPushString(newkey); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_RESTORE( @@ -4728,31 +4727,31 @@ int NWNX_Redis_RESTORE( // Redis type: integer int freq_frequency = 0 ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "RESTORE"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(ttl)); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", serialized_value); - if (replace != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", replace); - if (absttl != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", absttl); - if (idletime_seconds != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(idletime_seconds)); - if (freq_frequency != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(freq_frequency)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("RESTORE"); + NWNXPushString(key); + NWNXPushString(IntToString(ttl)); + NWNXPushString(serialized_value); + if (replace != "") NWNXPushString(replace); + if (absttl != "") NWNXPushString(absttl); + if (idletime_seconds != 0) NWNXPushString(IntToString(idletime_seconds)); + if (freq_frequency != 0) NWNXPushString(IntToString(freq_frequency)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_ROLE() { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "ROLE"); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("ROLE"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_RPOP( string key ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "RPOP"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("RPOP"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_RPOPLPUSH( @@ -4761,108 +4760,108 @@ int NWNX_Redis_RPOPLPUSH( // Redis type: key string destination ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "RPOPLPUSH"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", source); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", destination); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("RPOPLPUSH"); + NWNXPushString(source); + NWNXPushString(destination); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_RPUSH( string key, string value ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "RPUSH"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", value); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("RPUSH"); + NWNXPushString(key); + NWNXPushString(value); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_RPUSHX( string key, string value ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "RPUSHX"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", value); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("RPUSHX"); + NWNXPushString(key); + NWNXPushString(value); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_SADD( string key, string member ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "SADD"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", member); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("SADD"); + NWNXPushString(key); + NWNXPushString(member); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_SAVE() { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "SAVE"); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("SAVE"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_SCARD( string key ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "SCARD"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("SCARD"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_SCRIPT_DEBUG( // Redis type: enum string mode ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "SCRIPT_DEBUG"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", mode); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("SCRIPT_DEBUG"); + NWNXPushString(mode); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_SCRIPT_EXISTS( string sha1 ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "SCRIPT_EXISTS"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", sha1); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("SCRIPT_EXISTS"); + NWNXPushString(sha1); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_SCRIPT_FLUSH() { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "SCRIPT_FLUSH"); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("SCRIPT_FLUSH"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_SCRIPT_KILL() { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "SCRIPT_KILL"); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("SCRIPT_KILL"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_SCRIPT_LOAD( string script ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "SCRIPT_LOAD"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", script); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("SCRIPT_LOAD"); + NWNXPushString(script); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_SDIFF( string key ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "SDIFF"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("SDIFF"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_SDIFFSTORE( @@ -4870,21 +4869,21 @@ int NWNX_Redis_SDIFFSTORE( string destination, string key ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "SDIFFSTORE"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", destination); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("SDIFFSTORE"); + NWNXPushString(destination); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_SELECT( // Redis type: integer int index ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "SELECT"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(index)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("SELECT"); + NWNXPushString(IntToString(index)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_SET( @@ -4893,12 +4892,12 @@ int NWNX_Redis_SET( // Redis type: enum string condition = "" ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "SET"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", value); - if (condition != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", condition); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("SET"); + NWNXPushString(key); + NWNXPushString(value); + if (condition != "") NWNXPushString(condition); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_SETBIT( @@ -4907,12 +4906,12 @@ int NWNX_Redis_SETBIT( int offset, string value ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "SETBIT"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(offset)); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", value); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("SETBIT"); + NWNXPushString(key); + NWNXPushString(IntToString(offset)); + NWNXPushString(value); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_SETEX( @@ -4921,23 +4920,23 @@ int NWNX_Redis_SETEX( int seconds, string value ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "SETEX"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(seconds)); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", value); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("SETEX"); + NWNXPushString(key); + NWNXPushString(IntToString(seconds)); + NWNXPushString(value); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_SETNX( string key, string value ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "SETNX"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", value); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("SETNX"); + NWNXPushString(key); + NWNXPushString(value); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_SETRANGE( @@ -4946,31 +4945,31 @@ int NWNX_Redis_SETRANGE( int offset, string value ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "SETRANGE"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(offset)); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", value); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("SETRANGE"); + NWNXPushString(key); + NWNXPushString(IntToString(offset)); + NWNXPushString(value); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_SHUTDOWN( // Redis type: enum string save_mode = "" ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "SHUTDOWN"); - if (save_mode != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", save_mode); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("SHUTDOWN"); + if (save_mode != "") NWNXPushString(save_mode); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_SINTER( string key ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "SINTER"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("SINTER"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_SINTERSTORE( @@ -4978,64 +4977,64 @@ int NWNX_Redis_SINTERSTORE( string destination, string key ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "SINTERSTORE"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", destination); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("SINTERSTORE"); + NWNXPushString(destination); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_SISMEMBER( string key, string member ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "SISMEMBER"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", member); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("SISMEMBER"); + NWNXPushString(key); + NWNXPushString(member); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_SLAVEOF( string host, string port ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "SLAVEOF"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", host); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", port); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("SLAVEOF"); + NWNXPushString(host); + NWNXPushString(port); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_REPLICAOF( string host, string port ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "REPLICAOF"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", host); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", port); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("REPLICAOF"); + NWNXPushString(host); + NWNXPushString(port); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_SLOWLOG( string subcommand, string argument = "" ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "SLOWLOG"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", subcommand); - if (argument != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", argument); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("SLOWLOG"); + NWNXPushString(subcommand); + if (argument != "") NWNXPushString(argument); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_SMEMBERS( string key ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "SMEMBERS"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("SMEMBERS"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_SMOVE( @@ -5045,12 +5044,12 @@ int NWNX_Redis_SMOVE( string destination, string member ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "SMOVE"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", source); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", destination); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", member); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("SMOVE"); + NWNXPushString(source); + NWNXPushString(destination); + NWNXPushString(member); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_SORT( @@ -5069,17 +5068,17 @@ int NWNX_Redis_SORT( // Redis type: key string store_destination = "" ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "SORT"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - if (by_pattern != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", by_pattern); - if (limit_offset != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(limit_offset)); - if (limit_count != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(limit_count)); - if (get_pattern != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", get_pattern); - if (order != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", order); - if (sorting != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", sorting); - if (store_destination != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", store_destination); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("SORT"); + NWNXPushString(key); + if (by_pattern != "") NWNXPushString(by_pattern); + if (limit_offset != 0) NWNXPushString(IntToString(limit_offset)); + if (limit_count != 0) NWNXPushString(IntToString(limit_count)); + if (get_pattern != "") NWNXPushString(get_pattern); + if (order != "") NWNXPushString(order); + if (sorting != "") NWNXPushString(sorting); + if (store_destination != "") NWNXPushString(store_destination); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_SPOP( @@ -5087,11 +5086,11 @@ int NWNX_Redis_SPOP( // Redis type: integer int count = 0 ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "SPOP"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - if (count != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(count)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("SPOP"); + NWNXPushString(key); + if (count != 0) NWNXPushString(IntToString(count)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_SRANDMEMBER( @@ -5099,40 +5098,40 @@ int NWNX_Redis_SRANDMEMBER( // Redis type: integer int count = 0 ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "SRANDMEMBER"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - if (count != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(count)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("SRANDMEMBER"); + NWNXPushString(key); + if (count != 0) NWNXPushString(IntToString(count)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_SREM( string key, string member ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "SREM"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", member); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("SREM"); + NWNXPushString(key); + NWNXPushString(member); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_STRLEN( string key ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "STRLEN"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("STRLEN"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_SUNION( string key ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "SUNION"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("SUNION"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_SUNIONSTORE( @@ -5140,11 +5139,11 @@ int NWNX_Redis_SUNIONSTORE( string destination, string key ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "SUNIONSTORE"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", destination); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("SUNIONSTORE"); + NWNXPushString(destination); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_SWAPDB( @@ -5153,65 +5152,65 @@ int NWNX_Redis_SWAPDB( // Redis type: integer int index_1 ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "SWAPDB"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(index)); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(index_1)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("SWAPDB"); + NWNXPushString(IntToString(index)); + NWNXPushString(IntToString(index_1)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_SYNC() { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "SYNC"); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("SYNC"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_TIME() { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "TIME"); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("TIME"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_TOUCH( string key ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "TOUCH"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("TOUCH"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_TTL( string key ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "TTL"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("TTL"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_TYPE( string key ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "TYPE"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("TYPE"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_UNLINK( string key ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "UNLINK"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("UNLINK"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_UNWATCH() { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "UNWATCH"); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("UNWATCH"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_WAIT( @@ -5220,20 +5219,20 @@ int NWNX_Redis_WAIT( // Redis type: integer int timeout ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "WAIT"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(numreplicas)); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(timeout)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("WAIT"); + NWNXPushString(IntToString(numreplicas)); + NWNXPushString(IntToString(timeout)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_WATCH( string key ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "WATCH"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("WATCH"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_ZADD( @@ -5248,24 +5247,24 @@ int NWNX_Redis_ZADD( float score = 0.0, string member = "" ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "ZADD"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - if (condition != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", condition); - if (change != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", change); - if (increment != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", increment); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", FloatToString(score, 0)); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", member); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("ZADD"); + NWNXPushString(key); + if (condition != "") NWNXPushString(condition); + if (change != "") NWNXPushString(change); + if (increment != "") NWNXPushString(increment); + NWNXPushString(FloatToString(score, 0)); + NWNXPushString(member); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_ZCARD( string key ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "ZCARD"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("ZCARD"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_ZCOUNT( @@ -5275,12 +5274,12 @@ int NWNX_Redis_ZCOUNT( // Redis type: double float max ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "ZCOUNT"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", FloatToString(min, 0)); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", FloatToString(max, 0)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("ZCOUNT"); + NWNXPushString(key); + NWNXPushString(FloatToString(min, 0)); + NWNXPushString(FloatToString(max, 0)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_ZINCRBY( @@ -5289,12 +5288,12 @@ int NWNX_Redis_ZINCRBY( int increment, string member ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "ZINCRBY"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(increment)); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", member); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("ZINCRBY"); + NWNXPushString(key); + NWNXPushString(IntToString(increment)); + NWNXPushString(member); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_ZINTERSTORE( @@ -5308,14 +5307,14 @@ int NWNX_Redis_ZINTERSTORE( // Redis type: enum string aggregate_aggregate = "" ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "ZINTERSTORE"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", destination); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(numkeys)); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - if (weights_weight != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(weights_weight)); - if (aggregate_aggregate != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", aggregate_aggregate); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("ZINTERSTORE"); + NWNXPushString(destination); + NWNXPushString(IntToString(numkeys)); + NWNXPushString(key); + if (weights_weight != 0) NWNXPushString(IntToString(weights_weight)); + if (aggregate_aggregate != "") NWNXPushString(aggregate_aggregate); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_ZLEXCOUNT( @@ -5323,12 +5322,12 @@ int NWNX_Redis_ZLEXCOUNT( string min, string max ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "ZLEXCOUNT"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", min); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", max); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("ZLEXCOUNT"); + NWNXPushString(key); + NWNXPushString(min); + NWNXPushString(max); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_ZPOPMAX( @@ -5336,11 +5335,11 @@ int NWNX_Redis_ZPOPMAX( // Redis type: integer int count = 0 ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "ZPOPMAX"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - if (count != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(count)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("ZPOPMAX"); + NWNXPushString(key); + if (count != 0) NWNXPushString(IntToString(count)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_ZPOPMIN( @@ -5348,11 +5347,11 @@ int NWNX_Redis_ZPOPMIN( // Redis type: integer int count = 0 ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "ZPOPMIN"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - if (count != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(count)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("ZPOPMIN"); + NWNXPushString(key); + if (count != 0) NWNXPushString(IntToString(count)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_ZRANGE( @@ -5364,13 +5363,13 @@ int NWNX_Redis_ZRANGE( // Redis type: enum string withscores = "" ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "ZRANGE"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(start)); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(stop)); - if (withscores != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", withscores); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("ZRANGE"); + NWNXPushString(key); + NWNXPushString(IntToString(start)); + NWNXPushString(IntToString(stop)); + if (withscores != "") NWNXPushString(withscores); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_ZRANGEBYLEX( @@ -5382,14 +5381,14 @@ int NWNX_Redis_ZRANGEBYLEX( // Redis type: integer int limit_count = 0 ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "ZRANGEBYLEX"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", min); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", max); - if (limit_offset != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(limit_offset)); - if (limit_count != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(limit_count)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("ZRANGEBYLEX"); + NWNXPushString(key); + NWNXPushString(min); + NWNXPushString(max); + if (limit_offset != 0) NWNXPushString(IntToString(limit_offset)); + if (limit_count != 0) NWNXPushString(IntToString(limit_count)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_ZREVRANGEBYLEX( @@ -5401,14 +5400,14 @@ int NWNX_Redis_ZREVRANGEBYLEX( // Redis type: integer int limit_count = 0 ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "ZREVRANGEBYLEX"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", max); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", min); - if (limit_offset != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(limit_offset)); - if (limit_count != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(limit_count)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("ZREVRANGEBYLEX"); + NWNXPushString(key); + NWNXPushString(max); + NWNXPushString(min); + if (limit_offset != 0) NWNXPushString(IntToString(limit_offset)); + if (limit_count != 0) NWNXPushString(IntToString(limit_count)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_ZRANGEBYSCORE( @@ -5424,37 +5423,37 @@ int NWNX_Redis_ZRANGEBYSCORE( // Redis type: integer int limit_count = 0 ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "ZRANGEBYSCORE"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", FloatToString(min, 0)); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", FloatToString(max, 0)); - if (withscores != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", withscores); - if (limit_offset != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(limit_offset)); - if (limit_count != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(limit_count)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("ZRANGEBYSCORE"); + NWNXPushString(key); + NWNXPushString(FloatToString(min, 0)); + NWNXPushString(FloatToString(max, 0)); + if (withscores != "") NWNXPushString(withscores); + if (limit_offset != 0) NWNXPushString(IntToString(limit_offset)); + if (limit_count != 0) NWNXPushString(IntToString(limit_count)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_ZRANK( string key, string member ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "ZRANK"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", member); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("ZRANK"); + NWNXPushString(key); + NWNXPushString(member); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_ZREM( string key, string member ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "ZREM"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", member); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("ZREM"); + NWNXPushString(key); + NWNXPushString(member); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_ZREMRANGEBYLEX( @@ -5462,12 +5461,12 @@ int NWNX_Redis_ZREMRANGEBYLEX( string min, string max ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "ZREMRANGEBYLEX"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", min); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", max); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("ZREMRANGEBYLEX"); + NWNXPushString(key); + NWNXPushString(min); + NWNXPushString(max); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_ZREMRANGEBYRANK( @@ -5477,12 +5476,12 @@ int NWNX_Redis_ZREMRANGEBYRANK( // Redis type: integer int stop ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "ZREMRANGEBYRANK"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(start)); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(stop)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("ZREMRANGEBYRANK"); + NWNXPushString(key); + NWNXPushString(IntToString(start)); + NWNXPushString(IntToString(stop)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_ZREMRANGEBYSCORE( @@ -5492,12 +5491,12 @@ int NWNX_Redis_ZREMRANGEBYSCORE( // Redis type: double float max ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "ZREMRANGEBYSCORE"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", FloatToString(min, 0)); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", FloatToString(max, 0)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("ZREMRANGEBYSCORE"); + NWNXPushString(key); + NWNXPushString(FloatToString(min, 0)); + NWNXPushString(FloatToString(max, 0)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_ZREVRANGE( @@ -5509,13 +5508,13 @@ int NWNX_Redis_ZREVRANGE( // Redis type: enum string withscores = "" ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "ZREVRANGE"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(start)); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(stop)); - if (withscores != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", withscores); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("ZREVRANGE"); + NWNXPushString(key); + NWNXPushString(IntToString(start)); + NWNXPushString(IntToString(stop)); + if (withscores != "") NWNXPushString(withscores); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_ZREVRANGEBYSCORE( @@ -5531,37 +5530,37 @@ int NWNX_Redis_ZREVRANGEBYSCORE( // Redis type: integer int limit_count = 0 ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "ZREVRANGEBYSCORE"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", FloatToString(max, 0)); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", FloatToString(min, 0)); - if (withscores != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", withscores); - if (limit_offset != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(limit_offset)); - if (limit_count != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(limit_count)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("ZREVRANGEBYSCORE"); + NWNXPushString(key); + NWNXPushString(FloatToString(max, 0)); + NWNXPushString(FloatToString(min, 0)); + if (withscores != "") NWNXPushString(withscores); + if (limit_offset != 0) NWNXPushString(IntToString(limit_offset)); + if (limit_count != 0) NWNXPushString(IntToString(limit_count)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_ZREVRANK( string key, string member ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "ZREVRANK"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", member); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("ZREVRANK"); + NWNXPushString(key); + NWNXPushString(member); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_ZSCORE( string key, string member ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "ZSCORE"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", member); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("ZSCORE"); + NWNXPushString(key); + NWNXPushString(member); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_ZUNIONSTORE( @@ -5575,14 +5574,14 @@ int NWNX_Redis_ZUNIONSTORE( // Redis type: enum string aggregate_aggregate = "" ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "ZUNIONSTORE"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", destination); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(numkeys)); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - if (weights_weight != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(weights_weight)); - if (aggregate_aggregate != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", aggregate_aggregate); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("ZUNIONSTORE"); + NWNXPushString(destination); + NWNXPushString(IntToString(numkeys)); + NWNXPushString(key); + if (weights_weight != 0) NWNXPushString(IntToString(weights_weight)); + if (aggregate_aggregate != "") NWNXPushString(aggregate_aggregate); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_SCAN( @@ -5594,13 +5593,13 @@ int NWNX_Redis_SCAN( int count_count = 0, string type_type = "" ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "SCAN"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(cursor)); - if (match_pattern != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", match_pattern); - if (count_count != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(count_count)); - if (type_type != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", type_type); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("SCAN"); + NWNXPushString(IntToString(cursor)); + if (match_pattern != "") NWNXPushString(match_pattern); + if (count_count != 0) NWNXPushString(IntToString(count_count)); + if (type_type != "") NWNXPushString(type_type); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_SSCAN( @@ -5612,13 +5611,13 @@ int NWNX_Redis_SSCAN( // Redis type: integer int count_count = 0 ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "SSCAN"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(cursor)); - if (match_pattern != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", match_pattern); - if (count_count != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(count_count)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("SSCAN"); + NWNXPushString(key); + NWNXPushString(IntToString(cursor)); + if (match_pattern != "") NWNXPushString(match_pattern); + if (count_count != 0) NWNXPushString(IntToString(count_count)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_HSCAN( @@ -5630,13 +5629,13 @@ int NWNX_Redis_HSCAN( // Redis type: integer int count_count = 0 ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "HSCAN"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(cursor)); - if (match_pattern != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", match_pattern); - if (count_count != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(count_count)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("HSCAN"); + NWNXPushString(key); + NWNXPushString(IntToString(cursor)); + if (match_pattern != "") NWNXPushString(match_pattern); + if (count_count != 0) NWNXPushString(IntToString(count_count)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_ZSCAN( @@ -5648,13 +5647,13 @@ int NWNX_Redis_ZSCAN( // Redis type: integer int count_count = 0 ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "ZSCAN"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(cursor)); - if (match_pattern != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", match_pattern); - if (count_count != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(count_count)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("ZSCAN"); + NWNXPushString(key); + NWNXPushString(IntToString(cursor)); + if (match_pattern != "") NWNXPushString(match_pattern); + if (count_count != 0) NWNXPushString(IntToString(count_count)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_XINFO( @@ -5668,14 +5667,14 @@ int NWNX_Redis_XINFO( // Redis type: enum string help = "" ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "XINFO"); - if (consumers_key != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", consumers_key); - if (consumers_groupname != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", consumers_groupname); - if (groups_key != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", groups_key); - if (stream_key != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", stream_key); - if (help != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", help); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("XINFO"); + if (consumers_key != "") NWNXPushString(consumers_key); + if (consumers_groupname != "") NWNXPushString(consumers_groupname); + if (groups_key != "") NWNXPushString(groups_key); + if (stream_key != "") NWNXPushString(stream_key); + if (help != "") NWNXPushString(help); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_XADD( @@ -5685,13 +5684,13 @@ int NWNX_Redis_XADD( string field, string str ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "XADD"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", ID); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", field); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", str); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("XADD"); + NWNXPushString(key); + NWNXPushString(ID); + NWNXPushString(field); + NWNXPushString(str); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_XTRIM( @@ -5703,24 +5702,24 @@ int NWNX_Redis_XTRIM( // Redis type: integer int count = 0 ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "XTRIM"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", strategy); - if (approx != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", approx); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(count)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("XTRIM"); + NWNXPushString(key); + NWNXPushString(strategy); + if (approx != "") NWNXPushString(approx); + NWNXPushString(IntToString(count)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_XDEL( string key, string ID ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "XDEL"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", ID); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("XDEL"); + NWNXPushString(key); + NWNXPushString(ID); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_XRANGE( @@ -5730,13 +5729,13 @@ int NWNX_Redis_XRANGE( // Redis type: integer int count_count = 0 ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "XRANGE"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", start); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", end); - if (count_count != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(count_count)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("XRANGE"); + NWNXPushString(key); + NWNXPushString(start); + NWNXPushString(end); + if (count_count != 0) NWNXPushString(IntToString(count_count)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_XREVRANGE( @@ -5746,22 +5745,22 @@ int NWNX_Redis_XREVRANGE( // Redis type: integer int count_count = 0 ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "XREVRANGE"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", end); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", start); - if (count_count != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(count_count)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("XREVRANGE"); + NWNXPushString(key); + NWNXPushString(end); + NWNXPushString(start); + if (count_count != 0) NWNXPushString(IntToString(count_count)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_XLEN( string key ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "XLEN"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("XLEN"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_XREAD( @@ -5774,14 +5773,14 @@ int NWNX_Redis_XREAD( string key = "", string ID = "" ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "XREAD"); - if (count_count != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(count_count)); - if (block_milliseconds != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(block_milliseconds)); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", streams); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", ID); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("XREAD"); + if (count_count != 0) NWNXPushString(IntToString(count_count)); + if (block_milliseconds != 0) NWNXPushString(IntToString(block_milliseconds)); + NWNXPushString(streams); + NWNXPushString(key); + NWNXPushString(ID); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_XGROUP( @@ -5801,20 +5800,20 @@ int NWNX_Redis_XGROUP( string delconsumer_groupname = "", string delconsumer_consumername = "" ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "XGROUP"); - if (create_key != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", create_key); - if (create_groupname != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", create_groupname); - if (create_id_or__ != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", create_id_or__); - if (setid_key != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", setid_key); - if (setid_groupname != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", setid_groupname); - if (setid_id_or__ != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", setid_id_or__); - if (destroy_key != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", destroy_key); - if (destroy_groupname != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", destroy_groupname); - if (delconsumer_key != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", delconsumer_key); - if (delconsumer_groupname != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", delconsumer_groupname); - if (delconsumer_consumername != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", delconsumer_consumername); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("XGROUP"); + if (create_key != "") NWNXPushString(create_key); + if (create_groupname != "") NWNXPushString(create_groupname); + if (create_id_or__ != "") NWNXPushString(create_id_or__); + if (setid_key != "") NWNXPushString(setid_key); + if (setid_groupname != "") NWNXPushString(setid_groupname); + if (setid_id_or__ != "") NWNXPushString(setid_id_or__); + if (destroy_key != "") NWNXPushString(destroy_key); + if (destroy_groupname != "") NWNXPushString(destroy_groupname); + if (delconsumer_key != "") NWNXPushString(delconsumer_key); + if (delconsumer_groupname != "") NWNXPushString(delconsumer_groupname); + if (delconsumer_consumername != "") NWNXPushString(delconsumer_consumername); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_XREADGROUP( @@ -5831,17 +5830,17 @@ int NWNX_Redis_XREADGROUP( string key = "", string ID = "" ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "XREADGROUP"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", group_group); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", group_consumer); - if (count_count != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(count_count)); - if (block_milliseconds != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(block_milliseconds)); - if (noack != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", noack); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", streams); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", ID); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("XREADGROUP"); + NWNXPushString(group_group); + NWNXPushString(group_consumer); + if (count_count != 0) NWNXPushString(IntToString(count_count)); + if (block_milliseconds != 0) NWNXPushString(IntToString(block_milliseconds)); + if (noack != "") NWNXPushString(noack); + NWNXPushString(streams); + NWNXPushString(key); + NWNXPushString(ID); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_XACK( @@ -5849,12 +5848,12 @@ int NWNX_Redis_XACK( string group, string ID ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "XACK"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", group); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", ID); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("XACK"); + NWNXPushString(key); + NWNXPushString(group); + NWNXPushString(ID); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_XCLAIM( @@ -5870,17 +5869,17 @@ int NWNX_Redis_XCLAIM( // Redis type: integer int retrycount_count = 0 ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "XCLAIM"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", group); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", consumer); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", min_idle_time); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", ID); - if (idle_ms != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(idle_ms)); - if (time_ms_unix_time != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(time_ms_unix_time)); - if (retrycount_count != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(retrycount_count)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("XCLAIM"); + NWNXPushString(key); + NWNXPushString(group); + NWNXPushString(consumer); + NWNXPushString(min_idle_time); + NWNXPushString(ID); + if (idle_ms != 0) NWNXPushString(IntToString(idle_ms)); + if (time_ms_unix_time != 0) NWNXPushString(IntToString(time_ms_unix_time)); + if (retrycount_count != 0) NWNXPushString(IntToString(retrycount_count)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int NWNX_Redis_XPENDING( @@ -5892,15 +5891,15 @@ int NWNX_Redis_XPENDING( int count = 0, string consumer = "" ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "XPENDING"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", group); - if (start != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", start); - if (end != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", end); - if (count != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(count)); - if (consumer != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", consumer); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("XPENDING"); + NWNXPushString(key); + NWNXPushString(group); + if (start != "") NWNXPushString(start); + if (end != "") NWNXPushString(end); + if (count != 0) NWNXPushString(IntToString(count)); + if (consumer != "") NWNXPushString(consumer); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } /// @} diff --git a/_module/nss/nwnx_redis_lib.nss b/_module/nss/nwnx_redis_lib.nss index 759c61e..ce931a2 100644 --- a/_module/nss/nwnx_redis_lib.nss +++ b/_module/nss/nwnx_redis_lib.nss @@ -3,7 +3,6 @@ /// @{ /// @file nwnx_redis_lib.nss /// @brief Allows connection and interfacing with a redis server. -#include "nwnx" /// @anchor redis_results /// @name Redis Results @@ -65,44 +64,44 @@ string NWNX_Redis_GetResultAsString(int resultId); int NWNX_Redis_GetResultType(int resultId) { - NWNX_PushArgumentInt("NWNX_Redis", "GetResultType", resultId); - NWNX_CallFunction("NWNX_Redis", "GetResultType"); - return NWNX_GetReturnValueInt("NWNX_Redis", "GetResultType"); + NWNXPushInt(resultId); + NWNXCall("NWNX_Redis", "GetResultType"); + return NWNXPopInt(); } int NWNX_Redis_GetArrayLength(int resultId) { - NWNX_PushArgumentInt("NWNX_Redis", "GetResultArrayLength", resultId); - NWNX_CallFunction("NWNX_Redis", "GetResultArrayLength"); - return NWNX_GetReturnValueInt("NWNX_Redis", "GetResultArrayLength"); + NWNXPushInt(resultId); + NWNXCall("NWNX_Redis", "GetResultArrayLength"); + return NWNXPopInt(); } // Returns the last int NWNX_Redis_GetArrayElement(int resultId, int idx) { - NWNX_PushArgumentInt("NWNX_Redis", "GetResultArrayElement", resultId); - NWNX_PushArgumentInt("NWNX_Redis", "GetResultArrayElement", idx); - NWNX_CallFunction("NWNX_Redis", "GetResultArrayElement"); - return NWNX_GetReturnValueInt("NWNX_Redis", "GetResultArrayElement"); + NWNXPushInt(resultId); + NWNXPushInt(idx); + NWNXCall("NWNX_Redis", "GetResultArrayElement"); + return NWNXPopInt(); } float NWNX_Redis_GetResultAsFloat(int resultId) { - NWNX_PushArgumentInt("NWNX_Redis", "GetResultAsString", resultId); - NWNX_CallFunction("NWNX_Redis", "GetResultAsString"); - return StringToFloat(NWNX_GetReturnValueString("NWNX_Redis", "GetResultAsString")); + NWNXPushInt(resultId); + NWNXCall("NWNX_Redis", "GetResultAsString"); + return StringToFloat(NWNXPopString()); } int NWNX_Redis_GetResultAsInt(int resultId) { - NWNX_PushArgumentInt("NWNX_Redis", "GetResultAsString", resultId); - NWNX_CallFunction("NWNX_Redis", "GetResultAsString"); - return StringToInt(NWNX_GetReturnValueString("NWNX_Redis", "GetResultAsString")); + NWNXPushInt(resultId); + NWNXCall("NWNX_Redis", "GetResultAsString"); + return StringToInt(NWNXPopString()); } string NWNX_Redis_GetResultAsString(int resultId) { - NWNX_PushArgumentInt("NWNX_Redis", "GetResultAsString", resultId); - NWNX_CallFunction("NWNX_Redis", "GetResultAsString"); - return NWNX_GetReturnValueString("NWNX_Redis", "GetResultAsString"); + NWNXPushInt(resultId); + NWNXCall("NWNX_Redis", "GetResultAsString"); + return NWNXPopString(); } diff --git a/_module/nss/nwnx_redis_ps.nss b/_module/nss/nwnx_redis_ps.nss index 1d59dd1..ca03f31 100644 --- a/_module/nss/nwnx_redis_ps.nss +++ b/_module/nss/nwnx_redis_ps.nss @@ -2,7 +2,6 @@ /// @brief Interface to Redis PUBSUB /// @{ /// @file nwnx_redis_ps.nss -#include "nwnx" /// A redis PUBSUB message struct NWNX_Redis_PubSubMessageData { @@ -15,9 +14,9 @@ struct NWNX_Redis_PubSubMessageData { struct NWNX_Redis_PubSubMessageData NWNX_Redis_GetPubSubMessageData() { struct NWNX_Redis_PubSubMessageData ret; - NWNX_CallFunction("NWNX_Redis", "GetPubSubData"); - ret.message = NWNX_GetReturnValueString("NWNX_Redis", "GetPubSubData"); - ret.channel = NWNX_GetReturnValueString("NWNX_Redis", "GetPubSubData"); + NWNXCall("NWNX_Redis", "GetPubSubData"); + ret.message = NWNXPopString(); + ret.channel = NWNXPopString(); return ret; } /// @} diff --git a/_module/nss/nwnx_redis_short.nss b/_module/nss/nwnx_redis_short.nss index c8adc65..ec1945e 100644 --- a/_module/nss/nwnx_redis_short.nss +++ b/_module/nss/nwnx_redis_short.nss @@ -1,4 +1,3 @@ -#include "nwnx" #include "nwnx_redis_lib" @@ -72,7 +71,7 @@ int BITCOUNT( * Perform arbitrary bitfield integer operations on strings * * Time complexity: O(1) for each subcommand specified - * Annotated return value: + * Annotated return value: */ int BITFIELD( string key, @@ -206,7 +205,7 @@ int BZPOPMAX( * Returns the client ID for the current connection * * Time complexity: O(1) - * Annotated return value: + * Annotated return value: */ int CLIENT_ID(); @@ -294,7 +293,7 @@ int CLIENT_SETNAME( * Time complexity: O(log N) where N is the number of client connections * - Valid values for unblock_type: "TIMEOUT", "ERROR" - * Annotated return value: + * Annotated return value: */ int CLIENT_UNBLOCK( string client_id, @@ -516,7 +515,7 @@ int CLUSTER_SETSLOT( * List replica nodes of the specified master node * * Time complexity: O(1) - * Annotated return value: + * Annotated return value: */ int CLUSTER_SLAVES( string node_id @@ -528,7 +527,7 @@ int CLUSTER_SLAVES( * List replica nodes of the specified master node * * Time complexity: O(1) - * Annotated return value: + * Annotated return value: */ int CLUSTER_REPLICAS( string node_id @@ -731,7 +730,7 @@ int ECHO( * Execute a Lua script server side * * Time complexity: Depends on the script that is executed. - * Annotated return value: + * Annotated return value: */ int EVAL( string script, @@ -747,7 +746,7 @@ int EVAL( * Execute a Lua script server side * * Time complexity: Depends on the script that is executed. - * Annotated return value: + * Annotated return value: */ int EVALSHA( string sha1, @@ -956,7 +955,7 @@ int GEORADIUS( * - Valid values for withhash: "WITHHASH" * - Valid values for order: "ASC", "DESC" - * Annotated return value: + * Annotated return value: */ int GEORADIUSBYMEMBER( string key, @@ -1552,7 +1551,7 @@ int MIGRATE( * MONITOR * * Listen for all requests received by the server in real time - * Annotated return value: + * Annotated return value: */ int MONITOR(); @@ -1610,7 +1609,7 @@ int MULTI(); * Inspect the internals of Redis objects * * Time complexity: O(1) for all the currently implemented subcommands. - * Annotated return value: + * Annotated return value: */ int OBJECT( string subcommand, @@ -1715,7 +1714,7 @@ int PING( * Set the value and expiration in milliseconds of a key * * Time complexity: O(1) - * Annotated return value: + * Annotated return value: */ int PSETEX( string key, @@ -2213,7 +2212,7 @@ int REPLICAOF( * SLOWLOG * * Manages the Redis slow queries log - * Annotated return value: + * Annotated return value: */ int SLOWLOG( string subcommand, @@ -2377,7 +2376,7 @@ int SWAPDB( * SYNC * * Internal command used for replication - * Annotated return value: + * Annotated return value: */ int SYNC(); @@ -2884,7 +2883,7 @@ int ZUNIONSTORE( * Time complexity: O(1) for every call. O(N) for a complete iteration, including enough command * calls for the cursor to return back to 0. N is the number of elements inside * the collection. - * Annotated return value: + * Annotated return value: */ int SCAN( // Redis type: integer @@ -2904,7 +2903,7 @@ int SCAN( * Time complexity: O(1) for every call. O(N) for a complete iteration, including enough command * calls for the cursor to return back to 0. N is the number of elements inside * the collection.. - * Annotated return value: + * Annotated return value: */ int SSCAN( string key, @@ -2924,7 +2923,7 @@ int SSCAN( * Time complexity: O(1) for every call. O(N) for a complete iteration, including enough command * calls for the cursor to return back to 0. N is the number of elements inside * the collection.. - * Annotated return value: + * Annotated return value: */ int HSCAN( string key, @@ -2944,7 +2943,7 @@ int HSCAN( * Time complexity: O(1) for every call. O(N) for a complete iteration, including enough command * calls for the cursor to return back to 0. N is the number of elements inside * the collection.. - * Annotated return value: + * Annotated return value: */ int ZSCAN( string key, @@ -2966,7 +2965,7 @@ int ZSCAN( * items in the stream. * - Valid values for help: "HELP" - * Annotated return value: + * Annotated return value: */ int XINFO( // Redis type: key @@ -3114,7 +3113,7 @@ int XREAD( * Time complexity: O(1) for all the subcommands, with the exception of the DESTROY subcommand * which takes an additional O(M) time in order to delete the M entries inside * the consumer group pending entries list (PEL). - * Annotated return value: + * Annotated return value: */ int XGROUP( // Redis type: key @@ -3148,7 +3147,7 @@ int XGROUP( * - Valid values for noack: "NOACK" * - Valid values for streams: "STREAMS" - * Annotated return value: + * Annotated return value: */ int XREADGROUP( string group_group, @@ -3230,32 +3229,32 @@ int APPEND( string key, string value ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "APPEND"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", value); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("APPEND"); + NWNXPushString(key); + NWNXPushString(value); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int AUTH( string password ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "AUTH"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", password); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("AUTH"); + NWNXPushString(password); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int BGREWRITEAOF() { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "BGREWRITEAOF"); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("BGREWRITEAOF"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int BGSAVE() { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "BGSAVE"); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("BGSAVE"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int BITCOUNT( @@ -3265,12 +3264,12 @@ int BITCOUNT( // Redis type: integer int end = 0 ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "BITCOUNT"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - if (start != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(start)); - if (end != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(end)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("BITCOUNT"); + NWNXPushString(key); + if (start != 0) NWNXPushString(IntToString(start)); + if (end != 0) NWNXPushString(IntToString(end)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int BITFIELD( @@ -3292,18 +3291,18 @@ int BITFIELD( // Redis type: integer int incrby_increment = 0 ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "BITFIELD"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - if (get_type != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", get_type); - if (get_offset != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(get_offset)); - if (set_type != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", set_type); - if (set_offset != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(set_offset)); - if (set_value != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(set_value)); - if (incrby_type != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", incrby_type); - if (incrby_offset != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(incrby_offset)); - if (incrby_increment != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(incrby_increment)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("BITFIELD"); + NWNXPushString(key); + if (get_type != "") NWNXPushString(get_type); + if (get_offset != 0) NWNXPushString(IntToString(get_offset)); + if (set_type != "") NWNXPushString(set_type); + if (set_offset != 0) NWNXPushString(IntToString(set_offset)); + if (set_value != 0) NWNXPushString(IntToString(set_value)); + if (incrby_type != "") NWNXPushString(incrby_type); + if (incrby_offset != 0) NWNXPushString(IntToString(incrby_offset)); + if (incrby_increment != 0) NWNXPushString(IntToString(incrby_increment)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int BITOP( @@ -3312,12 +3311,12 @@ int BITOP( string destkey, string key ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "BITOP"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", operation); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", destkey); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("BITOP"); + NWNXPushString(operation); + NWNXPushString(destkey); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int BITPOS( @@ -3329,13 +3328,13 @@ int BITPOS( // Redis type: integer int end = 0 ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "BITPOS"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(bit)); - if (start != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(start)); - if (end != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(end)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("BITPOS"); + NWNXPushString(key); + NWNXPushString(IntToString(bit)); + if (start != 0) NWNXPushString(IntToString(start)); + if (end != 0) NWNXPushString(IntToString(end)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int BLPOP( @@ -3343,11 +3342,11 @@ int BLPOP( // Redis type: integer int timeout ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "BLPOP"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(timeout)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("BLPOP"); + NWNXPushString(key); + NWNXPushString(IntToString(timeout)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int BRPOP( @@ -3355,11 +3354,11 @@ int BRPOP( // Redis type: integer int timeout ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "BRPOP"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(timeout)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("BRPOP"); + NWNXPushString(key); + NWNXPushString(IntToString(timeout)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int BRPOPLPUSH( @@ -3370,12 +3369,12 @@ int BRPOPLPUSH( // Redis type: integer int timeout ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "BRPOPLPUSH"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", source); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", destination); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(timeout)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("BRPOPLPUSH"); + NWNXPushString(source); + NWNXPushString(destination); + NWNXPushString(IntToString(timeout)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int BZPOPMIN( @@ -3383,11 +3382,11 @@ int BZPOPMIN( // Redis type: integer int timeout ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "BZPOPMIN"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(timeout)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("BZPOPMIN"); + NWNXPushString(key); + NWNXPushString(IntToString(timeout)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int BZPOPMAX( @@ -3395,17 +3394,17 @@ int BZPOPMAX( // Redis type: integer int timeout ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "BZPOPMAX"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(timeout)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("BZPOPMAX"); + NWNXPushString(key); + NWNXPushString(IntToString(timeout)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int CLIENT_ID() { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "CLIENT_ID"); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("CLIENT_ID"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int CLIENT_KILL( @@ -3415,54 +3414,54 @@ int CLIENT_KILL( string addr_ip_port = "", string skipme_yes_no = "" ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "CLIENT_KILL"); - if (ip_port != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", ip_port); - if (id_client_id != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(id_client_id)); - if (addr_ip_port != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", addr_ip_port); - if (skipme_yes_no != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", skipme_yes_no); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("CLIENT_KILL"); + if (ip_port != "") NWNXPushString(ip_port); + if (id_client_id != 0) NWNXPushString(IntToString(id_client_id)); + if (addr_ip_port != "") NWNXPushString(addr_ip_port); + if (skipme_yes_no != "") NWNXPushString(skipme_yes_no); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int CLIENT_LIST() { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "CLIENT_LIST"); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("CLIENT_LIST"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int CLIENT_GETNAME() { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "CLIENT_GETNAME"); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("CLIENT_GETNAME"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int CLIENT_PAUSE( // Redis type: integer int timeout ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "CLIENT_PAUSE"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(timeout)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("CLIENT_PAUSE"); + NWNXPushString(IntToString(timeout)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int CLIENT_REPLY( // Redis type: enum string reply_mode ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "CLIENT_REPLY"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", reply_mode); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("CLIENT_REPLY"); + NWNXPushString(reply_mode); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int CLIENT_SETNAME( string connection_name ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "CLIENT_SETNAME"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", connection_name); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("CLIENT_SETNAME"); + NWNXPushString(connection_name); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int CLIENT_UNBLOCK( @@ -3470,69 +3469,69 @@ int CLIENT_UNBLOCK( // Redis type: enum string unblock_type = "" ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "CLIENT_UNBLOCK"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", client_id); - if (unblock_type != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", unblock_type); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("CLIENT_UNBLOCK"); + NWNXPushString(client_id); + if (unblock_type != "") NWNXPushString(unblock_type); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int CLUSTER_ADDSLOTS( // Redis type: integer int slot ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "CLUSTER_ADDSLOTS"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(slot)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("CLUSTER_ADDSLOTS"); + NWNXPushString(IntToString(slot)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int CLUSTER_COUNT_FAILURE_REPORTS( string node_id ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "CLUSTER_COUNT_FAILURE_REPORTS"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", node_id); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("CLUSTER_COUNT_FAILURE_REPORTS"); + NWNXPushString(node_id); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int CLUSTER_COUNTKEYSINSLOT( // Redis type: integer int slot ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "CLUSTER_COUNTKEYSINSLOT"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(slot)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("CLUSTER_COUNTKEYSINSLOT"); + NWNXPushString(IntToString(slot)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int CLUSTER_DELSLOTS( // Redis type: integer int slot ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "CLUSTER_DELSLOTS"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(slot)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("CLUSTER_DELSLOTS"); + NWNXPushString(IntToString(slot)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int CLUSTER_FAILOVER( // Redis type: enum string options = "" ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "CLUSTER_FAILOVER"); - if (options != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", options); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("CLUSTER_FAILOVER"); + if (options != "") NWNXPushString(options); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int CLUSTER_FORGET( string node_id ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "CLUSTER_FORGET"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", node_id); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("CLUSTER_FORGET"); + NWNXPushString(node_id); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int CLUSTER_GETKEYSINSLOT( @@ -3541,26 +3540,26 @@ int CLUSTER_GETKEYSINSLOT( // Redis type: integer int count ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "CLUSTER_GETKEYSINSLOT"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(slot)); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(count)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("CLUSTER_GETKEYSINSLOT"); + NWNXPushString(IntToString(slot)); + NWNXPushString(IntToString(count)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int CLUSTER_INFO() { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "CLUSTER_INFO"); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("CLUSTER_INFO"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int CLUSTER_KEYSLOT( string key ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "CLUSTER_KEYSLOT"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("CLUSTER_KEYSLOT"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int CLUSTER_MEET( @@ -3568,52 +3567,52 @@ int CLUSTER_MEET( // Redis type: integer int port ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "CLUSTER_MEET"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", ip); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(port)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("CLUSTER_MEET"); + NWNXPushString(ip); + NWNXPushString(IntToString(port)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int CLUSTER_NODES() { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "CLUSTER_NODES"); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("CLUSTER_NODES"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int CLUSTER_REPLICATE( string node_id ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "CLUSTER_REPLICATE"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", node_id); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("CLUSTER_REPLICATE"); + NWNXPushString(node_id); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int CLUSTER_RESET( // Redis type: enum string reset_type = "" ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "CLUSTER_RESET"); - if (reset_type != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", reset_type); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("CLUSTER_RESET"); + if (reset_type != "") NWNXPushString(reset_type); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int CLUSTER_SAVECONFIG() { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "CLUSTER_SAVECONFIG"); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("CLUSTER_SAVECONFIG"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int CLUSTER_SET_CONFIG_EPOCH( // Redis type: integer int config_epoch ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "CLUSTER_SET_CONFIG_EPOCH"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(config_epoch)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("CLUSTER_SET_CONFIG_EPOCH"); + NWNXPushString(IntToString(config_epoch)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int CLUSTER_SETSLOT( @@ -3623,125 +3622,125 @@ int CLUSTER_SETSLOT( string subcommand, string node_id = "" ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "CLUSTER_SETSLOT"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(slot)); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", subcommand); - if (node_id != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", node_id); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("CLUSTER_SETSLOT"); + NWNXPushString(IntToString(slot)); + NWNXPushString(subcommand); + if (node_id != "") NWNXPushString(node_id); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int CLUSTER_SLAVES( string node_id ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "CLUSTER_SLAVES"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", node_id); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("CLUSTER_SLAVES"); + NWNXPushString(node_id); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int CLUSTER_REPLICAS( string node_id ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "CLUSTER_REPLICAS"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", node_id); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("CLUSTER_REPLICAS"); + NWNXPushString(node_id); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int CLUSTER_SLOTS() { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "CLUSTER_SLOTS"); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("CLUSTER_SLOTS"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int COMMAND() { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "COMMAND"); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("COMMAND"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int COMMAND_COUNT() { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "COMMAND_COUNT"); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("COMMAND_COUNT"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int COMMAND_GETKEYS() { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "COMMAND_GETKEYS"); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("COMMAND_GETKEYS"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int COMMAND_INFO( string command_name ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "COMMAND_INFO"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", command_name); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("COMMAND_INFO"); + NWNXPushString(command_name); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int CONFIG_GET( string parameter ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "CONFIG_GET"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", parameter); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("CONFIG_GET"); + NWNXPushString(parameter); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int CONFIG_REWRITE() { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "CONFIG_REWRITE"); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("CONFIG_REWRITE"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int CONFIG_SET( string parameter, string value ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "CONFIG_SET"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", parameter); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", value); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("CONFIG_SET"); + NWNXPushString(parameter); + NWNXPushString(value); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int CONFIG_RESETSTAT() { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "CONFIG_RESETSTAT"); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("CONFIG_RESETSTAT"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int DBSIZE() { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "DBSIZE"); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("DBSIZE"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int DEBUG_OBJECT( string key ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "DEBUG_OBJECT"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("DEBUG_OBJECT"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int DEBUG_SEGFAULT() { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "DEBUG_SEGFAULT"); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("DEBUG_SEGFAULT"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int DECR( string key ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "DECR"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("DECR"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int DECRBY( @@ -3749,44 +3748,44 @@ int DECRBY( // Redis type: integer int decrement ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "DECRBY"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(decrement)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("DECRBY"); + NWNXPushString(key); + NWNXPushString(IntToString(decrement)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int DEL( string key ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "DEL"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("DEL"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int DISCARD() { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "DISCARD"); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("DISCARD"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int DUMP( string key ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "DUMP"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("DUMP"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int ECHO( string message ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "ECHO"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", message); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("ECHO"); + NWNXPushString(message); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int EVAL( @@ -3796,13 +3795,13 @@ int EVAL( string key, string arg ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "EVAL"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", script); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(numkeys)); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", arg); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("EVAL"); + NWNXPushString(script); + NWNXPushString(IntToString(numkeys)); + NWNXPushString(key); + NWNXPushString(arg); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int EVALSHA( @@ -3812,28 +3811,28 @@ int EVALSHA( string key, string arg ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "EVALSHA"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", sha1); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(numkeys)); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", arg); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("EVALSHA"); + NWNXPushString(sha1); + NWNXPushString(IntToString(numkeys)); + NWNXPushString(key); + NWNXPushString(arg); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int EXEC() { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "EXEC"); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("EXEC"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int EXISTS( string key ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "EXISTS"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("EXISTS"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int EXPIRE( @@ -3841,11 +3840,11 @@ int EXPIRE( // Redis type: integer int seconds ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "EXPIRE"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(seconds)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("EXPIRE"); + NWNXPushString(key); + NWNXPushString(IntToString(seconds)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int EXPIREAT( @@ -3853,31 +3852,31 @@ int EXPIREAT( // Redis type: posix time string timestamp ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "EXPIREAT"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", timestamp); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("EXPIREAT"); + NWNXPushString(key); + NWNXPushString(timestamp); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int FLUSHALL( // Redis type: enum string async = "" ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "FLUSHALL"); - if (async != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", async); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("FLUSHALL"); + if (async != "") NWNXPushString(async); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int FLUSHDB( // Redis type: enum string async = "" ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "FLUSHDB"); - if (async != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", async); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("FLUSHDB"); + if (async != "") NWNXPushString(async); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int GEOADD( @@ -3888,35 +3887,35 @@ int GEOADD( float latitude, string member ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "GEOADD"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", FloatToString(longitude, 0)); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", FloatToString(latitude, 0)); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", member); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("GEOADD"); + NWNXPushString(key); + NWNXPushString(FloatToString(longitude, 0)); + NWNXPushString(FloatToString(latitude, 0)); + NWNXPushString(member); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int GEOHASH( string key, string member ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "GEOHASH"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", member); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("GEOHASH"); + NWNXPushString(key); + NWNXPushString(member); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int GEOPOS( string key, string member ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "GEOPOS"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", member); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("GEOPOS"); + NWNXPushString(key); + NWNXPushString(member); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int GEODIST( @@ -3925,13 +3924,13 @@ int GEODIST( string member2, string unit = "" ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "GEODIST"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", member1); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", member2); - if (unit != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", unit); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("GEODIST"); + NWNXPushString(key); + NWNXPushString(member1); + NWNXPushString(member2); + if (unit != "") NWNXPushString(unit); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int GEORADIUS( @@ -3959,21 +3958,21 @@ int GEORADIUS( // Redis type: key string storedist_key = "" ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "GEORADIUS"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", FloatToString(longitude, 0)); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", FloatToString(latitude, 0)); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", FloatToString(radius, 0)); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", unit); - if (withcoord != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", withcoord); - if (withdist != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", withdist); - if (withhash != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", withhash); - if (count_count != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(count_count)); - if (order != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", order); - if (store_key != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", store_key); - if (storedist_key != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", storedist_key); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("GEORADIUS"); + NWNXPushString(key); + NWNXPushString(FloatToString(longitude, 0)); + NWNXPushString(FloatToString(latitude, 0)); + NWNXPushString(FloatToString(radius, 0)); + NWNXPushString(unit); + if (withcoord != "") NWNXPushString(withcoord); + if (withdist != "") NWNXPushString(withdist); + if (withhash != "") NWNXPushString(withhash); + if (count_count != 0) NWNXPushString(IntToString(count_count)); + if (order != "") NWNXPushString(order); + if (store_key != "") NWNXPushString(store_key); + if (storedist_key != "") NWNXPushString(storedist_key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int GEORADIUSBYMEMBER( @@ -3998,29 +3997,29 @@ int GEORADIUSBYMEMBER( // Redis type: key string storedist_key = "" ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "GEORADIUSBYMEMBER"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", member); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", FloatToString(radius, 0)); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", unit); - if (withcoord != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", withcoord); - if (withdist != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", withdist); - if (withhash != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", withhash); - if (count_count != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(count_count)); - if (order != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", order); - if (store_key != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", store_key); - if (storedist_key != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", storedist_key); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("GEORADIUSBYMEMBER"); + NWNXPushString(key); + NWNXPushString(member); + NWNXPushString(FloatToString(radius, 0)); + NWNXPushString(unit); + if (withcoord != "") NWNXPushString(withcoord); + if (withdist != "") NWNXPushString(withdist); + if (withhash != "") NWNXPushString(withhash); + if (count_count != 0) NWNXPushString(IntToString(count_count)); + if (order != "") NWNXPushString(order); + if (store_key != "") NWNXPushString(store_key); + if (storedist_key != "") NWNXPushString(storedist_key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int GET( string key ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "GET"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("GET"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int GETBIT( @@ -4028,11 +4027,11 @@ int GETBIT( // Redis type: integer int offset ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "GETBIT"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(offset)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("GETBIT"); + NWNXPushString(key); + NWNXPushString(IntToString(offset)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int GETRANGE( @@ -4042,65 +4041,65 @@ int GETRANGE( // Redis type: integer int end ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "GETRANGE"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(start)); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(end)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("GETRANGE"); + NWNXPushString(key); + NWNXPushString(IntToString(start)); + NWNXPushString(IntToString(end)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int GETSET( string key, string value ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "GETSET"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", value); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("GETSET"); + NWNXPushString(key); + NWNXPushString(value); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int HDEL( string key, string field ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "HDEL"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", field); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("HDEL"); + NWNXPushString(key); + NWNXPushString(field); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int HEXISTS( string key, string field ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "HEXISTS"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", field); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("HEXISTS"); + NWNXPushString(key); + NWNXPushString(field); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int HGET( string key, string field ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "HGET"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", field); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("HGET"); + NWNXPushString(key); + NWNXPushString(field); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int HGETALL( string key ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "HGETALL"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("HGETALL"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int HINCRBY( @@ -4109,12 +4108,12 @@ int HINCRBY( // Redis type: integer int increment ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "HINCRBY"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", field); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(increment)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("HINCRBY"); + NWNXPushString(key); + NWNXPushString(field); + NWNXPushString(IntToString(increment)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int HINCRBYFLOAT( @@ -4123,41 +4122,41 @@ int HINCRBYFLOAT( // Redis type: double float increment ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "HINCRBYFLOAT"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", field); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", FloatToString(increment, 0)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("HINCRBYFLOAT"); + NWNXPushString(key); + NWNXPushString(field); + NWNXPushString(FloatToString(increment, 0)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int HKEYS( string key ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "HKEYS"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("HKEYS"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int HLEN( string key ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "HLEN"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("HLEN"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int HMGET( string key, string field ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "HMGET"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", field); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("HMGET"); + NWNXPushString(key); + NWNXPushString(field); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int HMSET( @@ -4165,12 +4164,12 @@ int HMSET( string field, string value ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "HMSET"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", field); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", value); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("HMSET"); + NWNXPushString(key); + NWNXPushString(field); + NWNXPushString(value); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int HSET( @@ -4178,12 +4177,12 @@ int HSET( string field, string value ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "HSET"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", field); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", value); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("HSET"); + NWNXPushString(key); + NWNXPushString(field); + NWNXPushString(value); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int HSETNX( @@ -4191,41 +4190,41 @@ int HSETNX( string field, string value ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "HSETNX"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", field); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", value); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("HSETNX"); + NWNXPushString(key); + NWNXPushString(field); + NWNXPushString(value); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int HSTRLEN( string key, string field ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "HSTRLEN"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", field); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("HSTRLEN"); + NWNXPushString(key); + NWNXPushString(field); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int HVALS( string key ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "HVALS"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("HVALS"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int INCR( string key ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "INCR"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("INCR"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int INCRBY( @@ -4233,11 +4232,11 @@ int INCRBY( // Redis type: integer int increment ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "INCRBY"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(increment)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("INCRBY"); + NWNXPushString(key); + NWNXPushString(IntToString(increment)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int INCRBYFLOAT( @@ -4245,35 +4244,35 @@ int INCRBYFLOAT( // Redis type: double float increment ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "INCRBYFLOAT"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", FloatToString(increment, 0)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("INCRBYFLOAT"); + NWNXPushString(key); + NWNXPushString(FloatToString(increment, 0)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int INFO( string section = "" ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "INFO"); - if (section != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", section); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("INFO"); + if (section != "") NWNXPushString(section); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int KEYS( string pattern ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "KEYS"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", pattern); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("KEYS"); + NWNXPushString(pattern); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int LASTSAVE() { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "LASTSAVE"); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("LASTSAVE"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int LINDEX( @@ -4281,11 +4280,11 @@ int LINDEX( // Redis type: integer int index ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "LINDEX"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(index)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("LINDEX"); + NWNXPushString(key); + NWNXPushString(IntToString(index)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int LINSERT( @@ -4295,53 +4294,53 @@ int LINSERT( string pivot, string value ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "LINSERT"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", where); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", pivot); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", value); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("LINSERT"); + NWNXPushString(key); + NWNXPushString(where); + NWNXPushString(pivot); + NWNXPushString(value); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int LLEN( string key ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "LLEN"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("LLEN"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int LPOP( string key ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "LPOP"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("LPOP"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int LPUSH( string key, string value ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "LPUSH"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", value); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("LPUSH"); + NWNXPushString(key); + NWNXPushString(value); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int LPUSHX( string key, string value ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "LPUSHX"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", value); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("LPUSHX"); + NWNXPushString(key); + NWNXPushString(value); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int LRANGE( @@ -4351,12 +4350,12 @@ int LRANGE( // Redis type: integer int stop ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "LRANGE"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(start)); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(stop)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("LRANGE"); + NWNXPushString(key); + NWNXPushString(IntToString(start)); + NWNXPushString(IntToString(stop)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int LREM( @@ -4365,12 +4364,12 @@ int LREM( int count, string value ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "LREM"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(count)); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", value); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("LREM"); + NWNXPushString(key); + NWNXPushString(IntToString(count)); + NWNXPushString(value); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int LSET( @@ -4379,12 +4378,12 @@ int LSET( int index, string value ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "LSET"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(index)); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", value); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("LSET"); + NWNXPushString(key); + NWNXPushString(IntToString(index)); + NWNXPushString(value); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int LTRIM( @@ -4394,42 +4393,42 @@ int LTRIM( // Redis type: integer int stop ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "LTRIM"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(start)); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(stop)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("LTRIM"); + NWNXPushString(key); + NWNXPushString(IntToString(start)); + NWNXPushString(IntToString(stop)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int MEMORY_DOCTOR() { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "MEMORY_DOCTOR"); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("MEMORY_DOCTOR"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int MEMORY_HELP() { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "MEMORY_HELP"); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("MEMORY_HELP"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int MEMORY_MALLOC_STATS() { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "MEMORY_MALLOC_STATS"); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("MEMORY_MALLOC_STATS"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int MEMORY_PURGE() { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "MEMORY_PURGE"); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("MEMORY_PURGE"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int MEMORY_STATS() { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "MEMORY_STATS"); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("MEMORY_STATS"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int MEMORY_USAGE( @@ -4437,20 +4436,20 @@ int MEMORY_USAGE( // Redis type: integer int samples_count = 0 ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "MEMORY_USAGE"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - if (samples_count != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(samples_count)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("MEMORY_USAGE"); + NWNXPushString(key); + if (samples_count != 0) NWNXPushString(IntToString(samples_count)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int MGET( string key ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "MGET"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("MGET"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int MIGRATE( @@ -4470,24 +4469,24 @@ int MIGRATE( // Redis type: key string keys_key = "" ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "MIGRATE"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", host); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", port); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(destination_db)); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(timeout)); - if (copy != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", copy); - if (replace != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", replace); - if (auth_password != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", auth_password); - if (keys_key != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", keys_key); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("MIGRATE"); + NWNXPushString(host); + NWNXPushString(port); + NWNXPushString(key); + NWNXPushString(IntToString(destination_db)); + NWNXPushString(IntToString(timeout)); + if (copy != "") NWNXPushString(copy); + if (replace != "") NWNXPushString(replace); + if (auth_password != "") NWNXPushString(auth_password); + if (keys_key != "") NWNXPushString(keys_key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int MONITOR() { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "MONITOR"); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("MONITOR"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int MOVE( @@ -4495,59 +4494,59 @@ int MOVE( // Redis type: integer int db ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "MOVE"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(db)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("MOVE"); + NWNXPushString(key); + NWNXPushString(IntToString(db)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int MSET( string key, string value ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "MSET"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", value); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("MSET"); + NWNXPushString(key); + NWNXPushString(value); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int MSETNX( string key, string value ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "MSETNX"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", value); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("MSETNX"); + NWNXPushString(key); + NWNXPushString(value); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int MULTI() { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "MULTI"); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("MULTI"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int OBJECT( string subcommand, string arguments = "" ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "OBJECT"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", subcommand); - if (arguments != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", arguments); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("OBJECT"); + NWNXPushString(subcommand); + if (arguments != "") NWNXPushString(arguments); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int PERSIST( string key ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "PERSIST"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("PERSIST"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int PEXPIRE( @@ -4555,11 +4554,11 @@ int PEXPIRE( // Redis type: integer int milliseconds ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "PEXPIRE"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(milliseconds)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("PEXPIRE"); + NWNXPushString(key); + NWNXPushString(IntToString(milliseconds)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int PEXPIREAT( @@ -4567,31 +4566,31 @@ int PEXPIREAT( // Redis type: posix time string milliseconds_timestamp ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "PEXPIREAT"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", milliseconds_timestamp); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("PEXPIREAT"); + NWNXPushString(key); + NWNXPushString(milliseconds_timestamp); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int PFADD( string key, string element ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "PFADD"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", element); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("PFADD"); + NWNXPushString(key); + NWNXPushString(element); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int PFCOUNT( string key ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "PFCOUNT"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("PFCOUNT"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int PFMERGE( @@ -4600,20 +4599,20 @@ int PFMERGE( // Redis type: key string sourcekey ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "PFMERGE"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", destkey); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", sourcekey); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("PFMERGE"); + NWNXPushString(destkey); + NWNXPushString(sourcekey); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int PING( string message = "" ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "PING"); - if (message != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", message); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("PING"); + if (message != "") NWNXPushString(message); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int PSETEX( @@ -4622,67 +4621,67 @@ int PSETEX( int milliseconds, string value ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "PSETEX"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(milliseconds)); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", value); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("PSETEX"); + NWNXPushString(key); + NWNXPushString(IntToString(milliseconds)); + NWNXPushString(value); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int PUBSUB( string subcommand, string argument = "" ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "PUBSUB"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", subcommand); - if (argument != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", argument); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("PUBSUB"); + NWNXPushString(subcommand); + if (argument != "") NWNXPushString(argument); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int PTTL( string key ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "PTTL"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("PTTL"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int PUBLISH( string channel, string message ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "PUBLISH"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", channel); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", message); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("PUBLISH"); + NWNXPushString(channel); + NWNXPushString(message); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int QUIT() { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "QUIT"); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("QUIT"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int RANDOMKEY() { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "RANDOMKEY"); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("RANDOMKEY"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int READONLY() { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "READONLY"); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("READONLY"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int READWRITE() { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "READWRITE"); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("READWRITE"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int RENAME( @@ -4690,11 +4689,11 @@ int RENAME( // Redis type: key string newkey ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "RENAME"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", newkey); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("RENAME"); + NWNXPushString(key); + NWNXPushString(newkey); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int RENAMENX( @@ -4702,11 +4701,11 @@ int RENAMENX( // Redis type: key string newkey ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "RENAMENX"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", newkey); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("RENAMENX"); + NWNXPushString(key); + NWNXPushString(newkey); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int RESTORE( @@ -4723,31 +4722,31 @@ int RESTORE( // Redis type: integer int freq_frequency = 0 ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "RESTORE"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(ttl)); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", serialized_value); - if (replace != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", replace); - if (absttl != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", absttl); - if (idletime_seconds != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(idletime_seconds)); - if (freq_frequency != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(freq_frequency)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("RESTORE"); + NWNXPushString(key); + NWNXPushString(IntToString(ttl)); + NWNXPushString(serialized_value); + if (replace != "") NWNXPushString(replace); + if (absttl != "") NWNXPushString(absttl); + if (idletime_seconds != 0) NWNXPushString(IntToString(idletime_seconds)); + if (freq_frequency != 0) NWNXPushString(IntToString(freq_frequency)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int ROLE() { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "ROLE"); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("ROLE"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int RPOP( string key ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "RPOP"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("RPOP"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int RPOPLPUSH( @@ -4756,108 +4755,108 @@ int RPOPLPUSH( // Redis type: key string destination ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "RPOPLPUSH"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", source); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", destination); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("RPOPLPUSH"); + NWNXPushString(source); + NWNXPushString(destination); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int RPUSH( string key, string value ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "RPUSH"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", value); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("RPUSH"); + NWNXPushString(key); + NWNXPushString(value); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int RPUSHX( string key, string value ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "RPUSHX"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", value); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("RPUSHX"); + NWNXPushString(key); + NWNXPushString(value); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int SADD( string key, string member ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "SADD"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", member); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("SADD"); + NWNXPushString(key); + NWNXPushString(member); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int SAVE() { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "SAVE"); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("SAVE"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int SCARD( string key ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "SCARD"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("SCARD"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int SCRIPT_DEBUG( // Redis type: enum string mode ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "SCRIPT_DEBUG"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", mode); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("SCRIPT_DEBUG"); + NWNXPushString(mode); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int SCRIPT_EXISTS( string sha1 ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "SCRIPT_EXISTS"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", sha1); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("SCRIPT_EXISTS"); + NWNXPushString(sha1); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int SCRIPT_FLUSH() { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "SCRIPT_FLUSH"); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("SCRIPT_FLUSH"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int SCRIPT_KILL() { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "SCRIPT_KILL"); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("SCRIPT_KILL"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int SCRIPT_LOAD( string script ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "SCRIPT_LOAD"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", script); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("SCRIPT_LOAD"); + NWNXPushString(script); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int SDIFF( string key ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "SDIFF"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("SDIFF"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int SDIFFSTORE( @@ -4865,21 +4864,21 @@ int SDIFFSTORE( string destination, string key ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "SDIFFSTORE"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", destination); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("SDIFFSTORE"); + NWNXPushString(destination); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int SELECT( // Redis type: integer int index ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "SELECT"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(index)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("SELECT"); + NWNXPushString(IntToString(index)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int SET( @@ -4888,12 +4887,12 @@ int SET( // Redis type: enum string condition = "" ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "SET"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", value); - if (condition != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", condition); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("SET"); + NWNXPushString(key); + NWNXPushString(value); + if (condition != "") NWNXPushString(condition); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int SETBIT( @@ -4902,12 +4901,12 @@ int SETBIT( int offset, string value ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "SETBIT"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(offset)); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", value); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("SETBIT"); + NWNXPushString(key); + NWNXPushString(IntToString(offset)); + NWNXPushString(value); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int SETEX( @@ -4916,23 +4915,23 @@ int SETEX( int seconds, string value ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "SETEX"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(seconds)); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", value); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("SETEX"); + NWNXPushString(key); + NWNXPushString(IntToString(seconds)); + NWNXPushString(value); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int SETNX( string key, string value ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "SETNX"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", value); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("SETNX"); + NWNXPushString(key); + NWNXPushString(value); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int SETRANGE( @@ -4941,31 +4940,31 @@ int SETRANGE( int offset, string value ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "SETRANGE"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(offset)); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", value); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("SETRANGE"); + NWNXPushString(key); + NWNXPushString(IntToString(offset)); + NWNXPushString(value); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int SHUTDOWN( // Redis type: enum string save_mode = "" ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "SHUTDOWN"); - if (save_mode != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", save_mode); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("SHUTDOWN"); + if (save_mode != "") NWNXPushString(save_mode); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int SINTER( string key ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "SINTER"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("SINTER"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int SINTERSTORE( @@ -4973,64 +4972,64 @@ int SINTERSTORE( string destination, string key ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "SINTERSTORE"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", destination); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("SINTERSTORE"); + NWNXPushString(destination); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int SISMEMBER( string key, string member ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "SISMEMBER"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", member); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("SISMEMBER"); + NWNXPushString(key); + NWNXPushString(member); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int SLAVEOF( string host, string port ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "SLAVEOF"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", host); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", port); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("SLAVEOF"); + NWNXPushString(host); + NWNXPushString(port); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int REPLICAOF( string host, string port ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "REPLICAOF"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", host); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", port); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("REPLICAOF"); + NWNXPushString(host); + NWNXPushString(port); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int SLOWLOG( string subcommand, string argument = "" ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "SLOWLOG"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", subcommand); - if (argument != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", argument); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("SLOWLOG"); + NWNXPushString(subcommand); + if (argument != "") NWNXPushString(argument); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int SMEMBERS( string key ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "SMEMBERS"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("SMEMBERS"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int SMOVE( @@ -5040,12 +5039,12 @@ int SMOVE( string destination, string member ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "SMOVE"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", source); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", destination); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", member); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("SMOVE"); + NWNXPushString(source); + NWNXPushString(destination); + NWNXPushString(member); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int SORT( @@ -5064,17 +5063,17 @@ int SORT( // Redis type: key string store_destination = "" ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "SORT"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - if (by_pattern != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", by_pattern); - if (limit_offset != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(limit_offset)); - if (limit_count != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(limit_count)); - if (get_pattern != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", get_pattern); - if (order != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", order); - if (sorting != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", sorting); - if (store_destination != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", store_destination); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("SORT"); + NWNXPushString(key); + if (by_pattern != "") NWNXPushString(by_pattern); + if (limit_offset != 0) NWNXPushString(IntToString(limit_offset)); + if (limit_count != 0) NWNXPushString(IntToString(limit_count)); + if (get_pattern != "") NWNXPushString(get_pattern); + if (order != "") NWNXPushString(order); + if (sorting != "") NWNXPushString(sorting); + if (store_destination != "") NWNXPushString(store_destination); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int SPOP( @@ -5082,11 +5081,11 @@ int SPOP( // Redis type: integer int count = 0 ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "SPOP"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - if (count != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(count)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("SPOP"); + NWNXPushString(key); + if (count != 0) NWNXPushString(IntToString(count)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int SRANDMEMBER( @@ -5094,40 +5093,40 @@ int SRANDMEMBER( // Redis type: integer int count = 0 ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "SRANDMEMBER"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - if (count != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(count)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("SRANDMEMBER"); + NWNXPushString(key); + if (count != 0) NWNXPushString(IntToString(count)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int SREM( string key, string member ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "SREM"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", member); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("SREM"); + NWNXPushString(key); + NWNXPushString(member); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int STRLEN( string key ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "STRLEN"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("STRLEN"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int SUNION( string key ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "SUNION"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("SUNION"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int SUNIONSTORE( @@ -5135,11 +5134,11 @@ int SUNIONSTORE( string destination, string key ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "SUNIONSTORE"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", destination); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("SUNIONSTORE"); + NWNXPushString(destination); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int SWAPDB( @@ -5148,65 +5147,65 @@ int SWAPDB( // Redis type: integer int index_1 ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "SWAPDB"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(index)); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(index_1)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("SWAPDB"); + NWNXPushString(IntToString(index)); + NWNXPushString(IntToString(index_1)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int SYNC() { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "SYNC"); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("SYNC"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int TIME() { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "TIME"); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("TIME"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int TOUCH( string key ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "TOUCH"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("TOUCH"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int TTL( string key ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "TTL"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("TTL"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int TYPE( string key ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "TYPE"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("TYPE"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int UNLINK( string key ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "UNLINK"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("UNLINK"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int UNWATCH() { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "UNWATCH"); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("UNWATCH"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int WAIT( @@ -5215,20 +5214,20 @@ int WAIT( // Redis type: integer int timeout ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "WAIT"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(numreplicas)); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(timeout)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("WAIT"); + NWNXPushString(IntToString(numreplicas)); + NWNXPushString(IntToString(timeout)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int WATCH( string key ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "WATCH"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("WATCH"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int ZADD( @@ -5243,24 +5242,24 @@ int ZADD( float score = 0.0, string member = "" ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "ZADD"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - if (condition != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", condition); - if (change != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", change); - if (increment != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", increment); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", FloatToString(score, 0)); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", member); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("ZADD"); + NWNXPushString(key); + if (condition != "") NWNXPushString(condition); + if (change != "") NWNXPushString(change); + if (increment != "") NWNXPushString(increment); + NWNXPushString(FloatToString(score, 0)); + NWNXPushString(member); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int ZCARD( string key ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "ZCARD"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("ZCARD"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int ZCOUNT( @@ -5270,12 +5269,12 @@ int ZCOUNT( // Redis type: double float max ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "ZCOUNT"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", FloatToString(min, 0)); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", FloatToString(max, 0)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("ZCOUNT"); + NWNXPushString(key); + NWNXPushString(FloatToString(min, 0)); + NWNXPushString(FloatToString(max, 0)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int ZINCRBY( @@ -5284,12 +5283,12 @@ int ZINCRBY( int increment, string member ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "ZINCRBY"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(increment)); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", member); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("ZINCRBY"); + NWNXPushString(key); + NWNXPushString(IntToString(increment)); + NWNXPushString(member); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int ZINTERSTORE( @@ -5303,14 +5302,14 @@ int ZINTERSTORE( // Redis type: enum string aggregate_aggregate = "" ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "ZINTERSTORE"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", destination); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(numkeys)); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - if (weights_weight != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(weights_weight)); - if (aggregate_aggregate != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", aggregate_aggregate); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("ZINTERSTORE"); + NWNXPushString(destination); + NWNXPushString(IntToString(numkeys)); + NWNXPushString(key); + if (weights_weight != 0) NWNXPushString(IntToString(weights_weight)); + if (aggregate_aggregate != "") NWNXPushString(aggregate_aggregate); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int ZLEXCOUNT( @@ -5318,12 +5317,12 @@ int ZLEXCOUNT( string min, string max ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "ZLEXCOUNT"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", min); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", max); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("ZLEXCOUNT"); + NWNXPushString(key); + NWNXPushString(min); + NWNXPushString(max); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int ZPOPMAX( @@ -5331,11 +5330,11 @@ int ZPOPMAX( // Redis type: integer int count = 0 ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "ZPOPMAX"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - if (count != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(count)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("ZPOPMAX"); + NWNXPushString(key); + if (count != 0) NWNXPushString(IntToString(count)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int ZPOPMIN( @@ -5343,11 +5342,11 @@ int ZPOPMIN( // Redis type: integer int count = 0 ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "ZPOPMIN"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - if (count != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(count)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("ZPOPMIN"); + NWNXPushString(key); + if (count != 0) NWNXPushString(IntToString(count)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int ZRANGE( @@ -5359,13 +5358,13 @@ int ZRANGE( // Redis type: enum string withscores = "" ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "ZRANGE"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(start)); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(stop)); - if (withscores != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", withscores); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("ZRANGE"); + NWNXPushString(key); + NWNXPushString(IntToString(start)); + NWNXPushString(IntToString(stop)); + if (withscores != "") NWNXPushString(withscores); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int ZRANGEBYLEX( @@ -5377,14 +5376,14 @@ int ZRANGEBYLEX( // Redis type: integer int limit_count = 0 ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "ZRANGEBYLEX"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", min); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", max); - if (limit_offset != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(limit_offset)); - if (limit_count != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(limit_count)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("ZRANGEBYLEX"); + NWNXPushString(key); + NWNXPushString(min); + NWNXPushString(max); + if (limit_offset != 0) NWNXPushString(IntToString(limit_offset)); + if (limit_count != 0) NWNXPushString(IntToString(limit_count)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int ZREVRANGEBYLEX( @@ -5396,14 +5395,14 @@ int ZREVRANGEBYLEX( // Redis type: integer int limit_count = 0 ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "ZREVRANGEBYLEX"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", max); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", min); - if (limit_offset != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(limit_offset)); - if (limit_count != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(limit_count)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("ZREVRANGEBYLEX"); + NWNXPushString(key); + NWNXPushString(max); + NWNXPushString(min); + if (limit_offset != 0) NWNXPushString(IntToString(limit_offset)); + if (limit_count != 0) NWNXPushString(IntToString(limit_count)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int ZRANGEBYSCORE( @@ -5419,37 +5418,37 @@ int ZRANGEBYSCORE( // Redis type: integer int limit_count = 0 ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "ZRANGEBYSCORE"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", FloatToString(min, 0)); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", FloatToString(max, 0)); - if (withscores != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", withscores); - if (limit_offset != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(limit_offset)); - if (limit_count != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(limit_count)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("ZRANGEBYSCORE"); + NWNXPushString(key); + NWNXPushString(FloatToString(min, 0)); + NWNXPushString(FloatToString(max, 0)); + if (withscores != "") NWNXPushString(withscores); + if (limit_offset != 0) NWNXPushString(IntToString(limit_offset)); + if (limit_count != 0) NWNXPushString(IntToString(limit_count)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int ZRANK( string key, string member ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "ZRANK"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", member); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("ZRANK"); + NWNXPushString(key); + NWNXPushString(member); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int ZREM( string key, string member ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "ZREM"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", member); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("ZREM"); + NWNXPushString(key); + NWNXPushString(member); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int ZREMRANGEBYLEX( @@ -5457,12 +5456,12 @@ int ZREMRANGEBYLEX( string min, string max ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "ZREMRANGEBYLEX"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", min); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", max); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("ZREMRANGEBYLEX"); + NWNXPushString(key); + NWNXPushString(min); + NWNXPushString(max); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int ZREMRANGEBYRANK( @@ -5472,12 +5471,12 @@ int ZREMRANGEBYRANK( // Redis type: integer int stop ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "ZREMRANGEBYRANK"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(start)); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(stop)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("ZREMRANGEBYRANK"); + NWNXPushString(key); + NWNXPushString(IntToString(start)); + NWNXPushString(IntToString(stop)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int ZREMRANGEBYSCORE( @@ -5487,12 +5486,12 @@ int ZREMRANGEBYSCORE( // Redis type: double float max ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "ZREMRANGEBYSCORE"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", FloatToString(min, 0)); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", FloatToString(max, 0)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("ZREMRANGEBYSCORE"); + NWNXPushString(key); + NWNXPushString(FloatToString(min, 0)); + NWNXPushString(FloatToString(max, 0)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int ZREVRANGE( @@ -5504,13 +5503,13 @@ int ZREVRANGE( // Redis type: enum string withscores = "" ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "ZREVRANGE"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(start)); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(stop)); - if (withscores != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", withscores); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("ZREVRANGE"); + NWNXPushString(key); + NWNXPushString(IntToString(start)); + NWNXPushString(IntToString(stop)); + if (withscores != "") NWNXPushString(withscores); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int ZREVRANGEBYSCORE( @@ -5526,37 +5525,37 @@ int ZREVRANGEBYSCORE( // Redis type: integer int limit_count = 0 ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "ZREVRANGEBYSCORE"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", FloatToString(max, 0)); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", FloatToString(min, 0)); - if (withscores != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", withscores); - if (limit_offset != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(limit_offset)); - if (limit_count != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(limit_count)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("ZREVRANGEBYSCORE"); + NWNXPushString(key); + NWNXPushString(FloatToString(max, 0)); + NWNXPushString(FloatToString(min, 0)); + if (withscores != "") NWNXPushString(withscores); + if (limit_offset != 0) NWNXPushString(IntToString(limit_offset)); + if (limit_count != 0) NWNXPushString(IntToString(limit_count)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int ZREVRANK( string key, string member ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "ZREVRANK"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", member); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("ZREVRANK"); + NWNXPushString(key); + NWNXPushString(member); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int ZSCORE( string key, string member ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "ZSCORE"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", member); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("ZSCORE"); + NWNXPushString(key); + NWNXPushString(member); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int ZUNIONSTORE( @@ -5570,14 +5569,14 @@ int ZUNIONSTORE( // Redis type: enum string aggregate_aggregate = "" ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "ZUNIONSTORE"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", destination); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(numkeys)); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - if (weights_weight != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(weights_weight)); - if (aggregate_aggregate != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", aggregate_aggregate); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("ZUNIONSTORE"); + NWNXPushString(destination); + NWNXPushString(IntToString(numkeys)); + NWNXPushString(key); + if (weights_weight != 0) NWNXPushString(IntToString(weights_weight)); + if (aggregate_aggregate != "") NWNXPushString(aggregate_aggregate); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int SCAN( @@ -5589,13 +5588,13 @@ int SCAN( int count_count = 0, string type_type = "" ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "SCAN"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(cursor)); - if (match_pattern != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", match_pattern); - if (count_count != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(count_count)); - if (type_type != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", type_type); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("SCAN"); + NWNXPushString(IntToString(cursor)); + if (match_pattern != "") NWNXPushString(match_pattern); + if (count_count != 0) NWNXPushString(IntToString(count_count)); + if (type_type != "") NWNXPushString(type_type); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int SSCAN( @@ -5607,13 +5606,13 @@ int SSCAN( // Redis type: integer int count_count = 0 ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "SSCAN"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(cursor)); - if (match_pattern != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", match_pattern); - if (count_count != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(count_count)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("SSCAN"); + NWNXPushString(key); + NWNXPushString(IntToString(cursor)); + if (match_pattern != "") NWNXPushString(match_pattern); + if (count_count != 0) NWNXPushString(IntToString(count_count)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int HSCAN( @@ -5625,13 +5624,13 @@ int HSCAN( // Redis type: integer int count_count = 0 ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "HSCAN"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(cursor)); - if (match_pattern != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", match_pattern); - if (count_count != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(count_count)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("HSCAN"); + NWNXPushString(key); + NWNXPushString(IntToString(cursor)); + if (match_pattern != "") NWNXPushString(match_pattern); + if (count_count != 0) NWNXPushString(IntToString(count_count)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int ZSCAN( @@ -5643,13 +5642,13 @@ int ZSCAN( // Redis type: integer int count_count = 0 ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "ZSCAN"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(cursor)); - if (match_pattern != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", match_pattern); - if (count_count != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(count_count)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("ZSCAN"); + NWNXPushString(key); + NWNXPushString(IntToString(cursor)); + if (match_pattern != "") NWNXPushString(match_pattern); + if (count_count != 0) NWNXPushString(IntToString(count_count)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int XINFO( @@ -5663,14 +5662,14 @@ int XINFO( // Redis type: enum string help = "" ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "XINFO"); - if (consumers_key != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", consumers_key); - if (consumers_groupname != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", consumers_groupname); - if (groups_key != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", groups_key); - if (stream_key != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", stream_key); - if (help != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", help); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("XINFO"); + if (consumers_key != "") NWNXPushString(consumers_key); + if (consumers_groupname != "") NWNXPushString(consumers_groupname); + if (groups_key != "") NWNXPushString(groups_key); + if (stream_key != "") NWNXPushString(stream_key); + if (help != "") NWNXPushString(help); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int XADD( @@ -5680,13 +5679,13 @@ int XADD( string field, string str ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "XADD"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", ID); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", field); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", str); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("XADD"); + NWNXPushString(key); + NWNXPushString(ID); + NWNXPushString(field); + NWNXPushString(str); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int XTRIM( @@ -5698,24 +5697,24 @@ int XTRIM( // Redis type: integer int count = 0 ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "XTRIM"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", strategy); - if (approx != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", approx); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(count)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("XTRIM"); + NWNXPushString(key); + NWNXPushString(strategy); + if (approx != "") NWNXPushString(approx); + NWNXPushString(IntToString(count)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int XDEL( string key, string ID ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "XDEL"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", ID); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("XDEL"); + NWNXPushString(key); + NWNXPushString(ID); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int XRANGE( @@ -5725,13 +5724,13 @@ int XRANGE( // Redis type: integer int count_count = 0 ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "XRANGE"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", start); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", end); - if (count_count != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(count_count)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("XRANGE"); + NWNXPushString(key); + NWNXPushString(start); + NWNXPushString(end); + if (count_count != 0) NWNXPushString(IntToString(count_count)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int XREVRANGE( @@ -5741,22 +5740,22 @@ int XREVRANGE( // Redis type: integer int count_count = 0 ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "XREVRANGE"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", end); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", start); - if (count_count != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(count_count)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("XREVRANGE"); + NWNXPushString(key); + NWNXPushString(end); + NWNXPushString(start); + if (count_count != 0) NWNXPushString(IntToString(count_count)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int XLEN( string key ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "XLEN"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("XLEN"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int XREAD( @@ -5769,14 +5768,14 @@ int XREAD( string key = "", string ID = "" ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "XREAD"); - if (count_count != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(count_count)); - if (block_milliseconds != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(block_milliseconds)); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", streams); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", ID); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("XREAD"); + if (count_count != 0) NWNXPushString(IntToString(count_count)); + if (block_milliseconds != 0) NWNXPushString(IntToString(block_milliseconds)); + NWNXPushString(streams); + NWNXPushString(key); + NWNXPushString(ID); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int XGROUP( @@ -5796,20 +5795,20 @@ int XGROUP( string delconsumer_groupname = "", string delconsumer_consumername = "" ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "XGROUP"); - if (create_key != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", create_key); - if (create_groupname != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", create_groupname); - if (create_id_or__ != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", create_id_or__); - if (setid_key != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", setid_key); - if (setid_groupname != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", setid_groupname); - if (setid_id_or__ != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", setid_id_or__); - if (destroy_key != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", destroy_key); - if (destroy_groupname != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", destroy_groupname); - if (delconsumer_key != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", delconsumer_key); - if (delconsumer_groupname != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", delconsumer_groupname); - if (delconsumer_consumername != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", delconsumer_consumername); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("XGROUP"); + if (create_key != "") NWNXPushString(create_key); + if (create_groupname != "") NWNXPushString(create_groupname); + if (create_id_or__ != "") NWNXPushString(create_id_or__); + if (setid_key != "") NWNXPushString(setid_key); + if (setid_groupname != "") NWNXPushString(setid_groupname); + if (setid_id_or__ != "") NWNXPushString(setid_id_or__); + if (destroy_key != "") NWNXPushString(destroy_key); + if (destroy_groupname != "") NWNXPushString(destroy_groupname); + if (delconsumer_key != "") NWNXPushString(delconsumer_key); + if (delconsumer_groupname != "") NWNXPushString(delconsumer_groupname); + if (delconsumer_consumername != "") NWNXPushString(delconsumer_consumername); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int XREADGROUP( @@ -5826,17 +5825,17 @@ int XREADGROUP( string key = "", string ID = "" ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "XREADGROUP"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", group_group); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", group_consumer); - if (count_count != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(count_count)); - if (block_milliseconds != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(block_milliseconds)); - if (noack != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", noack); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", streams); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", ID); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("XREADGROUP"); + NWNXPushString(group_group); + NWNXPushString(group_consumer); + if (count_count != 0) NWNXPushString(IntToString(count_count)); + if (block_milliseconds != 0) NWNXPushString(IntToString(block_milliseconds)); + if (noack != "") NWNXPushString(noack); + NWNXPushString(streams); + NWNXPushString(key); + NWNXPushString(ID); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int XACK( @@ -5844,12 +5843,12 @@ int XACK( string group, string ID ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "XACK"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", group); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", ID); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("XACK"); + NWNXPushString(key); + NWNXPushString(group); + NWNXPushString(ID); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int XCLAIM( @@ -5865,17 +5864,17 @@ int XCLAIM( // Redis type: integer int retrycount_count = 0 ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "XCLAIM"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", group); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", consumer); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", min_idle_time); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", ID); - if (idle_ms != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(idle_ms)); - if (time_ms_unix_time != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(time_ms_unix_time)); - if (retrycount_count != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(retrycount_count)); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("XCLAIM"); + NWNXPushString(key); + NWNXPushString(group); + NWNXPushString(consumer); + NWNXPushString(min_idle_time); + NWNXPushString(ID); + if (idle_ms != 0) NWNXPushString(IntToString(idle_ms)); + if (time_ms_unix_time != 0) NWNXPushString(IntToString(time_ms_unix_time)); + if (retrycount_count != 0) NWNXPushString(IntToString(retrycount_count)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } int XPENDING( @@ -5887,14 +5886,13 @@ int XPENDING( int count = 0, string consumer = "" ) { - NWNX_PushArgumentString("NWNX_Redis", "Deferred", "XPENDING"); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", key); - NWNX_PushArgumentString("NWNX_Redis", "Deferred", group); - if (start != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", start); - if (end != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", end); - if (count != 0) NWNX_PushArgumentString("NWNX_Redis", "Deferred", IntToString(count)); - if (consumer != "") NWNX_PushArgumentString("NWNX_Redis", "Deferred", consumer); - NWNX_CallFunction("NWNX_Redis", "Deferred"); - return NWNX_GetReturnValueInt("NWNX_Redis", "Deferred"); + NWNXPushString("XPENDING"); + NWNXPushString(key); + NWNXPushString(group); + if (start != "") NWNXPushString(start); + if (end != "") NWNXPushString(end); + if (count != 0) NWNXPushString(IntToString(count)); + if (consumer != "") NWNXPushString(consumer); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); } - diff --git a/_module/nss/nwnx_rename.nss b/_module/nss/nwnx_rename.nss index 053fb2a..88231eb 100644 --- a/_module/nss/nwnx_rename.nss +++ b/_module/nss/nwnx_rename.nss @@ -2,7 +2,6 @@ /// @brief Facilitates renaming, overriding and customization of player names. /// @{ /// @file nwnx_rename.nss -#include "nwnx" const string NWNX_Rename = "NWNX_Rename"; ///< @private @@ -46,35 +45,26 @@ void NWNX_Rename_ClearPCNameOverride(object oTarget, object oObserver = OBJECT_I void NWNX_Rename_SetPCNameOverride(object oTarget, string sNewName, string sPrefix = "" , string sSuffix = "" , int iPlayerNameState = NWNX_RENAME_PLAYERNAME_DEFAULT, object oObserver = OBJECT_INVALID) { - string sFunc = "SetPCNameOverride"; - - NWNX_PushArgumentObject(NWNX_Rename, sFunc, oObserver); - NWNX_PushArgumentInt(NWNX_Rename, sFunc, iPlayerNameState); - NWNX_PushArgumentString(NWNX_Rename, sFunc, sSuffix); - NWNX_PushArgumentString(NWNX_Rename, sFunc, sPrefix); - NWNX_PushArgumentString(NWNX_Rename, sFunc, sNewName); - NWNX_PushArgumentObject(NWNX_Rename, sFunc, oTarget); - - NWNX_CallFunction(NWNX_Rename, sFunc); + NWNXPushObject(oObserver); + NWNXPushInt(iPlayerNameState); + NWNXPushString(sSuffix); + NWNXPushString(sPrefix); + NWNXPushString(sNewName); + NWNXPushObject(oTarget); + NWNXCall(NWNX_Rename, "SetPCNameOverride"); } string NWNX_Rename_GetPCNameOverride(object oTarget, object oObserver = OBJECT_INVALID) { - string sFunc = "GetPCNameOverride"; - - NWNX_PushArgumentObject(NWNX_Rename, sFunc, oObserver); - NWNX_PushArgumentObject(NWNX_Rename, sFunc, oTarget); - - NWNX_CallFunction(NWNX_Rename, sFunc); - return NWNX_GetReturnValueString(NWNX_Rename, sFunc); + NWNXPushObject(oObserver); + NWNXPushObject(oTarget); + NWNXCall(NWNX_Rename, "GetPCNameOverride"); + return NWNXPopString(); } void NWNX_Rename_ClearPCNameOverride(object oTarget, object oObserver = OBJECT_INVALID, int clearAll = FALSE) { - string sFunc = "ClearPCNameOverride"; - - NWNX_PushArgumentInt(NWNX_Rename, sFunc, clearAll); - NWNX_PushArgumentObject(NWNX_Rename, sFunc, oObserver); - NWNX_PushArgumentObject(NWNX_Rename, sFunc, oTarget); - - NWNX_CallFunction(NWNX_Rename, sFunc); + NWNXPushInt(clearAll); + NWNXPushObject(oObserver); + NWNXPushObject(oTarget); + NWNXCall(NWNX_Rename, "ClearPCNameOverride"); } diff --git a/_module/nss/nwnx_reveal.nss b/_module/nss/nwnx_reveal.nss index 8ddf2f1..1261830 100644 --- a/_module/nss/nwnx_reveal.nss +++ b/_module/nss/nwnx_reveal.nss @@ -2,7 +2,6 @@ /// @brief Allows the selective revealing of a stealthing character to another character or their party. /// @{ /// @file nwnx_reveal.nss -#include "nwnx" const string NWNX_Reveal = "NWNX_Reveal"; ///< @private @@ -28,22 +27,16 @@ void NWNX_Reveal_SetRevealToParty(object oHiding, int bReveal, int iDetectionMet void NWNX_Reveal_RevealTo(object oHiding, object oObserver, int iDetectionMethod = NWNX_REVEAL_HEARD) { - string sFunc = "RevealTo"; - - NWNX_PushArgumentInt(NWNX_Reveal, sFunc, iDetectionMethod); - NWNX_PushArgumentObject(NWNX_Reveal, sFunc, oObserver); - NWNX_PushArgumentObject(NWNX_Reveal, sFunc, oHiding); - - NWNX_CallFunction(NWNX_Reveal, sFunc); + NWNXPushInt(iDetectionMethod); + NWNXPushObject(oObserver); + NWNXPushObject(oHiding); + NWNXCall(NWNX_Reveal, "RevealTo"); } void NWNX_Reveal_SetRevealToParty(object oHiding, int bReveal, int iDetectionMethod = NWNX_REVEAL_HEARD) { - string sFunc = "SetRevealToParty"; - - NWNX_PushArgumentInt(NWNX_Reveal, sFunc, iDetectionMethod); - NWNX_PushArgumentInt(NWNX_Reveal, sFunc, bReveal); - NWNX_PushArgumentObject(NWNX_Reveal, sFunc, oHiding); - - NWNX_CallFunction(NWNX_Reveal, sFunc); + NWNXPushInt(iDetectionMethod); + NWNXPushInt(bReveal); + NWNXPushObject(oHiding); + NWNXCall(NWNX_Reveal, "SetRevealToParty"); } diff --git a/_module/nss/nwnx_ruby.nss b/_module/nss/nwnx_ruby.nss index 24c8f85..ce377cc 100644 --- a/_module/nss/nwnx_ruby.nss +++ b/_module/nss/nwnx_ruby.nss @@ -2,22 +2,19 @@ /// @brief Allows users to execute arbitrary Ruby from the game. /// @{ /// @file nwnx_ruby.nss -#include "nwnx" const string NWNX_Ruby = "NWNX_Ruby"; ///< @private -string NWNX_Ruby_Evaluate (string sCode); +string NWNX_Ruby_Evaluate(string sCode); /// @brief Evaluates some ruby code. /// @param sCode The code to evaluate. /// @return The output of the call. string NWNX_Ruby_Evaluate(string sCode) { - string sFunc = "Evaluate"; - - NWNX_PushArgumentString (NWNX_Ruby, sFunc, sCode); - NWNX_CallFunction (NWNX_Ruby, sFunc); - return NWNX_GetReturnValueString (NWNX_Ruby, sFunc); + NWNXPushString(sCode); + NWNXCall(NWNX_Ruby, "Evaluate"); + return NWNXPopString(); } /// @} diff --git a/_module/nss/nwnx_skillranks.nss b/_module/nss/nwnx_skillranks.nss index cc88483..ae38d96 100644 --- a/_module/nss/nwnx_skillranks.nss +++ b/_module/nss/nwnx_skillranks.nss @@ -3,7 +3,6 @@ /// skill related feats as well as modifying stock feats. /// @{ /// @file nwnx_skillranks.nss -#include "nwnx" const string NWNX_SkillRanks = "NWNX_SkillRanks"; ///< @private @@ -144,82 +143,67 @@ void NWNX_SkillRanks_SetAreaModifier(object oArea, int iSkill, int iModifier); int NWNX_SkillRanks_GetSkillFeatCountForSkill(int iSkill) { - string sFunc = "GetSkillFeatCountForSkill"; - - NWNX_PushArgumentInt(NWNX_SkillRanks, sFunc, iSkill); - NWNX_CallFunction(NWNX_SkillRanks, sFunc); - - return NWNX_GetReturnValueInt(NWNX_SkillRanks, sFunc); + NWNXPushInt(iSkill); + NWNXCall(NWNX_SkillRanks, "GetSkillFeatCountForSkill"); + return NWNXPopInt(); } struct NWNX_SkillRanks_SkillFeat NWNX_SkillRanks_GetSkillFeatForSkillByIndex(int iSkill, int iIndex) { - string sFunc = "GetSkillFeatForSkillByIndex"; - - NWNX_PushArgumentInt(NWNX_SkillRanks, sFunc, iIndex); - NWNX_PushArgumentInt(NWNX_SkillRanks, sFunc, iSkill); - NWNX_CallFunction(NWNX_SkillRanks, sFunc); - + NWNXPushInt(iIndex); + NWNXPushInt(iSkill); + NWNXCall(NWNX_SkillRanks, "GetSkillFeatForSkillByIndex"); struct NWNX_SkillRanks_SkillFeat skillFeat; - skillFeat.iSkill = iSkill; - skillFeat.iFeat = NWNX_GetReturnValueInt(NWNX_SkillRanks, sFunc); - skillFeat.iModifier = NWNX_GetReturnValueInt(NWNX_SkillRanks, sFunc); - skillFeat.iFocusFeat = NWNX_GetReturnValueInt(NWNX_SkillRanks, sFunc); - skillFeat.sClasses = NWNX_GetReturnValueString(NWNX_SkillRanks, sFunc); - skillFeat.fClassLevelMod = NWNX_GetReturnValueFloat(NWNX_SkillRanks, sFunc); - skillFeat.iAreaFlagsRequired = NWNX_GetReturnValueInt(NWNX_SkillRanks, sFunc); - skillFeat.iAreaFlagsForbidden = NWNX_GetReturnValueInt(NWNX_SkillRanks, sFunc); - skillFeat.iDayOrNight = NWNX_GetReturnValueInt(NWNX_SkillRanks, sFunc); - skillFeat.bBypassArmorCheckPenalty = NWNX_GetReturnValueInt(NWNX_SkillRanks, sFunc); - skillFeat.iKeyAbilityMask = NWNX_GetReturnValueInt(NWNX_SkillRanks, sFunc); - + skillFeat.iFeat = NWNXPopInt(); + skillFeat.iModifier = NWNXPopInt(); + skillFeat.iFocusFeat = NWNXPopInt(); + skillFeat.sClasses = NWNXPopString(); + skillFeat.fClassLevelMod = NWNXPopFloat(); + skillFeat.iAreaFlagsRequired = NWNXPopInt(); + skillFeat.iAreaFlagsForbidden = NWNXPopInt(); + skillFeat.iDayOrNight = NWNXPopInt(); + skillFeat.bBypassArmorCheckPenalty = NWNXPopInt(); + skillFeat.iKeyAbilityMask = NWNXPopInt(); return skillFeat; } struct NWNX_SkillRanks_SkillFeat NWNX_SkillRanks_GetSkillFeat(int iSkill, int iFeat) { - string sFunc = "GetSkillFeat"; - - NWNX_PushArgumentInt(NWNX_SkillRanks, sFunc, iFeat); - NWNX_PushArgumentInt(NWNX_SkillRanks, sFunc, iSkill); - NWNX_CallFunction(NWNX_SkillRanks, sFunc); - + NWNXPushInt(iFeat); + NWNXPushInt(iSkill); + NWNXCall(NWNX_SkillRanks, "GetSkillFeat"); struct NWNX_SkillRanks_SkillFeat skillFeat; - skillFeat.iSkill = iSkill; skillFeat.iFeat = iFeat; - skillFeat.iModifier = NWNX_GetReturnValueInt(NWNX_SkillRanks, sFunc); - skillFeat.iFocusFeat = NWNX_GetReturnValueInt(NWNX_SkillRanks, sFunc); - skillFeat.sClasses = NWNX_GetReturnValueString(NWNX_SkillRanks, sFunc); - skillFeat.fClassLevelMod = NWNX_GetReturnValueFloat(NWNX_SkillRanks, sFunc); - skillFeat.iAreaFlagsRequired = NWNX_GetReturnValueInt(NWNX_SkillRanks, sFunc); - skillFeat.iAreaFlagsForbidden = NWNX_GetReturnValueInt(NWNX_SkillRanks, sFunc); - skillFeat.iDayOrNight = NWNX_GetReturnValueInt(NWNX_SkillRanks, sFunc); - skillFeat.bBypassArmorCheckPenalty = NWNX_GetReturnValueInt(NWNX_SkillRanks, sFunc); - skillFeat.iKeyAbilityMask = NWNX_GetReturnValueInt(NWNX_SkillRanks, sFunc); - + skillFeat.iModifier = NWNXPopInt(); + skillFeat.iFocusFeat = NWNXPopInt(); + skillFeat.sClasses = NWNXPopString(); + skillFeat.fClassLevelMod = NWNXPopFloat(); + skillFeat.iAreaFlagsRequired = NWNXPopInt(); + skillFeat.iAreaFlagsForbidden = NWNXPopInt(); + skillFeat.iDayOrNight = NWNXPopInt(); + skillFeat.bBypassArmorCheckPenalty = NWNXPopInt(); + skillFeat.iKeyAbilityMask = NWNXPopInt(); return skillFeat; } void NWNX_SkillRanks_SetSkillFeat(struct NWNX_SkillRanks_SkillFeat skillFeat, int createIfNonExistent = FALSE) { - string sFunc = "SetSkillFeat"; - - NWNX_PushArgumentInt(NWNX_SkillRanks, sFunc, createIfNonExistent); - NWNX_PushArgumentInt(NWNX_SkillRanks, sFunc, skillFeat.iKeyAbilityMask); - NWNX_PushArgumentInt(NWNX_SkillRanks, sFunc, skillFeat.bBypassArmorCheckPenalty); - NWNX_PushArgumentInt(NWNX_SkillRanks, sFunc, skillFeat.iDayOrNight); - NWNX_PushArgumentInt(NWNX_SkillRanks, sFunc, skillFeat.iAreaFlagsForbidden); - NWNX_PushArgumentInt(NWNX_SkillRanks, sFunc, skillFeat.iAreaFlagsRequired); - NWNX_PushArgumentFloat(NWNX_SkillRanks, sFunc, skillFeat.fClassLevelMod); + NWNXPushInt(createIfNonExistent); + NWNXPushInt(skillFeat.iKeyAbilityMask); + NWNXPushInt(skillFeat.bBypassArmorCheckPenalty); + NWNXPushInt(skillFeat.iDayOrNight); + NWNXPushInt(skillFeat.iAreaFlagsForbidden); + NWNXPushInt(skillFeat.iAreaFlagsRequired); + NWNXPushFloat(skillFeat.fClassLevelMod); // We only need to send the string from the point of the first set bit - NWNX_PushArgumentString(NWNX_SkillRanks, sFunc, GetStringRight(skillFeat.sClasses, GetStringLength(skillFeat.sClasses)-FindSubString(skillFeat.sClasses, "1"))); - NWNX_PushArgumentInt(NWNX_SkillRanks, sFunc, skillFeat.iFocusFeat); - NWNX_PushArgumentInt(NWNX_SkillRanks, sFunc, skillFeat.iModifier); - NWNX_PushArgumentInt(NWNX_SkillRanks, sFunc, skillFeat.iFeat); - NWNX_PushArgumentInt(NWNX_SkillRanks, sFunc, skillFeat.iSkill); - NWNX_CallFunction(NWNX_SkillRanks, sFunc); + NWNXPushString(GetStringRight(skillFeat.sClasses,GetStringLength(skillFeat.sClasses)-FindSubString(skillFeat.sClasses,"1"))); + NWNXPushInt(skillFeat.iFocusFeat); + NWNXPushInt(skillFeat.iModifier); + NWNXPushInt(skillFeat.iFeat); + NWNXPushInt(skillFeat.iSkill); + NWNXCall(NWNX_SkillRanks, "SetSkillFeat"); } struct NWNX_SkillRanks_SkillFeat NWNX_SkillRanks_AddSkillFeatClass(struct NWNX_SkillRanks_SkillFeat skillFeat, int iClass) @@ -237,47 +221,35 @@ struct NWNX_SkillRanks_SkillFeat NWNX_SkillRanks_AddSkillFeatClass(struct NWNX_S void NWNX_SkillRanks_SetSkillFeatFocusModifier(int iModifier, int epicFocus = FALSE) { - string sFunc = "SetSkillFeatFocusModifier"; - - NWNX_PushArgumentInt(NWNX_SkillRanks, sFunc, epicFocus); - NWNX_PushArgumentInt(NWNX_SkillRanks, sFunc, iModifier); - NWNX_CallFunction(NWNX_SkillRanks, sFunc); + NWNXPushInt(epicFocus); + NWNXPushInt(iModifier); + NWNXCall(NWNX_SkillRanks, "SetSkillFeatFocusModifier"); } int NWNX_SkillRanks_GetBlindnessPenalty() { - string sFunc = "GetBlindnessPenalty"; - - NWNX_CallFunction(NWNX_SkillRanks, sFunc); - - return NWNX_GetReturnValueInt(NWNX_SkillRanks, sFunc); + NWNXCall(NWNX_SkillRanks, "GetBlindnessPenalty"); + return NWNXPopInt(); } void NWNX_SkillRanks_SetBlindnessPenalty(int iModifier) { - string sFunc = "SetBlindnessPenalty"; - - NWNX_PushArgumentInt(NWNX_SkillRanks, sFunc, iModifier); - NWNX_CallFunction(NWNX_SkillRanks, sFunc); + NWNXPushInt(iModifier); + NWNXCall(NWNX_SkillRanks, "SetBlindnessPenalty"); } int NWNX_SkillRanks_GetAreaModifier(object oArea, int iSkill) { - string sFunc = "GetAreaModifier"; - - NWNX_PushArgumentInt(NWNX_SkillRanks, sFunc, iSkill); - NWNX_PushArgumentObject(NWNX_SkillRanks, sFunc, oArea); - NWNX_CallFunction(NWNX_SkillRanks, sFunc); - - return NWNX_GetReturnValueInt(NWNX_SkillRanks, sFunc); + NWNXPushInt(iSkill); + NWNXPushObject(oArea); + NWNXCall(NWNX_SkillRanks, "GetAreaModifier"); + return NWNXPopInt(); } void NWNX_SkillRanks_SetAreaModifier(object oArea, int iSkill, int iModifier) { - string sFunc = "SetAreaModifier"; - - NWNX_PushArgumentInt(NWNX_SkillRanks, sFunc, iModifier); - NWNX_PushArgumentInt(NWNX_SkillRanks, sFunc, iSkill); - NWNX_PushArgumentObject(NWNX_SkillRanks, sFunc, oArea); - NWNX_CallFunction(NWNX_SkillRanks, sFunc); + NWNXPushInt(iModifier); + NWNXPushInt(iSkill); + NWNXPushObject(oArea); + NWNXCall(NWNX_SkillRanks, "SetAreaModifier"); } diff --git a/_module/nss/nwnx_spellcheck.nss b/_module/nss/nwnx_spellcheck.nss index 5c75bee..45a0e65 100644 --- a/_module/nss/nwnx_spellcheck.nss +++ b/_module/nss/nwnx_spellcheck.nss @@ -2,7 +2,6 @@ /// @brief Functions related to spellchecking /// @{ /// @file nwnx_spellcheck.nss -#include "nwnx" const string NWNX_SpellChecker = "NWNX_SpellChecker"; ///< @private @@ -27,17 +26,14 @@ string NWNX_SpellChecker_GetSuggestSpell(string word); string NWNX_SpellChecker_FindMisspell(string sentence) { - string sFunc = "FindMisspell"; - - NWNX_PushArgumentString(NWNX_SpellChecker, sFunc, sentence); - NWNX_CallFunction(NWNX_SpellChecker, sFunc); - return NWNX_GetReturnValueString(NWNX_SpellChecker, sFunc); + NWNXPushString(sentence); + NWNXCall(NWNX_SpellChecker, "FindMisspell"); + return NWNXPopString(); } string NWNX_SpellChecker_GetSuggestSpell(string word) { - string sFunc = "GetSuggestSpell"; - NWNX_PushArgumentString(NWNX_SpellChecker, sFunc, word); - NWNX_CallFunction(NWNX_SpellChecker, sFunc); - return NWNX_GetReturnValueString(NWNX_SpellChecker, sFunc); + NWNXPushString(word); + NWNXCall(NWNX_SpellChecker, "GetSuggestSpell"); + return NWNXPopString(); } diff --git a/_module/nss/nwnx_sql.nss b/_module/nss/nwnx_sql.nss index fdd583f..cb32494 100644 --- a/_module/nss/nwnx_sql.nss +++ b/_module/nss/nwnx_sql.nss @@ -2,7 +2,6 @@ /// @brief Functions to interface with a database through SQL /// @{ /// @file nwnx_sql.nss -#include "nwnx" const string NWNX_SQL = "NWNX_SQL"; ///< @private @@ -61,6 +60,16 @@ void NWNX_SQL_PreparedObjectId(int position, object value); /// @param base64 Use base64-encoded string format if TRUE (default), otherwise use binary format. void NWNX_SQL_PreparedObjectFull(int position, object value, int base64 = TRUE); +/// @brief Set the NULL value of a prepared statement at given position. +/// @param position The nth ? in a prepared statement. +void NWNX_SQL_PreparedNULL(int position); + +/// @brief Set the Json value of a prepared statement at given position. +/// Convienence function to match other Prepared(type) functions. +/// @param position The nth ? in a prepared statement. +/// @param value The value to set. +void NWNX_SQL_PreparedJson(int position, json value); + /// @brief Like NWNX_SQL_ReadDataInActiveRow, but for full serialized objects. /// /// The object will be deserialized and created in the game. New object ID is returned. @@ -98,23 +107,23 @@ 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) { - string sFunc = "PrepareQuery"; - - NWNX_PushArgumentString(NWNX_SQL, sFunc, query); - NWNX_CallFunction(NWNX_SQL, sFunc); - return NWNX_GetReturnValueInt(NWNX_SQL, sFunc); + NWNXPushString(query); + NWNXCall(NWNX_SQL, "PrepareQuery"); + return NWNXPopInt(); } int NWNX_SQL_ExecutePreparedQuery() { - string sFunc = "ExecutePreparedQuery"; - - NWNX_CallFunction(NWNX_SQL, sFunc); - return NWNX_GetReturnValueInt(NWNX_SQL, sFunc); + NWNXCall(NWNX_SQL, "ExecutePreparedQuery"); + return NWNXPopInt(); } int NWNX_SQL_ExecuteQuery(string query) @@ -132,123 +141,109 @@ int NWNX_SQL_ExecuteQuery(string query) int NWNX_SQL_ReadyToReadNextRow() { - string sFunc = "ReadyToReadNextRow"; - - NWNX_CallFunction(NWNX_SQL, sFunc); - return NWNX_GetReturnValueInt(NWNX_SQL, sFunc); + NWNXCall(NWNX_SQL, "ReadyToReadNextRow"); + return NWNXPopInt(); } void NWNX_SQL_ReadNextRow() { - string sFunc = "ReadNextRow"; - - NWNX_CallFunction(NWNX_SQL, sFunc); + NWNXCall(NWNX_SQL, "ReadNextRow"); } string NWNX_SQL_ReadDataInActiveRow(int column = 0) { - string sFunc = "ReadDataInActiveRow"; - - NWNX_PushArgumentInt(NWNX_SQL, sFunc, column); - NWNX_CallFunction(NWNX_SQL, sFunc); - return NWNX_GetReturnValueString(NWNX_SQL, sFunc); + NWNXPushInt(column); + NWNXCall(NWNX_SQL, "ReadDataInActiveRow"); + return NWNXPopString(); } void NWNX_SQL_PreparedInt(int position, int value) { - string sFunc = "PreparedInt"; - - NWNX_PushArgumentInt(NWNX_SQL, sFunc, value); - NWNX_PushArgumentInt(NWNX_SQL, sFunc, position); - NWNX_CallFunction(NWNX_SQL, sFunc); + NWNXPushInt(value); + NWNXPushInt(position); + NWNXCall(NWNX_SQL, "PreparedInt"); } void NWNX_SQL_PreparedString(int position, string value) { - string sFunc = "PreparedString"; - - NWNX_PushArgumentString(NWNX_SQL, sFunc, value); - NWNX_PushArgumentInt(NWNX_SQL, sFunc, position); - NWNX_CallFunction(NWNX_SQL, sFunc); - + NWNXPushString(value); + NWNXPushInt(position); + NWNXCall(NWNX_SQL, "PreparedString"); } void NWNX_SQL_PreparedFloat(int position, float value) { - string sFunc = "PreparedFloat"; - - NWNX_PushArgumentFloat(NWNX_SQL, sFunc, value); - NWNX_PushArgumentInt(NWNX_SQL, sFunc, position); - NWNX_CallFunction(NWNX_SQL, sFunc); - + NWNXPushFloat(value); + NWNXPushInt(position); + NWNXCall(NWNX_SQL, "PreparedFloat"); } void NWNX_SQL_PreparedObjectId(int position, object value) { - string sFunc = "PreparedObjectId"; - - NWNX_PushArgumentObject(NWNX_SQL, sFunc, value); - NWNX_PushArgumentInt(NWNX_SQL, sFunc, position); - NWNX_CallFunction(NWNX_SQL, sFunc); - + NWNXPushObject(value); + NWNXPushInt(position); + NWNXCall(NWNX_SQL, "PreparedObjectId"); } void NWNX_SQL_PreparedObjectFull(int position, object value, int base64 = TRUE) { - string sFunc = "PreparedObjectFull"; - - NWNX_PushArgumentInt(NWNX_SQL, sFunc, base64); - NWNX_PushArgumentObject(NWNX_SQL, sFunc, value); - NWNX_PushArgumentInt(NWNX_SQL, sFunc, position); - NWNX_CallFunction(NWNX_SQL, sFunc); + NWNXPushInt(base64); + NWNXPushObject(value); + NWNXPushInt(position); + NWNXCall(NWNX_SQL, "PreparedObjectFull"); } +void NWNX_SQL_PreparedNULL(int position) +{ + NWNXPushInt(position); + NWNXCall(NWNX_SQL, "PreparedNULL"); +} +void NWNX_SQL_PreparedJson(int position, json value) +{ + // Dump to string and continue as a string from here. + // Famously assuming we're sent valid Json here. + NWNX_SQL_PreparedString(position, JsonDump(value)); +} + object NWNX_SQL_ReadFullObjectInActiveRow(int column = 0, object owner = OBJECT_INVALID, float x = 0.0, float y = 0.0, float z = 0.0, int base64 = TRUE) { - string sFunc = "ReadFullObjectInActiveRow"; - - NWNX_PushArgumentInt(NWNX_SQL, sFunc, base64); - NWNX_PushArgumentFloat(NWNX_SQL, sFunc, z); - NWNX_PushArgumentFloat(NWNX_SQL, sFunc, y); - NWNX_PushArgumentFloat(NWNX_SQL, sFunc, x); - NWNX_PushArgumentObject(NWNX_SQL, sFunc, owner); - NWNX_PushArgumentInt(NWNX_SQL, sFunc, column); - NWNX_CallFunction(NWNX_SQL, sFunc); - return NWNX_GetReturnValueObject(NWNX_SQL, sFunc); + NWNXPushInt(base64); + NWNXPushFloat(z); + NWNXPushFloat(y); + NWNXPushFloat(x); + NWNXPushObject(owner); + NWNXPushInt(column); + NWNXCall(NWNX_SQL, "ReadFullObjectInActiveRow"); + return NWNXPopObject(); } int NWNX_SQL_GetAffectedRows() { - string sFunc = "GetAffectedRows"; - - NWNX_CallFunction(NWNX_SQL, sFunc); - return NWNX_GetReturnValueInt(NWNX_SQL, sFunc); + NWNXCall(NWNX_SQL, "GetAffectedRows"); + return NWNXPopInt(); } string NWNX_SQL_GetDatabaseType() { - string sFunc = "GetDatabaseType"; - - NWNX_CallFunction(NWNX_SQL, sFunc); - return NWNX_GetReturnValueString(NWNX_SQL, sFunc); + NWNXCall(NWNX_SQL, "GetDatabaseType"); + return NWNXPopString(); } void NWNX_SQL_DestroyPreparedQuery() { - string sFunc = "DestroyPreparedQuery"; - - NWNX_CallFunction(NWNX_SQL, sFunc); + NWNXCall(NWNX_SQL, "DestroyPreparedQuery"); } string NWNX_SQL_GetLastError() { - string sFunc = "GetLastError"; - - NWNX_CallFunction(NWNX_SQL, sFunc); - return NWNX_GetReturnValueString(NWNX_SQL, sFunc); + NWNXCall(NWNX_SQL, "GetLastError"); + return NWNXPopString(); } int NWNX_SQL_GetPreparedQueryParamCount() { - string sFunc = "GetPreparedQueryParamCount"; - - NWNX_CallFunction(NWNX_SQL, sFunc); - return NWNX_GetReturnValueInt(NWNX_SQL, sFunc); + NWNXCall(NWNX_SQL, "GetPreparedQueryParamCount"); + return NWNXPopInt(); +} + +void NWNX_SQL_PostgreSQL_SetNextQueryResultsBinaryMode() +{ + NWNXCall(NWNX_SQL, "PostgreSQL_SetNextQueryResultsBinaryMode"); } diff --git a/_module/nss/nwnx_store.nss b/_module/nss/nwnx_store.nss new file mode 100644 index 0000000..8f6d252 --- /dev/null +++ b/_module/nss/nwnx_store.nss @@ -0,0 +1,106 @@ +/// @addtogroup store +/// @brief Functions exposing additional store properties. +/// @{ +/// @file nwnx_store.nss + +const string NWNX_Store = "NWNX_Store"; ///< @private + +/// @brief Return status of a base item purchase status. +/// @param oStore The store object. +/// @param nBaseItem A BASE_ITEM_* value +/// @return TRUE if the quest has been completed. -1 if the player does not have the journal entry. +int NWNX_Store_GetIsRestrictedBuyItem(object oStore, int nBaseItem); + +/// @brief Return the blackmarket mark down of a store +/// @param oStore The store object. +/// @return mark down of a store, -1 on error +int NWNX_Store_GetBlackMarketMarkDown(object oStore); + +/// @brief Set the blackmarket mark down of a store +/// @param oStore The store object. +/// @param nValue The amount. +void NWNX_Store_SetBlackMarketMarkDown(object oStore, int nValue); + +/// @brief Return the mark down of a store +/// @param oStore The store object. +/// @return mark down of a store, -1 on error +int NWNX_Store_GetMarkDown(object oStore); + +/// @brief Set the mark down of a store +/// @param oStore The store object. +/// @param nValue The amount. +void NWNX_Store_SetMarkDown(object oStore, int nValue); + +/// @brief Return the mark up of a store +/// @param oStore The store object. +/// @return mark up of a store, -1 on error +int NWNX_Store_GetMarkUp(object oStore); + +/// @brief Set the mark up of a store +/// @param oStore The store object. +/// @param nValue The amount. +void NWNX_Store_SetMarkUp(object oStore, int nValue); + +/// @brief Return current customer count +/// @param oStore The store object. +/// @return count, or -1 on error +int NWNX_Store_GetCurrentCustomersCount(object oStore); + +/// @} + +int NWNX_Store_GetIsRestrictedBuyItem(object oStore, int nBaseItem) +{ + NWNXPushInt(nBaseItem); + NWNXPushObject(oStore); + NWNXCall(NWNX_Store, "GetIsRestrictedBuyItem"); + return NWNXPopInt(); +} + +int NWNX_Store_GetBlackMarketMarkDown(object oStore) +{ + NWNXPushObject(oStore); + NWNXCall(NWNX_Store, "GetBlackMarketMarkDown"); + return NWNXPopInt(); +} + +void NWNX_Store_SetBlackMarketMarkDown(object oStore, int nValue) +{ + NWNXPushInt(nValue); + NWNXPushObject(oStore); + NWNXCall(NWNX_Store, "SetBlackMarketMarkDown"); +} + +int NWNX_Store_GetMarkDown(object oStore) +{ + NWNXPushObject(oStore); + NWNXCall(NWNX_Store, "GetMarkDown"); + return NWNXPopInt(); +} + +void NWNX_Store_SetMarkDown(object oStore, int nValue) +{ + NWNXPushInt(nValue); + NWNXPushObject(oStore); + NWNXCall(NWNX_Store, "SetMarkDown"); +} + +int NWNX_Store_GetMarkUp(object oStore) +{ + NWNXPushObject(oStore); + NWNXCall(NWNX_Store, "GetMarkUp"); + return NWNXPopInt(); +} + +void NWNX_Store_SetMarkUp(object oStore, int nValue) +{ + NWNXPushInt(nValue); + NWNXPushObject(oStore); + NWNXCall(NWNX_Store, "SetMarkUp"); +} + +int NWNX_Store_GetCurrentCustomersCount(object oStore) +{ + NWNXPushObject(oStore); + NWNXCall(NWNX_Store, "GetCurrentCustomersCount"); + return NWNXPopInt(); +} diff --git a/_module/nss/nwnx_tileset.nss b/_module/nss/nwnx_tileset.nss new file mode 100644 index 0000000..fa07a37 --- /dev/null +++ b/_module/nss/nwnx_tileset.nss @@ -0,0 +1,324 @@ +/// @addtogroup tileset Tileset +/// @brief An advanced plugin that exposes additional tileset and tile properties and allows builders to override the tiles of an area created with CreateArea(). +/// @{ +/// @file nwnx_tileset.nss + +const string NWNX_Tileset = "NWNX_Tileset"; ///< @private + +/// @brief A structure containing general tileset data. +struct NWNX_Tileset_TilesetData +{ + int nNumTileData; ///< The number of tiles in the tileset. + float fHeightTransition; ///< The height difference between tiles on different heights. + int nNumTerrain; ///< The number of terrains in the tileset. + int nNumCrossers; ///< The number of crossers in the tileset. + int nNumGroups; ///< The number of groups in the tileset. + string sBorderTerrain; ///< The default border terrain of the tileset. + string sDefaultTerrain; ///< The default terrain of the tileset. + string sFloorTerrain; ///< The default floor terrain of the tileset. + int nDisplayNameStrRef; ///< The name of the tileset as strref, -1 if not set. + string sUnlocalizedName; ///< The unlocalized name of the tileset, "" if not set. + int bInterior; ///< The type of tileset. TRUE for interior, FALSE for exterior. + int bHasHeightTransition; ///< TRUE if the tileset supports multiple height levels. FALSE if not. +}; + +/// @brief A structure containing the group data for a tileset. +struct NWNX_Tileset_TilesetGroupData +{ + string sName; ///< The name of the group. + int nStrRef; ///< The StrRef of the group. + int nRows; ///< The number of rows the group has. + int nColumns; ///< The number of columns the group has. +}; + +/// @brief A structure containing the edge and corner types of a tile. +struct NWNX_Tileset_TileEdgesAndCorners +{ + string sTopLeft; ///< The top left corner. + string sTop; ///< The top edge. + string sTopRight; ///< The top right corner. + string sRight; ///< The right edge. + string sBottomRight; ///< The bottom right corner. + string sBottom; ///< The bottom edge. + string sBottomLeft; ///< The bottom left corner. + string sLeft; ///< The left edge. +}; + +/// @brief A structure containing the door data for a tile. +struct NWNX_Tileset_TileDoorData +{ + int nType; ///< The type of door, returns an index into doortypes.2da. + float fX; ///< The X position of the door. + float fY; ///< The Y position of the door. + float fZ; ///< The Z position of the door. + float fOrientation; ///< The orientation of the door. +}; + +/// @brief A structure containing custom tile data, +struct NWNX_Tileset_CustomTileData +{ + int nTileID; ///< The tile ID. See the tileset's .set file. + int nOrientation; ///< The orientation of the tile. Valid values: 0-3. + int nHeight; ///< The height of the tile. + + int nMainLightColor1; ///< A `TILE_MAIN_LIGHT_COLOR_*` value. + int nMainLightColor2; ///< A `TILE_MAIN_LIGHT_COLOR_*` value. + int nSourceLightColor1; ///< A `TILE_SOURCE_LIGHT_COLOR_*` value. + int nSourceLightColor2; ///< A `TILE_SOURCE_LIGHT_COLOR_*` value. + + int bAnimLoop1; ///< A bool to enable or disable the tile's first anim loop. + int bAnimLoop2; ///< A bool to enable or disable the tile's second anim loop. + int bAnimLoop3; ///< A bool to enable or disable the tile's third anim loop. +}; + +/// @brief Get general data of sTileset. +/// @param sTileset The tileset. +/// @return A NWNX_Tileset_TilesetData struct. +struct NWNX_Tileset_TilesetData NWNX_Tileset_GetTilesetData(string sTileset); + +/// @brief Get the name of sTileset's terrain at nIndex. +/// @param sTileset The tileset. +/// @param nIndex The index of the terrain. Range: NWNX_Tileset_TilesetData.nNumTerrain > nIndex >= 0 +/// @return The terrain name or "" on error. +string NWNX_Tileset_GetTilesetTerrain(string sTileset, int nIndex); + +/// @brief Get the name of sTileset's crosser at nIndex. +/// @param sTileset The tileset. +/// @param nIndex The index of the crosser. Range: NWNX_Tileset_TilesetData.nNumCrossers > nIndex >= 0 +/// @return The crosser name or "" on error. +string NWNX_Tileset_GetTilesetCrosser(string sTileset, int nIndex); + +/// @brief Get general data of the group at nIndex in sTileset. +/// @param sTileset The tileset. +/// @param nIndex The index of the group. Range: NWNX_Tileset_TilesetData.nNumGroups > nIndex >= 0 +/// @return A NWNX_Tileset_TilesetGroupData struct. +struct NWNX_Tileset_TilesetGroupData NWNX_Tileset_GetTilesetGroupData(string sTileset, int nIndex); + +/// @brief Get the tile ID at nTileIndex in nGroupIndex of sTileset. +/// @param sTileset The tileset. +/// @param nGroupIndex The index of the group. Range: NWNX_Tileset_TilesetData.nNumGroups > nGroupIndex >= 0 +/// @param nTileIndex The index of the tile. Range: (NWNX_Tileset_TilesetGroupData.nRows * NWNX_Tileset_TilesetGroupData.nColumns) > nTileIndex >= 0 +/// @return The tile ID or 0 on error. +int NWNX_Tileset_GetTilesetGroupTile(string sTileset, int nGroupIndex, int nTileIndex); + +/// @brief Get the model name of a tile in sTileset. +/// @param sTileset The tileset. +/// @param nTileID The tile ID. +/// @return The model name or "" on error. +string NWNX_Tileset_GetTileModel(string sTileset, int nTileID); + +/// @brief Get the minimap texture name of a tile in sTileset. +/// @param sTileset The tileset. +/// @param nTileID The tile ID. +/// @return The minimap texture name or "" on error. +string NWNX_Tileset_GetTileMinimapTexture(string sTileset, int nTileID); + +/// @brief Get the edges and corners of a tile in sTileset. +/// @param sTileset The tileset. +/// @param nTileID The tile ID. +/// @return A NWNX_Tileset_TileEdgesAndCorners struct. +struct NWNX_Tileset_TileEdgesAndCorners NWNX_Tileset_GetTileEdgesAndCorners(string sTileset, int nTileID); + +/// @brief Get the number of doors of a tile in sTileset. +/// @param sTileset The tileset. +/// @param nTileID The tile ID. +/// @return The amount of doors. +int NWNX_Tileset_GetTileNumDoors(string sTileset, int nTileID); + +/// @brief Get the door data of a tile in sTileset. +/// @param sTileset The tileset. +/// @param nTileID The tile ID. +/// @param nIndex The index of the door. Range: NWNX_Tileset_GetTileNumDoors() > nIndex >= 0 +/// @return A NWNX_Tileset_TileDoorData struct. +struct NWNX_Tileset_TileDoorData NWNX_Tileset_GetTileDoorData(string sTileset, int nTileID, int nIndex = 0); + +/// @brief Override the tiles of sAreaResRef with data in sOverrideName. +/// @param sAreaResRef The resref of the area to override. +/// @param sOverrideName The name of the override containing the custom tile data or "" to remove the override. +void NWNX_Tileset_SetAreaTileOverride(string sAreaResRef, string sOverrideName); + +/// @brief Create a tile override named sOverrideName. +/// @param sOverrideName The name of the override. +/// @param sTileSet The tileset the override should use. +/// @param nWidth The width of the area. Valid values: 1-32. +/// @param nHeight The height of the area. Valid values: 1-32. +void NWNX_Tileset_CreateTileOverride(string sOverrideName, string sTileSet, int nWidth, int nHeight); + +/// @brief Delete a tile override named sOverrideName. +/// @note This will also delete all custom tile data associated with sOverrideName. +/// @param sOverrideName The name of the override. +void NWNX_Tileset_DeleteTileOverride(string sOverrideName); + +/// @brief Set custom tile data for the tile at nIndex in sOverrideName. +/// @note An override must first be created with NWNX_Tileset_CreateTileOverride(). +/// @param sOverrideName The name of the override. +/// @param nIndex The index of the tile. +/// @param strCustomTileData A NWNX_Tileset_CustomTileData struct. +void NWNX_Tileset_SetOverrideTileData(string sOverrideName, int nIndex, struct NWNX_Tileset_CustomTileData strCustomTileData); + +/// @brief Delete custom tile data of the tile at nIndex in sOverrideName. +/// @param sOverrideName The name of the override. +/// @param nIndex The tile's index or -1 to remove all custom tile data. +void NWNX_Tileset_DeleteOverrideTileData(string sOverrideName, int nIndex); + +/// @} + +struct NWNX_Tileset_TilesetData NWNX_Tileset_GetTilesetData(string sTileset) +{ + NWNXPushString(sTileset); + NWNXCall(NWNX_Tileset, "GetTilesetData"); + struct NWNX_Tileset_TilesetData str; + str.bHasHeightTransition = NWNXPopInt(); + str.bInterior = NWNXPopInt(); + str.sUnlocalizedName = NWNXPopString(); + str.nDisplayNameStrRef = NWNXPopInt(); + str.sFloorTerrain = NWNXPopString(); + str.sDefaultTerrain = NWNXPopString(); + str.sBorderTerrain = NWNXPopString(); + str.nNumGroups = NWNXPopInt(); + str.nNumCrossers = NWNXPopInt(); + str.nNumTerrain = NWNXPopInt(); + str.fHeightTransition = NWNXPopFloat(); + str.nNumTileData = NWNXPopInt(); + return str; +} + +string NWNX_Tileset_GetTilesetTerrain(string sTileset, int nIndex) +{ + NWNXPushInt(nIndex); + NWNXPushString(sTileset); + NWNXCall(NWNX_Tileset, "GetTilesetTerrain"); + return NWNXPopString(); +} + +string NWNX_Tileset_GetTilesetCrosser(string sTileset, int nIndex) +{ + NWNXPushInt(nIndex); + NWNXPushString(sTileset); + NWNXCall(NWNX_Tileset, "GetTilesetCrosser"); + return NWNXPopString(); +} + +struct NWNX_Tileset_TilesetGroupData NWNX_Tileset_GetTilesetGroupData(string sTileset, int nIndex) +{ + NWNXPushInt(nIndex); + NWNXPushString(sTileset); + NWNXCall(NWNX_Tileset, "GetTilesetGroupData"); + struct NWNX_Tileset_TilesetGroupData str; + str.nColumns = NWNXPopInt(); + str.nRows = NWNXPopInt(); + str.nStrRef = NWNXPopInt(); + str.sName = NWNXPopString(); + return str; +} + +int NWNX_Tileset_GetTilesetGroupTile(string sTileset, int nGroupIndex, int nTileIndex) +{ + NWNXPushInt(nTileIndex); + NWNXPushInt(nGroupIndex); + NWNXPushString(sTileset); + NWNXCall(NWNX_Tileset, "GetTilesetGroupTile"); + return NWNXPopInt(); +} + +string NWNX_Tileset_GetTileModel(string sTileset, int nTileID) +{ + NWNXPushInt(nTileID); + NWNXPushString(sTileset); + NWNXCall(NWNX_Tileset, "GetTileModel"); + return NWNXPopString(); +} + +string NWNX_Tileset_GetTileMinimapTexture(string sTileset, int nTileID) +{ + NWNXPushInt(nTileID); + NWNXPushString(sTileset); + NWNXCall(NWNX_Tileset, "GetTileMinimapTexture"); + return NWNXPopString(); +} + +struct NWNX_Tileset_TileEdgesAndCorners NWNX_Tileset_GetTileEdgesAndCorners(string sTileset, int nTileID) +{ + NWNXPushInt(nTileID); + NWNXPushString(sTileset); + NWNXCall(NWNX_Tileset, "GetTileEdgesAndCorners"); + struct NWNX_Tileset_TileEdgesAndCorners str; + str.sLeft = NWNXPopString(); + str.sBottomLeft = NWNXPopString(); + str.sBottom = NWNXPopString(); + str.sBottomRight = NWNXPopString(); + str.sRight = NWNXPopString(); + str.sTopRight = NWNXPopString(); + str.sTop = NWNXPopString(); + str.sTopLeft = NWNXPopString(); + return str; +} + +int NWNX_Tileset_GetTileNumDoors(string sTileset, int nTileID) +{ + NWNXPushInt(nTileID); + NWNXPushString(sTileset); + NWNXCall(NWNX_Tileset, "GetTileNumDoors"); + return NWNXPopInt(); +} + +struct NWNX_Tileset_TileDoorData NWNX_Tileset_GetTileDoorData(string sTileset, int nTileID, int nIndex = 0) +{ + NWNXPushInt(nIndex); + NWNXPushInt(nTileID); + NWNXPushString(sTileset); + NWNXCall(NWNX_Tileset, "GetTileDoorData"); + struct NWNX_Tileset_TileDoorData str; + str.fOrientation = NWNXPopFloat(); + str.fZ = NWNXPopFloat(); + str.fY = NWNXPopFloat(); + str.fX = NWNXPopFloat(); + str.nType = NWNXPopInt(); + return str; +} + +void NWNX_Tileset_SetAreaTileOverride(string sAreaResRef, string sOverrideName) +{ + NWNXPushString(sOverrideName); + NWNXPushString(sAreaResRef); + NWNXCall(NWNX_Tileset, "SetAreaTileOverride"); +} + +void NWNX_Tileset_CreateTileOverride(string sOverrideName, string sTileSet, int nWidth, int nHeight) +{ + NWNXPushInt(nHeight); + NWNXPushInt(nWidth); + NWNXPushString(sTileSet); + NWNXPushString(sOverrideName); + NWNXCall(NWNX_Tileset, "CreateTileOverride"); +} + +void NWNX_Tileset_DeleteTileOverride(string sOverrideName) +{ + NWNXPushString(sOverrideName); + NWNXCall(NWNX_Tileset, "DeleteTileOverride"); +} + +void NWNX_Tileset_SetOverrideTileData(string sOverrideName, int nIndex, struct NWNX_Tileset_CustomTileData strCustomTileData) +{ + NWNXPushInt(strCustomTileData.bAnimLoop3); + NWNXPushInt(strCustomTileData.bAnimLoop2); + NWNXPushInt(strCustomTileData.bAnimLoop1); + NWNXPushInt(strCustomTileData.nSourceLightColor2); + NWNXPushInt(strCustomTileData.nSourceLightColor1); + NWNXPushInt(strCustomTileData.nMainLightColor2); + NWNXPushInt(strCustomTileData.nMainLightColor1); + NWNXPushInt(strCustomTileData.nHeight); + NWNXPushInt(strCustomTileData.nOrientation); + NWNXPushInt(strCustomTileData.nTileID); + NWNXPushInt(nIndex); + NWNXPushString(sOverrideName); + NWNXCall(NWNX_Tileset, "SetOverrideTileData"); +} + +void NWNX_Tileset_DeleteOverrideTileData(string sOverrideName, int nIndex) +{ + NWNXPushInt(nIndex); + NWNXPushString(sOverrideName); + NWNXCall(NWNX_Tileset, "DeleteOverrideTileData"); +} diff --git a/_module/nss/nwnx_time.nss b/_module/nss/nwnx_time.nss index 1e4e71b..7b1788b 100644 --- a/_module/nss/nwnx_time.nss +++ b/_module/nss/nwnx_time.nss @@ -2,18 +2,22 @@ /// @brief Provides various time related functions /// @{ /// @file nwnx_time.nss -#include "nwnx" +#include "nwnx_util" +#include "inc_sqlite_time" const string NWNX_Time = "NWNX_Time"; ///< @private /// @brief Returns the current date. +/// @deprecated Use SQLite functions (see inc_sqlite_time). This will be removed in future NWNX releases. /// @return The date in the format (mm/dd/yyyy). string NWNX_Time_GetSystemDate(); /// @brief Returns current time. +/// @deprecated Use SQLite functions (see inc_sqlite_time). This will be removed in future NWNX releases. /// @return The current time in the format (24:mm:ss). string NWNX_Time_GetSystemTime(); +/// @deprecated Use SQLite functions (see inc_sqlite_time). This will be removed in future NWNX releases. /// @return Returns the number of seconds since midnight on January 1, 1970. int NWNX_Time_GetTimeStamp(); @@ -24,6 +28,7 @@ struct NWNX_Time_HighResTimestamp int microseconds; ///< Microseconds }; +/// @deprecated Use NWNX_Util_GetHighResTimeStamp(). This will be removed in future NWNX releases. /// @return Returns the number of microseconds since midnight on January 1, 1970. struct NWNX_Time_HighResTimestamp NWNX_Time_GetHighResTimeStamp(); @@ -31,33 +36,28 @@ struct NWNX_Time_HighResTimestamp NWNX_Time_GetHighResTimeStamp(); string NWNX_Time_GetSystemDate() { - string sFunc = "GetSystemDate"; - NWNX_CallFunction(NWNX_Time, sFunc); - return NWNX_GetReturnValueString(NWNX_Time, sFunc); + WriteTimestampedLogEntry("WARNING: NWNX_Time is deprecated. You should migrate to SQLite based functions (see inc_sqlite_time)."); + return SQLite_GetSystemDate(); } string NWNX_Time_GetSystemTime() { - string sFunc = "GetSystemTime"; - NWNX_CallFunction(NWNX_Time, sFunc); - return NWNX_GetReturnValueString(NWNX_Time, sFunc); + WriteTimestampedLogEntry("WARNING: NWNX_Time is deprecated. You should migrate to SQLite based functions (see inc_sqlite_time)."); + return SQLite_GetSystemTime(); } int NWNX_Time_GetTimeStamp() { - string sFunc = "GetTimeStamp"; - - NWNX_CallFunction(NWNX_Time, sFunc); - return NWNX_GetReturnValueInt(NWNX_Time, sFunc); + WriteTimestampedLogEntry("WARNING: NWNX_Time is deprecated. You should migrate to SQLite based functions (see inc_sqlite_time)."); + return SQLite_GetTimeStamp(); } struct NWNX_Time_HighResTimestamp NWNX_Time_GetHighResTimeStamp() { + WriteTimestampedLogEntry("WARNING: NWNX_Time is deprecated. NWNX_Time_GetHighResTimeStamp is moving to NWNX_Util."); + struct NWNX_Util_HighResTimestamp u = NWNX_Util_GetHighResTimeStamp(); struct NWNX_Time_HighResTimestamp t; - string sFunc = "GetHighResTimeStamp"; - - NWNX_CallFunction(NWNX_Time, sFunc); - t.microseconds = NWNX_GetReturnValueInt(NWNX_Time, sFunc); - t.seconds = NWNX_GetReturnValueInt(NWNX_Time, sFunc); + t.seconds = u.seconds; + t.microseconds = u.microseconds; return t; } diff --git a/_module/nss/nwnx_util.nss b/_module/nss/nwnx_util.nss index 71c66f0..1de3d14 100644 --- a/_module/nss/nwnx_util.nss +++ b/_module/nss/nwnx_util.nss @@ -2,7 +2,6 @@ /// @brief Provides various utility functions that don't have a better home /// @{ /// @file nwnx_util.nss -#include "nwnx" const string NWNX_Util = "NWNX_Util"; ///< @private @@ -28,6 +27,20 @@ const int NWNX_UTIL_RESREF_TYPE_STORE = 2051; const int NWNX_UTIL_RESREF_TYPE_WAYPOINT = 2058; ///@} +/// @brief A world time struct +struct NWNX_Util_WorldTime +{ + int nCalendarDay; ///< The calendar day + int nTimeOfDay; ///< The time of day +}; + +/// @brief A high resolution timestamp +struct NWNX_Util_HighResTimestamp +{ + int seconds; ///< Seconds since epoch + int microseconds; ///< Microseconds +}; + /// @brief Gets the name of the currently executing script. /// @note If depth is > 0, it will return the name of the script that called this one via ExecuteScript(). /// @param depth to seek the executing script. @@ -44,6 +57,14 @@ string NWNX_Util_GetAsciiTableString(); /// @return The hashed string as an integer. int NWNX_Util_Hash(string str); +/// @brief Gets the last modified timestamp (mtime) of the module file in seconds. +/// @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. @@ -54,7 +75,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. @@ -65,12 +85,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. @@ -90,12 +104,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. @@ -109,11 +117,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. @@ -121,37 +124,44 @@ int NWNX_Util_GetServerTicksPerSecond(); /// @return The last created object. On error, this returns OBJECT_INVALID. object NWNX_Util_GetLastCreatedObject(int nObjectType, int nNthLast = 1); -/// @brief Compiles and adds a script to the UserDirectory/nwnx folder. +/// @brief Compiles and adds a script to the UserDirectory/nwnx folder, or to the location of sAlias. /// @note Will override existing scripts that are in the module. /// @param sFileName The script filename without extension, 16 or less characters. /// @param sScriptData The script data to compile /// @param bWrapIntoMain Set to TRUE to wrap sScriptData into void main(){}. +/// @param sAlias The alias of the resource directory to add the ncs file to. Default: UserDirectory/nwnx /// @return "" on success, or the compilation error. -string NWNX_Util_AddScript(string sFileName, string sScriptData, int bWrapIntoMain = FALSE); +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. +/// @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. /// @param sContents The contents of the nss file +/// @param sAlias The alias of the resource directory to add the nss file to. Default: UserDirectory/nwnx /// @return TRUE on success. -int NWNX_Util_AddNSSFile(string sFileName, string sContents); +int NWNX_Util_AddNSSFile(string sFileName, string sContents, string sAlias = "NWNX"); -/// @brief Remove sFileName of nType from the UserDirectory/nwnx folder. +/// @brief Remove sFileName of nType from the UserDirectory/nwnx folder, or from the location of sAlias. /// @param sFileName The filename without extension, 16 or less characters. /// @param nType The @ref resref_types "Resref Type". +/// @param sAlias The alias of the resource directory to remove the file from. Default: UserDirectory/nwnx /// @return TRUE on success. -int NWNX_Util_RemoveNWNXResourceFile(string sFileName, int nType); +int NWNX_Util_RemoveNWNXResourceFile(string sFileName, int nType, string sAlias = "NWNX"); -/// @brief Set the NWScript instruction limit +/// @brief Set the NWScript instruction limit. /// @param nInstructionLimit The new limit or -1 to reset to default. void NWNX_Util_SetInstructionLimit(int nInstructionLimit); +/// @brief Get the NWScript instruction limit. +int NWNX_Util_GetInstructionLimit(); + +/// @brief Set the number of NWScript instructions currently executed. +/// @param nInstructions The number of instructions, must be >= 0. +void NWNX_Util_SetInstructionsExecuted(int nInstructions); + +/// @brief Get the number of NWScript instructions currently executed. +int NWNX_Util_GetInstructionsExecuted(); + /// @brief Register a server console command that will execute a script chunk. /// @note Example usage: NWNX_Util_RegisterServerConsoleCommand("test", "PrintString(\"Test Command -> Args: $args\");"); /// @param sCommand The name of the command. @@ -163,12 +173,6 @@ int NWNX_Util_RegisterServerConsoleCommand(string sCommand, string sScriptChunk) /// @param sCommand The name of the command. void NWNX_Util_UnregisterServerConsoleCommand(string sCommand); -/// @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_Util_PluginExists("NWNX_Creature"); -/// @return TRUE if the plugin exists and is enabled, otherwise FALSE. -int NWNX_Util_PluginExists(string sPlugin); - /// @brief Gets the server's current working user folder. /// @return The absolute path of the server's home directory (-userDirectory) string NWNX_Util_GetUserDirectory(); @@ -177,245 +181,410 @@ string NWNX_Util_GetUserDirectory(); /// @return Return value of the last run script. int NWNX_Util_GetScriptReturnValue(); +/// @brief Create a door. +/// @param sResRef The ResRef of the door. +/// @param locLocation The location to create the door at. +/// @param sNewTag An optional new tag for the door. +/// @param nAppearanceType An optional index into doortypes.2da for appearance. +/// @return The door, or OBJECT_INVALID on failure. +object NWNX_Util_CreateDoor(string sResRef, location locLocation, string sNewTag = "", int nAppearanceType = -1); + +/// @brief Set the object that will be returned by GetItemActivator. +/// @param oObject An object. +void NWNX_Util_SetItemActivator(object oObject); + +/// @brief Get the world time as calendar day and time of day. +/// @note This function is useful for calculating effect expiry times. +/// @param fAdjustment An adjustment in seconds, 0.0f will return the current world time, +/// positive or negative values will return a world time in the future or past. +/// @return A NWNX_Util_WorldTime struct with the calendar day and time of day. +struct NWNX_Util_WorldTime NWNX_Util_GetWorldTime(float fAdjustment = 0.0f); + +/// @brief Set a server-side resource override. +/// @param nResType A @ref resref_types "Resref Type". +/// @param sOldName The old resource name, 16 characters or less. +/// @param sNewName The new resource name or "" to clear a previous override, 16 characters or less. +void NWNX_Util_SetResourceOverride(int nResType, string sOldName, string sNewName); + +/// @brief Get a server-side resource override. +/// @param nResType A @ref resref_types "Resref Type". +/// @param sName The name of the resource, 16 characters or less. +/// @return The resource override, or "" if one is not set. +string NWNX_Util_GetResourceOverride(int nResType, string sName); + +/// @brief Get if a script param is set. +/// @param sParamName The script parameter name to check. +/// @return TRUE if the script param is set, FALSE if not or on error. +int NWNX_Util_GetScriptParamIsSet(string sParamName); + +/// @brief Set the module dawn hour. +/// @param nDawnHour The new dawn hour +void NWNX_Util_SetDawnHour(int nDawnHour); + +/// @brief Get the module dawn hour. +/// @return The dawn hour +int NWNX_Util_GetDawnHour(); + +/// @brief Set the module dusk hour. +/// @param nDuskHour The new dusk hour +void NWNX_Util_SetDuskHour(int nDuskHour); + +/// @brief Get the module dusk hour. +/// @return The dusk hour +int NWNX_Util_GetDuskHour(); + +/// @return Returns the number of microseconds since midnight on January 1, 1970. +struct NWNX_Util_HighResTimestamp NWNX_Util_GetHighResTimeStamp(); + +/// @return Return name of a terminal, "" if not a TTY +string NWNX_Util_GetTTY(); + +/// @brief Set the currently running script event. +/// @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); + +/// @brief Return the filename of the tlk file. +/// @return The name +string NWNX_Util_GetModuleTlkFile(); + +/// @brief Update a resource directory by having ResMan reindex it. +/// @param sAlias A resource directory alias, eg: TEMP +/// @return TRUE if successful, FALSE on error. +int NWNX_Util_UpdateResourceDirectory(string sAlias); + /// @} string NWNX_Util_GetCurrentScriptName(int depth = 0) { - string sFunc = "GetCurrentScriptName"; - NWNX_PushArgumentInt(NWNX_Util, sFunc, depth); - NWNX_CallFunction(NWNX_Util, sFunc); - return NWNX_GetReturnValueString(NWNX_Util, sFunc); + NWNXPushInt(depth); + NWNXCall(NWNX_Util, "GetCurrentScriptName"); + return NWNXPopString(); } string NWNX_Util_GetAsciiTableString() { - string sFunc = "GetAsciiTableString"; - NWNX_CallFunction(NWNX_Util, sFunc); - return NWNX_GetReturnValueString(NWNX_Util, sFunc); + NWNXCall(NWNX_Util, "GetAsciiTableString"); + return NWNXPopString(); } int NWNX_Util_Hash(string str) { - string sFunc = "Hash"; - NWNX_PushArgumentString(NWNX_Util, sFunc, str); - NWNX_CallFunction(NWNX_Util, sFunc); - return NWNX_GetReturnValueInt(NWNX_Util, sFunc); + NWNXPushString(str); + NWNXCall(NWNX_Util, "Hash"); + return NWNXPopInt(); +} + +int NWNX_Util_GetModuleMtime() +{ + NWNXCall(NWNX_Util, "GetModuleMtime"); + return NWNXPopInt(); +} + +string NWNX_Util_GetModuleFile() +{ + NWNXCall(NWNX_Util, "GetModuleFile"); + return NWNXPopString(); } string NWNX_Util_GetCustomToken(int customTokenNumber) { - string sFunc = "GetCustomToken"; - NWNX_PushArgumentInt(NWNX_Util, sFunc, customTokenNumber); - NWNX_CallFunction(NWNX_Util, sFunc); - return NWNX_GetReturnValueString(NWNX_Util, sFunc); + NWNXPushInt(customTokenNumber); + NWNXCall(NWNX_Util, "GetCustomToken"); + return NWNXPopString(); } itemproperty NWNX_Util_EffectToItemProperty(effect e) { - string sFunc = "EffectTypeCast"; - NWNX_PushArgumentEffect(NWNX_Util, sFunc, e); - NWNX_CallFunction(NWNX_Util, sFunc); - return NWNX_GetReturnValueItemProperty(NWNX_Util, sFunc); + NWNXPushEffect(e); + NWNXCall(NWNX_Util, "EffectTypeCast"); + return NWNXPopItemProperty(); } effect NWNX_Util_ItemPropertyToEffect(itemproperty ip) { - string sFunc = "EffectTypeCast"; - NWNX_PushArgumentItemProperty(NWNX_Util, sFunc, ip); - NWNX_CallFunction(NWNX_Util, sFunc); - return NWNX_GetReturnValueEffect(NWNX_Util, sFunc); + NWNXPushItemProperty(ip); + NWNXCall(NWNX_Util, "EffectTypeCast"); + return NWNXPopEffect(); } string NWNX_Util_StripColors(string str) { - string sFunc = "StripColors"; - NWNX_PushArgumentString(NWNX_Util, sFunc, str); - NWNX_CallFunction(NWNX_Util, sFunc); - return NWNX_GetReturnValueString(NWNX_Util, sFunc); -} - -int NWNX_Util_IsValidResRef(string resref, int type = NWNX_UTIL_RESREF_TYPE_CREATURE) -{ - string sFunc = "IsValidResRef"; - NWNX_PushArgumentInt(NWNX_Util, sFunc, type); - NWNX_PushArgumentString(NWNX_Util, sFunc, resref); - NWNX_CallFunction(NWNX_Util, sFunc); - return NWNX_GetReturnValueInt(NWNX_Util, sFunc); + NWNXPushString(str); + NWNXCall(NWNX_Util, "StripColors"); + return NWNXPopString(); } string NWNX_Util_GetEnvironmentVariable(string sVarname) { - string sFunc = "GetEnvironmentVariable"; - NWNX_PushArgumentString(NWNX_Util, sFunc, sVarname); - NWNX_CallFunction(NWNX_Util, sFunc); - return NWNX_GetReturnValueString(NWNX_Util, sFunc); + NWNXPushString(sVarname); + NWNXCall(NWNX_Util, "GetEnvironmentVariable"); + return NWNXPopString(); } int NWNX_Util_GetMinutesPerHour() { - string sFunc = "GetMinutesPerHour"; - NWNX_CallFunction(NWNX_Util, sFunc); - return NWNX_GetReturnValueInt(NWNX_Util, sFunc); + NWNXCall(NWNX_Util, "GetMinutesPerHour"); + return NWNXPopInt(); } void NWNX_Util_SetMinutesPerHour(int minutes) { - string sFunc = "SetMinutesPerHour"; - NWNX_PushArgumentInt(NWNX_Util, sFunc, minutes); - NWNX_CallFunction(NWNX_Util, sFunc); + NWNXPushInt(minutes); + NWNXCall(NWNX_Util, "SetMinutesPerHour"); } string NWNX_Util_EncodeStringForURL(string sURL) { - string sFunc = "EncodeStringForURL"; - - NWNX_PushArgumentString(NWNX_Util, sFunc, sURL); - NWNX_CallFunction(NWNX_Util, sFunc); - - return NWNX_GetReturnValueString(NWNX_Util, sFunc); -} - -int NWNX_Util_Get2DARowCount(string str) -{ - string sFunc = "Get2DARowCount"; - NWNX_PushArgumentString(NWNX_Util, sFunc, str); - NWNX_CallFunction(NWNX_Util, sFunc); - return NWNX_GetReturnValueInt(NWNX_Util, sFunc); + NWNXPushString(sURL); + NWNXCall(NWNX_Util, "EncodeStringForURL"); + return NWNXPopString(); } string NWNX_Util_GetFirstResRef(int nType, string sRegexFilter = "", int bModuleResourcesOnly = TRUE) { - string sFunc = "GetFirstResRef"; - - NWNX_PushArgumentInt(NWNX_Util, sFunc, bModuleResourcesOnly); - NWNX_PushArgumentString(NWNX_Util, sFunc, sRegexFilter); - NWNX_PushArgumentInt(NWNX_Util, sFunc, nType); - NWNX_CallFunction(NWNX_Util, sFunc); - - return NWNX_GetReturnValueString(NWNX_Util, sFunc); + NWNXPushInt(bModuleResourcesOnly); + NWNXPushString(sRegexFilter); + NWNXPushInt(nType); + NWNXCall(NWNX_Util, "GetFirstResRef"); + return NWNXPopString(); } string NWNX_Util_GetNextResRef() { - string sFunc = "GetNextResRef"; - - NWNX_CallFunction(NWNX_Util, sFunc); - - return NWNX_GetReturnValueString(NWNX_Util, sFunc); -} - -int NWNX_Util_GetServerTicksPerSecond() -{ - string sFunc = "GetServerTicksPerSecond"; - - NWNX_CallFunction(NWNX_Util, sFunc); - - return NWNX_GetReturnValueInt(NWNX_Util, sFunc); + NWNXCall(NWNX_Util, "GetNextResRef"); + return NWNXPopString(); } object NWNX_Util_GetLastCreatedObject(int nObjectType, int nNthLast = 1) { - string sFunc = "GetLastCreatedObject"; - - NWNX_PushArgumentInt(NWNX_Util, sFunc, nNthLast); - NWNX_PushArgumentInt(NWNX_Util, sFunc, nObjectType); - NWNX_CallFunction(NWNX_Util, sFunc); - - return NWNX_GetReturnValueObject(NWNX_Util, sFunc); + NWNXPushInt(nNthLast); + NWNXPushInt(nObjectType); + NWNXCall(NWNX_Util, "GetLastCreatedObject"); + return NWNXPopObject(); } -string NWNX_Util_AddScript(string sFileName, string sScriptData, int bWrapIntoMain = FALSE) +string NWNX_Util_AddScript(string sFileName, string sScriptData, int bWrapIntoMain = FALSE, string sAlias = "NWNX") { - string sFunc = "AddScript"; - - NWNX_PushArgumentInt(NWNX_Util, sFunc, bWrapIntoMain); - NWNX_PushArgumentString(NWNX_Util, sFunc, sScriptData); - NWNX_PushArgumentString(NWNX_Util, sFunc, sFileName); - NWNX_CallFunction(NWNX_Util, sFunc); - - return NWNX_GetReturnValueString(NWNX_Util, sFunc); + NWNXPushString(sAlias); + NWNXPushInt(bWrapIntoMain); + NWNXPushString(sScriptData); + NWNXPushString(sFileName); + NWNXCall(NWNX_Util, "AddScript"); + return NWNXPopString(); } -string NWNX_Util_GetNSSContents(string sScriptName, int nMaxLength = -1) +int NWNX_Util_AddNSSFile(string sFileName, string sContents, string sAlias = "NWNX") { - string sFunc = "GetNSSContents"; - - NWNX_PushArgumentInt(NWNX_Util, sFunc, nMaxLength); - NWNX_PushArgumentString(NWNX_Util, sFunc, sScriptName); - NWNX_CallFunction(NWNX_Util, sFunc); - - return NWNX_GetReturnValueString(NWNX_Util, sFunc); + NWNXPushString(sAlias); + NWNXPushString(sContents); + NWNXPushString(sFileName); + NWNXCall(NWNX_Util, "AddNSSFile"); + return NWNXPopInt(); } -int NWNX_Util_AddNSSFile(string sFileName, string sContents) +int NWNX_Util_RemoveNWNXResourceFile(string sFileName, int nType, string sAlias = "NWNX") { - string sFunc = "AddNSSFile"; - - NWNX_PushArgumentString(NWNX_Util, sFunc, sContents); - NWNX_PushArgumentString(NWNX_Util, sFunc, sFileName); - NWNX_CallFunction(NWNX_Util, sFunc); - - return NWNX_GetReturnValueInt(NWNX_Util, sFunc); -} - -int NWNX_Util_RemoveNWNXResourceFile(string sFileName, int nType) -{ - string sFunc = "RemoveNWNXResourceFile"; - - NWNX_PushArgumentInt(NWNX_Util, sFunc, nType); - NWNX_PushArgumentString(NWNX_Util, sFunc, sFileName); - NWNX_CallFunction(NWNX_Util, sFunc); - - return NWNX_GetReturnValueInt(NWNX_Util, sFunc); + NWNXPushString(sAlias); + NWNXPushInt(nType); + NWNXPushString(sFileName); + NWNXCall(NWNX_Util, "RemoveNWNXResourceFile"); + return NWNXPopInt(); } void NWNX_Util_SetInstructionLimit(int nInstructionLimit) { - string sFunc = "SetInstructionLimit"; + NWNXPushInt(nInstructionLimit); + NWNXCall(NWNX_Util, "SetInstructionLimit"); +} - NWNX_PushArgumentInt(NWNX_Util, sFunc, nInstructionLimit); - NWNX_CallFunction(NWNX_Util, sFunc); +int NWNX_Util_GetInstructionLimit() +{ + NWNXCall(NWNX_Util, "GetInstructionLimit"); + return NWNXPopInt(); +} + +void NWNX_Util_SetInstructionsExecuted(int nInstructions) +{ + NWNXPushInt(nInstructions); + NWNXCall(NWNX_Util, "SetInstructionsExecuted"); +} + +int NWNX_Util_GetInstructionsExecuted() +{ + NWNXCall(NWNX_Util, "GetInstructionsExecuted"); + return NWNXPopInt(); } int NWNX_Util_RegisterServerConsoleCommand(string sCommand, string sScriptChunk) { - string sFunc = "RegisterServerConsoleCommand"; - - NWNX_PushArgumentString(NWNX_Util, sFunc, sScriptChunk); - NWNX_PushArgumentString(NWNX_Util, sFunc, sCommand); - NWNX_CallFunction(NWNX_Util, sFunc); - - return NWNX_GetReturnValueInt(NWNX_Util, sFunc); + NWNXPushString(sScriptChunk); + NWNXPushString(sCommand); + NWNXCall(NWNX_Util, "RegisterServerConsoleCommand"); + return NWNXPopInt(); } void NWNX_Util_UnregisterServerConsoleCommand(string sCommand) { - string sFunc = "UnregisterServerConsoleCommand"; - - NWNX_PushArgumentString(NWNX_Util, sFunc, sCommand); - NWNX_CallFunction(NWNX_Util, sFunc); -} - -int NWNX_Util_PluginExists(string sPlugin) -{ - string sFunc = "PluginExists"; - NWNX_PushArgumentString(NWNX_Util, sFunc, sPlugin); - NWNX_CallFunction(NWNX_Util, sFunc); - return NWNX_GetReturnValueInt(NWNX_Util, sFunc); + NWNXPushString(sCommand); + NWNXCall(NWNX_Util, "UnregisterServerConsoleCommand"); } string NWNX_Util_GetUserDirectory() { - string sFunc = "GetUserDirectory"; - NWNX_CallFunction(NWNX_Util, sFunc); - return NWNX_GetReturnValueString(NWNX_Util, sFunc); + NWNXCall(NWNX_Util, "GetUserDirectory"); + return NWNXPopString(); } int NWNX_Util_GetScriptReturnValue() { - string sFunc = "GetScriptReturnValue"; - - NWNX_CallFunction(NWNX_Util, sFunc); - - return NWNX_GetReturnValueInt(NWNX_Util, sFunc); + NWNXCall(NWNX_Util, "GetScriptReturnValue"); + return NWNXPopInt(); +} + +object NWNX_Util_CreateDoor(string sResRef, location locLocation, string sNewTag = "", int nAppearanceType = -1) +{ + NWNXPushInt(nAppearanceType); + NWNXPushString(sNewTag); + NWNXPushLocation(locLocation); + NWNXPushString(sResRef); + NWNXCall(NWNX_Util, "CreateDoor"); + return NWNXPopObject(); +} + +void NWNX_Util_SetItemActivator(object oObject) +{ + NWNXPushObject(oObject); + NWNXCall(NWNX_Util, "SetItemActivator"); +} + +struct NWNX_Util_WorldTime NWNX_Util_GetWorldTime(float fAdjustment = 0.0f) +{ + NWNXPushFloat(fAdjustment); + NWNXCall(NWNX_Util, "GetWorldTime"); + struct NWNX_Util_WorldTime strWorldTime; + strWorldTime.nTimeOfDay = NWNXPopInt(); + strWorldTime.nCalendarDay = NWNXPopInt(); + return strWorldTime; +} + +void NWNX_Util_SetResourceOverride(int nResType, string sOldName, string sNewName) +{ + NWNXPushString(sNewName); + NWNXPushString(sOldName); + NWNXPushInt(nResType); + NWNXCall(NWNX_Util, "SetResourceOverride"); +} + +string NWNX_Util_GetResourceOverride(int nResType, string sName) +{ + NWNXPushString(sName); + NWNXPushInt(nResType); + NWNXCall(NWNX_Util, "GetResourceOverride"); + return NWNXPopString(); +} + +int NWNX_Util_GetScriptParamIsSet(string sParamName) +{ + NWNXPushString(sParamName); + NWNXCall(NWNX_Util, "GetScriptParamIsSet"); + return NWNXPopInt(); +} + +void NWNX_Util_SetDawnHour(int nDawnHour) +{ + NWNXPushInt(nDawnHour); + NWNXCall(NWNX_Util, "SetDawnHour"); +} + +int NWNX_Util_GetDawnHour() +{ + NWNXCall(NWNX_Util, "GetDawnHour"); + return NWNXPopInt(); +} + +void NWNX_Util_SetDuskHour(int nDuskHour) +{ + NWNXPushInt(nDuskHour); + NWNXCall(NWNX_Util, "SetDuskHour"); +} + +int NWNX_Util_GetDuskHour() +{ + NWNXCall(NWNX_Util, "GetDuskHour"); + return NWNXPopInt(); +} + +struct NWNX_Util_HighResTimestamp NWNX_Util_GetHighResTimeStamp() +{ + struct NWNX_Util_HighResTimestamp t; + NWNXCall(NWNX_Util, "GetHighResTimeStamp"); + t.microseconds = NWNXPopInt(); + t.seconds = NWNXPopInt(); + return t; +} + +string NWNX_Util_GetTTY() +{ + NWNXCall(NWNX_Util, "GetTTY"); + return NWNXPopString(); +} + +void NWNX_Util_SetCurrentlyRunningEvent(int nEventID) +{ + NWNXPushInt(nEventID); + NWNXCall(NWNX_Util, "SetCurrentlyRunningEvent"); +} + +int NWNX_Util_GetStringLevenshteinDistance(string sString, string sCompareTo) +{ + NWNXPushString(sCompareTo); + NWNXPushString(sString); + NWNXCall(NWNX_Util, "GetStringLevenshteinDistance"); + return NWNXPopInt(); +} + +void NWNX_Util_UpdateClientObject(object oObjectToUpdate, object oPlayer = OBJECT_INVALID) +{ + NWNXPushObject(oPlayer); + NWNXPushObject(oObjectToUpdate); + NWNXCall(NWNX_Util, "UpdateClientObject"); +} + +int NWNX_Util_CleanResourceDirectory(string sAlias, int nResType = 0xFFFF) +{ + NWNXPushInt(nResType); + NWNXPushString(sAlias); + NWNXCall(NWNX_Util, "CleanResourceDirectory"); + return NWNXPopInt(); +} + +string NWNX_Util_GetModuleTlkFile() +{ + string sFunc = "GetModuleTlkFile"; + NWNXCall(NWNX_Util, sFunc); + return NWNXPopString(); +} + +int NWNX_Util_UpdateResourceDirectory(string sAlias) +{ + NWNXPushString(sAlias); + NWNXCall(NWNX_Util, "UpdateResourceDirectory"); + return NWNXPopInt(); } diff --git a/_module/nss/nwnx_visibility.nss b/_module/nss/nwnx_visibility.nss index 22774e8..be70ed0 100644 --- a/_module/nss/nwnx_visibility.nss +++ b/_module/nss/nwnx_visibility.nss @@ -2,76 +2,70 @@ /// @brief Functions to manipulate visibility of objects both globally or per observer /// @{ /// @file nwnx_visibility.nss -#include "nwnx" const string NWNX_Visibility = "NWNX_Visibility"; ///< @private /// @name Visibility Types /// @anchor vis_types /// @{ -const int NWNX_VISIBILITY_DEFAULT = -1; -const int NWNX_VISIBILITY_VISIBLE = 0; -const int NWNX_VISIBILITY_HIDDEN = 1; -const int NWNX_VISIBILITY_DM_ONLY = 2; +const int NWNX_VISIBILITY_DEFAULT = -1; +const int NWNX_VISIBILITY_VISIBLE = 0; +const int NWNX_VISIBILITY_HIDDEN = 1; +const int NWNX_VISIBILITY_DM_ONLY = 2; +const int NWNX_VISIBILITY_ALWAYS_VISIBLE = 3; +const int NWNX_VISIBILITY_ALWAYS_VISIBLE_DM_ONLY = 4; ///@} -/// @brief Queries the existing visibility override for given (player, target) pair. +/// @brief Queries the existing visibility override for given (oPlayer, oTarget) pair. +/// If oPlayer is OBJECT_INVALID, the global visibility override will be returned. /// -/// If player is OBJECT_INVALID, the global visibility override will be returned -/// * Player == VALID -> returns: -/// * NWNX_VISIBILITY_DEFAULT = Player override not set -/// * NWNX_VISIBILITY_VISIBLE = Target is always visible for player -/// * NWNX_VISIBILITY_HIDDEN = Target is always hidden for player -/// * Player == OBJECT_INVALID -> returns: -/// * NWNX_VISIBILITY_DEFAULT = Global override not set -/// * NWNX_VISIBILITY_VISIBLE = Target is globally visible -/// * NWNX_VISIBILITY_HIDDEN = Target is globally hidden -/// * NWNX_VISIBILITY_DM_ONLY = Target is only visible to DMs -/// @param player The PC Object or OBJECT_INVALID. -/// @param target The object for which we're querying the visibility. +/// * NWNX_VISIBILITY_DEFAULT = Override not set. +/// * NWNX_VISIBILITY_VISIBLE = Target is visible but still adheres to default visibility rules. +/// * NWNX_VISIBILITY_HIDDEN = Target is always hidden. +/// * NWNX_VISIBILITY_DM_ONLY = Target is only visible to DMs but still adheres to default visibility rules. +/// * NWNX_VISIBILITY_ALWAYS_VISIBLE = Target is always visible in all circumstances. +/// * NWNX_VISIBILITY_ALWAYS_VISIBLE_DM_ONLY = Target is always visible only to DMs in all circumstances. +/// +/// @param oPlayer The PC Object or OBJECT_INVALID. +/// @param oTarget The object for which we're querying the visibility override. /// @return The @ref vis_types "Visibility Type". -int NWNX_Visibility_GetVisibilityOverride(object player, object target); +int NWNX_Visibility_GetVisibilityOverride(object oPlayer, object oTarget); -/// @brief Overrides the default visibility rules about how player perceives the target object. +/// @brief Overrides the default visibility rules about how oPlayer perceives oTarget. +/// If oPlayer is OBJECT_INVALID, the global visibility override will be set. /// -/// If player is OBJECT_INVALID, the global visibility override will be set -/// * Player == VALID -> override: -/// * NWNX_VISIBILITY_DEFAULT = Remove the player override -/// * NWNX_VISIBILITY_VISIBLE = Target is always visible for player -/// * NWNX_VISIBILITY_HIDDEN = Target is always hidden for player -/// * Player == OBJECT_INVALID -> override: -/// * NWNX_VISIBILITY_DEFAULT = Remove the global override -/// * NWNX_VISIBILITY_VISIBLE = Target is globally visible -/// * NWNX_VISIBILITY_HIDDEN = Target is globally hidden -/// * NWNX_VISIBILITY_DM_ONLY = Target is only visible to DMs +/// * NWNX_VISIBILITY_DEFAULT = Remove a set override. +/// * NWNX_VISIBILITY_VISIBLE = Target is visible but still adheres to default visibility rules. +/// * NWNX_VISIBILITY_HIDDEN = Target is always hidden. +/// * NWNX_VISIBILITY_DM_ONLY = Target is only visible to DMs but still adheres to default visibility rules. +/// * NWNX_VISIBILITY_ALWAYS_VISIBLE = Target is always visible in all circumstances. +/// * NWNX_VISIBILITY_ALWAYS_VISIBLE_DM_ONLY = Target is always visible to DMs in all circumstances. +/// +/// @warning Setting too many objects to ALWAYS_VISIBLE in an area will impact the performance of your players. Use sparingly. /// /// @note Player state overrides the global state which means if a global state is set /// to NWNX_VISIBILITY_HIDDEN or NWNX_VISIBILITY_DM_ONLY but the player's state is /// set to NWNX_VISIBILITY_VISIBLE for the target, the object will be visible to the player. -/// @param player The PC Object or OBJECT_INVALID. -/// @param target The object for which we're altering the visibility. -/// @param override The visibility type from @ref vis_types "Visibility Types". -void NWNX_Visibility_SetVisibilityOverride(object player, object target, int override); +/// +/// @param oPlayer The PC Object or OBJECT_INVALID. +/// @param oTarget The object for which we're altering the visibility. +/// @param nOverride The visibility type from @ref vis_types "Visibility Types". +void NWNX_Visibility_SetVisibilityOverride(object oPlayer, object oTarget, int nOverride); /// @} -int NWNX_Visibility_GetVisibilityOverride(object player, object target) +int NWNX_Visibility_GetVisibilityOverride(object oPlayer, object oTarget) { - string sFunc = "GetVisibilityOverride"; - - NWNX_PushArgumentObject(NWNX_Visibility, sFunc, target); - NWNX_PushArgumentObject(NWNX_Visibility, sFunc, player); - NWNX_CallFunction(NWNX_Visibility, sFunc); - - return NWNX_GetReturnValueInt(NWNX_Visibility, sFunc); + NWNXPushObject(oTarget); + NWNXPushObject(oPlayer); + NWNXCall(NWNX_Visibility, "GetVisibilityOverride"); + return NWNXPopInt(); } -void NWNX_Visibility_SetVisibilityOverride(object player, object target, int override) +void NWNX_Visibility_SetVisibilityOverride(object oPlayer, object oTarget, int nOverride) { - string sFunc = "SetVisibilityOverride"; - - NWNX_PushArgumentInt(NWNX_Visibility, sFunc, override); - NWNX_PushArgumentObject(NWNX_Visibility, sFunc, target); - NWNX_PushArgumentObject(NWNX_Visibility, sFunc, player); - NWNX_CallFunction(NWNX_Visibility, sFunc); + NWNXPushInt(nOverride); + NWNXPushObject(oTarget); + NWNXPushObject(oPlayer); + NWNXCall(NWNX_Visibility, "SetVisibilityOverride"); } diff --git a/_module/nss/nwnx_weapon.nss b/_module/nss/nwnx_weapon.nss index 09d812f..eced73f 100644 --- a/_module/nss/nwnx_weapon.nss +++ b/_module/nss/nwnx_weapon.nss @@ -2,7 +2,6 @@ /// @brief Functions exposing additional weapon properties. /// @{ /// @file nwnx_weapon.nss -#include "nwnx" const string NWNX_Weapon = "NWNX_Weapon"; ///< @private @@ -94,6 +93,7 @@ void NWNX_Weapon_SetGreaterWeaponFocusFeat(int nBaseItem, int nFeat); /// @brief Set base item as monk weapon. /// @param nBaseItem The base item id. +/// @deprecated Use baseitems.2da. This will be removed in future NWNX releases. void NWNX_Weapon_SetWeaponIsMonkWeapon(int nBaseItem); /// @brief Set plugin options. @@ -114,187 +114,175 @@ struct NWNX_Weapon_DevastatingCriticalEvent_Data NWNX_Weapon_GetDevastatingCriti /// @note This is only for use with the Devastating Critical Event Script. void NWNX_Weapon_BypassDevastatingCritical(); +/// @brief Sets weapon to gain .5 strength bonus. +/// @param oWeapon Should be a melee weapon. +/// @param nEnable TRUE for bonus. FALSE to turn off bonus. +/// @param bPersist whether the two hand state should persist to the gff file. +void NWNX_Weapon_SetOneHalfStrength(object oWeapon, int nEnable, int bPersist = FALSE); + +/// @brief Gets if the weapon is set to gain addition .5 strength bonus +/// @param oWeapon the weapon +/// @return FALSE/0 if weapon is not receiving the bonus. TRUE/1 if it does. +int NWNX_Weapon_GetOneHalfStrength(object oWeapon); + +/// @brief Override the max attack distance of ranged weapons. +/// @param nBaseItem The baseitem id. +/// @param fMax The maximum attack distance. Default is 40.0f. +/// @param fMaxPassive The maximum passive attack distance. Default is 20.0f. Seems to be used by the engine to determine a new nearby target when needed. +/// @param fPreferred The preferred attack distance. See the PrefAttackDist column in baseitems.2da, default seems to be 30.0f for ranged weapons. +/// @note fMaxPassive should probably be lower than fMax, half of fMax seems to be a good start. fPreferred should be at least ~0.5f lower than fMax. +void NWNX_Weapon_SetMaxRangedAttackDistanceOverride(int nBaseItem, float fMax, float fMaxPassive, float fPreferred); + /// @} void NWNX_Weapon_SetWeaponFocusFeat(int nBaseItem, int nFeat) { - string sFunc = "SetWeaponFocusFeat"; - - NWNX_PushArgumentInt(NWNX_Weapon, sFunc, nFeat); - NWNX_PushArgumentInt(NWNX_Weapon, sFunc, nBaseItem); - - NWNX_CallFunction(NWNX_Weapon, sFunc); + NWNXPushInt(nFeat); + NWNXPushInt(nBaseItem); + NWNXCall(NWNX_Weapon, "SetWeaponFocusFeat"); } void NWNX_Weapon_SetEpicWeaponFocusFeat(int nBaseItem, int nFeat) { - string sFunc = "SetEpicWeaponFocusFeat"; - - NWNX_PushArgumentInt(NWNX_Weapon, sFunc, nFeat); - NWNX_PushArgumentInt(NWNX_Weapon, sFunc, nBaseItem); - - NWNX_CallFunction(NWNX_Weapon, sFunc); + NWNXPushInt(nFeat); + NWNXPushInt(nBaseItem); + NWNXCall(NWNX_Weapon, "SetEpicWeaponFocusFeat"); } void NWNX_Weapon_SetGreaterWeaponFocusFeat(int nBaseItem, int nFeat) { - string sFunc = "SetGreaterWeaponFocusFeat"; - - NWNX_PushArgumentInt(NWNX_Weapon, sFunc, nFeat); - NWNX_PushArgumentInt(NWNX_Weapon, sFunc, nBaseItem); - - NWNX_CallFunction(NWNX_Weapon, sFunc); + NWNXPushInt(nFeat); + NWNXPushInt(nBaseItem); + NWNXCall(NWNX_Weapon, "SetGreaterWeaponFocusFeat"); } void NWNX_Weapon_SetWeaponFinesseSize(int nBaseItem, int nSize) { - string sFunc = "SetWeaponFinesseSize"; - - NWNX_PushArgumentInt(NWNX_Weapon, sFunc, nSize); - NWNX_PushArgumentInt(NWNX_Weapon, sFunc, nBaseItem); - - NWNX_CallFunction(NWNX_Weapon, sFunc); + NWNXPushInt(nSize); + NWNXPushInt(nBaseItem); + NWNXCall(NWNX_Weapon, "SetWeaponFinesseSize"); } int NWNX_Weapon_GetWeaponFinesseSize(int nBaseItem) { - string sFunc = "GetWeaponFinesseSize"; - - NWNX_PushArgumentInt(NWNX_Weapon, sFunc, nBaseItem); - - NWNX_CallFunction(NWNX_Weapon, sFunc); - - return NWNX_GetReturnValueInt(NWNX_Weapon, sFunc); + NWNXPushInt(nBaseItem); + NWNXCall(NWNX_Weapon, "GetWeaponFinesseSize"); + return NWNXPopInt(); } void NWNX_Weapon_SetWeaponUnarmed(int nBaseItem) { - string sFunc = "SetWeaponUnarmed"; - - NWNX_PushArgumentInt(NWNX_Weapon, sFunc, nBaseItem); - - NWNX_CallFunction(NWNX_Weapon, sFunc); + NWNXPushInt(nBaseItem); + NWNXCall(NWNX_Weapon, "SetWeaponUnarmed"); } void NWNX_Weapon_SetWeaponIsMonkWeapon(int nBaseItem) { - string sFunc = "SetWeaponIsMonkWeapon"; - - NWNX_PushArgumentInt(NWNX_Weapon, sFunc, nBaseItem); - - NWNX_CallFunction(NWNX_Weapon, sFunc); + WriteTimestampedLogEntry("NWNX_Weapon_SetWeaponIsMonkWeapon() is deprecated. Please use baseitems.2da instead."); + NWNXPushInt(nBaseItem); + NWNXCall(NWNX_Weapon, "SetWeaponIsMonkWeapon"); } void NWNX_Weapon_SetWeaponImprovedCriticalFeat(int nBaseItem, int nFeat) { - string sFunc = "SetWeaponImprovedCriticalFeat"; - - NWNX_PushArgumentInt(NWNX_Weapon, sFunc, nFeat); - NWNX_PushArgumentInt(NWNX_Weapon, sFunc, nBaseItem); - - NWNX_CallFunction(NWNX_Weapon, sFunc); + NWNXPushInt(nFeat); + NWNXPushInt(nBaseItem); + NWNXCall(NWNX_Weapon, "SetWeaponImprovedCriticalFeat"); } void NWNX_Weapon_SetWeaponSpecializationFeat(int nBaseItem, int nFeat) { - string sFunc = "SetWeaponSpecializationFeat"; - - NWNX_PushArgumentInt(NWNX_Weapon, sFunc, nFeat); - NWNX_PushArgumentInt(NWNX_Weapon, sFunc, nBaseItem); - - NWNX_CallFunction(NWNX_Weapon, sFunc); + NWNXPushInt(nFeat); + NWNXPushInt(nBaseItem); + NWNXCall(NWNX_Weapon, "SetWeaponSpecializationFeat"); } void NWNX_Weapon_SetGreaterWeaponSpecializationFeat(int nBaseItem, int nFeat) { - string sFunc = "SetGreaterWeaponSpecializationFeat"; - - NWNX_PushArgumentInt(NWNX_Weapon, sFunc, nFeat); - NWNX_PushArgumentInt(NWNX_Weapon, sFunc, nBaseItem); - - NWNX_CallFunction(NWNX_Weapon, sFunc); + NWNXPushInt(nFeat); + NWNXPushInt(nBaseItem); + NWNXCall(NWNX_Weapon, "SetGreaterWeaponSpecializationFeat"); } void NWNX_Weapon_SetEpicWeaponSpecializationFeat(int nBaseItem, int nFeat) { - string sFunc = "SetEpicWeaponSpecializationFeat"; - - NWNX_PushArgumentInt(NWNX_Weapon, sFunc, nFeat); - NWNX_PushArgumentInt(NWNX_Weapon, sFunc, nBaseItem); - - NWNX_CallFunction(NWNX_Weapon, sFunc); + NWNXPushInt(nFeat); + NWNXPushInt(nBaseItem); + NWNXCall(NWNX_Weapon, "SetEpicWeaponSpecializationFeat"); } void NWNX_Weapon_SetEpicWeaponOverwhelmingCriticalFeat(int nBaseItem, int nFeat) { - string sFunc = "SetEpicWeaponOverwhelmingCriticalFeat"; - - NWNX_PushArgumentInt(NWNX_Weapon, sFunc, nFeat); - NWNX_PushArgumentInt(NWNX_Weapon, sFunc, nBaseItem); - - NWNX_CallFunction(NWNX_Weapon, sFunc); + NWNXPushInt(nFeat); + NWNXPushInt(nBaseItem); + NWNXCall(NWNX_Weapon, "SetEpicWeaponOverwhelmingCriticalFeat"); } void NWNX_Weapon_SetEpicWeaponDevastatingCriticalFeat(int nBaseItem, int nFeat) { - string sFunc = "SetEpicWeaponDevastatingCriticalFeat"; - - NWNX_PushArgumentInt(NWNX_Weapon, sFunc, nFeat); - NWNX_PushArgumentInt(NWNX_Weapon, sFunc, nBaseItem); - - NWNX_CallFunction(NWNX_Weapon, sFunc); + NWNXPushInt(nFeat); + NWNXPushInt(nBaseItem); + NWNXCall(NWNX_Weapon, "SetEpicWeaponDevastatingCriticalFeat"); } void NWNX_Weapon_SetWeaponOfChoiceFeat(int nBaseItem, int nFeat) { - string sFunc = "SetWeaponOfChoiceFeat"; - - NWNX_PushArgumentInt(NWNX_Weapon, sFunc, nFeat); - NWNX_PushArgumentInt(NWNX_Weapon, sFunc, nBaseItem); - - NWNX_CallFunction(NWNX_Weapon, sFunc); + NWNXPushInt(nFeat); + NWNXPushInt(nBaseItem); + NWNXCall(NWNX_Weapon, "SetWeaponOfChoiceFeat"); } void NWNX_Weapon_SetOption(int nOption, int nVal) { - string sFunc = "SetOption"; - - NWNX_PushArgumentInt(NWNX_Weapon, sFunc, nVal); - NWNX_PushArgumentInt(NWNX_Weapon, sFunc, nOption); - - NWNX_CallFunction(NWNX_Weapon, sFunc); + NWNXPushInt(nVal); + NWNXPushInt(nOption); + NWNXCall(NWNX_Weapon, "SetOption"); } void NWNX_Weapon_SetDevastatingCriticalEventScript(string sScript) { - string sFunc = "SetDevastatingCriticalEventScript"; - - NWNX_PushArgumentString(NWNX_Weapon, sFunc, sScript); - - NWNX_CallFunction(NWNX_Weapon, sFunc); + NWNXPushString(sScript); + NWNXCall(NWNX_Weapon, "SetDevastatingCriticalEventScript"); } void NWNX_Weapon_BypassDevastatingCritical() { - string sFunc = "SetEventData"; - - NWNX_PushArgumentInt(NWNX_Weapon, sFunc, 1); - NWNX_PushArgumentInt(NWNX_Weapon, sFunc, NWNX_WEAPON_SETDATA_DC_BYPASS); - - NWNX_CallFunction(NWNX_Weapon, sFunc); + NWNXPushInt(1); + NWNXPushInt(NWNX_WEAPON_SETDATA_DC_BYPASS); + NWNXCall(NWNX_Weapon, "SetEventData"); } struct NWNX_Weapon_DevastatingCriticalEvent_Data NWNX_Weapon_GetDevastatingCriticalEventData() { - string sFunc = "GetEventData"; struct NWNX_Weapon_DevastatingCriticalEvent_Data data; - - NWNX_PushArgumentInt(NWNX_Weapon, sFunc, NWNX_WEAPON_GETDATA_DC); - NWNX_CallFunction(NWNX_Weapon, sFunc); - - data.oWeapon = NWNX_GetReturnValueObject(NWNX_Weapon, sFunc); - data.oTarget = NWNX_GetReturnValueObject(NWNX_Weapon, sFunc); - data.nDamage = NWNX_GetReturnValueInt(NWNX_Weapon, sFunc); - + NWNXPushInt(NWNX_WEAPON_GETDATA_DC); + NWNXCall(NWNX_Weapon, "GetEventData"); + data.oWeapon = NWNXPopObject(); + data.oTarget = NWNXPopObject(); + data.nDamage = NWNXPopInt(); return data; } + +void NWNX_Weapon_SetOneHalfStrength(object oWeapon, int nEnable, int bPersist = FALSE) +{ + NWNXPushInt(bPersist); + NWNXPushInt(nEnable); + NWNXPushObject(oWeapon); + NWNXCall(NWNX_Weapon, "SetOneHalfStrength"); +} + +int NWNX_Weapon_GetOneHalfStrength(object oWeapon) +{ + NWNXPushObject(oWeapon); + NWNXCall(NWNX_Weapon, "GetOneHalfStrength"); + return NWNXPopInt(); +} + +void NWNX_Weapon_SetMaxRangedAttackDistanceOverride(int nBaseItem, float fMax, float fMaxPassive, float fPreferred) +{ + NWNXPushFloat(fPreferred); + NWNXPushFloat(fMaxPassive); + NWNXPushFloat(fMax); + NWNXPushInt(nBaseItem); + NWNXCall(NWNX_Weapon, "SetMaxRangedAttackDistanceOverride"); +} diff --git a/_module/nss/nwnx_webhook.nss b/_module/nss/nwnx_webhook.nss index 755b632..2d7e7ed 100644 --- a/_module/nss/nwnx_webhook.nss +++ b/_module/nss/nwnx_webhook.nss @@ -2,7 +2,6 @@ /// @brief Send messages to external entities through web hooks. /// @{ /// @file nwnx_webhook.nss -#include "nwnx" const string NWNX_WebHook = "NWNX_WebHook"; ///< @private @@ -28,13 +27,12 @@ void NWNX_WebHook_ResendWebHookHTTPS(string host, string path, string sMessage, void NWNX_WebHook_SendWebHookHTTPS(string host, string path, string message, string username = "", int mrkdwn = 1) { - string sFunc = "SendWebHookHTTPS"; - NWNX_PushArgumentInt(NWNX_WebHook, sFunc, mrkdwn); - NWNX_PushArgumentString(NWNX_WebHook, sFunc, username); - NWNX_PushArgumentString(NWNX_WebHook, sFunc, message); - NWNX_PushArgumentString(NWNX_WebHook, sFunc, path); - NWNX_PushArgumentString(NWNX_WebHook, sFunc, host); - NWNX_CallFunction(NWNX_WebHook, sFunc); + NWNXPushInt(mrkdwn); + NWNXPushString(username); + NWNXPushString(message); + NWNXPushString(path); + NWNXPushString(host); + NWNXCall(NWNX_WebHook, "SendWebHookHTTPS"); } void NWNX_WebHook_ResendWebHookHTTPS(string host, string path, string sMessage, float delay = 0.0f) diff --git a/_release/Underworld 2 [PRC8-CEP3].7z b/_release/Underworld 2 [PRC8-CEP3].7z index 6dd1c41..b0e3427 100644 Binary files a/_release/Underworld 2 [PRC8-CEP3].7z and b/_release/Underworld 2 [PRC8-CEP3].7z differ