diff --git a/_module/ifo/module.ifo.json b/_module/ifo/module.ifo.json index 8f894806..76166c45 100644 --- a/_module/ifo/module.ifo.json +++ b/_module/ifo/module.ifo.json @@ -4400,6 +4400,13 @@ "value": "peps_prc8" } }, + { + "__struct_id": 8, + "Mod_Hak": { + "type": "cexostring", + "value": "prcx_shims" + } + }, { "__struct_id": 8, "Mod_Hak": { @@ -4688,7 +4695,7 @@ }, "Mod_OnPlrGuiEvt": { "type": "resref", - "value": "" + "value": "prc_onplayergui" }, "Mod_OnPlrLvlUp": { "type": "resref", @@ -5799,6 +5806,21 @@ "type": "int", "value": 1 } + }, + { + "__struct_id": 0, + "Name": { + "type": "cexostring", + "value": "PRC_PRCX_ENABLED" + }, + "Type": { + "type": "dword", + "value": 1 + }, + "Value": { + "type": "int", + "value": 1 + } } ] } diff --git a/_module/itp/creaturepalcus.itp.json b/_module/itp/creaturepalcus.itp.json index a2fe96e0..9c19a805 100644 --- a/_module/itp/creaturepalcus.itp.json +++ b/_module/itp/creaturepalcus.itp.json @@ -24851,7 +24851,7 @@ "__struct_id": 0, "CR": { "type": "float", - "value": 17.0 + "value": 16.0 }, "FACTION": { "type": "cexostring", @@ -36838,7 +36838,7 @@ "__struct_id": 0, "CR": { "type": "float", - "value": 0.3333333432674408 + "value": 84.0 }, "FACTION": { "type": "cexostring", diff --git a/_module/ncs/062_npc_say.ncs b/_module/ncs/062_npc_say.ncs index a0d6633e..07455dab 100644 Binary files a/_module/ncs/062_npc_say.ncs and b/_module/ncs/062_npc_say.ncs differ diff --git a/_module/ncs/0c_assoc_actions.ncs b/_module/ncs/0c_assoc_actions.ncs index d469987d..71a2317e 100644 Binary files a/_module/ncs/0c_assoc_actions.ncs and b/_module/ncs/0c_assoc_actions.ncs differ diff --git a/_module/ncs/0c_cast_polymorp.ncs b/_module/ncs/0c_cast_polymorp.ncs index 9f1916e4..e4416310 100644 Binary files a/_module/ncs/0c_cast_polymorp.ncs and b/_module/ncs/0c_cast_polymorp.ncs differ diff --git a/_module/ncs/0c_fire_henchmen.ncs b/_module/ncs/0c_fire_henchmen.ncs index 800bd810..203fe8c3 100644 Binary files a/_module/ncs/0c_fire_henchmen.ncs and b/_module/ncs/0c_fire_henchmen.ncs differ diff --git a/_module/ncs/0c_get_convo.ncs b/_module/ncs/0c_get_convo.ncs index fd990929..743ca417 100644 Binary files a/_module/ncs/0c_get_convo.ncs and b/_module/ncs/0c_get_convo.ncs differ diff --git a/_module/ncs/0c_get_henchman.ncs b/_module/ncs/0c_get_henchman.ncs index 13e4af79..b4835758 100644 Binary files a/_module/ncs/0c_get_henchman.ncs and b/_module/ncs/0c_get_henchman.ncs differ diff --git a/_module/ncs/0c_henchmenspell.ncs b/_module/ncs/0c_henchmenspell.ncs index 751cb571..12820bea 100644 Binary files a/_module/ncs/0c_henchmenspell.ncs and b/_module/ncs/0c_henchmenspell.ncs differ diff --git a/_module/ncs/0c_if_a_magic_m.ncs b/_module/ncs/0c_if_a_magic_m.ncs index 3b61ec9d..739c42fa 100644 Binary files a/_module/ncs/0c_if_a_magic_m.ncs and b/_module/ncs/0c_if_a_magic_m.ncs differ diff --git a/_module/ncs/0c_if_ass_convo.ncs b/_module/ncs/0c_if_ass_convo.ncs index 630c0c8f..021e64a3 100644 Binary files a/_module/ncs/0c_if_ass_convo.ncs and b/_module/ncs/0c_if_ass_convo.ncs differ diff --git a/_module/ncs/0c_if_assoc_mode.ncs b/_module/ncs/0c_if_assoc_mode.ncs index 172c75d3..bea2cfff 100644 Binary files a/_module/ncs/0c_if_assoc_mode.ncs and b/_module/ncs/0c_if_assoc_mode.ncs differ diff --git a/_module/ncs/0c_if_cntrspell.ncs b/_module/ncs/0c_if_cntrspell.ncs index 4667f688..cb2154ae 100644 Binary files a/_module/ncs/0c_if_cntrspell.ncs and b/_module/ncs/0c_if_cntrspell.ncs differ diff --git a/_module/ncs/0c_if_com_script.ncs b/_module/ncs/0c_if_com_script.ncs index eb6dcb21..e69435ce 100644 Binary files a/_module/ncs/0c_if_com_script.ncs and b/_module/ncs/0c_if_com_script.ncs differ diff --git a/_module/ncs/0c_if_convo.ncs b/_module/ncs/0c_if_convo.ncs index 13b85f09..ef685bcd 100644 Binary files a/_module/ncs/0c_if_convo.ncs and b/_module/ncs/0c_if_convo.ncs differ diff --git a/_module/ncs/0c_if_has_assoc.ncs b/_module/ncs/0c_if_has_assoc.ncs index ffdfb4f3..cfe9eaea 100644 Binary files a/_module/ncs/0c_if_has_assoc.ncs and b/_module/ncs/0c_if_has_assoc.ncs differ diff --git a/_module/ncs/0c_if_has_class.ncs b/_module/ncs/0c_if_has_class.ncs index 1461b033..ba91574e 100644 Binary files a/_module/ncs/0c_if_has_class.ncs and b/_module/ncs/0c_if_has_class.ncs differ diff --git a/_module/ncs/0c_if_has_spell.ncs b/_module/ncs/0c_if_has_spell.ncs index aa89e0e0..7fc39238 100644 Binary files a/_module/ncs/0c_if_has_spell.ncs and b/_module/ncs/0c_if_has_spell.ncs differ diff --git a/_module/ncs/0c_if_hen_leave.ncs b/_module/ncs/0c_if_hen_leave.ncs index be810642..355b28cb 100644 Binary files a/_module/ncs/0c_if_hen_leave.ncs and b/_module/ncs/0c_if_hen_leave.ncs differ diff --git a/_module/ncs/0c_if_identify.ncs b/_module/ncs/0c_if_identify.ncs index af035767..0f66aac5 100644 Binary files a/_module/ncs/0c_if_identify.ncs and b/_module/ncs/0c_if_identify.ncs differ diff --git a/_module/ncs/0c_if_open_inven.ncs b/_module/ncs/0c_if_open_inven.ncs index c51df655..44b6f53e 100644 Binary files a/_module/ncs/0c_if_open_inven.ncs and b/_module/ncs/0c_if_open_inven.ncs differ diff --git a/_module/ncs/0c_if_pickuploot.ncs b/_module/ncs/0c_if_pickuploot.ncs index 5ec22e57..4aeca4dc 100644 Binary files a/_module/ncs/0c_if_pickuploot.ncs and b/_module/ncs/0c_if_pickuploot.ncs differ diff --git a/_module/ncs/0c_if_polymorph.ncs b/_module/ncs/0c_if_polymorph.ncs index 0778730e..ab9a4dee 100644 Binary files a/_module/ncs/0c_if_polymorph.ncs and b/_module/ncs/0c_if_polymorph.ncs differ diff --git a/_module/ncs/0c_if_scout.ncs b/_module/ncs/0c_if_scout.ncs index 5ec22e57..4aeca4dc 100644 Binary files a/_module/ncs/0c_if_scout.ncs and b/_module/ncs/0c_if_scout.ncs differ diff --git a/_module/ncs/0c_if_taunt.ncs b/_module/ncs/0c_if_taunt.ncs index 342a27a5..1d5fd9ff 100644 Binary files a/_module/ncs/0c_if_taunt.ncs and b/_module/ncs/0c_if_taunt.ncs differ diff --git a/_module/ncs/0c_listhenchman.ncs b/_module/ncs/0c_listhenchman.ncs index de1e30e0..6af6af8b 100644 Binary files a/_module/ncs/0c_listhenchman.ncs and b/_module/ncs/0c_listhenchman.ncs differ diff --git a/_module/ncs/0c_no_com_script.ncs b/_module/ncs/0c_no_com_script.ncs index 65232c21..1691bde7 100644 Binary files a/_module/ncs/0c_no_com_script.ncs and b/_module/ncs/0c_no_com_script.ncs differ diff --git a/_module/ncs/0c_summon_assoc.ncs b/_module/ncs/0c_summon_assoc.ncs index 86796be8..2af6b569 100644 Binary files a/_module/ncs/0c_summon_assoc.ncs and b/_module/ncs/0c_summon_assoc.ncs differ diff --git a/_module/ncs/0c_use_feat.ncs b/_module/ncs/0c_use_feat.ncs index 910277c8..2afe7e78 100644 Binary files a/_module/ncs/0c_use_feat.ncs and b/_module/ncs/0c_use_feat.ncs differ diff --git a/_module/ncs/0e_c2_1_hb.ncs b/_module/ncs/0e_c2_1_hb.ncs index 43d1d40d..11bed8f8 100644 Binary files a/_module/ncs/0e_c2_1_hb.ncs and b/_module/ncs/0e_c2_1_hb.ncs differ diff --git a/_module/ncs/0e_c2_7_ondeath.ncs b/_module/ncs/0e_c2_7_ondeath.ncs index 7705e5ff..bc62bda6 100644 Binary files a/_module/ncs/0e_c2_7_ondeath.ncs and b/_module/ncs/0e_c2_7_ondeath.ncs differ diff --git a/_module/ncs/0e_ch_1_hb.ncs b/_module/ncs/0e_ch_1_hb.ncs index 60b5196a..4118a330 100644 Binary files a/_module/ncs/0e_ch_1_hb.ncs and b/_module/ncs/0e_ch_1_hb.ncs differ diff --git a/_module/ncs/0e_ch_7_ondeath.ncs b/_module/ncs/0e_ch_7_ondeath.ncs index ca47b898..977e2bc8 100644 Binary files a/_module/ncs/0e_ch_7_ondeath.ncs and b/_module/ncs/0e_ch_7_ondeath.ncs differ diff --git a/_module/ncs/0e_do_combat_rnd.ncs b/_module/ncs/0e_do_combat_rnd.ncs index 735f4df5..e5be57e7 100644 Binary files a/_module/ncs/0e_do_combat_rnd.ncs and b/_module/ncs/0e_do_combat_rnd.ncs differ diff --git a/_module/ncs/0e_gui_events.ncs b/_module/ncs/0e_gui_events.ncs index 24c02d6b..4fe30423 100644 Binary files a/_module/ncs/0e_gui_events.ncs and b/_module/ncs/0e_gui_events.ncs differ diff --git a/_module/ncs/0e_id_events.ncs b/_module/ncs/0e_id_events.ncs index 48e25c79..271590fe 100644 Binary files a/_module/ncs/0e_id_events.ncs and b/_module/ncs/0e_id_events.ncs differ diff --git a/_module/ncs/0e_nui.ncs b/_module/ncs/0e_nui.ncs index 13bdf7a4..ef9dd9db 100644 Binary files a/_module/ncs/0e_nui.ncs and b/_module/ncs/0e_nui.ncs differ diff --git a/_module/ncs/0e_nui_dm.ncs b/_module/ncs/0e_nui_dm.ncs index d2f8a0e2..a389aa31 100644 Binary files a/_module/ncs/0e_nui_dm.ncs and b/_module/ncs/0e_nui_dm.ncs differ diff --git a/_module/ncs/0e_onclientload.ncs b/_module/ncs/0e_onclientload.ncs index fac6ad0d..78c3608f 100644 Binary files a/_module/ncs/0e_onclientload.ncs and b/_module/ncs/0e_onclientload.ncs differ diff --git a/_module/ncs/0e_player_target.ncs b/_module/ncs/0e_player_target.ncs index 48d8e031..f7973564 100644 Binary files a/_module/ncs/0e_player_target.ncs and b/_module/ncs/0e_player_target.ncs differ diff --git a/_module/ncs/0e_prc_ch_events.ncs b/_module/ncs/0e_prc_ch_events.ncs index a21d7478..e41e939c 100644 Binary files a/_module/ncs/0e_prc_ch_events.ncs and b/_module/ncs/0e_prc_ch_events.ncs differ diff --git a/_module/ncs/69_hen_combat.ncs b/_module/ncs/69_hen_combat.ncs index 3bb53189..ac7e6cf7 100644 Binary files a/_module/ncs/69_hen_combat.ncs and b/_module/ncs/69_hen_combat.ncs differ diff --git a/_module/ncs/69_hen_conv.ncs b/_module/ncs/69_hen_conv.ncs index feb68195..31dd1dac 100644 Binary files a/_module/ncs/69_hen_conv.ncs and b/_module/ncs/69_hen_conv.ncs differ diff --git a/_module/ncs/69_hen_death.ncs b/_module/ncs/69_hen_death.ncs index b5fcb4ff..d7be1902 100644 Binary files a/_module/ncs/69_hen_death.ncs and b/_module/ncs/69_hen_death.ncs differ diff --git a/_module/ncs/69_hen_percep.ncs b/_module/ncs/69_hen_percep.ncs index bfc23c37..24db8269 100644 Binary files a/_module/ncs/69_hen_percep.ncs and b/_module/ncs/69_hen_percep.ncs differ diff --git a/_module/ncs/69_hen_spawnin.ncs b/_module/ncs/69_hen_spawnin.ncs index eea07289..10d7f230 100644 Binary files a/_module/ncs/69_hen_spawnin.ncs and b/_module/ncs/69_hen_spawnin.ncs differ diff --git a/_module/ncs/69_hen_spawnin2.ncs b/_module/ncs/69_hen_spawnin2.ncs index 973a69c2..3e1d7908 100644 Binary files a/_module/ncs/69_hen_spawnin2.ncs and b/_module/ncs/69_hen_spawnin2.ncs differ diff --git a/_module/ncs/69_hench_canlvl.ncs b/_module/ncs/69_hench_canlvl.ncs index e96b7a5f..edd626b4 100644 Binary files a/_module/ncs/69_hench_canlvl.ncs and b/_module/ncs/69_hench_canlvl.ncs differ diff --git a/_module/ncs/69_hench_canwork.ncs b/_module/ncs/69_hench_canwork.ncs index 0d9ebe95..2d8f7064 100644 Binary files a/_module/ncs/69_hench_canwork.ncs and b/_module/ncs/69_hench_canwork.ncs differ diff --git a/_module/ncs/69_hench_crtrsmn.ncs b/_module/ncs/69_hench_crtrsmn.ncs index 8a8d637b..c3d93390 100644 Binary files a/_module/ncs/69_hench_crtrsmn.ncs and b/_module/ncs/69_hench_crtrsmn.ncs differ diff --git a/_module/ncs/69_hench_crtruns.ncs b/_module/ncs/69_hench_crtruns.ncs index 0c4fb143..3f988659 100644 Binary files a/_module/ncs/69_hench_crtruns.ncs and b/_module/ncs/69_hench_crtruns.ncs differ diff --git a/_module/ncs/69_hench_destobj.ncs b/_module/ncs/69_hench_destobj.ncs index 6cd0839e..5a250681 100644 Binary files a/_module/ncs/69_hench_destobj.ncs and b/_module/ncs/69_hench_destobj.ncs differ diff --git a/_module/ncs/69_hench_didie.ncs b/_module/ncs/69_hench_didie.ncs index 39648e50..2c90ba56 100644 Binary files a/_module/ncs/69_hench_didie.ncs and b/_module/ncs/69_hench_didie.ncs differ diff --git a/_module/ncs/69_hench_eqmelee.ncs b/_module/ncs/69_hench_eqmelee.ncs index 1e32d87e..8f1109aa 100644 Binary files a/_module/ncs/69_hench_eqmelee.ncs and b/_module/ncs/69_hench_eqmelee.ncs differ diff --git a/_module/ncs/69_hench_eqrange.ncs b/_module/ncs/69_hench_eqrange.ncs index 39c13195..674af7e6 100644 Binary files a/_module/ncs/69_hench_eqrange.ncs and b/_module/ncs/69_hench_eqrange.ncs differ diff --git a/_module/ncs/69_hench_fire.ncs b/_module/ncs/69_hench_fire.ncs index f9c10ce8..3b120c34 100644 Binary files a/_module/ncs/69_hench_fire.ncs and b/_module/ncs/69_hench_fire.ncs differ diff --git a/_module/ncs/69_hench_fired.ncs b/_module/ncs/69_hench_fired.ncs index cf5651c0..a7821952 100644 Binary files a/_module/ncs/69_hench_fired.ncs and b/_module/ncs/69_hench_fired.ncs differ diff --git a/_module/ncs/69_hench_gomelee.ncs b/_module/ncs/69_hench_gomelee.ncs index 5e72bd78..e0610905 100644 Binary files a/_module/ncs/69_hench_gomelee.ncs and b/_module/ncs/69_hench_gomelee.ncs differ diff --git a/_module/ncs/69_hench_gorange.ncs b/_module/ncs/69_hench_gorange.ncs index d20f77cd..f055357a 100644 Binary files a/_module/ncs/69_hench_gorange.ncs and b/_module/ncs/69_hench_gorange.ncs differ diff --git a/_module/ncs/69_hench_heall.ncs b/_module/ncs/69_hench_heall.ncs index c95ba9ed..0b541c16 100644 Binary files a/_module/ncs/69_hench_heall.ncs and b/_module/ncs/69_hench_heall.ncs differ diff --git a/_module/ncs/69_hench_hire.ncs b/_module/ncs/69_hench_hire.ncs index 2dd4eb40..46acf8af 100644 Binary files a/_module/ncs/69_hench_hire.ncs and b/_module/ncs/69_hench_hire.ncs differ diff --git a/_module/ncs/69_hench_level.ncs b/_module/ncs/69_hench_level.ncs index bca685be..438ab869 100644 Binary files a/_module/ncs/69_hench_level.ncs and b/_module/ncs/69_hench_level.ncs differ diff --git a/_module/ncs/69_hench_pickup.ncs b/_module/ncs/69_hench_pickup.ncs index 7238ed1a..a084a9b0 100644 Binary files a/_module/ncs/69_hench_pickup.ncs and b/_module/ncs/69_hench_pickup.ncs differ diff --git a/_module/ncs/69_hench_quit.ncs b/_module/ncs/69_hench_quit.ncs index 31c178b6..66bf56a7 100644 Binary files a/_module/ncs/69_hench_quit.ncs and b/_module/ncs/69_hench_quit.ncs differ diff --git a/_module/ncs/69_hench_rangeno.ncs b/_module/ncs/69_hench_rangeno.ncs index cdb37e9e..bcd30cc3 100644 Binary files a/_module/ncs/69_hench_rangeno.ncs and b/_module/ncs/69_hench_rangeno.ncs differ diff --git a/_module/ncs/69_hench_rangeye.ncs b/_module/ncs/69_hench_rangeye.ncs index 627113c6..96a76289 100644 Binary files a/_module/ncs/69_hench_rangeye.ncs and b/_module/ncs/69_hench_rangeye.ncs differ diff --git a/_module/ncs/69_hench_scout1.ncs b/_module/ncs/69_hench_scout1.ncs index 9713a052..38703895 100644 Binary files a/_module/ncs/69_hench_scout1.ncs and b/_module/ncs/69_hench_scout1.ncs differ diff --git a/_module/ncs/69_hench_scout2.ncs b/_module/ncs/69_hench_scout2.ncs index 06219708..45a5bd88 100644 Binary files a/_module/ncs/69_hench_scout2.ncs and b/_module/ncs/69_hench_scout2.ncs differ diff --git a/_module/ncs/69_hench_switch.ncs b/_module/ncs/69_hench_switch.ncs index 2c780ef5..5c995237 100644 Binary files a/_module/ncs/69_hench_switch.ncs and b/_module/ncs/69_hench_switch.ncs differ diff --git a/_module/ncs/69_hench_switchn.ncs b/_module/ncs/69_hench_switchn.ncs index 85eb5fcc..dfaeb800 100644 Binary files a/_module/ncs/69_hench_switchn.ncs and b/_module/ncs/69_hench_switchn.ncs differ diff --git a/_module/ncs/_area_on_enter.ncs b/_module/ncs/_area_on_enter.ncs index a1cf9353..ed33457d 100644 Binary files a/_module/ncs/_area_on_enter.ncs and b/_module/ncs/_area_on_enter.ncs differ diff --git a/_module/ncs/_area_on_enter_m.ncs b/_module/ncs/_area_on_enter_m.ncs index efeadd64..29611185 100644 Binary files a/_module/ncs/_area_on_enter_m.ncs and b/_module/ncs/_area_on_enter_m.ncs differ diff --git a/_module/ncs/_area_on_exit.ncs b/_module/ncs/_area_on_exit.ncs index baba0a53..e2dcb191 100644 Binary files a/_module/ncs/_area_on_exit.ncs and b/_module/ncs/_area_on_exit.ncs differ diff --git a/_module/ncs/_area_open_map.ncs b/_module/ncs/_area_open_map.ncs index 1d5356cf..81550a25 100644 Binary files a/_module/ncs/_area_open_map.ncs and b/_module/ncs/_area_open_map.ncs differ diff --git a/_module/ncs/_boss_spawn_def9.ncs b/_module/ncs/_boss_spawn_def9.ncs index e25f1eb2..26c11fa3 100644 Binary files a/_module/ncs/_boss_spawn_def9.ncs and b/_module/ncs/_boss_spawn_def9.ncs differ diff --git a/_module/ncs/_deadmagic_exit.ncs b/_module/ncs/_deadmagic_exit.ncs index 506e8100..ffd904c2 100644 Binary files a/_module/ncs/_deadmagic_exit.ncs and b/_module/ncs/_deadmagic_exit.ncs differ diff --git a/_module/ncs/_fb1_onenter.ncs b/_module/ncs/_fb1_onenter.ncs index c71ced39..b87c3d10 100644 Binary files a/_module/ncs/_fb1_onenter.ncs and b/_module/ncs/_fb1_onenter.ncs differ diff --git a/_module/ncs/_golemeqgear.ncs b/_module/ncs/_golemeqgear.ncs index e02554f7..94ddb7b9 100644 Binary files a/_module/ncs/_golemeqgear.ncs and b/_module/ncs/_golemeqgear.ncs differ diff --git a/_module/ncs/_innerkeep_enter.ncs b/_module/ncs/_innerkeep_enter.ncs index 2a056381..c3518b25 100644 Binary files a/_module/ncs/_innerkeep_enter.ncs and b/_module/ncs/_innerkeep_enter.ncs differ diff --git a/_module/ncs/_ness_spawn_hb.ncs b/_module/ncs/_ness_spawn_hb.ncs index 58c1b943..5025e24f 100644 Binary files a/_module/ncs/_ness_spawn_hb.ncs and b/_module/ncs/_ness_spawn_hb.ncs differ diff --git a/_module/ncs/_on_respawn.ncs b/_module/ncs/_on_respawn.ncs index ff59a876..558c25e7 100644 Binary files a/_module/ncs/_on_respawn.ncs and b/_module/ncs/_on_respawn.ncs differ diff --git a/_module/ncs/_onplayer_rest.ncs b/_module/ncs/_onplayer_rest.ncs index 1953e34f..b3bbb4c6 100644 Binary files a/_module/ncs/_onplayer_rest.ncs and b/_module/ncs/_onplayer_rest.ncs differ diff --git a/_module/ncs/aa_rod_of_wonder.ncs b/_module/ncs/aa_rod_of_wonder.ncs index 7fc6c0bf..0adfb584 100644 Binary files a/_module/ncs/aa_rod_of_wonder.ncs and b/_module/ncs/aa_rod_of_wonder.ncs differ diff --git a/_module/ncs/aa_wild_magic.ncs b/_module/ncs/aa_wild_magic.ncs index 9277415f..e295f9dc 100644 Binary files a/_module/ncs/aa_wild_magic.ncs and b/_module/ncs/aa_wild_magic.ncs differ diff --git a/_module/ncs/abyss_ondeath.ncs b/_module/ncs/abyss_ondeath.ncs index 550f49b9..cccdb38b 100644 Binary files a/_module/ncs/abyss_ondeath.ncs and b/_module/ncs/abyss_ondeath.ncs differ diff --git a/_module/ncs/ai_a_ambusher.ncs b/_module/ncs/ai_a_ambusher.ncs index f8a39ff2..a03c1c62 100644 Binary files a/_module/ncs/ai_a_ambusher.ncs and b/_module/ncs/ai_a_ambusher.ncs differ diff --git a/_module/ncs/ai_a_atk_casters.ncs b/_module/ncs/ai_a_atk_casters.ncs index 2a6f4a58..06d923a7 100644 Binary files a/_module/ncs/ai_a_atk_casters.ncs and b/_module/ncs/ai_a_atk_casters.ncs differ diff --git a/_module/ncs/ai_a_atk_nearest.ncs b/_module/ncs/ai_a_atk_nearest.ncs index 3cd45e81..833a075d 100644 Binary files a/_module/ncs/ai_a_atk_nearest.ncs and b/_module/ncs/ai_a_atk_nearest.ncs differ diff --git a/_module/ncs/ai_a_atk_warrior.ncs b/_module/ncs/ai_a_atk_warrior.ncs index 5f160ad6..dc1c83fa 100644 Binary files a/_module/ncs/ai_a_atk_warrior.ncs and b/_module/ncs/ai_a_atk_warrior.ncs differ diff --git a/_module/ncs/ai_a_barbarian.ncs b/_module/ncs/ai_a_barbarian.ncs index fa8149d6..af3eb391 100644 Binary files a/_module/ncs/ai_a_barbarian.ncs and b/_module/ncs/ai_a_barbarian.ncs differ diff --git a/_module/ncs/ai_a_bard.ncs b/_module/ncs/ai_a_bard.ncs index 6873015e..6dd8e513 100644 Binary files a/_module/ncs/ai_a_bard.ncs and b/_module/ncs/ai_a_bard.ncs differ diff --git a/_module/ncs/ai_a_cleric.ncs b/_module/ncs/ai_a_cleric.ncs index d0856ac3..01050a88 100644 Binary files a/_module/ncs/ai_a_cleric.ncs and b/_module/ncs/ai_a_cleric.ncs differ diff --git a/_module/ncs/ai_a_cntrspell.ncs b/_module/ncs/ai_a_cntrspell.ncs index 22cf4287..23cbfbc9 100644 Binary files a/_module/ncs/ai_a_cntrspell.ncs and b/_module/ncs/ai_a_cntrspell.ncs differ diff --git a/_module/ncs/ai_a_default.ncs b/_module/ncs/ai_a_default.ncs index e5648b9e..333a2a09 100644 Binary files a/_module/ncs/ai_a_default.ncs and b/_module/ncs/ai_a_default.ncs differ diff --git a/_module/ncs/ai_a_defensive.ncs b/_module/ncs/ai_a_defensive.ncs index ebb7f248..3235b1e2 100644 Binary files a/_module/ncs/ai_a_defensive.ncs and b/_module/ncs/ai_a_defensive.ncs differ diff --git a/_module/ncs/ai_a_druid.ncs b/_module/ncs/ai_a_druid.ncs index fe29ce13..20f795c9 100644 Binary files a/_module/ncs/ai_a_druid.ncs and b/_module/ncs/ai_a_druid.ncs differ diff --git a/_module/ncs/ai_a_fighter.ncs b/_module/ncs/ai_a_fighter.ncs index 17dfd52d..9344330c 100644 Binary files a/_module/ncs/ai_a_fighter.ncs and b/_module/ncs/ai_a_fighter.ncs differ diff --git a/_module/ncs/ai_a_flanker.ncs b/_module/ncs/ai_a_flanker.ncs index cc1a22bd..2dffa998 100644 Binary files a/_module/ncs/ai_a_flanker.ncs and b/_module/ncs/ai_a_flanker.ncs differ diff --git a/_module/ncs/ai_a_invisible.ncs b/_module/ncs/ai_a_invisible.ncs index d1afd373..37538f5d 100644 Binary files a/_module/ncs/ai_a_invisible.ncs and b/_module/ncs/ai_a_invisible.ncs differ diff --git a/_module/ncs/ai_a_monk.ncs b/_module/ncs/ai_a_monk.ncs index 3b7d9ae6..05d691e1 100644 Binary files a/_module/ncs/ai_a_monk.ncs and b/_module/ncs/ai_a_monk.ncs differ diff --git a/_module/ncs/ai_a_no_cmb_mode.ncs b/_module/ncs/ai_a_no_cmb_mode.ncs index 86acace2..5fa9ce0f 100644 Binary files a/_module/ncs/ai_a_no_cmb_mode.ncs and b/_module/ncs/ai_a_no_cmb_mode.ncs differ diff --git a/_module/ncs/ai_a_paladin.ncs b/_module/ncs/ai_a_paladin.ncs index bf5d17db..433d253d 100644 Binary files a/_module/ncs/ai_a_paladin.ncs and b/_module/ncs/ai_a_paladin.ncs differ diff --git a/_module/ncs/ai_a_peaceful.ncs b/_module/ncs/ai_a_peaceful.ncs index ddc1baa8..43ec3ca7 100644 Binary files a/_module/ncs/ai_a_peaceful.ncs and b/_module/ncs/ai_a_peaceful.ncs differ diff --git a/_module/ncs/ai_a_polymorphed.ncs b/_module/ncs/ai_a_polymorphed.ncs index 40b87a39..d8b2e40d 100644 Binary files a/_module/ncs/ai_a_polymorphed.ncs and b/_module/ncs/ai_a_polymorphed.ncs differ diff --git a/_module/ncs/ai_a_ranged.ncs b/_module/ncs/ai_a_ranged.ncs index 40c194f7..4be0a56b 100644 Binary files a/_module/ncs/ai_a_ranged.ncs and b/_module/ncs/ai_a_ranged.ncs differ diff --git a/_module/ncs/ai_a_ranger.ncs b/_module/ncs/ai_a_ranger.ncs index f426e0e4..eac13b86 100644 Binary files a/_module/ncs/ai_a_ranger.ncs and b/_module/ncs/ai_a_ranger.ncs differ diff --git a/_module/ncs/ai_a_rogue.ncs b/_module/ncs/ai_a_rogue.ncs index a2680a11..4c671858 100644 Binary files a/_module/ncs/ai_a_rogue.ncs and b/_module/ncs/ai_a_rogue.ncs differ diff --git a/_module/ncs/ai_a_sorcerer.ncs b/_module/ncs/ai_a_sorcerer.ncs index d46e0529..12f0b218 100644 Binary files a/_module/ncs/ai_a_sorcerer.ncs and b/_module/ncs/ai_a_sorcerer.ncs differ diff --git a/_module/ncs/ai_a_taunter.ncs b/_module/ncs/ai_a_taunter.ncs index 2ff167c1..a8f335cf 100644 Binary files a/_module/ncs/ai_a_taunter.ncs and b/_module/ncs/ai_a_taunter.ncs differ diff --git a/_module/ncs/ai_a_wizard.ncs b/_module/ncs/ai_a_wizard.ncs index 40ec2fd6..18b0e938 100644 Binary files a/_module/ncs/ai_a_wizard.ncs and b/_module/ncs/ai_a_wizard.ncs differ diff --git a/_module/ncs/ai_ambusher.ncs b/_module/ncs/ai_ambusher.ncs index 847db874..29c98404 100644 Binary files a/_module/ncs/ai_ambusher.ncs and b/_module/ncs/ai_ambusher.ncs differ diff --git a/_module/ncs/ai_barbarian.ncs b/_module/ncs/ai_barbarian.ncs index 8bb340a3..0c802b38 100644 Binary files a/_module/ncs/ai_barbarian.ncs and b/_module/ncs/ai_barbarian.ncs differ diff --git a/_module/ncs/ai_bard.ncs b/_module/ncs/ai_bard.ncs index 63e430da..f3f7d0a0 100644 Binary files a/_module/ncs/ai_bard.ncs and b/_module/ncs/ai_bard.ncs differ diff --git a/_module/ncs/ai_cleric.ncs b/_module/ncs/ai_cleric.ncs index 88737c4c..18ce2696 100644 Binary files a/_module/ncs/ai_cleric.ncs and b/_module/ncs/ai_cleric.ncs differ diff --git a/_module/ncs/ai_cntrspell.ncs b/_module/ncs/ai_cntrspell.ncs index 2a7b3220..a1fd58a4 100644 Binary files a/_module/ncs/ai_cntrspell.ncs and b/_module/ncs/ai_cntrspell.ncs differ diff --git a/_module/ncs/ai_coward.ncs b/_module/ncs/ai_coward.ncs index e213b10a..329bb729 100644 Binary files a/_module/ncs/ai_coward.ncs and b/_module/ncs/ai_coward.ncs differ diff --git a/_module/ncs/ai_default.ncs b/_module/ncs/ai_default.ncs index 67084069..b046660b 100644 Binary files a/_module/ncs/ai_default.ncs and b/_module/ncs/ai_default.ncs differ diff --git a/_module/ncs/ai_defensive.ncs b/_module/ncs/ai_defensive.ncs index 31635481..a72eee93 100644 Binary files a/_module/ncs/ai_defensive.ncs and b/_module/ncs/ai_defensive.ncs differ diff --git a/_module/ncs/ai_dragon.ncs b/_module/ncs/ai_dragon.ncs index 02e08a62..35d4b97a 100644 Binary files a/_module/ncs/ai_dragon.ncs and b/_module/ncs/ai_dragon.ncs differ diff --git a/_module/ncs/ai_druid.ncs b/_module/ncs/ai_druid.ncs index ca082adb..df33aae2 100644 Binary files a/_module/ncs/ai_druid.ncs and b/_module/ncs/ai_druid.ncs differ diff --git a/_module/ncs/ai_fighter.ncs b/_module/ncs/ai_fighter.ncs index d8fd83bc..9517e72f 100644 Binary files a/_module/ncs/ai_fighter.ncs and b/_module/ncs/ai_fighter.ncs differ diff --git a/_module/ncs/ai_flanker.ncs b/_module/ncs/ai_flanker.ncs index f5aa767d..ab6dbebc 100644 Binary files a/_module/ncs/ai_flanker.ncs and b/_module/ncs/ai_flanker.ncs differ diff --git a/_module/ncs/ai_incorporeal.ncs b/_module/ncs/ai_incorporeal.ncs index 4bde59e6..45e21ecc 100644 Binary files a/_module/ncs/ai_incorporeal.ncs and b/_module/ncs/ai_incorporeal.ncs differ diff --git a/_module/ncs/ai_invisible.ncs b/_module/ncs/ai_invisible.ncs index 7d7504c2..a0ce74fe 100644 Binary files a/_module/ncs/ai_invisible.ncs and b/_module/ncs/ai_invisible.ncs differ diff --git a/_module/ncs/ai_monk.ncs b/_module/ncs/ai_monk.ncs index cef19a51..fc95b2a1 100644 Binary files a/_module/ncs/ai_monk.ncs and b/_module/ncs/ai_monk.ncs differ diff --git a/_module/ncs/ai_paladin.ncs b/_module/ncs/ai_paladin.ncs index a60c6164..1fe405a4 100644 Binary files a/_module/ncs/ai_paladin.ncs and b/_module/ncs/ai_paladin.ncs differ diff --git a/_module/ncs/ai_polymorphed.ncs b/_module/ncs/ai_polymorphed.ncs index 3f22f782..84e077d5 100644 Binary files a/_module/ncs/ai_polymorphed.ncs and b/_module/ncs/ai_polymorphed.ncs differ diff --git a/_module/ncs/ai_ranged.ncs b/_module/ncs/ai_ranged.ncs index bebde984..0ead8f4f 100644 Binary files a/_module/ncs/ai_ranged.ncs and b/_module/ncs/ai_ranged.ncs differ diff --git a/_module/ncs/ai_ranger.ncs b/_module/ncs/ai_ranger.ncs index c491cfdd..5d205d8e 100644 Binary files a/_module/ncs/ai_ranger.ncs and b/_module/ncs/ai_ranger.ncs differ diff --git a/_module/ncs/ai_rogue.ncs b/_module/ncs/ai_rogue.ncs index 341513b0..510a7c0d 100644 Binary files a/_module/ncs/ai_rogue.ncs and b/_module/ncs/ai_rogue.ncs differ diff --git a/_module/ncs/ai_shadow.ncs b/_module/ncs/ai_shadow.ncs index 383918f3..dab1f2a8 100644 Binary files a/_module/ncs/ai_shadow.ncs and b/_module/ncs/ai_shadow.ncs differ diff --git a/_module/ncs/ai_sorcerer.ncs b/_module/ncs/ai_sorcerer.ncs index 563ead68..78f0b250 100644 Binary files a/_module/ncs/ai_sorcerer.ncs and b/_module/ncs/ai_sorcerer.ncs differ diff --git a/_module/ncs/ai_taunter.ncs b/_module/ncs/ai_taunter.ncs index 447b59fa..efcc38aa 100644 Binary files a/_module/ncs/ai_taunter.ncs and b/_module/ncs/ai_taunter.ncs differ diff --git a/_module/ncs/ai_wizard.ncs b/_module/ncs/ai_wizard.ncs index 730fe5e9..fda525d7 100644 Binary files a/_module/ncs/ai_wizard.ncs and b/_module/ncs/ai_wizard.ncs differ diff --git a/_module/ncs/air_door_open.ncs b/_module/ncs/air_door_open.ncs index 0474f90e..a11cee1e 100644 Binary files a/_module/ncs/air_door_open.ncs and b/_module/ncs/air_door_open.ncs differ diff --git a/_module/ncs/all_statues.ncs b/_module/ncs/all_statues.ncs index da6150d2..f06c5fd1 100644 Binary files a/_module/ncs/all_statues.ncs and b/_module/ncs/all_statues.ncs differ diff --git a/_module/ncs/anna_give.ncs b/_module/ncs/anna_give.ncs index bf39b3b3..9c09b2e4 100644 Binary files a/_module/ncs/anna_give.ncs and b/_module/ncs/anna_give.ncs differ diff --git a/_module/ncs/archon_ondeath.ncs b/_module/ncs/archon_ondeath.ncs index 63563897..381cb850 100644 Binary files a/_module/ncs/archon_ondeath.ncs and b/_module/ncs/archon_ondeath.ncs differ diff --git a/_module/ncs/area_cold_frost2.ncs b/_module/ncs/area_cold_frost2.ncs index c13cc1bd..347507a9 100644 Binary files a/_module/ncs/area_cold_frost2.ncs and b/_module/ncs/area_cold_frost2.ncs differ diff --git a/_module/ncs/area_spawner.ncs b/_module/ncs/area_spawner.ncs index ec65c0d5..c671baec 100644 Binary files a/_module/ncs/area_spawner.ncs and b/_module/ncs/area_spawner.ncs differ diff --git a/_module/ncs/areacleanup.ncs b/_module/ncs/areacleanup.ncs index 26d610da..4183575c 100644 Binary files a/_module/ncs/areacleanup.ncs and b/_module/ncs/areacleanup.ncs differ diff --git a/_module/ncs/array_example.ncs b/_module/ncs/array_example.ncs new file mode 100644 index 00000000..ea9aa657 Binary files /dev/null and b/_module/ncs/array_example.ncs differ diff --git a/_module/ncs/asg_alcdesk_01t.ncs b/_module/ncs/asg_alcdesk_01t.ncs index aae28c6c..faa2678e 100644 Binary files a/_module/ncs/asg_alcdesk_01t.ncs and b/_module/ncs/asg_alcdesk_01t.ncs differ diff --git a/_module/ncs/asg_alcdsk_mat01.ncs b/_module/ncs/asg_alcdsk_mat01.ncs index d439f625..e2f8e9a5 100644 Binary files a/_module/ncs/asg_alcdsk_mat01.ncs and b/_module/ncs/asg_alcdsk_mat01.ncs differ diff --git a/_module/ncs/asg_enchan_01t.ncs b/_module/ncs/asg_enchan_01t.ncs index 3f583f5e..7f82685f 100644 Binary files a/_module/ncs/asg_enchan_01t.ncs and b/_module/ncs/asg_enchan_01t.ncs differ diff --git a/_module/ncs/asg_racanebk.ncs b/_module/ncs/asg_racanebk.ncs index 03fd2b10..6dde003d 100644 Binary files a/_module/ncs/asg_racanebk.ncs and b/_module/ncs/asg_racanebk.ncs differ diff --git a/_module/ncs/asg_radvopen.ncs b/_module/ncs/asg_radvopen.ncs index 75de6d1b..34652542 100644 Binary files a/_module/ncs/asg_radvopen.ncs and b/_module/ncs/asg_radvopen.ncs differ diff --git a/_module/ncs/asg_rdivinebk.ncs b/_module/ncs/asg_rdivinebk.ncs index 2e01319e..6e1549e6 100644 Binary files a/_module/ncs/asg_rdivinebk.ncs and b/_module/ncs/asg_rdivinebk.ncs differ diff --git a/_module/ncs/asg_resdesk_01.ncs b/_module/ncs/asg_resdesk_01.ncs index 11a85521..be6b47ef 100644 Binary files a/_module/ncs/asg_resdesk_01.ncs and b/_module/ncs/asg_resdesk_01.ncs differ diff --git a/_module/ncs/asg_resdesk_01t.ncs b/_module/ncs/asg_resdesk_01t.ncs index a1c3153a..ea2cc06d 100644 Binary files a/_module/ncs/asg_resdesk_01t.ncs and b/_module/ncs/asg_resdesk_01t.ncs differ diff --git a/_module/ncs/asg_resdesk_04t.ncs b/_module/ncs/asg_resdesk_04t.ncs index 5b8af738..1272cfd4 100644 Binary files a/_module/ncs/asg_resdesk_04t.ncs and b/_module/ncs/asg_resdesk_04t.ncs differ diff --git a/_module/ncs/asg_resdesk_05t.ncs b/_module/ncs/asg_resdesk_05t.ncs index 6d8e20b0..69de9dc9 100644 Binary files a/_module/ncs/asg_resdesk_05t.ncs and b/_module/ncs/asg_resdesk_05t.ncs differ diff --git a/_module/ncs/asg_resdesknext.ncs b/_module/ncs/asg_resdesknext.ncs index 69061b5f..688e81b9 100644 Binary files a/_module/ncs/asg_resdesknext.ncs and b/_module/ncs/asg_resdesknext.ncs differ diff --git a/_module/ncs/asg_resdeskprev.ncs b/_module/ncs/asg_resdeskprev.ncs index d7140f98..0737f10d 100644 Binary files a/_module/ncs/asg_resdeskprev.ncs and b/_module/ncs/asg_resdeskprev.ncs differ diff --git a/_module/ncs/asg_rseedbooks.ncs b/_module/ncs/asg_rseedbooks.ncs index ae916778..3dc64134 100644 Binary files a/_module/ncs/asg_rseedbooks.ncs and b/_module/ncs/asg_rseedbooks.ncs differ diff --git a/_module/ncs/asg_rul_bulditem.ncs b/_module/ncs/asg_rul_bulditem.ncs index c6d0fda3..ce17b873 100644 Binary files a/_module/ncs/asg_rul_bulditem.ncs and b/_module/ncs/asg_rul_bulditem.ncs differ diff --git a/_module/ncs/asg_rul_buldmagi.ncs b/_module/ncs/asg_rul_buldmagi.ncs index 648932d3..c81f5a74 100644 Binary files a/_module/ncs/asg_rul_buldmagi.ncs and b/_module/ncs/asg_rul_buldmagi.ncs differ diff --git a/_module/ncs/asg_rul_buldresr.ncs b/_module/ncs/asg_rul_buldresr.ncs index 0c13bcc4..c7813785 100644 Binary files a/_module/ncs/asg_rul_buldresr.ncs and b/_module/ncs/asg_rul_buldresr.ncs differ diff --git a/_module/ncs/asg_rul_buldsmcl.ncs b/_module/ncs/asg_rul_buldsmcl.ncs index 43879ba4..3e57f8c3 100644 Binary files a/_module/ncs/asg_rul_buldsmcl.ncs and b/_module/ncs/asg_rul_buldsmcl.ncs differ diff --git a/_module/ncs/asg_rul_destcont.ncs b/_module/ncs/asg_rul_destcont.ncs index cf3b157d..86005072 100644 Binary files a/_module/ncs/asg_rul_destcont.ncs and b/_module/ncs/asg_rul_destcont.ncs differ diff --git a/_module/ncs/asg_rul_micscfx.ncs b/_module/ncs/asg_rul_micscfx.ncs index 9876bd7e..ba1d9d6a 100644 Binary files a/_module/ncs/asg_rul_micscfx.ncs and b/_module/ncs/asg_rul_micscfx.ncs differ diff --git a/_module/ncs/asg_rul_rescast.ncs b/_module/ncs/asg_rul_rescast.ncs index af0b78c9..808ab1cb 100644 Binary files a/_module/ncs/asg_rul_rescast.ncs and b/_module/ncs/asg_rul_rescast.ncs differ diff --git a/_module/ncs/asg_rul_testbmag.ncs b/_module/ncs/asg_rul_testbmag.ncs index f1b2db09..21e398f0 100644 Binary files a/_module/ncs/asg_rul_testbmag.ncs and b/_module/ncs/asg_rul_testbmag.ncs differ diff --git a/_module/ncs/asg_rul_testbsel.ncs b/_module/ncs/asg_rul_testbsel.ncs index ac023f35..06604f12 100644 Binary files a/_module/ncs/asg_rul_testbsel.ncs and b/_module/ncs/asg_rul_testbsel.ncs differ diff --git a/_module/ncs/asg_rul_testmcop.ncs b/_module/ncs/asg_rul_testmcop.ncs index 627f80e8..8bf06307 100644 Binary files a/_module/ncs/asg_rul_testmcop.ncs and b/_module/ncs/asg_rul_testmcop.ncs differ diff --git a/_module/ncs/asg_rul_testop00.ncs b/_module/ncs/asg_rul_testop00.ncs index 2b3e1d4a..8968681a 100644 Binary files a/_module/ncs/asg_rul_testop00.ncs and b/_module/ncs/asg_rul_testop00.ncs differ diff --git a/_module/ncs/asg_rul_testop01.ncs b/_module/ncs/asg_rul_testop01.ncs index 88775a58..3c15bfed 100644 Binary files a/_module/ncs/asg_rul_testop01.ncs and b/_module/ncs/asg_rul_testop01.ncs differ diff --git a/_module/ncs/asg_rul_testop02.ncs b/_module/ncs/asg_rul_testop02.ncs index c1c7d891..28c189aa 100644 Binary files a/_module/ncs/asg_rul_testop02.ncs and b/_module/ncs/asg_rul_testop02.ncs differ diff --git a/_module/ncs/asg_rul_testop03.ncs b/_module/ncs/asg_rul_testop03.ncs index 24842925..d0849890 100644 Binary files a/_module/ncs/asg_rul_testop03.ncs and b/_module/ncs/asg_rul_testop03.ncs differ diff --git a/_module/ncs/asg_rul_testop04.ncs b/_module/ncs/asg_rul_testop04.ncs index 767df096..d65ac172 100644 Binary files a/_module/ncs/asg_rul_testop04.ncs and b/_module/ncs/asg_rul_testop04.ncs differ diff --git a/_module/ncs/asg_rul_testop05.ncs b/_module/ncs/asg_rul_testop05.ncs index 025e3b2a..4d8666f9 100644 Binary files a/_module/ncs/asg_rul_testop05.ncs and b/_module/ncs/asg_rul_testop05.ncs differ diff --git a/_module/ncs/asg_rul_testop06.ncs b/_module/ncs/asg_rul_testop06.ncs index 87574965..f6851581 100644 Binary files a/_module/ncs/asg_rul_testop06.ncs and b/_module/ncs/asg_rul_testop06.ncs differ diff --git a/_module/ncs/asg_rul_testopre.ncs b/_module/ncs/asg_rul_testopre.ncs index 478b75b4..80d05246 100644 Binary files a/_module/ncs/asg_rul_testopre.ncs and b/_module/ncs/asg_rul_testopre.ncs differ diff --git a/_module/ncs/asg_rul_testsmcl.ncs b/_module/ncs/asg_rul_testsmcl.ncs index 6f801cca..67da0054 100644 Binary files a/_module/ncs/asg_rul_testsmcl.ncs and b/_module/ncs/asg_rul_testsmcl.ncs differ diff --git a/_module/ncs/asg_temp_rbooks.ncs b/_module/ncs/asg_temp_rbooks.ncs index e179dda2..3e7b0e63 100644 Binary files a/_module/ncs/asg_temp_rbooks.ncs and b/_module/ncs/asg_temp_rbooks.ncs differ diff --git a/_module/ncs/asg_temp_rbooksd.ncs b/_module/ncs/asg_temp_rbooksd.ncs index 07585a23..879baa92 100644 Binary files a/_module/ncs/asg_temp_rbooksd.ncs and b/_module/ncs/asg_temp_rbooksd.ncs differ diff --git a/_module/ncs/asg_tes_alanvtim.ncs b/_module/ncs/asg_tes_alanvtim.ncs index af3a8a0f..d52944a2 100644 Binary files a/_module/ncs/asg_tes_alanvtim.ncs and b/_module/ncs/asg_tes_alanvtim.ncs differ diff --git a/_module/ncs/asg_tes_alteranv.ncs b/_module/ncs/asg_tes_alteranv.ncs index 7c1d7816..66a23753 100644 Binary files a/_module/ncs/asg_tes_alteranv.ncs and b/_module/ncs/asg_tes_alteranv.ncs differ diff --git a/_module/ncs/asg_tes_anvaltrc.ncs b/_module/ncs/asg_tes_anvaltrc.ncs index d65c23db..a0c9ce1c 100644 Binary files a/_module/ncs/asg_tes_anvaltrc.ncs and b/_module/ncs/asg_tes_anvaltrc.ncs differ diff --git a/_module/ncs/asg_tes_portlab.ncs b/_module/ncs/asg_tes_portlab.ncs index f9a787b9..9486f581 100644 Binary files a/_module/ncs/asg_tes_portlab.ncs and b/_module/ncs/asg_tes_portlab.ncs differ diff --git a/_module/ncs/attack_pc.ncs b/_module/ncs/attack_pc.ncs index d6c2306a..56388d81 100644 Binary files a/_module/ncs/attack_pc.ncs and b/_module/ncs/attack_pc.ncs differ diff --git a/_module/ncs/badger_death.ncs b/_module/ncs/badger_death.ncs index d41a5087..8964e759 100644 Binary files a/_module/ncs/badger_death.ncs and b/_module/ncs/badger_death.ncs differ diff --git a/_module/ncs/baltarattack.ncs b/_module/ncs/baltarattack.ncs index d6c2306a..56388d81 100644 Binary files a/_module/ncs/baltarattack.ncs and b/_module/ncs/baltarattack.ncs differ diff --git a/_module/ncs/bank_on_close.ncs b/_module/ncs/bank_on_close.ncs index 67d97093..f2a77f7c 100644 Binary files a/_module/ncs/bank_on_close.ncs and b/_module/ncs/bank_on_close.ncs differ diff --git a/_module/ncs/bank_on_dist.ncs b/_module/ncs/bank_on_dist.ncs index c8e8e439..7fa31477 100644 Binary files a/_module/ncs/bank_on_dist.ncs and b/_module/ncs/bank_on_dist.ncs differ diff --git a/_module/ncs/bank_on_open.ncs b/_module/ncs/bank_on_open.ncs index 5dff67f7..3544eaa0 100644 Binary files a/_module/ncs/bank_on_open.ncs and b/_module/ncs/bank_on_open.ncs differ diff --git a/_module/ncs/barkskinvfx.ncs b/_module/ncs/barkskinvfx.ncs index 5bc38ade..db533d5d 100644 Binary files a/_module/ncs/barkskinvfx.ncs and b/_module/ncs/barkskinvfx.ncs differ diff --git a/_module/ncs/barkskinvfx2.ncs b/_module/ncs/barkskinvfx2.ncs index a8b9007b..2dea2583 100644 Binary files a/_module/ncs/barkskinvfx2.ncs and b/_module/ncs/barkskinvfx2.ncs differ diff --git a/_module/ncs/barrel_ondeath.ncs b/_module/ncs/barrel_ondeath.ncs index 3a2effb7..22ed45ae 100644 Binary files a/_module/ncs/barrel_ondeath.ncs and b/_module/ncs/barrel_ondeath.ncs differ diff --git a/_module/ncs/blueteamuniform.ncs b/_module/ncs/blueteamuniform.ncs index 4b59a32c..07680766 100644 Binary files a/_module/ncs/blueteamuniform.ncs and b/_module/ncs/blueteamuniform.ncs differ diff --git a/_module/ncs/catapult_die.ncs b/_module/ncs/catapult_die.ncs index 534c4056..dceb3f7d 100644 Binary files a/_module/ncs/catapult_die.ncs and b/_module/ncs/catapult_die.ncs differ diff --git a/_module/ncs/celest_ondeath.ncs b/_module/ncs/celest_ondeath.ncs index 3cfb0d91..b178ea83 100644 Binary files a/_module/ncs/celest_ondeath.ncs and b/_module/ncs/celest_ondeath.ncs differ diff --git a/_module/ncs/check_baltar.ncs b/_module/ncs/check_baltar.ncs index bd6e1e04..216457eb 100644 Binary files a/_module/ncs/check_baltar.ncs and b/_module/ncs/check_baltar.ncs differ diff --git a/_module/ncs/check_bandi_head.ncs b/_module/ncs/check_bandi_head.ncs index 9e99ff5a..9f90131c 100644 Binary files a/_module/ncs/check_bandi_head.ncs and b/_module/ncs/check_bandi_head.ncs differ diff --git a/_module/ncs/check_cugelhead.ncs b/_module/ncs/check_cugelhead.ncs index ad766cf8..cecda21f 100644 Binary files a/_module/ncs/check_cugelhead.ncs and b/_module/ncs/check_cugelhead.ncs differ diff --git a/_module/ncs/check_cugelnote.ncs b/_module/ncs/check_cugelnote.ncs index e8428306..94911ec6 100644 Binary files a/_module/ncs/check_cugelnote.ncs and b/_module/ncs/check_cugelnote.ncs differ diff --git a/_module/ncs/check_diary.ncs b/_module/ncs/check_diary.ncs index 18741e75..0b4b2e58 100644 Binary files a/_module/ncs/check_diary.ncs and b/_module/ncs/check_diary.ncs differ diff --git a/_module/ncs/check_dragonbloo.ncs b/_module/ncs/check_dragonbloo.ncs index d9b5d69a..5af078f2 100644 Binary files a/_module/ncs/check_dragonbloo.ncs and b/_module/ncs/check_dragonbloo.ncs differ diff --git a/_module/ncs/check_ele_ring.ncs b/_module/ncs/check_ele_ring.ncs index 0fc956ee..6b5a3a59 100644 Binary files a/_module/ncs/check_ele_ring.ncs and b/_module/ncs/check_ele_ring.ncs differ diff --git a/_module/ncs/check_giant_head.ncs b/_module/ncs/check_giant_head.ncs index 4e080033..ee670f95 100644 Binary files a/_module/ncs/check_giant_head.ncs and b/_module/ncs/check_giant_head.ncs differ diff --git a/_module/ncs/check_gob_head.ncs b/_module/ncs/check_gob_head.ncs index 8038a113..43db3ee1 100644 Binary files a/_module/ncs/check_gob_head.ncs and b/_module/ncs/check_gob_head.ncs differ diff --git a/_module/ncs/check_green.ncs b/_module/ncs/check_green.ncs index 9c8a51c4..4b6cd1b1 100644 Binary files a/_module/ncs/check_green.ncs and b/_module/ncs/check_green.ncs differ diff --git a/_module/ncs/check_hamleynote.ncs b/_module/ncs/check_hamleynote.ncs index c758e4b6..dd3cc6b2 100644 Binary files a/_module/ncs/check_hamleynote.ncs and b/_module/ncs/check_hamleynote.ncs differ diff --git a/_module/ncs/check_inn_note.ncs b/_module/ncs/check_inn_note.ncs index 7093326c..695116fd 100644 Binary files a/_module/ncs/check_inn_note.ncs and b/_module/ncs/check_inn_note.ncs differ diff --git a/_module/ncs/check_kells_head.ncs b/_module/ncs/check_kells_head.ncs index 5a1eb3cd..2229976c 100644 Binary files a/_module/ncs/check_kells_head.ncs and b/_module/ncs/check_kells_head.ncs differ diff --git a/_module/ncs/check_millbaby.ncs b/_module/ncs/check_millbaby.ncs index 912a7683..1755b0d0 100644 Binary files a/_module/ncs/check_millbaby.ncs and b/_module/ncs/check_millbaby.ncs differ diff --git a/_module/ncs/check_nurglehead.ncs b/_module/ncs/check_nurglehead.ncs index 1f2f6b0a..2da06b38 100644 Binary files a/_module/ncs/check_nurglehead.ncs and b/_module/ncs/check_nurglehead.ncs differ diff --git a/_module/ncs/check_orb.ncs b/_module/ncs/check_orb.ncs index a9e250c4..1cf97c38 100644 Binary files a/_module/ncs/check_orb.ncs and b/_module/ncs/check_orb.ncs differ diff --git a/_module/ncs/check_orkus_ring.ncs b/_module/ncs/check_orkus_ring.ncs index 77302b54..234e7049 100644 Binary files a/_module/ncs/check_orkus_ring.ncs and b/_module/ncs/check_orkus_ring.ncs differ diff --git a/_module/ncs/check_samurai.ncs b/_module/ncs/check_samurai.ncs index c304a548..7e0ce788 100644 Binary files a/_module/ncs/check_samurai.ncs and b/_module/ncs/check_samurai.ncs differ diff --git a/_module/ncs/check_w_head.ncs b/_module/ncs/check_w_head.ncs index be5f2e65..c112ac41 100644 Binary files a/_module/ncs/check_w_head.ncs and b/_module/ncs/check_w_head.ncs differ diff --git a/_module/ncs/chk_dryad_2.ncs b/_module/ncs/chk_dryad_2.ncs index 72f249f5..aed24b52 100644 Binary files a/_module/ncs/chk_dryad_2.ncs and b/_module/ncs/chk_dryad_2.ncs differ diff --git a/_module/ncs/chk_item_ent_gso.ncs b/_module/ncs/chk_item_ent_gso.ncs index 362cab21..b1d2a3ab 100644 Binary files a/_module/ncs/chk_item_ent_gso.ncs and b/_module/ncs/chk_item_ent_gso.ncs differ diff --git a/_module/ncs/chk_item_ent_tmf.ncs b/_module/ncs/chk_item_ent_tmf.ncs index 4f8cd9de..ae7f04c6 100644 Binary files a/_module/ncs/chk_item_ent_tmf.ncs and b/_module/ncs/chk_item_ent_tmf.ncs differ diff --git a/_module/ncs/chk_ygdragon_2.ncs b/_module/ncs/chk_ygdragon_2.ncs index 63cdf3be..111e5ab2 100644 Binary files a/_module/ncs/chk_ygdragon_2.ncs and b/_module/ncs/chk_ygdragon_2.ncs differ diff --git a/_module/ncs/chng_fact_hostil.ncs b/_module/ncs/chng_fact_hostil.ncs index 0426b44a..ad65a0fb 100644 Binary files a/_module/ncs/chng_fact_hostil.ncs and b/_module/ncs/chng_fact_hostil.ncs differ diff --git a/_module/ncs/ck_bearskin.ncs b/_module/ncs/ck_bearskin.ncs index d7a01a62..32805a34 100644 Binary files a/_module/ncs/ck_bearskin.ncs and b/_module/ncs/ck_bearskin.ncs differ diff --git a/_module/ncs/ck_bearskin_no.ncs b/_module/ncs/ck_bearskin_no.ncs index 4905455b..2e2e2548 100644 Binary files a/_module/ncs/ck_bearskin_no.ncs and b/_module/ncs/ck_bearskin_no.ncs differ diff --git a/_module/ncs/ck_chokey.ncs b/_module/ncs/ck_chokey.ncs index 9dcf5d3b..3b506881 100644 Binary files a/_module/ncs/ck_chokey.ncs and b/_module/ncs/ck_chokey.ncs differ diff --git a/_module/ncs/ck_dryadboot.ncs b/_module/ncs/ck_dryadboot.ncs index 70625eac..3e3ee2bc 100644 Binary files a/_module/ncs/ck_dryadboot.ncs and b/_module/ncs/ck_dryadboot.ncs differ diff --git a/_module/ncs/ck_item_wolfbane.ncs b/_module/ncs/ck_item_wolfbane.ncs index 2c3eebcf..ca0f917b 100644 Binary files a/_module/ncs/ck_item_wolfbane.ncs and b/_module/ncs/ck_item_wolfbane.ncs differ diff --git a/_module/ncs/ck_itm_enter_kdb.ncs b/_module/ncs/ck_itm_enter_kdb.ncs index a2322c87..4838186d 100644 Binary files a/_module/ncs/ck_itm_enter_kdb.ncs and b/_module/ncs/ck_itm_enter_kdb.ncs differ diff --git a/_module/ncs/ck_itm_enter_ohs.ncs b/_module/ncs/ck_itm_enter_ohs.ncs index 8592a87b..fb5fa634 100644 Binary files a/_module/ncs/ck_itm_enter_ohs.ncs and b/_module/ncs/ck_itm_enter_ohs.ncs differ diff --git a/_module/ncs/ck_ohs_key_gypo.ncs b/_module/ncs/ck_ohs_key_gypo.ncs index e782162e..e145a6be 100644 Binary files a/_module/ncs/ck_ohs_key_gypo.ncs and b/_module/ncs/ck_ohs_key_gypo.ncs differ diff --git a/_module/ncs/ck_pirate_kdbkey.ncs b/_module/ncs/ck_pirate_kdbkey.ncs index f302d654..0e82e34a 100644 Binary files a/_module/ncs/ck_pirate_kdbkey.ncs and b/_module/ncs/ck_pirate_kdbkey.ncs differ diff --git a/_module/ncs/ck_witchammy.ncs b/_module/ncs/ck_witchammy.ncs index d9774bef..db7bbfed 100644 Binary files a/_module/ncs/ck_witchammy.ncs and b/_module/ncs/ck_witchammy.ncs differ diff --git a/_module/ncs/ck_wolfkey.ncs b/_module/ncs/ck_wolfkey.ncs index d94dba94..71e197cd 100644 Binary files a/_module/ncs/ck_wolfkey.ncs and b/_module/ncs/ck_wolfkey.ncs differ diff --git a/_module/ncs/clear_stores_out.ncs b/_module/ncs/clear_stores_out.ncs index 84167987..804a2c73 100644 Binary files a/_module/ncs/clear_stores_out.ncs and b/_module/ncs/clear_stores_out.ncs differ diff --git a/_module/ncs/clone_test_ring3.ncs b/_module/ncs/clone_test_ring3.ncs index 28193df2..015d2451 100644 Binary files a/_module/ncs/clone_test_ring3.ncs and b/_module/ncs/clone_test_ring3.ncs differ diff --git a/_module/ncs/combatrndcreatur.ncs b/_module/ncs/combatrndcreatur.ncs index 4691cb00..57e2230f 100644 Binary files a/_module/ncs/combatrndcreatur.ncs and b/_module/ncs/combatrndcreatur.ncs differ diff --git a/_module/ncs/convo_script_sit.ncs b/_module/ncs/convo_script_sit.ncs index 3ca062ab..2e0f4d45 100644 Binary files a/_module/ncs/convo_script_sit.ncs and b/_module/ncs/convo_script_sit.ncs differ diff --git a/_module/ncs/createbastardswd.ncs b/_module/ncs/createbastardswd.ncs index 77eae1a1..a94b1418 100644 Binary files a/_module/ncs/createbastardswd.ncs and b/_module/ncs/createbastardswd.ncs differ diff --git a/_module/ncs/createbattleaxe.ncs b/_module/ncs/createbattleaxe.ncs index 508ba28c..5ec4c877 100644 Binary files a/_module/ncs/createbattleaxe.ncs and b/_module/ncs/createbattleaxe.ncs differ diff --git a/_module/ncs/createdagger.ncs b/_module/ncs/createdagger.ncs index d6f3f32f..cb9dc272 100644 Binary files a/_module/ncs/createdagger.ncs and b/_module/ncs/createdagger.ncs differ diff --git a/_module/ncs/createdblaxe.ncs b/_module/ncs/createdblaxe.ncs index 7bc98061..30b5c152 100644 Binary files a/_module/ncs/createdblaxe.ncs and b/_module/ncs/createdblaxe.ncs differ diff --git a/_module/ncs/createdblscimita.ncs b/_module/ncs/createdblscimita.ncs index 016805ba..f4592c51 100644 Binary files a/_module/ncs/createdblscimita.ncs and b/_module/ncs/createdblscimita.ncs differ diff --git a/_module/ncs/creatediremace.ncs b/_module/ncs/creatediremace.ncs index 35a51dc7..7add07e4 100644 Binary files a/_module/ncs/creatediremace.ncs and b/_module/ncs/creatediremace.ncs differ diff --git a/_module/ncs/createdwarvenaxe.ncs b/_module/ncs/createdwarvenaxe.ncs index 38b7bc24..ca48a7d8 100644 Binary files a/_module/ncs/createdwarvenaxe.ncs and b/_module/ncs/createdwarvenaxe.ncs differ diff --git a/_module/ncs/createeagleclaw.ncs b/_module/ncs/createeagleclaw.ncs index 2cdc8cf2..cd0b80cc 100644 Binary files a/_module/ncs/createeagleclaw.ncs and b/_module/ncs/createeagleclaw.ncs differ diff --git a/_module/ncs/createelvencourt.ncs b/_module/ncs/createelvencourt.ncs index fe776cfe..bdc9a1ab 100644 Binary files a/_module/ncs/createelvencourt.ncs and b/_module/ncs/createelvencourt.ncs differ diff --git a/_module/ncs/createelvenlight.ncs b/_module/ncs/createelvenlight.ncs index de6fe237..2ed77078 100644 Binary files a/_module/ncs/createelvenlight.ncs and b/_module/ncs/createelvenlight.ncs differ diff --git a/_module/ncs/createelventhinb.ncs b/_module/ncs/createelventhinb.ncs index 5d8adad8..8b47a5b4 100644 Binary files a/_module/ncs/createelventhinb.ncs and b/_module/ncs/createelventhinb.ncs differ diff --git a/_module/ncs/createfalchion.ncs b/_module/ncs/createfalchion.ncs index 0f7d819b..21eedb0c 100644 Binary files a/_module/ncs/createfalchion.ncs and b/_module/ncs/createfalchion.ncs differ diff --git a/_module/ncs/creategauntlet.ncs b/_module/ncs/creategauntlet.ncs index 00264d2e..311c6ab9 100644 Binary files a/_module/ncs/creategauntlet.ncs and b/_module/ncs/creategauntlet.ncs differ diff --git a/_module/ncs/creategoad.ncs b/_module/ncs/creategoad.ncs index e5b9fbec..73666ac0 100644 Binary files a/_module/ncs/creategoad.ncs and b/_module/ncs/creategoad.ncs differ diff --git a/_module/ncs/creategreataxe.ncs b/_module/ncs/creategreataxe.ncs index 8294e451..a7f21d26 100644 Binary files a/_module/ncs/creategreataxe.ncs and b/_module/ncs/creategreataxe.ncs differ diff --git a/_module/ncs/creategreatsword.ncs b/_module/ncs/creategreatsword.ncs index dcabd1a7..2908f2d8 100644 Binary files a/_module/ncs/creategreatsword.ncs and b/_module/ncs/creategreatsword.ncs differ diff --git a/_module/ncs/createhalberd.ncs b/_module/ncs/createhalberd.ncs index a37cbebb..76559cfa 100644 Binary files a/_module/ncs/createhalberd.ncs and b/_module/ncs/createhalberd.ncs differ diff --git a/_module/ncs/createhandaxe.ncs b/_module/ncs/createhandaxe.ncs index f4318e4f..2e3bc177 100644 Binary files a/_module/ncs/createhandaxe.ncs and b/_module/ncs/createhandaxe.ncs differ diff --git a/_module/ncs/createheavyflail.ncs b/_module/ncs/createheavyflail.ncs index 39dd01bc..7a62ce07 100644 Binary files a/_module/ncs/createheavyflail.ncs and b/_module/ncs/createheavyflail.ncs differ diff --git a/_module/ncs/createheavymace.ncs b/_module/ncs/createheavymace.ncs index 4129bfed..085b718b 100644 Binary files a/_module/ncs/createheavymace.ncs and b/_module/ncs/createheavymace.ncs differ diff --git a/_module/ncs/createheavypick.ncs b/_module/ncs/createheavypick.ncs index 88fa8e75..04e9daad 100644 Binary files a/_module/ncs/createheavypick.ncs and b/_module/ncs/createheavypick.ncs differ diff --git a/_module/ncs/createhvycrossbo.ncs b/_module/ncs/createhvycrossbo.ncs index 084853aa..ecf02c8b 100644 Binary files a/_module/ncs/createhvycrossbo.ncs and b/_module/ncs/createhvycrossbo.ncs differ diff --git a/_module/ncs/createhvycrssbo2.ncs b/_module/ncs/createhvycrssbo2.ncs index 2a64f600..24af00ee 100644 Binary files a/_module/ncs/createhvycrssbo2.ncs and b/_module/ncs/createhvycrssbo2.ncs differ diff --git a/_module/ncs/createkama.ncs b/_module/ncs/createkama.ncs index b8cb57f7..d71d4d63 100644 Binary files a/_module/ncs/createkama.ncs and b/_module/ncs/createkama.ncs differ diff --git a/_module/ncs/createkatana.ncs b/_module/ncs/createkatana.ncs index 28c61bd6..faef9758 100644 Binary files a/_module/ncs/createkatana.ncs and b/_module/ncs/createkatana.ncs differ diff --git a/_module/ncs/createkatar.ncs b/_module/ncs/createkatar.ncs index 34c4fccd..690b80da 100644 Binary files a/_module/ncs/createkatar.ncs and b/_module/ncs/createkatar.ncs differ diff --git a/_module/ncs/createkukri.ncs b/_module/ncs/createkukri.ncs index 69aa1b56..1919a4be 100644 Binary files a/_module/ncs/createkukri.ncs and b/_module/ncs/createkukri.ncs differ diff --git a/_module/ncs/createlance.ncs b/_module/ncs/createlance.ncs index 2bb731e8..16a6abec 100644 Binary files a/_module/ncs/createlance.ncs and b/_module/ncs/createlance.ncs differ diff --git a/_module/ncs/createlightflail.ncs b/_module/ncs/createlightflail.ncs index bbf28d15..dd950a6e 100644 Binary files a/_module/ncs/createlightflail.ncs and b/_module/ncs/createlightflail.ncs differ diff --git a/_module/ncs/createlightpick.ncs b/_module/ncs/createlightpick.ncs index b7672233..801ba0b8 100644 Binary files a/_module/ncs/createlightpick.ncs and b/_module/ncs/createlightpick.ncs differ diff --git a/_module/ncs/createlitexbow.ncs b/_module/ncs/createlitexbow.ncs index fd5815ae..c4fccbea 100644 Binary files a/_module/ncs/createlitexbow.ncs and b/_module/ncs/createlitexbow.ncs differ diff --git a/_module/ncs/createlitexbow2.ncs b/_module/ncs/createlitexbow2.ncs index 48895213..99c53393 100644 Binary files a/_module/ncs/createlitexbow2.ncs and b/_module/ncs/createlitexbow2.ncs differ diff --git a/_module/ncs/createlongbow.ncs b/_module/ncs/createlongbow.ncs index 4717ab6d..55a84cbb 100644 Binary files a/_module/ncs/createlongbow.ncs and b/_module/ncs/createlongbow.ncs differ diff --git a/_module/ncs/createlongbow2.ncs b/_module/ncs/createlongbow2.ncs index c2c3cfb0..02e5040a 100644 Binary files a/_module/ncs/createlongbow2.ncs and b/_module/ncs/createlongbow2.ncs differ diff --git a/_module/ncs/createlongsword.ncs b/_module/ncs/createlongsword.ncs index 5beab58f..21615f84 100644 Binary files a/_module/ncs/createlongsword.ncs and b/_module/ncs/createlongsword.ncs differ diff --git a/_module/ncs/createmace.ncs b/_module/ncs/createmace.ncs index bf8c2cbb..5eace6dd 100644 Binary files a/_module/ncs/createmace.ncs and b/_module/ncs/createmace.ncs differ diff --git a/_module/ncs/createmaul.ncs b/_module/ncs/createmaul.ncs index a94cbe20..c4ba3c26 100644 Binary files a/_module/ncs/createmaul.ncs and b/_module/ncs/createmaul.ncs differ diff --git a/_module/ncs/createmorningsta.ncs b/_module/ncs/createmorningsta.ncs index 8669fa97..7c62a237 100644 Binary files a/_module/ncs/createmorningsta.ncs and b/_module/ncs/createmorningsta.ncs differ diff --git a/_module/ncs/createnunchaku.ncs b/_module/ncs/createnunchaku.ncs index 614e5153..68025c7a 100644 Binary files a/_module/ncs/createnunchaku.ncs and b/_module/ncs/createnunchaku.ncs differ diff --git a/_module/ncs/createquartersta.ncs b/_module/ncs/createquartersta.ncs index 9ecd201a..571b2d31 100644 Binary files a/_module/ncs/createquartersta.ncs and b/_module/ncs/createquartersta.ncs differ diff --git a/_module/ncs/createrapier.ncs b/_module/ncs/createrapier.ncs index 8673a6f2..d60ac53f 100644 Binary files a/_module/ncs/createrapier.ncs and b/_module/ncs/createrapier.ncs differ diff --git a/_module/ncs/createsai.ncs b/_module/ncs/createsai.ncs index 485963ca..4d5f22a1 100644 Binary files a/_module/ncs/createsai.ncs and b/_module/ncs/createsai.ncs differ diff --git a/_module/ncs/createsap.ncs b/_module/ncs/createsap.ncs index 6f337ec7..12bc0feb 100644 Binary files a/_module/ncs/createsap.ncs and b/_module/ncs/createsap.ncs differ diff --git a/_module/ncs/createscimitar.ncs b/_module/ncs/createscimitar.ncs index aad01641..7b536459 100644 Binary files a/_module/ncs/createscimitar.ncs and b/_module/ncs/createscimitar.ncs differ diff --git a/_module/ncs/createscythe.ncs b/_module/ncs/createscythe.ncs index 00ccafb2..55eaa112 100644 Binary files a/_module/ncs/createscythe.ncs and b/_module/ncs/createscythe.ncs differ diff --git a/_module/ncs/createshortbow.ncs b/_module/ncs/createshortbow.ncs index 8849a21b..cb741b35 100644 Binary files a/_module/ncs/createshortbow.ncs and b/_module/ncs/createshortbow.ncs differ diff --git a/_module/ncs/createshortbow2.ncs b/_module/ncs/createshortbow2.ncs index e09e5eb1..bebc98e7 100644 Binary files a/_module/ncs/createshortbow2.ncs and b/_module/ncs/createshortbow2.ncs differ diff --git a/_module/ncs/createshortswrd.ncs b/_module/ncs/createshortswrd.ncs index 20a552e0..6f4849d1 100644 Binary files a/_module/ncs/createshortswrd.ncs and b/_module/ncs/createshortswrd.ncs differ diff --git a/_module/ncs/createsickle.ncs b/_module/ncs/createsickle.ncs index 1927fd1a..c658f06a 100644 Binary files a/_module/ncs/createsickle.ncs and b/_module/ncs/createsickle.ncs differ diff --git a/_module/ncs/createsling.ncs b/_module/ncs/createsling.ncs index 4c95eee3..edf1d5eb 100644 Binary files a/_module/ncs/createsling.ncs and b/_module/ncs/createsling.ncs differ diff --git a/_module/ncs/createsling2.ncs b/_module/ncs/createsling2.ncs index 274cd785..0925e9af 100644 Binary files a/_module/ncs/createsling2.ncs and b/_module/ncs/createsling2.ncs differ diff --git a/_module/ncs/createspear.ncs b/_module/ncs/createspear.ncs index 7a4a4830..2ac53b2a 100644 Binary files a/_module/ncs/createspear.ncs and b/_module/ncs/createspear.ncs differ diff --git a/_module/ncs/createtrident.ncs b/_module/ncs/createtrident.ncs index e5837e25..61123ec6 100644 Binary files a/_module/ncs/createtrident.ncs and b/_module/ncs/createtrident.ncs differ diff --git a/_module/ncs/createtwobldswrd.ncs b/_module/ncs/createtwobldswrd.ncs index 5b00cef9..8db79bd4 100644 Binary files a/_module/ncs/createtwobldswrd.ncs and b/_module/ncs/createtwobldswrd.ncs differ diff --git a/_module/ncs/createwarhammer.ncs b/_module/ncs/createwarhammer.ncs index 7fdd71fe..eb9c6d91 100644 Binary files a/_module/ncs/createwarhammer.ncs and b/_module/ncs/createwarhammer.ncs differ diff --git a/_module/ncs/createwhip.ncs b/_module/ncs/createwhip.ncs index c4c580a4..143c5ca6 100644 Binary files a/_module/ncs/createwhip.ncs and b/_module/ncs/createwhip.ncs differ diff --git a/_module/ncs/cutsceneghost.ncs b/_module/ncs/cutsceneghost.ncs index 3f68bd8e..8a3cee61 100644 Binary files a/_module/ncs/cutsceneghost.ncs and b/_module/ncs/cutsceneghost.ncs differ diff --git a/_module/ncs/cutsceneinvisibl.ncs b/_module/ncs/cutsceneinvisibl.ncs index 0d11e8a0..11ffafc9 100644 Binary files a/_module/ncs/cutsceneinvisibl.ncs and b/_module/ncs/cutsceneinvisibl.ncs differ diff --git a/_module/ncs/dante_letodel_at.ncs b/_module/ncs/dante_letodel_at.ncs index fbb1cd59..0dfdcbb3 100644 Binary files a/_module/ncs/dante_letodel_at.ncs and b/_module/ncs/dante_letodel_at.ncs differ diff --git a/_module/ncs/dead_magic_exit.ncs b/_module/ncs/dead_magic_exit.ncs index f8932bb8..ccdabd14 100644 Binary files a/_module/ncs/dead_magic_exit.ncs and b/_module/ncs/dead_magic_exit.ncs differ diff --git a/_module/ncs/death_vikinglead.ncs b/_module/ncs/death_vikinglead.ncs index 521d2c96..c097a603 100644 Binary files a/_module/ncs/death_vikinglead.ncs and b/_module/ncs/death_vikinglead.ncs differ diff --git a/_module/ncs/death_xp1000.ncs b/_module/ncs/death_xp1000.ncs index 4a3f1e26..cd42f907 100644 Binary files a/_module/ncs/death_xp1000.ncs and b/_module/ncs/death_xp1000.ncs differ diff --git a/_module/ncs/delay_on_exit.ncs b/_module/ncs/delay_on_exit.ncs index 831a1157..d543e495 100644 Binary files a/_module/ncs/delay_on_exit.ncs and b/_module/ncs/delay_on_exit.ncs differ diff --git a/_module/ncs/delete1.ncs b/_module/ncs/delete1.ncs index ff68cbe8..47cb248e 100644 Binary files a/_module/ncs/delete1.ncs and b/_module/ncs/delete1.ncs differ diff --git a/_module/ncs/deronportal.ncs b/_module/ncs/deronportal.ncs index 4c5a8357..facef8c8 100644 Binary files a/_module/ncs/deronportal.ncs and b/_module/ncs/deronportal.ncs differ diff --git a/_module/ncs/deronportal2.ncs b/_module/ncs/deronportal2.ncs index 5a1a58c9..da4f76ee 100644 Binary files a/_module/ncs/deronportal2.ncs and b/_module/ncs/deronportal2.ncs differ diff --git a/_module/ncs/deronrecalldevic.ncs b/_module/ncs/deronrecalldevic.ncs index 14eb8315..03bb425d 100644 Binary files a/_module/ncs/deronrecalldevic.ncs and b/_module/ncs/deronrecalldevic.ncs differ diff --git a/_module/ncs/deronsafe.ncs b/_module/ncs/deronsafe.ncs index 720885c9..3427a64e 100644 Binary files a/_module/ncs/deronsafe.ncs and b/_module/ncs/deronsafe.ncs differ diff --git a/_module/ncs/desertheat2.ncs b/_module/ncs/desertheat2.ncs index 1203a8fc..d3911f4e 100644 Binary files a/_module/ncs/desertheat2.ncs and b/_module/ncs/desertheat2.ncs differ diff --git a/_module/ncs/detect_glow_evil.ncs b/_module/ncs/detect_glow_evil.ncs index f154d2bb..aa57b409 100644 Binary files a/_module/ncs/detect_glow_evil.ncs and b/_module/ncs/detect_glow_evil.ncs differ diff --git a/_module/ncs/dh2_onaenter.ncs b/_module/ncs/dh2_onaenter.ncs index 83ccb87c..522c33f1 100644 Binary files a/_module/ncs/dh2_onaenter.ncs and b/_module/ncs/dh2_onaenter.ncs differ diff --git a/_module/ncs/dh2_trigenter.ncs b/_module/ncs/dh2_trigenter.ncs index 4cdd05e1..d8693da8 100644 Binary files a/_module/ncs/dh2_trigenter.ncs and b/_module/ncs/dh2_trigenter.ncs differ diff --git a/_module/ncs/distancecheck2.ncs b/_module/ncs/distancecheck2.ncs index 084b3b85..cac630e7 100644 Binary files a/_module/ncs/distancecheck2.ncs and b/_module/ncs/distancecheck2.ncs differ diff --git a/_module/ncs/distancecheck4.ncs b/_module/ncs/distancecheck4.ncs index 5177c55a..fe1a072e 100644 Binary files a/_module/ncs/distancecheck4.ncs and b/_module/ncs/distancecheck4.ncs differ diff --git a/_module/ncs/distancecheck6.ncs b/_module/ncs/distancecheck6.ncs index d74a5cd4..d6e49be0 100644 Binary files a/_module/ncs/distancecheck6.ncs and b/_module/ncs/distancecheck6.ncs differ diff --git a/_module/ncs/dmshelper.ncs b/_module/ncs/dmshelper.ncs index fe24f4b4..7d398f10 100644 Binary files a/_module/ncs/dmshelper.ncs and b/_module/ncs/dmshelper.ncs differ diff --git a/_module/ncs/dmw_conv_end.ncs b/_module/ncs/dmw_conv_end.ncs index 746d3c9a..74e0493e 100644 Binary files a/_module/ncs/dmw_conv_end.ncs and b/_module/ncs/dmw_conv_end.ncs differ diff --git a/_module/ncs/dmw_do_dialog1.ncs b/_module/ncs/dmw_do_dialog1.ncs index df4fb9c1..fb09a890 100644 Binary files a/_module/ncs/dmw_do_dialog1.ncs and b/_module/ncs/dmw_do_dialog1.ncs differ diff --git a/_module/ncs/dmw_do_dialog2.ncs b/_module/ncs/dmw_do_dialog2.ncs index ea2f2010..ad6e5191 100644 Binary files a/_module/ncs/dmw_do_dialog2.ncs and b/_module/ncs/dmw_do_dialog2.ncs differ diff --git a/_module/ncs/dmw_do_dialog3.ncs b/_module/ncs/dmw_do_dialog3.ncs index 63ada2ce..d7c5c7a4 100644 Binary files a/_module/ncs/dmw_do_dialog3.ncs and b/_module/ncs/dmw_do_dialog3.ncs differ diff --git a/_module/ncs/dmw_do_dialog4.ncs b/_module/ncs/dmw_do_dialog4.ncs index 39870672..01f827a4 100644 Binary files a/_module/ncs/dmw_do_dialog4.ncs and b/_module/ncs/dmw_do_dialog4.ncs differ diff --git a/_module/ncs/dmw_do_dialog5.ncs b/_module/ncs/dmw_do_dialog5.ncs index e8187e10..17a192c7 100644 Binary files a/_module/ncs/dmw_do_dialog5.ncs and b/_module/ncs/dmw_do_dialog5.ncs differ diff --git a/_module/ncs/dmw_do_dialog6.ncs b/_module/ncs/dmw_do_dialog6.ncs index 5c00a79d..0711c64c 100644 Binary files a/_module/ncs/dmw_do_dialog6.ncs and b/_module/ncs/dmw_do_dialog6.ncs differ diff --git a/_module/ncs/dmw_do_dialog7.ncs b/_module/ncs/dmw_do_dialog7.ncs index 32653232..793e4d57 100644 Binary files a/_module/ncs/dmw_do_dialog7.ncs and b/_module/ncs/dmw_do_dialog7.ncs differ diff --git a/_module/ncs/dmw_do_dialog8.ncs b/_module/ncs/dmw_do_dialog8.ncs index c2a560e0..d2768bba 100644 Binary files a/_module/ncs/dmw_do_dialog8.ncs and b/_module/ncs/dmw_do_dialog8.ncs differ diff --git a/_module/ncs/dmw_do_dialog9.ncs b/_module/ncs/dmw_do_dialog9.ncs index 10134967..d64203f5 100644 Binary files a/_module/ncs/dmw_do_dialog9.ncs and b/_module/ncs/dmw_do_dialog9.ncs differ diff --git a/_module/ncs/dmw_test_dialog0.ncs b/_module/ncs/dmw_test_dialog0.ncs index fb5d6fa4..ebf4c2cf 100644 Binary files a/_module/ncs/dmw_test_dialog0.ncs and b/_module/ncs/dmw_test_dialog0.ncs differ diff --git a/_module/ncs/dmw_test_dialog1.ncs b/_module/ncs/dmw_test_dialog1.ncs index 43299f4d..48166c3f 100644 Binary files a/_module/ncs/dmw_test_dialog1.ncs and b/_module/ncs/dmw_test_dialog1.ncs differ diff --git a/_module/ncs/dmw_test_dialog2.ncs b/_module/ncs/dmw_test_dialog2.ncs index cdd15874..ebc162fa 100644 Binary files a/_module/ncs/dmw_test_dialog2.ncs and b/_module/ncs/dmw_test_dialog2.ncs differ diff --git a/_module/ncs/dmw_test_dialog3.ncs b/_module/ncs/dmw_test_dialog3.ncs index c9f6f028..7d839e48 100644 Binary files a/_module/ncs/dmw_test_dialog3.ncs and b/_module/ncs/dmw_test_dialog3.ncs differ diff --git a/_module/ncs/dmw_test_dialog4.ncs b/_module/ncs/dmw_test_dialog4.ncs index afe22e7a..b5b77de8 100644 Binary files a/_module/ncs/dmw_test_dialog4.ncs and b/_module/ncs/dmw_test_dialog4.ncs differ diff --git a/_module/ncs/dmw_test_dialog5.ncs b/_module/ncs/dmw_test_dialog5.ncs index 2283d0a2..79bb0db7 100644 Binary files a/_module/ncs/dmw_test_dialog5.ncs and b/_module/ncs/dmw_test_dialog5.ncs differ diff --git a/_module/ncs/dmw_test_dialog6.ncs b/_module/ncs/dmw_test_dialog6.ncs index 7852edd7..bef5e828 100644 Binary files a/_module/ncs/dmw_test_dialog6.ncs and b/_module/ncs/dmw_test_dialog6.ncs differ diff --git a/_module/ncs/dmw_test_dialog7.ncs b/_module/ncs/dmw_test_dialog7.ncs index 00abd044..03b45bae 100644 Binary files a/_module/ncs/dmw_test_dialog7.ncs and b/_module/ncs/dmw_test_dialog7.ncs differ diff --git a/_module/ncs/dmw_test_dialog8.ncs b/_module/ncs/dmw_test_dialog8.ncs index 03b750bc..cbfdcf22 100644 Binary files a/_module/ncs/dmw_test_dialog8.ncs and b/_module/ncs/dmw_test_dialog8.ncs differ diff --git a/_module/ncs/dmw_test_dialog9.ncs b/_module/ncs/dmw_test_dialog9.ncs index 92204a6a..d5a459fa 100644 Binary files a/_module/ncs/dmw_test_dialog9.ncs and b/_module/ncs/dmw_test_dialog9.ncs differ diff --git a/_module/ncs/door_night_lock.ncs b/_module/ncs/door_night_lock.ncs index 761e42b0..bc33614b 100644 Binary files a/_module/ncs/door_night_lock.ncs and b/_module/ncs/door_night_lock.ncs differ diff --git a/_module/ncs/dragon_convo_ck.ncs b/_module/ncs/dragon_convo_ck.ncs index bc3e550a..bf1eaf64 100644 Binary files a/_module/ncs/dragon_convo_ck.ncs and b/_module/ncs/dragon_convo_ck.ncs differ diff --git a/_module/ncs/dragon_enter21.ncs b/_module/ncs/dragon_enter21.ncs index 405a7d0c..50e5672e 100644 Binary files a/_module/ncs/dragon_enter21.ncs and b/_module/ncs/dragon_enter21.ncs differ diff --git a/_module/ncs/dragon_exit12.ncs b/_module/ncs/dragon_exit12.ncs index 2f4bd22a..06815c23 100644 Binary files a/_module/ncs/dragon_exit12.ncs and b/_module/ncs/dragon_exit12.ncs differ diff --git a/_module/ncs/dragoncall_enter.ncs b/_module/ncs/dragoncall_enter.ncs index 6a3895b7..60970098 100644 Binary files a/_module/ncs/dragoncall_enter.ncs and b/_module/ncs/dragoncall_enter.ncs differ diff --git a/_module/ncs/dragonspawn.ncs b/_module/ncs/dragonspawn.ncs index 2e8e323e..9f371b65 100644 Binary files a/_module/ncs/dragonspawn.ncs and b/_module/ncs/dragonspawn.ncs differ diff --git a/_module/ncs/dragonspawn2.ncs b/_module/ncs/dragonspawn2.ncs index 6ae389c4..64bee534 100644 Binary files a/_module/ncs/dragonspawn2.ncs and b/_module/ncs/dragonspawn2.ncs differ diff --git a/_module/ncs/dragonsreward.ncs b/_module/ncs/dragonsreward.ncs index bfb9a1cd..3982217a 100644 Binary files a/_module/ncs/dragonsreward.ncs and b/_module/ncs/dragonsreward.ncs differ diff --git a/_module/ncs/drop_ondeath_npc.ncs b/_module/ncs/drop_ondeath_npc.ncs index 3f2f5067..4b0e4dae 100644 Binary files a/_module/ncs/drop_ondeath_npc.ncs and b/_module/ncs/drop_ondeath_npc.ncs differ diff --git a/_module/ncs/drow_bell_ring.ncs b/_module/ncs/drow_bell_ring.ncs index 2b35e04f..c7aaa0bd 100644 Binary files a/_module/ncs/drow_bell_ring.ncs and b/_module/ncs/drow_bell_ring.ncs differ diff --git a/_module/ncs/drow_dm_getvar1.ncs b/_module/ncs/drow_dm_getvar1.ncs index 4cef5e4e..4ce28f49 100644 Binary files a/_module/ncs/drow_dm_getvar1.ncs and b/_module/ncs/drow_dm_getvar1.ncs differ diff --git a/_module/ncs/drow_dm_getvar2.ncs b/_module/ncs/drow_dm_getvar2.ncs index 1ddfffe6..c6c6a613 100644 Binary files a/_module/ncs/drow_dm_getvar2.ncs and b/_module/ncs/drow_dm_getvar2.ncs differ diff --git a/_module/ncs/drow_dm_getvar3.ncs b/_module/ncs/drow_dm_getvar3.ncs index dc788966..a25f1e45 100644 Binary files a/_module/ncs/drow_dm_getvar3.ncs and b/_module/ncs/drow_dm_getvar3.ncs differ diff --git a/_module/ncs/drowprinces_give.ncs b/_module/ncs/drowprinces_give.ncs index 12a8366a..b48a3c62 100644 Binary files a/_module/ncs/drowprinces_give.ncs and b/_module/ncs/drowprinces_give.ncs differ diff --git a/_module/ncs/eagle_npc.ncs b/_module/ncs/eagle_npc.ncs index 3e4cae22..aee8cbc1 100644 Binary files a/_module/ncs/eagle_npc.ncs and b/_module/ncs/eagle_npc.ncs differ diff --git a/_module/ncs/earthnoble_spawn.ncs b/_module/ncs/earthnoble_spawn.ncs index bd706e96..76112a8e 100644 Binary files a/_module/ncs/earthnoble_spawn.ncs and b/_module/ncs/earthnoble_spawn.ncs differ diff --git a/_module/ncs/eldricreward1.ncs b/_module/ncs/eldricreward1.ncs index caf1939c..d59792fd 100644 Binary files a/_module/ncs/eldricreward1.ncs and b/_module/ncs/eldricreward1.ncs differ diff --git a/_module/ncs/eldricreward2.ncs b/_module/ncs/eldricreward2.ncs index 7c8f6549..122e861a 100644 Binary files a/_module/ncs/eldricreward2.ncs and b/_module/ncs/eldricreward2.ncs differ diff --git a/_module/ncs/element_port2.ncs b/_module/ncs/element_port2.ncs index 2db548af..28ce0bd5 100644 Binary files a/_module/ncs/element_port2.ncs and b/_module/ncs/element_port2.ncs differ diff --git a/_module/ncs/emperor_attack.ncs b/_module/ncs/emperor_attack.ncs index a2a3da9b..fbd480c9 100644 Binary files a/_module/ncs/emperor_attack.ncs and b/_module/ncs/emperor_attack.ncs differ diff --git a/_module/ncs/end_baltar.ncs b/_module/ncs/end_baltar.ncs index 893f8353..cc68c479 100644 Binary files a/_module/ncs/end_baltar.ncs and b/_module/ncs/end_baltar.ncs differ diff --git a/_module/ncs/end_cugel_quest.ncs b/_module/ncs/end_cugel_quest.ncs index 575bba5f..4bd691e9 100644 Binary files a/_module/ncs/end_cugel_quest.ncs and b/_module/ncs/end_cugel_quest.ncs differ diff --git a/_module/ncs/end_green.ncs b/_module/ncs/end_green.ncs index 325fedde..7bb4529e 100644 Binary files a/_module/ncs/end_green.ncs and b/_module/ncs/end_green.ncs differ diff --git a/_module/ncs/end_hamley_gear.ncs b/_module/ncs/end_hamley_gear.ncs index a1038562..c08091e3 100644 Binary files a/_module/ncs/end_hamley_gear.ncs and b/_module/ncs/end_hamley_gear.ncs differ diff --git a/_module/ncs/end_hamleynote.ncs b/_module/ncs/end_hamleynote.ncs index 86dc832d..53028c22 100644 Binary files a/_module/ncs/end_hamleynote.ncs and b/_module/ncs/end_hamleynote.ncs differ diff --git a/_module/ncs/end_hetmanquest.ncs b/_module/ncs/end_hetmanquest.ncs index abaf2860..4daf53da 100644 Binary files a/_module/ncs/end_hetmanquest.ncs and b/_module/ncs/end_hetmanquest.ncs differ diff --git a/_module/ncs/end_irda_stone.ncs b/_module/ncs/end_irda_stone.ncs index 7aab5268..76f846a9 100644 Binary files a/_module/ncs/end_irda_stone.ncs and b/_module/ncs/end_irda_stone.ncs differ diff --git a/_module/ncs/end_jail_quest.ncs b/_module/ncs/end_jail_quest.ncs index 8385f823..7104a45c 100644 Binary files a/_module/ncs/end_jail_quest.ncs and b/_module/ncs/end_jail_quest.ncs differ diff --git a/_module/ncs/end_miller_baby.ncs b/_module/ncs/end_miller_baby.ncs index 5dc9466d..100954b2 100644 Binary files a/_module/ncs/end_miller_baby.ncs and b/_module/ncs/end_miller_baby.ncs differ diff --git a/_module/ncs/end_shaolin.ncs b/_module/ncs/end_shaolin.ncs index a64ba55c..a76de796 100644 Binary files a/_module/ncs/end_shaolin.ncs and b/_module/ncs/end_shaolin.ncs differ diff --git a/_module/ncs/escort_death.ncs b/_module/ncs/escort_death.ncs index 043c4c2b..da07fe8e 100644 Binary files a/_module/ncs/escort_death.ncs and b/_module/ncs/escort_death.ncs differ diff --git a/_module/ncs/escort_reset2.ncs b/_module/ncs/escort_reset2.ncs index ade08356..367b3406 100644 Binary files a/_module/ncs/escort_reset2.ncs and b/_module/ncs/escort_reset2.ncs differ diff --git a/_module/ncs/escort_spawn.ncs b/_module/ncs/escort_spawn.ncs index 695dd197..4f5530f7 100644 Binary files a/_module/ncs/escort_spawn.ncs and b/_module/ncs/escort_spawn.ncs differ diff --git a/_module/ncs/escort_stop.ncs b/_module/ncs/escort_stop.ncs index 3989c7b5..515c9e69 100644 Binary files a/_module/ncs/escort_stop.ncs and b/_module/ncs/escort_stop.ncs differ diff --git a/_module/ncs/explosive_death.ncs b/_module/ncs/explosive_death.ncs index 144ceb12..ee16e085 100644 Binary files a/_module/ncs/explosive_death.ncs and b/_module/ncs/explosive_death.ncs differ diff --git a/_module/ncs/farmhand.ncs b/_module/ncs/farmhand.ncs index 4f4209f0..e6afb3c5 100644 Binary files a/_module/ncs/farmhand.ncs and b/_module/ncs/farmhand.ncs differ diff --git a/_module/ncs/farmhand2.ncs b/_module/ncs/farmhand2.ncs index fb16e2bf..b2d03c60 100644 Binary files a/_module/ncs/farmhand2.ncs and b/_module/ncs/farmhand2.ncs differ diff --git a/_module/ncs/farmhand3.ncs b/_module/ncs/farmhand3.ncs index d6de03c4..b6c2ed90 100644 Binary files a/_module/ncs/farmhand3.ncs and b/_module/ncs/farmhand3.ncs differ diff --git a/_module/ncs/farmhand4.ncs b/_module/ncs/farmhand4.ncs index 56e93e03..fe8336e3 100644 Binary files a/_module/ncs/farmhand4.ncs and b/_module/ncs/farmhand4.ncs differ diff --git a/_module/ncs/farmhand5.ncs b/_module/ncs/farmhand5.ncs index ae3b6202..72311903 100644 Binary files a/_module/ncs/farmhand5.ncs and b/_module/ncs/farmhand5.ncs differ diff --git a/_module/ncs/fb1_onenter.ncs b/_module/ncs/fb1_onenter.ncs index fbec03db..d4b0a66e 100644 Binary files a/_module/ncs/fb1_onenter.ncs and b/_module/ncs/fb1_onenter.ncs differ diff --git a/_module/ncs/fiend_death.ncs b/_module/ncs/fiend_death.ncs index 9643e7c9..e746fcb8 100644 Binary files a/_module/ncs/fiend_death.ncs and b/_module/ncs/fiend_death.ncs differ diff --git a/_module/ncs/findfriend.ncs b/_module/ncs/findfriend.ncs index 6fdbd31c..ec12c0f8 100644 Binary files a/_module/ncs/findfriend.ncs and b/_module/ncs/findfriend.ncs differ diff --git a/_module/ncs/firelord_spawn.ncs b/_module/ncs/firelord_spawn.ncs index 4a3d96e9..aaedc6e6 100644 Binary files a/_module/ncs/firelord_spawn.ncs and b/_module/ncs/firelord_spawn.ncs differ diff --git a/_module/ncs/forcefield_wolf1.ncs b/_module/ncs/forcefield_wolf1.ncs index b0d23a62..5273f2de 100644 Binary files a/_module/ncs/forcefield_wolf1.ncs and b/_module/ncs/forcefield_wolf1.ncs differ diff --git a/_module/ncs/frobo_flee.ncs b/_module/ncs/frobo_flee.ncs index 1782f819..17031fde 100644 Binary files a/_module/ncs/frobo_flee.ncs and b/_module/ncs/frobo_flee.ncs differ diff --git a/_module/ncs/frobo_spawn.ncs b/_module/ncs/frobo_spawn.ncs index 56ddd87e..f1688986 100644 Binary files a/_module/ncs/frobo_spawn.ncs and b/_module/ncs/frobo_spawn.ncs differ diff --git a/_module/ncs/frobo_take_stat.ncs b/_module/ncs/frobo_take_stat.ncs index ddd75778..c7e85da4 100644 Binary files a/_module/ncs/frobo_take_stat.ncs and b/_module/ncs/frobo_take_stat.ncs differ diff --git a/_module/ncs/fx_hbdiv.ncs b/_module/ncs/fx_hbdiv.ncs index 116dd661..6d43fdba 100644 Binary files a/_module/ncs/fx_hbdiv.ncs and b/_module/ncs/fx_hbdiv.ncs differ diff --git a/_module/ncs/gen_treasure1.ncs b/_module/ncs/gen_treasure1.ncs index e8e7abc6..7f1505a6 100644 Binary files a/_module/ncs/gen_treasure1.ncs and b/_module/ncs/gen_treasure1.ncs differ diff --git a/_module/ncs/ghost_ck_ring.ncs b/_module/ncs/ghost_ck_ring.ncs index 4f7f5752..7361d213 100644 Binary files a/_module/ncs/ghost_ck_ring.ncs and b/_module/ncs/ghost_ck_ring.ncs differ diff --git a/_module/ncs/ghostvfx.ncs b/_module/ncs/ghostvfx.ncs index 7e751e1f..00731a32 100644 Binary files a/_module/ncs/ghostvfx.ncs and b/_module/ncs/ghostvfx.ncs differ diff --git a/_module/ncs/give_dragonorb.ncs b/_module/ncs/give_dragonorb.ncs index 6ea715cf..6311f084 100644 Binary files a/_module/ncs/give_dragonorb.ncs and b/_module/ncs/give_dragonorb.ncs differ diff --git a/_module/ncs/give_dryad_item.ncs b/_module/ncs/give_dryad_item.ncs index f6787c72..1c848ef8 100644 Binary files a/_module/ncs/give_dryad_item.ncs and b/_module/ncs/give_dryad_item.ncs differ diff --git a/_module/ncs/golemgold.ncs b/_module/ncs/golemgold.ncs index e434e5d7..db2018fd 100644 Binary files a/_module/ncs/golemgold.ncs and b/_module/ncs/golemgold.ncs differ diff --git a/_module/ncs/gz_healer_spawn.ncs b/_module/ncs/gz_healer_spawn.ncs index 8d0aec15..7d15fa64 100644 Binary files a/_module/ncs/gz_healer_spawn.ncs and b/_module/ncs/gz_healer_spawn.ncs differ diff --git a/_module/ncs/gz_healer_ude.ncs b/_module/ncs/gz_healer_ude.ncs index 44d404d0..a3e3f1e1 100644 Binary files a/_module/ncs/gz_healer_ude.ncs and b/_module/ncs/gz_healer_ude.ncs differ diff --git a/_module/ncs/gzcc_healertoken.ncs b/_module/ncs/gzcc_healertoken.ncs index 0503a650..b6fe98db 100644 Binary files a/_module/ncs/gzcc_healertoken.ncs and b/_module/ncs/gzcc_healertoken.ncs differ diff --git a/_module/ncs/gzcc_is_pc_abdmg.ncs b/_module/ncs/gzcc_is_pc_abdmg.ncs index 5a614073..25a851c5 100644 Binary files a/_module/ncs/gzcc_is_pc_abdmg.ncs and b/_module/ncs/gzcc_is_pc_abdmg.ncs differ diff --git a/_module/ncs/gzcc_is_pc_blind.ncs b/_module/ncs/gzcc_is_pc_blind.ncs index af7fcccc..0ee287a0 100644 Binary files a/_module/ncs/gzcc_is_pc_blind.ncs and b/_module/ncs/gzcc_is_pc_blind.ncs differ diff --git a/_module/ncs/gzcc_is_pc_curse.ncs b/_module/ncs/gzcc_is_pc_curse.ncs index a96f7874..0d02fedd 100644 Binary files a/_module/ncs/gzcc_is_pc_curse.ncs and b/_module/ncs/gzcc_is_pc_curse.ncs differ diff --git a/_module/ncs/gzcc_is_pc_disea.ncs b/_module/ncs/gzcc_is_pc_disea.ncs index 95f83468..aa025890 100644 Binary files a/_module/ncs/gzcc_is_pc_disea.ncs and b/_module/ncs/gzcc_is_pc_disea.ncs differ diff --git a/_module/ncs/gzcc_is_pc_dmged.ncs b/_module/ncs/gzcc_is_pc_dmged.ncs index 75e85f59..9b4cd225 100644 Binary files a/_module/ncs/gzcc_is_pc_dmged.ncs and b/_module/ncs/gzcc_is_pc_dmged.ncs differ diff --git a/_module/ncs/gzcc_is_pc_neglv.ncs b/_module/ncs/gzcc_is_pc_neglv.ncs index eb93fb61..20ed7596 100644 Binary files a/_module/ncs/gzcc_is_pc_neglv.ncs and b/_module/ncs/gzcc_is_pc_neglv.ncs differ diff --git a/_module/ncs/gzcc_is_pc_poiso.ncs b/_module/ncs/gzcc_is_pc_poiso.ncs index adc419c0..7bac60c3 100644 Binary files a/_module/ncs/gzcc_is_pc_poiso.ncs and b/_module/ncs/gzcc_is_pc_poiso.ncs differ diff --git a/_module/ncs/gzcc_needhealer.ncs b/_module/ncs/gzcc_needhealer.ncs index 2b28fbc1..29d34dbf 100644 Binary files a/_module/ncs/gzcc_needhealer.ncs and b/_module/ncs/gzcc_needhealer.ncs differ diff --git a/_module/ncs/gzcs_heal_damage.ncs b/_module/ncs/gzcs_heal_damage.ncs index 2aef4b8e..0588bc9d 100644 Binary files a/_module/ncs/gzcs_heal_damage.ncs and b/_module/ncs/gzcs_heal_damage.ncs differ diff --git a/_module/ncs/gzcs_rem_abdmg.ncs b/_module/ncs/gzcs_rem_abdmg.ncs index af0350ef..de155715 100644 Binary files a/_module/ncs/gzcs_rem_abdmg.ncs and b/_module/ncs/gzcs_rem_abdmg.ncs differ diff --git a/_module/ncs/gzcs_rem_all.ncs b/_module/ncs/gzcs_rem_all.ncs index 30727d7a..44849e3c 100644 Binary files a/_module/ncs/gzcs_rem_all.ncs and b/_module/ncs/gzcs_rem_all.ncs differ diff --git a/_module/ncs/gzcs_rem_blind.ncs b/_module/ncs/gzcs_rem_blind.ncs index 146c1f3c..0619366c 100644 Binary files a/_module/ncs/gzcs_rem_blind.ncs and b/_module/ncs/gzcs_rem_blind.ncs differ diff --git a/_module/ncs/gzcs_rem_curse.ncs b/_module/ncs/gzcs_rem_curse.ncs index 97daed7e..d145211b 100644 Binary files a/_module/ncs/gzcs_rem_curse.ncs and b/_module/ncs/gzcs_rem_curse.ncs differ diff --git a/_module/ncs/gzcs_rem_disease.ncs b/_module/ncs/gzcs_rem_disease.ncs index 2dfc71ac..8d8925ab 100644 Binary files a/_module/ncs/gzcs_rem_disease.ncs and b/_module/ncs/gzcs_rem_disease.ncs differ diff --git a/_module/ncs/gzcs_rem_neglvls.ncs b/_module/ncs/gzcs_rem_neglvls.ncs index 308cb5b3..1c90358b 100644 Binary files a/_module/ncs/gzcs_rem_neglvls.ncs and b/_module/ncs/gzcs_rem_neglvls.ncs differ diff --git a/_module/ncs/gzcs_rem_poison.ncs b/_module/ncs/gzcs_rem_poison.ncs index 6509bd3c..d138683e 100644 Binary files a/_module/ncs/gzcs_rem_poison.ncs and b/_module/ncs/gzcs_rem_poison.ncs differ diff --git a/_module/ncs/haunted_door.ncs b/_module/ncs/haunted_door.ncs index deebb7fb..bd43347a 100644 Binary files a/_module/ncs/haunted_door.ncs and b/_module/ncs/haunted_door.ncs differ diff --git a/_module/ncs/haunted_door2.ncs b/_module/ncs/haunted_door2.ncs index 9af155c3..62e2e4e8 100644 Binary files a/_module/ncs/haunted_door2.ncs and b/_module/ncs/haunted_door2.ncs differ diff --git a/_module/ncs/healcheck25.ncs b/_module/ncs/healcheck25.ncs index 24e92c97..f2453e56 100644 Binary files a/_module/ncs/healcheck25.ncs and b/_module/ncs/healcheck25.ncs differ diff --git a/_module/ncs/healcheck50.ncs b/_module/ncs/healcheck50.ncs index 4dd6b5f3..88e26f98 100644 Binary files a/_module/ncs/healcheck50.ncs and b/_module/ncs/healcheck50.ncs differ diff --git a/_module/ncs/healcheck75.ncs b/_module/ncs/healcheck75.ncs index 6f88550a..4ee895f0 100644 Binary files a/_module/ncs/healcheck75.ncs and b/_module/ncs/healcheck75.ncs differ diff --git a/_module/ncs/hen_gentokens_at.ncs b/_module/ncs/hen_gentokens_at.ncs index 5d51211f..b8ae0da6 100644 Binary files a/_module/ncs/hen_gentokens_at.ncs and b/_module/ncs/hen_gentokens_at.ncs differ diff --git a/_module/ncs/hen_settrloc_at.ncs b/_module/ncs/hen_settrloc_at.ncs index f9be3239..b3290be5 100644 Binary files a/_module/ncs/hen_settrloc_at.ncs and b/_module/ncs/hen_settrloc_at.ncs differ diff --git a/_module/ncs/hench_o0_heal.ncs b/_module/ncs/hench_o0_heal.ncs index 4ec1199c..7f0f2a15 100644 Binary files a/_module/ncs/hench_o0_heal.ncs and b/_module/ncs/hench_o0_heal.ncs differ diff --git a/_module/ncs/henchcomp.ncs b/_module/ncs/henchcomp.ncs index e02219df..90c16d58 100644 Binary files a/_module/ncs/henchcomp.ncs and b/_module/ncs/henchcomp.ncs differ diff --git a/_module/ncs/henchdisdual.ncs b/_module/ncs/henchdisdual.ncs index c2ca720a..1e6a9bb4 100644 Binary files a/_module/ncs/henchdisdual.ncs and b/_module/ncs/henchdisdual.ncs differ diff --git a/_module/ncs/henchendual.ncs b/_module/ncs/henchendual.ncs index a924a220..7d667b08 100644 Binary files a/_module/ncs/henchendual.ncs and b/_module/ncs/henchendual.ncs differ diff --git a/_module/ncs/henchenheavy.ncs b/_module/ncs/henchenheavy.ncs index 3fc4bdb7..6b79b1ee 100644 Binary files a/_module/ncs/henchenheavy.ncs and b/_module/ncs/henchenheavy.ncs differ diff --git a/_module/ncs/henchenlight.ncs b/_module/ncs/henchenlight.ncs index b9353350..db7cf8e9 100644 Binary files a/_module/ncs/henchenlight.ncs and b/_module/ncs/henchenlight.ncs differ diff --git a/_module/ncs/henchfamilar.ncs b/_module/ncs/henchfamilar.ncs index 36d5f1bb..88925f4e 100644 Binary files a/_module/ncs/henchfamilar.ncs and b/_module/ncs/henchfamilar.ncs differ diff --git a/_module/ncs/hls_wandlab.ncs b/_module/ncs/hls_wandlab.ncs index 60fc720f..8805dbb4 100644 Binary files a/_module/ncs/hls_wandlab.ncs and b/_module/ncs/hls_wandlab.ncs differ diff --git a/_module/ncs/innerkeep_enter.ncs b/_module/ncs/innerkeep_enter.ncs index 7883b251..78b4d701 100644 Binary files a/_module/ncs/innerkeep_enter.ncs and b/_module/ncs/innerkeep_enter.ncs differ diff --git a/_module/ncs/irda_start.ncs b/_module/ncs/irda_start.ncs index db51e6e1..9231a5dc 100644 Binary files a/_module/ncs/irda_start.ncs and b/_module/ncs/irda_start.ncs differ diff --git a/_module/ncs/item_enter_cho.ncs b/_module/ncs/item_enter_cho.ncs index 9e5e9f6d..d9f75002 100644 Binary files a/_module/ncs/item_enter_cho.ncs and b/_module/ncs/item_enter_cho.ncs differ diff --git a/_module/ncs/king_give_1.ncs b/_module/ncs/king_give_1.ncs index e897e403..5f50a00e 100644 Binary files a/_module/ncs/king_give_1.ncs and b/_module/ncs/king_give_1.ncs differ diff --git a/_module/ncs/king_give_3.ncs b/_module/ncs/king_give_3.ncs index 9727afdd..3c13364a 100644 Binary files a/_module/ncs/king_give_3.ncs and b/_module/ncs/king_give_3.ncs differ diff --git a/_module/ncs/king_sit.ncs b/_module/ncs/king_sit.ncs index 9bda952d..5852353f 100644 Binary files a/_module/ncs/king_sit.ncs and b/_module/ncs/king_sit.ncs differ diff --git a/_module/ncs/kingreward3.ncs b/_module/ncs/kingreward3.ncs index 73f3f5c3..4b90cd9c 100644 Binary files a/_module/ncs/kingreward3.ncs and b/_module/ncs/kingreward3.ncs differ diff --git a/_module/ncs/kingspeak.ncs b/_module/ncs/kingspeak.ncs index 41e53a60..5599bc70 100644 Binary files a/_module/ncs/kingspeak.ncs and b/_module/ncs/kingspeak.ncs differ diff --git a/_module/ncs/kpb_credit_token.ncs b/_module/ncs/kpb_credit_token.ncs index dbada12d..0af49697 100644 Binary files a/_module/ncs/kpb_credit_token.ncs and b/_module/ncs/kpb_credit_token.ncs differ diff --git a/_module/ncs/kpb_deposit100.ncs b/_module/ncs/kpb_deposit100.ncs index a49e5805..1b01f074 100644 Binary files a/_module/ncs/kpb_deposit100.ncs and b/_module/ncs/kpb_deposit100.ncs differ diff --git a/_module/ncs/kpb_deposit1000.ncs b/_module/ncs/kpb_deposit1000.ncs index c88cad0e..9774fcb4 100644 Binary files a/_module/ncs/kpb_deposit1000.ncs and b/_module/ncs/kpb_deposit1000.ncs differ diff --git a/_module/ncs/kpb_deposit10000.ncs b/_module/ncs/kpb_deposit10000.ncs index a91c8177..aedfd894 100644 Binary files a/_module/ncs/kpb_deposit10000.ncs and b/_module/ncs/kpb_deposit10000.ncs differ diff --git a/_module/ncs/kpb_loan_balance.ncs b/_module/ncs/kpb_loan_balance.ncs index da38b870..a65925dd 100644 Binary files a/_module/ncs/kpb_loan_balance.ncs and b/_module/ncs/kpb_loan_balance.ncs differ diff --git a/_module/ncs/kpb_takeloan100.ncs b/_module/ncs/kpb_takeloan100.ncs index 7cef2360..d5e53438 100644 Binary files a/_module/ncs/kpb_takeloan100.ncs and b/_module/ncs/kpb_takeloan100.ncs differ diff --git a/_module/ncs/kpb_takeloan1000.ncs b/_module/ncs/kpb_takeloan1000.ncs index b8dc2edc..49b5652d 100644 Binary files a/_module/ncs/kpb_takeloan1000.ncs and b/_module/ncs/kpb_takeloan1000.ncs differ diff --git a/_module/ncs/kpb_takeloan5000.ncs b/_module/ncs/kpb_takeloan5000.ncs index 4e035fd2..d062bd98 100644 Binary files a/_module/ncs/kpb_takeloan5000.ncs and b/_module/ncs/kpb_takeloan5000.ncs differ diff --git a/_module/ncs/kpb_tkeloan10000.ncs b/_module/ncs/kpb_tkeloan10000.ncs index 095c8cd0..c18949a2 100644 Binary files a/_module/ncs/kpb_tkeloan10000.ncs and b/_module/ncs/kpb_tkeloan10000.ncs differ diff --git a/_module/ncs/kpb_withdraw100.ncs b/_module/ncs/kpb_withdraw100.ncs index 330c30e7..2ce860ee 100644 Binary files a/_module/ncs/kpb_withdraw100.ncs and b/_module/ncs/kpb_withdraw100.ncs differ diff --git a/_module/ncs/kpb_withdraw1000.ncs b/_module/ncs/kpb_withdraw1000.ncs index 12ec3915..21209a7a 100644 Binary files a/_module/ncs/kpb_withdraw1000.ncs and b/_module/ncs/kpb_withdraw1000.ncs differ diff --git a/_module/ncs/kpb_withdraw_all.ncs b/_module/ncs/kpb_withdraw_all.ncs index c3f5bcd8..0bcb26b3 100644 Binary files a/_module/ncs/kpb_withdraw_all.ncs and b/_module/ncs/kpb_withdraw_all.ncs differ diff --git a/_module/ncs/kpb_wthdraw10000.ncs b/_module/ncs/kpb_wthdraw10000.ncs index 95dce4b8..5363bda5 100644 Binary files a/_module/ncs/kpb_wthdraw10000.ncs and b/_module/ncs/kpb_wthdraw10000.ncs differ diff --git a/_module/ncs/kylith_ondeath.ncs b/_module/ncs/kylith_ondeath.ncs index 90e40bfc..051ca668 100644 Binary files a/_module/ncs/kylith_ondeath.ncs and b/_module/ncs/kylith_ondeath.ncs differ diff --git a/_module/ncs/leveltake1.ncs b/_module/ncs/leveltake1.ncs index 31005334..b01918b5 100644 Binary files a/_module/ncs/leveltake1.ncs and b/_module/ncs/leveltake1.ncs differ diff --git a/_module/ncs/leveltake10.ncs b/_module/ncs/leveltake10.ncs index 314db8ae..88041a64 100644 Binary files a/_module/ncs/leveltake10.ncs and b/_module/ncs/leveltake10.ncs differ diff --git a/_module/ncs/leveltake5.ncs b/_module/ncs/leveltake5.ncs index 06033801..4c32454f 100644 Binary files a/_module/ncs/leveltake5.ncs and b/_module/ncs/leveltake5.ncs differ diff --git a/_module/ncs/lever_combo1.ncs b/_module/ncs/lever_combo1.ncs index 1a334c8d..0d30ad45 100644 Binary files a/_module/ncs/lever_combo1.ncs and b/_module/ncs/lever_combo1.ncs differ diff --git a/_module/ncs/lmpperfact01.ncs b/_module/ncs/lmpperfact01.ncs index 4fab3211..9e81719f 100644 Binary files a/_module/ncs/lmpperfact01.ncs and b/_module/ncs/lmpperfact01.ncs differ diff --git a/_module/ncs/lmpperfact04.ncs b/_module/ncs/lmpperfact04.ncs index b9d3fab3..3b047a45 100644 Binary files a/_module/ncs/lmpperfact04.ncs and b/_module/ncs/lmpperfact04.ncs differ diff --git a/_module/ncs/lmpperfactrefund.ncs b/_module/ncs/lmpperfactrefund.ncs index 0c70a8bd..ba30787c 100644 Binary files a/_module/ncs/lmpperfactrefund.ncs and b/_module/ncs/lmpperfactrefund.ncs differ diff --git a/_module/ncs/lmpperfacttheft.ncs b/_module/ncs/lmpperfacttheft.ncs index c24dcaa6..c0b86d0a 100644 Binary files a/_module/ncs/lmpperfacttheft.ncs and b/_module/ncs/lmpperfacttheft.ncs differ diff --git a/_module/ncs/lmpperfbow.ncs b/_module/ncs/lmpperfbow.ncs index d45b67a2..9a172740 100644 Binary files a/_module/ncs/lmpperfbow.ncs and b/_module/ncs/lmpperfbow.ncs differ diff --git a/_module/ncs/lmpperfcondperf.ncs b/_module/ncs/lmpperfcondperf.ncs index 3d3eee81..45018227 100644 Binary files a/_module/ncs/lmpperfcondperf.ncs and b/_module/ncs/lmpperfcondperf.ncs differ diff --git a/_module/ncs/lmpperfconvabort.ncs b/_module/ncs/lmpperfconvabort.ncs index ca17281e..46132ee0 100644 Binary files a/_module/ncs/lmpperfconvabort.ncs and b/_module/ncs/lmpperfconvabort.ncs differ diff --git a/_module/ncs/lmpperffacepc.ncs b/_module/ncs/lmpperffacepc.ncs index 9d145926..4c3ea90b 100644 Binary files a/_module/ncs/lmpperffacepc.ncs and b/_module/ncs/lmpperffacepc.ncs differ diff --git a/_module/ncs/lmpperfreset02.ncs b/_module/ncs/lmpperfreset02.ncs index 208382ae..a96673f1 100644 Binary files a/_module/ncs/lmpperfreset02.ncs and b/_module/ncs/lmpperfreset02.ncs differ diff --git a/_module/ncs/lmpperfreset03.ncs b/_module/ncs/lmpperfreset03.ncs index 208382ae..a96673f1 100644 Binary files a/_module/ncs/lmpperfreset03.ncs and b/_module/ncs/lmpperfreset03.ncs differ diff --git a/_module/ncs/lmpperfreset04.ncs b/_module/ncs/lmpperfreset04.ncs index 828321de..c8a606d9 100644 Binary files a/_module/ncs/lmpperfreset04.ncs and b/_module/ncs/lmpperfreset04.ncs differ diff --git a/_module/ncs/lmpperfreset05.ncs b/_module/ncs/lmpperfreset05.ncs index 208382ae..a96673f1 100644 Binary files a/_module/ncs/lmpperfreset05.ncs and b/_module/ncs/lmpperfreset05.ncs differ diff --git a/_module/ncs/lmpperfspawn.ncs b/_module/ncs/lmpperfspawn.ncs index 52e21356..39588064 100644 Binary files a/_module/ncs/lmpperfspawn.ncs and b/_module/ncs/lmpperfspawn.ncs differ diff --git a/_module/ncs/lmpperfstartperf.ncs b/_module/ncs/lmpperfstartperf.ncs index 03091c90..a789fe3d 100644 Binary files a/_module/ncs/lmpperfstartperf.ncs and b/_module/ncs/lmpperfstartperf.ncs differ diff --git a/_module/ncs/lmpperfterm.ncs b/_module/ncs/lmpperfterm.ncs index cac6e122..59095f8e 100644 Binary files a/_module/ncs/lmpperfterm.ncs and b/_module/ncs/lmpperfterm.ncs differ diff --git a/_module/ncs/lmpperfuser.ncs b/_module/ncs/lmpperfuser.ncs index f01fdf9a..1306e483 100644 Binary files a/_module/ncs/lmpperfuser.ncs and b/_module/ncs/lmpperfuser.ncs differ diff --git a/_module/ncs/lomil_ck_eggs.ncs b/_module/ncs/lomil_ck_eggs.ncs index b6feabe0..46604ed4 100644 Binary files a/_module/ncs/lomil_ck_eggs.ncs and b/_module/ncs/lomil_ck_eggs.ncs differ diff --git a/_module/ncs/lose_xp_quest_oc.ncs b/_module/ncs/lose_xp_quest_oc.ncs index b93a8559..0d2c0ea1 100644 Binary files a/_module/ncs/lose_xp_quest_oc.ncs and b/_module/ncs/lose_xp_quest_oc.ncs differ diff --git a/_module/ncs/lts_ambplc_used.ncs b/_module/ncs/lts_ambplc_used.ncs index 8b090527..4f2f24aa 100644 Binary files a/_module/ncs/lts_ambplc_used.ncs and b/_module/ncs/lts_ambplc_used.ncs differ diff --git a/_module/ncs/mail_body.ncs b/_module/ncs/mail_body.ncs index 8158b1bd..c893ebae 100644 Binary files a/_module/ncs/mail_body.ncs and b/_module/ncs/mail_body.ncs differ diff --git a/_module/ncs/mail_conv_bckmsg.ncs b/_module/ncs/mail_conv_bckmsg.ncs index 75f3f37a..863c41c1 100644 Binary files a/_module/ncs/mail_conv_bckmsg.ncs and b/_module/ncs/mail_conv_bckmsg.ncs differ diff --git a/_module/ncs/mail_conv_greet.ncs b/_module/ncs/mail_conv_greet.ncs index 5d13484d..b0910dc9 100644 Binary files a/_module/ncs/mail_conv_greet.ncs and b/_module/ncs/mail_conv_greet.ncs differ diff --git a/_module/ncs/mail_conv_mblist.ncs b/_module/ncs/mail_conv_mblist.ncs index b3f4aaa9..8fbc5f23 100644 Binary files a/_module/ncs/mail_conv_mblist.ncs and b/_module/ncs/mail_conv_mblist.ncs differ diff --git a/_module/ncs/mail_conv_msgcnt.ncs b/_module/ncs/mail_conv_msgcnt.ncs index 9969eabd..9a68b5c8 100644 Binary files a/_module/ncs/mail_conv_msgcnt.ncs and b/_module/ncs/mail_conv_msgcnt.ncs differ diff --git a/_module/ncs/mail_conv_msglst.ncs b/_module/ncs/mail_conv_msglst.ncs index 0ca87503..0e10896b 100644 Binary files a/_module/ncs/mail_conv_msglst.ncs and b/_module/ncs/mail_conv_msglst.ncs differ diff --git a/_module/ncs/mail_conv_next.ncs b/_module/ncs/mail_conv_next.ncs index 8dd0bc0e..e7734e06 100644 Binary files a/_module/ncs/mail_conv_next.ncs and b/_module/ncs/mail_conv_next.ncs differ diff --git a/_module/ncs/mail_conv_ngreet.ncs b/_module/ncs/mail_conv_ngreet.ncs index 7dfca2dd..4fed7020 100644 Binary files a/_module/ncs/mail_conv_ngreet.ncs and b/_module/ncs/mail_conv_ngreet.ncs differ diff --git a/_module/ncs/mail_conv_nxtmsg.ncs b/_module/ncs/mail_conv_nxtmsg.ncs index 8dd0bc0e..e7734e06 100644 Binary files a/_module/ncs/mail_conv_nxtmsg.ncs and b/_module/ncs/mail_conv_nxtmsg.ncs differ diff --git a/_module/ncs/mail_conv_prev.ncs b/_module/ncs/mail_conv_prev.ncs index 6f2c869e..bfb75561 100644 Binary files a/_module/ncs/mail_conv_prev.ncs and b/_module/ncs/mail_conv_prev.ncs differ diff --git a/_module/ncs/mail_conv_showbm.ncs b/_module/ncs/mail_conv_showbm.ncs index b0f7191c..2496c0fa 100644 Binary files a/_module/ncs/mail_conv_showbm.ncs and b/_module/ncs/mail_conv_showbm.ncs differ diff --git a/_module/ncs/mail_conv_shown.ncs b/_module/ncs/mail_conv_shown.ncs index e0304ab7..16f81e4e 100644 Binary files a/_module/ncs/mail_conv_shown.ncs and b/_module/ncs/mail_conv_shown.ncs differ diff --git a/_module/ncs/mail_conv_shownm.ncs b/_module/ncs/mail_conv_shownm.ncs index ca40de2a..1e56e281 100644 Binary files a/_module/ncs/mail_conv_shownm.ncs and b/_module/ncs/mail_conv_shownm.ncs differ diff --git a/_module/ncs/mail_conv_showp.ncs b/_module/ncs/mail_conv_showp.ncs index 9c31bfe4..6ab503a8 100644 Binary files a/_module/ncs/mail_conv_showp.ncs and b/_module/ncs/mail_conv_showp.ncs differ diff --git a/_module/ncs/mail_convstart.ncs b/_module/ncs/mail_convstart.ncs index b092d3a5..95b7cbb5 100644 Binary files a/_module/ncs/mail_convstart.ncs and b/_module/ncs/mail_convstart.ncs differ diff --git a/_module/ncs/mail_deletemsg.ncs b/_module/ncs/mail_deletemsg.ncs index 698ca00e..dce71053 100644 Binary files a/_module/ncs/mail_deletemsg.ncs and b/_module/ncs/mail_deletemsg.ncs differ diff --git a/_module/ncs/mail_hasmb.ncs b/_module/ncs/mail_hasmb.ncs index 65f8d8a3..c8901f7f 100644 Binary files a/_module/ncs/mail_hasmb.ncs and b/_module/ncs/mail_hasmb.ncs differ diff --git a/_module/ncs/mail_hasnomb.ncs b/_module/ncs/mail_hasnomb.ncs index e3efc408..8e8437c3 100644 Binary files a/_module/ncs/mail_hasnomb.ncs and b/_module/ncs/mail_hasnomb.ncs differ diff --git a/_module/ncs/mail_listenoff.ncs b/_module/ncs/mail_listenoff.ncs index ab8b8c99..e7b6aab7 100644 Binary files a/_module/ncs/mail_listenoff.ncs and b/_module/ncs/mail_listenoff.ncs differ diff --git a/_module/ncs/mail_listenon.ncs b/_module/ncs/mail_listenon.ncs index e02b5926..9e25bf1b 100644 Binary files a/_module/ncs/mail_listenon.ncs and b/_module/ncs/mail_listenon.ncs differ diff --git a/_module/ncs/mail_markunread.ncs b/_module/ncs/mail_markunread.ncs index 33489910..deeaead0 100644 Binary files a/_module/ncs/mail_markunread.ncs and b/_module/ncs/mail_markunread.ncs differ diff --git a/_module/ncs/mail_mb_config.ncs b/_module/ncs/mail_mb_config.ncs index dd77a5cf..be84e954 100644 Binary files a/_module/ncs/mail_mb_config.ncs and b/_module/ncs/mail_mb_config.ncs differ diff --git a/_module/ncs/mail_mb_display.ncs b/_module/ncs/mail_mb_display.ncs index 7b6c0b85..fea13124 100644 Binary files a/_module/ncs/mail_mb_display.ncs and b/_module/ncs/mail_mb_display.ncs differ diff --git a/_module/ncs/mail_mb_setup.ncs b/_module/ncs/mail_mb_setup.ncs index d8e60e69..4e1bbf3b 100644 Binary files a/_module/ncs/mail_mb_setup.ncs and b/_module/ncs/mail_mb_setup.ncs differ diff --git a/_module/ncs/mail_onconv.ncs b/_module/ncs/mail_onconv.ncs index e4866e96..99d44ba2 100644 Binary files a/_module/ncs/mail_onconv.ncs and b/_module/ncs/mail_onconv.ncs differ diff --git a/_module/ncs/mail_preview.ncs b/_module/ncs/mail_preview.ncs index 0f7ebc30..4495d9ca 100644 Binary files a/_module/ncs/mail_preview.ncs and b/_module/ncs/mail_preview.ncs differ diff --git a/_module/ncs/mail_reply.ncs b/_module/ncs/mail_reply.ncs index ad5a248a..573a5e61 100644 Binary files a/_module/ncs/mail_reply.ncs and b/_module/ncs/mail_reply.ncs differ diff --git a/_module/ncs/mail_send.ncs b/_module/ncs/mail_send.ncs index 5551893b..388bb82f 100644 Binary files a/_module/ncs/mail_send.ncs and b/_module/ncs/mail_send.ncs differ diff --git a/_module/ncs/mail_show01.ncs b/_module/ncs/mail_show01.ncs index 7469f25b..77f03b9e 100644 Binary files a/_module/ncs/mail_show01.ncs and b/_module/ncs/mail_show01.ncs differ diff --git a/_module/ncs/mail_show02.ncs b/_module/ncs/mail_show02.ncs index 16b74c39..4982f79e 100644 Binary files a/_module/ncs/mail_show02.ncs and b/_module/ncs/mail_show02.ncs differ diff --git a/_module/ncs/mail_show03.ncs b/_module/ncs/mail_show03.ncs index 260ba661..63e1caf1 100644 Binary files a/_module/ncs/mail_show03.ncs and b/_module/ncs/mail_show03.ncs differ diff --git a/_module/ncs/mail_show04.ncs b/_module/ncs/mail_show04.ncs index ba491997..cf8921ff 100644 Binary files a/_module/ncs/mail_show04.ncs and b/_module/ncs/mail_show04.ncs differ diff --git a/_module/ncs/mail_show05.ncs b/_module/ncs/mail_show05.ncs index 61817421..48f108d3 100644 Binary files a/_module/ncs/mail_show05.ncs and b/_module/ncs/mail_show05.ncs differ diff --git a/_module/ncs/mail_show06.ncs b/_module/ncs/mail_show06.ncs index b03dbab0..05060f15 100644 Binary files a/_module/ncs/mail_show06.ncs and b/_module/ncs/mail_show06.ncs differ diff --git a/_module/ncs/mail_show07.ncs b/_module/ncs/mail_show07.ncs index d4f627b5..7a7d6732 100644 Binary files a/_module/ncs/mail_show07.ncs and b/_module/ncs/mail_show07.ncs differ diff --git a/_module/ncs/mail_show08.ncs b/_module/ncs/mail_show08.ncs index b5fe9607..dd05ce92 100644 Binary files a/_module/ncs/mail_show08.ncs and b/_module/ncs/mail_show08.ncs differ diff --git a/_module/ncs/mail_show09.ncs b/_module/ncs/mail_show09.ncs index 1e104dc5..bcb6ea2a 100644 Binary files a/_module/ncs/mail_show09.ncs and b/_module/ncs/mail_show09.ncs differ diff --git a/_module/ncs/mail_show10.ncs b/_module/ncs/mail_show10.ncs index f6c95ec8..7b98c24d 100644 Binary files a/_module/ncs/mail_show10.ncs and b/_module/ncs/mail_show10.ncs differ diff --git a/_module/ncs/mail_showmessage.ncs b/_module/ncs/mail_showmessage.ncs index 11953ad1..e64eefed 100644 Binary files a/_module/ncs/mail_showmessage.ncs and b/_module/ncs/mail_showmessage.ncs differ diff --git a/_module/ncs/mail_subject.ncs b/_module/ncs/mail_subject.ncs index 6cdfd7c5..19b28d07 100644 Binary files a/_module/ncs/mail_subject.ncs and b/_module/ncs/mail_subject.ncs differ diff --git a/_module/ncs/merchant_arm_5k.ncs b/_module/ncs/merchant_arm_5k.ncs index 7689a596..b58d34e7 100644 Binary files a/_module/ncs/merchant_arm_5k.ncs and b/_module/ncs/merchant_arm_5k.ncs differ diff --git a/_module/ncs/merchant_bow_5k.ncs b/_module/ncs/merchant_bow_5k.ncs index f72044c2..64ee447e 100644 Binary files a/_module/ncs/merchant_bow_5k.ncs and b/_module/ncs/merchant_bow_5k.ncs differ diff --git a/_module/ncs/merchant_gen_5k.ncs b/_module/ncs/merchant_gen_5k.ncs index a5411447..03842056 100644 Binary files a/_module/ncs/merchant_gen_5k.ncs and b/_module/ncs/merchant_gen_5k.ncs differ diff --git a/_module/ncs/merchant_mag_5k.ncs b/_module/ncs/merchant_mag_5k.ncs index f0f81b0e..d85844d4 100644 Binary files a/_module/ncs/merchant_mag_5k.ncs and b/_module/ncs/merchant_mag_5k.ncs differ diff --git a/_module/ncs/merchant_reset5k.ncs b/_module/ncs/merchant_reset5k.ncs index 5ed55529..1a19e9d9 100644 Binary files a/_module/ncs/merchant_reset5k.ncs and b/_module/ncs/merchant_reset5k.ncs differ diff --git a/_module/ncs/merchant_scr2k.ncs b/_module/ncs/merchant_scr2k.ncs index fce981b9..edd0b5e7 100644 Binary files a/_module/ncs/merchant_scr2k.ncs and b/_module/ncs/merchant_scr2k.ncs differ diff --git a/_module/ncs/merchant_thief2k.ncs b/_module/ncs/merchant_thief2k.ncs index 7201d5e5..12bbe997 100644 Binary files a/_module/ncs/merchant_thief2k.ncs and b/_module/ncs/merchant_thief2k.ncs differ diff --git a/_module/ncs/mm_prc_spells.ncs b/_module/ncs/mm_prc_spells.ncs index 97d42c9d..5b28b9ed 100644 Binary files a/_module/ncs/mm_prc_spells.ncs and b/_module/ncs/mm_prc_spells.ncs differ diff --git a/_module/ncs/move_hcave_b.ncs b/_module/ncs/move_hcave_b.ncs index 58f1820b..e70a33f8 100644 Binary files a/_module/ncs/move_hcave_b.ncs and b/_module/ncs/move_hcave_b.ncs differ diff --git a/_module/ncs/mud_golem_ondam.ncs b/_module/ncs/mud_golem_ondam.ncs index a0881675..bd8e4ce7 100644 Binary files a/_module/ncs/mud_golem_ondam.ncs and b/_module/ncs/mud_golem_ondam.ncs differ diff --git a/_module/ncs/multiple_mob_att.ncs b/_module/ncs/multiple_mob_att.ncs index 40b8f917..ac093f06 100644 Binary files a/_module/ncs/multiple_mob_att.ncs and b/_module/ncs/multiple_mob_att.ncs differ diff --git a/_module/ncs/no_ai_atk.ncs b/_module/ncs/no_ai_atk.ncs index b8d5c373..14d413bd 100644 Binary files a/_module/ncs/no_ai_atk.ncs and b/_module/ncs/no_ai_atk.ncs differ diff --git a/_module/ncs/no_ai_cmb.ncs b/_module/ncs/no_ai_cmb.ncs index 248a563e..d65c40a1 100644 Binary files a/_module/ncs/no_ai_cmb.ncs and b/_module/ncs/no_ai_cmb.ncs differ diff --git a/_module/ncs/no_ai_cnv.ncs b/_module/ncs/no_ai_cnv.ncs index 8fdb892a..df0f0007 100644 Binary files a/_module/ncs/no_ai_cnv.ncs and b/_module/ncs/no_ai_cnv.ncs differ diff --git a/_module/ncs/no_ai_dam.ncs b/_module/ncs/no_ai_dam.ncs index 7689955f..3846ac18 100644 Binary files a/_module/ncs/no_ai_dam.ncs and b/_module/ncs/no_ai_dam.ncs differ diff --git a/_module/ncs/no_ai_dis.ncs b/_module/ncs/no_ai_dis.ncs index 0b32af12..401c644d 100644 Binary files a/_module/ncs/no_ai_dis.ncs and b/_module/ncs/no_ai_dis.ncs differ diff --git a/_module/ncs/no_ai_dth.ncs b/_module/ncs/no_ai_dth.ncs index 8d665f04..a721fc2f 100644 Binary files a/_module/ncs/no_ai_dth.ncs and b/_module/ncs/no_ai_dth.ncs differ diff --git a/_module/ncs/no_ai_hrt.ncs b/_module/ncs/no_ai_hrt.ncs index de658fa5..6a1e4065 100644 Binary files a/_module/ncs/no_ai_hrt.ncs and b/_module/ncs/no_ai_hrt.ncs differ diff --git a/_module/ncs/no_ai_per.ncs b/_module/ncs/no_ai_per.ncs index cf762372..4aec1641 100644 Binary files a/_module/ncs/no_ai_per.ncs and b/_module/ncs/no_ai_per.ncs differ diff --git a/_module/ncs/no_ai_spt.ncs b/_module/ncs/no_ai_spt.ncs index aadb3de9..98b3650e 100644 Binary files a/_module/ncs/no_ai_spt.ncs and b/_module/ncs/no_ai_spt.ncs differ diff --git a/_module/ncs/no_scr_shutdown.ncs b/_module/ncs/no_scr_shutdown.ncs index f3f3bf86..81dc6697 100644 Binary files a/_module/ncs/no_scr_shutdown.ncs and b/_module/ncs/no_scr_shutdown.ncs differ diff --git a/_module/ncs/no_spn_beh.ncs b/_module/ncs/no_spn_beh.ncs index 6cedacee..c91dafda 100644 Binary files a/_module/ncs/no_spn_beh.ncs and b/_module/ncs/no_spn_beh.ncs differ diff --git a/_module/ncs/no_spn_clr.ncs b/_module/ncs/no_spn_clr.ncs index 5405b084..910bf7b7 100644 Binary files a/_module/ncs/no_spn_clr.ncs and b/_module/ncs/no_spn_clr.ncs differ diff --git a/_module/ncs/no_spn_fiend.ncs b/_module/ncs/no_spn_fiend.ncs index 71d690ea..23a7b271 100644 Binary files a/_module/ncs/no_spn_fiend.ncs and b/_module/ncs/no_spn_fiend.ncs differ diff --git a/_module/ncs/no_spn_ftr.ncs b/_module/ncs/no_spn_ftr.ncs index 815f872a..a8d265e0 100644 Binary files a/_module/ncs/no_spn_ftr.ncs and b/_module/ncs/no_spn_ftr.ncs differ diff --git a/_module/ncs/no_spn_ftrfire.ncs b/_module/ncs/no_spn_ftrfire.ncs index 0823ac04..f760a52f 100644 Binary files a/_module/ncs/no_spn_ftrfire.ncs and b/_module/ncs/no_spn_ftrfire.ncs differ diff --git a/_module/ncs/no_spn_ftrsize.ncs b/_module/ncs/no_spn_ftrsize.ncs index 0823ac04..f760a52f 100644 Binary files a/_module/ncs/no_spn_ftrsize.ncs and b/_module/ncs/no_spn_ftrsize.ncs differ diff --git a/_module/ncs/no_spn_ftrwater.ncs b/_module/ncs/no_spn_ftrwater.ncs index 0f3ce6fe..6e943907 100644 Binary files a/_module/ncs/no_spn_ftrwater.ncs and b/_module/ncs/no_spn_ftrwater.ncs differ diff --git a/_module/ncs/no_spn_ftrwood.ncs b/_module/ncs/no_spn_ftrwood.ncs index 521f8896..df3e3c61 100644 Binary files a/_module/ncs/no_spn_ftrwood.ncs and b/_module/ncs/no_spn_ftrwood.ncs differ diff --git a/_module/ncs/no_spn_melcast1.ncs b/_module/ncs/no_spn_melcast1.ncs index 50fde0a8..177a623e 100644 Binary files a/_module/ncs/no_spn_melcast1.ncs and b/_module/ncs/no_spn_melcast1.ncs differ diff --git a/_module/ncs/no_spn_melcast2.ncs b/_module/ncs/no_spn_melcast2.ncs index 0f12cfba..d476cc09 100644 Binary files a/_module/ncs/no_spn_melcast2.ncs and b/_module/ncs/no_spn_melcast2.ncs differ diff --git a/_module/ncs/no_spn_melcast3.ncs b/_module/ncs/no_spn_melcast3.ncs index f56f1f43..969dd6c4 100644 Binary files a/_module/ncs/no_spn_melcast3.ncs and b/_module/ncs/no_spn_melcast3.ncs differ diff --git a/_module/ncs/no_spn_melenh.ncs b/_module/ncs/no_spn_melenh.ncs index 7d273eac..f7912312 100644 Binary files a/_module/ncs/no_spn_melenh.ncs and b/_module/ncs/no_spn_melenh.ncs differ diff --git a/_module/ncs/no_spn_rftr.ncs b/_module/ncs/no_spn_rftr.ncs index 7e5956cb..83bbd1cb 100644 Binary files a/_module/ncs/no_spn_rftr.ncs and b/_module/ncs/no_spn_rftr.ncs differ diff --git a/_module/ncs/no_spn_rftrcast1.ncs b/_module/ncs/no_spn_rftrcast1.ncs index 49d6eb34..4cf852e0 100644 Binary files a/_module/ncs/no_spn_rftrcast1.ncs and b/_module/ncs/no_spn_rftrcast1.ncs differ diff --git a/_module/ncs/no_spn_rngcast3.ncs b/_module/ncs/no_spn_rngcast3.ncs index dcc56bfe..cf2e8e25 100644 Binary files a/_module/ncs/no_spn_rngcast3.ncs and b/_module/ncs/no_spn_rngcast3.ncs differ diff --git a/_module/ncs/no_spn_rngt1comm.ncs b/_module/ncs/no_spn_rngt1comm.ncs index b4c0b79c..864fb382 100644 Binary files a/_module/ncs/no_spn_rngt1comm.ncs and b/_module/ncs/no_spn_rngt1comm.ncs differ diff --git a/_module/ncs/no_spn_rngt2comm.ncs b/_module/ncs/no_spn_rngt2comm.ncs index dfc84423..085365a0 100644 Binary files a/_module/ncs/no_spn_rngt2comm.ncs and b/_module/ncs/no_spn_rngt2comm.ncs differ diff --git a/_module/ncs/no_spn_rngt3comm.ncs b/_module/ncs/no_spn_rngt3comm.ncs index fc90f24c..9921c4c5 100644 Binary files a/_module/ncs/no_spn_rngt3comm.ncs and b/_module/ncs/no_spn_rngt3comm.ncs differ diff --git a/_module/ncs/no_spn_rog.ncs b/_module/ncs/no_spn_rog.ncs index f61ca2e6..4c1d7d71 100644 Binary files a/_module/ncs/no_spn_rog.ncs and b/_module/ncs/no_spn_rog.ncs differ diff --git a/_module/ncs/no_spn_rogcast1.ncs b/_module/ncs/no_spn_rogcast1.ncs index 5add8ace..5bc99543 100644 Binary files a/_module/ncs/no_spn_rogcast1.ncs and b/_module/ncs/no_spn_rogcast1.ncs differ diff --git a/_module/ncs/no_spn_rogcast3.ncs b/_module/ncs/no_spn_rogcast3.ncs index 1ad31d08..aee05d1b 100644 Binary files a/_module/ncs/no_spn_rogcast3.ncs and b/_module/ncs/no_spn_rogcast3.ncs differ diff --git a/_module/ncs/no_spn_rogenh.ncs b/_module/ncs/no_spn_rogenh.ncs index cb774385..f6e82e92 100644 Binary files a/_module/ncs/no_spn_rogenh.ncs and b/_module/ncs/no_spn_rogenh.ncs differ diff --git a/_module/ncs/no_spn_rogtel.ncs b/_module/ncs/no_spn_rogtel.ncs index 9a41af84..0372d0c4 100644 Binary files a/_module/ncs/no_spn_rogtel.ncs and b/_module/ncs/no_spn_rogtel.ncs differ diff --git a/_module/ncs/no_spn_summ.ncs b/_module/ncs/no_spn_summ.ncs index d19c4073..af05ad85 100644 Binary files a/_module/ncs/no_spn_summ.ncs and b/_module/ncs/no_spn_summ.ncs differ diff --git a/_module/ncs/no_spn_wiz.ncs b/_module/ncs/no_spn_wiz.ncs index 0d277262..0d97f458 100644 Binary files a/_module/ncs/no_spn_wiz.ncs and b/_module/ncs/no_spn_wiz.ncs differ diff --git a/_module/ncs/noticeboard_glow.ncs b/_module/ncs/noticeboard_glow.ncs index 85ac0ae4..11a3247c 100644 Binary files a/_module/ncs/noticeboard_glow.ncs and b/_module/ncs/noticeboard_glow.ncs differ diff --git a/_module/ncs/npc_rndwayp_go.ncs b/_module/ncs/npc_rndwayp_go.ncs index f18e9e86..9c72861b 100644 Binary files a/_module/ncs/npc_rndwayp_go.ncs and b/_module/ncs/npc_rndwayp_go.ncs differ diff --git a/_module/ncs/npc_sit_chair.ncs b/_module/ncs/npc_sit_chair.ncs index af3e671e..012224cc 100644 Binary files a/_module/ncs/npc_sit_chair.ncs and b/_module/ncs/npc_sit_chair.ncs differ diff --git a/_module/ncs/npc_sit_stay.ncs b/_module/ncs/npc_sit_stay.ncs index 1d813bba..345a4aec 100644 Binary files a/_module/ncs/npc_sit_stay.ncs and b/_module/ncs/npc_sit_stay.ncs differ diff --git a/_module/ncs/npc_sit_woodenbe.ncs b/_module/ncs/npc_sit_woodenbe.ncs index a60a533c..a1445c42 100644 Binary files a/_module/ncs/npc_sit_woodenbe.ncs and b/_module/ncs/npc_sit_woodenbe.ncs differ diff --git a/_module/ncs/nw_c2_9icewraith.ncs b/_module/ncs/nw_c2_9icewraith.ncs index cc84172d..e9b4973c 100644 Binary files a/_module/ncs/nw_c2_9icewraith.ncs and b/_module/ncs/nw_c2_9icewraith.ncs differ diff --git a/_module/ncs/nw_c2_9itigwrait.ncs b/_module/ncs/nw_c2_9itigwrait.ncs index 847fe0e3..15e6aae1 100644 Binary files a/_module/ncs/nw_c2_9itigwrait.ncs and b/_module/ncs/nw_c2_9itigwrait.ncs differ diff --git a/_module/ncs/nw_c2_bossdie.ncs b/_module/ncs/nw_c2_bossdie.ncs index 84781c5c..76814872 100644 Binary files a/_module/ncs/nw_c2_bossdie.ncs and b/_module/ncs/nw_c2_bossdie.ncs differ diff --git a/_module/ncs/nw_c2_bossspawn.ncs b/_module/ncs/nw_c2_bossspawn.ncs index dd738bd1..c6dcde5d 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_defaul1b.ncs b/_module/ncs/nw_c2_defaul1b.ncs index 42b684ad..cfe7ff45 100644 Binary files a/_module/ncs/nw_c2_defaul1b.ncs and b/_module/ncs/nw_c2_defaul1b.ncs differ diff --git a/_module/ncs/nw_c2_defaul4.ncs b/_module/ncs/nw_c2_defaul4.ncs index 1e8ea573..d9a94efd 100644 Binary files a/_module/ncs/nw_c2_defaul4.ncs and b/_module/ncs/nw_c2_defaul4.ncs differ diff --git a/_module/ncs/nw_c2_default1.ncs b/_module/ncs/nw_c2_default1.ncs index b2439bfc..93f87104 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 cebb6f20..c2e21701 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 36e8755b..6e293baa 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 e924bf00..78034c8b 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 21d30294..ccb39179 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 925dccde..fe5f7d69 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_default7_g.ncs b/_module/ncs/nw_c2_default7_g.ncs index 80bf6d6c..85a0762f 100644 Binary files a/_module/ncs/nw_c2_default7_g.ncs and b/_module/ncs/nw_c2_default7_g.ncs differ diff --git a/_module/ncs/nw_c2_default8.ncs b/_module/ncs/nw_c2_default8.ncs index af3c96cc..3d882b4a 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_default9_a.ncs b/_module/ncs/nw_c2_default9_a.ncs index b8c9b841..ee891aae 100644 Binary files a/_module/ncs/nw_c2_default9_a.ncs and b/_module/ncs/nw_c2_default9_a.ncs differ diff --git a/_module/ncs/nw_c2_default9_r.ncs b/_module/ncs/nw_c2_default9_r.ncs index 3388d2d2..ecea6fe5 100644 Binary files a/_module/ncs/nw_c2_default9_r.ncs and b/_module/ncs/nw_c2_default9_r.ncs differ diff --git a/_module/ncs/nw_c2_default9_t.ncs b/_module/ncs/nw_c2_default9_t.ncs index 52f90dc1..493bdc91 100644 Binary files a/_module/ncs/nw_c2_default9_t.ncs and b/_module/ncs/nw_c2_default9_t.ncs differ diff --git a/_module/ncs/nw_c2_default9gh.ncs b/_module/ncs/nw_c2_default9gh.ncs index e61a62de..58e85287 100644 Binary files a/_module/ncs/nw_c2_default9gh.ncs and b/_module/ncs/nw_c2_default9gh.ncs differ diff --git a/_module/ncs/nw_c2_default9pr.ncs b/_module/ncs/nw_c2_default9pr.ncs index 353c8e9c..2adae9f5 100644 Binary files a/_module/ncs/nw_c2_default9pr.ncs and b/_module/ncs/nw_c2_default9pr.ncs differ diff --git a/_module/ncs/nw_c2_default9si.ncs b/_module/ncs/nw_c2_default9si.ncs index 99b85b8f..8ff96f68 100644 Binary files a/_module/ncs/nw_c2_default9si.ncs and b/_module/ncs/nw_c2_default9si.ncs differ diff --git a/_module/ncs/nw_c2_defaultb.ncs b/_module/ncs/nw_c2_defaultb.ncs index ca34e09b..8af3f397 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_c2_defaulte.ncs b/_module/ncs/nw_c2_defaulte.ncs index 5876b028..4843b219 100644 Binary files a/_module/ncs/nw_c2_defaulte.ncs and b/_module/ncs/nw_c2_defaulte.ncs differ diff --git a/_module/ncs/nw_c2_dimdoors.ncs b/_module/ncs/nw_c2_dimdoors.ncs index 1bc1b2cc..30c0232f 100644 Binary files a/_module/ncs/nw_c2_dimdoors.ncs and b/_module/ncs/nw_c2_dimdoors.ncs differ diff --git a/_module/ncs/nw_c2_fastbuff9.ncs b/_module/ncs/nw_c2_fastbuff9.ncs index d4cb570c..7b498e60 100644 Binary files a/_module/ncs/nw_c2_fastbuff9.ncs and b/_module/ncs/nw_c2_fastbuff9.ncs differ diff --git a/_module/ncs/nw_c2_herbivore.ncs b/_module/ncs/nw_c2_herbivore.ncs index 478d0c73..6ac7ea3e 100644 Binary files a/_module/ncs/nw_c2_herbivore.ncs and b/_module/ncs/nw_c2_herbivore.ncs differ diff --git a/_module/ncs/nw_c2_herbivore2.ncs b/_module/ncs/nw_c2_herbivore2.ncs index 478d0c73..6ac7ea3e 100644 Binary files a/_module/ncs/nw_c2_herbivore2.ncs and b/_module/ncs/nw_c2_herbivore2.ncs differ diff --git a/_module/ncs/nw_c2_highai.ncs b/_module/ncs/nw_c2_highai.ncs index af540c34..5fad9b06 100644 Binary files a/_module/ncs/nw_c2_highai.ncs and b/_module/ncs/nw_c2_highai.ncs differ diff --git a/_module/ncs/nw_c2_shadow9.ncs b/_module/ncs/nw_c2_shadow9.ncs index cf0a36bf..b7d8ea74 100644 Binary files a/_module/ncs/nw_c2_shadow9.ncs and b/_module/ncs/nw_c2_shadow9.ncs differ diff --git a/_module/ncs/nw_c2_water9.ncs b/_module/ncs/nw_c2_water9.ncs index f8fc7ff2..ef4aca64 100644 Binary files a/_module/ncs/nw_c2_water9.ncs and b/_module/ncs/nw_c2_water9.ncs differ diff --git a/_module/ncs/nw_c2_water9b.ncs b/_module/ncs/nw_c2_water9b.ncs index bdbebb87..b1289da4 100644 Binary files a/_module/ncs/nw_c2_water9b.ncs and b/_module/ncs/nw_c2_water9b.ncs differ diff --git a/_module/ncs/nw_ch_ac1.ncs b/_module/ncs/nw_ch_ac1.ncs index ba260b23..8e81f71a 100644 Binary files a/_module/ncs/nw_ch_ac1.ncs and b/_module/ncs/nw_ch_ac1.ncs differ diff --git a/_module/ncs/nw_ch_ac2.ncs b/_module/ncs/nw_ch_ac2.ncs index e02c855b..7b0ec450 100644 Binary files a/_module/ncs/nw_ch_ac2.ncs and b/_module/ncs/nw_ch_ac2.ncs differ diff --git a/_module/ncs/nw_ch_ac3.ncs b/_module/ncs/nw_ch_ac3.ncs index aa9d108e..bbce0f6d 100644 Binary files a/_module/ncs/nw_ch_ac3.ncs and b/_module/ncs/nw_ch_ac3.ncs differ diff --git a/_module/ncs/nw_ch_ac4.ncs b/_module/ncs/nw_ch_ac4.ncs index 0edc03ce..47ffe2dc 100644 Binary files a/_module/ncs/nw_ch_ac4.ncs and b/_module/ncs/nw_ch_ac4.ncs differ diff --git a/_module/ncs/nw_ch_ac5.ncs b/_module/ncs/nw_ch_ac5.ncs index df1e19c5..67aeca38 100644 Binary files a/_module/ncs/nw_ch_ac5.ncs and b/_module/ncs/nw_ch_ac5.ncs differ diff --git a/_module/ncs/nw_ch_ac6.ncs b/_module/ncs/nw_ch_ac6.ncs index ce42943e..266ebcd2 100644 Binary files a/_module/ncs/nw_ch_ac6.ncs and b/_module/ncs/nw_ch_ac6.ncs differ diff --git a/_module/ncs/nw_ch_ac8.ncs b/_module/ncs/nw_ch_ac8.ncs index 1f8f4677..25424e5c 100644 Binary files a/_module/ncs/nw_ch_ac8.ncs and b/_module/ncs/nw_ch_ac8.ncs differ diff --git a/_module/ncs/nw_ch_aca.ncs b/_module/ncs/nw_ch_aca.ncs index 9215c812..592e5279 100644 Binary files a/_module/ncs/nw_ch_aca.ncs and b/_module/ncs/nw_ch_aca.ncs differ diff --git a/_module/ncs/nw_ch_acb.ncs b/_module/ncs/nw_ch_acb.ncs index ff643f75..7ac2f274 100644 Binary files a/_module/ncs/nw_ch_acb.ncs and b/_module/ncs/nw_ch_acb.ncs differ diff --git a/_module/ncs/nw_ch_ace.ncs b/_module/ncs/nw_ch_ace.ncs index 04b458a1..4c3ddb6b 100644 Binary files a/_module/ncs/nw_ch_ace.ncs and b/_module/ncs/nw_ch_ace.ncs differ diff --git a/_module/ncs/nw_ch_heal_75.ncs b/_module/ncs/nw_ch_heal_75.ncs index 0de1bd08..b2ce6b26 100644 Binary files a/_module/ncs/nw_ch_heal_75.ncs and b/_module/ncs/nw_ch_heal_75.ncs differ diff --git a/_module/ncs/nw_ch_summon_9.ncs b/_module/ncs/nw_ch_summon_9.ncs index 3f2a89ca..63be4324 100644 Binary files a/_module/ncs/nw_ch_summon_9.ncs and b/_module/ncs/nw_ch_summon_9.ncs differ diff --git a/_module/ncs/nw_o2_boss.ncs b/_module/ncs/nw_o2_boss.ncs index 586fa995..a3d51d0c 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 100d8c1f..83378b73 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 5bbe7343..a2c8928f 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 72b50dc8..cc4ab6d3 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 2fec0ac0..74c9f3ef 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_undyingspawn.ncs b/_module/ncs/nw_undyingspawn.ncs index 2598afe9..cf2e3942 100644 Binary files a/_module/ncs/nw_undyingspawn.ncs and b/_module/ncs/nw_undyingspawn.ncs differ diff --git a/_module/ncs/oldman_sit.ncs b/_module/ncs/oldman_sit.ncs index af82262e..bfb1bdd5 100644 Binary files a/_module/ncs/oldman_sit.ncs and b/_module/ncs/oldman_sit.ncs differ diff --git a/_module/ncs/olina_ck_ball.ncs b/_module/ncs/olina_ck_ball.ncs index 8f9c6d4e..19c3c9dc 100644 Binary files a/_module/ncs/olina_ck_ball.ncs and b/_module/ncs/olina_ck_ball.ncs differ diff --git a/_module/ncs/olinaleave.ncs b/_module/ncs/olinaleave.ncs index 75ef2f16..81982f50 100644 Binary files a/_module/ncs/olinaleave.ncs and b/_module/ncs/olinaleave.ncs differ diff --git a/_module/ncs/on_close.ncs b/_module/ncs/on_close.ncs index 08443934..2d3ef2cf 100644 Binary files a/_module/ncs/on_close.ncs and b/_module/ncs/on_close.ncs differ diff --git a/_module/ncs/on_damage_dr.ncs b/_module/ncs/on_damage_dr.ncs index 58e1e584..ce47bac3 100644 Binary files a/_module/ncs/on_damage_dr.ncs and b/_module/ncs/on_damage_dr.ncs differ diff --git a/_module/ncs/on_death_yin.ncs b/_module/ncs/on_death_yin.ncs index 2a573df4..0e1fd230 100644 Binary files a/_module/ncs/on_death_yin.ncs and b/_module/ncs/on_death_yin.ncs differ diff --git a/_module/ncs/on_deathyang.ncs b/_module/ncs/on_deathyang.ncs index 35ac27d4..ebf6d7f3 100644 Binary files a/_module/ncs/on_deathyang.ncs and b/_module/ncs/on_deathyang.ncs differ diff --git a/_module/ncs/on_open.ncs b/_module/ncs/on_open.ncs index 2a96c023..3aaf761c 100644 Binary files a/_module/ncs/on_open.ncs and b/_module/ncs/on_open.ncs differ diff --git a/_module/ncs/on_pubsub.ncs b/_module/ncs/on_pubsub.ncs new file mode 100644 index 00000000..6b9dd2fb Binary files /dev/null and b/_module/ncs/on_pubsub.ncs differ diff --git a/_module/ncs/on_sit_bench_2.ncs b/_module/ncs/on_sit_bench_2.ncs index 22e3c3e4..fc564f03 100644 Binary files a/_module/ncs/on_sit_bench_2.ncs and b/_module/ncs/on_sit_bench_2.ncs differ diff --git a/_module/ncs/on_spawn_wander.ncs b/_module/ncs/on_spawn_wander.ncs index 3ca5daf5..3bcca77c 100644 Binary files a/_module/ncs/on_spawn_wander.ncs and b/_module/ncs/on_spawn_wander.ncs differ diff --git a/_module/ncs/ondeath_thief.ncs b/_module/ncs/ondeath_thief.ncs index 4779c4d7..026a25cd 100644 Binary files a/_module/ncs/ondeath_thief.ncs and b/_module/ncs/ondeath_thief.ncs differ diff --git a/_module/ncs/onent_beamoff.ncs b/_module/ncs/onent_beamoff.ncs index 7f48287e..8ba5c2c7 100644 Binary files a/_module/ncs/onent_beamoff.ncs and b/_module/ncs/onent_beamoff.ncs differ diff --git a/_module/ncs/onent_beamon.ncs b/_module/ncs/onent_beamon.ncs index 14cc59e8..78adf8da 100644 Binary files a/_module/ncs/onent_beamon.ncs and b/_module/ncs/onent_beamon.ncs differ diff --git a/_module/ncs/onent_beamzone.ncs b/_module/ncs/onent_beamzone.ncs index 209af2aa..ee40f054 100644 Binary files a/_module/ncs/onent_beamzone.ncs and b/_module/ncs/onent_beamzone.ncs differ diff --git a/_module/ncs/onuse_beamlever.ncs b/_module/ncs/onuse_beamlever.ncs index 2ec1d759..a7533ce6 100644 Binary files a/_module/ncs/onuse_beamlever.ncs and b/_module/ncs/onuse_beamlever.ncs differ diff --git a/_module/ncs/open_attack_pc.ncs b/_module/ncs/open_attack_pc.ncs index c2bb284c..7c711b26 100644 Binary files a/_module/ncs/open_attack_pc.ncs and b/_module/ncs/open_attack_pc.ncs differ diff --git a/_module/ncs/pac_haunt.ncs b/_module/ncs/pac_haunt.ncs index 1f6c12a9..2ff45828 100644 Binary files a/_module/ncs/pac_haunt.ncs and b/_module/ncs/pac_haunt.ncs differ diff --git a/_module/ncs/pac_recreate.ncs b/_module/ncs/pac_recreate.ncs index 1ddeca1b..79d1c82f 100644 Binary files a/_module/ncs/pac_recreate.ncs and b/_module/ncs/pac_recreate.ncs differ diff --git a/_module/ncs/pass_onspawn1.ncs b/_module/ncs/pass_onspawn1.ncs index 03ff7144..3b5f1617 100644 Binary files a/_module/ncs/pass_onspawn1.ncs and b/_module/ncs/pass_onspawn1.ncs differ diff --git a/_module/ncs/pass_onspawn2.ncs b/_module/ncs/pass_onspawn2.ncs index e2c748b6..bfb6d900 100644 Binary files a/_module/ncs/pass_onspawn2.ncs and b/_module/ncs/pass_onspawn2.ncs differ diff --git a/_module/ncs/pathoflightring.ncs b/_module/ncs/pathoflightring.ncs index fac9371a..c2572d2f 100644 Binary files a/_module/ncs/pathoflightring.ncs and b/_module/ncs/pathoflightring.ncs differ diff --git a/_module/ncs/pc_savebuffs.ncs b/_module/ncs/pc_savebuffs.ncs index 94413251..b7876d8c 100644 Binary files a/_module/ncs/pc_savebuffs.ncs and b/_module/ncs/pc_savebuffs.ncs differ diff --git a/_module/ncs/pe_buffing.ncs b/_module/ncs/pe_buffing.ncs index 3eaeaea6..06d95ab4 100644 Binary files a/_module/ncs/pe_buffing.ncs and b/_module/ncs/pe_buffing.ncs differ diff --git a/_module/ncs/pe_crafting.ncs b/_module/ncs/pe_crafting.ncs index 6f7cb01c..ad5d12e3 100644 Binary files a/_module/ncs/pe_crafting.ncs and b/_module/ncs/pe_crafting.ncs differ diff --git a/_module/ncs/pe_debug.ncs b/_module/ncs/pe_debug.ncs index dd5e56f7..994d7657 100644 Binary files a/_module/ncs/pe_debug.ncs and b/_module/ncs/pe_debug.ncs differ diff --git a/_module/ncs/pe_henchmen.ncs b/_module/ncs/pe_henchmen.ncs index 7a61d32b..124f7708 100644 Binary files a/_module/ncs/pe_henchmen.ncs and b/_module/ncs/pe_henchmen.ncs differ diff --git a/_module/ncs/percive_thief.ncs b/_module/ncs/percive_thief.ncs index 894347fc..46abecbd 100644 Binary files a/_module/ncs/percive_thief.ncs and b/_module/ncs/percive_thief.ncs differ diff --git a/_module/ncs/perem_spawn.ncs b/_module/ncs/perem_spawn.ncs index 3b778b0f..ca8ad885 100644 Binary files a/_module/ncs/perem_spawn.ncs and b/_module/ncs/perem_spawn.ncs differ diff --git a/_module/ncs/perem_userd.ncs b/_module/ncs/perem_userd.ncs index 10226e13..b7f9c9c5 100644 Binary files a/_module/ncs/perem_userd.ncs and b/_module/ncs/perem_userd.ncs differ diff --git a/_module/ncs/pi_buffing.ncs b/_module/ncs/pi_buffing.ncs index e654f655..64924b1e 100644 Binary files a/_module/ncs/pi_buffing.ncs and b/_module/ncs/pi_buffing.ncs differ diff --git a/_module/ncs/pi_crafting.ncs b/_module/ncs/pi_crafting.ncs index 7ba191b5..6fc371e9 100644 Binary files a/_module/ncs/pi_crafting.ncs and b/_module/ncs/pi_crafting.ncs differ diff --git a/_module/ncs/pi_debug.ncs b/_module/ncs/pi_debug.ncs index 6230c0d2..e6a2f0ce 100644 Binary files a/_module/ncs/pi_debug.ncs and b/_module/ncs/pi_debug.ncs differ diff --git a/_module/ncs/pi_henchmen.ncs b/_module/ncs/pi_henchmen.ncs index f9c4726f..ffc14ced 100644 Binary files a/_module/ncs/pi_henchmen.ncs and b/_module/ncs/pi_henchmen.ncs differ diff --git a/_module/ncs/pillar_death1.ncs b/_module/ncs/pillar_death1.ncs index cbc98ca7..c1b3316c 100644 Binary files a/_module/ncs/pillar_death1.ncs and b/_module/ncs/pillar_death1.ncs differ diff --git a/_module/ncs/player_list.ncs b/_module/ncs/player_list.ncs index 29d470cd..7dca8f21 100644 Binary files a/_module/ncs/player_list.ncs and b/_module/ncs/player_list.ncs differ diff --git a/_module/ncs/port_irda.ncs b/_module/ncs/port_irda.ncs index 6f552704..f43712be 100644 Binary files a/_module/ncs/port_irda.ncs and b/_module/ncs/port_irda.ncs differ diff --git a/_module/ncs/port_nasgarth.ncs b/_module/ncs/port_nasgarth.ncs index 62eb0b1a..ceaee26d 100644 Binary files a/_module/ncs/port_nasgarth.ncs and b/_module/ncs/port_nasgarth.ncs differ diff --git a/_module/ncs/prc_pwondeath.ncs b/_module/ncs/prc_pwondeath.ncs index 29c0e053..7130fcc8 100644 Binary files a/_module/ncs/prc_pwondeath.ncs and b/_module/ncs/prc_pwondeath.ncs differ diff --git a/_module/ncs/prc_pwonspawn.ncs b/_module/ncs/prc_pwonspawn.ncs index 5dcb51e1..77a591cd 100644 Binary files a/_module/ncs/prc_pwonspawn.ncs and b/_module/ncs/prc_pwonspawn.ncs differ diff --git a/_module/ncs/prc_rest.ncs b/_module/ncs/prc_rest.ncs new file mode 100644 index 00000000..01502a16 Binary files /dev/null and b/_module/ncs/prc_rest.ncs differ diff --git a/_module/ncs/pro_dance.ncs b/_module/ncs/pro_dance.ncs index 4f12c90e..57f1bcee 100644 Binary files a/_module/ncs/pro_dance.ncs and b/_module/ncs/pro_dance.ncs differ diff --git a/_module/ncs/puke.ncs b/_module/ncs/puke.ncs index a60d3b8c..98574d35 100644 Binary files a/_module/ncs/puke.ncs and b/_module/ncs/puke.ncs differ diff --git a/_module/ncs/pureclass_check.ncs b/_module/ncs/pureclass_check.ncs index d1fc53a6..c2393fb3 100644 Binary files a/_module/ncs/pureclass_check.ncs and b/_module/ncs/pureclass_check.ncs differ diff --git a/_module/ncs/pw_sp_troll.ncs b/_module/ncs/pw_sp_troll.ncs index 5ba643db..b573ecc4 100644 Binary files a/_module/ncs/pw_sp_troll.ncs and b/_module/ncs/pw_sp_troll.ncs differ diff --git a/_module/ncs/pw_ude_troll.ncs b/_module/ncs/pw_ude_troll.ncs index a382410f..3fbf2333 100644 Binary files a/_module/ncs/pw_ude_troll.ncs and b/_module/ncs/pw_ude_troll.ncs differ diff --git a/_module/ncs/queen_sit.ncs b/_module/ncs/queen_sit.ncs index 958577d3..17ffd885 100644 Binary files a/_module/ncs/queen_sit.ncs and b/_module/ncs/queen_sit.ncs differ diff --git a/_module/ncs/queenspeak.ncs b/_module/ncs/queenspeak.ncs index 498e7d98..40e2a12a 100644 Binary files a/_module/ncs/queenspeak.ncs and b/_module/ncs/queenspeak.ncs differ diff --git a/_module/ncs/random_drop.ncs b/_module/ncs/random_drop.ncs index 876d71ce..3d1c2ae9 100644 Binary files a/_module/ncs/random_drop.ncs and b/_module/ncs/random_drop.ncs differ diff --git a/_module/ncs/random_drop2.ncs b/_module/ncs/random_drop2.ncs index 5e974455..918d8661 100644 Binary files a/_module/ncs/random_drop2.ncs and b/_module/ncs/random_drop2.ncs differ diff --git a/_module/ncs/random_drop_yy.ncs b/_module/ncs/random_drop_yy.ncs index 189cd1b3..f37628fd 100644 Binary files a/_module/ncs/random_drop_yy.ncs and b/_module/ncs/random_drop_yy.ncs differ diff --git a/_module/ncs/range_att_spawn.ncs b/_module/ncs/range_att_spawn.ncs index 3985e3fb..853812c4 100644 Binary files a/_module/ncs/range_att_spawn.ncs and b/_module/ncs/range_att_spawn.ncs differ diff --git a/_module/ncs/re_common_spawn.ncs b/_module/ncs/re_common_spawn.ncs index 8ce39697..2641e209 100644 Binary files a/_module/ncs/re_common_spawn.ncs and b/_module/ncs/re_common_spawn.ncs differ diff --git a/_module/ncs/re_comspawn_sitb.ncs b/_module/ncs/re_comspawn_sitb.ncs index 87ac6be7..272ad1fe 100644 Binary files a/_module/ncs/re_comspawn_sitb.ncs and b/_module/ncs/re_comspawn_sitb.ncs differ diff --git a/_module/ncs/re_comspawn_sitc.ncs b/_module/ncs/re_comspawn_sitc.ncs index cc8b227e..083592a2 100644 Binary files a/_module/ncs/re_comspawn_sitc.ncs and b/_module/ncs/re_comspawn_sitc.ncs differ diff --git a/_module/ncs/re_comspawn_sits.ncs b/_module/ncs/re_comspawn_sits.ncs index 02d75d67..c81dd2da 100644 Binary files a/_module/ncs/re_comspawn_sits.ncs and b/_module/ncs/re_comspawn_sits.ncs differ diff --git a/_module/ncs/re_comspawn_wayp.ncs b/_module/ncs/re_comspawn_wayp.ncs index b4eac049..5ccb6555 100644 Binary files a/_module/ncs/re_comspawn_wayp.ncs and b/_module/ncs/re_comspawn_wayp.ncs differ diff --git a/_module/ncs/re_comspawnfarm1.ncs b/_module/ncs/re_comspawnfarm1.ncs index eddc368e..0b7333de 100644 Binary files a/_module/ncs/re_comspawnfarm1.ncs and b/_module/ncs/re_comspawnfarm1.ncs differ diff --git a/_module/ncs/re_comspawnfarm2.ncs b/_module/ncs/re_comspawnfarm2.ncs index 6957a20e..8b9cdf6e 100644 Binary files a/_module/ncs/re_comspawnfarm2.ncs and b/_module/ncs/re_comspawnfarm2.ncs differ diff --git a/_module/ncs/re_comspawnfarm3.ncs b/_module/ncs/re_comspawnfarm3.ncs index d7641f5b..5923888f 100644 Binary files a/_module/ncs/re_comspawnfarm3.ncs and b/_module/ncs/re_comspawnfarm3.ncs differ diff --git a/_module/ncs/re_comspawnfarm4.ncs b/_module/ncs/re_comspawnfarm4.ncs index d5464ab5..b4701a3f 100644 Binary files a/_module/ncs/re_comspawnfarm4.ncs and b/_module/ncs/re_comspawnfarm4.ncs differ diff --git a/_module/ncs/re_comspawnfarm5.ncs b/_module/ncs/re_comspawnfarm5.ncs index 32b4a971..6de3559e 100644 Binary files a/_module/ncs/re_comspawnfarm5.ncs and b/_module/ncs/re_comspawnfarm5.ncs differ diff --git a/_module/ncs/re_rndwayp_go.ncs b/_module/ncs/re_rndwayp_go.ncs index 3f28d814..329f3860 100644 Binary files a/_module/ncs/re_rndwayp_go.ncs and b/_module/ncs/re_rndwayp_go.ncs differ diff --git a/_module/ncs/rh_ambush.ncs b/_module/ncs/rh_ambush.ncs index 2cf242d7..e8b3dac4 100644 Binary files a/_module/ncs/rh_ambush.ncs and b/_module/ncs/rh_ambush.ncs differ diff --git a/_module/ncs/rh_bladetrap.ncs b/_module/ncs/rh_bladetrap.ncs index 7b88a71c..8e32b18b 100644 Binary files a/_module/ncs/rh_bladetrap.ncs and b/_module/ncs/rh_bladetrap.ncs differ diff --git a/_module/ncs/rh_golem_attack.ncs b/_module/ncs/rh_golem_attack.ncs index 9d476267..ba4e8ef5 100644 Binary files a/_module/ncs/rh_golem_attack.ncs and b/_module/ncs/rh_golem_attack.ncs differ diff --git a/_module/ncs/rh_mirror_attack.ncs b/_module/ncs/rh_mirror_attack.ncs index eff4ff87..79354454 100644 Binary files a/_module/ncs/rh_mirror_attack.ncs and b/_module/ncs/rh_mirror_attack.ncs differ diff --git a/_module/ncs/rhgolem_buff.ncs b/_module/ncs/rhgolem_buff.ncs index 8453464b..f2fc6dea 100644 Binary files a/_module/ncs/rhgolem_buff.ncs and b/_module/ncs/rhgolem_buff.ncs differ diff --git a/_module/ncs/rhgolem_charm.ncs b/_module/ncs/rhgolem_charm.ncs index c7dedbf2..1f6de138 100644 Binary files a/_module/ncs/rhgolem_charm.ncs and b/_module/ncs/rhgolem_charm.ncs differ diff --git a/_module/ncs/rhgolem_threaten.ncs b/_module/ncs/rhgolem_threaten.ncs index 0450bc44..d187f7a4 100644 Binary files a/_module/ncs/rhgolem_threaten.ncs and b/_module/ncs/rhgolem_threaten.ncs differ diff --git a/_module/ncs/riftchest_abyss.ncs b/_module/ncs/riftchest_abyss.ncs index ce526ff8..8102fb9c 100644 Binary files a/_module/ncs/riftchest_abyss.ncs and b/_module/ncs/riftchest_abyss.ncs differ diff --git a/_module/ncs/riftchest_archon.ncs b/_module/ncs/riftchest_archon.ncs index 2d70c30e..ae81987e 100644 Binary files a/_module/ncs/riftchest_archon.ncs and b/_module/ncs/riftchest_archon.ncs differ diff --git a/_module/ncs/riftchest_celest.ncs b/_module/ncs/riftchest_celest.ncs index 4d044c20..eb06d4b9 100644 Binary files a/_module/ncs/riftchest_celest.ncs and b/_module/ncs/riftchest_celest.ncs differ diff --git a/_module/ncs/royalsealchk.ncs b/_module/ncs/royalsealchk.ncs index 8d8c6e96..c677bad6 100644 Binary files a/_module/ncs/royalsealchk.ncs and b/_module/ncs/royalsealchk.ncs differ diff --git a/_module/ncs/royalsealtake.ncs b/_module/ncs/royalsealtake.ncs index c6c04bd9..186648e2 100644 Binary files a/_module/ncs/royalsealtake.ncs and b/_module/ncs/royalsealtake.ncs differ diff --git a/_module/ncs/sarumguard_give.ncs b/_module/ncs/sarumguard_give.ncs index cd5101c5..1f5abf64 100644 Binary files a/_module/ncs/sarumguard_give.ncs and b/_module/ncs/sarumguard_give.ncs differ diff --git a/_module/ncs/sc_ra_rnd_dialog.ncs b/_module/ncs/sc_ra_rnd_dialog.ncs index d32f1f8e..e4f76333 100644 Binary files a/_module/ncs/sc_ra_rnd_dialog.ncs and b/_module/ncs/sc_ra_rnd_dialog.ncs differ diff --git a/_module/ncs/sc_ra_rnd_rumors.ncs b/_module/ncs/sc_ra_rnd_rumors.ncs index 4366a139..848d6801 100644 Binary files a/_module/ncs/sc_ra_rnd_rumors.ncs and b/_module/ncs/sc_ra_rnd_rumors.ncs differ diff --git a/_module/ncs/sec_dr_abandpass.ncs b/_module/ncs/sec_dr_abandpass.ncs index b328039d..183b3eb8 100644 Binary files a/_module/ncs/sec_dr_abandpass.ncs and b/_module/ncs/sec_dr_abandpass.ncs differ diff --git a/_module/ncs/sec_dr_hauntcave.ncs b/_module/ncs/sec_dr_hauntcave.ncs index 2460ae79..ffa20a88 100644 Binary files a/_module/ncs/sec_dr_hauntcave.ncs and b/_module/ncs/sec_dr_hauntcave.ncs differ diff --git a/_module/ncs/sei_sit.ncs b/_module/ncs/sei_sit.ncs index 794e5f14..ba8cb200 100644 Binary files a/_module/ncs/sei_sit.ncs and b/_module/ncs/sei_sit.ncs differ diff --git a/_module/ncs/shame_ck.ncs b/_module/ncs/shame_ck.ncs index 547965ab..e6cd3f71 100644 Binary files a/_module/ncs/shame_ck.ncs and b/_module/ncs/shame_ck.ncs differ diff --git a/_module/ncs/sitchair.ncs b/_module/ncs/sitchair.ncs index 719622f1..2ff54851 100644 Binary files a/_module/ncs/sitchair.ncs and b/_module/ncs/sitchair.ncs differ diff --git a/_module/ncs/sitchairbreak.ncs b/_module/ncs/sitchairbreak.ncs index c2daf2e1..d35ee80e 100644 Binary files a/_module/ncs/sitchairbreak.ncs and b/_module/ncs/sitchairbreak.ncs differ diff --git a/_module/ncs/sitchairfix.ncs b/_module/ncs/sitchairfix.ncs index e85cbb58..bce94f6f 100644 Binary files a/_module/ncs/sitchairfix.ncs and b/_module/ncs/sitchairfix.ncs differ diff --git a/_module/ncs/sitinchair.ncs b/_module/ncs/sitinchair.ncs index 22ed7777..97b79964 100644 Binary files a/_module/ncs/sitinchair.ncs and b/_module/ncs/sitinchair.ncs differ diff --git a/_module/ncs/sitspeak.ncs b/_module/ncs/sitspeak.ncs index a7d3af26..abff52a5 100644 Binary files a/_module/ncs/sitspeak.ncs and b/_module/ncs/sitspeak.ncs differ diff --git a/_module/ncs/sitwoodbench.ncs b/_module/ncs/sitwoodbench.ncs index 06f8a8d2..e00dc0d7 100644 Binary files a/_module/ncs/sitwoodbench.ncs and b/_module/ncs/sitwoodbench.ncs differ diff --git a/_module/ncs/skull_blue_score.ncs b/_module/ncs/skull_blue_score.ncs index 5d67a86f..3e196863 100644 Binary files a/_module/ncs/skull_blue_score.ncs and b/_module/ncs/skull_blue_score.ncs differ diff --git a/_module/ncs/skull_final.ncs b/_module/ncs/skull_final.ncs index 29f3cf04..f071b568 100644 Binary files a/_module/ncs/skull_final.ncs and b/_module/ncs/skull_final.ncs differ diff --git a/_module/ncs/skull_red_score.ncs b/_module/ncs/skull_red_score.ncs index 1b2a4f77..34b98c77 100644 Binary files a/_module/ncs/skull_red_score.ncs and b/_module/ncs/skull_red_score.ncs differ diff --git a/_module/ncs/skullball_strip.ncs b/_module/ncs/skullball_strip.ncs index cec1ad8e..1c6d75cd 100644 Binary files a/_module/ncs/skullball_strip.ncs and b/_module/ncs/skullball_strip.ncs differ diff --git a/_module/ncs/sot_back_beacon.ncs b/_module/ncs/sot_back_beacon.ncs index c60fef86..c2c5516a 100644 Binary files a/_module/ncs/sot_back_beacon.ncs and b/_module/ncs/sot_back_beacon.ncs differ diff --git a/_module/ncs/sot_beacon.ncs b/_module/ncs/sot_beacon.ncs index 70ccde11..08aac958 100644 Binary files a/_module/ncs/sot_beacon.ncs and b/_module/ncs/sot_beacon.ncs differ diff --git a/_module/ncs/sot_home.ncs b/_module/ncs/sot_home.ncs index ad6633ae..eb630ed0 100644 Binary files a/_module/ncs/sot_home.ncs and b/_module/ncs/sot_home.ncs differ diff --git a/_module/ncs/sot_last_use.ncs b/_module/ncs/sot_last_use.ncs index 150d3738..4fd1d469 100644 Binary files a/_module/ncs/sot_last_use.ncs and b/_module/ncs/sot_last_use.ncs differ diff --git a/_module/ncs/spawn_corpse_dcy.ncs b/_module/ncs/spawn_corpse_dcy.ncs index a837e50e..3d98bfcd 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 b0153208..3dd0d92c 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 d3a011e9..c7656b89 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_oncloscrp.ncs b/_module/ncs/spawn_oncloscrp.ncs index 69a2f74c..3dcc58e1 100644 Binary files a/_module/ncs/spawn_oncloscrp.ncs and b/_module/ncs/spawn_oncloscrp.ncs differ diff --git a/_module/ncs/spawn_orig_hb.ncs b/_module/ncs/spawn_orig_hb.ncs index 58c1b943..5025e24f 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_pseudohb.ncs b/_module/ncs/spawn_pseudohb.ncs index e15db41e..280f26b5 100644 Binary files a/_module/ncs/spawn_pseudohb.ncs and b/_module/ncs/spawn_pseudohb.ncs differ diff --git a/_module/ncs/spawn_sample_hb.ncs b/_module/ncs/spawn_sample_hb.ncs index 58c1b943..5025e24f 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 3708de8f..b4641455 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_deactiv.ncs b/_module/ncs/spawn_sc_deactiv.ncs index 8027e576..8f5ce57d 100644 Binary files a/_module/ncs/spawn_sc_deactiv.ncs and b/_module/ncs/spawn_sc_deactiv.ncs differ diff --git a/_module/ncs/spawn_sc_death.ncs b/_module/ncs/spawn_sc_death.ncs index a39358eb..8130b5a8 100644 Binary files a/_module/ncs/spawn_sc_death.ncs and b/_module/ncs/spawn_sc_death.ncs differ diff --git a/_module/ncs/spawn_sc_hbeat.ncs b/_module/ncs/spawn_sc_hbeat.ncs index 1750172b..c895cf63 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_patrol.ncs b/_module/ncs/spawn_sc_patrol.ncs index d4220413..9a852555 100644 Binary files a/_module/ncs/spawn_sc_patrol.ncs and b/_module/ncs/spawn_sc_patrol.ncs differ diff --git a/_module/ncs/spawn_sc_spawn.ncs b/_module/ncs/spawn_sc_spawn.ncs index 547da034..d2f77f6a 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_smpl_onen2.ncs b/_module/ncs/spawn_smpl_onen2.ncs index 49087daa..38856198 100644 Binary files a/_module/ncs/spawn_smpl_onen2.ncs and b/_module/ncs/spawn_smpl_onen2.ncs differ diff --git a/_module/ncs/spawn_smpl_onent.ncs b/_module/ncs/spawn_smpl_onent.ncs index 7a3ec9bf..30a0c814 100644 Binary files a/_module/ncs/spawn_smpl_onent.ncs and b/_module/ncs/spawn_smpl_onent.ncs differ diff --git a/_module/ncs/spawn_smpl_onext.ncs b/_module/ncs/spawn_smpl_onext.ncs index c90b83d4..b5ac3ece 100644 Binary files a/_module/ncs/spawn_smpl_onext.ncs and b/_module/ncs/spawn_smpl_onext.ncs differ diff --git a/_module/ncs/spawn_statue.ncs b/_module/ncs/spawn_statue.ncs index 4b17a431..9f413119 100644 Binary files a/_module/ncs/spawn_statue.ncs and b/_module/ncs/spawn_statue.ncs differ diff --git a/_module/ncs/spawn_statue2.ncs b/_module/ncs/spawn_statue2.ncs index 7676a6fe..3dc9a340 100644 Binary files a/_module/ncs/spawn_statue2.ncs and b/_module/ncs/spawn_statue2.ncs differ diff --git a/_module/ncs/spawn_statue3.ncs b/_module/ncs/spawn_statue3.ncs index b1e55e41..55dcfea5 100644 Binary files a/_module/ncs/spawn_statue3.ncs and b/_module/ncs/spawn_statue3.ncs differ diff --git a/_module/ncs/spawn_valar.ncs b/_module/ncs/spawn_valar.ncs index ff2e2540..048325ac 100644 Binary files a/_module/ncs/spawn_valar.ncs and b/_module/ncs/spawn_valar.ncs differ diff --git a/_module/ncs/spawnb_cc_dump.ncs b/_module/ncs/spawnb_cc_dump.ncs index f7543f71..5101e25d 100644 Binary files a/_module/ncs/spawnb_cc_dump.ncs and b/_module/ncs/spawnb_cc_dump.ncs differ diff --git a/_module/ncs/spawnb_cc_nodump.ncs b/_module/ncs/spawnb_cc_nodump.ncs index 5b8f17e9..1ab1629d 100644 Binary files a/_module/ncs/spawnb_cc_nodump.ncs and b/_module/ncs/spawnb_cc_nodump.ncs differ diff --git a/_module/ncs/spawnb_cc_notrck.ncs b/_module/ncs/spawnb_cc_notrck.ncs index 58222a61..2b541ae4 100644 Binary files a/_module/ncs/spawnb_cc_notrck.ncs and b/_module/ncs/spawnb_cc_notrck.ncs differ diff --git a/_module/ncs/spawnb_cc_trck.ncs b/_module/ncs/spawnb_cc_trck.ncs index 83c5cad5..8993f6a6 100644 Binary files a/_module/ncs/spawnb_cc_trck.ncs and b/_module/ncs/spawnb_cc_trck.ncs differ diff --git a/_module/ncs/spawnb_sample_ai.ncs b/_module/ncs/spawnb_sample_ai.ncs index 38bf1074..666feb09 100644 Binary files a/_module/ncs/spawnb_sample_ai.ncs and b/_module/ncs/spawnb_sample_ai.ncs differ diff --git a/_module/ncs/spawnb_sc_activ.ncs b/_module/ncs/spawnb_sc_activ.ncs index 830f5826..1004d115 100644 Binary files a/_module/ncs/spawnb_sc_activ.ncs and b/_module/ncs/spawnb_sc_activ.ncs differ diff --git a/_module/ncs/spawnb_sc_dactiv.ncs b/_module/ncs/spawnb_sc_dactiv.ncs index 32866346..6daec590 100644 Binary files a/_module/ncs/spawnb_sc_dactiv.ncs and b/_module/ncs/spawnb_sc_dactiv.ncs differ diff --git a/_module/ncs/spawnb_sc_dump.ncs b/_module/ncs/spawnb_sc_dump.ncs index 070b4bd0..8c2050a0 100644 Binary files a/_module/ncs/spawnb_sc_dump.ncs and b/_module/ncs/spawnb_sc_dump.ncs differ diff --git a/_module/ncs/spawnb_sc_nodump.ncs b/_module/ncs/spawnb_sc_nodump.ncs index 69ee30d2..742f5df5 100644 Binary files a/_module/ncs/spawnb_sc_nodump.ncs and b/_module/ncs/spawnb_sc_nodump.ncs differ diff --git a/_module/ncs/spawnb_sc_notrck.ncs b/_module/ncs/spawnb_sc_notrck.ncs index 13dd03f4..1d137b78 100644 Binary files a/_module/ncs/spawnb_sc_notrck.ncs and b/_module/ncs/spawnb_sc_notrck.ncs differ diff --git a/_module/ncs/spawnb_sc_trck.ncs b/_module/ncs/spawnb_sc_trck.ncs index 36b0ece1..f46650bd 100644 Binary files a/_module/ncs/spawnb_sc_trck.ncs and b/_module/ncs/spawnb_sc_trck.ncs differ diff --git a/_module/ncs/spawnbanner.ncs b/_module/ncs/spawnbanner.ncs index da7b1d60..d1edd1eb 100644 Binary files a/_module/ncs/spawnbanner.ncs and b/_module/ncs/spawnbanner.ncs differ diff --git a/_module/ncs/spawndaemon.ncs b/_module/ncs/spawndaemon.ncs index a5bbf567..c1dbbc23 100644 Binary files a/_module/ncs/spawndaemon.ncs and b/_module/ncs/spawndaemon.ncs differ diff --git a/_module/ncs/speak_sit_spawn.ncs b/_module/ncs/speak_sit_spawn.ncs index 7bf1a084..2f016e7a 100644 Binary files a/_module/ncs/speak_sit_spawn.ncs and b/_module/ncs/speak_sit_spawn.ncs differ diff --git a/_module/ncs/svirf_common_ck.ncs b/_module/ncs/svirf_common_ck.ncs index 99c080f6..7cdf32b7 100644 Binary files a/_module/ncs/svirf_common_ck.ncs and b/_module/ncs/svirf_common_ck.ncs differ diff --git a/_module/ncs/svirf_hostile_ck.ncs b/_module/ncs/svirf_hostile_ck.ncs index 9e8c6e5c..71286f62 100644 Binary files a/_module/ncs/svirf_hostile_ck.ncs and b/_module/ncs/svirf_hostile_ck.ncs differ diff --git a/_module/ncs/timed_door.ncs b/_module/ncs/timed_door.ncs index 78e66e1f..39de2518 100644 Binary files a/_module/ncs/timed_door.ncs and b/_module/ncs/timed_door.ncs differ diff --git a/_module/ncs/tracking.ncs b/_module/ncs/tracking.ncs index 5a68518c..295f37d8 100644 Binary files a/_module/ncs/tracking.ncs and b/_module/ncs/tracking.ncs differ diff --git a/_module/ncs/troll_nwn_spawn.ncs b/_module/ncs/troll_nwn_spawn.ncs index f34950fb..d7dae7f5 100644 Binary files a/_module/ncs/troll_nwn_spawn.ncs and b/_module/ncs/troll_nwn_spawn.ncs differ diff --git a/_module/ncs/troll_spawn.ncs b/_module/ncs/troll_spawn.ncs index 76c97abc..d39eb7c3 100644 Binary files a/_module/ncs/troll_spawn.ncs and b/_module/ncs/troll_spawn.ncs differ diff --git a/_module/ncs/troll_userdefine.ncs b/_module/ncs/troll_userdefine.ncs index 99a8a9ad..b43f4e1f 100644 Binary files a/_module/ncs/troll_userdefine.ncs and b/_module/ncs/troll_userdefine.ncs differ diff --git a/_module/ncs/ud_beamtarget.ncs b/_module/ncs/ud_beamtarget.ncs index b95d1d2e..ae2e70c5 100644 Binary files a/_module/ncs/ud_beamtarget.ncs and b/_module/ncs/ud_beamtarget.ncs differ diff --git a/_module/ncs/unequip_onenter2.ncs b/_module/ncs/unequip_onenter2.ncs index ad071b9c..a0740c32 100644 Binary files a/_module/ncs/unequip_onenter2.ncs and b/_module/ncs/unequip_onenter2.ncs differ diff --git a/_module/ncs/valen_attacks.ncs b/_module/ncs/valen_attacks.ncs index 8f4e852e..d88f65a4 100644 Binary files a/_module/ncs/valen_attacks.ncs and b/_module/ncs/valen_attacks.ncs differ diff --git a/_module/ncs/vfxshadowarmor.ncs b/_module/ncs/vfxshadowarmor.ncs index 8e65d8dc..60718098 100644 Binary files a/_module/ncs/vfxshadowarmor.ncs and b/_module/ncs/vfxshadowarmor.ncs differ diff --git a/_module/ncs/victors_helm_ck.ncs b/_module/ncs/victors_helm_ck.ncs index 6ecad8d5..dcf3e048 100644 Binary files a/_module/ncs/victors_helm_ck.ncs and b/_module/ncs/victors_helm_ck.ncs differ diff --git a/_module/ncs/watervfx.ncs b/_module/ncs/watervfx.ncs index 45bac5cd..d6da81b5 100644 Binary files a/_module/ncs/watervfx.ncs and b/_module/ncs/watervfx.ncs differ diff --git a/_module/ncs/wetland_guard.ncs b/_module/ncs/wetland_guard.ncs index 3ae96e41..712a6592 100644 Binary files a/_module/ncs/wetland_guard.ncs and b/_module/ncs/wetland_guard.ncs differ diff --git a/_module/ncs/wetland_guard2.ncs b/_module/ncs/wetland_guard2.ncs index 1ddba5d4..773f279d 100644 Binary files a/_module/ncs/wetland_guard2.ncs and b/_module/ncs/wetland_guard2.ncs differ diff --git a/_module/ncs/wings.ncs b/_module/ncs/wings.ncs index f9a30706..ee90c658 100644 Binary files a/_module/ncs/wings.ncs and b/_module/ncs/wings.ncs differ diff --git a/_module/ncs/x0_ch_hen_combat.ncs b/_module/ncs/x0_ch_hen_combat.ncs index fcb92604..8a6c3333 100644 Binary files a/_module/ncs/x0_ch_hen_combat.ncs and b/_module/ncs/x0_ch_hen_combat.ncs differ diff --git a/_module/ncs/x0_ch_hen_conv.ncs b/_module/ncs/x0_ch_hen_conv.ncs index 1d5c4b97..06ea3122 100644 Binary files a/_module/ncs/x0_ch_hen_conv.ncs and b/_module/ncs/x0_ch_hen_conv.ncs differ diff --git a/_module/ncs/x0_ch_hen_heart.ncs b/_module/ncs/x0_ch_hen_heart.ncs index 4b2bf992..897d370a 100644 Binary files a/_module/ncs/x0_ch_hen_heart.ncs and b/_module/ncs/x0_ch_hen_heart.ncs differ diff --git a/_module/ncs/x0_ch_hen_spawn.ncs b/_module/ncs/x0_ch_hen_spawn.ncs index da6a3b33..240c9ad4 100644 Binary files a/_module/ncs/x0_ch_hen_spawn.ncs and b/_module/ncs/x0_ch_hen_spawn.ncs differ diff --git a/_module/ncs/x0_ch_hen_stealt.ncs b/_module/ncs/x0_ch_hen_stealt.ncs index dfb89170..d80ac2b8 100644 Binary files a/_module/ncs/x0_ch_hen_stealt.ncs and b/_module/ncs/x0_ch_hen_stealt.ncs differ diff --git a/_module/ncs/x0_o2_use_tdoor.ncs b/_module/ncs/x0_o2_use_tdoor.ncs index ca8c8694..c9d9cded 100644 Binary files a/_module/ncs/x0_o2_use_tdoor.ncs and b/_module/ncs/x0_o2_use_tdoor.ncs differ diff --git a/_module/ncs/x2_def_immobile.ncs b/_module/ncs/x2_def_immobile.ncs index 2341a4a7..e2f4a921 100644 Binary files a/_module/ncs/x2_def_immobile.ncs and b/_module/ncs/x2_def_immobile.ncs differ diff --git a/_module/ncs/x2_def_spawnwwp.ncs b/_module/ncs/x2_def_spawnwwp.ncs index 4b62eb7b..73d24a7f 100644 Binary files a/_module/ncs/x2_def_spawnwwp.ncs and b/_module/ncs/x2_def_spawnwwp.ncs differ diff --git a/_module/ncs/x2_mod_def_equ.ncs b/_module/ncs/x2_mod_def_equ.ncs index ed33c865..1298c9a9 100644 Binary files a/_module/ncs/x2_mod_def_equ.ncs and b/_module/ncs/x2_mod_def_equ.ncs differ diff --git a/_module/ncs/xov_hen_fired.ncs b/_module/ncs/xov_hen_fired.ncs index 71df57c5..0081e2b9 100644 Binary files a/_module/ncs/xov_hen_fired.ncs and b/_module/ncs/xov_hen_fired.ncs differ diff --git a/_module/ncs/xov_hen_join.ncs b/_module/ncs/xov_hen_join.ncs index 37d1136e..0cfa4ad8 100644 Binary files a/_module/ncs/xov_hen_join.ncs and b/_module/ncs/xov_hen_join.ncs differ diff --git a/_module/ncs/xp_disarm.ncs b/_module/ncs/xp_disarm.ncs index ddbcf8fc..541f22ce 100644 Binary files a/_module/ncs/xp_disarm.ncs and b/_module/ncs/xp_disarm.ncs differ diff --git a/_module/ncs/xp_unlock.ncs b/_module/ncs/xp_unlock.ncs index e60208a5..040f84a5 100644 Binary files a/_module/ncs/xp_unlock.ncs and b/_module/ncs/xp_unlock.ncs differ diff --git a/_module/ncs/xs_catapult_use.ncs b/_module/ncs/xs_catapult_use.ncs index d365ed5f..c3cef00b 100644 Binary files a/_module/ncs/xs_catapult_use.ncs and b/_module/ncs/xs_catapult_use.ncs differ diff --git a/_module/ncs/yang_death.ncs b/_module/ncs/yang_death.ncs index ff1b8566..3ba458fa 100644 Binary files a/_module/ncs/yang_death.ncs and b/_module/ncs/yang_death.ncs differ diff --git a/_module/ncs/yin_death.ncs b/_module/ncs/yin_death.ncs index 22225a48..b9e23632 100644 Binary files a/_module/ncs/yin_death.ncs and b/_module/ncs/yin_death.ncs differ diff --git a/_module/ncs/yinyang_ondeath.ncs b/_module/ncs/yinyang_ondeath.ncs index 1daf9521..0788dc07 100644 Binary files a/_module/ncs/yinyang_ondeath.ncs and b/_module/ncs/yinyang_ondeath.ncs differ diff --git a/_module/ncs/yinyang_spawn.ncs b/_module/ncs/yinyang_spawn.ncs index e25f1eb2..26c11fa3 100644 Binary files a/_module/ncs/yinyang_spawn.ncs and b/_module/ncs/yinyang_spawn.ncs differ diff --git a/_module/ncs/zep_openclose.ncs b/_module/ncs/zep_openclose.ncs index 130172c9..ec656cad 100644 Binary files a/_module/ncs/zep_openclose.ncs and b/_module/ncs/zep_openclose.ncs differ diff --git a/_module/nss/array_example.nss b/_module/nss/array_example.nss new file mode 100644 index 00000000..53f13f8f --- /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 00000000..7671723d --- /dev/null +++ b/_module/nss/inc_array.nss @@ -0,0 +1,512 @@ +/// @addtogroup data Data +/// @brief Provides a number of data structures for NWN code to use (simulated arrays) +/// @{ +/// @file nwnx_data.nss + +const int INVALID_INDEX = -1; +const int TYPE_FLOAT = 0; +const int TYPE_INTEGER = 1; +const int TYPE_OBJECT = 2; +const int TYPE_STRING = 3; + +/// @defgroup data_array_at Array At +/// @brief Returns the element at the index. +/// @ingroup data +/// @param obj The object. +/// @param tag The tag. +/// @param index The index. +/// @return The element of associated type. +/// @{ +string Array_At_Str(string tag, int index, object obj=OBJECT_INVALID); +float Array_At_Flt(string tag, int index, object obj=OBJECT_INVALID); +int Array_At_Int(string tag, int index, object obj=OBJECT_INVALID); +object Array_At_Obj(string tag, int index, object obj=OBJECT_INVALID); +/// @} + + +/// Clears the entire array, such that size==0. +void Array_Clear(string tag, object obj=OBJECT_INVALID); + +/// @defgroup data_array_contains Array Contains +/// @brief Checks if array contains the element. +/// @ingroup data +/// @param obj The object. +/// @param tag The tag. +/// @param element The element. +/// @return TRUE if the collection contains the element. +/// @{ +int Array_Contains_Flt(string tag, float element, object obj=OBJECT_INVALID); +int Array_Contains_Int(string tag, int element, object obj=OBJECT_INVALID); +int Array_Contains_Obj(string tag, object element, object obj=OBJECT_INVALID); +int Array_Contains_Str(string tag, string element, object obj=OBJECT_INVALID); +/// @} + +/// Copies the array of name otherTag over the array of name tag. +void Array_Copy(string tag, string otherTag, object obj=OBJECT_INVALID); + +/// Erases the element at index, and shuffles any elements from index size-1 to index + 1 left. +void Array_Erase(string tag, int index, object obj=OBJECT_INVALID); + +/// @defgroup data_array_find Array Find +/// @brief Get the index at which the element is located. +/// @ingroup data +/// @param obj The object. +/// @param tag The tag. +/// @param element The element. +/// @return Returns the index at which the element is located, or ARRAY_INVALID_INDEX. +/// @{ +int Array_Find_Flt(string tag, float element, object obj=OBJECT_INVALID); +int Array_Find_Int(string tag, int element, object obj=OBJECT_INVALID); +int Array_Find_Obj(string tag, object element, object obj=OBJECT_INVALID); +int Array_Find_Str(string tag, string element, object obj=OBJECT_INVALID); +/// @} + +/// @defgroup data_array_insert Array Insert +/// @brief Inserts the element at the index, where size > index >= 0. +/// @ingroup data +/// @param obj The object. +/// @param tag The tag. +/// @param index The index. +/// @param element The element. +/// @{ +void Array_Insert_Flt(string tag, int index, float element, object obj=OBJECT_INVALID); +void Array_Insert_Int(string tag, int index, int element, object obj=OBJECT_INVALID); +void Array_Insert_Obj(string tag, int index, object element, object obj=OBJECT_INVALID); +void Array_Insert_Str(string tag, int index, string element, object obj=OBJECT_INVALID); +/// @} + +/// @defgroup data_array_pushback Array Pushback +/// @brief Pushes an element to the back of the collection. +/// @remark Functionally identical to an insert at index size-1. +/// @ingroup data +/// @param obj The object. +/// @param tag The tag. +/// @param element The element. +/// @{ +void Array_PushBack_Flt(string tag, float element, object obj=OBJECT_INVALID); +void Array_PushBack_Int(string tag, int element, object obj=OBJECT_INVALID); +void Array_PushBack_Obj(string tag, object element, object obj=OBJECT_INVALID); +void Array_PushBack_Str(string tag, string element, object obj=OBJECT_INVALID); +/// @} + +/// Resizes the array. If the array is shrinking, it chops off elements at the ned. +void Array_Resize(string tag, int size, object obj=OBJECT_INVALID); + +/// Reorders the array such each possible permutation of elements has equal probability of appearance. +void Array_Shuffle(string tag, object obj=OBJECT_INVALID); + +/// Returns the size of the array. +int Array_Size(string tag, object obj=OBJECT_INVALID); + +/// Sorts the collection based on descending order. +void Array_SortAscending(string tag, int type=TYPE_STRING, object obj=OBJECT_INVALID); + +/// Sorts the collection based on descending order. +void Array_SortDescending(string tag, int type=TYPE_STRING, object obj=OBJECT_INVALID); + +/// @defgroup data_array_set Array Set +/// @brief Sets the element at the index, where size > index >= 0. +/// @ingroup data +/// @param obj The object. +/// @param tag The tag. +/// @param index The index. +/// @param element The element. +/// @{ +void Array_Set_Flt(string tag, int index, float element, object obj=OBJECT_INVALID); +void Array_Set_Int(string tag, int index, int element, object obj=OBJECT_INVALID); +void Array_Set_Obj(string tag, int index, object element, object obj=OBJECT_INVALID); +void Array_Set_Str(string tag, int index, string element, object obj=OBJECT_INVALID); +/// @} + +/// @} + +// +// Local Utility Functions. +// +string GetTableName(string tag, object obj=OBJECT_INVALID, int bare=FALSE) { + if (obj == OBJECT_INVALID) + obj = GetModule(); + + string sName = "array_" + ObjectToString(obj) + "_" + tag; + // Remove invalid characters from the tag rather than failing. + string sCleansed = RegExpReplace("[^A-Za-z0-9_\$@#]", sName, ""); + // But provide some feedback. + if (GetStringLength(sName) != GetStringLength(sCleansed) || GetStringLength(sCleansed) == 0) { + WriteTimestampedLogEntry("WARNING: Invalid table name detected for array with tag <" + tag + ">. Only characters (a-zA-Z0-9), _, @, $ and # are allowed. Using <"+sCleansed+"> instead."); + + } + + // BARE returns just the table name with no wrapping. + if (bare == TRUE) { + return sCleansed; + } + + // Table name wraped in quotes to avoid token expansion. + return "\""+sCleansed+"\""; +} + +string GetTableCreateString(string tag, object obj=OBJECT_INVALID) { + // for simplicity sake, everything is turned into a string. Possible enhancement + // to create specific tables for int/float/whatever. + return "CREATE TABLE IF NOT EXISTS " + GetTableName(tag, obj) + " ( ind INTEGER, value TEXT )"; +} + +int TableExists(string tag, object obj=OBJECT_INVALID) { + string stmt = "SELECT name FROM sqlite_master WHERE type = 'table' AND name = @tablename;"; + sqlquery sqlQuery = SqlPrepareQueryObject(GetModule(), stmt); + SqlBindString(sqlQuery, "@tablename", GetTableName(tag, obj, TRUE)); + return SqlStep(sqlQuery); +} + +void ExecuteStatement(string statement, object obj=OBJECT_INVALID) { + if (obj == OBJECT_INVALID) + obj = GetModule(); + // There's no direct "execute this.." everything has to be prepared then executed. + //WriteTimestampedLogEntry("SQL: " + statement); + sqlquery sqlQuery = SqlPrepareQueryObject(GetModule(), statement); + SqlStep(sqlQuery); +} + +void CreateArrayTable(string tag, object obj=OBJECT_INVALID) { + string createStatement = GetTableCreateString(tag, obj); + ExecuteStatement(createStatement, obj); +} + +// Get the table row count. Returns -1 on error (0 is a valid number of rows in a table) +int GetRowCount(string tag, object obj=OBJECT_INVALID) { + if (obj == OBJECT_INVALID) + obj = GetModule(); + CreateArrayTable(tag, obj); + string stmt = "SELECT COUNT(1) FROM " + GetTableName(tag, obj); + sqlquery sqlQuery = SqlPrepareQueryObject(GetModule(), stmt); + if ( SqlStep(sqlQuery) ) { + return SqlGetInt(sqlQuery, 0); + } + return -1; +} + + +//////////////////////////////////////////////////////////////////////////////// +// return the value contained in location "index" +string Array_At_Str(string tag, int index, object obj=OBJECT_INVALID) +{ + // Just "create if not exists" to ensure it exists for the insert. + CreateArrayTable(tag, obj); + + string stmt = "SELECT value FROM " + GetTableName(tag, obj) + " WHERE ind = @ind"; + sqlquery sqlQuery = SqlPrepareQueryObject(GetModule(), stmt); + SqlBindInt(sqlQuery, "@ind", index); + if ( SqlStep(sqlQuery) ) { + return SqlGetString(sqlQuery, 0); + } + return ""; +} + +float Array_At_Flt(string tag, int index, object obj=OBJECT_INVALID) +{ + string st = Array_At_Str(tag, index, obj); + if (st == "") { + return 0.0; + } + return StringToFloat(st); +} + +int Array_At_Int(string tag, int index, object obj=OBJECT_INVALID) +{ + string st = Array_At_Str(tag, index, obj); + if (st == "") { + return 0; + } + return StringToInt(st); +} + +object Array_At_Obj(string tag, int index, object obj=OBJECT_INVALID) +{ + string st = Array_At_Str(tag, index, obj); + if (st == "") { + return OBJECT_INVALID; + } + return StringToObject(st); +} + +void Array_Clear(string tag, object obj=OBJECT_INVALID) +{ + ExecuteStatement("delete from "+GetTableName(tag, obj), obj); +} + +//////////////////////////////////////////////////////////////////////////////// +// Return true/value (1/0) if the array contains the value "element" +int Array_Contains_Str(string tag, string element, object obj=OBJECT_INVALID) +{ + CreateArrayTable(tag, obj); + string stmt = "SELECT COUNT(1) FROM "+GetTableName(tag, obj)+" WHERE value = @element"; + + sqlquery sqlQuery = SqlPrepareQueryObject(GetModule(), stmt); + SqlBindString(sqlQuery, "@element", element); + + int pos = -1; + if ( SqlStep(sqlQuery) ) { + pos = SqlGetInt(sqlQuery, 0); + if (pos > 0) { + return TRUE; + } + } + return FALSE; +} + +int Array_Contains_Flt(string tag, float element, object obj=OBJECT_INVALID) +{ + return Array_Contains_Str(tag, FloatToString(element), obj); +} + +int Array_Contains_Int(string tag, int element, object obj=OBJECT_INVALID) +{ + return Array_Contains_Str(tag, IntToString(element), obj); +} + +int Array_Contains_Obj(string tag, object element, object obj=OBJECT_INVALID) +{ + return Array_Contains_Str(tag, ObjectToString(element), obj); +} + + +//////////////////////////////////////////////////////////////////////////////// +void Array_Copy(string tag, string otherTag, object obj=OBJECT_INVALID) +{ + CreateArrayTable(otherTag, obj); + ExecuteStatement("INSERT INTO "+GetTableName(otherTag, obj)+" SELECT * FROM "+GetTableName(tag, obj), obj); +} + +//////////////////////////////////////////////////////////////////////////////// +void Array_Erase(string tag, int index, object obj=OBJECT_INVALID) +{ + int rows = GetRowCount(tag, obj); + // Silently fail if "index" is outside the range of valid indicies. + if (index >= 0 && index < rows) { + string stmt = "DELETE FROM "+GetTableName(tag, obj)+" WHERE ind = @ind"; + sqlquery sqlQuery = SqlPrepareQueryObject(GetModule(), stmt); + SqlBindInt(sqlQuery, "@ind", index); + SqlStep(sqlQuery); + + stmt = "UPDATE "+GetTableName(tag, obj)+" SET ind = ind - 1 WHERE ind > @ind"; + sqlQuery = SqlPrepareQueryObject(GetModule(), stmt); + SqlBindInt(sqlQuery, "@ind", index); + SqlStep(sqlQuery); + } +} + +//////////////////////////////////////////////////////////////////////////////// +// return the index in the array containing "element" +// if not found, return INVALID_INDEX +int Array_Find_Str(string tag, string element, object obj=OBJECT_INVALID) +{ + string stmt; + sqlquery sqlQuery; + + // Just create it before trying to select in case it doesn't exist yet. + CreateArrayTable(tag, obj); + + stmt = "SELECT IFNULL(MIN(ind),@invalid_index) FROM "+GetTableName(tag, obj)+" WHERE value = @element"; + sqlQuery = SqlPrepareQueryObject(GetModule(), stmt); + + SqlBindInt(sqlQuery, "@invalid_index", INVALID_INDEX); + SqlBindString(sqlQuery, "@element", element); + if ( SqlStep(sqlQuery) ) { + return SqlGetInt(sqlQuery, 0); + } + return INVALID_INDEX; +} + +int Array_Find_Flt(string tag, float element, object obj=OBJECT_INVALID) +{ + return Array_Find_Str(tag, FloatToString(element), obj); +} + +int Array_Find_Int(string tag, int element, object obj=OBJECT_INVALID) +{ + return Array_Find_Str(tag, IntToString(element), obj); +} + +int Array_Find_Obj(string tag, object element, object obj=OBJECT_INVALID) +{ + return Array_Find_Str(tag, ObjectToString(element), obj); +} + +//////////////////////////////////////////////////////////////////////////////// +// Insert a new element into position 'index'. If index is beyond the number of rows in the array, +// this will quietly fail. This could be changed if you wanted to support sparse +// arrays. +void Array_Insert_Str(string tag, int index, string element, object obj=OBJECT_INVALID) +{ + int rows = GetRowCount(tag, obj); + // Index numbers are off by one, much like C arrays, so for "rows=10" - values are 0-9. + // It's not unreasonable to fail if you try to insert ind=10 into an array who's indexes + // only go to 9, but I guess it doesn't hurt as long as we're not allowing gaps in + // index numbers. + if (index >= 0 && index <= rows) { + // index is passed as an integer, so immune (as far as I know) to SQL injection for a one shot query. + ExecuteStatement("UPDATE "+GetTableName(tag, obj)+" SET ind = ind + 1 WHERE ind >= "+IntToString(index), obj); + // Element, however, is not. + string stmt = "INSERT INTO "+GetTableName(tag, obj)+" VALUES ( @ind, @element )"; + sqlquery sqlQuery = SqlPrepareQueryObject(GetModule(), stmt); + SqlBindInt(sqlQuery, "@ind", index); + SqlBindString(sqlQuery, "@element", element); + SqlStep(sqlQuery); + } +} + +void Array_Insert_Flt(string tag, int index, float element, object obj=OBJECT_INVALID) +{ + Array_Insert_Str(tag, index, FloatToString(element), obj); +} + +void Array_Insert_Int(string tag, int index, int element, object obj=OBJECT_INVALID) +{ + Array_Insert_Str(tag, index, IntToString(element), obj); +} + +void Array_Insert_Obj(string tag, int index, object element, object obj=OBJECT_INVALID) +{ + Array_Insert_Str(tag, index, ObjectToString(element), obj); +} + +//////////////////////////////////////////////////////////////////////////////// +// Insert a new element at the end of the array. +void Array_PushBack_Str(string tag, string element, object obj=OBJECT_INVALID) +{ + // Create it before trhing to INSERT into it. If it already exists, this is a no-op. + CreateArrayTable(tag, obj); + + // If rowCount = 10, indexes are from 0 to 9, so this becomes the 11th entry at index 10. + int rowCount = GetRowCount(tag, obj); + + string stmt = "INSERT INTO "+GetTableName(tag, obj)+" VALUES ( @ind, @element )"; + sqlquery sqlQuery = SqlPrepareQueryObject(GetModule(), stmt); + SqlBindInt(sqlQuery, "@ind", rowCount); + SqlBindString(sqlQuery, "@element", element); + SqlStep(sqlQuery); +} + +void Array_PushBack_Flt(string tag, float element, object obj=OBJECT_INVALID) +{ + Array_PushBack_Str(tag, FloatToString(element), obj); +} + +void Array_PushBack_Int(string tag, int element, object obj=OBJECT_INVALID) +{ + Array_PushBack_Str(tag, IntToString(element), obj); +} + +void Array_PushBack_Obj(string tag, object element, object obj=OBJECT_INVALID) +{ + Array_PushBack_Str(tag, ObjectToString(element), obj); +} + +//////////////////////////////////////////////////////////////////////////////// +// Cuts the array off at size 'size'. Elements beyond size are removed. +void Array_Resize(string tag, int size, object obj=OBJECT_INVALID) +{ + // Int immune to sql injection so easier to one-shot it. + ExecuteStatement("DELETE FROM "+GetTableName(tag, obj)+" WHERE ind >= " + IntToString(size), obj); +} + +//////////////////////////////////////////////////////////////////////////////// +void Array_Shuffle(string tag, object obj=OBJECT_INVALID) +{ + string table = GetTableName(tag, obj, TRUE); + ExecuteStatement("CREATE TABLE " +table+ "_temp AS SELECT ROW_NUMBER() OVER(ORDER BY RANDOM())-1, value FROM " +table, obj); + ExecuteStatement("DELETE FROM " +table , obj); + ExecuteStatement("INSERT INTO " +table+ " SELECT * FROM " +table+ "_temp", obj); + ExecuteStatement("DROP TABLE " +table+ "_TEMP", obj); +} + +//////////////////////////////////////////////////////////////////////////////// +int Array_Size(string tag, object obj=OBJECT_INVALID) +{ + return GetRowCount(tag, obj); +} + +//////////////////////////////////////////////////////////////////////////////// +// Sort the array by value according to 'direction' (ASC or DESC). +// Supplying a type allows for correct numerical sorting of integers or floats. +void Array_Sort(string tag, string dir="ASC", int type=TYPE_STRING, object obj=OBJECT_INVALID) +{ + string table = GetTableName(tag, obj, TRUE); + string direction = GetStringUpperCase(dir); + + if ( ! (direction == "ASC" || direction == "DESC") ) { + WriteTimestampedLogEntry("WARNING: Invalid sort direction <" + direction + "> supplied. Defaulting to ASC."); + direction = "ASC"; + } + + // default orderBy for strings. + string orderBy = "ORDER BY value " + direction; + switch(type) { + case TYPE_INTEGER: + orderBy = "ORDER BY CAST(value AS INTEGER)" + direction; + break; + case TYPE_FLOAT: + orderBy = "ORDER BY CAST(value AS DECIMAL)" + direction; + break; + } + ExecuteStatement("CREATE TABLE " +table+ "_temp AS SELECT ROW_NUMBER() OVER(" + orderBy + ")-1, value FROM " +table, obj); + ExecuteStatement("DELETE FROM " +table, obj); + ExecuteStatement("INSERT INTO " +table+ " SELECT * FROM " +table+ "_temp", obj); + ExecuteStatement("DROP TABLE " +table+ "_temp", obj); +} + +void Array_SortAscending(string tag, int type=TYPE_STRING, object obj=OBJECT_INVALID) +{ + Array_Sort(tag, "ASC", type, obj); +} + +void Array_SortDescending(string tag, int type=TYPE_STRING, object obj=OBJECT_INVALID) +{ + Array_Sort(tag, "DESC", type, obj); +} + +//////////////////////////////////////////////////////////////////////////////// +// Set the value of array index 'index' to a 'element' +// This will quietly eat values if index > array size +void Array_Set_Str(string tag, int index, string element, object obj=OBJECT_INVALID) +{ + int rows = GetRowCount(tag, obj); + if (index >= 0 && index <= rows) { + string stmt = "UPDATE "+GetTableName(tag, obj)+" SET value = @element WHERE ind = @ind"; + sqlquery sqlQuery = SqlPrepareQueryObject(GetModule(), stmt); + SqlBindInt(sqlQuery, "@ind", index); + SqlBindString(sqlQuery, "@element", element); + SqlStep(sqlQuery); + } +} + +void Array_Set_Flt(string tag, int index, float element, object obj=OBJECT_INVALID) +{ + Array_Set_Str(tag, index, FloatToString(element), obj); +} + +void Array_Set_Int(string tag, int index, int element, object obj=OBJECT_INVALID) +{ + Array_Set_Str(tag, index, IntToString(element), obj); +} + +void Array_Set_Obj(string tag, int index, object element, object obj=OBJECT_INVALID) +{ + Array_Set_Str(tag, index, ObjectToString(element), obj); +} + +void Array_Debug_Dump(string tag, string title = "xxx", object obj=OBJECT_INVALID) { + if (title != "xxx") { + WriteTimestampedLogEntry("== " + title + " ======================================"); + } + WriteTimestampedLogEntry("Table name = " + GetTableName(tag, obj)); + string stmt = "SELECT ind, value FROM " + GetTableName(tag, obj); + sqlquery sqlQuery = SqlPrepareQueryObject(GetModule(), stmt); + int ind = -1; + string value = ""; + while ( SqlStep(sqlQuery) ) { + ind = SqlGetInt(sqlQuery, 0); + value = SqlGetString(sqlQuery, 1); + WriteTimestampedLogEntry(tag + "[" + IntToString(ind) + "] = " + value); + } +} diff --git a/_module/nss/inc_sqlite_time.nss b/_module/nss/inc_sqlite_time.nss new file mode 100644 index 00000000..f8dddeb4 --- /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 fe8942cf..f7648213 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 bbb43df9..42a17d65 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 @@ -139,7 +140,7 @@ void NWNX_Administration_SetPlayOption(int option, int value); /// /// @param playerName The community (login name). /// @param characterName The character name. -/// @return Returns TRUE if successful +/// @return Returns TRUE if successful. int NWNX_Administration_DeleteTURD(string playerName, string characterName); /// @brief Get an @ref admin_debug "Administration Debug Type" value. @@ -156,189 +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 = TRUE, string sKickMessage = "") { - string sFunc = "DeletePlayerCharacter"; - - NWNX_PushArgumentString(NWNX_Administration, sFunc, sKickMessage); - 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 new file mode 100644 index 00000000..4c85eb14 --- /dev/null +++ b/_module/nss/nwnx_appearance.nss @@ -0,0 +1,65 @@ +/// @addtogroup appearance Appearance +/// @brief Allows the appearance and some other things of creatures to be overridden per player. +/// @{ +/// @file nwnx_appearance.nss + +const string NWNX_Appearance = "NWNX_Appearance"; ///< @private + +/// @name Appearance Types +/// @anchor appearance_types +/// +/// The various types of changes that can be made to how a PC is perceived. +/// @{ +const int NWNX_APPEARANCE_TYPE_APPEARANCE = 0; ///< APPEARANCE_TYPE_* or -1 to remove +const int NWNX_APPEARANCE_TYPE_GENDER = 1; ///< GENDER_* or -1 to remove + +/// @brief 0-GetMaxHitPoints(oCreature) or -1 to remove +/// @note This is visual only. Does not change the Examine Window health status. +const int NWNX_APPEARANCE_TYPE_HITPOINTS = 2; +const int NWNX_APPEARANCE_TYPE_HAIR_COLOR = 3; ///< 0-175 or -1 to remove +const int NWNX_APPEARANCE_TYPE_SKIN_COLOR = 4; ///< 0-175 or -1 to remove +const int NWNX_APPEARANCE_TYPE_PHENOTYPE = 5; ///< PHENOTYPE_* or -1 to remove +const int NWNX_APPEARANCE_TYPE_HEAD_TYPE = 6; ///< 0-? or -1 to remove +const int NWNX_APPEARANCE_TYPE_SOUNDSET = 7; ///< See soundset.2da or -1 to remove +const int NWNX_APPEARANCE_TYPE_TAIL_TYPE = 8; ///< CREATURE_TAIL_TYPE_* or see tailmodel.2da, -1 to remove +const int NWNX_APPEARANCE_TYPE_WING_TYPE = 9; ///< CREATURE_WING_TYPE_* or see wingmodel.2da, -1 to remove +const int NWNX_APPEARANCE_TYPE_FOOTSTEP_SOUND = 10; ///< 0-17 or see footstepsounds.2da, -1 to remove + +/// @brief See portraits.2da, -1 to remove +/// @note Does not change the Examine Window portrait. +const int NWNX_APPEARANCE_TYPE_PORTRAIT = 11; +///@} + +/// @brief Override a creature's appearance type for a player. +/// @param oPlayer The player who will see/hear things differently. +/// @param oCreature The target creature whose appearance type to alter for oPlayer. Can be a PC. +/// @param nType The @ref appearance_types "Appearance Type" to set or -1 to fully remove override. +/// @param nValue The new value for the appearance type. +void NWNX_Appearance_SetOverride(object oPlayer, object oCreature, int nType, int nValue); + +/// @brief Get a creature's appearance type for a player. +/// @param oPlayer The player who see/hear things differently. +/// @param oCreature The target creature whose appearance type is altered for oPlayer. Can be a PC. +/// @param nType The @ref appearance_types "Appearance Type" to get. +/// @return The value for the appearance type or -1 when not set. +int NWNX_Appearance_GetOverride(object oPlayer, object oCreature, int nType); + +/// @} + +void NWNX_Appearance_SetOverride(object oPlayer, object oCreature, int nType, int nValue) +{ + NWNXPushInt(nValue); + NWNXPushInt(nType); + NWNXPushObject(oCreature); + NWNXPushObject(oPlayer); + NWNXCall(NWNX_Appearance, "SetOverride"); +} + +int NWNX_Appearance_GetOverride(object oPlayer, object oCreature, int nType) +{ + 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 new file mode 100644 index 00000000..ee261ad5 --- /dev/null +++ b/_module/nss/nwnx_area.nss @@ -0,0 +1,747 @@ +/// @addtogroup area Area +/// @brief Functions exposing additional area properties as well as creating transitions. +/// @{ +/// @file nwnx_area.nss + +const string NWNX_Area = "NWNX_Area"; ///< @private + +/// @name Area PVP Settings +/// @anchor area_pvp +/// @{ +const int NWNX_AREA_PVP_SETTING_NO_PVP = 0; +const int NWNX_AREA_PVP_SETTING_PARTY_PVP = 1; +const int NWNX_AREA_PVP_SETTING_FULL_PVP = 2; +const int NWNX_AREA_PVP_SETTING_SERVER_DEFAULT = 3; +/// @} + +/// @name Area Weather Settings +/// @anchor area_weather +/// @{ +const int NWNX_AREA_WEATHER_CHANCE_RAIN = 0; +const int NWNX_AREA_WEATHER_CHANCE_SNOW = 1; +const int NWNX_AREA_WEATHER_CHANCE_LIGHTNING = 2; +/// @} + +/// @name Area Day Night Cycle Settings +/// @anchor area_daynight +/// @{ +const int NWNX_AREA_DAYNIGHTCYCLE_CYCLE_DAY_NIGHT = 0; +const int NWNX_AREA_DAYNIGHTCYCLE_ALWAYS_BRIGHT = 1; +const int NWNX_AREA_DAYNIGHTCYCLE_ALWAYS_DARK = 2; +/// @} + +/// @name Area Sun/Moon Color Settings +/// @anchor area_color +/// @{ +const int NWNX_AREA_COLOR_TYPE_MOON_AMBIENT = 0; +const int NWNX_AREA_COLOR_TYPE_MOON_DIFFUSE = 1; +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. +int NWNX_Area_GetNumberOfPlayersInArea(object area); + +/// @brief Gets the creature that last entered area. +/// @param area The area object. +/// @return The most recent creature to enter the area. +object NWNX_Area_GetLastEntered(object area); + +/// @brief Gets the creature that last left area +/// @param area The area object. +object NWNX_Area_GetLastLeft(object area); + +/// @brief Get the PVP setting of area +/// @param area The area object. +/// @return Returns the @ref area_pvp "PVP Setting" for the area. +int NWNX_Area_GetPVPSetting(object area); + +/// @brief Set the PVP setting of area +/// @param area The area object. +/// @param pvpSetting One of @ref area_pvp the "PVP Settings". +void NWNX_Area_SetPVPSetting(object area, int pvpSetting); + +/// @brief Get the spot modifier of area +/// @param area The area object. +/// @return The value of the Spot skill modifier for this area. +int NWNX_Area_GetAreaSpotModifier(object area); + +/// @brief Set the spot modifier of area +/// @param area The area object. +/// @param spotModifier The modifier to the Spot skill for this area. +/// @sa NWNX_SkillRanks_SetAreaModifier() to change any skill modifier. +void NWNX_Area_SetAreaSpotModifier(object area, int spotModifier); + +/// @brief Get the listen modifier of area +/// @param area The area object. +/// @return The value of the Listen skill modifier for this area. +int NWNX_Area_GetAreaListenModifier(object area); + +/// @brief Set the listen modifier of area +/// @param area The area object. +/// @param listenModifier The modifier to the Listen skill for this area. +/// @sa NWNX_SkillRanks_SetAreaModifier() to change any skill modifier. +void NWNX_Area_SetAreaListenModifier(object area, int listenModifier); + +/// @brief Checks the No Resting area flag +/// @param area The area object. +/// @return TRUE if resting is not allowed in area. +int NWNX_Area_GetNoRestingAllowed(object area); + +/// @brief Set whether to disable resting in the area. +/// @param area The area object. +/// @param bNoRestingAllowed TRUE to disable resting in the area. +void NWNX_Area_SetNoRestingAllowed(object area, int bNoRestingAllowed); + +/// @brief Get the wind power in area +/// @param area The area object. +/// @return The wind power for the area. (0-2) +int NWNX_Area_GetWindPower(object area); + +/// @brief Set the wind power in area +/// @param area The area object. +/// @param windPower Set to 0, 1 or 2. +void NWNX_Area_SetWindPower(object area, int windPower); + +/// @brief Get the weather chance of type in area +/// @param type A @ref area_weather "Weather Setting". +/// @param area The area object. +/// @return The percentage chance for the weather type. (0-100) +int NWNX_Area_GetWeatherChance(object area, int type); + +/// @brief Set the weather chance of type in area +/// @param area The area object. +/// @param type A @ref area_weather "Weather Setting". +/// @param chance The chance this weather event occurs. +void NWNX_Area_SetWeatherChance(object area, int type, int chance); + +/// @brief Get the fog clip distance in area +/// @param area The area object. +/// @return The fog clip distance. +float NWNX_Area_GetFogClipDistance(object area); + +/// @brief Set the fog clip distance in area +/// @param area The area object. +/// @param distance The new fog clip distance. +void NWNX_Area_SetFogClipDistance(object area, float distance); + +/// @brief Get the shadow opacity of area +/// @param area The area object. +/// @return The shadow opacity for the area. (0-100) +int NWNX_Area_GetShadowOpacity(object area); + +/// @brief Set the shadow opacity of area +/// @param area The area object. +/// @param shadowOpacity The shadow opacity to set for the area (0-100). +void NWNX_Area_SetShadowOpacity(object area, int shadowOpacity); + +/// @brief Get the day/night cycle of area +/// @param area The area object. +/// @return The @ref area_daynight "Day Night Cycle Setting". +int NWNX_Area_GetDayNightCycle(object area); + +/// @brief Set the day/night cycle of area +/// @param area The area object. +/// @param type = A @ref area_daynight "Day Night Cycle Setting". +void NWNX_Area_SetDayNightCycle(object area, int type); + +/// @brief Get the Sun/Moon Ambient/Diffuse colors of area +/// @param area The area object. +/// @param type = A @ref area_color "Sun/Moon Color Setting". +/// @return A FOG_COLOR_* or a custom value, -1 on error. +int NWNX_Area_GetSunMoonColors(object area, int type); + +/// @brief Set the Sun/Moon Ambient/Diffuse colors of area +// type = NWNX_AREA_COLOR_TYPE_* +/// @param area The area object. +/// @param type = A @ref area_color "Sun/Moon Color Setting". +/// @param color = A FOG_COLOR_*. +/// @note The color can also be represented as a hex RGB number if specific color shades are desired. +/// The format of a hex specified color would be 0xFFEEDD where +/// * FF would represent the amount of red in the color +/// * EE would represent the amount of green in the color +/// * DD would represent the amount of blue in the color. +void NWNX_Area_SetSunMoonColors(object area, int type, int color); + +/// @brief Create and returns a transition (square shaped of specified size) at a location. +/// @param area The area object. +/// @param target A door or waypoint object. +/// @param x,y,z The position to create the transition. +/// @param size The size of the square. +/// @param tag If specified, the returning object will have this tag. +/// @sa NWNX_Object_SetTriggerGeometry() if you wish to draw the transition as something other than a square. +object NWNX_Area_CreateTransition(object area, object target, float x, float y, float z, float size = 2.0f, string tag=""); + +/// @brief Get the state of a tile animation loop. +/// @param oArea The area object. +/// @param fTileX, fTileY The coordinates of the tile. +/// @param nAnimLoop The loop to check. (1-3) +/// @return TRUE if the loop is enabled. +int NWNX_Area_GetTileAnimationLoop(object oArea, float fTileX, float fTileY, int nAnimLoop); + +/// @brief Set the state of a tile animation loop. +/// @param oArea The area object. +/// @param fTileX, fTileY The coordinates of the tile. +/// @param nAnimLoop The loop to set (1-3). +/// @param bEnabled TRUE or FALSE. +/// @note Requires clients to re-enter the area for it to take effect +void NWNX_Area_SetTileAnimationLoop(object oArea, float fTileX, float fTileY, int nAnimLoop, int bEnabled); + +/// @brief Get the name of the tile model from any location. +/// @param oArea The area name. +/// @param fTileX, fTileY The coordinates of the tile. +string NWNX_Area_GetTileModelResRef(object oArea, float fTileX, float fTileY); + +/// @brief Test to see if there's a direct, walkable line between two points in the area. +/// @param oArea The area object. +/// @param fStartX, fStartY The starting points. +/// @param fEndX, fEndY The ending points. +/// @param fPerSpace The personal space of a creature. Found in appearance.2da. +/// @param fHeight The height of a creature. Found in appearance.2da. +/// @param bIgnoreDoors Whether to ignore doors in the check. +/// @return +/// * 1 if there is a direct walkable line. +/// * -1 if the line is blocked by terrain. +/// * -2 if the line is blocked by a placeable. +/// * -3 if the line is blocked by a creature. +int NWNX_Area_TestDirectLine(object oArea, float fStartX, float fStartY, float fEndX, float fEndY, float fPerSpace, float fHeight, int bIgnoreDoors=FALSE); + +/// @brief Get if the area music is playing. +/// @param oArea The area object. +/// @param bBattleMusic Set to TRUE to get if the battle music is playing. +/// @return TRUE if music is playing +int NWNX_Area_GetMusicIsPlaying(object oArea, int bBattleMusic = FALSE); + +/// @brief Create and return a generic trigger (square shaped of specified size) at a location. +/// @param oArea The area object. +/// @param fX, fY, fZ The position to create the trigger. +/// @param sTag If specified, the returned trigger will have this tag. +/// @param fSize The size of the square. +/// @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 Usable 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) +{ + NWNXPushObject(area); + NWNXCall(NWNX_Area, "GetNumberOfPlayersInArea"); + return NWNXPopInt(); +} + +object NWNX_Area_GetLastEntered(object area) +{ + NWNXPushObject(area); + NWNXCall(NWNX_Area, "GetLastEntered"); + return NWNXPopObject(); +} + +object NWNX_Area_GetLastLeft(object area) +{ + NWNXPushObject(area); + NWNXCall(NWNX_Area, "GetLastLeft"); + return NWNXPopObject(); +} + +int NWNX_Area_GetPVPSetting(object area) +{ + NWNXPushObject(area); + NWNXCall(NWNX_Area, "GetPVPSetting"); + return NWNXPopInt(); +} + +void NWNX_Area_SetPVPSetting(object area, int pvpSetting) +{ + NWNXPushInt(pvpSetting); + NWNXPushObject(area); + NWNXCall(NWNX_Area, "SetPVPSetting"); +} + +int NWNX_Area_GetAreaSpotModifier(object area) +{ + NWNXPushObject(area); + NWNXCall(NWNX_Area, "GetAreaSpotModifier"); + return NWNXPopInt(); +} + +void NWNX_Area_SetAreaSpotModifier(object area, int spotModifier) +{ + NWNXPushInt(spotModifier); + NWNXPushObject(area); + NWNXCall(NWNX_Area, "SetAreaSpotModifier"); +} + +int NWNX_Area_GetAreaListenModifier(object area) +{ + NWNXPushObject(area); + NWNXCall(NWNX_Area, "GetAreaListenModifier"); + return NWNXPopInt(); +} + +void NWNX_Area_SetAreaListenModifier(object area, int listenModifier) +{ + NWNXPushInt(listenModifier); + NWNXPushObject(area); + NWNXCall(NWNX_Area, "SetAreaListenModifier"); +} + +int NWNX_Area_GetNoRestingAllowed(object area) +{ + NWNXPushObject(area); + NWNXCall(NWNX_Area, "GetNoRestingAllowed"); + return NWNXPopInt(); +} + +void NWNX_Area_SetNoRestingAllowed(object area, int bNoRestingAllowed) +{ + NWNXPushInt(bNoRestingAllowed); + NWNXPushObject(area); + NWNXCall(NWNX_Area, "SetNoRestingAllowed"); +} + +int NWNX_Area_GetWindPower(object area) +{ + NWNXPushObject(area); + NWNXCall(NWNX_Area, "GetWindPower"); + return NWNXPopInt(); +} + +void NWNX_Area_SetWindPower(object area, int windPower) +{ + NWNXPushInt(windPower); + NWNXPushObject(area); + NWNXCall(NWNX_Area, "SetWindPower"); +} + +int NWNX_Area_GetWeatherChance(object area, int type) +{ + NWNXPushInt(type); + NWNXPushObject(area); + NWNXCall(NWNX_Area, "GetWeatherChance"); + return NWNXPopInt(); +} + +void NWNX_Area_SetWeatherChance(object area, int type, int chance) +{ + NWNXPushInt(chance); + NWNXPushInt(type); + NWNXPushObject(area); + NWNXCall(NWNX_Area, "SetWeatherChance"); +} + +float NWNX_Area_GetFogClipDistance(object area) +{ + NWNXPushObject(area); + NWNXCall(NWNX_Area, "GetFogClipDistance"); + return NWNXPopFloat(); +} + +void NWNX_Area_SetFogClipDistance(object area, float distance) +{ + NWNXPushFloat(distance); + NWNXPushObject(area); + NWNXCall(NWNX_Area, "SetFogClipDistance"); +} + +int NWNX_Area_GetShadowOpacity(object area) +{ + NWNXPushObject(area); + NWNXCall(NWNX_Area, "GetShadowOpacity"); + return NWNXPopInt(); +} + +void NWNX_Area_SetShadowOpacity(object area, int shadowOpacity) +{ + NWNXPushInt(shadowOpacity); + NWNXPushObject(area); + NWNXCall(NWNX_Area, "SetShadowOpacity"); +} + + +int NWNX_Area_GetDayNightCycle(object area) +{ + NWNXPushObject(area); + NWNXCall(NWNX_Area, "GetDayNightCycle"); + return NWNXPopInt(); +} + +void NWNX_Area_SetDayNightCycle(object area, int type) +{ + NWNXPushInt(type); + NWNXPushObject(area); + NWNXCall(NWNX_Area, "SetDayNightCycle"); +} + +int NWNX_Area_GetSunMoonColors(object area, int type) +{ + NWNXPushInt(type); + NWNXPushObject(area); + NWNXCall(NWNX_Area, "GetSunMoonColors"); + return NWNXPopInt(); +} + +void NWNX_Area_SetSunMoonColors(object area, int type, int color) +{ + 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="") +{ + 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) +{ + NWNXPushInt(nAnimLoop); + NWNXPushFloat(fTileY); + NWNXPushFloat(fTileX); + NWNXPushObject(oArea); + + NWNXCall(NWNX_Area, "GetTileAnimationLoop"); + return NWNXPopInt(); +} + +void NWNX_Area_SetTileAnimationLoop(object oArea, float fTileX, float fTileY, int nAnimLoop, int bEnabled) +{ + NWNXPushInt(bEnabled); + NWNXPushInt(nAnimLoop); + NWNXPushFloat(fTileY); + NWNXPushFloat(fTileX); + NWNXPushObject(oArea); + NWNXCall(NWNX_Area, "SetTileAnimationLoop"); +} + +string NWNX_Area_GetTileModelResRef(object oArea, float fTileX, float fTileY) +{ + 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) +{ + 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) +{ + 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) +{ + 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 new file mode 100644 index 00000000..538fb2b8 --- /dev/null +++ b/_module/nss/nwnx_chat.nss @@ -0,0 +1,139 @@ +/// @addtogroup chat Chat +/// @brief Functions related to chat. +/// @{ +/// @file nwnx_chat.nss + +const string NWNX_Chat = "NWNX_Chat"; ///< @private + +/// @name Chat Channels +/// @anchor chat_channels +/// +/// Constants defining the various chat channels. +/// @{ +const int NWNX_CHAT_CHANNEL_PLAYER_TALK = 1; +const int NWNX_CHAT_CHANNEL_PLAYER_SHOUT = 2; +const int NWNX_CHAT_CHANNEL_PLAYER_WHISPER = 3; +const int NWNX_CHAT_CHANNEL_PLAYER_TELL = 4; +const int NWNX_CHAT_CHANNEL_SERVER_MSG = 5; +const int NWNX_CHAT_CHANNEL_PLAYER_PARTY = 6; +const int NWNX_CHAT_CHANNEL_PLAYER_DM = 14; +const int NWNX_CHAT_CHANNEL_DM_TALK = 17; +const int NWNX_CHAT_CHANNEL_DM_SHOUT = 18; +const int NWNX_CHAT_CHANNEL_DM_WHISPER = 19; +const int NWNX_CHAT_CHANNEL_DM_TELL = 20; +const int NWNX_CHAT_CHANNEL_DM_PARTY = 22; +const int NWNX_CHAT_CHANNEL_DM_DM = 30; +/// @} + +/// @brief Sends a chat message. +/// @remark If no target is provided, then it broadcasts to all eligible targets. +/// @param channel The @ref chat_channels "channel" to send the message. +/// @param message The message to send. +/// @param sender The sender of the message. +/// @param target The receiver of the message. +/// @return TRUE if successful, FALSE otherwise. +int NWNX_Chat_SendMessage(int channel, string message, object sender = OBJECT_SELF, object target = OBJECT_INVALID); + +/// @brief Registers the script which receives all chat messages. +/// @note If a script was previously registered, this one will take over. +/// @param script The script name to handle the chat events. +void NWNX_Chat_RegisterChatScript(string script); + +/// @brief Skips a chat message +/// @note Must be called from a chat or system script handler. +void NWNX_Chat_SkipMessage(); + +/// @brief Gets the chat @ref chat_channels "channel". +/// @note Must be called from a chat or system script handler. +/// @return The @ref chat_channels "channel" the message is sent. +int NWNX_Chat_GetChannel(); + +/// @brief Gets the message. +/// @note Must be called from a chat or system script handler. +/// @return The message sent. +string NWNX_Chat_GetMessage(); + +/// @brief Gets the sender of the message. +/// @note Must be called from a chat or system script handler. +/// @return The object sending the message. +object NWNX_Chat_GetSender(); + +/// @brief Gets the target of the message. +/// @note Must be called from an chat or system script handler. +/// @return The target of the message or OBJECT_INVALID if no target. +object NWNX_Chat_GetTarget(); + +/// @brief Sets the distance with which the player hears talks or whispers. +/// @remark Per player settings override server wide. +/// @param distance The distance in meters. +/// @param listener The listener, if OBJECT_INVALID then it will be set server wide. +/// @param channel The @ref chat_channels "channel" to modify the distance heard. Only applicable for talk and whisper. +void NWNX_Chat_SetChatHearingDistance(float distance, object listener = OBJECT_INVALID, int channel = NWNX_CHAT_CHANNEL_PLAYER_TALK); + +/// @brief Gets the distance with which the player hears talks or whisper +/// @param listener The listener, if OBJECT_INVALID then will return server wide setting. +/// @param channel The @ref chat_channels "channel". Only applicable for talk and whisper. +float NWNX_Chat_GetChatHearingDistance(object listener = OBJECT_INVALID, int channel = NWNX_CHAT_CHANNEL_PLAYER_TALK); + +/// @} + +int NWNX_Chat_SendMessage(int channel, string message, object sender = OBJECT_SELF, object target = OBJECT_INVALID) +{ + NWNXPushObject(target); + NWNXPushObject(sender); + NWNXPushString(message); + NWNXPushInt(channel); + NWNXCall(NWNX_Chat, "SendMessage"); + return NWNXPopInt(); +} + +void NWNX_Chat_RegisterChatScript(string script) +{ + NWNXPushString(script); + NWNXCall(NWNX_Chat, "RegisterChatScript"); +} + +void NWNX_Chat_SkipMessage() +{ + NWNXCall(NWNX_Chat, "SkipMessage"); +} + +int NWNX_Chat_GetChannel() +{ + NWNXCall(NWNX_Chat, "GetChannel"); + return NWNXPopInt(); +} + +string NWNX_Chat_GetMessage() +{ + NWNXCall(NWNX_Chat, "GetMessage"); + return NWNXPopString(); +} + +object NWNX_Chat_GetSender() +{ + NWNXCall(NWNX_Chat, "GetSender"); + return NWNXPopObject(); +} + +object NWNX_Chat_GetTarget() +{ + NWNXCall(NWNX_Chat, "GetTarget"); + return NWNXPopObject(); +} + +void NWNX_Chat_SetChatHearingDistance(float distance, object listener = OBJECT_INVALID, int channel = NWNX_CHAT_CHANNEL_PLAYER_TALK) +{ + 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) +{ + NWNXPushInt(channel); + NWNXPushObject(listener); + NWNXCall(NWNX_Chat, "GetChatHearingDistance"); + return NWNXPopFloat(); +} diff --git a/_module/nss/nwnx_consts.nss b/_module/nss/nwnx_consts.nss new file mode 100644 index 00000000..3562ec79 --- /dev/null +++ b/_module/nss/nwnx_consts.nss @@ -0,0 +1,182 @@ +/// @ingroup nwnx +/// @addtogroup consts NWNX Constants +/// @brief Provides various NWScript <-> Engine Constants Translation Table functions +/// @{ +/// @file nwnx_consts.nss + +/// @brief Translates ANIMATION_LOOPING_* and ANIMATION_FIREFORGET_* constants to their engine equivalent. +/// @param nAnimation The nwn animation constant +/// @return The engine equivalent of the constant +int NWNX_Consts_TranslateNWScriptAnimation(int nAnimation); + +/// @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 engine equivalent of the constant +int NWNX_Consts_TranslateNWScriptObjectType(int nObjectType); + + +int NWNX_Consts_TranslateNWScriptAnimation(int nAnimation) +{ + switch (nAnimation) + { + case ANIMATION_LOOPING_PAUSE: nAnimation = 0; break; + case ANIMATION_LOOPING_PAUSE2: nAnimation = 52; break; + case ANIMATION_LOOPING_LISTEN: nAnimation = 30; break; + case ANIMATION_LOOPING_MEDITATE: nAnimation = 32; break; + case ANIMATION_LOOPING_WORSHIP: nAnimation = 33; break; + case ANIMATION_LOOPING_LOOK_FAR: nAnimation = 48; break; + case ANIMATION_LOOPING_SIT_CHAIR: nAnimation = 36; break; + case ANIMATION_LOOPING_SIT_CROSS: nAnimation = 47; break; + case ANIMATION_LOOPING_TALK_NORMAL: nAnimation = 38; break; + case ANIMATION_LOOPING_TALK_PLEADING: nAnimation = 39; break; + case ANIMATION_LOOPING_TALK_FORCEFUL: nAnimation = 40; break; + case ANIMATION_LOOPING_TALK_LAUGHING: nAnimation = 41; break; + case ANIMATION_LOOPING_GET_LOW: nAnimation = 59; break; + case ANIMATION_LOOPING_GET_MID: nAnimation = 60; break; + case ANIMATION_LOOPING_PAUSE_TIRED: nAnimation = 57; break; + case ANIMATION_LOOPING_PAUSE_DRUNK: nAnimation = 58; break; + case ANIMATION_LOOPING_DEAD_FRONT: nAnimation = 6; break; + case ANIMATION_LOOPING_DEAD_BACK: nAnimation = 8; break; + case ANIMATION_LOOPING_CONJURE1: nAnimation = 15; break; + case ANIMATION_LOOPING_CONJURE2: nAnimation = 16; break; + case ANIMATION_LOOPING_SPASM: nAnimation = 93; break; + case ANIMATION_LOOPING_CUSTOM1: nAnimation = 97; break; + case ANIMATION_LOOPING_CUSTOM2: nAnimation = 98; break; + case ANIMATION_LOOPING_CUSTOM3: nAnimation = 101; break; + case ANIMATION_LOOPING_CUSTOM4: nAnimation = 102; break; + case ANIMATION_LOOPING_CUSTOM5: nAnimation = 103; break; + case ANIMATION_LOOPING_CUSTOM6: nAnimation = 104; break; + case ANIMATION_LOOPING_CUSTOM7: nAnimation = 105; break; + case ANIMATION_LOOPING_CUSTOM8: nAnimation = 106; break; + case ANIMATION_LOOPING_CUSTOM9: nAnimation = 107; break; + case ANIMATION_LOOPING_CUSTOM10: nAnimation = 108; break; + case ANIMATION_LOOPING_CUSTOM11: nAnimation = 109; break; + case ANIMATION_LOOPING_CUSTOM12: nAnimation = 110; break; + case ANIMATION_LOOPING_CUSTOM13: nAnimation = 111; break; + case ANIMATION_LOOPING_CUSTOM14: nAnimation = 112; break; + case ANIMATION_LOOPING_CUSTOM15: nAnimation = 113; break; + case ANIMATION_LOOPING_CUSTOM16: nAnimation = 114; break; + case ANIMATION_LOOPING_CUSTOM17: nAnimation = 115; break; + case ANIMATION_LOOPING_CUSTOM18: nAnimation = 116; break; + case ANIMATION_LOOPING_CUSTOM19: nAnimation = 117; break; + case ANIMATION_LOOPING_CUSTOM20: nAnimation = 118; break; + case ANIMATION_MOUNT1: nAnimation = 119; break; + case ANIMATION_DISMOUNT1: nAnimation = 120; break; + case ANIMATION_FIREFORGET_HEAD_TURN_LEFT: nAnimation = 53; break; + case ANIMATION_FIREFORGET_HEAD_TURN_RIGHT: nAnimation = 54; break; + case ANIMATION_FIREFORGET_PAUSE_SCRATCH_HEAD: nAnimation = 55; break; + case ANIMATION_FIREFORGET_PAUSE_BORED: nAnimation = 56; break; + case ANIMATION_FIREFORGET_SALUTE: nAnimation = 34; break; + case ANIMATION_FIREFORGET_BOW: nAnimation = 35; break; + case ANIMATION_FIREFORGET_STEAL: nAnimation = 37; break; + case ANIMATION_FIREFORGET_GREETING: nAnimation = 29; break; + case ANIMATION_FIREFORGET_TAUNT: nAnimation = 28; break; + case ANIMATION_FIREFORGET_VICTORY1: nAnimation = 44; break; + case ANIMATION_FIREFORGET_VICTORY2: nAnimation = 45; break; + case ANIMATION_FIREFORGET_VICTORY3: nAnimation = 46; break; + case ANIMATION_FIREFORGET_READ: nAnimation = 71; break; + case ANIMATION_FIREFORGET_DRINK: nAnimation = 70; break; + case ANIMATION_FIREFORGET_DODGE_SIDE: nAnimation = 90; break; + case ANIMATION_FIREFORGET_DODGE_DUCK: nAnimation = 91; break; + case ANIMATION_FIREFORGET_SPASM: nAnimation = 23; break; + default: nAnimation = 0; break; + } + + 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) + { + case OBJECT_TYPE_ALL: nObjectType = 0; break; + case OBJECT_TYPE_AREA_OF_EFFECT: nObjectType = 11; break; + case OBJECT_TYPE_CREATURE: nObjectType = 5; break; + case OBJECT_TYPE_DOOR: nObjectType = 10; break; + case OBJECT_TYPE_ENCOUNTER: nObjectType = 13; break; + case OBJECT_TYPE_ITEM: nObjectType = 6; break; + case OBJECT_TYPE_PLACEABLE: nObjectType = 9; break; + case OBJECT_TYPE_STORE: nObjectType = 14; break; + case OBJECT_TYPE_TRIGGER: nObjectType = 7; break; + case OBJECT_TYPE_WAYPOINT: nObjectType = 12; break; + default: nObjectType = 0; break; + } + + return nObjectType; +} +/// @} // End of consts diff --git a/_module/nss/nwnx_core.nss b/_module/nss/nwnx_core.nss new file mode 100644 index 00000000..74b02377 --- /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 new file mode 100644 index 00000000..46154204 --- /dev/null +++ b/_module/nss/nwnx_creature.nss @@ -0,0 +1,2281 @@ +/// @addtogroup creature Creature +/// @brief Functions exposing additional creature properties. +/// @{ +/// @file nwnx_creature.nss + +const string NWNX_Creature = "NWNX_Creature"; ///< @private + +/// @name Creature Movement Rates +/// @anchor creature_movement_rates +/// +/// The various types of movement rates. +/// @{ +const int NWNX_CREATURE_MOVEMENT_RATE_PC = 0; +const int NWNX_CREATURE_MOVEMENT_RATE_IMMOBILE = 1; +const int NWNX_CREATURE_MOVEMENT_RATE_VERY_SLOW = 2; +const int NWNX_CREATURE_MOVEMENT_RATE_SLOW = 3; +const int NWNX_CREATURE_MOVEMENT_RATE_NORMAL = 4; +const int NWNX_CREATURE_MOVEMENT_RATE_FAST = 5; +const int NWNX_CREATURE_MOVEMENT_RATE_VERY_FAST = 6; +const int NWNX_CREATURE_MOVEMENT_RATE_DEFAULT = 7; +const int NWNX_CREATURE_MOVEMENT_RATE_DM_FAST = 8; +/// @} + +/// @name Creature Movement Types +/// @anchor creature_movement_types +/// +/// The various types of movement types. +/// @{ +const int NWNX_CREATURE_MOVEMENT_TYPE_STATIONARY = 0; +const int NWNX_CREATURE_MOVEMENT_TYPE_WALK = 1; +const int NWNX_CREATURE_MOVEMENT_TYPE_RUN = 2; +const int NWNX_CREATURE_MOVEMENT_TYPE_SIDESTEP = 3; +const int NWNX_CREATURE_MOVEMENT_TYPE_WALK_BACKWARDS = 4; +/// @} + +/// @name Bonus Types +/// @anchor bonus_types +/// +/// Used with NWNX_Creature_GetTotalEffectBonus() these are the types of temporary bonuses from effects. +/// @{ +const int NWNX_CREATURE_BONUS_TYPE_ATTACK = 1; +const int NWNX_CREATURE_BONUS_TYPE_DAMAGE = 2; +const int NWNX_CREATURE_BONUS_TYPE_SAVING_THROW = 3; +const int NWNX_CREATURE_BONUS_TYPE_ABILITY = 4; +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 +{ + int id; ///< The spell id + int ready; ///< Whether it can be used + int level; ///< The level of the ability +}; + +/// @brief Gives the creature a feat. +/// @param creature The creature object. +/// @param feat The feat id. +/// @remark Consider also using NWNX_Creature_AddFeatByLevel() to properly allocate the feat to a level +void NWNX_Creature_AddFeat(object creature, int feat); + +/// @brief Gives 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 Adds the feat to the stat list at the provided level. +void NWNX_Creature_AddFeatByLevel(object creature, int feat, int level); + +/// @brief Removes a feat from a creature. +/// @param creature The creature object. +/// @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. +/// @param feat The feat id. +/// @return TRUE if the creature has the feat, regardless if they have any usages left or not. +int NWNX_Creature_GetKnowsFeat(object creature, int feat); + +/// @brief Returns the count of feats learned at the provided level. +/// @param creature The creature object. +/// @param level The level. +/// @return The count of feats. +int NWNX_Creature_GetFeatCountByLevel(object creature, int level); + +/// @brief Returns the feat learned at the level and index. +/// @param creature The creature object. +/// @param level The level. +/// @param index The index. Index bounds: 0 <= index < NWNX_Creature_GetFeatCountByLevel(). +/// @return The feat id at the index. +int NWNX_Creature_GetFeatByLevel(object creature, int level, int index); + +/// @brief Returns the creature level where the specified feat was learned. +/// @param creature The creature object. +/// @param feat The feat id. +/// @return The character level that the specified feat was granted, otherwise 0 if the creature does not have this feat. +int NWNX_Creature_GetFeatGrantLevel(object creature, int feat); + +/// @brief Get the total number of feats known by creature. +/// @param creature The creature object. +/// @return The total feat count for the creature. +int NWNX_Creature_GetFeatCount(object creature); + +/// @brief Returns the creature's feat at a given index +/// @param creature The creature object. +/// @param index The index. Index bounds: 0 <= index < NWNX_Creature_GetFeatCount(); +/// @return The feat id at the index. +int NWNX_Creature_GetFeatByIndex(object creature, int index); + +/// @brief Gets if creature meets feat requirements. +/// @param creature The creature object. +/// @param feat The feat id. +/// @return TRUE if creature meets all requirements to take given feat +int NWNX_Creature_GetMeetsFeatRequirements(object creature, int feat); + +/// @brief Gets the count of special abilities of the creature. +/// @param creature The creature object. +/// @return The total special ability count. +int NWNX_Creature_GetSpecialAbilityCount(object creature); + +/// @brief Returns the creature's special ability at a given index. +/// @param creature The creature object. +/// @param index The index. Index bounds: 0 <= index < NWNX_Creature_GetSpecialAbilityCount(). +/// @return An NWNX_Creature_SpecialAbility struct. +struct NWNX_Creature_SpecialAbility NWNX_Creature_GetSpecialAbility(object creature, int index); + +/// @brief Adds a special ability to a creature. +/// @param creature The creature object. +/// @param ability An NWNX_Creature_SpecialAbility struct. +void NWNX_Creature_AddSpecialAbility(object creature, struct NWNX_Creature_SpecialAbility ability); + +/// @brief Removes a special ability from a creature. +/// @param creature The creature object. +/// @param index The index. Index bounds: 0 <= index < NWNX_Creature_GetSpecialAbilityCount(). +void NWNX_Creature_RemoveSpecialAbility(object creature, int index); + +/// @brief Sets a special ability at the index for the creature. +/// @param creature The creature object. +/// @param index The index. Index bounds: 0 <= index < NWNX_Creature_GetSpecialAbilityCount(). +/// @param ability An NWNX_Creature_SpecialAbility struct. +void NWNX_Creature_SetSpecialAbility(object creature, int index, struct NWNX_Creature_SpecialAbility ability); + +/// @brief Get the class taken by the creature at the provided level. +/// @param creature The creature object. +/// @param level The level. +/// @return The class id. +int NWNX_Creature_GetClassByLevel(object creature, int level); + +/// @brief Sets the base AC for the creature. +/// @param creature The creature object. +/// @param ac The base AC to set for the creature. +void NWNX_Creature_SetBaseAC(object creature, int ac); + +/// @brief Get the base AC for the creature. +/// @param creature The creature object. +/// @return The base AC. +int NWNX_Creature_GetBaseAC(object creature); + +/// @brief Sets the ability score of the creature to the provided value. +/// @note Does not apply racial bonuses/penalties. +/// @param creature The creature object. +/// @param ability The ability constant. +/// @param value The value to set. +void NWNX_Creature_SetRawAbilityScore(object creature, int ability, int value); + +/// @brief Gets the ability score of the creature. +/// @note Does not apply racial bonuses/penalties. +/// @param creature The creature object. +/// @param ability The ability constant. +/// @return The ability score. +int NWNX_Creature_GetRawAbilityScore(object creature, int ability); + +/// @brief Adjusts the ability score of a creature. +/// @note Does not apply racial bonuses/penalties. +/// @param creature The creature object. +/// @param ability The ability constant. +/// @param modifier The modifier value. +void NWNX_Creature_ModifyRawAbilityScore(object creature, int ability, int modifier); + +/// @brief Gets the raw ability score a polymorphed creature had prior to polymorphing. +/// @note For Strength, Dexterity and Constitution only. +/// @param creature The creature object. +/// @param ability The ability constant. +/// @return The raw ability score. +int NWNX_Creature_GetPrePolymorphAbilityScore(object creature, int ability); + +/// @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) +/// @param level The spell level. +/// @return The remaining spell slot count. +int NWNX_Creature_GetRemainingSpellSlots(object creature, int class, int level); + +/// @brief Sets the remaining spell slots (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. +/// @param slots The remaining spell slots to set. +void NWNX_Creature_SetRemainingSpellSlots(object creature, int class, int level, int slots); + +/// @brief Gets the maximum spell slots (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 maximum spell slot count. +int NWNX_Creature_GetMaxSpellSlots(object creature, int class, int level); + +/// @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) +/// @param level The spell level. +/// @param spellId The spell to remove. +void NWNX_Creature_AddKnownSpell(object creature, int class, int level, int spellId); + +/// @brief Remove a spell from creature's spellbook for class. +/// @param creature The creature object. +/// @param class The class id from classes.2da. (Not class index 0-2) +/// @param level The spell level. +/// @param spellId The spell to remove. +void NWNX_Creature_RemoveKnownSpell(object creature, int class, int level, int spellId); + +/// @brief Gets the maximum hit points for creature for level. +/// @param creature The creature object. +/// @param level The level. +/// @return The maximum hit points a creature can have for the class at the provided level. +int NWNX_Creature_GetMaxHitPointsByLevel(object creature, int level); + +/// @brief Sets the maximum hit points for creature. +/// @param creature The creature object. +/// @param level The level. +/// @param value The amount to set the max hit points. +void NWNX_Creature_SetMaxHitPointsByLevel(object creature, int level, int value); + +/// @brief Set creature's movement rate. +/// @param creature The creature object. +/// @param rate The movement rate. +void NWNX_Creature_SetMovementRate(object creature, int rate); + +/// @brief Returns the creature's current movement rate factor. +/// @remark Base movement rate factor is 1.0. +/// @param creature The creature object. +/// @return The current movement rate factor. +float NWNX_Creature_GetMovementRateFactor(object creature); + +/// @brief Sets the creature's current movement rate factor. +/// @note Base movement rate factor is 1.0. +/// @param creature The creature object. +/// @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. +int NWNX_Creature_GetMovementType(object creature); + +/// @brief Sets the maximum movement rate a creature can have while walking (not running) +/// @remark This allows a creature with movement speed enhancements to walk at a normal rate. +/// @param creature The creature object. +/// @param fWalkRate The walk rate to apply. Setting the value to -1.0 will remove the cap. +/// Default value is 2000.0, which is the base human walk speed. +void NWNX_Creature_SetWalkRateCap(object creature, float fWalkRate = 2000.0f); + +/// @brief Set creature's raw good/evil alignment value. +/// @param creature The creature object. +/// @param value The value to set. +void NWNX_Creature_SetAlignmentGoodEvil(object creature, int value); + +/// @brief Set creature's raw law/chaos alignment value. +/// @param creature The creature object. +/// @param value The value to set. +void NWNX_Creature_SetAlignmentLawChaos(object creature, int value); + +/// @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 effectively 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. +/// @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. +/// @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 level The level to set. +void NWNX_Creature_SetLevelByPosition(object creature, int position, int level); + +/// @brief Set creature's base attack bonus (BAB). +/// @note Modifying the BAB will also affect the creature's attacks per round and its +/// eligibility for feats, prestige classes, etc. +/// @param creature The creature object. +/// @param bab The BAB value. Should be between 0 and 254. Setting BAB to 0 will cause the +/// creature to revert to its original BAB based on its classes and levels. A creature can +/// never have an actual BAB of zero. +/// @remark The base game has a function @nwn{SetBaseAttackBonus}, which actually sets +/// the bonus attacks per round for a creature, not the BAB. +void NWNX_Creature_SetBaseAttackBonus(object creature, int bab); + +/// @brief Gets the creatures current attacks per round (using equipped weapon). +/// @param creature The creature object. +/// @param bBaseAPR If TRUE, will return the base attacks per round, based on BAB and +/// equipped weapons, regardless of overrides set by calls to @nwn{SetBaseAttackBonus} builtin function. +/// @return The attacks per round. +int NWNX_Creature_GetAttacksPerRound(object creature, int bBaseAPR = FALSE); + +/// @brief Restore all creature feat uses. +/// @param creature The creature object. +void NWNX_Creature_RestoreFeats(object creature); + +/// @brief Restore all creature special ability uses. +/// @param creature The creature object. +void NWNX_Creature_RestoreSpecialAbilities(object creature); + +/// @brief Restore uses for all items carried by the creature. +/// @param creature The creature object. +void NWNX_Creature_RestoreItems(object creature); + +/// @brief Sets the creature size. +/// @param creature The creature object. +/// @param size Use CREATURE_SIZE_* constants. +void NWNX_Creature_SetSize(object creature, int size); + +/// @brief Gets the creature's remaining unspent skill points. +/// @param creature The creature object. +/// @return The remaining unspent skill points. +int NWNX_Creature_GetSkillPointsRemaining(object creature); + +/// @brief Sets the creature's remaining unspent skill points. +/// @param creature The creature object. +/// @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. +void NWNX_Creature_SetRacialType(object creature, int racialtype); + +/// @brief Sets the creature's gold without sending a feedback message +/// @param creature The creature object. +/// @param gold The amount of gold to set for their creature. +void NWNX_Creature_SetGold(object creature, int gold); + +/// @brief Sets corpse decay time in milliseconds +/// @param creature The creature object. +/// @param nDecayTime The corpse decay time. +void NWNX_Creature_SetCorpseDecayTime(object creature, int nDecayTime); + +/// @brief Gets the creature's base save. +/// @param creature The creature object. +/// @param which One of SAVING_THROW_FORT, SAVING_THROW_REFLEX or SAVING_THROW_WILL +/// @return The base save value. +/// @note This will include any modifiers set in the toolset. +int NWNX_Creature_GetBaseSavingThrow(object creature, int which); + +/// @brief Sets the creature's base save. +/// @param creature The creature object. +/// @param which One of SAVING_THROW_FORT, SAVING_THROW_REFLEX or SAVING_THROW_WILL +/// @param value The base save value. +void NWNX_Creature_SetBaseSavingThrow(object creature, int which, int value); + +/// @brief Add levels of class to the creature, bypassing all validation +/// @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, int package = PACKAGE_INVALID); + +/// @brief Remove last levels from a creature. +/// @param creature The creature object. +/// @param count The amount of levels to decrement. +/// @note This will not work on player characters. +void NWNX_Creature_LevelDown(object creature, int count=1); + +/// @brief Sets the creature's challenge rating +/// @param creature The creature object. +/// @param fCR The challenge rating. +void NWNX_Creature_SetChallengeRating(object creature, float fCR); + +/// @brief Returns the creature's highest attack bonus based on its own stats. +/// @note AB vs. Type and +AB on Gauntlets are excluded +/// @param creature The creature object. +/// @param isMelee +/// * TRUE: Get Melee/Unarmed Attack Bonus +/// * FALSE: Get Ranged Attack Bonus +/// * -1: Get Attack Bonus depending on the weapon creature has equipped in its right hand +/// Defaults to Melee Attack Bonus if weapon is invalid or no weapon +/// @param isTouchAttack If the attack was a touch attack. +/// @param isOffhand If the attack was with the offhand. +/// @param includeBaseAttackBonus Should the result include the base attack bonus. +/// @return The highest attack bonus. +int NWNX_Creature_GetAttackBonus(object creature, int isMelee = -1, int isTouchAttack = FALSE, int isOffhand = FALSE, int includeBaseAttackBonus = TRUE); + +/// @brief Get highest level version of feat possessed by creature. +/// @remark For feats that increment in power, for example, barbarian rage. +/// @param creature The creature object. +/// @param feat The feat id. +/// @return The highest level version of the feat. +int NWNX_Creature_GetHighestLevelOfFeat(object creature, int feat); + +/// @brief Get feat remaining uses. +/// @param creature The creature object. +/// @param feat The feat id. +/// @return The amount of remaining uses. +int NWNX_Creature_GetFeatRemainingUses(object creature, int feat); + +/// @brief Get feat total uses. +/// @param creature The creature object. +/// @param feat The feat id. +/// @return The total uses. +int NWNX_Creature_GetFeatTotalUses(object creature, int feat); + +/// @brief Set feat remaining uses. +/// @param creature The creature object. +/// @param feat The feat id. +/// @param uses The amount of remaining uses. +void NWNX_Creature_SetFeatRemainingUses(object creature, int feat, int uses); + +/// @brief Get total effect bonus +/// @remark This exposes the actual bonus value beyond a player's base scores to attack, damage bonus, saves, +/// skills, ability scores, and touch attack provided by spells, equipment, potions etc. +/// @param creature The creature object. +/// @param bonusType A @ref bonus_types "Bonus Type" +/// @param target A target object. Used to calculate bonuses versus specific races, alignments, etc. +/// @param isElemental If a damage bonus includes elemental damage. +/// @param isForceMax If the bonus should return the maximum possible. +/// @param savetype A SAVING_THROW_* constant. +/// @param saveSpecificType A SAVING_THROW_TYPE_* constant. +/// @param skill A skill id. +/// @param abilityScore An ABILITY_* constant. +/// @param isOffhand Whether the attack is an offhand attack. +/// @return The bonus value. +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); + +/// @brief Set the original first or last name of creature +/// @param creature The creature object. +/// @param name The name to give the creature. +/// @param isLastName TRUE to change their last name, FALSE for first. +/// @note For PCs this will persist to the .bic file if saved. Requires a relog to update. +void NWNX_Creature_SetOriginalName(object creature, string name, int isLastName); + +/// @brief Get the original first or last name of creature +/// @param creature The creature object. +/// @param isLastName TRUE to get last name, FALSE for first name. +/// @return The original first or last name of the creature. +string NWNX_Creature_GetOriginalName(object creature, int isLastName); + +/// @brief Set creature's spell resistance +/// @param creature The creature object. +/// @param sr The spell resistance. +/// @warning This setting will be overwritten by effects and once those effects fade the old setting (typically 0) will be set. +void NWNX_Creature_SetSpellResistance(object creature, int sr); + +/// @brief Set creature's animal companion creature type +/// @param creature The master creature object. +/// @param type The type from ANIMAL_COMPANION_CREATURE_TYPE_*. +void NWNX_Creature_SetAnimalCompanionCreatureType(object creature, int type); + +/// @brief Set creature's familiar creature type +/// @param creature The master creature object. +/// @param type The type from FAMILIAR_CREATURE_TYPE_*. +void NWNX_Creature_SetFamiliarCreatureType(object creature, int type); + +/// @brief Set creature's animal companion's name +/// @param creature The master creature object. +/// @param name The name to give their animal companion. +void NWNX_Creature_SetAnimalCompanionName(object creature, string name); + +/// @brief Set creature's familiar's name +/// @param creature The master creature object. +/// @param name The name to give their familiar. +void NWNX_Creature_SetFamiliarName(object creature, string name); + +/// @brief Get whether the creature can be disarmed. +/// @param creature The creature object. +/// @return TRUE if the creature can be disarmed. +int NWNX_Creature_GetDisarmable(object creature); + +/// @brief Set whether a creature can be disarmed. +/// @param creature The creature object. +/// @param disarmable Set to TRUE if the creature can be disarmed. +void NWNX_Creature_SetDisarmable(object creature, int disarmable); + +/// @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) +/// @param index The first or second domain. +/// @param domain The domain constant to set. +void NWNX_Creature_SetDomain(object creature, int class, int index, int domain); + +/// @brief Sets creature's specialist school. +/// @param creature The creature object. +/// @param class The class id from classes.2da. (Not class index 0-2) +/// @param school The school constant. +void NWNX_Creature_SetSpecialization(object creature, int class, int school); + +/// @brief Sets oCreatures faction to be the faction with id nFactionId. +/// @param oCreature The creature. +/// @param nFactionId The faction id we want the creature to join. +void NWNX_Creature_SetFaction(object oCreature, int nFactionId); + +/// @brief Gets the faction id from oCreature +/// @param oCreature the creature we wish to query against +/// @return faction id as an integer, -1 when used against invalid creature or invalid object. +int NWNX_Creature_GetFaction(object oCreature); + +/// @brief Get whether a creature is flat-footed. +/// @param oCreature The creature object. +/// @return TRUE if the creature is flat-footed. +int NWNX_Creature_GetFlatFooted(object oCreature); + +/// @brief Serialize oCreature's quickbar to a base64 string +/// @param oCreature The creature. +/// @return A base64 string representation of oCreature's quickbar. +string NWNX_Creature_SerializeQuickbar(object oCreature); + +/// @brief Deserialize sSerializedQuickbar for oCreature +/// @param oCreature The creature. +/// @param sSerializedQuickbar A base64 string of a quickbar +/// @return TRUE on success +int NWNX_Creature_DeserializeQuickbar(object oCreature, string sSerializedQuickbar); + +/// @brief Sets a caster level modifier for oCreature +/// @param oCreature the target creature +/// @param nClass the class that this modifier will apply to +/// @param nModifier the modifier to apply +/// @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 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 +int NWNX_Creature_GetCasterLevelModifier(object oCreature, int nClass); + +/// @brief Sets a caster level override for oCreature +/// @param oCreature the target creature +/// @param nClass the class that this modifier will apply to +/// @param nCasterLevel the caster level override to apply +/// @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 +/// @param oCreature the target creature +/// @param nClass the creature caster class +/// @return the current caster level override for the creature or -1 if not set +int NWNX_Creature_GetCasterLevelOverride(object oCreature, int nClass); + +/// @brief Move a creature to limbo. +/// @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 modifier 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 modifier 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); + +/// @brief Gets the creature's number of bonus spells. +/// @param oCreature The creature object. +/// @param nMultiClass The character class position, starting at 0. +/// @param nSpellLevel The spell level, 0 to 9. +int NWNX_Creature_GetNumberOfBonusSpells(object oCreature, int nMultiClass, int nSpellLevel); + +/// @brief Modifies the creature's number of bonus spells. +/// @param oCreature The creature object. +/// @param nMultiClass The character class position, starting at 0. +/// @param nSpellLevel The spell level, 0 to 9. +/// @param nDelta The value to change the number of bonus spells by. Can be negative. +void NWNX_Creature_ModifyNumberBonusSpells(object oCreature, int nMultiClass, int nSpellLevel, int nDelta); + +/// @} + +void NWNX_Creature_AddFeat(object creature, int feat) +{ + NWNXPushInt(feat); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "AddFeat"); +} + +void NWNX_Creature_AddFeatByLevel(object creature, int feat, int level) +{ + NWNXPushInt(level); + NWNXPushInt(feat); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "AddFeatByLevel"); +} + +void NWNX_Creature_RemoveFeat(object creature, int feat) +{ + NWNXPushInt(feat); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "RemoveFeat"); +} + +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) +{ + NWNXPushInt(feat); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "GetKnowsFeat"); + return NWNXPopInt(); +} + +int NWNX_Creature_GetFeatCountByLevel(object creature, int level) +{ + NWNXPushInt(level); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "GetFeatCountByLevel"); + return NWNXPopInt(); +} + +int NWNX_Creature_GetFeatByLevel(object creature, int level, int index) +{ + NWNXPushInt(index); + NWNXPushInt(level); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "GetFeatByLevel"); + return NWNXPopInt(); +} + +int NWNX_Creature_GetFeatCount(object creature) +{ + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "GetFeatCount"); + return NWNXPopInt(); +} + +int NWNX_Creature_GetFeatGrantLevel(object creature, int feat) +{ + NWNXPushInt(feat); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "GetFeatGrantLevel"); + return NWNXPopInt(); +} + +int NWNX_Creature_GetFeatByIndex(object creature, int index) +{ + NWNXPushInt(index); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "GetFeatByIndex"); + return NWNXPopInt(); +} + +int NWNX_Creature_GetMeetsFeatRequirements(object creature, int feat) +{ + NWNXPushInt(feat); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "GetMeetsFeatRequirements"); + return NWNXPopInt(); +} + +struct NWNX_Creature_SpecialAbility NWNX_Creature_GetSpecialAbility(object creature, int index) +{ + struct NWNX_Creature_SpecialAbility ability; + 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) +{ + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "GetSpecialAbilityCount"); + return NWNXPopInt(); +} + +void NWNX_Creature_AddSpecialAbility(object creature, struct NWNX_Creature_SpecialAbility ability) +{ + NWNXPushInt(ability.id); + NWNXPushInt(ability.ready); + NWNXPushInt(ability.level); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "AddSpecialAbility"); +} + +void NWNX_Creature_RemoveSpecialAbility(object creature, int index) +{ + NWNXPushInt(index); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "RemoveSpecialAbility"); +} + +void NWNX_Creature_SetSpecialAbility(object creature, int index, struct NWNX_Creature_SpecialAbility ability) +{ + 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) +{ + NWNXPushInt(level); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "GetClassByLevel"); + return NWNXPopInt(); +} + +void NWNX_Creature_SetBaseAC(object creature, int ac) +{ + NWNXPushInt(ac); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "SetBaseAC"); +} + +int NWNX_Creature_GetBaseAC(object creature) +{ + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "GetBaseAC"); + return NWNXPopInt(); +} + +void NWNX_Creature_SetRawAbilityScore(object creature, int ability, int value) +{ + NWNXPushInt(value); + NWNXPushInt(ability); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "SetRawAbilityScore"); +} + +int NWNX_Creature_GetRawAbilityScore(object creature, int ability) +{ + NWNXPushInt(ability); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "GetRawAbilityScore"); + return NWNXPopInt(); +} + +void NWNX_Creature_ModifyRawAbilityScore(object creature, int ability, int modifier) +{ + NWNXPushInt(modifier); + NWNXPushInt(ability); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "ModifyRawAbilityScore"); +} + +int NWNX_Creature_GetPrePolymorphAbilityScore(object creature, int ability) +{ + NWNXPushInt(ability); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "GetPrePolymorphAbilityScore"); + return NWNXPopInt(); +} + +int NWNX_Creature_GetRemainingSpellSlots(object creature, int class, int level) +{ + NWNXPushInt(level); + NWNXPushInt(class); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "GetRemainingSpellSlots"); + return NWNXPopInt(); +} + +void NWNX_Creature_SetRemainingSpellSlots(object creature, int class, int level, int slots) +{ + NWNXPushInt(slots); + NWNXPushInt(level); + NWNXPushInt(class); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "SetRemainingSpellSlots"); +} + +void NWNX_Creature_RemoveKnownSpell(object creature, int class, int level, int spellId) +{ + NWNXPushInt(spellId); + NWNXPushInt(level); + NWNXPushInt(class); + NWNXPushObject(creature); + + NWNXCall(NWNX_Creature, "RemoveKnownSpell"); +} + +void NWNX_Creature_AddKnownSpell(object creature, int class, int level, int spellId) +{ + NWNXPushInt(spellId); + NWNXPushInt(level); + NWNXPushInt(class); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "AddKnownSpell"); +} + +int NWNX_Creature_GetMaxSpellSlots(object creature, int class, int level) +{ + NWNXPushInt(level); + NWNXPushInt(class); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "GetMaxSpellSlots"); + return NWNXPopInt(); +} + + +int NWNX_Creature_GetMaxHitPointsByLevel(object creature, int level) +{ + NWNXPushInt(level); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "GetMaxHitPointsByLevel"); + return NWNXPopInt(); +} + +void NWNX_Creature_SetMaxHitPointsByLevel(object creature, int level, int value) +{ + NWNXPushInt(value); + NWNXPushInt(level); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "SetMaxHitPointsByLevel"); +} + +void NWNX_Creature_SetMovementRate(object creature, int rate) +{ + NWNXPushInt(rate); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "SetMovementRate"); +} + +float NWNX_Creature_GetMovementRateFactor(object creature) +{ + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "GetMovementRateFactor"); + return NWNXPopFloat(); +} + +void NWNX_Creature_SetMovementRateFactor(object creature, float factor) +{ + NWNXPushFloat(factor); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "SetMovementRateFactor"); +} + +float NWNX_Creature_GetMovementRateFactorCap(object creature) +{ + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "GetMovementRateFactorCap"); + return NWNXPopFloat(); +} + +void NWNX_Creature_SetMovementRateFactorCap(object creature, float cap) +{ + NWNXPushFloat(cap); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "SetMovementRateFactorCap"); +} + +void NWNX_Creature_SetAlignmentGoodEvil(object creature, int value) +{ + NWNXPushInt(value); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "SetAlignmentGoodEvil"); +} + +void NWNX_Creature_SetAlignmentLawChaos(object creature, int value) +{ + NWNXPushInt(value); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "SetAlignmentLawChaos"); +} + +void NWNX_Creature_SetSkillRank(object creature, int skill, int rank) +{ + NWNXPushInt(rank); + NWNXPushInt(skill); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "SetSkillRank"); +} + +int NWNX_Creature_GetSkillRankByLevel(object creature, int skill, int level) +{ + NWNXPushInt(level); + NWNXPushInt(skill); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "GetSkillRankByLevel"); + return NWNXPopInt(); +} + +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) +{ + NWNXPushInt(level); + NWNXPushInt(position); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "SetLevelByPosition"); +} + +void NWNX_Creature_SetBaseAttackBonus(object creature, int bab) +{ + NWNXPushInt(bab); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "SetBaseAttackBonus"); +} + +int NWNX_Creature_GetAttacksPerRound(object creature, int bBaseAPR = FALSE) +{ + NWNXPushInt(bBaseAPR); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "GetAttacksPerRound"); + return NWNXPopInt(); +} + +void NWNX_Creature_RestoreFeats(object creature) +{ + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "RestoreFeats"); +} + +void NWNX_Creature_RestoreSpecialAbilities(object creature) +{ + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "RestoreSpecialAbilities"); +} + +void NWNX_Creature_RestoreItems(object creature) +{ + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "RestoreItems"); +} + +void NWNX_Creature_SetSize(object creature, int size) +{ + NWNXPushInt(size); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "SetSize"); +} + +int NWNX_Creature_GetSkillPointsRemaining(object creature) +{ + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "GetSkillPointsRemaining"); + return NWNXPopInt(); +} + +void NWNX_Creature_SetSkillPointsRemaining(object creature, int skillpoints) +{ + NWNXPushInt(skillpoints); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "SetSkillPointsRemaining"); +} + +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) +{ + NWNXPushInt(racialtype); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "SetRacialType"); +} + +int NWNX_Creature_GetMovementType(object creature) +{ + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "GetMovementType"); + return NWNXPopInt(); +} + +void NWNX_Creature_SetWalkRateCap(object creature, float fWalkRate = 2000.0f) +{ + NWNXPushFloat(fWalkRate); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "SetWalkRateCap"); +} + +void NWNX_Creature_SetGold(object creature, int gold) +{ + NWNXPushInt(gold); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "SetGold"); +} + +void NWNX_Creature_SetCorpseDecayTime(object creature, int nDecayTime) +{ + NWNXPushInt(nDecayTime); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "SetCorpseDecayTime"); +} + +int NWNX_Creature_GetBaseSavingThrow(object creature, int which) +{ + NWNXPushInt(which); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "GetBaseSavingThrow"); + return NWNXPopInt(); +} + +void NWNX_Creature_SetBaseSavingThrow(object creature, int which, int value) +{ + NWNXPushInt(value); + NWNXPushInt(which); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "SetBaseSavingThrow"); +} + +void NWNX_Creature_LevelUp(object creature, int class, int count = 1, int package = PACKAGE_INVALID) +{ + NWNXPushInt(package); + NWNXPushInt(count); + NWNXPushInt(class); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "LevelUp"); +} + +void NWNX_Creature_LevelDown(object creature, int count=1) +{ + NWNXPushInt(count); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "LevelDown"); +} + +void NWNX_Creature_SetChallengeRating(object creature, float fCR) +{ + 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) +{ + if (isMelee == -1) + { + object oWeapon = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, creature); + + if (GetIsObjectValid(oWeapon)) + { + isMelee = !GetWeaponRanged(oWeapon); + } + else + {// Default to melee for unarmed + isMelee = TRUE; + } + } + NWNXPushInt(includeBaseAttackBonus); + NWNXPushInt(isOffhand); + NWNXPushInt(isTouchAttack); + NWNXPushInt(isMelee); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "GetAttackBonus"); + return NWNXPopInt(); +} + +int NWNX_Creature_GetHighestLevelOfFeat(object creature, int feat) +{ + NWNXPushInt(feat); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "GetHighestLevelOfFeat"); + return NWNXPopInt(); +} + +int NWNX_Creature_GetFeatRemainingUses(object creature, int feat) +{ + NWNXPushInt(feat); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "GetFeatRemainingUses"); + return NWNXPopInt(); +} + +int NWNX_Creature_GetFeatTotalUses(object creature, int feat) +{ + NWNXPushInt(feat); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "GetFeatTotalUses"); + return NWNXPopInt(); +} + +void NWNX_Creature_SetFeatRemainingUses(object creature, int feat, int uses) +{ + 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) +{ + 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) +{ + NWNXPushInt(isLastName); + NWNXPushString(name); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "SetOriginalName"); +} + +string NWNX_Creature_GetOriginalName(object creature, int isLastName) +{ + NWNXPushInt(isLastName); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "GetOriginalName"); + return NWNXPopString(); +} + +void NWNX_Creature_SetSpellResistance(object creature, int sr) +{ + NWNXPushInt(sr); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "SetSpellResistance"); +} + +void NWNX_Creature_SetAnimalCompanionCreatureType(object creature, int type) +{ + NWNXPushInt(type); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "SetAnimalCompanionCreatureType"); +} + +void NWNX_Creature_SetFamiliarCreatureType(object creature, int type) +{ + NWNXPushInt(type); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "SetFamiliarCreatureType"); +} + +void NWNX_Creature_SetAnimalCompanionName(object creature, string name) +{ + NWNXPushString(name); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "SetAnimalCompanionName"); +} + +void NWNX_Creature_SetFamiliarName(object creature, string name) +{ + NWNXPushString(name); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "SetFamiliarName"); +} + +int NWNX_Creature_GetDisarmable(object creature) +{ + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "GetDisarmable"); + return NWNXPopInt(); +} + +void NWNX_Creature_SetDisarmable(object creature, int disarmable) +{ + NWNXPushInt(disarmable); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "SetDisarmable"); +} + +void NWNX_Creature_SetDomain(object creature, int class, int index, int domain) +{ + NWNXPushInt(domain); + NWNXPushInt(index); + NWNXPushInt(class); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "SetDomain"); +} + +void NWNX_Creature_SetSpecialization(object creature, int class, int school) +{ + NWNXPushInt(school); + NWNXPushInt(class); + NWNXPushObject(creature); + NWNXCall(NWNX_Creature, "SetSpecialization"); +} + +void NWNX_Creature_SetFaction(object oCreature, int nFactionId) +{ + NWNXPushInt(nFactionId); + NWNXPushObject(oCreature); + NWNXCall(NWNX_Creature, "SetFaction"); +} + +int NWNX_Creature_GetFaction(object oCreature) +{ + NWNXPushObject(oCreature); + NWNXCall(NWNX_Creature, "GetFaction"); + return NWNXPopInt(); +} + +int NWNX_Creature_GetFlatFooted(object oCreature) +{ + NWNXPushObject(oCreature); + NWNXCall(NWNX_Creature, "GetFlatFooted"); + return NWNXPopInt(); +} + +string NWNX_Creature_SerializeQuickbar(object oCreature) +{ + NWNXPushObject(oCreature); + NWNXCall(NWNX_Creature, "SerializeQuickbar"); + return NWNXPopString(); +} + +int NWNX_Creature_DeserializeQuickbar(object oCreature, string sSerializedQuickbar) +{ + NWNXPushString(sSerializedQuickbar); + NWNXPushObject(oCreature); + NWNXCall(NWNX_Creature, "DeserializeQuickbar"); + return NWNXPopInt(); +} + +void NWNX_Creature_SetCasterLevelModifier(object oCreature, int nClass, int nModifier, int bPersist = FALSE) +{ + NWNXPushInt(bPersist); + NWNXPushInt(nModifier); + NWNXPushInt(nClass); + NWNXPushObject(oCreature); + NWNXCall(NWNX_Creature, "SetCasterLevelModifier"); +} + +int NWNX_Creature_GetCasterLevelModifier(object oCreature, int nClass) +{ + NWNXPushInt(nClass); + NWNXPushObject(oCreature); + NWNXCall(NWNX_Creature, "GetCasterLevelModifier"); + return NWNXPopInt(); +} + +void NWNX_Creature_SetCasterLevelOverride(object oCreature, int nClass, int nCasterLevel, int bPersist = FALSE) +{ + NWNXPushInt(bPersist); + NWNXPushInt(nCasterLevel); + NWNXPushInt(nClass); + NWNXPushObject(oCreature); + NWNXCall(NWNX_Creature, "SetCasterLevelOverride"); +} + +int NWNX_Creature_GetCasterLevelOverride(object oCreature, int nClass) +{ + NWNXPushInt(nClass); + NWNXPushObject(oCreature); + NWNXCall(NWNX_Creature, "GetCasterLevelOverride"); + return NWNXPopInt(); +} + +void NWNX_Creature_JumpToLimbo(object oCreature) +{ + 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"); +} + +int NWNX_Creature_GetNumberOfBonusSpells(object oCreature, int nMultiClass, int nSpellLevel) +{ + NWNXPushInt(nSpellLevel); + NWNXPushInt(nMultiClass); + NWNXPushObject(oCreature); + NWNXCall(NWNX_Creature, "GetNumberOfBonusSpells"); + return NWNXPopInt(); +} + +void NWNX_Creature_ModifyNumberBonusSpells(object oCreature, int nMultiClass, int nSpellLevel, int nDelta) +{ + NWNXPushInt(nDelta); + NWNXPushInt(nSpellLevel); + NWNXPushInt(nMultiClass); + NWNXPushObject(oCreature); + NWNXCall(NWNX_Creature, "ModifyNumberBonusSpells"); +} diff --git a/_module/nss/nwnx_damage.nss b/_module/nss/nwnx_damage.nss new file mode 100644 index 00000000..a8bdc048 --- /dev/null +++ b/_module/nss/nwnx_damage.nss @@ -0,0 +1,397 @@ +/// @addtogroup damage Damage +/// @brief Run a script before damage and attack events allowing for modification. Includes function to arbitrarily apply damage. +/// @{ +/// @file nwnx_damage.nss + +const string NWNX_Damage = "NWNX_Damage"; ///< @private + +/// @struct NWNX_Damage_DamageEventData +/// @brief Damage Event Data +struct NWNX_Damage_DamageEventData +{ + object oDamager; ///< The object that inflicted the damage. + int iBludgeoning; ///< Bludgeoning damage + int iPierce; ///< Piercing damage + int iSlash; ///< Slashing damage + int iMagical; ///< Magical damage + int iAcid; ///< Acid damage + int iCold; ///< Cold damage + int iDivine; ///< Divine damage + int iElectrical; ///< Electrical damage + int iFire; ///< Fire damage + int iNegative; ///< Negative damage + 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 +/// @brief Attack Event Data +struct NWNX_Damage_AttackEventData +{ + object oTarget; ///< The target who took the damage + int iBludgeoning; ///< Bludgeoning damage + int iPierce; ///< Piercing damage + int iSlash; ///< Slashing damage + int iMagical; ///< Magical damage + int iAcid; ///< Acid damage + int iCold; ///< Cold damage + int iDivine; ///< Divine damage + int iElectrical; ///< Electrical damage + int iFire; ///< Fire damage + int iNegative; ///< Negative damage + int iPositive; ///< Positive damage + int iSonic; ///< Sonic damage + int iBase; ///< Base damage + int iCustom1; ///< Custom1 damage + int iCustom2; ///< Custom2 damage + int iCustom3; ///< Custom3 damage + int iCustom4; ///< Custom4 damage + int iCustom5; ///< Custom5 damage + int iCustom6; ///< Custom6 damage + int iCustom7; ///< Custom7 damage + int iCustom8; ///< Custom8 damage + int iCustom9; ///< Custom9 damage + int iCustom10; ///< Custom10 damage + int iCustom11; ///< Custom11 damage + int iCustom12; ///< Custom12 damage + int iCustom13; ///< Custom13 damage + int iCustom14; ///< Custom14 damage + int iCustom15; ///< Custom15 damage + int iCustom16; ///< Custom16 damage + int iCustom17; ///< Custom17 damage + int iCustom18; ///< Custom18 damage + int iCustom19; ///< Custom19 damage + int iAttackNumber; ///< 1-based index of the attack in current combat round + int iAttackResult; ///< 1=hit, 2=parried, 3=critical hit, 4=miss, 5=resisted, 7=automatic hit, 8=concealed, 9=miss chance, 10=devastating crit + int iWeaponAttackType; ///< 1=main hand, 2=offhand, 3-5=creature, 6=extra(haste), 7=unarmed, 8=unarmed extra + int iSneakAttack; ///< 0=neither, 1=sneak attack, 2=death attack, 3=both + int bRangedAttack; /// TRUE if it is a ranged attack + int bKillingBlow; ///< TRUE if the hit is a killing blow + int iAttackType; ///< 65002=Attack of Opportunity, 65003=Riposte or a FeatID like KnockDown or some other special attack. + int iToHitRoll; ///< The to hit roll of the attack + int iToHitModifier; ///< The to hit modifier of the attack +}; + +/// @struct NWNX_Damage_DamageData +/// @brief Used for DealDamage +struct NWNX_Damage_DamageData +{ + int iBludgeoning; ///< Bludgeoning damage + int iPierce; ///< Piercing damage + int iSlash; ///< Slashing damage + int iMagical; ///< Magical damage + int iAcid; ///< Acid damage + int iCold; ///< Cold damage + int iDivine; ///< Divine damage + int iElectrical; ///< Electrical damage + int iFire; ///< Fire damage + 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); + +/// @brief Get Damage Event Data +/// @return A NWNX_Damage_DamageEventData struct. +/// @note To use only in the Damage Event Script. +struct NWNX_Damage_DamageEventData NWNX_Damage_GetDamageEventData(); + +/// @brief Set Damage Event Data +/// @param data A NWNX_Damage_DamageEventData struct. +/// @note To use only in the Damage Event Script. +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); + +/// @brief Get Attack Event Data +/// @return A NWNX_Damage_AttackEventData struct. +/// @note To use only in the Attack Event Script. +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. +/// @remark Permits multiple damage types and checks enhancement bonus for overcoming DR. +/// @param data A NWNX_Damage_DamageData struct. +/// @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_SetDamageEventScript(string sScript, object oOwner=OBJECT_INVALID) +{ + NWNXPushObject(oOwner); + NWNXPushString(sScript); + NWNXPushString("DAMAGE"); + NWNXCall(NWNX_Damage, "SetEventScript"); +} + +struct NWNX_Damage_DamageEventData NWNX_Damage_GetDamageEventData() +{ + struct NWNX_Damage_DamageEventData data; + 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) +{ + 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, "SetDamageEventData"); +} + +void NWNX_Damage_SetAttackEventScript(string sScript, object oOwner=OBJECT_INVALID) +{ + NWNXPushObject(oOwner); + NWNXPushString(sScript); + NWNXPushString("ATTACK"); + NWNXCall(NWNX_Damage, "SetEventScript"); +} + +struct NWNX_Damage_AttackEventData NWNX_Damage_GetAttackEventData() +{ + struct NWNX_Damage_AttackEventData data; + 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(); + data.bRangedAttack = NWNXPopInt(); + return data; +} + +void NWNX_Damage_SetAttackEventData(struct NWNX_Damage_AttackEventData data) +{ + 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) +{ + 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 new file mode 100644 index 00000000..b900de5b --- /dev/null +++ b/_module/nss/nwnx_data.nss @@ -0,0 +1,351 @@ +/// @addtogroup data Data +/// @brief Provides a number of data structures for NWN code to use (simulated arrays) +/// @{ +/// @file nwnx_data.nss + +#include "inc_array" + +// 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. +/// @ingroup data +/// @param obj The object. +/// @param tag The tag. +/// @param index The index. +/// @return The element of associated type. +/// @{ +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); +/// @} + + +/// Clears the entire array, such that size==0. +void NWNX_Data_Array_Clear(int type, object obj, string tag); + +/// @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 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); +/// @} + +/// Copies the array of name otherTag over the array of name tag. +void NWNX_Data_Array_Copy(int type, object obj, string tag, string otherTag); + +/// Erases the element at index, and shuffles any elements from index size-1 to index + 1 left. +void NWNX_Data_Array_Erase(int type, object obj, string tag, int index); + +/// @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 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); +/// @} + +/// @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 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); +/// @} + +/// @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 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); +/// @} + +/// Resizes the array. If the array is shrinking, it chops off elements at the ned. +void NWNX_Data_Array_Resize(int type, object obj, string tag, int size); + +/// Reorders the array such each possible permutation of elements has equal probability of appearance. +void NWNX_Data_Array_Shuffle(int type, object obj, string tag); + +/// Returns the size of the array. +int NWNX_Data_Array_Size(int type, object obj, string tag); + +/// Sorts the collection based on descending order. +void NWNX_Data_Array_SortAscending(int type, object obj, string tag); + +/// Sorts the collection based on descending order. +void NWNX_Data_Array_SortDescending(int type, object obj, string tag); + +/// @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 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) +{ + 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) +{ + 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) +{ + 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) +{ + 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) +{ + 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) +{ + 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) +{ + WriteTimestampedLogEntry("WARNING: NWNX_Data is deprecated. You should migrate to Array (see inc_array)"); + return Array_Contains_Obj(tag, element, obj); +} + + +//////////////////////////////////////////////////////////////////////////////// +void NWNX_Data_Array_Copy(int type, object obj, string tag, string otherTag) +{ + 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) +{ + 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) +{ + 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) +{ + 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) +{ + WriteTimestampedLogEntry("WARNING: NWNX_Data is deprecated. You should migrate to Array (see inc_array)"); + return Array_Find_Obj(tag, 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 NWNX_Data_Array_Insert_Str(object obj, string tag, int index, string element) +{ + 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) +{ + 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) +{ + 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) +{ + WriteTimestampedLogEntry("WARNING: NWNX_Data is deprecated. You should migrate to Array (see inc_array)"); + Array_Insert_Obj(tag, index, element, obj); +} + +//////////////////////////////////////////////////////////////////////////////// +// Insert a new element at the end of the array. +void NWNX_Data_Array_PushBack_Str(object obj, string tag, string element) +{ + 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) +{ + 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) +{ + 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) +{ + 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) +{ + 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) +{ + 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) +{ + 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) +{ + 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) +{ + 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) +{ + 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) +{ + 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) +{ + 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 00000000..f3be16cf --- /dev/null +++ b/_module/nss/nwnx_deprecated.nss @@ -0,0 +1,483 @@ +// The following functions have been removed from NWNX, please replace them with their basegame implementation! +// To use this file, include it to nwnx.nss and recompile all your scripts. + +// *** NWNX_Creature + +/// @name Cleric Domains +/// @anchor cleric_domains +/// +/// The clerical domains. +/// @{ +const int NWNX_CREATURE_CLERIC_DOMAIN_AIR = 0; +const int NWNX_CREATURE_CLERIC_DOMAIN_ANIMAL = 1; +const int NWNX_CREATURE_CLERIC_DOMAIN_DEATH = 3; +const int NWNX_CREATURE_CLERIC_DOMAIN_DESTRUCTION = 4; +const int NWNX_CREATURE_CLERIC_DOMAIN_EARTH = 5; +const int NWNX_CREATURE_CLERIC_DOMAIN_EVIL = 6; +const int NWNX_CREATURE_CLERIC_DOMAIN_FIRE = 7; +const int NWNX_CREATURE_CLERIC_DOMAIN_GOOD = 8; +const int NWNX_CREATURE_CLERIC_DOMAIN_HEALING = 9; +const int NWNX_CREATURE_CLERIC_DOMAIN_KNOWLEDGE = 10; +const int NWNX_CREATURE_CLERIC_DOMAIN_MAGIC = 13; +const int NWNX_CREATURE_CLERIC_DOMAIN_PLANT = 14; +const int NWNX_CREATURE_CLERIC_DOMAIN_PROTECTION = 15; +const int NWNX_CREATURE_CLERIC_DOMAIN_STRENGTH = 16; +const int NWNX_CREATURE_CLERIC_DOMAIN_SUN = 17; +const int NWNX_CREATURE_CLERIC_DOMAIN_TRAVEL = 18; +const int NWNX_CREATURE_CLERIC_DOMAIN_TRICKERY = 19; +const int NWNX_CREATURE_CLERIC_DOMAIN_WAR = 20; +const int NWNX_CREATURE_CLERIC_DOMAIN_WATER = 21; +/// @} + +/// @struct NWNX_Creature_MemorisedSpell +/// @brief A memorised spell structure. +struct NWNX_Creature_MemorisedSpell +{ + int id; ///< Spell ID + int ready; ///< Whether the spell can be cast + int meta; ///< Metamagic type, if any + int domain; ///< Clerical domain, if any +}; + +/// @brief Gets the count of memorised spells for a creature's class at a level. +/// @param creature The creature object. +/// @param class The class id from classes.2da. (Not class index 0-2) +/// @param level The spell level. +/// @return The memorised spell count. +int NWNX_Creature_GetMemorisedSpellCountByLevel(object creature, int class, int level); + +/// @brief Gets the memorised spell at a class level's index. +/// @param creature The creature object. +/// @param class The class id from classes.2da. (Not class index 0-2) +/// @param level The spell level. +/// @param index The index. Index bounds: 0 <= index < NWNX_Creature_GetMemorisedSpellCountByLevel(). +/// @return An NWNX_Creature_MemorisedSpell() struct. +struct NWNX_Creature_MemorisedSpell NWNX_Creature_GetMemorisedSpell(object creature, int class, int level, int index); + +/// @brief Sets the memorised spell at a class level's index. +/// @param creature The creature object. +/// @param class The class id from classes.2da. (Not class index 0-2) +/// @param level The spell level. +/// @param index The index. Index bounds: 0 <= index < NWNX_Creature_GetMemorisedSpellCountByLevel(). +/// @param spell An NWNX_Creature_MemorisedSpell() struct. +void NWNX_Creature_SetMemorisedSpell(object creature, int class, int level, int index, struct NWNX_Creature_MemorisedSpell spell); + +/// @brief Gets the known spell count (innate casting) at a class level. +/// @param creature The creature object. +/// @param class The class id from classes.2da. (Not class index 0-2) +/// @param level The spell level. +/// @return The known spell count. +int NWNX_Creature_GetKnownSpellCount(object creature, int class, int level); + +/// @brief Gets the known spell at a class level's index. +/// @param creature The creature object. +/// @param class The class id from classes.2da. (Not class index 0-2) +/// @param level The spell level. +/// @param index The index. Index bounds: 0 <= index < NWNX_Creature_GetKnownSpellCount(). +/// @return The spell id. +int NWNX_Creature_GetKnownSpell(object creature, int class, int level, int index); + +/// @brief Clear a specific spell from the creature's spellbook for class +/// @param creature The creature object. +/// @param class The class id from classes.2da. (Not class index 0-2) +/// @param spellId The spell to clear. +void NWNX_Creature_ClearMemorisedKnownSpells(object creature, int class, int spellId); + +/// @brief Clear the memorised spell of the creature for the class, level and index. +/// @param creature The creature object. +/// @param class The class id from classes.2da. (Not class index 0-2) +/// @param level The spell level. +/// @param index The index. Index bounds: 0 <= index < NWNX_Creature_GetMemorisedSpellCountByLevel(). +void NWNX_Creature_ClearMemorisedSpell(object creature, int class, int level, int index); + +/// @brief Get the soundset index for creature. +/// @param creature The creature object. +/// @return The soundset used by the creature. +int NWNX_Creature_GetSoundset(object creature); + +/// @brief Set the soundset index for creature. +/// @param creature The creature object. +/// @param soundset The soundset index. +void NWNX_Creature_SetSoundset(object creature, int soundset); + +/// @brief Sets the creature gender. +/// @param creature The creature object. +/// @param gender The GENDER_ constant. +void NWNX_Creature_SetGender(object creature, int gender); + +/// @brief Restore all creature spells per day for given level. +/// @param creature The creature object. +/// @param level The level to restore. If -1, all spells are restored. +void NWNX_Creature_RestoreSpells(object creature, int level = -1); + +/// @brief Gets one of creature's domains. +/// @param creature The creature object. +/// @param class The class id from classes.2da. (Not class index 0-2) +/// @param index The first or second domain. +/// @deprecated Use GetDomain(). This will be removed in future NWNX releases. +int NWNX_Creature_GetDomain(object creature, int class, int index); + +/// @brief Gets the creature's specialist school. +/// @param creature The creature object. +/// @param class The class id from classes.2da. (Not class index 0-2) +/// @deprecated Use GetSpecialization(). This will be removed in future NWNX releases. +int NWNX_Creature_GetSpecialization(object creature, int class); + +/// @brief Get the number of uses left of a spell. +/// @note This function is for caster classes that don't need to memorize spells. +/// @param oCreature The creature. +/// @param nSpellID The spell ID. +/// @param nMultiClass The position of the class to check, 0-2 +/// @param nDomainLevel The domain level if checking a domain spell. +/// @param nMetaMagic A METAMAGIC_* constant. +/// @return The number of spell uses left or 0 on error. +int NWNX_Creature_GetSpellUsesLeft(object oCreature, int nSpellID, int nMultiClass, int nDomainLevel = 0, int nMetaMagic = METAMAGIC_NONE); + +/// @brief Get the number of memorized ready spells by spellid. +/// @note This function is for caster classes that need to memorize spells. +/// @param oCreature The creature. +/// @param nSpellID The spell ID. +/// @param nMultiClass The position of the class to check, 0-2 +/// @param nMetaMagic A METAMAGIC_* constant. +/// @return The number of spell uses left or 0 on error. +int NWNX_Creature_GetMemorizedSpellReadyCount(object oCreature, int nSpellID, int nMultiClass, int nMetaMagic = METAMAGIC_NONE); + +/// @brief Set whether an effect icon is flashing or not. +/// @param oCreature The target creature. +/// @param nIconId The icon id, see effecticons.2da. +/// @param bFlashing TRUE for flashing, FALSE for not flashing. +void NWNX_Creature_SetEffectIconFlashing(object oCreature, int nIconId, int bFlashing); + +int NWNX_Creature_GetMemorisedSpellCountByLevel(object creature, int class, int level) +{ + WriteTimestampedLogEntry("WARNING: Calling deprecated NWNX Function: NWNX_Creature_GetMemorisedSpellCountByLevel"); + return GetMemorizedSpellCountByLevel(creature, class, level); +} + +struct NWNX_Creature_MemorisedSpell NWNX_Creature_GetMemorisedSpell(object creature, int class, int level, int index) +{ + WriteTimestampedLogEntry("WARNING: Calling deprecated NWNX Function: NWNX_Creature_GetMemorisedSpell"); + struct NWNX_Creature_MemorisedSpell spell; + spell.domain = GetMemorizedSpellIsDomainSpell(creature, class, level, index); + spell.meta = GetMemorizedSpellMetaMagic(creature, class, level, index); + spell.ready = GetMemorizedSpellReady(creature, class, level, index); + spell.id = GetMemorizedSpellId(creature, class, level, index); + return spell; +} + +void NWNX_Creature_SetMemorisedSpell(object creature, int class, int level, int index, struct NWNX_Creature_MemorisedSpell spell) +{ + WriteTimestampedLogEntry("WARNING: Calling deprecated NWNX Function: NWNX_Creature_SetMemorisedSpell"); + SetMemorizedSpell(creature, class, level, index, spell.id, spell.ready, spell.meta, spell.domain); +} + +int NWNX_Creature_GetKnownSpellCount(object creature, int class, int level) +{ + WriteTimestampedLogEntry("WARNING: Calling deprecated NWNX Function: NWNX_Creature_GetKnownSpellCount"); + return GetKnownSpellCount(creature, class, level); +} + +int NWNX_Creature_GetKnownSpell(object creature, int class, int level, int index) +{ + WriteTimestampedLogEntry("WARNING: Calling deprecated NWNX Function: NWNX_Creature_GetKnownSpell"); + return GetKnownSpellId(creature, class, level, index); +} + +void NWNX_Creature_ClearMemorisedKnownSpells(object creature, int class, int spellId) +{ + WriteTimestampedLogEntry("WARNING: Calling deprecated NWNX Function: NWNX_Creature_ClearMemorisedKnownSpells"); + ClearMemorizedSpellBySpellId(creature, class, spellId); +} + +void NWNX_Creature_ClearMemorisedSpell(object creature, int class, int level, int index) +{ + WriteTimestampedLogEntry("WARNING: Calling deprecated NWNX Function: NWNX_Creature_ClearMemorisedSpell"); + ClearMemorizedSpell(creature, class, level, index); +} + +int NWNX_Creature_GetSoundset(object creature) +{ + WriteTimestampedLogEntry("WARNING: Calling deprecated NWNX Function: NWNX_Creature_GetSoundset"); + return GetSoundset(creature); +} + +void NWNX_Creature_SetSoundset(object creature, int soundset) +{ + WriteTimestampedLogEntry("WARNING: Calling deprecated NWNX Function: NWNX_Creature_SetSoundset"); + SetSoundset(creature, soundset); +} + +void NWNX_Creature_SetGender(object creature, int gender) +{ + WriteTimestampedLogEntry("WARNING: Calling deprecated NWNX Function: NWNX_Creature_SetGender"); + SetGender(creature, gender); +} + +void NWNX_Creature_RestoreSpells(object creature, int level = -1) +{ + WriteTimestampedLogEntry("WARNING: Calling deprecated NWNX Function: NWNX_Creature_RestoreSpells"); + if (level == -1) + { + int i; + for (i = 0; i < 10; i++) + { + ReadySpellLevel(creature, i); + } + } + else + ReadySpellLevel(creature, level); + +} + +int NWNX_Creature_GetDomain(object creature, int class, int index) +{ + WriteTimestampedLogEntry("WARNING: Calling deprecated NWNX Function: NWNX_Creature_GetDomain"); + return GetDomain(creature, index, class); +} + +int NWNX_Creature_GetSpecialization(object creature, int class) +{ + WriteTimestampedLogEntry("WARNING: Calling deprecated NWNX Function: NWNX_Creature_GetSpecialization"); + return GetSpecialization(creature, class); +} + +int NWNX_Creature_GetSpellUsesLeft(object oCreature, int nSpellID, int nMultiClass, int nDomainLevel = 0, int nMetaMagic = METAMAGIC_NONE) +{ + WriteTimestampedLogEntry("WARNING: Calling deprecated NWNX Function: NWNX_Creature_GetSpellUsesLeft"); + return GetSpellUsesLeft(oCreature, GetClassByPosition(nMultiClass + 1), nSpellID, nMetaMagic, nDomainLevel); +} + +int NWNX_Creature_GetMemorizedSpellReadyCount(object oCreature, int nSpellID, int nMultiClass, int nMetaMagic = METAMAGIC_NONE) +{ + WriteTimestampedLogEntry("WARNING: Calling deprecated NWNX Function: NWNX_Creature_GetMemorizedSpellReadyCount"); + return GetSpellUsesLeft(oCreature, GetClassByPosition(nMultiClass + 1), nSpellID, nMetaMagic); +} + +void NWNX_Creature_SetEffectIconFlashing(object oCreature, int nIconId, int bFlashing) +{ + WriteTimestampedLogEntry("WARNING: Calling deprecated NWNX Function: NWNX_Creature_SetEffectIconFlashing"); + SetEffectIconFlashing(oCreature, nIconId, bFlashing); +} + +// *** NWNX_Effect + +/// @brief Set a script with optional data that runs when an effect expires +/// @param e The effect. +/// @param script The script to run when the effect expires. +/// @param data Any other data you wish to send back to the script. +/// @remark OBJECT_SELF in the script is the object the effect is applied to. +/// @note Only works for TEMPORARY and PERMANENT effects applied to an object. +effect NWNX_Effect_SetEffectExpiredScript(effect e, string script, string data = ""); + +/// @brief Get the data set with NWNX_Effect_SetEffectExpiredScript() +/// @note Should only be called from a script set with NWNX_Effect_SetEffectExpiredScript(). +/// @return The data attached to the effect. +string NWNX_Effect_GetEffectExpiredData(); + +/// @brief Get the effect creator. +/// @note Should only be called from a script set with NWNX_Effect_SetEffectExpiredScript(). +/// @return The object from which the effect originated. +object NWNX_Effect_GetEffectExpiredCreator(); + +/// @brief Accessorize an EffectVisualEffect(), making it undispellable and unable to be removed by resting or death. +/// @note If linked with a non-visualeffect or a non-accessorized visualeffect it *will* get removed. +/// @param eEffect An EffectVisualEffect(), does not work for other effect types. +/// @return The accessorized effect or an unchanged effect if not an EffectVisualEffect(). +effect NWNX_Effect_AccessorizeVisualEffect(effect eEffect); + +effect NWNX_Effect_SetEffectExpiredScript(effect e, string script, string data = "") +{ + WriteTimestampedLogEntry("WARNING: Calling deprecated NWNX Function: NWNX_Effect_SetEffectExpiredScript"); + return EffectLinkEffects(EffectRunScript("", script, "", 0.0f, data), e); +} + +string NWNX_Effect_GetEffectExpiredData() +{ + WriteTimestampedLogEntry("WARNING: Calling deprecated NWNX Function: NWNX_Effect_GetEffectExpiredData"); + return GetEffectString(GetLastRunScriptEffect(), 0); +} + +object NWNX_Effect_GetEffectExpiredCreator() +{ + WriteTimestampedLogEntry("WARNING: Calling deprecated NWNX Function: NWNX_Effect_GetEffectExpiredCreator"); + return GetEffectCreator(GetLastRunScriptEffect()); +} + +effect NWNX_Effect_AccessorizeVisualEffect(effect eEffect) +{ + WriteTimestampedLogEntry("WARNING: Calling deprecated NWNX Function: NWNX_Effect_AccessorizeVisualEffect"); + if (GetEffectType(eEffect) == EFFECT_TYPE_VISUALEFFECT) + return UnyieldingEffect(eEffect); + else + return eEffect; +} + +// *** NWNX_Object + +/// @brief Convert an object id to the actual object. +/// @param id The object id. +/// @return An object from the provided object ID. +/// @remark This is the counterpart to ObjectToString. +/// @deprecated Use the basegame StringToObject() function. This will be removed in a future NWNX release. +object NWNX_Object_StringToObject(string id); + +/// @brief Check if an item can fit in an object's inventory. +/// @param obj The object with an inventory. +/// @param baseitem The base item id to check for a fit. +/// @return TRUE if an item of base item type can fit in object's inventory +int NWNX_Object_CheckFit(object obj, int baseitem); + +/// @brief Add an effect to an object that displays an icon and has no other effect. +/// @remark See effecticons.2da for a list of possible effect icons. +/// @param obj The object to apply the effect. +/// @param nIcon The icon id. +/// @param fDuration If specified the effect will be temporary and last this length in seconds, otherwise the effect +/// will be permanent. +void NWNX_Object_AddIconEffect(object obj, int nIcon, float fDuration=0.0); + +/// @brief Remove an icon effect from an object that was added by the NWNX_Object_AddIconEffect() function. +/// @param obj The object. +/// @param nIcon The icon id. +void NWNX_Object_RemoveIconEffect(object obj, int nIcon); + +/// @brief Cause oObject to face fDirection. +/// @note This function is almost identical to SetFacing(), the only difference being that it allows you to specify +/// the target object without the use of AssignCommand(). This is useful when you want to change the facing of an object +/// in an ExecuteScriptChunk() call where AssignCommand() does not work. +/// @param oObject The object to change its facing of +/// @param fDirection The direction the object should face +void NWNX_Object_SetFacing(object oObject, float fDirection); + +object NWNX_Object_StringToObject(string id) +{ + WriteTimestampedLogEntry("WARNING: Calling deprecated NWNX Function: NWNX_Object_StringToObject"); + return StringToObject(id); +} + +int NWNX_Object_CheckFit(object obj, int baseitem) +{ + WriteTimestampedLogEntry("WARNING: Calling deprecated NWNX Function: NWNX_Object_CheckFit"); + return GetBaseItemFitsInInventory(baseitem, obj); +} + +void NWNX_Object_AddIconEffect(object obj, int nIcon, float fDuration=0.0) +{ + WriteTimestampedLogEntry("WARNING: Calling deprecated NWNX Function: NWNX_Object_AddIconEffect"); + effect eEffect = GetFirstEffect(obj); + while (GetIsEffectValid(eEffect)) + { + if (GetEffectTag(eEffect) == "NWNX_Object_IconEffect" && GetEffectInteger(eEffect, 0) == nIcon) + RemoveEffect(obj, eEffect); + eEffect = GetNextEffect(obj); + } + + effect eIcon = TagEffect(SupernaturalEffect(EffectIcon(nIcon)), "NWNX_Object_IconEffect"); + ApplyEffectToObject(fDuration == 0.0 ? DURATION_TYPE_PERMANENT : DURATION_TYPE_TEMPORARY, eIcon, obj, fDuration); +} + +void NWNX_Object_RemoveIconEffect(object obj, int nIcon) +{ + WriteTimestampedLogEntry("WARNING: Calling deprecated NWNX Function: NWNX_Object_RemoveIconEffect"); + effect eEffect = GetFirstEffect(obj); + while (GetIsEffectValid(eEffect)) + { + if (GetEffectTag(eEffect) == "NWNX_Object_IconEffect" && GetEffectInteger(eEffect, 0) == nIcon) + RemoveEffect(obj, eEffect); + eEffect = GetNextEffect(obj); + } +} + +void NWNX_Object_SetFacing(object oObject, float fDirection) +{ + WriteTimestampedLogEntry("WARNING: Calling deprecated NWNX Function: NWNX_Object_SetFacing"); + AssignCommand(oObject, SetFacing(fDirection)); +} + +// *** NWNX_Regex + +/// @param str The string to search. +/// @param regex The regular expression to use when searching. +/// @return TRUE if string matches the regular expression. +int NWNX_Regex_Search(string str, string regex); + +/// @brief Replaces any matches of the regular expression with a string. +/// @param str The string to search. +/// @param regex The regular expression to use when searching. +/// @param replace The string to replace the matches with. +/// @param firstOnly Set to TRUE to only replace the first match. +/// @return A new string with any replacements made. +string NWNX_Regex_Replace(string str, string regex, string replace = "", int firstOnly = FALSE); + +/// @brief Returns all matches in a string that match the regular expression. +/// @param str The string to search. +/// @param regex The regular expression to use. +/// @return A json array with json arrays of all (sub)matches. Returns JsonNull() on error. +json NWNX_Regex_Match(string str, string regex); + +int NWNX_Regex_Search(string str, string regex) +{ + WriteTimestampedLogEntry("WARNING: Calling deprecated NWNX Function: NWNX_Regex_Search"); + return JsonGetLength(RegExpMatch(regex, str)); +} + +string NWNX_Regex_Replace(string str, string regex, string replace="", int firstOnly=0) +{ + WriteTimestampedLogEntry("WARNING: Calling deprecated NWNX Function: NWNX_Regex_Replace"); + return RegExpReplace(regex, str, replace, firstOnly ? REGEXP_FORMAT_FIRST_ONLY : REGEXP_FORMAT_DEFAULT); +} + +json NWNX_Regex_Match(string str, string regex) +{ + WriteTimestampedLogEntry("WARNING: Calling deprecated NWNX Function: NWNX_Regex_Match"); + return RegExpIterate(regex, str); +} + +// *** NWNX_Util + +/// @brief Determines if the supplied resref exists. +/// @param resref The resref to check. +/// @param type The @ref resref_types "Resref Type". +/// @return TRUE/FALSE +int NWNX_Util_IsValidResRef(string resref, int type = RESTYPE_UTC); + +/// @anchor twoda_row_count +/// @brief Gets the row count for a 2da. +/// @param str The 2da to check (do not include the .2da). +/// @return The amount of rows in the 2da. +int NWNX_Util_Get2DARowCount(string str); + +/// @brief Gets the contents of a .nss script file as a string. +/// @param sScriptName The name of the script to get the contents of. +/// @param nMaxLength The max length of the return string, -1 to get everything +/// @return The script file contents or "" on error. +string NWNX_Util_GetNSSContents(string sScriptName, int nMaxLength = -1); + +/// @brief Get the ticks per second of the server. +/// @remark Useful to dynamically detect lag and adjust behavior accordingly. +/// @return The ticks per second. +int NWNX_Util_GetServerTicksPerSecond(); + +int NWNX_Util_IsValidResRef(string resref, int type = RESTYPE_UTC) +{ + WriteTimestampedLogEntry("WARNING: Calling deprecated NWNX Function: NWNX_Util_IsValidResRef"); + return ResManGetAliasFor(resref, type) != ""; +} + +int NWNX_Util_Get2DARowCount(string str) +{ + WriteTimestampedLogEntry("WARNING: Calling deprecated NWNX Function: NWNX_Util_Get2DARowCount"); + return Get2DARowCount(str); +} + +string NWNX_Util_GetNSSContents(string sScriptName, int nMaxLength = -1) +{ + WriteTimestampedLogEntry("WARNING: Calling deprecated NWNX Function: NWNX_Util_GetNSSContents"); + string s = ResManGetFileContents(sScriptName, RESTYPE_NSS); + return nMaxLength == -1 ? s : GetStringLeft(s, nMaxLength); +} + +int NWNX_Util_GetServerTicksPerSecond() +{ + WriteTimestampedLogEntry("WARNING: Calling deprecated NWNX Function: NWNX_Util_GetServerTicksPerSecond"); + return GetTickRate(); +} diff --git a/_module/nss/nwnx_dialog.nss b/_module/nss/nwnx_dialog.nss new file mode 100644 index 00000000..f270c5cc --- /dev/null +++ b/_module/nss/nwnx_dialog.nss @@ -0,0 +1,123 @@ +/// @addtogroup dialog Dialog +/// @brief Functions exposing additional dialog properties +/// @{ +/// @file nwnx_dialog.nss + +const string NWNX_Dialog = "NWNX_Dialog"; ///< @private + +/// @name Dialog Node Types +/// @anchor dialog_node_types +/// @{ +const int NWNX_DIALOG_NODE_TYPE_INVALID = -1; +const int NWNX_DIALOG_NODE_TYPE_STARTING_NODE = 0; +const int NWNX_DIALOG_NODE_TYPE_ENTRY_NODE = 1; +const int NWNX_DIALOG_NODE_TYPE_REPLY_NODE = 2; +/// @} + +/// @name Dialog Script Types +/// @anchor dialog_script_types +/// @{ +const int NWNX_DIALOG_SCRIPT_TYPE_OTHER = 0; +const int NWNX_DIALOG_SCRIPT_TYPE_STARTING_CONDITIONAL = 1; +const int NWNX_DIALOG_SCRIPT_TYPE_ACTION_TAKEN = 2; +/// @} + +/// @name Dialog Languages +/// @anchor dialog_languages +/// @{ +const int NWNX_DIALOG_LANGUAGE_ENGLISH = 0; +const int NWNX_DIALOG_LANGUAGE_FRENCH = 1; +const int NWNX_DIALOG_LANGUAGE_GERMAN = 2; +const int NWNX_DIALOG_LANGUAGE_ITALIAN = 3; +const int NWNX_DIALOG_LANGUAGE_SPANISH = 4; +const int NWNX_DIALOG_LANGUAGE_POLISH = 5; +const int NWNX_DIALOG_LANGUAGE_KOREAN = 128; +const int NWNX_DIALOG_LANGUAGE_CHINESE_TRADITIONAL = 129; +const int NWNX_DIALOG_LANGUAGE_CHINESE_SIMPLIFIED = 130; +const int NWNX_DIALOG_LANGUAGE_JAPANESE = 131; +/// @} + +/// @brief Get the @ref dialog_node_types "Node Type" of the current text node +/// @return A @ref dialog_node_types "Node Type". If called out of dialog, returns NWNX_DIALOG_NODE_TYPE_INVALID +int NWNX_Dialog_GetCurrentNodeType(); + +/// @brief Get the @ref dialog_script_types "Script Type" of the current text node +/// @return A @ref dialog_script_types "Node Type". If called out of dialog, returns NWNX_DIALOG_SCRIPT_TYPE_OTHER +int NWNX_Dialog_GetCurrentScriptType(); + +/// @brief Get the absolute ID of the current node in the conversation +/// @note NWNX_DIALOG_NODE_TYPE_ENTRY_NODE and NWNX_DIALOG_NODE_TYPE_REPLY_NODE nodes +/// have different namespaces, so they can share the same ID +/// @return The absolute ID in the dialog. If called out of dialog, returns -1 +int NWNX_Dialog_GetCurrentNodeID(); + +/// @brief Get the index of the current node in the list of replies/entries. +/// @note The index is zero based, and counts items not displayed due to a StartingConditional. +/// @return The index of the current node. +int NWNX_Dialog_GetCurrentNodeIndex(); + +/// @brief Get the text of the current node +/// @param language The @ref dialog_languages "language" of the text. +/// @param gender The gender for the text. +string NWNX_Dialog_GetCurrentNodeText(int language=NWNX_DIALOG_LANGUAGE_ENGLISH, int gender=GENDER_MALE); + +/// @brief Set the text of the current node for given language/gender +/// @note This will only work in a starting conditional script (action take comes after the text is displayed) +/// @param text The text for the node. +/// @param language The @ref dialog_languages "language" of the text. +/// @param gender The gender for the text. +void NWNX_Dialog_SetCurrentNodeText(string text, int language=NWNX_DIALOG_LANGUAGE_ENGLISH, int gender=GENDER_MALE); + +/// @brief End a conversation oObject is involved in, it will fire the OnAbort script of the conversation +/// @warning Calling this from a conversation script will crash your server. +/// @param oObject The object in a conversation +void NWNX_Dialog_End(object oObject); + +/// @} + + +int NWNX_Dialog_GetCurrentNodeType() +{ + NWNXCall(NWNX_Dialog, "GetCurrentNodeType"); + return NWNXPopInt(); +} + +int NWNX_Dialog_GetCurrentScriptType() +{ + NWNXCall(NWNX_Dialog, "GetCurrentScriptType"); + return NWNXPopInt(); +} + +int NWNX_Dialog_GetCurrentNodeID() +{ + NWNXCall(NWNX_Dialog, "GetCurrentNodeID"); + return NWNXPopInt(); +} + +int NWNX_Dialog_GetCurrentNodeIndex() +{ + NWNXCall(NWNX_Dialog, "GetCurrentNodeIndex"); + return NWNXPopInt(); +} + +string NWNX_Dialog_GetCurrentNodeText(int language=NWNX_DIALOG_LANGUAGE_ENGLISH, int gender=GENDER_MALE) +{ + 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) +{ + NWNXPushInt(gender); + NWNXPushInt(language); + NWNXPushString(text); + NWNXCall(NWNX_Dialog, "SetCurrentNodeText"); +} + +void NWNX_Dialog_End(object oObject) +{ + NWNXPushObject(oObject); + NWNXCall(NWNX_Dialog, "End"); +} diff --git a/_module/nss/nwnx_effect.nss b/_module/nss/nwnx_effect.nss new file mode 100644 index 00000000..566b0b63 --- /dev/null +++ b/_module/nss/nwnx_effect.nss @@ -0,0 +1,354 @@ +/// @addtogroup effect Effect +/// @brief Utility functions to manipulate the builtin effect type. +/// @{ +/// @file nwnx_effect.nss + +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 + + float fDuration; ///< @todo Describe + int nExpiryCalendarDay; ///< @todo Describe + int nExpiryTimeOfDay; ///< @todo Describe + + object oCreator; ///< @todo Describe + int nSpellId; ///< @todo Describe + int bExpose; ///< @todo Describe + int bShowIcon; ///< @todo Describe + int nCasterLevel; ///< @todo Describe + + effect eLinkLeft; ///< @todo Describe + int bLinkLeftValid; ///< @todo Describe + effect eLinkRight; ///< @todo Describe + int bLinkRightValid; ///< @todo Describe + + int nNumIntegers; ///< @todo Describe + int nParam0; ///< @todo Describe + int nParam1; ///< @todo Describe + int nParam2; ///< @todo Describe + int nParam3; ///< @todo Describe + int nParam4; ///< @todo Describe + int nParam5; ///< @todo Describe + int nParam6; ///< @todo Describe + int nParam7; ///< @todo Describe + float fParam0; ///< @todo Describe + float fParam1; ///< @todo Describe + float fParam2; ///< @todo Describe + float fParam3; ///< @todo Describe + string sParam0; ///< @todo Describe + string sParam1; ///< @todo Describe + string sParam2; ///< @todo Describe + string sParam3; ///< @todo Describe + string sParam4; ///< @todo Describe + string sParam5; ///< @todo Describe + object oParam0; ///< @todo Describe + 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. +/// @param e The effect to convert. +/// @return A constructed NWNX_EffectUnpacked. +struct NWNX_EffectUnpacked NWNX_Effect_UnpackEffect(effect e); + +/// @brief Convert unpacked effect structure to native type. +/// @param e The NWNX_EffectUnpacked structure to convert. +/// @return The effect. +effect NWNX_Effect_PackEffect(struct NWNX_EffectUnpacked e); + +/// @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 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 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 Applies 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_ResolveUnpack(int bLink=TRUE) +{ + struct NWNX_EffectUnpacked n; + + n.sItemProp = NWNXPopString(); + + n.sTag = NWNXPopString(); + + 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(); + + if(bLink) + { + n.bLinkRightValid = NWNXPopInt(); + n.eLinkRight = NWNXPopEffect(); + n.bLinkLeftValid = NWNXPopInt(); + n.eLinkLeft = NWNXPopEffect(); + } + else + { + n.bLinkRightValid = FALSE; + n.bLinkLeftValid = FALSE; + } + + 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) +{ + __NWNX_Effect_ResolvePack(e); + NWNXCall(NWNX_Effect, "PackEffect"); + return NWNXPopEffect(); +} + +int NWNX_Effect_ReplaceEffect(object obj, effect eOld, effect eNew) +{ + NWNXPushEffect(eNew); + NWNXPushEffect(eOld); + NWNXPushObject(obj); + NWNXCall(NWNX_Effect, "ReplaceEffect"); + return NWNXPopInt(); +} + +int NWNX_Effect_GetTrueEffectCount(object oObject) +{ + NWNXPushObject(oObject); + NWNXCall(NWNX_Effect, "GetTrueEffectCount"); + return NWNXPopInt(); +} + +struct NWNX_EffectUnpacked NWNX_Effect_GetTrueEffect(object oObject, int nIndex) +{ + 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 new file mode 100644 index 00000000..57bb7fbf --- /dev/null +++ b/_module/nss/nwnx_elc.nss @@ -0,0 +1,216 @@ +/// @addtogroup elc ELC +/// @brief Replacement for ValidateCharacter: ELC & ILR +/// @{ +/// @file nwnx_elc.nss + +const string NWNX_ELC = "NWNX_ELC"; ///< @private + + +/// @anchor elc_fail_type +/// @name ELC Failure Types +/// @{ +const int NWNX_ELC_VALIDATION_FAILURE_TYPE_NONE = 0; +const int NWNX_ELC_VALIDATION_FAILURE_TYPE_CHARACTER = 1; +const int NWNX_ELC_VALIDATION_FAILURE_TYPE_ITEM = 2; +const int NWNX_ELC_VALIDATION_FAILURE_TYPE_SKILL = 3; +const int NWNX_ELC_VALIDATION_FAILURE_TYPE_FEAT = 4; +const int NWNX_ELC_VALIDATION_FAILURE_TYPE_SPELL = 5; +const int NWNX_ELC_VALIDATION_FAILURE_TYPE_CUSTOM = 6; +/// @} + +/// @anchor elc_fail_subtype +/// @name ELC Failure Subtypes +/// @{ +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; +const int NWNX_ELC_SUBTYPE_UNIDENTIFIED_EQUIPPED_ITEM = 4; +const int NWNX_ELC_SUBTYPE_MIN_EQUIP_LEVEL = 5; +const int NWNX_ELC_SUBTYPE_NON_PC_CHARACTER = 6; +const int NWNX_ELC_SUBTYPE_DM_CHARACTER = 7; +const int NWNX_ELC_SUBTYPE_NON_PLAYER_RACE = 8; +const int NWNX_ELC_SUBTYPE_NON_PLAYER_CLASS = 9; +const int NWNX_ELC_SUBTYPE_CLASS_LEVEL_RESTRICTION = 10; +const int NWNX_ELC_SUBTYPE_PRESTIGE_CLASS_REQUIREMENTS = 11; +const int NWNX_ELC_SUBTYPE_CLASS_ALIGNMENT_RESTRICTION = 12; +const int NWNX_ELC_SUBTYPE_STARTING_ABILITY_VALUE_MAX = 13; +const int NWNX_ELC_SUBTYPE_ABILITY_POINT_BUY_SYSTEM_CALCULATION = 14; +const int NWNX_ELC_SUBTYPE_CLASS_SPELLCASTER_INVALID_PRIMARY_STAT = 15; +const int NWNX_ELC_SUBTYPE_EPIC_LEVEL_FLAG = 16; +const int NWNX_ELC_SUBTYPE_TOO_MANY_HITPOINTS = 17; +const int NWNX_ELC_SUBTYPE_UNUSABLE_SKILL = 18; +const int NWNX_ELC_SUBTYPE_NOT_ENOUGH_SKILLPOINTS = 19; +const int NWNX_ELC_SUBTYPE_INVALID_NUM_RANKS_IN_CLASS_SKILL = 20; +const int NWNX_ELC_SUBTYPE_INVALID_NUM_RANKS_IN_NON_CLASS_SKILL = 21; +const int NWNX_ELC_SUBTYPE_INVALID_NUM_REMAINING_SKILL_POINTS = 22; +const int NWNX_ELC_SUBTYPE_INVALID_FEAT = 23; +const int NWNX_ELC_SUBTYPE_FEAT_REQUIRED_SPELL_LEVEL_NOT_MET = 24; +const int NWNX_ELC_SUBTYPE_FEAT_REQUIRED_BASE_ATTACK_BONUS_NOT_MET = 25; +const int NWNX_ELC_SUBTYPE_FEAT_REQUIRED_ABILITY_VALUE_NOT_MET = 26; +const int NWNX_ELC_SUBTYPE_FEAT_REQUIRED_SKILL_NOT_MET = 27; +const int NWNX_ELC_SUBTYPE_FEAT_REQUIRED_FEAT_NOT_MET = 28; +const int NWNX_ELC_SUBTYPE_TOO_MANY_FEATS_THIS_LEVEL = 29; +const int NWNX_ELC_SUBTYPE_FEAT_NOT_AVAILABLE_TO_CLASS = 30; +const int NWNX_ELC_SUBTYPE_FEAT_IS_NORMAL_FEAT_ONLY = 31; +const int NWNX_ELC_SUBTYPE_FEAT_IS_BONUS_FEAT_ONLY = 32; +const int NWNX_ELC_SUBTYPE_SPELL_INVALID_SPELL_GAIN_WIZARD = 33; +const int NWNX_ELC_SUBTYPE_SPELL_INVALID_SPELL_GAIN_BARD_SORCERER = 34; +const int NWNX_ELC_SUBTYPE_SPELL_INVALID_SPELL_GAIN_OTHER_CLASSES = 35; +const int NWNX_ELC_SUBTYPE_INVALID_SPELL = 36; +const int NWNX_ELC_SUBTYPE_SPELL_INVALID_SPELL_LEVEL = 37; +const int NWNX_ELC_SUBTYPE_SPELL_MINIMUM_ABILITY = 40; +const int NWNX_ELC_SUBTYPE_SPELL_RESTRICTED_SPELL_SCHOOL = 41; +const int NWNX_ELC_SUBTYPE_SPELL_ALREADY_KNOWN = 42; +const int NWNX_ELC_SUBTYPE_SPELL_WIZARD_EXCEEDS_NUMSPELLS_TO_ADD = 43; +const int NWNX_ELC_SUBTYPE_ILLEGAL_REMOVED_SPELL = 44; +const int NWNX_ELC_SUBTYPE_REMOVED_NOT_KNOWN_SPELL = 45; +const int NWNX_ELC_SUBTYPE_INVALID_NUM_SPELLS = 46; +const int NWNX_ELC_SUBTYPE_SPELL_LIST_COMPARISON = 47; +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 +/// @param sScript The script name. +void NWNX_ELC_SetELCScript(string sScript); + +/// @brief Enables a custom ELC Check that will call the ELC Script with the +/// NWNX_ELC_VALIDATION_FAILURE_TYPE_CUSTOM type. +/// @param bEnabled TRUE to use this check. +/// @note Only runs if you have an ELC script set, be sure to skip this check +/// if a player doesn't fail your custom check otherwise they won't be able to log in +void NWNX_ELC_EnableCustomELCCheck(int bEnabled); + +/// @brief Skip an ELC Validation Failure Event +/// @note Only to be called in the ELC Script +void NWNX_ELC_SkipValidationFailure(); + +/// @brief Get the validation failure type +/// @return A @ref elc_fail_type "Validation Failure Type" +/// @note Only to be called in the ELC Script +int NWNX_ELC_GetValidationFailureType(); + +/// @brief Get the validation failure subtype +/// @return A @ref elc_fail_subtype "Validation Failure Subtype" +/// @note Only to be called in the ELC Script +int NWNX_ELC_GetValidationFailureSubType(); + +/// @brief Get the failure message +/// @return The talk table strref the player receives. +/// @note Only to be called in the ELC Script +int NWNX_ELC_GetValidationFailureMessageStrRef(); + +/// @brief Set the failure message +/// @param nStrRef The talk table strref the player receives, must be > 0. +/// @note Only to be called in the ELC Script +void NWNX_ELC_SetValidationFailureMessageStrRef(int nStrRef); + +/// @brief Get the item that failed ILR validation +/// @return The object that caused the ILR validation failure. Returns OBJECT_INVALID on error. +/// @note Only to be called in the ELC Script during a +/// NWNX_ELC_VALIDATION_FAILURE_TYPE_ITEM validation failure. +object NWNX_ELC_GetValidationFailureItem(); + +/// @brief Get the character level at which the validation failure occurred +/// @return The character level or -1 on error. +/// @remark May not always return a level, depending on where the failure occurred. +/// @note Only to be called in the ELC Script +int NWNX_ELC_GetValidationFailureLevel(); + +/// @brief Get the ID of the skill that failed ELC validation +/// @return The skill ID or -1 on error. +/// @remark May not always return a skill id, depending on the validation failure subtype. +/// @note Only to be called in the ELC Script during a +/// NWNX_ELC_VALIDATION_FAILURE_TYPE_SKILL validation failure. +int NWNX_ELC_GetValidationFailureSkillID(); + +/// @brief Get the ID of the feat that failed ELC validation +/// @return The feat ID or -1 on error +/// @remark May not always return a feat id, depending on the validation failure subtype. +/// @note Only to be called in the ELC Script during a +/// NWNX_ELC_VALIDATION_FAILURE_TYPE_FEAT validation failure. +int NWNX_ELC_GetValidationFailureFeatID(); + +/// @brief Get the ID of the spell that failed ELC validation +/// @return The spell ID or -1 on error +/// @remark May not always return a spell id, depending on the validation failure subtype. +/// @note Only to be called in the ELC Script during a +/// NWNX_ELC_VALIDATION_FAILURE_TYPE_SPELL validation failure. +int NWNX_ELC_GetValidationFailureSpellID(); + +/// @} + +void NWNX_ELC_SetELCScript(string sScript) +{ + NWNXPushString(sScript); + NWNXCall(NWNX_ELC, "SetELCScript"); +} + +void NWNX_ELC_EnableCustomELCCheck(int bEnabled) +{ + NWNXPushInt(bEnabled); + NWNXCall(NWNX_ELC, "EnableCustomELCCheck"); +} + +void NWNX_ELC_SkipValidationFailure() +{ + NWNXCall(NWNX_ELC, "SkipValidationFailure"); +} + +int NWNX_ELC_GetValidationFailureType() +{ + NWNXCall(NWNX_ELC, "GetValidationFailureType"); + return NWNXPopInt(); +} + +int NWNX_ELC_GetValidationFailureSubType() +{ + NWNXCall(NWNX_ELC, "GetValidationFailureSubType"); + return NWNXPopInt(); +} + +int NWNX_ELC_GetValidationFailureMessageStrRef() +{ + NWNXCall(NWNX_ELC, "GetValidationFailureMessageStrRef"); + return NWNXPopInt(); +} + +void NWNX_ELC_SetValidationFailureMessageStrRef(int nStrRef) +{ + NWNXPushInt(nStrRef); + NWNXCall(NWNX_ELC, "SetValidationFailureMessageStrRef"); +} + +object NWNX_ELC_GetValidationFailureItem() +{ + NWNXCall(NWNX_ELC, "GetValidationFailureItem"); + return NWNXPopObject(); +} + +int NWNX_ELC_GetValidationFailureLevel() +{ + NWNXCall(NWNX_ELC, "GetValidationFailureLevel"); + return NWNXPopInt(); +} + +int NWNX_ELC_GetValidationFailureSkillID() +{ + NWNXCall(NWNX_ELC, "GetValidationFailureSkillID"); + return NWNXPopInt(); +} + +int NWNX_ELC_GetValidationFailureFeatID() +{ + NWNXCall(NWNX_ELC, "GetValidationFailureFeatID"); + return NWNXPopInt(); +} + +int NWNX_ELC_GetValidationFailureSpellID() +{ + NWNXCall(NWNX_ELC, "GetValidationFailureSpellID"); + return NWNXPopInt(); +} diff --git a/_module/nss/nwnx_encounter.nss b/_module/nss/nwnx_encounter.nss new file mode 100644 index 00000000..8aadcabe --- /dev/null +++ b/_module/nss/nwnx_encounter.nss @@ -0,0 +1,266 @@ +/// @addtogroup encounter Encounter +/// @brief Functions exposing additional encounter properties. +/// @{ +/// @file nwnx_encounter.nss + +const string NWNX_Encounter = "NWNX_Encounter"; ///< @private + +/// @brief A creature list entry for an encounter. +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. +int NWNX_Encounter_GetNumberOfCreaturesInEncounterList(object encounter); + +/// @brief Gets the encounter creature list entry at the specified index +/// @param encounter The encounter object. +/// @param index The index of the creature in the encounter list. +/// @return An NWNX_Encounter_CreatureListEntry. +struct NWNX_Encounter_CreatureListEntry NWNX_Encounter_GetEncounterCreatureByIndex(object encounter, int index); + +/// @brief Set the encounter creature list entry at the specified index +/// @param encounter The encounter object. +/// @param index The index of the creature in the encounter list. +/// @param creatureEntry The NWNX_Encounter_CreatureListEntry. +void NWNX_Encounter_SetEncounterCreatureByIndex(object encounter, int index, struct NWNX_Encounter_CreatureListEntry creatureEntry); + +/// @brief Get the faction id of encounter +/// @param encounter The encounter object. +/// @return The faction id. +int NWNX_Encounter_GetFactionId(object encounter); + +/// @brief Set the faction id of encounter. +/// @param encounter The encounter object. +/// @param factionId The faction id. +void NWNX_Encounter_SetFactionId(object encounter, int factionId); + +/// @brief Get if encounter is player triggered only. +/// @param encounter The encounter object. +/// @return TRUE if encounter is player triggered only. +int NWNX_Encounter_GetPlayerTriggeredOnly(object encounter); + +/// @brief Set if encounter is player triggered only. +/// @param encounter The encounter object. +/// @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. +int NWNX_Encounter_GetResetTime(object encounter); + +/// @brief Set the reset time of encounter. +/// @param encounter The encounter object. +/// @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) +{ + NWNXPushObject(encounter); + NWNXCall(NWNX_Encounter, "GetNumberOfCreaturesInEncounterList"); + return NWNXPopInt(); +} + +struct NWNX_Encounter_CreatureListEntry NWNX_Encounter_GetEncounterCreatureByIndex(object encounter, int index) +{ + struct NWNX_Encounter_CreatureListEntry creatureEntry; + 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) +{ + 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) +{ + NWNXPushObject(encounter); + NWNXCall(NWNX_Encounter, "GetFactionId"); + return NWNXPopInt(); +} + +void NWNX_Encounter_SetFactionId(object encounter, int factionId) +{ + NWNXPushInt(factionId); + NWNXPushObject(encounter); + NWNXCall(NWNX_Encounter, "SetFactionId"); +} + +int NWNX_Encounter_GetPlayerTriggeredOnly(object encounter) +{ + NWNXPushObject(encounter); + NWNXCall(NWNX_Encounter, "GetPlayerTriggeredOnly"); + return NWNXPopInt(); +} + +void NWNX_Encounter_SetPlayerTriggeredOnly(object encounter, int playerTriggeredOnly) +{ + + NWNXPushInt(playerTriggeredOnly); + NWNXPushObject(encounter); + NWNXCall(NWNX_Encounter, "SetPlayerTriggeredOnly"); +} + +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) +{ + NWNXPushObject(encounter); + NWNXCall(NWNX_Encounter, "GetResetTime"); + return NWNXPopInt(); +} + +void NWNX_Encounter_SetResetTime(object encounter, int resetTime) +{ + 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 new file mode 100644 index 00000000..0a15cde7 --- /dev/null +++ b/_module/nss/nwnx_events.nss @@ -0,0 +1,2532 @@ +/// @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 + +const string NWNX_Events = "NWNX_Events"; ///< @private + +/** + # Events +__________________________________________ + ## Associate Events + - NWNX_ON_ADD_ASSOCIATE_BEFORE + - NWNX_ON_ADD_ASSOCIATE_AFTER + - NWNX_ON_REMOVE_ASSOCIATE_BEFORE + - NWNX_ON_REMOVE_ASSOCIATE_AFTER + + `OBJECT_SELF` = The owner of the associate. + + Event Data Tag | Type | Notes + ----------------------|--------|------- + ASSOCIATE_OBJECT_ID | object | Convert to object with StringToObject() + +_______________________________________ + ## Stealth Events + - 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 + - NWNX_ON_EXAMINE_OBJECT_AFTER + + `OBJECT_SELF` = The player examining the object + + Event Data Tag | Type | Notes + ----------------------|--------|------- + 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 + - NWNX_ON_VALIDATE_USE_ITEM_AFTER + + `OBJECT_SELF` = The creature using the item + + Event Data Tag | Type | Notes | + ------------------------|--------|-------| + ITEM_OBJECT_ID | object | Convert to object with StringToObject()| + BEFORE_RESULT | int | TRUE/FALSE, only in _AFTER events| + + @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. + +_______________________________________ + ## Use Item Events + - NWNX_ON_USE_ITEM_BEFORE + - NWNX_ON_USE_ITEM_AFTER + + `OBJECT_SELF` = The creature using the item + + Event Data Tag | Type | Notes | + ------------------------|--------|-------| + 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. + +_______________________________________ + ## Item Container Events + - NWNX_ON_ITEM_INVENTORY_OPEN_BEFORE + - NWNX_ON_ITEM_INVENTORY_OPEN_AFTER + - NWNX_ON_ITEM_INVENTORY_CLOSE_BEFORE + - NWNX_ON_ITEM_INVENTORY_CLOSE_AFTER + + `OBJECT_SELF` = The container + + Event Data Tag | Type | Notes + ----------------------|--------|------- + OWNER | object |Convert to object with StringToObject() + +_______________________________________ + ## Ammunition Reload Events + - NWNX_ON_ITEM_AMMO_RELOAD_BEFORE + - NWNX_ON_ITEM_AMMO_RELOAD_AFTER + + `OBJECT_SELF` = The creature whose inventory we're searching for the item type + + Event Data Tag | Type | Notes + ----------------------|------|------- + BASE_ITEM_ID | int | The base item type being sought (arrow, bolt, bullet) + BASE_ITEM_NTH | int | Find the Nth instance of this item + ACTION_RESULT | int | The object that was determined in BEFORE (only in after) + +_______________________________________ + ## Scroll Learn Events + - NWNX_ON_ITEM_SCROLL_LEARN_BEFORE + - NWNX_ON_ITEM_SCROLL_LEARN_AFTER + + `OBJECT_SELF` = The creature learning the scroll + + Event Data Tag | Type | Notes + ----------------------|--------|------- + 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 + - NWNX_ON_VALIDATE_ITEM_EQUIP_BEFORE + - NWNX_ON_VALIDATE_ITEM_EQUIP_AFTER + + `OBJECT_SELF` = The creature trying to equip the item + + Event Data Tag | Type | Notes | + ----------------------|--------|-------| + ITEM_OBJECT_ID | object | Convert to object with StringToObject()| + SLOT | int | INVENTORY_SLOT_* Constant| + BEFORE_RESULT | int | TRUE/FALSE, only in _AFTER events| + + @note Manually setting the result of this event will skip all game checks for item slot validity. The client will block incompatible types (weapons into armor slots) in the GUI, but this will work using ActionEquipItem(). + @note To show this item as unusable to the PC (red in the inventory), use in combination with the "NWNX_ON_VALIDATE_USE_ITEM_*" events. + @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. + +_______________________________________ + ## Item Equip Events + - NWNX_ON_ITEM_EQUIP_BEFORE + - NWNX_ON_ITEM_EQUIP_AFTER + + `OBJECT_SELF` = The creature equipping the item + + Event Data Tag | Type | Notes | + ----------------------|--------|-------| + 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 equipped 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 + - NWNX_ON_ITEM_UNEQUIP_AFTER + + `OBJECT_SELF` = The creature unequipping the item + + Event Data Tag | Type | Notes + ----------------------|--------|------- + ITEM | object | Convert to object with StringToObject() + + @note These events do not trigger when equipment is replaced by equipping another item. +_______________________________________ + ## Item Destroy Events + - NWNX_ON_ITEM_DESTROY_OBJECT_BEFORE + - NWNX_ON_ITEM_DESTROY_OBJECT_AFTER + - NWNX_ON_ITEM_DECREMENT_STACKSIZE_BEFORE + - NWNX_ON_ITEM_DECREMENT_STACKSIZE_AFTER + + `OBJECT_SELF` = The item triggering the event + + @note Use of `NWNX_ON_ITEM_(DESTROY_OBJECT|DECREMENT_STACKSIZE)_*` conflicts with object event handler profiling + +_______________________________________ + ## Item Use Lore To Identify Events + - NWNX_ON_ITEM_USE_LORE_BEFORE + - NWNX_ON_ITEM_USE_LORE_AFTER + + `OBJECT_SELF` = The player attempting to identify an item with their lore skill + + Event Data Tag | Type | Notes + ----------------------|--------|------- + ITEM | object |Convert to object with StringToObject() + +_______________________________________ + ## Item Pay To Identify Events + - NWNX_ON_ITEM_PAY_TO_IDENTIFY_BEFORE + - NWNX_ON_ITEM_PAY_TO_IDENTIFY_AFTER + + `OBJECT_SELF` = The player attempting to pay to identify an item + + Event Data Tag | Type | Notes + ----------------------|--------|------- + ITEM | object | Convert to object with StringToObject() + STORE | object | Convert to object with StringToObject() + +_______________________________________ + ## Item Split Events + - NWNX_ON_ITEM_SPLIT_BEFORE + - NWNX_ON_ITEM_SPLIT_AFTER + + `OBJECT_SELF` = The player attempting to split an item + + Event Data Tag | Type | Notes| + ----------------------|--------|-------| + 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 + - NWNX_ON_USE_FEAT_AFTER + + `OBJECT_SELF` = The object using the feat + + Event Data Tag | Type | Notes | + ----------------------|--------|-------| + FEAT_ID | int | | + SUBFEAT_ID | int | | + 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 + +_______________________________________ + ## Feat Decrement Remaining Uses Events + - NWNX_ON_DECREMENT_REMAINING_FEAT_USES_BEFORE + - NWNX_ON_DECREMENT_REMAINING_FEAT_USES_AFTER + + `OBJECT_SELF` = The object owning the feat + + Event Data Tag | Type | Notes | + ----------------------|--------|-------| + FEAT_ID | int | | + REMAINING_USES | int | Decremented by 1 in the _AFTER event if the _BEFORE event wasn't skipped | + + @note Skipping the _BEFORE event will prevent the feat uses being decremented + +_______________________________________ + ## 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 + - NWNX_ON_DM_GIVE_GOLD_AFTER + - NWNX_ON_DM_GIVE_XP_BEFORE + - NWNX_ON_DM_GIVE_XP_AFTER + - NWNX_ON_DM_GIVE_LEVEL_BEFORE + - NWNX_ON_DM_GIVE_LEVEL_AFTER + - NWNX_ON_DM_GIVE_ALIGNMENT_BEFORE + - NWNX_ON_DM_GIVE_ALIGNMENT_AFTER + + `OBJECT_SELF` = The DM + + Event Data Tag | Type | Notes | + ----------------------|--------|-------| + AMOUNT | int | | + OBJECT | object | Convert to object with StringToObject() | + ALIGNMENT_TYPE | int | Only valid for `NWNX_ON_DM_GIVE_ALIGNMENT_*` | + +_______________________________________ + ## DM Spawn Object Events + - NWNX_ON_DM_SPAWN_OBJECT_BEFORE + - NWNX_ON_DM_SPAWN_OBJECT_AFTER + + `OBJECT_SELF` = The DM + + Event Data Tag | Type | Notes | + ----------------------|--------|-------| + 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 + - NWNX_ON_DM_GIVE_ITEM_BEFORE + - NWNX_ON_DM_GIVE_ITEM_AFTER + + `OBJECT_SELF` = The DM + + Event Data Tag | Type | Notes + ----------------------|--------|------- + TARGET | object | Convert to object with StringToObject() + ITEM | object | Only returns a valid object in *_AFTER + +_______________________________________ + ## DM Multiple Object Action Events + - NWNX_ON_DM_HEAL_BEFORE + - NWNX_ON_DM_HEAL_AFTER + - NWNX_ON_DM_KILL_BEFORE + - NWNX_ON_DM_KILL_AFTER + - NWNX_ON_DM_TOGGLE_INVULNERABLE_BEFORE + - NWNX_ON_DM_TOGGLE_INVULNERABLE_AFTER + - NWNX_ON_DM_FORCE_REST_BEFORE + - NWNX_ON_DM_FORCE_REST_AFTER + - NWNX_ON_DM_LIMBO_BEFORE + - NWNX_ON_DM_LIMBO_AFTER + - NWNX_ON_DM_TOGGLE_AI_BEFORE + - NWNX_ON_DM_TOGGLE_AI_AFTER + - NWNX_ON_DM_TOGGLE_IMMORTAL_BEFORE + - NWNX_ON_DM_TOGGLE_IMMORTAL_AFTER + + `OBJECT_SELF` = The DM + + Event Data Tag | Type | Notes + ----------------------|--------|------- + NUM_TARGETS | int | The number of targets affected + TARGET_* | object | * = 1 <= NUM_TARGETS + +_______________________________________ + ## DM Single Object Action Events + - NWNX_ON_DM_GOTO_BEFORE + - NWNX_ON_DM_GOTO_AFTER + - NWNX_ON_DM_POSSESS_BEFORE + - NWNX_ON_DM_POSSESS_AFTER + - NWNX_ON_DM_POSSESS_FULL_POWER_BEFORE + - NWNX_ON_DM_POSSESS_FULL_POWER_AFTER + - NWNX_ON_DM_TOGGLE_LOCK_BEFORE + - NWNX_ON_DM_TOGGLE_LOCK_AFTER + - NWNX_ON_DM_DISABLE_TRAP_BEFORE + - NWNX_ON_DM_DISABLE_TRAP_AFTER + + `OBJECT_SELF` = The DM + + Event Data Tag | Type | Notes + ----------------------|--------|------- + TARGET | object | Convert to object with StringToObject() + + @note If `TARGET` is `OBJECT_INVALID` for `NWNX_ON_DM_POSSESS_*`, the DM is unpossessing. + +_______________________________________ + ## DM Jump Events + - NWNX_ON_DM_JUMP_TO_POINT_BEFORE + - NWNX_ON_DM_JUMP_TO_POINT_AFTER + - NWNX_ON_DM_JUMP_TARGET_TO_POINT_BEFORE + - NWNX_ON_DM_JUMP_TARGET_TO_POINT_AFTER + - NWNX_ON_DM_JUMP_ALL_PLAYERS_TO_POINT_BEFORE + - NWNX_ON_DM_JUMP_ALL_PLAYERS_TO_POINT_AFTER + + `OBJECT_SELF` = The DM + + Event Data Tag | Type | Notes | + ----------------------|--------|-------| + TARGET_AREA | object | Convert to object with StringToObject() | + POS_X | float | | + POS_Y | float | | + POS_Z | float | | + NUM_TARGETS | int | Only valid for NWNX_ON_DM_JUMP_TARGET_TO_POINT_* | + TARGET_* | object | * = 1 <= NUM_TARGETS, Only valid for NWNX_ON_DM_JUMP_TARGET_TO_POINT_* | + +_______________________________________ + ## DM Change Difficulty Events + - NWNX_ON_DM_CHANGE_DIFFICULTY_BEFORE + - NWNX_ON_DM_CHANGE_DIFFICULTY_AFTER + + `OBJECT_SELF` = The DM + + Event Data Tag | Type | Notes | + ----------------------|--------|-------| + DIFFICULTY_SETTING | int | | + +_______________________________________ + ## DM View Inventory Events + - NWNX_ON_DM_VIEW_INVENTORY_BEFORE + - NWNX_ON_DM_VIEW_INVENTORY_AFTER + + `OBJECT_SELF` = The DM + + Event Data Tag | Type | Notes + ----------------------|--------|------- + OPEN_INVENTORY | int | TRUE if opening an inventory, FALSE if closing + TARGET | object | Convert to object with StringToObject() + +_______________________________________ + ## DM Spawn Trap Events + - NWNX_ON_DM_SPAWN_TRAP_ON_OBJECT_BEFORE + - NWNX_ON_DM_SPAWN_TRAP_ON_OBJECT_AFTER + + `OBJECT_SELF` = The DM + + Event Data Tag | Type | Notes + ----------------------|--------|------- + AREA | object | Convert to object with StringToObject() + TARGET | object | Convert to object with StringToObject() + +_______________________________________ + ## DM Dump Locals Events + - NWNX_ON_DM_DUMP_LOCALS_BEFORE + - NWNX_ON_DM_DUMP_LOCALS_AFTER + + `OBJECT_SELF` = The DM + + Event Data Tag | Type | Notes + ----------------------|--------|------- + TYPE | int | 0 = dm_dumplocals, 1 = dm_dumparealocals, 3 = dm_dumpmodulelocals + 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_TAKE_ITEM_BEFORE + - NWNX_ON_DM_TAKE_ITEM_AFTER + - NWNX_ON_DM_SET_TIME_BEFORE + - NWNX_ON_DM_SET_TIME_AFTER + - NWNX_ON_DM_SET_DATE_BEFORE + - NWNX_ON_DM_SET_DATE_AFTER + - NWNX_ON_DM_SET_FACTION_REPUTATION_BEFORE + - NWNX_ON_DM_SET_FACTION_REPUTATION_AFTER + - NWNX_ON_DM_GET_FACTION_REPUTATION_BEFORE + - NWNX_ON_DM_GET_FACTION_REPUTATION_AFTER + + `OBJECT_SELF` = The DM + +_______________________________________ + ## Client Disconnect Events + - NWNX_ON_CLIENT_DISCONNECT_BEFORE + - NWNX_ON_CLIENT_DISCONNECT_AFTER + + `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. + +_______________________________________ + ## Client Connect Events + - NWNX_ON_CLIENT_CONNECT_BEFORE + - NWNX_ON_CLIENT_CONNECT_AFTER + + `OBJECT_SELF` = The module + + Event Data Tag | Type | Notes + ----------------------|--------|------- + PLAYER_NAME | string | Player name of the connecting client + 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 + - NWNX_ON_START_COMBAT_ROUND_AFTER + + `OBJECT_SELF` = The creature starting the combat round + + Event Data Tag | Type | Notes + ----------------------|--------|------- + 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 + - NWNX_ON_CAST_SPELL_BEFORE + - NWNX_ON_CAST_SPELL_AFTER + + `OBJECT_SELF` = The creature casting the spell + + Event Data Tag | Type | Notes | + ----------------------|--------|-------| + SPELL_ID | int | | + TARGET_POSITION_X | float | | + TARGET_POSITION_Y | float | | + TARGET_POSITION_Z | float | | + 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 | + PROJECTILE_PATH_TYPE | int | | + IS_INSTANT_SPELL | int | Returns TRUE if spell was instant else FALSE | + +@note the stock nwscript GetMetaMagicFeat() function will return any metamagic used. + +_______________________________________ + ## Set Memorized Spell Slot Events + - NWNX_SET_MEMORIZED_SPELL_SLOT_BEFORE + - NWNX_SET_MEMORIZED_SPELL_SLOT_AFTER + + `OBJECT_SELF` = The creature who's memorizing the spell + + Event Data Tag | Type | Notes | + ----------------------|--------|-------| + SPELL_MULTICLASS | int | Index of the spell casting class (0-7) | + SPELL_SLOT | int | | + SPELL_ID | int | | + SPELL_DOMAIN | int | | + SPELL_METAMAGIC | int | | + SPELL_FROMCLIENT | int | | + ACTION_RESULT | int | | + +_______________________________________ + ## Clear Memorized Spell Slot Events + - NWNX_CLEAR_MEMORIZED_SPELL_SLOT_BEFORE + - NWNX_CLEAR_MEMORIZED_SPELL_SLOT_AFTER + + `OBJECT_SELF` = The creature whose spellbook is being changed + + Event Data Tag | Type | Notes | + ----------------------|--------|-------| + 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 + - NWNX_ON_HEALER_KIT_AFTER + + `OBJECT_SELF` = The creature using the Healer's Kit + + Event Data Tag | Type | Notes | + ----------------------|--------|-------| + 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 + - NWNX_ON_PARTY_*_AFTER + + `OBJECT_SELF` = The player doing the action + + Replace * with an event listed below + + Event | Event Data Tag | Type | Notes | + ----------------|-----------------------|--------|-------| + 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 + - NWNX_ON_COMBAT_MODE_ON + - NWNX_ON_COMBAT_MODE_OFF + + `OBJECT_SELF` = The Player Character toggling the mode + + Event Data Tag | Type | Notes + ----------------------|--------|------- + COMBAT_MODE_ID | int | See below + + The `COMBAT_MODE_ID` returned does not match the `COMBAT_MODE_*` NWScript constants. Use the following: + Combat Mode | ID + ----------------------|---- + NONE | 0 + PARRY | 1 + POWER_ATTACK | 2 + IMPROVED_POWER_ATTACK | 3 + COUNTERSPELL | 4 + FLURRY_OF_BLOWS | 5 + RAPID_SHOT | 6 + EXPERTISE | 7 + IMPROVED_EXPERTISE | 8 + DEFENSIVE_CASTING | 9 + DIRTY_FIGHTING | 10 + DEFENSIVE_STANCE | 11 + +_______________________________________ + ## Use Skill Events + - NWNX_ON_USE_SKILL_BEFORE + - NWNX_ON_USE_SKILL_AFTER + + `OBJECT_SELF` = The creature using the skill + + Event Data Tag | Type | Notes | + ----------------------|--------|-------| + 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`, + `SKILL_PICK_POCKET`, `SKILL_TAUNT` + +_______________________________________ + ## Map Pin Events + - NWNX_ON_MAP_PIN_ADD_PIN_BEFORE + - NWNX_ON_MAP_PIN_ADD_PIN_AFTER + - NWNX_ON_MAP_PIN_CHANGE_PIN_BEFORE + - NWNX_ON_MAP_PIN_CHANGE_PIN_AFTER + - NWNX_ON_MAP_PIN_DESTROY_PIN_BEFORE + - NWNX_ON_MAP_PIN_DESTROY_PIN_AFTER + + `OBJECT_SELF` = The player performing the map pin action + + Event Data Tag | Type | Notes + ----------------------|--------|------- + PIN_X | float | Not available in DESTROY event + PIN_Y | float | Not available in DESTROY event + PIN_ID | int | Not available in ADD events. Use `GetLocalInt(oPC, "NW_TOTAL_MAP_PINS")` + PIN_NOTE | string | Not available in DESTROY event + +_______________________________________ + ## Spot/Listen Detection Events + - NWNX_ON_DO_LISTEN_DETECTION_BEFORE + - NWNX_ON_DO_LISTEN_DETECTION_AFTER + - NWNX_ON_DO_SPOT_DETECTION_BEFORE + - NWNX_ON_DO_SPOT_DETECTION_AFTER + + `OBJECT_SELF` = The creature doing the detecting + + Event Data Tag | Type | Notes + ----------------------|--------|------- + TARGET | object | Convert to object with StringToObject() + TARGET_INVISIBLE | int | TRUE/FALSE + BEFORE_RESULT | int | TRUE/FALSE, only in _AFTER events + +_______________________________________ + ## Polymorph Events + - NWNX_ON_POLYMORPH_BEFORE + - NWNX_ON_POLYMORPH_AFTER + - NWNX_ON_UNPOLYMORPH_BEFORE + - NWNX_ON_UNPOLYMORPH_AFTER + + `OBJECT_SELF` = The creature doing the un/polymorphing + + Event Data Tag | Type | Notes + ----------------------|--------|------- + POLYMORPH_TYPE | int | Appearance polymorphing into. Only for ON_POLYMORPH + + @warning If skipping the ON_POLYMORPH event, in some cases bioware scripts will enter an endless loop + trying to merge item properties.\n + This can be seen in `x2_s2_gwildshp` with the minotaur form with the following line: + `IPWildShapeCopyItemProperties(oWeaponOld,oWeaponNew, TRUE);` + If you want to skip this, you need to make sure oWeaponOld != oWeaponNew + +_______________________________________ + ## Effect Applied/Removed Events + - NWNX_ON_EFFECT_APPLIED_BEFORE + - NWNX_ON_EFFECT_APPLIED_AFTER + - NWNX_ON_EFFECT_REMOVED_BEFORE + - NWNX_ON_EFFECT_REMOVED_AFTER + + `OBJECT_SELF` = The target of the effect + + Event Data Tag | Type | Notes | + ----------------------|--------|-------| + UNIQUE_ID | int | | + 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_* | + DURATION | float | | + SPELL_ID | int | | + CASTER_LEVEL | int | | + CUSTOM_TAG | string | | + INT_PARAM_* | int | * = 1-8 | + FLOAT_PARAM_* | float | * = 1-4 | + STRING_PARAM_* | string | * = 1-6 | + 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. + +_______________________________________ + ## Quickchat Events + - NWNX_ON_QUICKCHAT_BEFORE + - NWNX_ON_QUICKCHAT_AFTER + + `OBJECT_SELF` = The player using the quick chat command + + Event Data Tag | Type | Notes + ----------------------|--------|------- + QUICKCHAT_COMMAND | int | `VOICE_CHAT_*` constants + +_______________________________________ + ## Inventory Open Events + - NWNX_ON_INVENTORY_OPEN_BEFORE + - NWNX_ON_INVENTORY_OPEN_AFTER + + `OBJECT_SELF` = The player opening the inventory + + Event Data Tag | Type | Notes + ----------------------|--------|------- + TARGET_INVENTORY | object | Pretty sure this is always the player + +_______________________________________ + ## Inventory Select Panel Events + - NWNX_ON_INVENTORY_SELECT_PANEL_BEFORE + - NWNX_ON_INVENTORY_SELECT_PANEL_AFTER + + `OBJECT_SELF` = The player changing inventory panels + + Event Data Tag | Type | Notes + ----------------------|--------|------- + CURRENT_PANEL | int | The current panel, index starts at 0 + SELECTED_PANEL | int | The selected panel, index starts at 0 + +_______________________________________ + ## Barter Start Events + - NWNX_ON_BARTER_START_BEFORE + - NWNX_ON_BARTER_START_AFTER + + `OBJECT_SELF` = The player who initiated the barter + + Event Data Tag | Type | Notes + ----------------------|--------|------- + BARTER_TARGET | object | The other player involved in the barter + +_______________________________________ + ## Barter End Events + - NWNX_ON_BARTER_END_BEFORE + - NWNX_ON_BARTER_END_AFTER + + `OBJECT_SELF` = The player who initiated the barter + + Event Data Tag | Type | Notes + ------------------------------|--------|------- + BARTER_TARGET | object | The other player involved in the barter + 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 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 + - NWNX_ON_TRAP_DISARM_AFTER + - NWNX_ON_TRAP_ENTER_BEFORE + - NWNX_ON_TRAP_ENTER_AFTER + - NWNX_ON_TRAP_EXAMINE_BEFORE + - NWNX_ON_TRAP_EXAMINE_AFTER + - NWNX_ON_TRAP_FLAG_BEFORE + - NWNX_ON_TRAP_FLAG_AFTER + - NWNX_ON_TRAP_RECOVER_BEFORE + - NWNX_ON_TRAP_RECOVER_AFTER + - NWNX_ON_TRAP_SET_BEFORE + - NWNX_ON_TRAP_SET_AFTER + + `OBJECT_SELF` = The creature performing the trap action + + Event Data Tag | Type | Notes + ----------------------|--------|------- + TRAP_OBJECT_ID | object | Convert to object with StringToObject() + TARGET_OBJECT_ID | object | Convert to object with StringToObject(), only in SET events + TARGET_POSITION_X | float | Only in SET events + TARGET_POSITION_Y | float | Only in SET events + TARGET_POSITION_Z | float | Only in SET events + NEEDS_TO_MOVE | int | TRUE/FALSE, only in _BEFORE events (not ENTER), if TRUE another _BEFORE event will be fired before the actual interaction with the trap + TRAP_FORCE_SET | int | TRUE/FALSE, only in ENTER events + ACTION_RESULT | int | TRUE/FALSE, only in _AFTER events (not ENTER) + +_______________________________________ + ## Timing Bar Events + - NWNX_ON_TIMING_BAR_START_BEFORE + - NWNX_ON_TIMING_BAR_START_AFTER + - NWNX_ON_TIMING_BAR_STOP_BEFORE + - NWNX_ON_TIMING_BAR_STOP_AFTER + - NWNX_ON_TIMING_BAR_CANCEL_BEFORE + - NWNX_ON_TIMING_BAR_CANCEL_AFTER + + `OBJECT_SELF` = The player the timing bar is for + + Event Data Tag | Type | Notes + ----------------------|--------|------- + EVENT_ID | int | The type of timing bar, see constants below, only in _START_ events + DURATION | int | Length of time (in milliseconds) the bar is set to last, only in _START_ events + +_______________________________________ + ## Webhook Events + - NWNX_ON_WEBHOOK_SUCCESS + - NWNX_ON_WEBHOOK_FAILURE + + `OBJECT_SELF` = The module object + + Event Data Tag | Type | Notes | + ----------------------|--------|-------| + STATUS | int | The return code after posting to the server | + MESSAGE | string | The full constructed message sent | + HOST | string | | + PATH | string | | + RATELIMIT_LIMIT | int | Discord: The number of requests that can be made in a limited period | + RATELIMIT_REMAINING | int | Discord: The number of remaining requests that can be made before rate limited | + RATELIMIT_RESET | int | Discord: Timestamp when the rate limit resets | + RETRY_AFTER | float | Milliseconds until another webhook is allowed when rate limited | + FAIL_INFO | string | The reason the hook failed aside from rate limits | + + @note Requires @ref webhook "NWNX_WebHook" plugin to work. + +_______________________________________ + ## Servervault Events + - NWNX_ON_CHECK_STICKY_PLAYER_NAME_RESERVED_BEFORE + - NWNX_ON_CHECK_STICKY_PLAYER_NAME_RESERVED_AFTER + + `OBJECT_SELF` = The module + + Event Data Tag | Type | Notes + ----------------------|--------|------- + PLAYER_NAME | string | Player name of the connecting client + CDKEY | string | Public cdkey of the connecting client + LEGACY_CDKEY | string | Public cdkey from earlier versions of NWN + IS_DM | int | Whether the client is connecting as DM (1/0) + + @note Skipping the _BEFORE event will cause no player names to be accepted unless you SetEventResult("1") + +_______________________________________ + ## Server Character Save Events + - NWNX_ON_SERVER_CHARACTER_SAVE_BEFORE + - NWNX_ON_SERVER_CHARACTER_SAVE_AFTER + + `OBJECT_SELF` = The player character being saved. + + @note This is called once for every character when the server is exiting and when the server is saved, or when ExportSingleCharacter() & ExportAllCharacters() is called. + +_______________________________________ + ## Export Character Events + - NWNX_ON_CLIENT_EXPORT_CHARACTER_BEFORE + - NWNX_ON_CLIENT_EXPORT_CHARACTER_AFTER + + `OBJECT_SELF` = The player + + Note: This event runs when the player clicks the "Save Character" button in the options menu to export their character to their localvault. + +_______________________________________ + ## Levelling Events + - NWNX_ON_LEVEL_UP_BEFORE + - NWNX_ON_LEVEL_UP_AFTER + - NWNX_ON_LEVEL_UP_AUTOMATIC_BEFORE + - NWNX_ON_LEVEL_UP_AUTOMATIC_AFTER + - NWNX_ON_LEVEL_DOWN_BEFORE + - NWNX_ON_LEVEL_DOWN_AFTER + + `OBJECT_SELF` = The creature levelling up or down, automatic is for henchmen levelling + +_______________________________________ + ## Container Change Events + - NWNX_ON_INVENTORY_ADD_ITEM_BEFORE + - NWNX_ON_INVENTORY_ADD_ITEM_AFTER + - NWNX_ON_INVENTORY_REMOVE_ITEM_BEFORE + - NWNX_ON_INVENTORY_REMOVE_ITEM_AFTER + + @note NWNX_ON_INVENTORY_REMOVE_ITEM_* is not skippable + + `OBJECT_SELF` = The container + + Event Data Tag | Type | Notes + ----------------------|--------|------- + ITEM | object | Convert to object with StringToObject() + +_______________________________________ + ## Gold Events + - NWNX_ON_INVENTORY_ADD_GOLD_BEFORE + - NWNX_ON_INVENTORY_ADD_GOLD_AFTER + - NWNX_ON_INVENTORY_REMOVE_GOLD_BEFORE + - NWNX_ON_INVENTORY_REMOVE_GOLD_AFTER + + `OBJECT_SELF` = The creature gaining or losing gold + + Event Data Tag | Type | Notes + ----------------------|--------|------- + GOLD | int | The amount of gold added or removed + + @warning While these events are skippable, you should be very careful about doing so. + It's very easy to create situations where players can dupe their gold or worse. + +_______________________________________ + ## PVP Attitude Change Events + - NWNX_ON_PVP_ATTITUDE_CHANGE_BEFORE + - NWNX_ON_PVP_ATTITUDE_CHANGE_AFTER + + `OBJECT_SELF` = The player performing the attitude change + + Event Data Tag | Type | Notes + ----------------------|--------|------- + TARGET_OBJECT_ID | object | Convert to object with StringToObject() + ATTITUDE | int | 0 = Dislike, 1 = Like + +_______________________________________ + ## Input Walk To Events + - NWNX_ON_INPUT_WALK_TO_WAYPOINT_BEFORE + - NWNX_ON_INPUT_WALK_TO_WAYPOINT_AFTER + + `OBJECT_SELF` = The player clicking somewhere to move + + Event Data Tag | Type | Notes | + ----------------------|--------|-------| + AREA | object | Convert to object with StringToObject() | + POS_X | float | | + POS_Y | float | | + POS_Z | float | | + RUN_TO_POINT | int | TRUE if player is running, FALSE if player is walking (eg when shift clicking) | + +_______________________________________ + ## Material Change Events + - NWNX_ON_MATERIALCHANGE_BEFORE + - NWNX_ON_MATERIALCHANGE_AFTER + + `OBJECT_SELF` = The creature walking on a different surface material + + Event Data Tag | Type | Notes + ----------------------|--------|------- + MATERIAL_TYPE | int | See surfacemat.2da for values + + @note: After a PC transitions to a new area, a surface material change event + won't fire until after the PC moves. + +_______________________________________ + ## Input Attack Events + - NWNX_ON_INPUT_ATTACK_OBJECT_BEFORE + - NWNX_ON_INPUT_ATTACK_OBJECT_AFTER + + `OBJECT_SELF` = The creature attacking + + Event Data Tag | Type | Notes + ----------------------|--------|------- + TARGET | object | Convert to object with StringToObject() + PASSIVE | int | TRUE / FALSE + CLEAR_ALL_ACTIONS | int | TRUE / FALSE + ADD_TO_FRONT | int | TRUE / FALSE + +_______________________________________ + ## Input Force Move To Events + - NWNX_ON_INPUT_FORCE_MOVE_TO_OBJECT_BEFORE + - NWNX_ON_INPUT_FORCE_MOVE_TO_OBJECT_AFTER + + `OBJECT_SELF` = The creature forcibly moving + + Event Data Tag | Type | Notes + ----------------------|--------|------- + TARGET | object | Convert to object with StringToObject() + + _______________________________________ + ## Input Cast Spell Events + - NWNX_ON_INPUT_CAST_SPELL_BEFORE + - NWNX_ON_INPUT_CAST_SPELL_AFTER + + `OBJECT_SELF` = The creature casting a spell + + Event Data Tag | Type | Notes + ----------------------|--------|------- + 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 + +_______________________________________ + ## Input Keyboard Events + - NWNX_ON_INPUT_KEYBOARD_BEFORE + - NWNX_ON_INPUT_KEYBOARD_AFTER + + `OBJECT_SELF` = The player + + Event Data Tag | Type | Notes + ----------------------|--------|------- + KEY | string | The key pressed by the player, one of the following: W A S D Q E + + @note To stop the player from moving you can do something like below, since normal immobilizing effects stop the client + from sending input. + + location locPlayer = GetLocation(oPlayer); + object oBoulder = CreateObject(OBJECT_TYPE_PLACEABLE, "plc_boulder", locPlayer, FALSE, "TESTPLC"); + 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 + + `OBJECT_SELF` = The object doing the locking + + Event Data Tag | Type | Notes + ----------------------|--------|------- + DOOR | object | Convert to object with StringToObject() + ACTION_RESULT | int | TRUE/FALSE, only in _AFTER events + +_______________________________________ + ## Object Unlock Events + - NWNX_ON_OBJECT_UNLOCK_BEFORE + - NWNX_ON_OBJECT_UNLOCK_AFTER + + `OBJECT_SELF` = The object doing the unlocking + + Event Data Tag | Type | Notes + ----------------------|--------|------- + 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 + - NWNX_ON_UUID_COLLISION_BEFORE + - NWNX_ON_UUID_COLLISION_AFTER + + `OBJECT_SELF` = The object that caused the UUID collision + + Event Data Tag | Type | Notes + ----------------------|--------|------- + UUID | string | The UUID + + Note: To get the existing object with `UUID` you can use GetObjectByUUID(), be aware that this event runs before the + object is added to the world which means many functions (for example `GetArea(OBJECT_SELF)`) will not work. + +_______________________________________ + ## Resource Events + - NWNX_ON_RESOURCE_ADDED + - NWNX_ON_RESOURCE_REMOVED + - NWNX_ON_RESOURCE_MODIFIED + + `OBJECT_SELF` = The module + + Event Data Tag | Type | Notes + ----------------------|--------|------- + 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 resource folders like /nwnx, /development and those defined in the Custom Resman Definition File + +_______________________________________ + ## ELC Events + - NWNX_ON_ELC_VALIDATE_CHARACTER_BEFORE + - NWNX_ON_ELC_VALIDATE_CHARACTER_AFTER + + `OBJECT_SELF` = The player + + Note: NWNX_ELC must be loaded for these events to work. The `_AFTER` event only fires if the character successfully + completes validation. + +_______________________________________ + ## Quickbar Events + - NWNX_ON_QUICKBAR_SET_BUTTON_BEFORE + - NWNX_ON_QUICKBAR_SET_BUTTON_AFTER + + `OBJECT_SELF` = The player + + Event Data Tag | Type | Notes + ----------------------|--------|------- + BUTTON | int | The quickbar button slot, 0-35 + TYPE | int | The type of quickbar button set, see NWNX_PLAYER_QBS_TYPE_* in nwnx_player_qbs.nss + + Note: Skipping the event does not prevent the client from changing the button clientside, the change won't however + be saved to the bic file. + +_______________________________________ + ## Calendar Events + - NWNX_ON_CALENDAR_HOUR + - NWNX_ON_CALENDAR_DAY + - NWNX_ON_CALENDAR_MONTH + - NWNX_ON_CALENDAR_YEAR + - NWNX_ON_CALENDAR_DAWN + - NWNX_ON_CALENDAR_DUSK + + `OBJECT_SELF` = The module + + Event Data Tag | Type | Notes + ----------------------|--------|------- + OLD | int | The (Hour/Day/Month/Year) before the change. Not available in DAWN/DUSK. + 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. | + ID | int | The ID of the item property. | + 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 + _______________________________________ + ## Ability Change Events + - NWNX_ON_ABILITY_CHANGE_BEFORE + - NWNX_ON_ABILITY_CHANGE_AFTER + + `OBJECT_SELF` = The player object + + Event Data Tag | Type | Notes + ----------------------|------|------- + ABILITY | int | The ABILITY_* constant | + VALUE | int | The new ability value | + MOD | int | The new ability modifier (only available in AFTER) | + + @note The event only fires for players. It might fire a few times during (before) client enter when all the items are equipped and one or more of them have a bonus to abilities. To detect and possibly skip events happening before client enter one can use `GetIsObjectValid(GetArea(OBJECT_SELF))`. + + @warning The nwscript function GetAbilityModifier() will return the **old** modifier when used in this event. Use the MOD event data to get the new value. +*/ + +/// @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_DECREMENT_REMAINING_FEAT_USES_BEFORE = "NWNX_ON_DECREMENT_REMAINING_FEAT_USES_BEFORE"; +const string NWNX_ON_DECREMENT_REMAINING_FEAT_USES_AFTER = "NWNX_ON_DECREMENT_REMAINING_FEAT_USES_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; +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; +const int NWNX_EVENTS_TIMING_BAR_TRAP_EXAMINE = 4; +const int NWNX_EVENTS_TIMING_BAR_TRAP_SET = 5; +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. +/// +/// 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 evt The event name. +/// @param script The script to call when the event fires. +void NWNX_Events_SubscribeEvent(string evt, string script); + +/// @brief Unsubscribe a script from an event +/// @param evt The event name. +/// @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. +/// THIS SHOULD ONLY BE CALLED FROM WITHIN AN EVENT HANDLER. +string NWNX_Events_GetEventData(string tag); + +/// Skips execution of the currently executing event. +/// If this is a NWNX event, that means that the base function call won't be called. +/// This won't impact any other subscribers, nor dispatch for before / after functions. +/// For example, if you are subscribing to NWNX_ON_EXAMINE_OBJECT_BEFORE, and you skip ... +/// - The other subscribers will still be called. +/// - The original function in the base game will be skipped. +/// - The matching after event (NWNX_ON_EXAMINE_OBJECT_AFTER) will also be executed. +/// +/// THIS SHOULD ONLY BE CALLED FROM WITHIN AN EVENT HANDLER. +/// ONLY WORKS WITH THE FOLLOWING EVENTS: +/// - Feat events +/// - Item events +/// - Healing events +/// - CombatMode events +/// - Party events +/// - Skill events +/// - Map events +/// - Listen/Spot Detection events +/// - Polymorph events +/// - DMAction events +/// - Client connect event +/// - Client Export Character event +/// - Spell events (except SPELL_FAILED) +/// - QuickChat events +/// - Barter event (START/ADD_ITEM only) +/// - Trap events +/// - Sticky Player Name event +/// - Server Character Save Events +/// - Add/RemoveGold events +/// - PVP Attitude Change events +/// - {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 +/// - Decrement Remaining Feat Uses 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. +/// +/// THIS SHOULD ONLY BE CALLED FROM WITHIN AN EVENT HANDLER. +/// ONLY WORKS WITH THE FOLLOWING EVENTS: +/// - Use Item event - "1" or "0" to send feedback whether item use is allowed +/// - Validate Use Item Event - "1" or "0" to show the item is unusable (red) in the player inventory. +/// - Healer's Kit event +/// - Listen/Spot Detection events -> "1" or "0" +/// - OnClientConnectBefore -> Reason for disconnect if skipped +/// - 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 +/// +/// Returns "" on error +string NWNX_Events_GetCurrentEvent(); + +/// 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(Chunk). +void NWNX_Events_AddObjectToDispatchList(string sEvent, string sScriptOrChunk, 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) +{ + NWNXPushString(script); + NWNXPushString(evt); + NWNXCall(NWNX_Events, "SubscribeEvent"); +} + +void NWNX_Events_UnsubscribeEvent(string evt, string script) +{ + NWNXPushString(script); + NWNXPushString(evt); + NWNXCall(NWNX_Events, "UnsubscribeEvent"); +} + +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) +{ + NWNXPushString(data); + NWNXPushString(tag); + NWNXCall(NWNX_Events, "PushEventData"); +} + +int NWNX_Events_SignalEvent(string evt, object target) +{ + NWNXPushObject(target); + NWNXPushString(evt); + NWNXCall(NWNX_Events, "SignalEvent"); + return NWNXPopInt(); +} + +string NWNX_Events_GetEventData(string tag) +{ + NWNXPushString(tag); + NWNXCall(NWNX_Events, "GetEventData"); + return NWNXPopString(); +} + +void NWNX_Events_SkipEvent() +{ + NWNXCall(NWNX_Events, "SkipEvent"); +} + +void NWNX_Events_SetEventResult(string data) +{ + NWNXPushString(data); + NWNXCall(NWNX_Events, "SetEventResult"); +} + +string NWNX_Events_GetCurrentEvent() +{ + NWNXCall(NWNX_Events, "GetCurrentEvent"); + return NWNXPopString(); +} + +void NWNX_Events_ToggleDispatchListMode(string sEvent, string sScriptOrChunk, int bEnable) +{ + NWNXPushInt(bEnable); + NWNXPushString(sScriptOrChunk); + NWNXPushString(sEvent); + NWNXCall(NWNX_Events, "ToggleDispatchListMode"); +} + +void NWNX_Events_AddObjectToDispatchList(string sEvent, string sScriptOrChunk, object oObject) +{ + NWNXPushObject(oObject); + NWNXPushString(sScriptOrChunk); + NWNXPushString(sEvent); + NWNXCall(NWNX_Events, "AddObjectToDispatchList"); +} + +void NWNX_Events_RemoveObjectFromDispatchList(string sEvent, string sScriptOrChunk, object oObject) +{ + 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 00000000..8b9468ea --- /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 00000000..82f0ead2 --- /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); + } + } + } +} diff --git a/_module/nss/nwnx_feedback.nss b/_module/nss/nwnx_feedback.nss new file mode 100644 index 00000000..3fa6f114 --- /dev/null +++ b/_module/nss/nwnx_feedback.nss @@ -0,0 +1,469 @@ +/// @addtogroup feedback Feedback +/// @brief Allows combatlog, feedback and journal updated messages to be hidden globally or per player. +/// @note +/// * If oPC == OBJECT_INVALID it will get/set the global state: +/// * TRUE = Message is globally hidden +/// * FALSE = Message is not globally hidden +/// * If oPC is a valid player it will get/set the personal state: +/// * TRUE = Message is hidden for oPC +/// * FALSE = Message is not hidden for oPC +/// * -1 = Personal state is not set for Message +/// @{ +/// @file nwnx_feedback.nss + +const string NWNX_Feedback = "NWNX_Feedback"; ///< @private + +/// @name Combat Log Message Types +/// @anchor combat_log_msgs +/// @{ +const int NWNX_FEEDBACK_COMBATLOG_SIMPLE_ADJECTIVE = 1; // Simple_Adjective: : +const int NWNX_FEEDBACK_COMBATLOG_SIMPLE_DAMAGE = 2; // Simple_Damage: damaged : +const int NWNX_FEEDBACK_COMBATLOG_COMPLEX_DAMAGE = 3; // Complex_Damage: damages : +const int NWNX_FEEDBACK_COMBATLOG_COMPLEX_DEATH = 4; // Complex_Death: killed +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 +/// @anchor feedback_msgs +/// @{ + +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; +const int NWNX_FEEDBACK_SKILL_TAUNT_VALID_TARGETS = 3; +const int NWNX_FEEDBACK_SKILL_TAUNT_TARGET_IMMUNE = 223; +const int NWNX_FEEDBACK_SKILL_PICKPOCKET_STOLE_ITEM = 4; +const int NWNX_FEEDBACK_SKILL_PICKPOCKET_STOLE_GOLD = 5; +const int NWNX_FEEDBACK_SKILL_PICKPOCKET_ATTEMPTING_TO_STEAL = 46; +const int NWNX_FEEDBACK_SKILL_PICKPOCKET_ATTEMPT_DETECTED = 150; +const int NWNX_FEEDBACK_SKILL_PICKPOCKET_STOLE_ITEM_TARGET = 47; +const int NWNX_FEEDBACK_SKILL_PICKPOCKET_STOLE_GOLD_TARGET = 48; +const int NWNX_FEEDBACK_SKILL_PICKPOCKET_TARGET_BROKE = 57; +const int NWNX_FEEDBACK_SKILL_HEAL_TARGET_NOT_DISPSND = 55; +const int NWNX_FEEDBACK_SKILL_HEAL_VALID_TARGETS = 56; +const int NWNX_FEEDBACK_SKILL_STEALTH_IN_COMBAT = 60; + +/// Miscellaneous Targeting Messages +const int NWNX_FEEDBACK_TARGET_UNAWARE = 6; +const int NWNX_FEEDBACK_ACTION_NOT_POSSIBLE_STATUS = 7; +const int NWNX_FEEDBACK_ACTION_NOT_POSSIBLE_PVP = 187; +const int NWNX_FEEDBACK_ACTION_CANT_REACH_TARGET = 218; +const int NWNX_FEEDBACK_ACTION_NO_LOOT = 247; + +/// Miscellaneous Feedback Messages +const int NWNX_FEEDBACK_WEIGHT_TOO_ENCUMBERED_TO_RUN = 8; +const int NWNX_FEEDBACK_WEIGHT_TOO_ENCUMBERED_WALK_SLOW = 9; +const int NWNX_FEEDBACK_WEIGHT_TOO_ENCUMBERED_CANT_PICKUP = 10; +const int NWNX_FEEDBACK_STATS_LEVELUP = 11; +const int NWNX_FEEDBACK_INVENTORY_FULL = 12; +const int NWNX_FEEDBACK_CONTAINER_FULL = 212; +const int NWNX_FEEDBACK_TRAP_TRIGGERED = 82; +const int NWNX_FEEDBACK_DAMAGE_HEALED = 151; +const int NWNX_FEEDBACK_EXPERIENCE_GAINNED = 182; +const int NWNX_FEEDBACK_EXPERIENCE_LOST = 183; +const int NWNX_FEEDBACK_JOURNALUPDATED = 184; // Doesn't actually work, use: + // NWNX_Feedback_{Get/Set}JournalUpdatedMessageHidden() +const int NWNX_FEEDBACK_BARTER_CANCELLED = 185; + +/// Mode activation/deactivation Messages +const int NWNX_FEEDBACK_DETECT_MODE_ACTIVATED = 83; +const int NWNX_FEEDBACK_DETECT_MODE_DEACTIVATED = 84; +const int NWNX_FEEDBACK_STEALTH_MODE_ACTIVATED = 85; +const int NWNX_FEEDBACK_STEALTH_MODE_DEACTIVATED = 86; +const int NWNX_FEEDBACK_PARRY_MODE_ACTIVATED = 87; +const int NWNX_FEEDBACK_PARRY_MODE_DEACTIVATED = 88; +const int NWNX_FEEDBACK_POWER_ATTACK_MODE_ACTIVATED = 89; +const int NWNX_FEEDBACK_POWER_ATTACK_MODE_DEACTIVATED = 90; +const int NWNX_FEEDBACK_IMPROVED_POWER_ATTACK_MODE_ACTIVATED = 91; +const int NWNX_FEEDBACK_IMPROVED_POWER_ATTACK_MODE_DEACTIVATED = 92; +const int NWNX_FEEDBACK_RAPID_SHOT_MODE_ACTIVATED = 166; +const int NWNX_FEEDBACK_RAPID_SHOT_MODE_DEACTIVATED = 167; +const int NWNX_FEEDBACK_FLURRY_OF_BLOWS_MODE_ACTIVATED = 168; +const int NWNX_FEEDBACK_FLURRY_OF_BLOWS_MODE_DEACTIVATED = 169; +const int NWNX_FEEDBACK_EXPERTISE_MODE_ACTIVATED = 227; +const int NWNX_FEEDBACK_EXPERTISE_MODE_DEACTIVATED = 228; +const int NWNX_FEEDBACK_IMPROVED_EXPERTISE_MODE_ACTIVATED = 229; +const int NWNX_FEEDBACK_IMPROVED_EXPERTISE_MODE_DEACTIVATED = 230; +const int NWNX_FEEDBACK_DEFENSIVE_CAST_MODE_ACTIVATED = 231; +const int NWNX_FEEDBACK_DEFENSIVE_CAST_MODE_DEACTIVATED = 232; +const int NWNX_FEEDBACK_MODE_CANNOT_USE_WEAPONS = 188; +const int NWNX_FEEDBACK_DIRTY_FIGHTING_MODE_ACTIVATED = 237; +const int NWNX_FEEDBACK_DIRTY_FIGHTING_MODE_DEACTIVATED = 238; + +const int NWNX_FEEDBACK_DEFENSIVE_STANCE_MODE_ACTIVATED = 252; +const int NWNX_FEEDBACK_DEFENSIVE_STANCE_MODE_DEACTIVATED = 253; + +/// Equipping Feedback Messages +const int NWNX_FEEDBACK_EQUIP_SKILL_SPELL_MODIFIERS = 71; +const int NWNX_FEEDBACK_EQUIP_UNIDENTIFIED = 76; +const int NWNX_FEEDBACK_EQUIP_MONK_ABILITIES = 77; +const int NWNX_FEEDBACK_EQUIP_INSUFFICIENT_LEVEL = 98; +const int NWNX_FEEDBACK_EQUIP_PROFICIENCIES = 119; +const int NWNX_FEEDBACK_EQUIP_WEAPON_TOO_LARGE = 120; +const int NWNX_FEEDBACK_EQUIP_WEAPON_TOO_SMALL = 260; +const int NWNX_FEEDBACK_EQUIP_ONE_HANDED_WEAPON = 121; +const int NWNX_FEEDBACK_EQUIP_TWO_HANDED_WEAPON = 122; +const int NWNX_FEEDBACK_EQUIP_WEAPON_SWAPPED_OUT = 123; +const int NWNX_FEEDBACK_EQUIP_ONE_CHAIN_WEAPON = 124; +const int NWNX_FEEDBACK_EQUIP_NATURAL_AC_NO_STACK = 189; +const int NWNX_FEEDBACK_EQUIP_ARMOUR_AC_NO_STACK = 190; +const int NWNX_FEEDBACK_EQUIP_SHIELD_AC_NO_STACK = 191; +const int NWNX_FEEDBACK_EQUIP_DEFLECTION_AC_NO_STACK = 192; +const int NWNX_FEEDBACK_EQUIP_NO_ARMOR_COMBAT = 193; +const int NWNX_FEEDBACK_EQUIP_RANGER_ABILITIES = 200; +const int NWNX_FEEDBACK_EQUIP_ALIGNMENT = 207; +const int NWNX_FEEDBACK_EQUIP_CLASS = 208; +const int NWNX_FEEDBACK_EQUIP_RACE = 209; +const int NWNX_FEEDBACK_UNEQUIP_NO_ARMOR_COMBAT = 194; + +/// Action Feedback Messages +const int NWNX_FEEDBACK_OBJECT_LOCKED = 13; +const int NWNX_FEEDBACK_OBJECT_NOT_LOCKED = 14; +const int NWNX_FEEDBACK_OBJECT_SPECIAL_KEY = 15; +const int NWNX_FEEDBACK_OBJECT_USED_KEY = 16; +const int NWNX_FEEDBACK_REST_EXCITED_CANT_REST = 17; +const int NWNX_FEEDBACK_REST_BEGINNING_REST = 18; +const int NWNX_FEEDBACK_REST_FINISHED_REST = 19; +const int NWNX_FEEDBACK_REST_CANCEL_REST = 20; +const int NWNX_FEEDBACK_REST_NOT_ALLOWED_IN_AREA = 54; +const int NWNX_FEEDBACK_REST_NOT_ALLOWED_BY_POSSESSED_FAMILIAR = 153; +const int NWNX_FEEDBACK_REST_NOT_ALLOWED_ENEMIES = 186; +const int NWNX_FEEDBACK_REST_CANT_UNDER_THIS_EFFECT = 213; +const int NWNX_FEEDBACK_CAST_LOST_TARGET = 21; +const int NWNX_FEEDBACK_CAST_CANT_CAST = 22; +const int NWNX_FEEDBACK_CAST_CNTRSPELL_TARGET_LOST_TARGET = 52; +const int NWNX_FEEDBACK_CAST_ARCANE_SPELL_FAILURE = 61; +const int NWNX_FEEDBACK_CAST_CNTRSPELL_TARGET_ARCANE_SPELL_FAILURE = 118; +const int NWNX_FEEDBACK_CAST_ENTANGLE_CONCENTRATION_FAILURE = 65; +const int NWNX_FEEDBACK_CAST_CNTRSPELL_TARGET_ENTANGLE_CONCENTRATION_FAILURE = 147; +const int NWNX_FEEDBACK_CAST_SPELL_INTERRUPTED = 72; +const int NWNX_FEEDBACK_CAST_EFFECT_SPELL_FAILURE = 236; +const int NWNX_FEEDBACK_CAST_CANT_CAST_WHILE_POLYMORPHED = 107; +const int NWNX_FEEDBACK_CAST_USE_HANDS = 210; +const int NWNX_FEEDBACK_CAST_USE_MOUTH = 211; +const int NWNX_FEEDBACK_CAST_DEFCAST_CONCENTRATION_FAILURE = 233; +const int NWNX_FEEDBACK_CAST_DEFCAST_CONCENTRATION_SUCCESS = 240; +const int NWNX_FEEDBACK_USEITEM_CANT_USE = 23; +const int NWNX_FEEDBACK_CONVERSATION_TOOFAR = 58; +const int NWNX_FEEDBACK_CONVERSATION_BUSY = 59; +const int NWNX_FEEDBACK_CONVERSATION_IN_COMBAT = 152; +const int NWNX_FEEDBACK_CHARACTER_INTRANSIT = 74; +const int NWNX_FEEDBACK_CHARACTER_OUTTRANSIT = 75; +const int NWNX_FEEDBACK_USEITEM_NOT_EQUIPPED = 244; +const int NWNX_FEEDBACK_DROPITEM_CANT_DROP = 245; +const int NWNX_FEEDBACK_DROPITEM_CANT_GIVE = 246; +const int NWNX_FEEDBACK_CLIENT_SERVER_SPELL_MISMATCH = 259; + +/// Combat feedback messages +const int NWNX_FEEDBACK_COMBAT_RUNNING_OUT_OF_AMMO = 24; +const int NWNX_FEEDBACK_COMBAT_OUT_OF_AMMO = 25; +const int NWNX_FEEDBACK_COMBAT_HENCHMAN_OUT_OF_AMMO = 241; +const int NWNX_FEEDBACK_COMBAT_DAMAGE_IMMUNITY = 62; +const int NWNX_FEEDBACK_COMBAT_SPELL_IMMUNITY = 68; +const int NWNX_FEEDBACK_COMBAT_DAMAGE_RESISTANCE = 63; +const int NWNX_FEEDBACK_COMBAT_DAMAGE_RESISTANCE_REMAINING = 66; +const int NWNX_FEEDBACK_COMBAT_DAMAGE_REDUCTION = 64; +const int NWNX_FEEDBACK_COMBAT_DAMAGE_REDUCTION_REMAINING = 67; +const int NWNX_FEEDBACK_COMBAT_SPELL_LEVEL_ABSORPTION = 69; +const int NWNX_FEEDBACK_COMBAT_SPELL_LEVEL_ABSORPTION_REMAINING = 70; +const int NWNX_FEEDBACK_COMBAT_WEAPON_NOT_EFFECTIVE = 117; +const int NWNX_FEEDBACK_COMBAT_EPIC_DODGE_ATTACK_EVADED = 234; +const int NWNX_FEEDBACK_COMBAT_MASSIVE_DAMAGE = 235; +const int NWNX_FEEDBACK_COMBAT_SAVED_VS_MASSIVE_DAMAGE = 254; +const int NWNX_FEEDBACK_COMBAT_SAVED_VS_DEVASTATING_CRITICAL = 257; + +/// Feat Feedback Messages +const int NWNX_FEEDBACK_FEAT_SAP_VALID_TARGETS = 26; +const int NWNX_FEEDBACK_FEAT_KNOCKDOWN_VALID_TARGETS = 27; +const int NWNX_FEEDBACK_FEAT_IMPKNOCKDOWN_VALID_TARGETS = 28; +const int NWNX_FEEDBACK_FEAT_CALLED_SHOT_NO_LEGS = 29; +const int NWNX_FEEDBACK_FEAT_CALLED_SHOT_NO_ARMS = 30; +const int NWNX_FEEDBACK_FEAT_SMITE_GOOD_TARGET_NOT_GOOD = 239; +const int NWNX_FEEDBACK_FEAT_SMITE_EVIL_TARGET_NOT_EVIL = 53; +const int NWNX_FEEDBACK_FEAT_QUIVERING_PALM_HIGHER_LEVEL = 73; +const int NWNX_FEEDBACK_FEAT_KEEN_SENSE_DETECT = 195; +const int NWNX_FEEDBACK_FEAT_USE_UNARMED = 198; +const int NWNX_FEEDBACK_FEAT_USES = 199; +const int NWNX_FEEDBACK_FEAT_USE_WEAPON_OF_CHOICE = 243; + +/// Party Feedback Messages +const int NWNX_FEEDBACK_PARTY_NEW_LEADER = 31; +const int NWNX_FEEDBACK_PARTY_MEMBER_KICKED = 32; +const int NWNX_FEEDBACK_PARTY_KICKED_YOU = 33; +const int NWNX_FEEDBACK_PARTY_ALREADY_CONSIDERING = 34; +const int NWNX_FEEDBACK_PARTY_ALREADY_INVOLVED = 35; +const int NWNX_FEEDBACK_PARTY_SENT_INVITATION = 36; +const int NWNX_FEEDBACK_PARTY_RECEIVED_INVITATION = 37; +const int NWNX_FEEDBACK_PARTY_JOINED = 38; +const int NWNX_FEEDBACK_PARTY_INVITATION_IGNORED = 39; +const int NWNX_FEEDBACK_PARTY_YOU_IGNORED_INVITATION = 40; +const int NWNX_FEEDBACK_PARTY_INVITATION_REJECTED = 41; +const int NWNX_FEEDBACK_PARTY_YOU_REJECTED_INVITATION = 42; +const int NWNX_FEEDBACK_PARTY_INVITATION_EXPIRED = 43; +const int NWNX_FEEDBACK_PARTY_LEFT_PARTY = 44; +const int NWNX_FEEDBACK_PARTY_YOU_LEFT = 45; +const int NWNX_FEEDBACK_PARTY_HENCHMAN_LIMIT = 49; +const int NWNX_FEEDBACK_PARTY_CANNOT_LEAVE_THE_ONE_PARTY = 196; +const int NWNX_FEEDBACK_PARTY_CANNOT_KICK_FROM_THE_ONE_PARTY = 197; +const int NWNX_FEEDBACK_PARTY_YOU_INVITED_NON_SINGLETON = 202; +const int NWNX_FEEDBACK_PVP_REACTION_DISLIKESYOU = 203; + +/// Item Feedback Messages +const int NWNX_FEEDBACK_ITEM_RECEIVED = 50; +const int NWNX_FEEDBACK_ITEM_LOST = 51; +const int NWNX_FEEDBACK_ITEM_EJECTED = 96; +const int NWNX_FEEDBACK_ITEM_USE_UNIDENTIFIED = 97; +const int NWNX_FEEDBACK_ITEM_GOLD_GAINED = 148; +const int NWNX_FEEDBACK_ITEM_GOLD_LOST = 149; + +/// Spell Scroll Learning +const int NWNX_FEEDBACK_LEARN_SCROLL_NOT_SCROLL = 78; +const int NWNX_FEEDBACK_LEARN_SCROLL_CANT_LEARN_CLASS = 79; +const int NWNX_FEEDBACK_LEARN_SCROLL_CANT_LEARN_LEVEL = 80; +const int NWNX_FEEDBACK_LEARN_SCROLL_CANT_LEARN_ABILITY = 81; +const int NWNX_FEEDBACK_LEARN_SCROLL_CANT_LEARN_OPPOSITION = 219; +const int NWNX_FEEDBACK_LEARN_SCROLL_CANT_LEARN_POSSESS = 220; +const int NWNX_FEEDBACK_LEARN_SCROLL_CANT_LEARN_KNOWN = 221; +const int NWNX_FEEDBACK_LEARN_SCROLL_CANT_LEARN_DIVINE = 224; +const int NWNX_FEEDBACK_LEARN_SCROLL_SUCCESS = 222; + +/// Floaty text feedback +const int NWNX_FEEDBACK_FLOATY_TEXT_STRREF = 93; +const int NWNX_FEEDBACK_FLOATY_TEXT_STRING = 94; + +/// Store feedback +const int NWNX_FEEDBACK_CANNOT_SELL_PLOT_ITEM = 99; +const int NWNX_FEEDBACK_CANNOT_SELL_CONTAINER = 100; +const int NWNX_FEEDBACK_CANNOT_SELL_ITEM = 101; +const int NWNX_FEEDBACK_NOT_ENOUGH_GOLD = 102; +const int NWNX_FEEDBACK_TRANSACTION_SUCCEEDED = 103; +const int NWNX_FEEDBACK_PRICE_TOO_HIGH = 248; +const int NWNX_FEEDBACK_STORE_NOT_ENOUGH_GOLD = 249; +const int NWNX_FEEDBACK_CANNOT_SELL_STOLEN_ITEM = 250; +const int NWNX_FEEDBACK_CANNOT_SELL_RESTRICTED_ITEM = 251; + +/// Portal control feedback +const int NWNX_FEEDBACK_PORTAL_TIMEDOUT = 104; +const int NWNX_FEEDBACK_PORTAL_INVALID = 105; + +/// Chat feedback +const int NWNX_FEEDBACK_CHAT_TELL_PLAYER_NOT_FOUND = 106; + +/// Alignment Feedback +const int NWNX_FEEDBACK_ALIGNMENT_SHIFT = 108; +const int NWNX_FEEDBACK_ALIGNMENT_PARTY_SHIFT = 111; +const int NWNX_FEEDBACK_ALIGNMENT_CHANGE = 109; +const int NWNX_FEEDBACK_ALIGNMENT_RESTRICTED_BY_CLASS_LOST = 110; +const int NWNX_FEEDBACK_ALIGNMENT_RESTRICTED_BY_CLASS_GAIN = 115; +const int NWNX_FEEDBACK_ALIGNMENT_RESTRICTED_WARNING_LOSS = 116; +const int NWNX_FEEDBACK_ALIGNMENT_RESTRICTED_WARNING_GAIN = 112; +const int NWNX_FEEDBACK_ALIGNMENT_EPITOME_GAINED = 113; +const int NWNX_FEEDBACK_ALIGNMENT_EPITOME_LOST = 114; + +/// Immunity Feedback +const int NWNX_FEEDBACK_IMMUNITY_DISEASE = 125; +const int NWNX_FEEDBACK_IMMUNITY_CRITICAL_HIT = 126; +const int NWNX_FEEDBACK_IMMUNITY_DEATH_MAGIC = 127; +const int NWNX_FEEDBACK_IMMUNITY_FEAR = 128; +const int NWNX_FEEDBACK_IMMUNITY_KNOCKDOWN = 129; +const int NWNX_FEEDBACK_IMMUNITY_PARALYSIS = 130; +const int NWNX_FEEDBACK_IMMUNITY_NEGATIVE_LEVEL = 131; +const int NWNX_FEEDBACK_IMMUNITY_MIND_SPELLS = 132; +const int NWNX_FEEDBACK_IMMUNITY_POISON = 133; +const int NWNX_FEEDBACK_IMMUNITY_SNEAK_ATTACK = 134; +const int NWNX_FEEDBACK_IMMUNITY_SLEEP = 135; +const int NWNX_FEEDBACK_IMMUNITY_DAZE = 136; +const int NWNX_FEEDBACK_IMMUNITY_CONFUSION = 137; +const int NWNX_FEEDBACK_IMMUNITY_STUN = 138; +const int NWNX_FEEDBACK_IMMUNITY_BLINDNESS = 139; +const int NWNX_FEEDBACK_IMMUNITY_DEAFNESS = 140; +const int NWNX_FEEDBACK_IMMUNITY_CURSE = 141; +const int NWNX_FEEDBACK_IMMUNITY_CHARM = 142; +const int NWNX_FEEDBACK_IMMUNITY_DOMINATE = 143; +const int NWNX_FEEDBACK_IMMUNITY_ENTANGLE = 144; +const int NWNX_FEEDBACK_IMMUNITY_SILENCE = 145; +const int NWNX_FEEDBACK_IMMUNITY_SLOW = 146; + +/// Associates +const int NWNX_FEEDBACK_ASSOCIATE_SUMMONED = 154; +const int NWNX_FEEDBACK_ASSOCIATE_UNSUMMONING = 155; +const int NWNX_FEEDBACK_ASSOCIATE_UNSUMMONING_BECAUSE_REST = 156; +const int NWNX_FEEDBACK_ASSOCIATE_UNSUMMONING_BECAUSE_DIED = 157; +const int NWNX_FEEDBACK_ASSOCIATE_DOMINATED = 158; +const int NWNX_FEEDBACK_ASSOCIATE_DOMINATION_ENDED = 159; +const int NWNX_FEEDBACK_ASSOCIATE_POSSESSED_CANNOT_RECOVER_TRAP = 170; +const int NWNX_FEEDBACK_ASSOCIATE_POSSESSED_CANNOT_BARTER = 171; +const int NWNX_FEEDBACK_ASSOCIATE_POSSESSED_CANNOT_EQUIP = 172; +const int NWNX_FEEDBACK_ASSOCIATE_POSSESSED_CANNOT_REPOSITORY_MOVE = 173; +const int NWNX_FEEDBACK_ASSOCIATE_POSSESSED_CANNOT_PICK_UP = 174; +const int NWNX_FEEDBACK_ASSOCIATE_POSSESSED_CANNOT_DROP = 175; +const int NWNX_FEEDBACK_ASSOCIATE_POSSESSED_CANNOT_UNEQUIP = 176; +const int NWNX_FEEDBACK_ASSOCIATE_POSSESSED_CANNOT_REST = 177; +const int NWNX_FEEDBACK_ASSOCIATE_POSSESSED_CANNOT_DIALOGUE = 178; +const int NWNX_FEEDBACK_ASSOCIATE_POSSESSED_CANNOT_GIVE_ITEM = 179; +const int NWNX_FEEDBACK_ASSOCIATE_POSSESSED_CANNOT_TAKE_ITEM = 180; +const int NWNX_FEEDBACK_ASSOCIATE_POSSESSED_CANNOT_USE_CONTAINER = 181; + +/// Miscellaneous Feedback +const int NWNX_FEEDBACK_SCRIPT_ERROR = 160; +const int NWNX_FEEDBACK_ACTION_LIST_OVERFLOW = 161; +const int NWNX_FEEDBACK_EFFECT_LIST_OVERFLOW = 162; +const int NWNX_FEEDBACK_AI_UPDATE_TIME_OVERFLOW = 163; +const int NWNX_FEEDBACK_ACTION_LIST_WIPE_OVERFLOW = 164; +const int NWNX_FEEDBACK_EFFECT_LIST_WIPE_OVERFLOW = 165; +const int NWNX_FEEDBACK_SEND_MESSAGE_TO_PC = 204; +const int NWNX_FEEDBACK_SEND_MESSAGE_TO_PC_STRREF = 242; + +/// Misc GUI feedback +const int NWNX_FEEDBACK_GUI_ONLY_PARTY_LEADER_MAY_CLICK = 201; +const int NWNX_FEEDBACK_PAUSED = 205; +const int NWNX_FEEDBACK_UNPAUSED = 206; +const int NWNX_FEEDBACK_REST_YOU_MAY_NOT_AT_THIS_TIME = 214; +const int NWNX_FEEDBACK_GUI_CHAR_EXPORT_REQUEST_SENT = 215; +const int NWNX_FEEDBACK_GUI_CHAR_EXPORTED_SUCCESSFULLY = 216; +const int NWNX_FEEDBACK_GUI_ERROR_CHAR_NOT_EXPORTED = 217; +const int NWNX_FEEDBACK_CAMERA_BG = 255; +const int NWNX_FEEDBACK_CAMERA_EQ = 256; +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. +/// @param nMessage The message identifier from @ref feedback_msgs "Feedback Messages". +/// @param oPC The PC or OBJECT_INVALID for a global setting. +/// @return TRUE if the message is hidden. +int NWNX_Feedback_GetFeedbackMessageHidden(int nMessage, object oPC = OBJECT_INVALID); + +/// @brief Sets if feedback message is hidden. +/// @param nMessage The message identifier. +/// @param isHidden TRUE/FALSE +/// @param oPC The PC or OBJECT_INVALID for a global setting. +/// @note Personal state overrides the global state which means if a global state is set +/// to TRUE but the personal state is set to FALSE, the message will be shown to the PC. +void NWNX_Feedback_SetFeedbackMessageHidden(int nMessage, int isHidden, object oPC = OBJECT_INVALID); + +/// @brief Gets if combat log message is hidden. +/// @param nMessage The message identifier from @ref combat_log_msgs "Combat Log Messages". +/// @param oPC The PC or OBJECT_INVALID for a global setting. +/// @return TRUE if the message is hidden. +int NWNX_Feedback_GetCombatLogMessageHidden(int nMessage, object oPC = OBJECT_INVALID); + +/// @brief Sets if combat log message is hidden. +/// @param nMessage The message identifier. +/// @param isHidden TRUE/FALSE +/// @param oPC The PC or OBJECT_INVALID for a global setting. +/// @note Personal state overrides the global state which means if a global state is set +/// to TRUE but the personal state is set to FALSE, the message will be shown to the PC. +void NWNX_Feedback_SetCombatLogMessageHidden(int nMessage, int isHidden, object oPC = OBJECT_INVALID); + +/// @brief Gets if the journal update message is hidden. +/// @param oPC The PC or OBJECT_INVALID for a global setting. +/// @return TRUE if the message is hidden. +int NWNX_Feedback_GetJournalUpdatedMessageHidden(object oPC = OBJECT_INVALID); + +/// @brief Sets if journal update message is hidden. +/// @param isHidden TRUE/FALSE +/// @param oPC The PC or OBJECT_INVALID for a global setting. +/// @note Personal state overrides the global state which means if a global state is set +/// to TRUE but the personal state is set to FALSE, the message will be shown to the PC. +void NWNX_Feedback_SetJournalUpdatedMessageHidden(int isHidden, object oPC = OBJECT_INVALID); + +/// @brief Set whether to use a blacklist or whitelist mode for feedback messages +/// @param bWhitelist TRUE for all messages to be hidden by default, default FALSE. +void NWNX_Feedback_SetFeedbackMessageMode(int bWhitelist); + + +/// @brief Set whether to use a blacklist or whitelist mode for combat log messages +/// @param bWhitelist TRUE for all messages to be hidden by default, default FALSE. +/// @note If using Whitelist, be sure to whitelist NWNX_FEEDBACK_COMBATLOG_FEEDBACK for feedback messages to work. +void NWNX_Feedback_SetCombatLogMessageMode(int bWhitelist); + +/// @} + +int NWNX_Feedback_GetFeedbackMessageHidden(int nMessage, object oPC = OBJECT_INVALID) +{ + NWNXPushInt(nMessage); + NWNXPushInt(0); + NWNXPushObject(oPC); + NWNXCall(NWNX_Feedback, "GetMessageHidden"); + return NWNXPopInt(); +} + +void NWNX_Feedback_SetFeedbackMessageHidden(int nMessage, int isHidden, object oPC = OBJECT_INVALID) +{ + NWNXPushInt(isHidden); + NWNXPushInt(nMessage); + NWNXPushInt(0); + NWNXPushObject(oPC); + NWNXCall(NWNX_Feedback, "SetMessageHidden"); +} + +int NWNX_Feedback_GetCombatLogMessageHidden(int nMessage, object oPC = OBJECT_INVALID) +{ + NWNXPushInt(nMessage); + NWNXPushInt(1); + NWNXPushObject(oPC); + NWNXCall(NWNX_Feedback, "GetMessageHidden"); + + return NWNXPopInt(); +} + +void NWNX_Feedback_SetCombatLogMessageHidden(int nMessage, int isHidden, object oPC = OBJECT_INVALID) +{ + NWNXPushInt(isHidden); + NWNXPushInt(nMessage); + NWNXPushInt(1); + NWNXPushObject(oPC); + NWNXCall(NWNX_Feedback, "SetMessageHidden"); +} + +int NWNX_Feedback_GetJournalUpdatedMessageHidden(object oPC = OBJECT_INVALID) +{ + NWNXPushInt(0); + NWNXPushInt(2); + NWNXPushObject(oPC); + NWNXCall(NWNX_Feedback, "GetMessageHidden"); + return NWNXPopInt(); +} + +void NWNX_Feedback_SetJournalUpdatedMessageHidden(int isHidden, object oPC = OBJECT_INVALID) +{ + NWNXPushInt(isHidden); + NWNXPushInt(0); + NWNXPushInt(2); + NWNXPushObject(oPC); + NWNXCall(NWNX_Feedback, "SetMessageHidden"); +} + +void NWNX_Feedback_SetFeedbackMessageMode(int bWhitelist) +{ + NWNXPushInt(bWhitelist); + NWNXPushInt(0); + NWNXCall(NWNX_Feedback, "SetFeedbackMode"); +} + +void NWNX_Feedback_SetCombatLogMessageMode(int bWhitelist) +{ + 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 00000000..878dc3dd --- /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 new file mode 100644 index 00000000..d604f9ed --- /dev/null +++ b/_module/nss/nwnx_item.nss @@ -0,0 +1,252 @@ +/// @addtogroup item Item +/// @brief Functions exposing additional item properties. +/// @{ +/// @file nwnx_item.nss + +const string NWNX_Item = "NWNX_Item"; ///< @private + +/// @brief Set an item's weight. +/// @note Will not persist through saving. +/// @param oItem The item object. +/// @param weight The weight, note this is in tenths of pounds. +void NWNX_Item_SetWeight(object oItem, int weight); + +/// @brief Set an item's base value in gold pieces. +/// @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); + +/// @brief Set an item's additional value in gold pieces. +/// @remark Total cost = base_value + additional_value. +/// @note Will persist through saving. +/// @param oItem The item object. +/// @param gold The additional gold value. +void NWNX_Item_SetAddGoldPieceValue(object oItem, int gold); + +/// @brief Get an item's base value in gold pieces. +/// @param oItem The item object. +/// @return The base gold piece value for the item. +int NWNX_Item_GetBaseGoldPieceValue(object oItem); + +/// @brief Get an item's additional value in gold pieces. +/// @param oItem The item object. +/// @return The additional gold piece value for the item. +int NWNX_Item_GetAddGoldPieceValue(object oItem); + +/// @brief Set an item's base item type. +/// @warning This will not be visible until the item is refreshed (e.g. drop and take the item, +/// or logging out and back in). +/// @param oItem The item object. +/// @param nBaseItem The new base item. +void NWNX_Item_SetBaseItemType(object oItem, int nBaseItem); + +/// @brief Make a single change to the appearance of an item. +/// @warning This will not be visible to PCs until the item is refreshed for them (e.g. by logging out and back in). +/// +/// Helmet models and simple items ignore nIndex. +/// ``` +/// nType nIndex nValue +/// ITEM_APPR_TYPE_SIMPLE_MODEL [Ignored] Model # +/// ITEM_APPR_TYPE_WEAPON_COLOR ITEM_APPR_WEAPON_COLOR_* 0-255 +/// ITEM_APPR_TYPE_WEAPON_MODEL ITEM_APPR_WEAPON_MODEL_* Model # +/// ITEM_APPR_TYPE_ARMOR_MODEL ITEM_APPR_ARMOR_MODEL_* Model # +/// ITEM_APPR_TYPE_ARMOR_COLOR ITEM_APPR_ARMOR_COLOR_* [0] 0-255 [1] +/// ``` +/// +/// [0] Where ITEM_APPR_TYPE_ARMOR_COLOR is specified, if per-part coloring is +/// desired, the following equation can be used for nIndex to achieve that: +/// +/// ITEM_APPR_ARMOR_NUM_COLORS + (ITEM_APPR_ARMOR_MODEL_ * ITEM_APPR_ARMOR_NUM_COLORS) + ITEM_APPR_ARMOR_COLOR_ +/// +/// For example, to change the CLOTH1 channel of the torso, nIndex would be: +/// +/// 6 + (7 * 6) + 2 = 50 +/// +/// [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. +/// @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 +/// @param oItem The item object. +/// @return A string representing the item's appearance. +string NWNX_Item_GetEntireItemAppearance(object oItem); + +/// @brief Restores an item's appearance using the value retrieved through NWNX_Item_GetEntireItemAppearance(). +/// @param oItem The item object. +/// @param sApp A string representing the item's appearance. +void NWNX_Item_RestoreItemAppearance(object oItem, string sApp); + +/// @brief Get an item's base armor class +/// @param oItem The item object. +/// @return The base armor class. +int NWNX_Item_GetBaseArmorClass(object oItem); + +/// @brief Get an item's minimum level required to equip. +/// @param oItem The item object. +/// @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 re-enable persistence. Recommended use on OBJECT_INVALID OnModuleLoad. +/// @warning if Persistence is FALSE, or not re-enabled, 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 re-enable persistence. Recommended use on OBJECT_INVALID OnModuleLoad. +/// @warning if Persistence is FALSE, or not re-enabled, 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) +{ + NWNXPushInt(w); + NWNXPushObject(oItem); + NWNXCall(NWNX_Item, "SetWeight"); +} + +void NWNX_Item_SetBaseGoldPieceValue(object oItem, int g) +{ + NWNXPushInt(g); + NWNXPushObject(oItem); + NWNXCall(NWNX_Item, "SetBaseGoldPieceValue"); +} + +void NWNX_Item_SetAddGoldPieceValue(object oItem, int g) +{ + NWNXPushInt(g); + NWNXPushObject(oItem); + NWNXCall(NWNX_Item, "SetAddGoldPieceValue"); +} + +int NWNX_Item_GetBaseGoldPieceValue(object oItem) +{ + NWNXPushObject(oItem); + NWNXCall(NWNX_Item, "GetBaseGoldPieceValue"); + return NWNXPopInt(); +} + +int NWNX_Item_GetAddGoldPieceValue(object oItem) +{ + NWNXPushObject(oItem); + NWNXCall(NWNX_Item, "GetAddGoldPieceValue"); + return NWNXPopInt(); +} + +void NWNX_Item_SetBaseItemType(object oItem, int nBaseItem) +{ + NWNXPushInt(nBaseItem); + NWNXPushObject(oItem); + NWNXCall(NWNX_Item, "SetBaseItemType"); +} + +void NWNX_Item_SetItemAppearance(object oItem, int nType, int nIndex, int nValue, int bUpdateCreatureAppearance = FALSE) +{ + NWNXPushInt(bUpdateCreatureAppearance); + NWNXPushInt(nValue); + NWNXPushInt(nIndex); + NWNXPushInt(nType); + NWNXPushObject(oItem); + NWNXCall(NWNX_Item, "SetItemAppearance"); +} + +string NWNX_Item_GetEntireItemAppearance(object oItem) +{ + NWNXPushObject(oItem); + NWNXCall(NWNX_Item, "GetEntireItemAppearance"); + return NWNXPopString(); +} + +void NWNX_Item_RestoreItemAppearance(object oItem, string sApp) +{ + NWNXPushString(sApp); + NWNXPushObject(oItem); + NWNXCall(NWNX_Item, "RestoreItemAppearance"); +} + +int NWNX_Item_GetBaseArmorClass(object oItem) +{ + NWNXPushObject(oItem); + NWNXCall(NWNX_Item, "GetBaseArmorClass"); + return NWNXPopInt(); +} + +int NWNX_Item_GetMinEquipLevel(object oItem) +{ + 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 new file mode 100644 index 00000000..d956add0 --- /dev/null +++ b/_module/nss/nwnx_itemprop.nss @@ -0,0 +1,100 @@ +/// @addtogroup itemproperty ItemProperty +/// @brief Utility functions to manipulate the builtin itemproperty type. +/// @{ +/// @file nwnx_itemprop.nss + +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 + int nCostTableValue; ///< @todo Describe + int nParam1; ///< @todo Describe + int nParam1Value; ///< @todo Describe + int nUsesPerDay; ///< @todo Describe + int nChanceToAppear; ///< @todo Describe + int bUsable; ///< @todo Describe + int nSpellId; ///< @todo Describe + object oCreator; ///< @todo Describe + string sTag; ///< @todo Describe +}; + +/// @brief Convert native itemproperty type to unpacked structure. +/// @param ip The itemproperty to convert. +/// @return A constructed NWNX_IPUnpacked. +struct NWNX_IPUnpacked NWNX_ItemProperty_UnpackIP(itemproperty ip); + +/// @brief Convert unpacked itemproperty structure to native type. +/// @param ip The NWNX_IPUnpacked structure to convert. +/// @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) +{ + NWNXPushItemProperty(ip); + NWNXCall(NWNX_ItemProperty, "UnpackIP"); + struct NWNX_IPUnpacked n; + 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) +{ + 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 new file mode 100644 index 00000000..42bf158e --- /dev/null +++ b/_module/nss/nwnx_lua.nss @@ -0,0 +1,44 @@ +/// @addtogroup lua LUA +/// @brief Execute Lua code and generate events in NWScript +/// @{ +/// @file nwnx_lua.nss + +const string NWNX_Lua = "NWNX_Lua"; ///< @private + +/// @brief Evaluate LUA code. +/// @param sCode The code to evaluate. +void NWNX_Lua_EvalVoid(string sCode); + +/// @brief Evaluate LUA code and return the output. +/// @param sCode The code to evaluate. +/// @return The result of the Lua code execution. +string NWNX_Lua_Eval(string sCode); + +/// @brief Generate events in NWScript to receive on the Lua side. +/// +/// Executes all the Lua functions registered to listen to that event in order of priority. +/// For details on events just look at the three *Event() functions in preload.lua. +void NWNX_Lua_RunEvent(string sEvent, object oObject, string sExtra=""); + +/// @} + +void NWNX_Lua_EvalVoid(string sCode) +{ + NWNXPushString(sCode); + NWNXCall(NWNX_Lua, "EvalVoid"); +} + +string NWNX_Lua_Eval(string sCode) +{ + NWNXPushString(sCode); + NWNXCall(NWNX_Lua, "Eval"); + return NWNXPopString(); +} + +void NWNX_Lua_RunEvent(string sEvent, object oObject, string sExtra="") +{ + 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 00000000..159214f9 --- /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 00000000..953a863a --- /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 new file mode 100644 index 00000000..cbc27f77 --- /dev/null +++ b/_module/nss/nwnx_object.nss @@ -0,0 +1,910 @@ +/// @addtogroup object Object +/// @brief Functions exposing additional object properties. +/// @{ +/// @file nwnx_object.nss + +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 +/// @name Internal Object Types +/// @{ +const int NWNX_OBJECT_TYPE_INTERNAL_INVALID = -1; +const int NWNX_OBJECT_TYPE_INTERNAL_GUI = 1; +const int NWNX_OBJECT_TYPE_INTERNAL_TILE = 2; +const int NWNX_OBJECT_TYPE_INTERNAL_MODULE = 3; +const int NWNX_OBJECT_TYPE_INTERNAL_AREA = 4; +const int NWNX_OBJECT_TYPE_INTERNAL_CREATURE = 5; +const int NWNX_OBJECT_TYPE_INTERNAL_ITEM = 6; +const int NWNX_OBJECT_TYPE_INTERNAL_TRIGGER = 7; +const int NWNX_OBJECT_TYPE_INTERNAL_PROJECTILE = 8; +const int NWNX_OBJECT_TYPE_INTERNAL_PLACEABLE = 9; +const int NWNX_OBJECT_TYPE_INTERNAL_DOOR = 10; +const int NWNX_OBJECT_TYPE_INTERNAL_AREAOFEFFECT = 11; +const int NWNX_OBJECT_TYPE_INTERNAL_WAYPOINT = 12; +const int NWNX_OBJECT_TYPE_INTERNAL_ENCOUNTER = 13; +const int NWNX_OBJECT_TYPE_INTERNAL_STORE = 14; +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 +{ + int type; ///< Int, String, Float, Object + string key; ///< Name of the variable +}; + +/// @brief Gets the count of all local variables. +/// @param obj The object. +/// @return The count. +int NWNX_Object_GetLocalVariableCount(object obj); + +/// @brief Gets the local variable at the provided index of the provided object. +/// @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 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 Get an object's hit points. +/// @note Unlike the native GetCurrentHitpoints function, this excludes temporary hitpoints. +/// @param obj The object. +/// @return The hit points. +int NWNX_Object_GetCurrentHitPoints(object obj); + +/// @brief Set an object's hit points. +/// @param obj The object. +/// @param hp The hit points. +void NWNX_Object_SetCurrentHitPoints(object obj, int hp); + +/// @brief Adjust an object's maximum hit points +/// @note Will not work on PCs. +/// @param obj The object. +/// @param hp The maximum hit points. +void NWNX_Object_SetMaxHitPoints(object obj, int hp); + +/// @brief Serialize a full object to a base64 string +/// @param obj The object. +/// @return A base64 string representation of the object. +/// @note includes locals, inventory, etc +string NWNX_Object_Serialize(object obj); + +/// @brief Deserialize the object. +/// @note The object will be created outside of the world and needs to be manually positioned at a location/inventory. +/// @param serialized The base64 string. +/// @return The object. +object NWNX_Object_Deserialize(string serialized); + +/// @brief Gets the dialog resref. +/// @param obj The object. +/// @return The name of the dialog resref. +string NWNX_Object_GetDialogResref(object obj); + +/// @brief Sets the dialog resref. +/// @param obj The object. +/// @param dialog The name of the dialog resref. +void NWNX_Object_SetDialogResref(object obj, string dialog); + +/// @brief Set oPlaceable's appearance. +/// @note Will not update for PCs until they re-enter the area. +/// @param oPlaceable The placeable. +/// @param nAppearance The appearance id. +void NWNX_Object_SetAppearance(object oPlaceable, int nAppearance); + +/// @brief Get oPlaceable's appearance. +/// @param oPlaceable The placeable. +/// @return The appearance id. +int NWNX_Object_GetAppearance(object oPlaceable); + +/// @brief Determine if an object has a visual effect. +/// @param obj The object. +/// @param nVFX The visual effect id. +/// @return TRUE if the object has the visual effect applied to it +int NWNX_Object_GetHasVisualEffect(object obj, int nVFX); + +/// @brief Get an object's damage immunity. +/// @param obj The object. +/// @param damageType The damage type to check for immunity. Use DAMAGE_TYPE_* constants. +/// @return Damage immunity as a percentage. +int NWNX_Object_GetDamageImmunity(object obj, int damageType); + +/// @brief Add or move an object. +/// @param obj The object. +/// @param area The area. +/// @param pos The position. +void NWNX_Object_AddToArea(object obj, object area, vector pos); + +/// @brief Get placeable's static setting +/// @param obj The object. +/// @return TRUE if placeable is static. +int NWNX_Object_GetPlaceableIsStatic(object obj); + +/// @brief Set placeable as static or not. +/// @note Will not update for PCs until they re-enter the area. +/// @param obj The object. +/// @param isStatic TRUE/FALSE +void NWNX_Object_SetPlaceableIsStatic(object obj, int isStatic); + +/// @brief Gets if a door/placeable auto-removes the key after use. +/// @param obj The object. +/// @return TRUE/FALSE or -1 on error. +int NWNX_Object_GetAutoRemoveKey(object obj); + +/// @brief Sets if a door/placeable auto-removes the key after use. +/// @param obj The object. +/// @param bRemoveKey TRUE/FALSE +void NWNX_Object_SetAutoRemoveKey(object obj, int bRemoveKey); + +/// @brief Get the geometry of a trigger +/// @param oTrigger The trigger object. +/// @return A string of vertex positions. +string NWNX_Object_GetTriggerGeometry(object oTrigger); + +/// @brief Set the geometry of a trigger with a list of vertex positions +/// @param oTrigger The trigger 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_Object_SetTriggerGeometry(object oTrigger, string sGeometry); + +/// @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 +/// @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. +/// @param sVarName The variable name. +/// @return The value or 0 on error. +int NWNX_Object_GetInt(object oObject, string sVarName); + +/// @brief Set oObject's integer variable sVarName to nValue. +/// @param oObject The object to set the variable on. +/// @param sVarName The variable name. +/// @param nValue The integer value to to set +/// @param bPersist When TRUE, 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. +void NWNX_Object_SetInt(object oObject, string sVarName, int nValue, int bPersist); + +/// @brief Delete oObject's integer variable sVarName. +/// @param oObject The object to delete the variable from. +/// @param sVarName The variable name. +void NWNX_Object_DeleteInt(object oObject, string sVarName); + +/// @brief Get oObject's string variable sVarName. +/// @param oObject The object to get the variable from. +/// @param sVarName The variable name. +/// @return The value or "" on error. +string NWNX_Object_GetString(object oObject, string sVarName); + +/// @brief Set oObject's string variable sVarName to sValue. +/// @param oObject The object to set the variable on. +/// @param sVarName The variable name. +/// @param sValue The string value to to set +/// @param bPersist When TRUE, 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. +void NWNX_Object_SetString(object oObject, string sVarName, string sValue, int bPersist); + +/// @brief Delete oObject's string variable sVarName. +/// @param oObject The object to delete the variable from. +/// @param sVarName The variable name. +void NWNX_Object_DeleteString(object oObject, string sVarName); + +/// @brief Get oObject's float variable sVarName. +/// @param oObject The object to get the variable from. +/// @param sVarName The variable name. +/// @return The value or 0.0f on error. +float NWNX_Object_GetFloat(object oObject, string sVarName); + +/// @brief Set oObject's float variable sVarName to fValue. +/// @param oObject The object to set the variable on. +/// @param sVarName The variable name. +/// @param fValue The float value to to set +/// @param bPersist When TRUE, 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. +void NWNX_Object_SetFloat(object oObject, string sVarName, float fValue, int bPersist); + +/// @brief Delete oObject's persistent float variable sVarName. +/// @param oObject The object to delete the variable from. +/// @param sVarName The variable name. +void NWNX_Object_DeleteFloat(object oObject, string sVarName); + +/// @brief Delete any variables that match sRegex +/// @note It will only remove variables set by NWNX_Object_Set{Int|String|Float}() +/// @param oObject The object to delete the variables from. +/// @param sRegex The regular expression, for example .*Test.* removes every variable that has Test in it. +void NWNX_Object_DeleteVarRegex(object oObject, string sRegex); + +/// @brief Get if vPosition is inside oTrigger's geometry. +/// @note The Z value of vPosition is ignored. +/// @param oTrigger The trigger. +/// @param vPosition The position. +/// @return TRUE if vPosition is inside oTrigger's geometry. +int NWNX_Object_GetPositionIsInTrigger(object oTrigger, vector vPosition); + +/// @brief Gets the given object's internal type (NWNX_OBJECT_TYPE_INTERNAL_*) +/// @param oObject The object. +/// @return The object's type (NWNX_OBJECT_TYPE_INTERNAL_*) +int NWNX_Object_GetInternalObjectType(object oObject); + +/// @brief Have oObject acquire oItem. +/// @note Useful to give deserialized items to an object, may not work if oItem is already possessed by an object. +/// @param oObject The object receiving oItem, must be a Creature, Placeable, Store or Item +/// @param oItem The item. +/// @return TRUE on success. +int NWNX_Object_AcquireItem(object oObject, object oItem); + +/// @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); + +/// @brief Peek at the UUID of oObject without assigning one if it does not have one +/// @param oObject The object +/// @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 corresponds 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 corresponds to the normal game behaviour. +/// @param nSpellLevel The level of the casted spell. Default value is -1, which corresponds to the normal game behaviour. +/// @param nSpellSchool The school of the casted spell (SPELL_SCHOOL_* constant). Default value is -1, which corresponds 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) +{ + NWNXPushObject(obj); + NWNXCall(NWNX_Object, "GetLocalVariableCount"); + return NWNXPopInt(); +} + +struct NWNX_Object_LocalVariable NWNX_Object_GetLocalVariable(object obj, int index) +{ + NWNXPushInt(index); + NWNXPushObject(obj); + NWNXCall(NWNX_Object, "GetLocalVariable"); + struct NWNX_Object_LocalVariable var; + var.key = NWNXPopString(); + var.type = NWNXPopInt(); + return var; +} + +void NWNX_Object_SetPosition(object oObject, vector vPosition, int bUpdateSubareas = TRUE) +{ + NWNXPushInt(bUpdateSubareas); + NWNXPushVector(vPosition); + NWNXPushObject(oObject); + NWNXCall(NWNX_Object, "SetPosition"); +} + +int NWNX_Object_GetCurrentHitPoints(object creature) +{ + NWNXPushObject(creature); + NWNXCall(NWNX_Object, "GetCurrentHitPoints"); + return NWNXPopInt(); +} + +void NWNX_Object_SetCurrentHitPoints(object creature, int hp) +{ + NWNXPushInt(hp); + NWNXPushObject(creature); + NWNXCall(NWNX_Object, "SetCurrentHitPoints"); +} + +void NWNX_Object_SetMaxHitPoints(object creature, int hp) +{ + NWNXPushInt(hp); + NWNXPushObject(creature); + NWNXCall(NWNX_Object, "SetMaxHitPoints"); +} + +string NWNX_Object_Serialize(object obj) +{ + NWNXPushObject(obj); + NWNXCall(NWNX_Object, "Serialize"); + return NWNXPopString(); +} + +object NWNX_Object_Deserialize(string serialized) +{ + NWNXPushString(serialized); + NWNXCall(NWNX_Object, "Deserialize"); + return NWNXPopObject(); +} + +string NWNX_Object_GetDialogResref(object obj) +{ + NWNXPushObject(obj); + NWNXCall(NWNX_Object, "GetDialogResref"); + return NWNXPopString(); +} + +void NWNX_Object_SetDialogResref(object obj, string dialog) +{ + NWNXPushString(dialog); + NWNXPushObject(obj); + NWNXCall(NWNX_Object, "SetDialogResref"); +} + +void NWNX_Object_SetAppearance(object oPlaceable, int nAppearance) +{ + NWNXPushInt(nAppearance); + NWNXPushObject(oPlaceable); + NWNXCall(NWNX_Object, "SetAppearance"); +} + +int NWNX_Object_GetAppearance(object oPlaceable) +{ + NWNXPushObject(oPlaceable); + NWNXCall(NWNX_Object, "GetAppearance"); + return NWNXPopInt(); +} + +int NWNX_Object_GetHasVisualEffect(object obj, int nVFX) +{ + NWNXPushInt(nVFX); + NWNXPushObject(obj); + NWNXCall(NWNX_Object, "GetHasVisualEffect"); + return NWNXPopInt(); +} + +int NWNX_Object_GetDamageImmunity(object obj, int damageType) +{ + NWNXPushInt(damageType); + NWNXPushObject(obj); + NWNXCall(NWNX_Object, "GetDamageImmunity"); + return NWNXPopInt(); +} + +void NWNX_Object_AddToArea(object obj, object area, vector pos) +{ + NWNXPushVector(pos); + NWNXPushObject(area); + NWNXPushObject(obj); + NWNXCall(NWNX_Object, "AddToArea"); +} + +int NWNX_Object_GetPlaceableIsStatic(object obj) +{ + NWNXPushObject(obj); + NWNXCall(NWNX_Object, "GetPlaceableIsStatic"); + return NWNXPopInt(); +} + +void NWNX_Object_SetPlaceableIsStatic(object obj, int isStatic) +{ + NWNXPushInt(isStatic); + NWNXPushObject(obj); + NWNXCall(NWNX_Object, "SetPlaceableIsStatic"); +} + +int NWNX_Object_GetAutoRemoveKey(object obj) +{ + NWNXPushObject(obj); + NWNXCall(NWNX_Object, "GetAutoRemoveKey"); + return NWNXPopInt(); +} + +void NWNX_Object_SetAutoRemoveKey(object obj, int bRemoveKey) +{ + NWNXPushInt(bRemoveKey); + NWNXPushObject(obj); + NWNXCall(NWNX_Object, "SetAutoRemoveKey"); +} + +string NWNX_Object_GetTriggerGeometry(object oTrigger) +{ + NWNXPushObject(oTrigger); + NWNXCall(NWNX_Object, "GetTriggerGeometry"); + return NWNXPopString(); +} + +void NWNX_Object_SetTriggerGeometry(object oTrigger, string sGeometry) +{ + NWNXPushString(sGeometry); + NWNXPushObject(oTrigger); + NWNXCall(NWNX_Object, "SetTriggerGeometry"); +} + +void NWNX_Object_Export(object oObject, string sFileName, string sAlias = "NWNX") +{ + NWNXPushString(sAlias); + NWNXPushString(sFileName); + NWNXPushObject(oObject); + NWNXCall(NWNX_Object, "Export"); +} + +int NWNX_Object_GetInt(object oObject, string sVarName) +{ + NWNXPushString(sVarName); + NWNXPushObject(oObject); + NWNXCall(NWNX_Object, "GetInt"); + return NWNXPopInt(); +} + +void NWNX_Object_SetInt(object oObject, string sVarName, int nValue, int bPersist) +{ + NWNXPushInt(bPersist); + NWNXPushInt(nValue); + NWNXPushString(sVarName); + NWNXPushObject(oObject); + NWNXCall(NWNX_Object, "SetInt"); +} + +void NWNX_Object_DeleteInt(object oObject, string sVarName) +{ + NWNXPushString(sVarName); + NWNXPushObject(oObject); + NWNXCall(NWNX_Object, "DeleteInt"); +} + +string NWNX_Object_GetString(object oObject, string sVarName) +{ + NWNXPushString(sVarName); + NWNXPushObject(oObject); + NWNXCall(NWNX_Object, "GetString"); + return NWNXPopString(); +} + +void NWNX_Object_SetString(object oObject, string sVarName, string sValue, int bPersist) +{ + NWNXPushInt(bPersist); + NWNXPushString(sValue); + NWNXPushString(sVarName); + NWNXPushObject(oObject); + NWNXCall(NWNX_Object, "SetString"); +} + +void NWNX_Object_DeleteString(object oObject, string sVarName) +{ + NWNXPushString(sVarName); + NWNXPushObject(oObject); + NWNXCall(NWNX_Object, "DeleteString"); +} + +float NWNX_Object_GetFloat(object oObject, string sVarName) +{ + NWNXPushString(sVarName); + NWNXPushObject(oObject); + NWNXCall(NWNX_Object, "GetFloat"); + return NWNXPopFloat(); +} + +void NWNX_Object_SetFloat(object oObject, string sVarName, float fValue, int bPersist) +{ + NWNXPushInt(bPersist); + NWNXPushFloat(fValue); + NWNXPushString(sVarName); + NWNXPushObject(oObject); + NWNXCall(NWNX_Object, "SetFloat"); +} + +void NWNX_Object_DeleteFloat(object oObject, string sVarName) +{ + NWNXPushString(sVarName); + NWNXPushObject(oObject); + NWNXCall(NWNX_Object, "DeleteFloat"); +} + +void NWNX_Object_DeleteVarRegex(object oObject, string sRegex) +{ + NWNXPushString(sRegex); + NWNXPushObject(oObject); + NWNXCall(NWNX_Object, "DeleteVarRegex"); +} + +int NWNX_Object_GetPositionIsInTrigger(object oTrigger, vector vPosition) +{ + NWNXPushVector(vPosition); + NWNXPushObject(oTrigger); + NWNXCall(NWNX_Object, "GetPositionIsInTrigger"); + return NWNXPopInt(); +} + +int NWNX_Object_GetInternalObjectType(object oObject) +{ + NWNXPushObject(oObject); + NWNXCall(NWNX_Object, "GetInternalObjectType"); + return NWNXPopInt(); +} + +int NWNX_Object_AcquireItem(object oObject, object oItem) +{ + NWNXPushObject(oItem); + NWNXPushObject(oObject); + NWNXCall(NWNX_Object, "AcquireItem"); + return NWNXPopInt(); +} + +void NWNX_Object_ClearSpellEffectsOnOthers(object oObject) +{ + NWNXPushObject(oObject); + NWNXCall(NWNX_Object, "ClearSpellEffectsOnOthers"); +} + +string NWNX_Object_PeekUUID(object oObject) +{ + 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 new file mode 100644 index 00000000..c90daddd --- /dev/null +++ b/_module/nss/nwnx_player.nss @@ -0,0 +1,990 @@ +/// @addtogroup player +/// @brief Functions exposing additional player properties. +/// @{ +/// @file nwnx_player.nss + +const string NWNX_Player = "NWNX_Player"; ///< @private + +/// @brief A quickbar slot. +struct NWNX_Player_QuickBarSlot +{ + object oItem; ///< @todo Describe + object oSecondaryItem; ///< @todo Describe + int nObjectType; ///< @todo Describe + int nMultiClass; ///< @todo Describe + string sResRef; ///< @todo Describe + string sCommandLabel; ///< @todo Describe + string sCommandLine; ///< @todo Describe + string sToolTip; ///< @todo Describe + int nINTParam1; ///< @todo Describe + int nMetaType; ///< @todo Describe + int nDomainLevel; ///< @todo Describe + int nAssociateType; ///< @todo Describe + 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 +/// +/// The various types of timing bars. +/// @{ +const int NWNX_PLAYER_TIMING_BAR_TRAP_FLAG = 1; +const int NWNX_PLAYER_TIMING_BAR_TRAP_RECOVER = 2; +const int NWNX_PLAYER_TIMING_BAR_TRAP_DISARM = 3; +const int NWNX_PLAYER_TIMING_BAR_TRAP_EXAMINE = 4; +const int NWNX_PLAYER_TIMING_BAR_TRAP_SET = 5; +const int NWNX_PLAYER_TIMING_BAR_REST = 6; +const int NWNX_PLAYER_TIMING_BAR_UNLOCK = 7; +const int NWNX_PLAYER_TIMING_BAR_LOCK = 8; +const int NWNX_PLAYER_TIMING_BAR_CUSTOM = 10; +/// @} + +/// @name Platform IDs +/// @anchor platform_ids +/// @{ +const int NWNX_PLAYER_PLATFORM_INVALID = 0; +const int NWNX_PLAYER_PLATFORM_WINDOWS_X86 = 1; +const int NWNX_PLAYER_PLATFORM_WINDOWS_X64 = 2; +const int NWNX_PLAYER_PLATFORM_LINUX_X86 = 10; +const int NWNX_PLAYER_PLATFORM_LINUX_X64 = 11; +const int NWNX_PLAYER_PLATFORM_LINUX_ARM32 = 12; +const int NWNX_PLAYER_PLATFORM_LINUX_ARM64 = 13; +const int NWNX_PLAYER_PLATFORM_MAC_X86 = 20; +const int NWNX_PLAYER_PLATFORM_MAC_X64 = 21; +const int NWNX_PLAYER_PLATFORM_IOS = 30; +const int NWNX_PLAYER_PLATFORM_ANDROID_ARM32 = 40; +const int NWNX_PLAYER_PLATFORM_ANDROID_ARM64 = 41; +const int NWNX_PLAYER_PLATFORM_ANDROID_X64 = 42; +const int NWNX_PLAYER_PLATFORM_NINTENDO_SWITCH = 50; +const int NWNX_PLAYER_PLATFORM_MICROSOFT_XBOXONE = 60; +const int NWNX_PLAYER_PLATFORM_SONY_PS4 = 70; +/// @} + +/// @brief Force display placeable examine window for player +/// @note If used on a placeable in a different area than the player, the portrait will not be shown. +/// @param player The player object. +/// @param placeable The placeable object. +void NWNX_Player_ForcePlaceableExamineWindow(object player, object placeable); + +/// @brief Force opens the target object's inventory for the player. +/// @note +/// * If the placeable is in a different area than the player, the portrait will not be shown +/// * The placeable's open/close animations will be played +/// * Clicking the 'close' button will cause the player to walk to the placeable If the placeable is in a +/// different area, the player will just walk to the edge of the current area and stop. +/// This action can be cancelled manually. +/// * Walking will close the placeable automatically. +/// @param player The player object. +/// @param placeable The placeable object. +void NWNX_Player_ForcePlaceableInventoryWindow(object player, object placeable); + +/// @brief Starts displaying a timing bar. +/// @param player The player object. +/// @param seconds The length of time the timing bar will complete. +/// @param script The script to run at the bar's completion. +/// @param type The @ref timing_bar_types "Timing Bar Type" +/// @remark Only one timing bar can be ran at the same time. +void NWNX_Player_StartGuiTimingBar(object player, float seconds, string script = "", int type = NWNX_PLAYER_TIMING_BAR_CUSTOM); + +/// @brief Stop displaying a timing bar. +/// @param player The player object. +/// @param script The script to run when stopped. +void NWNX_Player_StopGuiTimingBar(object player, string script = ""); + +/// @brief Sets whether the player should always walk when given movement commands. +/// @param player The player object. +/// @param bWalk TRUE to set the player to always walk. +/// @remark Clicking on the ground or using WASD will trigger walking instead of running. +void NWNX_Player_SetAlwaysWalk(object player, int bWalk=TRUE); + +/// @brief Gets the player's quickbar slot info +/// @param player The player object. +/// @param slot Slot ID 0-35 +/// @return An NWNX_Player_QuickBarSlot struct. +struct NWNX_Player_QuickBarSlot NWNX_Player_GetQuickBarSlot(object player, int slot); + +/// @brief Sets the player's quickbar slot info +/// @param player The player object. +/// @param slot Slot ID 0-35 +/// @param qbs An NWNX_Player_QuickBarSlot struct. +void NWNX_Player_SetQuickBarSlot(object player, int slot, struct NWNX_Player_QuickBarSlot qbs); + +/// @brief Get the name of the .bic file associated with the player's character. +/// @param player The player object. +/// @return The filename for this player's bic. (Not including the ".bic") +string NWNX_Player_GetBicFileName(object player); + +/// @brief Plays the VFX at the target position in current area for the given player only +/// @param player The player object. +/// @param effectId The effect id. +/// @param position The position to play the visual effect. +/// @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. +/// @param track The track id to play. +void NWNX_Player_MusicBackgroundChangeDay(object player, int track); + +/// @brief Changes the nighttime music track for the given player only +/// @param player The player object. +/// @param track The track id to play. +void NWNX_Player_MusicBackgroundChangeNight(object player, int track); + +/// @brief Starts the background music for the given player only +/// @param player The player object. +void NWNX_Player_MusicBackgroundStart(object player); + +/// @brief Stops the background music for the given player only +/// @param player The player object. +void NWNX_Player_MusicBackgroundStop(object player); + +/// @brief Changes the battle music track for the given player only +/// @param player The player object. +/// @param track The track id to play. +void NWNX_Player_MusicBattleChange(object player, int track); + +/// @brief Starts the battle music for the given player only +/// @param player The player object. +void NWNX_Player_MusicBattleStart(object player); + +/// @brief Stops the battle music for the given player only +/// @param player The player object. +void NWNX_Player_MusicBattleStop(object player); + +/// @brief Play a sound at the location of target for the given player only +/// @param player The player object. +/// @param sound The sound resref. +/// @param target The target object for the sound to originate. If target OBJECT_INVALID the sound +/// will play at the location of the player. +void NWNX_Player_PlaySound(object player, string sound, object target = OBJECT_INVALID); + +/// @brief Toggle a placeable's usable flag for the given player only +/// @param player The player object. +/// @param placeable The placeable object. +/// @param usable TRUE for usable. +void NWNX_Player_SetPlaceableUsable(object player, object placeable, int usable); + +/// @brief Override player's rest duration +/// @param player The player object. +/// @param duration The duration of rest in milliseconds, 1000 = 1 second. Minimum duration of 10ms. -1 clears the override. +void NWNX_Player_SetRestDuration(object player, int duration); + +/// @brief Apply visualeffect to target that only player can see +/// @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, float scale=1.0f, vector translate=[], vector rotate=[]); + +/// @brief Refreshes the players character sheet +/// @param player The player object. +/// @note You may need to use DelayCommand if you're manipulating values +/// through nwnx and forcing a UI refresh, 0.5s seemed to be fine +void NWNX_Player_UpdateCharacterSheet(object player); + +/// @brief Allows player to open target's inventory +/// @param player The player object. +/// @param target The target object, must be a creature or another player. +/// @param open TRUE to open. +/// @remark Only works if player and target are in the same area. +void NWNX_Player_OpenInventory(object player, object target, int open = TRUE); + +/// @brief Get player's area exploration state +/// @param player The player object. +/// @param area The area object. +/// @return A string representation of the tiles explored for that area. +string NWNX_Player_GetAreaExplorationState(object player, object area); + +/// @brief Set player's area exploration state. +/// @param player The player object. +/// @param area The area object. +/// @param str An encoded string obtained with NWNX_Player_GetAreaExplorationState() +void NWNX_Player_SetAreaExplorationState(object player, object area, string str); + +/// @brief Override player's rest animation. +/// @param oPlayer The player object. +/// @param nAnimation The NWNX animation id. This does not take ANIMATION_LOOPING_* or +/// ANIMATION_FIREFORGET_* constants. Instead use NWNX_Consts_TranslateNWScriptAnimation() to get +/// the NWNX equivalent. -1 to clear the override. +void NWNX_Player_SetRestAnimation(object oPlayer, int nAnimation); + +/// @brief Override a visual transform on the given object that only player will see. +/// @param oPlayer The player object. +/// @param oObject The target object. Can be any valid Creature, Placeable, Item or Door. +/// @param nTransform One of OBJECT_VISUAL_TRANSFORM_* or -1 to remove the override. +/// @param fValue Depends on the transformation to apply. +void NWNX_Player_SetObjectVisualTransformOverride(object oPlayer, object oObject, int nTransform, float fValue); + +/// @brief Apply a looping visualeffect to a target that only player can see +/// @param player The player object. +/// @param target The target object. +/// @param visualeffect A VFX_DUR_*. Calling again will remove an applied effect. -1 to remove all effects +/// @note Only really works with looping effects: VFX_DUR_*. Other types *kind* of work, they'll play when +/// reentering the area and the object is in view or when they come back in view range. +void NWNX_Player_ApplyLoopingVisualEffectToObject(object player, object target, int visualeffect); + +/// @brief Override the name of placeable for player only +/// @param player The player object. +/// @param placeable The placeable object. +/// @param name The name for the placeable for this player, "" to clear the override. +void NWNX_Player_SetPlaceableNameOverride(object player, object placeable, string name); + +/// @brief Gets whether a quest has been completed by a player +/// @param player The player object. +/// @param sQuestName The name identifier of the quest from the Journal Editor. +/// @return TRUE if the quest has been completed. -1 if the player does not have the journal entry. +int NWNX_Player_GetQuestCompleted(object player, string sQuestName); + +/// @brief Place waypoints on module load representing where a PC should start +/// +/// This will require storing the PC's cd key or community name (depending on how you store in your vault) +/// and bic_filename along with routinely updating their location in some persistent method like OnRest, +/// OnAreaEnter and OnClentExit. +/// +/// @param sCDKeyOrCommunityName The Public CD Key or Community Name of the player, this will depend on your vault type. +/// @param sBicFileName The filename for the character. Retrieved with NWNX_Player_GetBicFileName(). +/// @param oWP The waypoint object to place where the PC should start. +/// @param bFirstConnectOnly Set to FALSE if you would like the PC to go to this location every time they login instead +/// of just every server restart. +void NWNX_Player_SetPersistentLocation(string sCDKeyOrCommunityName, string sBicFileName, object oWP, int bFirstConnectOnly = TRUE); + +/// @brief Force an item name to be updated. +/// @note This is a workaround for bug that occurs when updating item names in open containers. +/// @param oPlayer The player object. +/// @param oItem The item object. +void NWNX_Player_UpdateItemName(object oPlayer, object oItem); + +/// @brief Possesses a creature by temporarily making them a familiar +/// @details This command allows a PC to possess an NPC by temporarily adding them as a familiar. It will work +/// if the player already has an existing familiar. The creatures must be in the same area. Unpossession can be +/// done with the regular @nwn{UnpossessFamiliar} commands. +/// @note The possessed creature will send automap data back to the possessor. +/// If you wish to prevent this you may wish to use NWNX_Player_GetAreaExplorationState() and +/// NWNX_Player_SetAreaExplorationState() before and after the possession. +/// @note The possessing creature will be left wherever they were when beginning the possession. You may wish +/// to use @nwn{EffectCutsceneImmobilize} and @nwn{EffectCutsceneGhost} to hide them. +/// @param oPossessor The possessor player object. +/// @param oPossessed The possessed creature object. Only works on NPCs. +/// @param bMindImmune If FALSE will remove the mind immunity effect on the possessor. +/// @param bCreateDefaultQB If TRUE will populate the quick bar with default buttons. +/// @return TRUE if possession succeeded. +int NWNX_Player_PossessCreature(object oPossessor, object oPossessed, int bMindImmune = TRUE, int bCreateDefaultQB = FALSE); + +/// @brief Returns the platform ID of the given player (NWNX_PLAYER_PLATFORM_*) +/// @param oPlayer The player object. +int NWNX_Player_GetPlatformId(object oPlayer); + +/// @brief Returns the game language of the given player (uses NWNX_DIALOG_LANGUAGE_*) +/// @details This function returns the ID of the game language displayed to the player. +/// Uses the same constants as nwnx_dialog. +/// @param oPlayer The player object. +int NWNX_Player_GetLanguage(object oPlayer); + +/// @brief Override sOldResName with sNewResName of nResType for oPlayer. +/// @warning If sNewResName does not exist on oPlayer's client it will crash their game. +/// @param oPlayer The player object. +/// @param nResType The res type, see nwnx_util.nss for constants. +/// @param sOldResName The old res name, 16 characters or less. +/// @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); + +/// @brief Get the current open store of oPlayer. +/// @param oPlayer The player. +/// @return The open store or OBJECT_INVALID if no store is open. +object NWNX_Player_GetOpenStore(object oPlayer); + +/// @} + +void NWNX_Player_ForcePlaceableExamineWindow(object player, object placeable) +{ + NWNXPushObject(placeable); + NWNXPushObject(player); + NWNXCall(NWNX_Player, "ForcePlaceableExamineWindow"); +} + +void NWNX_Player_ForcePlaceableInventoryWindow(object player, object placeable) +{ + NWNXPushObject(placeable); + NWNXPushObject(player); + NWNXCall(NWNX_Player, "ForcePlaceableInventoryWindow"); +} + +void NWNX_Player_INTERNAL_StopGuiTimingBar(object player, string script = "", int id = -1) ///< @private +{ + int activeId = GetLocalInt(player, "NWNX_PLAYER_GUI_TIMING_ACTIVE"); + // 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"); + NWNXPushObject(player); + NWNXCall(NWNX_Player, "StopGuiTimingBar"); + if(script != "") + { + ExecuteScript(script, player); + } +} + +void NWNX_Player_StartGuiTimingBar(object player, float seconds, string script = "", int type = NWNX_PLAYER_TIMING_BAR_CUSTOM) +{ + if (GetLocalInt(player, "NWNX_PLAYER_GUI_TIMING_ACTIVE")) + return; + 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)); +} + +void NWNX_Player_StopGuiTimingBar(object player, string script = "") +{ + NWNX_Player_INTERNAL_StopGuiTimingBar(player, script, -1); +} + +void NWNX_Player_SetAlwaysWalk(object player, int bWalk=TRUE) +{ + NWNXPushInt(bWalk); + NWNXPushObject(player); + NWNXCall(NWNX_Player, "SetAlwaysWalk"); +} + +struct NWNX_Player_QuickBarSlot NWNX_Player_GetQuickBarSlot(object player, int slot) +{ + struct NWNX_Player_QuickBarSlot qbs; + 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) +{ + 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) +{ + NWNXPushObject(player); + NWNXCall(NWNX_Player, "GetBicFileName"); + return NWNXPopString(); +} + +void NWNX_Player_ShowVisualEffect(object player, int effectId, vector position, float scale=1.0f, vector translate=[], vector rotate=[]) +{ + NWNXPushVector(rotate); + NWNXPushVector(translate); + NWNXPushFloat(scale); + NWNXPushVector(position); + NWNXPushInt(effectId); + NWNXPushObject(player); + NWNXCall(NWNX_Player, "ShowVisualEffect"); +} + +void NWNX_Player_MusicBackgroundChangeDay(object player, int track) +{ + NWNXPushInt(track); + NWNXPushInt(TRUE); + NWNXPushObject(player); + NWNXCall(NWNX_Player, "ChangeBackgroundMusic"); +} + +void NWNX_Player_MusicBackgroundChangeNight(object player, int track) +{ + NWNXPushInt(track); + NWNXPushInt(FALSE); + NWNXPushObject(player); + NWNXCall(NWNX_Player, "ChangeBackgroundMusic"); +} + +void NWNX_Player_MusicBackgroundStart(object player) +{ + NWNXPushInt(TRUE); + NWNXPushObject(player); + NWNXCall(NWNX_Player, "PlayBackgroundMusic"); +} + +void NWNX_Player_MusicBackgroundStop(object player) +{ + NWNXPushInt(FALSE); + NWNXPushObject(player); + NWNXCall(NWNX_Player, "PlayBackgroundMusic"); +} + +void NWNX_Player_MusicBattleChange(object player, int track) +{ + NWNXPushInt(track); + NWNXPushObject(player); + NWNXCall(NWNX_Player, "ChangeBattleMusic"); +} + +void NWNX_Player_MusicBattleStart(object player) +{ + NWNXPushInt(TRUE); + NWNXPushObject(player); + NWNXCall(NWNX_Player, "PlayBattleMusic"); +} + +void NWNX_Player_MusicBattleStop(object player) +{ + NWNXPushInt(FALSE); + NWNXPushObject(player); + NWNXCall(NWNX_Player, "PlayBattleMusic"); +} + +void NWNX_Player_PlaySound(object player, string sound, object target = OBJECT_INVALID) +{ + NWNXPushObject(target); + NWNXPushString(sound); + NWNXPushObject(player); + NWNXCall(NWNX_Player, "PlaySound"); +} + +void NWNX_Player_SetPlaceableUsable(object player, object placeable, int usable) +{ + NWNXPushInt(usable); + NWNXPushObject(placeable); + NWNXPushObject(player); + NWNXCall(NWNX_Player, "SetPlaceableUsable"); +} + +void NWNX_Player_SetRestDuration(object player, int duration) +{ + NWNXPushInt(duration); + NWNXPushObject(player); + NWNXCall(NWNX_Player, "SetRestDuration"); +} + +void NWNX_Player_ApplyInstantVisualEffectToObject(object player, object target, int visualeffect, float scale=1.0f, vector translate=[], vector rotate=[]) +{ + NWNXPushVector(rotate); + NWNXPushVector(translate); + NWNXPushFloat(scale); + NWNXPushInt(visualeffect); + NWNXPushObject(target); + NWNXPushObject(player); + NWNXCall(NWNX_Player, "ApplyInstantVisualEffectToObject"); +} + +void NWNX_Player_UpdateCharacterSheet(object player) +{ + NWNXPushObject(player); + NWNXCall(NWNX_Player, "UpdateCharacterSheet"); +} + +void NWNX_Player_OpenInventory(object player, object target, int open = TRUE) +{ + NWNXPushInt(open); + NWNXPushObject(target); + NWNXPushObject(player); + NWNXCall(NWNX_Player, "OpenInventory"); +} + +string NWNX_Player_GetAreaExplorationState(object player, object area) +{ + NWNXPushObject(area); + NWNXPushObject(player); + NWNXCall(NWNX_Player, "GetAreaExplorationState"); + return NWNXPopString(); +} + +void NWNX_Player_SetAreaExplorationState(object player, object area, string str) +{ + NWNXPushString(str); + NWNXPushObject(area); + NWNXPushObject(player); + NWNXCall(NWNX_Player, "SetAreaExplorationState"); +} + +void NWNX_Player_SetRestAnimation(object oPlayer, int nAnimation) +{ + NWNXPushInt(nAnimation); + NWNXPushObject(oPlayer); + NWNXCall(NWNX_Player, "SetRestAnimation"); +} + +void NWNX_Player_SetObjectVisualTransformOverride(object oPlayer, object oObject, int nTransform, float fValue) +{ + NWNXPushFloat(fValue); + NWNXPushInt(nTransform); + NWNXPushObject(oObject); + NWNXPushObject(oPlayer); + NWNXCall(NWNX_Player, "SetObjectVisualTransformOverride"); +} + +void NWNX_Player_ApplyLoopingVisualEffectToObject(object player, object target, int visualeffect) +{ + NWNXPushInt(visualeffect); + NWNXPushObject(target); + NWNXPushObject(player); + NWNXCall(NWNX_Player, "ApplyLoopingVisualEffectToObject"); +} + +void NWNX_Player_SetPlaceableNameOverride(object player, object placeable, string name) +{ + NWNXPushString(name); + NWNXPushObject(placeable); + NWNXPushObject(player); + NWNXCall(NWNX_Player, "SetPlaceableNameOverride"); +} + +int NWNX_Player_GetQuestCompleted(object player, string sQuestName) +{ + NWNXPushString(sQuestName); + NWNXPushObject(player); + NWNXCall(NWNX_Player, "GetQuestCompleted"); + return NWNXPopInt(); +} + +void NWNX_Player_SetPersistentLocation(string sCDKeyOrCommunityName, string sBicFileName, object oWP, int bFirstConnectOnly = TRUE) +{ + NWNXPushInt(bFirstConnectOnly); + NWNXPushObject(oWP); + NWNXPushString(sBicFileName); + NWNXPushString(sCDKeyOrCommunityName); + NWNXCall(NWNX_Player, "SetPersistentLocation"); +} + +void NWNX_Player_UpdateItemName(object oPlayer, object oItem) +{ + NWNXPushObject(oItem); + NWNXPushObject(oPlayer); + NWNXCall(NWNX_Player, "UpdateItemName"); +} + +int NWNX_Player_PossessCreature(object oPossessor, object oPossessed, int bMindImmune = TRUE, int bCreateDefaultQB = FALSE) +{ + NWNXPushInt(bCreateDefaultQB); + NWNXPushInt(bMindImmune); + NWNXPushObject(oPossessed); + NWNXPushObject(oPossessor); + NWNXCall(NWNX_Player, "PossessCreature"); + return NWNXPopInt(); +} + +int NWNX_Player_GetPlatformId(object oPlayer) +{ + NWNXPushObject(oPlayer); + NWNXCall(NWNX_Player, "GetPlatformId"); + return NWNXPopInt(); +} + +int NWNX_Player_GetLanguage(object oPlayer) +{ + NWNXPushObject(oPlayer); + NWNXCall(NWNX_Player, "GetLanguage"); + return NWNXPopInt(); +} + +void NWNX_Player_SetResManOverride(object oPlayer, int nResType, string sOldResName, string sNewResName) +{ + 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"); +} + +object NWNX_Player_GetOpenStore(object oPlayer) +{ + NWNXPushObject(oPlayer); + NWNXCall(NWNX_Player, "GetOpenStore"); + return NWNXPopObject(); +} diff --git a/_module/nss/nwnx_player_qbs.nss b/_module/nss/nwnx_player_qbs.nss new file mode 100644 index 00000000..0649c97a --- /dev/null +++ b/_module/nss/nwnx_player_qbs.nss @@ -0,0 +1,207 @@ +/// @addtogroup player +/// @{ +/// @file nwnx_player_qbs.nss +/// @brief Helper script for quickbar management. +#include "nwnx_player" + +/// @name Quickbar Slot Types +/// @anchor qbs_types +/// @{ +const int NWNX_PLAYER_QBS_TYPE_EMPTY = 0; +const int NWNX_PLAYER_QBS_TYPE_ITEM = 1; +const int NWNX_PLAYER_QBS_TYPE_SPELL = 2; +const int NWNX_PLAYER_QBS_TYPE_SKILL = 3; +const int NWNX_PLAYER_QBS_TYPE_FEAT = 4; +const int NWNX_PLAYER_QBS_TYPE_DIALOG = 6; +const int NWNX_PLAYER_QBS_TYPE_ATTACK = 7; +const int NWNX_PLAYER_QBS_TYPE_EMOTE = 8; +const int NWNX_PLAYER_QBS_TYPE_ITEM_PROPERTY_CASTSPELL = 9; +const int NWNX_PLAYER_QBS_TYPE_MODE_TOGGLE = 10; +const int NWNX_PLAYER_QBS_TYPE_COMMAND = 18; +const int NWNX_PLAYER_QBS_TYPE_POSSESS_FAMILIAR = 38; +const int NWNX_PLAYER_QBS_TYPE_ASSOCIATE_COMMAND = 39; +const int NWNX_PLAYER_QBS_TYPE_EXAMINE = 40; +const int NWNX_PLAYER_QBS_TYPE_BARTER = 41; +const int NWNX_PLAYER_QBS_TYPE_QUICK_CHAT = 42; +const int NWNX_PLAYER_QBS_TYPE_CANCELPOLYMORPH = 43; +const int NWNX_PLAYER_QBS_TYPE_SPELLLIKEABILITY = 44; +/// @} + +/// Create an empty QBS of given type +struct NWNX_Player_QuickBarSlot NWNX_Player_QBS_Empty(int type = NWNX_PLAYER_QBS_TYPE_EMPTY); +/// Create a QBS for using an item +struct NWNX_Player_QuickBarSlot NWNX_Player_QBS_UseItem(object oItem, int nPropertyID = 0); +/// Create a QBS for equipping an item +struct NWNX_Player_QuickBarSlot NWNX_Player_QBS_EquipItem(object oItem, object oSecondaryItem = OBJECT_INVALID); +/// Create a QBS for casting a spell +struct NWNX_Player_QuickBarSlot NWNX_Player_QBS_CastSpell(int nSpell, int nClassIndex = 0, int nMetamagic = METAMAGIC_NONE, int nDomainLevel = -1); +/// Create a QBS for using a skill +struct NWNX_Player_QuickBarSlot NWNX_Player_QBS_UseSkill(int nSkill); +/// Create a QBS for using a feat +struct NWNX_Player_QuickBarSlot NWNX_Player_QBS_UseFeat(int nFeat); +/// Create a QBS for starting a dialog +struct NWNX_Player_QuickBarSlot NWNX_Player_QBS_StartDialog(); +/// Create a QBS for attacking +struct NWNX_Player_QuickBarSlot NWNX_Player_QBS_Attack(); +/// Create a QBS for emoting +struct NWNX_Player_QuickBarSlot NWNX_Player_QBS_Emote(int nEmote); +/// Create a QBS for toggling a mode +struct NWNX_Player_QuickBarSlot NWNX_Player_QBS_ToggleMode(int nMode); +/// Create a QBS for examining +struct NWNX_Player_QuickBarSlot NWNX_Player_QBS_Examine(); +/// Create a QBS for bartering +struct NWNX_Player_QuickBarSlot NWNX_Player_QBS_Barter(); +/// Create a QBS for quickchat command +struct NWNX_Player_QuickBarSlot NWNX_Player_QBS_QuickChat(int nCommand); +/// Create a QBS for examining +struct NWNX_Player_QuickBarSlot NWNX_Player_QBS_PossessFamiliar(); +/// Create a QBS for casting a spell +struct NWNX_Player_QuickBarSlot NWNX_Player_QBS_UseSpecialAbility(int nSpell, int nCasterLevel); +/// Create a QBS for running a command +struct NWNX_Player_QuickBarSlot NWNX_Player_QBS_Command(string sCommandLabel, string sCommandLine); + +/// @} + + +struct NWNX_Player_QuickBarSlot NWNX_Player_QBS_Empty(int type = NWNX_PLAYER_QBS_TYPE_EMPTY) +{ + struct NWNX_Player_QuickBarSlot qbs; + + qbs.nObjectType = type; + + qbs.oItem = OBJECT_INVALID; + qbs.oSecondaryItem = OBJECT_INVALID; + qbs.nMultiClass = 0; + qbs.sResRef = ""; + qbs.sCommandLabel = ""; + qbs.sCommandLine = ""; + qbs.sToolTip = ""; + qbs.nINTParam1 = 0; + qbs.nMetaType = 0; + qbs.nDomainLevel = 0; + qbs.nAssociateType = 0; + qbs.oAssociate = OBJECT_INVALID; + + return qbs; +} + +struct NWNX_Player_QuickBarSlot NWNX_Player_QBS_UseItem(object oItem, int nPropertyID = 0) +{ + struct NWNX_Player_QuickBarSlot qbs = NWNX_Player_QBS_Empty(NWNX_PLAYER_QBS_TYPE_ITEM); + + qbs.oItem = oItem; + qbs.nINTParam1 = nPropertyID; + + return qbs; +} + +struct NWNX_Player_QuickBarSlot NWNX_Player_QBS_EquipItem(object oItem, object oSecondaryItem = OBJECT_INVALID) +{ + struct NWNX_Player_QuickBarSlot qbs = NWNX_Player_QBS_Empty(NWNX_PLAYER_QBS_TYPE_ITEM); + + qbs.oItem = oItem; + qbs.oSecondaryItem = oSecondaryItem; + + return qbs; +} + +struct NWNX_Player_QuickBarSlot NWNX_Player_QBS_CastSpell(int nSpell, int nClassIndex = 0, int nMetamagic = METAMAGIC_NONE, int nDomainLevel = -1) +{ + struct NWNX_Player_QuickBarSlot qbs = NWNX_Player_QBS_Empty(NWNX_PLAYER_QBS_TYPE_SPELL); + + qbs.nINTParam1 = nSpell; + qbs.nMultiClass = nClassIndex; + qbs.nMetaType = nMetamagic; + qbs.nDomainLevel = nDomainLevel; + + return qbs; +} + +struct NWNX_Player_QuickBarSlot NWNX_Player_QBS_UseSkill(int nSkill) +{ + struct NWNX_Player_QuickBarSlot qbs = NWNX_Player_QBS_Empty(NWNX_PLAYER_QBS_TYPE_SKILL); + + qbs.nINTParam1 = nSkill; + + return qbs; +} + +struct NWNX_Player_QuickBarSlot NWNX_Player_QBS_UseFeat(int nFeat) +{ + struct NWNX_Player_QuickBarSlot qbs = NWNX_Player_QBS_Empty(NWNX_PLAYER_QBS_TYPE_FEAT); + + qbs.nINTParam1 = nFeat; + + return qbs; +} + +struct NWNX_Player_QuickBarSlot NWNX_Player_QBS_StartDialog() +{ + return NWNX_Player_QBS_Empty(NWNX_PLAYER_QBS_TYPE_DIALOG); +} + +struct NWNX_Player_QuickBarSlot NWNX_Player_QBS_Attack() +{ + return NWNX_Player_QBS_Empty(NWNX_PLAYER_QBS_TYPE_ATTACK); +} + +struct NWNX_Player_QuickBarSlot NWNX_Player_QBS_Emote(int nEmote) +{ + struct NWNX_Player_QuickBarSlot qbs = NWNX_Player_QBS_Empty(NWNX_PLAYER_QBS_TYPE_EMOTE); + + qbs.nINTParam1 = nEmote; + + return qbs; +} + +struct NWNX_Player_QuickBarSlot NWNX_Player_QBS_ToggleMode(int nMode) +{ + struct NWNX_Player_QuickBarSlot qbs = NWNX_Player_QBS_Empty(NWNX_PLAYER_QBS_TYPE_MODE_TOGGLE); + + qbs.nINTParam1 = nMode; + + return qbs; +} + +struct NWNX_Player_QuickBarSlot NWNX_Player_QBS_Examine() +{ + return NWNX_Player_QBS_Empty(NWNX_PLAYER_QBS_TYPE_EXAMINE); +} + +struct NWNX_Player_QuickBarSlot NWNX_Player_QBS_Barter() +{ + return NWNX_Player_QBS_Empty(NWNX_PLAYER_QBS_TYPE_BARTER); +} + +struct NWNX_Player_QuickBarSlot NWNX_Player_QBS_QuickChat(int nCommand) +{ + struct NWNX_Player_QuickBarSlot qbs = NWNX_Player_QBS_Empty(NWNX_PLAYER_QBS_TYPE_QUICK_CHAT); + + qbs.nINTParam1 = nCommand; + + return qbs; +} + +struct NWNX_Player_QuickBarSlot NWNX_Player_QBS_PossessFamiliar() +{ + return NWNX_Player_QBS_Empty(NWNX_PLAYER_QBS_TYPE_POSSESS_FAMILIAR); +} + +struct NWNX_Player_QuickBarSlot NWNX_Player_QBS_UseSpecialAbility(int nSpell, int nCasterLevel) +{ + struct NWNX_Player_QuickBarSlot qbs = NWNX_Player_QBS_Empty(NWNX_PLAYER_QBS_TYPE_SPELL); + + qbs.nINTParam1 = nSpell; + qbs.nDomainLevel = nCasterLevel; + + return qbs; +} +struct NWNX_Player_QuickBarSlot NWNX_Player_QBS_Command(string sCommandLabel, string sCommandLine) +{ + struct NWNX_Player_QuickBarSlot qbs = NWNX_Player_QBS_Empty(NWNX_PLAYER_QBS_TYPE_COMMAND); + + qbs.sCommandLabel = sCommandLabel; + qbs.sCommandLine = sCommandLine; + + return qbs; +} diff --git a/_module/nss/nwnx_profiler.nss b/_module/nss/nwnx_profiler.nss new file mode 100644 index 00000000..3a516a47 --- /dev/null +++ b/_module/nss/nwnx_profiler.nss @@ -0,0 +1,53 @@ +/// @addtogroup profiler Profiler +/// @brief Functions to instrument nwscript code. +/// @remark These functions are for advanced users. +/// @{ +/// @file nwnx_profiler.nss + +const string NWNX_Profiler = "NWNX_Profiler"; ///< @private + +/// @brief Push a timing metric scope - note that every push must be matched by a corresponding pop. +/// +/// A timing metric contains the following information. +/// ```c +/// { +/// metricName: [name], // Mandatory, from user code +/// metricFields: { time, nanoseconds }, // Automatically captured by the push/pop pair +/// metricTags: { [tag0_tag], [tag0_value] } // Optional, from user code, can be used to +/// filter metrics based on some category or, +/// constant e.g. objectType or area +/// } +/// ``` +/// +/// If you don't understand how this works and you wish to use it, you should research +/// the Metrics system (see Metrics.hpp) as well as googling about how InfluxDB stores metrics. +/// +/// @note It's possible to have more than one tag pair per metric, It is just limited +/// to one arbitrarily here. You can edit the prototype to include more and the C++ +/// code will cope with it correctly. +/// @param name The name to use for your metric. +/// @param tag0_tag An optional tag to filter your metrics. +/// @param tag0_value The tag's value for which to filter. +void NWNX_Profiler_PushPerfScope(string name, string tag0_tag = "", string tag0_value = ""); + +/// @brief Pops a timing metric. +/// @remark A metric must already be pushed. +void NWNX_Profiler_PopPerfScope(); + +/// @} + +void NWNX_Profiler_PushPerfScope(string name, string tag0_tag = "", string tag0_value = "") +{ + if (tag0_value != "" && tag0_tag != "") + { + NWNXPushString(tag0_value); + NWNXPushString(tag0_tag); + } + NWNXPushString(name); + NWNXCall(NWNX_Profiler, "PushPerfScope"); +} + +void NWNX_Profiler_PopPerfScope() +{ + NWNXCall(NWNX_Profiler, "PopPerfScope"); +} diff --git a/_module/nss/nwnx_race.nss b/_module/nss/nwnx_race.nss new file mode 100644 index 00000000..3b892283 --- /dev/null +++ b/_module/nss/nwnx_race.nss @@ -0,0 +1,102 @@ +/// @addtogroup race Race +/// @brief Define racial and subrace characteristics. +/// @{ +/// @file nwnx_race.nss + +const string NWNX_Race = "NWNX_Race"; ///< @private + +/// @name Racial Modifiers +/// @anchor racial_modifiers +/// +/// @{ +const int NWNX_RACE_MODIFIER_INVALID = 0; +const int NWNX_RACE_MODIFIER_AB = 1; +const int NWNX_RACE_MODIFIER_ABVSRACE = 2; +const int NWNX_RACE_MODIFIER_AC = 3; +const int NWNX_RACE_MODIFIER_ACVSRACE = 4; +const int NWNX_RACE_MODIFIER_CONCEALMENT = 5; +const int NWNX_RACE_MODIFIER_DMGIMMUNITY = 6; +const int NWNX_RACE_MODIFIER_DMGREDUCTION = 7; +const int NWNX_RACE_MODIFIER_DMGRESIST = 8; +const int NWNX_RACE_MODIFIER_FEAT = 9; +const int NWNX_RACE_MODIFIER_FEATUSAGE = 10; +const int NWNX_RACE_MODIFIER_IMMUNITY = 11; +const int NWNX_RACE_MODIFIER_INITIATIVE = 12; +const int NWNX_RACE_MODIFIER_MOVEMENTSPEED = 13; +const int NWNX_RACE_MODIFIER_RACE = 14; +const int NWNX_RACE_MODIFIER_REGENERATION = 15; +const int NWNX_RACE_MODIFIER_SAVE = 16; +const int NWNX_RACE_MODIFIER_SAVEVSRACE = 17; +const int NWNX_RACE_MODIFIER_SAVEVSTYPE = 18; +const int NWNX_RACE_MODIFIER_SKILL = 19; +const int NWNX_RACE_MODIFIER_SPELLIMMUNITY = 20; +const int NWNX_RACE_MODIFIER_SRCHARGEN = 21; +const int NWNX_RACE_MODIFIER_SRINCLEVEL = 22; +///@} + +/// @brief Sets a racial modifier. +/// @param iRace The RACIALTYPE_ constant or value in racialtypes.2da. +/// @param iMod The @ref racial_modifiers "racial modifier" to set. +/// @param iParam1, iParam2, iParam3 The parameters for this racial modifier. +void NWNX_Race_SetRacialModifier(int iRace, int iMod, int iParam1, int iParam2 = 0xDEADBEEF, int iParam3 = 0xDEADBEEF); + +/// @brief Gets the parent race for a race. +/// @param iRace The race to check for a parent. +/// @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) +{ + NWNXPushInt(iParam3); + NWNXPushInt(iParam2); + NWNXPushInt(iParam1); + NWNXPushInt(iMod); + NWNXPushInt(iRace); + NWNXCall(NWNX_Race, "SetRacialModifier"); +} + +int NWNX_Race_GetParentRace(int iRace) +{ + 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 new file mode 100644 index 00000000..cacd9d24 --- /dev/null +++ b/_module/nss/nwnx_race_2da.nss @@ -0,0 +1,69 @@ +/// @ingroup race +/// @file nwnx_race_2da.nss +/// @brief Parse a column in the racialtypes.2da to load the modifiers. +#include "nwnx_race" + +/// @ingroup race +/// @brief Translate a modifier type from a string to its constant. +/// @param raceMod The string representation of the constant. +/// @return The constant for the race modifier. +int NWNX_Race_GetModifierConstant(string raceMod); + +/// @ingroup race +/// @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"); + +int NWNX_Race_GetModifierConstant(string raceMod) +{ + if (raceMod == "AB") return NWNX_RACE_MODIFIER_AB; + else if (raceMod == "ABVSRACE") return NWNX_RACE_MODIFIER_ABVSRACE; + else if (raceMod == "AC") return NWNX_RACE_MODIFIER_AC; + else if (raceMod == "ACVSRACE") return NWNX_RACE_MODIFIER_ACVSRACE; + else if (raceMod == "CONCEALMENT") return NWNX_RACE_MODIFIER_CONCEALMENT; + else if (raceMod == "DMGIMMUNITY") return NWNX_RACE_MODIFIER_DMGIMMUNITY; + else if (raceMod == "DMGREDUCTION") return NWNX_RACE_MODIFIER_DMGREDUCTION; + else if (raceMod == "DMGRESIST") return NWNX_RACE_MODIFIER_DMGRESIST; + else if (raceMod == "FEAT") return NWNX_RACE_MODIFIER_FEAT; + else if (raceMod == "FEATUSAGE") return NWNX_RACE_MODIFIER_FEATUSAGE; + else if (raceMod == "IMMUNITY") return NWNX_RACE_MODIFIER_IMMUNITY; + else if (raceMod == "INITIATIVE") return NWNX_RACE_MODIFIER_INITIATIVE; + else if (raceMod == "MOVEMENTSPEED") return NWNX_RACE_MODIFIER_MOVEMENTSPEED; + else if (raceMod == "RACE") return NWNX_RACE_MODIFIER_RACE; + else if (raceMod == "REGENERATION") return NWNX_RACE_MODIFIER_REGENERATION; + else if (raceMod == "SAVE") return NWNX_RACE_MODIFIER_SAVE; + else if (raceMod == "SAVEVSRACE") return NWNX_RACE_MODIFIER_SAVEVSRACE; + else if (raceMod == "SAVEVSTYPE") return NWNX_RACE_MODIFIER_SAVEVSTYPE; + else if (raceMod == "SKILL") return NWNX_RACE_MODIFIER_SKILL; + else if (raceMod == "SPELLIMMUNITY") return NWNX_RACE_MODIFIER_SPELLIMMUNITY; + else if (raceMod == "SRCHARGEN") return NWNX_RACE_MODIFIER_SRCHARGEN; + else if (raceMod == "SRINCLEVEL") return NWNX_RACE_MODIFIER_SRINCLEVEL; + return NWNX_RACE_MODIFIER_INVALID; +} + +void NWNX_Race_LoadRacialModifiers(string sColumnName = "RacialModsTable") +{ + int iRaceRows = Get2DARowCount("racialtypes"); + int iRace; + for (iRace = 0; iRace < iRaceRows; iRace++) + { + string sRaceModTable = Get2DAString("racialtypes", sColumnName, iRace); + if(sRaceModTable != "") + { + int iRaceModRows = Get2DARowCount(sRaceModTable); + int iRaceMod; + for (iRaceMod = 0; iRaceMod < iRaceModRows; iRaceMod++) + { + string sType = Get2DAString(sRaceModTable, "Type", iRaceMod); + string sParam1 = Get2DAString(sRaceModTable, "Param1", iRaceMod); + string sParam2 = Get2DAString(sRaceModTable, "Param2", iRaceMod); + string sParam3 = Get2DAString(sRaceModTable, "Param3", iRaceMod); + int iParam1 = sParam1 == "" ? 0xDEADBEEF : StringToInt(sParam1); + int iParam2 = sParam2 == "" ? 0xDEADBEEF : StringToInt(sParam2); + int iParam3 = sParam3 == "" ? 0xDEADBEEF : StringToInt(sParam3); + NWNX_Race_SetRacialModifier(iRace, NWNX_Race_GetModifierConstant(sType), iParam1, iParam2, iParam3); + } + } + } +} diff --git a/_module/nss/nwnx_redis.nss b/_module/nss/nwnx_redis.nss new file mode 100644 index 00000000..9c88eb2e --- /dev/null +++ b/_module/nss/nwnx_redis.nss @@ -0,0 +1,5905 @@ +/// @ingroup redis +/// @brief Autogenerated redis commands for NWNX usage. Autogenerated on: 2019-10-01 20:51:53 -0400 +/// @{ +/// @file nwnx_redis.nss +/// @name Redis Commands +#include "nwnx_redis_lib" + + +// Skipping sub-command: BITFIELD/{"command"=>"OVERFLOW", "type"=>"enum", "enum"=>["WRAP", "SAT", "FAIL"], "optional"=>true} - not supported yet. +// Skipping sub-command: CLIENT_KILL/{"command"=>"TYPE", "type"=>"enum", "enum"=>["normal", "master", "slave", "pubsub"], "optional"=>true} - not supported yet. +// Skipping sub-command: CLIENT_LIST/{"command"=>"TYPE", "type"=>"enum", "enum"=>["normal", "master", "replica", "pubsub"], "optional"=>true} - not supported yet. +// Skipping sub-command: SET/{"command"=>"expiration", "type"=>"enum", "enum"=>["EX seconds", "PX milliseconds"], "optional"=>true} - not supported yet. +// Skipping XCLAIM, cannot parse argument: {"name"=>"force", "enum"=>["FORCE"], "optional"=>true} - not supported yet. +// Skipping XCLAIM, cannot parse argument: {"name"=>"justid", "enum"=>["JUSTID"], "optional"=>true} - not supported yet. +/** + * APPEND + * + * Append a value to a key + * + * Time complexity: O(1). The amortized time complexity is O(1) assuming the appended value is + * small and the already present value is of any size, since the dynamic string + * library used by Redis will double the free space available on every + * reallocation. + * Annotated return value: integer + */ +int NWNX_Redis_APPEND( + string key, + string value +); + +/** + * AUTH + * + * Authenticate to the server + * Annotated return value: simple-string + */ +int NWNX_Redis_AUTH( + string password +); + +/** + * BGREWRITEAOF + * + * Asynchronously rewrite the append-only file + * Annotated return value: simple-string + */ +int NWNX_Redis_BGREWRITEAOF(); + +/** + * BGSAVE + * + * Asynchronously save the dataset to disk + * Annotated return value: simple-string + */ +int NWNX_Redis_BGSAVE(); + +/** + * BITCOUNT + * + * Count set bits in a string + * + * Time complexity: O(N) + * Annotated return value: integer + */ +int NWNX_Redis_BITCOUNT( + string key, + // Redis type: integer + int start = 0, + // Redis type: integer + int end = 0 +); + +/** + * BITFIELD + * + * Perform arbitrary bitfield integer operations on strings + * + * Time complexity: O(1) for each subcommand specified + * Annotated return value: + */ +int NWNX_Redis_BITFIELD( + string key, + // Redis type: type + string get_type = "", + // Redis type: integer + int get_offset = 0, + // Redis type: type + string set_type = "", + // Redis type: integer + int set_offset = 0, + // Redis type: integer + int set_value = 0, + // Redis type: type + string incrby_type = "", + // Redis type: integer + int incrby_offset = 0, + // Redis type: integer + int incrby_increment = 0 +); + +/** + * BITOP + * + * Perform bitwise operations between strings + * + * Time complexity: O(N) + * Annotated return value: integer + */ +int NWNX_Redis_BITOP( + string operation, + // Redis type: key + string destkey, + string key +); + +/** + * BITPOS + * + * Find first bit set or clear in a string + * + * Time complexity: O(N) + * Annotated return value: integer + */ +int NWNX_Redis_BITPOS( + string key, + // Redis type: integer + int bit, + // Redis type: integer + int start = 0, + // Redis type: integer + int end = 0 +); + +/** + * BLPOP + * + * Remove and get the first element in a list, or block until one is available + * + * Time complexity: O(1) + * Annotated return value: array + */ +int NWNX_Redis_BLPOP( + string key, + // Redis type: integer + int timeout +); + +/** + * BRPOP + * + * Remove and get the last element in a list, or block until one is available + * + * Time complexity: O(1) + * Annotated return value: array + */ +int NWNX_Redis_BRPOP( + string key, + // Redis type: integer + int timeout +); + +/** + * BRPOPLPUSH + * + * Pop a value from a list, push it to another list and return it; or block until one is available + * + * Time complexity: O(1) + * Annotated return value: bulk-string + */ +int NWNX_Redis_BRPOPLPUSH( + // Redis type: key + string source, + // Redis type: key + string destination, + // Redis type: integer + int timeout +); + +/** + * BZPOPMIN + * + * Remove and return the member with the lowest score from one or more sorted sets, or block until one is available + * + * Time complexity: O(log(N)) with N being the number of elements in the sorted set. + * Annotated return value: array + */ +int NWNX_Redis_BZPOPMIN( + string key, + // Redis type: integer + int timeout +); + +/** + * BZPOPMAX + * + * Remove and return the member with the highest score from one or more sorted sets, or block until one is available + * + * Time complexity: O(log(N)) with N being the number of elements in the sorted set. + * Annotated return value: array + */ +int NWNX_Redis_BZPOPMAX( + string key, + // Redis type: integer + int timeout +); + +/** + * CLIENT_ID + * + * Returns the client ID for the current connection + * + * Time complexity: O(1) + * Annotated return value: + */ +int NWNX_Redis_CLIENT_ID(); + +/** + * CLIENT_KILL + * + * Kill the connection of a client + * + * Time complexity: O(N) where N is the number of client connections + * Annotated return value: simple-string + */ +int NWNX_Redis_CLIENT_KILL( + string ip_port = "", + // Redis type: integer + int id_client_id = 0, + string addr_ip_port = "", + string skipme_yes_no = "" +); + +/** + * CLIENT_LIST + * + * Get the list of client connections + * + * Time complexity: O(N) where N is the number of client connections + * Annotated return value: bulk-string + */ +int NWNX_Redis_CLIENT_LIST(); + +/** + * CLIENT_GETNAME + * + * Get the current connection name + * + * Time complexity: O(1) + * Annotated return value: bulk-string + */ +int NWNX_Redis_CLIENT_GETNAME(); + +/** + * CLIENT_PAUSE + * + * Stop processing commands from clients for some time + * + * Time complexity: O(1) + * Annotated return value: simple-string + */ +int NWNX_Redis_CLIENT_PAUSE( + // Redis type: integer + int timeout +); + +/** + * CLIENT_REPLY + * + * Instruct the server whether to reply to commands + * + * Time complexity: O(1) + + * - Valid values for reply_mode: "ON", "OFF", "SKIP" + * Annotated return value: simple-string + */ +int NWNX_Redis_CLIENT_REPLY( + // Redis type: enum + string reply_mode +); + +/** + * CLIENT_SETNAME + * + * Set the current connection name + * + * Time complexity: O(1) + * Annotated return value: simple-string + */ +int NWNX_Redis_CLIENT_SETNAME( + string connection_name +); + +/** + * CLIENT_UNBLOCK + * + * Unblock a client blocked in a blocking command from a different connection + * + * Time complexity: O(log N) where N is the number of client connections + + * - Valid values for unblock_type: "TIMEOUT", "ERROR" + * Annotated return value: + */ +int NWNX_Redis_CLIENT_UNBLOCK( + string client_id, + // Redis type: enum + string unblock_type = "" +); + +/** + * CLUSTER_ADDSLOTS + * + * Assign new hash slots to receiving node + * + * Time complexity: O(N) where N is the total number of hash slot arguments + * Annotated return value: simple-string + */ +int NWNX_Redis_CLUSTER_ADDSLOTS( + // Redis type: integer + int slot +); + +/** + * CLUSTER_COUNT_FAILURE_REPORTS + * + * Return the number of failure reports active for a given node + * + * Time complexity: O(N) where N is the number of failure reports + * Annotated return value: integer + */ +int NWNX_Redis_CLUSTER_COUNT_FAILURE_REPORTS( + string node_id +); + +/** + * CLUSTER_COUNTKEYSINSLOT + * + * Return the number of local keys in the specified hash slot + * + * Time complexity: O(1) + * Annotated return value: integer + */ +int NWNX_Redis_CLUSTER_COUNTKEYSINSLOT( + // Redis type: integer + int slot +); + +/** + * CLUSTER_DELSLOTS + * + * Set hash slots as unbound in receiving node + * + * Time complexity: O(N) where N is the total number of hash slot arguments + * Annotated return value: simple-string + */ +int NWNX_Redis_CLUSTER_DELSLOTS( + // Redis type: integer + int slot +); + +/** + * CLUSTER_FAILOVER + * + * Forces a replica to perform a manual failover of its master. + * + * Time complexity: O(1) + + * - Valid values for options: "FORCE", "TAKEOVER" + * Annotated return value: simple-string + */ +int NWNX_Redis_CLUSTER_FAILOVER( + // Redis type: enum + string options = "" +); + +/** + * CLUSTER_FORGET + * + * Remove a node from the nodes table + * + * Time complexity: O(1) + * Annotated return value: simple-string + */ +int NWNX_Redis_CLUSTER_FORGET( + string node_id +); + +/** + * CLUSTER_GETKEYSINSLOT + * + * Return local key names in the specified hash slot + * + * Time complexity: O(log(N)) where N is the number of requested keys + * Annotated return value: array + */ +int NWNX_Redis_CLUSTER_GETKEYSINSLOT( + // Redis type: integer + int slot, + // Redis type: integer + int count +); + +/** + * CLUSTER_INFO + * + * Provides info about Redis Cluster node state + * + * Time complexity: O(1) + * Annotated return value: bulk-string + */ +int NWNX_Redis_CLUSTER_INFO(); + +/** + * CLUSTER_KEYSLOT + * + * Returns the hash slot of the specified key + * + * Time complexity: O(N) where N is the number of bytes in the key + * Annotated return value: integer + */ +int NWNX_Redis_CLUSTER_KEYSLOT( + string key +); + +/** + * CLUSTER_MEET + * + * Force a node cluster to handshake with another node + * + * Time complexity: O(1) + * Annotated return value: simple-string + */ +int NWNX_Redis_CLUSTER_MEET( + string ip, + // Redis type: integer + int port +); + +/** + * CLUSTER_NODES + * + * Get Cluster config for the node + * + * Time complexity: O(N) where N is the total number of Cluster nodes + * Annotated return value: bulk-string + */ +int NWNX_Redis_CLUSTER_NODES(); + +/** + * CLUSTER_REPLICATE + * + * Reconfigure a node as a replica of the specified master node + * + * Time complexity: O(1) + * Annotated return value: simple-string + */ +int NWNX_Redis_CLUSTER_REPLICATE( + string node_id +); + +/** + * CLUSTER_RESET + * + * Reset a Redis Cluster node + * + * Time complexity: O(N) where N is the number of known nodes. The command may execute a + * FLUSHALL as a side effect. + + * - Valid values for reset_type: "HARD", "SOFT" + * Annotated return value: simple-string + */ +int NWNX_Redis_CLUSTER_RESET( + // Redis type: enum + string reset_type = "" +); + +/** + * CLUSTER_SAVECONFIG + * + * Forces the node to save cluster state on disk + * + * Time complexity: O(1) + * Annotated return value: simple-string + */ +int NWNX_Redis_CLUSTER_SAVECONFIG(); + +/** + * CLUSTER_SET_CONFIG_EPOCH + * + * Set the configuration epoch in a new node + * + * Time complexity: O(1) + * Annotated return value: simple-string + */ +int NWNX_Redis_CLUSTER_SET_CONFIG_EPOCH( + // Redis type: integer + int config_epoch +); + +/** + * CLUSTER_SETSLOT + * + * Bind a hash slot to a specific node + * + * Time complexity: O(1) + + * - Valid values for subcommand: "IMPORTING", "MIGRATING", "STABLE", "NODE" + * Annotated return value: simple-string + */ +int NWNX_Redis_CLUSTER_SETSLOT( + // Redis type: integer + int slot, + // Redis type: enum + string subcommand, + string node_id = "" +); + +/** + * CLUSTER_SLAVES + * + * List replica nodes of the specified master node + * + * Time complexity: O(1) + * Annotated return value: + */ +int NWNX_Redis_CLUSTER_SLAVES( + string node_id +); + +/** + * CLUSTER_REPLICAS + * + * List replica nodes of the specified master node + * + * Time complexity: O(1) + * Annotated return value: + */ +int NWNX_Redis_CLUSTER_REPLICAS( + string node_id +); + +/** + * CLUSTER_SLOTS + * + * Get array of Cluster slot to node mappings + * + * Time complexity: O(N) where N is the total number of Cluster nodes + * Annotated return value: array + */ +int NWNX_Redis_CLUSTER_SLOTS(); + +/** + * COMMAND + * + * Get array of Redis command details + * + * Time complexity: O(N) where N is the total number of Redis commands + * Annotated return value: array + */ +int NWNX_Redis_COMMAND(); + +/** + * COMMAND_COUNT + * + * Get total number of Redis commands + * + * Time complexity: O(1) + * Annotated return value: integer + */ +int NWNX_Redis_COMMAND_COUNT(); + +/** + * COMMAND_GETKEYS + * + * Extract keys given a full Redis command + * + * Time complexity: O(N) where N is the number of arguments to the command + * Annotated return value: array + */ +int NWNX_Redis_COMMAND_GETKEYS(); + +/** + * COMMAND_INFO + * + * Get array of specific Redis command details + * + * Time complexity: O(N) when N is number of commands to look up + * Annotated return value: array + */ +int NWNX_Redis_COMMAND_INFO( + string command_name +); + +/** + * CONFIG_GET + * + * Get the value of a configuration parameter + * Annotated return value: array + */ +int NWNX_Redis_CONFIG_GET( + string parameter +); + +/** + * CONFIG_REWRITE + * + * Rewrite the configuration file with the in memory configuration + * Annotated return value: simple-string + */ +int NWNX_Redis_CONFIG_REWRITE(); + +/** + * CONFIG_SET + * + * Set a configuration parameter to the given value + * Annotated return value: simple-string + */ +int NWNX_Redis_CONFIG_SET( + string parameter, + string value +); + +/** + * CONFIG_RESETSTAT + * + * Reset the stats returned by INFO + * + * Time complexity: O(1) + * Annotated return value: simple-string + */ +int NWNX_Redis_CONFIG_RESETSTAT(); + +/** + * DBSIZE + * + * Return the number of keys in the selected database + * Annotated return value: integer + */ +int NWNX_Redis_DBSIZE(); + +/** + * DEBUG_OBJECT + * + * Get debugging information about a key + * Annotated return value: simple-string + */ +int NWNX_Redis_DEBUG_OBJECT( + string key +); + +/** + * DEBUG_SEGFAULT + * + * Make the server crash + * Annotated return value: simple-string + */ +int NWNX_Redis_DEBUG_SEGFAULT(); + +/** + * DECR + * + * Decrement the integer value of a key by one + * + * Time complexity: O(1) + * Annotated return value: integer + */ +int NWNX_Redis_DECR( + string key +); + +/** + * DECRBY + * + * Decrement the integer value of a key by the given number + * + * Time complexity: O(1) + * Annotated return value: integer + */ +int NWNX_Redis_DECRBY( + string key, + // Redis type: integer + int decrement +); + +/** + * DEL + * + * Delete a key + * + * Time complexity: O(N) where N is the number of keys that will be removed. When a key to + * remove holds a value other than a string, the individual complexity for this + * key is O(M) where M is the number of elements in the list, set, sorted set + * or hash. Removing a single key that holds a string value is O(1). + * Annotated return value: integer + */ +int NWNX_Redis_DEL( + string key +); + +/** + * DISCARD + * + * Discard all commands issued after MULTI + * Annotated return value: simple-string + */ +int NWNX_Redis_DISCARD(); + +/** + * DUMP + * + * Return a serialized version of the value stored at the specified key. + * + * Time complexity: O(1) to access the key and additional O(N*M) to serialized it, where N is + * the number of Redis objects composing the value and M their average size. + * For small string values the time complexity is thus O(1)+O(1*M) where M is + * small, so simply O(1). + * Annotated return value: bulk-string + */ +int NWNX_Redis_DUMP( + string key +); + +/** + * ECHO + * + * Echo the given string + * Annotated return value: bulk-string + */ +int NWNX_Redis_ECHO( + string message +); + +/** + * EVAL + * + * Execute a Lua script server side + * + * Time complexity: Depends on the script that is executed. + * Annotated return value: + */ +int NWNX_Redis_EVAL( + string script, + // Redis type: integer + int numkeys, + string key, + string arg +); + +/** + * EVALSHA + * + * Execute a Lua script server side + * + * Time complexity: Depends on the script that is executed. + * Annotated return value: + */ +int NWNX_Redis_EVALSHA( + string sha1, + // Redis type: integer + int numkeys, + string key, + string arg +); + +/** + * EXEC + * + * Execute all commands issued after MULTI + * Annotated return value: array + */ +int NWNX_Redis_EXEC(); + +/** + * EXISTS + * + * Determine if a key exists + * + * Time complexity: O(1) + * Annotated return value: integer + */ +int NWNX_Redis_EXISTS( + string key +); + +/** + * EXPIRE + * + * Set a key's time to live in seconds + * + * Time complexity: O(1) + * Annotated return value: integer + */ +int NWNX_Redis_EXPIRE( + string key, + // Redis type: integer + int seconds +); + +/** + * EXPIREAT + * + * Set the expiration for a key as a UNIX timestamp + * + * Time complexity: O(1) + * Annotated return value: integer + */ +int NWNX_Redis_EXPIREAT( + string key, + // Redis type: posix time + string timestamp +); + +/** + * FLUSHALL + * + * Remove all keys from all databases + + * - Valid values for async: "ASYNC" + * Annotated return value: simple-string + */ +int NWNX_Redis_FLUSHALL( + // Redis type: enum + string async = "" +); + +/** + * FLUSHDB + * + * Remove all keys from the current database + + * - Valid values for async: "ASYNC" + * Annotated return value: simple-string + */ +int NWNX_Redis_FLUSHDB( + // Redis type: enum + string async = "" +); + +/** + * GEOADD + * + * Add one or more geospatial items in the geospatial index represented using a sorted set + * + * Time complexity: O(log(N)) for each item added, where N is the number of elements in the + * sorted set. + * Annotated return value: integer + */ +int NWNX_Redis_GEOADD( + string key, + // Redis type: double + float longitude, + // Redis type: double + float latitude, + string member +); + +/** + * GEOHASH + * + * Returns members of a geospatial index as standard geohash strings + * + * Time complexity: O(log(N)) for each member requested, where N is the number of elements in + * the sorted set. + * Annotated return value: array + */ +int NWNX_Redis_GEOHASH( + string key, + string member +); + +/** + * GEOPOS + * + * Returns longitude and latitude of members of a geospatial index + * + * Time complexity: O(log(N)) for each member requested, where N is the number of elements in + * the sorted set. + * Annotated return value: array + */ +int NWNX_Redis_GEOPOS( + string key, + string member +); + +/** + * GEODIST + * + * Returns the distance between two members of a geospatial index + * + * Time complexity: O(log(N)) + * Annotated return value: bulk-string + */ +int NWNX_Redis_GEODIST( + string key, + string member1, + string member2, + string unit = "" +); + +/** + * GEORADIUS + * + * Query a sorted set representing a geospatial index to fetch members matching a given maximum distance from a point + * + * Time complexity: O(N+log(M)) where N is the number of elements inside the bounding box of the + * circular area delimited by center and radius and M is the number of items + * inside the index. + + * - Valid values for unit: "m", "km", "ft", "mi" + + * - Valid values for withcoord: "WITHCOORD" + + * - Valid values for withdist: "WITHDIST" + + * - Valid values for withhash: "WITHHASH" + + * - Valid values for order: "ASC", "DESC" + * Annotated return value: array + */ +int NWNX_Redis_GEORADIUS( + string key, + // Redis type: double + float longitude, + // Redis type: double + float latitude, + // Redis type: double + float radius, + // Redis type: enum + string unit, + // Redis type: enum + string withcoord = "", + // Redis type: enum + string withdist = "", + // Redis type: enum + string withhash = "", + // Redis type: integer + int count_count = 0, + // Redis type: enum + string order = "", + // Redis type: key + string store_key = "", + // Redis type: key + string storedist_key = "" +); + +/** + * GEORADIUSBYMEMBER + * + * Query a sorted set representing a geospatial index to fetch members matching a given maximum distance from a member + * + * Time complexity: O(N+log(M)) where N is the number of elements inside the bounding box of the + * circular area delimited by center and radius and M is the number of items + * inside the index. + + * - Valid values for unit: "m", "km", "ft", "mi" + + * - Valid values for withcoord: "WITHCOORD" + + * - Valid values for withdist: "WITHDIST" + + * - Valid values for withhash: "WITHHASH" + + * - Valid values for order: "ASC", "DESC" + * Annotated return value: + */ +int NWNX_Redis_GEORADIUSBYMEMBER( + string key, + string member, + // Redis type: double + float radius, + // Redis type: enum + string unit, + // Redis type: enum + string withcoord = "", + // Redis type: enum + string withdist = "", + // Redis type: enum + string withhash = "", + // Redis type: integer + int count_count = 0, + // Redis type: enum + string order = "", + // Redis type: key + string store_key = "", + // Redis type: key + string storedist_key = "" +); + +/** + * GET + * + * Get the value of a key + * + * Time complexity: O(1) + * Annotated return value: bulk-string + */ +int NWNX_Redis_GET( + string key +); + +/** + * GETBIT + * + * Returns the bit value at offset in the string value stored at key + * + * Time complexity: O(1) + * Annotated return value: integer + */ +int NWNX_Redis_GETBIT( + string key, + // Redis type: integer + int offset +); + +/** + * GETRANGE + * + * Get a substring of the string stored at a key + * + * Time complexity: O(N) where N is the length of the returned string. The complexity is + * ultimately determined by the returned length, but because creating a + * substring from an existing string is very cheap, it can be considered O(1) + * for small strings. + * Annotated return value: bulk-string + */ +int NWNX_Redis_GETRANGE( + string key, + // Redis type: integer + int start, + // Redis type: integer + int end +); + +/** + * GETSET + * + * Set the string value of a key and return its old value + * + * Time complexity: O(1) + * Annotated return value: bulk-string + */ +int NWNX_Redis_GETSET( + string key, + string value +); + +/** + * HDEL + * + * Delete one or more hash fields + * + * Time complexity: O(N) where N is the number of fields to be removed. + * Annotated return value: integer + */ +int NWNX_Redis_HDEL( + string key, + string field +); + +/** + * HEXISTS + * + * Determine if a hash field exists + * + * Time complexity: O(1) + * Annotated return value: integer + */ +int NWNX_Redis_HEXISTS( + string key, + string field +); + +/** + * HGET + * + * Get the value of a hash field + * + * Time complexity: O(1) + * Annotated return value: bulk-string + */ +int NWNX_Redis_HGET( + string key, + string field +); + +/** + * HGETALL + * + * Get all the fields and values in a hash + * + * Time complexity: O(N) where N is the size of the hash. + * Annotated return value: array + */ +int NWNX_Redis_HGETALL( + string key +); + +/** + * HINCRBY + * + * Increment the integer value of a hash field by the given number + * + * Time complexity: O(1) + * Annotated return value: integer + */ +int NWNX_Redis_HINCRBY( + string key, + string field, + // Redis type: integer + int increment +); + +/** + * HINCRBYFLOAT + * + * Increment the float value of a hash field by the given amount + * + * Time complexity: O(1) + * Annotated return value: bulk-string + */ +int NWNX_Redis_HINCRBYFLOAT( + string key, + string field, + // Redis type: double + float increment +); + +/** + * HKEYS + * + * Get all the fields in a hash + * + * Time complexity: O(N) where N is the size of the hash. + * Annotated return value: array + */ +int NWNX_Redis_HKEYS( + string key +); + +/** + * HLEN + * + * Get the number of fields in a hash + * + * Time complexity: O(1) + * Annotated return value: integer + */ +int NWNX_Redis_HLEN( + string key +); + +/** + * HMGET + * + * Get the values of all the given hash fields + * + * Time complexity: O(N) where N is the number of fields being requested. + * Annotated return value: array + */ +int NWNX_Redis_HMGET( + string key, + string field +); + +/** + * HMSET + * + * Set multiple hash fields to multiple values + * + * Time complexity: O(N) where N is the number of fields being set. + * Annotated return value: simple-string + */ +int NWNX_Redis_HMSET( + string key, + string field, + string value +); + +/** + * HSET + * + * Set the string value of a hash field + * + * Time complexity: O(1) + * Annotated return value: integer + */ +int NWNX_Redis_HSET( + string key, + string field, + string value +); + +/** + * HSETNX + * + * Set the value of a hash field, only if the field does not exist + * + * Time complexity: O(1) + * Annotated return value: integer + */ +int NWNX_Redis_HSETNX( + string key, + string field, + string value +); + +/** + * HSTRLEN + * + * Get the length of the value of a hash field + * + * Time complexity: O(1) + * Annotated return value: integer + */ +int NWNX_Redis_HSTRLEN( + string key, + string field +); + +/** + * HVALS + * + * Get all the values in a hash + * + * Time complexity: O(N) where N is the size of the hash. + * Annotated return value: array + */ +int NWNX_Redis_HVALS( + string key +); + +/** + * INCR + * + * Increment the integer value of a key by one + * + * Time complexity: O(1) + * Annotated return value: integer + */ +int NWNX_Redis_INCR( + string key +); + +/** + * INCRBY + * + * Increment the integer value of a key by the given amount + * + * Time complexity: O(1) + * Annotated return value: integer + */ +int NWNX_Redis_INCRBY( + string key, + // Redis type: integer + int increment +); + +/** + * INCRBYFLOAT + * + * Increment the float value of a key by the given amount + * + * Time complexity: O(1) + * Annotated return value: bulk-string + */ +int NWNX_Redis_INCRBYFLOAT( + string key, + // Redis type: double + float increment +); + +/** + * INFO + * + * Get information and statistics about the server + * Annotated return value: bulk-string + */ +int NWNX_Redis_INFO( + string section = "" +); + +/** + * KEYS + * + * Find all keys matching the given pattern + * + * Time complexity: O(N) with N being the number of keys in the database, under the assumption + * that the key names in the database and the given pattern have limited + * length. + * Annotated return value: array + */ +int NWNX_Redis_KEYS( + string pattern +); + +/** + * LASTSAVE + * + * Get the UNIX time stamp of the last successful save to disk + * Annotated return value: integer + */ +int NWNX_Redis_LASTSAVE(); + +/** + * LINDEX + * + * Get an element from a list by its index + * + * Time complexity: O(N) where N is the number of elements to traverse to get to the element at + * index. This makes asking for the first or the last element of the list O(1). + * Annotated return value: bulk-string + */ +int NWNX_Redis_LINDEX( + string key, + // Redis type: integer + int index +); + +/** + * LINSERT + * + * Insert an element before or after another element in a list + * + * Time complexity: O(N) where N is the number of elements to traverse before seeing the value + * pivot. This means that inserting somewhere on the left end on the list + * (head) can be considered O(1) and inserting somewhere on the right end + * (tail) is O(N). + + * - Valid values for where: "BEFORE", "AFTER" + * Annotated return value: integer + */ +int NWNX_Redis_LINSERT( + string key, + // Redis type: enum + string where, + string pivot, + string value +); + +/** + * LLEN + * + * Get the length of a list + * + * Time complexity: O(1) + * Annotated return value: integer + */ +int NWNX_Redis_LLEN( + string key +); + +/** + * LPOP + * + * Remove and get the first element in a list + * + * Time complexity: O(1) + * Annotated return value: bulk-string + */ +int NWNX_Redis_LPOP( + string key +); + +/** + * LPUSH + * + * Prepend one or multiple values to a list + * + * Time complexity: O(1) + * Annotated return value: integer + */ +int NWNX_Redis_LPUSH( + string key, + string value +); + +/** + * LPUSHX + * + * Prepend a value to a list, only if the list exists + * + * Time complexity: O(1) + * Annotated return value: integer + */ +int NWNX_Redis_LPUSHX( + string key, + string value +); + +/** + * LRANGE + * + * Get a range of elements from a list + * + * Time complexity: O(S+N) where S is the distance of start offset from HEAD for small lists, + * from nearest end (HEAD or TAIL) for large lists; and N is the number of + * elements in the specified range. + * Annotated return value: array + */ +int NWNX_Redis_LRANGE( + string key, + // Redis type: integer + int start, + // Redis type: integer + int stop +); + +/** + * LREM + * + * Remove elements from a list + * + * Time complexity: O(N) where N is the length of the list. + * Annotated return value: integer + */ +int NWNX_Redis_LREM( + string key, + // Redis type: integer + int count, + string value +); + +/** + * LSET + * + * Set the value of an element in a list by its index + * + * Time complexity: O(N) where N is the length of the list. Setting either the first or the last + * element of the list is O(1). + * Annotated return value: simple-string + */ +int NWNX_Redis_LSET( + string key, + // Redis type: integer + int index, + string value +); + +/** + * LTRIM + * + * Trim a list to the specified range + * + * Time complexity: O(N) where N is the number of elements to be removed by the operation. + * Annotated return value: simple-string + */ +int NWNX_Redis_LTRIM( + string key, + // Redis type: integer + int start, + // Redis type: integer + int stop +); + +/** + * MEMORY_DOCTOR + * + * Outputs memory problems report + * Annotated return value: bulk-string + */ +int NWNX_Redis_MEMORY_DOCTOR(); + +/** + * MEMORY_HELP + * + * Show helpful text about the different subcommands + * Annotated return value: array + */ +int NWNX_Redis_MEMORY_HELP(); + +/** + * MEMORY_MALLOC_STATS + * + * Show allocator internal stats + * Annotated return value: bulk-string + */ +int NWNX_Redis_MEMORY_MALLOC_STATS(); + +/** + * MEMORY_PURGE + * + * Ask the allocator to release memory + * Annotated return value: simple-string + */ +int NWNX_Redis_MEMORY_PURGE(); + +/** + * MEMORY_STATS + * + * Show memory usage details + * Annotated return value: array + */ +int NWNX_Redis_MEMORY_STATS(); + +/** + * MEMORY_USAGE + * + * Estimate the memory usage of a key + * + * Time complexity: O(N) where N is the number of samples. + * Annotated return value: integer + */ +int NWNX_Redis_MEMORY_USAGE( + string key, + // Redis type: integer + int samples_count = 0 +); + +/** + * MGET + * + * Get the values of all the given keys + * + * Time complexity: O(N) where N is the number of keys to retrieve. + * Annotated return value: array + */ +int NWNX_Redis_MGET( + string key +); + +/** + * MIGRATE + * + * Atomically transfer a key from a Redis instance to another one. + * + * Time complexity: This command actually executes a DUMP+DEL in the source instance, and a + * RESTORE in the target instance. See the pages of these commands for time + * complexity. Also an O(N) data transfer between the two instances is + * performed. + + * - Valid values for key: "key", "\"\"" + + * - Valid values for copy: "COPY" + + * - Valid values for replace: "REPLACE" + * Annotated return value: simple-string + */ +int NWNX_Redis_MIGRATE( + string host, + string port, + // Redis type: enum + string key, + // Redis type: integer + int destination_db, + // Redis type: integer + int timeout, + // Redis type: enum + string copy = "", + // Redis type: enum + string replace = "", + string auth_password = "", + // Redis type: key + string keys_key = "" +); + +/** + * MONITOR + * + * Listen for all requests received by the server in real time + * Annotated return value: + */ +int NWNX_Redis_MONITOR(); + +/** + * MOVE + * + * Move a key to another database + * + * Time complexity: O(1) + * Annotated return value: integer + */ +int NWNX_Redis_MOVE( + string key, + // Redis type: integer + int db +); + +/** + * MSET + * + * Set multiple keys to multiple values + * + * Time complexity: O(N) where N is the number of keys to set. + * Annotated return value: simple-string + */ +int NWNX_Redis_MSET( + string key, + string value +); + +/** + * MSETNX + * + * Set multiple keys to multiple values, only if none of the keys exist + * + * Time complexity: O(N) where N is the number of keys to set. + * Annotated return value: integer + */ +int NWNX_Redis_MSETNX( + string key, + string value +); + +/** + * MULTI + * + * Mark the start of a transaction block + * Annotated return value: simple-string + */ +int NWNX_Redis_MULTI(); + +/** + * OBJECT + * + * Inspect the internals of Redis objects + * + * Time complexity: O(1) for all the currently implemented subcommands. + * Annotated return value: + */ +int NWNX_Redis_OBJECT( + string subcommand, + string arguments = "" +); + +/** + * PERSIST + * + * Remove the expiration from a key + * + * Time complexity: O(1) + * Annotated return value: integer + */ +int NWNX_Redis_PERSIST( + string key +); + +/** + * PEXPIRE + * + * Set a key's time to live in milliseconds + * + * Time complexity: O(1) + * Annotated return value: integer + */ +int NWNX_Redis_PEXPIRE( + string key, + // Redis type: integer + int milliseconds +); + +/** + * PEXPIREAT + * + * Set the expiration for a key as a UNIX timestamp specified in milliseconds + * + * Time complexity: O(1) + * Annotated return value: integer + */ +int NWNX_Redis_PEXPIREAT( + string key, + // Redis type: posix time + string milliseconds_timestamp +); + +/** + * PFADD + * + * Adds the specified elements to the specified HyperLogLog. + * + * Time complexity: O(1) to add every element. + * Annotated return value: integer + */ +int NWNX_Redis_PFADD( + string key, + string element +); + +/** + * PFCOUNT + * + * Return the approximated cardinality of the set(s) observed by the HyperLogLog at key(s). + * + * Time complexity: O(1) with a very small average constant time when called with a single key. + * O(N) with N being the number of keys, and much bigger constant times, when + * called with multiple keys. + * Annotated return value: integer + */ +int NWNX_Redis_PFCOUNT( + string key +); + +/** + * PFMERGE + * + * Merge N different HyperLogLogs into a single one. + * + * Time complexity: O(N) to merge N HyperLogLogs, but with high constant times. + * Annotated return value: simple-string + */ +int NWNX_Redis_PFMERGE( + // Redis type: key + string destkey, + // Redis type: key + string sourcekey +); + +/** + * PING + * + * Ping the server + * Annotated return value: simple-string + */ +int NWNX_Redis_PING( + string message = "" +); + +/** + * PSETEX + * + * Set the value and expiration in milliseconds of a key + * + * Time complexity: O(1) + * Annotated return value: + */ +int NWNX_Redis_PSETEX( + string key, + // Redis type: integer + int milliseconds, + string value +); + +/** + * PUBSUB + * + * Inspect the state of the Pub/Sub subsystem + * + * Time complexity: O(N) for the CHANNELS subcommand, where N is the number of active channels, + * and assuming constant time pattern matching (relatively short channels and + * patterns). O(N) for the NUMSUB subcommand, where N is the number of + * requested channels. O(1) for the NUMPAT subcommand. + * Annotated return value: array + */ +int NWNX_Redis_PUBSUB( + string subcommand, + string argument = "" +); + +/** + * PTTL + * + * Get the time to live for a key in milliseconds + * + * Time complexity: O(1) + * Annotated return value: integer + */ +int NWNX_Redis_PTTL( + string key +); + +/** + * PUBLISH + * + * Post a message to a channel + * + * Time complexity: O(N+M) where N is the number of clients subscribed to the receiving channel + * and M is the total number of subscribed patterns (by any client). + * Annotated return value: integer + */ +int NWNX_Redis_PUBLISH( + string channel, + string message +); + +/** + * QUIT + * + * Close the connection + * Annotated return value: simple-string + */ +int NWNX_Redis_QUIT(); + +/** + * RANDOMKEY + * + * Return a random key from the keyspace + * + * Time complexity: O(1) + * Annotated return value: bulk-string + */ +int NWNX_Redis_RANDOMKEY(); + +/** + * READONLY + * + * Enables read queries for a connection to a cluster replica node + * + * Time complexity: O(1) + * Annotated return value: simple-string + */ +int NWNX_Redis_READONLY(); + +/** + * READWRITE + * + * Disables read queries for a connection to a cluster replica node + * + * Time complexity: O(1) + * Annotated return value: simple-string + */ +int NWNX_Redis_READWRITE(); + +/** + * RENAME + * + * Rename a key + * + * Time complexity: O(1) + * Annotated return value: simple-string + */ +int NWNX_Redis_RENAME( + string key, + // Redis type: key + string newkey +); + +/** + * RENAMENX + * + * Rename a key, only if the new key does not exist + * + * Time complexity: O(1) + * Annotated return value: integer + */ +int NWNX_Redis_RENAMENX( + string key, + // Redis type: key + string newkey +); + +/** + * RESTORE + * + * Create a key using the provided serialized value, previously obtained using DUMP. + * + * Time complexity: O(1) to create the new key and additional O(N*M) to reconstruct the + * serialized value, where N is the number of Redis objects composing the value + * and M their average size. For small string values the time complexity is + * thus O(1)+O(1*M) where M is small, so simply O(1). However for sorted set + * values the complexity is O(N*M*log(N)) because inserting values into sorted + * sets is O(log(N)). + + * - Valid values for replace: "REPLACE" + + * - Valid values for absttl: "ABSTTL" + * Annotated return value: simple-string + */ +int NWNX_Redis_RESTORE( + string key, + // Redis type: integer + int ttl, + string serialized_value, + // Redis type: enum + string replace = "", + // Redis type: enum + string absttl = "", + // Redis type: integer + int idletime_seconds = 0, + // Redis type: integer + int freq_frequency = 0 +); + +/** + * ROLE + * + * Return the role of the instance in the context of replication + * Annotated return value: array + */ +int NWNX_Redis_ROLE(); + +/** + * RPOP + * + * Remove and get the last element in a list + * + * Time complexity: O(1) + * Annotated return value: bulk-string + */ +int NWNX_Redis_RPOP( + string key +); + +/** + * RPOPLPUSH + * + * Remove the last element in a list, prepend it to another list and return it + * + * Time complexity: O(1) + * Annotated return value: bulk-string + */ +int NWNX_Redis_RPOPLPUSH( + // Redis type: key + string source, + // Redis type: key + string destination +); + +/** + * RPUSH + * + * Append one or multiple values to a list + * + * Time complexity: O(1) + * Annotated return value: integer + */ +int NWNX_Redis_RPUSH( + string key, + string value +); + +/** + * RPUSHX + * + * Append a value to a list, only if the list exists + * + * Time complexity: O(1) + * Annotated return value: integer + */ +int NWNX_Redis_RPUSHX( + string key, + string value +); + +/** + * SADD + * + * Add one or more members to a set + * + * Time complexity: O(1) for each element added, so O(N) to add N elements when the command is + * called with multiple arguments. + * Annotated return value: integer + */ +int NWNX_Redis_SADD( + string key, + string member +); + +/** + * SAVE + * + * Synchronously save the dataset to disk + * Annotated return value: simple-string + */ +int NWNX_Redis_SAVE(); + +/** + * SCARD + * + * Get the number of members in a set + * + * Time complexity: O(1) + * Annotated return value: integer + */ +int NWNX_Redis_SCARD( + string key +); + +/** + * SCRIPT_DEBUG + * + * Set the debug mode for executed scripts. + * + * Time complexity: O(1) + + * - Valid values for mode: "YES", "SYNC", "NO" + * Annotated return value: simple-string + */ +int NWNX_Redis_SCRIPT_DEBUG( + // Redis type: enum + string mode +); + +/** + * SCRIPT_EXISTS + * + * Check existence of scripts in the script cache. + * + * Time complexity: O(N) with N being the number of scripts to check (so checking a single + * script is an O(1) operation). + * Annotated return value: array + */ +int NWNX_Redis_SCRIPT_EXISTS( + string sha1 +); + +/** + * SCRIPT_FLUSH + * + * Remove all the scripts from the script cache. + * + * Time complexity: O(N) with N being the number of scripts in cache + * Annotated return value: simple-string + */ +int NWNX_Redis_SCRIPT_FLUSH(); + +/** + * SCRIPT_KILL + * + * Kill the script currently in execution. + * + * Time complexity: O(1) + * Annotated return value: simple-string + */ +int NWNX_Redis_SCRIPT_KILL(); + +/** + * SCRIPT_LOAD + * + * Load the specified Lua script into the script cache. + * + * Time complexity: O(N) with N being the length in bytes of the script body. + * Annotated return value: bulk-string + */ +int NWNX_Redis_SCRIPT_LOAD( + string script +); + +/** + * SDIFF + * + * Subtract multiple sets + * + * Time complexity: O(N) where N is the total number of elements in all given sets. + * Annotated return value: array + */ +int NWNX_Redis_SDIFF( + string key +); + +/** + * SDIFFSTORE + * + * Subtract multiple sets and store the resulting set in a key + * + * Time complexity: O(N) where N is the total number of elements in all given sets. + * Annotated return value: integer + */ +int NWNX_Redis_SDIFFSTORE( + // Redis type: key + string destination, + string key +); + +/** + * SELECT + * + * Change the selected database for the current connection + * Annotated return value: simple-string + */ +int NWNX_Redis_SELECT( + // Redis type: integer + int index +); + +/** + * SET + * + * Set the string value of a key + * + * Time complexity: O(1) + + * - Valid values for condition: "NX", "XX" + * Annotated return value: simple-string + */ +int NWNX_Redis_SET( + string key, + string value, + // Redis type: enum + string condition = "" +); + +/** + * SETBIT + * + * Sets or clears the bit at offset in the string value stored at key + * + * Time complexity: O(1) + * Annotated return value: integer + */ +int NWNX_Redis_SETBIT( + string key, + // Redis type: integer + int offset, + string value +); + +/** + * SETEX + * + * Set the value and expiration of a key + * + * Time complexity: O(1) + * Annotated return value: simple-string + */ +int NWNX_Redis_SETEX( + string key, + // Redis type: integer + int seconds, + string value +); + +/** + * SETNX + * + * Set the value of a key, only if the key does not exist + * + * Time complexity: O(1) + * Annotated return value: integer + */ +int NWNX_Redis_SETNX( + string key, + string value +); + +/** + * SETRANGE + * + * Overwrite part of a string at key starting at the specified offset + * + * Time complexity: O(1), not counting the time taken to copy the new string in place. Usually, + * this string is very small so the amortized complexity is O(1). Otherwise, + * complexity is O(M) with M being the length of the value argument. + * Annotated return value: integer + */ +int NWNX_Redis_SETRANGE( + string key, + // Redis type: integer + int offset, + string value +); + +/** + * SHUTDOWN + * + * Synchronously save the dataset to disk and then shut down the server + + * - Valid values for save_mode: "NOSAVE", "SAVE" + * Annotated return value: simple-string + */ +int NWNX_Redis_SHUTDOWN( + // Redis type: enum + string save_mode = "" +); + +/** + * SINTER + * + * Intersect multiple sets + * + * Time complexity: O(N*M) worst case where N is the cardinality of the smallest set and M is + * the number of sets. + * Annotated return value: array + */ +int NWNX_Redis_SINTER( + string key +); + +/** + * SINTERSTORE + * + * Intersect multiple sets and store the resulting set in a key + * + * Time complexity: O(N*M) worst case where N is the cardinality of the smallest set and M is + * the number of sets. + * Annotated return value: integer + */ +int NWNX_Redis_SINTERSTORE( + // Redis type: key + string destination, + string key +); + +/** + * SISMEMBER + * + * Determine if a given value is a member of a set + * + * Time complexity: O(1) + * Annotated return value: integer + */ +int NWNX_Redis_SISMEMBER( + string key, + string member +); + +/** + * SLAVEOF + * + * Make the server a replica of another instance, or promote it as master. Deprecated starting with Redis 5. Use REPLICAOF instead. + * Annotated return value: simple-string + */ +int NWNX_Redis_SLAVEOF( + string host, + string port +); + +/** + * REPLICAOF + * + * Make the server a replica of another instance, or promote it as master. + * Annotated return value: simple-string + */ +int NWNX_Redis_REPLICAOF( + string host, + string port +); + +/** + * SLOWLOG + * + * Manages the Redis slow queries log + * Annotated return value: + */ +int NWNX_Redis_SLOWLOG( + string subcommand, + string argument = "" +); + +/** + * SMEMBERS + * + * Get all the members in a set + * + * Time complexity: O(N) where N is the set cardinality. + * Annotated return value: array + */ +int NWNX_Redis_SMEMBERS( + string key +); + +/** + * SMOVE + * + * Move a member from one set to another + * + * Time complexity: O(1) + * Annotated return value: integer + */ +int NWNX_Redis_SMOVE( + // Redis type: key + string source, + // Redis type: key + string destination, + string member +); + +/** + * SORT + * + * Sort the elements in a list, set or sorted set + * + * Time complexity: O(N+M*log(M)) where N is the number of elements in the list or set to sort, + * and M the number of returned elements. When the elements are not sorted, + * complexity is currently O(N) as there is a copy step that will be avoided in + * next releases. + + * - Valid values for order: "ASC", "DESC" + + * - Valid values for sorting: "ALPHA" + * Annotated return value: array + */ +int NWNX_Redis_SORT( + string key, + // Redis type: pattern + string by_pattern = "", + // Redis type: integer + int limit_offset = 0, + // Redis type: integer + int limit_count = 0, + string get_pattern = "", + // Redis type: enum + string order = "", + // Redis type: enum + string sorting = "", + // Redis type: key + string store_destination = "" +); + +/** + * SPOP + * + * Remove and return one or multiple random members from a set + * + * Time complexity: O(1) + * Annotated return value: bulk-string + */ +int NWNX_Redis_SPOP( + string key, + // Redis type: integer + int count = 0 +); + +/** + * SRANDMEMBER + * + * Get one or multiple random members from a set + * + * Time complexity: Without the count argument O(1), otherwise O(N) where N is the absolute + * value of the passed count. + * Annotated return value: bulk-string + */ +int NWNX_Redis_SRANDMEMBER( + string key, + // Redis type: integer + int count = 0 +); + +/** + * SREM + * + * Remove one or more members from a set + * + * Time complexity: O(N) where N is the number of members to be removed. + * Annotated return value: integer + */ +int NWNX_Redis_SREM( + string key, + string member +); + +/** + * STRLEN + * + * Get the length of the value stored in a key + * + * Time complexity: O(1) + * Annotated return value: integer + */ +int NWNX_Redis_STRLEN( + string key +); + +/** + * SUNION + * + * Add multiple sets + * + * Time complexity: O(N) where N is the total number of elements in all given sets. + * Annotated return value: array + */ +int NWNX_Redis_SUNION( + string key +); + +/** + * SUNIONSTORE + * + * Add multiple sets and store the resulting set in a key + * + * Time complexity: O(N) where N is the total number of elements in all given sets. + * Annotated return value: integer + */ +int NWNX_Redis_SUNIONSTORE( + // Redis type: key + string destination, + string key +); + +/** + * SWAPDB + * + * Swaps two Redis databases + * Annotated return value: simple-string + */ +int NWNX_Redis_SWAPDB( + // Redis type: integer + int index, + // Redis type: integer + int index_1 +); + +/** + * SYNC + * + * Internal command used for replication + * Annotated return value: + */ +int NWNX_Redis_SYNC(); + +/** + * TIME + * + * Return the current server time + * + * Time complexity: O(1) + * Annotated return value: array + */ +int NWNX_Redis_TIME(); + +/** + * TOUCH + * + * Alters the last access time of a key(s). Returns the number of existing keys specified. + * + * Time complexity: O(N) where N is the number of keys that will be touched. + * Annotated return value: integer + */ +int NWNX_Redis_TOUCH( + string key +); + +/** + * TTL + * + * Get the time to live for a key + * + * Time complexity: O(1) + * Annotated return value: integer + */ +int NWNX_Redis_TTL( + string key +); + +/** + * TYPE + * + * Determine the type stored at key + * + * Time complexity: O(1) + * Annotated return value: simple-string + */ +int NWNX_Redis_TYPE( + string key +); + +/** + * UNLINK + * + * Delete a key asynchronously in another thread. Otherwise it is just as DEL, but non blocking. + * + * Time complexity: O(1) for each key removed regardless of its size. Then the command does O(N) + * work in a different thread in order to reclaim memory, where N is the number + * of allocations the deleted objects where composed of. + * Annotated return value: integer + */ +int NWNX_Redis_UNLINK( + string key +); + +/** + * UNWATCH + * + * Forget about all watched keys + * + * Time complexity: O(1) + * Annotated return value: simple-string + */ +int NWNX_Redis_UNWATCH(); + +/** + * WAIT + * + * Wait for the synchronous replication of all the write commands sent in the context of the current connection + * + * Time complexity: O(1) + * Annotated return value: integer + */ +int NWNX_Redis_WAIT( + // Redis type: integer + int numreplicas, + // Redis type: integer + int timeout +); + +/** + * WATCH + * + * Watch the given keys to determine execution of the MULTI/EXEC block + * + * Time complexity: O(1) for every key. + * Annotated return value: simple-string + */ +int NWNX_Redis_WATCH( + string key +); + +/** + * ZADD + * + * Add one or more members to a sorted set, or update its score if it already exists + * + * Time complexity: O(log(N)) for each item added, where N is the number of elements in the + * sorted set. + + * - Valid values for condition: "NX", "XX" + + * - Valid values for change: "CH" + + * - Valid values for increment: "INCR" + * Annotated return value: integer + */ +int NWNX_Redis_ZADD( + string key, + // Redis type: enum + string condition = "", + // Redis type: enum + string change = "", + // Redis type: enum + string increment = "", + // Redis type: double + float score = 0.0, + string member = "" +); + +/** + * ZCARD + * + * Get the number of members in a sorted set + * + * Time complexity: O(1) + * Annotated return value: integer + */ +int NWNX_Redis_ZCARD( + string key +); + +/** + * ZCOUNT + * + * Count the members in a sorted set with scores within the given values + * + * Time complexity: O(log(N)) with N being the number of elements in the sorted set. + * Annotated return value: integer + */ +int NWNX_Redis_ZCOUNT( + string key, + // Redis type: double + float min, + // Redis type: double + float max +); + +/** + * ZINCRBY + * + * Increment the score of a member in a sorted set + * + * Time complexity: O(log(N)) where N is the number of elements in the sorted set. + * Annotated return value: bulk-string + */ +int NWNX_Redis_ZINCRBY( + string key, + // Redis type: integer + int increment, + string member +); + +/** + * ZINTERSTORE + * + * Intersect multiple sorted sets and store the resulting sorted set in a new key + * + * Time complexity: O(N*K)+O(M*log(M)) worst case with N being the smallest input sorted set, K + * being the number of input sorted sets and M being the number of elements in + * the resulting sorted set. + + * - Valid values for aggregate_aggregate: "SUM", "MIN", "MAX" + * Annotated return value: integer + */ +int NWNX_Redis_ZINTERSTORE( + // Redis type: key + string destination, + // Redis type: integer + int numkeys, + string key, + // Redis type: integer + int weights_weight = 0, + // Redis type: enum + string aggregate_aggregate = "" +); + +/** + * ZLEXCOUNT + * + * Count the number of members in a sorted set between a given lexicographical range + * + * Time complexity: O(log(N)) with N being the number of elements in the sorted set. + * Annotated return value: integer + */ +int NWNX_Redis_ZLEXCOUNT( + string key, + string min, + string max +); + +/** + * ZPOPMAX + * + * Remove and return members with the highest scores in a sorted set + * + * Time complexity: O(log(N)*M) with N being the number of elements in the sorted set, and M + * being the number of elements popped. + * Annotated return value: array + */ +int NWNX_Redis_ZPOPMAX( + string key, + // Redis type: integer + int count = 0 +); + +/** + * ZPOPMIN + * + * Remove and return members with the lowest scores in a sorted set + * + * Time complexity: O(log(N)*M) with N being the number of elements in the sorted set, and M + * being the number of elements popped. + * Annotated return value: array + */ +int NWNX_Redis_ZPOPMIN( + string key, + // Redis type: integer + int count = 0 +); + +/** + * ZRANGE + * + * Return a range of members in a sorted set, by index + * + * Time complexity: O(log(N)+M) with N being the number of elements in the sorted set and M the + * number of elements returned. + + * - Valid values for withscores: "WITHSCORES" + * Annotated return value: array + */ +int NWNX_Redis_ZRANGE( + string key, + // Redis type: integer + int start, + // Redis type: integer + int stop, + // Redis type: enum + string withscores = "" +); + +/** + * ZRANGEBYLEX + * + * Return a range of members in a sorted set, by lexicographical range + * + * Time complexity: O(log(N)+M) with N being the number of elements in the sorted set and M the + * number of elements being returned. If M is constant (e.g. always asking for + * the first 10 elements with LIMIT), you can consider it O(log(N)). + * Annotated return value: array + */ +int NWNX_Redis_ZRANGEBYLEX( + string key, + string min, + string max, + // Redis type: integer + int limit_offset = 0, + // Redis type: integer + int limit_count = 0 +); + +/** + * ZREVRANGEBYLEX + * + * Return a range of members in a sorted set, by lexicographical range, ordered from higher to lower strings. + * + * Time complexity: O(log(N)+M) with N being the number of elements in the sorted set and M the + * number of elements being returned. If M is constant (e.g. always asking for + * the first 10 elements with LIMIT), you can consider it O(log(N)). + * Annotated return value: array + */ +int NWNX_Redis_ZREVRANGEBYLEX( + string key, + string max, + string min, + // Redis type: integer + int limit_offset = 0, + // Redis type: integer + int limit_count = 0 +); + +/** + * ZRANGEBYSCORE + * + * Return a range of members in a sorted set, by score + * + * Time complexity: O(log(N)+M) with N being the number of elements in the sorted set and M the + * number of elements being returned. If M is constant (e.g. always asking for + * the first 10 elements with LIMIT), you can consider it O(log(N)). + + * - Valid values for withscores: "WITHSCORES" + * Annotated return value: array + */ +int NWNX_Redis_ZRANGEBYSCORE( + string key, + // Redis type: double + float min, + // Redis type: double + float max, + // Redis type: enum + string withscores = "", + // Redis type: integer + int limit_offset = 0, + // Redis type: integer + int limit_count = 0 +); + +/** + * ZRANK + * + * Determine the index of a member in a sorted set + * + * Time complexity: O(log(N)) + * Annotated return value: integer + */ +int NWNX_Redis_ZRANK( + string key, + string member +); + +/** + * ZREM + * + * Remove one or more members from a sorted set + * + * Time complexity: O(M*log(N)) with N being the number of elements in the sorted set and M the + * number of elements to be removed. + * Annotated return value: integer + */ +int NWNX_Redis_ZREM( + string key, + string member +); + +/** + * ZREMRANGEBYLEX + * + * Remove all members in a sorted set between the given lexicographical range + * + * Time complexity: O(log(N)+M) with N being the number of elements in the sorted set and M the + * number of elements removed by the operation. + * Annotated return value: integer + */ +int NWNX_Redis_ZREMRANGEBYLEX( + string key, + string min, + string max +); + +/** + * ZREMRANGEBYRANK + * + * Remove all members in a sorted set within the given indexes + * + * Time complexity: O(log(N)+M) with N being the number of elements in the sorted set and M the + * number of elements removed by the operation. + * Annotated return value: integer + */ +int NWNX_Redis_ZREMRANGEBYRANK( + string key, + // Redis type: integer + int start, + // Redis type: integer + int stop +); + +/** + * ZREMRANGEBYSCORE + * + * Remove all members in a sorted set within the given scores + * + * Time complexity: O(log(N)+M) with N being the number of elements in the sorted set and M the + * number of elements removed by the operation. + * Annotated return value: integer + */ +int NWNX_Redis_ZREMRANGEBYSCORE( + string key, + // Redis type: double + float min, + // Redis type: double + float max +); + +/** + * ZREVRANGE + * + * Return a range of members in a sorted set, by index, with scores ordered from high to low + * + * Time complexity: O(log(N)+M) with N being the number of elements in the sorted set and M the + * number of elements returned. + + * - Valid values for withscores: "WITHSCORES" + * Annotated return value: array + */ +int NWNX_Redis_ZREVRANGE( + string key, + // Redis type: integer + int start, + // Redis type: integer + int stop, + // Redis type: enum + string withscores = "" +); + +/** + * ZREVRANGEBYSCORE + * + * Return a range of members in a sorted set, by score, with scores ordered from high to low + * + * Time complexity: O(log(N)+M) with N being the number of elements in the sorted set and M the + * number of elements being returned. If M is constant (e.g. always asking for + * the first 10 elements with LIMIT), you can consider it O(log(N)). + + * - Valid values for withscores: "WITHSCORES" + * Annotated return value: array + */ +int NWNX_Redis_ZREVRANGEBYSCORE( + string key, + // Redis type: double + float max, + // Redis type: double + float min, + // Redis type: enum + string withscores = "", + // Redis type: integer + int limit_offset = 0, + // Redis type: integer + int limit_count = 0 +); + +/** + * ZREVRANK + * + * Determine the index of a member in a sorted set, with scores ordered from high to low + * + * Time complexity: O(log(N)) + * Annotated return value: integer + */ +int NWNX_Redis_ZREVRANK( + string key, + string member +); + +/** + * ZSCORE + * + * Get the score associated with the given member in a sorted set + * + * Time complexity: O(1) + * Annotated return value: bulk-string + */ +int NWNX_Redis_ZSCORE( + string key, + string member +); + +/** + * ZUNIONSTORE + * + * Add multiple sorted sets and store the resulting sorted set in a new key + * + * Time complexity: O(N)+O(M log(M)) with N being the sum of the sizes of the input sorted sets, + * and M being the number of elements in the resulting sorted set. + + * - Valid values for aggregate_aggregate: "SUM", "MIN", "MAX" + * Annotated return value: integer + */ +int NWNX_Redis_ZUNIONSTORE( + // Redis type: key + string destination, + // Redis type: integer + int numkeys, + string key, + // Redis type: integer + int weights_weight = 0, + // Redis type: enum + string aggregate_aggregate = "" +); + +/** + * SCAN + * + * Incrementally iterate the keys space + * + * 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: + */ +int NWNX_Redis_SCAN( + // Redis type: integer + int cursor, + // Redis type: pattern + string match_pattern = "", + // Redis type: integer + int count_count = 0, + string type_type = "" +); + +/** + * SSCAN + * + * Incrementally iterate Set elements + * + * 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: + */ +int NWNX_Redis_SSCAN( + string key, + // Redis type: integer + int cursor, + // Redis type: pattern + string match_pattern = "", + // Redis type: integer + int count_count = 0 +); + +/** + * HSCAN + * + * Incrementally iterate hash fields and associated values + * + * 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: + */ +int NWNX_Redis_HSCAN( + string key, + // Redis type: integer + int cursor, + // Redis type: pattern + string match_pattern = "", + // Redis type: integer + int count_count = 0 +); + +/** + * ZSCAN + * + * Incrementally iterate sorted sets elements and associated scores + * + * 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: + */ +int NWNX_Redis_ZSCAN( + string key, + // Redis type: integer + int cursor, + // Redis type: pattern + string match_pattern = "", + // Redis type: integer + int count_count = 0 +); + +/** + * XINFO + * + * Get information on streams and consumer groups + * + * Time complexity: O(N) with N being the number of returned items for the subcommands CONSUMERS + * and GROUPS. The STREAM subcommand is O(log N) with N being the number of + * items in the stream. + + * - Valid values for help: "HELP" + * Annotated return value: + */ +int NWNX_Redis_XINFO( + // Redis type: key + string consumers_key = "", + string consumers_groupname = "", + // Redis type: key + string groups_key = "", + // Redis type: key + string stream_key = "", + // Redis type: enum + string help = "" +); + +/** + * XADD + * + * Appends a new entry to a stream + * + * Time complexity: O(1) + * Annotated return value: bulk-string + */ +int NWNX_Redis_XADD( + string key, + string ID, + // Redis type: value + string field, + string str +); + +/** + * XTRIM + * + * Trims the stream to (approximately if '~' is passed) a certain size + * + * Time complexity: O(N), with N being the number of evicted entries. Constant times are very + * small however, since entries are organized in macro nodes containing + * multiple entries that can be released with a single deallocation. + + * - Valid values for strategy: "MAXLEN" + + * - Valid values for approx: "~" + * Annotated return value: integer + */ +int NWNX_Redis_XTRIM( + string key, + // Redis type: enum + string strategy, + // Redis type: enum + string approx = "", + // Redis type: integer + int count = 0 +); + +/** + * XDEL + * + * Removes the specified entries from the stream. Returns the number of items actually deleted, that may be different from the number of IDs passed in case certain IDs do not exist. + * + * Time complexity: O(1) for each single item to delete in the stream, regardless of the stream + * size. + * Annotated return value: integer + */ +int NWNX_Redis_XDEL( + string key, + string ID +); + +/** + * XRANGE + * + * Return a range of elements in a stream, with IDs matching the specified IDs interval + * + * Time complexity: O(N) with N being the number of elements being returned. If N is constant + * (e.g. always asking for the first 10 elements with COUNT), you can consider + * it O(1). + * Annotated return value: array + */ +int NWNX_Redis_XRANGE( + string key, + string start, + string end, + // Redis type: integer + int count_count = 0 +); + +/** + * XREVRANGE + * + * Return a range of elements in a stream, with IDs matching the specified IDs interval, in reverse order (from greater to smaller IDs) compared to XRANGE + * + * Time complexity: O(N) with N being the number of elements returned. If N is constant (e.g. + * always asking for the first 10 elements with COUNT), you can consider it + * O(1). + * Annotated return value: array + */ +int NWNX_Redis_XREVRANGE( + string key, + string end, + string start, + // Redis type: integer + int count_count = 0 +); + +/** + * XLEN + * + * Return the number of entries in a stream + * + * Time complexity: O(1) + * Annotated return value: integer + */ +int NWNX_Redis_XLEN( + string key +); + +/** + * XREAD + * + * Return never seen elements in multiple streams, with IDs greater than the ones reported by the caller for each stream. Can block. + * + * Time complexity: For each stream mentioned: O(N) with N being the number of elements being + * returned, it means that XREAD-ing with a fixed COUNT is O(1). Note that when + * the BLOCK option is used, XADD will pay O(M) time in order to serve the M + * clients blocked on the stream getting new data. + + * - Valid values for streams: "STREAMS" + * Annotated return value: array + */ +int NWNX_Redis_XREAD( + // Redis type: integer + int count_count = 0, + // Redis type: integer + int block_milliseconds = 0, + // Redis type: enum + string streams = "", + string key = "", + string ID = "" +); + +/** + * XGROUP + * + * Create, destroy, and manage consumer groups. + * + * 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: + */ +int NWNX_Redis_XGROUP( + // Redis type: key + string create_key = "", + string create_groupname = "", + string create_id_or__ = "", + // Redis type: key + string setid_key = "", + string setid_groupname = "", + string setid_id_or__ = "", + // Redis type: key + string destroy_key = "", + string destroy_groupname = "", + // Redis type: key + string delconsumer_key = "", + string delconsumer_groupname = "", + string delconsumer_consumername = "" +); + +/** + * XREADGROUP + * + * Return new entries from a stream using a consumer group, or access the history of the pending entries for a given consumer. Can block. + * + * Time complexity: For each stream mentioned: O(M) with M being the number of elements + * returned. If M is constant (e.g. always asking for the first 10 elements + * with COUNT), you can consider it O(1). On the other side when XREADGROUP + * blocks, XADD will pay the O(N) time in order to serve the N clients blocked + * on the stream getting new data. + + * - Valid values for noack: "NOACK" + + * - Valid values for streams: "STREAMS" + * Annotated return value: + */ +int NWNX_Redis_XREADGROUP( + string group_group, + string group_consumer, + // Redis type: integer + int count_count = 0, + // Redis type: integer + int block_milliseconds = 0, + // Redis type: enum + string noack = "", + // Redis type: enum + string streams = "", + string key = "", + string ID = "" +); + +/** + * XACK + * + * Marks a pending message as correctly processed, effectively removing it from the pending entries list of the consumer group. Return value of the command is the number of messages successfully acknowledged, that is, the IDs we were actually able to resolve in the PEL. + * + * Time complexity: O(1) for each message ID processed. + * Annotated return value: integer + */ +int NWNX_Redis_XACK( + string key, + string group, + string ID +); + +/** + * XCLAIM + * + * Changes (or acquires) ownership of a message in a consumer group, as if the message was delivered to the specified consumer. + * + * Time complexity: O(log N) with N being the number of messages in the PEL of the consumer + * group. + * Annotated return value: array + */ +int NWNX_Redis_XCLAIM( + string key, + string group, + string consumer, + string min_idle_time, + string ID, + // Redis type: integer + int idle_ms = 0, + // Redis type: integer + int time_ms_unix_time = 0, + // Redis type: integer + int retrycount_count = 0 +); + +/** + * XPENDING + * + * Return information and entries from a stream consumer group pending entries list, that are messages fetched but never acknowledged. + * + * Time complexity: O(N) with N being the number of elements returned, so asking for a small + * fixed number of entries per call is O(1). When the command returns just the + * summary it runs in O(1) time assuming the list of consumers is small, + * otherwise there is additional O(N) time needed to iterate every consumer. + * Annotated return value: array + */ +int NWNX_Redis_XPENDING( + string key, + string group, + string start = "", + string end = "", + // Redis type: integer + int count = 0, + string consumer = "" +); + + + +// Implementation below +int NWNX_Redis_APPEND( + string key, + string value +) { + NWNXPushString("APPEND"); + NWNXPushString(key); + NWNXPushString(value); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_AUTH( + string password +) { + NWNXPushString("AUTH"); + NWNXPushString(password); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_BGREWRITEAOF() { + NWNXPushString("BGREWRITEAOF"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_BGSAVE() { + NWNXPushString("BGSAVE"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_BITCOUNT( + string key, + // Redis type: integer + int start = 0, + // Redis type: integer + int end = 0 +) { + 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( + string key, + // Redis type: type + string get_type = "", + // Redis type: integer + int get_offset = 0, + // Redis type: type + string set_type = "", + // Redis type: integer + int set_offset = 0, + // Redis type: integer + int set_value = 0, + // Redis type: type + string incrby_type = "", + // Redis type: integer + int incrby_offset = 0, + // Redis type: integer + int incrby_increment = 0 +) { + 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( + string operation, + // Redis type: key + string destkey, + string key +) { + NWNXPushString("BITOP"); + NWNXPushString(operation); + NWNXPushString(destkey); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_BITPOS( + string key, + // Redis type: integer + int bit, + // Redis type: integer + int start = 0, + // Redis type: integer + int end = 0 +) { + 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( + string key, + // Redis type: integer + int timeout +) { + NWNXPushString("BLPOP"); + NWNXPushString(key); + NWNXPushString(IntToString(timeout)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_BRPOP( + string key, + // Redis type: integer + int timeout +) { + NWNXPushString("BRPOP"); + NWNXPushString(key); + NWNXPushString(IntToString(timeout)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_BRPOPLPUSH( + // Redis type: key + string source, + // Redis type: key + string destination, + // Redis type: integer + int timeout +) { + NWNXPushString("BRPOPLPUSH"); + NWNXPushString(source); + NWNXPushString(destination); + NWNXPushString(IntToString(timeout)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_BZPOPMIN( + string key, + // Redis type: integer + int timeout +) { + NWNXPushString("BZPOPMIN"); + NWNXPushString(key); + NWNXPushString(IntToString(timeout)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_BZPOPMAX( + string key, + // Redis type: integer + int timeout +) { + NWNXPushString("BZPOPMAX"); + NWNXPushString(key); + NWNXPushString(IntToString(timeout)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_CLIENT_ID() { + NWNXPushString("CLIENT_ID"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_CLIENT_KILL( + string ip_port = "", + // Redis type: integer + int id_client_id = 0, + string addr_ip_port = "", + string skipme_yes_no = "" +) { + 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() { + NWNXPushString("CLIENT_LIST"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_CLIENT_GETNAME() { + NWNXPushString("CLIENT_GETNAME"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_CLIENT_PAUSE( + // Redis type: integer + int timeout +) { + NWNXPushString("CLIENT_PAUSE"); + NWNXPushString(IntToString(timeout)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_CLIENT_REPLY( + // Redis type: enum + string reply_mode +) { + NWNXPushString("CLIENT_REPLY"); + NWNXPushString(reply_mode); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_CLIENT_SETNAME( + string connection_name +) { + NWNXPushString("CLIENT_SETNAME"); + NWNXPushString(connection_name); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_CLIENT_UNBLOCK( + string client_id, + // Redis type: enum + string unblock_type = "" +) { + 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 +) { + NWNXPushString("CLUSTER_ADDSLOTS"); + NWNXPushString(IntToString(slot)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_CLUSTER_COUNT_FAILURE_REPORTS( + string node_id +) { + NWNXPushString("CLUSTER_COUNT_FAILURE_REPORTS"); + NWNXPushString(node_id); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_CLUSTER_COUNTKEYSINSLOT( + // Redis type: integer + int slot +) { + NWNXPushString("CLUSTER_COUNTKEYSINSLOT"); + NWNXPushString(IntToString(slot)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_CLUSTER_DELSLOTS( + // Redis type: integer + int slot +) { + NWNXPushString("CLUSTER_DELSLOTS"); + NWNXPushString(IntToString(slot)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_CLUSTER_FAILOVER( + // Redis type: enum + string options = "" +) { + NWNXPushString("CLUSTER_FAILOVER"); + if (options != "") NWNXPushString(options); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_CLUSTER_FORGET( + string node_id +) { + NWNXPushString("CLUSTER_FORGET"); + NWNXPushString(node_id); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_CLUSTER_GETKEYSINSLOT( + // Redis type: integer + int slot, + // Redis type: integer + int count +) { + NWNXPushString("CLUSTER_GETKEYSINSLOT"); + NWNXPushString(IntToString(slot)); + NWNXPushString(IntToString(count)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_CLUSTER_INFO() { + NWNXPushString("CLUSTER_INFO"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_CLUSTER_KEYSLOT( + string key +) { + NWNXPushString("CLUSTER_KEYSLOT"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_CLUSTER_MEET( + string ip, + // Redis type: integer + int port +) { + NWNXPushString("CLUSTER_MEET"); + NWNXPushString(ip); + NWNXPushString(IntToString(port)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_CLUSTER_NODES() { + NWNXPushString("CLUSTER_NODES"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_CLUSTER_REPLICATE( + string node_id +) { + NWNXPushString("CLUSTER_REPLICATE"); + NWNXPushString(node_id); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_CLUSTER_RESET( + // Redis type: enum + string reset_type = "" +) { + NWNXPushString("CLUSTER_RESET"); + if (reset_type != "") NWNXPushString(reset_type); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_CLUSTER_SAVECONFIG() { + NWNXPushString("CLUSTER_SAVECONFIG"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_CLUSTER_SET_CONFIG_EPOCH( + // Redis type: integer + int config_epoch +) { + NWNXPushString("CLUSTER_SET_CONFIG_EPOCH"); + NWNXPushString(IntToString(config_epoch)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_CLUSTER_SETSLOT( + // Redis type: integer + int slot, + // Redis type: enum + string subcommand, + string node_id = "" +) { + 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 +) { + NWNXPushString("CLUSTER_SLAVES"); + NWNXPushString(node_id); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_CLUSTER_REPLICAS( + string node_id +) { + NWNXPushString("CLUSTER_REPLICAS"); + NWNXPushString(node_id); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_CLUSTER_SLOTS() { + NWNXPushString("CLUSTER_SLOTS"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_COMMAND() { + NWNXPushString("COMMAND"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_COMMAND_COUNT() { + NWNXPushString("COMMAND_COUNT"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_COMMAND_GETKEYS() { + NWNXPushString("COMMAND_GETKEYS"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_COMMAND_INFO( + string command_name +) { + NWNXPushString("COMMAND_INFO"); + NWNXPushString(command_name); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_CONFIG_GET( + string parameter +) { + NWNXPushString("CONFIG_GET"); + NWNXPushString(parameter); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_CONFIG_REWRITE() { + NWNXPushString("CONFIG_REWRITE"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_CONFIG_SET( + string parameter, + string value +) { + NWNXPushString("CONFIG_SET"); + NWNXPushString(parameter); + NWNXPushString(value); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_CONFIG_RESETSTAT() { + NWNXPushString("CONFIG_RESETSTAT"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_DBSIZE() { + NWNXPushString("DBSIZE"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_DEBUG_OBJECT( + string key +) { + NWNXPushString("DEBUG_OBJECT"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_DEBUG_SEGFAULT() { + NWNXPushString("DEBUG_SEGFAULT"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_DECR( + string key +) { + NWNXPushString("DECR"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_DECRBY( + string key, + // Redis type: integer + int decrement +) { + NWNXPushString("DECRBY"); + NWNXPushString(key); + NWNXPushString(IntToString(decrement)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_DEL( + string key +) { + NWNXPushString("DEL"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_DISCARD() { + NWNXPushString("DISCARD"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_DUMP( + string key +) { + NWNXPushString("DUMP"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_ECHO( + string message +) { + NWNXPushString("ECHO"); + NWNXPushString(message); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_EVAL( + string script, + // Redis type: integer + int numkeys, + string key, + string arg +) { + NWNXPushString("EVAL"); + NWNXPushString(script); + NWNXPushString(IntToString(numkeys)); + NWNXPushString(key); + NWNXPushString(arg); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_EVALSHA( + string sha1, + // Redis type: integer + int numkeys, + string key, + string arg +) { + NWNXPushString("EVALSHA"); + NWNXPushString(sha1); + NWNXPushString(IntToString(numkeys)); + NWNXPushString(key); + NWNXPushString(arg); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_EXEC() { + NWNXPushString("EXEC"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_EXISTS( + string key +) { + NWNXPushString("EXISTS"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_EXPIRE( + string key, + // Redis type: integer + int seconds +) { + NWNXPushString("EXPIRE"); + NWNXPushString(key); + NWNXPushString(IntToString(seconds)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_EXPIREAT( + string key, + // Redis type: posix time + string timestamp +) { + NWNXPushString("EXPIREAT"); + NWNXPushString(key); + NWNXPushString(timestamp); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_FLUSHALL( + // Redis type: enum + string async = "" +) { + NWNXPushString("FLUSHALL"); + if (async != "") NWNXPushString(async); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_FLUSHDB( + // Redis type: enum + string async = "" +) { + NWNXPushString("FLUSHDB"); + if (async != "") NWNXPushString(async); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_GEOADD( + string key, + // Redis type: double + float longitude, + // Redis type: double + float latitude, + string member +) { + 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 +) { + NWNXPushString("GEOHASH"); + NWNXPushString(key); + NWNXPushString(member); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_GEOPOS( + string key, + string member +) { + NWNXPushString("GEOPOS"); + NWNXPushString(key); + NWNXPushString(member); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_GEODIST( + string key, + string member1, + string member2, + string unit = "" +) { + NWNXPushString("GEODIST"); + NWNXPushString(key); + NWNXPushString(member1); + NWNXPushString(member2); + if (unit != "") NWNXPushString(unit); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_GEORADIUS( + string key, + // Redis type: double + float longitude, + // Redis type: double + float latitude, + // Redis type: double + float radius, + // Redis type: enum + string unit, + // Redis type: enum + string withcoord = "", + // Redis type: enum + string withdist = "", + // Redis type: enum + string withhash = "", + // Redis type: integer + int count_count = 0, + // Redis type: enum + string order = "", + // Redis type: key + string store_key = "", + // Redis type: key + string storedist_key = "" +) { + 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( + string key, + string member, + // Redis type: double + float radius, + // Redis type: enum + string unit, + // Redis type: enum + string withcoord = "", + // Redis type: enum + string withdist = "", + // Redis type: enum + string withhash = "", + // Redis type: integer + int count_count = 0, + // Redis type: enum + string order = "", + // Redis type: key + string store_key = "", + // Redis type: key + string storedist_key = "" +) { + 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 +) { + NWNXPushString("GET"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_GETBIT( + string key, + // Redis type: integer + int offset +) { + NWNXPushString("GETBIT"); + NWNXPushString(key); + NWNXPushString(IntToString(offset)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_GETRANGE( + string key, + // Redis type: integer + int start, + // Redis type: integer + int end +) { + NWNXPushString("GETRANGE"); + NWNXPushString(key); + NWNXPushString(IntToString(start)); + NWNXPushString(IntToString(end)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_GETSET( + string key, + string value +) { + NWNXPushString("GETSET"); + NWNXPushString(key); + NWNXPushString(value); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_HDEL( + string key, + string field +) { + NWNXPushString("HDEL"); + NWNXPushString(key); + NWNXPushString(field); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_HEXISTS( + string key, + string field +) { + NWNXPushString("HEXISTS"); + NWNXPushString(key); + NWNXPushString(field); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_HGET( + string key, + string field +) { + NWNXPushString("HGET"); + NWNXPushString(key); + NWNXPushString(field); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_HGETALL( + string key +) { + NWNXPushString("HGETALL"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_HINCRBY( + string key, + string field, + // Redis type: integer + int increment +) { + NWNXPushString("HINCRBY"); + NWNXPushString(key); + NWNXPushString(field); + NWNXPushString(IntToString(increment)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_HINCRBYFLOAT( + string key, + string field, + // Redis type: double + float increment +) { + NWNXPushString("HINCRBYFLOAT"); + NWNXPushString(key); + NWNXPushString(field); + NWNXPushString(FloatToString(increment, 0)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_HKEYS( + string key +) { + NWNXPushString("HKEYS"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_HLEN( + string key +) { + NWNXPushString("HLEN"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_HMGET( + string key, + string field +) { + NWNXPushString("HMGET"); + NWNXPushString(key); + NWNXPushString(field); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_HMSET( + string key, + string field, + string value +) { + NWNXPushString("HMSET"); + NWNXPushString(key); + NWNXPushString(field); + NWNXPushString(value); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_HSET( + string key, + string field, + string value +) { + NWNXPushString("HSET"); + NWNXPushString(key); + NWNXPushString(field); + NWNXPushString(value); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_HSETNX( + string key, + string field, + string value +) { + NWNXPushString("HSETNX"); + NWNXPushString(key); + NWNXPushString(field); + NWNXPushString(value); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_HSTRLEN( + string key, + string field +) { + NWNXPushString("HSTRLEN"); + NWNXPushString(key); + NWNXPushString(field); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_HVALS( + string key +) { + NWNXPushString("HVALS"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_INCR( + string key +) { + NWNXPushString("INCR"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_INCRBY( + string key, + // Redis type: integer + int increment +) { + NWNXPushString("INCRBY"); + NWNXPushString(key); + NWNXPushString(IntToString(increment)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_INCRBYFLOAT( + string key, + // Redis type: double + float increment +) { + NWNXPushString("INCRBYFLOAT"); + NWNXPushString(key); + NWNXPushString(FloatToString(increment, 0)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_INFO( + string section = "" +) { + NWNXPushString("INFO"); + if (section != "") NWNXPushString(section); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_KEYS( + string pattern +) { + NWNXPushString("KEYS"); + NWNXPushString(pattern); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_LASTSAVE() { + NWNXPushString("LASTSAVE"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_LINDEX( + string key, + // Redis type: integer + int index +) { + NWNXPushString("LINDEX"); + NWNXPushString(key); + NWNXPushString(IntToString(index)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_LINSERT( + string key, + // Redis type: enum + string where, + string pivot, + string value +) { + NWNXPushString("LINSERT"); + NWNXPushString(key); + NWNXPushString(where); + NWNXPushString(pivot); + NWNXPushString(value); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_LLEN( + string key +) { + NWNXPushString("LLEN"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_LPOP( + string key +) { + NWNXPushString("LPOP"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_LPUSH( + string key, + string value +) { + NWNXPushString("LPUSH"); + NWNXPushString(key); + NWNXPushString(value); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_LPUSHX( + string key, + string value +) { + NWNXPushString("LPUSHX"); + NWNXPushString(key); + NWNXPushString(value); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_LRANGE( + string key, + // Redis type: integer + int start, + // Redis type: integer + int stop +) { + NWNXPushString("LRANGE"); + NWNXPushString(key); + NWNXPushString(IntToString(start)); + NWNXPushString(IntToString(stop)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_LREM( + string key, + // Redis type: integer + int count, + string value +) { + NWNXPushString("LREM"); + NWNXPushString(key); + NWNXPushString(IntToString(count)); + NWNXPushString(value); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_LSET( + string key, + // Redis type: integer + int index, + string value +) { + NWNXPushString("LSET"); + NWNXPushString(key); + NWNXPushString(IntToString(index)); + NWNXPushString(value); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_LTRIM( + string key, + // Redis type: integer + int start, + // Redis type: integer + int stop +) { + NWNXPushString("LTRIM"); + NWNXPushString(key); + NWNXPushString(IntToString(start)); + NWNXPushString(IntToString(stop)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_MEMORY_DOCTOR() { + NWNXPushString("MEMORY_DOCTOR"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_MEMORY_HELP() { + NWNXPushString("MEMORY_HELP"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_MEMORY_MALLOC_STATS() { + NWNXPushString("MEMORY_MALLOC_STATS"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_MEMORY_PURGE() { + NWNXPushString("MEMORY_PURGE"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_MEMORY_STATS() { + NWNXPushString("MEMORY_STATS"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_MEMORY_USAGE( + string key, + // Redis type: integer + int samples_count = 0 +) { + 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 +) { + NWNXPushString("MGET"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_MIGRATE( + string host, + string port, + // Redis type: enum + string key, + // Redis type: integer + int destination_db, + // Redis type: integer + int timeout, + // Redis type: enum + string copy = "", + // Redis type: enum + string replace = "", + string auth_password = "", + // Redis type: key + string keys_key = "" +) { + 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() { + NWNXPushString("MONITOR"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_MOVE( + string key, + // Redis type: integer + int db +) { + NWNXPushString("MOVE"); + NWNXPushString(key); + NWNXPushString(IntToString(db)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_MSET( + string key, + string value +) { + NWNXPushString("MSET"); + NWNXPushString(key); + NWNXPushString(value); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_MSETNX( + string key, + string value +) { + NWNXPushString("MSETNX"); + NWNXPushString(key); + NWNXPushString(value); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_MULTI() { + NWNXPushString("MULTI"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_OBJECT( + string subcommand, + string arguments = "" +) { + NWNXPushString("OBJECT"); + NWNXPushString(subcommand); + if (arguments != "") NWNXPushString(arguments); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_PERSIST( + string key +) { + NWNXPushString("PERSIST"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_PEXPIRE( + string key, + // Redis type: integer + int milliseconds +) { + NWNXPushString("PEXPIRE"); + NWNXPushString(key); + NWNXPushString(IntToString(milliseconds)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_PEXPIREAT( + string key, + // Redis type: posix time + string milliseconds_timestamp +) { + NWNXPushString("PEXPIREAT"); + NWNXPushString(key); + NWNXPushString(milliseconds_timestamp); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_PFADD( + string key, + string element +) { + NWNXPushString("PFADD"); + NWNXPushString(key); + NWNXPushString(element); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_PFCOUNT( + string key +) { + NWNXPushString("PFCOUNT"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_PFMERGE( + // Redis type: key + string destkey, + // Redis type: key + string sourcekey +) { + NWNXPushString("PFMERGE"); + NWNXPushString(destkey); + NWNXPushString(sourcekey); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_PING( + string message = "" +) { + NWNXPushString("PING"); + if (message != "") NWNXPushString(message); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_PSETEX( + string key, + // Redis type: integer + int milliseconds, + string value +) { + NWNXPushString("PSETEX"); + NWNXPushString(key); + NWNXPushString(IntToString(milliseconds)); + NWNXPushString(value); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_PUBSUB( + string subcommand, + string argument = "" +) { + NWNXPushString("PUBSUB"); + NWNXPushString(subcommand); + if (argument != "") NWNXPushString(argument); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_PTTL( + string key +) { + NWNXPushString("PTTL"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_PUBLISH( + string channel, + string message +) { + NWNXPushString("PUBLISH"); + NWNXPushString(channel); + NWNXPushString(message); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_QUIT() { + NWNXPushString("QUIT"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_RANDOMKEY() { + NWNXPushString("RANDOMKEY"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_READONLY() { + NWNXPushString("READONLY"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_READWRITE() { + NWNXPushString("READWRITE"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_RENAME( + string key, + // Redis type: key + string newkey +) { + NWNXPushString("RENAME"); + NWNXPushString(key); + NWNXPushString(newkey); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_RENAMENX( + string key, + // Redis type: key + string newkey +) { + NWNXPushString("RENAMENX"); + NWNXPushString(key); + NWNXPushString(newkey); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_RESTORE( + string key, + // Redis type: integer + int ttl, + string serialized_value, + // Redis type: enum + string replace = "", + // Redis type: enum + string absttl = "", + // Redis type: integer + int idletime_seconds = 0, + // Redis type: integer + int freq_frequency = 0 +) { + 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() { + NWNXPushString("ROLE"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_RPOP( + string key +) { + NWNXPushString("RPOP"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_RPOPLPUSH( + // Redis type: key + string source, + // Redis type: key + string destination +) { + NWNXPushString("RPOPLPUSH"); + NWNXPushString(source); + NWNXPushString(destination); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_RPUSH( + string key, + string value +) { + NWNXPushString("RPUSH"); + NWNXPushString(key); + NWNXPushString(value); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_RPUSHX( + string key, + string value +) { + NWNXPushString("RPUSHX"); + NWNXPushString(key); + NWNXPushString(value); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_SADD( + string key, + string member +) { + NWNXPushString("SADD"); + NWNXPushString(key); + NWNXPushString(member); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_SAVE() { + NWNXPushString("SAVE"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_SCARD( + string key +) { + NWNXPushString("SCARD"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_SCRIPT_DEBUG( + // Redis type: enum + string mode +) { + NWNXPushString("SCRIPT_DEBUG"); + NWNXPushString(mode); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_SCRIPT_EXISTS( + string sha1 +) { + NWNXPushString("SCRIPT_EXISTS"); + NWNXPushString(sha1); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_SCRIPT_FLUSH() { + NWNXPushString("SCRIPT_FLUSH"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_SCRIPT_KILL() { + NWNXPushString("SCRIPT_KILL"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_SCRIPT_LOAD( + string script +) { + NWNXPushString("SCRIPT_LOAD"); + NWNXPushString(script); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_SDIFF( + string key +) { + NWNXPushString("SDIFF"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_SDIFFSTORE( + // Redis type: key + string destination, + string key +) { + NWNXPushString("SDIFFSTORE"); + NWNXPushString(destination); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_SELECT( + // Redis type: integer + int index +) { + NWNXPushString("SELECT"); + NWNXPushString(IntToString(index)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_SET( + string key, + string value, + // Redis type: enum + string condition = "" +) { + NWNXPushString("SET"); + NWNXPushString(key); + NWNXPushString(value); + if (condition != "") NWNXPushString(condition); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_SETBIT( + string key, + // Redis type: integer + int offset, + string value +) { + NWNXPushString("SETBIT"); + NWNXPushString(key); + NWNXPushString(IntToString(offset)); + NWNXPushString(value); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_SETEX( + string key, + // Redis type: integer + int seconds, + string value +) { + NWNXPushString("SETEX"); + NWNXPushString(key); + NWNXPushString(IntToString(seconds)); + NWNXPushString(value); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_SETNX( + string key, + string value +) { + NWNXPushString("SETNX"); + NWNXPushString(key); + NWNXPushString(value); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_SETRANGE( + string key, + // Redis type: integer + int offset, + string value +) { + 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 = "" +) { + NWNXPushString("SHUTDOWN"); + if (save_mode != "") NWNXPushString(save_mode); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_SINTER( + string key +) { + NWNXPushString("SINTER"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_SINTERSTORE( + // Redis type: key + string destination, + string key +) { + NWNXPushString("SINTERSTORE"); + NWNXPushString(destination); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_SISMEMBER( + string key, + string member +) { + NWNXPushString("SISMEMBER"); + NWNXPushString(key); + NWNXPushString(member); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_SLAVEOF( + string host, + string port +) { + NWNXPushString("SLAVEOF"); + NWNXPushString(host); + NWNXPushString(port); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_REPLICAOF( + string host, + string port +) { + NWNXPushString("REPLICAOF"); + NWNXPushString(host); + NWNXPushString(port); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_SLOWLOG( + string subcommand, + string argument = "" +) { + NWNXPushString("SLOWLOG"); + NWNXPushString(subcommand); + if (argument != "") NWNXPushString(argument); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_SMEMBERS( + string key +) { + NWNXPushString("SMEMBERS"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_SMOVE( + // Redis type: key + string source, + // Redis type: key + string destination, + string member +) { + NWNXPushString("SMOVE"); + NWNXPushString(source); + NWNXPushString(destination); + NWNXPushString(member); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_SORT( + string key, + // Redis type: pattern + string by_pattern = "", + // Redis type: integer + int limit_offset = 0, + // Redis type: integer + int limit_count = 0, + string get_pattern = "", + // Redis type: enum + string order = "", + // Redis type: enum + string sorting = "", + // Redis type: key + string store_destination = "" +) { + 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( + string key, + // Redis type: integer + int count = 0 +) { + NWNXPushString("SPOP"); + NWNXPushString(key); + if (count != 0) NWNXPushString(IntToString(count)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_SRANDMEMBER( + string key, + // Redis type: integer + int count = 0 +) { + NWNXPushString("SRANDMEMBER"); + NWNXPushString(key); + if (count != 0) NWNXPushString(IntToString(count)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_SREM( + string key, + string member +) { + NWNXPushString("SREM"); + NWNXPushString(key); + NWNXPushString(member); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_STRLEN( + string key +) { + NWNXPushString("STRLEN"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_SUNION( + string key +) { + NWNXPushString("SUNION"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_SUNIONSTORE( + // Redis type: key + string destination, + string key +) { + NWNXPushString("SUNIONSTORE"); + NWNXPushString(destination); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_SWAPDB( + // Redis type: integer + int index, + // Redis type: integer + int index_1 +) { + NWNXPushString("SWAPDB"); + NWNXPushString(IntToString(index)); + NWNXPushString(IntToString(index_1)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_SYNC() { + NWNXPushString("SYNC"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_TIME() { + NWNXPushString("TIME"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_TOUCH( + string key +) { + NWNXPushString("TOUCH"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_TTL( + string key +) { + NWNXPushString("TTL"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_TYPE( + string key +) { + NWNXPushString("TYPE"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_UNLINK( + string key +) { + NWNXPushString("UNLINK"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_UNWATCH() { + NWNXPushString("UNWATCH"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_WAIT( + // Redis type: integer + int numreplicas, + // Redis type: integer + int timeout +) { + NWNXPushString("WAIT"); + NWNXPushString(IntToString(numreplicas)); + NWNXPushString(IntToString(timeout)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_WATCH( + string key +) { + NWNXPushString("WATCH"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_ZADD( + string key, + // Redis type: enum + string condition = "", + // Redis type: enum + string change = "", + // Redis type: enum + string increment = "", + // Redis type: double + float score = 0.0, + string member = "" +) { + 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 +) { + NWNXPushString("ZCARD"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_ZCOUNT( + string key, + // Redis type: double + float min, + // Redis type: double + float max +) { + NWNXPushString("ZCOUNT"); + NWNXPushString(key); + NWNXPushString(FloatToString(min, 0)); + NWNXPushString(FloatToString(max, 0)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_ZINCRBY( + string key, + // Redis type: integer + int increment, + string member +) { + NWNXPushString("ZINCRBY"); + NWNXPushString(key); + NWNXPushString(IntToString(increment)); + NWNXPushString(member); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_ZINTERSTORE( + // Redis type: key + string destination, + // Redis type: integer + int numkeys, + string key, + // Redis type: integer + int weights_weight = 0, + // Redis type: enum + string aggregate_aggregate = "" +) { + 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( + string key, + string min, + string max +) { + NWNXPushString("ZLEXCOUNT"); + NWNXPushString(key); + NWNXPushString(min); + NWNXPushString(max); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_ZPOPMAX( + string key, + // Redis type: integer + int count = 0 +) { + NWNXPushString("ZPOPMAX"); + NWNXPushString(key); + if (count != 0) NWNXPushString(IntToString(count)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_ZPOPMIN( + string key, + // Redis type: integer + int count = 0 +) { + NWNXPushString("ZPOPMIN"); + NWNXPushString(key); + if (count != 0) NWNXPushString(IntToString(count)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_ZRANGE( + string key, + // Redis type: integer + int start, + // Redis type: integer + int stop, + // Redis type: enum + string withscores = "" +) { + NWNXPushString("ZRANGE"); + NWNXPushString(key); + NWNXPushString(IntToString(start)); + NWNXPushString(IntToString(stop)); + if (withscores != "") NWNXPushString(withscores); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_ZRANGEBYLEX( + string key, + string min, + string max, + // Redis type: integer + int limit_offset = 0, + // Redis type: integer + int limit_count = 0 +) { + 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( + string key, + string max, + string min, + // Redis type: integer + int limit_offset = 0, + // Redis type: integer + int limit_count = 0 +) { + 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( + string key, + // Redis type: double + float min, + // Redis type: double + float max, + // Redis type: enum + string withscores = "", + // Redis type: integer + int limit_offset = 0, + // Redis type: integer + int limit_count = 0 +) { + 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 +) { + NWNXPushString("ZRANK"); + NWNXPushString(key); + NWNXPushString(member); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_ZREM( + string key, + string member +) { + NWNXPushString("ZREM"); + NWNXPushString(key); + NWNXPushString(member); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_ZREMRANGEBYLEX( + string key, + string min, + string max +) { + NWNXPushString("ZREMRANGEBYLEX"); + NWNXPushString(key); + NWNXPushString(min); + NWNXPushString(max); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_ZREMRANGEBYRANK( + string key, + // Redis type: integer + int start, + // Redis type: integer + int stop +) { + NWNXPushString("ZREMRANGEBYRANK"); + NWNXPushString(key); + NWNXPushString(IntToString(start)); + NWNXPushString(IntToString(stop)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_ZREMRANGEBYSCORE( + string key, + // Redis type: double + float min, + // Redis type: double + float max +) { + NWNXPushString("ZREMRANGEBYSCORE"); + NWNXPushString(key); + NWNXPushString(FloatToString(min, 0)); + NWNXPushString(FloatToString(max, 0)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_ZREVRANGE( + string key, + // Redis type: integer + int start, + // Redis type: integer + int stop, + // Redis type: enum + string withscores = "" +) { + NWNXPushString("ZREVRANGE"); + NWNXPushString(key); + NWNXPushString(IntToString(start)); + NWNXPushString(IntToString(stop)); + if (withscores != "") NWNXPushString(withscores); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_ZREVRANGEBYSCORE( + string key, + // Redis type: double + float max, + // Redis type: double + float min, + // Redis type: enum + string withscores = "", + // Redis type: integer + int limit_offset = 0, + // Redis type: integer + int limit_count = 0 +) { + 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 +) { + NWNXPushString("ZREVRANK"); + NWNXPushString(key); + NWNXPushString(member); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_ZSCORE( + string key, + string member +) { + NWNXPushString("ZSCORE"); + NWNXPushString(key); + NWNXPushString(member); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_ZUNIONSTORE( + // Redis type: key + string destination, + // Redis type: integer + int numkeys, + string key, + // Redis type: integer + int weights_weight = 0, + // Redis type: enum + string aggregate_aggregate = "" +) { + 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( + // Redis type: integer + int cursor, + // Redis type: pattern + string match_pattern = "", + // Redis type: integer + int count_count = 0, + string type_type = "" +) { + 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( + string key, + // Redis type: integer + int cursor, + // Redis type: pattern + string match_pattern = "", + // Redis type: integer + int count_count = 0 +) { + 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( + string key, + // Redis type: integer + int cursor, + // Redis type: pattern + string match_pattern = "", + // Redis type: integer + int count_count = 0 +) { + 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( + string key, + // Redis type: integer + int cursor, + // Redis type: pattern + string match_pattern = "", + // Redis type: integer + int count_count = 0 +) { + 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( + // Redis type: key + string consumers_key = "", + string consumers_groupname = "", + // Redis type: key + string groups_key = "", + // Redis type: key + string stream_key = "", + // Redis type: enum + string help = "" +) { + 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( + string key, + string ID, + // Redis type: value + string field, + string str +) { + NWNXPushString("XADD"); + NWNXPushString(key); + NWNXPushString(ID); + NWNXPushString(field); + NWNXPushString(str); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_XTRIM( + string key, + // Redis type: enum + string strategy, + // Redis type: enum + string approx = "", + // Redis type: integer + int count = 0 +) { + 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 +) { + NWNXPushString("XDEL"); + NWNXPushString(key); + NWNXPushString(ID); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_XRANGE( + string key, + string start, + string end, + // Redis type: integer + int count_count = 0 +) { + 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( + string key, + string end, + string start, + // Redis type: integer + int count_count = 0 +) { + 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 +) { + NWNXPushString("XLEN"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_XREAD( + // Redis type: integer + int count_count = 0, + // Redis type: integer + int block_milliseconds = 0, + // Redis type: enum + string streams = "", + string key = "", + string ID = "" +) { + 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( + // Redis type: key + string create_key = "", + string create_groupname = "", + string create_id_or__ = "", + // Redis type: key + string setid_key = "", + string setid_groupname = "", + string setid_id_or__ = "", + // Redis type: key + string destroy_key = "", + string destroy_groupname = "", + // Redis type: key + string delconsumer_key = "", + string delconsumer_groupname = "", + string delconsumer_consumername = "" +) { + 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( + string group_group, + string group_consumer, + // Redis type: integer + int count_count = 0, + // Redis type: integer + int block_milliseconds = 0, + // Redis type: enum + string noack = "", + // Redis type: enum + string streams = "", + string key = "", + string ID = "" +) { + 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( + string key, + string group, + string ID +) { + NWNXPushString("XACK"); + NWNXPushString(key); + NWNXPushString(group); + NWNXPushString(ID); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int NWNX_Redis_XCLAIM( + string key, + string group, + string consumer, + string min_idle_time, + string ID, + // Redis type: integer + int idle_ms = 0, + // Redis type: integer + int time_ms_unix_time = 0, + // Redis type: integer + int retrycount_count = 0 +) { + 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( + string key, + string group, + string start = "", + string end = "", + // Redis type: integer + int count = 0, + string consumer = "" +) { + 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 new file mode 100644 index 00000000..ce931a2b --- /dev/null +++ b/_module/nss/nwnx_redis_lib.nss @@ -0,0 +1,107 @@ +/// @addtogroup redis Redis +/// @brief Allows connection and interfacing with a redis server. +/// @{ +/// @file nwnx_redis_lib.nss +/// @brief Allows connection and interfacing with a redis server. + +/// @anchor redis_results +/// @name Redis Results +/// @{ + +/// @brief Array result +const int NWNX_REDIS_RESULT_ARRAY = 1; + +/// This never appears: it is rewritten into STRING for simplicity reasons. +/// const int NWNX_REDIS_RESULT_BULK_STRING = 2; + +/// @brief Error result +/// @note You can retrieve errors as strings. +const int NWNX_REDIS_RESULT_ERROR = 3; + +/// @brief Integer result +/// @warning This cannot represent integers above 32bit. +/// @remark Use NWNX_Redis_GetResultAsString() if you need the string representation. +const int NWNX_REDIS_RESULT_INTEGER = 4; + +/// @brief String result +const int NWNX_REDIS_RESULT_STRING = 5; + +/// @brief Null result +const int NWNX_REDIS_RESULT_NULL = 6; +/// @} + +/// Returns the result type as a int. +int NWNX_Redis_GetResultType(int resultId); + +/// @brief Gets the length of the given result. +/// @param resultId The result id. +/// @return The length or 0 if the given result wasn't a list type. +int NWNX_Redis_GetArrayLength(int resultId); + +/// @brief Gets a list entry as a string. +/// @param resultId The result id. +/// @param idx The index in the list. +/// @return The list entry, will return "" if the given result is not a list, +/// or if the requested index is out of bounds. +int NWNX_Redis_GetArrayElement(int resultId, int idx); + +/// @brief Gets the given result as a float. +/// @param resultId The result id. +/// @return The result as a float. +float NWNX_Redis_GetResultAsFloat(int resultId); + +/// @brief Gets the given result as an integer. +/// @param resultId The result id. +/// @return The result as an integer. +int NWNX_Redis_GetResultAsInt(int resultId); + +/// @brief Gets the given result as a string. +/// @param resultId The result id. +/// @return The result as a string. +string NWNX_Redis_GetResultAsString(int resultId); + +/// @} + +int NWNX_Redis_GetResultType(int resultId) +{ + NWNXPushInt(resultId); + NWNXCall("NWNX_Redis", "GetResultType"); + return NWNXPopInt(); +} + +int NWNX_Redis_GetArrayLength(int resultId) +{ + NWNXPushInt(resultId); + NWNXCall("NWNX_Redis", "GetResultArrayLength"); + return NWNXPopInt(); +} + +// Returns the last +int NWNX_Redis_GetArrayElement(int resultId, int idx) +{ + NWNXPushInt(resultId); + NWNXPushInt(idx); + NWNXCall("NWNX_Redis", "GetResultArrayElement"); + return NWNXPopInt(); +} + +float NWNX_Redis_GetResultAsFloat(int resultId) +{ + NWNXPushInt(resultId); + NWNXCall("NWNX_Redis", "GetResultAsString"); + return StringToFloat(NWNXPopString()); +} + +int NWNX_Redis_GetResultAsInt(int resultId) +{ + NWNXPushInt(resultId); + NWNXCall("NWNX_Redis", "GetResultAsString"); + return StringToInt(NWNXPopString()); +} + +string NWNX_Redis_GetResultAsString(int resultId) +{ + NWNXPushInt(resultId); + NWNXCall("NWNX_Redis", "GetResultAsString"); + return NWNXPopString(); +} diff --git a/_module/nss/nwnx_redis_ps.nss b/_module/nss/nwnx_redis_ps.nss new file mode 100644 index 00000000..ca03f317 --- /dev/null +++ b/_module/nss/nwnx_redis_ps.nss @@ -0,0 +1,22 @@ +/// @ingroup redis +/// @brief Interface to Redis PUBSUB +/// @{ +/// @file nwnx_redis_ps.nss + +/// A redis PUBSUB message +struct NWNX_Redis_PubSubMessageData { + string channel; ///< The channel + string message; ///< The message +}; + +/// @brief Get a PUBSUB message +/// @return A NWNX_Redis_PubSubMessageData struct. +struct NWNX_Redis_PubSubMessageData NWNX_Redis_GetPubSubMessageData() +{ + struct NWNX_Redis_PubSubMessageData ret; + 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 new file mode 100644 index 00000000..9dd8a6ef --- /dev/null +++ b/_module/nss/nwnx_redis_short.nss @@ -0,0 +1,5898 @@ +#include "nwnx_redis_lib" + + +// Skipping sub-command: BITFIELD/{"command"=>"OVERFLOW", "type"=>"enum", "enum"=>["WRAP", "SAT", "FAIL"], "optional"=>true} - not supported yet. +// Skipping sub-command: CLIENT_KILL/{"command"=>"TYPE", "type"=>"enum", "enum"=>["normal", "master", "slave", "pubsub"], "optional"=>true} - not supported yet. +// Skipping sub-command: CLIENT_LIST/{"command"=>"TYPE", "type"=>"enum", "enum"=>["normal", "master", "replica", "pubsub"], "optional"=>true} - not supported yet. +// Skipping sub-command: SET/{"command"=>"expiration", "type"=>"enum", "enum"=>["EX seconds", "PX milliseconds"], "optional"=>true} - not supported yet. +// Skipping XCLAIM, cannot parse argument: {"name"=>"force", "enum"=>["FORCE"], "optional"=>true} - not supported yet. +// Skipping XCLAIM, cannot parse argument: {"name"=>"justid", "enum"=>["JUSTID"], "optional"=>true} - not supported yet. +/** + * APPEND + * + * Append a value to a key + * + * Time complexity: O(1). The amortized time complexity is O(1) assuming the appended value is + * small and the already present value is of any size, since the dynamic string + * library used by Redis will double the free space available on every + * reallocation. + * Annotated return value: integer + */ +int APPEND( + string key, + string value +); + +/** + * AUTH + * + * Authenticate to the server + * Annotated return value: simple-string + */ +int AUTH( + string password +); + +/** + * BGREWRITEAOF + * + * Asynchronously rewrite the append-only file + * Annotated return value: simple-string + */ +int BGREWRITEAOF(); + +/** + * BGSAVE + * + * Asynchronously save the dataset to disk + * Annotated return value: simple-string + */ +int BGSAVE(); + +/** + * BITCOUNT + * + * Count set bits in a string + * + * Time complexity: O(N) + * Annotated return value: integer + */ +int BITCOUNT( + string key, + // Redis type: integer + int start = 0, + // Redis type: integer + int end = 0 +); + +/** + * BITFIELD + * + * Perform arbitrary bitfield integer operations on strings + * + * Time complexity: O(1) for each subcommand specified + * Annotated return value: + */ +int BITFIELD( + string key, + // Redis type: type + string get_type = "", + // Redis type: integer + int get_offset = 0, + // Redis type: type + string set_type = "", + // Redis type: integer + int set_offset = 0, + // Redis type: integer + int set_value = 0, + // Redis type: type + string incrby_type = "", + // Redis type: integer + int incrby_offset = 0, + // Redis type: integer + int incrby_increment = 0 +); + +/** + * BITOP + * + * Perform bitwise operations between strings + * + * Time complexity: O(N) + * Annotated return value: integer + */ +int BITOP( + string operation, + // Redis type: key + string destkey, + string key +); + +/** + * BITPOS + * + * Find first bit set or clear in a string + * + * Time complexity: O(N) + * Annotated return value: integer + */ +int BITPOS( + string key, + // Redis type: integer + int bit, + // Redis type: integer + int start = 0, + // Redis type: integer + int end = 0 +); + +/** + * BLPOP + * + * Remove and get the first element in a list, or block until one is available + * + * Time complexity: O(1) + * Annotated return value: array + */ +int BLPOP( + string key, + // Redis type: integer + int timeout +); + +/** + * BRPOP + * + * Remove and get the last element in a list, or block until one is available + * + * Time complexity: O(1) + * Annotated return value: array + */ +int BRPOP( + string key, + // Redis type: integer + int timeout +); + +/** + * BRPOPLPUSH + * + * Pop a value from a list, push it to another list and return it; or block until one is available + * + * Time complexity: O(1) + * Annotated return value: bulk-string + */ +int BRPOPLPUSH( + // Redis type: key + string source, + // Redis type: key + string destination, + // Redis type: integer + int timeout +); + +/** + * BZPOPMIN + * + * Remove and return the member with the lowest score from one or more sorted sets, or block until one is available + * + * Time complexity: O(log(N)) with N being the number of elements in the sorted set. + * Annotated return value: array + */ +int BZPOPMIN( + string key, + // Redis type: integer + int timeout +); + +/** + * BZPOPMAX + * + * Remove and return the member with the highest score from one or more sorted sets, or block until one is available + * + * Time complexity: O(log(N)) with N being the number of elements in the sorted set. + * Annotated return value: array + */ +int BZPOPMAX( + string key, + // Redis type: integer + int timeout +); + +/** + * CLIENT_ID + * + * Returns the client ID for the current connection + * + * Time complexity: O(1) + * Annotated return value: + */ +int CLIENT_ID(); + +/** + * CLIENT_KILL + * + * Kill the connection of a client + * + * Time complexity: O(N) where N is the number of client connections + * Annotated return value: simple-string + */ +int CLIENT_KILL( + string ip_port = "", + // Redis type: integer + int id_client_id = 0, + string addr_ip_port = "", + string skipme_yes_no = "" +); + +/** + * CLIENT_LIST + * + * Get the list of client connections + * + * Time complexity: O(N) where N is the number of client connections + * Annotated return value: bulk-string + */ +int CLIENT_LIST(); + +/** + * CLIENT_GETNAME + * + * Get the current connection name + * + * Time complexity: O(1) + * Annotated return value: bulk-string + */ +int CLIENT_GETNAME(); + +/** + * CLIENT_PAUSE + * + * Stop processing commands from clients for some time + * + * Time complexity: O(1) + * Annotated return value: simple-string + */ +int CLIENT_PAUSE( + // Redis type: integer + int timeout +); + +/** + * CLIENT_REPLY + * + * Instruct the server whether to reply to commands + * + * Time complexity: O(1) + + * - Valid values for reply_mode: "ON", "OFF", "SKIP" + * Annotated return value: simple-string + */ +int CLIENT_REPLY( + // Redis type: enum + string reply_mode +); + +/** + * CLIENT_SETNAME + * + * Set the current connection name + * + * Time complexity: O(1) + * Annotated return value: simple-string + */ +int CLIENT_SETNAME( + string connection_name +); + +/** + * CLIENT_UNBLOCK + * + * Unblock a client blocked in a blocking command from a different connection + * + * Time complexity: O(log N) where N is the number of client connections + + * - Valid values for unblock_type: "TIMEOUT", "ERROR" + * Annotated return value: + */ +int CLIENT_UNBLOCK( + string client_id, + // Redis type: enum + string unblock_type = "" +); + +/** + * CLUSTER_ADDSLOTS + * + * Assign new hash slots to receiving node + * + * Time complexity: O(N) where N is the total number of hash slot arguments + * Annotated return value: simple-string + */ +int CLUSTER_ADDSLOTS( + // Redis type: integer + int slot +); + +/** + * CLUSTER_COUNT_FAILURE_REPORTS + * + * Return the number of failure reports active for a given node + * + * Time complexity: O(N) where N is the number of failure reports + * Annotated return value: integer + */ +int CLUSTER_COUNT_FAILURE_REPORTS( + string node_id +); + +/** + * CLUSTER_COUNTKEYSINSLOT + * + * Return the number of local keys in the specified hash slot + * + * Time complexity: O(1) + * Annotated return value: integer + */ +int CLUSTER_COUNTKEYSINSLOT( + // Redis type: integer + int slot +); + +/** + * CLUSTER_DELSLOTS + * + * Set hash slots as unbound in receiving node + * + * Time complexity: O(N) where N is the total number of hash slot arguments + * Annotated return value: simple-string + */ +int CLUSTER_DELSLOTS( + // Redis type: integer + int slot +); + +/** + * CLUSTER_FAILOVER + * + * Forces a replica to perform a manual failover of its master. + * + * Time complexity: O(1) + + * - Valid values for options: "FORCE", "TAKEOVER" + * Annotated return value: simple-string + */ +int CLUSTER_FAILOVER( + // Redis type: enum + string options = "" +); + +/** + * CLUSTER_FORGET + * + * Remove a node from the nodes table + * + * Time complexity: O(1) + * Annotated return value: simple-string + */ +int CLUSTER_FORGET( + string node_id +); + +/** + * CLUSTER_GETKEYSINSLOT + * + * Return local key names in the specified hash slot + * + * Time complexity: O(log(N)) where N is the number of requested keys + * Annotated return value: array + */ +int CLUSTER_GETKEYSINSLOT( + // Redis type: integer + int slot, + // Redis type: integer + int count +); + +/** + * CLUSTER_INFO + * + * Provides info about Redis Cluster node state + * + * Time complexity: O(1) + * Annotated return value: bulk-string + */ +int CLUSTER_INFO(); + +/** + * CLUSTER_KEYSLOT + * + * Returns the hash slot of the specified key + * + * Time complexity: O(N) where N is the number of bytes in the key + * Annotated return value: integer + */ +int CLUSTER_KEYSLOT( + string key +); + +/** + * CLUSTER_MEET + * + * Force a node cluster to handshake with another node + * + * Time complexity: O(1) + * Annotated return value: simple-string + */ +int CLUSTER_MEET( + string ip, + // Redis type: integer + int port +); + +/** + * CLUSTER_NODES + * + * Get Cluster config for the node + * + * Time complexity: O(N) where N is the total number of Cluster nodes + * Annotated return value: bulk-string + */ +int CLUSTER_NODES(); + +/** + * CLUSTER_REPLICATE + * + * Reconfigure a node as a replica of the specified master node + * + * Time complexity: O(1) + * Annotated return value: simple-string + */ +int CLUSTER_REPLICATE( + string node_id +); + +/** + * CLUSTER_RESET + * + * Reset a Redis Cluster node + * + * Time complexity: O(N) where N is the number of known nodes. The command may execute a + * FLUSHALL as a side effect. + + * - Valid values for reset_type: "HARD", "SOFT" + * Annotated return value: simple-string + */ +int CLUSTER_RESET( + // Redis type: enum + string reset_type = "" +); + +/** + * CLUSTER_SAVECONFIG + * + * Forces the node to save cluster state on disk + * + * Time complexity: O(1) + * Annotated return value: simple-string + */ +int CLUSTER_SAVECONFIG(); + +/** + * CLUSTER_SET_CONFIG_EPOCH + * + * Set the configuration epoch in a new node + * + * Time complexity: O(1) + * Annotated return value: simple-string + */ +int CLUSTER_SET_CONFIG_EPOCH( + // Redis type: integer + int config_epoch +); + +/** + * CLUSTER_SETSLOT + * + * Bind a hash slot to a specific node + * + * Time complexity: O(1) + + * - Valid values for subcommand: "IMPORTING", "MIGRATING", "STABLE", "NODE" + * Annotated return value: simple-string + */ +int CLUSTER_SETSLOT( + // Redis type: integer + int slot, + // Redis type: enum + string subcommand, + string node_id = "" +); + +/** + * CLUSTER_SLAVES + * + * List replica nodes of the specified master node + * + * Time complexity: O(1) + * Annotated return value: + */ +int CLUSTER_SLAVES( + string node_id +); + +/** + * CLUSTER_REPLICAS + * + * List replica nodes of the specified master node + * + * Time complexity: O(1) + * Annotated return value: + */ +int CLUSTER_REPLICAS( + string node_id +); + +/** + * CLUSTER_SLOTS + * + * Get array of Cluster slot to node mappings + * + * Time complexity: O(N) where N is the total number of Cluster nodes + * Annotated return value: array + */ +int CLUSTER_SLOTS(); + +/** + * COMMAND + * + * Get array of Redis command details + * + * Time complexity: O(N) where N is the total number of Redis commands + * Annotated return value: array + */ +int COMMAND(); + +/** + * COMMAND_COUNT + * + * Get total number of Redis commands + * + * Time complexity: O(1) + * Annotated return value: integer + */ +int COMMAND_COUNT(); + +/** + * COMMAND_GETKEYS + * + * Extract keys given a full Redis command + * + * Time complexity: O(N) where N is the number of arguments to the command + * Annotated return value: array + */ +int COMMAND_GETKEYS(); + +/** + * COMMAND_INFO + * + * Get array of specific Redis command details + * + * Time complexity: O(N) when N is number of commands to look up + * Annotated return value: array + */ +int COMMAND_INFO( + string command_name +); + +/** + * CONFIG_GET + * + * Get the value of a configuration parameter + * Annotated return value: array + */ +int CONFIG_GET( + string parameter +); + +/** + * CONFIG_REWRITE + * + * Rewrite the configuration file with the in memory configuration + * Annotated return value: simple-string + */ +int CONFIG_REWRITE(); + +/** + * CONFIG_SET + * + * Set a configuration parameter to the given value + * Annotated return value: simple-string + */ +int CONFIG_SET( + string parameter, + string value +); + +/** + * CONFIG_RESETSTAT + * + * Reset the stats returned by INFO + * + * Time complexity: O(1) + * Annotated return value: simple-string + */ +int CONFIG_RESETSTAT(); + +/** + * DBSIZE + * + * Return the number of keys in the selected database + * Annotated return value: integer + */ +int DBSIZE(); + +/** + * DEBUG_OBJECT + * + * Get debugging information about a key + * Annotated return value: simple-string + */ +int DEBUG_OBJECT( + string key +); + +/** + * DEBUG_SEGFAULT + * + * Make the server crash + * Annotated return value: simple-string + */ +int DEBUG_SEGFAULT(); + +/** + * DECR + * + * Decrement the integer value of a key by one + * + * Time complexity: O(1) + * Annotated return value: integer + */ +int DECR( + string key +); + +/** + * DECRBY + * + * Decrement the integer value of a key by the given number + * + * Time complexity: O(1) + * Annotated return value: integer + */ +int DECRBY( + string key, + // Redis type: integer + int decrement +); + +/** + * DEL + * + * Delete a key + * + * Time complexity: O(N) where N is the number of keys that will be removed. When a key to + * remove holds a value other than a string, the individual complexity for this + * key is O(M) where M is the number of elements in the list, set, sorted set + * or hash. Removing a single key that holds a string value is O(1). + * Annotated return value: integer + */ +int DEL( + string key +); + +/** + * DISCARD + * + * Discard all commands issued after MULTI + * Annotated return value: simple-string + */ +int DISCARD(); + +/** + * DUMP + * + * Return a serialized version of the value stored at the specified key. + * + * Time complexity: O(1) to access the key and additional O(N*M) to serialized it, where N is + * the number of Redis objects composing the value and M their average size. + * For small string values the time complexity is thus O(1)+O(1*M) where M is + * small, so simply O(1). + * Annotated return value: bulk-string + */ +int DUMP( + string key +); + +/** + * ECHO + * + * Echo the given string + * Annotated return value: bulk-string + */ +int ECHO( + string message +); + +/** + * EVAL + * + * Execute a Lua script server side + * + * Time complexity: Depends on the script that is executed. + * Annotated return value: + */ +int EVAL( + string script, + // Redis type: integer + int numkeys, + string key, + string arg +); + +/** + * EVALSHA + * + * Execute a Lua script server side + * + * Time complexity: Depends on the script that is executed. + * Annotated return value: + */ +int EVALSHA( + string sha1, + // Redis type: integer + int numkeys, + string key, + string arg +); + +/** + * EXEC + * + * Execute all commands issued after MULTI + * Annotated return value: array + */ +int EXEC(); + +/** + * EXISTS + * + * Determine if a key exists + * + * Time complexity: O(1) + * Annotated return value: integer + */ +int EXISTS( + string key +); + +/** + * EXPIRE + * + * Set a key's time to live in seconds + * + * Time complexity: O(1) + * Annotated return value: integer + */ +int EXPIRE( + string key, + // Redis type: integer + int seconds +); + +/** + * EXPIREAT + * + * Set the expiration for a key as a UNIX timestamp + * + * Time complexity: O(1) + * Annotated return value: integer + */ +int EXPIREAT( + string key, + // Redis type: posix time + string timestamp +); + +/** + * FLUSHALL + * + * Remove all keys from all databases + + * - Valid values for async: "ASYNC" + * Annotated return value: simple-string + */ +int FLUSHALL( + // Redis type: enum + string async = "" +); + +/** + * FLUSHDB + * + * Remove all keys from the current database + + * - Valid values for async: "ASYNC" + * Annotated return value: simple-string + */ +int FLUSHDB( + // Redis type: enum + string async = "" +); + +/** + * GEOADD + * + * Add one or more geospatial items in the geospatial index represented using a sorted set + * + * Time complexity: O(log(N)) for each item added, where N is the number of elements in the + * sorted set. + * Annotated return value: integer + */ +int GEOADD( + string key, + // Redis type: double + float longitude, + // Redis type: double + float latitude, + string member +); + +/** + * GEOHASH + * + * Returns members of a geospatial index as standard geohash strings + * + * Time complexity: O(log(N)) for each member requested, where N is the number of elements in + * the sorted set. + * Annotated return value: array + */ +int GEOHASH( + string key, + string member +); + +/** + * GEOPOS + * + * Returns longitude and latitude of members of a geospatial index + * + * Time complexity: O(log(N)) for each member requested, where N is the number of elements in + * the sorted set. + * Annotated return value: array + */ +int GEOPOS( + string key, + string member +); + +/** + * GEODIST + * + * Returns the distance between two members of a geospatial index + * + * Time complexity: O(log(N)) + * Annotated return value: bulk-string + */ +int GEODIST( + string key, + string member1, + string member2, + string unit = "" +); + +/** + * GEORADIUS + * + * Query a sorted set representing a geospatial index to fetch members matching a given maximum distance from a point + * + * Time complexity: O(N+log(M)) where N is the number of elements inside the bounding box of the + * circular area delimited by center and radius and M is the number of items + * inside the index. + + * - Valid values for unit: "m", "km", "ft", "mi" + + * - Valid values for withcoord: "WITHCOORD" + + * - Valid values for withdist: "WITHDIST" + + * - Valid values for withhash: "WITHHASH" + + * - Valid values for order: "ASC", "DESC" + * Annotated return value: array + */ +int GEORADIUS( + string key, + // Redis type: double + float longitude, + // Redis type: double + float latitude, + // Redis type: double + float radius, + // Redis type: enum + string unit, + // Redis type: enum + string withcoord = "", + // Redis type: enum + string withdist = "", + // Redis type: enum + string withhash = "", + // Redis type: integer + int count_count = 0, + // Redis type: enum + string order = "", + // Redis type: key + string store_key = "", + // Redis type: key + string storedist_key = "" +); + +/** + * GEORADIUSBYMEMBER + * + * Query a sorted set representing a geospatial index to fetch members matching a given maximum distance from a member + * + * Time complexity: O(N+log(M)) where N is the number of elements inside the bounding box of the + * circular area delimited by center and radius and M is the number of items + * inside the index. + + * - Valid values for unit: "m", "km", "ft", "mi" + + * - Valid values for withcoord: "WITHCOORD" + + * - Valid values for withdist: "WITHDIST" + + * - Valid values for withhash: "WITHHASH" + + * - Valid values for order: "ASC", "DESC" + * Annotated return value: + */ +int GEORADIUSBYMEMBER( + string key, + string member, + // Redis type: double + float radius, + // Redis type: enum + string unit, + // Redis type: enum + string withcoord = "", + // Redis type: enum + string withdist = "", + // Redis type: enum + string withhash = "", + // Redis type: integer + int count_count = 0, + // Redis type: enum + string order = "", + // Redis type: key + string store_key = "", + // Redis type: key + string storedist_key = "" +); + +/** + * GET + * + * Get the value of a key + * + * Time complexity: O(1) + * Annotated return value: bulk-string + */ +int GET( + string key +); + +/** + * GETBIT + * + * Returns the bit value at offset in the string value stored at key + * + * Time complexity: O(1) + * Annotated return value: integer + */ +int GETBIT( + string key, + // Redis type: integer + int offset +); + +/** + * GETRANGE + * + * Get a substring of the string stored at a key + * + * Time complexity: O(N) where N is the length of the returned string. The complexity is + * ultimately determined by the returned length, but because creating a + * substring from an existing string is very cheap, it can be considered O(1) + * for small strings. + * Annotated return value: bulk-string + */ +int GETRANGE( + string key, + // Redis type: integer + int start, + // Redis type: integer + int end +); + +/** + * GETSET + * + * Set the string value of a key and return its old value + * + * Time complexity: O(1) + * Annotated return value: bulk-string + */ +int GETSET( + string key, + string value +); + +/** + * HDEL + * + * Delete one or more hash fields + * + * Time complexity: O(N) where N is the number of fields to be removed. + * Annotated return value: integer + */ +int HDEL( + string key, + string field +); + +/** + * HEXISTS + * + * Determine if a hash field exists + * + * Time complexity: O(1) + * Annotated return value: integer + */ +int HEXISTS( + string key, + string field +); + +/** + * HGET + * + * Get the value of a hash field + * + * Time complexity: O(1) + * Annotated return value: bulk-string + */ +int HGET( + string key, + string field +); + +/** + * HGETALL + * + * Get all the fields and values in a hash + * + * Time complexity: O(N) where N is the size of the hash. + * Annotated return value: array + */ +int HGETALL( + string key +); + +/** + * HINCRBY + * + * Increment the integer value of a hash field by the given number + * + * Time complexity: O(1) + * Annotated return value: integer + */ +int HINCRBY( + string key, + string field, + // Redis type: integer + int increment +); + +/** + * HINCRBYFLOAT + * + * Increment the float value of a hash field by the given amount + * + * Time complexity: O(1) + * Annotated return value: bulk-string + */ +int HINCRBYFLOAT( + string key, + string field, + // Redis type: double + float increment +); + +/** + * HKEYS + * + * Get all the fields in a hash + * + * Time complexity: O(N) where N is the size of the hash. + * Annotated return value: array + */ +int HKEYS( + string key +); + +/** + * HLEN + * + * Get the number of fields in a hash + * + * Time complexity: O(1) + * Annotated return value: integer + */ +int HLEN( + string key +); + +/** + * HMGET + * + * Get the values of all the given hash fields + * + * Time complexity: O(N) where N is the number of fields being requested. + * Annotated return value: array + */ +int HMGET( + string key, + string field +); + +/** + * HMSET + * + * Set multiple hash fields to multiple values + * + * Time complexity: O(N) where N is the number of fields being set. + * Annotated return value: simple-string + */ +int HMSET( + string key, + string field, + string value +); + +/** + * HSET + * + * Set the string value of a hash field + * + * Time complexity: O(1) + * Annotated return value: integer + */ +int HSET( + string key, + string field, + string value +); + +/** + * HSETNX + * + * Set the value of a hash field, only if the field does not exist + * + * Time complexity: O(1) + * Annotated return value: integer + */ +int HSETNX( + string key, + string field, + string value +); + +/** + * HSTRLEN + * + * Get the length of the value of a hash field + * + * Time complexity: O(1) + * Annotated return value: integer + */ +int HSTRLEN( + string key, + string field +); + +/** + * HVALS + * + * Get all the values in a hash + * + * Time complexity: O(N) where N is the size of the hash. + * Annotated return value: array + */ +int HVALS( + string key +); + +/** + * INCR + * + * Increment the integer value of a key by one + * + * Time complexity: O(1) + * Annotated return value: integer + */ +int INCR( + string key +); + +/** + * INCRBY + * + * Increment the integer value of a key by the given amount + * + * Time complexity: O(1) + * Annotated return value: integer + */ +int INCRBY( + string key, + // Redis type: integer + int increment +); + +/** + * INCRBYFLOAT + * + * Increment the float value of a key by the given amount + * + * Time complexity: O(1) + * Annotated return value: bulk-string + */ +int INCRBYFLOAT( + string key, + // Redis type: double + float increment +); + +/** + * INFO + * + * Get information and statistics about the server + * Annotated return value: bulk-string + */ +int INFO( + string section = "" +); + +/** + * KEYS + * + * Find all keys matching the given pattern + * + * Time complexity: O(N) with N being the number of keys in the database, under the assumption + * that the key names in the database and the given pattern have limited + * length. + * Annotated return value: array + */ +int KEYS( + string pattern +); + +/** + * LASTSAVE + * + * Get the UNIX time stamp of the last successful save to disk + * Annotated return value: integer + */ +int LASTSAVE(); + +/** + * LINDEX + * + * Get an element from a list by its index + * + * Time complexity: O(N) where N is the number of elements to traverse to get to the element at + * index. This makes asking for the first or the last element of the list O(1). + * Annotated return value: bulk-string + */ +int LINDEX( + string key, + // Redis type: integer + int index +); + +/** + * LINSERT + * + * Insert an element before or after another element in a list + * + * Time complexity: O(N) where N is the number of elements to traverse before seeing the value + * pivot. This means that inserting somewhere on the left end on the list + * (head) can be considered O(1) and inserting somewhere on the right end + * (tail) is O(N). + + * - Valid values for where: "BEFORE", "AFTER" + * Annotated return value: integer + */ +int LINSERT( + string key, + // Redis type: enum + string where, + string pivot, + string value +); + +/** + * LLEN + * + * Get the length of a list + * + * Time complexity: O(1) + * Annotated return value: integer + */ +int LLEN( + string key +); + +/** + * LPOP + * + * Remove and get the first element in a list + * + * Time complexity: O(1) + * Annotated return value: bulk-string + */ +int LPOP( + string key +); + +/** + * LPUSH + * + * Prepend one or multiple values to a list + * + * Time complexity: O(1) + * Annotated return value: integer + */ +int LPUSH( + string key, + string value +); + +/** + * LPUSHX + * + * Prepend a value to a list, only if the list exists + * + * Time complexity: O(1) + * Annotated return value: integer + */ +int LPUSHX( + string key, + string value +); + +/** + * LRANGE + * + * Get a range of elements from a list + * + * Time complexity: O(S+N) where S is the distance of start offset from HEAD for small lists, + * from nearest end (HEAD or TAIL) for large lists; and N is the number of + * elements in the specified range. + * Annotated return value: array + */ +int LRANGE( + string key, + // Redis type: integer + int start, + // Redis type: integer + int stop +); + +/** + * LREM + * + * Remove elements from a list + * + * Time complexity: O(N) where N is the length of the list. + * Annotated return value: integer + */ +int LREM( + string key, + // Redis type: integer + int count, + string value +); + +/** + * LSET + * + * Set the value of an element in a list by its index + * + * Time complexity: O(N) where N is the length of the list. Setting either the first or the last + * element of the list is O(1). + * Annotated return value: simple-string + */ +int LSET( + string key, + // Redis type: integer + int index, + string value +); + +/** + * LTRIM + * + * Trim a list to the specified range + * + * Time complexity: O(N) where N is the number of elements to be removed by the operation. + * Annotated return value: simple-string + */ +int LTRIM( + string key, + // Redis type: integer + int start, + // Redis type: integer + int stop +); + +/** + * MEMORY_DOCTOR + * + * Outputs memory problems report + * Annotated return value: bulk-string + */ +int MEMORY_DOCTOR(); + +/** + * MEMORY_HELP + * + * Show helpful text about the different subcommands + * Annotated return value: array + */ +int MEMORY_HELP(); + +/** + * MEMORY_MALLOC_STATS + * + * Show allocator internal stats + * Annotated return value: bulk-string + */ +int MEMORY_MALLOC_STATS(); + +/** + * MEMORY_PURGE + * + * Ask the allocator to release memory + * Annotated return value: simple-string + */ +int MEMORY_PURGE(); + +/** + * MEMORY_STATS + * + * Show memory usage details + * Annotated return value: array + */ +int MEMORY_STATS(); + +/** + * MEMORY_USAGE + * + * Estimate the memory usage of a key + * + * Time complexity: O(N) where N is the number of samples. + * Annotated return value: integer + */ +int MEMORY_USAGE( + string key, + // Redis type: integer + int samples_count = 0 +); + +/** + * MGET + * + * Get the values of all the given keys + * + * Time complexity: O(N) where N is the number of keys to retrieve. + * Annotated return value: array + */ +int MGET( + string key +); + +/** + * MIGRATE + * + * Atomically transfer a key from a Redis instance to another one. + * + * Time complexity: This command actually executes a DUMP+DEL in the source instance, and a + * RESTORE in the target instance. See the pages of these commands for time + * complexity. Also an O(N) data transfer between the two instances is + * performed. + + * - Valid values for key: "key", "\"\"" + + * - Valid values for copy: "COPY" + + * - Valid values for replace: "REPLACE" + * Annotated return value: simple-string + */ +int MIGRATE( + string host, + string port, + // Redis type: enum + string key, + // Redis type: integer + int destination_db, + // Redis type: integer + int timeout, + // Redis type: enum + string copy = "", + // Redis type: enum + string replace = "", + string auth_password = "", + // Redis type: key + string keys_key = "" +); + +/** + * MONITOR + * + * Listen for all requests received by the server in real time + * Annotated return value: + */ +int MONITOR(); + +/** + * MOVE + * + * Move a key to another database + * + * Time complexity: O(1) + * Annotated return value: integer + */ +int MOVE( + string key, + // Redis type: integer + int db +); + +/** + * MSET + * + * Set multiple keys to multiple values + * + * Time complexity: O(N) where N is the number of keys to set. + * Annotated return value: simple-string + */ +int MSET( + string key, + string value +); + +/** + * MSETNX + * + * Set multiple keys to multiple values, only if none of the keys exist + * + * Time complexity: O(N) where N is the number of keys to set. + * Annotated return value: integer + */ +int MSETNX( + string key, + string value +); + +/** + * MULTI + * + * Mark the start of a transaction block + * Annotated return value: simple-string + */ +int MULTI(); + +/** + * OBJECT + * + * Inspect the internals of Redis objects + * + * Time complexity: O(1) for all the currently implemented subcommands. + * Annotated return value: + */ +int OBJECT( + string subcommand, + string arguments = "" +); + +/** + * PERSIST + * + * Remove the expiration from a key + * + * Time complexity: O(1) + * Annotated return value: integer + */ +int PERSIST( + string key +); + +/** + * PEXPIRE + * + * Set a key's time to live in milliseconds + * + * Time complexity: O(1) + * Annotated return value: integer + */ +int PEXPIRE( + string key, + // Redis type: integer + int milliseconds +); + +/** + * PEXPIREAT + * + * Set the expiration for a key as a UNIX timestamp specified in milliseconds + * + * Time complexity: O(1) + * Annotated return value: integer + */ +int PEXPIREAT( + string key, + // Redis type: posix time + string milliseconds_timestamp +); + +/** + * PFADD + * + * Adds the specified elements to the specified HyperLogLog. + * + * Time complexity: O(1) to add every element. + * Annotated return value: integer + */ +int PFADD( + string key, + string element +); + +/** + * PFCOUNT + * + * Return the approximated cardinality of the set(s) observed by the HyperLogLog at key(s). + * + * Time complexity: O(1) with a very small average constant time when called with a single key. + * O(N) with N being the number of keys, and much bigger constant times, when + * called with multiple keys. + * Annotated return value: integer + */ +int PFCOUNT( + string key +); + +/** + * PFMERGE + * + * Merge N different HyperLogLogs into a single one. + * + * Time complexity: O(N) to merge N HyperLogLogs, but with high constant times. + * Annotated return value: simple-string + */ +int PFMERGE( + // Redis type: key + string destkey, + // Redis type: key + string sourcekey +); + +/** + * PING + * + * Ping the server + * Annotated return value: simple-string + */ +int PING( + string message = "" +); + +/** + * PSETEX + * + * Set the value and expiration in milliseconds of a key + * + * Time complexity: O(1) + * Annotated return value: + */ +int PSETEX( + string key, + // Redis type: integer + int milliseconds, + string value +); + +/** + * PUBSUB + * + * Inspect the state of the Pub/Sub subsystem + * + * Time complexity: O(N) for the CHANNELS subcommand, where N is the number of active channels, + * and assuming constant time pattern matching (relatively short channels and + * patterns). O(N) for the NUMSUB subcommand, where N is the number of + * requested channels. O(1) for the NUMPAT subcommand. + * Annotated return value: array + */ +int PUBSUB( + string subcommand, + string argument = "" +); + +/** + * PTTL + * + * Get the time to live for a key in milliseconds + * + * Time complexity: O(1) + * Annotated return value: integer + */ +int PTTL( + string key +); + +/** + * PUBLISH + * + * Post a message to a channel + * + * Time complexity: O(N+M) where N is the number of clients subscribed to the receiving channel + * and M is the total number of subscribed patterns (by any client). + * Annotated return value: integer + */ +int PUBLISH( + string channel, + string message +); + +/** + * QUIT + * + * Close the connection + * Annotated return value: simple-string + */ +int QUIT(); + +/** + * RANDOMKEY + * + * Return a random key from the keyspace + * + * Time complexity: O(1) + * Annotated return value: bulk-string + */ +int RANDOMKEY(); + +/** + * READONLY + * + * Enables read queries for a connection to a cluster replica node + * + * Time complexity: O(1) + * Annotated return value: simple-string + */ +int READONLY(); + +/** + * READWRITE + * + * Disables read queries for a connection to a cluster replica node + * + * Time complexity: O(1) + * Annotated return value: simple-string + */ +int READWRITE(); + +/** + * RENAME + * + * Rename a key + * + * Time complexity: O(1) + * Annotated return value: simple-string + */ +int RENAME( + string key, + // Redis type: key + string newkey +); + +/** + * RENAMENX + * + * Rename a key, only if the new key does not exist + * + * Time complexity: O(1) + * Annotated return value: integer + */ +int RENAMENX( + string key, + // Redis type: key + string newkey +); + +/** + * RESTORE + * + * Create a key using the provided serialized value, previously obtained using DUMP. + * + * Time complexity: O(1) to create the new key and additional O(N*M) to reconstruct the + * serialized value, where N is the number of Redis objects composing the value + * and M their average size. For small string values the time complexity is + * thus O(1)+O(1*M) where M is small, so simply O(1). However for sorted set + * values the complexity is O(N*M*log(N)) because inserting values into sorted + * sets is O(log(N)). + + * - Valid values for replace: "REPLACE" + + * - Valid values for absttl: "ABSTTL" + * Annotated return value: simple-string + */ +int RESTORE( + string key, + // Redis type: integer + int ttl, + string serialized_value, + // Redis type: enum + string replace = "", + // Redis type: enum + string absttl = "", + // Redis type: integer + int idletime_seconds = 0, + // Redis type: integer + int freq_frequency = 0 +); + +/** + * ROLE + * + * Return the role of the instance in the context of replication + * Annotated return value: array + */ +int ROLE(); + +/** + * RPOP + * + * Remove and get the last element in a list + * + * Time complexity: O(1) + * Annotated return value: bulk-string + */ +int RPOP( + string key +); + +/** + * RPOPLPUSH + * + * Remove the last element in a list, prepend it to another list and return it + * + * Time complexity: O(1) + * Annotated return value: bulk-string + */ +int RPOPLPUSH( + // Redis type: key + string source, + // Redis type: key + string destination +); + +/** + * RPUSH + * + * Append one or multiple values to a list + * + * Time complexity: O(1) + * Annotated return value: integer + */ +int RPUSH( + string key, + string value +); + +/** + * RPUSHX + * + * Append a value to a list, only if the list exists + * + * Time complexity: O(1) + * Annotated return value: integer + */ +int RPUSHX( + string key, + string value +); + +/** + * SADD + * + * Add one or more members to a set + * + * Time complexity: O(1) for each element added, so O(N) to add N elements when the command is + * called with multiple arguments. + * Annotated return value: integer + */ +int SADD( + string key, + string member +); + +/** + * SAVE + * + * Synchronously save the dataset to disk + * Annotated return value: simple-string + */ +int SAVE(); + +/** + * SCARD + * + * Get the number of members in a set + * + * Time complexity: O(1) + * Annotated return value: integer + */ +int SCARD( + string key +); + +/** + * SCRIPT_DEBUG + * + * Set the debug mode for executed scripts. + * + * Time complexity: O(1) + + * - Valid values for mode: "YES", "SYNC", "NO" + * Annotated return value: simple-string + */ +int SCRIPT_DEBUG( + // Redis type: enum + string mode +); + +/** + * SCRIPT_EXISTS + * + * Check existence of scripts in the script cache. + * + * Time complexity: O(N) with N being the number of scripts to check (so checking a single + * script is an O(1) operation). + * Annotated return value: array + */ +int SCRIPT_EXISTS( + string sha1 +); + +/** + * SCRIPT_FLUSH + * + * Remove all the scripts from the script cache. + * + * Time complexity: O(N) with N being the number of scripts in cache + * Annotated return value: simple-string + */ +int SCRIPT_FLUSH(); + +/** + * SCRIPT_KILL + * + * Kill the script currently in execution. + * + * Time complexity: O(1) + * Annotated return value: simple-string + */ +int SCRIPT_KILL(); + +/** + * SCRIPT_LOAD + * + * Load the specified Lua script into the script cache. + * + * Time complexity: O(N) with N being the length in bytes of the script body. + * Annotated return value: bulk-string + */ +int SCRIPT_LOAD( + string script +); + +/** + * SDIFF + * + * Subtract multiple sets + * + * Time complexity: O(N) where N is the total number of elements in all given sets. + * Annotated return value: array + */ +int SDIFF( + string key +); + +/** + * SDIFFSTORE + * + * Subtract multiple sets and store the resulting set in a key + * + * Time complexity: O(N) where N is the total number of elements in all given sets. + * Annotated return value: integer + */ +int SDIFFSTORE( + // Redis type: key + string destination, + string key +); + +/** + * SELECT + * + * Change the selected database for the current connection + * Annotated return value: simple-string + */ +int SELECT( + // Redis type: integer + int index +); + +/** + * SET + * + * Set the string value of a key + * + * Time complexity: O(1) + + * - Valid values for condition: "NX", "XX" + * Annotated return value: simple-string + */ +int SET( + string key, + string value, + // Redis type: enum + string condition = "" +); + +/** + * SETBIT + * + * Sets or clears the bit at offset in the string value stored at key + * + * Time complexity: O(1) + * Annotated return value: integer + */ +int SETBIT( + string key, + // Redis type: integer + int offset, + string value +); + +/** + * SETEX + * + * Set the value and expiration of a key + * + * Time complexity: O(1) + * Annotated return value: simple-string + */ +int SETEX( + string key, + // Redis type: integer + int seconds, + string value +); + +/** + * SETNX + * + * Set the value of a key, only if the key does not exist + * + * Time complexity: O(1) + * Annotated return value: integer + */ +int SETNX( + string key, + string value +); + +/** + * SETRANGE + * + * Overwrite part of a string at key starting at the specified offset + * + * Time complexity: O(1), not counting the time taken to copy the new string in place. Usually, + * this string is very small so the amortized complexity is O(1). Otherwise, + * complexity is O(M) with M being the length of the value argument. + * Annotated return value: integer + */ +int SETRANGE( + string key, + // Redis type: integer + int offset, + string value +); + +/** + * SHUTDOWN + * + * Synchronously save the dataset to disk and then shut down the server + + * - Valid values for save_mode: "NOSAVE", "SAVE" + * Annotated return value: simple-string + */ +int SHUTDOWN( + // Redis type: enum + string save_mode = "" +); + +/** + * SINTER + * + * Intersect multiple sets + * + * Time complexity: O(N*M) worst case where N is the cardinality of the smallest set and M is + * the number of sets. + * Annotated return value: array + */ +int SINTER( + string key +); + +/** + * SINTERSTORE + * + * Intersect multiple sets and store the resulting set in a key + * + * Time complexity: O(N*M) worst case where N is the cardinality of the smallest set and M is + * the number of sets. + * Annotated return value: integer + */ +int SINTERSTORE( + // Redis type: key + string destination, + string key +); + +/** + * SISMEMBER + * + * Determine if a given value is a member of a set + * + * Time complexity: O(1) + * Annotated return value: integer + */ +int SISMEMBER( + string key, + string member +); + +/** + * SLAVEOF + * + * Make the server a replica of another instance, or promote it as master. Deprecated starting with Redis 5. Use REPLICAOF instead. + * Annotated return value: simple-string + */ +int SLAVEOF( + string host, + string port +); + +/** + * REPLICAOF + * + * Make the server a replica of another instance, or promote it as master. + * Annotated return value: simple-string + */ +int REPLICAOF( + string host, + string port +); + +/** + * SLOWLOG + * + * Manages the Redis slow queries log + * Annotated return value: + */ +int SLOWLOG( + string subcommand, + string argument = "" +); + +/** + * SMEMBERS + * + * Get all the members in a set + * + * Time complexity: O(N) where N is the set cardinality. + * Annotated return value: array + */ +int SMEMBERS( + string key +); + +/** + * SMOVE + * + * Move a member from one set to another + * + * Time complexity: O(1) + * Annotated return value: integer + */ +int SMOVE( + // Redis type: key + string source, + // Redis type: key + string destination, + string member +); + +/** + * SORT + * + * Sort the elements in a list, set or sorted set + * + * Time complexity: O(N+M*log(M)) where N is the number of elements in the list or set to sort, + * and M the number of returned elements. When the elements are not sorted, + * complexity is currently O(N) as there is a copy step that will be avoided in + * next releases. + + * - Valid values for order: "ASC", "DESC" + + * - Valid values for sorting: "ALPHA" + * Annotated return value: array + */ +int SORT( + string key, + // Redis type: pattern + string by_pattern = "", + // Redis type: integer + int limit_offset = 0, + // Redis type: integer + int limit_count = 0, + string get_pattern = "", + // Redis type: enum + string order = "", + // Redis type: enum + string sorting = "", + // Redis type: key + string store_destination = "" +); + +/** + * SPOP + * + * Remove and return one or multiple random members from a set + * + * Time complexity: O(1) + * Annotated return value: bulk-string + */ +int SPOP( + string key, + // Redis type: integer + int count = 0 +); + +/** + * SRANDMEMBER + * + * Get one or multiple random members from a set + * + * Time complexity: Without the count argument O(1), otherwise O(N) where N is the absolute + * value of the passed count. + * Annotated return value: bulk-string + */ +int SRANDMEMBER( + string key, + // Redis type: integer + int count = 0 +); + +/** + * SREM + * + * Remove one or more members from a set + * + * Time complexity: O(N) where N is the number of members to be removed. + * Annotated return value: integer + */ +int SREM( + string key, + string member +); + +/** + * STRLEN + * + * Get the length of the value stored in a key + * + * Time complexity: O(1) + * Annotated return value: integer + */ +int STRLEN( + string key +); + +/** + * SUNION + * + * Add multiple sets + * + * Time complexity: O(N) where N is the total number of elements in all given sets. + * Annotated return value: array + */ +int SUNION( + string key +); + +/** + * SUNIONSTORE + * + * Add multiple sets and store the resulting set in a key + * + * Time complexity: O(N) where N is the total number of elements in all given sets. + * Annotated return value: integer + */ +int SUNIONSTORE( + // Redis type: key + string destination, + string key +); + +/** + * SWAPDB + * + * Swaps two Redis databases + * Annotated return value: simple-string + */ +int SWAPDB( + // Redis type: integer + int index, + // Redis type: integer + int index_1 +); + +/** + * SYNC + * + * Internal command used for replication + * Annotated return value: + */ +int SYNC(); + +/** + * TIME + * + * Return the current server time + * + * Time complexity: O(1) + * Annotated return value: array + */ +int TIME(); + +/** + * TOUCH + * + * Alters the last access time of a key(s). Returns the number of existing keys specified. + * + * Time complexity: O(N) where N is the number of keys that will be touched. + * Annotated return value: integer + */ +int TOUCH( + string key +); + +/** + * TTL + * + * Get the time to live for a key + * + * Time complexity: O(1) + * Annotated return value: integer + */ +int TTL( + string key +); + +/** + * TYPE + * + * Determine the type stored at key + * + * Time complexity: O(1) + * Annotated return value: simple-string + */ +int TYPE( + string key +); + +/** + * UNLINK + * + * Delete a key asynchronously in another thread. Otherwise it is just as DEL, but non blocking. + * + * Time complexity: O(1) for each key removed regardless of its size. Then the command does O(N) + * work in a different thread in order to reclaim memory, where N is the number + * of allocations the deleted objects where composed of. + * Annotated return value: integer + */ +int UNLINK( + string key +); + +/** + * UNWATCH + * + * Forget about all watched keys + * + * Time complexity: O(1) + * Annotated return value: simple-string + */ +int UNWATCH(); + +/** + * WAIT + * + * Wait for the synchronous replication of all the write commands sent in the context of the current connection + * + * Time complexity: O(1) + * Annotated return value: integer + */ +int WAIT( + // Redis type: integer + int numreplicas, + // Redis type: integer + int timeout +); + +/** + * WATCH + * + * Watch the given keys to determine execution of the MULTI/EXEC block + * + * Time complexity: O(1) for every key. + * Annotated return value: simple-string + */ +int WATCH( + string key +); + +/** + * ZADD + * + * Add one or more members to a sorted set, or update its score if it already exists + * + * Time complexity: O(log(N)) for each item added, where N is the number of elements in the + * sorted set. + + * - Valid values for condition: "NX", "XX" + + * - Valid values for change: "CH" + + * - Valid values for increment: "INCR" + * Annotated return value: integer + */ +int ZADD( + string key, + // Redis type: enum + string condition = "", + // Redis type: enum + string change = "", + // Redis type: enum + string increment = "", + // Redis type: double + float score = 0.0, + string member = "" +); + +/** + * ZCARD + * + * Get the number of members in a sorted set + * + * Time complexity: O(1) + * Annotated return value: integer + */ +int ZCARD( + string key +); + +/** + * ZCOUNT + * + * Count the members in a sorted set with scores within the given values + * + * Time complexity: O(log(N)) with N being the number of elements in the sorted set. + * Annotated return value: integer + */ +int ZCOUNT( + string key, + // Redis type: double + float min, + // Redis type: double + float max +); + +/** + * ZINCRBY + * + * Increment the score of a member in a sorted set + * + * Time complexity: O(log(N)) where N is the number of elements in the sorted set. + * Annotated return value: bulk-string + */ +int ZINCRBY( + string key, + // Redis type: integer + int increment, + string member +); + +/** + * ZINTERSTORE + * + * Intersect multiple sorted sets and store the resulting sorted set in a new key + * + * Time complexity: O(N*K)+O(M*log(M)) worst case with N being the smallest input sorted set, K + * being the number of input sorted sets and M being the number of elements in + * the resulting sorted set. + + * - Valid values for aggregate_aggregate: "SUM", "MIN", "MAX" + * Annotated return value: integer + */ +int ZINTERSTORE( + // Redis type: key + string destination, + // Redis type: integer + int numkeys, + string key, + // Redis type: integer + int weights_weight = 0, + // Redis type: enum + string aggregate_aggregate = "" +); + +/** + * ZLEXCOUNT + * + * Count the number of members in a sorted set between a given lexicographical range + * + * Time complexity: O(log(N)) with N being the number of elements in the sorted set. + * Annotated return value: integer + */ +int ZLEXCOUNT( + string key, + string min, + string max +); + +/** + * ZPOPMAX + * + * Remove and return members with the highest scores in a sorted set + * + * Time complexity: O(log(N)*M) with N being the number of elements in the sorted set, and M + * being the number of elements popped. + * Annotated return value: array + */ +int ZPOPMAX( + string key, + // Redis type: integer + int count = 0 +); + +/** + * ZPOPMIN + * + * Remove and return members with the lowest scores in a sorted set + * + * Time complexity: O(log(N)*M) with N being the number of elements in the sorted set, and M + * being the number of elements popped. + * Annotated return value: array + */ +int ZPOPMIN( + string key, + // Redis type: integer + int count = 0 +); + +/** + * ZRANGE + * + * Return a range of members in a sorted set, by index + * + * Time complexity: O(log(N)+M) with N being the number of elements in the sorted set and M the + * number of elements returned. + + * - Valid values for withscores: "WITHSCORES" + * Annotated return value: array + */ +int ZRANGE( + string key, + // Redis type: integer + int start, + // Redis type: integer + int stop, + // Redis type: enum + string withscores = "" +); + +/** + * ZRANGEBYLEX + * + * Return a range of members in a sorted set, by lexicographical range + * + * Time complexity: O(log(N)+M) with N being the number of elements in the sorted set and M the + * number of elements being returned. If M is constant (e.g. always asking for + * the first 10 elements with LIMIT), you can consider it O(log(N)). + * Annotated return value: array + */ +int ZRANGEBYLEX( + string key, + string min, + string max, + // Redis type: integer + int limit_offset = 0, + // Redis type: integer + int limit_count = 0 +); + +/** + * ZREVRANGEBYLEX + * + * Return a range of members in a sorted set, by lexicographical range, ordered from higher to lower strings. + * + * Time complexity: O(log(N)+M) with N being the number of elements in the sorted set and M the + * number of elements being returned. If M is constant (e.g. always asking for + * the first 10 elements with LIMIT), you can consider it O(log(N)). + * Annotated return value: array + */ +int ZREVRANGEBYLEX( + string key, + string max, + string min, + // Redis type: integer + int limit_offset = 0, + // Redis type: integer + int limit_count = 0 +); + +/** + * ZRANGEBYSCORE + * + * Return a range of members in a sorted set, by score + * + * Time complexity: O(log(N)+M) with N being the number of elements in the sorted set and M the + * number of elements being returned. If M is constant (e.g. always asking for + * the first 10 elements with LIMIT), you can consider it O(log(N)). + + * - Valid values for withscores: "WITHSCORES" + * Annotated return value: array + */ +int ZRANGEBYSCORE( + string key, + // Redis type: double + float min, + // Redis type: double + float max, + // Redis type: enum + string withscores = "", + // Redis type: integer + int limit_offset = 0, + // Redis type: integer + int limit_count = 0 +); + +/** + * ZRANK + * + * Determine the index of a member in a sorted set + * + * Time complexity: O(log(N)) + * Annotated return value: integer + */ +int ZRANK( + string key, + string member +); + +/** + * ZREM + * + * Remove one or more members from a sorted set + * + * Time complexity: O(M*log(N)) with N being the number of elements in the sorted set and M the + * number of elements to be removed. + * Annotated return value: integer + */ +int ZREM( + string key, + string member +); + +/** + * ZREMRANGEBYLEX + * + * Remove all members in a sorted set between the given lexicographical range + * + * Time complexity: O(log(N)+M) with N being the number of elements in the sorted set and M the + * number of elements removed by the operation. + * Annotated return value: integer + */ +int ZREMRANGEBYLEX( + string key, + string min, + string max +); + +/** + * ZREMRANGEBYRANK + * + * Remove all members in a sorted set within the given indexes + * + * Time complexity: O(log(N)+M) with N being the number of elements in the sorted set and M the + * number of elements removed by the operation. + * Annotated return value: integer + */ +int ZREMRANGEBYRANK( + string key, + // Redis type: integer + int start, + // Redis type: integer + int stop +); + +/** + * ZREMRANGEBYSCORE + * + * Remove all members in a sorted set within the given scores + * + * Time complexity: O(log(N)+M) with N being the number of elements in the sorted set and M the + * number of elements removed by the operation. + * Annotated return value: integer + */ +int ZREMRANGEBYSCORE( + string key, + // Redis type: double + float min, + // Redis type: double + float max +); + +/** + * ZREVRANGE + * + * Return a range of members in a sorted set, by index, with scores ordered from high to low + * + * Time complexity: O(log(N)+M) with N being the number of elements in the sorted set and M the + * number of elements returned. + + * - Valid values for withscores: "WITHSCORES" + * Annotated return value: array + */ +int ZREVRANGE( + string key, + // Redis type: integer + int start, + // Redis type: integer + int stop, + // Redis type: enum + string withscores = "" +); + +/** + * ZREVRANGEBYSCORE + * + * Return a range of members in a sorted set, by score, with scores ordered from high to low + * + * Time complexity: O(log(N)+M) with N being the number of elements in the sorted set and M the + * number of elements being returned. If M is constant (e.g. always asking for + * the first 10 elements with LIMIT), you can consider it O(log(N)). + + * - Valid values for withscores: "WITHSCORES" + * Annotated return value: array + */ +int ZREVRANGEBYSCORE( + string key, + // Redis type: double + float max, + // Redis type: double + float min, + // Redis type: enum + string withscores = "", + // Redis type: integer + int limit_offset = 0, + // Redis type: integer + int limit_count = 0 +); + +/** + * ZREVRANK + * + * Determine the index of a member in a sorted set, with scores ordered from high to low + * + * Time complexity: O(log(N)) + * Annotated return value: integer + */ +int ZREVRANK( + string key, + string member +); + +/** + * ZSCORE + * + * Get the score associated with the given member in a sorted set + * + * Time complexity: O(1) + * Annotated return value: bulk-string + */ +int ZSCORE( + string key, + string member +); + +/** + * ZUNIONSTORE + * + * Add multiple sorted sets and store the resulting sorted set in a new key + * + * Time complexity: O(N)+O(M log(M)) with N being the sum of the sizes of the input sorted sets, + * and M being the number of elements in the resulting sorted set. + + * - Valid values for aggregate_aggregate: "SUM", "MIN", "MAX" + * Annotated return value: integer + */ +int ZUNIONSTORE( + // Redis type: key + string destination, + // Redis type: integer + int numkeys, + string key, + // Redis type: integer + int weights_weight = 0, + // Redis type: enum + string aggregate_aggregate = "" +); + +/** + * SCAN + * + * Incrementally iterate the keys space + * + * 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: + */ +int SCAN( + // Redis type: integer + int cursor, + // Redis type: pattern + string match_pattern = "", + // Redis type: integer + int count_count = 0, + string type_type = "" +); + +/** + * SSCAN + * + * Incrementally iterate Set elements + * + * 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: + */ +int SSCAN( + string key, + // Redis type: integer + int cursor, + // Redis type: pattern + string match_pattern = "", + // Redis type: integer + int count_count = 0 +); + +/** + * HSCAN + * + * Incrementally iterate hash fields and associated values + * + * 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: + */ +int HSCAN( + string key, + // Redis type: integer + int cursor, + // Redis type: pattern + string match_pattern = "", + // Redis type: integer + int count_count = 0 +); + +/** + * ZSCAN + * + * Incrementally iterate sorted sets elements and associated scores + * + * 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: + */ +int ZSCAN( + string key, + // Redis type: integer + int cursor, + // Redis type: pattern + string match_pattern = "", + // Redis type: integer + int count_count = 0 +); + +/** + * XINFO + * + * Get information on streams and consumer groups + * + * Time complexity: O(N) with N being the number of returned items for the subcommands CONSUMERS + * and GROUPS. The STREAM subcommand is O(log N) with N being the number of + * items in the stream. + + * - Valid values for help: "HELP" + * Annotated return value: + */ +int XINFO( + // Redis type: key + string consumers_key = "", + string consumers_groupname = "", + // Redis type: key + string groups_key = "", + // Redis type: key + string stream_key = "", + // Redis type: enum + string help = "" +); + +/** + * XADD + * + * Appends a new entry to a stream + * + * Time complexity: O(1) + * Annotated return value: bulk-string + */ +int XADD( + string key, + string ID, + // Redis type: value + string field, + string str +); + +/** + * XTRIM + * + * Trims the stream to (approximately if '~' is passed) a certain size + * + * Time complexity: O(N), with N being the number of evicted entries. Constant times are very + * small however, since entries are organized in macro nodes containing + * multiple entries that can be released with a single deallocation. + + * - Valid values for strategy: "MAXLEN" + + * - Valid values for approx: "~" + * Annotated return value: integer + */ +int XTRIM( + string key, + // Redis type: enum + string strategy, + // Redis type: enum + string approx = "", + // Redis type: integer + int count = 0 +); + +/** + * XDEL + * + * Removes the specified entries from the stream. Returns the number of items actually deleted, that may be different from the number of IDs passed in case certain IDs do not exist. + * + * Time complexity: O(1) for each single item to delete in the stream, regardless of the stream + * size. + * Annotated return value: integer + */ +int XDEL( + string key, + string ID +); + +/** + * XRANGE + * + * Return a range of elements in a stream, with IDs matching the specified IDs interval + * + * Time complexity: O(N) with N being the number of elements being returned. If N is constant + * (e.g. always asking for the first 10 elements with COUNT), you can consider + * it O(1). + * Annotated return value: array + */ +int XRANGE( + string key, + string start, + string end, + // Redis type: integer + int count_count = 0 +); + +/** + * XREVRANGE + * + * Return a range of elements in a stream, with IDs matching the specified IDs interval, in reverse order (from greater to smaller IDs) compared to XRANGE + * + * Time complexity: O(N) with N being the number of elements returned. If N is constant (e.g. + * always asking for the first 10 elements with COUNT), you can consider it + * O(1). + * Annotated return value: array + */ +int XREVRANGE( + string key, + string end, + string start, + // Redis type: integer + int count_count = 0 +); + +/** + * XLEN + * + * Return the number of entries in a stream + * + * Time complexity: O(1) + * Annotated return value: integer + */ +int XLEN( + string key +); + +/** + * XREAD + * + * Return never seen elements in multiple streams, with IDs greater than the ones reported by the caller for each stream. Can block. + * + * Time complexity: For each stream mentioned: O(N) with N being the number of elements being + * returned, it means that XREAD-ing with a fixed COUNT is O(1). Note that when + * the BLOCK option is used, XADD will pay O(M) time in order to serve the M + * clients blocked on the stream getting new data. + + * - Valid values for streams: "STREAMS" + * Annotated return value: array + */ +int XREAD( + // Redis type: integer + int count_count = 0, + // Redis type: integer + int block_milliseconds = 0, + // Redis type: enum + string streams = "", + string key = "", + string ID = "" +); + +/** + * XGROUP + * + * Create, destroy, and manage consumer groups. + * + * 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: + */ +int XGROUP( + // Redis type: key + string create_key = "", + string create_groupname = "", + string create_id_or__ = "", + // Redis type: key + string setid_key = "", + string setid_groupname = "", + string setid_id_or__ = "", + // Redis type: key + string destroy_key = "", + string destroy_groupname = "", + // Redis type: key + string delconsumer_key = "", + string delconsumer_groupname = "", + string delconsumer_consumername = "" +); + +/** + * XREADGROUP + * + * Return new entries from a stream using a consumer group, or access the history of the pending entries for a given consumer. Can block. + * + * Time complexity: For each stream mentioned: O(M) with M being the number of elements + * returned. If M is constant (e.g. always asking for the first 10 elements + * with COUNT), you can consider it O(1). On the other side when XREADGROUP + * blocks, XADD will pay the O(N) time in order to serve the N clients blocked + * on the stream getting new data. + + * - Valid values for noack: "NOACK" + + * - Valid values for streams: "STREAMS" + * Annotated return value: + */ +int XREADGROUP( + string group_group, + string group_consumer, + // Redis type: integer + int count_count = 0, + // Redis type: integer + int block_milliseconds = 0, + // Redis type: enum + string noack = "", + // Redis type: enum + string streams = "", + string key = "", + string ID = "" +); + +/** + * XACK + * + * Marks a pending message as correctly processed, effectively removing it from the pending entries list of the consumer group. Return value of the command is the number of messages successfully acknowledged, that is, the IDs we were actually able to resolve in the PEL. + * + * Time complexity: O(1) for each message ID processed. + * Annotated return value: integer + */ +int XACK( + string key, + string group, + string ID +); + +/** + * XCLAIM + * + * Changes (or acquires) ownership of a message in a consumer group, as if the message was delivered to the specified consumer. + * + * Time complexity: O(log N) with N being the number of messages in the PEL of the consumer + * group. + * Annotated return value: array + */ +int XCLAIM( + string key, + string group, + string consumer, + string min_idle_time, + string ID, + // Redis type: integer + int idle_ms = 0, + // Redis type: integer + int time_ms_unix_time = 0, + // Redis type: integer + int retrycount_count = 0 +); + +/** + * XPENDING + * + * Return information and entries from a stream consumer group pending entries list, that are messages fetched but never acknowledged. + * + * Time complexity: O(N) with N being the number of elements returned, so asking for a small + * fixed number of entries per call is O(1). When the command returns just the + * summary it runs in O(1) time assuming the list of consumers is small, + * otherwise there is additional O(N) time needed to iterate every consumer. + * Annotated return value: array + */ +int XPENDING( + string key, + string group, + string start = "", + string end = "", + // Redis type: integer + int count = 0, + string consumer = "" +); + + + +// Implementation below +int APPEND( + string key, + string value +) { + NWNXPushString("APPEND"); + NWNXPushString(key); + NWNXPushString(value); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int AUTH( + string password +) { + NWNXPushString("AUTH"); + NWNXPushString(password); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int BGREWRITEAOF() { + NWNXPushString("BGREWRITEAOF"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int BGSAVE() { + NWNXPushString("BGSAVE"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int BITCOUNT( + string key, + // Redis type: integer + int start = 0, + // Redis type: integer + int end = 0 +) { + NWNXPushString("BITCOUNT"); + NWNXPushString(key); + if (start != 0) NWNXPushString(IntToString(start)); + if (end != 0) NWNXPushString(IntToString(end)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int BITFIELD( + string key, + // Redis type: type + string get_type = "", + // Redis type: integer + int get_offset = 0, + // Redis type: type + string set_type = "", + // Redis type: integer + int set_offset = 0, + // Redis type: integer + int set_value = 0, + // Redis type: type + string incrby_type = "", + // Redis type: integer + int incrby_offset = 0, + // Redis type: integer + int incrby_increment = 0 +) { + 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( + string operation, + // Redis type: key + string destkey, + string key +) { + NWNXPushString("BITOP"); + NWNXPushString(operation); + NWNXPushString(destkey); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int BITPOS( + string key, + // Redis type: integer + int bit, + // Redis type: integer + int start = 0, + // Redis type: integer + int end = 0 +) { + 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( + string key, + // Redis type: integer + int timeout +) { + NWNXPushString("BLPOP"); + NWNXPushString(key); + NWNXPushString(IntToString(timeout)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int BRPOP( + string key, + // Redis type: integer + int timeout +) { + NWNXPushString("BRPOP"); + NWNXPushString(key); + NWNXPushString(IntToString(timeout)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int BRPOPLPUSH( + // Redis type: key + string source, + // Redis type: key + string destination, + // Redis type: integer + int timeout +) { + NWNXPushString("BRPOPLPUSH"); + NWNXPushString(source); + NWNXPushString(destination); + NWNXPushString(IntToString(timeout)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int BZPOPMIN( + string key, + // Redis type: integer + int timeout +) { + NWNXPushString("BZPOPMIN"); + NWNXPushString(key); + NWNXPushString(IntToString(timeout)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int BZPOPMAX( + string key, + // Redis type: integer + int timeout +) { + NWNXPushString("BZPOPMAX"); + NWNXPushString(key); + NWNXPushString(IntToString(timeout)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int CLIENT_ID() { + NWNXPushString("CLIENT_ID"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int CLIENT_KILL( + string ip_port = "", + // Redis type: integer + int id_client_id = 0, + string addr_ip_port = "", + string skipme_yes_no = "" +) { + 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() { + NWNXPushString("CLIENT_LIST"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int CLIENT_GETNAME() { + NWNXPushString("CLIENT_GETNAME"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int CLIENT_PAUSE( + // Redis type: integer + int timeout +) { + NWNXPushString("CLIENT_PAUSE"); + NWNXPushString(IntToString(timeout)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int CLIENT_REPLY( + // Redis type: enum + string reply_mode +) { + NWNXPushString("CLIENT_REPLY"); + NWNXPushString(reply_mode); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int CLIENT_SETNAME( + string connection_name +) { + NWNXPushString("CLIENT_SETNAME"); + NWNXPushString(connection_name); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int CLIENT_UNBLOCK( + string client_id, + // Redis type: enum + string unblock_type = "" +) { + 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 +) { + NWNXPushString("CLUSTER_ADDSLOTS"); + NWNXPushString(IntToString(slot)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int CLUSTER_COUNT_FAILURE_REPORTS( + string node_id +) { + NWNXPushString("CLUSTER_COUNT_FAILURE_REPORTS"); + NWNXPushString(node_id); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int CLUSTER_COUNTKEYSINSLOT( + // Redis type: integer + int slot +) { + NWNXPushString("CLUSTER_COUNTKEYSINSLOT"); + NWNXPushString(IntToString(slot)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int CLUSTER_DELSLOTS( + // Redis type: integer + int slot +) { + NWNXPushString("CLUSTER_DELSLOTS"); + NWNXPushString(IntToString(slot)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int CLUSTER_FAILOVER( + // Redis type: enum + string options = "" +) { + NWNXPushString("CLUSTER_FAILOVER"); + if (options != "") NWNXPushString(options); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int CLUSTER_FORGET( + string node_id +) { + NWNXPushString("CLUSTER_FORGET"); + NWNXPushString(node_id); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int CLUSTER_GETKEYSINSLOT( + // Redis type: integer + int slot, + // Redis type: integer + int count +) { + NWNXPushString("CLUSTER_GETKEYSINSLOT"); + NWNXPushString(IntToString(slot)); + NWNXPushString(IntToString(count)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int CLUSTER_INFO() { + NWNXPushString("CLUSTER_INFO"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int CLUSTER_KEYSLOT( + string key +) { + NWNXPushString("CLUSTER_KEYSLOT"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int CLUSTER_MEET( + string ip, + // Redis type: integer + int port +) { + NWNXPushString("CLUSTER_MEET"); + NWNXPushString(ip); + NWNXPushString(IntToString(port)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int CLUSTER_NODES() { + NWNXPushString("CLUSTER_NODES"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int CLUSTER_REPLICATE( + string node_id +) { + NWNXPushString("CLUSTER_REPLICATE"); + NWNXPushString(node_id); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int CLUSTER_RESET( + // Redis type: enum + string reset_type = "" +) { + NWNXPushString("CLUSTER_RESET"); + if (reset_type != "") NWNXPushString(reset_type); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int CLUSTER_SAVECONFIG() { + NWNXPushString("CLUSTER_SAVECONFIG"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int CLUSTER_SET_CONFIG_EPOCH( + // Redis type: integer + int config_epoch +) { + NWNXPushString("CLUSTER_SET_CONFIG_EPOCH"); + NWNXPushString(IntToString(config_epoch)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int CLUSTER_SETSLOT( + // Redis type: integer + int slot, + // Redis type: enum + string subcommand, + string node_id = "" +) { + 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 +) { + NWNXPushString("CLUSTER_SLAVES"); + NWNXPushString(node_id); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int CLUSTER_REPLICAS( + string node_id +) { + NWNXPushString("CLUSTER_REPLICAS"); + NWNXPushString(node_id); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int CLUSTER_SLOTS() { + NWNXPushString("CLUSTER_SLOTS"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int COMMAND() { + NWNXPushString("COMMAND"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int COMMAND_COUNT() { + NWNXPushString("COMMAND_COUNT"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int COMMAND_GETKEYS() { + NWNXPushString("COMMAND_GETKEYS"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int COMMAND_INFO( + string command_name +) { + NWNXPushString("COMMAND_INFO"); + NWNXPushString(command_name); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int CONFIG_GET( + string parameter +) { + NWNXPushString("CONFIG_GET"); + NWNXPushString(parameter); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int CONFIG_REWRITE() { + NWNXPushString("CONFIG_REWRITE"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int CONFIG_SET( + string parameter, + string value +) { + NWNXPushString("CONFIG_SET"); + NWNXPushString(parameter); + NWNXPushString(value); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int CONFIG_RESETSTAT() { + NWNXPushString("CONFIG_RESETSTAT"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int DBSIZE() { + NWNXPushString("DBSIZE"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int DEBUG_OBJECT( + string key +) { + NWNXPushString("DEBUG_OBJECT"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int DEBUG_SEGFAULT() { + NWNXPushString("DEBUG_SEGFAULT"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int DECR( + string key +) { + NWNXPushString("DECR"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int DECRBY( + string key, + // Redis type: integer + int decrement +) { + NWNXPushString("DECRBY"); + NWNXPushString(key); + NWNXPushString(IntToString(decrement)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int DEL( + string key +) { + NWNXPushString("DEL"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int DISCARD() { + NWNXPushString("DISCARD"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int DUMP( + string key +) { + NWNXPushString("DUMP"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int ECHO( + string message +) { + NWNXPushString("ECHO"); + NWNXPushString(message); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int EVAL( + string script, + // Redis type: integer + int numkeys, + string key, + string arg +) { + NWNXPushString("EVAL"); + NWNXPushString(script); + NWNXPushString(IntToString(numkeys)); + NWNXPushString(key); + NWNXPushString(arg); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int EVALSHA( + string sha1, + // Redis type: integer + int numkeys, + string key, + string arg +) { + NWNXPushString("EVALSHA"); + NWNXPushString(sha1); + NWNXPushString(IntToString(numkeys)); + NWNXPushString(key); + NWNXPushString(arg); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int EXEC() { + NWNXPushString("EXEC"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int EXISTS( + string key +) { + NWNXPushString("EXISTS"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int EXPIRE( + string key, + // Redis type: integer + int seconds +) { + NWNXPushString("EXPIRE"); + NWNXPushString(key); + NWNXPushString(IntToString(seconds)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int EXPIREAT( + string key, + // Redis type: posix time + string timestamp +) { + NWNXPushString("EXPIREAT"); + NWNXPushString(key); + NWNXPushString(timestamp); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int FLUSHALL( + // Redis type: enum + string async = "" +) { + NWNXPushString("FLUSHALL"); + if (async != "") NWNXPushString(async); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int FLUSHDB( + // Redis type: enum + string async = "" +) { + NWNXPushString("FLUSHDB"); + if (async != "") NWNXPushString(async); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int GEOADD( + string key, + // Redis type: double + float longitude, + // Redis type: double + float latitude, + string member +) { + 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 +) { + NWNXPushString("GEOHASH"); + NWNXPushString(key); + NWNXPushString(member); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int GEOPOS( + string key, + string member +) { + NWNXPushString("GEOPOS"); + NWNXPushString(key); + NWNXPushString(member); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int GEODIST( + string key, + string member1, + string member2, + string unit = "" +) { + NWNXPushString("GEODIST"); + NWNXPushString(key); + NWNXPushString(member1); + NWNXPushString(member2); + if (unit != "") NWNXPushString(unit); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int GEORADIUS( + string key, + // Redis type: double + float longitude, + // Redis type: double + float latitude, + // Redis type: double + float radius, + // Redis type: enum + string unit, + // Redis type: enum + string withcoord = "", + // Redis type: enum + string withdist = "", + // Redis type: enum + string withhash = "", + // Redis type: integer + int count_count = 0, + // Redis type: enum + string order = "", + // Redis type: key + string store_key = "", + // Redis type: key + string storedist_key = "" +) { + 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( + string key, + string member, + // Redis type: double + float radius, + // Redis type: enum + string unit, + // Redis type: enum + string withcoord = "", + // Redis type: enum + string withdist = "", + // Redis type: enum + string withhash = "", + // Redis type: integer + int count_count = 0, + // Redis type: enum + string order = "", + // Redis type: key + string store_key = "", + // Redis type: key + string storedist_key = "" +) { + 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 +) { + NWNXPushString("GET"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int GETBIT( + string key, + // Redis type: integer + int offset +) { + NWNXPushString("GETBIT"); + NWNXPushString(key); + NWNXPushString(IntToString(offset)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int GETRANGE( + string key, + // Redis type: integer + int start, + // Redis type: integer + int end +) { + NWNXPushString("GETRANGE"); + NWNXPushString(key); + NWNXPushString(IntToString(start)); + NWNXPushString(IntToString(end)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int GETSET( + string key, + string value +) { + NWNXPushString("GETSET"); + NWNXPushString(key); + NWNXPushString(value); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int HDEL( + string key, + string field +) { + NWNXPushString("HDEL"); + NWNXPushString(key); + NWNXPushString(field); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int HEXISTS( + string key, + string field +) { + NWNXPushString("HEXISTS"); + NWNXPushString(key); + NWNXPushString(field); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int HGET( + string key, + string field +) { + NWNXPushString("HGET"); + NWNXPushString(key); + NWNXPushString(field); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int HGETALL( + string key +) { + NWNXPushString("HGETALL"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int HINCRBY( + string key, + string field, + // Redis type: integer + int increment +) { + NWNXPushString("HINCRBY"); + NWNXPushString(key); + NWNXPushString(field); + NWNXPushString(IntToString(increment)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int HINCRBYFLOAT( + string key, + string field, + // Redis type: double + float increment +) { + NWNXPushString("HINCRBYFLOAT"); + NWNXPushString(key); + NWNXPushString(field); + NWNXPushString(FloatToString(increment, 0)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int HKEYS( + string key +) { + NWNXPushString("HKEYS"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int HLEN( + string key +) { + NWNXPushString("HLEN"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int HMGET( + string key, + string field +) { + NWNXPushString("HMGET"); + NWNXPushString(key); + NWNXPushString(field); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int HMSET( + string key, + string field, + string value +) { + NWNXPushString("HMSET"); + NWNXPushString(key); + NWNXPushString(field); + NWNXPushString(value); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int HSET( + string key, + string field, + string value +) { + NWNXPushString("HSET"); + NWNXPushString(key); + NWNXPushString(field); + NWNXPushString(value); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int HSETNX( + string key, + string field, + string value +) { + NWNXPushString("HSETNX"); + NWNXPushString(key); + NWNXPushString(field); + NWNXPushString(value); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int HSTRLEN( + string key, + string field +) { + NWNXPushString("HSTRLEN"); + NWNXPushString(key); + NWNXPushString(field); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int HVALS( + string key +) { + NWNXPushString("HVALS"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int INCR( + string key +) { + NWNXPushString("INCR"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int INCRBY( + string key, + // Redis type: integer + int increment +) { + NWNXPushString("INCRBY"); + NWNXPushString(key); + NWNXPushString(IntToString(increment)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int INCRBYFLOAT( + string key, + // Redis type: double + float increment +) { + NWNXPushString("INCRBYFLOAT"); + NWNXPushString(key); + NWNXPushString(FloatToString(increment, 0)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int INFO( + string section = "" +) { + NWNXPushString("INFO"); + if (section != "") NWNXPushString(section); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int KEYS( + string pattern +) { + NWNXPushString("KEYS"); + NWNXPushString(pattern); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int LASTSAVE() { + NWNXPushString("LASTSAVE"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int LINDEX( + string key, + // Redis type: integer + int index +) { + NWNXPushString("LINDEX"); + NWNXPushString(key); + NWNXPushString(IntToString(index)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int LINSERT( + string key, + // Redis type: enum + string where, + string pivot, + string value +) { + NWNXPushString("LINSERT"); + NWNXPushString(key); + NWNXPushString(where); + NWNXPushString(pivot); + NWNXPushString(value); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int LLEN( + string key +) { + NWNXPushString("LLEN"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int LPOP( + string key +) { + NWNXPushString("LPOP"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int LPUSH( + string key, + string value +) { + NWNXPushString("LPUSH"); + NWNXPushString(key); + NWNXPushString(value); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int LPUSHX( + string key, + string value +) { + NWNXPushString("LPUSHX"); + NWNXPushString(key); + NWNXPushString(value); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int LRANGE( + string key, + // Redis type: integer + int start, + // Redis type: integer + int stop +) { + NWNXPushString("LRANGE"); + NWNXPushString(key); + NWNXPushString(IntToString(start)); + NWNXPushString(IntToString(stop)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int LREM( + string key, + // Redis type: integer + int count, + string value +) { + NWNXPushString("LREM"); + NWNXPushString(key); + NWNXPushString(IntToString(count)); + NWNXPushString(value); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int LSET( + string key, + // Redis type: integer + int index, + string value +) { + NWNXPushString("LSET"); + NWNXPushString(key); + NWNXPushString(IntToString(index)); + NWNXPushString(value); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int LTRIM( + string key, + // Redis type: integer + int start, + // Redis type: integer + int stop +) { + NWNXPushString("LTRIM"); + NWNXPushString(key); + NWNXPushString(IntToString(start)); + NWNXPushString(IntToString(stop)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int MEMORY_DOCTOR() { + NWNXPushString("MEMORY_DOCTOR"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int MEMORY_HELP() { + NWNXPushString("MEMORY_HELP"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int MEMORY_MALLOC_STATS() { + NWNXPushString("MEMORY_MALLOC_STATS"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int MEMORY_PURGE() { + NWNXPushString("MEMORY_PURGE"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int MEMORY_STATS() { + NWNXPushString("MEMORY_STATS"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int MEMORY_USAGE( + string key, + // Redis type: integer + int samples_count = 0 +) { + NWNXPushString("MEMORY_USAGE"); + NWNXPushString(key); + if (samples_count != 0) NWNXPushString(IntToString(samples_count)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int MGET( + string key +) { + NWNXPushString("MGET"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int MIGRATE( + string host, + string port, + // Redis type: enum + string key, + // Redis type: integer + int destination_db, + // Redis type: integer + int timeout, + // Redis type: enum + string copy = "", + // Redis type: enum + string replace = "", + string auth_password = "", + // Redis type: key + string keys_key = "" +) { + 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() { + NWNXPushString("MONITOR"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int MOVE( + string key, + // Redis type: integer + int db +) { + NWNXPushString("MOVE"); + NWNXPushString(key); + NWNXPushString(IntToString(db)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int MSET( + string key, + string value +) { + NWNXPushString("MSET"); + NWNXPushString(key); + NWNXPushString(value); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int MSETNX( + string key, + string value +) { + NWNXPushString("MSETNX"); + NWNXPushString(key); + NWNXPushString(value); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int MULTI() { + NWNXPushString("MULTI"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int OBJECT( + string subcommand, + string arguments = "" +) { + NWNXPushString("OBJECT"); + NWNXPushString(subcommand); + if (arguments != "") NWNXPushString(arguments); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int PERSIST( + string key +) { + NWNXPushString("PERSIST"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int PEXPIRE( + string key, + // Redis type: integer + int milliseconds +) { + NWNXPushString("PEXPIRE"); + NWNXPushString(key); + NWNXPushString(IntToString(milliseconds)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int PEXPIREAT( + string key, + // Redis type: posix time + string milliseconds_timestamp +) { + NWNXPushString("PEXPIREAT"); + NWNXPushString(key); + NWNXPushString(milliseconds_timestamp); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int PFADD( + string key, + string element +) { + NWNXPushString("PFADD"); + NWNXPushString(key); + NWNXPushString(element); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int PFCOUNT( + string key +) { + NWNXPushString("PFCOUNT"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int PFMERGE( + // Redis type: key + string destkey, + // Redis type: key + string sourcekey +) { + NWNXPushString("PFMERGE"); + NWNXPushString(destkey); + NWNXPushString(sourcekey); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int PING( + string message = "" +) { + NWNXPushString("PING"); + if (message != "") NWNXPushString(message); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int PSETEX( + string key, + // Redis type: integer + int milliseconds, + string value +) { + NWNXPushString("PSETEX"); + NWNXPushString(key); + NWNXPushString(IntToString(milliseconds)); + NWNXPushString(value); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int PUBSUB( + string subcommand, + string argument = "" +) { + NWNXPushString("PUBSUB"); + NWNXPushString(subcommand); + if (argument != "") NWNXPushString(argument); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int PTTL( + string key +) { + NWNXPushString("PTTL"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int PUBLISH( + string channel, + string message +) { + NWNXPushString("PUBLISH"); + NWNXPushString(channel); + NWNXPushString(message); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int QUIT() { + NWNXPushString("QUIT"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int RANDOMKEY() { + NWNXPushString("RANDOMKEY"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int READONLY() { + NWNXPushString("READONLY"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int READWRITE() { + NWNXPushString("READWRITE"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int RENAME( + string key, + // Redis type: key + string newkey +) { + NWNXPushString("RENAME"); + NWNXPushString(key); + NWNXPushString(newkey); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int RENAMENX( + string key, + // Redis type: key + string newkey +) { + NWNXPushString("RENAMENX"); + NWNXPushString(key); + NWNXPushString(newkey); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int RESTORE( + string key, + // Redis type: integer + int ttl, + string serialized_value, + // Redis type: enum + string replace = "", + // Redis type: enum + string absttl = "", + // Redis type: integer + int idletime_seconds = 0, + // Redis type: integer + int freq_frequency = 0 +) { + 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() { + NWNXPushString("ROLE"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int RPOP( + string key +) { + NWNXPushString("RPOP"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int RPOPLPUSH( + // Redis type: key + string source, + // Redis type: key + string destination +) { + NWNXPushString("RPOPLPUSH"); + NWNXPushString(source); + NWNXPushString(destination); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int RPUSH( + string key, + string value +) { + NWNXPushString("RPUSH"); + NWNXPushString(key); + NWNXPushString(value); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int RPUSHX( + string key, + string value +) { + NWNXPushString("RPUSHX"); + NWNXPushString(key); + NWNXPushString(value); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int SADD( + string key, + string member +) { + NWNXPushString("SADD"); + NWNXPushString(key); + NWNXPushString(member); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int SAVE() { + NWNXPushString("SAVE"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int SCARD( + string key +) { + NWNXPushString("SCARD"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int SCRIPT_DEBUG( + // Redis type: enum + string mode +) { + NWNXPushString("SCRIPT_DEBUG"); + NWNXPushString(mode); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int SCRIPT_EXISTS( + string sha1 +) { + NWNXPushString("SCRIPT_EXISTS"); + NWNXPushString(sha1); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int SCRIPT_FLUSH() { + NWNXPushString("SCRIPT_FLUSH"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int SCRIPT_KILL() { + NWNXPushString("SCRIPT_KILL"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int SCRIPT_LOAD( + string script +) { + NWNXPushString("SCRIPT_LOAD"); + NWNXPushString(script); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int SDIFF( + string key +) { + NWNXPushString("SDIFF"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int SDIFFSTORE( + // Redis type: key + string destination, + string key +) { + NWNXPushString("SDIFFSTORE"); + NWNXPushString(destination); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int SELECT( + // Redis type: integer + int index +) { + NWNXPushString("SELECT"); + NWNXPushString(IntToString(index)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int SET( + string key, + string value, + // Redis type: enum + string condition = "" +) { + NWNXPushString("SET"); + NWNXPushString(key); + NWNXPushString(value); + if (condition != "") NWNXPushString(condition); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int SETBIT( + string key, + // Redis type: integer + int offset, + string value +) { + NWNXPushString("SETBIT"); + NWNXPushString(key); + NWNXPushString(IntToString(offset)); + NWNXPushString(value); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int SETEX( + string key, + // Redis type: integer + int seconds, + string value +) { + NWNXPushString("SETEX"); + NWNXPushString(key); + NWNXPushString(IntToString(seconds)); + NWNXPushString(value); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int SETNX( + string key, + string value +) { + NWNXPushString("SETNX"); + NWNXPushString(key); + NWNXPushString(value); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int SETRANGE( + string key, + // Redis type: integer + int offset, + string value +) { + NWNXPushString("SETRANGE"); + NWNXPushString(key); + NWNXPushString(IntToString(offset)); + NWNXPushString(value); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int SHUTDOWN( + // Redis type: enum + string save_mode = "" +) { + NWNXPushString("SHUTDOWN"); + if (save_mode != "") NWNXPushString(save_mode); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int SINTER( + string key +) { + NWNXPushString("SINTER"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int SINTERSTORE( + // Redis type: key + string destination, + string key +) { + NWNXPushString("SINTERSTORE"); + NWNXPushString(destination); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int SISMEMBER( + string key, + string member +) { + NWNXPushString("SISMEMBER"); + NWNXPushString(key); + NWNXPushString(member); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int SLAVEOF( + string host, + string port +) { + NWNXPushString("SLAVEOF"); + NWNXPushString(host); + NWNXPushString(port); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int REPLICAOF( + string host, + string port +) { + NWNXPushString("REPLICAOF"); + NWNXPushString(host); + NWNXPushString(port); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int SLOWLOG( + string subcommand, + string argument = "" +) { + NWNXPushString("SLOWLOG"); + NWNXPushString(subcommand); + if (argument != "") NWNXPushString(argument); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int SMEMBERS( + string key +) { + NWNXPushString("SMEMBERS"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int SMOVE( + // Redis type: key + string source, + // Redis type: key + string destination, + string member +) { + NWNXPushString("SMOVE"); + NWNXPushString(source); + NWNXPushString(destination); + NWNXPushString(member); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int SORT( + string key, + // Redis type: pattern + string by_pattern = "", + // Redis type: integer + int limit_offset = 0, + // Redis type: integer + int limit_count = 0, + string get_pattern = "", + // Redis type: enum + string order = "", + // Redis type: enum + string sorting = "", + // Redis type: key + string store_destination = "" +) { + 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( + string key, + // Redis type: integer + int count = 0 +) { + NWNXPushString("SPOP"); + NWNXPushString(key); + if (count != 0) NWNXPushString(IntToString(count)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int SRANDMEMBER( + string key, + // Redis type: integer + int count = 0 +) { + NWNXPushString("SRANDMEMBER"); + NWNXPushString(key); + if (count != 0) NWNXPushString(IntToString(count)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int SREM( + string key, + string member +) { + NWNXPushString("SREM"); + NWNXPushString(key); + NWNXPushString(member); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int STRLEN( + string key +) { + NWNXPushString("STRLEN"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int SUNION( + string key +) { + NWNXPushString("SUNION"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int SUNIONSTORE( + // Redis type: key + string destination, + string key +) { + NWNXPushString("SUNIONSTORE"); + NWNXPushString(destination); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int SWAPDB( + // Redis type: integer + int index, + // Redis type: integer + int index_1 +) { + NWNXPushString("SWAPDB"); + NWNXPushString(IntToString(index)); + NWNXPushString(IntToString(index_1)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int SYNC() { + NWNXPushString("SYNC"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int TIME() { + NWNXPushString("TIME"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int TOUCH( + string key +) { + NWNXPushString("TOUCH"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int TTL( + string key +) { + NWNXPushString("TTL"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int TYPE( + string key +) { + NWNXPushString("TYPE"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int UNLINK( + string key +) { + NWNXPushString("UNLINK"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int UNWATCH() { + NWNXPushString("UNWATCH"); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int WAIT( + // Redis type: integer + int numreplicas, + // Redis type: integer + int timeout +) { + NWNXPushString("WAIT"); + NWNXPushString(IntToString(numreplicas)); + NWNXPushString(IntToString(timeout)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int WATCH( + string key +) { + NWNXPushString("WATCH"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int ZADD( + string key, + // Redis type: enum + string condition = "", + // Redis type: enum + string change = "", + // Redis type: enum + string increment = "", + // Redis type: double + float score = 0.0, + string member = "" +) { + 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 +) { + NWNXPushString("ZCARD"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int ZCOUNT( + string key, + // Redis type: double + float min, + // Redis type: double + float max +) { + NWNXPushString("ZCOUNT"); + NWNXPushString(key); + NWNXPushString(FloatToString(min, 0)); + NWNXPushString(FloatToString(max, 0)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int ZINCRBY( + string key, + // Redis type: integer + int increment, + string member +) { + NWNXPushString("ZINCRBY"); + NWNXPushString(key); + NWNXPushString(IntToString(increment)); + NWNXPushString(member); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int ZINTERSTORE( + // Redis type: key + string destination, + // Redis type: integer + int numkeys, + string key, + // Redis type: integer + int weights_weight = 0, + // Redis type: enum + string aggregate_aggregate = "" +) { + 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( + string key, + string min, + string max +) { + NWNXPushString("ZLEXCOUNT"); + NWNXPushString(key); + NWNXPushString(min); + NWNXPushString(max); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int ZPOPMAX( + string key, + // Redis type: integer + int count = 0 +) { + NWNXPushString("ZPOPMAX"); + NWNXPushString(key); + if (count != 0) NWNXPushString(IntToString(count)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int ZPOPMIN( + string key, + // Redis type: integer + int count = 0 +) { + NWNXPushString("ZPOPMIN"); + NWNXPushString(key); + if (count != 0) NWNXPushString(IntToString(count)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int ZRANGE( + string key, + // Redis type: integer + int start, + // Redis type: integer + int stop, + // Redis type: enum + string withscores = "" +) { + NWNXPushString("ZRANGE"); + NWNXPushString(key); + NWNXPushString(IntToString(start)); + NWNXPushString(IntToString(stop)); + if (withscores != "") NWNXPushString(withscores); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int ZRANGEBYLEX( + string key, + string min, + string max, + // Redis type: integer + int limit_offset = 0, + // Redis type: integer + int limit_count = 0 +) { + 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( + string key, + string max, + string min, + // Redis type: integer + int limit_offset = 0, + // Redis type: integer + int limit_count = 0 +) { + 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( + string key, + // Redis type: double + float min, + // Redis type: double + float max, + // Redis type: enum + string withscores = "", + // Redis type: integer + int limit_offset = 0, + // Redis type: integer + int limit_count = 0 +) { + 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 +) { + NWNXPushString("ZRANK"); + NWNXPushString(key); + NWNXPushString(member); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int ZREM( + string key, + string member +) { + NWNXPushString("ZREM"); + NWNXPushString(key); + NWNXPushString(member); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int ZREMRANGEBYLEX( + string key, + string min, + string max +) { + NWNXPushString("ZREMRANGEBYLEX"); + NWNXPushString(key); + NWNXPushString(min); + NWNXPushString(max); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int ZREMRANGEBYRANK( + string key, + // Redis type: integer + int start, + // Redis type: integer + int stop +) { + NWNXPushString("ZREMRANGEBYRANK"); + NWNXPushString(key); + NWNXPushString(IntToString(start)); + NWNXPushString(IntToString(stop)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int ZREMRANGEBYSCORE( + string key, + // Redis type: double + float min, + // Redis type: double + float max +) { + NWNXPushString("ZREMRANGEBYSCORE"); + NWNXPushString(key); + NWNXPushString(FloatToString(min, 0)); + NWNXPushString(FloatToString(max, 0)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int ZREVRANGE( + string key, + // Redis type: integer + int start, + // Redis type: integer + int stop, + // Redis type: enum + string withscores = "" +) { + NWNXPushString("ZREVRANGE"); + NWNXPushString(key); + NWNXPushString(IntToString(start)); + NWNXPushString(IntToString(stop)); + if (withscores != "") NWNXPushString(withscores); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int ZREVRANGEBYSCORE( + string key, + // Redis type: double + float max, + // Redis type: double + float min, + // Redis type: enum + string withscores = "", + // Redis type: integer + int limit_offset = 0, + // Redis type: integer + int limit_count = 0 +) { + 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 +) { + NWNXPushString("ZREVRANK"); + NWNXPushString(key); + NWNXPushString(member); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int ZSCORE( + string key, + string member +) { + NWNXPushString("ZSCORE"); + NWNXPushString(key); + NWNXPushString(member); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int ZUNIONSTORE( + // Redis type: key + string destination, + // Redis type: integer + int numkeys, + string key, + // Redis type: integer + int weights_weight = 0, + // Redis type: enum + string aggregate_aggregate = "" +) { + 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( + // Redis type: integer + int cursor, + // Redis type: pattern + string match_pattern = "", + // Redis type: integer + int count_count = 0, + string type_type = "" +) { + 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( + string key, + // Redis type: integer + int cursor, + // Redis type: pattern + string match_pattern = "", + // Redis type: integer + int count_count = 0 +) { + 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( + string key, + // Redis type: integer + int cursor, + // Redis type: pattern + string match_pattern = "", + // Redis type: integer + int count_count = 0 +) { + 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( + string key, + // Redis type: integer + int cursor, + // Redis type: pattern + string match_pattern = "", + // Redis type: integer + int count_count = 0 +) { + 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( + // Redis type: key + string consumers_key = "", + string consumers_groupname = "", + // Redis type: key + string groups_key = "", + // Redis type: key + string stream_key = "", + // Redis type: enum + string help = "" +) { + 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( + string key, + string ID, + // Redis type: value + string field, + string str +) { + NWNXPushString("XADD"); + NWNXPushString(key); + NWNXPushString(ID); + NWNXPushString(field); + NWNXPushString(str); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int XTRIM( + string key, + // Redis type: enum + string strategy, + // Redis type: enum + string approx = "", + // Redis type: integer + int count = 0 +) { + 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 +) { + NWNXPushString("XDEL"); + NWNXPushString(key); + NWNXPushString(ID); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int XRANGE( + string key, + string start, + string end, + // Redis type: integer + int count_count = 0 +) { + NWNXPushString("XRANGE"); + NWNXPushString(key); + NWNXPushString(start); + NWNXPushString(end); + if (count_count != 0) NWNXPushString(IntToString(count_count)); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int XREVRANGE( + string key, + string end, + string start, + // Redis type: integer + int count_count = 0 +) { + 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 +) { + NWNXPushString("XLEN"); + NWNXPushString(key); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int XREAD( + // Redis type: integer + int count_count = 0, + // Redis type: integer + int block_milliseconds = 0, + // Redis type: enum + string streams = "", + string key = "", + string ID = "" +) { + 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( + // Redis type: key + string create_key = "", + string create_groupname = "", + string create_id_or__ = "", + // Redis type: key + string setid_key = "", + string setid_groupname = "", + string setid_id_or__ = "", + // Redis type: key + string destroy_key = "", + string destroy_groupname = "", + // Redis type: key + string delconsumer_key = "", + string delconsumer_groupname = "", + string delconsumer_consumername = "" +) { + 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( + string group_group, + string group_consumer, + // Redis type: integer + int count_count = 0, + // Redis type: integer + int block_milliseconds = 0, + // Redis type: enum + string noack = "", + // Redis type: enum + string streams = "", + string key = "", + string ID = "" +) { + 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( + string key, + string group, + string ID +) { + NWNXPushString("XACK"); + NWNXPushString(key); + NWNXPushString(group); + NWNXPushString(ID); + NWNXCall("NWNX_Redis", "Deferred"); + return NWNXPopInt(); +} + +int XCLAIM( + string key, + string group, + string consumer, + string min_idle_time, + string ID, + // Redis type: integer + int idle_ms = 0, + // Redis type: integer + int time_ms_unix_time = 0, + // Redis type: integer + int retrycount_count = 0 +) { + 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( + string key, + string group, + string start = "", + string end = "", + // Redis type: integer + int count = 0, + string consumer = "" +) { + 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 new file mode 100644 index 00000000..f7270581 --- /dev/null +++ b/_module/nss/nwnx_rename.nss @@ -0,0 +1,70 @@ +/// @addtogroup rename Rename +/// @brief Facilitates renaming, overriding and customization of player names. +/// @{ +/// @file nwnx_rename.nss + +const string NWNX_Rename = "NWNX_Rename"; ///< @private + +/// @anchor rename_comm_name_override_type +/// @name Community Name Override Type +/// @{ +const int NWNX_RENAME_PLAYERNAME_DEFAULT = 0; ///< Don't rename +const int NWNX_RENAME_PLAYERNAME_OBFUSCATE = 1; ///< Generate random string for Community Name +const int NWNX_RENAME_PLAYERNAME_OVERRIDE = 2; ///< Use character name specified +const int NWNX_RENAME_PLAYERNAME_ANONYMOUS = 3; ///< Use the value of the NWNX_RENAME_ANONYMOUS_NAME environment variable +///@} + +/// @brief Set a PC's character name and community name on the player list. +/// @param oTarget The PC whose name is being overridden. +/// @param sNewName The new name. +/// @param sPrefix The prefix for their character name, sometimes used for a color code. +/// @param sSuffix The suffix for their character name. +/// @param iPlayerNameState How to change the Community Name, use @ref rename_comm_name_override_type "Community Name Override Type". +/// @param oObserver If specified, the character name will appear to that specific observer as set, this overrides a global setting. +/// @note Will not persist through saving, resets or logout. +void NWNX_Rename_SetPCNameOverride(object oTarget, string sNewName, string sPrefix = "" , string sSuffix = "" , + int iPlayerNameState = NWNX_RENAME_PLAYERNAME_DEFAULT, object oObserver = OBJECT_INVALID); + +/// @brief Gets a PC's name as overridden. +/// @param oTarget The PC whose name to query. +/// @param oObserver The specific observer. +/// @return The PC's name as overridden either per observer or globally. +/// @note If you wish to get a PC's true name use `GetName(oPC, TRUE)`. +string NWNX_Rename_GetPCNameOverride(object oTarget, object oObserver = OBJECT_INVALID); + +/// @brief Clears an overridden PC Name. +/// @param oTarget The PC whose overridden name to clear, use OBJECT_INVALID if you're clearing all overrides for an observer. +/// @param oObserver The observer whose overridden name of oTarget is being cleared. +/// If oTarget is OBJECT_INVALID then all overrides are cleared. +/// @param clearAll If true, both the global and personal overrides will be cleared for that target PC. +/// Requires oObserver be OBJECT_INVALID. +void NWNX_Rename_ClearPCNameOverride(object oTarget, object oObserver = OBJECT_INVALID, int clearAll = FALSE); + +/// @} + +void NWNX_Rename_SetPCNameOverride(object oTarget, string sNewName, string sPrefix = "" , string sSuffix = "" , + int iPlayerNameState = NWNX_RENAME_PLAYERNAME_DEFAULT, object oObserver = OBJECT_INVALID) +{ + 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) +{ + NWNXPushObject(oObserver); + NWNXPushObject(oTarget); + NWNXCall(NWNX_Rename, "GetPCNameOverride"); + return NWNXPopString(); +} + +void NWNX_Rename_ClearPCNameOverride(object oTarget, object oObserver = OBJECT_INVALID, int clearAll = FALSE) +{ + NWNXPushInt(clearAll); + NWNXPushObject(oObserver); + NWNXPushObject(oTarget); + NWNXCall(NWNX_Rename, "ClearPCNameOverride"); +} diff --git a/_module/nss/nwnx_reveal.nss b/_module/nss/nwnx_reveal.nss new file mode 100644 index 00000000..12618306 --- /dev/null +++ b/_module/nss/nwnx_reveal.nss @@ -0,0 +1,42 @@ +/// @addtogroup reveal Reveal +/// @brief Allows the selective revealing of a stealthing character to another character or their party. +/// @{ +/// @file nwnx_reveal.nss + +const string NWNX_Reveal = "NWNX_Reveal"; ///< @private + +/// @name Reveal Detection Methods +/// @{ +const int NWNX_REVEAL_SEEN = 1; ///< Seen +const int NWNX_REVEAL_HEARD = 0; ///< Heard +///@} + +/// @brief Selectively reveals the character to an observer until the next time they stealth out of sight. +/// @param oHiding The creature who is stealthed. +/// @param oObserver The creature to whom the hider is revealed. +/// @param iDetectionMethod Can be specified to determine whether the hidden creature is seen or heard. +void NWNX_Reveal_RevealTo(object oHiding, object oObserver, int iDetectionMethod = NWNX_REVEAL_HEARD); + +/// @brief Sets whether a character remains visible to their party through stealth. +/// @param oHiding The creature who is stealthed. +/// @param bReveal TRUE for visible. +/// @param iDetectionMethod Can be specified to determine whether the hidden creature is seen or heard. +void NWNX_Reveal_SetRevealToParty(object oHiding, int bReveal, int iDetectionMethod = NWNX_REVEAL_HEARD); + +/// @} + +void NWNX_Reveal_RevealTo(object oHiding, object oObserver, int iDetectionMethod = NWNX_REVEAL_HEARD) +{ + NWNXPushInt(iDetectionMethod); + NWNXPushObject(oObserver); + NWNXPushObject(oHiding); + NWNXCall(NWNX_Reveal, "RevealTo"); +} + +void NWNX_Reveal_SetRevealToParty(object oHiding, int bReveal, int iDetectionMethod = NWNX_REVEAL_HEARD) +{ + NWNXPushInt(iDetectionMethod); + NWNXPushInt(bReveal); + NWNXPushObject(oHiding); + NWNXCall(NWNX_Reveal, "SetRevealToParty"); +} diff --git a/_module/nss/nwnx_ruby.nss b/_module/nss/nwnx_ruby.nss new file mode 100644 index 00000000..ce377cc8 --- /dev/null +++ b/_module/nss/nwnx_ruby.nss @@ -0,0 +1,20 @@ +/// @addtogroup ruby Ruby +/// @brief Allows users to execute arbitrary Ruby from the game. +/// @{ +/// @file nwnx_ruby.nss + +const string NWNX_Ruby = "NWNX_Ruby"; ///< @private + +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) +{ + NWNXPushString(sCode); + NWNXCall(NWNX_Ruby, "Evaluate"); + return NWNXPopString(); +} + +/// @} diff --git a/_module/nss/nwnx_skillranks.nss b/_module/nss/nwnx_skillranks.nss new file mode 100644 index 00000000..ae38d96f --- /dev/null +++ b/_module/nss/nwnx_skillranks.nss @@ -0,0 +1,255 @@ +/// @addtogroup skillranks SkillRanks +/// @brief Enhances and allows for manipulation of skill rank calculations including the ability to build custom +/// skill related feats as well as modifying stock feats. +/// @{ +/// @file nwnx_skillranks.nss + +const string NWNX_SkillRanks = "NWNX_SkillRanks"; ///< @private + +/// @name SkillRanks Key Abilities +/// @anchor skr_key_abilities +/// +/// The abilities as bits +/// @{ +const int NWNX_SKILLRANKS_KEY_ABILITY_STRENGTH = 1; ///< Strength +const int NWNX_SKILLRANKS_KEY_ABILITY_DEXTERITY = 2; ///< Dexterity +const int NWNX_SKILLRANKS_KEY_ABILITY_CONSTITUTION = 4; ///< Constitution +const int NWNX_SKILLRANKS_KEY_ABILITY_INTELLIGENCE = 8; ///< Intelligence +const int NWNX_SKILLRANKS_KEY_ABILITY_WISDOM = 16; ///< Wisdom +const int NWNX_SKILLRANKS_KEY_ABILITY_CHARISMA = 32; ///< Charisma +///@} + +/// @name SkillRanks Key Ability Calculation Method +/// @anchor skr_key_ability_calc_bits +/// +/// Constants used to calculate the ability modifier for a skill. +/// @{ +/// @warning Use only one of these calculations in your mask! If you use more than one the first will be used. +const int NWNX_SKILLRANKS_KEY_ABILITY_CALC_MIN = 64; ///< Use the minimum value of the provided ability scores. +const int NWNX_SKILLRANKS_KEY_ABILITY_CALC_MAX = 128; ///< Use the maximum value of the provided ability scores. +const int NWNX_SKILLRANKS_KEY_ABILITY_CALC_AVERAGE = 256; ///< Use the average value of the provided ability scores. +const int NWNX_SKILLRANKS_KEY_ABILITY_CALC_SUM = 512; ///< Use the sum of the provided ability scores. +///@} + +/// @brief A feat that manipulates skill ranks. +struct NWNX_SkillRanks_SkillFeat +{ + int iSkill; ///< The skill this feat impacts + int iFeat; ///< The feat + + /// Skill feat bonus/penalty + int iModifier; + + /// 1 for Focus, 2 for Epic Focus. This can be set on a feat so NWNX_SkillRanks_SetFocusMod + /// can mass change the modifier for the Skill Focus and Epic Skill Focus feats. + int iFocusFeat; + + /// @brief 255 char bitset string for skill ranks impacted by class levels (like Bardic Knowledge). + /// + /// The right most bit is barbarian (class 0), second from right is bard (class 1) etc. + /// It's not necessary to pass in the entire string, for example Ranger is class 7 and Fighter is 4 + /// If you wanted those class levels to impact the skill modifier you could set sClasses equal to + /// "10010000". From right to left = Barbarian, Bard, Cleric, Druid, Fighter, Monk, Paladin, Ranger + /// You can alternatively use NWNX_SkillRanks_AddSkillFeatClass() for each class + /// @remark If unset but #fClassLevelMod is set, then all classes will be included. + string sClasses; + + /// Levels in class multiplier gives you skill modifier, for example 0.5f would mean 1 point for + /// every two class levels. If #sClasses is not set and this is set then all class levels will be modified. + float fClassLevelMod; + + /// Used for feats like Stonecunning or Trackless Step which restrict skill modifiers by area types. + int iAreaFlagsRequired; + + /// Used for feats like Stonecunning or Trackless Step which restrict skill modifiers by area types. + int iAreaFlagsForbidden; + + /// 1 for Day, 2 for Night - if skill modifiers only take effect based on the day/night cycle or an area + /// that's set to always night. 0 is all hours. + int iDayOrNight; + + /// This allows for feats that bypass the armor check penalty on skill rank calculations. + int bBypassArmorCheckPenalty; + + /// @brief Bitmask of @ref skr_key_abilities "abilities" and @ref skr_key_ability_calc_bits "method to calculate" + /// the ability modifier for a skill. + /// + /// Example **Doctor** Feat that used INT instead of WIS (if higher) for Heal skill would set to: + /// #NWNX_SKILLRANKS_KEY_ABILITY_INTELLIGENCE | #NWNX_SKILLRANKS_KEY_ABILITY_WISDOM | #NWNX_SKILLRANKS_KEY_ABILITY_CALC_MAX; + int iKeyAbilityMask; +}; + +/// @param iSkill The skill to check the feat count. +/// @return The count of feats for a specific skill. +int NWNX_SkillRanks_GetSkillFeatCountForSkill(int iSkill); + +/// @brief Returns a skill feat. +/// @param iSkill The skill. +/// @param iFeat The feat. +/// @return A constructed NWNX_SkillRanks_SkillFeat. +struct NWNX_SkillRanks_SkillFeat NWNX_SkillRanks_GetSkillFeat(int iSkill, int iFeat); + +/// @brief Returns a skill feat by index. +/// @remark Generally used in a loop with NWNX_SkillRanks_GetSkillFeatCountForSkill(). +/// @param iSkill The skill. +/// @param iIndex The index in the list of feats for the skill. +/// @return A constructed NWNX_SkillRanks_SkillFeat. +struct NWNX_SkillRanks_SkillFeat NWNX_SkillRanks_GetSkillFeatForSkillByIndex(int iSkill, int iIndex); + +/// @brief Modifies or creates a skill feat. +/// @param skillFeat The defined NWNX_SkillRanks_SkillFeat. +/// @param createIfNonExistent TRUE to create if the feat does not exist. +void NWNX_SkillRanks_SetSkillFeat(struct NWNX_SkillRanks_SkillFeat skillFeat, int createIfNonExistent = FALSE); + +/// @brief Add classes to a skill feat instead of working with the NWNX_SkillRanks_SkillFeat::sClasses string. +/// +/// Manipulating the sClasses string in the NWNX_SkillRanks_SkillFeat struct can be difficult. This +/// function allows the builder to enter one class at a time. +/// @param skillFeat The NWNX_SkillRanks_SkillFeat for which the sClasses field will be modifier. +/// @param iClass The class to add to the Skill Feat. +/// @return The updated NWNX_SkillRanks_SkillFeat. +struct NWNX_SkillRanks_SkillFeat NWNX_SkillRanks_AddSkillFeatClass(struct NWNX_SkillRanks_SkillFeat skillFeat, int iClass); + +/// @brief Change the modifier value for Skill Focus and Epic Skill Focus feats. +/// +/// The stock modifier on Skill Focus and Epic Skill Focus are 3 and 10 respectively, these can be +/// changed with this function. +/// @param iModifier The new value for the feat modifier. +/// @param iEpic Set to TRUE to change the value for Epic Skill Focus. +void NWNX_SkillRanks_SetSkillFeatFocusModifier(int iModifier, int iEpic = FALSE); + +/// @brief Gets the current penalty to Dexterity based skills when blind. +/// @return The penalty to Dexterity when blind. +int NWNX_SkillRanks_GetBlindnessPenalty(); + +/// @brief Set the value the Dexterity based skills get decreased due to blindness. +/// @remark Default is 4. +/// @param iModifier The penalty to Dexterity when blind. +void NWNX_SkillRanks_SetBlindnessPenalty(int iModifier); + +/// @brief Get a skill modifier for an area. +/// @param oArea The area. +/// @param iSkill The skill to check. +/// @return The modifier to that skill in the area. +int NWNX_SkillRanks_GetAreaModifier(object oArea, int iSkill); + +/// @brief Sets a skill modifier for the area. +/// @param oArea The area. +/// @param iSkill The skill to change. +/// @param iModifier The modifier to the skill in the area. +void NWNX_SkillRanks_SetAreaModifier(object oArea, int iSkill, int iModifier); + +/// @} + +int NWNX_SkillRanks_GetSkillFeatCountForSkill(int iSkill) +{ + NWNXPushInt(iSkill); + NWNXCall(NWNX_SkillRanks, "GetSkillFeatCountForSkill"); + return NWNXPopInt(); +} + +struct NWNX_SkillRanks_SkillFeat NWNX_SkillRanks_GetSkillFeatForSkillByIndex(int iSkill, int iIndex) +{ + NWNXPushInt(iIndex); + NWNXPushInt(iSkill); + NWNXCall(NWNX_SkillRanks, "GetSkillFeatForSkillByIndex"); + struct NWNX_SkillRanks_SkillFeat skillFeat; + skillFeat.iSkill = iSkill; + 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) +{ + NWNXPushInt(iFeat); + NWNXPushInt(iSkill); + NWNXCall(NWNX_SkillRanks, "GetSkillFeat"); + struct NWNX_SkillRanks_SkillFeat skillFeat; + skillFeat.iSkill = iSkill; + skillFeat.iFeat = iFeat; + 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) +{ + 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 + 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) +{ + if (GetStringLength(skillFeat.sClasses) < 255) + { + int i; + string sPad; + for (i = 0; i < 255-GetStringLength(skillFeat.sClasses); i++) { sPad = sPad + "0"; } + skillFeat.sClasses = sPad + skillFeat.sClasses; + } + skillFeat.sClasses = GetStringLeft(skillFeat.sClasses, 254 - iClass) + "1" + GetStringRight(skillFeat.sClasses, iClass); + return skillFeat; +} + +void NWNX_SkillRanks_SetSkillFeatFocusModifier(int iModifier, int epicFocus = FALSE) +{ + NWNXPushInt(epicFocus); + NWNXPushInt(iModifier); + NWNXCall(NWNX_SkillRanks, "SetSkillFeatFocusModifier"); +} + +int NWNX_SkillRanks_GetBlindnessPenalty() +{ + NWNXCall(NWNX_SkillRanks, "GetBlindnessPenalty"); + return NWNXPopInt(); +} + +void NWNX_SkillRanks_SetBlindnessPenalty(int iModifier) +{ + NWNXPushInt(iModifier); + NWNXCall(NWNX_SkillRanks, "SetBlindnessPenalty"); +} + +int NWNX_SkillRanks_GetAreaModifier(object oArea, int iSkill) +{ + NWNXPushInt(iSkill); + NWNXPushObject(oArea); + NWNXCall(NWNX_SkillRanks, "GetAreaModifier"); + return NWNXPopInt(); +} + +void NWNX_SkillRanks_SetAreaModifier(object oArea, int iSkill, int iModifier) +{ + NWNXPushInt(iModifier); + NWNXPushInt(iSkill); + NWNXPushObject(oArea); + NWNXCall(NWNX_SkillRanks, "SetAreaModifier"); +} diff --git a/_module/nss/nwnx_spellcheck.nss b/_module/nss/nwnx_spellcheck.nss new file mode 100644 index 00000000..45a0e659 --- /dev/null +++ b/_module/nss/nwnx_spellcheck.nss @@ -0,0 +1,39 @@ +/// @addtogroup spellchecker SpellChecker +/// @brief Functions related to spellchecking +/// @{ +/// @file nwnx_spellcheck.nss + +const string NWNX_SpellChecker = "NWNX_SpellChecker"; ///< @private + +/// @brief Finds misspells in a string. +/// @param sentence The sentence to check. +/// @return The spelling mistakes in the sentence, comma delimited. Returns blank if no errors or if .so file +/// is improperly installed. +/// @note If it returns an error in every word, even when spelled correctly, the dictionary is not set up correctly. +/// @warning These functions can be performance heavy, do limit how many calls and/or how long of a sentence is passed. +/// Make use of **DelayCommands** and **AssignCommands** +string NWNX_SpellChecker_FindMisspell(string sentence); + +/// @brief Get suggestions on a single word, comma delimited. +/// @param word The string to check for suggestions. +/// @return A comma delimited lists of suggestions for a word. Returns blank if no errors or if .so file is improperly +/// installed. +/// @warning These functions can be performance heavy, do limit how many calls and/or how long of a sentence is passed. +/// Make use of **DelayCommands** and **AssignCommands** +string NWNX_SpellChecker_GetSuggestSpell(string word); + +/// @} + +string NWNX_SpellChecker_FindMisspell(string sentence) +{ + NWNXPushString(sentence); + NWNXCall(NWNX_SpellChecker, "FindMisspell"); + return NWNXPopString(); +} + +string NWNX_SpellChecker_GetSuggestSpell(string word) +{ + NWNXPushString(word); + NWNXCall(NWNX_SpellChecker, "GetSuggestSpell"); + return NWNXPopString(); +} diff --git a/_module/nss/nwnx_sql.nss b/_module/nss/nwnx_sql.nss new file mode 100644 index 00000000..05639340 --- /dev/null +++ b/_module/nss/nwnx_sql.nss @@ -0,0 +1,249 @@ +/// @addtogroup sql SQL +/// @brief Functions to interface with a database through SQL +/// @{ +/// @file nwnx_sql.nss + +const string NWNX_SQL = "NWNX_SQL"; ///< @private + +/// @brief Prepares the provided query for execution. +/// @note This does not execute the query. Will also clear any previous state. +/// @param query The query to prepare. +/// @return TRUE if the query was successfully prepared. +int NWNX_SQL_PrepareQuery(string query); + +/// @brief Executes a query which has been prepared. +/// @return The ID of this query if successful, else FALSE. +int NWNX_SQL_ExecutePreparedQuery(); + +/// @brief Directly execute an SQL query. +/// @note Clears previously prepared query states. +/// @return The ID of this query if successful, else FALSE. +int NWNX_SQL_ExecuteQuery(string query); + +/// @anchor sql_rtrnr +/// @return TRUE if one or more rows are ready, FALSE otherwise. +int NWNX_SQL_ReadyToReadNextRow(); + +/// @anchor sql_rnr +/// @brief Reads the next row of returned data. +/// @remark Should only be called after a successful call to @ref sql_rtrnr "NWNX_SQL_ReadyToReadNextRow()". +void NWNX_SQL_ReadNextRow(); + +/// @param column The column to read in the active row. +/// @return Data at the nth (0-based) column of the active row. +/// @remark Should only be called after a successful call to @ref sql_rnr "NWNX_SQL_ReadNextRow()". +string NWNX_SQL_ReadDataInActiveRow(int column = 0); + +/// @brief Set the int value of a prepared statement at given position. +/// @param position The nth ? in a prepared statement. +/// @param value The value to set. +void NWNX_SQL_PreparedInt(int position, int value); + +/// @brief Set the string value of a prepared statement at given position. +/// @param position The nth ? in a prepared statement. +/// @param value The value to set. +void NWNX_SQL_PreparedString(int position, string value); + +/// @brief Set the float value of a prepared statement at given position. +/// @param position The nth ? in a prepared statement. +/// @param value The value to set. +void NWNX_SQL_PreparedFloat(int position, float value); + +/// @brief Set the ObjectId value of a prepared statement at given position. +/// @param position The nth ? in a prepared statement. +/// @param value The value to set. +void NWNX_SQL_PreparedObjectId(int position, object value); + +/// @brief Set the full serialized object value of a prepared statement at given position. +/// @param position The nth ? in a prepared statement. +/// @param value The value to set. +/// @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. +/// Convenience 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. +/// +/// The exact behavior depends on type of deserialized object and owner object: +/// * If object is an item, and owner if placeable, creature or container, the item will be created in its inventory +/// * If owner is an area, the object will be created on the ground at Vector(x,y,z) +/// * Otherwise, the object will be created outside the world and needs to be ported manually. +/// +/// @param column The column to read in the active row. +/// @param owner The owner of the object. +/// @param x, y, z The vector for objects to be placed in areas. +/// @param base64 Use base64-encoded string format if TRUE (default), otherwise use binary format. +/// @return The deserialized object. +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); + +/// @brief Gets the rows affected by a query. +/// @remark This command is for non-row-based statements like INSERT, UPDATE, DELETE, etc. +/// @return Number of rows affected by SQL statement or -1 if the query was not non-row-based. +int NWNX_SQL_GetAffectedRows(); + +/// Gets the database type. +/// @return The database type we're interacting with. +/// @remark This is the same value as the value of NWNX_SQL_TYPE environment variable. +string NWNX_SQL_GetDatabaseType(); + +/// @brief Free any resources attached to an existing prepared query. +/// @remark Resources are automatically freed when a new query is prepared, so calling this isn't necessary. +void NWNX_SQL_DestroyPreparedQuery(); + +/// @return The last error message generated by the database. +string NWNX_SQL_GetLastError(); + +/// @brief Gets the number of parameters expected by a prepared query. +/// @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) +{ + NWNXPushString(query); + NWNXCall(NWNX_SQL, "PrepareQuery"); + return NWNXPopInt(); +} + +int NWNX_SQL_ExecutePreparedQuery() +{ + NWNXCall(NWNX_SQL, "ExecutePreparedQuery"); + return NWNXPopInt(); +} + +int NWNX_SQL_ExecuteQuery(string query) +{ + // Note: the implementation might change as support for more SQL targets arrives. + if (NWNX_SQL_PrepareQuery(query)) + { + int ret = NWNX_SQL_ExecutePreparedQuery(); + NWNX_SQL_DestroyPreparedQuery(); + return ret; + } + + return FALSE; +} + +int NWNX_SQL_ReadyToReadNextRow() +{ + NWNXCall(NWNX_SQL, "ReadyToReadNextRow"); + return NWNXPopInt(); +} + +void NWNX_SQL_ReadNextRow() +{ + NWNXCall(NWNX_SQL, "ReadNextRow"); +} + +string NWNX_SQL_ReadDataInActiveRow(int column = 0) +{ + NWNXPushInt(column); + NWNXCall(NWNX_SQL, "ReadDataInActiveRow"); + return NWNXPopString(); +} + + +void NWNX_SQL_PreparedInt(int position, int value) +{ + NWNXPushInt(value); + NWNXPushInt(position); + NWNXCall(NWNX_SQL, "PreparedInt"); +} +void NWNX_SQL_PreparedString(int position, string value) +{ + NWNXPushString(value); + NWNXPushInt(position); + NWNXCall(NWNX_SQL, "PreparedString"); +} +void NWNX_SQL_PreparedFloat(int position, float value) +{ + NWNXPushFloat(value); + NWNXPushInt(position); + NWNXCall(NWNX_SQL, "PreparedFloat"); +} +void NWNX_SQL_PreparedObjectId(int position, object value) +{ + NWNXPushObject(value); + NWNXPushInt(position); + NWNXCall(NWNX_SQL, "PreparedObjectId"); +} +void NWNX_SQL_PreparedObjectFull(int position, object value, int base64 = TRUE) +{ + 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) +{ + NWNXPushInt(base64); + NWNXPushFloat(z); + NWNXPushFloat(y); + NWNXPushFloat(x); + NWNXPushObject(owner); + NWNXPushInt(column); + NWNXCall(NWNX_SQL, "ReadFullObjectInActiveRow"); + return NWNXPopObject(); +} + +int NWNX_SQL_GetAffectedRows() +{ + NWNXCall(NWNX_SQL, "GetAffectedRows"); + return NWNXPopInt(); +} + +string NWNX_SQL_GetDatabaseType() +{ + NWNXCall(NWNX_SQL, "GetDatabaseType"); + return NWNXPopString(); +} + +void NWNX_SQL_DestroyPreparedQuery() +{ + NWNXCall(NWNX_SQL, "DestroyPreparedQuery"); +} + +string NWNX_SQL_GetLastError() +{ + NWNXCall(NWNX_SQL, "GetLastError"); + return NWNXPopString(); +} + +int NWNX_SQL_GetPreparedQueryParamCount() +{ + 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 00000000..829ec961 --- /dev/null +++ b/_module/nss/nwnx_store.nss @@ -0,0 +1,202 @@ +/// @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); + +/// @brief Return the black market status +/// @param oStore The store object. +/// @return status, -1 on error +int NWNX_Store_GetBlackMarket(object oStore); + +/// @brief Set the black market status +/// @param oStore The store object. +/// @param nValue TRUE/FALSE. +void NWNX_Store_SetBlackMarket(object oStore, int nValue); + +/// @brief Return the gold amount +/// @param oStore The store object. +/// @return status, -1 on error +int NWNX_Store_GetGold(object oStore); + +/// @brief Set the gold amount +/// @param oStore The store object. +/// @param nValue Amount +void NWNX_Store_SetGold(object oStore, int nValue); + +/// @brief Return the identify cost +/// @param oStore The store object. +/// @return status, -1 on error +int NWNX_Store_GetIdentifyCost(object oStore); + +/// @brief Set the identify cost +/// @param oStore The store object. +/// @param nValue Cost +void NWNX_Store_SetIdentifyCost(object oStore, int nValue); + +/// @brief Return the MaxBuyPrice amount +/// @param oStore The store object. +/// @return status, -1 on error +int NWNX_Store_GetMaxBuyPrice(object oStore); + +/// @brief Set the MaxBuyPrice amount +/// @param oStore The store object. +/// @param nValue Amount +void NWNX_Store_SetMaxBuyPrice(object oStore, int nValue); + +/// @} + +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(); +} + +int NWNX_Store_GetBlackMarket(object oStore) +{ + NWNXPushObject(oStore); + NWNXCall(NWNX_Store, "GetBlackMarket"); + return NWNXPopInt(); +} + +void NWNX_Store_SetBlackMarket(object oStore, int nValue) +{ + NWNXPushInt(nValue); + NWNXPushObject(oStore); + NWNXCall(NWNX_Store, "SetBlackMarket"); +} + +int NWNX_Store_GetGold(object oStore) +{ + NWNXPushObject(oStore); + NWNXCall(NWNX_Store, "GetGold"); + return NWNXPopInt(); +} + +void NWNX_Store_SetGold(object oStore, int nValue) +{ + NWNXPushInt(nValue); + NWNXPushObject(oStore); + NWNXCall(NWNX_Store, "SetGold"); +} + +int NWNX_Store_GetIdentifyCost(object oStore) +{ + NWNXPushObject(oStore); + NWNXCall(NWNX_Store, "GetIdentifyCost"); + return NWNXPopInt(); +} + +void NWNX_Store_SetIdentifyCost(object oStore, int nValue) +{ + NWNXPushInt(nValue); + NWNXPushObject(oStore); + NWNXCall(NWNX_Store, "SetIdentifyCost"); +} + +int NWNX_Store_GetMaxBuyPrice(object oStore) +{ + NWNXPushObject(oStore); + NWNXCall(NWNX_Store, "GetMaxBuyPrice"); + return NWNXPopInt(); +} + +void NWNX_Store_SetMaxBuyPrice(object oStore, int nValue) +{ + NWNXPushInt(nValue); + NWNXPushObject(oStore); + NWNXCall(NWNX_Store, "SetMaxBuyPrice"); +} diff --git a/_module/nss/nwnx_tests.nss b/_module/nss/nwnx_tests.nss new file mode 100644 index 00000000..81b76433 --- /dev/null +++ b/_module/nss/nwnx_tests.nss @@ -0,0 +1,21 @@ +/// @ingroup nwnx +/// @addtogroup tests NWNX Tests +/// @brief Helper functions when running the test scripts +/// @{ +/// @file nwnx_tests.nss + +/// @brief Reports the test results +/// @param sPlugin The plugin calling the test. +/// @param sTestName The name of the test. +/// @param bSuccess TRUE if the test passed. +void NWNX_Tests_Report(string sPlugin, string sTestName, int bSuccess); + +void NWNX_Tests_Report(string sPlugin, string sTestName, int bSuccess) +{ + if (bSuccess) + WriteTimestampedLogEntry(sPlugin + ": " + sTestName + "() success"); + else + WriteTimestampedLogEntry(sPlugin + ": " + sTestName + "() failed"); +} + +/// @} // End of tests diff --git a/_module/nss/nwnx_tileset.nss b/_module/nss/nwnx_tileset.nss new file mode 100644 index 00000000..fa07a379 --- /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 new file mode 100644 index 00000000..7b1788b7 --- /dev/null +++ b/_module/nss/nwnx_time.nss @@ -0,0 +1,63 @@ +/// @addtogroup time Time +/// @brief Provides various time related functions +/// @{ +/// @file nwnx_time.nss +#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(); + +/// @brief A high resolution timestamp +struct NWNX_Time_HighResTimestamp +{ + int seconds; ///< Seconds since epoch + 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(); + +/// @} + +string NWNX_Time_GetSystemDate() +{ + WriteTimestampedLogEntry("WARNING: NWNX_Time is deprecated. You should migrate to SQLite based functions (see inc_sqlite_time)."); + return SQLite_GetSystemDate(); +} + +string NWNX_Time_GetSystemTime() +{ + WriteTimestampedLogEntry("WARNING: NWNX_Time is deprecated. You should migrate to SQLite based functions (see inc_sqlite_time)."); + return SQLite_GetSystemTime(); +} + +int NWNX_Time_GetTimeStamp() +{ + 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; + t.seconds = u.seconds; + t.microseconds = u.microseconds; + return t; +} diff --git a/_module/nss/nwnx_util.nss b/_module/nss/nwnx_util.nss new file mode 100644 index 00000000..1de3d14d --- /dev/null +++ b/_module/nss/nwnx_util.nss @@ -0,0 +1,590 @@ +/// @addtogroup util Util +/// @brief Provides various utility functions that don't have a better home +/// @{ +/// @file nwnx_util.nss + +const string NWNX_Util = "NWNX_Util"; ///< @private + +/// @name Resref Types +/// @anchor resref_types +/// Constants for the various types of resrefs. +/// +/// @{ +const int NWNX_UTIL_RESREF_TYPE_NSS = 2009; +const int NWNX_UTIL_RESREF_TYPE_NCS = 2010; +const int NWNX_UTIL_RESREF_TYPE_AREA_ARE = 2012; +const int NWNX_UTIL_RESREF_TYPE_TWODA = 2017; +const int NWNX_UTIL_RESREF_TYPE_AREA_GIT = 2023; +const int NWNX_UTIL_RESREF_TYPE_ITEM = 2025; +const int NWNX_UTIL_RESREF_TYPE_CREATURE = 2027; +const int NWNX_UTIL_RESREF_TYPE_DIALOG = 2029; +const int NWNX_UTIL_RESREF_TYPE_TRIGGER = 2032; +const int NWNX_UTIL_RESREF_TYPE_SOUND = 2035; +const int NWNX_UTIL_RESREF_TYPE_ENCOUNTER = 2040; +const int NWNX_UTIL_RESREF_TYPE_DOOR = 2042; +const int NWNX_UTIL_RESREF_TYPE_PLACEABLE = 2044; +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. +/// @return The name of the currently executing script. +string NWNX_Util_GetCurrentScriptName(int depth = 0); + +/// @brief Gets a string that contains the ascii table. +/// @note The character at index 0 is a space. +/// @return A string that contains all characters at their position (e.g. 'A' at 65). +string NWNX_Util_GetAsciiTableString(); + +/// @brief Gets an integer hash of a string. +/// @param str The string to hash. +/// @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. +string NWNX_Util_GetCustomToken(int customTokenNumber); + +/// @brief Convert an effect type to an itemproperty type. +/// @param e The effect to convert to an itemproperty. +/// @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. +effect NWNX_Util_ItemPropertyToEffect(itemproperty ip); + +/// @brief Strip any color codes from a string. +/// @param str The string to strip of color. +/// @return The new string without any color codes. +string NWNX_Util_StripColors(string str); + +/// @brief Retrieves an environment variable. +/// @param sVarname The environment variable to query. +/// @return The value of the environment variable. +string NWNX_Util_GetEnvironmentVariable(string sVarname); + +/// @brief Gets the module real life minutes per in game hour. +/// @return The minutes per hour. +int NWNX_Util_GetMinutesPerHour(); + +/// @brief Set module real life minutes per in game hour. +/// @param minutes The minutes per hour. +void NWNX_Util_SetMinutesPerHour(int minutes); + +/// @anchor util_encode_url +/// @brief Encodes a string for usage in a URL. +/// @param str The string to encode for a URL. +/// @return The url encoded string. +string NWNX_Util_EncodeStringForURL(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. +/// For example: **nwnx_.\*** gets you all scripts prefixed with nwnx_ +/// when using the NSS resref type. +/// @param bModuleResourcesOnly If TRUE only custom resources will be returned. +/// @return The first resref found or "" if none is found. +string NWNX_Util_GetFirstResRef(int nType, string sRegexFilter = "", int bModuleResourcesOnly = TRUE); + +/// @brief Get the next resref. +/// @return The next resref found or "" if none is found. +string NWNX_Util_GetNextResRef(); + +/// @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. +/// @param nNthLast The nth last object created. +/// @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, 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 sAlias = "NWNX"); + +/// @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, string sAlias = "NWNX"); + +/// @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, string sAlias = "NWNX"); + +/// @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. +/// @param sScriptChunk The script chunk to run. You can use $args to get the console command arguments. +/// @return TRUE on success. +int NWNX_Util_RegisterServerConsoleCommand(string sCommand, string sScriptChunk); + +/// @brief Unregister a server console command that was registered with NWNX_Util_RegisterServerConsoleCommand(). +/// @param sCommand The name of the command. +void NWNX_Util_UnregisterServerConsoleCommand(string sCommand); + +/// @brief Gets the server's current working user folder. +/// @return The absolute path of the server's home directory (-userDirectory) +string NWNX_Util_GetUserDirectory(); + +/// @brief Get the return value of the last run script with a StartingConditional +/// @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) +{ + NWNXPushInt(depth); + NWNXCall(NWNX_Util, "GetCurrentScriptName"); + return NWNXPopString(); +} + +string NWNX_Util_GetAsciiTableString() +{ + NWNXCall(NWNX_Util, "GetAsciiTableString"); + return NWNXPopString(); +} + +int NWNX_Util_Hash(string str) +{ + 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) +{ + NWNXPushInt(customTokenNumber); + NWNXCall(NWNX_Util, "GetCustomToken"); + return NWNXPopString(); +} + +itemproperty NWNX_Util_EffectToItemProperty(effect e) +{ + NWNXPushEffect(e); + NWNXCall(NWNX_Util, "EffectTypeCast"); + return NWNXPopItemProperty(); +} + +effect NWNX_Util_ItemPropertyToEffect(itemproperty ip) +{ + NWNXPushItemProperty(ip); + NWNXCall(NWNX_Util, "EffectTypeCast"); + return NWNXPopEffect(); +} + +string NWNX_Util_StripColors(string str) +{ + NWNXPushString(str); + NWNXCall(NWNX_Util, "StripColors"); + return NWNXPopString(); +} + +string NWNX_Util_GetEnvironmentVariable(string sVarname) +{ + NWNXPushString(sVarname); + NWNXCall(NWNX_Util, "GetEnvironmentVariable"); + return NWNXPopString(); +} + +int NWNX_Util_GetMinutesPerHour() +{ + NWNXCall(NWNX_Util, "GetMinutesPerHour"); + return NWNXPopInt(); +} + +void NWNX_Util_SetMinutesPerHour(int minutes) +{ + NWNXPushInt(minutes); + NWNXCall(NWNX_Util, "SetMinutesPerHour"); +} + +string NWNX_Util_EncodeStringForURL(string sURL) +{ + NWNXPushString(sURL); + NWNXCall(NWNX_Util, "EncodeStringForURL"); + return NWNXPopString(); +} + +string NWNX_Util_GetFirstResRef(int nType, string sRegexFilter = "", int bModuleResourcesOnly = TRUE) +{ + NWNXPushInt(bModuleResourcesOnly); + NWNXPushString(sRegexFilter); + NWNXPushInt(nType); + NWNXCall(NWNX_Util, "GetFirstResRef"); + return NWNXPopString(); +} + +string NWNX_Util_GetNextResRef() +{ + NWNXCall(NWNX_Util, "GetNextResRef"); + return NWNXPopString(); +} + +object NWNX_Util_GetLastCreatedObject(int nObjectType, int nNthLast = 1) +{ + NWNXPushInt(nNthLast); + NWNXPushInt(nObjectType); + NWNXCall(NWNX_Util, "GetLastCreatedObject"); + return NWNXPopObject(); +} + +string NWNX_Util_AddScript(string sFileName, string sScriptData, int bWrapIntoMain = FALSE, string sAlias = "NWNX") +{ + NWNXPushString(sAlias); + NWNXPushInt(bWrapIntoMain); + NWNXPushString(sScriptData); + NWNXPushString(sFileName); + NWNXCall(NWNX_Util, "AddScript"); + return NWNXPopString(); +} + +int NWNX_Util_AddNSSFile(string sFileName, string sContents, string sAlias = "NWNX") +{ + NWNXPushString(sAlias); + NWNXPushString(sContents); + NWNXPushString(sFileName); + NWNXCall(NWNX_Util, "AddNSSFile"); + return NWNXPopInt(); +} + +int NWNX_Util_RemoveNWNXResourceFile(string sFileName, int nType, string sAlias = "NWNX") +{ + NWNXPushString(sAlias); + NWNXPushInt(nType); + NWNXPushString(sFileName); + NWNXCall(NWNX_Util, "RemoveNWNXResourceFile"); + return NWNXPopInt(); +} + +void NWNX_Util_SetInstructionLimit(int nInstructionLimit) +{ + NWNXPushInt(nInstructionLimit); + NWNXCall(NWNX_Util, "SetInstructionLimit"); +} + +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) +{ + NWNXPushString(sScriptChunk); + NWNXPushString(sCommand); + NWNXCall(NWNX_Util, "RegisterServerConsoleCommand"); + return NWNXPopInt(); +} + +void NWNX_Util_UnregisterServerConsoleCommand(string sCommand) +{ + NWNXPushString(sCommand); + NWNXCall(NWNX_Util, "UnregisterServerConsoleCommand"); +} + +string NWNX_Util_GetUserDirectory() +{ + NWNXCall(NWNX_Util, "GetUserDirectory"); + return NWNXPopString(); +} + +int NWNX_Util_GetScriptReturnValue() +{ + 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 new file mode 100644 index 00000000..be70ed0c --- /dev/null +++ b/_module/nss/nwnx_visibility.nss @@ -0,0 +1,71 @@ +/// @addtogroup visibility Visibility +/// @brief Functions to manipulate visibility of objects both globally or per observer +/// @{ +/// @file nwnx_visibility.nss + +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_ALWAYS_VISIBLE = 3; +const int NWNX_VISIBILITY_ALWAYS_VISIBLE_DM_ONLY = 4; +///@} + +/// @brief Queries the existing visibility override for given (oPlayer, oTarget) pair. +/// If oPlayer is OBJECT_INVALID, the global visibility override will be returned. +/// +/// * 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 oPlayer, object oTarget); + +/// @brief Overrides the default visibility rules about how oPlayer perceives oTarget. +/// If oPlayer is OBJECT_INVALID, the global visibility override will be set. +/// +/// * 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 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 oPlayer, object oTarget) +{ + NWNXPushObject(oTarget); + NWNXPushObject(oPlayer); + NWNXCall(NWNX_Visibility, "GetVisibilityOverride"); + return NWNXPopInt(); +} + +void NWNX_Visibility_SetVisibilityOverride(object oPlayer, object oTarget, int nOverride) +{ + NWNXPushInt(nOverride); + NWNXPushObject(oTarget); + NWNXPushObject(oPlayer); + NWNXCall(NWNX_Visibility, "SetVisibilityOverride"); +} diff --git a/_module/nss/nwnx_weapon.nss b/_module/nss/nwnx_weapon.nss new file mode 100644 index 00000000..eced73f0 --- /dev/null +++ b/_module/nss/nwnx_weapon.nss @@ -0,0 +1,288 @@ +/// @addtogroup weapon Weapon +/// @brief Functions exposing additional weapon properties. +/// @{ +/// @file nwnx_weapon.nss + +const string NWNX_Weapon = "NWNX_Weapon"; ///< @private + +/// @name Weapons Options +/// @anchor wpn_opts +/// +/// Options constants to be used with NWNX_Weapon_SetOption function. +/// @{ +const int NWNX_WEAPON_OPT_GRTFOCUS_AB_BONUS = 0; ///< Greater Focus Attack Bonus +const int NWNX_WEAPON_OPT_GRTSPEC_DAM_BONUS = 1; ///< Greater Specialization Damage Bonus +///@} + +// Get Event Data Constants +const int NWNX_WEAPON_GETDATA_DC = 0; ///< Get Devastating Critical Data + +// Set Event Data Constants +const int NWNX_WEAPON_SETDATA_DC_BYPASS = 0; ///< Set Devastating Critical Bypass + +/// Devastating critical event data +struct NWNX_Weapon_DevastatingCriticalEvent_Data +{ + object oWeapon; ///< The weapon used to cause the event. + object oTarget; ///< The target hit with a devastating critical. + int nDamage; ///< The damage points delivered. +}; + +/// @brief Set nFeat as weapon focus feat for a base item. +/// @param nBaseItem The base item id. +/// @param nFeat The feat to set. +void NWNX_Weapon_SetWeaponFocusFeat(int nBaseItem, int nFeat); + +/// @brief Set required creature size for a weapon base item to be finessable. +/// @param nBaseItem The base item id. +/// @param nSize The creature size minimum to consider this weapon finessable. +void NWNX_Weapon_SetWeaponFinesseSize(int nBaseItem, int nSize); + +/// @brief Get required creature size for a weapon base item to be finessable. +/// @param nBaseItem The base item id. +int NWNX_Weapon_GetWeaponFinesseSize(int nBaseItem); + +/// @brief Set weapon base item to be considered as unarmed for weapon finesse feat. +/// @param nBaseItem The base item id. +void NWNX_Weapon_SetWeaponUnarmed(int nBaseItem); + +/// @brief Set a feat as weapon improved critical for a base item. +/// @param nBaseItem The base item id. +/// @param nFeat The feat to set. +void NWNX_Weapon_SetWeaponImprovedCriticalFeat(int nBaseItem, int nFeat); + +/// @brief Set a feat as weapon specialization for a base item. +/// @param nBaseItem The base item id. +/// @param nFeat The feat to set. +void NWNX_Weapon_SetWeaponSpecializationFeat(int nBaseItem, int nFeat); + +/// @brief Set a feat as epic weapon focus for a base item. +/// @param nBaseItem The base item id. +/// @param nFeat The feat to set. +void NWNX_Weapon_SetEpicWeaponFocusFeat(int nBaseItem, int nFeat); + +/// @brief Set a feat as epic weapon specialization for a base item. +/// @param nBaseItem The base item id. +/// @param nFeat The feat to set. +void NWNX_Weapon_SetEpicWeaponSpecializationFeat(int nBaseItem, int nFeat); + +/// @brief Set a feat as epic weapon overwhelming critical for a base item. +/// @param nBaseItem The base item id. +/// @param nFeat The feat to set. +void NWNX_Weapon_SetEpicWeaponOverwhelmingCriticalFeat(int nBaseItem, int nFeat); + +/// @brief Set a feat as epic weapon devastating critical for a base item. +/// @param nBaseItem The base item id. +/// @param nFeat The feat to set. +void NWNX_Weapon_SetEpicWeaponDevastatingCriticalFeat(int nBaseItem, int nFeat); + +/// @brief Set a feat as weapon of choice for a base item. +/// @param nBaseItem The base item id. +/// @param nFeat The feat to set. +void NWNX_Weapon_SetWeaponOfChoiceFeat(int nBaseItem, int nFeat); + +/// @brief Set a feat as greater weapon specialization for a base item. +/// @param nBaseItem The base item id. +/// @param nFeat The feat to set. +void NWNX_Weapon_SetGreaterWeaponSpecializationFeat(int nBaseItem, int nFeat); + +/// @brief Set a feat as greater weapon focus for a base item. +/// @param nBaseItem The base item id. +/// @param nFeat The feat to set. +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. +/// @param nOption The option to change from @ref wpn_opts "Weapon Options". +/// @param nVal The new value of the option. +void NWNX_Weapon_SetOption(int nOption, int nVal); + +/// @brief Set Devastating Critical Event Script. +/// @param sScript The script to call when a Devastating Critical occurs. +void NWNX_Weapon_SetDevastatingCriticalEventScript(string sScript); + +/// @brief Get Devastating Critical Event Data. +/// @note This is only for use with the Devastating Critical Event Script. +/// @return An NWNX_Weapon_DevastatingCriticalEvent_Data struct. +struct NWNX_Weapon_DevastatingCriticalEvent_Data NWNX_Weapon_GetDevastatingCriticalEventData(); + +/// @brief Bypass Devastating Critical. +/// @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) +{ + NWNXPushInt(nFeat); + NWNXPushInt(nBaseItem); + NWNXCall(NWNX_Weapon, "SetWeaponFocusFeat"); +} + +void NWNX_Weapon_SetEpicWeaponFocusFeat(int nBaseItem, int nFeat) +{ + NWNXPushInt(nFeat); + NWNXPushInt(nBaseItem); + NWNXCall(NWNX_Weapon, "SetEpicWeaponFocusFeat"); +} + +void NWNX_Weapon_SetGreaterWeaponFocusFeat(int nBaseItem, int nFeat) +{ + NWNXPushInt(nFeat); + NWNXPushInt(nBaseItem); + NWNXCall(NWNX_Weapon, "SetGreaterWeaponFocusFeat"); +} + +void NWNX_Weapon_SetWeaponFinesseSize(int nBaseItem, int nSize) +{ + NWNXPushInt(nSize); + NWNXPushInt(nBaseItem); + NWNXCall(NWNX_Weapon, "SetWeaponFinesseSize"); +} + +int NWNX_Weapon_GetWeaponFinesseSize(int nBaseItem) +{ + NWNXPushInt(nBaseItem); + NWNXCall(NWNX_Weapon, "GetWeaponFinesseSize"); + return NWNXPopInt(); +} + +void NWNX_Weapon_SetWeaponUnarmed(int nBaseItem) +{ + NWNXPushInt(nBaseItem); + NWNXCall(NWNX_Weapon, "SetWeaponUnarmed"); +} + +void NWNX_Weapon_SetWeaponIsMonkWeapon(int nBaseItem) +{ + 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) +{ + NWNXPushInt(nFeat); + NWNXPushInt(nBaseItem); + NWNXCall(NWNX_Weapon, "SetWeaponImprovedCriticalFeat"); +} + +void NWNX_Weapon_SetWeaponSpecializationFeat(int nBaseItem, int nFeat) +{ + NWNXPushInt(nFeat); + NWNXPushInt(nBaseItem); + NWNXCall(NWNX_Weapon, "SetWeaponSpecializationFeat"); +} + +void NWNX_Weapon_SetGreaterWeaponSpecializationFeat(int nBaseItem, int nFeat) +{ + NWNXPushInt(nFeat); + NWNXPushInt(nBaseItem); + NWNXCall(NWNX_Weapon, "SetGreaterWeaponSpecializationFeat"); +} + +void NWNX_Weapon_SetEpicWeaponSpecializationFeat(int nBaseItem, int nFeat) +{ + NWNXPushInt(nFeat); + NWNXPushInt(nBaseItem); + NWNXCall(NWNX_Weapon, "SetEpicWeaponSpecializationFeat"); +} + +void NWNX_Weapon_SetEpicWeaponOverwhelmingCriticalFeat(int nBaseItem, int nFeat) +{ + NWNXPushInt(nFeat); + NWNXPushInt(nBaseItem); + NWNXCall(NWNX_Weapon, "SetEpicWeaponOverwhelmingCriticalFeat"); +} + +void NWNX_Weapon_SetEpicWeaponDevastatingCriticalFeat(int nBaseItem, int nFeat) +{ + NWNXPushInt(nFeat); + NWNXPushInt(nBaseItem); + NWNXCall(NWNX_Weapon, "SetEpicWeaponDevastatingCriticalFeat"); +} + +void NWNX_Weapon_SetWeaponOfChoiceFeat(int nBaseItem, int nFeat) +{ + NWNXPushInt(nFeat); + NWNXPushInt(nBaseItem); + NWNXCall(NWNX_Weapon, "SetWeaponOfChoiceFeat"); +} + +void NWNX_Weapon_SetOption(int nOption, int nVal) +{ + NWNXPushInt(nVal); + NWNXPushInt(nOption); + NWNXCall(NWNX_Weapon, "SetOption"); +} + +void NWNX_Weapon_SetDevastatingCriticalEventScript(string sScript) +{ + NWNXPushString(sScript); + NWNXCall(NWNX_Weapon, "SetDevastatingCriticalEventScript"); +} + +void NWNX_Weapon_BypassDevastatingCritical() +{ + NWNXPushInt(1); + NWNXPushInt(NWNX_WEAPON_SETDATA_DC_BYPASS); + NWNXCall(NWNX_Weapon, "SetEventData"); +} + +struct NWNX_Weapon_DevastatingCriticalEvent_Data NWNX_Weapon_GetDevastatingCriticalEventData() +{ + struct NWNX_Weapon_DevastatingCriticalEvent_Data data; + 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 new file mode 100644 index 00000000..2d7e7ed0 --- /dev/null +++ b/_module/nss/nwnx_webhook.nss @@ -0,0 +1,41 @@ +/// @addtogroup webhook Webhook +/// @brief Send messages to external entities through web hooks. +/// @{ +/// @file nwnx_webhook.nss + +const string NWNX_WebHook = "NWNX_WebHook"; ///< @private + +/// @brief Send a slack compatible webhook. +/// @param host The web server to send the hook. +/// @param path The path to the hook. +/// @param message The message to dispatch. +/// @param username The username to display as the originator of the hook. +/// @param mrkdwn Set to false if you do not wish your message's markdown be parsed. +void NWNX_WebHook_SendWebHookHTTPS(string host, string path, string message, string username = "", int mrkdwn = 1); + +/// @brief Resends a webhook message after a defined delay. +/// +/// Handy when a submission is rate limited, since the message that the event sends in NWNX_Events_GetEventData +/// is already constructed. So it just resends the WebHook with an optional delay. +/// @param host The web server to send the hook. +/// @param path The path to the hook. +/// @param sMessage The message to dispatch. +/// @param delay The delay in seconds to send the message again. +void NWNX_WebHook_ResendWebHookHTTPS(string host, string path, string sMessage, float delay = 0.0f); + +/// @} + +void NWNX_WebHook_SendWebHookHTTPS(string host, string path, string message, string username = "", int mrkdwn = 1) +{ + 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) +{ + DelayCommand(delay, NWNX_WebHook_SendWebHookHTTPS(host, path, sMessage)); +} diff --git a/_module/nss/nwnx_webhook_rch.nss b/_module/nss/nwnx_webhook_rch.nss new file mode 100644 index 00000000..3555ef71 --- /dev/null +++ b/_module/nss/nwnx_webhook_rch.nss @@ -0,0 +1,159 @@ +/// @ingroup webhook +/// @file nwnx_webhook_rch.nss +/// @brief Create richer webhook messages suitable for Discord +#include "nwnx_webhook" + +/// @ingroup webhook +/// @brief For more information on these fields see https://birdie0.github.io/discord-webhooks-guide/ +/// @note URL fields may require NWNX_Util_EncodeStringForURL(). +struct NWNX_WebHook_Message { + string sUsername; ///< https://birdie0.github.io/discord-webhooks-guide/structure/username.html + string sText; ///< https://birdie0.github.io/discord-webhooks-guide/structure/content.html + string sAvatarURL; ///< https://birdie0.github.io/discord-webhooks-guide/structure/avatar_url.html + string sColor; ///< https://birdie0.github.io/discord-webhooks-guide/structure/embed/color.html + string sAuthorName; ///< https://birdie0.github.io/discord-webhooks-guide/structure/embed/author.html + string sAuthorURL; ///< https://birdie0.github.io/discord-webhooks-guide/structure/embed/author.html + string sAuthorIconURL; ///< https://birdie0.github.io/discord-webhooks-guide/structure/embed/author.html + string sTitle; ///< https://birdie0.github.io/discord-webhooks-guide/structure/embed/title.html + string sURL; ///< https://birdie0.github.io/discord-webhooks-guide/structure/embed/url.html + string sDescription; ///< https://birdie0.github.io/discord-webhooks-guide/structure/embed/description.html + string sThumbnailURL; ///< https://birdie0.github.io/discord-webhooks-guide/structure/embed/thumbnail.html + string sImageURL; ///< https://birdie0.github.io/discord-webhooks-guide/structure/embed/image.html + string sFooterText; ///< https://birdie0.github.io/discord-webhooks-guide/structure/embed/footer.html + string sFooterURL; ///< https://birdie0.github.io/discord-webhooks-guide/structure/embed/footer.html + int iTimestamp; ///< https://birdie0.github.io/discord-webhooks-guide/structure/embed/timestamp.html + string sField1Name; ///< https://birdie0.github.io/discord-webhooks-guide/structure/embed/fields.html + string sField1Value; ///< https://birdie0.github.io/discord-webhooks-guide/structure/embed/fields.html + int iField1Inline; ///< https://birdie0.github.io/discord-webhooks-guide/structure/embed/fields.html + string sField2Name; ///< https://birdie0.github.io/discord-webhooks-guide/structure/embed/fields.html + string sField2Value; ///< https://birdie0.github.io/discord-webhooks-guide/structure/embed/fields.html + int iField2Inline; ///< https://birdie0.github.io/discord-webhooks-guide/structure/embed/fields.html + string sField3Name; ///< https://birdie0.github.io/discord-webhooks-guide/structure/embed/fields.html + string sField3Value; ///< https://birdie0.github.io/discord-webhooks-guide/structure/embed/fields.html + int iField3Inline; ///< https://birdie0.github.io/discord-webhooks-guide/structure/embed/fields.html + string sField4Name; ///< https://birdie0.github.io/discord-webhooks-guide/structure/embed/fields.html + string sField4Value; ///< https://birdie0.github.io/discord-webhooks-guide/structure/embed/fields.html + int iField4Inline; ///< https://birdie0.github.io/discord-webhooks-guide/structure/embed/fields.html + string sField5Name; ///< https://birdie0.github.io/discord-webhooks-guide/structure/embed/fields.html + string sField5Value; ///< https://birdie0.github.io/discord-webhooks-guide/structure/embed/fields.html + int iField5Inline; ///< https://birdie0.github.io/discord-webhooks-guide/structure/embed/fields.html + string sField6Name; ///< https://birdie0.github.io/discord-webhooks-guide/structure/embed/fields.html + string sField6Value; ///< https://birdie0.github.io/discord-webhooks-guide/structure/embed/fields.html + int iField6Inline; ///< https://birdie0.github.io/discord-webhooks-guide/structure/embed/fields.html + string sField7Name; ///< https://birdie0.github.io/discord-webhooks-guide/structure/embed/fields.html + string sField7Value; ///< https://birdie0.github.io/discord-webhooks-guide/structure/embed/fields.html + int iField7Inline; ///< https://birdie0.github.io/discord-webhooks-guide/structure/embed/fields.html + string sField8Name; ///< https://birdie0.github.io/discord-webhooks-guide/structure/embed/fields.html + string sField8Value; ///< https://birdie0.github.io/discord-webhooks-guide/structure/embed/fields.html + int iField8Inline; ///< https://birdie0.github.io/discord-webhooks-guide/structure/embed/fields.html + string sField9Name; ///< https://birdie0.github.io/discord-webhooks-guide/structure/embed/fields.html + string sField9Value; ///< https://birdie0.github.io/discord-webhooks-guide/structure/embed/fields.html + int iField9Inline; ///< https://birdie0.github.io/discord-webhooks-guide/structure/embed/fields.html + string sField10Name; ///< https://birdie0.github.io/discord-webhooks-guide/structure/embed/fields.html + string sField10Value; ///< https://birdie0.github.io/discord-webhooks-guide/structure/embed/fields.html + int iField10Inline; ///< https://birdie0.github.io/discord-webhooks-guide/structure/embed/fields.html +}; + +/// @private We don't need this to be a part of the docs. +/// @brief Helper function to convert 0 or 1 to false or true. +/// @param iBool The integer representation of the boolean. +/// @return The string representation (true or false) of the boolean. +string IntToBoolString(int iBool); + +/// @ingroup webhook +/// @brief Builds and sends a rich webhook message based on the constructed NWNX_WebHook_Message. +/// @param host The web server to send the hook. +/// @param path The path to the hook. +/// @param stMessage A constructed NWNX_Webhook_Message. +/// @param mrkdwn Set to false if you do not wish your message's markdown be parsed. +/// @warning Your path must end with /slack if using a Discord webhook. +string NWNX_WebHook_BuildMessageForWebHook(string host, string path, struct NWNX_WebHook_Message stMessage, int mrkdwn = 1); + +string IntToBoolString(int iBool) +{ + return iBool == 0 ? "false" : "true"; +} + +string NWNX_WebHook_BuildMessageForWebHook(string host, string path, struct NWNX_WebHook_Message stMessage, int mrkdwn = 1) +{ + if (host == "discordapp.com" && GetStringRight(path, 6) != "/slack") + { + PrintString("Discord WebHook specified but path does not end with /slack"); + return ""; + } + + // Open JSON + string message = "{"; + + string sMainText = ""; + + // The only way to turn off markdown for discord is to surround the text in backticks + if (stMessage.sText != "") + { + if (host == "discordapp.com" && !mrkdwn) + sMainText = "```text\\n" + stMessage.sText + "```"; + else + sMainText = stMessage.sText; + } + message = message + "\"text\": \"" + sMainText + "\""; + + // Slack will turn off markdown + if (host != "discordapp.com" && !mrkdwn) + message = message + ",\"mrkdwn\": false"; + + // Set the user attributes for the poster + if (stMessage.sUsername != "") + message = message + ",\"username\": \"" + stMessage.sUsername + "\""; + if (stMessage.sAvatarURL != "") + message = message + ",\"icon_url\": \"" + stMessage.sAvatarURL + "\""; + + // We need to construct an attachment (embed) object + if (stMessage.sAuthorName != "" || stMessage.sAuthorURL != "" || stMessage.sAuthorIconURL != "" || + stMessage.sTitle != "" || stMessage.sURL != "" || stMessage.sDescription != "" || + stMessage.sFooterText != "" || stMessage.sFooterURL != "" || stMessage.iTimestamp > 0 || + stMessage.sColor != "" || stMessage.sThumbnailURL != "" || stMessage.sImageURL != "" || stMessage.sField1Name != "") + { + message = message + ",\"attachments\": [{\"author_name\": \"" + stMessage.sAuthorName + "\",\"author_link\": \"" + stMessage.sAuthorURL + + "\",\"author_icon\": \"" + stMessage.sAuthorIconURL + "\",\"title\": \"" + stMessage.sTitle + "\",\"title_link\": \"" + stMessage.sURL + + "\",\"text\": \"" + stMessage.sDescription + "\",\"footer\": \"" + stMessage.sFooterText + "\",\"footer_icon\": \"" + stMessage.sFooterURL + + "\",\"color\": \"" + stMessage.sColor + "\",\"thumb_url\": \"" + stMessage.sThumbnailURL + + "\",\"image_url\": \"" + stMessage.sImageURL + "\""; + + // Dont post an empty timestamp + if (stMessage.iTimestamp > 0) + message = message + ",\"ts\": \"" + IntToString(stMessage.iTimestamp) + "\""; + + // Fields to handle + if (stMessage.sField1Name != "") + { + message = message + ",\"fields\": ["; + message = message + "{\"title\": \"" + stMessage.sField1Name + "\",\"value\": \"" + stMessage.sField1Value + "\",\"short\": " + IntToBoolString(stMessage.iField1Inline) + "}"; + if (stMessage.sField2Name != "") + message = message + ",{\"title\": \"" + stMessage.sField2Name + "\",\"value\": \"" + stMessage.sField2Value + "\",\"short\": " + IntToBoolString(stMessage.iField2Inline) + "}"; + if (stMessage.sField3Name != "") + message = message + ",{\"title\": \"" + stMessage.sField3Name + "\",\"value\": \"" + stMessage.sField3Value + "\",\"short\": " + IntToBoolString(stMessage.iField3Inline) + "}"; + if (stMessage.sField4Name != "") + message = message + ",{\"title\": \"" + stMessage.sField4Name + "\",\"value\": \"" + stMessage.sField4Value + "\",\"short\": " + IntToBoolString(stMessage.iField4Inline) + "}"; + if (stMessage.sField5Name != "") + message = message + ",{\"title\": \"" + stMessage.sField5Name + "\",\"value\": \"" + stMessage.sField5Value + "\",\"short\": " + IntToBoolString(stMessage.iField5Inline) + "}"; + if (stMessage.sField6Name != "") + message = message + ",{\"title\": \"" + stMessage.sField6Name + "\",\"value\": \"" + stMessage.sField6Value + "\",\"short\": " + IntToBoolString(stMessage.iField6Inline) + "}"; + if (stMessage.sField7Name != "") + message = message + ",{\"title\": \"" + stMessage.sField7Name + "\",\"value\": \"" + stMessage.sField7Value + "\",\"short\": " + IntToBoolString(stMessage.iField7Inline) + "}"; + if (stMessage.sField8Name != "") + message = message + ",{\"title\": \"" + stMessage.sField8Name + "\",\"value\": \"" + stMessage.sField8Value + "\",\"short\": " + IntToBoolString(stMessage.iField8Inline) + "}"; + if (stMessage.sField9Name != "") + message = message + ",{\"title\": \"" + stMessage.sField9Name + "\",\"value\": \"" + stMessage.sField9Value + "\",\"short\": " + IntToBoolString(stMessage.iField9Inline) + "}"; + if (stMessage.sField10Name != "") + message = message + ",{\"title\": \"" + stMessage.sField10Name + "\",\"value\": \"" + stMessage.sField10Value + "\",\"short\": " + IntToBoolString(stMessage.iField10Inline) + "}"; + // Close fields array + message = message + "]"; + } + // Close attachments array + message = message + "}]"; + } + // Close JSON + message = message + "}"; + + return message; +} diff --git a/_module/nss/on_pubsub.nss b/_module/nss/on_pubsub.nss new file mode 100644 index 00000000..4505136a --- /dev/null +++ b/_module/nss/on_pubsub.nss @@ -0,0 +1,14 @@ +/// @ingroup redis +/// @brief Script to handle PubSub event +/// @{ +/// @file on_pubsub.nss +#include "nwnx_redis_ps" + +void main() +{ + struct NWNX_Redis_PubSubMessageData data = NWNX_Redis_GetPubSubMessageData(); + + WriteTimestampedLogEntry("Pubsub Event: channel=" + data.channel + + " message=" + data.message); +} +/// @} diff --git a/_module/nss/prc_rest.nss b/_module/nss/prc_rest.nss new file mode 100644 index 00000000..d5490b89 --- /dev/null +++ b/_module/nss/prc_rest.nss @@ -0,0 +1,408 @@ +//:://///////////////////////////////////////////// +//:: OnPlayerRest eventscript +//:: prc_rest +//::////////////////////////////////////////////// +/* + Hooked NPC's into this via prc_npc_rested - 06.03.2004, Ornedan +*/ + +#include "prc_inc_function" +#include "psi_inc_psifunc" +#include "prc_sp_func" +#include "prc_inc_domain" +#include "true_inc_trufunc" +#include "inv_inc_invfunc" +#include "inc_epicspells" +#include "prc_inc_scry" +#include "prc_inc_dragsham" +#include "prc_inc_wpnrest" +#include "inc_dynconv" +#include "prc_inc_util" +#include "shd_inc_myst" +#include "prc_inc_template" + +void PrcFeats(object oPC) +{ + if(DEBUG) DoDebug("prc_rest: Evaluating PC feats for " + DebugObject2Str(oPC)); + + SetLocalInt(oPC,"ONREST",1); + object oSkin = GetPCSkin(oPC); + DelayCommand(0.2, ScrubPCSkin(oPC, oSkin)); + DelayCommand(0.3, FeatSpecialUsePerDay(oPC)); + DelayCommand(0.4, DeletePRCLocalInts(oSkin)); + DelayCommand(0.5, DeletePRCLocalIntsT(oPC)); + DelayCommand(0.6, EvalPRCFeats(oPC)); + DelayCommand(0.7, DoWeaponsEquip(oPC)); + DelayCommand(1.0, DeleteLocalInt(oPC,"ONREST")); +} + +void RestCancelled(object oPC) +{ + if(GetPRCSwitch(PRC_PNP_REST_HEALING)) + { + int nHP = GetLocalInt(oPC, "PnP_Rest_InitialHP"); + //cancelled, dont heal anything + //nHP += GetHitDice(oPC); + int nCurrentHP = GetCurrentHitPoints(oPC); + int nDamage = nCurrentHP-nHP; + //check its a positive number + if(nDamage > 0) + { + //DelayCommand(1.5, ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectDamage(nDamage, DAMAGE_TYPE_MAGICAL, DAMAGE_POWER_PLUS_TWENTY), oPC)); + SetCurrentHitPoints(oPC, nCurrentHP - nDamage); + } + } + if(DEBUG) DoDebug("prc_rest: Rest cancelled for " + DebugObject2Str(oPC)); + DelayCommand(1.1,PrcFeats(oPC)); + // Execute scripts hooked to this event for the player triggering it + ExecuteAllScriptsHookedToEvent(oPC, EVENT_ONPLAYERREST_CANCELLED); +} + +void RestFinished(object oPC) +{ + int nGeneration = PRC_NextGeneration(GetLocalInt(oPC, PRC_Rest_Generation)); + if (DEBUG > 1) DoDebug("Rest Generation: " + IntToString(nGeneration)); + SetLocalInt(oPC, PRC_Rest_Generation, nGeneration); + + if(DEBUG) DoDebug("prc_rest: Rest finished for for " + DebugObject2Str(oPC)); + //Restore Power Points for Psionics + ExecuteScript("prc_psi_ppoints", oPC); + ExecuteScript("tob_evnt_recover", oPC); + DelayCommand(0.1, BonusDomainRest(oPC)); + DelayCommand(0.2, ClearLawLocalVars(oPC)); + DelayCommand(0.3, ClearMystLocalVars(oPC)); + DelayCommand(0.4, ClearLegacyUses(oPC)); + DelayCommand(0.5, ClearInvocationLocalVars(oPC)); + + // To heal up enslaved creatures... + object oSlave = GetLocalObject(oPC, "EnslavedCreature"); + if (GetIsObjectValid(oSlave) && !GetIsDead(oSlave) && !GetIsInCombat(oSlave)) + AssignCommand(oSlave, ActionRest()); + //ForceRest(oSlave); + + if (GetIsEpicSpellcaster(oPC)) { + FloatingTextStringOnCreature("*You feel refreshed*", oPC, FALSE); + ReplenishSlots(oPC); + } + + if (GetHasFeat(FEAT_SF_CODE,oPC)) + DelayCommand(0.1, RemoveSpecificProperty(GetPCSkin(oPC),ITEM_PROPERTY_BONUS_FEAT,IP_CONST_FEAT_SF_CODE)); + + // begin flurry of swords array + if (GetLevelByClass(CLASS_TYPE_ARCANE_DUELIST, oPC)) + { + DeleteLocalInt(oPC, "FLURRY_TARGET_NUMBER"); + + int i; + for (i = 0 ; i < 10 ; i++) + { + string sName = "FLURRY_TARGET_" + IntToString(i); + SetLocalObject(oPC, sName, OBJECT_INVALID); + } + } + // end flurry or swords array + + //Check for leftover Diamond Dragon appendages + if (GetLevelByClass(CLASS_TYPE_DIAMOND_DRAGON, oPC)) + { + if(GetPersistantLocalInt(oPC, "ChannelingTail")) + { + SetPersistantLocalInt(oPC, "ChannelingTail", FALSE); + SetCreatureTailType(CREATURE_TAIL_TYPE_NONE, oPC); + } + if(GetPersistantLocalInt(oPC, "ChannelingWings")) + { + SetPersistantLocalInt(oPC, "ChannelingWings", FALSE); + SetCreatureWingType(CREATURE_WING_TYPE_NONE, oPC); + } + } + + if(GetPRCSwitch(PRC_PNP_REST_HEALING)) + { + int nHP = GetLocalInt(oPC, "PnP_Rest_InitialHP"); + int nOldMax = GetLocalInt(oPC, "PnP_Rest_InitialMax"); + if(DEBUG) DoDebug("prc_rest: Finished HPs for " + DebugObject2Str(oPC)+"n/n/"+" nCurrent: "+IntToString(nHP)+" nMax: "+IntToString(nOldMax)); + //only heal HP if not undead and not a construct + if(MyPRCGetRacialType(oPC) != RACIAL_TYPE_UNDEAD && MyPRCGetRacialType(oPC) != RACIAL_TYPE_CONSTRUCT) + nHP = GetMaxHitPoints(oPC) - nOldMax + nHP + GetHitDice(oPC); + int nCurrentHP = GetCurrentHitPoints(oPC); + int nDamage = nCurrentHP-nHP; + //check its a positive number + if(nDamage > 0) + { + //DelayCommand(1.5, ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectDamage(nDamage, DAMAGE_TYPE_MAGICAL, DAMAGE_POWER_PLUS_TWENTY), oPC)); + SetCurrentHitPoints(oPC, nCurrentHP - nDamage); + } + // We've finished rest, clean up + DeleteLocalInt(oPC, "PnP_Rest_InitialHP"); + DeleteLocalInt(oPC, "PnP_Rest_InitialMax"); + } + + int nSpellCount = GetPRCSwitch(PRC_DISABLE_SPELL_COUNT); + int i; + string sMessage; + for(i=1;i 0 || nRest < 0) + { + int nDelay = nRest * GetHitDice(oPC); + if (nRest == -1) nDelay = 24; + else if (nRest == -2) nDelay = 16; + + SetLocalInt(oPC, "RestTimer", TRUE); + DelayCommand(HoursToSeconds(nDelay), DeleteLocalInt(oPC, "RestTimer")); + DelayCommand(HoursToSeconds(nDelay), FloatingTextStringOnCreature("You may now rest again.", oPC, FALSE)); + FloatingTextStringOnCreature("You may rest again in "+IntToString(nDelay)+" hours.", oPC, FALSE); + } + + //ebonfowl: execute reserve feat update + if(GetLocalInt(oPC, "ReserveFeatsRunning") == TRUE) + { + DelayCommand(1.5, ExecuteScript("prc_reservefeat", oPC)); + } + + // Execute scripts hooked to this event for the player triggering it + ExecuteAllScriptsHookedToEvent(oPC, EVENT_ONPLAYERREST_FINISHED); +} + +void RestStarted(object oPC) +{ + if(DEBUG) DoDebug("prc_rest: Rest started for " + DebugObject2Str(oPC)); + + // Scrying cleanup + if (GetIsScrying(oPC)) + { + object oCopy = GetLocalObject(oPC, "Scry_Copy"); + DoScryEnd(oPC, oCopy); + } + + int nRest = GetPRCSwitch(PRC_PNP_REST_LIMIT); + if(nRest > 0 || nRest < 0) + { + int nDelay = nRest * GetHitDice(oPC); + if (nRest == -1) nDelay = 24; + else if (nRest == -2) nDelay = 16; + + if(GetLocalInt(oPC, "RestTimer")) + { + AssignCommand(oPC, ClearAllActions()); + FloatingTextStringOnCreature("You may not rest yet. You may rest once every "+IntToString(nDelay)+" hours.", oPC, FALSE); + } + } + + // Clean up Crown of Might + object oCrown = GetItemPossessedBy(oPC, "prc_crown_might"); + if (GetIsObjectValid(oCrown)) DestroyObject(oCrown); + oCrown = GetItemPossessedBy(oPC, "prc_crown_prot"); + if (GetIsObjectValid(oCrown)) DestroyObject(oCrown); + + if (GetLevelByClass(CLASS_TYPE_DRUNKEN_MASTER, oPC)){ + SetLocalInt(oPC, "DRUNKEN_MASTER_IS_IN_DRUNKEN_RAGE", 0); + SetLocalInt(oPC, "DRUNKEN_MASTER_IS_DRUNK_LIKE_A_DEMON", 0); + } + /* Left here in case the multisummon trick is ever broken. In that case, use this to make Astral Constructs get unsummoned properly + if(GetHasFeat(whatever feat determines if the PC can manifest Astral Construct here)){ + int i = 1; + object oCheck = GetHenchman(oPC, i); + while(oCheck != OBJECT_INVALID){ + if(GetStringLeft(GetTag(oCheck), 14) == "psi_astral_con") + DoDespawn(oCheck); + i++; + oCheck = GetHenchman(oPC, i); + } + } + */ + + if (GetIsPC(oPC)) SetLocalInt(oPC, "PnP_Rest_InitialHP", GetCurrentHitPoints(oPC)); + SetLocalInt(oPC, "PnP_Rest_InitialMax", GetMaxHitPoints(oPC)); + if(DEBUG) DoDebug("prc_rest: HPs for " + DebugObject2Str(oPC)+"n/n/"+" nCurrent: "+IntToString(GetCurrentHitPoints(oPC))+" nMax: "+IntToString(GetMaxHitPoints(oPC))); + // Remove Psionic Focus + if(GetIsPsionicallyFocused(oPC)) + { + LosePsionicFocus(oPC); + } + DeleteLocalInt(oPC, PRC_SPELL_CHARGE_COUNT); + DeleteLocalInt(oPC, PRC_SPELL_CHARGE_SPELLID); + DeleteLocalObject(oPC, PRC_SPELL_CONC_TARGET); + if(GetLocalInt(oPC, PRC_SPELL_HOLD)) FloatingTextStringOnCreature("*Normal Casting*", oPC); + DeleteLocalInt(oPC, PRC_SPELL_HOLD); + DeleteLocalInt(oPC, PRC_SPELL_METAMAGIC); + DeleteLocalManifestation(oPC, PRC_POWER_HOLD_MANIFESTATION); + DeleteLocalMystery(oPC, "MYST_HOLD_MYST"); + // run the prereq check here + ExecuteScript("prc_prereq", oPC); + // Execute scripts hooked to this event for the player triggering it + ExecuteAllScriptsHookedToEvent(oPC, EVENT_ONPLAYERREST_STARTED); +} + +void main() +{ + object oPC = GetLastBeingRested(); + + if(DEBUG) DoDebug("prc_rest: Running for " + DebugObject2Str(oPC)); + if(DEBUG) DoDebug("prc_rest Void Main: HPs for " + DebugObject2Str(oPC) +" nCurrent: "+IntToString(GetCurrentHitPoints(oPC))); + + // return here for DMs as they don't need all this stuff + if(GetIsDM(oPC)) + return; + + //rest kits + if(GetPRCSwitch(PRC_SUPPLY_BASED_REST)) + ExecuteScript("sbr_onrest", OBJECT_SELF); + + // Handle the PRCForceRest() wrapper + if(GetLocalInt(oPC, "PRC_ForceRested")) + { + if(DEBUG) DoDebug("prc_rest: Handling forced rest"); + RestStarted(oPC); + // A minor delay to break the script association and to lessen TMI chances + DelayCommand(0.5f, RestFinished(oPC)); + // Clear the flag + DeleteLocalInt(oPC, "PRC_ForceRested"); + } + else + { + switch(MyGetLastRestEventType()){ + case REST_EVENTTYPE_REST_CANCELLED:{ + RestCancelled(oPC); + break; + } + case REST_EVENTTYPE_REST_STARTED:{ + RestStarted(oPC); + break; + } + case REST_EVENTTYPE_REST_FINISHED:{ + RestFinished(oPC); + break; + } + case REST_EVENTTYPE_REST_INVALID:{ + break; + } + } + } +}