diff --git a/_module/are/adventurers_inn.are.json b/_module/are/adventurers_inn.are.json index d041236b..75ca2deb 100644 --- a/_module/are/adventurers_inn.are.json +++ b/_module/are/adventurers_inn.are.json @@ -677,7 +677,7 @@ }, "Version": { "type": "dword", - "value": 110 + "value": 111 }, "Width": { "type": "int", diff --git a/_module/are/area056.are.json b/_module/are/area056.are.json index 82982e21..7fbf22d3 100644 --- a/_module/are/area056.are.json +++ b/_module/are/area056.are.json @@ -14,7 +14,7 @@ }, "Comments": { "type": "cexostring", - "value": "" + "value": "Level 10a: Lake of Tar" }, "Creator_ID": { "type": "int", @@ -87,7 +87,7 @@ "Name": { "type": "cexolocstring", "value": { - "0": "Level 10a, Lake of Tar" + "0": "Level 10a: Lake of Tar" } }, "NoRest": { @@ -11169,7 +11169,7 @@ }, "Version": { "type": "dword", - "value": 12 + "value": 14 }, "Width": { "type": "int", diff --git a/_module/are/ifm_pc_rooms.are.json b/_module/are/ifm_pc_rooms.are.json index c6c65fd3..42080d7f 100644 --- a/_module/are/ifm_pc_rooms.are.json +++ b/_module/are/ifm_pc_rooms.are.json @@ -333,7 +333,7 @@ }, "Version": { "type": "dword", - "value": 11 + "value": 14 }, "Width": { "type": "int", diff --git a/_module/are/inthetarlake.are.json b/_module/are/inthetarlake.are.json index da910be9..4a742ce7 100644 --- a/_module/are/inthetarlake.are.json +++ b/_module/are/inthetarlake.are.json @@ -54,7 +54,7 @@ }, "LoadScreenID": { "type": "word", - "value": 0 + "value": 24 }, "ModListenCheck": { "type": "int", @@ -11169,7 +11169,7 @@ }, "Version": { "type": "dword", - "value": 10 + "value": 12 }, "Width": { "type": "int", diff --git a/_module/gic/area056.gic.json b/_module/gic/area056.gic.json index d07e4f7a..801582ee 100644 --- a/_module/gic/area056.gic.json +++ b/_module/gic/area056.gic.json @@ -2,43 +2,7 @@ "__data_type": "GIC ", "Creature List": { "type": "list", - "value": [ - { - "__struct_id": 4, - "Comment": { - "type": "cexostring", - "value": "" - } - }, - { - "__struct_id": 4, - "Comment": { - "type": "cexostring", - "value": "" - } - }, - { - "__struct_id": 4, - "Comment": { - "type": "cexostring", - "value": "" - } - }, - { - "__struct_id": 4, - "Comment": { - "type": "cexostring", - "value": "" - } - }, - { - "__struct_id": 4, - "Comment": { - "type": "cexostring", - "value": "" - } - } - ] + "value": [] }, "Door List": { "type": "list", @@ -543,6 +507,13 @@ "value": "" } }, + { + "__struct_id": 1, + "Comment": { + "type": "cexostring", + "value": "" + } + }, { "__struct_id": 1, "Comment": { @@ -589,6 +560,13 @@ "type": "cexostring", "value": "" } + }, + { + "__struct_id": 5, + "Comment": { + "type": "cexostring", + "value": "This is the default waypoint you may place to set a patrol path for a creature or NPC.\r\n1. Create the creature and either use its current Tag or fill in a new one.\r\n2. Place or make sure the WalkWayPoints() is within the body of the On Spawn script for the creature.\r\n3. Place a series of waypoints along the route you wish the creature to walk.\r\n4. Select all of the newly created waypoints and right click. Choose the Create Set option.\r\n5. The waypoint set will have a set name of \"WP_\" + NPC Tag. Thus if an NPC with the Tag \"Guard\" will have a waypoint set called \"WP_Guard\". Note that Tags are case sensitive." + } } ] } diff --git a/_module/gic/inthetarlake.gic.json b/_module/gic/inthetarlake.gic.json index a06bf1ae..05a89c3e 100644 --- a/_module/gic/inthetarlake.gic.json +++ b/_module/gic/inthetarlake.gic.json @@ -44,7 +44,228 @@ }, "SoundList": { "type": "list", - "value": [] + "value": [ + { + "__struct_id": 6, + "Comment": { + "type": "cexostring", + "value": "" + }, + "PlayInToolset": { + "type": "byte", + "value": 1 + } + }, + { + "__struct_id": 6, + "Comment": { + "type": "cexostring", + "value": "" + }, + "PlayInToolset": { + "type": "byte", + "value": 1 + } + }, + { + "__struct_id": 6, + "Comment": { + "type": "cexostring", + "value": "" + }, + "PlayInToolset": { + "type": "byte", + "value": 1 + } + }, + { + "__struct_id": 6, + "Comment": { + "type": "cexostring", + "value": "" + }, + "PlayInToolset": { + "type": "byte", + "value": 1 + } + }, + { + "__struct_id": 6, + "Comment": { + "type": "cexostring", + "value": "" + }, + "PlayInToolset": { + "type": "byte", + "value": 1 + } + }, + { + "__struct_id": 6, + "Comment": { + "type": "cexostring", + "value": "" + }, + "PlayInToolset": { + "type": "byte", + "value": 1 + } + }, + { + "__struct_id": 6, + "Comment": { + "type": "cexostring", + "value": "" + }, + "PlayInToolset": { + "type": "byte", + "value": 1 + } + }, + { + "__struct_id": 6, + "Comment": { + "type": "cexostring", + "value": "" + }, + "PlayInToolset": { + "type": "byte", + "value": 1 + } + }, + { + "__struct_id": 6, + "Comment": { + "type": "cexostring", + "value": "" + }, + "PlayInToolset": { + "type": "byte", + "value": 1 + } + }, + { + "__struct_id": 6, + "Comment": { + "type": "cexostring", + "value": "" + }, + "PlayInToolset": { + "type": "byte", + "value": 1 + } + }, + { + "__struct_id": 6, + "Comment": { + "type": "cexostring", + "value": "" + }, + "PlayInToolset": { + "type": "byte", + "value": 1 + } + }, + { + "__struct_id": 6, + "Comment": { + "type": "cexostring", + "value": "" + }, + "PlayInToolset": { + "type": "byte", + "value": 1 + } + }, + { + "__struct_id": 6, + "Comment": { + "type": "cexostring", + "value": "" + }, + "PlayInToolset": { + "type": "byte", + "value": 1 + } + }, + { + "__struct_id": 6, + "Comment": { + "type": "cexostring", + "value": "" + }, + "PlayInToolset": { + "type": "byte", + "value": 1 + } + }, + { + "__struct_id": 6, + "Comment": { + "type": "cexostring", + "value": "" + }, + "PlayInToolset": { + "type": "byte", + "value": 1 + } + }, + { + "__struct_id": 6, + "Comment": { + "type": "cexostring", + "value": "" + }, + "PlayInToolset": { + "type": "byte", + "value": 1 + } + }, + { + "__struct_id": 6, + "Comment": { + "type": "cexostring", + "value": "" + }, + "PlayInToolset": { + "type": "byte", + "value": 1 + } + }, + { + "__struct_id": 6, + "Comment": { + "type": "cexostring", + "value": "" + }, + "PlayInToolset": { + "type": "byte", + "value": 1 + } + }, + { + "__struct_id": 6, + "Comment": { + "type": "cexostring", + "value": "" + }, + "PlayInToolset": { + "type": "byte", + "value": 1 + } + }, + { + "__struct_id": 6, + "Comment": { + "type": "cexostring", + "value": "" + }, + "PlayInToolset": { + "type": "byte", + "value": 1 + } + } + ] }, "StoreList": { "type": "list", diff --git a/_module/git/area056.git.json b/_module/git/area056.git.json index 055fcbcb..aa74fee4 100644 --- a/_module/git/area056.git.json +++ b/_module/git/area056.git.json @@ -21,6 +21,10 @@ "type": "int", "value": 108 }, + "Comment": { + "type": "cexostring", + "value": "" + }, "EnvAudio": { "type": "int", "value": 8 @@ -45,5259 +49,7 @@ }, "Creature List": { "type": "list", - "value": [ - { - "__struct_id": 4, - "Appearance_Type": { - "type": "word", - "value": 112 - }, - "BodyBag": { - "type": "byte", - "value": 0 - }, - "Cha": { - "type": "byte", - "value": 15 - }, - "ChallengeRating": { - "type": "float", - "value": 4.0 - }, - "ClassList": { - "type": "list", - "value": [ - { - "__struct_id": 2, - "Class": { - "type": "int", - "value": 24 - }, - "ClassLevel": { - "type": "short", - "value": 3 - } - } - ] - }, - "Con": { - "type": "byte", - "value": 13 - }, - "Conversation": { - "type": "resref", - "value": "" - }, - "CRAdjust": { - "type": "int", - "value": 0 - }, - "CurrentHitPoints": { - "type": "short", - "value": 13 - }, - "DecayTime": { - "type": "dword", - "value": 0 - }, - "Deity": { - "type": "cexostring", - "value": "" - }, - "Description": { - "id": 12635, - "type": "cexolocstring", - "value": { - "0": "Chaotic and destructive, Mephits come in many shapes and have a wide range of abilities. Most are drawn from the various Elemental and Quasi-Elemental Planes." - } - }, - "Dex": { - "type": "byte", - "value": 10 - }, - "Disarmable": { - "type": "byte", - "value": 0 - }, - "Equip_ItemList": { - "type": "list", - "value": [ - { - "__struct_id": 16384, - "AddCost": { - "type": "dword", - "value": 0 - }, - "BaseItem": { - "type": "int", - "value": 72 - }, - "Charges": { - "type": "byte", - "value": 0 - }, - "Cost": { - "type": "dword", - "value": 180 - }, - "Cursed": { - "type": "byte", - "value": 0 - }, - "DescIdentified": { - "type": "cexolocstring", - "value": {} - }, - "Description": { - "type": "cexolocstring", - "value": {} - }, - "Identified": { - "type": "byte", - "value": 0 - }, - "LocalizedName": { - "id": 13262, - "type": "cexolocstring", - "value": {} - }, - "ModelPart1": { - "type": "byte", - "value": 1 - }, - "Plot": { - "type": "byte", - "value": 0 - }, - "PropertiesList": { - "type": "list", - "value": [ - { - "__struct_id": 0, - "ChanceAppear": { - "type": "byte", - "value": 100 - }, - "CostTable": { - "type": "byte", - "value": 19 - }, - "CostValue": { - "type": "word", - "value": 2 - }, - "Param1": { - "type": "byte", - "value": 255 - }, - "Param1Value": { - "type": "byte", - "value": 255 - }, - "PropertyName": { - "type": "word", - "value": 77 - }, - "Subtype": { - "type": "word", - "value": 0 - } - } - ] - }, - "StackSize": { - "type": "word", - "value": 1 - }, - "Stolen": { - "type": "byte", - "value": 0 - }, - "Tag": { - "type": "cexostring", - "value": "NW_IT_CREWPSP002" - }, - "TemplateResRef": { - "type": "resref", - "value": "nw_it_crewpsp002" - }, - "xModelPart1": { - "type": "word", - "value": 1 - }, - "XOrientation": { - "type": "float", - "value": 0.0 - }, - "XPosition": { - "type": "float", - "value": -1.0 - }, - "YOrientation": { - "type": "float", - "value": 1.0 - }, - "YPosition": { - "type": "float", - "value": -1.0 - }, - "ZPosition": { - "type": "float", - "value": -1.0 - } - }, - { - "__struct_id": 32768, - "AddCost": { - "type": "dword", - "value": 0 - }, - "BaseItem": { - "type": "int", - "value": 72 - }, - "Charges": { - "type": "byte", - "value": 0 - }, - "Cost": { - "type": "dword", - "value": 180 - }, - "Cursed": { - "type": "byte", - "value": 0 - }, - "DescIdentified": { - "type": "cexolocstring", - "value": {} - }, - "Description": { - "type": "cexolocstring", - "value": {} - }, - "Identified": { - "type": "byte", - "value": 0 - }, - "LocalizedName": { - "id": 13262, - "type": "cexolocstring", - "value": {} - }, - "ModelPart1": { - "type": "byte", - "value": 1 - }, - "Plot": { - "type": "byte", - "value": 0 - }, - "PropertiesList": { - "type": "list", - "value": [ - { - "__struct_id": 0, - "ChanceAppear": { - "type": "byte", - "value": 100 - }, - "CostTable": { - "type": "byte", - "value": 19 - }, - "CostValue": { - "type": "word", - "value": 2 - }, - "Param1": { - "type": "byte", - "value": 255 - }, - "Param1Value": { - "type": "byte", - "value": 255 - }, - "PropertyName": { - "type": "word", - "value": 77 - }, - "Subtype": { - "type": "word", - "value": 0 - } - } - ] - }, - "StackSize": { - "type": "word", - "value": 1 - }, - "Stolen": { - "type": "byte", - "value": 0 - }, - "Tag": { - "type": "cexostring", - "value": "NW_IT_CREWPSP002" - }, - "TemplateResRef": { - "type": "resref", - "value": "nw_it_crewpsp002" - }, - "xModelPart1": { - "type": "word", - "value": 1 - }, - "XOrientation": { - "type": "float", - "value": 0.0 - }, - "XPosition": { - "type": "float", - "value": -1.0 - }, - "YOrientation": { - "type": "float", - "value": 1.0 - }, - "YPosition": { - "type": "float", - "value": -1.0 - }, - "ZPosition": { - "type": "float", - "value": -1.0 - } - }, - { - "__struct_id": 131072, - "AddCost": { - "type": "dword", - "value": 0 - }, - "BaseItem": { - "type": "int", - "value": 73 - }, - "Charges": { - "type": "byte", - "value": 0 - }, - "Cost": { - "type": "dword", - "value": 0 - }, - "Cursed": { - "type": "byte", - "value": 0 - }, - "DescIdentified": { - "type": "cexolocstring", - "value": {} - }, - "Description": { - "type": "cexolocstring", - "value": {} - }, - "Identified": { - "type": "byte", - "value": 0 - }, - "LocalizedName": { - "id": 13079, - "type": "cexolocstring", - "value": {} - }, - "ModelPart1": { - "type": "byte", - "value": 1 - }, - "Plot": { - "type": "byte", - "value": 0 - }, - "PropertiesList": { - "type": "list", - "value": [ - { - "__struct_id": 0, - "ChanceAppear": { - "type": "byte", - "value": 100 - }, - "CostTable": { - "type": "byte", - "value": 6 - }, - "CostValue": { - "type": "word", - "value": 1 - }, - "Param1": { - "type": "byte", - "value": 255 - }, - "Param1Value": { - "type": "byte", - "value": 255 - }, - "PropertyName": { - "type": "word", - "value": 22 - }, - "Subtype": { - "type": "word", - "value": 0 - } - }, - { - "__struct_id": 0, - "ChanceAppear": { - "type": "byte", - "value": 100 - }, - "CostTable": { - "type": "byte", - "value": 2 - }, - "CostValue": { - "type": "word", - "value": 2 - }, - "Param1": { - "type": "byte", - "value": 255 - }, - "Param1Value": { - "type": "byte", - "value": 255 - }, - "PropertyName": { - "type": "word", - "value": 51 - }, - "Subtype": { - "type": "word", - "value": 0 - } - } - ] - }, - "StackSize": { - "type": "word", - "value": 1 - }, - "Stolen": { - "type": "byte", - "value": 0 - }, - "Tag": { - "type": "cexostring", - "value": "NW_IT_CREITEM031" - }, - "TemplateResRef": { - "type": "resref", - "value": "nw_it_creitem031" - }, - "xModelPart1": { - "type": "word", - "value": 1 - }, - "XOrientation": { - "type": "float", - "value": 0.0 - }, - "XPosition": { - "type": "float", - "value": -1.0 - }, - "YOrientation": { - "type": "float", - "value": 1.0 - }, - "YPosition": { - "type": "float", - "value": -1.0 - }, - "ZPosition": { - "type": "float", - "value": -1.0 - } - } - ] - }, - "FactionID": { - "type": "word", - "value": 1 - }, - "FeatList": { - "type": "list", - "value": [ - { - "__struct_id": 1, - "Feat": { - "type": "word", - "value": 228 - } - }, - { - "__struct_id": 1, - "Feat": { - "type": "word", - "value": 28 - } - }, - { - "__struct_id": 1, - "Feat": { - "type": "word", - "value": 289 - } - } - ] - }, - "FirstName": { - "id": 12640, - "type": "cexolocstring", - "value": { - "0": "Tar Mephit" - } - }, - "fortbonus": { - "type": "short", - "value": 0 - }, - "Gender": { - "type": "byte", - "value": 0 - }, - "GoodEvil": { - "type": "byte", - "value": 0 - }, - "HitPoints": { - "type": "short", - "value": 13 - }, - "Int": { - "type": "byte", - "value": 12 - }, - "Interruptable": { - "type": "byte", - "value": 1 - }, - "IsImmortal": { - "type": "byte", - "value": 0 - }, - "IsPC": { - "type": "byte", - "value": 0 - }, - "LastName": { - "type": "cexolocstring", - "value": {} - }, - "LawfulChaotic": { - "type": "byte", - "value": 50 - }, - "Lootable": { - "type": "byte", - "value": 0 - }, - "MaxHitPoints": { - "type": "short", - "value": 16 - }, - "NaturalAC": { - "type": "byte", - "value": 5 - }, - "NoPermDeath": { - "type": "byte", - "value": 0 - }, - "PerceptionRange": { - "type": "byte", - "value": 11 - }, - "Phenotype": { - "type": "int", - "value": 0 - }, - "Plot": { - "type": "byte", - "value": 0 - }, - "PortraitId": { - "type": "word", - "value": 249 - }, - "Race": { - "type": "byte", - "value": 20 - }, - "refbonus": { - "type": "short", - "value": 0 - }, - "ScriptAttacked": { - "type": "resref", - "value": "nw_c2_default5" - }, - "ScriptDamaged": { - "type": "resref", - "value": "nw_c2_default6" - }, - "ScriptDeath": { - "type": "resref", - "value": "nw_c2_default7" - }, - "ScriptDialogue": { - "type": "resref", - "value": "nw_c2_default4" - }, - "ScriptDisturbed": { - "type": "resref", - "value": "nw_c2_default8" - }, - "ScriptEndRound": { - "type": "resref", - "value": "nw_c2_default3" - }, - "ScriptHeartbeat": { - "type": "resref", - "value": "nw_c2_default1" - }, - "ScriptOnBlocked": { - "type": "resref", - "value": "nw_c2_defaulte" - }, - "ScriptOnNotice": { - "type": "resref", - "value": "nw_c2_default2" - }, - "ScriptRested": { - "type": "resref", - "value": "nw_c2_defaulta" - }, - "ScriptSpawn": { - "type": "resref", - "value": "nw_c2_dropin9" - }, - "ScriptSpellAt": { - "type": "resref", - "value": "nw_c2_defaultb" - }, - "ScriptUserDefine": { - "type": "resref", - "value": "nw_c2_defaultd" - }, - "SkillList": { - "type": "list", - "value": [ - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Comment": { - "type": "cexostring", - "value": "" - }, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Comment": { - "type": "cexostring", - "value": "" - }, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Comment": { - "type": "cexostring", - "value": "" - }, - "Rank": { - "type": "byte", - "value": 9 - } - }, - { - "__struct_id": 0, - "Comment": { - "type": "cexostring", - "value": "" - }, - "Rank": { - "type": "byte", - "value": 6 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 6 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 6 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - } - ] - }, - "SoundSetFile": { - "type": "word", - "value": 63 - }, - "SpecAbilityList": { - "type": "list", - "value": [ - { - "__struct_id": 4, - "Spell": { - "type": "word", - "value": 229 - }, - "SpellCasterLevel": { - "type": "byte", - "value": 1 - }, - "SpellFlags": { - "type": "byte", - "value": 1 - } - }, - { - "__struct_id": 4, - "Spell": { - "type": "word", - "value": 115 - }, - "SpellCasterLevel": { - "type": "byte", - "value": 3 - }, - "SpellFlags": { - "type": "byte", - "value": 1 - } - }, - { - "__struct_id": 4, - "Spell": { - "type": "word", - "value": 171 - }, - "SpellCasterLevel": { - "type": "byte", - "value": 6 - }, - "SpellFlags": { - "type": "byte", - "value": 1 - } - } - ] - }, - "StartingPackage": { - "type": "byte", - "value": 0 - }, - "Str": { - "type": "byte", - "value": 14 - }, - "Subrace": { - "type": "cexostring", - "value": "" - }, - "Tag": { - "type": "cexostring", - "value": "NW_MEPOOZE2" - }, - "Tail_New": { - "type": "dword", - "value": 0 - }, - "TemplateList": { - "type": "list", - "value": [] - }, - "TemplateResRef": { - "type": "resref", - "value": "mepooze001" - }, - "WalkRate": { - "type": "int", - "value": 7 - }, - "willbonus": { - "type": "short", - "value": 0 - }, - "Wings_New": { - "type": "dword", - "value": 0 - }, - "Wis": { - "type": "byte", - "value": 11 - }, - "XOrientation": { - "type": "float", - "value": 0.0 - }, - "XPosition": { - "type": "float", - "value": 96.51458740234375 - }, - "YOrientation": { - "type": "float", - "value": 1.0 - }, - "YPosition": { - "type": "float", - "value": 128.6723175048828 - }, - "ZPosition": { - "type": "float", - "value": 1.0 - } - }, - { - "__struct_id": 4, - "Appearance_Type": { - "type": "word", - "value": 112 - }, - "BodyBag": { - "type": "byte", - "value": 0 - }, - "Cha": { - "type": "byte", - "value": 15 - }, - "ChallengeRating": { - "type": "float", - "value": 4.0 - }, - "ClassList": { - "type": "list", - "value": [ - { - "__struct_id": 2, - "Class": { - "type": "int", - "value": 24 - }, - "ClassLevel": { - "type": "short", - "value": 3 - } - } - ] - }, - "Con": { - "type": "byte", - "value": 13 - }, - "Conversation": { - "type": "resref", - "value": "" - }, - "CRAdjust": { - "type": "int", - "value": 0 - }, - "CurrentHitPoints": { - "type": "short", - "value": 13 - }, - "DecayTime": { - "type": "dword", - "value": 0 - }, - "Deity": { - "type": "cexostring", - "value": "" - }, - "Description": { - "id": 12635, - "type": "cexolocstring", - "value": { - "0": "Chaotic and destructive, Mephits come in many shapes and have a wide range of abilities. Most are drawn from the various Elemental and Quasi-Elemental Planes." - } - }, - "Dex": { - "type": "byte", - "value": 10 - }, - "Disarmable": { - "type": "byte", - "value": 0 - }, - "Equip_ItemList": { - "type": "list", - "value": [ - { - "__struct_id": 16384, - "AddCost": { - "type": "dword", - "value": 0 - }, - "BaseItem": { - "type": "int", - "value": 72 - }, - "Charges": { - "type": "byte", - "value": 0 - }, - "Cost": { - "type": "dword", - "value": 180 - }, - "Cursed": { - "type": "byte", - "value": 0 - }, - "DescIdentified": { - "type": "cexolocstring", - "value": {} - }, - "Description": { - "type": "cexolocstring", - "value": {} - }, - "Identified": { - "type": "byte", - "value": 0 - }, - "LocalizedName": { - "id": 13262, - "type": "cexolocstring", - "value": {} - }, - "ModelPart1": { - "type": "byte", - "value": 1 - }, - "Plot": { - "type": "byte", - "value": 0 - }, - "PropertiesList": { - "type": "list", - "value": [ - { - "__struct_id": 0, - "ChanceAppear": { - "type": "byte", - "value": 100 - }, - "CostTable": { - "type": "byte", - "value": 19 - }, - "CostValue": { - "type": "word", - "value": 2 - }, - "Param1": { - "type": "byte", - "value": 255 - }, - "Param1Value": { - "type": "byte", - "value": 255 - }, - "PropertyName": { - "type": "word", - "value": 77 - }, - "Subtype": { - "type": "word", - "value": 0 - } - } - ] - }, - "StackSize": { - "type": "word", - "value": 1 - }, - "Stolen": { - "type": "byte", - "value": 0 - }, - "Tag": { - "type": "cexostring", - "value": "NW_IT_CREWPSP002" - }, - "TemplateResRef": { - "type": "resref", - "value": "nw_it_crewpsp002" - }, - "xModelPart1": { - "type": "word", - "value": 1 - }, - "XOrientation": { - "type": "float", - "value": 0.0 - }, - "XPosition": { - "type": "float", - "value": -1.0 - }, - "YOrientation": { - "type": "float", - "value": 1.0 - }, - "YPosition": { - "type": "float", - "value": -1.0 - }, - "ZPosition": { - "type": "float", - "value": -1.0 - } - }, - { - "__struct_id": 32768, - "AddCost": { - "type": "dword", - "value": 0 - }, - "BaseItem": { - "type": "int", - "value": 72 - }, - "Charges": { - "type": "byte", - "value": 0 - }, - "Cost": { - "type": "dword", - "value": 180 - }, - "Cursed": { - "type": "byte", - "value": 0 - }, - "DescIdentified": { - "type": "cexolocstring", - "value": {} - }, - "Description": { - "type": "cexolocstring", - "value": {} - }, - "Identified": { - "type": "byte", - "value": 0 - }, - "LocalizedName": { - "id": 13262, - "type": "cexolocstring", - "value": {} - }, - "ModelPart1": { - "type": "byte", - "value": 1 - }, - "Plot": { - "type": "byte", - "value": 0 - }, - "PropertiesList": { - "type": "list", - "value": [ - { - "__struct_id": 0, - "ChanceAppear": { - "type": "byte", - "value": 100 - }, - "CostTable": { - "type": "byte", - "value": 19 - }, - "CostValue": { - "type": "word", - "value": 2 - }, - "Param1": { - "type": "byte", - "value": 255 - }, - "Param1Value": { - "type": "byte", - "value": 255 - }, - "PropertyName": { - "type": "word", - "value": 77 - }, - "Subtype": { - "type": "word", - "value": 0 - } - } - ] - }, - "StackSize": { - "type": "word", - "value": 1 - }, - "Stolen": { - "type": "byte", - "value": 0 - }, - "Tag": { - "type": "cexostring", - "value": "NW_IT_CREWPSP002" - }, - "TemplateResRef": { - "type": "resref", - "value": "nw_it_crewpsp002" - }, - "xModelPart1": { - "type": "word", - "value": 1 - }, - "XOrientation": { - "type": "float", - "value": 0.0 - }, - "XPosition": { - "type": "float", - "value": -1.0 - }, - "YOrientation": { - "type": "float", - "value": 1.0 - }, - "YPosition": { - "type": "float", - "value": -1.0 - }, - "ZPosition": { - "type": "float", - "value": -1.0 - } - }, - { - "__struct_id": 131072, - "AddCost": { - "type": "dword", - "value": 0 - }, - "BaseItem": { - "type": "int", - "value": 73 - }, - "Charges": { - "type": "byte", - "value": 0 - }, - "Cost": { - "type": "dword", - "value": 0 - }, - "Cursed": { - "type": "byte", - "value": 0 - }, - "DescIdentified": { - "type": "cexolocstring", - "value": {} - }, - "Description": { - "type": "cexolocstring", - "value": {} - }, - "Identified": { - "type": "byte", - "value": 0 - }, - "LocalizedName": { - "id": 13079, - "type": "cexolocstring", - "value": {} - }, - "ModelPart1": { - "type": "byte", - "value": 1 - }, - "Plot": { - "type": "byte", - "value": 0 - }, - "PropertiesList": { - "type": "list", - "value": [ - { - "__struct_id": 0, - "ChanceAppear": { - "type": "byte", - "value": 100 - }, - "CostTable": { - "type": "byte", - "value": 6 - }, - "CostValue": { - "type": "word", - "value": 1 - }, - "Param1": { - "type": "byte", - "value": 255 - }, - "Param1Value": { - "type": "byte", - "value": 255 - }, - "PropertyName": { - "type": "word", - "value": 22 - }, - "Subtype": { - "type": "word", - "value": 0 - } - }, - { - "__struct_id": 0, - "ChanceAppear": { - "type": "byte", - "value": 100 - }, - "CostTable": { - "type": "byte", - "value": 2 - }, - "CostValue": { - "type": "word", - "value": 2 - }, - "Param1": { - "type": "byte", - "value": 255 - }, - "Param1Value": { - "type": "byte", - "value": 255 - }, - "PropertyName": { - "type": "word", - "value": 51 - }, - "Subtype": { - "type": "word", - "value": 0 - } - } - ] - }, - "StackSize": { - "type": "word", - "value": 1 - }, - "Stolen": { - "type": "byte", - "value": 0 - }, - "Tag": { - "type": "cexostring", - "value": "NW_IT_CREITEM031" - }, - "TemplateResRef": { - "type": "resref", - "value": "nw_it_creitem031" - }, - "xModelPart1": { - "type": "word", - "value": 1 - }, - "XOrientation": { - "type": "float", - "value": 0.0 - }, - "XPosition": { - "type": "float", - "value": -1.0 - }, - "YOrientation": { - "type": "float", - "value": 1.0 - }, - "YPosition": { - "type": "float", - "value": -1.0 - }, - "ZPosition": { - "type": "float", - "value": -1.0 - } - } - ] - }, - "FactionID": { - "type": "word", - "value": 1 - }, - "FeatList": { - "type": "list", - "value": [ - { - "__struct_id": 1, - "Feat": { - "type": "word", - "value": 228 - } - }, - { - "__struct_id": 1, - "Feat": { - "type": "word", - "value": 28 - } - }, - { - "__struct_id": 1, - "Feat": { - "type": "word", - "value": 289 - } - } - ] - }, - "FirstName": { - "id": 12640, - "type": "cexolocstring", - "value": { - "0": "Tar Mephit" - } - }, - "fortbonus": { - "type": "short", - "value": 0 - }, - "Gender": { - "type": "byte", - "value": 0 - }, - "GoodEvil": { - "type": "byte", - "value": 0 - }, - "HitPoints": { - "type": "short", - "value": 13 - }, - "Int": { - "type": "byte", - "value": 12 - }, - "Interruptable": { - "type": "byte", - "value": 1 - }, - "IsImmortal": { - "type": "byte", - "value": 0 - }, - "IsPC": { - "type": "byte", - "value": 0 - }, - "LastName": { - "type": "cexolocstring", - "value": {} - }, - "LawfulChaotic": { - "type": "byte", - "value": 50 - }, - "Lootable": { - "type": "byte", - "value": 0 - }, - "MaxHitPoints": { - "type": "short", - "value": 16 - }, - "NaturalAC": { - "type": "byte", - "value": 5 - }, - "NoPermDeath": { - "type": "byte", - "value": 0 - }, - "PerceptionRange": { - "type": "byte", - "value": 11 - }, - "Phenotype": { - "type": "int", - "value": 0 - }, - "Plot": { - "type": "byte", - "value": 0 - }, - "PortraitId": { - "type": "word", - "value": 249 - }, - "Race": { - "type": "byte", - "value": 20 - }, - "refbonus": { - "type": "short", - "value": 0 - }, - "ScriptAttacked": { - "type": "resref", - "value": "nw_c2_default5" - }, - "ScriptDamaged": { - "type": "resref", - "value": "nw_c2_default6" - }, - "ScriptDeath": { - "type": "resref", - "value": "nw_c2_default7" - }, - "ScriptDialogue": { - "type": "resref", - "value": "nw_c2_default4" - }, - "ScriptDisturbed": { - "type": "resref", - "value": "nw_c2_default8" - }, - "ScriptEndRound": { - "type": "resref", - "value": "nw_c2_default3" - }, - "ScriptHeartbeat": { - "type": "resref", - "value": "nw_c2_default1" - }, - "ScriptOnBlocked": { - "type": "resref", - "value": "nw_c2_defaulte" - }, - "ScriptOnNotice": { - "type": "resref", - "value": "nw_c2_default2" - }, - "ScriptRested": { - "type": "resref", - "value": "nw_c2_defaulta" - }, - "ScriptSpawn": { - "type": "resref", - "value": "nw_c2_dropin9" - }, - "ScriptSpellAt": { - "type": "resref", - "value": "nw_c2_defaultb" - }, - "ScriptUserDefine": { - "type": "resref", - "value": "nw_c2_defaultd" - }, - "SkillList": { - "type": "list", - "value": [ - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 9 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 6 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 6 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 6 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - } - ] - }, - "SoundSetFile": { - "type": "word", - "value": 63 - }, - "SpecAbilityList": { - "type": "list", - "value": [ - { - "__struct_id": 4, - "Spell": { - "type": "word", - "value": 229 - }, - "SpellCasterLevel": { - "type": "byte", - "value": 1 - }, - "SpellFlags": { - "type": "byte", - "value": 1 - } - }, - { - "__struct_id": 4, - "Spell": { - "type": "word", - "value": 115 - }, - "SpellCasterLevel": { - "type": "byte", - "value": 3 - }, - "SpellFlags": { - "type": "byte", - "value": 1 - } - }, - { - "__struct_id": 4, - "Spell": { - "type": "word", - "value": 171 - }, - "SpellCasterLevel": { - "type": "byte", - "value": 6 - }, - "SpellFlags": { - "type": "byte", - "value": 1 - } - } - ] - }, - "StartingPackage": { - "type": "byte", - "value": 0 - }, - "Str": { - "type": "byte", - "value": 14 - }, - "Subrace": { - "type": "cexostring", - "value": "" - }, - "Tag": { - "type": "cexostring", - "value": "NW_MEPOOZE2" - }, - "Tail_New": { - "type": "dword", - "value": 0 - }, - "TemplateList": { - "type": "list", - "value": [] - }, - "TemplateResRef": { - "type": "resref", - "value": "mepooze001" - }, - "WalkRate": { - "type": "int", - "value": 7 - }, - "willbonus": { - "type": "short", - "value": 0 - }, - "Wings_New": { - "type": "dword", - "value": 0 - }, - "Wis": { - "type": "byte", - "value": 11 - }, - "XOrientation": { - "type": "float", - "value": 0.0 - }, - "XPosition": { - "type": "float", - "value": 90.92715454101563 - }, - "YOrientation": { - "type": "float", - "value": 1.0 - }, - "YPosition": { - "type": "float", - "value": 128.5200042724609 - }, - "ZPosition": { - "type": "float", - "value": 0.9999999403953552 - } - }, - { - "__struct_id": 4, - "Appearance_Type": { - "type": "word", - "value": 112 - }, - "BodyBag": { - "type": "byte", - "value": 0 - }, - "Cha": { - "type": "byte", - "value": 15 - }, - "ChallengeRating": { - "type": "float", - "value": 4.0 - }, - "ClassList": { - "type": "list", - "value": [ - { - "__struct_id": 2, - "Class": { - "type": "int", - "value": 24 - }, - "ClassLevel": { - "type": "short", - "value": 3 - } - } - ] - }, - "Con": { - "type": "byte", - "value": 13 - }, - "Conversation": { - "type": "resref", - "value": "" - }, - "CRAdjust": { - "type": "int", - "value": 0 - }, - "CurrentHitPoints": { - "type": "short", - "value": 13 - }, - "DecayTime": { - "type": "dword", - "value": 0 - }, - "Deity": { - "type": "cexostring", - "value": "" - }, - "Description": { - "id": 12635, - "type": "cexolocstring", - "value": { - "0": "Chaotic and destructive, Mephits come in many shapes and have a wide range of abilities. Most are drawn from the various Elemental and Quasi-Elemental Planes." - } - }, - "Dex": { - "type": "byte", - "value": 10 - }, - "Disarmable": { - "type": "byte", - "value": 0 - }, - "Equip_ItemList": { - "type": "list", - "value": [ - { - "__struct_id": 16384, - "AddCost": { - "type": "dword", - "value": 0 - }, - "BaseItem": { - "type": "int", - "value": 72 - }, - "Charges": { - "type": "byte", - "value": 0 - }, - "Cost": { - "type": "dword", - "value": 180 - }, - "Cursed": { - "type": "byte", - "value": 0 - }, - "DescIdentified": { - "type": "cexolocstring", - "value": {} - }, - "Description": { - "type": "cexolocstring", - "value": {} - }, - "Identified": { - "type": "byte", - "value": 0 - }, - "LocalizedName": { - "id": 13262, - "type": "cexolocstring", - "value": {} - }, - "ModelPart1": { - "type": "byte", - "value": 1 - }, - "Plot": { - "type": "byte", - "value": 0 - }, - "PropertiesList": { - "type": "list", - "value": [ - { - "__struct_id": 0, - "ChanceAppear": { - "type": "byte", - "value": 100 - }, - "CostTable": { - "type": "byte", - "value": 19 - }, - "CostValue": { - "type": "word", - "value": 2 - }, - "Param1": { - "type": "byte", - "value": 255 - }, - "Param1Value": { - "type": "byte", - "value": 255 - }, - "PropertyName": { - "type": "word", - "value": 77 - }, - "Subtype": { - "type": "word", - "value": 0 - } - } - ] - }, - "StackSize": { - "type": "word", - "value": 1 - }, - "Stolen": { - "type": "byte", - "value": 0 - }, - "Tag": { - "type": "cexostring", - "value": "NW_IT_CREWPSP002" - }, - "TemplateResRef": { - "type": "resref", - "value": "nw_it_crewpsp002" - }, - "xModelPart1": { - "type": "word", - "value": 1 - }, - "XOrientation": { - "type": "float", - "value": 0.0 - }, - "XPosition": { - "type": "float", - "value": -1.0 - }, - "YOrientation": { - "type": "float", - "value": 1.0 - }, - "YPosition": { - "type": "float", - "value": -1.0 - }, - "ZPosition": { - "type": "float", - "value": -1.0 - } - }, - { - "__struct_id": 32768, - "AddCost": { - "type": "dword", - "value": 0 - }, - "BaseItem": { - "type": "int", - "value": 72 - }, - "Charges": { - "type": "byte", - "value": 0 - }, - "Cost": { - "type": "dword", - "value": 180 - }, - "Cursed": { - "type": "byte", - "value": 0 - }, - "DescIdentified": { - "type": "cexolocstring", - "value": {} - }, - "Description": { - "type": "cexolocstring", - "value": {} - }, - "Identified": { - "type": "byte", - "value": 0 - }, - "LocalizedName": { - "id": 13262, - "type": "cexolocstring", - "value": {} - }, - "ModelPart1": { - "type": "byte", - "value": 1 - }, - "Plot": { - "type": "byte", - "value": 0 - }, - "PropertiesList": { - "type": "list", - "value": [ - { - "__struct_id": 0, - "ChanceAppear": { - "type": "byte", - "value": 100 - }, - "CostTable": { - "type": "byte", - "value": 19 - }, - "CostValue": { - "type": "word", - "value": 2 - }, - "Param1": { - "type": "byte", - "value": 255 - }, - "Param1Value": { - "type": "byte", - "value": 255 - }, - "PropertyName": { - "type": "word", - "value": 77 - }, - "Subtype": { - "type": "word", - "value": 0 - } - } - ] - }, - "StackSize": { - "type": "word", - "value": 1 - }, - "Stolen": { - "type": "byte", - "value": 0 - }, - "Tag": { - "type": "cexostring", - "value": "NW_IT_CREWPSP002" - }, - "TemplateResRef": { - "type": "resref", - "value": "nw_it_crewpsp002" - }, - "xModelPart1": { - "type": "word", - "value": 1 - }, - "XOrientation": { - "type": "float", - "value": 0.0 - }, - "XPosition": { - "type": "float", - "value": -1.0 - }, - "YOrientation": { - "type": "float", - "value": 1.0 - }, - "YPosition": { - "type": "float", - "value": -1.0 - }, - "ZPosition": { - "type": "float", - "value": -1.0 - } - }, - { - "__struct_id": 131072, - "AddCost": { - "type": "dword", - "value": 0 - }, - "BaseItem": { - "type": "int", - "value": 73 - }, - "Charges": { - "type": "byte", - "value": 0 - }, - "Cost": { - "type": "dword", - "value": 0 - }, - "Cursed": { - "type": "byte", - "value": 0 - }, - "DescIdentified": { - "type": "cexolocstring", - "value": {} - }, - "Description": { - "type": "cexolocstring", - "value": {} - }, - "Identified": { - "type": "byte", - "value": 0 - }, - "LocalizedName": { - "id": 13079, - "type": "cexolocstring", - "value": {} - }, - "ModelPart1": { - "type": "byte", - "value": 1 - }, - "Plot": { - "type": "byte", - "value": 0 - }, - "PropertiesList": { - "type": "list", - "value": [ - { - "__struct_id": 0, - "ChanceAppear": { - "type": "byte", - "value": 100 - }, - "CostTable": { - "type": "byte", - "value": 6 - }, - "CostValue": { - "type": "word", - "value": 1 - }, - "Param1": { - "type": "byte", - "value": 255 - }, - "Param1Value": { - "type": "byte", - "value": 255 - }, - "PropertyName": { - "type": "word", - "value": 22 - }, - "Subtype": { - "type": "word", - "value": 0 - } - }, - { - "__struct_id": 0, - "ChanceAppear": { - "type": "byte", - "value": 100 - }, - "CostTable": { - "type": "byte", - "value": 2 - }, - "CostValue": { - "type": "word", - "value": 2 - }, - "Param1": { - "type": "byte", - "value": 255 - }, - "Param1Value": { - "type": "byte", - "value": 255 - }, - "PropertyName": { - "type": "word", - "value": 51 - }, - "Subtype": { - "type": "word", - "value": 0 - } - } - ] - }, - "StackSize": { - "type": "word", - "value": 1 - }, - "Stolen": { - "type": "byte", - "value": 0 - }, - "Tag": { - "type": "cexostring", - "value": "NW_IT_CREITEM031" - }, - "TemplateResRef": { - "type": "resref", - "value": "nw_it_creitem031" - }, - "xModelPart1": { - "type": "word", - "value": 1 - }, - "XOrientation": { - "type": "float", - "value": 0.0 - }, - "XPosition": { - "type": "float", - "value": -1.0 - }, - "YOrientation": { - "type": "float", - "value": 1.0 - }, - "YPosition": { - "type": "float", - "value": -1.0 - }, - "ZPosition": { - "type": "float", - "value": -1.0 - } - } - ] - }, - "FactionID": { - "type": "word", - "value": 1 - }, - "FeatList": { - "type": "list", - "value": [ - { - "__struct_id": 1, - "Feat": { - "type": "word", - "value": 228 - } - }, - { - "__struct_id": 1, - "Feat": { - "type": "word", - "value": 28 - } - }, - { - "__struct_id": 1, - "Feat": { - "type": "word", - "value": 289 - } - } - ] - }, - "FirstName": { - "id": 12640, - "type": "cexolocstring", - "value": { - "0": "Tar Mephit" - } - }, - "fortbonus": { - "type": "short", - "value": 0 - }, - "Gender": { - "type": "byte", - "value": 0 - }, - "GoodEvil": { - "type": "byte", - "value": 0 - }, - "HitPoints": { - "type": "short", - "value": 13 - }, - "Int": { - "type": "byte", - "value": 12 - }, - "Interruptable": { - "type": "byte", - "value": 1 - }, - "IsImmortal": { - "type": "byte", - "value": 0 - }, - "IsPC": { - "type": "byte", - "value": 0 - }, - "LastName": { - "type": "cexolocstring", - "value": {} - }, - "LawfulChaotic": { - "type": "byte", - "value": 50 - }, - "Lootable": { - "type": "byte", - "value": 0 - }, - "MaxHitPoints": { - "type": "short", - "value": 16 - }, - "NaturalAC": { - "type": "byte", - "value": 5 - }, - "NoPermDeath": { - "type": "byte", - "value": 0 - }, - "PerceptionRange": { - "type": "byte", - "value": 11 - }, - "Phenotype": { - "type": "int", - "value": 0 - }, - "Plot": { - "type": "byte", - "value": 0 - }, - "PortraitId": { - "type": "word", - "value": 249 - }, - "Race": { - "type": "byte", - "value": 20 - }, - "refbonus": { - "type": "short", - "value": 0 - }, - "ScriptAttacked": { - "type": "resref", - "value": "nw_c2_default5" - }, - "ScriptDamaged": { - "type": "resref", - "value": "nw_c2_default6" - }, - "ScriptDeath": { - "type": "resref", - "value": "nw_c2_default7" - }, - "ScriptDialogue": { - "type": "resref", - "value": "nw_c2_default4" - }, - "ScriptDisturbed": { - "type": "resref", - "value": "nw_c2_default8" - }, - "ScriptEndRound": { - "type": "resref", - "value": "nw_c2_default3" - }, - "ScriptHeartbeat": { - "type": "resref", - "value": "nw_c2_default1" - }, - "ScriptOnBlocked": { - "type": "resref", - "value": "nw_c2_defaulte" - }, - "ScriptOnNotice": { - "type": "resref", - "value": "nw_c2_default2" - }, - "ScriptRested": { - "type": "resref", - "value": "nw_c2_defaulta" - }, - "ScriptSpawn": { - "type": "resref", - "value": "nw_c2_dropin9" - }, - "ScriptSpellAt": { - "type": "resref", - "value": "nw_c2_defaultb" - }, - "ScriptUserDefine": { - "type": "resref", - "value": "nw_c2_defaultd" - }, - "SkillList": { - "type": "list", - "value": [ - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 9 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 6 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 6 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 6 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - } - ] - }, - "SoundSetFile": { - "type": "word", - "value": 63 - }, - "SpecAbilityList": { - "type": "list", - "value": [ - { - "__struct_id": 4, - "Spell": { - "type": "word", - "value": 229 - }, - "SpellCasterLevel": { - "type": "byte", - "value": 1 - }, - "SpellFlags": { - "type": "byte", - "value": 1 - } - }, - { - "__struct_id": 4, - "Spell": { - "type": "word", - "value": 115 - }, - "SpellCasterLevel": { - "type": "byte", - "value": 3 - }, - "SpellFlags": { - "type": "byte", - "value": 1 - } - }, - { - "__struct_id": 4, - "Spell": { - "type": "word", - "value": 171 - }, - "SpellCasterLevel": { - "type": "byte", - "value": 6 - }, - "SpellFlags": { - "type": "byte", - "value": 1 - } - } - ] - }, - "StartingPackage": { - "type": "byte", - "value": 0 - }, - "Str": { - "type": "byte", - "value": 14 - }, - "Subrace": { - "type": "cexostring", - "value": "" - }, - "Tag": { - "type": "cexostring", - "value": "NW_MEPOOZE2" - }, - "Tail_New": { - "type": "dword", - "value": 0 - }, - "TemplateList": { - "type": "list", - "value": [] - }, - "TemplateResRef": { - "type": "resref", - "value": "mepooze001" - }, - "WalkRate": { - "type": "int", - "value": 7 - }, - "willbonus": { - "type": "short", - "value": 0 - }, - "Wings_New": { - "type": "dword", - "value": 0 - }, - "Wis": { - "type": "byte", - "value": 11 - }, - "XOrientation": { - "type": "float", - "value": 0.0 - }, - "XPosition": { - "type": "float", - "value": 99.4249267578125 - }, - "YOrientation": { - "type": "float", - "value": 1.0 - }, - "YPosition": { - "type": "float", - "value": 129.8290252685547 - }, - "ZPosition": { - "type": "float", - "value": 1.0 - } - }, - { - "__struct_id": 4, - "Appearance_Type": { - "type": "word", - "value": 112 - }, - "BodyBag": { - "type": "byte", - "value": 0 - }, - "Cha": { - "type": "byte", - "value": 15 - }, - "ChallengeRating": { - "type": "float", - "value": 4.0 - }, - "ClassList": { - "type": "list", - "value": [ - { - "__struct_id": 2, - "Class": { - "type": "int", - "value": 24 - }, - "ClassLevel": { - "type": "short", - "value": 3 - } - } - ] - }, - "Con": { - "type": "byte", - "value": 13 - }, - "Conversation": { - "type": "resref", - "value": "" - }, - "CRAdjust": { - "type": "int", - "value": 0 - }, - "CurrentHitPoints": { - "type": "short", - "value": 13 - }, - "DecayTime": { - "type": "dword", - "value": 0 - }, - "Deity": { - "type": "cexostring", - "value": "" - }, - "Description": { - "id": 12635, - "type": "cexolocstring", - "value": { - "0": "Chaotic and destructive, Mephits come in many shapes and have a wide range of abilities. Most are drawn from the various Elemental and Quasi-Elemental Planes." - } - }, - "Dex": { - "type": "byte", - "value": 10 - }, - "Disarmable": { - "type": "byte", - "value": 0 - }, - "Equip_ItemList": { - "type": "list", - "value": [ - { - "__struct_id": 16384, - "AddCost": { - "type": "dword", - "value": 0 - }, - "BaseItem": { - "type": "int", - "value": 72 - }, - "Charges": { - "type": "byte", - "value": 0 - }, - "Cost": { - "type": "dword", - "value": 180 - }, - "Cursed": { - "type": "byte", - "value": 0 - }, - "DescIdentified": { - "type": "cexolocstring", - "value": {} - }, - "Description": { - "type": "cexolocstring", - "value": {} - }, - "Identified": { - "type": "byte", - "value": 0 - }, - "LocalizedName": { - "id": 13262, - "type": "cexolocstring", - "value": {} - }, - "ModelPart1": { - "type": "byte", - "value": 1 - }, - "Plot": { - "type": "byte", - "value": 0 - }, - "PropertiesList": { - "type": "list", - "value": [ - { - "__struct_id": 0, - "ChanceAppear": { - "type": "byte", - "value": 100 - }, - "CostTable": { - "type": "byte", - "value": 19 - }, - "CostValue": { - "type": "word", - "value": 2 - }, - "Param1": { - "type": "byte", - "value": 255 - }, - "Param1Value": { - "type": "byte", - "value": 255 - }, - "PropertyName": { - "type": "word", - "value": 77 - }, - "Subtype": { - "type": "word", - "value": 0 - } - } - ] - }, - "StackSize": { - "type": "word", - "value": 1 - }, - "Stolen": { - "type": "byte", - "value": 0 - }, - "Tag": { - "type": "cexostring", - "value": "NW_IT_CREWPSP002" - }, - "TemplateResRef": { - "type": "resref", - "value": "nw_it_crewpsp002" - }, - "xModelPart1": { - "type": "word", - "value": 1 - }, - "XOrientation": { - "type": "float", - "value": 0.0 - }, - "XPosition": { - "type": "float", - "value": -1.0 - }, - "YOrientation": { - "type": "float", - "value": 1.0 - }, - "YPosition": { - "type": "float", - "value": -1.0 - }, - "ZPosition": { - "type": "float", - "value": -1.0 - } - }, - { - "__struct_id": 32768, - "AddCost": { - "type": "dword", - "value": 0 - }, - "BaseItem": { - "type": "int", - "value": 72 - }, - "Charges": { - "type": "byte", - "value": 0 - }, - "Cost": { - "type": "dword", - "value": 180 - }, - "Cursed": { - "type": "byte", - "value": 0 - }, - "DescIdentified": { - "type": "cexolocstring", - "value": {} - }, - "Description": { - "type": "cexolocstring", - "value": {} - }, - "Identified": { - "type": "byte", - "value": 0 - }, - "LocalizedName": { - "id": 13262, - "type": "cexolocstring", - "value": {} - }, - "ModelPart1": { - "type": "byte", - "value": 1 - }, - "Plot": { - "type": "byte", - "value": 0 - }, - "PropertiesList": { - "type": "list", - "value": [ - { - "__struct_id": 0, - "ChanceAppear": { - "type": "byte", - "value": 100 - }, - "CostTable": { - "type": "byte", - "value": 19 - }, - "CostValue": { - "type": "word", - "value": 2 - }, - "Param1": { - "type": "byte", - "value": 255 - }, - "Param1Value": { - "type": "byte", - "value": 255 - }, - "PropertyName": { - "type": "word", - "value": 77 - }, - "Subtype": { - "type": "word", - "value": 0 - } - } - ] - }, - "StackSize": { - "type": "word", - "value": 1 - }, - "Stolen": { - "type": "byte", - "value": 0 - }, - "Tag": { - "type": "cexostring", - "value": "NW_IT_CREWPSP002" - }, - "TemplateResRef": { - "type": "resref", - "value": "nw_it_crewpsp002" - }, - "xModelPart1": { - "type": "word", - "value": 1 - }, - "XOrientation": { - "type": "float", - "value": 0.0 - }, - "XPosition": { - "type": "float", - "value": -1.0 - }, - "YOrientation": { - "type": "float", - "value": 1.0 - }, - "YPosition": { - "type": "float", - "value": -1.0 - }, - "ZPosition": { - "type": "float", - "value": -1.0 - } - }, - { - "__struct_id": 131072, - "AddCost": { - "type": "dword", - "value": 0 - }, - "BaseItem": { - "type": "int", - "value": 73 - }, - "Charges": { - "type": "byte", - "value": 0 - }, - "Cost": { - "type": "dword", - "value": 0 - }, - "Cursed": { - "type": "byte", - "value": 0 - }, - "DescIdentified": { - "type": "cexolocstring", - "value": {} - }, - "Description": { - "type": "cexolocstring", - "value": {} - }, - "Identified": { - "type": "byte", - "value": 0 - }, - "LocalizedName": { - "id": 13079, - "type": "cexolocstring", - "value": {} - }, - "ModelPart1": { - "type": "byte", - "value": 1 - }, - "Plot": { - "type": "byte", - "value": 0 - }, - "PropertiesList": { - "type": "list", - "value": [ - { - "__struct_id": 0, - "ChanceAppear": { - "type": "byte", - "value": 100 - }, - "CostTable": { - "type": "byte", - "value": 6 - }, - "CostValue": { - "type": "word", - "value": 1 - }, - "Param1": { - "type": "byte", - "value": 255 - }, - "Param1Value": { - "type": "byte", - "value": 255 - }, - "PropertyName": { - "type": "word", - "value": 22 - }, - "Subtype": { - "type": "word", - "value": 0 - } - }, - { - "__struct_id": 0, - "ChanceAppear": { - "type": "byte", - "value": 100 - }, - "CostTable": { - "type": "byte", - "value": 2 - }, - "CostValue": { - "type": "word", - "value": 2 - }, - "Param1": { - "type": "byte", - "value": 255 - }, - "Param1Value": { - "type": "byte", - "value": 255 - }, - "PropertyName": { - "type": "word", - "value": 51 - }, - "Subtype": { - "type": "word", - "value": 0 - } - } - ] - }, - "StackSize": { - "type": "word", - "value": 1 - }, - "Stolen": { - "type": "byte", - "value": 0 - }, - "Tag": { - "type": "cexostring", - "value": "NW_IT_CREITEM031" - }, - "TemplateResRef": { - "type": "resref", - "value": "nw_it_creitem031" - }, - "xModelPart1": { - "type": "word", - "value": 1 - }, - "XOrientation": { - "type": "float", - "value": 0.0 - }, - "XPosition": { - "type": "float", - "value": -1.0 - }, - "YOrientation": { - "type": "float", - "value": 1.0 - }, - "YPosition": { - "type": "float", - "value": -1.0 - }, - "ZPosition": { - "type": "float", - "value": -1.0 - } - } - ] - }, - "FactionID": { - "type": "word", - "value": 1 - }, - "FeatList": { - "type": "list", - "value": [ - { - "__struct_id": 1, - "Feat": { - "type": "word", - "value": 228 - } - }, - { - "__struct_id": 1, - "Feat": { - "type": "word", - "value": 28 - } - }, - { - "__struct_id": 1, - "Feat": { - "type": "word", - "value": 289 - } - } - ] - }, - "FirstName": { - "id": 12640, - "type": "cexolocstring", - "value": { - "0": "Tar Mephit" - } - }, - "fortbonus": { - "type": "short", - "value": 0 - }, - "Gender": { - "type": "byte", - "value": 0 - }, - "GoodEvil": { - "type": "byte", - "value": 0 - }, - "HitPoints": { - "type": "short", - "value": 13 - }, - "Int": { - "type": "byte", - "value": 12 - }, - "Interruptable": { - "type": "byte", - "value": 1 - }, - "IsImmortal": { - "type": "byte", - "value": 0 - }, - "IsPC": { - "type": "byte", - "value": 0 - }, - "LastName": { - "type": "cexolocstring", - "value": {} - }, - "LawfulChaotic": { - "type": "byte", - "value": 50 - }, - "Lootable": { - "type": "byte", - "value": 0 - }, - "MaxHitPoints": { - "type": "short", - "value": 16 - }, - "NaturalAC": { - "type": "byte", - "value": 5 - }, - "NoPermDeath": { - "type": "byte", - "value": 0 - }, - "PerceptionRange": { - "type": "byte", - "value": 11 - }, - "Phenotype": { - "type": "int", - "value": 0 - }, - "Plot": { - "type": "byte", - "value": 0 - }, - "PortraitId": { - "type": "word", - "value": 249 - }, - "Race": { - "type": "byte", - "value": 20 - }, - "refbonus": { - "type": "short", - "value": 0 - }, - "ScriptAttacked": { - "type": "resref", - "value": "nw_c2_default5" - }, - "ScriptDamaged": { - "type": "resref", - "value": "nw_c2_default6" - }, - "ScriptDeath": { - "type": "resref", - "value": "nw_c2_default7" - }, - "ScriptDialogue": { - "type": "resref", - "value": "nw_c2_default4" - }, - "ScriptDisturbed": { - "type": "resref", - "value": "nw_c2_default8" - }, - "ScriptEndRound": { - "type": "resref", - "value": "nw_c2_default3" - }, - "ScriptHeartbeat": { - "type": "resref", - "value": "nw_c2_default1" - }, - "ScriptOnBlocked": { - "type": "resref", - "value": "nw_c2_defaulte" - }, - "ScriptOnNotice": { - "type": "resref", - "value": "nw_c2_default2" - }, - "ScriptRested": { - "type": "resref", - "value": "nw_c2_defaulta" - }, - "ScriptSpawn": { - "type": "resref", - "value": "nw_c2_dropin9" - }, - "ScriptSpellAt": { - "type": "resref", - "value": "nw_c2_defaultb" - }, - "ScriptUserDefine": { - "type": "resref", - "value": "nw_c2_defaultd" - }, - "SkillList": { - "type": "list", - "value": [ - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 9 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 6 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 6 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 6 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - } - ] - }, - "SoundSetFile": { - "type": "word", - "value": 63 - }, - "SpecAbilityList": { - "type": "list", - "value": [ - { - "__struct_id": 4, - "Spell": { - "type": "word", - "value": 229 - }, - "SpellCasterLevel": { - "type": "byte", - "value": 1 - }, - "SpellFlags": { - "type": "byte", - "value": 1 - } - }, - { - "__struct_id": 4, - "Spell": { - "type": "word", - "value": 115 - }, - "SpellCasterLevel": { - "type": "byte", - "value": 3 - }, - "SpellFlags": { - "type": "byte", - "value": 1 - } - }, - { - "__struct_id": 4, - "Spell": { - "type": "word", - "value": 171 - }, - "SpellCasterLevel": { - "type": "byte", - "value": 6 - }, - "SpellFlags": { - "type": "byte", - "value": 1 - } - } - ] - }, - "StartingPackage": { - "type": "byte", - "value": 0 - }, - "Str": { - "type": "byte", - "value": 14 - }, - "Subrace": { - "type": "cexostring", - "value": "" - }, - "Tag": { - "type": "cexostring", - "value": "NW_MEPOOZE2" - }, - "Tail_New": { - "type": "dword", - "value": 0 - }, - "TemplateList": { - "type": "list", - "value": [] - }, - "TemplateResRef": { - "type": "resref", - "value": "mepooze001" - }, - "WalkRate": { - "type": "int", - "value": 7 - }, - "willbonus": { - "type": "short", - "value": 0 - }, - "Wings_New": { - "type": "dword", - "value": 0 - }, - "Wis": { - "type": "byte", - "value": 11 - }, - "XOrientation": { - "type": "float", - "value": 0.0 - }, - "XPosition": { - "type": "float", - "value": 89.09788513183594 - }, - "YOrientation": { - "type": "float", - "value": 1.0 - }, - "YPosition": { - "type": "float", - "value": 131.2329559326172 - }, - "ZPosition": { - "type": "float", - "value": 1.00000011920929 - } - }, - { - "__struct_id": 4, - "Appearance_Type": { - "type": "word", - "value": 112 - }, - "BodyBag": { - "type": "byte", - "value": 0 - }, - "Cha": { - "type": "byte", - "value": 15 - }, - "ChallengeRating": { - "type": "float", - "value": 4.0 - }, - "ClassList": { - "type": "list", - "value": [ - { - "__struct_id": 2, - "Class": { - "type": "int", - "value": 24 - }, - "ClassLevel": { - "type": "short", - "value": 3 - } - } - ] - }, - "Con": { - "type": "byte", - "value": 13 - }, - "Conversation": { - "type": "resref", - "value": "" - }, - "CRAdjust": { - "type": "int", - "value": 0 - }, - "CurrentHitPoints": { - "type": "short", - "value": 13 - }, - "DecayTime": { - "type": "dword", - "value": 0 - }, - "Deity": { - "type": "cexostring", - "value": "" - }, - "Description": { - "id": 12635, - "type": "cexolocstring", - "value": { - "0": "Chaotic and destructive, Mephits come in many shapes and have a wide range of abilities. Most are drawn from the various Elemental and Quasi-Elemental Planes." - } - }, - "Dex": { - "type": "byte", - "value": 10 - }, - "Disarmable": { - "type": "byte", - "value": 0 - }, - "Equip_ItemList": { - "type": "list", - "value": [ - { - "__struct_id": 16384, - "AddCost": { - "type": "dword", - "value": 0 - }, - "BaseItem": { - "type": "int", - "value": 72 - }, - "Charges": { - "type": "byte", - "value": 0 - }, - "Cost": { - "type": "dword", - "value": 180 - }, - "Cursed": { - "type": "byte", - "value": 0 - }, - "DescIdentified": { - "type": "cexolocstring", - "value": {} - }, - "Description": { - "type": "cexolocstring", - "value": {} - }, - "Identified": { - "type": "byte", - "value": 0 - }, - "LocalizedName": { - "id": 13262, - "type": "cexolocstring", - "value": {} - }, - "ModelPart1": { - "type": "byte", - "value": 1 - }, - "Plot": { - "type": "byte", - "value": 0 - }, - "PropertiesList": { - "type": "list", - "value": [ - { - "__struct_id": 0, - "ChanceAppear": { - "type": "byte", - "value": 100 - }, - "CostTable": { - "type": "byte", - "value": 19 - }, - "CostValue": { - "type": "word", - "value": 2 - }, - "Param1": { - "type": "byte", - "value": 255 - }, - "Param1Value": { - "type": "byte", - "value": 255 - }, - "PropertyName": { - "type": "word", - "value": 77 - }, - "Subtype": { - "type": "word", - "value": 0 - } - } - ] - }, - "StackSize": { - "type": "word", - "value": 1 - }, - "Stolen": { - "type": "byte", - "value": 0 - }, - "Tag": { - "type": "cexostring", - "value": "NW_IT_CREWPSP002" - }, - "TemplateResRef": { - "type": "resref", - "value": "nw_it_crewpsp002" - }, - "xModelPart1": { - "type": "word", - "value": 1 - }, - "XOrientation": { - "type": "float", - "value": 0.0 - }, - "XPosition": { - "type": "float", - "value": -1.0 - }, - "YOrientation": { - "type": "float", - "value": 1.0 - }, - "YPosition": { - "type": "float", - "value": -1.0 - }, - "ZPosition": { - "type": "float", - "value": -1.0 - } - }, - { - "__struct_id": 32768, - "AddCost": { - "type": "dword", - "value": 0 - }, - "BaseItem": { - "type": "int", - "value": 72 - }, - "Charges": { - "type": "byte", - "value": 0 - }, - "Cost": { - "type": "dword", - "value": 180 - }, - "Cursed": { - "type": "byte", - "value": 0 - }, - "DescIdentified": { - "type": "cexolocstring", - "value": {} - }, - "Description": { - "type": "cexolocstring", - "value": {} - }, - "Identified": { - "type": "byte", - "value": 0 - }, - "LocalizedName": { - "id": 13262, - "type": "cexolocstring", - "value": {} - }, - "ModelPart1": { - "type": "byte", - "value": 1 - }, - "Plot": { - "type": "byte", - "value": 0 - }, - "PropertiesList": { - "type": "list", - "value": [ - { - "__struct_id": 0, - "ChanceAppear": { - "type": "byte", - "value": 100 - }, - "CostTable": { - "type": "byte", - "value": 19 - }, - "CostValue": { - "type": "word", - "value": 2 - }, - "Param1": { - "type": "byte", - "value": 255 - }, - "Param1Value": { - "type": "byte", - "value": 255 - }, - "PropertyName": { - "type": "word", - "value": 77 - }, - "Subtype": { - "type": "word", - "value": 0 - } - } - ] - }, - "StackSize": { - "type": "word", - "value": 1 - }, - "Stolen": { - "type": "byte", - "value": 0 - }, - "Tag": { - "type": "cexostring", - "value": "NW_IT_CREWPSP002" - }, - "TemplateResRef": { - "type": "resref", - "value": "nw_it_crewpsp002" - }, - "xModelPart1": { - "type": "word", - "value": 1 - }, - "XOrientation": { - "type": "float", - "value": 0.0 - }, - "XPosition": { - "type": "float", - "value": -1.0 - }, - "YOrientation": { - "type": "float", - "value": 1.0 - }, - "YPosition": { - "type": "float", - "value": -1.0 - }, - "ZPosition": { - "type": "float", - "value": -1.0 - } - }, - { - "__struct_id": 131072, - "AddCost": { - "type": "dword", - "value": 0 - }, - "BaseItem": { - "type": "int", - "value": 73 - }, - "Charges": { - "type": "byte", - "value": 0 - }, - "Cost": { - "type": "dword", - "value": 0 - }, - "Cursed": { - "type": "byte", - "value": 0 - }, - "DescIdentified": { - "type": "cexolocstring", - "value": {} - }, - "Description": { - "type": "cexolocstring", - "value": {} - }, - "Identified": { - "type": "byte", - "value": 0 - }, - "LocalizedName": { - "id": 13079, - "type": "cexolocstring", - "value": {} - }, - "ModelPart1": { - "type": "byte", - "value": 1 - }, - "Plot": { - "type": "byte", - "value": 0 - }, - "PropertiesList": { - "type": "list", - "value": [ - { - "__struct_id": 0, - "ChanceAppear": { - "type": "byte", - "value": 100 - }, - "CostTable": { - "type": "byte", - "value": 6 - }, - "CostValue": { - "type": "word", - "value": 1 - }, - "Param1": { - "type": "byte", - "value": 255 - }, - "Param1Value": { - "type": "byte", - "value": 255 - }, - "PropertyName": { - "type": "word", - "value": 22 - }, - "Subtype": { - "type": "word", - "value": 0 - } - }, - { - "__struct_id": 0, - "ChanceAppear": { - "type": "byte", - "value": 100 - }, - "CostTable": { - "type": "byte", - "value": 2 - }, - "CostValue": { - "type": "word", - "value": 2 - }, - "Param1": { - "type": "byte", - "value": 255 - }, - "Param1Value": { - "type": "byte", - "value": 255 - }, - "PropertyName": { - "type": "word", - "value": 51 - }, - "Subtype": { - "type": "word", - "value": 0 - } - } - ] - }, - "StackSize": { - "type": "word", - "value": 1 - }, - "Stolen": { - "type": "byte", - "value": 0 - }, - "Tag": { - "type": "cexostring", - "value": "NW_IT_CREITEM031" - }, - "TemplateResRef": { - "type": "resref", - "value": "nw_it_creitem031" - }, - "xModelPart1": { - "type": "word", - "value": 1 - }, - "XOrientation": { - "type": "float", - "value": 0.0 - }, - "XPosition": { - "type": "float", - "value": -1.0 - }, - "YOrientation": { - "type": "float", - "value": 1.0 - }, - "YPosition": { - "type": "float", - "value": -1.0 - }, - "ZPosition": { - "type": "float", - "value": -1.0 - } - } - ] - }, - "FactionID": { - "type": "word", - "value": 1 - }, - "FeatList": { - "type": "list", - "value": [ - { - "__struct_id": 1, - "Feat": { - "type": "word", - "value": 228 - } - }, - { - "__struct_id": 1, - "Feat": { - "type": "word", - "value": 28 - } - }, - { - "__struct_id": 1, - "Feat": { - "type": "word", - "value": 289 - } - } - ] - }, - "FirstName": { - "id": 12640, - "type": "cexolocstring", - "value": { - "0": "Tar Mephit" - } - }, - "fortbonus": { - "type": "short", - "value": 0 - }, - "Gender": { - "type": "byte", - "value": 0 - }, - "GoodEvil": { - "type": "byte", - "value": 0 - }, - "HitPoints": { - "type": "short", - "value": 13 - }, - "Int": { - "type": "byte", - "value": 12 - }, - "Interruptable": { - "type": "byte", - "value": 1 - }, - "IsImmortal": { - "type": "byte", - "value": 0 - }, - "IsPC": { - "type": "byte", - "value": 0 - }, - "LastName": { - "type": "cexolocstring", - "value": {} - }, - "LawfulChaotic": { - "type": "byte", - "value": 50 - }, - "Lootable": { - "type": "byte", - "value": 0 - }, - "MaxHitPoints": { - "type": "short", - "value": 16 - }, - "NaturalAC": { - "type": "byte", - "value": 5 - }, - "NoPermDeath": { - "type": "byte", - "value": 0 - }, - "PerceptionRange": { - "type": "byte", - "value": 11 - }, - "Phenotype": { - "type": "int", - "value": 0 - }, - "Plot": { - "type": "byte", - "value": 0 - }, - "PortraitId": { - "type": "word", - "value": 249 - }, - "Race": { - "type": "byte", - "value": 20 - }, - "refbonus": { - "type": "short", - "value": 0 - }, - "ScriptAttacked": { - "type": "resref", - "value": "nw_c2_default5" - }, - "ScriptDamaged": { - "type": "resref", - "value": "nw_c2_default6" - }, - "ScriptDeath": { - "type": "resref", - "value": "nw_c2_default7" - }, - "ScriptDialogue": { - "type": "resref", - "value": "nw_c2_default4" - }, - "ScriptDisturbed": { - "type": "resref", - "value": "nw_c2_default8" - }, - "ScriptEndRound": { - "type": "resref", - "value": "nw_c2_default3" - }, - "ScriptHeartbeat": { - "type": "resref", - "value": "nw_c2_default1" - }, - "ScriptOnBlocked": { - "type": "resref", - "value": "nw_c2_defaulte" - }, - "ScriptOnNotice": { - "type": "resref", - "value": "nw_c2_default2" - }, - "ScriptRested": { - "type": "resref", - "value": "nw_c2_defaulta" - }, - "ScriptSpawn": { - "type": "resref", - "value": "nw_c2_dropin9" - }, - "ScriptSpellAt": { - "type": "resref", - "value": "nw_c2_defaultb" - }, - "ScriptUserDefine": { - "type": "resref", - "value": "nw_c2_defaultd" - }, - "SkillList": { - "type": "list", - "value": [ - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 9 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 6 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 6 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 6 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - }, - { - "__struct_id": 0, - "Rank": { - "type": "byte", - "value": 0 - } - } - ] - }, - "SoundSetFile": { - "type": "word", - "value": 63 - }, - "SpecAbilityList": { - "type": "list", - "value": [ - { - "__struct_id": 4, - "Spell": { - "type": "word", - "value": 229 - }, - "SpellCasterLevel": { - "type": "byte", - "value": 1 - }, - "SpellFlags": { - "type": "byte", - "value": 1 - } - }, - { - "__struct_id": 4, - "Spell": { - "type": "word", - "value": 115 - }, - "SpellCasterLevel": { - "type": "byte", - "value": 3 - }, - "SpellFlags": { - "type": "byte", - "value": 1 - } - }, - { - "__struct_id": 4, - "Spell": { - "type": "word", - "value": 171 - }, - "SpellCasterLevel": { - "type": "byte", - "value": 6 - }, - "SpellFlags": { - "type": "byte", - "value": 1 - } - } - ] - }, - "StartingPackage": { - "type": "byte", - "value": 0 - }, - "Str": { - "type": "byte", - "value": 14 - }, - "Subrace": { - "type": "cexostring", - "value": "" - }, - "Tag": { - "type": "cexostring", - "value": "NW_MEPOOZE2" - }, - "Tail_New": { - "type": "dword", - "value": 0 - }, - "TemplateList": { - "type": "list", - "value": [] - }, - "TemplateResRef": { - "type": "resref", - "value": "mepooze001" - }, - "WalkRate": { - "type": "int", - "value": 7 - }, - "willbonus": { - "type": "short", - "value": 0 - }, - "Wings_New": { - "type": "dword", - "value": 0 - }, - "Wis": { - "type": "byte", - "value": 11 - }, - "XOrientation": { - "type": "float", - "value": 0.0 - }, - "XPosition": { - "type": "float", - "value": 93.82815551757813 - }, - "YOrientation": { - "type": "float", - "value": 1.0 - }, - "YPosition": { - "type": "float", - "value": 128.8843688964844 - }, - "ZPosition": { - "type": "float", - "value": 1.0 - } - } - ] + "value": [] }, "Door List": { "type": "list", @@ -5312,6 +64,10 @@ "type": "byte", "value": 1 }, + "Comment": { + "type": "cexostring", + "value": "" + }, "CreatureList": { "type": "list", "value": [ @@ -5321,6 +77,10 @@ "type": "int", "value": 1431 }, + "Comment": { + "type": "cexostring", + "value": "" + }, "CR": { "type": "float", "value": 0.3333333432674408 @@ -5340,6 +100,10 @@ "type": "int", "value": 76 }, + "Comment": { + "type": "cexostring", + "value": "" + }, "CR": { "type": "float", "value": 2.0 @@ -5414,7 +178,7 @@ "__struct_id": 0, "Appearance": { "type": "int", - "value": 116 + "value": 168 }, "CR": { "type": "float", @@ -5422,7 +186,7 @@ }, "ResRef": { "type": "resref", - "value": "nw_willowisp" + "value": "nw_umberhulk" }, "SingleSpawn": { "type": "byte", @@ -5433,7 +197,7 @@ "__struct_id": 0, "Appearance": { "type": "int", - "value": 168 + "value": 116 }, "CR": { "type": "float", @@ -5441,7 +205,7 @@ }, "ResRef": { "type": "resref", - "value": "nw_umberhulk" + "value": "nw_willowisp" }, "SingleSpawn": { "type": "byte", @@ -10030,15 +4794,15 @@ }, "X": { "type": "float", - "value": 113.145637512207 + "value": 112.6315994262695 }, "Y": { "type": "float", - "value": 109.99609375 + "value": 109.8649749755859 }, "Z": { "type": "float", - "value": -2.343172788619995 + "value": -2.400003910064697 } }, { @@ -21691,6 +16455,209 @@ "type": "float", "value": 0.0 } + }, + { + "__struct_id": 1, + "AutoRemoveKey": { + "type": "byte", + "value": 0 + }, + "Cursor": { + "type": "byte", + "value": 0 + }, + "DisarmDC": { + "type": "byte", + "value": 0 + }, + "Faction": { + "type": "dword", + "value": 1 + }, + "Geometry": { + "type": "list", + "value": [ + { + "__struct_id": 3, + "PointX": { + "type": "float", + "value": -23.81990051269531 + }, + "PointY": { + "type": "float", + "value": 11.79757690429688 + }, + "PointZ": { + "type": "float", + "value": 1.024999976158142 + } + }, + { + "__struct_id": 3, + "PointX": { + "type": "float", + "value": -23.26988983154297 + }, + "PointY": { + "type": "float", + "value": -2.391502380371094 + }, + "PointZ": { + "type": "float", + "value": 1.024999976158142 + } + }, + { + "__struct_id": 3, + "PointX": { + "type": "float", + "value": 0.0 + }, + "PointY": { + "type": "float", + "value": 0.0 + }, + "PointZ": { + "type": "float", + "value": 1.024999976158142 + } + }, + { + "__struct_id": 3, + "PointX": { + "type": "float", + "value": 0.5890579223632813 + }, + "PointY": { + "type": "float", + "value": 12.11772155761719 + }, + "PointZ": { + "type": "float", + "value": 1.024999976158142 + } + } + ] + }, + "HighlightHeight": { + "type": "float", + "value": 0.0 + }, + "KeyName": { + "type": "cexostring", + "value": "" + }, + "LinkedTo": { + "type": "cexostring", + "value": "" + }, + "LinkedToFlags": { + "type": "byte", + "value": 0 + }, + "LoadScreenID": { + "type": "word", + "value": 0 + }, + "LocalizedName": { + "id": 14759, + "type": "cexolocstring", + "value": { + "0": "TarMephits" + } + }, + "OnClick": { + "type": "resref", + "value": "" + }, + "OnDisarm": { + "type": "resref", + "value": "" + }, + "OnTrapTriggered": { + "type": "resref", + "value": "" + }, + "PortraitId": { + "type": "word", + "value": 0 + }, + "ScriptHeartbeat": { + "type": "resref", + "value": "" + }, + "ScriptOnEnter": { + "type": "resref", + "value": "cv_10a_tar_fight" + }, + "ScriptOnExit": { + "type": "resref", + "value": "" + }, + "ScriptUserDefine": { + "type": "resref", + "value": "" + }, + "Tag": { + "type": "cexostring", + "value": "TarMephits" + }, + "TemplateResRef": { + "type": "resref", + "value": "newgeneric" + }, + "TrapDetectable": { + "type": "byte", + "value": 1 + }, + "TrapDetectDC": { + "type": "byte", + "value": 0 + }, + "TrapDisarmable": { + "type": "byte", + "value": 1 + }, + "TrapFlag": { + "type": "byte", + "value": 0 + }, + "TrapOneShot": { + "type": "byte", + "value": 1 + }, + "TrapType": { + "type": "byte", + "value": 0 + }, + "Type": { + "type": "int", + "value": 0 + }, + "XOrientation": { + "type": "float", + "value": 0.0 + }, + "XPosition": { + "type": "float", + "value": 104.5922088623047 + }, + "YOrientation": { + "type": "float", + "value": 0.0 + }, + "YPosition": { + "type": "float", + "value": 128.0166931152344 + }, + "ZOrientation": { + "type": "float", + "value": 0.0 + }, + "ZPosition": { + "type": "float", + "value": 0.0 + } } ] }, @@ -21992,6 +16959,68 @@ "type": "float", "value": 1.024999976158142 } + }, + { + "__struct_id": 5, + "Appearance": { + "type": "byte", + "value": 1 + }, + "Description": { + "type": "cexolocstring", + "value": {} + }, + "HasMapNote": { + "type": "byte", + "value": 0 + }, + "LinkedTo": { + "type": "cexostring", + "value": "" + }, + "LocalizedName": { + "id": 14817, + "type": "cexolocstring", + "value": { + "0": "SP_SN06M05_SA_SD12M10_RW_PC05_DS2_FC3_RH" + } + }, + "MapNote": { + "type": "cexolocstring", + "value": {} + }, + "MapNoteEnabled": { + "type": "byte", + "value": 1 + }, + "Tag": { + "type": "cexostring", + "value": "tarmephit001" + }, + "TemplateResRef": { + "type": "resref", + "value": "sp_waypoint" + }, + "XOrientation": { + "type": "float", + "value": 1.681558157189781e-044 + }, + "XPosition": { + "type": "float", + "value": 92.46055603027344 + }, + "YOrientation": { + "type": "float", + "value": 1.0 + }, + "YPosition": { + "type": "float", + "value": 127.9767303466797 + }, + "ZPosition": { + "type": "float", + "value": 1.000005722045898 + } } ] } diff --git a/_module/git/ifm_pc_rooms.git.json b/_module/git/ifm_pc_rooms.git.json index 606e8168..1f6f0daa 100644 --- a/_module/git/ifm_pc_rooms.git.json +++ b/_module/git/ifm_pc_rooms.git.json @@ -547,7 +547,7 @@ "id": 14548, "type": "cexolocstring", "value": { - "0": "This looks like a safe place to stoe your belongings, for now." + "0": "This looks like a safe place to store your gear... for now." } }, "DisarmDC": { @@ -597,7 +597,9 @@ "LocName": { "id": 14549, "type": "cexolocstring", - "value": {} + "value": { + "0": "Armoire" + } }, "OnClick": { "type": "resref", @@ -725,15 +727,15 @@ }, "X": { "type": "float", - "value": 11.45763397216797 + "value": 11.55000019073486 }, "Y": { "type": "float", - "value": 16.69826316833496 + "value": 16.82999992370606 }, "Z": { "type": "float", - "value": -5.7220458984375e-006 + "value": 0.0 } }, { @@ -1633,11 +1635,11 @@ }, "X": { "type": "float", - "value": 12.91908931732178 + "value": 11.75813961029053 }, "Y": { "type": "float", - "value": 11.65272808074951 + "value": 12.54897880554199 }, "Z": { "type": "float", @@ -2310,15 +2312,15 @@ }, "X": { "type": "float", - "value": 15.05000019073486 + "value": 14.97459030151367 }, "Y": { "type": "float", - "value": 18.44000053405762 + "value": 18.7603874206543 }, "Z": { "type": "float", - "value": 0.0 + "value": -5.7220458984375e-006 } }, { diff --git a/_module/git/inthetarlake.git.json b/_module/git/inthetarlake.git.json index 5156aafd..099299cc 100644 --- a/_module/git/inthetarlake.git.json +++ b/_module/git/inthetarlake.git.json @@ -743,7 +743,2408 @@ }, "SoundList": { "type": "list", - "value": [] + "value": [ + { + "__struct_id": 6, + "Active": { + "type": "byte", + "value": 1 + }, + "Continuous": { + "type": "byte", + "value": 0 + }, + "Elevation": { + "type": "float", + "value": 1.5 + }, + "GeneratedType": { + "type": "dword", + "value": 0 + }, + "Hours": { + "type": "dword", + "value": 0 + }, + "Interval": { + "type": "dword", + "value": 0 + }, + "IntervalVrtn": { + "type": "dword", + "value": 0 + }, + "LocName": { + "id": 91313, + "type": "cexolocstring", + "value": {} + }, + "Looping": { + "type": "byte", + "value": 1 + }, + "MaxDistance": { + "type": "float", + "value": 10.0 + }, + "MinDistance": { + "type": "float", + "value": 1.0 + }, + "PitchVariation": { + "type": "float", + "value": 0.0 + }, + "Positional": { + "type": "byte", + "value": 1 + }, + "Priority": { + "type": "byte", + "value": 3 + }, + "Random": { + "type": "byte", + "value": 0 + }, + "RandomPosition": { + "type": "byte", + "value": 0 + }, + "RandomRangeX": { + "type": "float", + "value": 0.0 + }, + "RandomRangeY": { + "type": "float", + "value": 0.0 + }, + "Sounds": { + "type": "list", + "value": [ + { + "__struct_id": 0, + "Sound": { + "type": "resref", + "value": "al_mg_x2eldbrain" + } + } + ] + }, + "Tag": { + "type": "cexostring", + "value": "IllithidElderBrain" + }, + "TemplateResRef": { + "type": "resref", + "value": "illithidelder001" + }, + "Times": { + "type": "byte", + "value": 3 + }, + "Volume": { + "type": "byte", + "value": 127 + }, + "VolumeVrtn": { + "type": "byte", + "value": 0 + }, + "XPosition": { + "type": "float", + "value": 47.47902679443359 + }, + "YPosition": { + "type": "float", + "value": 139.9750061035156 + }, + "ZPosition": { + "type": "float", + "value": 1.50000011920929 + } + }, + { + "__struct_id": 6, + "Active": { + "type": "byte", + "value": 1 + }, + "Continuous": { + "type": "byte", + "value": 0 + }, + "Elevation": { + "type": "float", + "value": 1.5 + }, + "GeneratedType": { + "type": "dword", + "value": 0 + }, + "Hours": { + "type": "dword", + "value": 0 + }, + "Interval": { + "type": "dword", + "value": 0 + }, + "IntervalVrtn": { + "type": "dword", + "value": 0 + }, + "LocName": { + "id": 91313, + "type": "cexolocstring", + "value": {} + }, + "Looping": { + "type": "byte", + "value": 1 + }, + "MaxDistance": { + "type": "float", + "value": 10.0 + }, + "MinDistance": { + "type": "float", + "value": 1.0 + }, + "PitchVariation": { + "type": "float", + "value": 0.0 + }, + "Positional": { + "type": "byte", + "value": 1 + }, + "Priority": { + "type": "byte", + "value": 3 + }, + "Random": { + "type": "byte", + "value": 0 + }, + "RandomPosition": { + "type": "byte", + "value": 0 + }, + "RandomRangeX": { + "type": "float", + "value": 0.0 + }, + "RandomRangeY": { + "type": "float", + "value": 0.0 + }, + "Sounds": { + "type": "list", + "value": [ + { + "__struct_id": 0, + "Sound": { + "type": "resref", + "value": "al_mg_x2eldbrain" + } + } + ] + }, + "Tag": { + "type": "cexostring", + "value": "IllithidElderBrain" + }, + "TemplateResRef": { + "type": "resref", + "value": "illithidelder001" + }, + "Times": { + "type": "byte", + "value": 3 + }, + "Volume": { + "type": "byte", + "value": 127 + }, + "VolumeVrtn": { + "type": "byte", + "value": 0 + }, + "XPosition": { + "type": "float", + "value": 95.08742523193359 + }, + "YPosition": { + "type": "float", + "value": 143.9970245361328 + }, + "ZPosition": { + "type": "float", + "value": 3.753506183624268 + } + }, + { + "__struct_id": 6, + "Active": { + "type": "byte", + "value": 1 + }, + "Continuous": { + "type": "byte", + "value": 0 + }, + "Elevation": { + "type": "float", + "value": 1.5 + }, + "GeneratedType": { + "type": "dword", + "value": 0 + }, + "Hours": { + "type": "dword", + "value": 0 + }, + "Interval": { + "type": "dword", + "value": 0 + }, + "IntervalVrtn": { + "type": "dword", + "value": 0 + }, + "LocName": { + "id": 91313, + "type": "cexolocstring", + "value": {} + }, + "Looping": { + "type": "byte", + "value": 1 + }, + "MaxDistance": { + "type": "float", + "value": 10.0 + }, + "MinDistance": { + "type": "float", + "value": 1.0 + }, + "PitchVariation": { + "type": "float", + "value": 0.0 + }, + "Positional": { + "type": "byte", + "value": 1 + }, + "Priority": { + "type": "byte", + "value": 3 + }, + "Random": { + "type": "byte", + "value": 0 + }, + "RandomPosition": { + "type": "byte", + "value": 0 + }, + "RandomRangeX": { + "type": "float", + "value": 0.0 + }, + "RandomRangeY": { + "type": "float", + "value": 0.0 + }, + "Sounds": { + "type": "list", + "value": [ + { + "__struct_id": 0, + "Sound": { + "type": "resref", + "value": "al_mg_x2eldbrain" + } + } + ] + }, + "Tag": { + "type": "cexostring", + "value": "IllithidElderBrain" + }, + "TemplateResRef": { + "type": "resref", + "value": "illithidelder001" + }, + "Times": { + "type": "byte", + "value": 3 + }, + "Volume": { + "type": "byte", + "value": 127 + }, + "VolumeVrtn": { + "type": "byte", + "value": 0 + }, + "XPosition": { + "type": "float", + "value": 69.83470153808594 + }, + "YPosition": { + "type": "float", + "value": 147.1778411865234 + }, + "ZPosition": { + "type": "float", + "value": 1.50000011920929 + } + }, + { + "__struct_id": 6, + "Active": { + "type": "byte", + "value": 1 + }, + "Continuous": { + "type": "byte", + "value": 0 + }, + "Elevation": { + "type": "float", + "value": 1.5 + }, + "GeneratedType": { + "type": "dword", + "value": 0 + }, + "Hours": { + "type": "dword", + "value": 0 + }, + "Interval": { + "type": "dword", + "value": 0 + }, + "IntervalVrtn": { + "type": "dword", + "value": 0 + }, + "LocName": { + "id": 91313, + "type": "cexolocstring", + "value": {} + }, + "Looping": { + "type": "byte", + "value": 1 + }, + "MaxDistance": { + "type": "float", + "value": 10.0 + }, + "MinDistance": { + "type": "float", + "value": 1.0 + }, + "PitchVariation": { + "type": "float", + "value": 0.0 + }, + "Positional": { + "type": "byte", + "value": 1 + }, + "Priority": { + "type": "byte", + "value": 3 + }, + "Random": { + "type": "byte", + "value": 0 + }, + "RandomPosition": { + "type": "byte", + "value": 0 + }, + "RandomRangeX": { + "type": "float", + "value": 0.0 + }, + "RandomRangeY": { + "type": "float", + "value": 0.0 + }, + "Sounds": { + "type": "list", + "value": [ + { + "__struct_id": 0, + "Sound": { + "type": "resref", + "value": "al_mg_x2eldbrain" + } + } + ] + }, + "Tag": { + "type": "cexostring", + "value": "IllithidElderBrain" + }, + "TemplateResRef": { + "type": "resref", + "value": "illithidelder001" + }, + "Times": { + "type": "byte", + "value": 3 + }, + "Volume": { + "type": "byte", + "value": 127 + }, + "VolumeVrtn": { + "type": "byte", + "value": 0 + }, + "XPosition": { + "type": "float", + "value": 28.98110008239746 + }, + "YPosition": { + "type": "float", + "value": 124.7168731689453 + }, + "ZPosition": { + "type": "float", + "value": 1.5 + } + }, + { + "__struct_id": 6, + "Active": { + "type": "byte", + "value": 1 + }, + "Continuous": { + "type": "byte", + "value": 0 + }, + "Elevation": { + "type": "float", + "value": 1.5 + }, + "GeneratedType": { + "type": "dword", + "value": 0 + }, + "Hours": { + "type": "dword", + "value": 0 + }, + "Interval": { + "type": "dword", + "value": 0 + }, + "IntervalVrtn": { + "type": "dword", + "value": 0 + }, + "LocName": { + "id": 91313, + "type": "cexolocstring", + "value": {} + }, + "Looping": { + "type": "byte", + "value": 1 + }, + "MaxDistance": { + "type": "float", + "value": 10.0 + }, + "MinDistance": { + "type": "float", + "value": 1.0 + }, + "PitchVariation": { + "type": "float", + "value": 0.0 + }, + "Positional": { + "type": "byte", + "value": 1 + }, + "Priority": { + "type": "byte", + "value": 3 + }, + "Random": { + "type": "byte", + "value": 0 + }, + "RandomPosition": { + "type": "byte", + "value": 0 + }, + "RandomRangeX": { + "type": "float", + "value": 0.0 + }, + "RandomRangeY": { + "type": "float", + "value": 0.0 + }, + "Sounds": { + "type": "list", + "value": [ + { + "__struct_id": 0, + "Sound": { + "type": "resref", + "value": "al_mg_x2eldbrain" + } + } + ] + }, + "Tag": { + "type": "cexostring", + "value": "IllithidElderBrain" + }, + "TemplateResRef": { + "type": "resref", + "value": "illithidelder001" + }, + "Times": { + "type": "byte", + "value": 3 + }, + "Volume": { + "type": "byte", + "value": 127 + }, + "VolumeVrtn": { + "type": "byte", + "value": 0 + }, + "XPosition": { + "type": "float", + "value": 10.47187042236328 + }, + "YPosition": { + "type": "float", + "value": 100.9124603271484 + }, + "ZPosition": { + "type": "float", + "value": 1.50000011920929 + } + }, + { + "__struct_id": 6, + "Active": { + "type": "byte", + "value": 1 + }, + "Continuous": { + "type": "byte", + "value": 0 + }, + "Elevation": { + "type": "float", + "value": 1.5 + }, + "GeneratedType": { + "type": "dword", + "value": 0 + }, + "Hours": { + "type": "dword", + "value": 0 + }, + "Interval": { + "type": "dword", + "value": 0 + }, + "IntervalVrtn": { + "type": "dword", + "value": 0 + }, + "LocName": { + "id": 91313, + "type": "cexolocstring", + "value": {} + }, + "Looping": { + "type": "byte", + "value": 1 + }, + "MaxDistance": { + "type": "float", + "value": 10.0 + }, + "MinDistance": { + "type": "float", + "value": 1.0 + }, + "PitchVariation": { + "type": "float", + "value": 0.0 + }, + "Positional": { + "type": "byte", + "value": 1 + }, + "Priority": { + "type": "byte", + "value": 3 + }, + "Random": { + "type": "byte", + "value": 0 + }, + "RandomPosition": { + "type": "byte", + "value": 0 + }, + "RandomRangeX": { + "type": "float", + "value": 0.0 + }, + "RandomRangeY": { + "type": "float", + "value": 0.0 + }, + "Sounds": { + "type": "list", + "value": [ + { + "__struct_id": 0, + "Sound": { + "type": "resref", + "value": "al_mg_x2eldbrain" + } + } + ] + }, + "Tag": { + "type": "cexostring", + "value": "IllithidElderBrain" + }, + "TemplateResRef": { + "type": "resref", + "value": "illithidelder001" + }, + "Times": { + "type": "byte", + "value": 3 + }, + "Volume": { + "type": "byte", + "value": 127 + }, + "VolumeVrtn": { + "type": "byte", + "value": 0 + }, + "XPosition": { + "type": "float", + "value": 9.816433906555176 + }, + "YPosition": { + "type": "float", + "value": 76.58443450927734 + }, + "ZPosition": { + "type": "float", + "value": 1.5 + } + }, + { + "__struct_id": 6, + "Active": { + "type": "byte", + "value": 1 + }, + "Continuous": { + "type": "byte", + "value": 0 + }, + "Elevation": { + "type": "float", + "value": 1.5 + }, + "GeneratedType": { + "type": "dword", + "value": 0 + }, + "Hours": { + "type": "dword", + "value": 0 + }, + "Interval": { + "type": "dword", + "value": 0 + }, + "IntervalVrtn": { + "type": "dword", + "value": 0 + }, + "LocName": { + "id": 91313, + "type": "cexolocstring", + "value": {} + }, + "Looping": { + "type": "byte", + "value": 1 + }, + "MaxDistance": { + "type": "float", + "value": 10.0 + }, + "MinDistance": { + "type": "float", + "value": 1.0 + }, + "PitchVariation": { + "type": "float", + "value": 0.0 + }, + "Positional": { + "type": "byte", + "value": 1 + }, + "Priority": { + "type": "byte", + "value": 3 + }, + "Random": { + "type": "byte", + "value": 0 + }, + "RandomPosition": { + "type": "byte", + "value": 0 + }, + "RandomRangeX": { + "type": "float", + "value": 0.0 + }, + "RandomRangeY": { + "type": "float", + "value": 0.0 + }, + "Sounds": { + "type": "list", + "value": [ + { + "__struct_id": 0, + "Sound": { + "type": "resref", + "value": "al_mg_x2eldbrain" + } + } + ] + }, + "Tag": { + "type": "cexostring", + "value": "IllithidElderBrain" + }, + "TemplateResRef": { + "type": "resref", + "value": "illithidelder001" + }, + "Times": { + "type": "byte", + "value": 3 + }, + "Volume": { + "type": "byte", + "value": 127 + }, + "VolumeVrtn": { + "type": "byte", + "value": 0 + }, + "XPosition": { + "type": "float", + "value": 17.65275573730469 + }, + "YPosition": { + "type": "float", + "value": 52.19091796875 + }, + "ZPosition": { + "type": "float", + "value": 1.5 + } + }, + { + "__struct_id": 6, + "Active": { + "type": "byte", + "value": 1 + }, + "Continuous": { + "type": "byte", + "value": 0 + }, + "Elevation": { + "type": "float", + "value": 1.5 + }, + "GeneratedType": { + "type": "dword", + "value": 0 + }, + "Hours": { + "type": "dword", + "value": 0 + }, + "Interval": { + "type": "dword", + "value": 0 + }, + "IntervalVrtn": { + "type": "dword", + "value": 0 + }, + "LocName": { + "id": 91313, + "type": "cexolocstring", + "value": {} + }, + "Looping": { + "type": "byte", + "value": 1 + }, + "MaxDistance": { + "type": "float", + "value": 10.0 + }, + "MinDistance": { + "type": "float", + "value": 1.0 + }, + "PitchVariation": { + "type": "float", + "value": 0.0 + }, + "Positional": { + "type": "byte", + "value": 1 + }, + "Priority": { + "type": "byte", + "value": 3 + }, + "Random": { + "type": "byte", + "value": 0 + }, + "RandomPosition": { + "type": "byte", + "value": 0 + }, + "RandomRangeX": { + "type": "float", + "value": 0.0 + }, + "RandomRangeY": { + "type": "float", + "value": 0.0 + }, + "Sounds": { + "type": "list", + "value": [ + { + "__struct_id": 0, + "Sound": { + "type": "resref", + "value": "al_mg_x2eldbrain" + } + } + ] + }, + "Tag": { + "type": "cexostring", + "value": "IllithidElderBrain" + }, + "TemplateResRef": { + "type": "resref", + "value": "illithidelder001" + }, + "Times": { + "type": "byte", + "value": 3 + }, + "Volume": { + "type": "byte", + "value": 127 + }, + "VolumeVrtn": { + "type": "byte", + "value": 0 + }, + "XPosition": { + "type": "float", + "value": 21.14233016967773 + }, + "YPosition": { + "type": "float", + "value": 27.47263336181641 + }, + "ZPosition": { + "type": "float", + "value": 1.499994277954102 + } + }, + { + "__struct_id": 6, + "Active": { + "type": "byte", + "value": 1 + }, + "Continuous": { + "type": "byte", + "value": 0 + }, + "Elevation": { + "type": "float", + "value": 1.5 + }, + "GeneratedType": { + "type": "dword", + "value": 0 + }, + "Hours": { + "type": "dword", + "value": 0 + }, + "Interval": { + "type": "dword", + "value": 0 + }, + "IntervalVrtn": { + "type": "dword", + "value": 0 + }, + "LocName": { + "id": 91313, + "type": "cexolocstring", + "value": {} + }, + "Looping": { + "type": "byte", + "value": 1 + }, + "MaxDistance": { + "type": "float", + "value": 10.0 + }, + "MinDistance": { + "type": "float", + "value": 1.0 + }, + "PitchVariation": { + "type": "float", + "value": 0.0 + }, + "Positional": { + "type": "byte", + "value": 1 + }, + "Priority": { + "type": "byte", + "value": 3 + }, + "Random": { + "type": "byte", + "value": 0 + }, + "RandomPosition": { + "type": "byte", + "value": 0 + }, + "RandomRangeX": { + "type": "float", + "value": 0.0 + }, + "RandomRangeY": { + "type": "float", + "value": 0.0 + }, + "Sounds": { + "type": "list", + "value": [ + { + "__struct_id": 0, + "Sound": { + "type": "resref", + "value": "al_mg_x2eldbrain" + } + } + ] + }, + "Tag": { + "type": "cexostring", + "value": "IllithidElderBrain" + }, + "TemplateResRef": { + "type": "resref", + "value": "illithidelder001" + }, + "Times": { + "type": "byte", + "value": 3 + }, + "Volume": { + "type": "byte", + "value": 127 + }, + "VolumeVrtn": { + "type": "byte", + "value": 0 + }, + "XPosition": { + "type": "float", + "value": 41.81654739379883 + }, + "YPosition": { + "type": "float", + "value": 20.15434455871582 + }, + "ZPosition": { + "type": "float", + "value": 1.499994277954102 + } + }, + { + "__struct_id": 6, + "Active": { + "type": "byte", + "value": 1 + }, + "Continuous": { + "type": "byte", + "value": 0 + }, + "Elevation": { + "type": "float", + "value": 1.5 + }, + "GeneratedType": { + "type": "dword", + "value": 0 + }, + "Hours": { + "type": "dword", + "value": 0 + }, + "Interval": { + "type": "dword", + "value": 0 + }, + "IntervalVrtn": { + "type": "dword", + "value": 0 + }, + "LocName": { + "id": 91313, + "type": "cexolocstring", + "value": {} + }, + "Looping": { + "type": "byte", + "value": 1 + }, + "MaxDistance": { + "type": "float", + "value": 10.0 + }, + "MinDistance": { + "type": "float", + "value": 1.0 + }, + "PitchVariation": { + "type": "float", + "value": 0.0 + }, + "Positional": { + "type": "byte", + "value": 1 + }, + "Priority": { + "type": "byte", + "value": 3 + }, + "Random": { + "type": "byte", + "value": 0 + }, + "RandomPosition": { + "type": "byte", + "value": 0 + }, + "RandomRangeX": { + "type": "float", + "value": 0.0 + }, + "RandomRangeY": { + "type": "float", + "value": 0.0 + }, + "Sounds": { + "type": "list", + "value": [ + { + "__struct_id": 0, + "Sound": { + "type": "resref", + "value": "al_mg_x2eldbrain" + } + } + ] + }, + "Tag": { + "type": "cexostring", + "value": "IllithidElderBrain" + }, + "TemplateResRef": { + "type": "resref", + "value": "illithidelder001" + }, + "Times": { + "type": "byte", + "value": 3 + }, + "Volume": { + "type": "byte", + "value": 127 + }, + "VolumeVrtn": { + "type": "byte", + "value": 0 + }, + "XPosition": { + "type": "float", + "value": 67.79651641845703 + }, + "YPosition": { + "type": "float", + "value": 18.87362670898438 + }, + "ZPosition": { + "type": "float", + "value": 1.499994277954102 + } + }, + { + "__struct_id": 6, + "Active": { + "type": "byte", + "value": 1 + }, + "Continuous": { + "type": "byte", + "value": 0 + }, + "Elevation": { + "type": "float", + "value": 1.5 + }, + "GeneratedType": { + "type": "dword", + "value": 0 + }, + "Hours": { + "type": "dword", + "value": 0 + }, + "Interval": { + "type": "dword", + "value": 0 + }, + "IntervalVrtn": { + "type": "dword", + "value": 0 + }, + "LocName": { + "id": 91313, + "type": "cexolocstring", + "value": {} + }, + "Looping": { + "type": "byte", + "value": 1 + }, + "MaxDistance": { + "type": "float", + "value": 10.0 + }, + "MinDistance": { + "type": "float", + "value": 1.0 + }, + "PitchVariation": { + "type": "float", + "value": 0.0 + }, + "Positional": { + "type": "byte", + "value": 1 + }, + "Priority": { + "type": "byte", + "value": 3 + }, + "Random": { + "type": "byte", + "value": 0 + }, + "RandomPosition": { + "type": "byte", + "value": 0 + }, + "RandomRangeX": { + "type": "float", + "value": 0.0 + }, + "RandomRangeY": { + "type": "float", + "value": 0.0 + }, + "Sounds": { + "type": "list", + "value": [ + { + "__struct_id": 0, + "Sound": { + "type": "resref", + "value": "al_mg_x2eldbrain" + } + } + ] + }, + "Tag": { + "type": "cexostring", + "value": "IllithidElderBrain" + }, + "TemplateResRef": { + "type": "resref", + "value": "illithidelder001" + }, + "Times": { + "type": "byte", + "value": 3 + }, + "Volume": { + "type": "byte", + "value": 127 + }, + "VolumeVrtn": { + "type": "byte", + "value": 0 + }, + "XPosition": { + "type": "float", + "value": 92.49578094482422 + }, + "YPosition": { + "type": "float", + "value": 20.15433502197266 + }, + "ZPosition": { + "type": "float", + "value": 1.499994277954102 + } + }, + { + "__struct_id": 6, + "Active": { + "type": "byte", + "value": 1 + }, + "Continuous": { + "type": "byte", + "value": 0 + }, + "Elevation": { + "type": "float", + "value": 1.5 + }, + "GeneratedType": { + "type": "dword", + "value": 0 + }, + "Hours": { + "type": "dword", + "value": 0 + }, + "Interval": { + "type": "dword", + "value": 0 + }, + "IntervalVrtn": { + "type": "dword", + "value": 0 + }, + "LocName": { + "id": 91313, + "type": "cexolocstring", + "value": {} + }, + "Looping": { + "type": "byte", + "value": 1 + }, + "MaxDistance": { + "type": "float", + "value": 10.0 + }, + "MinDistance": { + "type": "float", + "value": 1.0 + }, + "PitchVariation": { + "type": "float", + "value": 0.0 + }, + "Positional": { + "type": "byte", + "value": 1 + }, + "Priority": { + "type": "byte", + "value": 3 + }, + "Random": { + "type": "byte", + "value": 0 + }, + "RandomPosition": { + "type": "byte", + "value": 0 + }, + "RandomRangeX": { + "type": "float", + "value": 0.0 + }, + "RandomRangeY": { + "type": "float", + "value": 0.0 + }, + "Sounds": { + "type": "list", + "value": [ + { + "__struct_id": 0, + "Sound": { + "type": "resref", + "value": "al_mg_x2eldbrain" + } + } + ] + }, + "Tag": { + "type": "cexostring", + "value": "IllithidElderBrain" + }, + "TemplateResRef": { + "type": "resref", + "value": "illithidelder001" + }, + "Times": { + "type": "byte", + "value": 3 + }, + "Volume": { + "type": "byte", + "value": 127 + }, + "VolumeVrtn": { + "type": "byte", + "value": 0 + }, + "XPosition": { + "type": "float", + "value": 114.0847778320313 + }, + "YPosition": { + "type": "float", + "value": 30.21699905395508 + }, + "ZPosition": { + "type": "float", + "value": 1.499994277954102 + } + }, + { + "__struct_id": 6, + "Active": { + "type": "byte", + "value": 1 + }, + "Continuous": { + "type": "byte", + "value": 0 + }, + "Elevation": { + "type": "float", + "value": 1.5 + }, + "GeneratedType": { + "type": "dword", + "value": 0 + }, + "Hours": { + "type": "dword", + "value": 0 + }, + "Interval": { + "type": "dword", + "value": 0 + }, + "IntervalVrtn": { + "type": "dword", + "value": 0 + }, + "LocName": { + "id": 91313, + "type": "cexolocstring", + "value": {} + }, + "Looping": { + "type": "byte", + "value": 1 + }, + "MaxDistance": { + "type": "float", + "value": 10.0 + }, + "MinDistance": { + "type": "float", + "value": 1.0 + }, + "PitchVariation": { + "type": "float", + "value": 0.0 + }, + "Positional": { + "type": "byte", + "value": 1 + }, + "Priority": { + "type": "byte", + "value": 3 + }, + "Random": { + "type": "byte", + "value": 0 + }, + "RandomPosition": { + "type": "byte", + "value": 0 + }, + "RandomRangeX": { + "type": "float", + "value": 0.0 + }, + "RandomRangeY": { + "type": "float", + "value": 0.0 + }, + "Sounds": { + "type": "list", + "value": [ + { + "__struct_id": 0, + "Sound": { + "type": "resref", + "value": "al_mg_x2eldbrain" + } + } + ] + }, + "Tag": { + "type": "cexostring", + "value": "IllithidElderBrain" + }, + "TemplateResRef": { + "type": "resref", + "value": "illithidelder001" + }, + "Times": { + "type": "byte", + "value": 3 + }, + "Volume": { + "type": "byte", + "value": 127 + }, + "VolumeVrtn": { + "type": "byte", + "value": 0 + }, + "XPosition": { + "type": "float", + "value": 136.4056091308594 + }, + "YPosition": { + "type": "float", + "value": 34.05909729003906 + }, + "ZPosition": { + "type": "float", + "value": 1.499994277954102 + } + }, + { + "__struct_id": 6, + "Active": { + "type": "byte", + "value": 1 + }, + "Continuous": { + "type": "byte", + "value": 0 + }, + "Elevation": { + "type": "float", + "value": 1.5 + }, + "GeneratedType": { + "type": "dword", + "value": 0 + }, + "Hours": { + "type": "dword", + "value": 0 + }, + "Interval": { + "type": "dword", + "value": 0 + }, + "IntervalVrtn": { + "type": "dword", + "value": 0 + }, + "LocName": { + "id": 91313, + "type": "cexolocstring", + "value": {} + }, + "Looping": { + "type": "byte", + "value": 1 + }, + "MaxDistance": { + "type": "float", + "value": 10.0 + }, + "MinDistance": { + "type": "float", + "value": 1.0 + }, + "PitchVariation": { + "type": "float", + "value": 0.0 + }, + "Positional": { + "type": "byte", + "value": 1 + }, + "Priority": { + "type": "byte", + "value": 3 + }, + "Random": { + "type": "byte", + "value": 0 + }, + "RandomPosition": { + "type": "byte", + "value": 0 + }, + "RandomRangeX": { + "type": "float", + "value": 0.0 + }, + "RandomRangeY": { + "type": "float", + "value": 0.0 + }, + "Sounds": { + "type": "list", + "value": [ + { + "__struct_id": 0, + "Sound": { + "type": "resref", + "value": "al_mg_x2eldbrain" + } + } + ] + }, + "Tag": { + "type": "cexostring", + "value": "IllithidElderBrain" + }, + "TemplateResRef": { + "type": "resref", + "value": "illithidelder001" + }, + "Times": { + "type": "byte", + "value": 3 + }, + "Volume": { + "type": "byte", + "value": 127 + }, + "VolumeVrtn": { + "type": "byte", + "value": 0 + }, + "XPosition": { + "type": "float", + "value": 138.6011047363281 + }, + "YPosition": { + "type": "float", + "value": 60.77091217041016 + }, + "ZPosition": { + "type": "float", + "value": 1.499994277954102 + } + }, + { + "__struct_id": 6, + "Active": { + "type": "byte", + "value": 1 + }, + "Continuous": { + "type": "byte", + "value": 0 + }, + "Elevation": { + "type": "float", + "value": 1.5 + }, + "GeneratedType": { + "type": "dword", + "value": 0 + }, + "Hours": { + "type": "dword", + "value": 0 + }, + "Interval": { + "type": "dword", + "value": 0 + }, + "IntervalVrtn": { + "type": "dword", + "value": 0 + }, + "LocName": { + "id": 91313, + "type": "cexolocstring", + "value": {} + }, + "Looping": { + "type": "byte", + "value": 1 + }, + "MaxDistance": { + "type": "float", + "value": 10.0 + }, + "MinDistance": { + "type": "float", + "value": 1.0 + }, + "PitchVariation": { + "type": "float", + "value": 0.0 + }, + "Positional": { + "type": "byte", + "value": 1 + }, + "Priority": { + "type": "byte", + "value": 3 + }, + "Random": { + "type": "byte", + "value": 0 + }, + "RandomPosition": { + "type": "byte", + "value": 0 + }, + "RandomRangeX": { + "type": "float", + "value": 0.0 + }, + "RandomRangeY": { + "type": "float", + "value": 0.0 + }, + "Sounds": { + "type": "list", + "value": [ + { + "__struct_id": 0, + "Sound": { + "type": "resref", + "value": "al_mg_x2eldbrain" + } + } + ] + }, + "Tag": { + "type": "cexostring", + "value": "IllithidElderBrain" + }, + "TemplateResRef": { + "type": "resref", + "value": "illithidelder001" + }, + "Times": { + "type": "byte", + "value": 3 + }, + "Volume": { + "type": "byte", + "value": 127 + }, + "VolumeVrtn": { + "type": "byte", + "value": 0 + }, + "XPosition": { + "type": "float", + "value": 141.1624908447266 + }, + "YPosition": { + "type": "float", + "value": 85.65313720703125 + }, + "ZPosition": { + "type": "float", + "value": 1.499994277954102 + } + }, + { + "__struct_id": 6, + "Active": { + "type": "byte", + "value": 1 + }, + "Continuous": { + "type": "byte", + "value": 0 + }, + "Elevation": { + "type": "float", + "value": 1.5 + }, + "GeneratedType": { + "type": "dword", + "value": 0 + }, + "Hours": { + "type": "dword", + "value": 0 + }, + "Interval": { + "type": "dword", + "value": 0 + }, + "IntervalVrtn": { + "type": "dword", + "value": 0 + }, + "LocName": { + "id": 91313, + "type": "cexolocstring", + "value": {} + }, + "Looping": { + "type": "byte", + "value": 1 + }, + "MaxDistance": { + "type": "float", + "value": 10.0 + }, + "MinDistance": { + "type": "float", + "value": 1.0 + }, + "PitchVariation": { + "type": "float", + "value": 0.0 + }, + "Positional": { + "type": "byte", + "value": 1 + }, + "Priority": { + "type": "byte", + "value": 3 + }, + "Random": { + "type": "byte", + "value": 0 + }, + "RandomPosition": { + "type": "byte", + "value": 0 + }, + "RandomRangeX": { + "type": "float", + "value": 0.0 + }, + "RandomRangeY": { + "type": "float", + "value": 0.0 + }, + "Sounds": { + "type": "list", + "value": [ + { + "__struct_id": 0, + "Sound": { + "type": "resref", + "value": "al_mg_x2eldbrain" + } + } + ] + }, + "Tag": { + "type": "cexostring", + "value": "IllithidElderBrain" + }, + "TemplateResRef": { + "type": "resref", + "value": "illithidelder001" + }, + "Times": { + "type": "byte", + "value": 3 + }, + "Volume": { + "type": "byte", + "value": 127 + }, + "VolumeVrtn": { + "type": "byte", + "value": 0 + }, + "XPosition": { + "type": "float", + "value": 137.5033416748047 + }, + "YPosition": { + "type": "float", + "value": 109.4376220703125 + }, + "ZPosition": { + "type": "float", + "value": 1.499994277954102 + } + }, + { + "__struct_id": 6, + "Active": { + "type": "byte", + "value": 1 + }, + "Continuous": { + "type": "byte", + "value": 0 + }, + "Elevation": { + "type": "float", + "value": 1.5 + }, + "GeneratedType": { + "type": "dword", + "value": 0 + }, + "Hours": { + "type": "dword", + "value": 0 + }, + "Interval": { + "type": "dword", + "value": 0 + }, + "IntervalVrtn": { + "type": "dword", + "value": 0 + }, + "LocName": { + "id": 91313, + "type": "cexolocstring", + "value": {} + }, + "Looping": { + "type": "byte", + "value": 1 + }, + "MaxDistance": { + "type": "float", + "value": 10.0 + }, + "MinDistance": { + "type": "float", + "value": 1.0 + }, + "PitchVariation": { + "type": "float", + "value": 0.0 + }, + "Positional": { + "type": "byte", + "value": 1 + }, + "Priority": { + "type": "byte", + "value": 3 + }, + "Random": { + "type": "byte", + "value": 0 + }, + "RandomPosition": { + "type": "byte", + "value": 0 + }, + "RandomRangeX": { + "type": "float", + "value": 0.0 + }, + "RandomRangeY": { + "type": "float", + "value": 0.0 + }, + "Sounds": { + "type": "list", + "value": [ + { + "__struct_id": 0, + "Sound": { + "type": "resref", + "value": "al_mg_x2eldbrain" + } + } + ] + }, + "Tag": { + "type": "cexostring", + "value": "IllithidElderBrain" + }, + "TemplateResRef": { + "type": "resref", + "value": "illithidelder001" + }, + "Times": { + "type": "byte", + "value": 3 + }, + "Volume": { + "type": "byte", + "value": 127 + }, + "VolumeVrtn": { + "type": "byte", + "value": 0 + }, + "XPosition": { + "type": "float", + "value": 108.0471878051758 + }, + "YPosition": { + "type": "float", + "value": 108.8887481689453 + }, + "ZPosition": { + "type": "float", + "value": 1.499994277954102 + } + }, + { + "__struct_id": 6, + "Active": { + "type": "byte", + "value": 1 + }, + "Continuous": { + "type": "byte", + "value": 0 + }, + "Elevation": { + "type": "float", + "value": 1.5 + }, + "GeneratedType": { + "type": "dword", + "value": 0 + }, + "Hours": { + "type": "dword", + "value": 0 + }, + "Interval": { + "type": "dword", + "value": 0 + }, + "IntervalVrtn": { + "type": "dword", + "value": 0 + }, + "LocName": { + "id": 91313, + "type": "cexolocstring", + "value": {} + }, + "Looping": { + "type": "byte", + "value": 1 + }, + "MaxDistance": { + "type": "float", + "value": 10.0 + }, + "MinDistance": { + "type": "float", + "value": 1.0 + }, + "PitchVariation": { + "type": "float", + "value": 0.0 + }, + "Positional": { + "type": "byte", + "value": 1 + }, + "Priority": { + "type": "byte", + "value": 3 + }, + "Random": { + "type": "byte", + "value": 0 + }, + "RandomPosition": { + "type": "byte", + "value": 0 + }, + "RandomRangeX": { + "type": "float", + "value": 0.0 + }, + "RandomRangeY": { + "type": "float", + "value": 0.0 + }, + "Sounds": { + "type": "list", + "value": [ + { + "__struct_id": 0, + "Sound": { + "type": "resref", + "value": "al_mg_x2eldbrain" + } + } + ] + }, + "Tag": { + "type": "cexostring", + "value": "IllithidElderBrain" + }, + "TemplateResRef": { + "type": "resref", + "value": "illithidelder001" + }, + "Times": { + "type": "byte", + "value": 3 + }, + "Volume": { + "type": "byte", + "value": 127 + }, + "VolumeVrtn": { + "type": "byte", + "value": 0 + }, + "XPosition": { + "type": "float", + "value": 95.1151123046875 + }, + "YPosition": { + "type": "float", + "value": 94.53624725341797 + }, + "ZPosition": { + "type": "float", + "value": 4.200719833374023 + } + }, + { + "__struct_id": 6, + "Active": { + "type": "byte", + "value": 1 + }, + "Continuous": { + "type": "byte", + "value": 0 + }, + "Elevation": { + "type": "float", + "value": 1.5 + }, + "GeneratedType": { + "type": "dword", + "value": 0 + }, + "Hours": { + "type": "dword", + "value": 0 + }, + "Interval": { + "type": "dword", + "value": 0 + }, + "IntervalVrtn": { + "type": "dword", + "value": 0 + }, + "LocName": { + "id": 91313, + "type": "cexolocstring", + "value": {} + }, + "Looping": { + "type": "byte", + "value": 1 + }, + "MaxDistance": { + "type": "float", + "value": 10.0 + }, + "MinDistance": { + "type": "float", + "value": 1.0 + }, + "PitchVariation": { + "type": "float", + "value": 0.0 + }, + "Positional": { + "type": "byte", + "value": 1 + }, + "Priority": { + "type": "byte", + "value": 3 + }, + "Random": { + "type": "byte", + "value": 0 + }, + "RandomPosition": { + "type": "byte", + "value": 0 + }, + "RandomRangeX": { + "type": "float", + "value": 0.0 + }, + "RandomRangeY": { + "type": "float", + "value": 0.0 + }, + "Sounds": { + "type": "list", + "value": [ + { + "__struct_id": 0, + "Sound": { + "type": "resref", + "value": "al_mg_x2eldbrain" + } + } + ] + }, + "Tag": { + "type": "cexostring", + "value": "IllithidElderBrain" + }, + "TemplateResRef": { + "type": "resref", + "value": "illithidelder001" + }, + "Times": { + "type": "byte", + "value": 3 + }, + "Volume": { + "type": "byte", + "value": 127 + }, + "VolumeVrtn": { + "type": "byte", + "value": 0 + }, + "XPosition": { + "type": "float", + "value": 80.05467224121094 + }, + "YPosition": { + "type": "float", + "value": 83.09173583984375 + }, + "ZPosition": { + "type": "float", + "value": 1.499994277954102 + } + }, + { + "__struct_id": 6, + "Active": { + "type": "byte", + "value": 1 + }, + "Continuous": { + "type": "byte", + "value": 0 + }, + "Elevation": { + "type": "float", + "value": 1.5 + }, + "GeneratedType": { + "type": "dword", + "value": 0 + }, + "Hours": { + "type": "dword", + "value": 0 + }, + "Interval": { + "type": "dword", + "value": 0 + }, + "IntervalVrtn": { + "type": "dword", + "value": 0 + }, + "LocName": { + "id": 91313, + "type": "cexolocstring", + "value": {} + }, + "Looping": { + "type": "byte", + "value": 1 + }, + "MaxDistance": { + "type": "float", + "value": 10.0 + }, + "MinDistance": { + "type": "float", + "value": 1.0 + }, + "PitchVariation": { + "type": "float", + "value": 0.0 + }, + "Positional": { + "type": "byte", + "value": 1 + }, + "Priority": { + "type": "byte", + "value": 3 + }, + "Random": { + "type": "byte", + "value": 0 + }, + "RandomPosition": { + "type": "byte", + "value": 0 + }, + "RandomRangeX": { + "type": "float", + "value": 0.0 + }, + "RandomRangeY": { + "type": "float", + "value": 0.0 + }, + "Sounds": { + "type": "list", + "value": [ + { + "__struct_id": 0, + "Sound": { + "type": "resref", + "value": "al_mg_x2eldbrain" + } + } + ] + }, + "Tag": { + "type": "cexostring", + "value": "IllithidElderBrain" + }, + "TemplateResRef": { + "type": "resref", + "value": "illithidelder001" + }, + "Times": { + "type": "byte", + "value": 3 + }, + "Volume": { + "type": "byte", + "value": 127 + }, + "VolumeVrtn": { + "type": "byte", + "value": 0 + }, + "XPosition": { + "type": "float", + "value": 58.28271484375 + }, + "YPosition": { + "type": "float", + "value": 83.27468872070313 + }, + "ZPosition": { + "type": "float", + "value": 1.499994277954102 + } + } + ] }, "StoreList": { "type": "list", @@ -898,7 +3299,7 @@ "id": 14817, "type": "cexolocstring", "value": { - "0": "SP_SN05M02_SA_SR35M25P_SD10M05_RW_PC05_DS3_DI20" + "0": "SP_SN05M03_SA_SD12M10_RW_PC05_DS2_FC3" } }, "MapNote": { @@ -942,7 +3343,7 @@ "__struct_id": 5, "Appearance": { "type": "byte", - "value": 3 + "value": 1 }, "Description": { "type": "cexolocstring", @@ -960,7 +3361,7 @@ "id": 14817, "type": "cexolocstring", "value": { - "0": "SL01" + "0": "SP_SN05M03_SA_SD12M10_RW_PC05_DS2_FC3" } }, "MapNote": { @@ -973,7 +3374,7 @@ }, "Tag": { "type": "cexostring", - "value": "SL01" + "value": "tarmephit001" }, "TemplateResRef": { "type": "resref", @@ -985,7 +3386,7 @@ }, "XPosition": { "type": "float", - "value": 30.20638275146484 + "value": 29.92337989807129 }, "YOrientation": { "type": "float", @@ -993,7 +3394,7 @@ }, "YPosition": { "type": "float", - "value": 129.0350036621094 + "value": 126.5394287109375 }, "ZPosition": { "type": "float", @@ -1004,7 +3405,7 @@ "__struct_id": 5, "Appearance": { "type": "byte", - "value": 3 + "value": 1 }, "Description": { "type": "cexolocstring", @@ -1022,7 +3423,7 @@ "id": 14817, "type": "cexolocstring", "value": { - "0": "SL06" + "0": "SP_SN05M03_SA_SD12M10_RW_PC05_DS2_FC3" } }, "MapNote": { @@ -1035,7 +3436,7 @@ }, "Tag": { "type": "cexostring", - "value": "SL06" + "value": "tarmephit001" }, "TemplateResRef": { "type": "resref", @@ -1043,11 +3444,11 @@ }, "XOrientation": { "type": "float", - "value": 1.541428310757299e-043 + "value": 0.0 }, "XPosition": { "type": "float", - "value": 87.83036804199219 + "value": 9.498647689819336 }, "YOrientation": { "type": "float", @@ -1055,7 +3456,7 @@ }, "YPosition": { "type": "float", - "value": 89.76968383789063 + "value": 79.17666625976563 }, "ZPosition": { "type": "float", @@ -1066,7 +3467,7 @@ "__struct_id": 5, "Appearance": { "type": "byte", - "value": 3 + "value": 1 }, "Description": { "type": "cexolocstring", @@ -1084,7 +3485,7 @@ "id": 14817, "type": "cexolocstring", "value": { - "0": "SL02" + "0": "SP_SN05M03_SA_SD12M10_RW_PC05_DS2_FC3" } }, "MapNote": { @@ -1097,7 +3498,7 @@ }, "Tag": { "type": "cexostring", - "value": "SL02" + "value": "tarmephit001" }, "TemplateResRef": { "type": "resref", @@ -1105,11 +3506,11 @@ }, "XOrientation": { "type": "float", - "value": 1.541428310757299e-043 + "value": 0.0 }, "XPosition": { "type": "float", - "value": 10.96511840820313 + "value": 23.08793640136719 }, "YOrientation": { "type": "float", @@ -1117,7 +3518,7 @@ }, "YPosition": { "type": "float", - "value": 79.81986236572266 + "value": 24.69306373596191 }, "ZPosition": { "type": "float", @@ -1128,7 +3529,7 @@ "__struct_id": 5, "Appearance": { "type": "byte", - "value": 3 + "value": 1 }, "Description": { "type": "cexolocstring", @@ -1146,7 +3547,7 @@ "id": 14817, "type": "cexolocstring", "value": { - "0": "SL05" + "0": "SP_SN05M03_SA_SD12M10_RW_PC05_DS2_FC3" } }, "MapNote": { @@ -1159,7 +3560,7 @@ }, "Tag": { "type": "cexostring", - "value": "SL05" + "value": "tarmephit001" }, "TemplateResRef": { "type": "resref", @@ -1167,11 +3568,11 @@ }, "XOrientation": { "type": "float", - "value": 1.541428310757299e-043 + "value": 0.0 }, "XPosition": { "type": "float", - "value": 136.369140625 + "value": 135.6609191894531 }, "YOrientation": { "type": "float", @@ -1179,7 +3580,7 @@ }, "YPosition": { "type": "float", - "value": 109.5062789916992 + "value": 30.11311912536621 }, "ZPosition": { "type": "float", @@ -1190,7 +3591,7 @@ "__struct_id": 5, "Appearance": { "type": "byte", - "value": 3 + "value": 1 }, "Description": { "type": "cexolocstring", @@ -1208,7 +3609,7 @@ "id": 14817, "type": "cexolocstring", "value": { - "0": "SL03" + "0": "SP_SN05M03_SA_SD12M10_RW_PC05_DS2_FC3" } }, "MapNote": { @@ -1221,7 +3622,7 @@ }, "Tag": { "type": "cexostring", - "value": "SL03" + "value": "tarmephit001" }, "TemplateResRef": { "type": "resref", @@ -1229,11 +3630,11 @@ }, "XOrientation": { "type": "float", - "value": 1.541428310757299e-043 + "value": 0.0 }, "XPosition": { "type": "float", - "value": 21.4156436920166 + "value": 136.2919616699219 }, "YOrientation": { "type": "float", @@ -1241,7 +3642,7 @@ }, "YPosition": { "type": "float", - "value": 27.03426933288574 + "value": 107.0107192993164 }, "ZPosition": { "type": "float", @@ -1252,7 +3653,7 @@ "__struct_id": 5, "Appearance": { "type": "byte", - "value": 3 + "value": 1 }, "Description": { "type": "cexolocstring", @@ -1270,7 +3671,7 @@ "id": 14817, "type": "cexolocstring", "value": { - "0": "SL04" + "0": "SP_SN05M03_SA_SD12M10_RW_PC05_DS2_FC3" } }, "MapNote": { @@ -1283,7 +3684,7 @@ }, "Tag": { "type": "cexostring", - "value": "SL04" + "value": "tarmephit001" }, "TemplateResRef": { "type": "resref", @@ -1291,11 +3692,11 @@ }, "XOrientation": { "type": "float", - "value": 1.541428310757299e-043 + "value": 0.0 }, "XPosition": { "type": "float", - "value": 134.2973480224609 + "value": 87.85610198974609 }, "YOrientation": { "type": "float", @@ -1303,11 +3704,11 @@ }, "YPosition": { "type": "float", - "value": 29.93302536010742 + "value": 86.70809936523438 }, "ZPosition": { "type": "float", - "value": -5.7220458984375e-006 + "value": 0.01000607013702393 } } ] diff --git a/_module/ifo/module.ifo.json b/_module/ifo/module.ifo.json index 5f2556fa..a24b14c1 100644 --- a/_module/ifo/module.ifo.json +++ b/_module/ifo/module.ifo.json @@ -2204,7 +2204,7 @@ }, "Mod_OnNuiEvent": { "type": "resref", - "value": "" + "value": "ra_mod_onnui" }, "Mod_OnPlrChat": { "type": "resref", @@ -2236,7 +2236,7 @@ }, "Mod_OnPlrTarget": { "type": "resref", - "value": "" + "value": "ra_onplaytarget" }, "Mod_OnPlrTileAct": { "type": "resref", diff --git a/_module/itp/itempalcus.itp.json b/_module/itp/itempalcus.itp.json index 14d98419..3566d282 100644 --- a/_module/itp/itempalcus.itp.json +++ b/_module/itp/itempalcus.itp.json @@ -11150,6 +11150,17 @@ "value": "stormgiantprops" } }, + { + "__struct_id": 0, + "NAME": { + "type": "cexostring", + "value": "Tar Mephit Properties" + }, + "RESREF": { + "type": "resref", + "value": "hide_tarmephit01" + } + }, { "__struct_id": 0, "NAME": { diff --git a/_module/itp/soundpalcus.itp.json b/_module/itp/soundpalcus.itp.json index 5a8a56a8..a1b4e711 100644 --- a/_module/itp/soundpalcus.itp.json +++ b/_module/itp/soundpalcus.itp.json @@ -31,6 +31,22 @@ "type": "byte", "value": 12 }, + "LIST": { + "type": "list", + "value": [ + { + "__struct_id": 0, + "NAME": { + "type": "cexostring", + "value": "Illithid Elder Brain" + }, + "RESREF": { + "type": "resref", + "value": "illithidelder001" + } + } + ] + }, "STRREF": { "type": "dword", "value": 62487 diff --git a/_module/ncs/cv_10a_tar_fight.ncs b/_module/ncs/cv_10a_tar_fight.ncs new file mode 100644 index 00000000..2464c9c8 Binary files /dev/null and b/_module/ncs/cv_10a_tar_fight.ncs differ diff --git a/_module/ncs/dmfi_execute.ncs b/_module/ncs/dmfi_execute.ncs index f9dcfe9e..ddbf76d0 100644 Binary files a/_module/ncs/dmfi_execute.ncs and b/_module/ncs/dmfi_execute.ncs differ diff --git a/_module/ncs/dmfi_plychat_exe.ncs b/_module/ncs/dmfi_plychat_exe.ncs index 1ca142bc..d3a9410a 100644 Binary files a/_module/ncs/dmfi_plychat_exe.ncs and b/_module/ncs/dmfi_plychat_exe.ncs differ diff --git a/_module/ncs/dungeon_enter.ncs b/_module/ncs/dungeon_enter.ncs index 607ca0e4..9fc016f0 100644 Binary files a/_module/ncs/dungeon_enter.ncs and b/_module/ncs/dungeon_enter.ncs differ diff --git a/_module/ncs/nui_f_storage.ncs b/_module/ncs/nui_f_storage.ncs new file mode 100644 index 00000000..ccc9fe69 Binary files /dev/null and b/_module/ncs/nui_f_storage.ncs differ diff --git a/_module/ncs/ra_mod_onnui.ncs b/_module/ncs/ra_mod_onnui.ncs new file mode 100644 index 00000000..690fc08c Binary files /dev/null and b/_module/ncs/ra_mod_onnui.ncs differ diff --git a/_module/ncs/ra_onplaytarget.ncs b/_module/ncs/ra_onplaytarget.ncs new file mode 100644 index 00000000..f7b2614f Binary files /dev/null and b/_module/ncs/ra_onplaytarget.ncs differ diff --git a/_module/ncs/tar_lake_hb.ncs b/_module/ncs/tar_lake_hb.ncs index a98e5e52..8df95365 100644 Binary files a/_module/ncs/tar_lake_hb.ncs and b/_module/ncs/tar_lake_hb.ncs differ diff --git a/_module/ncs/x2_mod_def_load.ncs b/_module/ncs/x2_mod_def_load.ncs index 828c83a8..66a21f0a 100644 Binary files a/_module/ncs/x2_mod_def_load.ncs and b/_module/ncs/x2_mod_def_load.ncs differ diff --git a/_module/nss/cv_10a_tar_fight.nss b/_module/nss/cv_10a_tar_fight.nss new file mode 100644 index 00000000..dba5259b --- /dev/null +++ b/_module/nss/cv_10a_tar_fight.nss @@ -0,0 +1,20 @@ +void main() +{ + // Get the entering object (usually a player character) + object oPC = GetEnteringObject(); + + // Check if the entering object is a player character and not the module itself + if (GetIsPC(oPC) && !GetIsDM(oPC)) + { + // Find the nearest creature with the tag "TARMEPHIT001" + object oCreature = GetNearestObjectByTag("TARMEPHIT001", oPC); + + // Check if a valid creature was found + if (GetIsObjectValid(oCreature)) + { + // Make the creature say the message + SpeakString("Hey, you stay away from our tar!", TALKVOLUME_SHOUT); + } + } +} + diff --git a/_module/nss/dungeon_enter.nss b/_module/nss/dungeon_enter.nss index fb5e962e..109f5f12 100644 --- a/_module/nss/dungeon_enter.nss +++ b/_module/nss/dungeon_enter.nss @@ -32,7 +32,7 @@ void main() SetLocalInt(oPC, "bEnteredDungeon", 1); //:: Fires any NESS spawners - ExecuteScript("spawn_smpl_onen2"); + ExecuteScript("ra_onareaenter"); //////////////////////////////////////////////// Sparky Spawner Section if (GetLocalInt(oArea, "sparkyloaded") != 1) diff --git a/_module/nss/nui_c_config.nss b/_module/nss/nui_c_config.nss new file mode 100644 index 00000000..d5707bbd --- /dev/null +++ b/_module/nss/nui_c_config.nss @@ -0,0 +1,50 @@ + +/// ---------------------------------------------------------------------------- +/// @file nui_c_config.nss +/// @author Ed Burke (tinygiant98) +/// @brief NUI Form Creation and Management System Configuration +/// ---------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +// FORM INSPECTOR +// ----------------------------------------------------------------------------- + +// The form inspection capability allows you to record data about a form's status, +// including bind values and how various events affect them. To use the inspection +// capability, you must include the `nui_f_inspector` formfile in your module and +// set NUI_FI_RECORD_DATA to the desired value. + +// *** WARNING *** Form inspection is very expensive. Is it recommended that +// you only use the form inspection capability during debug or set this +// value to NUI_FI_WHEN_OPEN to prevent unnecessary traffic. +const int NUI_FI_NEVER = 0; +const int NUI_FI_ALWAYS = 1; +const int NUI_FI_WHEN_OPEN = 2; + +const int NUI_FI_RECORD_DATA = NUI_FI_WHEN_OPEN; + +// ----------------------------------------------------------------------------- +// Custom Functions +// MODIFY THESE TO ENSURE COMPATIBILTY WITH YOUR MODULE'S SYSTEMS +// ----------------------------------------------------------------------------- + +// This system has some basic debugging functionality. In order to make this system work +// under multiple modules without collision, the following function is provided to +// allow you to call whatever debugging system you'd like to call. If you use +// squattingmonk's debug utility, no changes need to be made. The primary system does +// not provide any organic debug calls, but this function is available to all formfiles +// for debugging purposes. +// +const int NUI_DEBUG_SEVERITY_NONE = 0; +const int NUI_DEBUG_SEVERITY_CRITICAL = 1; +const int NUI_DEBUG_SEVERITY_ERROR = 2; +const int NUI_DEBUG_SEVERITY_WARNING = 3; +const int NUI_DEBUG_SEVERITY_NOTICE = 4; +const int NUI_DEBUG_SEVERITY_DEBUG = 5; + +//#include "util_i_debug" + +void NUI_Debug(string sMessage, int nSeverity = 4) +{ + //Debug(sMessage, nSeverity); +} diff --git a/_module/nss/nui_c_storage.nss b/_module/nss/nui_c_storage.nss new file mode 100644 index 00000000..db78eaa0 --- /dev/null +++ b/_module/nss/nui_c_storage.nss @@ -0,0 +1,225 @@ +/// ---------------------------------------------------------------------------- +/// @file nui_c_storage.nss +/// @author Ed Burke (tinygiant98) +/// @brief Persistent Storage formfile configuration settings +/// ---------------------------------------------------------------------------- + +/// @note Most of the following global/default settings can be overriden on a +/// per-container basis by setting a local variable on the container +/// object as noted in the setting descriptions below. Constants, such as +/// PS_TRUE, PS_NONE, etc. should be used in this configuration file, however, +/// actual values must be used when setting local overrides. Those values +/// are provided below. + +/// @warning This system uses player character UUIDs. This can cause issues in +/// single-player modules if the player-character is not exported and the +/// UUID is not saved to the .bic file. + +/// @brief By default, containers will be saved to a database table referenced +/// by the container object's tag. The saved item data includes the UUID +/// and CD Key of the PC that deposited the item so the same container can +/// be used for multiple PCs. To set a specific (unique) name to use as the +/// table name instead, set a local string called `PS_UNIQUE_ID` on the +/// container object and set it to any unique string. + +/// @brief Determines usage of the `Search` button. +/// Configuration File: +/// PS_TRUE to force players to click the `Search` button +/// before an inventory search will commence. This is a good idea +/// for containers that you expect will have large inventories. +/// PS_FALSE to allow real-time searching as the player types +/// characters into the `Search` textbox. +/// Local Override (int): PS_FORCE_SEARCH_BUTTON +/// 1 = PS_TRUE +/// -1 = PS_FALSE +const int PS_FORCE_SEARCH_BUTTON_DEFAULT = PS_TRUE; + +/// @brief Determines whether item object state is saved to the database. The +/// object state includes variables and effects. +/// Configuration File: +/// PS_TRUE saves the object state +/// PS_FALSE does not save the object state +/// Local Override (int): PS_FORCE_OBJECT_STATE +/// 1 = PS_TRUE +/// -1 = PS_FALSE +const int PS_FORCE_OBJECT_STATE_DEFAULT = PS_TRUE; + +/// @brief Sets the item storage limit. +/// Configuration File: +/// PS_UNLIMITED to allow unlimited item storage. +/// Set to any positive integer to limit item storage to that amount. +/// Local Override (int): PS_STORAGE_LIMIT +/// -1 = PS_UNLIMITED +/// Set to any positive integer to limit item storage to that amount. +const int PS_STORAGE_LIMIT_DEFAULT = 500; + +/// @brief Set the maximum distance (meters) a PC can travel from the container +/// before the form will auto-close. +/// Configuration File: +/// PS_UNLIMITED_DISTANCE to never auto-close the form +/// Set to any positive float to limit distance to that amount. +/// Local Override (float): PS_DISTANCE +/// -1.0 = PS_UNLIMITED_DISTANCE +/// Set to any positive float to limit distance to that amount. +const float PS_DISTANCE_DEFAULT = 5.0; + +/// @brief Set the container access type. Container inventories can be accessed +/// by two methods: exclusive and contentious. +/// - Exclusive: Multiple players may open the same container, but each +/// player will only see items they've previously deposited. Players +/// may only withdraw items they've previously deposited. +/// - Contentious: Multiple players may open the same container. All +/// players will see all items deposited by any player. Any player +/// can remove any item, regardless of who originally deposited the +/// item. +/// +/// Configuration File: +/// PS_ACCESS_EXCLUSIVE for exclusive access +/// PS_ACCESS_CONTENTIOUS for contentious access +/// Local Override (int): PS_ACCESS_TYPE +/// 1 = PS_ACCESS_EXCLUSIVE +/// 2 = PS_ACCESS_CONTENTIOUS +const int PS_ACCESS_TYPE_DEFAULT = PS_ACCESS_EXCLUSIVE; + +/// @brief Set the container type. Containers can be of multiple types: +/// - Public: Any player can open, deposit and withdraw items from this +/// container. Whether they are limited to specific items is dependant +/// on the container's access setting. +/// - Character: Creates a 'portable' storage container for any player +/// character. Any container of this type will hold the same inventory +/// for any specific player. +/// - CD Key: Creates a 'portable' storage container for any characters +/// owned by cd-key associated with the player character. Any container +/// of this type will hold the inventory desposited by any character +/// sharing the player's cd key. +/// +/// Configuration File: +/// PS_CONTAINER_PUBLIC for public. +/// PS_CONTAINER_CHARACTER for per-character. +/// PS_CONTAINER_CD_KEY for per-cdkey. +/// Local Override (int): PS_CONTAINER_TYPE +/// 1 = PS_CONTAINER_PUBLIC +/// 2 = PS_CONTAINER_CHARACTER +/// 3 = PS_CONTAINER_CDKEY +const int PS_CONTAINER_TYPE_DEFAULT = PS_CONTAINER_CDKEY; + +/// @brief Set the default container type, if the container is an item. Containers +/// can be of multiple types: +/// - Public: Any player can open, deposit and withdraw items from this +/// container. Whether they are limited to specific items is dependant +/// on the container's access setting. +/// - Character: Creates a 'portable' storage container for any player +/// character. Any container of this type will hold the same inventory +/// for any specific player. +/// - CD Key: Creates a 'portable' storage container for any characters +/// owned by cd-key associated with the player character. Any container +/// of this type will hold the inventory desposited by any character +/// sharing the player's cd key. +/// +/// Configuration File: +/// PS_CONTAINER_PUBLIC for public. +/// PS_CONTAINER_CHARACTER for per-character. +/// PS_CONTAINER_CD_KEY for per-cdkey. +/// Local Override (int): PS_CONTAINER_TYPE +/// 1 = PS_CONTAINER_PUBLIC +/// 2 = PS_CONTAINER_CHARACTER +/// 3 = PS_CONTAINER_CDKEY +const int PS_CONTAINER_ITEM_TYPE_DEFAULT = PS_CONTAINER_CHARACTER; + +/// @brief Determines whether the player's inventory window will be opened +/// when a container is opened. +/// Configuration File: +/// PS_TRUE to open the inventory window. +/// PS_FALSE to prevent the window from opening. If the inventory +/// window is already open, this will not close it. +/// Local Override (int): PS_OPEN_INVENTORY +/// 1 = PS_TRUE +/// -1 = PS_FALSE +const int PS_OPEN_INVENTORY_DEFAULT = PS_TRUE; + +/// @brief Determines the maximum amount of gold a container can store. +/// If the container is set to store no gold, the form controls that +/// manipulate gold storage will not be visible on the form. +/// Configuration File: +/// PS_UNLIMITED to allow unlimited gold storage. +/// PS_NONE to prevent gold storage. +/// Set to any positive integer to limit gold to that amount. +/// Local Override (int): PS_MAX_GOLD +/// -1 = PS_UNLIMITED +/// -2 = PS_NONE +/// Set to any positive integer to limit gold to that amount. +const int PS_MAX_GOLD_DEFAULT = 1500000; + +/// @note Reference these terms for the following option: +/// Container: A persistent storage object in the game, such as a chest. +/// Container Item: An item which: +/// Can have its own inventory +/// Can be carried in a player's inventory + +/// @brief Determines handling for container objects. Containers can optionally +/// store container items. +/// Configuration File: +/// PS_UNLIMITED to allow storage of an unlimited number of container items. +/// PS_NONE to prevent storage of any container items. +/// Set to any positive integer to limit storage to that number of container +/// items. +/// Local Override (int): PS_MAX_CONTAINER_TIMES +/// -1 = PS_UNLIMITED +/// -2 = PS_NONE +/// Set to any positive integer to limit storage to that number of container +/// items. +const int PS_MAX_CONTAINER_ITEMS_DEFAULT = 100; + +/// @brief Determines how many items can be stored in stored container items. +/// Configuration File: +/// PS_UNLIMITED to allow storage of any number of items within a container +/// item's inventory. This will be naturally limited by the size of +/// the container item's inventory. +/// PS_NONE to prevent any items from being stored in a container item. If +/// container item storage is allow and PS_NONE is used, only empty +/// container items can be stored. +/// Set to any positive integer to limit the number of items stored in +/// the inventory of a container item. +/// Local Override (int): PS_MAX_CONTAINER_ITEMS_INVENTORY +/// -1 = PS_UNLIMITED +/// -2 = PS_NONE +/// Set to any positive integer to limit the number of items stored in +/// the inventory of a container item. +/// +/// @note This configuration option has no effect if PS_MAX_CONTAINER_ITEMS_DEFAULT +/// is set to PS_NONE or its local override is set to -1. +/// @warning Items that fail check involved with container item limitations do +/// not have default messages reported to the player. The item will simply fail +/// to be stored. +const int PS_MAX_CONTAINER_ITEMS_INVENTORY_DEFAULT = 1000; + +/// @brief Creates the form's title. +/// @param oContainer The container object being used. +/// @param oPC The player using oContainer. +/// @note A local string called `PS_TITLE` may be set on the object for easy +/// reference in this function. The function below is an example and may +/// be modified in any way. The returned value will be displayed as the +/// form's title. +string ps_GetFormTitle(object oContainer, object oPC, int nAccess, int nType) +{ + string sTitle; + if ((sTitle = GetLocalString(oContainer, PS_TITLE)) != "") + return sTitle; + else + { + switch (nType) + { + case PS_CONTAINER_PUBLIC: + return GetTag(oContainer); + case PS_CONTAINER_CDKEY: + return GetName(oPC) + "'s Player-Specific Storage"; + case PS_CONTAINER_CHARACTER: + return GetName(oPC) + "'s Character-Specific Storage"; + } + + if (GetIsPC(OBJECT_SELF)) + return GetName(OBJECT_SELF) + "'s Storage"; + } + + return "Persistent Storage"; +} diff --git a/_module/nss/nui_f_storage.nss b/_module/nss/nui_f_storage.nss new file mode 100644 index 00000000..4a33fffc --- /dev/null +++ b/_module/nss/nui_f_storage.nss @@ -0,0 +1,1147 @@ +/// ---------------------------------------------------------------------------- +/// @file nui_f_storage.nss +/// @author Ed Burke (tinygiant98) +/// @brief Persistent Storage formfile +/// ---------------------------------------------------------------------------- + +const string FORM_ID = "persistent_storage"; +const string PS_DATABASE = "nui_ps_data"; +const string FORM_VERSION = "0.2.2"; + +const int PS_ACCESS_EXCLUSIVE = 1; +const int PS_ACCESS_CONTENTIOUS = 2; + +const int PS_CONTAINER_PUBLIC = 1; +const int PS_CONTAINER_CHARACTER = 2; +const int PS_CONTAINER_CDKEY = 3; + +const int PS_CONTAINER_ITEMS_NONE = 1; +const int PS_CONTAINER_ITEMS_ANY = 2; + +const int PS_UNLIMITED = -1; +const int PS_NONE = -2; + +const int PS_TRUE = 1; +const int PS_FALSE = -1; + +const float PS_UNLIMITED_DISTANCE = -1.0; + +const string PS_TITLE = "PS_TITLE"; +const string PS_FORCE_SEARCH_BUTTON = "PS_FORCE_SEARCH_BUTTON"; +const string PS_FORCE_OBJECT_STATE = "PS_FORCE_OBJECT_STATE"; +const string PS_STORAGE_LIMIT = "PS_STORAGE_LIMIT"; +const string PS_DISTANCE = "PS_DISTANCE"; +const string PS_UNIQUE_ID = "PS_UNIQUE_ID"; +const string PS_ACCESS_TYPE = "PS_ACCESS_TYPE"; +const string PS_CONTAINER_TYPE = "PS_CONTAINER_TYPE"; +const string PS_OPEN_INVENTORY = "PS_OPEN_INVENTORY"; +const string PS_MAX_GOLD = "PS_MAX_GOLD"; +const string PS_MAX_CONTAINER_ITEMS = "PS_MAX_CONTAINER_ITEMS"; +const string PS_MAX_CONTAINER_ITEMS_INVENTORY = "PS_MAX_CONTAINER_ITEMS_INVENTORY"; +const string PS_ORIGINAL_NAME = "PS_ORIGINAL_NAME"; + +const string PS_DESTROYED = "PS_DESTROYED"; + +const string PS_TARGETING_MODE = "PS_TARGETING_MODE"; +const string PS_SEARCH_STRING = "PS_SEARCH_STRING"; + +const string PS_CONTAINER = "PS_CONTAINER"; + +const string PS_GEOMETRY = "PS_GEOMETRY"; +const string PS_UUID_ARRAY = "PS_UUID_ARRAY"; +const string PS_USERS = "PS_USERS"; + +#include "nui_i_library" +#include "util_i_strings" +#include "nui_c_storage" +#include "util_i_varlists" + +object ps_GetContainer(object oPC) +{ + return GetLocalObject(oPC, PS_CONTAINER); +} + +int ps_GetLocalIntOrDefault(object oPC, string sVarName, int nDefault) +{ + object oContainer = GetIsPC(oPC) ? ps_GetContainer(oPC) : oPC; + int n = GetLocalInt(oContainer, sVarName); + return n ? n : nDefault; +} + +string ps_GetLocalStringOrDefault(object oPC, string sVarName, string sDefault) +{ + object oContainer = GetIsPC(oPC) ? ps_GetContainer(oPC) : oPC; + string s = GetLocalString(oContainer, sVarName); + return s != "" ? s : sDefault; +} + +float ps_GetLocalFloatOrDefault(object oPC, string sVarName, float fDefault) +{ + object oContainer = GetIsPC(oPC) ? ps_GetContainer(oPC) : oPC; + float f = GetLocalFloat(oContainer, sVarName); + return f != 0.0 ? f : fDefault; +} + +string ps_GetContainerID(object oPC) +{ + return ps_GetLocalStringOrDefault(oPC, PS_UNIQUE_ID, GetTag(ps_GetContainer(oPC))); +} + +int ps_GetUseSearchButton(object oPC) +{ + return ps_GetLocalIntOrDefault(oPC, PS_FORCE_SEARCH_BUTTON, PS_FORCE_SEARCH_BUTTON_DEFAULT) == PS_TRUE; +} + +int ps_GetSaveObjectState(object oPC) +{ + return ps_GetLocalIntOrDefault(oPC, PS_FORCE_OBJECT_STATE, PS_FORCE_OBJECT_STATE_DEFAULT) == PS_TRUE; +} + +int ps_GetContainerType(object oPC) +{ + int nType = GetLocalInt(oPC, PS_CONTAINER_TYPE); + object oContainer = ps_GetContainer(oPC); + + if (!nType && GetObjectType(oContainer) == OBJECT_TYPE_ITEM) + return PS_CONTAINER_ITEM_TYPE_DEFAULT; + else + return PS_CONTAINER_TYPE_DEFAULT; +} + +int ps_GetAccessType(object oPC) +{ + return ps_GetLocalIntOrDefault(oPC, PS_ACCESS_TYPE, PS_ACCESS_TYPE_DEFAULT); +} + +int ps_GetMaxItems(object oPC) +{ + return ps_GetLocalIntOrDefault(oPC, PS_STORAGE_LIMIT, PS_STORAGE_LIMIT_DEFAULT); +} + +int ps_GetMaxContainerItems(object oPC) +{ + return ps_GetLocalIntOrDefault(oPC, PS_MAX_CONTAINER_ITEMS, PS_MAX_CONTAINER_ITEMS_DEFAULT); +} + +int ps_GetMaxContainterItemInventory(object oPC) +{ + return ps_GetLocalIntOrDefault(oPC, PS_MAX_CONTAINER_ITEMS_INVENTORY, PS_MAX_CONTAINER_ITEMS_INVENTORY_DEFAULT); +} + +float ps_GetMaxDistance(object oPC) +{ + return ps_GetLocalFloatOrDefault(oPC, PS_DISTANCE, PS_DISTANCE_DEFAULT); +} + +int ps_GetOpenInventory(object oPC) +{ + return ps_GetLocalIntOrDefault(oPC, PS_OPEN_INVENTORY, PS_OPEN_INVENTORY_DEFAULT) == PS_TRUE; +} + +int ps_GetMaxGold(object oPC) +{ + object oContainer = ps_GetContainer(oPC); + if (GetObjectType(oContainer) == OBJECT_TYPE_ITEM) + return PS_NONE; + else + return ps_GetLocalIntOrDefault(oPC, PS_MAX_GOLD, PS_MAX_GOLD_DEFAULT); +} + +object ps_GetFirstUser(object oPC) +{ + return GetListObject(ps_GetContainer(oPC), 0, PS_USERS); +} + +int ps_RemoveUser(object oPC) +{ + return RemoveListObject(ps_GetContainer(oPC), oPC, PS_USERS, TRUE); +} + +string ps_GetOwner(object oPC, string sType = "") +{ + if (ps_GetAccessType(oPC) == PS_ACCESS_CONTENTIOUS && ps_GetContainerType(oPC) != PS_CONTAINER_PUBLIC) + oPC = ps_GetFirstUser(oPC); + + if (sType == "") return GetObjectUUID(oPC) + ":" + GetPCPublicCDKey(oPC, TRUE); + else if (sType == "uuid") return GetObjectUUID(oPC); + else if (sType == "cdkey") return GetPCPublicCDKey(oPC, TRUE); + else return ""; +} + +int ps_GetIsColored(string s) +{ + string sPattern = "***"; + sqlquery sql = SqlPrepareQueryObject(GetModule(), "SELECT @string GLOB @pattern;"); + SqlBindString(sql, "@string", s); + SqlBindString(sql, "@pattern", sPattern); + return SqlStep(sql) ? SqlGetInt(sql, 0) : FALSE; +} + +void ps_BeginTransaction() +{ + SqlStep(SqlPrepareQueryCampaign(PS_DATABASE, "BEGIN TRANSACTION;")); +} + +void ps_CommitTransaction() +{ + SqlStep(SqlPrepareQueryCampaign(PS_DATABASE, "COMMIT TRANSACTION;")); +} + +sqlquery ps_PrepareQuery(string sQuery) +{ + return SqlPrepareQueryCampaign(PS_DATABASE, sQuery); +} + +string ps_GetTableName(object oPC) +{ + return ps_GetContainerID(oPC); +} + +void ps_InitializeDatabase(object oPC) +{ + string sTable = ps_GetTableName(oPC); + string sQuery = "SELECT name FROM sqlite_master WHERE type='table' AND name = @table;"; + sqlquery sql = ps_PrepareQuery(sQuery); + SqlBindString(sql, "@table", sTable); + + if (!SqlStep(sql)) + { + sQuery = + "CREATE TABLE IF NOT EXISTS " + sTable + " (" + + "owner TEXT NOT NULL DEFAULT '', " + + "item_uuid TEXT NOT NULL DEFAULT '', " + + "item_name TEXT NOT NULL DEFAULT '', " + + "item_baseitem INTEGER NOT NULL DEFAULT '', " + + "item_stacksize INTEGER NOT NULL DEFAULT '', " + + "item_iconresref TEXT NOT NULL DEFAULT '', " + + "item_data TEXT_NOT NULL DEFAULT '', " + + "PRIMARY KEY(owner, item_uuid));"; + SqlStep(ps_PrepareQuery(sQuery)); + } +} + +void ps_EnterDepositMode(object oPC) +{ + SetLocalInt(oPC, PS_TARGETING_MODE, TRUE); + EnterTargetingMode(oPC, OBJECT_TYPE_ITEM); +} + +int ps_CountStoredItems(object oPC) +{ + string sAnd, sOwner; + + int nType = ps_GetContainerType(oPC); + if (nType == PS_CONTAINER_CHARACTER || nType == PS_CONTAINER_CDKEY) + { + sAnd = " AND owner GLOB @owner"; + if (nType == PS_CONTAINER_CHARACTER) sOwner = ps_GetOwner(oPC, "uuid") + ":*"; + else sOwner = "*:" + ps_GetOwner(oPC, "cdkey"); + } + + string sQuery = + "SELECT COUNT(*) FROM " + ps_GetTableName(oPC) + " " + + "WHERE item_uuid != 'gold'" + sAnd + ";"; + sqlquery sql = ps_PrepareQuery(sQuery); + + if (sAnd != "") + SqlBindString(sql, "@owner", sOwner); + + return SqlStep(sql) ? SqlGetInt(sql, 0) : 0; +} + +int ps_CountStoredGold(object oPC) +{ + int nType = ps_GetContainerType(oPC); + string sWhere = (nType == PS_CONTAINER_PUBLIC ? "" : " AND owner GLOB @owner"); + + string sQuery = + "SELECT SUM(item_stacksize) FROM " + ps_GetTableName(oPC) + " " + + "WHERE item_uuid == 'gold'" + sWhere + ";"; + sqlquery sql = ps_PrepareQuery(sQuery); + + if (nType == PS_CONTAINER_CHARACTER) SqlBindString(sql, "@owner", ps_GetOwner(oPC, "uuid") + ":*"); + else if (nType == PS_CONTAINER_CDKEY) SqlBindString(sql, "@owner", "*:" + ps_GetOwner(oPC, "cdkey")); + + return SqlStep(sql) ? SqlGetInt(sql, 0) : 0; +} + +string ps_GetIconResref(object oItem, json jItem, int nBaseItem) +{ + if (nBaseItem == BASE_ITEM_CLOAK) + return "iit_cloak"; + else if (nBaseItem == BASE_ITEM_SPELLSCROLL || nBaseItem == BASE_ITEM_ENCHANTED_SCROLL) + { + if (GetItemHasItemProperty(oItem, ITEM_PROPERTY_CAST_SPELL)) + { + itemproperty ip = GetFirstItemProperty(oItem); + while (GetIsItemPropertyValid(ip)) + { + if (GetItemPropertyType(ip) == ITEM_PROPERTY_CAST_SPELL) + return Get2DAString("iprp_spells", "Icon", GetItemPropertySubType(ip)); + + ip = GetNextItemProperty(oItem); + } + } + } + else if (Get2DAString("baseitems", "ModelType", nBaseItem) == "0") + { + json jSimpleModel = JsonPointer(jItem, "/ModelPart1/value"); + if (JsonGetType(jSimpleModel) == JSON_TYPE_INTEGER) + { + string sSimpleModelId = IntToString(JsonGetInt(jSimpleModel)); + while (GetStringLength(sSimpleModelId) < 3) + sSimpleModelId = "0" + sSimpleModelId; + + string sDefaultIcon = Get2DAString("baseitems", "DefaultIcon", nBaseItem); + switch (nBaseItem) + { + case BASE_ITEM_MISCSMALL: + case BASE_ITEM_CRAFTMATERIALSML: + sDefaultIcon = "iit_smlmisc_" + sSimpleModelId; + break; + case BASE_ITEM_MISCMEDIUM: + case BASE_ITEM_CRAFTMATERIALMED: + case 112: + sDefaultIcon = "iit_midmisc_" + sSimpleModelId; + break; + case BASE_ITEM_MISCLARGE: + sDefaultIcon = "iit_talmisc_" + sSimpleModelId; + break; + case BASE_ITEM_MISCTHIN: + sDefaultIcon = "iit_thnmisc_" + sSimpleModelId; + break; + } + + int nLength = GetStringLength(sDefaultIcon); + if (GetSubString(sDefaultIcon, nLength - 4, 1) == "_") + sDefaultIcon = GetStringLeft(sDefaultIcon, nLength - 4); + + string sIcon = sDefaultIcon + "_" + sSimpleModelId; + if (ResManGetAliasFor(sIcon, RESTYPE_TGA) != "") + return sIcon; + } + } + + return Get2DAString("baseitems", "DefaultIcon", nBaseItem); +} + +string ps_FormatGold(int nGold, int nForce = FALSE) +{ + if (nGold < 100000 || nForce) + return FormatInt(nGold, "%,d"); + else if (nGold >= 1000000) + return FormatFloat(nGold / 1000000.0, "%.1fM"); + else + return FormatFloat(nGold / 1000.0, "%.1fk"); +} + +void ps_UpdateGoldBinds(object oPC, int nToken, int nTotal = -1) +{ + if (nTotal == -1) + nTotal = ps_CountStoredGold(oPC); + + NuiSetBind(oPC, nToken, "gold_stored", JsonInt(nTotal)); + NuiSetBind(oPC, nToken, "gold_stored_label", JsonString("Gold: " + ps_FormatGold(nTotal))); + + if (nTotal > 100000) + NuiSetBind(oPC, nToken, "gold_stored_tooltip", JsonString(ps_FormatGold(nTotal, TRUE))); + else + NuiSetBind(oPC, nToken, "gold_stored_tooltip", JsonString("")); + + int nGold = GetGold(oPC); + + NuiSetBind(oPC, nToken, "btn_withdraw_gold", JsonBool(nTotal > 0)); + NuiSetBind(oPC, nToken, "btn_deposit_gold", JsonBool(nGold > 0)); + + int nAmount = StringToInt(JsonGetString(NuiGetBind(oPC, nToken, "gold_amount"))); + int nWithdraw = nAmount <= 0 || nAmount > nTotal ? nTotal : nAmount; + int nDeposit = nAmount <= 0 || nAmount > nGold ? min(ps_GetMaxGold(oPC) - nTotal, nGold) : nAmount; + + NuiSetBind(oPC, nToken, "btn_withdraw_tooltip", JsonString("Withdraw " + ps_FormatGold(nWithdraw, TRUE) + " gold")); + NuiSetBind(oPC, nToken, "btn_deposit_tooltip", JsonString("Deposit " + ps_FormatGold(nDeposit, TRUE) + " gold")); + NuiSetBind(oPC, nToken, "txt_gold_amount", JsonBool(nGold > 0 || nTotal > 0)); +} + +/// @private Updates the amount of gold stored in a container. If the container +/// doesn't allow gold, no action is taken. Stored gold will be updated +/// *by* nGold, not *to* nGold. +/// @param nGold can be positive, negative. `0` is a special case to zero-out +/// the gold in the container (withdrawing all gold) for the owning character +int ps_UpdateGold(object oPC, int nToken, int nGold) +{ + if (ps_GetMaxGold(oPC) <= PS_NONE) return FALSE; + + string sGold = (nGold == 0 ? "@nGold" : "item_stacksize + @nGold"); + string sQuery = + "INSERT INTO " + ps_GetTableName(oPC) + + "(owner, item_uuid, item_baseitem, item_stacksize) " + + "VALUES (@owner, @item_uuid, @item_baseitem, @item_stacksize) " + + "ON CONFLICT (owner, item_uuid) DO UPDATE " + + "SET item_stacksize = " + sGold + ";"; + + sqlquery sql = ps_PrepareQuery(sQuery); + SqlBindString(sql, "@owner", ps_GetOwner(oPC)); + SqlBindString(sql, "@item_uuid", "gold"); + SqlBindInt (sql, "@item_baseitem", BASE_ITEM_GOLD); + SqlBindInt (sql, "@item_stacksize", nGold); + SqlBindInt (sql, "@nGold", nGold); + + SqlStep(sql); + + ps_UpdateGoldBinds(oPC, nToken); + return nGold; +} + +int ps_WithdrawGold(object oPC, int nToken, int nGold) +{ + if (ps_GetMaxGold(oPC) <= PS_NONE) return FALSE; + + if (ps_GetContainerType(oPC) != PS_CONTAINER_PUBLIC) + return ps_UpdateGold(oPC, nToken, -nGold); + + string sTable = ps_GetTableName(oPC); + string sQuery = + "DELETE FROM " + sTable + " WHERE ROWID IN (SELECT ROWID FROM " + sTable + " t1 " + + "WHERE (SELECT SUM(t2.item_stacksize) FROM " + sTable + " t2 WHERE t1.item_stacksize >= " + + "t2.item_stacksize) <= @target ORDER BY t1.item_stacksize ASC) AND item_uuid = 'gold' " + + "RETURNING item_stacksize;"; + sqlquery sql = ps_PrepareQuery(sQuery); + SqlBindInt(sql, "@target", nGold); + + int nRemoved, nRecords; + while (SqlStep(sql)) + { + nRemoved += SqlGetInt(sql, 0); + nRecords++; + } + + if (!nRecords || nGold - nRemoved > 0) + { + sQuery = + "UPDATE " + sTable + " SET item_stacksize = item_stacksize - @gold " + + "WHERE ROWID IN (SELECT ROWID FROM " + sTable + " WHERE item_stacksize >= " + + "@gold AND item_uuid = 'gold' ORDER BY RANDOM() LIMIT 1);"; + sql = ps_PrepareQuery(sQuery); + SqlBindInt(sql, "@gold", nGold - nRemoved); + SqlStep(sql); + } + + return TRUE; +} + +void ps_UpdateItemList(object oPC, int nFlag = FALSE) +{ + /// @note This NUI_DisplaySubform only exists because of an nui issue where shortening a array bound to a listbox + /// a sufficient amount while scrolled near the bottom results in an nui error. To fix this issue, the listbox + /// is implemented as a subform and reloaded here each time this function is called. It effectively fixes the + /// problem, but should be removed when .35 is stable. See additional sections affected by this in DefineForm(). + NUI_DisplaySubform(oPC, FORM_ID, "grpItems", "lstItems"); + + string sAnd, sSearch = GetLocalString(oPC, PS_SEARCH_STRING); + int n, nItems, nGold, nType = ps_GetContainerType(oPC); + int nToken = NUI_GetFormToken(oPC, FORM_ID); + + string sWhere = (nType == PS_CONTAINER_PUBLIC ? "" : " AND owner GLOB @owner"); + json jWhere = JsonArrayInsert(JsonArray(), JsonString(sWhere)); + sWhere += (sSearch == "" ? "" : " AND lower(item_name) GLOB @item"); + jWhere = JsonArrayInsert(jWhere, JsonString(sWhere)); + + string sTable = ps_GetTableName(oPC); + + string sQuery = + "WITH gold AS (SELECT SUM(item_stacksize) pieces FROM " + sTable + " WHERE item_uuid == 'gold'$1 ), " + + "items AS (SELECT item_uuid, IIF(item_stacksize > 1, item_name || ' (x' || item_stacksize || ')', item_name) name, " + + "item_iconresref, json('false') selected FROM " + sTable + " WHERE item_uuid != 'gold'$2 " + + "ORDER BY item_name ASC, item_baseitem ASC) SELECT COUNT(items.item_uuid) items, gold.pieces, " + + "IIF(json_group_array(item_uuid) == json_array(null), json_array(), json_group_array(item_uuid)) uuid, " + + "IIF(json_group_array(name) == json_array(null), json_array(), json_group_array(name)) name, " + + "IIF(json_group_array(item_iconresref) == json_array(null), json_array(), json_group_array(item_iconresref)) resref, " + + "IIF(json_group_array(json(selected)) == json_array(null), json_array(), json_group_array(json(selected))) selected " + + "FROM gold LEFT JOIN items;"; + + sqlquery sql = ps_PrepareQuery(SubstituteString(sQuery, jWhere)); + + if (sSearch != "") SqlBindString(sql, "@item", "*" + GetStringLowerCase(sSearch) + "*"); + + if (nType == PS_CONTAINER_CHARACTER) SqlBindString(sql, "@owner", ps_GetOwner(oPC, "uuid") + ":*"); + else if (nType == PS_CONTAINER_CDKEY) SqlBindString(sql, "@owner", "*:" + ps_GetOwner(oPC, "cdkey")); + + if (SqlStep(sql)) + { + nItems = SqlGetInt(sql, 0); + nGold = SqlGetInt(sql, 1); + SetLocalJson(oPC, PS_UUID_ARRAY, SqlGetJson(sql, 2)); + NuiSetBind(oPC, nToken, "names", SqlGetJson(sql, 3)); + NuiSetBind(oPC, nToken, "icons", SqlGetJson(sql, 4)); + NuiSetBind(oPC, nToken, "selected", SqlGetJson(sql, 5)); + } + + int nMax = ps_GetMaxItems(oPC); + if (nMax >= 0) + { + string sColor; + float f = nItems * 1.0 / nMax; + + if (f > 0.9) sColor = NUI_DefineHexColor(COLOR_RED); + else if (f > 0.75) sColor = NUI_DefineHexColor(COLOR_YELLOW); + else sColor = NUI_DefineHexColor(COLOR_GREEN); + + NuiSetBind(oPC, nToken, "progress", JsonFloat(f)); + NuiSetBind(oPC, nToken, "progress_color", JsonParse(sColor)); + NuiSetBind(oPC, nToken, "progress_tooltip", JsonString(IntToString(nItems) + " of " + IntToString(nMax) + " items stored")); + } + else + { + NuiSetBind(oPC, nToken, "progress", JsonFloat(0.0)); + NuiSetBind(oPC, nToken, "progress_tooltip", JsonString("This container has unlimited item storage")); + } + + NuiSetBind(oPC, nToken, "btn_withdraw", JsonBool(FALSE)); + NuiSetBind(oPC, nToken, "btn_withdraw_all", JsonBool(nItems > 0 && ps_GetAccessType(oPC) != PS_ACCESS_CONTENTIOUS)); + NuiSetBind(oPC, nToken, "btn_deposit", JsonBool(nItems < nMax || nMax <= 0)); + + ps_UpdateGoldBinds(oPC, nToken, nGold); + + if (!nFlag && ps_GetAccessType(oPC) == PS_ACCESS_CONTENTIOUS) + { + object oContainer = ps_GetContainer(oPC); + int n; for (n; n < CountObjectList(oContainer, PS_USERS); n++) + { + object oUser = GetListObject(oContainer, n, PS_USERS); + if (oUser != oPC && NuiFindWindow(oUser, FORM_ID)) + ps_UpdateItemList(oUser, TRUE); + } + } +} + +int ps_CountInventoryItems(object oContainer) +{ + int n; + object oItem = GetFirstItemInInventory(oContainer); + while (GetIsObjectValid(oItem)) + { + n++; + oItem = GetNextItemInInventory(oContainer); + } + + return n; +} + +int ps_CountContainerItems(object oPC) +{ + string sQuery = "SELECT COUNT(*) FROM " + ps_GetTableName(oPC) + " " + + "WHERE item_data != '' AND json_extract(item_data, '$.ItemList') IS NOT NULL;"; + sqlquery sql = ps_PrepareQuery(sQuery); + return SqlStep(sql) ? SqlGetInt(sql, 0) : 0; +} + +int ps_DepositContainerItem(object oPC, object oItem) +{ + if (!GetHasInventory(oItem)) + return TRUE; + + int nMaxContainerItems = ps_GetMaxContainerItems(oPC); + if (nMaxContainerItems <= PS_NONE) + return FALSE; + else + { + if (nMaxContainerItems == PS_UNLIMITED || ps_CountContainerItems(oPC) < nMaxContainerItems) + { + int nMaxItems = ps_GetMaxContainterItemInventory(oPC); + if (nMaxItems == PS_UNLIMITED) + return TRUE; + else + { + if (nMaxItems == PS_NONE) + return !GetIsObjectValid(GetFirstItemInInventory(oItem)); + else + return ps_CountInventoryItems(oItem) <= nMaxItems; + } + } + else + return FALSE; + } +} + +void ps_DepositItem(object oPC, object oItem) +{ + DeleteLocalInt(oPC, PS_TARGETING_MODE); + + if (!GetIsObjectValid(oItem) || GetLocalInt(oItem, PS_DESTROYED) || GetObjectType(oItem) != OBJECT_TYPE_ITEM) + return; + + if (GetItemCursedFlag(oItem) || GetItemPossessor(oItem) != oPC) + return; + + int nStoredItems = ps_CountStoredItems(oPC); + int nMaxItems = ps_GetMaxItems(oPC); + if (nMaxItems > 0 && nStoredItems >= nMaxItems) + { + SendMessageToPC(oPC, "Your storage is full, withdraw an item first."); + return; + } + + if (!ps_DepositContainerItem(oPC, oItem)) + return; + + int nItemBaseItem = GetBaseItemType(oItem); + string sItemName = GetIdentified(oItem) ? GetName(oItem) : GetStringByStrRef(StringToInt(Get2DAString("baseitems", "Name", nItemBaseItem))) + " (Unidentified)"; + json jItemData = ObjectToJson(oItem, ps_GetSaveObjectState(oPC)); + + if (ps_GetIsColored(sItemName)) + { + JsonObjectSet(jItemData, PS_ORIGINAL_NAME, JsonString(sItemName)); + sItemName = UnColorString(sItemName); + } + + string sQuery = + "INSERT INTO " + ps_GetTableName(oPC) + + "(owner, item_uuid, item_name, item_baseitem, item_stacksize, item_iconresref, item_data) " + + "VALUES(@owner, @item_uuid, @item_name ->> '$', @item_baseitem, @item_stacksize, @item_iconresref, @item_data) " + + "RETURNING item_uuid;"; + sqlquery sql = ps_PrepareQuery(sQuery); + + SqlBindString(sql, "@owner", ps_GetOwner(oPC)); + SqlBindString(sql, "@item_uuid", GetObjectUUID(oItem)); + SqlBindJson (sql, "@item_name", JsonString(sItemName)); + SqlBindInt (sql, "@item_baseitem", nItemBaseItem); + SqlBindInt (sql, "@item_stacksize", GetItemStackSize(oItem)); + SqlBindString(sql, "@item_iconresref", ps_GetIconResref(oItem, jItemData, nItemBaseItem)); + SqlBindJson (sql, "@item_data", jItemData); + + if (SqlStep(sql)) + { + if (SqlGetString(sql, 0) == "") + { + NUI_Debug("Error depositing item!", NUI_DEBUG_SEVERITY_ERROR); + return; + } + } + + SetLocalInt(oItem, PS_DESTROYED, TRUE); + DestroyObject(oItem); + + ps_UpdateItemList(oPC); + if (++nStoredItems <= nMaxItems || nMaxItems <= 0) + ps_EnterDepositMode(oPC); +} + +/// @private void version of JsonToObject to prevent mass-withdraw overflow errors. +void ps_JsonToObject(json jObject, location l, object oOwner, int nObjectState) +{ + object oItem = JsonToObject(jObject, l, oOwner, nObjectState); + json jName = JsonObjectGet(jObject, PS_ORIGINAL_NAME); + + if (jName != JsonNull()) + SetName(oItem, JsonGetString(jName)); +} + +void ps_WithdrawItems(object oPC, int nToken, int bForceAll = FALSE) +{ + json jUUIDs = GetLocalJson(oPC, PS_UUID_ARRAY); + if (!JsonGetLength(jUUIDs)) + return; + + string sWhere = (bForceAll ? "" : " WHERE truths.value = true"); + + string sQuery = + "WITH truths AS (SELECT ROWID, value FROM json_each(@truths)), " + + " uuids AS (SELECT rowid, value FROM json_each(@uuids)) " + + "DELETE FROM " + ps_GetTableName(oPC) + " WHERE item_uuid IN " + + "(SELECT uuids.value FROM uuids INNER JOIN truths ON uuids.ROWID " + + "= truths.ROWID" + sWhere + ") RETURNING item_data;"; + + sqlquery sql = ps_PrepareQuery(sQuery); + SqlBindJson(sql, "@uuids", jUUIDs); + SqlBindJson(sql, "@truths", NuiGetBind(oPC, nToken, "selected")); + + ps_BeginTransaction(); + + location l = GetLocation(oPC); + int nState = ps_GetSaveObjectState(oPC); + + while (SqlStep(sql)) + { + json j = SqlGetJson(sql, 0); + DelayCommand(0.0, ps_JsonToObject(j, l, oPC, nState)); + } + + ps_UpdateItemList(oPC); + ps_CommitTransaction(); +} + +void ps_OnFormOpen() +{ + ps_InitializeDatabase(OBJECT_SELF); + + object oContainer = ps_GetContainer(OBJECT_SELF); + int nAccess = ps_GetAccessType(OBJECT_SELF); + int nType = ps_GetContainerType(OBJECT_SELF); + + NUI_SetBind(OBJECT_SELF, FORM_ID, "title", nuiString(ps_GetFormTitle(oContainer, OBJECT_SELF, nAccess, nType))); + + if (ps_GetOpenInventory(OBJECT_SELF)) + PopUpGUIPanel(OBJECT_SELF, GUI_PANEL_INVENTORY); + + ps_UpdateItemList(OBJECT_SELF); +} + +void ps_OnFormClose() +{ + if (ps_GetAccessType(OBJECT_SELF) == PS_ACCESS_CONTENTIOUS) + ps_RemoveUser(OBJECT_SELF); + + DeleteLocalInt(OBJECT_SELF, PS_TARGETING_MODE); + DeleteLocalString(OBJECT_SELF, PS_SEARCH_STRING); + DeleteLocalJson(OBJECT_SELF, PS_UUID_ARRAY); + DeleteLocalObject(OBJECT_SELF, PS_CONTAINER); +} + +void BindForm() +{ + json jBinds = NUI_GetOrphanBinds(FORM_ID); + int n; for (n; n < JsonGetLength(jBinds); n++) + { + string sValue, sBind = JsonGetString(JsonArrayGet(jBinds, n)); + json jValue = JsonNull(); + + if (sBind == "search") sValue = nuiString(""); + + if (sValue != "") + NUI_SetBind(OBJECT_SELF, FORM_ID, sBind, sValue); + else if (jValue != JsonNull()) + NUI_SetBindJ(OBJECT_SELF, FORM_ID, sBind, jValue); + } +} + +void DefineForm() +{ + float fRowHeight = 30.0; + + NUI_CreateForm(FORM_ID, FORM_VERSION); + NUI_SetTOCTitle("Peristent Storage"); + NUI_SetResizable(FALSE); + NUI_SubscribeEvent(EVENT_SCRIPT_MODULE_ON_PLAYER_TARGET); + NUI_SubscribeEvent(EVENT_SCRIPT_PLACEABLE_ON_USED); + NUI_SubscribeEvent(EVENT_SCRIPT_PLACEABLE_ON_OPEN); + NUI_SubscribeEvent(EVENT_SCRIPT_PLACEABLE_ON_CLOSED); + NUI_SubscribeEvent(EVENT_SCRIPT_MODULE_ON_ACTIVATE_ITEM); + { + NUI_AddRow(); + NUI_AddColumn(); + NUI_SetWidth(350.0); + + NUI_AddRow(); + NUI_SetHeight(20.0); + NUI_SetMargin(0.0); + + NUI_AddProgressBar(); + NUI_BindTooltip("progress_tooltip"); + NUI_BindValue("progress"); + NUI_BindForegroundColor("progress_color"); + NUI_CloseRow(); + + NUI_AddRow(); + NUI_SetHeight(fRowHeight); + NUI_SetMargin(0.0); + + NUI_AddTextbox(); + NUI_SetPlaceholder("Search..."); + NUI_BindValue("search", TRUE); + NUI_SetLength(64); + NUI_SetMultiline(FALSE); + NUI_AddCommandButton("btn_clear"); + NUI_SetLabel("X"); + NUI_BindEnabled("btn_clear"); + NUI_SetTooltip("Clear search criteria"); + NUI_SetWidth(35.0); + NUI_AddCommandButton("btn_search"); + NUI_SetLabel("Search"); + NUI_SetWidth(60.0); + NUI_BindEnabled("btn_search"); + NUI_SetTooltip("Search item list by criteria"); + NUI_SetDisabledTooltip("Live search enabled"); + NUI_CloseRow(); + + /// @note Due to the list size issue with NUI in .34, the item listbox had to be + /// implemented as a subform. The commented out section immediately below + /// this AddRow() block is the original implementation and should be reinstanted + /// once (if?) .35 is stable. Additionally, remove the subform definition + /// below. + NUI_AddRow(); + NUI_SetHeight(288.0); + NUI_SetMargin(0.0); + + NUI_AddGroup("grpItems"); + NUI_SetBorder(TRUE); + NUI_SetScrollbars(NUI_SCROLLBARS_NONE); + { + NUI_AddSpacer(); + } NUI_CloseGroup(); + NUI_CloseRow(); + + /* + NUI_AddRow(); + NUI_AddListbox(); + NUI_BindRowCount("icons"); + NUI_SetRowHeight(32.0); + { + NUI_AddGroup(); + NUI_SetBorder(TRUE); + NUI_SetScrollbars(NUI_SCROLLBARS_NONE); + NUI_SetTemplateWidth(32.0); + NUI_SetTemplateVariable(FALSE); + { + NUI_AddImage(); + NUI_BindResref("icons"); + NUI_SetAspect(NUI_ASPECT_FIT); + NUI_SetHorizontalAlignment(NUI_HALIGN_CENTER); + NUI_SetVerticalAlignment(NUI_VALIGN_MIDDLE); + } NUI_CloseGroup(); + NUI_AddCheckbox(); + NUI_BindLabel("names"); + NUI_BindValue("selected"); + } NUI_CloseListbox(); + NUI_CloseRow(); + */ + + NUI_AddRow(); + NUI_SetHeight(fRowHeight); + NUI_SetMargin(0.0); + + NUI_AddCommandButton("btn_withdraw"); + NUI_SetLabel("Withdraw"); + NUI_BindEnabled("btn_withdraw"); + NUI_SetTooltip("Withdraw selected items"); + NUI_SetDisabledTooltip("No items selected for withdrawal"); + NUI_SetWidth(100.0); + NUI_AddCommandButton("btn_withdraw_all"); + NUI_SetLabel("All"); + NUI_BindEnabled("btn_withdraw_all"); + NUI_SetTooltip("Withdraw all items"); + NUI_SetDisabledTooltip("No items available for withdrawal"); + NUI_SetWidth(45.0); + NUI_AddSpacer(); + NUI_AddCommandButton("btn_deposit"); + NUI_SetLabel("Deposit"); + NUI_BindEnabled("btn_deposit"); + NUI_SetTooltip("Select an item to deposit"); + NUI_SetWidth(100.0); + NUI_CloseRow(); + + NUI_AddRow(); + NUI_SetHeight(8.0); + NUI_CloseRow(); + + NUI_AddRow(); + NUI_SetHeight(fRowHeight); + NUI_BindVisible("showGold"); + NUI_SetMargin(0.0); + + NUI_AddGroup(); + NUI_SetBorder(TRUE); + NUI_SetScrollbars(NUI_SCROLLBARS_NONE); + NUI_SetWidth(100.0); + NUI_BindTooltip("gold_stored_tooltip"); + { + NUI_AddLabel(); + NUI_BindLabel("gold_stored_label"); + NUI_SetForegroundColor(NUI_DefineHexColor(COLOR_GOLD)); + NUI_SetHorizontalAlignment(NUI_HALIGN_LEFT); + NUI_SetVerticalAlignment(NUI_VALIGN_MIDDLE); + } NUI_CloseGroup(); + + NUI_AddTextbox(); + NUI_SetPlaceholder("Amount..."); + NUI_BindEnabled("txt_gold_amount"); + NUI_BindValue("gold_amount", TRUE); + NUI_BindTooltip("gold_amount_tooltip"); + NUI_SetLength(64); + NUI_SetMultiline(FALSE); + + NUI_AddCommandButton("btn_withdraw_gold"); + NUI_SetLabel("Withdraw"); + NUI_BindEnabled("btn_withdraw_gold"); + NUI_BindTooltip("btn_withdraw_tooltip"); + NUI_SetWidth(75.0); + + NUI_AddCommandButton("btn_deposit_gold"); + NUI_SetLabel("Deposit"); + NUI_BindEnabled("btn_deposit_gold"); + NUI_BindTooltip("btn_deposit_tooltip"); + NUI_SetWidth(75.0); + NUI_CloseRow(); + NUI_CloseColumn(); + NUI_CloseRow(); + } + + /// @note Remove this subform definition when .35 is stable. + NUI_CreateSubform("lstItems"); + { + NUI_AddRow(); + NUI_AddListbox(); + NUI_BindRowCount("icons"); + NUI_SetRowHeight(32.0); + NUI_SetBorder(FALSE); + { + NUI_AddGroup(); + NUI_SetBorder(TRUE); + NUI_SetScrollbars(NUI_SCROLLBARS_NONE); + NUI_SetTemplateWidth(32.0); + NUI_SetTemplateVariable(FALSE); + { + NUI_AddImage(); + NUI_BindResref("icons"); + NUI_SetAspect(NUI_ASPECT_FIT); + NUI_SetHorizontalAlignment(NUI_HALIGN_CENTER); + NUI_SetVerticalAlignment(NUI_VALIGN_MIDDLE); + } NUI_CloseGroup(); + NUI_AddCheckbox(); + NUI_BindLabel("names"); + NUI_BindValue("selected", TRUE); + } NUI_CloseListbox(); + NUI_CloseRow(); + } + + NUI_CreateDefaultProfile(); + { + NUI_SetProfileBind("geometry", NUI_DefineRectangle(360.0, 0.0, 370.0, 470.0)); + NUI_SetProfileBind("search", nuiString("")); + NUI_SetProfileBind("showGold", nuiBool(TRUE)); + NUI_SetProfileBind("showDMPanel", nuiBool(FALSE)); + } + + NUI_CreateProfile("noGold"); + { + NUI_SetProfileBind("showGold", nuiBool(FALSE)); + } +} + +void HandleNUIEvents() +{ + struct NUIEventData ed = NUI_GetEventData(); + + if (ed.sEvent == "click") + { + if (ed.sControlID == "btn_withdraw") + ps_WithdrawItems(ed.oPC, ed.nToken); + else if (ed.sControlID == "btn_withdraw_all") + ps_WithdrawItems(ed.oPC, ed.nToken, TRUE); + else if (ed.sControlID == "btn_deposit") + ps_EnterDepositMode(ed.oPC); + else if (ed.sControlID == "btn_deposit_gold") + { + int nAmount, nGold = GetGold(ed.oPC); + string sAmount = JsonGetString(NuiGetBind(ed.oPC, ed.nToken, "gold_amount")); + + if (sAmount == "") + nAmount = nGold; + else + nAmount = clamp(StringToInt(sAmount), 0, nGold); + + if ((nGold = ps_GetMaxGold(ed.oPC)) > -2) + nAmount = min(nAmount, nGold - JsonGetInt(NuiGetBind(ed.oPC, ed.nToken, "gold_stored"))); + + if (nAmount <= 0) return; + + if (ps_UpdateGold(ed.oPC, ed.nToken, nAmount)) + AssignCommand(ed.oPC, TakeGoldFromCreature(nAmount, ed.oPC, TRUE)); + + DelayCommand(0.1, ps_UpdateGoldBinds(ed.oPC, ed.nToken)); + } + else if (ed.sControlID == "btn_withdraw_gold") + { + int nAmount, nGold = JsonGetInt(NuiGetBind(ed.oPC, ed.nToken, "gold_stored")); + string sAmount = JsonGetString(NuiGetBind(ed.oPC, ed.nToken, "gold_amount")); + + if (sAmount == "") + nAmount = nGold; + else + nAmount = clamp(StringToInt(sAmount), 0, nGold); + + if (nAmount <= 0) return; + + if (ps_WithdrawGold(ed.oPC, ed.nToken, nAmount)) + GiveGoldToCreature(ed.oPC, nAmount); + + ps_UpdateGoldBinds(ed.oPC, ed.nToken); + } + else if (ed.sControlID == "btn_search") + { + SetLocalString(ed.oPC, PS_SEARCH_STRING, JsonGetString(NuiGetBind(ed.oPC, ed.nToken, "search"))); + ps_UpdateItemList(ed.oPC); + } + else if (ed.sControlID == "btn_clear") + { + NuiSetBind(ed.oPC, ed.nToken, "search", JsonString("")); + + if (ps_GetUseSearchButton(ed.oPC)) + { + DeleteLocalString(ed.oPC, PS_SEARCH_STRING); + ps_UpdateItemList(ed.oPC); + } + } + } + else if (ed.sEvent == "watch") + { + if (ed.sControlID == "geometry") + { + SetLocalJson(ed.oPC, PS_GEOMETRY, NuiGetBind(ed.oPC, ed.nToken, "geometry")); + } + else if (ed.sControlID == "selected") + { + json jSelected = JsonFind(NuiGetBind(ed.oPC, ed.nToken, ed.sControlID), JsonBool(TRUE)); + NuiSetBind(ed.oPC, ed.nToken, "btn_withdraw", JsonBool(jSelected != JsonNull())); + } + else if (ed.sControlID == "search") + { + string sSearch = JsonGetString(NuiGetBind(ed.oPC, ed.nToken, "search")); + int nSearch = GetStringLength(sSearch); + + NuiSetBind(ed.oPC, ed.nToken, "btn_clear", JsonBool(nSearch > 0)); + + if (ps_GetUseSearchButton(ed.oPC)) + { + NuiSetBind(ed.oPC, ed.nToken, "btn_search", JsonBool(nSearch > 0)); + if (!nSearch) + { + DeleteLocalString(ed.oPC, PS_SEARCH_STRING); + ps_UpdateItemList(ed.oPC); + } + } + else + { + NuiSetBind(ed.oPC, ed.nToken, "btn_search", JsonBool(FALSE)); + SetLocalString(ed.oPC, PS_SEARCH_STRING, sSearch); + ps_UpdateItemList(ed.oPC); + } + } + else if (ed.sControlID == "gold_amount") + { + string sAmount = JsonGetString(NuiGetBind(ed.oPC, ed.nToken, ed.sControlID)); + if (!GetIsNumeric(sAmount)) + { + NuiSetBind(ed.oPC, ed.nToken, "btn_withdraw_gold", jFalse); + NuiSetBind(ed.oPC, ed.nToken, "btn_deposit_gold", jFalse); + NuiSetBind(ed.oPC, ed.nToken, "gold_amount_tooltip", JsonString("Error: Only Digits Allowed")); + return; + } + + NuiSetBind(ed.oPC, ed.nToken, "gold_amount_tooltip", JsonString("")); + + int nStored = JsonGetInt(NuiGetBind(ed.oPC, ed.nToken, "gold_stored")); + int nAmount = clamp(StringToInt(sAmount), 0, max(nStored, GetGold(ed.oPC))); + + if (StringToInt(sAmount) > nAmount) + NuiSetBind(ed.oPC, ed.nToken, ed.sControlID, JsonString(IntToString(nAmount))); + + ps_UpdateGoldBinds(ed.oPC, ed.nToken); + } + } + else if (ed.sEvent == "open") + ps_OnFormOpen(); + else if (ed.sEvent == "close") + ps_OnFormClose(); +} + +void ps_CloseContainer(object oPC) +{ + if (NUI_GetFormToken(oPC, FORM_ID)) + NUI_CloseForm(oPC, FORM_ID); +} + +/// @private Closes the form if the player moves too far away from the container. +void ps_OnPCHeartbeat(object oPC, object oContainer) +{ + object oLastContainer = GetLocalObject(oPC, PS_CONTAINER); + if (oLastContainer == OBJECT_INVALID || oLastContainer != oContainer) + return; + + if (GetObjectType(oContainer) == OBJECT_TYPE_ITEM) + return; + + float fMax = ps_GetMaxDistance(oPC); + if (fMax < 0.0) return; + + if (GetDistanceBetween(oLastContainer, oPC) > fMax) + ps_CloseContainer(oPC); + else + AssignCommand(oPC, DelayCommand(2.0, ps_OnPCHeartbeat(oPC, oLastContainer))); +} + +/// @private Closes the form for any using player that moves too far away from the +/// container. +void ps_OnContainerHeartbeat(object oContainer) +{ + if (GetObjectType(oContainer) == OBJECT_TYPE_ITEM) + return; + + float fMax = ps_GetLocalFloatOrDefault(oContainer, PS_DISTANCE, PS_DISTANCE_DEFAULT); + if (fMax < 0.0) return; + + int nAccess = ps_GetLocalIntOrDefault(oContainer, PS_ACCESS_TYPE, PS_ACCESS_TYPE_DEFAULT); + if (nAccess == PS_ACCESS_CONTENTIOUS) + { + int n; for (n; n < CountObjectList(oContainer, PS_USERS); n++) + { + object oPC = GetListObject(oContainer, n, PS_USERS); + if (GetDistanceBetween(oContainer, oPC) > fMax) + ps_CloseContainer(oPC); + } + } + + if (CountObjectList(oContainer, PS_USERS)) + AssignCommand(oContainer, DelayCommand(2.0, ps_OnContainerHeartbeat(oContainer))); +} + +void ps_OpenContainer(object oPC, object oContainer = OBJECT_INVALID) +{ + //ps_OnFormClose(); + + if (oContainer == OBJECT_INVALID) + oContainer = oPC == OBJECT_SELF ? GetLocalObject(oPC, NUI_OBJECT) : OBJECT_SELF; + SetLocalObject(oPC, PS_CONTAINER, oContainer); + + if (ps_GetAccessType(oPC) == PS_ACCESS_CONTENTIOUS) + AddListObject(oContainer, oPC, PS_USERS, TRUE); + + if (GetObjectType(oContainer) != OBJECT_TYPE_ITEM) + { + DelayCommand(2.0, ps_OnPCHeartbeat(oPC, oContainer)); + DelayCommand(2.0, ps_OnContainerHeartbeat(oContainer)); + } + + NUI_DisplayForm(oPC, FORM_ID, ps_GetMaxGold(oPC) > -2 ? "default" : "noGold"); +} + +void HandleModuleEvents() +{ + object oPC = OBJECT_SELF; + + switch (GetCurrentlyRunningEvent()) + { + case EVENT_SCRIPT_MODULE_ON_PLAYER_TARGET: + { + object oPC = GetLastPlayerToSelectTarget(); + + if (!GetLocalInt(oPC, PS_TARGETING_MODE) || NuiFindWindow(oPC, FORM_ID) == 0) + return; + + ps_DepositItem(oPC, GetTargetingModeSelectedObject()); + } break; + case EVENT_SCRIPT_PLACEABLE_ON_USED: + if (!GetIsPC(oPC)) oPC = GetLastUsedBy(); + case EVENT_SCRIPT_PLACEABLE_ON_OPEN: + if (!GetIsPC(oPC)) oPC = GetLastOpenedBy(); + ps_OpenContainer(oPC); + break; + case EVENT_SCRIPT_PLACEABLE_ON_CLOSED: + if (!GetIsPC(OBJECT_SELF)) oPC = GetLastClosedBy(); + ps_CloseContainer(oPC); + break; + case EVENT_SCRIPT_MODULE_ON_ACTIVATE_ITEM: + ps_OpenContainer(GetItemActivator(), GetItemActivated()); + break; + default: + } +} diff --git a/_module/nss/nui_i_library.nss b/_module/nss/nui_i_library.nss new file mode 100644 index 00000000..559da58e --- /dev/null +++ b/_module/nss/nui_i_library.nss @@ -0,0 +1,43 @@ +/// ---------------------------------------------------------------------------- +/// @file nui_i_library.nss +/// @author Ed Burke (tinygiant98) +/// @brief Boilerplate code for creating a library dispatcher. Should only be +/// included in library scripts as it implements main(). +/// ---------------------------------------------------------------------------- + +#include "nui_i_main" + +// ----------------------------------------------------------------------------- +// Function Protoypes +// ----------------------------------------------------------------------------- + +void DefineForm(); +void BindForm(); +void HandleNUIEvents(); +void HandleModuleEvents(); + +// ----------------------------------------------------------------------------- +// Function Implementations +// ----------------------------------------------------------------------------- + +// These are dummy implementations to prevent nwnsc from complaining that they +// do not exist. If you want to compile in the toolset rather than using nwnsc, +// comment these lines out. +//#pragma default_function(DefineForm) +//#pragma default_function(BindForm) +//#pragma default_function(HandleNUIEvents) +//#pragma default_function(HandleModuleEvents) + +// ----------------------------------------------------------------------------- +// Library Dispatch +// ----------------------------------------------------------------------------- + +void main() +{ + string sOperation = GetScriptParam("NUI_FUNCTION"); + + if (sOperation == NUI_DEFINE) DefineForm(); + else if (sOperation == NUI_BIND) BindForm(); + else if (sOperation == NUI_EVENT_NUI) HandleNUIEvents(); + else HandleModuleEvents(); +} diff --git a/_module/nss/nui_i_main.nss b/_module/nss/nui_i_main.nss new file mode 100644 index 00000000..2b47a6aa --- /dev/null +++ b/_module/nss/nui_i_main.nss @@ -0,0 +1,2741 @@ +/// ---------------------------------------------------------------------------- +/// @file nui_i_main.nss +/// @author Ed Burke (tinygiant98) +/// @brief NUI Form Creation and Management System +/// ---------------------------------------------------------------------------- + +#include "util_i_csvlists" +#include "util_i_color" +#include "nui_c_config" + +// ----------------------------------------------------------------------------- +// Constants +// ----------------------------------------------------------------------------- + +const string NUI_VERSION = "0.4.7"; +const string NUI_DATABASE = "nui_form_data"; + +const int NUI_ORIENTATION_ROW = 0; +const int NUI_ORIENTATION_COLUMN = 1; + +const int NUI_DRAW_ABOVE = 1; +const int NUI_DRAW_BELOW = -1; + +const int NUI_DRAW_ALWAYS = 0; +const int NUI_DRAW_MOUSEOFF = 1; +const int NUI_DRAW_MOUSEHOVER = 2; +const int NUI_DRAW_MOUSELEFT = 3; +const int NUI_DRAW_MOUSERIGHT = 4; +const int NUI_DRAW_MOUSEMIDDLE = 5; + +const int NUI_SCROLLBARS_NONE = 0; +const int NUI_SCROLLBARS_X = 1; +const int NUI_SCROLLBARS_Y = 2; +const int NUI_SCROLLBARS_BOTH = 3; +const int NUI_SCROLLBARS_AUTO = 4; + +const int NUI_CHART_LINE = 0; +const int NUI_CHART_BAR = 1; + +const int NUI_ASPECT_FIT = 0; +const int NUI_ASPECT_FILL = 1; +const int NUI_ASPECT_FIT100 = 2; +const int NUI_ASPECT_EXACT = 3; +const int NUI_ASPECT_EXACTSCALED = 4; +const int NUI_ASPECT_STRETCH = 5; + +const int NUI_HALIGN_CENTER = 0; +const int NUI_HALIGN_LEFT = 1; +const int NUI_HALIGN_RIGHT = 2; + +const int NUI_VALIGN_MIDDLE = 0; +const int NUI_VALIGN_TOP = 1; +const int NUI_VALIGN_BOTTOM = 2; + +const string NUI_DEFINE = "DefineForm"; +const string NUI_BIND = "BindForm"; +const string NUI_EVENT_NUI = "HandleNUIEvents"; +const string NUI_EVENT_MOD = "HandleModuleEvents"; + +const string NUI_OBJECT = "NUI_OBJECT"; + +const int NUI_FI_EVENT_UPDATE_FORMS = 100001; +const int NUI_FI_EVENT_UPDATE_EVENTS = 100002; + +json jTrue = JsonBool(TRUE); +json jFalse = JsonBool(FALSE); + +const int NUI_USE_CAMPAIGN_DATABASE = FALSE; +const string NUI_FORMFILE_PREFIX = "nui_f_"; + +struct NUIEventData { + object oPC; // PC object interacting with the form + int nToken; // Subject form token + string sFormID; // Form ID as assigned during the form definition process + string sEvent; // Event - mouseup, click, etc. + string sControlID; // Control ID as assigned during the form definition process + int nIndex; // Index of control in array, if the control is in an array (listbox) + json jPayload; // Event payload, if it exists +}; + +// ----------------------------------------------------------------------------- +// NUI/JSON Helpers +// ----------------------------------------------------------------------------- + +/// @brief Formats a json-parseable string. +/// @param s String value. +string nuiString(string s); + +/// @brief Formats a json-parseable integer. +/// @param n Integer value. +string nuiInt(int n); + +/// @brief Formats a json-parseable float. +/// @param f Float value. +string nuiFloat(float f); + +/// @brief Formats a json-parseable boolean. +/// @param b Boolean value. +string nuiBool(int b); + +/// @brief Creates a json-parseable object for a data bind. +/// @param sBind Bind variable. +/// @param bWatch TRUE to set a bind watch. +string nuiBind(string sBind, int bWatch = FALSE); + +/// @brief Creates a json-parseable object for referencing strings by StringRef. +/// @param nStrRef StringRef value. +string nuiStrRef(int nStrRef); + +/// @brief Creates a json-parseable object for a null value. +string nuiNull(); + +// ----------------------------------------------------------------------------- +// Form Definition, Controls, Custom JSON Structures, Drawing Elements +// ----------------------------------------------------------------------------- + +/// @brief Must be called during the module load process. Initializes the +/// required nui database tables and loads all available formfiles. +/// Automatically called by the system during the OnModuleLoad event +/// if not specifically called prior. +void NUI_Initialize(); + +/// @brief Creates a form template with all required form properties set to +/// default values: +/// accepts_input: true +/// border: true +/// closable: true +/// collapsible: true +/// geometry: bind:"geometry" +/// resizable: true +/// title: bind:"title" +/// transparent: false +/// @param sID Form ID. +/// @param sVersion A local version set into the form's json structure as +/// "local_version". This is different than the nui system's required +/// version, which should never be changed. +void NUI_CreateForm(string sID, string sVersion = ""); + +/// @brief Define a subform. +/// @param sID Subform ID. +/// @warning Must be used only during the form definition process and after +/// definition of the main form. +void NUI_CreateSubform(string sID); + +/// @brief Define a point based on a single coordinate set. +/// @param x X-coordinate. +/// @param y Y-coordinate. +/// @returns A json-parseable string representing a single coordinate set. +/// {"x":x.x, "y":y.y} +string NUI_DefinePoint(float x, float y); + +/// @brief Get an array of line endpoint coordinates. +/// @param x1 Start point x-coordinate. +/// @param y1 Start point y-coordinate. +/// @param x2 End point x-coordinate. +/// @param y2 End point y-coordinate. +/// @returns A json-parseable string representing an array of coordinates +/// that can be used in NUI_DrawLine(). +/// [x1.x, y1.y, x2.x, y2.y] +string NUI_GetLinePoints(float x1, float y1, float x2, float y2); + +/// @brief Add a single coordinate set to an empty or existing coordinate array. +/// @param sPoints Coordinate array. Can be a pre-existing arry as created by +/// NUI_GetLinePoints, an empty array string ("[]"), or an empty string (""). +/// @param x X-coordinate. +/// @param y Y-coordinate. +/// @returns A json-parseable string representing an array of coordinates +/// that can be used in NUI_DrawLine(). +/// [..., x.x, y.y] +string NUI_AddLinePoint(string sPoints, float x, float y); + +/// @brief Define an nui-usable color vector via rgba values. +/// @param r Red value. +/// @param g Green value. +/// @param b Blue value. +/// @param a Transparency value. +/// @returns A json-parseable string representing a color. +/// {"r":r, "g":g, "b":b, "a":a} +string NUI_DefineRGBColor(int r, int g, int b, int a = 255); + +/// @brief Define an nui-usable color vector via hsv values. +/// @param h Hue. +/// @param s Saturation. +/// @param v Value. +/// @returns A json-parseable string representing a color. +/// {"r":r, "g":g, "b":b, "a":a} +string NUI_DefineHSVColor(float h, float s, float v); + +/// @brief Define an nui-usable color vector via hex value. +/// @param nColor Hex color. +/// @returns A json-parseable string representing a color. +/// {"r":r, "g":g, "b":b, "a":a} +string NUI_DefineHexColor(int nColor); + +/// @brief Define a random nui-usable color vector. +/// @returns A json-parseable string representing a color. +/// {"r":r, "g":g, "b":b, "a":a} +string NUI_DefineRandomColor(); + +/// @brief Define a rectangle based on coordinates and dimensions. +/// @param x X-coordinate, top left corner. +/// @param y Y-coordinate, top left corner. +/// @param w Width. +/// @param h Height. +/// @returns A json-parseable string representing a rectangular region. +/// {"x":x.x, "y":y.y, "w":w.w, "h":h.h} +string NUI_DefineRectangle(float x, float y, float w, float h); + +/// @brief Get an array of rectangle corner coordinates. +/// @param x X-coordinate, top left corner. +/// @param y Y-coordinate, top left corner. +/// @param w Width. +/// @param h Height. +/// @returns A json-parseable string representing an array of coordinates +/// that can be used in NUI_DrawLine. +/// [x.x, y.y, x.x+w.w, y.y, x.x+w.w, y.y+h.h, x.x, y.y+h.h, x.x, y.y] +string NUI_GetRectanglePoints(float x, float y, float w, float h); + +/// @brief Get an array of rectangle corner coordinates. +/// @param sRectangle A json-parseable string representing a rectangular +/// region as returned by NUI_DefineRectangle(). +/// @returns A json-parseable string representing an array of coordinates +/// that can be used in NUI_DrawLine. +/// [x.x, y.y, x.x+w.w, y.y, x.x+w.w, y.y+h.h, x.x, y.y+h.h, x.x, y.y] +string NUI_GetDefinedRectanglePoints(string sRectangle); + +/// @brief Define a circle based on coordinates and radius. +/// @param x X-coordinate, center point. +/// @param y Y-coordinate, center point. +/// @param r Radius. +/// @returns A json-parseable string representing a rectangular region +/// that can be used in NUI_DrawDefinedCircle(). +/// [x.x-r.r, y.y-r.r, 2*r.r, 2*r.r] +string NUI_DefineCircle(float x, float y, float r); + +/// @brief Add a column to the form or control group. +/// @param fWidth Column width. If omitted, width will calculated automatically. +/// @note Definition must be closed with NUI_CloseColumn(). +void NUI_AddColumn(float fWidth = -1.0); + +/// @brief Close a column definition. +void NUI_CloseColumn(); + +/// @brief Add a row to the form or control group. +/// @param fWidth Row height. If omitted, height will calculated automatically. +/// @note Definition must be closed with NUI_CloseRow(). +void NUI_AddRow(float fHeight = -1.0); + +/// @brief Close a row definition. +void NUI_CloseRow(); + +/// @brief Add a control group to the form or control group. +/// @param sID Control id. Returned by NuiGetEventElement() (nwscript) or as +/// ed.sControlID in event data. +/// @note Control group can contain other controls and can act as a layout element +/// for tab controls or as a form's subregion, containing its own columns and rows +/// of elements. Definition must be closed with NUI_CloseGroup(). +void NUI_AddGroup(string sID = ""); + +/// @brief Close a control group definition. +void NUI_CloseGroup(); + +/// @brief Add a chart to the form or control group. +/// @param sID Control id. Returned by NuiGetEventElement() (nwscript) or as +/// ed.sControlID in event data. +void NUI_AddChart(string sID = ""); + +/// @brief Add a checkbox to the form or control group. +/// @param sID Control id. Returned by NuiGetEventElement() (nwscript) or as +/// ed.sControlID in event data. +void NUI_AddCheckbox(string sID = ""); + +/// @brief Add a color picker to the form or control group. +/// @param sID Control id. Returned by NuiGetEventElement() (nwscript) or as +/// ed.sControlID in event data. +void NUI_AddColorPicker(string sID = ""); + +/// @brief Add a combobox to the form or control group. +/// @param sID Control id. Returned by NuiGetEventElement() (nwscript) or as +/// ed.sControlID in event data. +void NUI_AddCombobox(string sID = ""); + +/// @brief Add a command button to the form or control group. +/// @param sID Control id. Returned by NuiGetEventElement() (nwscript) or as +/// ed.sControlID in event data. +void NUI_AddCommandButton(string sID = ""); + +/// @brief Add a fully-formed custom control. +/// @param sJson Json-parseable string representing a form control with all +/// desired properties defined. +/// @warning This is a very advanced-use function and typically should not be +/// used unless you know what you are doing with respect to how the json +/// definitions are built. Once a custom control is added with this function, +/// the control definition is closed and properties cannot be added or +/// modified. +void NUI_AddCustomControl(string sJson); + +/// @brief Add a float-based slider to the form or control group +/// @param sID Control id. Returned by NuiGetEventElement() (nwscript) or as +/// ed.sControlID in event data. +void NUI_AddFloatSlider(string sID = ""); + +/// @brief Add an image to the form or control group. +/// @param sID Control id. Returned by NuiGetEventElement() (nwscript) or as +/// ed.sControlID in event data. +void NUI_AddImage(string sID = ""); + +/// @brief Add an image button to the form or control group. +/// @param sID Control id. Returned by NuiGetEventElement() (nwscript) or as +/// ed.sControlID in event data. +void NUI_AddImageButton(string sID = ""); + +/// @brief Add an int-based slider to the form or control group. +/// @param sID Control id. Returned by NuiGetEventElement() (nwscript) or as +/// ed.sControlID in event data. +void NUI_AddIntSlider(string sID = ""); + +/// @brief Add a label to the form or control group. +/// @param sID Control id. Returned by NuiGetEventElement() (nwscript) or as +/// ed.sControlID in event data. +void NUI_AddLabel(string sID = ""); + +/// @brief Add a listbox to the form or control group. +/// @param sID Control id. Returned by NuiGetEventElement() (nwscript) or as +/// ed.sControlID in event data. +/// @note Each control added to the listbox row template can have individual +/// properties set. Additionally, template element properties can be set +/// with NUI_SetTemplateVariable() and NUI_SetTemplateWidth(). Definition +/// must be closed with NUI_CloseListbox(). +void NUI_AddListbox(string sID = ""); + +/// @brief Close a listbox definition. +void NUI_CloseListbox(); + +/// @brief Add an option group to the form or control group. +/// @param sID Control id. Returned by NuiGetEventElement() (nwscript) or as +/// ed.sControlID in event data. +/// @note Radio buttons may be added with NUI_SetElements(). Option group +/// values are 0-based, starting with the first radio button added. +void NUI_AddOptionGroup(string sID = ""); + +/// @brief Add a progress bar to the form or control group. +/// @param sID Control id. Returned by NuiGetEventElement() (nwscript) or as +/// ed.sControlID in event data. +void NUI_AddProgressBar(string sID = ""); + +/// @brief Add a spacer to the form or control group. +/// @param sID Control id. Returned by NuiGetEventElement() (nwscript) or as +/// ed.sControlID in event data. +void NUI_AddSpacer(string sID = ""); + +/// @brief Add an editable textbox to the form or control group. +/// @param sID Control id. Returned by NuiGetEventElement() (nwscript) or as +/// ed.sControlID in event data. +/// @note To force the textbox to be non-editable, use NUI_SetStatic(); +void NUI_AddTextbox(string sID = ""); + +/// @brief Add a toggle button to the form or control group. +/// @param sID Control id. Returned by NuiGetEventElement() (nwscript) or as +/// ed.sControlID in event data. +/// @note Toggle buttons may be added with NUI_AddElement() or +/// NUI_AddElement(). Option group values are 0-based, starting with +/// the first radio button added. +void NUI_AddToggleButton(string sID = ""); + +/// @brief Add an toggle (option) button group to the form or control group. +/// @param sID Control id. Returned by NuiGetEventElement() (nwscript) or as +/// ed.sControlID in event data. +/// @note Toggle buttons may be added with NUI_SetElements(). Option group +/// values are 0-based, starting with the first toggle button added. +void NUI_AddToggleGroup(string sID = ""); + +/// @brief Add a canvas to a control or control group. +/// @note Any number of drawlist elements may be added to a single canvas. +/// Drawlist elements can be added to any control or control group, but +/// cannot be added to the base form. Definitions must be closed with +/// NUI_CloseCanvas(). +void NUI_AddCanvas(); + +/// @brief Close a canvas definition. +void NUI_CloseCanvas(); + +/// @brief Draw a line or polyline on the canvas. +/// @param sPoints Json-parseable points array as defined by NUI_GetLinePoints(), +/// NUI_AddLinePoint(), or NUI_GetRectanglePoints(). +/// @note Line point coordinates are relative to the top-left corner of the control +/// the drawlist element is being added to. +void NUI_DrawLine(string sPoints); + +/// @brief Draw a rectangle on the canvas. +/// @param x X-coordinate, top left corner. +/// @param y Y-coordinate, top left corner. +/// @param w Width. +/// @param h Height. +/// @note X and Y coordinates are relative to the top-left corner of the control +/// the drawlist element is being added to. +void NUI_DrawRectangle(float x, float y, float w, float h); + +/// @brief Draw a rectangle on the canvas. +/// @param sRect Json-parseable string representing a rectangular region as defined +/// by NUI_DefineRectangle(). +/// @note X and Y coordinates are relative to the top-left corner of the control +/// the drawlist element is being added to. +void NUI_DrawDefinedRectangle(string sRect); + +/// @brief Draw a circle on the canvas. +/// @param x X-coordinate, center point. +/// @param y Y-coordinate, center point. +/// @param r Radius. +/// @note X and Y coordinates are relative to the top-left corner of the control +/// the drawlist element is being added to. +void NUI_DrawCircle(float x, float y, float r); + +/// @brief Draw a circle on the canvas. +/// @param sCircle Json-parseable string representing a rectangular region as defined +/// by NUI_DefineCircle(). +/// @note X and Y coordinates are relative to the top-left corner of the control +/// the drawlist element is being added to. +void NUI_DrawDefinedCircle(string sCircle); + +/// @brief Draw a textbox on the canvas. +/// @param sRect Json-parseable string representing a rectanglur region as defined +/// by NUI_DefineRectangle(). +/// @param sText Text to be displayed in the drawn textbox. +/// @note X and Y coordinates are relative to the top-left corner of the control +/// the drawlist element is being added to. +void NUI_DrawTextbox(string sRect, string sText); + +/// @brief Draw an image on the canvas. +/// @param sResref Resref of the image to be displayed. +/// @param sRect Json-parseable string representing a rectanglur region as defined +/// by NUI_DefineRectangle(). +/// @param nAspect Aspect ratio. +/// @param nHAlign Horizontal Alignment. +/// @param nValign Vertical Alignment. +void NUI_DrawImage(string sResref, string sRect, int nAspect, int nHAlign, int nVAlign); + +/// @brief Draw an arc on the canvas. +/// @param sCenter Json-parseable string representing the center of the arc as defined by +/// NUI_DefinePoint(). +/// @param r Radius. +/// @param fAMin Start angle. +/// @param fAMax End angle. +/// @note fAMin and fAMax are measured in fractions of PI radians from the start radian of +/// (0 * PI) which is visually represented as 090 degrees. A complete circle is 2 * PI. +/// To draw a 90 degree arc from 180 degrees to 270 degrees, use +/// NUI_DrawArc([sCenter], [r], 0.5 * PI, PI);. The radius arms will also be drawn. +/// @note To achieve any given angle with 0 degrees as straight up, use +/// fAMin = (-0.5 * PI) + ( / 180.0) * PI; +void NUI_DrawArc(string sCenter, float r, float fAMin, float fAMax); + +/// @brief Draw a bezier curve on the canvas. +/// @param sStart Json-parseable string representing the curve's start point. +/// @param sEnd Json-parseable string representing the curve's end point. +/// @param sCtrl0 Json-parseable string representing the curve's first control point. +/// @param sCtrl1 Json-parseable string representing the curve's second control point. +/// @note All arguments for this function can be defined by NUI_DefinePoint(). +/// @note More information about bezier curves: https://en.wikipedia.org/wiki/B%C3%A9zier_curve +void NUI_DrawCurve(string sStart, string sEnd, string sCtrl0, string sCtrl1); + +/// @brief Binds the drawlist element's points property. +/// @param sBind Variable to bind. +void NUI_BindLine(string sBind); + +/// @brief Binds the drawlist element's rectangle property. +/// @param sBind Variable to bind. +void NUI_BindCircle(string sBind); + +/// @brief Binds the drawlist element's text and rectangle properties. +/// @param sRectangle Variable to bind. +/// @param sText Variable to bind. +void NUI_BindTextbox(string sRectangle, string sText); + +/// @brief Binds the drawlist element's rectangle, resref (image), aspect and alignment properties. +/// @param sResref Variable to bind. +/// @param sRectangle Variable to bind. +/// @param sAspect Variable to bind. +/// @param sHAlign Variable to bind. +/// @param sVAlign Variable to bind. +void NUI_BindImage(string sResref, string sRectangle, string sAspect, string sHAlign, string sVAlign); + +/// @brief Binds the drawlist element's center, radius, start angle and end angle properties. +/// @param sCenter Variable to bind. +/// @param sRadius Variable to bind. +/// @param sStartAngle Variable to bind. +/// @param sEndAngle Variable to bind. +void NUI_BindArc(string sCenter, string sRadius, string sStartAngle, string sEndAngle); + +/// @brief Binds the drawlist element's start, end, and control point properties. +/// @param sStart Variable to bind. +/// @param sEnd Variable to bind. +/// @param sCtrl0 Variable to bind. +/// @param sCtrl1 Variable to bind. +void NUI_BindCurve(string sStart, string sEnd, string sCtrl0, string sCtrl1); + +/// @brief Binds the form's accepts input property. +/// @param sBind Variable to bind. +/// @param bWatch TRUE to set a bind watch. +void NUI_BindAcceptsInput(string sBind, int bWatch = FALSE); + +/// @brief Binds the control's aspect property. +/// @param sBind Variable to bind. +/// @param bWatch TRUE to set a bind watch. +void NUI_BindAspect(string sBind, int bWatch = FALSE); + +/// @brief Binds the form's or control's border property. +/// @param sBind Variable to bind. +/// @param bWatch TRUE to set a bind watch. +void NUI_BindBorder(string sBind, int bWatch = FALSE); + +/// @brief Binds the form's closable property. +/// @param sBind Variable to bind. +/// @param bWatch TRUE to set a bind watch. +void NUI_BindClosable(string sBind, int bWatch = FALSE); + +/// @brief Binds the form's collapsible property. +/// @param sBind Variable to bind. +/// @param bWatch TRUE to set a bind watch. +void NUI_BindCollapsible(string sBind, int bWatch = FALSE); + +/// @brief Binds the control's color property. +/// @param sBind Variable to bind. +/// @param bWatch TRUE to set a bind watch. +void NUI_BindColor(string sBind, int bWatch = FALSE); + +/// @brief Binds the disabled control's tooltip property. +/// @param sBind Variable to bind. +/// @param bWatch TRUE to set a bind watch. +void NUI_BindDisabledTooltip(string sBind, int bWatch = FALSE); + +/// @brief Binds the form's edge constraint property. +/// @param sBind Variable to bind. +/// @param bWatch TRUE to set a bind watch. +void NUI_BindEdgeConstraint(string sBind, int bWatch = FALSE); + +/// @brief Binds the control's elements property. +/// @param sBind Variable to bind. +/// @param bWatch TRUE to set a bind watch. +void NUI_BindElements(string sBind, int bWatch = FALSE); + +/// @brief Binds the control's enabled property. +/// @param sBind Variable to bind. +/// @param bWatch TRUE to set a bind watch. +void NUI_BindEnabled(string sBind, int bWatch = FALSE); + +/// @brief Binds the control's encouraged property. +/// @param sBind Variable to bind. +/// @param bWatch TRUE to set a bind watch. +void NUI_BindEncouraged(string sBind, int bWatch = FALSE); + +/// @brief Binds the control's fill property. +/// @param sBind Variable to bind. +/// @param bWatch TRUE to set a bind watch. +void NUI_BindFill(string sBind, int bWatch = FALSE); + +/// @brief Binds the control's foreground color property. +/// @param sBind Variable to bind. +/// @param bWatch TRUE to set a bind watch. +void NUI_BindForegroundColor(string sBind, int bWatch = FALSE); + +/// @brief Binds the form's geometry property. +/// @param sBind Variable to bind. +/// @param bWatch TRUE to set a bind watch. +void NUI_BindGeometry(string sBind, int bWatch = FALSE); + +/// @brief Binds the control's horizontal alignment property. +/// @param sBind Variable to bind. +/// @param bWatch TRUE to set a bind watch. +void NUI_BindHorizontalAlignment(string sBind, int bWatch = FALSE); + +/// @brief Binds the control's resref (image) property. +/// @param sBind Variable to bind. +/// @param bWatch TRUE to set a bind watch. +void NUI_BindResref(string sBind, int bWatch = FALSE); + +/// @brief Binds the control's label property. +/// @param sBind Variable to bind. +/// @param bWatch TRUE to set a bind watch. +void NUI_BindLabel(string sBind, int bWatch = FALSE); + +/// @brief Binds the control's legend property. +/// @param sBind Variable to bind. +/// @param bWatch TRUE to set a bind watch. +void NUI_BindLegend(string sBind, int bWatch = FALSE); + +/// @brief Binds the control's line thickness property. +/// @param sBind Variable to bind. +/// @param bWatch TRUE to set a bind watch. +void NUI_BindLineThickness(string sBind, int bWatch = FALSE); + +/// @brief Binds the control's max property. +/// @param sBind Variable to bind. +/// @param bWatch TRUE to set a bind watch. +void NUI_BindMax(string sBind, int bWatch = FALSE); + +/// @brief Binds the control's min property. +/// @param sBind Variable to bind. +/// @param bWatch TRUE to set a bind watch. +void NUI_BindMin(string sBind, int bWatch = FALSE); + +/// @brief Binds the control's placeholder property. +/// @param sBind Variable to bind. +/// @param bWatch TRUE to set a bind watch. +void NUI_BindPlaceholder(string sBind, int bWatch = FALSE); + +/// @brief Binds the control's points property. +/// @param sBind Variable to bind. +/// @param bWatch TRUE to set a bind watch. +void NUI_BindPoints(string sBind, int bWatch = FALSE); + +/// @brief Binds the control's rectangle property. +/// @param sBind Variable to bind. +/// @param bWatch TRUE to set a bind watch. +void NUI_BindRectangle(string sBind, int bWatch = FALSE); + +/// @brief Binds the control's region property. +/// @param sBind Variable to bind. +/// @param bWatch TRUE to set a bind watch. +void NUI_BindRegion(string sBind, int bWatch = FALSE); + +/// @brief Binds the form's resizable property. +/// @param sBind Variable to bind. +/// @param bWatch TRUE to set a bind watch. +void NUI_BindResizable(string sBind, int bWatch = FALSE); + +/// @brief Binds the control's rowcount property. +/// @param sBind Variable to bind. +/// @param bWatch TRUE to set a bind watch. +void NUI_BindRowCount(string sBind, int bWatch = FALSE); + +/// @brief Binds the control's scissor property. +/// @param sBind Variable to bind. +/// @param bWatch TRUE to set a bind watch. +void NUI_BindScissor(string sBind, int bWatch = FALSE); + +/// @brief Binds the form's size constraint property. +/// @param sBind Variable to bind. +/// @param bWatch TRUE to set a bind watch. +void NUI_BindSizeConstraint(string sBind, int bWatch = FALSE); + +/// @brief Binds a slider control's bounds. +/// @param sUpper Variable to bind. +/// @param sLower Variable to bind. +/// @param sStep Variable to bind. +/// @param bWatch TRUE to set a bind watch. +void NUI_BindSliderBounds(string sUpper, string sLower, string sStep, int bWatch = FALSE); + +/// @brief Binds the control's step property. +/// @param sBind Variable to bind. +/// @param bWatch TRUE to set a bind watch. +void NUI_BindStep(string sBind, int bWatch = FALSE); + +/// @brief Binds the control's text property. +/// @param sBind Variable to bind. +/// @param bWatch TRUE to set a bind watch. +void NUI_BindText(string sBind, int bWatch = FALSE); + +/// @brief Binds the form's title property. +/// @param sBind Variable to bind. +/// @param bWatch TRUE to set a bind watch. +void NUI_BindTitle(string sBind, int bWatch = FALSE); + +/// @brief Binds the control's tooltip property. +/// @param sBind Variable to bind. +/// @param bWatch TRUE to set a bind watch. +/// @param bDisabledTooltip If TRUE, the control's disabled tooltip property +/// will also be bound to sBind. +void NUI_BindTooltip(string sBind, int bWatch = FALSE, int bDisabledTooltip = FALSE); + +/// @brief Binds the form's elements property. +/// @param sBind Variable to bind. +/// @param bWatch TRUE to set a bind watch. +void NUI_BindTransparent(string sBind, int bWatch = FALSE); + +/// @brief Binds the control's type property. +/// @param sBind Variable to bind. +/// @param bWatch TRUE to set a bind watch. +void NUI_BindType(string sBind, int bWatch = FALSE); + +/// @brief Binds the control's value property. +/// @param sBind Variable to bind. +/// @param bWatch TRUE to set a bind watch. +void NUI_BindValue(string sBind, int bWatch = FALSE); + +/// @brief Binds the control's vertical alignment property. +/// @param sBind Variable to bind. +/// @param bWatch TRUE to set a bind watch. +void NUI_BindVerticalAlignment(string sBind, int bWatch = FALSE); + +/// @brief Binds the control's visible property. +/// @param sBind Variable to bind. +/// @param bWatch TRUE to set a bind watch. +void NUI_BindVisible(string sBind, int bWatch = FALSE); + +/// @brief Set the form's accepts input property. +/// @param bAcceptsInput Whether the form will accept player input. +void NUI_SetAcceptsInput(int bAcceptsInput = TRUE); + +/// @brief Sets the control's aspect property. +/// @param nAspect NUI_ASPECT_* constant. +void NUI_SetAspect(int nAspect); + +/// @brief Sets the control's aspect ratio property. +/// @param fAspect Aspect ratio (x/y). +void NUI_SetAspectRatio(float fAspect); + +/// @brief Sets the form's or control's border property. +/// @param bVisible Whether the border is visible. +void NUI_SetBorder(int bVisible = TRUE); + +/// @brief Sets the control's center property. +/// @param x X-coordinate. +/// @param y Y-coordinate. +void NUI_SetCenter(float x, float y); + +/// @brief Sets the form's closable property. +/// @param bClosable Whether the form is closable. +void NUI_SetClosable(int bClosable = TRUE); + +/// @brief Sets the form's collapsible property. +/// @param bCollapsible Whether the form is collapsible. +void NUI_SetCollapsible(int bCollapsible = TRUE); + +/// @brief Binds the control's color property. +/// @param sColor Json-parseable color vector as defined by NUI_DefineColor(), +/// NUI_DefineRGBColor(), NUI_DefineHSVColor(), NUI_DefineHexColor(), and +/// NUI_DefineRandomColor(). +void NUI_SetColor(string sColor); + +/// @brief Set a custom key:value pair into the build data for the +/// form or control currently being defined. +/// @param sKey Key. +/// @param sValue Json-parseable string. +void NUI_SetCustomKey(string sKey, string sValue); + +/// @brief For bound controls, sets the value that will be initially set +/// to the control's value property. +/// @param sDefault Default value to set. +void NUI_SetDefaultValue(string sDefault); + +/// @brief Sets the control's center property. +/// @param sCenter Json-parseable point vector as defined by NUI_DefinePoint(). +void NUI_SetDefinedCenter(string sCenter); + +/// @brief Sets the form's geometry property. +/// @param sGeometry Json-parseable string representing a rectangular region as +/// defined by NUI_DefineRectangle(). +void NUI_SetDefinedGeometry(string sGeometry); + +/// @brief Sets the control's width and height properties. +/// @param fWidth Width. +/// @param fHeight Height. +void NUI_SetDimensions(float fWidth, float fHeight); + +/// @brief Sets the disabled control's tooltip property. +/// @param sTooltip Tooltip text. +void NUI_SetDisabledTooltip(string sText); + +/// @brief Sets the control's direction property. +/// @param nDirection NUI_ORIENTATION_* constant. +void NUI_SetDirection(int nDirection = NUI_ORIENTATION_ROW); + +/// @brief Sets the control's draw condition property. +/// @param nCondition NUI_CONDITION_* constant. +void NUI_SetDrawCondition(int nCondition = NUI_DRAW_ALWAYS); + +/// @brief Sets the control's draw position property. +/// @param nPosition NUI_POSITION_* constant. +void NUI_SetDrawPosition(int nPosition = NUI_DRAW_ABOVE); + +/// @brief Sets the form's edge constraint property. +/// @param fLeft Left Margin. +/// @param fRight Right Margin. +/// @param fTop Top Margin. +/// @param fBottom Bottom Margin. +void NUI_SetEdgeConstraint(float fLeft, float fRight, float fTop, float fBottom); + +/// @brief Sets the control's elements property. +/// @param sElements +void NUI_SetElements(string sElements); + +/// @brief Sets the control's enabled property. +/// @param bEnabled Whether the control is enabled. +void NUI_SetEnabled(int bEnabled = TRUE); + +/// @brief Sets the control's encouraged property. +/// @param bEncourage Whether the control is encouraged. +void NUI_SetEncouraged(int bEncouraged = TRUE); + +/// @brief Sets the control's fill property. +/// @param bFill Whether the control is filled. +void NUI_SetFill(int bFill = TRUE); + +/// @brief Sets the bounds for a float-based slider. +/// @param fLower Lower bound. +/// @param fUpper Upper bound. +/// @param fStep Step Value. +void NUI_SetFloatSliderBounds(float fLower, float fUpper, float fStep); + +/// @brief Sets the control's foreground color property. +/// @param sColor A json-parseable color vector as +/// defined by NUI_DefineRGBColor(), NUI_DefineHSVColor(), +/// NUI_DefineHexColor(), or NUI_DefineRandomColor(). +void NUI_SetForegroundColor(string sColor); + +/// @brief Sets the form's geometry property. +/// @param x X-coordinate, top left corner. +/// @param y Y-coordinate, top left corner. +/// @param w Width. +/// @param h Height. +void NUI_SetGeometry(float x, float y, float w, float h); + +/// @brief Sets the control's height property. +/// @param fHeight Height. +void NUI_SetHeight(float fHeight); + +/// @brief Sets the control's horizontal alignment property. +/// @param nAlign NUI_HALIGN_* constant. +void NUI_SetHorizontalAlignment(int nAlign); + +/// @brief Sets the control's id property. +/// @param sID ID. +void NUI_SetID(string sID); + +/// @brief Sets the bounds for a integer-based slider. +/// @param nLower Lower bound. +/// @param nUpper Upper bound. +/// @param nStep Step Value. +void NUI_SetIntSliderBounds(int nLower, int nUpper, int nStep); + +/// @brief Sets the control's label property. +/// @param sLabel Label. +void NUI_SetLabel(string sLabel); + +/// @brief Sets the control's max length property. +/// @param nLength Max number of characters. +void NUI_SetLength(int nLength); + +/// @brief Sets the control's line thickness property. +/// @param fThickness Line thickness. +void NUI_SetLineThickness(float fThickness); + +/// @brief Sets the control's margin property. +/// @param fMargin Margin. +void NUI_SetMargin(float fMargin); + +/// @brief Sets the control's multiline property. +/// @param bMultiline Whether the textbox has multiple lines. +void NUI_SetMultiline(int bMultiline = TRUE); + +/// @brief Sets the control's padding property. +/// @param fPadding Padding. +void NUI_SetPadding(float fPadding); + +/// @brief Sets the control's placeholder property. +/// @param sText Placeholder text. +void NUI_SetPlaceholder(string sText); + +/// @brief Sets the control's points property. +/// @param sPoint Json-parseable string representing a coordinate array as defined +/// by NUI_GetLinePoints(), NUI_AddLinePoint(), or NUI_GetRectanglePoints(). +void NUI_SetPoints(string sPoints); + +/// @brief Sets the control's radius property. +/// @param r Radius. +void NUI_SetRadius(float r); + +/// @brief Sets the control's rectangle property. +/// @param sRectangle Json-parsaable string representing a rectangular region as defined +/// by NUI_DefineRectangle(). +void NUI_SetRectangle(string sRectangle); + +/// @brief Sets the control's region property. +/// @param sRegion Json-parsaable string representing a rectangular region as defined +/// by NUI_DefineRectangle(). +void NUI_SetRegion(string sRegion); + +/// @brief Sets the form's resizable property. +/// @param bResizable Whether the form is resizable. +void NUI_SetResizable(int bResizable = TRUE); + +/// @brief Sets the control's resref/image property. +/// @param sResref Resource resref. +void NUI_SetResref(string sResref); + +/// @brief Sets the control's row count property. +/// @param nRowCount Number of rows. +void NUI_SetRowCount(int nRowCount); + +/// @brief Sets the control's row height property. +/// @param fRowHeight Row height. +void NUI_SetRowHeight(float fRowHeight); + +/// @brief Sets the control's scissor property. +/// @param bScissor Whether to scissor to the control's dimensions. +void NUI_SetScissor(int bScissor); + +/// @brief Sets the control's scrollbars property. +/// @param nScrollBars NUI_SCROLLBARS_* constant. +void NUI_SetScrollbars(int nScrollbars = NUI_SCROLLBARS_AUTO); + +/// @brief Sets the form's size constraint property. +/// @param fMinWidth Minimum width. +/// @param fMinHeight Minimum height. +/// @param fMaxWidth Maximum width. +/// @param fMaxHeight Maximum height. +/// @note Set any parameter to 0.0 to ignore that parameter while +/// honoring the remaining parameters. +/// @note Setting a maximum constraint less than or equal to a minimum +/// constraint on the same dimension will prevent the form from +/// being resized in that dimension. +void NUI_SetSizeConstraint(float fMinWidth, float fMinHeight, float fMaxWidth, float fMaxHeight); + +/// @brief Sets the control's width and height properties. +/// @param fSide Length of one side. +void NUI_SetSquare(float fSide); + +/// @brief Sets the control's type property. +/// @note Sets an editable textbox to non-editable. +void NUI_SetStatic(); + +/// @brief Sets the template's variable property. +/// @param bVariable Whether the template control width is variable. +void NUI_SetTemplateVariable(int bVariable = TRUE); + +/// @brief Sets the template's width property. +/// @param fWidth Width. +void NUI_SetTemplateWidth(float fWidth); + +/// @brief Sets the control's text property. +/// @param sText Text. +void NUI_SetText(string sText); + +/// @brief Sets the form's title property. +/// @param sTitle Title. +void NUI_SetTitle(string sTitle); + +/// @brief Sets the control's tooltip property. +/// @param sText Tooltip text. +/// @param bDisabledTooltip If TRUE, the control's disabled tooltip property +/// will also be set to sText. +void NUI_SetTooltip(string sText, int bDisabledTooltip = FALSE); + +/// @brief Sets the form's transparent property. +/// @param bTransparent Whether the form's background is transparent. +void NUI_SetTransparent(int bTransparent = TRUE); + +/// @brief Sets the control's value property. +/// @param sValue Json-Parseable string. +/// @note sValue must be a string representing a value json structure. +void NUI_SetValue(string sValue); + +/// @brief Sets the control's vertical alignment property. +/// @param nAlign NUI_VALIGN_* constant. +void NUI_SetVerticalAlignment(int nAlign); + +/// @brief Sets the control's visible property. +/// @param bVisible Whether the control is visible. +void NUI_SetVisible(int bVisible = TRUE); + +/// @brief Sets the control's width property. +/// @param fWidth Width. +void NUI_SetWidth(float fWidth); + +/// @brief Set's the control's wordwrap property. +/// @param bWrap Whether the text wrap's withing the control's width. +void NUI_SetWordWrap(int bWrap = TRUE); + +/// @brief Defines all forms via formfiles that match prefixes set into +/// the configuration file. +/// @param sFormfile Optional formfile specification. +/// @note If sFormfile is passed, only the specified formfile will be loaded. +void NUI_DefineForms(string sFormfile = ""); + +/// @brief Display a form. +/// @param oPC Client to display the form on. +/// @param sFormID ID of the form to display. +/// @param sProfile Optional form profile. +/// @returns Form's token as assigned by the game engine. +int NUI_DisplayForm(object oPC, string sFormID, string sProfile = "default"); + +/// @brief Close an open form. +/// @param oPC Client on which to close the form. +/// @param sFormID ID of the form to close. +void NUI_CloseForm(object oPC, string sFormID); + +/// @brief Display a subform onto a control group element or form root. +/// @param oPC Client to display the subform on. +/// @param sFormID Form ID. +/// @param sElementID Element ID to replace. +/// @param sSubformID Subform ID to insert into sElement. +void NUI_DisplaySubform(object oPC, string sFormID, string sElementID, string sSubformID); + +/// @brief Creates the default profile. +void NUI_CreateDefaultProfile(); + +/// @brief Create a custom form profile based on the default profile. +/// @param sProfile Profile name. +/// @param sBase Optional; must be a previously created profile. If set, +/// sProfile will be based on profile sBase. +void NUI_CreateProfile(string sProfile, string sBase = ""); + +/// @brief Set a profile default bind value. +/// @param sBind Bind name. +/// @param sJson Json-parseable string representing the bind's profile value. +void NUI_SetProfileBind(string sBind, string sJson); + +/// @brief Set a profile default bind value. +/// @param sBind Bind name. +/// @param jValue Json bind value. +void NUI_SetProfileBindJ(string sBind, json jValue); + +/// @brief Set multiple profile binds to a single value. +/// @param sBinds Comma-delimited list of bind names. +/// @param sJson Json-parseable string representing the bind's profile value. +void NUI_SetProfileBinds(string sBinds, string sJson); + +/// @brief Set a form's profile. +/// @param oPC Client to set the profile on. +/// @param sFormID Form ID to set the profile on. +/// @param sProfile Profile to set. +void NUI_SetProfile(object oPC, string sFormID, string sProfile); + +/// @brief Set a bind value. +/// @param oPC Player to set the bind for. +/// @param sFormID Form ID. +/// @param sBind Bind/property name. +/// @param sValue Json-parseable bind Value. +void NUI_SetBind(object oPC, string sFormID, string sBind, string sValue); + +/// @brief Set a bind value. +/// @param oPC Player to set the bind for. +/// @param sFormID Form ID. +/// @param sBind Bind/property name. +/// @param jValue Json bind value. +void NUI_SetBindJ(object oPC, string sFormID, string sBind, json jValue); + +/// @brief Set a bind watch. +/// @param oPC Player to set the bind for. +/// @param sFormID Form ID. +/// @param sBind Bind/property name. +/// @param bWatch TRUE to set the watch, FALSE to remove it. +void NUI_SetBindWatch(object oPC, string sFormID, string sBind, int bWatch = TRUE); + +/// @brief Retrieve a bind value. +/// @param oPC Player to set the bind for. +/// @param sFormID Form ID. +/// @param sBind Bind/property name. +/// @returns Current bind value. +json NUI_GetBind(object oPC, string sFormID, string sBind); + +/// @brief Create a temporary layout to be immediately returned by NUI_GetLayout(). +/// @note Allow the creation of temporary layouts that can be immediately inserted +/// into a form's layout. This function should not be used for creating +/// tabs to be referenced at a later time. The layout created with this function +/// is temporary. +void NUI_CreateLayout(); + +/// @brief Get the temporary layout created with NUI_CreateLayout(). +/// @note The json-parseable string can be inserted directly into the current layout +/// or used in a layout replacement (tabs). This data will not, however, be +/// saved to the database, so this function and NUI_CreateLayout() are +/// meant for dynamic form building. +string NUI_GetLayout(); + +/// @brief Trigger the system to respond to an NUI or module event. +/// @param oPC Optional; the PC triggering the event. +/// @note If the event requires a PC object, the PC object must be +/// specified in this call. For example, in the OnClientEnter handler, +/// this function should be called as NUI_HandleEvents(GetEnteringObject()); +/// For events that do not require a PC object, or for the form to be displayed, +/// such as OnModuleLoad, or if the PC object is the OBJECT_SELF of the running +/// script, oPC does not have to be specified, however, it is a best practice +/// to always include the PC object to ensure the correct object is being passed +/// to the system. +void NUI_HandleEvents(object oPC = OBJECT_SELF); + +/// @brief Convenience funtion for NUI_HandleEvents(). +/// @param oPC Optional. See description above for NUI_HandleEvents(). +void NUI(object oPC = OBJECT_SELF); + +/// @brief Determines if a form is currently open. +/// @param oPC Players to check for the form. +/// @param sFormID The form's ID. +/// @returns TRUE if oPC has sFormID open, FALSE otherwise. +int NUI_GetIsFormOpen(object oPC, string sFormID); + +/// @brief Sends relevant event data to NUI_Debug(). +/// @param ed Event data structure retrieved from NUI_GetEventData(). +void NUI_DumpEventData(struct NUIEventData ed); + +/// @brief Retrieves versioning information. +/// @param bIncludeForms If TRUE, will include the versions for all forms +/// loaded into the module. +string NUI_GetVersions(int bIncludeForms = TRUE); + +/// @brief Save all of sFormID's bind values to a local variable. +/// @param oPC Player associated with sFormID. +/// @param sFormID Form ID to save bind values for. +void NUI_SaveBindState(object oPC, string sFormID); + +/// @brief Restore all of sFormID's bind values from a local variable. +/// @param oPC Player associated with sFormID. +/// @param sFormID Form ID to restore bind values for. +void NUI_RestoreBindState(object oPC, string sFormID); + +/// @brief Returns all event data as a struct NUIEventData. +/// @note Only valid within HandleNUIEvents() event handler. +struct NUIEventData NUI_GetEventData(); + +/// @brief Retrieve the key from a key value pair. +/// @param sPair A key:value... or key=value... pair. +/// @note Returns all characters before the first : or =. +string NUI_GetKey(string sPair); + +/// @brief Retrieve the nNth value from a key value series. +/// @param sPair a key:value:value... or key=:value:value... series. +string NUI_GetValue(string sPair, int nNth = 1); + +// ----------------------------------------------------------------------------- +// Public Functions +// Administrative Helpers +// ----------------------------------------------------------------------------- + +string NUI_GetKey(string sPair) +{ + json jMatch = RegExpMatch("(.*?)[:=].*", sPair); + return JsonGetLength(jMatch) != 2 ? "" : JsonGetString(JsonArrayGet(jMatch, 1)); +} + +string NUI_GetValue(string sPair, int nNth = 1) +{ + string sRegex = "(?:.*?[:=]){" + IntToString(nNth) + "}(.*?)(?:[:=]|$)"; + json jMatch = RegExpMatch(sRegex, sPair); + return JsonGetLength(jMatch) != 2 ? "" : JsonGetString(JsonArrayGet(jMatch, 1)); +} + +object nui_GetDataObject() {return GetModule();} + +// ----------------------------------------------------------------------------- +// Private Functions +// Build Flags and JSON Pathing +// ----------------------------------------------------------------------------- + +void nui_ClearVariables() +{ + object oData = nui_GetDataObject(); + DeleteLocalInt (oData, "FLAG_DEFINITION"); + DeleteLocalInt (oData, "FLAG_INCREMENT"); + DeleteLocalInt (oData, "FLAG_DRAWLIST"); + DeleteLocalInt (oData, "FLAG_LISTBOX"); + DeleteLocalInt (oData, "FLAG_FORCE"); + DeleteLocalInt (oData, "NUI_ENTRY_COUNT"); + DeleteLocalString(oData, "NUI_CONTROL_TYPE"); + DeleteLocalString(oData, "NUI_PATH"); + DeleteLocalString(oData, "NUI_FORMID"); +} + +int nui_ToggleFlag(int nFlag, string sFlag) +{ + if (nFlag == -1) + nFlag = !GetLocalInt(nui_GetDataObject(), sFlag); + + SetLocalInt(nui_GetDataObject(), sFlag, nFlag); + return nFlag; +} + +int nui_GetEntryCount() {return GetLocalInt(nui_GetDataObject(), "NUI_ENTRY_COUNT");} +void nui_ResetEntryCount() {DeleteLocalInt(nui_GetDataObject(), "NUI_ENTRY_COUNT");} + +int nui_IncrementEntryCount(int nIncrement = 1) +{ + int nCount = nui_GetEntryCount(); + SetLocalInt(nui_GetDataObject(), "NUI_ENTRY_COUNT", ++nCount); + return nCount; +} + +int nui_ToggleIncrementFlag(int nFlag = -1) {return nui_ToggleFlag(nFlag, "FLAG_INCREMENT");} +int nui_GetIncrementFlag() {return GetLocalInt(nui_GetDataObject(), "FLAG_INCREMENT");} + +int nui_ToggleDrawlistFlag(int nFlag = -1) {return nui_ToggleFlag(nFlag, "FLAG_DRAWLIST");} +int nui_GetDrawlistFlag() {return GetLocalInt(nui_GetDataObject(), "FLAG_DRAWLIST");} + +int nui_ToggleListboxFlag(int nFlag = -1) {return nui_ToggleFlag(nFlag, "FLAG_LISTBOX");} +int nui_GetListboxFlag() {return GetLocalInt(nui_GetDataObject(), "FLAG_LISTBOX");} + +int nui_ToggleDefinitionFlag(int nFlag = -1) {return nui_ToggleFlag(nFlag, "FLAG_DEFINITION");} +int nui_GetDefinitionFlag() {return GetLocalInt(nui_GetDataObject(), "FLAG_DEFINITION");} + +void nui_SetControlType(string sType) {SetLocalString(nui_GetDataObject(), "NUI_CONTROL_TYPE", sType);} +string nui_GetControlType() {return GetLocalString(nui_GetDataObject(), "NUI_CONTROL_TYPE");} + +string nui_SetPath(string sPath) +{ + SetLocalString(nui_GetDataObject(), "NUI_PATH", sPath); + return sPath; +} + +void nui_ResetPath() {nui_SetPath("$");} +string nui_GetPath() {return GetLocalString(nui_GetDataObject(), "NUI_PATH");} + +void nui_SetFormID(string sFormID) {SetLocalString(nui_GetDataObject(), "NUI_FORMID", sFormID);} +string nui_GetFormID() {return GetLocalString(nui_GetDataObject(), "NUI_FORMID");} + +void nui_SetFormfile(string sFormfile) {SetLocalString(nui_GetDataObject(), "NUI_FORMFILE", sFormfile);} +string nui_GetFormfile() {return GetLocalString(nui_GetDataObject(), "NUI_FORMFILE");} + +string nui_SubstitutePath(string sSub) {return nui_SetPath(RegExpReplace("@", nui_GetPath(), sSub));} +string nui_GetSubstitutedPath(string sSub) {return RegExpReplace("@", nui_GetPath(), sSub);} + +string nui_GetGroupKey() {return JsonGetString(JsonArrayGet(RegExpMatch("\\.(\\w*)\\[(?!.*\\.\\w*\\[)", nui_GetPath()), 1));} + +string nui_IncrementPath(string sElement = "", int bForce = FALSE) +{ + if (!nui_GetIncrementFlag() && !bForce) + return nui_GetPath(); + else + nui_ToggleIncrementFlag(); + + string sPath = nui_GetPath(); + + if (sPath == "$") + sPath += ".root"; + else + { + sPath = nui_SubstitutePath("#-1"); + + if (nui_GetGroupKey() == "row_template" && (nui_GetControlType() == "group" || sElement == "draw_list")) + sPath += "[0]"; + + if (sElement != "draw_list") + { + if (nui_GetControlType() == "listbox") + sPath += ".row_template[@]"; + else + sPath += ".children[@]"; + } + else + sPath += ".draw_list[@]"; + } + + return nui_SetPath(sPath); +} + +string nui_DecrementPath(int n = 1) +{ + string sPath; + while (n-- > 0) + sPath = nui_SetPath(RegExpReplace("\\[#-1\\](?!.*\\[#-1\\]).*", nui_GetPath(), "[@]")); + + return sPath; +} + +// ----------------------------------------------------------------------------- +// Private Functions +// Database +// ----------------------------------------------------------------------------- + +void nui_BeginTransaction() {SqlStep(SqlPrepareQueryObject(GetModule(), "BEGIN TRANSACTION;"));} +void nui_CommitTransaction() {SqlStep(SqlPrepareQueryObject(GetModule(), "COMMIT TRANSACTION;"));} + +sqlquery nui_PrepareQuery(string sQuery, int bForceModule = FALSE) +{ + if (nui_GetDefinitionFlag() || bForceModule) + return SqlPrepareQueryObject(GetModule(), sQuery); + + if (NUI_USE_CAMPAIGN_DATABASE) + return SqlPrepareQueryCampaign(NUI_DATABASE, sQuery); + else + return SqlPrepareQueryObject(GetModule(), sQuery); +} + +int nui_InitializeDatabase() +{ + string sQuery = "DROP TABLE IF EXISTS nui_forms;"; + SqlStep(nui_PrepareQuery(sQuery)); + SqlStep(nui_PrepareQuery(sQuery, TRUE)); + + sQuery = "CREATE TABLE IF NOT EXISTS nui_forms (" + + "id INTEGER PRIMARY KEY AUTOINCREMENT, " + + "form TEXT NOT NULL UNIQUE, " + + "definition NONE);"; + SqlStep(nui_PrepareQuery(sQuery)); + SqlStep(nui_PrepareQuery(sQuery, TRUE)); + + sQuery = "DROP TABLE IF EXISTS nui_fi_data;"; + SqlStep(nui_PrepareQuery(sQuery)); + + sQuery = + "CREATE TABLE IF NOT EXISTS nui_fi_data (" + + "event_id INTEGER PRIMARY KEY AUTOINCREMENT, " + + "sPlayer INTEGER, " + + "sFormID STRING, " + + "nToken INTEGER, " + + "sEvent STRING, " + + "sControlID STRING, " + + "nIndex INTEGER, " + + "jPayload STRING, " + + "binds_before STRING, " + + "binds_after STRING, " + + "timestamp INTEGER);"; + SqlStep(nui_PrepareQuery(sQuery)); + + sQuery = "SELECT * FROM nui_forms;"; + return SqlStep(nui_PrepareQuery(sQuery)); +} + +void nui_SaveForm(string sID, string sJson) +{ + string sQuery = "INSERT INTO nui_forms (form, definition) " + + "VALUES (@form, json(@json)) " + + "ON CONFLICT (form) DO UPDATE SET " + + "definition = json(@json);"; + sqlquery sql = nui_PrepareQuery(sQuery); + SqlBindString(sql, "@form", sID); + SqlBindString(sql, "@json", sJson); + SqlStep(sql); +} + +void nui_DeleteForm(string sID) +{ + sqlquery sql = nui_PrepareQuery("DELETE FROM nui_forms WHERE form = @form;"); + SqlBindString(sql, "@form", sID); + SqlStep(sql); +} + +void nui_CopyDefinitions(string sTable = "nui_forms") +{ + if (!NUI_USE_CAMPAIGN_DATABASE) + return; + + string sQuery = "WITH forms AS (SELECT json_object('form', form, 'definition', definition) AS f " + + "FROM " + sTable + ") SELECT json_group_array(json(f)) FROM forms;"; + sqlquery sql = nui_PrepareQuery(sQuery, TRUE); + json jForms = SqlStep(sql) ? SqlGetJson(sql, 0) : JsonNull(); + + if (jForms == JsonNull()) + return; + + sQuery = "INSERT OR REPLACE INTO " + sTable + " (form, definition) " + + "SELECT value ->> '$.form', value ->> '$.definition' " + + "FROM (SELECT value FROM json_each(@forms));"; + + sql = nui_PrepareQuery(sQuery); + SqlBindJson(sql, "@forms", jForms); + SqlStep(sql); + + sQuery = "DELETE FROM " + sTable + ";"; + SqlStep(nui_PrepareQuery(sQuery, TRUE)); +} + +string nui_GetDefinitionValue(string sFormID, string sPath = "") +{ + string sQuery = "SELECT json_extract(definition, '$" + (sPath == "" ? "" : "." + sPath) + "') " + + "FROM nui_forms WHERE form = @form;"; + + sqlquery sql = nui_PrepareQuery(sQuery); + SqlBindString(sql, "@form", sFormID); + return SqlStep(sql) ? SqlGetString(sql, 0) : ""; +} + +// ----------------------------------------------------------------------------- +// Private Functions +// Form Definition +// ----------------------------------------------------------------------------- + +string nui_CreateRowTemplate(string sControl) +{ + return "[" + sControl + "," + nuiFloat(25.0) + "," + nuiBool(TRUE) + "]"; +} + +void nui_SetObject(string sProperty, string sValue, string sType = "") +{ + string sPath, sFormID = nui_GetFormID(); + + if (sProperty != "") + { + sPath = nui_GetSubstitutedPath("#-1"); + + if (nui_GetGroupKey() == "row_template") + { + if (sProperty == "NUI_TEMPLATE_WIDTH") sPath += "[1]"; + else if (sProperty == "NUI_TEMPLATE_VARIABLE") sPath += "[2]"; + else sPath += "[0]." + sProperty; + } + else if (sProperty == "NUI_ELEMENT") sPath += ".elements[#]"; + else if (sProperty == "NUI_SERIES") sPath += ".value[#]"; + else sPath += "." + sProperty; + } + else + { + nui_IncrementPath(sType); + + if (nui_GetGroupKey() == "row_template") + sValue = nui_CreateRowTemplate(sValue); + + if (sType != "") + { + if (sType == "combo" || sType == "options" || sType == "tabbar") + nui_ResetEntryCount(); + + nui_SetControlType(sType); + } + + sPath = nui_GetSubstitutedPath("#"); + } + + string sQuery = "UPDATE nui_forms SET definition = (SELECT json_set(definition, '" + sPath + + "', json(@value)) FROM nui_forms WHERE form = @form) WHERE form = @form;"; + + sqlquery sql = nui_PrepareQuery(sQuery); + SqlBindString(sql, "@form", sFormID); + SqlBindString(sql, "@value", sValue); + SqlStep(sql); +} + +void nui_SetControl (string sValue, string sType = "") {nui_SetObject("", sValue, sType);} +void nui_SetProperty(string sProperty, string sValue) {nui_SetObject(sProperty, sValue);} + +void nui_CreateControl(string sType, string sID = "") +{ + string sControl = "{" + + nuiString("label") + ":null," + + nuiString("value") + ":null," + + nuiString("enabled") + ":true," + + nuiString("visible") + ":true," + + nuiString("user_data") + ":{}," + + nuiString("event_data") + ":{}," + + nuiString("type") + ":" + nuiString(sType) + + (sID == "" ? "" : "," + + nuiString("id") + ":" + nuiString(sID)) + + "}"; + + nui_SetControl(sControl, sType); +} + +string nui_CreateCanvasTemplate(string sProperties) +{ + return "{" + + nuiString("enabled") + ":true," + + nuiString("fill") + ":false," + + nuiString("line_thickness") + ":0.5," + + nuiString("order") + ":" + nuiInt(NUI_DRAW_ABOVE) + "," + + nuiString("render") + ":" + nuiInt(NUI_DRAW_ALWAYS) + "," + + nuiString("color") + ":" + NUI_DefineRGBColor(255, 255, 255) + "," + + sProperties + + "}"; +} + +// ----------------------------------------------------------------------------- +// Public Functions +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +// Json-Parseable Creators +// ----------------------------------------------------------------------------- + +string nuiString(string s) {return JsonDump(JsonParse("\"" + s + "\""));} +string nuiInt(int n) {return IntToString(n);} +string nuiFloat(float f) {return FloatToString(f);} +string nuiBool(int b) {return b ? "true" : "false";} +string nuiStrRef(int nStrRef) {return "{" + nuiString("strref") + ":" + nuiInt(nStrRef) + "}";} +string nuiNull() {return "null";} +int nuiIsBind(string s) {return JsonGetType(JsonParse(s)) == JSON_TYPE_OBJECT;} + +string nuiBind(string sBind, int bWatch = FALSE) +{ + return "{" + nuiString("bind") + ":" + nuiString(sBind) + "," + + nuiString("watch") + ":" + nuiBool(bWatch) + "}"; +} + +// ----------------------------------------------------------------------------- +// Form/Subform/Layout Definition +// ----------------------------------------------------------------------------- + +void NUI_Initialize() +{ + if (GetLocalInt(GetModule(), "NUI_INITIALIZED")) + return; + + if (nui_InitializeDatabase()) + { + SetLocalInt(GetModule(), "NUI_INITIALIZED", TRUE); + NUI_DefineForms(); + } +} + +void NUI_CreateForm(string sID, string sVersion = "") +{ + nui_SetFormID(sID); + + string sForm = "{" + + nuiString("accepts_input") + ":true," + + nuiString("border") + ":true," + + nuiString("closable") + ":true," + + nuiString("resizable") + ":true," + + nuiString("collapsed") + ":null," + + nuiString("transparent") + ":false," + + nuiString("version") + ":1," + + nuiString("user_data") + ":{}," + + nuiString("event_data") + ":[]," + + nuiString("subforms") + ":{}," + + nuiString("profiles") + ":{" + nuiString("default") + ":{}}," + + nuiString("formfile") + ":" + nuiString(nui_GetFormfile()) + "," + + nuiString("geometry") + ":" + nuiBind("geometry", TRUE) + "," + + nuiString("title") + ":" + nuiBind("title") + "," + + nuiString("local_version") + ":" + nuiString(sVersion) + "," + + nuiString("id") + ":" + nuiString(sID) + + "}"; + + nui_SaveForm(sID, sForm); + nui_ResetPath(); +} + +void NUI_CreateSubform(string sID) {nui_SetPath("$.subforms." + sID);} + +void NUI_CreateLayout() +{ + nui_ToggleDefinitionFlag(TRUE); + NUI_CreateForm("__layout__"); +} + +string NUI_GetLayout() +{ + string sLayout = nui_GetDefinitionValue("__layout__", "root"); + nui_DeleteForm("__layout__"); + nui_ToggleDefinitionFlag(FALSE); + return sLayout; +} + +json NUI_GetBindState(object oPC, string sFormID) +{ + int n, nToken = NuiFindWindow(oPC, sFormID); + json jState = JsonObject(); + string sBind; + + if (nToken) + { + while ((sBind = NuiGetNthBind(oPC, nToken, FALSE, n++)) != "") + jState = JsonObjectSet(jState, sBind, NuiGetBind(oPC, nToken, sBind)); + } + + return jState; +} + +void NUI_SaveBindState(object oPC, string sFormID) +{ + json jState = NUI_GetBindState(oPC, sFormID); + + if (jState != JsonObject()) + SetLocalJson(oPC, "NUI_STATE:" + sFormID, jState); +} + +void NUI_RestoreBindState(object oPC, string sFormID) +{ + json jState = GetLocalJson(oPC, "NUI_STATE:" + sFormID); + if (jState == JsonNull()) + return; + + json jKeys = JsonObjectKeys(jState); + int n, nToken = NuiFindWindow(oPC, sFormID); + string sBind; + + while ((sBind = JsonGetString(JsonArrayGet(jKeys, n++))) != "") + NuiSetBind(oPC, nToken, sBind, JsonObjectGet(jState, sBind)); +} + +void NUI_RepairGeometry(object oPC, string sFormID) +{ + int nToken = NuiFindWindow(oPC, sFormID); + + json j = NuiGetBind(OBJECT_SELF, nToken, "geometry"); + float h = JsonGetFloat(JsonObjectGet(j, "h")); + h += FloatToInt(h) % 2 == 0 ? 1.0 : -1.0; + NuiSetBind(oPC, nToken, "geometry", JsonObjectSet(j, "h", JsonFloat(h))); +} + +// ----------------------------------------------------------------------------- +// Vectors +// ----------------------------------------------------------------------------- + +string NUI_DefinePoint(float x, float y) +{ + return "{" + + nuiString("x") + ":" + nuiFloat(x) + "," + + nuiString("y") + ":" + nuiFloat(y) + + "}"; +} + +string NUI_GetLinePoints(float x1, float y1, float x2, float y2) +{ + return "[" + + nuiFloat(x1) + "," + + nuiFloat(y1) + "," + + nuiFloat(x2) + "," + + nuiFloat(y2) + + "]"; +} + +string NUI_AddLinePoint(string sPoints, float x, float y) +{ + string sOpen; + if (sPoints == "" || sPoints == "[]") + sOpen = "["; + else + sOpen = GetStringLeft(sPoints, GetStringLength(sPoints) - 1) + ","; + + return sOpen + + nuiFloat(x) + "," + + nuiFloat(y) + "]"; +} + +string NUI_DefineRGBColor(int r, int g, int b, int a = 255) +{ + return "{" + + nuiString("r") + ":" + nuiInt(r) + "," + + nuiString("g") + ":" + nuiInt(g) + "," + + nuiString("b") + ":" + nuiInt(b) + "," + + nuiString("a") + ":" + nuiInt(a) + + "}"; +} + +string NUI_DefineHSVColor(float h, float s, float v) +{ + struct HSV hsv; + hsv.h = h; + hsv.s = s; + hsv.v = v; + + struct RGB rgb = HSVToRGB(hsv); + return NUI_DefineRGBColor(rgb.r, rgb.g, rgb.b); +} + +string NUI_DefineHexColor(int nColor) +{ + struct RGB rgb = HexToRGB(nColor); + return NUI_DefineRGBColor(rgb.r, rgb.g, rgb.b); +} + +string NUI_DefineRandomColor() +{ + return NUI_DefineRGBColor(Random(256), Random(256), Random(256)); +} + +string NUI_DefineRectangle(float x, float y, float w, float h) +{ + return "{" + + nuiString("x") + ":" + nuiFloat(x) + "," + + nuiString("y") + ":" + nuiFloat(y) + "," + + nuiString("w") + ":" + nuiFloat(w) + "," + + nuiString("h") + ":" + nuiFloat(h) + + "}"; +} + +string NUI_GetRectanglePoints(float x, float y, float w, float h) +{ + string sx = nuiFloat(x); + string sy = nuiFloat(y); + string sxw = nuiFloat(x + w); + string syh = nuiFloat(y + h); + + return "[" + + sx + "," + sy + "," + + sxw + "," + sy + "," + + sxw + "," + syh + "," + + sx + "," + syh + "," + + sx + "," + sy + + "]"; +} + +// TODO Needs Testing +string NUI_GetDefinedRectanglePoints(string sRectangle) +{ + float x = StringToFloat(NUI_GetValue(GetListItem(sRectangle, 0))); + float y = StringToFloat(NUI_GetValue(GetListItem(sRectangle, 1))); + float w = StringToFloat(NUI_GetValue(GetListItem(sRectangle, 2))); + float h = StringToFloat(NUI_GetValue(GetListItem(sRectangle, 3))); + + return NUI_GetRectanglePoints(x, y, w, h); +} + +string NUI_DefineCircle(float x, float y, float r) +{ + r = fclamp(r, 0.0, fmin(x, y)); + string d = nuiFloat(2 * r); + + return "{" + + nuiString("x") + ":" + nuiFloat(x - r) + "," + + nuiString("y") + ":" + nuiFloat(y - r) + "," + + nuiString("w") + ":" + d + "," + + nuiString("h") + ":" + d + + "}"; +} + +// ----------------------------------------------------------------------------- +// Controls +// ----------------------------------------------------------------------------- + +// Columns and Rows ------------------------------------------------------------ + +void nui_AddLayout(string sType, float f = -1.0) +{ + string sDimension; + if (f > 0.0) + sDimension = "," + nuiString(sType == "col" ? "width" : "height") + ":" + nuiFloat(f); + + string sRoot = "{" + + nuiString("enabled") + ":true," + + nuiString("visible") + ":true," + + nuiString("children") + ":[]," + + nuiString("type") + ":" + nuiString(sType) + + sDimension + + "}"; + + if (nui_GetPath() == "$") + { + nui_SetProperty("root", sRoot); + nui_IncrementPath("", TRUE); + } + else + { + nui_SetControl(sRoot, sType); + nui_ToggleIncrementFlag(TRUE); + } +} + +void NUI_AddColumn(float fWidth = -1.0) {nui_AddLayout("col", fWidth);} +void NUI_CloseColumn() {nui_DecrementPath();} + +void NUI_AddRow(float fHeight = -1.0) {nui_AddLayout("row", fHeight);} +void NUI_CloseRow() {nui_DecrementPath();} + +void NUI_CloseLayout() {nui_DecrementPath();} + +// Controls -------------------------------------------------------------------- + +void NUI_AddCheckbox(string sID = "") {nui_CreateControl("check", sID);} +void NUI_AddColorPicker(string sID = "") {nui_CreateControl("color_picker", sID);} +void NUI_AddCommandButton(string sID = "") {nui_CreateControl("button", sID);} +void NUI_AddCustomControl(string sJson) {nui_SetControl(sJson);} +void NUI_AddFloatSlider(string sID = "") {nui_CreateControl("sliderf", sID);} +void NUI_AddProperty(string sID = "") {nui_CreateControl("propertyi", sID);} +void NUI_AddImage(string sID = "") {nui_CreateControl("image", sID);} +void NUI_AddImageButton(string sID = "") {nui_CreateControl("button_image", sID);} +void NUI_AddIntSlider(string sID = "") {nui_CreateControl("slider", sID);} +void NUI_AddLabel(string sID = "") {nui_CreateControl("label", sID);} +void NUI_AddMoviePlayer(string sID = "") {nui_CreateControl("movieplayer", sID);} +void NUI_AddProgressBar(string sID = "") {nui_CreateControl("progress", sID);} +void NUI_AddSpacer(string sID = "") {nui_CreateControl("spacer", sID);} +void NUI_AddToggleButton(string sID = "") {nui_CreateControl("button_select", sID);} + +void NUI_AddCanvas() +{ + nui_SetProperty("draw_list", "[]"); + nui_SetProperty("draw_list_scissor", nuiBool(FALSE)); + nui_IncrementPath("draw_list", TRUE); + nui_ToggleDrawlistFlag(TRUE); +} + +void NUI_AddChart(string sID = "") +{ + nui_CreateControl("chart", sID); + nui_SetProperty("value", "[]"); +} + +void NUI_CloseCanvas() +{ + nui_ToggleDrawlistFlag(FALSE); + nui_DecrementPath(); +} + +void NUI_AddCombobox(string sID = "") +{ + nui_CreateControl("combo", sID); + nui_SetProperty("elements", "[]"); +} + +void NUI_AddGroup(string sID = "") +{ + sID = (sID == "" ? "" : nuiString("id") + ":" + nuiString(sID) + ","); + string sGroup = "{" + sID + + nuiString("children") + ":[]," + + nuiString("border") + ":true," + + nuiString("type") + ":" + nuiString("group") + "," + + nuiString("scrollbars") + ":" + nuiInt(NUI_SCROLLBARS_AUTO) + + "}"; + + nui_SetControl(sGroup, "group"); + nui_ToggleIncrementFlag(TRUE); +} + +void NUI_CloseGroup() {nui_DecrementPath();} + +void NUI_AddListbox(string sID = "") +{ + sID = (sID == "" ? "" : nuiString("id") + ":" + nuiString(sID) + ","); + string sList = "{" + sID + + nuiString("row_template") + ":[]," + + nuiString("row_count") + ":1," + + nuiString("border") + ":true," + + nuiString("row_height") + ":25.0," + + nuiString("type") + ":" + nuiString("list") + "," + + nuiString("scrollbars") + ":" + nuiInt(NUI_SCROLLBARS_Y) + + "}"; + + nui_SetControl(sList, "listbox"); + nui_ToggleIncrementFlag(TRUE); +} + +void NUI_CloseListbox() {nui_DecrementPath();} + +void NUI_AddOptionGroup(string sID = "") +{ + nui_CreateControl("options", sID); + nui_SetProperty("elements", "[]"); +} + +void NUI_AddToggleGroup(string sID = "") +{ + nui_CreateControl("tabbar", sID); + nui_SetProperty("elements", "[]"); +} + +void NUI_AddTextbox(string sID = "") +{ + nui_CreateControl("textedit", sID); + nui_SetProperty("wordwrap", nuiBool(TRUE)); +} + +// Drawlist -------------------------------------------------------------------- + +void NUI_DrawLine(string sPoints) +{ + string sDraw = + nuiString("points") + ":" + sPoints + "," + + nuiString("type") + ":" + nuiInt(0); + + nui_ToggleIncrementFlag(FALSE); + nui_SetControl(nui_CreateCanvasTemplate(sDraw)); +} + +void NUI_DrawRectangle(float x, float y, float w, float h) +{ + NUI_DrawLine(NUI_GetRectanglePoints(x, y, w, h)); +} + +void NUI_DrawDefinedRectangle(string sRect) +{ + NUI_DrawLine(NUI_GetDefinedRectanglePoints(sRect)); +} + +void NUI_DrawCircle(float x, float y, float r) +{ + string sDraw = + nuiString("rect") + ":" + NUI_DefineCircle(x, y, r) + "," + + nuiString("type") + ":" + nuiInt(2); + + nui_ToggleIncrementFlag(FALSE); + nui_SetControl(nui_CreateCanvasTemplate(sDraw)); +} + +void NUI_DrawDefinedCircle(string sCircle) +{ + string sDraw = + nuiString("rect") + ":" + sCircle + "," + + nuiString("type") + ":" + nuiInt(2); + + nui_ToggleIncrementFlag(FALSE); + nui_SetControl(nui_CreateCanvasTemplate(sDraw)); +} + +void NUI_DrawTextbox(string sRect, string sText) +{ + string sDraw = + nuiString("rect") + ":" + sRect + "," + + nuiString("text") + ":" + (nuiIsBind(sText) ? sText : nuiString(sText)) + "," + + nuiString("type") + ":" + nuiInt(4); + + nui_ToggleIncrementFlag(FALSE); + nui_SetControl(nui_CreateCanvasTemplate(sDraw)); +} + +void NUI_DrawImage(string sResref, string sRect, int nAspect, int nHAlign, int nVAlign) +{ + string sDraw = + nuiString("rect") + ":" + sRect + "," + + nuiString("image") + ":" + + (nuiIsBind(sResref) ? sResref : nuiString(sResref)) + "," + + nuiString("image_aspect") + ":" + nuiInt(nAspect) + "," + + nuiString("image_halign") + ":" + nuiInt(nHAlign) + "," + + nuiString("image_valign") + ":" + nuiInt(nVAlign) + "," + + nuiString("type") + ":" + nuiInt(5); + + nui_ToggleIncrementFlag(FALSE); + nui_SetControl(nui_CreateCanvasTemplate(sDraw)); +} + +void NUI_DrawArc(string sCenter, float fRadius, float fAMin, float fAMax) +{ + string sDraw = + nuiString("c") + ":" + sCenter + "," + + nuiString("radius") + ":" + nuiFloat(fRadius) + "," + + nuiString("amin") + ":" + nuiFloat(fAMin) + "," + + nuiString("amax") + ":" + nuiFloat(fAMax) + "," + + nuiString("type") + ":" + nuiInt(3); + + nui_ToggleIncrementFlag(FALSE); + nui_SetControl(nui_CreateCanvasTemplate(sDraw)); +} + +void NUI_DrawCurve(string sA, string sB, string sCtrl0, string sCtrl1) +{ + string sDraw = + nuiString("a") + ":" + sA + "," + + nuiString("b") + ":" + sB + "," + + nuiString("ctrl0") + ":" + sCtrl0 + "," + + nuiString("ctrl1") + ":" + sCtrl1 + "," + + nuiString("type") + ":" + nuiInt(1); + + nui_ToggleIncrementFlag(FALSE); + nui_SetControl(nui_CreateCanvasTemplate(sDraw)); +} + +void NUI_BindLine(string sBind) {NUI_DrawLine(nuiBind(sBind));} +void NUI_BindCircle(string sBind) {NUI_DrawDefinedCircle(nuiBind(sBind));} + +void NUI_BindTextbox(string sRectangle, string sText) +{ + string sDraw = + nuiString("text") + ":" + nuiBind(sText) + "," + + nuiString("points") + ":" + nuiBind(sRectangle) + "," + + nuiString("type") + ":" + nuiInt(4); + + nui_ToggleIncrementFlag(FALSE); + nui_SetControl(nui_CreateCanvasTemplate(sDraw)); +} + +void NUI_BindImage(string sResref, string sRectangle, string sAspect, string sHAlign, string sVAlign) +{ + string sDraw = + nuiString("rect") + ":" + nuiBind(sRectangle) + "," + + nuiString("image") + ":" + nuiBind(sResref) + "," + + nuiString("image_aspect") + ":" + nuiBind(sAspect) + "," + + nuiString("image_halign") + ":" + nuiBind(sHAlign) + "," + + nuiString("image_valign") + ":" + nuiBind(sVAlign) + "," + + nuiString("type") + ":" + nuiInt(5); + + nui_ToggleIncrementFlag(FALSE); + nui_SetControl(nui_CreateCanvasTemplate(sDraw)); +} + +void NUI_BindArc(string sCenter, string sRadius, string sStartAngle, string sEndAngle) +{ + string sDraw = + nuiString("c") + ":" + nuiBind(sCenter) + "," + + nuiString("radius") + ":" + nuiBind(sRadius) + "," + + nuiString("amin") + ":" + nuiBind(sStartAngle) + "," + + nuiString("amax") + ":" + nuiBind(sEndAngle) + "," + + nuiString("type") + ":" + nuiInt(3); + + nui_ToggleIncrementFlag(FALSE); + nui_SetControl(nui_CreateCanvasTemplate(sDraw)); +} + +void NUI_BindCurve(string sStart, string sEnd, string sCtrl0, string sCtrl1) +{ + NUI_DrawCurve(nuiBind(sStart), nuiBind(sEnd), nuiBind(sCtrl0), nuiBind(sCtrl1)); +} + +// ----------------------------------------------------------------------------- +// Form and Control Properties +// ----------------------------------------------------------------------------- + +// Binds ----------------------------------------------------------------------- +// Forms --------------------------------------------------------------------- +void NUI_BindAcceptsInput(string sBind, int bWatch = FALSE) {nui_SetProperty("accepts_input", nuiBind(sBind, bWatch));} +void NUI_BindClosable(string sBind, int bWatch = FALSE) {nui_SetProperty("closable", nuiBind(sBind, bWatch));} +void NUI_BindCollapsible(string sBind, int bWatch = FALSE) {nui_SetProperty("collapsed", nuiBind(sBind, bWatch));} +void NUI_BindEdgeConstraint(string sBind, int bWatch = FALSE) {nui_SetProperty("edge_constraint", nuiBind(sBind, bWatch));} +void NUI_BindGeometry(string sBind, int bWatch = FALSE) {nui_SetProperty("geometry", nuiBind(sBind, bWatch));} +void NUI_BindResizable(string sBind, int bWatch = FALSE) {nui_SetProperty("resizable", nuiBind(sBind, bWatch));} +void NUI_BindSizeConstraint(string sBind, int bWatch = FALSE) {nui_SetProperty("size_constraint", nuiBind(sBind, bWatch));} +void NUI_BindTitle(string sBind, int bWatch = FALSE) {nui_SetProperty("title", nuiBind(sBind, bWatch));} +void NUI_BindTitleColor(string sBind, int bWatch = FALSE) {nui_SetProperty("foreground_color", nuiBind(sBind, bWatch));} +void NUI_BindTransparent(string sBind, int bWatch = FALSE) {nui_SetProperty("transparent", nuiBind(sBind, bWatch));} + +// Binds ----------------------------------------------------------------------- +// Shared -------------------------------------------------------------------- +void NUI_BindBorder(string sBind, int bWatch = FALSE) {nui_SetProperty("border", nuiBind(sBind, bWatch));} + +// Binds ----------------------------------------------------------------------- +// Controls ------------------------------------------------------------------ +void NUI_BindData(string sBind, int bWatch = FALSE) {nui_SetProperty("data", nuiBind(sBind, bWatch));} +void NUI_BindDisabledTooltip(string sBind, int bWatch = FALSE) {nui_SetProperty("disabled_tooltip", nuiBind(sBind, bWatch));} +void NUI_BindElements(string sBind, int bWatch = FALSE) {nui_SetProperty("elements", nuiBind(sBind, bWatch));} +void NUI_BindEnabled(string sBind, int bWatch = FALSE) {nui_SetProperty("enabled", nuiBind(sBind, bWatch));} +void NUI_BindEncouraged(string sBind, int bWatch = FALSE) {nui_SetProperty("encouraged", nuiBind(sBind, bWatch));} +void NUI_BindEndPoint(string sBind, int bWatch = FALSE) {nui_SetProperty("b", nuiBind(sBind, bWatch));} +void NUI_BindFill(string sBind, int bWatch = FALSE) {nui_SetProperty("fill", nuiBind(sBind, bWatch));} +void NUI_BindForegroundColor(string sBind, int bWatch = FALSE) {nui_SetProperty("foreground_color", nuiBind(sBind, bWatch));} +void NUI_BindHorizontalAlignment(string sBind, int bWatch = FALSE) {nui_SetProperty("text_halign", nuiBind(sBind, bWatch));} +void NUI_BindLegend(string sBind, int bWatch = FALSE) {nui_SetProperty("legend", nuiBind(sBind, bWatch));} +void NUI_BindLength(string sBind, int bWatch = FALSE) {nui_SetProperty("max", nuiBind(sBind, bWatch));} +void NUI_BindLineThickness(string sBind, int bWatch = FALSE) {nui_SetProperty("line_thickness", nuiBind(sBind, bWatch));} +void NUI_BindPlaceholder(string sBind, int bWatch = FALSE) {nui_SetProperty("label", nuiBind(sBind, bWatch));} +void NUI_BindPoints(string sBind, int bWatch = FALSE) {nui_SetProperty("points", nuiBind(sBind, bWatch));} +void NUI_BindRadius(string sBind, int bWatch = FALSE) {nui_SetProperty("radius", nuiBind(sBind, bWatch));} +void NUI_BindRectangle(string sBind, int bWatch = FALSE) {nui_SetProperty("rect", nuiBind(sBind, bWatch));} +void NUI_BindRegion(string sBind, int bWatch = FALSE) {nui_SetProperty("image_region", nuiBind(sBind, bWatch));} +void NUI_BindRotation(string sBind, int bWatch = FALSE) {nui_SetProperty("rotate", nuiBind(sBind, bWatch));} +void NUI_BindRowCount(string sBind, int bWatch = FALSE) {nui_SetProperty("row_count", nuiBind(sBind, bWatch));} +void NUI_BindScale(string sBind, int bWatch = FALSE) {nui_SetProperty("scale", nuiBind(sBind, bWatch));} +void NUI_BindScissor(string sBind, int bWatch = FALSE) {nui_SetProperty("draw_list_scissor", nuiBind(sBind, bWatch));} +void NUI_BindShear(string sBInd, int bWatch = FALSE) {nui_SetProperty("shear", nuiBind(sBInd, bWatch));} +void NUI_BindStartPoint(string sBind, int bWatch = FALSE) {nui_SetProperty("a", nuiBind(sBind, bWatch));} +void NUI_BindStep(string sBind, int bWatch = FALSE) {nui_SetProperty("step", nuiBind(sBind, bWatch));} +void NUI_BindText(string sBind, int bWatch = FALSE) {nui_SetProperty("text", nuiBind(sBind, bWatch));} +void NUI_BindTranslation(string sBInd, int bWatch = FALSE) {nui_SetProperty("translate", nuiBind(sBInd, bWatch));} +void NUI_BindType(string sBind, int bWatch = FALSE) {nui_SetProperty("type", nuiBind(sBind, bWatch));} +void NUI_BindValue(string sBind, int bWatch = FALSE) {nui_SetProperty("value", nuiBind(sBind, bWatch));} +void NUI_BindVerticalAlignment(string sBind, int bWatch = FALSE) {nui_SetProperty("text_valign", nuiBind(sBind, bWatch));} +void NUI_BindVisible(string sBind, int bWatch = FALSE) {nui_SetProperty("visible", nuiBind(sBind, bWatch));} + +void NUI_BindAspect(string sBind, int bWatch = FALSE) +{ + string sProperty; + if (nui_GetDrawlistFlag() || nui_GetControlType() == "image") + sProperty = "image_aspect"; + else + sProperty = "aspect"; + + nui_SetProperty(sProperty, nuiBind(sBind, bWatch)); +} + +void NUI_BindColor(string sBind, int bWatch = FALSE) +{ + string sProperty = (nui_GetControlType() == "color_picker" ? "value" : "color"); + nui_SetProperty(sProperty, nuiBind(sBind, bWatch)); +} + +void NUI_BindSliderBounds(string sUpper, string sLower, string sStep, int bWatch = FALSE) +{ + nui_SetProperty("max", nuiBind(sUpper, bWatch)); + nui_SetProperty("min", nuiBind(sLower, bWatch)); + nui_SetProperty("step", nuiBind(sStep, bWatch)); +} + +void NUI_BindLabel(string sBind, int bWatch = FALSE) +{ + string sProperty = (nui_GetControlType() == "label" ? "value" : "label"); + nui_SetProperty(sProperty, nuiBind(sBind, bWatch)); +} + +void NUI_BindMax(string sBind, int bWatch = FALSE) +{ + string sProperty = (nui_GetDrawlistFlag() ? "amax" : "max"); + nui_SetProperty(sProperty, nuiBind(sBind, bWatch)); +} + +void NUI_BindMin(string sBind, int bWatch = FALSE) +{ + string sProperty = (nui_GetDrawlistFlag() ? "amin" : "min"); + nui_SetProperty(sProperty, nuiBind(sBind, bWatch)); +} + +void NUI_BindResref(string sBind, int bWatch = FALSE) +{ + string sProperty, sType = nui_GetControlType(); + if (sType == "button_image") sProperty = "label"; + else if (sType == "image") sProperty = "value"; + else if (sType == "movieplayer") sProperty = "value"; + else sProperty = "image"; + + nui_SetProperty(sProperty, nuiBind(sBind, bWatch)); +} + +void NUI_BindTooltip(string sBind, int bDisabledTooltip = FALSE, int bWatch = FALSE) +{ + if (nui_GetControlType() == "combo") + return; + + nui_SetProperty("tooltip", nuiBind(sBind, bWatch)); + if (bDisabledTooltip) NUI_BindDisabledTooltip(sBind, bWatch); +} + +// Sets ------------------------------------------------------------------------ +// Forms --------------------------------------------------------------------- +void NUI_SetAcceptsInput(int bAcceptsInput = TRUE) {nui_SetProperty("accepts_input", nuiBool(bAcceptsInput));} +void NUI_SetClosable(int bClosable = TRUE) {nui_SetProperty("closable", nuiBool(bClosable));} +void NUI_SetCollapsible(int bCollapsible = TRUE) {nui_SetProperty("collapsed", nuiBool(bCollapsible));} +void NUI_SetTitle(string sTitle) {nui_SetProperty("title", nuiString(sTitle));} +void NUI_SetTitleColor(string sColor) {nui_SetProperty("foreground_color", sColor);} +void NUI_SetTOCTitle(string sTitle) {nui_SetProperty("toc_title", nuiString(sTitle));} +void NUI_SetDefinedGeometry(string sGeometry) {nui_SetProperty("geometry", sGeometry);} +void NUI_SetGeometry(float x, float y, float w, float h) {nui_SetProperty("geometry", NUI_DefineRectangle(x, y, w, h));} +void NUI_SetResizable(int bResizable = TRUE) {nui_SetProperty("resizable", nuiBool(bResizable));} +void NUI_SetTransparent(int bTransparent = TRUE) {nui_SetProperty("transparent", nuiBool(bTransparent));} + +void NUI_SetEdgeConstraint(float fLeft, float fRight, float fTop, float fBottom) +{ + nui_SetProperty("edge_constraint", NUI_DefineRectangle(fLeft, fTop, fRight, fBottom)); +} + +void NUI_SetSizeConstraint(float fMinWidth, float fMinHeight, float fMaxWidth, float fMaxHeight) +{ + nui_SetProperty("size_constraint", NUI_DefineRectangle(fMinWidth, fMinHeight, fMaxWidth, fMaxHeight)); +} + +// Sets ------------------------------------------------------------------------ +// Shared -------------------------------------------------------------------- +void NUI_SetBorder(int bVisible = TRUE) {nui_SetProperty("border", nuiBool(bVisible));} +void NUI_SetCustomKey(string sKey, string sValue) {nui_SetProperty(sKey, sValue);} + +// Sets ------------------------------------------------------------------------ +// Controls ------------------------------------------------------------------ +void NUI_SetAspect(int nAspect) {nui_SetProperty("image_aspect", nuiInt(nAspect));} +void NUI_SetAspectRatio(float fAspect) {nui_SetProperty("aspect", nuiFloat(fAspect));} +void NUI_SetCenter(float x, float y) {nui_SetProperty("c", NUI_DefinePoint(x, y));} +void NUI_SetDefaultValue(string sDefault) {nui_SetProperty("default_value", sDefault);} +void NUI_SetDisabledTooltip(string sTooltip) {nui_SetProperty("disabled_tooltip", nuiString(sTooltip));} +void NUI_SetDirection(int nDirection = NUI_ORIENTATION_ROW) {nui_SetProperty("direction", nuiInt(nDirection));} +void NUI_SetDrawCondition(int nCondition = NUI_DRAW_ALWAYS) {nui_SetProperty("render", nuiInt(nCondition));} +void NUI_SetDrawPosition(int nPosition = NUI_DRAW_ABOVE) {nui_SetProperty("order", nuiInt(nPosition));} +void NUI_SetEnabled(int bEnabled = TRUE) {nui_SetProperty("enabled", nuiBool(bEnabled));} +void NUI_SetEncouraged(int bEncouraged = TRUE) {nui_SetProperty("encouraged", nuiBool(bEncouraged));} +void NUI_SetFill(int bFill = TRUE) {nui_SetProperty("fill", nuiBool(bFill));} +void NUI_SetForegroundColor(string sColor) {nui_SetProperty("foreground_color", sColor);} +void NUI_SetHeight(float fHeight) {nui_SetProperty("height", nuiFloat(fHeight));} +void NUI_SetID(string sID) {nui_SetProperty("id", nuiString(sID));} +void NUI_SetLength(int nLength) {nui_SetProperty("max", nuiInt(nLength));} +void NUI_SetLineThickness(float fThickness) {nui_SetProperty("line_thickness", nuiFloat(fThickness));} +void NUI_SetMargin(float fMargin) {nui_SetProperty("margin", nuiFloat(fMargin));} +void NUI_SetMultiline(int bMultiline = TRUE) {nui_SetProperty("multiline", nuiBool(bMultiline));} +void NUI_SetPadding(float fPadding) {nui_SetProperty("padding", nuiFloat(fPadding));} +void NUI_SetPlaceholder(string sText) {nui_SetProperty("label", nuiString(sText));} +void NUI_SetPoints(string sPoints) {nui_SetProperty("points", sPoints);} +void NUI_SetRadius(float r) {nui_SetProperty("radius", nuiFloat(r));} +void NUI_SetRectangle(string sRectangle) {nui_SetProperty("rect", sRectangle);} +void NUI_SetRegion(string sRegion) {nui_SetProperty("image_region", sRegion);} +void NUI_SetRotation(float fAngle) {nui_SetProperty("rotate", nuiFloat(fAngle));} +void NUI_SetRowCount(int nRowCount) {nui_SetProperty("row_count", nuiInt(nRowCount));} +void NUI_SetRowHeight(float fRowHeight) {nui_SetProperty("row_height", nuiFloat(fRowHeight));} +void NUI_SetScale(float x, float y) {nui_SetProperty("scale", NUI_DefinePoint(x, y));} +void NUI_SetScissor(int bScissor) {nui_SetProperty("draw_list_scissor", nuiBool(bScissor));} +void NUI_SetScrollbars(int nScrollbars = NUI_SCROLLBARS_AUTO) {nui_SetProperty("scrollbars", nuiInt(nScrollbars));} +void NUI_SetShear(float x, float y) {nui_SetProperty("shear", NUI_DefinePoint(x, y));} +void NUI_SetStatic() {nui_SetProperty("type", nuiString("text"));} +void NUI_SetTemplateVariable(int bVariable) {nui_SetProperty("NUI_TEMPLATE_VARIABLE", nuiBool(bVariable));} +void NUI_SetTemplateWidth(float fWidth) {nui_SetProperty("NUI_TEMPLATE_WIDTH", nuiFloat(fWidth));} +void NUI_SetText(string sText) {nui_SetProperty("text", nuiString(sText));} +void NUI_SetTranslation(float x, float y) {nui_SetProperty("translate", NUI_DefinePoint(x, y));} +void NUI_SetValue(string sValue) {nui_SetProperty("value", sValue);} +void NUI_SetVisible(int bVisible = TRUE) {nui_SetProperty("visible", nuiBool(bVisible));} +void NUI_SetWidth(float fWidth) {nui_SetProperty("width", nuiFloat(fWidth));} +void NUI_SetWordWrap(int bWrap = TRUE) {nui_SetProperty("wordwrap", nuiBool(bWrap));} + +void NUI_SetColor(string sColor) +{ + string sProperty = (nui_GetControlType() == "color_picker" ? "value" : "color"); + nui_SetProperty(sProperty, sColor); +} + +void NUI_SetDimensions(float fWidth, float fHeight) +{ + NUI_SetWidth(fWidth); + NUI_SetHeight(fHeight); +} + +void NUI_SetElements(string sElements) +{ + int nEntry = nui_GetEntryCount(); + string sType = nui_GetControlType(); + int n; for(n; n < CountList(sElements); n++) + { + string sElement, sEntry = GetListItem(sElements, n); + if (sType == "combo") + sElement = "[" + + nuiString(sEntry) + "," + + nuiInt(nEntry++) + + "]"; + else if (sType == "options" || sType == "tabbar") + sElement = nuiString(sEntry); + + nui_IncrementEntryCount(); + nui_SetProperty("NUI_ELEMENT", sElement); + } +} + +void NUI_SetFloatSliderBounds(float fLower, float fUpper, float fStep) +{ + nui_SetProperty("min", nuiFloat(fLower)); + nui_SetProperty("max", nuiFloat(fUpper)); + nui_SetProperty("step", nuiFloat(fStep)); +} + +void NUI_SetHorizontalAlignment(int nAlign) +{ + string sProperty = (nui_GetControlType() == "label" ? "text_halign" : "image_halign"); + nui_SetProperty(sProperty, nuiInt(nAlign)); +} + +void NUI_SetIntSliderBounds(int nLower, int nUpper, int nStep) +{ + nui_SetProperty("min", nuiInt(nLower)); + nui_SetProperty("max", nuiInt(nUpper)); + nui_SetProperty("step", nuiInt(nStep)); +} + +void NUI_SetLabel(string sLabel) +{ + string sProperty = (nui_GetControlType() == "label" ? "value" : "label"); + nui_SetProperty(sProperty, nuiString(sLabel)); +} + +void NUI_SetResref(string sResref) +{ + string sProperty, sType = nui_GetControlType(); + if (sType == "button_image") sProperty = "label"; + else if (sType == "image") sProperty = "value"; + else if (sType == "movieplayer") sProperty = "value"; + else if (sType == "button") sProperty = "value"; + else sProperty = "image"; + + nui_SetProperty(sProperty, nuiString(sResref)); +} + +void NUI_SetSquare(float fSide) +{ + NUI_SetHeight(fSide); + NUI_SetWidth(fSide); +} + +void NUI_SetTooltip(string sTooltip, int bDisabledTooltip = FALSE) +{ + if (nui_GetControlType() == "combo") + return; + + nui_SetProperty("tooltip", nuiString(sTooltip)); + if (bDisabledTooltip) NUI_SetDisabledTooltip(sTooltip); +} + +// TODO alignments for future movie player growth? +void NUI_SetVerticalAlignment(int nAlign) +{ + string sProperty = (nui_GetControlType() == "label" ? "text_valign" : "image_valign"); + nui_SetProperty(sProperty, nuiInt(nAlign)); +} + +// TODO not tested +void NUI_SetChartSeries(int nType, string sLegend, string sColor, string sData) +{ + string sChart = "{" + + nuiString("type") + ":" + nuiInt(nType) + "," + + nuiString("legend") + ":" + nuiString(sLegend) + "," + + nuiString("color") + ":" + sColor + "," + + nuiString("data") + ":" + sData + + "}"; + + nui_SetProperty("NUI_SERIES", sChart); +} + +// ----------------------------------------------------------------------------- +// Form Definition/Management +// Private +// ----------------------------------------------------------------------------- + +json nui_GetForm(string sFormID, int bForceModule = FALSE) +{ + sqlquery sql = nui_PrepareQuery("SELECT definition FROM nui_forms WHERE form = @form;", bForceModule); + SqlBindString(sql, "@form", sFormID); + + return SqlStep(sql) ? SqlGetJson(sql, 0) : JsonNull(); +} + +string nui_GetFormsByPrefix(string sForms, string sPrefix, int nResType) +{ + string sForm; + int n; while ((sForm = ResManFindPrefix(sPrefix, nResType, ++n)) != "") + sForms = AddListItem(sForms, sForm, TRUE); + + return sForms; +} + +string nui_GetForms(string sPrefix) +{ + string sForms = nui_GetFormsByPrefix("", sPrefix, RESTYPE_NCS); + return sForms = nui_GetFormsByPrefix(sForms, sPrefix, RESTYPE_NSS); +} + +int nui_ExecuteFunction(string sFile, string sFunction, object oTarget = OBJECT_SELF, string sArguments = "") +{ + if (sFile == "" || sFunction == "") + return FALSE; + + if (ResManFindPrefix(sFile, RESTYPE_NCS) == sFile) + { + SetScriptParam("NUI_FUNCTION", sFunction); + SetScriptParam("NUI_ARGS", sArguments); + ExecuteScript(sFile, oTarget); + return TRUE; + } + + if (sArguments != "") sArguments = nuiString(sArguments); + + string sChunk = "#" + "include " + nuiString(sFile) + " " + + "void main() {" + sFunction + "(" + sArguments + ");}"; + return ExecuteScriptChunk(sChunk, oTarget, FALSE) == ""; +} + +json nui_GetWatchedBinds(string sFormID) +{ + string sQuery = "SELECT json_group_array(value) FROM (SELECT DISTINCT value FROM nui_forms, " + + "json_tree(nui_forms.definition, '$') WHERE key = 'bind' AND json_extract(" + + "nui_forms.definition, path || '.watch') = true AND form = @form);"; + sqlquery sql = nui_PrepareQuery(sQuery); + SqlBindString(sql, "@form", sFormID); + return SqlStep(sql) ? SqlGetJson(sql, 0) : JsonArray(); +} + +json NUI_GetOrphanBinds(string sFormID) +{ + string sQuery = "SELECT json_group_array(value) FROM (SELECT DISTINCT value FROM nui_forms, " + + "json_tree(nui_forms.definition, '$') WHERE key = 'bind' and form = @form EXCEPT " + + "SELECT key FROM (SELECT DISTINCT key FROM nui_forms, json_each(nui_forms.definition, " + + "'$.profiles.default') AS value WHERE form = @form));"; + sqlquery sql = nui_PrepareQuery(sQuery); + SqlBindString(sql, "@form", sFormID); + return SqlStep(sql) ? SqlGetJson(sql, 0) : JsonArray(); +} + +// ----------------------------------------------------------------------------- +// Form Profiles +// Private +// ----------------------------------------------------------------------------- + +void nui_SetProfile(string sProfile) {SetLocalString(nui_GetDataObject(), "NUI_PROFILE", sProfile);} +string nui_GetProfile() {return GetLocalString(nui_GetDataObject(), "NUI_PROFILE");} + +/// @private Sets the profile bind value into the form definition. +void nui_SetProfileBind(string sProperty, string sJson = "") +{ + string sPath = "$.profiles." + nui_GetProfile() + "." + sProperty; + string sQuery = "UPDATE nui_forms SET definition = (SELECT json_set(definition, '" + sPath + + "', json(@json)) FROM nui_forms WHERE form = @form) WHERE form = @form;"; + + sqlquery sql = nui_PrepareQuery(sQuery); + SqlBindString(sql, "@form", nui_GetFormID()); + SqlBindString(sql, "@json", sJson); + SqlStep(sql); +} + +/// @private Used when basing a new profile off an old profile. To prevent massive amounts +/// of potential recursion, just copy the base profile and go from there. +void nui_CopyProfile(string sBase) +{ + string sQuery = "WITH base AS (SELECT value FROM nui_forms, json_tree(nui_forms.definition, " + + "'$.profiles') WHERE key = @base AND form = @form) UPDATE nui_forms SET definition = " + + "(SELECT json_set(definition, '$.profiles." + nui_GetProfile() + "', json_extract(base.value, '$')) " + + "FROM nui_forms, base WHERE form = @form) WHERE form = @form;"; + + sqlquery sql = nui_PrepareQuery(sQuery); + SqlBindString(sql, "@base", sBase); + SqlBindString(sql, "@form", nui_GetFormID()); + SqlStep(sql); +} + +/// @private Returns a json object of bind:value pairs from the default profile as modified +/// by sProfile. +json nui_GetProfileBinds(string sFormID, string sProfile = "") +{ + string sQuery = "WITH def AS (SELECT value FROM nui_forms, json_tree(nui_forms.definition, " + + "'$.profiles') WHERE key = 'default' AND form = @form), sel AS (SELECT " + + "COALESCE((SELECT value from nui_forms, json_tree(nui_forms.definition, '$.profiles') " + + "WHERE key = @profile AND form = @form), json_object()) value FROM nui_forms WHERE form = @form) " + + "SELECT json_patch(json_extract(def.value, '$'), json_extract(sel.value, '$')) FROM def, sel;"; + + sqlquery sql = nui_PrepareQuery(sQuery); + SqlBindString(sql, "@form", sFormID); + SqlBindString(sql, "@profile", sProfile); + return SqlStep(sql) ? SqlGetJson(sql, 0) : JsonObject(); +} + +/// @private Called during form opening, sets the initial values for all default binds. +void nui_SetProfileBinds(object oPC, string sFormID, string sProfile) +{ + json jProfile = nui_GetProfileBinds(sFormID, sProfile); + json jKeys = JsonObjectKeys(jProfile); + + int n; for (n; n < JsonGetLength(jKeys); n++) + { + string sKey = JsonGetString(JsonArrayGet(jKeys, n)); + NUI_SetBindJ(oPC, sFormID, sKey, JsonObjectGet(jProfile, sKey)); + } + + NUI_SetBind(oPC, sFormID, "NUI_FORM_PROFILE", nuiString(sProfile)); +} + +void nui_SetWatchedBinds(object oPC, string sFormID) +{ + json jBinds = nui_GetWatchedBinds(sFormID); + int n; for (n; n < JsonGetLength(jBinds); n++) + { + string sBind = JsonGetString(JsonArrayGet(jBinds, n)); + NUI_SetBindWatch(oPC, sFormID, sBind); + } +} + +// ----------------------------------------------------------------------------- +// Form Definition/Management +// Public +// ----------------------------------------------------------------------------- + +void NUI_DefineForms(string sFormfile = "") +{ + nui_ClearVariables(); + nui_BeginTransaction(); + nui_ToggleDefinitionFlag(TRUE); + + if (sFormfile != "") + { + nui_SetFormfile(sFormfile); + nui_ExecuteFunction(sFormfile, NUI_DEFINE); + } + else + { + int n; for (n; n < CountList(NUI_FORMFILE_PREFIX); n++) + { + string sFormfiles = nui_GetForms(GetListItem(NUI_FORMFILE_PREFIX, n)); + if (sFormfiles == "") return; + + int f; for (f; f < CountList(sFormfiles); f++) + { + sFormfile = GetListItem(sFormfiles, f); + + nui_SetFormfile(sFormfile); + nui_ExecuteFunction(sFormfile, NUI_DEFINE); + } + } + } + + nui_ToggleDefinitionFlag(FALSE); + nui_CopyDefinitions(); + nui_CommitTransaction(); +} + +int NUI_DisplayForm(object oPC, string sFormID, string sProfile = "default") +{ + json jForm = nui_GetForm(sFormID); + if (jForm != JsonNull()) + { + int nToken = NuiCreate(oPC, jForm, sFormID); + json jData = JsonObjectSet(JsonObject(), "profile", JsonString(sProfile)); + jData = JsonObjectSet(jData, "formfile", JsonString(nui_GetDefinitionValue(sFormID, "formfile"))); + + NuiSetUserData(oPC, NuiFindWindow(oPC, sFormID), jData); + return nToken; + } + + return -1; +} + +void NUI_CloseForm(object oPC, string sFormID) {NuiDestroy(oPC, NuiFindWindow(oPC, sFormID));} + +void NUI_DisplaySubform(object oPC, string sFormID, string sElementID, string sSubformID) +{ + int nToken = NuiFindWindow(oPC, sFormID); + string sLayout = nui_GetDefinitionValue(NuiGetWindowId(oPC, nToken), "subforms." + sSubformID); + NuiSetGroupLayout(oPC, nToken, sElementID, JsonParse(sLayout)); +} + +int NUI_GetFormToken(object oPC, string sFormID) +{ + return NuiFindWindow(oPC, sFormID); +} + +// ----------------------------------------------------------------------------- +// Form Profiles +// Public +// ----------------------------------------------------------------------------- + +void NUI_CreateDefaultProfile() {NUI_CreateProfile("default");} + +void NUI_CreateProfile(string sProfile, string sBase = "") +{ + nui_SetProfile(sProfile); + + if (sBase != "") + nui_CopyProfile(sBase); +} + +void NUI_SetProfileBind(string sBind, string sJson) +{ + if (sBind == "" || sJson == "" || JsonParse(sJson) == JsonNull()) + return; + + nui_SetProfileBind(sBind, sJson); +} + +void NUI_SetProfileBindJ(string sBind, json jValue) +{ + NUI_SetProfileBind(sBind, JsonDump(jValue)); +} + +void NUI_SetProfileBinds(string sBinds, string sJson) +{ + if (sBinds == "" || sJson == "" || JsonParse(sJson) == JsonNull()) + return; + + int n; for (n; n < CountList(sBinds); n++) + nui_SetProfileBind(GetListItem(sBinds, n), sJson); +} + +void NUI_SetProfile(object oPC, string sFormID, string sProfile) +{ + nui_SetProfileBinds(oPC, sFormID, sProfile); +} + +string NUI_GetProfile(object oPC, string sFormID) +{ + return JsonGetString(NUI_GetBind(oPC, sFormID, "NUI_FORM_PROFILE")); +} + +// ----------------------------------------------------------------------------- +// Event Management +// Private +// ----------------------------------------------------------------------------- + +int nui_HandleInspectionEvents(int nEventID = -1) +{ + struct NUIEventData ed = NUI_GetEventData(); + + if (NUI_FI_RECORD_DATA == NUI_FI_NEVER) + return -1; + else if (NUI_FI_RECORD_DATA == NUI_FI_WHEN_OPEN && !NUI_GetIsFormOpen(ed.oPC, "nui_inspector")) + return -1; + + if (ed.sEvent == "close") + { + sqlquery sql = nui_PrepareQuery("DELETE FROM nui_fi_data WHERE nToken = @token;"); + SqlBindInt(sql, "@token", NuiGetEventWindow()); + SqlStep(sql); + return -1; + } + + json jCurrentState = NUI_GetBindState(ed.oPC, ed.sFormID); + + string sQuery; + sqlquery sql; + + if (nEventID == -1) + { + sQuery = + "INSERT INTO nui_fi_data (sPlayer, sFormID, nToken, sEvent, sControlID, nIndex, jPayload, " + + "binds_before, timestamp) VALUES (@sPlayer, @sFormID, @nToken, @sEvent, @sControlID, @nIndex, " + + "@jPayload, @binds_before, strftime('%s','now')) RETURNING event_id;"; + + sql = nui_PrepareQuery(sQuery); + + SqlBindString(sql, "@sPlayer", GetObjectUUID(ed.oPC)); + SqlBindString(sql, "@sFormID", ed.sFormID); + SqlBindInt (sql, "@nToken", ed.nToken); + SqlBindString(sql, "@sEvent", ed.sEvent); + SqlBindString(sql, "@sControlID", ed.sControlID); + SqlBindInt (sql, "@nIndex", ed.nIndex); + SqlBindJson (sql, "@jPayload", ed.jPayload); + SqlBindJson (sql, "@binds_before", jCurrentState); + + nEventID = SqlStep(sql) ? SqlGetInt(sql, 0) : -1; + } + else + { + sQuery = + "UPDATE nui_fi_data SET binds_after = @binds_after " + + "WHERE event_id = @event_id;"; + sql = nui_PrepareQuery(sQuery); + SqlBindJson (sql, "@binds_after", jCurrentState); + SqlBindInt (sql, "@event_id", nEventID); + + SqlStep(sql); + } + + if (nEventID != -1) + { + SignalEvent(GetModule(), EventUserDefined(NUI_FI_EVENT_UPDATE_FORMS)); + SignalEvent(GetModule(), EventUserDefined(NUI_FI_EVENT_UPDATE_EVENTS)); + } + + return nEventID; +} + +void nui_HandleNUIEvents() +{ + object oPC = NuiGetEventPlayer(); + string sFormID = NuiGetWindowId(oPC, NuiGetEventWindow()); + + json jUserData = NuiGetUserData(oPC, NuiGetEventWindow()); + string sFormfile = JsonGetString(JsonObjectGet(jUserData, "formfile")); + + int nInspectorEventID = nui_HandleInspectionEvents(); + + if (NuiGetEventType() == "open") + { + string sProfile = JsonGetString(JsonObjectGet(jUserData, "profile")); + nui_SetProfileBinds(oPC, sFormID, sProfile); + nui_SetWatchedBinds(oPC, sFormID); + nui_ExecuteFunction(sFormfile, NUI_BIND, oPC); + } + + nui_ExecuteFunction(sFormfile, NUI_EVENT_NUI, oPC); + + if (nInspectorEventID != -1) + nui_HandleInspectionEvents(nInspectorEventID); +} + +// ----------------------------------------------------------------------------- +// Event Management +// Public +// ----------------------------------------------------------------------------- + +void NUI_SetBind(object oPC, string sFormID, string sBind, string sValue) +{ + NuiSetBind(oPC, NuiFindWindow(oPC, sFormID), sBind, JsonParse(sValue)); +} + +void NUI_SetBindJ(object oPC, string sFormID, string sBind, json jValue) +{ + NuiSetBind(oPC, NuiFindWindow(oPC, sFormID), sBind, jValue); +} + +void NUI_SetBindWatch(object oPC, string sFormID, string sBind, int bWatch = TRUE) +{ + NuiSetBindWatch(oPC, NuiFindWindow(oPC, sFormID), sBind, bWatch); +} + +json NUI_GetBind(object oPC, string sFormID, string sBind) +{ + return NuiGetBind(oPC, NuiFindWindow(oPC, sFormID), sBind); +} + +int NUI_GetIsFormOpen(object oPC, string sFormID) +{ + return NuiFindWindow(oPC, sFormID) > 0; +} + +void NUI_DumpEventData(struct NUIEventData ed) +{ + string sDump = + HexColorString("NUI Event Data Dump:", COLOR_CYAN) + + "\n -> " + HexColorString("PC: ", COLOR_GREEN_LIGHT) + HexColorString(GetName(ed.oPC), COLOR_ORANGE_LIGHT) + + "\n -> " + HexColorString("Form ID: ", COLOR_GREEN_LIGHT) + HexColorString(ed.sFormID, COLOR_ORANGE_LIGHT) + + "\n -> " + HexColorString("Form Token: ", COLOR_GREEN_LIGHT) + HexColorString(IntToString(ed.nToken), COLOR_ORANGE_LIGHT) + + "\n -> " + HexColorString("NUI Event: ", COLOR_GREEN_LIGHT) + HexColorString(ed.sEvent, COLOR_ORANGE_LIGHT) + + (ed.sEvent == "watch" ? + "\n -> " + HexColorString("Watched Bind: ", COLOR_GREEN_LIGHT) + HexColorString(ed.sControlID, COLOR_ORANGE_LIGHT) + + "\n -> " + HexColorString("Watched Bind Value: ", COLOR_GREEN_LIGHT) + + HexColorString(JsonDump(NuiGetBind(ed.oPC, ed.nToken, ed.sControlID)), COLOR_ORANGE_LIGHT) : + "\n -> " + HexColorString("Control ID: ", COLOR_GREEN_LIGHT) + HexColorString(ed.sControlID, COLOR_ORANGE_LIGHT)) + + (ed.nIndex > -1 ? + "\n -> " + HexColorString("Control Array Index: ", COLOR_GREEN_LIGHT) + HexColorString(IntToString(ed.nIndex), COLOR_ORANGE_LIGHT) : "") + + "\n -> " + HexColorString("Event Payload: ", COLOR_GREEN_LIGHT) + HexColorString(JsonDump(ed.jPayload), COLOR_ORANGE_LIGHT); + NUI_Debug(sDump); +} + +string NUI_GetVersions(int bIncludeForms = TRUE) +{ + int nKey = COLOR_BLUE_SKY_DEEP; + int nValue = COLOR_BLUE_LIGHT; + string sVersions = HexColorString("NUI System: ", COLOR_ORANGE_LIGHT) + HexColorString(NUI_VERSION, nValue); + + if (bIncludeForms) + { + string s = + "SELECT form || ': ', IIF(json_extract(definition, '$.local_version') = '', " + + "'', json_extract(definition, '$.local_version')) " + + "FROM nui_forms;"; + sqlquery q = nui_PrepareQuery(s); + + while (SqlStep(q)) + sVersions += "\n " + HexColorString(SqlGetString(q, 0), nKey) + HexColorString(SqlGetString(q, 1), nValue); + } + + return sVersions; +} + +struct NUIEventData NUI_GetEventData() +{ + struct NUIEventData ed; + + ed.oPC = NuiGetEventPlayer(); + ed.nToken = NuiGetEventWindow(); + ed.sFormID = NuiGetWindowId(ed.oPC, ed.nToken); + ed.sEvent = NuiGetEventType(); + ed.sControlID = NuiGetEventElement(); + ed.nIndex = NuiGetEventArrayIndex(); + ed.jPayload = NuiGetEventPayload(); + + return ed; +} + +void NUI_SubscribeEvent(int nEvent) +{ + string sQuery = "UPDATE nui_forms SET definition = (SELECT json_set(definition, " + + "'$.event_data[#]', json(@value)) FROM nui_forms WHERE form = @form) " + + "WHERE form = @form;"; + + sqlquery sql = nui_PrepareQuery(sQuery); + SqlBindString(sql, "@form", nui_GetFormID()); + SqlBindInt (sql, "@value", nEvent); + SqlStep(sql); +} + +void NUI_HandleEvents(object oPC = OBJECT_SELF) +{ + int nEvent = GetCurrentlyRunningEvent(); + if (nEvent == EVENT_SCRIPT_MODULE_ON_MODULE_LOAD) + NUI_Initialize(); + + if (nEvent == EVENT_SCRIPT_MODULE_ON_NUI_EVENT) + nui_HandleNUIEvents(); + else + { + string sQuery = "SELECT json_group_array(json_extract(nui_forms.definition, '$.formfile')) " + + "FROM nui_forms WHERE EXISTS (SELECT 1 FROM json_each(nui_forms.definition, " + + "'$.event_data') WHERE value = @event);"; + sqlquery sql = nui_PrepareQuery(sQuery); + SqlBindInt(sql, "@event", nEvent); + + SetLocalObject(oPC, NUI_OBJECT, OBJECT_SELF); + + if (SqlStep(sql)) + { + json jFormfiles = SqlGetJson(sql, 0); + int n; for (n; n < JsonGetLength(jFormfiles); n++) + nui_ExecuteFunction(JsonGetString(JsonArrayGet(jFormfiles, n)), NUI_EVENT_MOD, oPC); + } + + DeleteLocalObject(oPC, NUI_OBJECT); + } +} + +void NUI(object oPC = OBJECT_SELF) {NUI_HandleEvents(oPC);} diff --git a/_module/nss/ra_mod_onnui.nss b/_module/nss/ra_mod_onnui.nss new file mode 100644 index 00000000..71640ad3 --- /dev/null +++ b/_module/nss/ra_mod_onnui.nss @@ -0,0 +1,6 @@ +#include "nui_i_main" + +void main() +{ + NUI(); +} diff --git a/_module/nss/ra_onplaytarget.nss b/_module/nss/ra_onplaytarget.nss new file mode 100644 index 00000000..e3a477c5 --- /dev/null +++ b/_module/nss/ra_onplaytarget.nss @@ -0,0 +1,7 @@ +#include "nui_i_main" + +void main() + +{ +NUI_HandleEvents(GetLastPlayerToSelectTarget()); +} diff --git a/_module/nss/tar_lake_hb.nss b/_module/nss/tar_lake_hb.nss index 4ca66837..9e977d85 100644 --- a/_module/nss/tar_lake_hb.nss +++ b/_module/nss/tar_lake_hb.nss @@ -26,11 +26,11 @@ void ApplyHeatEffect(object oCreature) { int iHeatDam = d4(1); - ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectDamage(iHeatDam, DAMAGE_TYPE_FIRE), oCreature, 6.0f); + DelayCommand(0.0f, ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectDamage(iHeatDam, DAMAGE_TYPE_FIRE), oCreature, 6.0f)); } -//:: Can't breath in tar +//:: Can't breathe in tar void ApplySuffocationEffect(object oCreature) { int iConstitution = GetAbilityScore(oCreature, ABILITY_CONSTITUTION); @@ -139,9 +139,10 @@ void main() //:: Calculate the DC for the Strength check int iStrengthDC = 15 + iArmorPenalty; - //:: Roll a Strength check against the DC + //:: Be an Ooze Mephit or roll a Strength check against the DC if (GetResRef(OBJECT_SELF) != "mepooze001" && GetResRef(OBJECT_SELF) != "tarmephit001" || + GetAppearanceType(oCreature) != APPEARANCE_TYPE_MEPHIT_OOZE || d20() + GetAbilityModifier(ABILITY_STRENGTH, oCreature) < iStrengthDC) { //:: Apply the other effects since the Strength check failed diff --git a/_module/nss/util_c_color.nss b/_module/nss/util_c_color.nss new file mode 100644 index 00000000..83851e31 --- /dev/null +++ b/_module/nss/util_c_color.nss @@ -0,0 +1,225 @@ +/// ---------------------------------------------------------------------------- +/// @file util_c_color.nss +/// @author Ed Burke (tinygiant98) +/// @brief Configuration file for util_i_color.nss. +/// @details +/// These color codes are used with the functions from util_i_color.nss. These +/// are hex color codes, the same as you'd use in web design and may other +/// areas, so they are easy to look up and to copy-paste into other programs. +/// +/// You can change the values of any of constants below, but do not change the +/// names of the constants themselves. You can also add your own constants for +/// use in your module. +/// +/// ## Acknowledgement +/// - Function colors copied from https://nwn.wiki/display/NWN1/Colour+Tokens. +/// ---------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +// X11 Color Palette +// ----------------------------------------------------------------------------- + +// ----- Whites ---------------------------------------------------------------- +const int COLOR_AZURE = 0xf0ffff; +const int COLOR_BEIGE = 0xf5f5dc; +const int COLOR_BLUE_ALICE = 0xf0f8ff; +const int COLOR_HONEYDEW = 0xf0fff0; +const int COLOR_IVORY = 0xfffff0; +const int COLOR_LAVENDERBLUSH = 0xfff0f5; +const int COLOR_LINEN = 0xfaf0e6; +const int COLOR_MINTCREAM = 0xf5fffa; +const int COLOR_MISTYROSE = 0xffe4e1; +const int COLOR_OLDLACE = 0xfdf5e6; +const int COLOR_SEASHELL = 0xfff5ee; +const int COLOR_SNOW = 0xfffafa; +const int COLOR_WHITE = 0xffffff; +const int COLOR_WHITE_ANTIQUE = 0xfaebd7; +const int COLOR_WHITE_FLORAL = 0xfffaf0; +const int COLOR_WHITE_GHOST = 0xf8f8ff; +const int COLOR_WHITE_SMOKE = 0xf5f5f5; + +// ----- Blues ----------------------------------------------------------------- +const int COLOR_AQUA = 0x00ffff; +const int COLOR_AQUAMARINE = 0x7fffd4; +const int COLOR_BLUE = 0x0000ff; +const int COLOR_BLUE_CORNFLOWER = 0x6495ed; +const int COLOR_BLUE_DARK = 0x00008b; +const int COLOR_BLUE_DODGER = 0x1e90ff; +const int COLOR_BLUE_LIGHT = 0xadd8e6; +const int COLOR_BLUE_MEDIUM = 0x0000cd; +const int COLOR_BLUE_MIDNIGHT = 0x191970; +const int COLOR_BLUE_POWDER = 0xb0e0e6; +const int COLOR_BLUE_ROYAL = 0x4169e1; +const int COLOR_BLUE_SKY = 0x87ceeb; +const int COLOR_BLUE_SKY_DEEP = 0x00bfff; +const int COLOR_BLUE_SKY_LIGHT = 0x87cefa; +const int COLOR_BLUE_SLATE = 0x6a5acd; +const int COLOR_BLUE_SLATE_MEDIUM = 0x7b68ee; +const int COLOR_BLUE_STEEL = 0x4682b4; +const int COLOR_BLUE_STEEL_LIGHT = 0xb0c4de; +const int COLOR_CYAN = 0x00ffff; +const int COLOR_CYAN_LIGHT = 0xe0ffff; +const int COLOR_NAVY = 0x000080; +const int COLOR_TURQUOISE = 0x40e0d0; +const int COLOR_TURQUOISE_DARK = 0x00ced1; +const int COLOR_TURQUOISE_MEDIUM = 0x48d1cc; +const int COLOR_TURQUOISE_PALE = 0xafeeee; + +// ----- Browns ---------------------------------------------------------------- +const int COLOR_BISQUE = 0xffe4c4; +const int COLOR_BLANCHED_ALMOND = 0xffebcd; +const int COLOR_BROWN = 0xa52a2a; +const int COLOR_BROWN_LIGHT = 0xd0814b; +const int COLOR_BROWN_ROSY = 0xbc8f8f; +const int COLOR_BROWN_SADDLE = 0x8b4513; +const int COLOR_BROWN_SANDY = 0xf4a460; +const int COLOR_BURLYWOOD = 0xdeb887; +const int COLOR_CHOCOLATE = 0xd2691e; +const int COLOR_CORNSILK = 0xfff8dc; +const int COLOR_GOLDENROD = 0xdaa520; +const int COLOR_GOLDENROD_DARK = 0xb8860b; +const int COLOR_MAROON = 0x800000; +const int COLOR_PERU = 0xcd853f; +const int COLOR_SIENNA = 0xa0522d; +const int COLOR_TAN = 0xd2b48c; +const int COLOR_WHEAT = 0xf5deb3; +const int COLOR_WHITE_NAVAJO = 0xffdead; + +// ----- Purples --------------------------------------------------------------- +const int COLOR_BLUE_SLATE_DARK = 0x483d8b; +const int COLOR_BLUE_VIOLET = 0x8a2be2; +const int COLOR_FUCHSIA = 0xff00ff; +const int COLOR_INDIGO = 0x4b0082; +const int COLOR_LAVENDER = 0xe6e6fa; +const int COLOR_MAGENTA = 0xff00ff; +const int COLOR_MAGENTA_DARK = 0x8b008b; +const int COLOR_ORCHID = 0xda70d6; +const int COLOR_ORCHID_DARK = 0x9932cc; +const int COLOR_ORCHID_MEDIUM = 0xba55d3; +const int COLOR_PLUM = 0xdda0dd; +const int COLOR_PURPLE = 0x800080; +const int COLOR_PURPLE_MEDIUM = 0x9370d8; +const int COLOR_THISTLE = 0xd8bfd8; +const int COLOR_VIOLET = 0xee82ee; +const int COLOR_VIOLET_DARK = 0x9400d3; +const int COLOR_VIOLET_LIGHT = 0xf397f8; + +// ----- Oranges --------------------------------------------------------------- +const int COLOR_CORAL = 0xff7f50; +const int COLOR_ORANGE = 0xffa500; +const int COLOR_ORANGE_DARK = 0xff8c00; +const int COLOR_ORANGE_LIGHT = 0xf3b800; +const int COLOR_ORANGE_RED = 0xff4500; +const int COLOR_SALMON_LIGHT = 0xffa07a; +const int COLOR_TOMATO = 0xff6347; + +// ----- Reds ------------------------------------------------------------------ +const int COLOR_CORAL_LIGHT = 0xf08080; +const int COLOR_CRIMSON = 0xdc143c; +const int COLOR_FIREBRICK = 0xb22222; +const int COLOR_RED = 0xff0000; +const int COLOR_RED_DARK = 0x8b0000; +const int COLOR_RED_INDIAN = 0xcd5c4c; +const int COLOR_RED_LIGHT = 0xfa6155; +const int COLOR_SALMON = 0xfa8072; +const int COLOR_SALMON_DARK = 0xe9967a; + +// ----- Pinks ----------------------------------------------------------------- +const int COLOR_PINK = 0xffc0cb; +const int COLOR_PINK_DEEP = 0xff1493; +const int COLOR_PINK_HOT = 0xff69b4; +const int COLOR_PINK_LIGHT = 0xffb6c1; +const int COLOR_VIOLET_RED_MEDIUM = 0xc71585; +const int COLOR_VIOLET_RED_PALE = 0xdb7093; + +// ----- Grays ----------------------------------------------------------------- +const int COLOR_BLACK = 0x000000; +const int COLOR_GAINSBORO = 0xdcdcdc; +const int COLOR_GRAY = 0x808080; +const int COLOR_GRAY_DARK = 0xa9a9a9; +const int COLOR_GRAY_DIM = 0x696969; +const int COLOR_GRAY_LIGHT = 0xd3d3d3; +const int COLOR_GRAY_SLATE = 0x708090; +const int COLOR_GRAY_SLATE_DARK = 0x2f4f4f; +const int COLOR_GRAY_SLATE_LIGHT = 0x778899; +const int COLOR_SILVER = 0xc0c0c0; + +// ----- Greens ---------------------------------------------------------------- +const int COLOR_AQUAMARINE_MEDIUM = 0x66cdaa; +const int COLOR_CHARTREUSE = 0x7fff00; +const int COLOR_CYAN_DARK = 0x008b8b; +const int COLOR_GREEN = 0x008000; +const int COLOR_GREEN_DARK = 0x006400; +const int COLOR_GREEN_FOREST = 0x228b22; +const int COLOR_GREEN_LAWN = 0x7cfc00; +const int COLOR_GREEN_LIGHT = 0x90ee90; +const int COLOR_GREEN_LIME = 0x32cd32; +const int COLOR_GREEN_OLIVE_DARK = 0x556b2f; +const int COLOR_GREEN_PALE = 0x98fb98; +const int COLOR_GREEN_SEA = 0x2e8b57; +const int COLOR_GREEN_SEA_DARK = 0x8fbc8f; +const int COLOR_GREEN_SEA_LIGHT = 0x20b2aa; +const int COLOR_GREEN_SEA_MEDIUM = 0x3cb371; +const int COLOR_GREEN_SPRING = 0x00ff7f; +const int COLOR_GREEN_SPRING_MEDIUM = 0x00fa9a; +const int COLOR_GREEN_YELLOW = 0xadff2f; +const int COLOR_LIME = 0x00ff00; +const int COLOR_OLIVE = 0x808000; +const int COLOR_OLIVE_DRAB = 0x6b8e23; +const int COLOR_TEAL = 0x008080; +const int COLOR_YELLOW_GREEN = 0x9acd32; + +// ----- Yellows --------------------------------------------------------------- +const int COLOR_GOLD = 0xffd700; +const int COLOR_GOLDENROD_LIGHT = 0xfafad2; +const int COLOR_GOLDENROD_PALE = 0xeee8aa; +const int COLOR_KHAKI = 0xf0e68c; +const int COLOR_KHAKI_DARK = 0xbdb76b; +const int COLOR_LEMON_CHIFFON = 0xfffacd; +const int COLOR_MOCCASIN = 0xffe4b5; +const int COLOR_PAPAYA_WHIP = 0xffefd5; +const int COLOR_PEACH_PUFF = 0xffdab9; +const int COLOR_YELLOW = 0xffff00; +const int COLOR_YELLOW_DARK = 0xd0ce00; +const int COLOR_YELLOW_LIGHT = 0xffffe0; + +// ----------------------------------------------------------------------------- +// Colors By Function +// ----------------------------------------------------------------------------- + +const int COLOR_DEFAULT = 0xfefefe; +const int COLOR_ATTENTION = 0xfea400; +const int COLOR_BUG = 0x660000; +const int COLOR_FAIL = 0xff0000; +const int COLOR_SUCCESS = 0x3dc93d; +const int COLOR_DEBUG = 0xb4b4b4; +const int COLOR_INFO = 0xd0814b; + +// ----- Damage Types ---------------------------------------------------------- +const int COLOR_DAMAGE_MAGICAL = 0xcc77ff; +const int COLOR_DAMAGE_ACID = 0x01ff01; +const int COLOR_DAMAGE_COLD = 0x99ffff; +const int COLOR_DAMAGE_DIVINE = 0xffff01; +const int COLOR_DAMAGE_ELECTRICAL = 0x0166ff; +const int COLOR_DAMAGE_FIRE = 0xff0101; +const int COLOR_DAMAGE_NEGATIVE = 0x999999; +const int COLOR_DAMAGE_POSITIVE = 0xffffff; +const int COLOR_DAMAGE_SONIC = 0xff9901; + +// ----- Chat Log Messages ----------------------------------------------------- +const int COLOR_MESSAGE_FEEDBACK = 0xffff01; +const int COLOR_MESSAGE_COMBAT = 0xff6601; +const int COLOR_MESSAGE_MAGIC = 0xcc77ff; +const int COLOR_MESSAGE_SKILLS = 0x0166ff; +const int COLOR_MESSAGE_SAVING = 0x66ccff; +const int COLOR_SAVE_STATUS = 0x20ff20; +const int COLOR_PAUSE_STATE = 0xff0101; +const int COLOR_NAME_CLIENT = 0x99ffff; +const int COLOR_NAME_OTHER = 0xcc99cc; + +// ----------------------------------------------------------------------------- +// Custom Colors +// ----------------------------------------------------------------------------- +// You can add any custom colors you need for your functions below this line. +// ----------------------------------------------------------------------------- + diff --git a/_module/nss/util_i_color.nss b/_module/nss/util_i_color.nss new file mode 100644 index 00000000..9fb451a9 --- /dev/null +++ b/_module/nss/util_i_color.nss @@ -0,0 +1,364 @@ +/// ---------------------------------------------------------------------------- +/// @file util_i_color.nss +/// @author Michael A. Sinclair (Squatting Monk) +/// @brief Functions to handle colors. +/// @details +/// NWN normally uses color codes to color strings. These codes take the format +/// ``, where RGB are ALT codes (0-0255) for colors. +/// +/// Because color codes are arcane and can't be easily looked up, the functions +/// in this file prefer to use hex color codes. These codes are the same as +/// you'd use in web design and many other areas, so they are easy to look up +/// and can be copied and pasted into other programs. util_c_color.nss provides +/// some hex codes for common uses. +/// +/// This file also contains functions to represent colors as RGB or HSV +/// triplets. HSV (Hue, Saturation, Value) may be particularly useful if you +/// want to play around with shifting colors. +/// +/// ## Acknowledgements +/// - `GetColorCode()` function by rdjparadis. +/// - RGB <-> HSV colors adapted from NWShacker's Named Color Token System. +/// ---------------------------------------------------------------------------- + +#include "x3_inc_string" +#include "util_i_math" +#include "util_c_color" + +// ----------------------------------------------------------------------------- +// Constants +// ----------------------------------------------------------------------------- + +/// Used to generate colors from RGB values. NEVER modify this string. +/// @see https://nwn.wiki/display/NWN1/Colour+Tokens +/// @note First character is "nearest to 00" since we can't use `\x00` itself +/// @note COLOR_TOKEN originally by rdjparadis. Converted to NWN:EE escaped +/// characters by Jasperre. +const string COLOR_TOKEN = "\x01\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F\x20\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2A\x2B\x2C\x2D\x2E\x2F\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x3A\x3B\x3C\x3D\x3E\x3F\x40\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4A\x4B\x4C\x4D\x4E\x4F\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5A\x5B\x5C\x5D\x5E\x5F\x60\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6A\x6B\x6C\x6D\x6E\x6F\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7A\x7B\x7C\x7D\x7E\x7F\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F\xA0\xA1\xA2\xA3\xA4\xA5\xA6\xA7\xA8\xA9\xAA\xAB\xAC\xAD\xAE\xAF\xB0\xB1\xB2\xB3\xB4\xB5\xB6\xB7\xB8\xB9\xBA\xBB\xBC\xBD\xBE\xBF\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\xD0\xD1\xD2\xD3\xD4\xD5\xD6\xD7\xD8\xD9\xDA\xDB\xDC\xDD\xDE\xDF\xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF7\xF8\xF9\xFA\xFB\xFC\xFD\xFE\xFF"; + +// ----------------------------------------------------------------------------- +// Types +// ----------------------------------------------------------------------------- + +struct RGB +{ + int r; + int g; + int b; +}; + +struct HSV +{ + float h; + float s; + float v; +}; + +// ----------------------------------------------------------------------------- +// Function Prototypes +// ----------------------------------------------------------------------------- + +// ----- Type Creation --------------------------------------------------------- + +/// @brief Create an RBG color struct. +/// @param nRed The value of the red channel (0..255). +/// @param nGreen The value of the green channel (0..255). +/// @param nBlue The value of the blue channel (0..255). +struct RGB GetRGB(int nRed, int nGreen, int nBlue); + +/// @brief Create an HSV color struct. +/// @details The ranges are as follows: +/// 0.0 <= H < 360.0 +/// 0.0 <= S <= 1.0 +/// 0.0 <= V <= 1.0 +/// @param fHue The hue (i.e. location on color wheel). +/// @param fSaturation The saturation (i.e., distance from white/black). +/// @param fValue The value (i.e., brightness of color). +struct HSV GetHSV(float fHue, float fSaturation, float fValue); + +// ----- Type Conversion ------------------------------------------------------- + +/// @brief Convert a hexadecimal color to an RGB struct. +/// @param nColor Hexadecimal to convert to RGB. +struct RGB HexToRGB(int nColor); + +/// @brief Convert an RGB struct to a hexadecimal color. +/// @param rgb RGB to convert to hexadecimal. +int RGBToHex(struct RGB rgb); + +/// @brief Convert an RGB struct to an HSV struct. +/// @param rgb RGB to convert to HSV. +struct HSV RGBToHSV(struct RGB rgb); + +/// @brief Convert an HSV struct to an RGB struct. +/// @param hsv HSV to convert to RGB. +struct RGB HSVToRGB(struct HSV hsv); + +/// @brief Converts a hexadecimal color to an HSV struct. +/// @param nColor Hexadecimal to convert to HSV. +struct HSV HexToHSV(int nColor); + +/// @brief Converts an HSV struct to a hexadecial color. +/// @param hsv HSV to convert to hexadecimal. +int HSVToHex(struct HSV hsv); + +// ----- Coloring Functions ---------------------------------------------------- + +/// @brief Construct a color code that can be used to color a string. +/// @param nRed The intensity of the red channel (0..255). +/// @param nGreen The intensity of the green channel (0..255). +/// @param nBlue The intensity of the blue channel (0..255). +/// @returns A string color code in `` form. +string GetColorCode(int nRed, int nGreen, int nBlue); + +/// @brief Convert a hexadecimal color to a color code. +/// @param nColor Hexadecimal representation of an RGB color. +/// @returns A string color code in `` form. +string HexToColor(int nColor); + +/// @brief Convert a color code prefix to a hexadecimal +/// @param sColor A string color code in `` form. +int ColorToHex(string sColor); + +/// @brief Color a string with a color code. +/// @param sString The string to color. +/// @param sColor A string color code in `` form. +string ColorString(string sString, string sColor); + +/// @brief Color a string with a hexadecimal color. +/// @param sString The string to color. +/// @param nColor A hexadecimal color. +string HexColorString(string sString, int nColor); + +/// @brief Color a string with an RGB color. +/// @param sString The string to color. +/// @param rgb The RGB color struct. +string RGBColorString(string sString, struct RGB rgb); + +/// @brief Color a string with a struct HSV color +/// @param sString The string to color. +/// @param hsv The HSV color struct. +string HSVColorString(string sString, struct HSV hsv); + +/// @brief Remove color codes from a string. +/// @param sString The string to uncolor. +/// @returns sString with color codes removed. +string UnColorString(string sString); + +// ----------------------------------------------------------------------------- +// Function Definitions +// ----------------------------------------------------------------------------- + +// ----- Type Creation --------------------------------------------------------- + +struct RGB GetRGB(int nRed, int nGreen, int nBlue) +{ + struct RGB rgb; + + rgb.r = clamp(nRed, 0, 255); + rgb.g = clamp(nGreen, 0, 255); + rgb.b = clamp(nBlue, 0, 255); + + return rgb; +} + +struct HSV GetHSV(float fHue, float fSat, float fVal) +{ + struct HSV hsv; + + hsv.h = fclamp(fHue, 0.0, 360.0); + hsv.s = fclamp(fSat, 0.0, 1.0); + hsv.v = fclamp(fVal, 0.0, 1.0); + + if (hsv.h == 360.0) + hsv.h = 0.0; + + return hsv; +} + +// ----- Type Conversion ------------------------------------------------------- + +struct RGB HexToRGB(int nColor) +{ + int nRed = (nColor & 0xff0000) >> 16; + int nGreen = (nColor & 0x00ff00) >> 8; + int nBlue = (nColor & 0x0000ff); + return GetRGB(nRed, nGreen, nBlue); +} + +int RGBToHex(struct RGB rgb) +{ + int nRed = (clamp(rgb.r, 0, 255) << 16); + int nGreen = (clamp(rgb.g, 0, 255) << 8); + int nBlue = clamp(rgb.b, 0, 255); + return nRed + nGreen + nBlue; +} + +struct HSV RGBToHSV(struct RGB rgb) +{ + // Ensure the RGB values are within defined limits + rgb = GetRGB(rgb.r, rgb.g, rgb.b); + + struct HSV hsv; + + // Convert RGB to a range from 0 - 1 + float fRed = IntToFloat(rgb.r) / 255.0; + float fGreen = IntToFloat(rgb.g) / 255.0; + float fBlue = IntToFloat(rgb.b) / 255.0; + + float fMax = fmax(fRed, fmax(fGreen, fBlue)); + float fMin = fmin(fRed, fmin(fGreen, fBlue)); + float fChroma = fMax - fMin; + + if (fMax > fMin) + { + if (fMax == fRed) + hsv.h = 60.0 * ((fGreen - fBlue) / fChroma); + else if (fMax == fGreen) + hsv.h = 60.0 * ((fBlue - fRed) / fChroma + 2.0); + else + hsv.h = 60.0 * ((fRed - fGreen) / fChroma + 4.0); + + if (hsv.h < 0.0) + hsv.h += 360.0; + } + + if (fMax > 0.0) + hsv.s = fChroma / fMax; + + hsv.v = fMax; + return hsv; +} + +struct RGB HSVToRGB(struct HSV hsv) +{ + // Ensure the HSV values are within defined limits + hsv = GetHSV(hsv.h, hsv.s, hsv.v); + + struct RGB rgb; + + // If value is 0, the resulting color will always be black + if (hsv.v == 0.0) + return rgb; + + // If the saturation is 0, the resulting color will be a shade of grey + if (hsv.s == 0.0) + { + // Scale from white to black based on value + int nValue = FloatToInt(hsv.v * 255.0); + return GetRGB(nValue, nValue, nValue); + } + + float h = hsv.h / 60.0; + float f = frac(h); + int v = FloatToInt(hsv.v * 255.0); + int p = FloatToInt(v * (1.0 - hsv.s)); + int q = FloatToInt(v * (1.0 - hsv.s * f)); + int t = FloatToInt(v * (1.0 - hsv.s * (1.0 - f))); + int i = FloatToInt(h); + + switch (i % 6) + { + case 0: rgb = GetRGB(v, t, p); break; + case 1: rgb = GetRGB(q, v, p); break; + case 2: rgb = GetRGB(p, v, t); break; + case 3: rgb = GetRGB(p, q, v); break; + case 4: rgb = GetRGB(t, p, v); break; + case 5: rgb = GetRGB(v, p, q); break; + } + + return rgb; +} + +struct HSV HexToHSV(int nColor) +{ + return RGBToHSV(HexToRGB(nColor)); +} + +int HSVToHex(struct HSV hsv) +{ + return RGBToHex(HSVToRGB(hsv)); +} + +// ----- Coloring Functions ---------------------------------------------------- + +string GetColorCode(int nRed, int nGreen, int nBlue) +{ + return ""; +} + +string HexToColor(int nColor) +{ + if (nColor < 0 || nColor > 0xffffff) + return ""; + + int nRed = (nColor & 0xff0000) >> 16; + int nGreen = (nColor & 0x00ff00) >> 8; + int nBlue = (nColor & 0x0000ff); + return GetColorCode(nRed, nGreen, nBlue); +} + +int ColorToHex(string sColor) +{ + if (sColor == "") + return -1; + + string sRed = GetSubString(sColor, 2, 1); + string sGreen = GetSubString(sColor, 3, 1); + string sBlue = GetSubString(sColor, 4, 1); + + int nRed = FindSubString(COLOR_TOKEN, sRed) << 16; + int nGreen = FindSubString(COLOR_TOKEN, sGreen) << 8; + int nBlue = FindSubString(COLOR_TOKEN, sBlue); + + return nRed + nGreen + nBlue; +} + +string ColorString(string sString, string sColor) +{ + if (sColor != "") + sString = sColor + sString + ""; + + return sString; +} + +string HexColorString(string sString, int nColor) +{ + string sColor = HexToColor(nColor); + return ColorString(sString, sColor); +} + +string RGBColorString(string sString, struct RGB rgb) +{ + string sColor = GetColorCode(rgb.r, rgb.g, rgb.b); + return ColorString(sString, sColor); +} + +string HSVColorString(string sString, struct HSV hsv) +{ + struct RGB rgb = HSVToRGB(hsv); + return RGBColorString(sString, rgb); +} + +string UnColorString(string sString) +{ + sString = StringReplace(sString, "", ""); + int nOpen = FindSubString(sString, "", nOpen); + int nLength; + string sPrefix, sSuffix; + + while (nOpen != -1 && nClose != -1) + { + nLength = GetStringLength(sString); + sPrefix = GetStringLeft(sString, nOpen); + sSuffix = GetStringRight(sString, nLength - nClose - 1); + sString = sPrefix + sSuffix; + nOpen = FindSubString(sString, "", nOpen); + } + + return sString; +} diff --git a/_module/nss/util_i_csvlists.nss b/_module/nss/util_i_csvlists.nss new file mode 100644 index 00000000..4393bbe3 --- /dev/null +++ b/_module/nss/util_i_csvlists.nss @@ -0,0 +1,338 @@ +/// ---------------------------------------------------------------------------- +/// @file util_i_csvlists.nss +/// @author Michael A. Sinclair (Squatting Monk) +/// @author Ed Burke (tinygiant98) +/// @brief Functions for manipulating comma-separated value (CSV) lists. +/// @details +/// +/// ## Usage: +/// +/// ```nwscript +/// string sKnight, sKnights = "Lancelot, Galahad, Robin"; +/// int i, nCount = CountList(sKnights); +/// for (i = 0; i < nCount; i++) +/// { +/// sKnight = GetListItem(sKnights, i); +/// SpeakString("Sir " + sKnight); +/// } +/// +/// int bBedivere = HasListItem(sKnights, "Bedivere"); +/// SpeakString("Bedivere " + (bBedivere ? "is" : "is not") + " in the party."); +/// +/// sKnights = AddListItem(sKnights, "Bedivere"); +/// bBedivere = HasListItem(sKnights, "Bedivere"); +/// SpeakString("Bedivere " + (bBedivere ? "is" : "is not") + " in the party."); +/// +/// int nRobin = FindListItem(sKnights, "Robin"); +/// SpeakString("Robin is knight " + IntToString(nRobin) + " in the party."); +/// ``` +/// ---------------------------------------------------------------------------- + +#include "x3_inc_string" +#include "util_i_math" +#include "util_i_strings" + +// ----------------------------------------------------------------------------- +// Function Prototypes +// ----------------------------------------------------------------------------- + +/// @brief Return the number of items in a CSV list. +/// @param sList The CSV list to count. +int CountList(string sList); + +/// @brief Add an item to a CSV list. +/// @param sList The CSV list to add the item to. +/// @param sListItem The item to add to sList. +/// @param bAddUnique If TRUE, will only add the item to the list if it is not +/// already there. +/// @returns A modified copy of sList with sListItem added. +string AddListItem(string sList, string sListItem, int bAddUnique = FALSE); + +/// @brief Return the item at an index in a CSV list. +/// @param sList The CSV list to get the item from. +/// @param nIndex The index of the item to get (0-based). +string GetListItem(string sList, int nIndex = 0); + +/// @brief Return the index of a value in a CSV list. +/// @param sList The CSV list to search. +/// @param sListItem The value to search for. +/// @returns -1 if the item was not found in the list. +int FindListItem(string sList, string sListItem); + +/// @brief Return whether a CSV list contains a value. +/// @param sList The CSV list to search. +/// @param sListItem The value to search for. +/// @returns TRUE if the item is in the list, otherwise FALSE. +int HasListItem(string sList, string sListItem); + +/// @brief Delete the item at an index in a CSV list. +/// @param sList The CSV list to delete the item from. +/// @param nIndex The index of the item to delete (0-based). +/// @returns A modified copy of sList with the item deleted. +string DeleteListItem(string sList, int nIndex = 0); + +/// @brief Delete the first occurrence of an item in a CSV list. +/// @param sList The CSV list to remove the item from. +/// @param sListItem The value to remove from the list. +/// @returns A modified copy of sList with the item removed. +string RemoveListItem(string sList, string sListItem); + +/// @brief Copy items from one CSV list to another. +/// @param sSource The CSV list to copy items from. +/// @param sTarget The CSV list to copy items to. +/// @param nIndex The index to begin copying from. +/// @param nRange The number of items to copy. +/// @param bAddUnique If TRUE, will only copy items to sTarget if they are not +/// already there. +/// @returns A modified copy of sTarget with the items added to the end. +string CopyListItem(string sSource, string sTarget, int nIndex, int nRange = 1, int bAddUnique = FALSE); + +/// @brief Merge the contents of two CSV lists. +/// @param sList1 The first CSV list. +/// @param sList2 The second CSV list. +/// @param bAddUnique If TRUE, will only put items in the returned list if they +/// are not already there. +/// @returns A CSV list containing the items from each list. +string MergeLists(string sList1, string sList2, int bAddUnique = FALSE); + +/// @brief Add an item to a CSV list saved as a local variable on an object. +/// @param oObject The object on which the local variable is saved. +/// @param sListName The varname for the local variable. +/// @param sListItem The item to add to the list. +/// @param bAddUnique If TRUE, will only add the item to the list if it is not +/// already there. +/// @returns The updated copy of the list with sListItem added. +string AddLocalListItem(object oObject, string sListName, string sListItem, int bAddUnique = FALSE); + +/// @brief Delete an item in a CSV list saved as a local variable on an object. +/// @param oObject The object on which the local variable is saved. +/// @param sListName The varname for the local variable. +/// @param nIndex The index of the item to delete (0-based). +/// @returns The updated copy of the list with the item at nIndex deleted. +string DeleteLocalListItem(object oObject, string sListName, int nNth = 0); + +/// @brief Remove an item in a CSV list saved as a local variable on an object. +/// @param oObject The object on which the local variable is saved. +/// @param sListName The varname for the local variable. +/// @param sListItem The value to remove from the list. +/// @returns The updated copy of the list with the first instance of sListItem +/// removed. +string RemoveLocalListItem(object oObject, string sListName, string sListItem); + +/// @brief Merge the contents of a CSV list with those of a CSV list stored as a +/// local variable on an object. +/// @param oObject The object on which the local variable is saved. +/// @param sListName The varname for the local variable. +/// @param sListToMerge The CSV list to merge into the saved list. +/// @param bAddUnique If TRUE, will only put items in the returned list if they +/// are not already there. +/// @returns The updated copy of the list with all items from sListToMerge +/// added. +string MergeLocalList(object oObject, string sListName, string sListToMerge, int bAddUnique = FALSE); + +/// @brief Convert a comma-separated value list to a JSON array. +/// @param sList Source CSV list. +/// @returns JSON array representation of CSV list. +json ListToJson(string sList); + +/// @brief Convert a JSON array to a comma-separate value list. +/// @param jArray JSON array list. +/// @returns CSV list of JSON array values. +string JsonToList(json jArray); + +// ----------------------------------------------------------------------------- +// Function Implementations +// ----------------------------------------------------------------------------- + +int CountList(string sList) +{ + if (sList == "") + return 0; + + return GetSubStringCount(sList, ",") + 1; +} + +string AddListItem(string sList, string sListItem, int bAddUnique = FALSE) +{ + if (bAddUnique && HasListItem(sList, sListItem)) + return sList; + + if (sList != "") + return sList + ", " + sListItem; + + return sListItem; +} + +string GetListItem(string sList, int nIndex = 0) +{ + if (nIndex < 0 || sList == "") + return ""; + + // Loop through the elements until we find the one we want. + int nCount, nLeft, nRight = FindSubString(sList, ","); + while (nRight != -1 && nCount < nIndex) + { + nCount++; + nLeft = nRight + 1; + nRight = FindSubString(sList, ",", nLeft); + } + + // If there were not enough elements, return a null string. + if (nCount < nIndex) + return ""; + + // Get the element + return TrimString(GetStringSlice(sList, nLeft, nRight - 1)); +} + +int FindListItem(string sList, string sListItem) +{ + sList = TrimString(sList); + sListItem = TrimString(sListItem); + if (sList == "") + return -1; + + int nItem, nStart, nEnd; + do + { + nEnd = FindSubString(sList, ",", nStart); + if (TrimString(GetStringSlice(sList, nStart, nEnd - 1)) == sListItem) + return nItem; + nItem++; + nStart = nEnd + 1; + } + while (nEnd >= 0); + return -1; +} + +int HasListItem(string sList, string sListItem) +{ + return (FindListItem(sList, sListItem) > -1); +} + +string DeleteListItem(string sList, int nIndex = 0) +{ + if (nIndex < 0 || sList == "") + return sList; + + int nPos = FindSubStringN(sList, ",", nIndex); + if (nPos < 0) + { + if (nIndex) + { + nPos = FindSubStringN(sList, ",", nIndex - 1); + return TrimStringRight(GetStringSlice(sList, 0, nPos - 1)); + } + + return ""; + } + + string sRight = GetStringSlice(sList, nPos + 1); + if (!nIndex) + return sRight; + nPos = FindSubStringN(sList, ",", nIndex - 1); + sRight = nPos < 0 ? TrimStringLeft(sRight) : sRight; + return GetStringSlice(sList, 0, nPos) + sRight; +} + +string RemoveListItem(string sList, string sListItem) +{ + return DeleteListItem(sList, FindListItem(sList, sListItem)); +} + +string CopyListItem(string sSource, string sTarget, int nIndex, int nRange = 1, int bAddUnique = FALSE) +{ + string sValue; + int i, nCount = CountList(sSource); + + if (nIndex < 0 || nIndex >= nCount || !nCount) + return sSource; + + nRange = clamp(nRange, 1, nCount - nIndex); + + for (i = 0; i < nRange; i++) + { + sValue = GetListItem(sSource, nIndex + i); + sTarget = AddListItem(sTarget, sValue, bAddUnique); + } + + return sTarget; +} + +string MergeLists(string sList1, string sList2, int bAddUnique = FALSE) +{ + int i, nCount = CountList(sList2); + for (i = 0; i < nCount; i++) + sList1 = AddListItem(sList1, GetListItem(sList2, i), bAddUnique); + + return sList1; +} + +string AddLocalListItem(object oObject, string sListName, string sListItem, int bAddUnique = FALSE) +{ + string sList = GetLocalString(oObject, sListName); + sList = AddListItem(sList, sListItem, bAddUnique); + SetLocalString(oObject, sListName, sList); + return sList; +} + +string DeleteLocalListItem(object oObject, string sListName, int nNth = 0) +{ + string sList = GetLocalString(oObject, sListName); + sList = DeleteListItem(sList, nNth); + SetLocalString(oObject, sListName, sList); + return sList; +} + +string RemoveLocalListItem(object oObject, string sListName, string sListItem) +{ + string sList = GetLocalString(oObject, sListName); + sList = RemoveListItem(sList, sListItem); + SetLocalString(oObject, sListName, sList); + return sList; +} + +string MergeLocalList(object oObject, string sListName, string sListToMerge, int bAddUnique = FALSE) +{ + string sList = GetLocalString(oObject, sListName); + sList = MergeLists(sList, sListToMerge, bAddUnique); + SetLocalString(oObject, sListName, sList); + return sList; +} + +json ListToJson(string sList) +{ + json jRet = JsonArray(); + if (sList == "") + return jRet; + + string sItem; + int nStart, nEnd; + + do + { + nEnd = FindSubString(sList, ",", nStart); + sItem = TrimString(GetStringSlice(sList, nStart, nEnd - 1)); + jRet = JsonArrayInsert(jRet, JsonString(sItem)); + nStart = nEnd + 1; + } while (nEnd != -1); + + return jRet; +} + +string JsonToList(json jArray) +{ + if (JsonGetType(jArray) != JSON_TYPE_ARRAY) + return ""; + + string sList; + int i, nCount = JsonGetLength(jArray); + for (i; i < nCount; i++) + { + if (i > 0) + sList += ", "; + sList += JsonGetString(JsonArrayGet(jArray, i)); + } + + return sList; +} diff --git a/_module/nss/util_i_math.nss b/_module/nss/util_i_math.nss new file mode 100644 index 00000000..223299ab --- /dev/null +++ b/_module/nss/util_i_math.nss @@ -0,0 +1,177 @@ +/// ---------------------------------------------------------------------------- +/// @file util_i_math.nss +/// @author Michael A. Sinclair (Squatting Monk) +/// @brief Useful math utility functions. +/// ---------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +// Function Prototypes +// ----------------------------------------------------------------------------- + +/// @brief Return the closest integer to the binary logarithm of a number. +int log2(int n); + +/// @brief Restrict an integer to a range. +/// @param nValue The number to evaluate. +/// @param nMin The minimum value for the number. +/// @param nMax The maximum value for the number. +/// @returns nValue if it is between nMin and nMax. Otherwise returns the +/// closest of nMin or nMax. +int clamp(int nValue, int nMin, int nMax); + +/// @brief Restrict a float to a range. +/// @param fValue The number to evaluate. +/// @param fMin The minimum value for the number. +/// @param fMax The maximum value for the number. +/// @returns fValue if it is between fMin and fMax. Otherwise returns the +/// closest of fMin or fMax. +float fclamp(float fValue, float fMin, float fMax); + +/// @brief Return the larger of two integers. +int max(int a, int b); + +/// @brief Return the smaller of two integers. +int min(int a, int b); + +/// @brief Return the sign of an integer. +/// @returns -1 if n is negative, 0 if 0, or 1 if positive. +int sign(int n); + +/// @brief Return the larger of two floats. +float fmax(float a, float b); + +/// @brief Return the smaller of two floats. +float fmin(float a, float b); + +/// @brief Return the sign of a float. +/// @returns -1 if f is negative, 0 if 0, or 1 if positive. +int fsign(float f); + +/// @brief Truncate a float (i.e., remove numbers to the right of the decimal +/// point). +float trunc(float f); + +/// @brief Return the fractional part of a float (i.e., numbers to the right of +/// the decimal point). +float frac(float f); + +/// @brief Return a % b (modulo function). +/// @param a The dividend +/// @param b The divisor +/// @note For consistency with NWN's integer modulo operator, the result has the +/// same sign as a (i.e., fmod(-1, 2) == -1). +float fmod(float a, float b); + +/// @brief Round a float down to the nearest whole number. +float floor(float f); + +/// @brief Round a float up to the nearest whole number. +float ceil(float f); + +/// @brief Round a float towards to the nearest whole number. +/// @note In case of a tie (i.e., +/- 0.5), rounds away from 0. +float round(float f); + +/// @brief Determine if x is in [a..b] +/// @param x Value to compare +/// @param a Low end of range +/// @param b High end of range +int between(int x, int a, int b); + +/// @brief Determine if x is in [a..b] +/// @param x Value to compare +/// @param a Low end of range +/// @param b High end of range +int fbetween(float x, float a, float b); + +// ----------------------------------------------------------------------------- +// Function Definitions +// ----------------------------------------------------------------------------- + +int log2(int n) +{ + int nResult; + while (n >>= 1) + nResult++; + return nResult; +} + +int clamp(int nValue, int nMin, int nMax) +{ + return (nValue < nMin) ? nMin : ((nValue > nMax) ? nMax : nValue); +} + +float fclamp(float fValue, float fMin, float fMax) +{ + return (fValue < fMin) ? fMin : ((fValue > fMax) ? fMax : fValue); +} + +int max(int a, int b) +{ + return (b > a) ? b : a; +} + +int min(int a, int b) +{ + return (b > a) ? a : b; +} + +int sign(int n) +{ + return (n > 0) ? 1 : (n < 0) ? -1 : 0; +} + +float fmax(float a, float b) +{ + return (b > a) ? b : a; +} + +float fmin(float a, float b) +{ + return (b > a) ? a : b; +} + +int fsign(float f) +{ + return f > 0.0 ? 1 : f < 0.0 ? -1 : 0; +} + +float trunc(float f) +{ + return IntToFloat(FloatToInt(f)); +} + +float frac(float f) +{ + return f - trunc(f); +} + +float fmod(float a, float b) +{ + return a - b * trunc(a / b); +} + +float floor(float f) +{ + return IntToFloat(FloatToInt(f) - (f < 0.0)); +} + +float ceil(float f) +{ + return IntToFloat(FloatToInt(f) + (trunc(f) < f)); +} + +float round(float f) +{ + return IntToFloat(FloatToInt(f + (f < 0.0 ? -0.5 : 0.5))); +} + +int between(int x, int a, int b) +{ + return ((x - a) * (x - b)) <= 0; +} + +int fbetween(float x, float a, float b) +{ + return ((x - a) * (x - b)) <= 0.0; +} diff --git a/_module/nss/util_i_strings.nss b/_module/nss/util_i_strings.nss new file mode 100644 index 00000000..26eeb6f5 --- /dev/null +++ b/_module/nss/util_i_strings.nss @@ -0,0 +1,428 @@ +/// ---------------------------------------------------------------------------- +/// @file util_i_strings.nss +/// @author Michael A. Sinclair (Squatting Monk) +/// @author Ed Burke (tinygiant98) +/// @brief Functions for formatting times +/// ---------------------------------------------------------------------------- +/// @details This file holds utility functions for manipulating strings. +/// ---------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +// Constants +// ----------------------------------------------------------------------------- + +const string CHARSET_NUMERIC = "0123456789"; +const string CHARSET_ALPHA = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; +const string CHARSET_ALPHA_LOWER = "abcdefghijklmnopqrstuvwxyz"; +const string CHARSET_ALPHA_UPPER = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + +// ----------------------------------------------------------------------------- +// Function Prototypes +// ----------------------------------------------------------------------------- + +/// @brief Return the number of occurrences of a substring within a string. +/// @param sString The string to search. +/// @param sSubString The substring to search for. +int GetSubStringCount(string sString, string sSubString); + +/// @brief Return the position of a given occurrence of a substring within a +/// string. +/// @param sString The string to search. +/// @param sSubString The substring to search for. +/// @param nNth The occurrence to search for. Uses a zero-based index. +/// @returns The position of the start of the nNth occurrence of the substring, +/// or -1 if the substring did not occur at least nNth + 1 times. +int FindSubStringN(string sString, string sSubString, int nNth = 0); + +/// @brief Return the character at a position in a string. +/// @param sString The string to search. +/// @param nPos The position to check. +/// @returns "" if sString is not nPos + 1 characters long. +string GetChar(string sString, int nPos); + +/// @brief Return the substring of a string bounded by a start and end position. +/// @param sString The string to search. +/// @param nStart The starting position of the substring to return. +/// @param nEnd The ending position of the substring to return. If -1, will +/// return to the end of the string. +/// @returns "" if nStart is not at least nStart + 1 characters long or if nEnd +/// is < nStart and not -1. +/// @note Both nStart and nEnd are inclusive, so if nStart == nEnd, the +/// character at that index will be returned. +string GetStringSlice(string sString, int nStart, int nEnd = -1); + +/// @brief Replace the substring bounded by a string slice with another string. +/// @param sString The string to search. +/// @param sSub The substring to replace with. +/// @param nStart The starting position in sString of the substring to replace. +/// @param nEnd The ending position in sString of the substring to replace. +string ReplaceSubString(string sString, string sSub, int nStart, int nEnd); + +/// @brief Replace a substring in a string with another string. +/// @param sString The string to search. +/// @param sToken The substring to search for. +/// @param sSub The substring to replace with. +string SubstituteSubString(string sString, string sToken, string sSub); + +/// @brief Replace all substrings in a string with another string. +/// @param sString The string to search. +/// @param sToken The substring to search for. +/// @param sSub The substring to replace with. +string SubstituteSubStrings(string sString, string sToken, string sSub); + +/// @brief Return whether a string contains a substring. +/// @param sString The string to search. +/// @param sSubString The substring to search for. +/// @param nStart The position in sString to begin searching from (0-based). +/// @returns TRUE if sSubString is in sString, FALSE otherwise. +int HasSubString(string sString, string sSubString, int nStart = 0); + +/// @brief Return whether any of a string's characters are in a character set. +/// @param sString The string to search. +/// @param sSet The set of characters to search for. +/// @returns TRUE if any characters are in the set; FALSE otherwise. +int GetAnyCharsInSet(string sString, string sSet); + +/// @brief Return whether all of a string's characters are in a character set. +/// @param sString The string to search. +/// @param sSet The set of characters to search for. +/// @returns TRUE if all characters are in the set; FALSE otherwise. +int GetAllCharsInSet(string sString, string sSet); + +/// @brief Return whether all letters in a string are upper-case. +/// @param sString The string to check. +int GetIsUpperCase(string sString); + +/// @brief Return whether all letters in a string are lower-case. +/// @param sString The string to check. +int GetIsLowerCase(string sString); + +/// @brief Return whether all characters in sString are letters. +/// @param sString The string to check. +int GetIsAlpha(string sString); + +/// @brief Return whether all characters in sString are digits. +/// @param sString The string to check. +int GetIsNumeric(string sString); + +/// @brief Return whether all characters in sString are letters or digits. +/// @param sString The string to check. +int GetIsAlphaNumeric(string sString); + +/// @brief Trim characters from the left side of a string. +/// @param sString The string to trim. +/// @param sRemove The set of characters to remove. +string TrimStringLeft(string sString, string sRemove = " "); + +/// @brief Trim characters from the right side of a string. +/// @param sString The string to trim. +/// @param sRemove The set of characters to remove. +string TrimStringRight(string sString, string sRemove = " "); + +/// @brief Trim characters from both sides of a string. +/// @param sString The string to trim. +/// @param sRemove The set of characters to remove. +string TrimString(string sString, string sRemove = " "); + +/// @brief Interpolate values from a json array into a string using sqlite's +/// printf(). +/// @param jArray A json array containing float, int, or string elements to +/// interpolate. The number of elements must match the number of format +/// specifiers in sFormat. +/// @param sFormat The string to interpolate the values into. Must contain +/// format specifiers that correspond to the elements in jArray. For details +/// on format specifiers, see https://sqlite.org/printf.html. +/// @example +/// FormatValues(JsonParse("[\"Blue\", 255]"), "%s: #%06X"); // "Blue: #0000FF" +string FormatValues(json jArray, string sFormat); + +/// @brief Interpolate a float into a string using sqlite's printf(). +/// @param f A float to interpolate. Will be passed as an argument to the query +/// as many times as necessary to cover all format specifiers. +/// @param sFormat The string to interpolate the value into. For details on +/// format specifiers, see https://sqlite.org/printf.html. +/// @example +/// FormatFloat(15.0, "%d"); // "15" +/// FormatFloat(15.0, "%.2f"); // "15.00" +/// FormatFloat(15.0, "%05.1f"); // "015.0" +string FormatFloat(float f, string sFormat); + +/// @brief Interpolate an int into a string using sqlite's printf(). +/// @param n An int to interpolate. Will be passed as an argument to the query +/// as many times as necessary to cover all format specifiers. +/// @param sFormat The string to interpolate the value into. For details on +/// format specifiers, see https://sqlite.org/printf.html. +/// @example +/// FormatInt(15, "%d"); // "15" +/// FormatInt(15, "%04d"); // "0015" +/// FormatInt(15, "In hexadecimal, %d is %#x"); // "In hexadecimal, 15 is 0xf" +/// FormatInt(1000, "%,d"); // "1,000" +string FormatInt(int n, string sFormat); + +/// @brief Interpolate a string into another string using sqlite's printf(). +/// @param s A string to interpolate. Will be passed as an argument to the query +/// as many times as necessary to cover all format specifiers. +/// @param sFormat The string to interpolate the value into. For details on +/// format specifiers, see https://sqlite.org/printf.html. +/// @example +/// FormatString("foo", "%sbar"); // "foobar" +/// FormatString("foo", "%5sbar"); // " foobar" +/// FormatString("foo", "%-5sbar"); // "foo bar" +string FormatString(string s, string sFormat); + +/// @brief Substitute tokens in a string with values from a json array. +/// @param s The string to interpolate the values into. Should have tokens wich +/// contain sDesignator followed by a number denoting the position of the +/// value in jArray (1-based index). +/// @param jArray An array of values to interpolate. May be any combination of +/// strings, floats, decimals, or booleans. +/// @param sDesignator The character denoting the beginning of a token. +/// @example +/// // Assumes jArray = ["Today", 34, 2.5299999999, true]; +/// SubstituteString("$1, I ran $2 miles.", jArray); // "Today, I ran 34 miles." +/// SubstituteString("The circle's radius is $3.", jArray); // "The circle's radius is 2.53." +/// SubstituteString("The applicant answered: $4", jArray); // "The applicant answered: true" +string SubstituteString(string s, json jArray, string sDesignator = "$"); + +/// @brief Repeats a string multiple times. +/// @param s The string to repeat. +/// @param n The number of times to repeat s. +/// @returns The repeated string. +string RepeatString(string s, int n); + +// ----------------------------------------------------------------------------- +// Function Implementations +// ----------------------------------------------------------------------------- + +int GetSubStringCount(string sString, string sSubString) +{ + if (sString == "" || sSubString == "") + return 0; + + int nLength = GetStringLength(sSubString); + int nCount, nPos = FindSubString(sString, sSubString); + + while (nPos != -1) + { + nCount++; + nPos = FindSubString(sString, sSubString, nPos + nLength); + } + + return nCount; +} + +int FindSubStringN(string sString, string sSubString, int nNth = 0) +{ + if (nNth < 0 || sString == "" || sSubString == "") + return -1; + + int nLength = GetStringLength(sSubString); + int nPos = FindSubString(sString, sSubString); + + while (--nNth >= 0 && nPos != -1) + nPos = FindSubString(sString, sSubString, nPos + nLength); + + return nPos; +} + +string GetChar(string sString, int nPos) +{ + return GetSubString(sString, nPos, 1); +} + +string GetStringSlice(string sString, int nStart, int nEnd = -1) +{ + int nLength = GetStringLength(sString); + if (nEnd < 0 || nEnd > nLength) + nEnd = nLength; + + if (nStart < 0 || nStart > nEnd) + return ""; + + return GetSubString(sString, nStart, nEnd - nStart + 1); +} + +string ReplaceSubString(string sString, string sSub, int nStart, int nEnd) +{ + int nLength = GetStringLength(sString); + if (nStart < 0 || nStart >= nLength || nStart > nEnd) + return sString; + + return GetSubString(sString, 0, nStart) + sSub + + GetSubString(sString, nEnd + 1, nLength - nEnd); +} + +string SubstituteSubString(string sString, string sToken, string sSub) +{ + int nPos; + if ((nPos = FindSubString(sString, sToken)) == -1) + return sString; + + return ReplaceSubString(sString, sSub, nPos, nPos + GetStringLength(sToken) - 1); +} + +string SubstituteSubStrings(string sString, string sToken, string sSub) +{ + while (FindSubString(sString, sToken) >= 0) + sString = SubstituteSubString(sString, sToken, sSub); + + return sString; +} + +int HasSubString(string sString, string sSubString, int nStart = 0) +{ + return FindSubString(sString, sSubString, nStart) >= 0; +} + +int GetAnyCharsInSet(string sString, string sSet) +{ + int i, nLength = GetStringLength(sString); + for (i = 0; i < nLength; i++) + { + if (HasSubString(sSet, GetChar(sString, i))) + return TRUE; + } + return FALSE; +} + +int GetAllCharsInSet(string sString, string sSet) +{ + int i, nLength = GetStringLength(sString); + for (i = 0; i < nLength; i++) + { + if (!HasSubString(sSet, GetChar(sString, i))) + return FALSE; + } + return TRUE; +} + +int GetIsUpperCase(string sString) +{ + return GetAllCharsInSet(sString, CHARSET_ALPHA_UPPER + CHARSET_NUMERIC); +} + +int GetIsLowerCase(string sString) +{ + return GetAllCharsInSet(sString, CHARSET_ALPHA_LOWER + CHARSET_NUMERIC); +} + +int GetIsAlpha(string sString) +{ + return GetAllCharsInSet(sString, CHARSET_ALPHA); +} + +int GetIsNumeric(string sString) +{ + return GetAllCharsInSet(sString, CHARSET_NUMERIC); +} + +int GetIsAlphaNumeric(string sString) +{ + return GetAllCharsInSet(sString, CHARSET_ALPHA + CHARSET_NUMERIC); +} + +string TrimStringLeft(string sString, string sRemove = " ") +{ + while (FindSubString(sRemove, GetStringLeft(sString, 1)) != -1) + sString = GetStringRight(sString, GetStringLength(sString) - 1); + + return sString; +} + +string TrimStringRight(string sString, string sRemove = " ") +{ + while (FindSubString(sRemove, GetStringRight(sString, 1)) != -1) + sString = GetStringLeft(sString, GetStringLength(sString) - 1); + + return sString; +} + +string TrimString(string sString, string sRemove = " ") +{ + return TrimStringRight(TrimStringLeft(sString, sRemove), sRemove); +} + +string FormatValues(json jArray, string sFormat) +{ + if (JsonGetType(jArray) != JSON_TYPE_ARRAY) + return ""; + + string sArgs; + int i, nLength = JsonGetLength(jArray); + for (i = 0; i < nLength; i++) + sArgs += ", @" + IntToString(i); + + sqlquery q = SqlPrepareQueryObject(GetModule(), "SELECT printf(@format" + sArgs + ");"); + SqlBindString(q, "@format", sFormat); + for (i = 0; i < nLength; i++) + { + string sParam = "@" + IntToString(i); + json jValue = JsonArrayGet(jArray, i); + switch (JsonGetType(jValue)) + { + case JSON_TYPE_FLOAT: SqlBindFloat (q, sParam, JsonGetFloat (jValue)); break; + case JSON_TYPE_INTEGER: SqlBindInt (q, sParam, JsonGetInt (jValue)); break; + case JSON_TYPE_STRING: SqlBindString(q, sParam, JsonGetString(jValue)); break; + default: break; + } + } + return SqlStep(q) ? SqlGetString(q, 0) : ""; +} + +string FormatFloat(float f, string sFormat) +{ + json jArray = JsonArray(); + int i, nCount = GetSubStringCount(sFormat, "%"); + for (i = 0; i < nCount; i++) + jArray = JsonArrayInsert(jArray, JsonFloat(f)); + return FormatValues(jArray, sFormat); +} + +string FormatInt(int n, string sFormat) +{ + json jArray = JsonArray(); + int i, nCount = GetSubStringCount(sFormat, "%"); + for (i = 0; i < nCount; i++) + jArray = JsonArrayInsert(jArray, JsonInt(n)); + return FormatValues(jArray, sFormat); +} + +string FormatString(string s, string sFormat) +{ + json jArray = JsonArray(); + int i, nCount = GetSubStringCount(sFormat, "%"); + for (i = 0; i < nCount; i++) + jArray = JsonArrayInsert(jArray, JsonString(s)); + return FormatValues(jArray, sFormat); +} + +string SubstituteString(string s, json jArray, string sDesignator = "$") +{ + if (JsonGetType(jArray) != JSON_TYPE_ARRAY) + return s; + + int n; for (n = JsonGetLength(jArray) - 1; n >= 0; n--) + { + string sValue; + json jValue = JsonArrayGet(jArray, n); + int nType = JsonGetType(jValue); + if (nType == JSON_TYPE_STRING) sValue = JsonGetString(jValue); + else if (nType == JSON_TYPE_INTEGER) sValue = IntToString(JsonGetInt(jValue)); + else if (nType == JSON_TYPE_FLOAT) sValue = FormatFloat(JsonGetFloat(jValue), "%!f"); + else if (nType == JSON_TYPE_BOOL) sValue = JsonGetInt(jValue) == 1 ? "true" : "false"; + else continue; + + s = SubstituteSubStrings(s, sDesignator + IntToString(n + 1), sValue); + } + + return s; +} + +string RepeatString(string s, int n) +{ + string sResult; + while (n-- > 0) + sResult += s; + + return sResult; +} diff --git a/_module/nss/util_i_varlists.nss b/_module/nss/util_i_varlists.nss new file mode 100644 index 00000000..f21a2dd4 --- /dev/null +++ b/_module/nss/util_i_varlists.nss @@ -0,0 +1,2073 @@ +/// ---------------------------------------------------------------------------- +/// @file util_i_varlists.nss +/// @author Ed Burke (tinygiant98) +/// @brief Functions for manipulating local variable lists. +/// @details +/// Local variable lists are json arrays of a single type stored as local +/// variables. They are namespaced by type, so you can maintain lists of +/// different types using the same varname. +/// +/// The majority of functions in this file apply to each possible variable type: +/// float, int, location, vector, object, string, json. However, there are some +/// that only apply to a subset of variable types, such as +/// Sort[Float|Int|String]List() and [Increment|Decrement]ListInt(). +/// ---------------------------------------------------------------------------- + +#include "util_i_math" + +// ----------------------------------------------------------------------------- +// Constants +// ----------------------------------------------------------------------------- + +// Constants used to describe float|int|string sorting order +const int LIST_SORT_ASC = 1; +const int LIST_SORT_DESC = 2; + +// Prefixes used to keep list variables from colliding with other locals. These +// constants are considered private and should not be referenced from other scripts. +const string LIST_REF = "Ref:"; +const string VARLIST_TYPE_VECTOR = "VL:"; +const string VARLIST_TYPE_FLOAT = "FL:"; +const string VARLIST_TYPE_INT = "IL:"; +const string VARLIST_TYPE_LOCATION = "LL:"; +const string VARLIST_TYPE_OBJECT = "OL:"; +const string VARLIST_TYPE_STRING = "SL:"; +const string VARLIST_TYPE_JSON = "JL:"; + +// ----------------------------------------------------------------------------- +// Function Prototypes +// ----------------------------------------------------------------------------- + +/// @brief Convert a vector to a json object. +/// @param vPosition The vector to convert. +/// @note Alias for JsonVector(). +json VectorToJson(vector vPosition = [0.0, 0.0, 0.0]); + +/// @brief Convert a vector to a json object. +/// @param vPosition The vector to convert. +json JsonVector(vector vPosition = [0.0, 0.0, 0.0]); + +/// @brief Convert a json object to a vector. +/// @param jPosition The json object to convert. +/// @note Alias for JsonGetVector(). +vector JsonToVector(json jPosition); + +/// @brief Convert a json object to a vector. +/// @param jPosition The json object to convert. +vector JsonGetVector(json jPosition); + +/// @brief Convert a location to a json object. +/// @param lLocation The location to convert. +/// @note Alias for JsonLocation(). +json LocationToJson(location lLocation); + +/// @brief Convert a location to a json object. +/// @param lLocation The location to convert. +json JsonLocation(location lLocation); + +/// @brief Convert a json object to a location. +/// @param jLocation The json object to convert. +/// @note Alias for JsonGetLocation(). +location JsonToLocation(json jLocation); + +/// @brief Convert a json object to a location. +/// @param jLocation The json object to convert. +location JsonGetLocation(json jLocation); + +/// @brief Add a value to a float list on a target. +/// @param oTarget The object the list is stored on. +/// @param fValue The value to add to the list. +/// @param sListName The name of the list. +/// @param bAddUnique If TRUE, will not add the value if it is already present. +/// @returns TRUE if the operation was successful; FALSE otherwise. +int AddListFloat(object oTarget, float fValue, string sListName = "", int bAddUnique = FALSE); + +/// @brief Add a value to an int list on a target. +/// @param oTarget The object the list is stored on. +/// @param nValue The value to add to the list. +/// @param sListName The name of the list. +/// @param bAddUnique If TRUE, will not add the value if it is already present. +/// @returns TRUE if the operation was successful; FALSE otherwise. +int AddListInt(object oTarget, int nValue, string sListName = "", int bAddUnique = FALSE); + +/// @brief Add a value to a location list on a target. +/// @param oTarget The object the list is stored on. +/// @param lValue The value to add to the list. +/// @param sListName The name of the list. +/// @param bAddUnique If TRUE, will not add the value if it is already present. +/// @returns TRUE if the operation was successful; FALSE otherwise. +int AddListLocation(object oTarget, location lValue, string sListName = "", int bAddUnique = FALSE); + +/// @brief Add a value to a vector list on a target. +/// @param oTarget The object the list is stored on. +/// @param vValue The value to add to the list. +/// @param sListName The name of the list. +/// @param bAddUnique If TRUE, will not add the value if it is already present. +/// @returns TRUE if the operation was successful; FALSE otherwise. +int AddListVector(object oTarget, vector vValue, string sListName = "", int bAddUnique = FALSE); + +/// @brief Add a value to an object list on a target. +/// @param oTarget The object the list is stored on. +/// @param oValue The value to add to the list. +/// @param sListName The name of the list. +/// @param bAddUnique If TRUE, will not add the value if it is already present. +/// @returns TRUE if the operation was successful; FALSE otherwise. +int AddListObject(object oTarget, object oValue, string sListName = "", int bAddUnique = FALSE); + +/// @brief Add a value to a string list on a target. +/// @param oTarget The object the list is stored on. +/// @param sValue The value to add to the list. +/// @param sListName The name of the list. +/// @param bAddUnique If TRUE, will not add the value if it is already present. +/// @returns TRUE if the operation was successful; FALSE otherwise. +int AddListString(object oTarget, string sValue, string sListName = "", int bAddUnique = FALSE); + +/// @brief Add a value to a json list on a target. +/// @param oTarget The object the list is stored on. +/// @param jValue The value to add to the list. +/// @param sListName The name of the list. +/// @param bAddUnique If TRUE, will not add the value if it is already present. +/// @returns TRUE if the operation was successful; FALSE otherwise. +int AddListJson(object oTarget, json jValue, string sListName = "", int bAddUnique = FALSE); + +/// @brief Return the value at an index in a target's float list. +/// @param oTarget The object the list is stored on. +/// @param nIndex The index of the value. +/// @param sListName The name of the list. +/// @returns 0.0 if no value is found at nIndex. +float GetListFloat(object oTarget, int nIndex = 0, string sListName = ""); + +/// @brief Return the value at an index in a target's int list. +/// @param oTarget The object the list is stored on. +/// @param nIndex The index of the value. +/// @param sListName The name of the list. +/// @returns 0 if no value is found at nIndex. +int GetListInt(object oTarget, int nIndex = 0, string sListName = ""); + +/// @brief Return the value at an index in a target's location list. +/// @param oTarget The object the list is stored on. +/// @param nIndex The index of the value. +/// @param sListName The name of the list. +/// @returns LOCATION_INVALID if no value is found at nIndex. +location GetListLocation(object oTarget, int nIndex = 0, string sListName = ""); + +/// @brief Return the value at an index in a target's vector list. +/// @param oTarget The object the list is stored on. +/// @param nIndex The index of the value. +/// @param sListName The name of the list. +/// @returns [0.0. 0.0, 0.0] if no value was found at nIndex. +vector GetListVector(object oTarget, int nIndex = 0, string sListName = ""); + +/// @brief Return the value at an index in a target's object list. +/// @param oTarget The object the list is stored on. +/// @param nIndex The index of the value. +/// @param sListName The name of the list. +/// @returns OBJECT_INVALID if no value was found at nIndex. +object GetListObject(object oTarget, int nIndex = 0, string sListName = ""); + +/// @brief Return the value at an index in a target's string list. +/// @param oTarget The object the list is stored on. +/// @param nIndex The index of the value. +/// @param sListName The name of the list. +/// @returns "" if no value was found at nIndex. +string GetListString(object oTarget, int nIndex = 0, string sListName = ""); + +/// @brief Return the value at an index in a target's json list. +/// @param oTarget The object the list is stored on. +/// @param nIndex The index of the value. +/// @param sListName The name of the list. +/// @returns JSON_NULL if no value was found at nIndex. +json GetListJson(object oTarget, int nIndex = 0, string sListName = ""); + +/// @brief Delete the value at an index on an object's float list. +/// @param oTarget The object the list is stored on. +/// @param nIndex The index of the value. +/// @param sListName The name of the list. +/// @param bMaintainOrder Not used; exists for legacy purposes only. +/// @returns The number of items remanining in the list. +int DeleteListFloat(object oTarget, int nIndex, string sListName = "", int bMaintainOrder = FALSE); + +/// @brief Delete the value at an index on an object's int list. +/// @param oTarget The object the list is stored on. +/// @param nIndex The index of the value. +/// @param sListName The name of the list. +/// @param bMaintainOrder Not used; exists for legacy purposes only. +/// @returns The number of items remanining in the list. +int DeleteListInt(object oTarget, int nIndex, string sListName = "", int bMaintainOrder = FALSE); + +/// @brief Delete the value at an index on an object's location list. +/// @param oTarget The object the list is stored on. +/// @param nIndex The index of the value. +/// @param sListName The name of the list. +/// @param bMaintainOrder Not used; exists for legacy purposes only. +/// @returns The number of items remanining in the list. +int DeleteListLocation(object oTarget, int nIndex, string sListName = "", int bMaintainOrder = FALSE); + +/// @brief Delete the value at an index on an object's vector list. +/// @param oTarget The object the list is stored on. +/// @param nIndex The index of the value. +/// @param sListName The name of the list. +/// @param bMaintainOrder Not used; exists for legacy purposes only. +/// @returns The number of items remanining in the list. +int DeleteListVector(object oTarget, int nIndex, string sListName = "", int bMaintainOrder = FALSE); + +/// @brief Delete the value at an index on an object's object list. +/// @param oTarget The object the list is stored on. +/// @param nIndex The index of the value. +/// @param sListName The name of the list. +/// @param bMaintainOrder Not used; exists for legacy purposes only. +/// @returns The number of items remanining in the list. +int DeleteListObject(object oTarget, int nIndex, string sListName = "", int bMaintainOrder = FALSE); + +/// @brief Delete the value at an index on an object's string list. +/// @param oTarget The object the list is stored on. +/// @param nIndex The index of the value. +/// @param sListName The name of the list. +/// @param bMaintainOrder Not used; exists for legacy purposes only. +/// @returns The number of items remanining in the list. +int DeleteListString(object oTarget, int nIndex, string sListName = "", int bMaintainOrder = FALSE); + +/// @brief Delete the value at an index on an object's json list. +/// @param oTarget The object the list is stored on. +/// @param nIndex The index of the value. +/// @param sListName The name of the list. +/// @param bMaintainOrder Not used; exists for legacy purposes only. +/// @returns The number of items remanining in the list. +int DeleteListJson(object oTarget, int nIndex, string sListName = "", int bMaintainOrder = FALSE); + +/// @brief Remove the first instance of a value from an object's float list. +/// @param oTarget The object the list is stored on. +/// @param fValue The value to remove. +/// @param sListName The name of the list. +/// @param bMaintainOrder Not used; exists for legacy purposes only. +/// @returns The number of items remanining in the list. +int RemoveListFloat(object oTarget, float fValue, string sListName = "", int bMaintainOrder = FALSE); + +/// @brief Remove the first instance of a value from an object's int list. +/// @param oTarget The object the list is stored on. +/// @param nValue The value to remove. +/// @param sListName The name of the list. +/// @param bMaintainOrder Not used; exists for legacy purposes only. +/// @returns The number of items remanining in the list. +int RemoveListInt(object oTarget, int nValue, string sListName = "", int bMaintainOrder = FALSE); + +/// @brief Remove the first instance of a value from an object's location list. +/// @param oTarget The object the list is stored on. +/// @param lValue The value to remove. +/// @param sListName The name of the list. +/// @param bMaintainOrder Not used; exists for legacy purposes only. +/// @returns The number of items remanining in the list. +int RemoveListLocation(object oTarget, location lValue, string sListName = "", int bMaintainOrder = FALSE); + +/// @brief Remove the first instance of a value from an object's vector list. +/// @param oTarget The object the list is stored on. +/// @param vValue The value to remove. +/// @param sListName The name of the list. +/// @param bMaintainOrder Not used; exists for legacy purposes only. +/// @returns The number of items remanining in the list. +int RemoveListVector(object oTarget, vector vValue, string sListName = "", int bMaintainOrder = FALSE); + +/// @brief Remove the first instance of a value from an object's object list. +/// @param oTarget The object the list is stored on. +/// @param oValue The value to remove. +/// @param sListName The name of the list. +/// @param bMaintainOrder Not used; exists for legacy purposes only. +/// @returns The number of items remanining in the list. +int RemoveListObject(object oTarget, object oValue, string sListName = "", int bMaintainOrder = FALSE); + +/// @brief Remove the first instance of a value from an object's string list. +/// @param oTarget The object the list is stored on. +/// @param sValue The value to remove. +/// @param sListName The name of the list. +/// @param bMaintainOrder Not used; exists for legacy purposes only. +/// @returns The number of items remanining in the list. +int RemoveListString(object oTarget, string sValue, string sListName = "", int bMaintainOrder = FALSE); + +/// @brief Remove the first instance of a value from an object's json list. +/// @param oTarget The object the list is stored on. +/// @param jValue The value to remove. +/// @param sListName The name of the list. +/// @param bMaintainOrder Not used; exists for legacy purposes only. +/// @returns The number of items remanining in the list. +int RemoveListJson(object oTarget, json jValue, string sListName = "", int bMaintainOrder = FALSE); + +/// @brief Return the index of the first occurrence of a value in an object's +/// float list. +/// @param oTarget The object the list is stored on. +/// @param fValue The value to find. +/// @param sListName The name of the list. +/// @returns The index of the value (0-based), or -1 if it is not in the list. +int FindListFloat(object oTarget, float fValue, string sListName = ""); + +/// @brief Return the index of the first occurrence of a value in an object's +/// int list. +/// @param oTarget The object the list is stored on. +/// @param nValue The value to find. +/// @param sListName The name of the list. +/// @returns The index of the value (0-based), or -1 if it is not in the list. +int FindListInt(object oTarget, int nValue, string sListName = ""); + +/// @brief Return the index of the first occurrence of a value in an object's +/// location list. +/// @param oTarget The object the list is stored on. +/// @param lValue The value to find. +/// @param sListName The name of the list. +/// @returns The index of the value (0-based), or -1 if it is not in the list. +int FindListLocation(object oTarget, location lValue, string sListName = ""); + +/// @brief Return the index of the first occurrence of a value in an object's +/// vector list. +/// @param oTarget The object the list is stored on. +/// @param vValue The value to find. +/// @param sListName The name of the list. +/// @returns The index of the value (0-based), or -1 if it is not in the list. +int FindListVector(object oTarget, vector vValue, string sListName = ""); + +/// @brief Return the index of the first occurrence of a value in an object's +/// object list. +/// @param oTarget The object the list is stored on. +/// @param oValue The value to find. +/// @param sListName The name of the list. +/// @returns The index of the value (0-based), or -1 if it is not in the list. +int FindListObject(object oTarget, object oValue, string sListName = ""); + +/// @brief Return the index of the first occurrence of a value in an object's +/// string list. +/// @param oTarget The object the list is stored on. +/// @param sValue The value to find. +/// @param sListName The name of the list. +/// @returns The index of the value (0-based), or -1 if it is not in the list. +int FindListString(object oTarget, string sValue, string sListName = ""); + +/// @brief Return the index of the first occurrence of a value in an object's +/// json list. +/// @param oTarget The object the list is stored on. +/// @param jValue The value to find. +/// @param sListName The name of the list. +/// @returns The index of the value (0-based), or -1 if it is not in the list. +int FindListJson(object oTarget, json jValue, string sListName = ""); + +/// @brief Return whether a value is present in an object's float list. +/// @param oTarget The object the list is stored on. +/// @param fValue The value to find. +/// @param sListName The name of the list. +/// @returns TRUE if the value is in the list; FALSE otherwise. +int HasListFloat(object oTarget, float fValue, string sListName = ""); + +/// @brief Return whether a value is present in an object's int list. +/// @param oTarget The object the list is stored on. +/// @param nValue The value to find. +/// @param sListName The name of the list. +/// @returns TRUE if the value is in the list; FALSE otherwise. +int HasListInt(object oTarget, int nValue, string sListName = ""); + +/// @brief Return whether a value is present in an object's location list. +/// @param oTarget The object the list is stored on. +/// @param lValue The value to find. +/// @param sListName The name of the list. +/// @returns TRUE if the value is in the list; FALSE otherwise. +int HasListLocation(object oTarget, location lValue, string sListName = ""); + +/// @brief Return whether a value is present in an object's vector list. +/// @param oTarget The object the list is stored on. +/// @param vValue The value to find. +/// @param sListName The name of the list. +/// @returns TRUE if the value is in the list; FALSE otherwise. +int HasListVector(object oTarget, vector vValue, string sListName = ""); + +/// @brief Return whether a value is present in an object's object list. +/// @param oTarget The object the list is stored on. +/// @param oValue The value to find. +/// @param sListName The name of the list. +/// @returns TRUE if the value is in the list; FALSE otherwise. +int HasListObject(object oTarget, object oValue, string sListName = ""); + +/// @brief Return whether a value is present in an object's string list. +/// @param oTarget The object the list is stored on. +/// @param sValue The value to find. +/// @param sListName The name of the list. +/// @returns TRUE if the value is in the list; FALSE otherwise. +int HasListString(object oTarget, string sValue, string sListName = ""); + +/// @brief Return whether a value is present in an object's json list. +/// @param oTarget The object the list is stored on. +/// @param jValue The value to find. +/// @param sListName The name of the list. +/// @returns TRUE if the value is in the list; FALSE otherwise. +int HasListJson(object oTarget, json jValue, string sListName = ""); + +/// @brief Insert a value at an index in an object's float list. +/// @param oTarget The object the list is stored on. +/// @param nIndex The index to insert the value at. If the index exceeds the +/// length of the list, nothing is added. +/// @param fValue The value to insert. +/// @param sListName The name of the list. +/// @param bAddUnique If TRUE, the insert operation will be conducted first and +/// then duplicate values will be removed. +/// @returns The length of the updated list. +int InsertListFloat(object oTarget, int nIndex, float fValue, string sListName = "", int bAddUnique = FALSE); + +/// @brief Insert a value at an index in an object's int list. +/// @param oTarget The object the list is stored on. +/// @param nIndex The index to insert the value at. If the index exceeds the +/// length of the list, nothing is added. +/// @param nValue The value to insert. +/// @param sListName The name of the list. +/// @param bAddUnique If TRUE, the insert operation will be conducted first and +/// then duplicate values will be removed. +/// @returns The length of the updated list. +int InsertListInt(object oTarget, int nIndex, int nValue, string sListName = "", int bAddUnique = FALSE); + +/// @brief Insert a value at an index in an object's location list. +/// @param oTarget The object the list is stored on. +/// @param nIndex The index to insert the value at. If the index exceeds the +/// length of the list, nothing is added. +/// @param lValue The value to insert. +/// @param sListName The name of the list. +/// @param bAddUnique If TRUE, the insert operation will be conducted first and +/// then duplicate values will be removed. +/// @returns The length of the updated list. +int InsertListLocation(object oTarget, int nIndex, location lValue, string sListName = "", int bAddUnique = FALSE); + +/// @brief Insert a value at an index in an object's vector list. +/// @param oTarget The object the list is stored on. +/// @param nIndex The index to insert the value at. If the index exceeds the +/// length of the list, nothing is added. +/// @param vValue The value to insert. +/// @param sListName The name of the list. +/// @param bAddUnique If TRUE, the insert operation will be conducted first and +/// then duplicate values will be removed. +/// @returns The length of the updated list. +int InsertListVector(object oTarget, int nIndex, vector vValue, string sListName = "", int bAddUnique = FALSE); + +/// @brief Insert a value at an index in an object's objeect list. +/// @param oTarget The object the list is stored on. +/// @param nIndex The index to insert the value at. If the index exceeds the +/// length of the list, nothing is added. +/// @param oValue The value to insert. +/// @param sListName The name of the list. +/// @param bAddUnique If TRUE, the insert operation will be conducted first and +/// then duplicate values will be removed. +/// @returns The length of the updated list. +int InsertListObject(object oTarget, int nIndex, object oValue, string sListName = "", int bAddUnique = FALSE); + +/// @brief Insert a value at an index in an object's string list. +/// @param oTarget The object the list is stored on. +/// @param nIndex The index to insert the value at. If the index exceeds the +/// length of the list, nothing is added. +/// @param sValue The value to insert. +/// @param sListName The name of the list. +/// @param bAddUnique If TRUE, the insert operation will be conducted first and +/// then duplicate values will be removed. +/// @returns The length of the updated list. +int InsertListString(object oTarget, int nIndex, string sValue, string sListName = "", int bAddUnique = FALSE); + +/// @brief Insert a value at an index in an object's json list. +/// @param oTarget The object the list is stored on. +/// @param nIndex The index to insert the value at. If the index exceeds the +/// length of the list, nothing is added. +/// @param jValue The value to insert. +/// @param sListName The name of the list. +/// @param bAddUnique If TRUE, the insert operation will be conducted first and +/// then duplicate values will be removed. +/// @returns The length of the updated list. +int InsertListJson(object oTarget, int nIndex, json jValue, string sListName = "", int bAddUnique = FALSE); + +/// @brief Set the value at an index in an object's float list. +/// @param oTarget The object the list is stored on. +/// @param nIndex The index to set the value of. If the index exceeds the length +/// of the list, nothing is added. +/// @param fValue The value to set. +/// @param sListName The name of the list. +void SetListFloat(object oTarget, int nIndex, float fValue, string sListName = ""); + +/// @brief Set the value at an index in an object's int list. +/// @param oTarget The object the list is stored on. +/// @param nIndex The index to set the value of. If the index exceeds the length +/// of the list, nothing is added. +/// @param nValue The value to set. +/// @param sListName The name of the list. +void SetListInt(object oTarget, int nIndex, int nValue, string sListName = ""); + +/// @brief Set the value at an index in an object's location list. +/// @param oTarget The object the list is stored on. +/// @param nIndex The index to set the value of. If the index exceeds the length +/// of the list, nothing is added. +/// @param lValue The value to set. +/// @param sListName The name of the list. +void SetListLocation(object oTarget, int nIndex, location lValue, string sListName = ""); + +/// @brief Set the value at an index in an object's vector list. +/// @param oTarget The object the list is stored on. +/// @param nIndex The index to set the value of. If the index exceeds the length +/// of the list, nothing is added. +/// @param vValue The value to set. +/// @param sListName The name of the list. +void SetListVector(object oTarget, int nIndex, vector vValue, string sListName = ""); + +/// @brief Set the value at an index in an object's object list. +/// @param oTarget The object the list is stored on. +/// @param nIndex The index to set the value of. If the index exceeds the length +/// of the list, nothing is added. +/// @param oValue The value to set. +/// @param sListName The name of the list. +void SetListObject(object oTarget, int nIndex, object oValue, string sListName = ""); + +/// @brief Set the value at an index in an object's string list. +/// @param oTarget The object the list is stored on. +/// @param nIndex The index to set the value of. If the index exceeds the length +/// of the list, nothing is added. +/// @param sValue The value to set. +/// @param sListName The name of the list. +void SetListString(object oTarget, int nIndex, string sValue, string sListName = ""); + +/// @brief Set the value at an index in an object's json list. +/// @param oTarget The object the list is stored on. +/// @param nIndex The index to set the value of. If the index exceeds the length +/// of the list, nothing is added. +/// @param jValue The value to set. +/// @param sListName The name of the list. +void SetListJson(object oTarget, int nIndex, json jValue, string sListName = ""); + +/// @brief Copy value from one object's float list to another's. +/// @param oSource The object to copy the list values of. +/// @param oTarget The object to copy the list values to. +/// @param sSourceName The name of the list on oSource. +/// @param sTargetName The name of the list on oTarget. +/// @param nIndex The index to begin copying from. +/// @param nRange The number of values to copy. If -1, will copy all values from +/// nIndex and up. +/// @param bAddUnique If TRUE, the copy operation will be conducted first and +/// then any duplicate values will be removed. Values in the target list +/// will be prioritiezed over values from the source list. +/// @returns The number of values copied. +int CopyListFloat(object oSource, object oTarget, string sSourceName, string sTargetName, int nIndex, int nRange = 1, int bAddUnique = FALSE); + +/// @brief Copy value from one object's int list to another's. +/// @param oSource The object to copy the list values of. +/// @param oTarget The object to copy the list values to. +/// @param sSourceName The name of the list on oSource. +/// @param sTargetName The name of the list on oTarget. +/// @param nIndex The index to begin copying from. +/// @param nRange The number of values to copy. If -1, will copy all values from +/// nIndex and up. +/// @param bAddUnique If TRUE, the copy operation will be conducted first and +/// then any duplicate values will be removed. Values in the target list +/// will be prioritiezed over values from the source list. +/// @returns The number of values copied. +int CopyListInt(object oSource, object oTarget, string sSourceName, string sTargetName, int nIndex, int nRange = 1, int bAddUnique = FALSE); + +/// @brief Copy value from one object's location list to another's. +/// @param oSource The object to copy the list values of. +/// @param oTarget The object to copy the list values to. +/// @param sSourceName The name of the list on oSource. +/// @param sTargetName The name of the list on oTarget. +/// @param nIndex The index to begin copying from. +/// @param nRange The number of values to copy. If -1, will copy all values from +/// nIndex and up. +/// @param bAddUnique If TRUE, the copy operation will be conducted first and +/// then any duplicate values will be removed. Values in the target list +/// will be prioritiezed over values from the source list. +/// @returns The number of values copied. +int CopyListLocation(object oSource, object oTarget, string sSourceName, string sTargetName, int nIndex, int nRange = 1, int bAddUnique = FALSE); + +/// @brief Copy value from one object's vector list to another's. +/// @param oSource The object to copy the list values of. +/// @param oTarget The object to copy the list values to. +/// @param sSourceName The name of the list on oSource. +/// @param sTargetName The name of the list on oTarget. +/// @param nIndex The index to begin copying from. +/// @param nRange The number of values to copy. If -1, will copy all values from +/// nIndex and up. +/// @param bAddUnique If TRUE, the copy operation will be conducted first and +/// then any duplicate values will be removed. Values in the target list +/// will be prioritiezed over values from the source list. +/// @returns The number of values copied. +int CopyListVector(object oSource, object oTarget, string sSourceName, string sTargetName, int nIndex, int nRange = 1, int bAddUnique = FALSE); + +/// @brief Copy value from one object's object list to another's. +/// @param oSource The object to copy the list values of. +/// @param oTarget The object to copy the list values to. +/// @param sSourceName The name of the list on oSource. +/// @param sTargetName The name of the list on oTarget. +/// @param nIndex The index to begin copying from. +/// @param nRange The number of values to copy. If -1, will copy all values from +/// nIndex and up. +/// @param bAddUnique If TRUE, the copy operation will be conducted first and +/// then any duplicate values will be removed. Values in the target list +/// will be prioritiezed over values from the source list. +/// @returns The number of values copied. +int CopyListObject(object oSource, object oTarget, string sSourceName, string sTargetName, int nIndex, int nRange = 1, int bAddUnique = FALSE); + +/// @brief Copy value from one object's string list to another's. +/// @param oSource The object to copy the list values of. +/// @param oTarget The object to copy the list values to. +/// @param sSourceName The name of the list on oSource. +/// @param sTargetName The name of the list on oTarget. +/// @param nIndex The index to begin copying from. +/// @param nRange The number of values to copy. If -1, will copy all values from +/// nIndex and up. +/// @param bAddUnique If TRUE, the copy operation will be conducted first and +/// then any duplicate values will be removed. Values in the target list +/// will be prioritiezed over values from the source list. +/// @returns The number of values copied. +int CopyListString(object oSource, object oTarget, string sSourceName, string sTargetName, int nIndex, int nRange = 1, int bAddUnique = FALSE); + +/// @brief Copy value from one object's json list to another's. +/// @param oSource The object to copy the list values of. +/// @param oTarget The object to copy the list values to. +/// @param sSourceName The name of the list on oSource. +/// @param sTargetName The name of the list on oTarget. +/// @param nIndex The index to begin copying from. +/// @param nRange The number of values to copy. If -1, will copy all values from +/// nIndex and up. +/// @param bAddUnique If TRUE, the copy operation will be conducted first and +/// then any duplicate values will be removed. Values in the target list +/// will be prioritiezed over values from the source list. +/// @returns The number of values copied. +int CopyListJson(object oSource, object oTarget, string sSourceName, string sTargetName, int nIndex, int nRange = 1, int bAddUnique = FALSE); + +/// @brief Increment the value at an index in an object's int list. +/// @param oTarget The object the list is stored on. +/// @param nIndex The index of the value. +/// @param nIncrement The amount to increment the value by. +/// @param sListName The name of the list. +/// @returns The new value of the int. +int IncrementListInt(object oTarget, int nIndex, int nIncrement = 1, string sListName = ""); + +/// @brief Decrement the value at an index in an object's int list. +/// @param oTarget The object the list is stored on. +/// @param nIndex The index of the value. +/// @param nIncrement The amount to decrement the value by. +/// @param sListName The name of the list. +/// @returns The new value of the int. +int DecrementListInt(object oTarget, int nIndex, int nDecrement = -1, string sListName = ""); + +/// @brief Convert an object's float list to a json array. +/// @param oTarget The object the list is stored on. +/// @param sListName The name of the list. +/// @note Elements of the returned array can be decoded with JsonGetFloat(). +json GetFloatList(object oTarget, string sListName = ""); + +/// @brief Convert an object's int list to a json array. +/// @param oTarget The object the list is stored on. +/// @param sListName The name of the list. +/// @note Elements of the returned array can be decoded with JsonGetInt(). +json GetIntList(object oTarget, string sListName = ""); + +/// @brief Convert an object's location list to a json array. +/// @param oTarget The object the list is stored on. +/// @param sListName The name of the list. +/// @note Elements of the returned array can be decoded with JsonGetLocation(). +json GetLocationList(object oTarget, string sListName = ""); + +/// @brief Convert an object's vector list to a json array. +/// @param oTarget The object the list is stored on. +/// @param sListName The name of the list. +/// @note Elements of the returned array can be decoded with JsonGetVector(). +json GetVectorList(object oTarget, string sListName = ""); + +/// @brief Convert an object's object list to a json array. +/// @param oTarget The object the list is stored on. +/// @param sListName The name of the list. +/// @note Elements of the returned array can be decoded with +/// ObjectToString(JsonGetString()). +json GetObjectList(object oTarget, string sListName = ""); + +/// @brief Convert an object's string list to a json array. +/// @param oTarget The object the list is stored on. +/// @param sListName The name of the list. +/// @note Elements of the returned array can be decoded with JsonGetString(). +json GetStringList(object oTarget, string sListName = ""); + +/// @brief Convert an object's json list into a json array. +/// @param oTarget The object the list is stored on. +/// @param sListName The name of the list. +json GetJsonList(object oTarget, string sListName = ""); + +/// @brief Save a json array as an object's float list. +/// @param oTarget The object the list is stored on. +/// @param jList A JsonArray() made up of JsonFloat()s. +/// @param sListName The name of the list. +void SetFloatList(object oTarget, json jList, string sListName = ""); + +/// @brief Save a json array as an object's int list. +/// @param oTarget The object the list is stored on. +/// @param jList A JsonArray() made up of JsonInt()s. +/// @param sListName The name of the list. +void SetIntList(object oTarget, json jList, string sListName = ""); + +/// @brief Save a json array as an object's location list. +/// @param oTarget The object the list is stored on. +/// @param jList A JsonArray() made up of JsonLocation()s. +/// @param sListName The name of the list. +void SetLocationList(object oTarget, json jList, string sListName = ""); + +/// @brief Save a json array as an object's vector list. +/// @param oTarget The object the list is stored on. +/// @param jList A JsonArray() made up of JsonVector()s. +/// @param sListName The name of the list. +void SetVectorList(object oTarget, json jList, string sListName = ""); + +/// @brief Save a json array as an object's object list. +/// @param oTarget The object the list is stored on. +/// @param jList A JsonArray() made up of JsonObject()s. +/// @param sListName The name of the list. +void SetObjectList(object oTarget, json jList, string sListName = ""); + +/// @brief Save a json array as an object's string list. +/// @param oTarget The object the list is stored on. +/// @param jList A JsonArray() made up of JsonString()s. +/// @param sListName The name of the list. +void SetStringList(object oTarget, json jList, string sListName = ""); + +/// @brief Save a json array as an object's json list. +/// @param oTarget The object the list is stored on. +/// @param jList A JsonArray() made up of any json types. +/// @param sListName The name of the list. +void SetJsonList(object oTarget, json jList, string sListName = ""); + +/// @brief Delete an object's float list. +/// @param oTarget The object the list is stored on. +/// @param sListName The name of the list. +void DeleteFloatList(object oTarget, string sListName = ""); + +/// @brief Delete an object's float list. +/// @param oTarget The object the list is stored on. +/// @param sListName The name of the list. +void DeleteIntList(object oTarget, string sListName = ""); + +/// @brief Delete an object's float list. +/// @param oTarget The object the list is stored on. +/// @param sListName The name of the list. +void DeleteLocationList(object oTarget, string sListName = ""); + +/// @brief Delete an object's float list. +/// @param oTarget The object the list is stored on. +/// @param sListName The name of the list. +void DeleteVectorList(object oTarget, string sListName = ""); + +/// @brief Delete an object's float list. +/// @param oTarget The object the list is stored on. +/// @param sListName The name of the list. +void DeleteObjectList(object oTarget, string sListName = ""); + +/// @brief Delete an object's string list. +/// @param oTarget The object the list is stored on. +/// @param sListName The name of the list. +void DeleteStringList(object oTarget, string sListName = ""); + +/// @brief Delete an object's json list. +/// @param oTarget The object the list is stored on. +/// @param sListName The name of the list. +void DeleteJsonList(object oTarget, string sListName = ""); + +/// @brief Create a float list on a target, deleting any current list. +/// @param oTarget The object to create the list on. +/// @param nCount The number of values to initialize the list with. +/// @param sListName The name of the list. +/// @param fDefault The value to initialize the list with. +/// @returns A json array copy of the created list. +json DeclareFloatList(object oTarget, int nCount, string sListName = "", float fDefault = 0.0); + +/// @brief Create an int list on a target, deleting any current list. +/// @param oTarget The object to create the list on. +/// @param nCount The number of values to initialize the list with. +/// @param sListName The name of the list. +/// @param nDefault The value to initialize the list with. +/// @returns A json array copy of the created list. +json DeclareIntList(object oTarget, int nCount, string sListName = "", int nDefault = 0); + +/// @brief Create a location list on a target, deleting any current list. +/// @param oTarget The object to create the list on. +/// @param nCount The number of values to initialize the list with. +/// @param sListName The name of the list. +/// @returns A json array copy of the created list. +json DeclareLocationList(object oTarget, int nCount, string sListName = ""); + +/// @brief Create a vector list on a target, deleting any current list. +/// @param oTarget The object to create the list on. +/// @param nCount The number of values to initialize the list with. +/// @param sListName The name of the list. +/// @returns A json array copy of the created list. +json DeclareVectorList(object oTarget, int nCount, string sListName = ""); + +/// @brief Create an object list on a target, deleting any current list. +/// @param oTarget The object to create the list on. +/// @param nCount The number of values to initialize the list with. +/// @param sListName The name of the list. +/// @returns A json array copy of the created list. +json DeclareObjectList(object oTarget, int nCount, string sListName = ""); + +/// @brief Create a string list on a target, deleting any current list. +/// @param oTarget The object to create the list on. +/// @param nCount The number of values to initialize the list with. +/// @param sListName The name of the list. +/// @param sDefault The value to initialize the list with. +/// @returns A json array copy of the created list. +json DeclareStringList(object oTarget, int nCount, string sListName = "", string sDefault = ""); + +/// @brief Create a json list on a target, deleting any current list. +/// @param oTarget The object to create the list on. +/// @param nCount The number of values to initialize the list with. +/// @param sListName The name of the list. +/// @returns A json array copy of the created list. +json DeclareJsonList(object oTarget, int nCount, string sListName = ""); + +/// @brief Set the length of an object's float list. +/// @param oTarget The object the list is stored on. +/// @param nCount The length to set the list to. If less than the current +/// length, the list will be shortened to match. If greater than the current +/// length, additional values will be added to the end of the list. +/// @param sListName The name of the list. +/// @param fDefault The value to set any added elements to. +/// @returns A json array copy of the updated list. +json NormalizeFloatList(object oTarget, int nCount, string sListName = "", float fDefault = 0.0); + +/// @brief Set the length of an object's int list. +/// @param oTarget The object the list is stored on. +/// @param nCount The length to set the list to. If less than the current +/// length, the list will be shortened to match. If greater than the current +/// length, additional values will be added to the end of the list. +/// @param sListName The name of the list. +/// @param nDefault The value to set any added elements to. +/// @returns A json array copy of the updated list. +json NormalizeIntList(object oTarget, int nCount, string sListName = "", int nDefault = 0); + +/// @brief Set the length of an object's location list. +/// @param oTarget The object the list is stored on. +/// @param nCount The length to set the list to. If less than the current +/// length, the list will be shortened to match. If greater than the current +/// length, additional values will be added to the end of the list. +/// @param sListName The name of the list. +/// @returns A json array copy of the updated list. +json NormalizeLocationList(object oTarget, int nCount, string sListName = ""); + +/// @brief Set the length of an object's vector list. +/// @param oTarget The object the list is stored on. +/// @param nCount The length to set the list to. If less than the current +/// length, the list will be shortened to match. If greater than the current +/// length, additional values will be added to the end of the list. +/// @param sListName The name of the list. +/// @returns A json array copy of the updated list. +json NormalizeVectorList(object oTarget, int nCount, string sListName = ""); + +/// @brief Set the length of an object's object list. +/// @param oTarget The object the list is stored on. +/// @param nCount The length to set the list to. If less than the current +/// length, the list will be shortened to match. If greater than the current +/// length, additional values will be added to the end of the list. +/// @param sListName The name of the list. +/// @returns A json array copy of the updated list. +json NormalizeObjectList(object oTarget, int nCount, string sListName = ""); + +/// @brief Set the length of an object's string list. +/// @param oTarget The object the list is stored on. +/// @param nCount The length to set the list to. If less than the current +/// length, the list will be shortened to match. If greater than the current +/// length, additional values will be added to the end of the list. +/// @param sListName The name of the list. +/// @param sDefault The value to set any added elements to. +/// @returns A json array copy of the updated list. +json NormalizeStringList(object oTarget, int nCount, string sListName = "", string sDefault = ""); + +/// @brief Set the length of an object's json list. +/// @param oTarget The object the list is stored on. +/// @param nCount The length to set the list to. If less than the current +/// length, the list will be shortened to match. If greater than the current +/// length, additional null values will be added to the end of the list. +/// @param sListName The name of the list. +/// @returns A json array copy of the updated list. +json NormalizeJsonList(object oTarget, int nCount, string sListName = ""); + +/// @brief Copy all items from one object's float list to another's. +/// @param oSource The object to copy the list from. +/// @param oTarget The object to copy the list to. +/// @param sSourceName The name of the source list. +/// @param sTargetName The name of the target list. +/// @param bAddUnique If TRUE, will only copy items that are not already present +/// in the target list. +void CopyFloatList(object oSource, object oTarget, string sSourceName, string sTargetName, int bAddUnique = FALSE); + +/// @brief Copy all items from one object's int list to another's. +/// @param oSource The object to copy the list from. +/// @param oTarget The object to copy the list to. +/// @param sSourceName The name of the source list. +/// @param sTargetName The name of the target list. +/// @param bAddUnique If TRUE, will only copy items that are not already present +/// in the target list. +void CopyIntList(object oSource, object oTarget, string sSourceName, string sTargetName, int bAddUnique = FALSE); + +/// @brief Copy all items from one object's location list to another's. +/// @param oSource The object to copy the list from. +/// @param oTarget The object to copy the list to. +/// @param sSourceName The name of the source list. +/// @param sTargetName The name of the target list. +/// @param bAddUnique If TRUE, will only copy items that are not already present +/// in the target list. +void CopyLocationList(object oSource, object oTarget, string sSourceName, string sTargetName, int bAddUnique = FALSE); + +/// @brief Copy all items from one object's vector list to another's. +/// @param oSource The object to copy the list from. +/// @param oTarget The object to copy the list to. +/// @param sSourceName The name of the source list. +/// @param sTargetName The name of the target list. +/// @param bAddUnique If TRUE, will only copy items that are not already present +/// in the target list. +void CopyVectorList(object oSource, object oTarget, string sSourceName, string sTargetName, int bAddUnique = FALSE); + +/// @brief Copy all items from one object's object list to another's. +/// @param oSource The object to copy the list from. +/// @param oTarget The object to copy the list to. +/// @param sSourceName The name of the source list. +/// @param sTargetName The name of the target list. +/// @param bAddUnique If TRUE, will only copy items that are not already present +/// in the target list. +void CopyObjectList(object oSource, object oTarget, string sSourceName, string sTargetName, int bAddUnique = FALSE); + +/// @brief Copy all items from one object's string list to another's. +/// @param oSource The object to copy the list from. +/// @param oTarget The object to copy the list to. +/// @param sSourceName The name of the source list. +/// @param sTargetName The name of the target list. +/// @param bAddUnique If TRUE, will only copy items that are not already present +/// in the target list. +void CopyStringList(object oSource, object oTarget, string sSourceName, string sTargetName, int bAddUnique = FALSE); + +/// @brief Copy all items from one object's json list to another's. +/// @param oSource The object to copy the list from. +/// @param oTarget The object to copy the list to. +/// @param sSourceName The name of the source list. +/// @param sTargetName The name of the target list. +/// @param bAddUnique If TRUE, will only copy items that are not already present +/// in the target list. +void CopyJsonList(object oSource, object oTarget, string sSourceName, string sTargetName, int bAddUnique = FALSE); + +/// @brief Return the number of items in an object's float list. +/// @param oTarget The object the list is stored on. +/// @param sListName The name of the list. +int CountFloatList(object oTarget, string sListName = ""); + +/// @brief Return the number of items in an object's int list. +/// @param oTarget The object the list is stored on. +/// @param sListName The name of the list. +int CountIntList(object oTarget, string sListName = ""); + +/// @brief Return the number of items in an object's location list. +/// @param oTarget The object the list is stored on. +/// @param sListName The name of the list. +int CountLocationList(object oTarget, string sListName = ""); + +/// @brief Return the number of items in an object's vector list. +/// @param oTarget The object the list is stored on. +/// @param sListName The name of the list. +int CountVectorList(object oTarget, string sListName = ""); + +/// @brief Return the number of items in an object's object list. +/// @param oTarget The object the list is stored on. +/// @param sListName The name of the list. +int CountObjectList(object oTarget, string sListName = ""); + +/// @brief Return the number of items in an object's string list. +/// @param oTarget The object the list is stored on. +/// @param sListName The name of the list. +int CountStringList(object oTarget, string sListName = ""); + +/// @brief Return the number of items in an object's json list. +/// @param oTarget The object the list is stored on. +/// @param sListName The name of the list. +int CountJsonList(object oTarget, string sListName = ""); + +/// @brief Sort an object's float list. +/// @param oTarget The object the list is stored on. +/// @param nOrder A `LIST_ORDER_*` constant representing how to sort the list. +/// @param sListName The name of the list. +void SortFloatList(object oTarget, int nOrder = LIST_SORT_ASC, string sListName = ""); + +/// @brief Sort an object's int list. +/// @param oTarget The object the list is stored on. +/// @param nOrder A `LIST_ORDER_*` constant representing how to sort the list. +/// @param sListName The name of the list. +void SortIntList(object oTarget, int nOrder = LIST_SORT_ASC, string sListName = ""); + +/// @brief Sort an object's string list. +/// @param oTarget The object the list is stored on. +/// @param nOrder A `LIST_ORDER_*` constant representing how to sort the list. +/// @param sListName The name of the list. +void SortStringList(object oTarget, int nOrder = LIST_SORT_ASC, string sListName = ""); + +/// @brief Shuffle the items in an object's float list. +/// @param oTarget The object the list is stored on. +/// @param sListName The name of the list. +void ShuffleFloatList(object oTarget, string sListName = ""); + +/// @brief Shuffle the items in an object's int list. +/// @param oTarget The object the list is stored on. +/// @param sListName The name of the list. +void ShuffleIntList(object oTarget, string sListName = ""); + +/// @brief Shuffle the items in an object's location list. +/// @param oTarget The object the list is stored on. +/// @param sListName The name of the list. +void ShuffleLocationList(object oTarget, string sListName = ""); + +/// @brief Shuffle the items in an object's vector list. +/// @param oTarget The object the list is stored on. +/// @param sListName The name of the list. +void ShuffleVectorList(object oTarget, string sListName = ""); + +/// @brief Shuffle the items in an object's object list. +/// @param oTarget The object the list is stored on. +/// @param sListName The name of the list. +void ShuffleObjectList(object oTarget, string sListName = ""); + +/// @brief Shuffle the items in an object's string list. +/// @param oTarget The object the list is stored on. +/// @param sListName The name of the list. +void ShuffleStringList(object oTarget, string sListName = ""); + +/// @brief Shuffle the items in an object's json list. +/// @param oTarget The object the list is stored on. +/// @param sListName The name of the list. +void ShuffleJsonList(object oTarget, string sListName = ""); + +/// @brief Reverse the order of the items in an object's float list. +/// @param oTarget The object the list is stored on. +/// @param sListName The name of the list. +void ReverseFloatList(object oTarget, string sListName = ""); + +/// @brief Reverse the order of the items in an object's int list. +/// @param oTarget The object the list is stored on. +/// @param sListName The name of the list. +void ReverseIntList(object oTarget, string sListName = ""); + +/// @brief Reverse the order of the items in an object's location list. +/// @param oTarget The object the list is stored on. +/// @param sListName The name of the list. +void ReverseLocationList(object oTarget, string sListName = ""); + +/// @brief Reverse the order of the items in an object's vector list. +/// @param oTarget The object the list is stored on. +/// @param sListName The name of the list. +void ReverseVectorList(object oTarget, string sListName = ""); + +/// @brief Reverse the order of the items in an object's object list. +/// @param oTarget The object the list is stored on. +/// @param sListName The name of the list. +void ReverseObjectList(object oTarget, string sListName = ""); + +/// @brief Reverse the order of the items in an object's string list. +/// @param oTarget The object the list is stored on. +/// @param sListName The name of the list. +void ReverseStringList(object oTarget, string sListName = ""); + +/// @brief Reverse the order of the items in an object's json list. +/// @param oTarget The object the list is stored on. +/// @param sListName The name of the list. +void ReverseJsonList(object oTarget, string sListName = ""); + +// ----------------------------------------------------------------------------- +// Function Implementations +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +// Private Functions +// ----------------------------------------------------------------------------- + +// Determines whether nIndex is a valid reference to an array element in jList. +// If bNegative is TRUE, -1 will be returned as a valid nIndex value. +int _GetIsIndexValid(json jList, int nIndex, int bNegative = FALSE) +{ + return nIndex >= (0 - bNegative) && nIndex < JsonGetLength(jList); +} + +// Retrieves json array sListName of sListType from oTarget. +json _GetList(object oTarget, string sListType, string sListName = "") +{ + json jList = GetLocalJson(oTarget, LIST_REF + sListType + sListName); + return jList == JsonNull() ? JsonArray() : jList; +} + +// Sets sListType json array jList as sListName on oTarget. +void _SetList(object oTarget, string sListType, string sListName, json jList) +{ + SetLocalJson(oTarget, LIST_REF + sListType + sListName, jList); +} + +// Deletes sListType json array sListName from oTarget. +void _DeleteList(object oTarget, string sListType, string sListName) +{ + DeleteLocalJson(oTarget, LIST_REF + sListType + sListName); +} + +// Inserts array element jValue into json array sListName at nIndex on oTarget. +// Returns the number of elements in the array after insertion. If bUnique is +// TRUE, duplicate values with be removed after the insert operation. +int _InsertListElement(object oTarget, string sListType, string sListName, + json jValue, int nIndex, int bUnique) +{ + json jList = _GetList(oTarget, sListType, sListName); + + if (_GetIsIndexValid(jList, nIndex, TRUE) == TRUE) + { + jList = JsonArrayInsert(jList, jValue, nIndex); + + if (bUnique == TRUE) + jList = JsonArrayTransform(jList, JSON_ARRAY_UNIQUE); + + _SetList(oTarget, sListType, sListName, jList); + } + + return JsonGetLength(jList); +} + +// Returns array element at nIndex from array sListName on oTarget. If not +// found, returns JsonNull(). +json _GetListElement(object oTarget, string sListType, string sListName, int nIndex) +{ + json jList = _GetList(oTarget, sListType, sListName); + return _GetIsIndexValid(jList, nIndex) == TRUE ? + JsonArrayGet(jList, nIndex) : + JsonNull(); +} + +// Deletes array element at nIndex from array sListName on oTarget. Element order +// is maintained. Returns the number of array elements remaining after deletion. +int _DeleteListElement(object oTarget, string sListType, string sListName, int nIndex) +{ + json jList = _GetList(oTarget, sListType, sListName); + + if (_GetIsIndexValid(jList, nIndex) == TRUE && JsonGetLength(jList) > 0) + { + jList = JsonArrayDel(jList, nIndex); + _SetList(oTarget, sListType, sListName, jList); + } + + return JsonGetLength(jList); +} + +// Finds array element jValue in array sListName on oTarget. If found, returns the +// index of the elements. If not, returns -1. +int _FindListElement(object oTarget, string sListType, string sListName, json jValue) +{ + json jList = _GetList(oTarget, sListType, sListName); + json jIndex = JsonFind(jList, jValue, 0, JSON_FIND_EQUAL); + return jIndex == JsonNull() ? -1 : JsonGetInt(jIndex); +} + +// Deletes array element jValue from array sListName on oTarget. Element order +// is maintained. Returns the number of array elements remaining after deletion. +int _RemoveListElement(object oTarget, string sListType, string sListName, json jValue) +{ + json jList = _GetList(oTarget, sListType, sListName); + int nIndex = _FindListElement(oTarget, sListType, sListName, jValue); + + if (nIndex > -1) + { + jList = JsonArrayDel(jList, nIndex); + _SetList(oTarget, sListType, sListName, JsonArrayDel(jList, nIndex)); + } + + return JsonGetLength(jList); +} + +// Finds array element jValue in array sListName on oTarget. Returns TRUE if found, +// FALSE otherwise. +int _HasListElement(object oTarget, string sListType, string sListName, json jValue) +{ + return _FindListElement(oTarget, sListType, sListName, jValue) > -1; +} + +// Replaces array element at nIndex in array sListName on oTarget with jValue. +void _SetListElement(object oTarget, string sListType, string sListName, int nIndex, json jValue) +{ + json jList = _GetList(oTarget, sListType, sListName); + + if (_GetIsIndexValid(jList, nIndex) == TRUE) + _SetList(oTarget, sListType, sListName, JsonArraySet(jList, nIndex, jValue)); +} + +// This procedure exists because current json operations cannot easily append a list without +// removing duplicate elements or auto-sorting the list. BD is expected to update json +// functions with an append option. If so, replace this function with the json append +// function from nwscript.nss or fold this into _SortList() below. +json _JsonArrayAppend(json jFrom, json jTo) +{ + string sFrom = JsonDump(jFrom); + string sTo = JsonDump(jTo); + + sFrom = GetStringRight(sFrom, GetStringLength(sFrom) - 1); + sTo = GetStringLeft(sTo, GetStringLength(sTo) - 1); + + int nFrom = JsonGetLength(jFrom); + int nTo = JsonGetLength(jTo); + + string s = (nTo == 0 ? "" : + nTo > 0 && nFrom == 0 ? "" : ","); + + return JsonParse(sTo + s + sFrom); +} + +// Copies specified elements from oSource array sSourceName to oTarget array sTargetName. +// Copied elements start at nIndex and continue for nRange elements. Elements copied from +// oSource are appended to the end of oTarget's array. +int _CopyListElements(object oSource, object oTarget, string sListType, string sSourceName, + string sTargetName, int nIndex, int nRange, int bUnique) +{ + json jSource = _GetList(oSource, sListType, sSourceName); + json jTarget = _GetList(oTarget, sListType, sTargetName); + + if (jTarget == JsonNull()) + jTarget = JsonArray(); + + int nSource = JsonGetLength(jSource); + int nTarget = JsonGetLength(jTarget); + + if (nSource == 0) return 0; + + json jCopy, jReturn; + + if (nIndex == 0 && (nRange == -1 || nRange >= nSource)) + { + if (jSource == JsonNull() || nSource == 0) + return 0; + + jReturn = _JsonArrayAppend(jSource, jTarget); + if (bUnique == TRUE) + jReturn = JsonArrayTransform(jReturn, JSON_ARRAY_UNIQUE); + + _SetList(oTarget, sListType, sTargetName, jReturn); + return nSource; + } + + if (_GetIsIndexValid(jSource, nIndex) == TRUE) + { + int nMaxIndex = nSource - nIndex; + if (nRange == -1) + nRange = nMaxIndex; + else if (nRange > (nMaxIndex)) + nRange = clamp(nRange, 1, nMaxIndex); + + jCopy = JsonArrayGetRange(jSource, nIndex, nIndex + (nRange - 1)); + jReturn = _JsonArrayAppend(jTarget, jCopy); + if (bUnique == TRUE) + jReturn = JsonArrayTransform(jReturn, JSON_ARRAY_UNIQUE); + + _SetList(oTarget, sListType, sTargetName, jReturn); + return JsonGetLength(jCopy) - JsonGetLength(JsonSetOp(jCopy, JSON_SET_INTERSECT, jTarget)); + } + + return 0; +} + +// Modifies an int list element by nIncrement and returns the new value. +int _IncrementListElement(object oTarget, string sListName, int nIndex, int nIncrement) +{ + json jList = _GetList(oTarget, VARLIST_TYPE_INT, sListName); + + if (_GetIsIndexValid(jList, nIndex)) + { + int nValue = JsonGetInt(JsonArrayGet(jList, nIndex)) + nIncrement; + jList = JsonArraySet(jList, nIndex, JsonInt(nValue)); + _SetList(oTarget, VARLIST_TYPE_INT, sListName, jList); + + return nValue; + } + + return 0; +} + +// Creates an array of length nLength jDefault elements as sListName on oTarget. +json _DeclareList(object oTarget, string sListType, string sListName, int nLength, json jDefault) +{ + json jList = JsonArray(); + + int n; + for (n = 0; n < nLength; n++) + jList = JsonArrayInsert(jList, jDefault); + + _SetList(oTarget, sListType, sListName, jList); + return jList; +} + +// Sets the array length to nLength, adding/removing elements as required. +json _NormalizeList(object oTarget, string sListType, string sListName, int nLength, json jDefault) +{ + json jList = _GetList(oTarget, sListType, sListName); + if (jList == JsonArray()) + return _DeclareList(oTarget, sListType, sListName, nLength, jDefault); + else if (nLength < 0) + return jList; + else + { + int n, nList = JsonGetLength(jList); + if (nList > nLength) + jList = JsonArrayGetRange(jList, 0, nLength - 1); + else + { + for (n = 0; n < nLength - nList; n++) + jList = JsonArrayInsert(jList, jDefault); + } + + _SetList(oTarget, sListType, sListName, jList); + } + + return jList; +} + +// Returns the length of array sListName on oTarget. +int _CountList(object oTarget, string sListType, string sListName) +{ + return JsonGetLength(_GetList(oTarget, sListType, sListName)); +} + +// Sorts sListName on oTarget in order specified by nOrder. +void _SortList(object oTarget, string sListType, string sListName, int nOrder) +{ + json jList = _GetList(oTarget, sListType, sListName); + + if (JsonGetLength(jList) > 1) + _SetList(oTarget, sListType, sListName, JsonArrayTransform(jList, nOrder)); +} + +// ----------------------------------------------------------------------------- +// Public Functions +// ----------------------------------------------------------------------------- + +json VectorToJson(vector vPosition = [0.0, 0.0, 0.0]) +{ + json jPosition = JsonObject(); + jPosition = JsonObjectSet(jPosition, "x", JsonFloat(vPosition.x)); + jPosition = JsonObjectSet(jPosition, "y", JsonFloat(vPosition.y)); + return JsonObjectSet(jPosition, "z", JsonFloat(vPosition.z)); +} + +json JsonVector(vector vPosition = [0.0, 0.0, 0.0]) +{ + return VectorToJson(vPosition); +} + +vector JsonToVector(json jPosition) +{ + float x = JsonGetFloat(JsonObjectGet(jPosition, "x")); + float y = JsonGetFloat(JsonObjectGet(jPosition, "y")); + float z = JsonGetFloat(JsonObjectGet(jPosition, "z")); + + return Vector(x, y, z); +} + +vector JsonGetVector(json jPosition) +{ + return JsonToVector(jPosition); +} + +json LocationToJson(location lLocation) +{ + json jLocation = JsonObject(); + jLocation = JsonObjectSet(jLocation, "area", JsonString(ObjectToString(GetAreaFromLocation(lLocation)))); + jLocation = JsonObjectSet(jLocation, "position", VectorToJson(GetPositionFromLocation(lLocation))); + return JsonObjectSet(jLocation, "facing", JsonFloat(GetFacingFromLocation(lLocation))); +} + +json JsonLocation(location lLocation) +{ + return LocationToJson(lLocation); +} + +location JsonToLocation(json jLocation) +{ + object oArea = StringToObject(JsonGetString(JsonObjectGet(jLocation, "area"))); + vector vPosition = JsonToVector(JsonObjectGet(jLocation, "position")); + float fFacing = JsonGetFloat(JsonObjectGet(jLocation, "facing")); + + return Location(oArea, vPosition, fFacing); +} + +location JsonGetLocation(json jLocation) +{ + return JsonToLocation(jLocation); +} + +int AddListFloat(object oTarget, float fValue, string sListName = "", int bAddUnique = FALSE) +{ + return _InsertListElement(oTarget, VARLIST_TYPE_FLOAT, sListName, JsonFloat(fValue), -1, bAddUnique); +} + +int AddListInt(object oTarget, int nValue, string sListName = "", int bAddUnique = FALSE) +{ + return _InsertListElement(oTarget, VARLIST_TYPE_INT, sListName, JsonInt(nValue), -1, bAddUnique); +} + +int AddListLocation(object oTarget, location lValue, string sListName = "", int bAddUnique = FALSE) +{ + json jLocation = LocationToJson(lValue); + return _InsertListElement(oTarget, VARLIST_TYPE_LOCATION, sListName, jLocation, -1, bAddUnique); +} + +int AddListVector(object oTarget, vector vValue, string sListName = "", int bAddUnique = FALSE) +{ + json jVector = VectorToJson(vValue); + return _InsertListElement(oTarget, VARLIST_TYPE_VECTOR, sListName, jVector, -1, bAddUnique); +} + +int AddListObject(object oTarget, object oValue, string sListName = "", int bAddUnique = FALSE) +{ + json jObject = JsonString(ObjectToString(oValue)); + return _InsertListElement(oTarget, VARLIST_TYPE_OBJECT, sListName, jObject, -1, bAddUnique); +} + +int AddListString(object oTarget, string sString, string sListName = "", int bAddUnique = FALSE) +{ + return _InsertListElement(oTarget, VARLIST_TYPE_STRING, sListName, JsonString(sString), -1, bAddUnique); +} + +int AddListJson(object oTarget, json jValue, string sListName = "", int bAddUnique = FALSE) +{ + return _InsertListElement(oTarget, VARLIST_TYPE_JSON, sListName, jValue, -1, bAddUnique); +} + +float GetListFloat(object oTarget, int nIndex = 0, string sListName = "") +{ + json jValue = _GetListElement(oTarget, VARLIST_TYPE_FLOAT, sListName, nIndex); + return jValue == JsonNull() ? 0.0 : JsonGetFloat(jValue); +} + +int GetListInt(object oTarget, int nIndex = 0, string sListName = "") +{ + json jValue = _GetListElement(oTarget, VARLIST_TYPE_INT, sListName, nIndex); + return jValue == JsonNull() ? -1 : JsonGetInt(jValue); +} + +location GetListLocation(object oTarget, int nIndex = 0, string sListName = "") +{ + json jValue = _GetListElement(oTarget, VARLIST_TYPE_LOCATION, sListName, nIndex); + + if (jValue == JsonNull()) + return Location(OBJECT_INVALID, Vector(), 0.0); + else + return JsonToLocation(jValue); +} + +vector GetListVector(object oTarget, int nIndex = 0, string sListName = "") +{ + json jValue = _GetListElement(oTarget, VARLIST_TYPE_VECTOR, sListName, nIndex); + + if (jValue == JsonNull()) + return Vector(); + else + return JsonToVector(jValue); +} + +object GetListObject(object oTarget, int nIndex = 0, string sListName = "") +{ + json jValue = _GetListElement(oTarget, VARLIST_TYPE_OBJECT, sListName, nIndex); + return jValue == JsonNull() ? OBJECT_INVALID : StringToObject(JsonGetString(jValue)); +} + +string GetListString(object oTarget, int nIndex = 0, string sListName = "") +{ + json jValue = _GetListElement(oTarget, VARLIST_TYPE_STRING, sListName, nIndex); + return jValue == JsonNull() ? "" : JsonGetString(jValue); +} + +json GetListJson(object oTarget, int nIndex = 0, string sListName = "") +{ + return _GetListElement(oTarget, VARLIST_TYPE_JSON, sListName, nIndex); +} + +int DeleteListFloat(object oTarget, int nIndex, string sListName = "", int bMaintainOrder = FALSE) +{ + return _DeleteListElement(oTarget, VARLIST_TYPE_FLOAT, sListName, nIndex); +} + +int DeleteListInt(object oTarget, int nIndex, string sListName = "", int bMaintainOrder = FALSE) +{ + return _DeleteListElement(oTarget, VARLIST_TYPE_INT, sListName, nIndex); +} + +int DeleteListLocation(object oTarget, int nIndex, string sListName = "", int bMaintainOrder = FALSE) +{ + return _DeleteListElement(oTarget, VARLIST_TYPE_LOCATION, sListName, nIndex); +} + +int DeleteListVector(object oTarget, int nIndex, string sListName = "", int bMaintainOrder = FALSE) +{ + return _DeleteListElement(oTarget, VARLIST_TYPE_VECTOR, sListName, nIndex); +} + +int DeleteListObject(object oTarget, int nIndex, string sListName = "", int bMaintainOrder = FALSE) +{ + return _DeleteListElement(oTarget, VARLIST_TYPE_OBJECT, sListName, nIndex); +} + +int DeleteListString(object oTarget, int nIndex, string sListName = "", int bMaintainOrder = FALSE) +{ + return _DeleteListElement(oTarget, VARLIST_TYPE_STRING, sListName, nIndex); +} + +int DeleteListJson(object oTarget, int nIndex, string sListName = "", int bMaintainOrder = FALSE) +{ + return _DeleteListElement(oTarget, VARLIST_TYPE_JSON, sListName, nIndex); +} + +int RemoveListFloat(object oTarget, float fValue, string sListName = "", int bMaintainOrder = FALSE) +{ + return _RemoveListElement(oTarget, VARLIST_TYPE_FLOAT, sListName, JsonFloat(fValue)); +} + +int RemoveListInt(object oTarget, int nValue, string sListName = "", int bMaintainOrder = FALSE) +{ + return _RemoveListElement(oTarget, VARLIST_TYPE_INT, sListName, JsonInt(nValue)); +} + +int RemoveListLocation(object oTarget, location lValue, string sListName = "", int bMaintainOrder = FALSE) +{ + json jLocation = LocationToJson(lValue); + return _RemoveListElement(oTarget, VARLIST_TYPE_LOCATION, sListName, jLocation); +} + +int RemoveListVector(object oTarget, vector vValue, string sListName = "", int bMaintainOrder = FALSE) +{ + json jVector = VectorToJson(vValue); + return _RemoveListElement(oTarget, VARLIST_TYPE_VECTOR, sListName, jVector); +} + +int RemoveListObject(object oTarget, object oValue, string sListName = "", int bMaintainOrder = FALSE) +{ + json jObject = JsonString(ObjectToString(oValue)); + return _RemoveListElement(oTarget, VARLIST_TYPE_OBJECT, sListName, jObject); +} + +int RemoveListString(object oTarget, string sValue, string sListName = "", int bMaintainOrder = FALSE) +{ + return _RemoveListElement(oTarget, VARLIST_TYPE_STRING, sListName, JsonString(sValue)); +} + +int RemoveListJson(object oTarget, json jValue, string sListName = "", int bMaintainOrder = FALSE) +{ + return _RemoveListElement(oTarget, VARLIST_TYPE_JSON, sListName, jValue); +} + +int FindListFloat(object oTarget, float fValue, string sListName = "") +{ + return _FindListElement(oTarget, VARLIST_TYPE_FLOAT, sListName, JsonFloat(fValue)); +} + +int FindListInt(object oTarget, int nValue, string sListName = "") +{ + return _FindListElement(oTarget, VARLIST_TYPE_INT, sListName, JsonInt(nValue)); +} + +int FindListLocation(object oTarget, location lValue, string sListName = "") +{ + json jLocation = LocationToJson(lValue); + return _FindListElement(oTarget, VARLIST_TYPE_LOCATION, sListName, jLocation); +} + +int FindListVector(object oTarget, vector vValue, string sListName = "") +{ + json jVector = VectorToJson(vValue); + return _FindListElement(oTarget, VARLIST_TYPE_VECTOR, sListName, jVector); +} + +int FindListObject(object oTarget, object oValue, string sListName = "") +{ + json jObject = JsonString(ObjectToString(oValue)); + return _FindListElement(oTarget, VARLIST_TYPE_OBJECT, sListName, jObject); +} + +int FindListString(object oTarget, string sValue, string sListName = "") +{ + return _FindListElement(oTarget, VARLIST_TYPE_STRING, sListName, JsonString(sValue)); +} + +int FindListJson(object oTarget, json jValue, string sListName = "") +{ + return _FindListElement(oTarget, VARLIST_TYPE_JSON, sListName, jValue); +} + +int HasListFloat(object oTarget, float fValue, string sListName = "") +{ + return FindListFloat(oTarget, fValue, sListName) != -1; +} + +int HasListInt(object oTarget, int nValue, string sListName = "") +{ + return FindListInt(oTarget, nValue, sListName) != -1; +} + +int HasListLocation(object oTarget, location lValue, string sListName = "") +{ + return FindListLocation(oTarget, lValue, sListName) != -1; +} + +int HasListVector(object oTarget, vector vValue, string sListName = "") +{ + return FindListVector(oTarget, vValue, sListName) != -1; +} + +int HasListObject(object oTarget, object oValue, string sListName = "") +{ + return FindListObject(oTarget, oValue, sListName) != -1; +} + +int HasListString(object oTarget, string sValue, string sListName = "") +{ + return FindListString(oTarget, sValue, sListName) != -1; +} + +int HasListJson(object oTarget, json jValue, string sListName = "") +{ + return FindListJson(oTarget, jValue, sListName) != -1; +} + +int InsertListFloat(object oTarget, int nIndex, float fValue, string sListName = "", int bAddUnique = FALSE) +{ + return _InsertListElement(oTarget, VARLIST_TYPE_FLOAT, sListName, JsonFloat(fValue), nIndex, bAddUnique); +} + +int InsertListInt(object oTarget, int nIndex, int nValue, string sListName = "", int bAddUnique = FALSE) +{ + return _InsertListElement(oTarget, VARLIST_TYPE_INT, sListName, JsonInt(nValue), nIndex, bAddUnique); +} + +int InsertListLocation(object oTarget, int nIndex, location lValue, string sListName = "", int bAddUnique = FALSE) +{ + json jLocation = LocationToJson(lValue); + return _InsertListElement(oTarget, VARLIST_TYPE_LOCATION, sListName, jLocation, nIndex, bAddUnique); +} + +int InsertListVector(object oTarget, int nIndex, vector vValue, string sListName = "", int bAddUnique = FALSE) +{ + json jVector = VectorToJson(vValue); + return _InsertListElement(oTarget, VARLIST_TYPE_VECTOR, sListName, jVector, nIndex, bAddUnique); +} + +int InsertListObject(object oTarget, int nIndex, object oValue, string sListName = "", int bAddUnique = FALSE) +{ + json jObject = JsonString(ObjectToString(oValue)); + return _InsertListElement(oTarget, VARLIST_TYPE_OBJECT, sListName, jObject, nIndex, bAddUnique); +} + +int InsertListString(object oTarget, int nIndex, string sValue, string sListName = "", int bAddUnique = FALSE) +{ + return _InsertListElement(oTarget, VARLIST_TYPE_STRING, sListName, JsonString(sValue), nIndex, bAddUnique); +} + +int InsertListJson(object oTarget, int nIndex, json jValue, string sListName = "", int bAddUnique = FALSE) +{ + return _InsertListElement(oTarget, VARLIST_TYPE_JSON, sListName, jValue, nIndex, bAddUnique); +} + +void SetListFloat(object oTarget, int nIndex, float fValue, string sListName = "") +{ + _SetListElement(oTarget, VARLIST_TYPE_FLOAT, sListName, nIndex, JsonFloat(fValue)); +} + +void SetListInt(object oTarget, int nIndex, int nValue, string sListName = "") +{ + _SetListElement(oTarget, VARLIST_TYPE_INT, sListName, nIndex, JsonInt(nValue)); +} + +void SetListLocation(object oTarget, int nIndex, location lValue, string sListName = "") +{ + json jLocation = LocationToJson(lValue); + _SetListElement(oTarget, VARLIST_TYPE_LOCATION, sListName, nIndex, jLocation); +} + +void SetListVector(object oTarget, int nIndex, vector vValue, string sListName = "") +{ + json jVector = VectorToJson(vValue); + _SetListElement(oTarget, VARLIST_TYPE_VECTOR, sListName, nIndex, jVector); +} + +void SetListObject(object oTarget, int nIndex, object oValue, string sListName = "") +{ + json jObject = JsonString(ObjectToString(oValue)); + _SetListElement(oTarget, VARLIST_TYPE_OBJECT, sListName, nIndex, jObject); +} + +void SetListString(object oTarget, int nIndex, string sValue, string sListName = "") +{ + _SetListElement(oTarget, VARLIST_TYPE_STRING, sListName, nIndex, JsonString(sValue)); +} + +void SetListJson(object oTarget, int nIndex, json jValue, string sListName = "") +{ + _SetListElement(oTarget, VARLIST_TYPE_JSON, sListName, nIndex, jValue); +} + +int CopyListFloat(object oSource, object oTarget, string sSourceName, string sTargetName, int nIndex, int nRange = 1, int bAddUnique = FALSE) +{ + return _CopyListElements(oSource, oTarget, VARLIST_TYPE_FLOAT, sSourceName, sTargetName, nIndex, nRange, bAddUnique); +} + +int CopyListInt(object oSource, object oTarget, string sSourceName, string sTargetName, int nIndex, int nRange = 1, int bAddUnique = FALSE) +{ + return _CopyListElements(oSource, oTarget, VARLIST_TYPE_INT, sSourceName, sTargetName, nIndex, nRange, bAddUnique); +} + +int CopyListLocation(object oSource, object oTarget, string sSourceName, string sTargetName, int nIndex, int nRange = 1, int bAddUnique = FALSE) +{ + return _CopyListElements(oSource, oTarget, VARLIST_TYPE_LOCATION, sSourceName, sTargetName, nIndex, nRange, bAddUnique); +} + +int CopyListVector(object oSource, object oTarget, string sSourceName, string sTargetName, int nIndex, int nRange = 1, int bAddUnique = FALSE) +{ + return _CopyListElements(oSource, oTarget, VARLIST_TYPE_VECTOR, sSourceName, sTargetName, nIndex, nRange, bAddUnique); +} + +int CopyListObject(object oSource, object oTarget, string sSourceName, string sTargetName, int nIndex, int nRange = 1, int bAddUnique = FALSE) +{ + return _CopyListElements(oSource, oTarget, VARLIST_TYPE_OBJECT, sSourceName, sTargetName, nIndex, nRange, bAddUnique); +} + +int CopyListString(object oSource, object oTarget, string sSourceName, string sTargetName, int nIndex, int nRange = 1, int bAddUnique = FALSE) +{ + return _CopyListElements(oSource, oTarget, VARLIST_TYPE_STRING, sSourceName, sTargetName, nIndex, nRange, bAddUnique); +} + +int CopyListJson(object oSource, object oTarget, string sSourceName, string sTargetName, int nIndex, int nRange = 1, int bAddUnique = FALSE) +{ + return _CopyListElements(oSource, oTarget, VARLIST_TYPE_JSON, sSourceName, sTargetName, nIndex, nRange, bAddUnique); +} + +int IncrementListInt(object oTarget, int nIndex, int nIncrement = 1, string sListName = "") +{ + return _IncrementListElement(oTarget, sListName, nIndex, nIncrement); +} + +int DecrementListInt(object oTarget, int nIndex, int nDecrement = -1, string sListName = "") +{ + return _IncrementListElement(oTarget, sListName, nIndex, nDecrement); +} + +json GetFloatList(object oTarget, string sListName = "") +{ + return _GetList(oTarget, VARLIST_TYPE_FLOAT, sListName); +} + +json GetIntList(object oTarget, string sListName = "") +{ + return _GetList(oTarget, VARLIST_TYPE_INT, sListName); +} + +json GetLocationList(object oTarget, string sListName = "") +{ + return _GetList(oTarget, VARLIST_TYPE_LOCATION, sListName); +} + +json GetVectorList(object oTarget, string sListName = "") +{ + return _GetList(oTarget, VARLIST_TYPE_VECTOR, sListName); +} + +json GetObjectList(object oTarget, string sListName = "") +{ + return _GetList(oTarget, VARLIST_TYPE_OBJECT, sListName); +} + +json GetStringList(object oTarget, string sListName = "") +{ + return _GetList(oTarget, VARLIST_TYPE_STRING, sListName); +} + +json GetJsonList(object oTarget, string sListName = "") +{ + return _GetList(oTarget, VARLIST_TYPE_JSON, sListName); +} + +void SetFloatList(object oTarget, json jList, string sListName = "") +{ + _SetList(oTarget, VARLIST_TYPE_FLOAT, sListName, jList); +} + +void SetIntList(object oTarget, json jList, string sListName = "") +{ + _SetList(oTarget, VARLIST_TYPE_INT, sListName, jList); +} + +void SetLocationList(object oTarget, json jList, string sListName = "") +{ + _SetList(oTarget, VARLIST_TYPE_LOCATION, sListName, jList); +} + +void SetVectorList(object oTarget, json jList, string sListName = "") +{ + _SetList(oTarget, VARLIST_TYPE_VECTOR, sListName, jList); +} + +void SetObjectList(object oTarget, json jList, string sListName = "") +{ + _SetList(oTarget, VARLIST_TYPE_OBJECT, sListName, jList); +} + +void SetStringList(object oTarget, json jList, string sListName = "") +{ + _SetList(oTarget, VARLIST_TYPE_STRING, sListName, jList); +} + +void SetJsonList(object oTarget, json jList, string sListName = "") +{ + _SetList(oTarget, VARLIST_TYPE_JSON, sListName, jList); +} + +void DeleteFloatList(object oTarget, string sListName = "") +{ + _DeleteList(oTarget, VARLIST_TYPE_FLOAT, sListName); +} + +void DeleteIntList(object oTarget, string sListName = "") +{ + _DeleteList(oTarget, VARLIST_TYPE_INT, sListName); +} + +void DeleteLocationList(object oTarget, string sListName = "") +{ + _DeleteList(oTarget, VARLIST_TYPE_LOCATION, sListName); +} + +void DeleteVectorList(object oTarget, string sListName = "") +{ + _DeleteList(oTarget, VARLIST_TYPE_VECTOR, sListName); +} + +void DeleteObjectList(object oTarget, string sListName = "") +{ + _DeleteList(oTarget, VARLIST_TYPE_OBJECT, sListName); +} + +void DeleteStringList(object oTarget, string sListName = "") +{ + _DeleteList(oTarget, VARLIST_TYPE_STRING, sListName); +} + +void DeleteJsonList(object oTarget, string sListName = "") +{ + _DeleteList(oTarget, VARLIST_TYPE_JSON, sListName); +} + +json DeclareFloatList(object oTarget, int nCount, string sListName = "", float fDefault = 0.0) +{ + return _DeclareList(oTarget, VARLIST_TYPE_FLOAT, sListName, nCount, JsonFloat(fDefault)); +} + +json DeclareIntList(object oTarget, int nCount, string sListName = "", int nDefault = 0) +{ + return _DeclareList(oTarget, VARLIST_TYPE_INT, sListName, nCount, JsonInt(nDefault)); +} + +json DeclareLocationList(object oTarget, int nCount, string sListName = "") +{ + return _DeclareList(oTarget, VARLIST_TYPE_LOCATION, sListName, nCount, JsonNull()); +} + +json DeclareVectorList(object oTarget, int nCount, string sListName = "") +{ + return _DeclareList(oTarget, VARLIST_TYPE_VECTOR, sListName, nCount, JsonNull()); +} + +json DeclareObjectList(object oTarget, int nCount, string sListName = "") +{ + return _DeclareList(oTarget, VARLIST_TYPE_OBJECT, sListName, nCount, JsonNull()); +} + +json DeclareStringList(object oTarget, int nCount, string sListName = "", string sDefault = "") +{ + return _DeclareList(oTarget, VARLIST_TYPE_STRING, sListName, nCount, JsonString(sDefault)); +} + +json DeclareJsonList(object oTarget, int nCount, string sListName = "") +{ + return _DeclareList(oTarget, VARLIST_TYPE_JSON, sListName, nCount, JsonNull()); +} + +json NormalizeFloatList(object oTarget, int nCount, string sListName = "", float fDefault = 0.0) +{ + return _NormalizeList(oTarget, VARLIST_TYPE_FLOAT, sListName, nCount, JsonFloat(fDefault)); +} + +json NormalizeIntList(object oTarget, int nCount, string sListName = "", int nDefault = 0) +{ + return _NormalizeList(oTarget, VARLIST_TYPE_INT, sListName, nCount, JsonInt(nDefault)); +} + +json NormalizeLocationList(object oTarget, int nCount, string sListName = "") +{ + return _NormalizeList(oTarget, VARLIST_TYPE_LOCATION, sListName, nCount, JsonNull()); +} + +json NormalizeVectorList(object oTarget, int nCount, string sListName = "") +{ + return _NormalizeList(oTarget, VARLIST_TYPE_VECTOR, sListName, nCount, JsonNull()); +} + +json NormalizeObjectList(object oTarget, int nCount, string sListName = "") +{ + return _NormalizeList(oTarget, VARLIST_TYPE_OBJECT, sListName, nCount, JsonNull()); +} + +json NormalizeStringList(object oTarget, int nCount, string sListName = "", string sDefault = "") +{ + return _NormalizeList(oTarget, VARLIST_TYPE_STRING, sListName, nCount, JsonString(sDefault)); +} + +json NormalizeJsonList(object oTarget, int nCount, string sListName = "") +{ + return _NormalizeList(oTarget, VARLIST_TYPE_JSON, sListName, nCount, JsonNull()); +} + +void CopyFloatList(object oSource, object oTarget, string sSourceName, string sTargetName, int bAddUnique = FALSE) +{ + _CopyListElements(oSource, oTarget, VARLIST_TYPE_FLOAT, sSourceName, sTargetName, 0, -1, bAddUnique); +} + +void CopyIntList(object oSource, object oTarget, string sSourceName, string sTargetName, int bAddUnique = FALSE) +{ + _CopyListElements(oSource, oTarget, VARLIST_TYPE_INT, sSourceName, sTargetName, 0, -1, bAddUnique); +} + +void CopyLocationList(object oSource, object oTarget, string sSourceName, string sTargetName, int bAddUnique = FALSE) +{ + _CopyListElements(oSource, oTarget, VARLIST_TYPE_LOCATION, sSourceName, sTargetName, 0, -1, bAddUnique); +} + +void CopyVectorList(object oSource, object oTarget, string sSourceName, string sTargetName, int bAddUnique = FALSE) +{ + _CopyListElements(oSource, oTarget, VARLIST_TYPE_VECTOR, sSourceName, sTargetName, 0, -1, bAddUnique); +} + +void CopyObjectList(object oSource, object oTarget, string sSourceName, string sTargetName, int bAddUnique = FALSE) +{ + _CopyListElements(oSource, oTarget, VARLIST_TYPE_OBJECT, sSourceName, sTargetName, 0, -1, bAddUnique); +} + +void CopyStringList(object oSource, object oTarget, string sSourceName, string sTargetName, int bAddUnique = FALSE) +{ + _CopyListElements(oSource, oTarget, VARLIST_TYPE_STRING, sSourceName, sTargetName, 0, -1, bAddUnique); +} + +void CopyJsonList(object oSource, object oTarget, string sSourceName, string sTargetName, int bAddUnique = FALSE) +{ + _CopyListElements(oSource, oTarget, VARLIST_TYPE_JSON, sSourceName, sTargetName, 0, -1, bAddUnique); +} + +int CountFloatList(object oTarget, string sListName = "") +{ + return _CountList(oTarget, VARLIST_TYPE_FLOAT, sListName); +} + +int CountIntList(object oTarget, string sListName = "") +{ + return _CountList(oTarget, VARLIST_TYPE_INT, sListName); +} + +int CountLocationList(object oTarget, string sListName = "") +{ + return _CountList(oTarget, VARLIST_TYPE_LOCATION, sListName); +} + +int CountVectorList(object oTarget, string sListName = "") +{ + return _CountList(oTarget, VARLIST_TYPE_VECTOR, sListName); +} + +int CountObjectList(object oTarget, string sListName = "") +{ + return _CountList(oTarget, VARLIST_TYPE_OBJECT, sListName); +} + +int CountStringList(object oTarget, string sListName = "") +{ + return _CountList(oTarget, VARLIST_TYPE_STRING, sListName); +} + +int CountJsonList(object oTarget, string sListName = "") +{ + return _CountList(oTarget, VARLIST_TYPE_JSON, sListName); +} + +void SortFloatList(object oTarget, int nOrder = LIST_SORT_ASC, string sListName = "") +{ + _SortList(oTarget, VARLIST_TYPE_FLOAT, sListName, nOrder); +} + +void SortIntList(object oTarget, int nOrder = LIST_SORT_ASC, string sListName = "") +{ + _SortList(oTarget, VARLIST_TYPE_INT, sListName, nOrder); +} + +void SortStringList(object oTarget, int nOrder = LIST_SORT_ASC, string sListName = "") +{ + _SortList(oTarget, VARLIST_TYPE_STRING, sListName, nOrder); +} + +void ShuffleFloatList(object oTarget, string sListName = "") +{ + _SortList(oTarget, VARLIST_TYPE_FLOAT, sListName, JSON_ARRAY_SHUFFLE); +} + +void ShuffleIntList(object oTarget, string sListName = "") +{ + _SortList(oTarget, VARLIST_TYPE_INT, sListName, JSON_ARRAY_SHUFFLE); +} + +void ShuffleLocationList(object oTarget, string sListName = "") +{ + _SortList(oTarget, VARLIST_TYPE_LOCATION, sListName, JSON_ARRAY_SHUFFLE); +} + +void ShuffleVectorList(object oTarget, string sListName = "") +{ + _SortList(oTarget, VARLIST_TYPE_VECTOR, sListName, JSON_ARRAY_SHUFFLE); +} + +void ShuffleObjectList(object oTarget, string sListName = "") +{ + _SortList(oTarget, VARLIST_TYPE_OBJECT, sListName, JSON_ARRAY_SHUFFLE); +} + +void ShuffleStringList(object oTarget, string sListName = "") +{ + _SortList(oTarget, VARLIST_TYPE_STRING, sListName, JSON_ARRAY_SHUFFLE); +} + +void ShuffleJsonList(object oTarget, string sListName = "") +{ + _SortList(oTarget, VARLIST_TYPE_JSON, sListName, JSON_ARRAY_SHUFFLE); +} + +void ReverseFloatList(object oTarget, string sListName = "") +{ + _SortList(oTarget, VARLIST_TYPE_FLOAT, sListName, JSON_ARRAY_REVERSE); +} + +void ReverseIntList(object oTarget, string sListName = "") +{ + _SortList(oTarget, VARLIST_TYPE_INT, sListName, JSON_ARRAY_REVERSE); +} + +void ReverseLocationList(object oTarget, string sListName = "") +{ + _SortList(oTarget, VARLIST_TYPE_LOCATION, sListName, JSON_ARRAY_REVERSE); +} + +void ReverseVectorList(object oTarget, string sListName = "") +{ + _SortList(oTarget, VARLIST_TYPE_VECTOR, sListName, JSON_ARRAY_REVERSE); +} + +void ReverseObjectList(object oTarget, string sListName = "") +{ + _SortList(oTarget, VARLIST_TYPE_OBJECT, sListName, JSON_ARRAY_REVERSE); +} + +void ReverseStringList(object oTarget, string sListName = "") +{ + _SortList(oTarget, VARLIST_TYPE_STRING, sListName, JSON_ARRAY_REVERSE); +} + +void ReverseJsonList(object oTarget, string sListName = "") +{ + _SortList(oTarget, VARLIST_TYPE_JSON, sListName, JSON_ARRAY_REVERSE); +} diff --git a/_module/nss/x2_mod_def_load.nss b/_module/nss/x2_mod_def_load.nss index 4d0bca43..ad5fe65f 100644 --- a/_module/nss/x2_mod_def_load.nss +++ b/_module/nss/x2_mod_def_load.nss @@ -34,8 +34,10 @@ //:: Created On: 2003-07-16 //::////////////////////////////////////////////// +#include "nui_i_main" #include "x2_inc_switches" #include "x2_inc_restsys" + void main() { @@ -43,6 +45,8 @@ void main() SetEventScript(GetModule(), EVENT_SCRIPT_MODULE_ON_PLAYER_TARGET, "mod_target"); SetEventScript(GetModule(), EVENT_SCRIPT_MODULE_ON_PLAYER_GUIEVENT, "mod_gui"); + NUI(); + if (GetGameDifficulty() == GAME_DIFFICULTY_CORE_RULES || GetGameDifficulty() == GAME_DIFFICULTY_DIFFICULT) { // * Setting the switch below will enable a seperate Use Magic Device Skillcheck for diff --git a/_module/ra_tdog.mod b/_module/ra_tdog.mod index 7f2d7a02..76eaee6d 100644 Binary files a/_module/ra_tdog.mod and b/_module/ra_tdog.mod differ diff --git a/_module/utc/tarmephit001.utc.json b/_module/utc/tarmephit001.utc.json index c74985a8..7f8d3dc0 100644 --- a/_module/utc/tarmephit001.utc.json +++ b/_module/utc/tarmephit001.utc.json @@ -96,7 +96,7 @@ "__struct_id": 131072, "EquippedRes": { "type": "resref", - "value": "nw_it_creitem031" + "value": "hide_tarmephit01" } } ] @@ -129,6 +129,13 @@ "value": 40 } }, + { + "__struct_id": 1, + "Feat": { + "type": "word", + "value": 4793 + } + }, { "__struct_id": 1, "Feat": { @@ -673,6 +680,36 @@ "type": "int", "value": 1 } + }, + { + "__struct_id": 0, + "Name": { + "type": "cexostring", + "value": "NOBLIND" + }, + "Type": { + "type": "dword", + "value": 1 + }, + "Value": { + "type": "int", + "value": 1 + } + }, + { + "__struct_id": 0, + "Name": { + "type": "cexostring", + "value": "SPAWN_TYPE" + }, + "Type": { + "type": "dword", + "value": 3 + }, + "Value": { + "type": "cexostring", + "value": "no_spn_melcast1" + } } ] }, diff --git a/_module/uti/amuletofwaterbre.uti.json b/_module/uti/amuletofwaterbre.uti.json index 5935fcd0..c67ea8a0 100644 --- a/_module/uti/amuletofwaterbre.uti.json +++ b/_module/uti/amuletofwaterbre.uti.json @@ -2,7 +2,7 @@ "__data_type": "UTI ", "AddCost": { "type": "dword", - "value": 0 + "value": 499 }, "BaseItem": { "type": "int", @@ -18,7 +18,7 @@ }, "Cost": { "type": "dword", - "value": 1 + "value": 500 }, "Cursed": { "type": "byte", @@ -38,7 +38,7 @@ }, "Identified": { "type": "byte", - "value": 1 + "value": 0 }, "LocalizedName": { "type": "cexolocstring", @@ -60,7 +60,39 @@ }, "PropertiesList": { "type": "list", - "value": [] + "value": [ + { + "__struct_id": 0, + "ChanceAppear": { + "type": "byte", + "value": 100 + }, + "CostTable": { + "type": "byte", + "value": 0 + }, + "CostValue": { + "type": "word", + "value": 0 + }, + "Param1": { + "type": "byte", + "value": 255 + }, + "Param1Value": { + "type": "byte", + "value": 0 + }, + "PropertyName": { + "type": "word", + "value": 12 + }, + "Subtype": { + "type": "word", + "value": 575 + } + } + ] }, "StackSize": { "type": "word", @@ -77,5 +109,9 @@ "TemplateResRef": { "type": "resref", "value": "amuletofwaterbre" + }, + "xModelPart1": { + "type": "word", + "value": 68 } } diff --git a/_module/uti/hide_tarmephit01.uti.json b/_module/uti/hide_tarmephit01.uti.json new file mode 100644 index 00000000..36b8ceb0 --- /dev/null +++ b/_module/uti/hide_tarmephit01.uti.json @@ -0,0 +1,180 @@ +{ + "__data_type": "UTI ", + "AddCost": { + "type": "dword", + "value": 0 + }, + "BaseItem": { + "type": "int", + "value": 73 + }, + "Charges": { + "type": "byte", + "value": 0 + }, + "Comment": { + "type": "cexostring", + "value": "Tar Mephit Properties" + }, + "Cost": { + "type": "dword", + "value": 0 + }, + "Cursed": { + "type": "byte", + "value": 0 + }, + "DescIdentified": { + "type": "cexolocstring", + "value": { + "0": "Tar Mephit Properties" + } + }, + "Description": { + "type": "cexolocstring", + "value": { + "0": "Tar Mephit Properties" + } + }, + "Identified": { + "type": "byte", + "value": 0 + }, + "LocalizedName": { + "id": 13079, + "type": "cexolocstring", + "value": { + "0": "Tar Mephit Properties" + } + }, + "ModelPart1": { + "type": "byte", + "value": 1 + }, + "PaletteID": { + "type": "byte", + "value": 14 + }, + "Plot": { + "type": "byte", + "value": 0 + }, + "PropertiesList": { + "type": "list", + "value": [ + { + "__struct_id": 0, + "ChanceAppear": { + "type": "byte", + "value": 100 + }, + "CostTable": { + "type": "byte", + "value": 6 + }, + "CostValue": { + "type": "word", + "value": 1 + }, + "Param1": { + "type": "byte", + "value": 255 + }, + "Param1Value": { + "type": "byte", + "value": 255 + }, + "PropertyName": { + "type": "word", + "value": 22 + }, + "Subtype": { + "type": "word", + "value": 0 + } + }, + { + "__struct_id": 0, + "ChanceAppear": { + "type": "byte", + "value": 100 + }, + "CostTable": { + "type": "byte", + "value": 7 + }, + "CostValue": { + "type": "word", + "value": 2 + }, + "Param1": { + "type": "byte", + "value": 255 + }, + "Param1Value": { + "type": "byte", + "value": 0 + }, + "PropertyName": { + "type": "word", + "value": 23 + }, + "Subtype": { + "type": "word", + "value": 10 + } + }, + { + "__struct_id": 0, + "ChanceAppear": { + "type": "byte", + "value": 100 + }, + "CostTable": { + "type": "byte", + "value": 2 + }, + "CostValue": { + "type": "word", + "value": 2 + }, + "Param1": { + "type": "byte", + "value": 255 + }, + "Param1Value": { + "type": "byte", + "value": 255 + }, + "PropertyName": { + "type": "word", + "value": 51 + }, + "Subtype": { + "type": "word", + "value": 0 + } + } + ] + }, + "StackSize": { + "type": "word", + "value": 1 + }, + "Stolen": { + "type": "byte", + "value": 0 + }, + "Tag": { + "type": "cexostring", + "value": "HIDE_TARMEPHIT01" + }, + "TemplateResRef": { + "type": "resref", + "value": "hide_tarmephit01" + }, + "xModelPart1": { + "type": "word", + "value": 1 + } +} diff --git a/_module/uti/necklaceofadapta.uti.json b/_module/uti/necklaceofadapta.uti.json index 1e2c6969..5c67ad2b 100644 --- a/_module/uti/necklaceofadapta.uti.json +++ b/_module/uti/necklaceofadapta.uti.json @@ -18,7 +18,7 @@ }, "Cost": { "type": "dword", - "value": 40961 + "value": 41089 }, "Cursed": { "type": "byte", @@ -61,6 +61,37 @@ "PropertiesList": { "type": "list", "value": [ + { + "__struct_id": 0, + "ChanceAppear": { + "type": "byte", + "value": 100 + }, + "CostTable": { + "type": "byte", + "value": 0 + }, + "CostValue": { + "type": "word", + "value": 0 + }, + "Param1": { + "type": "byte", + "value": 255 + }, + "Param1Value": { + "type": "byte", + "value": 0 + }, + "PropertyName": { + "type": "word", + "value": 12 + }, + "Subtype": { + "type": "word", + "value": 574 + } + }, { "__struct_id": 0, "ChanceAppear": { @@ -135,7 +166,7 @@ }, "CostValue": { "type": "word", - "value": 158 + "value": 21 }, "Param1": { "type": "byte", @@ -166,7 +197,7 @@ }, "CostValue": { "type": "word", - "value": 21 + "value": 158 }, "Param1": { "type": "byte", @@ -202,5 +233,9 @@ "TemplateResRef": { "type": "resref", "value": "necklaceofadapta" + }, + "xModelPart1": { + "type": "word", + "value": 21 } } diff --git a/_module/uts/illithidelder001.uts.json b/_module/uts/illithidelder001.uts.json new file mode 100644 index 00000000..5a3be26e --- /dev/null +++ b/_module/uts/illithidelder001.uts.json @@ -0,0 +1,112 @@ +{ + "__data_type": "UTS ", + "Active": { + "type": "byte", + "value": 1 + }, + "Comment": { + "type": "cexostring", + "value": "" + }, + "Continuous": { + "type": "byte", + "value": 0 + }, + "Elevation": { + "type": "float", + "value": 1.5 + }, + "Hours": { + "type": "dword", + "value": 0 + }, + "Interval": { + "type": "dword", + "value": 0 + }, + "IntervalVrtn": { + "type": "dword", + "value": 0 + }, + "LocName": { + "id": 91313, + "type": "cexolocstring", + "value": {} + }, + "Looping": { + "type": "byte", + "value": 1 + }, + "MaxDistance": { + "type": "float", + "value": 10.0 + }, + "MinDistance": { + "type": "float", + "value": 1.0 + }, + "PaletteID": { + "type": "byte", + "value": 12 + }, + "PitchVariation": { + "type": "float", + "value": 0.0 + }, + "Positional": { + "type": "byte", + "value": 1 + }, + "Priority": { + "type": "byte", + "value": 3 + }, + "Random": { + "type": "byte", + "value": 0 + }, + "RandomPosition": { + "type": "byte", + "value": 0 + }, + "RandomRangeX": { + "type": "float", + "value": 0.0 + }, + "RandomRangeY": { + "type": "float", + "value": 0.0 + }, + "Sounds": { + "type": "list", + "value": [ + { + "__struct_id": 0, + "Sound": { + "type": "resref", + "value": "al_mg_x2eldbrain" + } + } + ] + }, + "Tag": { + "type": "cexostring", + "value": "IllithidElderBrain" + }, + "TemplateResRef": { + "type": "resref", + "value": "illithidelder001" + }, + "Times": { + "type": "byte", + "value": 3 + }, + "Volume": { + "type": "byte", + "value": 127 + }, + "VolumeVrtn": { + "type": "byte", + "value": 0 + } +}