Guest User

Untitled

a guest
Sep 23rd, 2021
124
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Greetings, Neverwinter Nights players and modders!
  2.  
  3. Today we’re releasing Patch 8193.32 for Neverwinter Nights: Enhanced Edition
  4. ! This update brings dozens of bug fixes and new features— including some exciting updates for content creators! Curated community content is also getting a new addition: A Hunt Through The Dark
  5. , by Markus Schlegel!
  6.  
  7. Patch Highlights
  8.  
  9. Renderer
  10. | Significant performance improvements & better shadows
  11. New Curated Content
  12. | Play as a drow in Markus Schlegel’s campaign, A Hunt Through The Dark
  13. Scriptable UI | Module authors can now create custom UI panels!
  14. Apple M1 support
  15. | Owners of Apple M1 devices now will have a much better experience playing NWN:EE!
  16. More than 100 fixes
  17. | Many other new features, script commands & fixes
  18.  
  19.  
  20.  
  21. Changes over build .31
  22.  
  23. This build is following the beta build from last week, and includes the following changes on top of it:
  24.  
  25. Renderer: Fixed SetTextureOverride() not working for custom content.
  26. Nui/Scriptable UI: Fixed combo() widget not decoding UTF8 correctly.
  27. ResMan: Fixed RESTYPE_JUI having the wrong ID, and added to nwscript.nss.
  28. nwscript.nss: Minor text/documentation updates.
  29.  
  30.  
  31.  
  32. Renderer Improvements
  33.  
  34. Many improvements have been made to the rendering and shadows engine:
  35.  
  36. Greatly reduced the amount of CPU time spent on rendering shadows (50-90% less) by moving more work to the shaders and just doing things more intelligently.
  37. Reduced buffer transfers related to rendering shadows (perf+)
  38. Fixed some common shadow rendering issues related to "behind" stencil tests. It does not fix every issue, however, and in rare cases, some issues may become more apparent - but all in all, the benefits should outweigh the drawbacks. The old approach can be restored with using "shadowfliporder 1" in the console.
  39. Shadow and beam volumes now use their own unique shaders.
  40. Fixed a number of other shadow rendering issues by doing view frustrum clipping in the vertex shaders. This (beyond improving performance) alleviates issues with shadows sometimes being cut off in odd places (and similar).
  41. The game now uses tiledata bounding box to determine lower clip of shadow volumes. This fixes shadows not being applied to geometry below the z position of the tile.
  42. The game now adjusts shadow alpha based on the vertical distance between the shadow plane used for drawing projections and the projection source. This gives a more correct shading.
  43. Removed the “experimental optimized shadow rendering” toggle. It is now always enabled.
  44. Added some minor refinements that help reduce the visual oddities caused by shadows being projected by erroneous models.
  45. Fixed dynamic shadow rendering performance dropping significantly on certain devices due to the new streaming setup.
  46. Added new debug outputs that help content artists to debug models from within the game. This includes rendering mesh bounding boxes, pivots (centers), emitter and light ranges, as well as shadow volumes. The options are accessible through the normal debug panel (ctrl+shift+f12).
  47. Optimized generation of shadow volumes to better fit the size of the shadow plane used for rendering shadows. Improves performance in GPU limited situations.
  48. Fixed an issue that made shadows fade out too quickly at low view angles.
  49. Fixed an issue with the scene manager that made geometry culling less effective.
  50. Made the game automatically downsize textures larger than the client GPU supports (instead of just failing to render).
  51. Optimized the size of the baked font textures to minimize texture memory footprint.
  52. Tweaked the subsurface light algorithm and made the normal debug outputs also apply for water.
  53. Removed some redundant GPU data buffer uploads.
  54. Fixed soft particles reading the screen depth at an offset position, resulting in occasional halos appearing around objects.
  55. Fixed automatic tile texture rotation (`rotatetexture 1`) causing normal and displacement maps to malfunction.
  56. Added a new console command ‘printvertexdata’. Prints an overview of the amount of memory currently used for vertex data (model geometry) to the client log.
  57. Fixed rendering unlit models with envmap (chargen colour picker shader issue; Halaster model issue).
  58. Fixed object view culling not respecting visual transforms, resulting in objects sometimes not appearing if transformed into view.
  59. Fixed some static parts being removed after having been auto-combined, resulting in erroneous shadows for some static geometry.
  60. Fixed skinmesh bone hierarchy to initial model layout. This solves certain issues caused by skinmeshed bodyparts being dynamically attached and removed.
  61. Fixed low quality render mode darkening water too much.
  62.  
  63.  
  64.  
  65. Curated Content: A Hunt Through The Dark
  66. by Markus Schlegel
  67.  
  68.  
  69.  
  70. Presenting the classic six-part campaign by Markus Schlegel - A Hunt Through The Dark!
  71.  
  72. Did you ever want to play the dark side, the bad, the evil, the worst of all, the drow?
  73. Take part in a hunting trip through the Underdark. It is on you to enslave goblins, betray comrades and spoil the plans of your leader Mistress Piwiewien – or not.
  74.  
  75.  
  76. Scriptable UI
  77.  
  78. Modules can now spawn custom UI panels, either defined in NWScript or JSON datafiles.
  79.  
  80. The layouting is done via a constraints solver and currently presents as a row/layout flow.
  81. Most native widget types available, including lower-level drawing primitives to create your own.
  82. Data binding is two-way between clients and the module, and allows synchronising sliders, input fields, buttons, and window geometry/properties. Mouse input events are supported as well.
  83. There is a new include file: nw_inc_nui.nss. There is also a demo script (nw_nui_demo.nss) that showcases some basic widget types. Finally, there is a more complex inspector example (nw_nui_insp.nss) that can show bind values for all open scripted windows.
  84. See the mentioned include file and demo for starting points. The new nwscript.nss API is reproduced at the end of this document.
  85.  
  86.  
  87.  
  88. NWScript JSON Datatype Support
  89.  
  90. NWScript now has a new native datatype, `json`. The API is documented at the end of these notes.
  91.  
  92. The engine can also serialise game objects to/from json, similar to how the sql data binder works. There is a new data format “.caf” for area objects that combines .are and .git, so you can de/serialise areas into a single json object. The serialisation format is compatible with neverwinter.nim.
  93.  
  94. There is a small helper library in nw_inc_gff.nss so you can construct GFF data on the fly (e.g. dynamic area/object creation and spawning).
  95.  
  96. The API also supports JSON Pointer, Diff, Patch and Merge. The SQLite API has been amended for both Campaign DB and custom databases.
  97.  
  98. Other Features
  99.  
  100. Added more GUI events, some suppressible, when the player interacts.
  101. Added device property queries to get player screen width height and scale.
  102. Added VM commands to query the game resource manager.
  103. PLT textures can now be phenotype-specific.
  104. Added a setting that allows players to control their non-PC party members in the same way as DMs do (drag, ctrl+click, etc). This is off by default, and can be enabled in server settings.
  105. Mac: Provided universal binary with a build for Apple M1. If you are on M1 and on Steam, you will have to launch the game directly, NOT via Steam, for the binary to run natively. Otherwise, it will run via Rosetta.
  106. Mac only: GOG Galaxy SDK no longer supported on x64 and arm64 (no native M1 build for the library).
  107. Mac only: Steam SDK/Workshop not supported on M1 (no native M1 build for the binary).
  108. Toolset: Added support for custom caster classes.
  109. Curated Content UI: Added support for promotion panels to show links to the Vault, Wikis, etc.
  110.  
  111.  
  112.  
  113. Smaller Changes
  114.  
  115. Script compiler now supports `\xFF` style escape sequences to put arbitrary bytes into a string literal. NB: \x00 will terminate the string, do not use.
  116. Cleaned up ovr/, moved everything except scripts into keybif.
  117. Debug UI: You can now use the RunScript/Chunk Debug UI in SP even when DebugMode is off (for testing convenience).
  118. VM: Store/RetrieveCampaignObject, SqlBindObject, SqlGetObject, ObjectToJson, and JsonToObject now support an additional parameter; bSave/LoadObjectState; which handles local variables, effects, action queue and transition info (for doors and triggers).
  119. Updated game credits for 2021, moved button out of OC Campaign to top level Movie menu.
  120.  
  121.  
  122.  
  123. Fixes
  124.  
  125. Game: Fixed savegames causing creatures in areas re-triggering the OnAreaEnter event. This was causing HotU chapter 3 to malfunction after saving and loading.
  126. Game: Fixed a rare crash when doors were melee-attacked by a null creature (PW-specific crash).
  127. Game: Fixed not storing fog clipping distance for areas when saving games.
  128. Game: Fixed a crash when showing a polymorphed creature on the party bar.
  129. Game: Fixed Steam Workshop modules not showing up if the .mod extension wasn’t all lowercase.
  130.  
  131. Toolset: Fixed inconsistencies with shadow rendering.
  132. Toolset: Fixed second story tile fade in “Always” mode not working correctly.
  133. Toolset: Areas are now considered modified when undo stack is changed
  134. Toolset: Undo now works for mouse wheel object scaling
  135. Toolset: Undo now works for Adjust Location dialog
  136. Toolset: Fixed a crash when right-clicking a tile with a recently-selected creature on it.
  137. Toolset: Fixed Replace All not working in backwards search mode.
  138.  
  139. VM: Fixed crash in CreateArea() due to heap-use-after-free
  140. VM: Fixed a crash when SetResourceOverride was targeting a missing/invalid resource.
  141. VM: Fixed a memleak every time CopyObject, CreateObject or CreateArea was called.
  142. VM: Area serialisation: Do not save item state twice to GFF (this would needlessly duplicate temporary effects and local vars into savegames and serialised objects).
  143.  
  144. Framelimiter: Opening up the radial menu is no longer considered background/modal.
  145.  
  146. Nui: Fixed nuklear receiving input meant for the console.
  147. Nui: Fixed nuklear eating mouse clicks that should go to the radial menu instead.
  148.  
  149.  
  150.  
  151. Tyrants of the Moonsea
  152.  
  153. Prevented use of the map inside the navigation cabin after traveling to a destination.
  154. Covered some poor camera rotations when transitioning out of the sea map.
  155. Removed an xp exploit in Ulblyn's conversation.
  156.  
  157.  
  158.  
  159. NWScript API Additions
  160.  
  161.  
  162. int GUIEVENT_COMPASS_CLICK = 15;
  163. int GUIEVENT_LEVELUP_CANCELLED = 16;
  164. int GUIEVENT_AREA_LOADSCREEN_FINISHED = 17;
  165. int GUIEVENT_QUICKCHAT_ACTIVATE = 18;
  166. int GUIEVENT_QUICKCHAT_SELECT = 19;
  167. int GUIEVENT_QUICKCHAT_CLOSE = 20;
  168. int GUIEVENT_SELECT_CREATURE = 21;
  169. int GUIEVENT_UNSELECT_CREATURE = 22;
  170. int GUIEVENT_EXAMINE_OBJECT = 23;
  171. int GUIEVENT_OPTIONS_OPEN = 24;
  172. int GUIEVENT_OPTIONS_CLOSE = 25;
  173.  
  174. int JSON_TYPE_NULL = 0; // Also invalid
  175. int JSON_TYPE_OBJECT = 1;
  176. int JSON_TYPE_ARRAY = 2;
  177. int JSON_TYPE_STRING = 3;
  178. int JSON_TYPE_INTEGER = 4;
  179. int JSON_TYPE_FLOAT = 5;
  180. int JSON_TYPE_BOOL = 6;
  181.  
  182. // The player's gui width (inner window bounds).
  183. string PLAYER_DEVICE_PROPERTY_GUI_WIDTH = "gui_width";
  184. // The player's gui height (inner window bounds).
  185. string PLAYER_DEVICE_PROPERTY_GUI_HEIGHT = "gui_height";
  186. // The player's gui scale, in percent (factor 1.4 = 140)
  187. string PLAYER_DEVICE_PROPERTY_GUI_SCALE = "gui_scale";
  188.  
  189. int PLAYER_LANGUAGE_INVALID = -1;
  190. int PLAYER_LANGUAGE_ENGLISH = 0;
  191. int PLAYER_LANGUAGE_FRENCH = 1;
  192. int PLAYER_LANGUAGE_GERMAN = 2;
  193. int PLAYER_LANGUAGE_ITALIAN = 3;
  194. int PLAYER_LANGUAGE_SPANISH = 4;
  195. int PLAYER_LANGUAGE_POLISH = 5;
  196.  
  197. int PLAYER_DEVICE_PLATFORM_INVALID = 0;
  198. int PLAYER_DEVICE_PLATFORM_WINDOWS_X86 = 1;
  199. int PLAYER_DEVICE_PLATFORM_WINDOWS_X64 = 2;
  200. int PLAYER_DEVICE_PLATFORM_LINUX_X86 = 10;
  201. int PLAYER_DEVICE_PLATFORM_LINUX_X64 = 11;
  202. int PLAYER_DEVICE_PLATFORM_LINUX_ARM32 = 12;
  203. int PLAYER_DEVICE_PLATFORM_LINUX_ARM64 = 13;
  204. int PLAYER_DEVICE_PLATFORM_MAC_X86 = 20;
  205. int PLAYER_DEVICE_PLATFORM_MAC_X64 = 21;
  206. int PLAYER_DEVICE_PLATFORM_IOS = 30;
  207. int PLAYER_DEVICE_PLATFORM_ANDROID_ARM32 = 40;
  208. int PLAYER_DEVICE_PLATFORM_ANDROID_ARM64 = 41;
  209. int PLAYER_DEVICE_PLATFORM_ANDROID_X64 = 42;
  210. int PLAYER_DEVICE_PLATFORM_NINTENDO_SWITCH = 50;
  211. int PLAYER_DEVICE_PLATFORM_MICROSOFT_XBOXONE = 60;
  212. int PLAYER_DEVICE_PLATFORM_SONY_PS4 = 70;
  213.  
  214. int RESTYPE_RES = 0;
  215. ...
  216. int RESTYPE_CAF = 2082;
  217.  
  218. // Parse the given string as a valid json value, and returns the corresponding type.
  219. // Returns a JSON_TYPE_NULL on error.
  220. // Check JsonGetError() to see the parse error, if any.
  221. // NB: The parsed string needs to be in game-local encoding, but the generated json structure
  222. // will contain UTF-8 data.
  223. json JsonParse(string sJson);
  224.  
  225. // Dump the given json value into a string that can be read back in via JsonParse.
  226. // nIndent describes the indentation level for pretty-printing; a value of -1 means no indentation and no linebreaks.
  227. // Returns a string describing JSON_TYPE_NULL on error.
  228. // NB: The dumped string is in game-local encoding, with all non-ascii characters escaped.
  229. string JsonDump(json jValue, int nIndent = -1);
  230.  
  231. // Describes the type of the given json value.
  232. // Returns JSON_TYPE_NULL if the value is empty.
  233. int JsonGetType(json jValue);
  234.  
  235. // Returns the length of the given json type.
  236. // For objects, returns the number of top-level keys present.
  237. // For arrays, returns the number of elements.
  238. // Null types are of size 0.
  239. // All other types return 1.
  240. int JsonGetLength(json jValue);
  241.  
  242. // Returns the error message if the value has errored out.
  243. // Currently only describes parse errors.
  244. string JsonGetError(json jValue);
  245.  
  246. // Create a NULL json value, seeded with a optional error message for JsonGetError().
  247. json JsonNull(string sError = "");
  248.  
  249. // Create a empty json object.
  250. json JsonObject();
  251.  
  252. // Create a empty json array.
  253. json JsonArray();
  254.  
  255. // Create a json string value.
  256. // NB: Strings are encoded to UTF-8 from the game-local charset.
  257. json JsonString(string sValue);
  258.  
  259. // Create a json integer value.
  260. json JsonInt(int nValue);
  261.  
  262. // Create a json floating point value.
  263. json JsonFloat(float fValue);
  264.  
  265. // Create a json bool valye.
  266. json JsonBool(int bValue);
  267.  
  268. // Returns a string representation of the json value.
  269. // Returns "" if the value cannot be represented as a string, or is empty.
  270. // NB: Strings are decoded from UTF-8 to the game-local charset.
  271. string JsonGetString(json jValue);
  272.  
  273. // Returns a int representation of the json value, casting where possible.
  274. // Returns 0 if the value cannot be represented as a float.
  275. // Use this to parse json bool types.
  276. // NB: This will narrow down to signed 32 bit, as that is what NWScript int is.
  277. // If you are trying to read a 64 bit or unsigned integer, you will lose data.
  278. // You will not lose data if you keep the value as a json element (via Object/ArrayGet).
  279. int JsonGetInt(json jValue);
  280.  
  281. // Returns a float representation of the json value, casting where possible.
  282. // Returns 0.0 if the value cannot be represented as a float.
  283. // NB: This will narrow doubles down to float.
  284. // If you are trying to read a double, you will lose data.
  285. // You will not lose data if you keep the value as a json element (via Object/ArrayGet).
  286. float JsonGetFloat(json jValue);
  287.  
  288. // Returns a json array containing all keys of jObject.
  289. // Returns a empty array if the object is empty or not a json object, with GetJsonError() filled in.
  290. json JsonObjectKeys(json jObject);
  291.  
  292. // Returns the key value of sKey on the object jObect.
  293. // Returns a null json value if jObject is not a object or sKey does not exist on the object, with GetJsonError() filled in.
  294. json JsonObjectGet(json jObject, string sKey);
  295.  
  296. // Returns a modified copy of jObject with the key at sKey set to jValue.
  297. // Returns a json null value if jObject is not a object, with GetJsonError() filled in.
  298. json JsonObjectSet(json jObject, string sKey, json jValue);
  299.  
  300. // Returns a modified copy of jObject with the key at sKey deleted.
  301. // Returns a json null value if jObject is not a object, with GetJsonError() filled in.
  302. json JsonObjectDel(json jObject, string sKey);
  303.  
  304. // Gets the json object at jArray index position nIndex.
  305. // Returns a json null value if the index is out of bounds, with GetJsonError() filled in.
  306. json JsonArrayGet(json jArray, int nIndex);
  307.  
  308. // Returns a modified copy of jArray with position nIndex set to jValue.
  309. // Returns a json null value if jArray is not actually an array, with GetJsonError() filled in.
  310. // Returns a json null value if nIndex is out of bounds, with GetJsonError() filled in.
  311. json JsonArraySet(json jArray, int nIndex, json jValue);
  312.  
  313. // Returns a modified copy of jArray with jValue inserted at position nIndex.
  314. // All succeeding objects in the array will move by one.
  315. // By default (-1), inserts objects at the end of the array ("push").
  316. // nIndex = 0 inserts at the beginning of the array.
  317. // Returns a json null value if jArray is not actually an array, with GetJsonError() filled in.
  318. // Returns a json null value if nIndex is not 0 or -1 and out of bounds, with GetJsonError() filled in.
  319. json JsonArrayInsert(json jArray, json jValue, int nIndex = -1);
  320.  
  321. // Returns a modified copy of jArray with the element at position nIndex removed,
  322. // and the array resized by one.
  323. // Returns a json null value if jArray is not actually an array, with GetJsonError() filled in.
  324. // Returns a json null value if nIndex is out of bounds, with GetJsonError() filled in.
  325. json JsonArrayDel(json jArray, int nIndex);
  326.  
  327. // Transforms the given object into a json structure.
  328. // The json format is compatible with what https://github.com/niv/neverwinter.nim@1.4.3+ emits.
  329. // Returns the null json type on errors, or if oObject is not serializable, with GetJsonError() filled in.
  330. // Supported object types: creature, item, trigger, placeable, door, waypoint, encounter, store, area (combined format)
  331. // If bSaveObjectState is TRUE, local vars, effects, action queue, and transition info (triggers, doors) are saved out
  332. // (except for Combined Area Format, which always has object state saved out).
  333. json ObjectToJson(object oObject, int bSaveObjectState = FALSE);
  334.  
  335. // Deserializes the game object described in jObject.
  336. // Returns OBJECT_INVALID on errors.
  337. // Supported object types: creature, item, trigger, placeable, door, waypoint, encounter, store, area (combined format)
  338. // For areas, locLocation is ignored.
  339. // If bLoadObjectState is TRUE, local vars, effects, action queue, and transition info (triggers, doors) are read in.
  340. object JsonToObject(json jObject, location locLocation, object oOwner = OBJECT_INVALID, int bLoadObjectState = FALSE);
  341.  
  342. // Returns the element at the given JSON pointer value.
  343. // See https://datatracker.ietf.org/doc/html/rfc6901 for details.
  344. // Returns a json null value on error, with GetJsonError() filled in.
  345. json JsonPointer(json jData, string sPointer);
  346.  
  347. // Return a modified copy of jData with jValue inserted at the path described by sPointer.
  348. // See https://datatracker.ietf.org/doc/html/rfc6901 for details.
  349. // Returns a json null value on error, with GetJsonError() filled in.
  350. // jPatch is an array of patch elements, each containing a op, a path, and a value field. Example:
  351. // [
  352. // { "op": "replace", "path": "/baz", "value": "boo" },
  353. // { "op": "add", "path": "/hello", "value": ["world"] },
  354. // { "op": "remove", "path": "/foo"}
  355. // ]
  356. // Valid operations are: add, remove, replace, move, copy, test
  357. json JsonPatch(json jData, json jPatch);
  358.  
  359. // Returns the diff (described as a json structure you can pass into JsonPatch) between the two objects.
  360. // Returns a json null value on error, with GetJsonError() filled in.
  361. json JsonDiff(json jLHS, json jRHS);
  362.  
  363. // Returns a modified copy of jData with jMerge merged into it. This is an alternative to
  364. // JsonPatch/JsonDiff, with a syntax more closely resembling the final object.
  365. // See https://datatracker.ietf.org/doc/html/rfc7386 for details.
  366. // Returns a json null value on error, with GetJsonError() filled in.
  367. json JsonMerge(json jData, json jMerge);
  368.  
  369. // Get oObject's local json variable sVarName
  370. // * Return value on error: json null type
  371. json GetLocalJson(object oObject, string sVarName);
  372.  
  373. // Set oObject's local json variable sVarName to jValue
  374. void SetLocalJson(object oObject, string sVarName, json jValue);
  375.  
  376. // Delete oObject's local json variable sVarName
  377. void DeleteLocalJson(object oObject, string sVarName);
  378.  
  379. // Bind an json to a named parameter of the given prepared query.
  380. // Json values are serialised into a string.
  381. // Example:
  382. // sqlquery v = SqlPrepareQueryObject(GetModule(), "insert into test (col) values (@myjson);");
  383. // SqlBindJson(v, "@myjson", myJsonObject);
  384. // SqlStep(v);
  385. void SqlBindJson(sqlquery sqlQuery, string sParam, json jValue);
  386.  
  387. // Retrieve a column cast as a json value of the currently stepped row.
  388. // You can call this after SqlStep() returned TRUE.
  389. // In case of error, a json null value will be returned.
  390. // In traditional fashion, nIndex starts at 0.
  391. json SqlGetJson(sqlquery sqlQuery, int nIndex);
  392.  
  393. // This stores a json out to the specified campaign database
  394. // The database name:
  395. // - is case insensitive and it must be the same for both set and get functions.
  396. // - can only contain alphanumeric characters, no spaces.
  397. // The var name must be unique across the entire database, regardless of the variable type.
  398. // If you want a variable to pertain to a specific player in the game, provide a player object.
  399. void SetCampaignJson(string sCampaignName, string sVarName, json jValue, object oPlayer=OBJECT_INVALID);
  400.  
  401. // This will read a json from the specified campaign database
  402. // The database name:
  403. // - is case insensitive and it must be the same for both set and get functions.
  404. // - can only contain alphanumeric characters, no spaces.
  405. // The var name must be unique across the entire database, regardless of the variable type.
  406. // If you want a variable to pertain to a specific player in the game, provide a player object.
  407. json GetCampaignJson(string sCampaignName, string sVarName, object oPlayer=OBJECT_INVALID);
  408.  
  409. // Gets a device property/capability as advertised by the client.
  410. // sProperty is one of PLAYER_DEVICE_PROPERTY_xxx.
  411. // Returns -1 if
  412. // - the property was never set by the client,
  413. // - the the actual value is -1,
  414. // - the player is running a older build that does not advertise device properties,
  415. // - the player has disabled sending device properties (Options->Game->Privacy).
  416. int GetPlayerDeviceProperty(object oPlayer, string sProperty);
  417.  
  418. // Returns the LANGUAGE_xx code of the given player, or -1 if unavailable.
  419. int GetPlayerLanguage(object oPlayer);
  420.  
  421. // Returns one of PLAYER_DEVICE_PLATFORM_xxx, or 0 if unavailable.
  422. int GetPlayerDevicePlatform(object oPlayer);
  423.  
  424. // Deserializes the given resref/template into a JSON structure.
  425. // Supported GFF resource types:
  426. // * RESTYPE_CAF (and RESTYPE_ARE, RESTYPE_GIT, RESTYPE_GIC)
  427. // * RESTYPE_UTC
  428. // * RESTYPE_UTI
  429. // * RESTYPE_UTT
  430. // * RESTYPE_UTP
  431. // * RESTYPE_UTD
  432. // * RESTYPE_UTW
  433. // * RESTYPE_UTE
  434. // * RESTYPE_UTM
  435. // Returns a valid gff-type json structure, or a null value with GetJsonError() set.
  436. json TemplateToJson(string sResRef, int nResType);
  437.  
  438. // Returns the resource location of sResRef.nResType, as seen by the running module.
  439. // Note for dedicated servers: Checks on the module/server side, not the client.
  440. // Returns "" if the resource does not exist in the search space.
  441. string ResManGetAliasFor(string sResRef, int nResType);
  442.  
  443. // Finds the nNth available resref starting with sPrefix.
  444. // * Set bSearchBaseData to TRUE to also search base game content stored in your game installation directory.
  445. // WARNING: This can be very slow.
  446. // * Set sOnlyKeyTable to a specific keytable to only search the given named keytable (e.g. "OVERRIDE:").
  447. // Returns "" if no such resref exists.
  448. string ResManFindPrefix(string sPrefix, int nResType, int nNth = 1, int bSearchBaseData = FALSE, string sOnlyKeyTable = "");
  449.  
  450. // Create a NUI window from the given resref(.jui) for the given player.
  451. // * The resref needs to be available on the client, not the server.
  452. // * The token is a integer for ease of handling only. You are not supposed to do anything with it, except store/pass it.
  453. // * The window ID needs to be alphanumeric and short. Only one window (per client) with the same ID can exist at a time.
  454. // Re-creating a window with the same id of one already open will immediately close the old one.
  455. // * See nw_inc_nui.nss for full documentation.
  456. // Returns the window token on success (>0), or 0 on error.
  457. int NuiCreateFromResRef(object oPlayer, string sResRef, string sWindowId = "");
  458.  
  459. // Create a NUI window inline for the given player.
  460. // * The token is a integer for ease of handling only. You are not supposed to do anything with it, except store/pass it.
  461. // * The window ID needs to be alphanumeric and short. Only one window (per client) with the same ID can exist at a time.
  462. // Re-creating a window with the same id of one already open will immediately close the old one.
  463. // * See nw_inc_nui.nss for full documentation.
  464. // Returns the window token on success (>0), or 0 on error.
  465. int NuiCreate(object oPlayer, json jNui, string sWindowId = "");
  466.  
  467. // You can look up windows by ID, if you gave them one.
  468. // * Windows with a ID present are singletons - attempting to open a second one with the same ID
  469. // will fail, even if the json definition is different.
  470. // Returns the token if found, or 0.
  471. int NuiFindWindow(object oPlayer, string sId);
  472.  
  473. // Destroys the given window, by token, immediately closing it on the client.
  474. // Does nothing if nUiToken does not exist on the client.
  475. // Does not send a close event - this immediately destroys all serverside state.
  476. // The client will close the window asynchronously.
  477. void NuiDestroy(object oPlayer, int nUiToken);
  478.  
  479. // Returns the originating player of the current event.
  480. object NuiGetEventPlayer();
  481.  
  482. // Gets the window token of the current event (or 0 if not in a event).
  483. int NuiGetEventWindow();
  484.  
  485. // Returns the event type of the current event.
  486. // * See nw_inc_nui.nss for full documentation of all events.
  487. string NuiGetEventType();
  488.  
  489. // Returns the ID of the widget that triggered the event.
  490. string NuiGetEventElement();
  491.  
  492. // Get the array index of the current event.
  493. // This can be used to get the index into an array, for example when rendering lists of buttons.
  494. // Returns -1 if the event is not originating from within an array.
  495. int NuiGetEventArrayIndex();
  496.  
  497. // Returns the window ID of the window described by nUiToken.
  498. // Returns "" on error, or if the window has no ID.
  499. string NuiGetWindowId(object oPlayer, int nUiToken);
  500.  
  501. // Gets the json value for the given player, token and bind.
  502. // * json values can hold all kinds of values; but NUI widgets require specific bind types.
  503. // It is up to you to either handle this in NWScript, or just set compatible bind types.
  504. // No auto-conversion happens.
  505. // Returns a json null value if the bind does not exist.
  506. json NuiGetBind(object oPlayer, int nUiToken, string sBindName);
  507.  
  508. // Sets a json value for the given player, token and bind.
  509. // The value is synced down to the client and can be used in UI binding.
  510. // When the UI changes the value, it is returned to the server and can be retrieved via NuiGetBind().
  511. // * json values can hold all kinds of values; but NUI widgets require specific bind types.
  512. // It is up to you to either handle this in NWScript, or just set compatible bind types.
  513. // No auto-conversion happens.
  514. // * If the bind is on the watch list, this will immediately invoke the event handler with the "watch"
  515. // even type; even before this function returns. Do not update watched binds from within the watch handler
  516. // unless you enjoy stack overflows.
  517. // Does nothing if the given player+token is invalid.
  518. void NuiSetBind(object oPlayer, int nUiToken, string sBindName, json jValue);
  519.  
  520. // Swaps out the given element (by id) with the given nui layout (partial).
  521. // * This currently only works with the "group" element type, and the special "_window_" root group.
  522. void NuiSetGroupLayout(object oPlayer, int nUiToken, string sElement, json jNui);
  523.  
  524. // Mark the given bind name as watched.
  525. // A watched bind will invoke the NUI script event every time it's value changes.
  526. // Be careful with binding nui data inside a watch event handler: It's easy to accidentally recurse yourself into a stack overflow.
  527. int NuiSetBindWatch(object oPlayer, int nUiToken, string sBind, int bWatch);
  528.  
  529. // Returns the nNth window token of the player, or 0.
  530. // nNth starts at 0.
  531. // Iterator is not write-safe: Calling DestroyWindow() will invalidate move following offsets by one.
  532. int NuiGetNthWindow(object oPlayer, int nNth = 0);
  533.  
  534. // Return the nNth bind name of the given window, or "".
  535. // If bWatched is TRUE, iterates only watched binds.
  536. // If FALSE, iterates all known binds on the window (either set locally or in UI).
  537. string NuiGetNthBind(object oPlayer, int nToken, int bWatched, int nNth = 0);
  538.  
  539. // Returns the event payload, specific to the event.
  540. // Returns JsonNull if event has no payload.
  541. json NuiGetEventPayload();
  542.  
  543. // Get the userdata of the given window token.
  544. // Returns JsonNull if the window does not exist on the given player, or has no userdata set.
  545. json NuiGetUserData(object oPlayer, int nToken);
  546.  
  547. // Sets an arbitrary json value as userdata on the given window token.
  548. // This userdata is not read or handled by the game engine and not sent to clients.
  549. // This mechanism only exists as a convenience for the programmer to store data bound to a windows' lifecycle.
  550. // Will do nothing if the window does not exist.
  551. void NuiSetUserData(object oPlayer, int nToken, json jUserData);
  552. 197
  553. Оценить
  554. 34
  555. Обсудить
  556. Поделиться
  557. Обычное обновление
  558. Опубликовано
  559. чт, 16 сентября
  560. Development Build 85.8193.31
  561. Hello friends!
  562.  
  563. How have you been doing? The Beamdog team has been hard at work on the next Neverwinter Nights: Enhanced Edition patch! Today, we are shipping release 8193.31 to the development branch of NWN:EE.
  564.  
  565. This is a huge beta patch, with many new and exciting features. We appreciate your assistance in helping us test them, and reporting any/all issues you find.
  566.  
  567. Highlights
  568.  
  569. Significant renderer performance improvements & better shadows.
  570. New Curated Content: A Hunt Through The Dark, by Markus Schlegel.
  571. Scriptable UI.
  572. Apple M1.
  573. Many other new features, script commands & fixes.
  574.  
  575.  
  576.  
  577. Renderer Improvements
  578.  
  579. Many improvements have been made to the rendering and shadows engine:
  580.  
  581. Greatly reduced the amount of CPU time spent on rendering shadows (50-90% less) by moving more work to the shaders and just doing things more intelligently.
  582. Reduced buffer transfers related to rendering shadows (perf+)
  583. Fixed some common shadow rendering issues related to "behind" stencil tests. It does not fix every issue, however, and in rare cases, some issues may become more apparent - but all in all, the benefits should outweigh the drawbacks. The old approach can be restored with using "shadowfliporder 1" in the console.
  584. Shadow and beam volumes now use their own unique shaders.
  585. Fixed a number of other shadow rendering issues by doing view frustrum clipping in the vertex shaders. This (beyond improving performance) alleviates issues with shadows sometimes being cut off in odd places (and similar).
  586. The game now uses tiledata bounding box to determine lower clip of shadow volumes. This fixes shadows not being applied to geometry below the z position of the tile.
  587. The game now adjusts shadow alpha based on the vertical distance between the shadow plane used for drawing projections and the projection source. This gives a more correct shading.
  588. Removed the “experimental optimized shadow rendering” toggle. It is now always enabled.
  589. Added some minor refinements that help reduce the visual oddities caused by shadows being projected by erroneous models.
  590. Fixed dynamic shadow rendering performance dropping significantly on certain devices due to the new streaming setup.
  591. Added new debug outputs that help content artists to debug models from within the game. This includes rendering mesh bounding boxes, pivots (centers), emitter and light ranges, as well as shadow volumes. The options are accessible through the normal debug panel (ctrl+shift+f12).
  592. Optimized generation of shadow volumes to better fit the size of the shadow plane used for rendering shadows. Improves performance in GPU limited situations.
  593. Fixed an issue that made shadows fade out too quickly at low view angles.
  594. Fixed an issue with the scene manager that made geometry culling less effective.
  595. Made the game automatically downsize textures larger than the client GPU supports (instead of just failing to render).
  596. Optimized the size of the baked font textures to minimize texture memory footprint.
  597. Tweaked the subsurface light algorithm and made the normal debug outputs also apply for water.
  598. Removed some redundant GPU data buffer uploads.
  599. Fixed soft particles reading the screen depth at an offset position, resulting in occasional halos appearing around objects.
  600. Fixed automatic tile texture rotation (`rotatetexture 1`) causing normal and displacement maps to malfunction.
  601. Added a new console command ‘printvertexdata’. Prints an overview of the amount of memory currently used for vertex data (model geometry) to the client log.
  602. Fixed rendering unlit models with envmap (chargen colour picker shader issue; Halaster model issue).
  603. Fixed object view culling not respecting visual transforms, resulting in objects sometimes not appearing if transformed into view.
  604. Fixed some static parts being removed after having been auto-combined, resulting in erroneous shadows for some static geometry.
  605. Fixed skinmesh bone hierarchy to initial model layout. This solves certain issues caused by skinmeshed bodyparts being dynamically attached and removed.
  606. Fixed low quality render mode darkening water too much.
  607.  
  608.  
  609.  
  610.  
  611.  
  612. Curated Content: A Hunt Through The Dark
  613. by Markus Schlegel
  614.  
  615.  
  616.  
  617. Presenting the classic six-part campaign by Markus Schlegel - A Hunt Through The Dark!
  618.  
  619. Did you ever want to play the dark side, the bad, the evil, the worst of all, the drow?
  620. Take part in a hunting trip through the Underdark. It is on you to enslave goblins, betray comrades and spoil the plans of your leader Mistress Piwiewien – or not.
  621.  
  622.  
  623. Scriptable UI
  624.  
  625. Modules can now spawn custom UI panels, either defined in NWScript or JSON datafiles.
  626.  
  627. The layouting is done via a constraints solver and currently presents as a row/layout flow.
  628. Most native widget types available, including lower-level drawing primitives to create your own.
  629. Data binding is two-way between clients and the module, and allows synchronising sliders, input fields, buttons, and window geometry/properties. Mouse input events are supported as well.
  630. There is a new include file: nw_inc_nui.nss. There is also a demo script (nw_nui_demo.nss) that showcases some basic widget types. Finally, there is a more complex inspector example (nw_nui_insp.nss) that can show bind values for all open scripted windows.
  631. See the mentioned include file and demo for starting points. The new nwscript.nss API is reproduced at the end of this document.
  632.  
  633.  
  634.  
  635. NWScript JSON Datatype Support
  636.  
  637. NWScript now has a new native datatype, `json`. The API is documented at the end of these notes.
  638.  
  639. The engine can also serialise game objects to/from json, similar to how the sql data binder works. There is a new data format “.caf” for area objects that combines .are and .git, so you can de/serialise areas into a single json object. The serialisation format is compatible with neverwinter.nim.
  640.  
  641. There is a small helper library in nw_inc_gff.nss so you can construct GFF data on the fly (e.g. dynamic area/object creation and spawning).
  642.  
  643. The API also supports JSON Pointer, Diff, Patch and Merge. The SQLite API has been amended for both Campaign DB and custom databases.
  644.  
  645. Other Features
  646.  
  647. Added more GUI events, some suppressible, when the player interacts.
  648. Added device property queries to get player screen width height and scale.
  649. Added VM commands to query the game resource manager.
  650. PLT textures can now be phenotype-specific.
  651. Added a setting that allows players to control their non-PC party members in the same way as DMs do (drag, ctrl+click, etc). This is off by default, and can be enabled in server settings.
  652. Mac: Provided universal binary with a build for Apple M1. If you are on M1 and on Steam, you will have to launch the game directly, NOT via Steam, for the binary to run natively. Otherwise, it will run via Rosetta.
  653. Mac only: GOG Galaxy SDK no longer supported on x64 and arm64 (no native M1 build for the library).
  654. Mac only: Steam SDK/Workshop not supported on M1 (no native M1 build for the binary).
  655. Toolset: Added support for custom caster classes.
  656. Curated Content UI: Added support for promotion panels to show links to the Vault, Wikis, etc.
  657.  
  658.  
  659.  
  660. Smaller Changes
  661.  
  662. Script compiler now supports `\xFF` style escape sequences to put arbitrary bytes into a string literal. NB: \x00 will terminate the string, do not use.
  663. Cleaned up ovr/, moved everything except scripts into keybif.
  664. Debug UI: You can now use the RunScript/Chunk Debug UI in SP even when DebugMode is off (for testing convenience).
  665. VM: Store/RetrieveCampaignObject, SqlBindObject, SqlGetObject, ObjectToJson, and JsonToObject now support an additional parameter; bSave/LoadObjectState; which handles local variables, effects, action queue and transition info (for doors and triggers).
  666. Updated game credits for 2021, moved button out of OC Campaign to top level Movie menu.
  667.  
  668.  
  669.  
  670. Fixes
  671.  
  672. Game: Fixed savegames causing creatures in areas re-triggering the OnAreaEnter event. This was causing HotU chapter 3 to malfunction after saving and loading.
  673. Game: Fixed a rare crash when doors were melee-attacked by a null creature (PW-specific crash).
  674. Game: Fixed not storing fog clipping distance for areas when saving games.
  675. Game: Fixed a crash when showing a polymorphed creature on the party bar.
  676. Game: Fixed Steam Workshop modules not showing up if the .mod extension wasn’t all lowercase.
  677.  
  678. Toolset: Fixed inconsistencies with shadow rendering.
  679. Toolset: Fixed second story tile fade in “Always” mode not working correctly.
  680. Toolset: Areas are now considered modified when undo stack is changed
  681. Toolset: Undo now works for mouse wheel object scaling
  682. Toolset: Undo now works for Adjust Location dialog
  683. Toolset: Fixed a crash when right-clicking a tile with a recently-selected creature on it.
  684. Toolset: Fixed Replace All not working in backwards search mode.
  685.  
  686. VM: Fixed crash in CreateArea() due to heap-use-after-free
  687. VM: Fixed a crash when SetResourceOverride was targeting a missing/invalid resource.
  688. VM: Fixed a memleak every time CopyObject, CreateObject or CreateArea was called.
  689. VM: Area serialisation: Do not save item state twice to GFF (this would needlessly duplicate temporary effects and local vars into savegames and serialised objects).
  690.  
  691. Framelimiter: Opening up the radial menu is no longer considered background/modal.
  692.  
  693. Nui: Fixed nuklear receiving input meant for the console.
  694. Nui: Fixed nuklear eating mouse clicks that should go to the radial menu instead.
  695.  
  696.  
  697.  
  698. Tyrants of the Moonsea
  699.  
  700. Prevented use of the map inside the navigation cabin after traveling to a destination.
  701. Covered some poor camera rotations when transitioning out of the sea map.
  702. Removed an xp exploit in Ulblyn's conversation.
  703.  
  704.  
  705.  
  706. NWScript API Additions
  707.  
  708.  
  709. int GUIEVENT_COMPASS_CLICK = 15;
  710. int GUIEVENT_LEVELUP_CANCELLED = 16;
  711. int GUIEVENT_AREA_LOADSCREEN_FINISHED = 17;
  712. int GUIEVENT_QUICKCHAT_ACTIVATE = 18;
  713. int GUIEVENT_QUICKCHAT_SELECT = 19;
  714. int GUIEVENT_QUICKCHAT_CLOSE = 20;
  715. int GUIEVENT_SELECT_CREATURE = 21;
  716. int GUIEVENT_UNSELECT_CREATURE = 22;
  717. int GUIEVENT_EXAMINE_OBJECT = 23;
  718. int GUIEVENT_OPTIONS_OPEN = 24;
  719. int GUIEVENT_OPTIONS_CLOSE = 25;
  720.  
  721. int JSON_TYPE_NULL = 0; // Also invalid
  722. int JSON_TYPE_OBJECT = 1;
  723. int JSON_TYPE_ARRAY = 2;
  724. int JSON_TYPE_STRING = 3;
  725. int JSON_TYPE_INTEGER = 4;
  726. int JSON_TYPE_FLOAT = 5;
  727. int JSON_TYPE_BOOL = 6;
  728.  
  729. // The player's gui width (inner window bounds).
  730. string PLAYER_DEVICE_PROPERTY_GUI_WIDTH = "gui_width";
  731. // The player's gui height (inner window bounds).
  732. string PLAYER_DEVICE_PROPERTY_GUI_HEIGHT = "gui_height";
  733. // The player's gui scale, in percent (factor 1.4 = 140)
  734. string PLAYER_DEVICE_PROPERTY_GUI_SCALE = "gui_scale";
  735.  
  736. int PLAYER_LANGUAGE_INVALID = -1;
  737. int PLAYER_LANGUAGE_ENGLISH = 0;
  738. int PLAYER_LANGUAGE_FRENCH = 1;
  739. int PLAYER_LANGUAGE_GERMAN = 2;
  740. int PLAYER_LANGUAGE_ITALIAN = 3;
  741. int PLAYER_LANGUAGE_SPANISH = 4;
  742. int PLAYER_LANGUAGE_POLISH = 5;
  743.  
  744. int PLAYER_DEVICE_PLATFORM_INVALID = 0;
  745. int PLAYER_DEVICE_PLATFORM_WINDOWS_X86 = 1;
  746. int PLAYER_DEVICE_PLATFORM_WINDOWS_X64 = 2;
  747. int PLAYER_DEVICE_PLATFORM_LINUX_X86 = 10;
  748. int PLAYER_DEVICE_PLATFORM_LINUX_X64 = 11;
  749. int PLAYER_DEVICE_PLATFORM_LINUX_ARM32 = 12;
  750. int PLAYER_DEVICE_PLATFORM_LINUX_ARM64 = 13;
  751. int PLAYER_DEVICE_PLATFORM_MAC_X86 = 20;
  752. int PLAYER_DEVICE_PLATFORM_MAC_X64 = 21;
  753. int PLAYER_DEVICE_PLATFORM_IOS = 30;
  754. int PLAYER_DEVICE_PLATFORM_ANDROID_ARM32 = 40;
  755. int PLAYER_DEVICE_PLATFORM_ANDROID_ARM64 = 41;
  756. int PLAYER_DEVICE_PLATFORM_ANDROID_X64 = 42;
  757. int PLAYER_DEVICE_PLATFORM_NINTENDO_SWITCH = 50;
  758. int PLAYER_DEVICE_PLATFORM_MICROSOFT_XBOXONE = 60;
  759. int PLAYER_DEVICE_PLATFORM_SONY_PS4 = 70;
  760.  
  761. int RESTYPE_RES = 0;
  762. ...
  763. int RESTYPE_CAF = 2082;
  764.  
  765. // Parse the given string as a valid json value, and returns the corresponding type.
  766. // Returns a JSON_TYPE_NULL on error.
  767. // Check JsonGetError() to see the parse error, if any.
  768. // NB: The parsed string needs to be in game-local encoding, but the generated json structure
  769. // will contain UTF-8 data.
  770. json JsonParse(string sJson);
  771.  
  772. // Dump the given json value into a string that can be read back in via JsonParse.
  773. // nIndent describes the indentation level for pretty-printing; a value of -1 means no indentation and no linebreaks.
  774. // Returns a string describing JSON_TYPE_NULL on error.
  775. // NB: The dumped string is in game-local encoding, with all non-ascii characters escaped.
  776. string JsonDump(json jValue, int nIndent = -1);
  777.  
  778. // Describes the type of the given json value.
  779. // Returns JSON_TYPE_NULL if the value is empty.
  780. int JsonGetType(json jValue);
  781.  
  782. // Returns the length of the given json type.
  783. // For objects, returns the number of top-level keys present.
  784. // For arrays, returns the number of elements.
  785. // Null types are of size 0.
  786. // All other types return 1.
  787. int JsonGetLength(json jValue);
  788.  
  789. // Returns the error message if the value has errored out.
  790. // Currently only describes parse errors.
  791. string JsonGetError(json jValue);
  792.  
  793. // Create a NULL json value, seeded with a optional error message for JsonGetError().
  794. json JsonNull(string sError = "");
  795.  
  796. // Create a empty json object.
  797. json JsonObject();
  798.  
  799. // Create a empty json array.
  800. json JsonArray();
  801.  
  802. // Create a json string value.
  803. // NB: Strings are encoded to UTF-8 from the game-local charset.
  804. json JsonString(string sValue);
  805.  
  806. // Create a json integer value.
  807. json JsonInt(int nValue);
  808.  
  809. // Create a json floating point value.
  810. json JsonFloat(float fValue);
  811.  
  812. // Create a json bool valye.
  813. json JsonBool(int bValue);
  814.  
  815. // Returns a string representation of the json value.
  816. // Returns "" if the value cannot be represented as a string, or is empty.
  817. // NB: Strings are decoded from UTF-8 to the game-local charset.
  818. string JsonGetString(json jValue);
  819.  
  820. // Returns a int representation of the json value, casting where possible.
  821. // Returns 0 if the value cannot be represented as a float.
  822. // Use this to parse json bool types.
  823. // NB: This will narrow down to signed 32 bit, as that is what NWScript int is.
  824. // If you are trying to read a 64 bit or unsigned integer, you will lose data.
  825. // You will not lose data if you keep the value as a json element (via Object/ArrayGet).
  826. int JsonGetInt(json jValue);
  827.  
  828. // Returns a float representation of the json value, casting where possible.
  829. // Returns 0.0 if the value cannot be represented as a float.
  830. // NB: This will narrow doubles down to float.
  831. // If you are trying to read a double, you will lose data.
  832. // You will not lose data if you keep the value as a json element (via Object/ArrayGet).
  833. float JsonGetFloat(json jValue);
  834.  
  835. // Returns a json array containing all keys of jObject.
  836. // Returns a empty array if the object is empty or not a json object, with GetJsonError() filled in.
  837. json JsonObjectKeys(json jObject);
  838.  
  839. // Returns the key value of sKey on the object jObect.
  840. // Returns a null json value if jObject is not a object or sKey does not exist on the object, with GetJsonError() filled in.
  841. json JsonObjectGet(json jObject, string sKey);
  842.  
  843. // Returns a modified copy of jObject with the key at sKey set to jValue.
  844. // Returns a json null value if jObject is not a object, with GetJsonError() filled in.
  845. json JsonObjectSet(json jObject, string sKey, json jValue);
  846.  
  847. // Returns a modified copy of jObject with the key at sKey deleted.
  848. // Returns a json null value if jObject is not a object, with GetJsonError() filled in.
  849. json JsonObjectDel(json jObject, string sKey);
  850.  
  851. // Gets the json object at jArray index position nIndex.
  852. // Returns a json null value if the index is out of bounds, with GetJsonError() filled in.
  853. json JsonArrayGet(json jArray, int nIndex);
  854.  
  855. // Returns a modified copy of jArray with position nIndex set to jValue.
  856. // Returns a json null value if jArray is not actually an array, with GetJsonError() filled in.
  857. // Returns a json null value if nIndex is out of bounds, with GetJsonError() filled in.
  858. json JsonArraySet(json jArray, int nIndex, json jValue);
  859.  
  860. // Returns a modified copy of jArray with jValue inserted at position nIndex.
  861. // All succeeding objects in the array will move by one.
  862. // By default (-1), inserts objects at the end of the array ("push").
  863. // nIndex = 0 inserts at the beginning of the array.
  864. // Returns a json null value if jArray is not actually an array, with GetJsonError() filled in.
  865. // Returns a json null value if nIndex is not 0 or -1 and out of bounds, with GetJsonError() filled in.
  866. json JsonArrayInsert(json jArray, json jValue, int nIndex = -1);
  867.  
  868. // Returns a modified copy of jArray with the element at position nIndex removed,
  869. // and the array resized by one.
  870. // Returns a json null value if jArray is not actually an array, with GetJsonError() filled in.
  871. // Returns a json null value if nIndex is out of bounds, with GetJsonError() filled in.
  872. json JsonArrayDel(json jArray, int nIndex);
  873.  
  874. // Transforms the given object into a json structure.
  875. // The json format is compatible with what https://github.com/niv/neverwinter.nim@1.4.3+ emits.
  876. // Returns the null json type on errors, or if oObject is not serializable, with GetJsonError() filled in.
  877. // Supported object types: creature, item, trigger, placeable, door, waypoint, encounter, store, area (combined format)
  878. // If bSaveObjectState is TRUE, local vars, effects, action queue, and transition info (triggers, doors) are saved out
  879. // (except for Combined Area Format, which always has object state saved out).
  880. json ObjectToJson(object oObject, int bSaveObjectState = FALSE);
  881.  
  882. // Deserializes the game object described in jObject.
  883. // Returns OBJECT_INVALID on errors.
  884. // Supported object types: creature, item, trigger, placeable, door, waypoint, encounter, store, area (combined format)
  885. // For areas, locLocation is ignored.
  886. // If bLoadObjectState is TRUE, local vars, effects, action queue, and transition info (triggers, doors) are read in.
  887. object JsonToObject(json jObject, location locLocation, object oOwner = OBJECT_INVALID, int bLoadObjectState = FALSE);
  888.  
  889. // Returns the element at the given JSON pointer value.
  890. // See https://datatracker.ietf.org/doc/html/rfc6901 for details.
  891. // Returns a json null value on error, with GetJsonError() filled in.
  892. json JsonPointer(json jData, string sPointer);
  893.  
  894. // Return a modified copy of jData with jValue inserted at the path described by sPointer.
  895. // See https://datatracker.ietf.org/doc/html/rfc6901 for details.
  896. // Returns a json null value on error, with GetJsonError() filled in.
  897. // jPatch is an array of patch elements, each containing a op, a path, and a value field. Example:
  898. // [
  899. // { "op": "replace", "path": "/baz", "value": "boo" },
  900. // { "op": "add", "path": "/hello", "value": ["world"] },
  901. // { "op": "remove", "path": "/foo"}
  902. // ]
  903. // Valid operations are: add, remove, replace, move, copy, test
  904. json JsonPatch(json jData, json jPatch);
  905.  
  906. // Returns the diff (described as a json structure you can pass into JsonPatch) between the two objects.
  907. // Returns a json null value on error, with GetJsonError() filled in.
  908. json JsonDiff(json jLHS, json jRHS);
  909.  
  910. // Returns a modified copy of jData with jMerge merged into it. This is an alternative to
  911. // JsonPatch/JsonDiff, with a syntax more closely resembling the final object.
  912. // See https://datatracker.ietf.org/doc/html/rfc7386 for details.
  913. // Returns a json null value on error, with GetJsonError() filled in.
  914. json JsonMerge(json jData, json jMerge);
  915.  
  916. // Get oObject's local json variable sVarName
  917. // * Return value on error: json null type
  918. json GetLocalJson(object oObject, string sVarName);
  919.  
  920. // Set oObject's local json variable sVarName to jValue
  921. void SetLocalJson(object oObject, string sVarName, json jValue);
  922.  
  923. // Delete oObject's local json variable sVarName
  924. void DeleteLocalJson(object oObject, string sVarName);
  925.  
  926. // Bind an json to a named parameter of the given prepared query.
  927. // Json values are serialised into a string.
  928. // Example:
  929. // sqlquery v = SqlPrepareQueryObject(GetModule(), "insert into test (col) values (@myjson);");
  930. // SqlBindJson(v, "@myjson", myJsonObject);
  931. // SqlStep(v);
  932. void SqlBindJson(sqlquery sqlQuery, string sParam, json jValue);
  933.  
  934. // Retrieve a column cast as a json value of the currently stepped row.
  935. // You can call this after SqlStep() returned TRUE.
  936. // In case of error, a json null value will be returned.
  937. // In traditional fashion, nIndex starts at 0.
  938. json SqlGetJson(sqlquery sqlQuery, int nIndex);
  939.  
  940. // This stores a json out to the specified campaign database
  941. // The database name:
  942. // - is case insensitive and it must be the same for both set and get functions.
  943. // - can only contain alphanumeric characters, no spaces.
  944. // The var name must be unique across the entire database, regardless of the variable type.
  945. // If you want a variable to pertain to a specific player in the game, provide a player object.
  946. void SetCampaignJson(string sCampaignName, string sVarName, json jValue, object oPlayer=OBJECT_INVALID);
  947.  
  948. // This will read a json from the specified campaign database
  949. // The database name:
  950. // - is case insensitive and it must be the same for both set and get functions.
  951. // - can only contain alphanumeric characters, no spaces.
  952. // The var name must be unique across the entire database, regardless of the variable type.
  953. // If you want a variable to pertain to a specific player in the game, provide a player object.
  954. json GetCampaignJson(string sCampaignName, string sVarName, object oPlayer=OBJECT_INVALID);
  955.  
  956. // Gets a device property/capability as advertised by the client.
  957. // sProperty is one of PLAYER_DEVICE_PROPERTY_xxx.
  958. // Returns -1 if
  959. // - the property was never set by the client,
  960. // - the the actual value is -1,
  961. // - the player is running a older build that does not advertise device properties,
  962. // - the player has disabled sending device properties (Options->Game->Privacy).
  963. int GetPlayerDeviceProperty(object oPlayer, string sProperty);
  964.  
  965. // Returns the LANGUAGE_xx code of the given player, or -1 if unavailable.
  966. int GetPlayerLanguage(object oPlayer);
  967.  
  968. // Returns one of PLAYER_DEVICE_PLATFORM_xxx, or 0 if unavailable.
  969. int GetPlayerDevicePlatform(object oPlayer);
  970.  
  971. // Deserializes the given resref/template into a JSON structure.
  972. // Supported GFF resource types:
  973. // * RESTYPE_CAF (and RESTYPE_ARE, RESTYPE_GIT, RESTYPE_GIC)
  974. // * RESTYPE_UTC
  975. // * RESTYPE_UTI
  976. // * RESTYPE_UTT
  977. // * RESTYPE_UTP
  978. // * RESTYPE_UTD
  979. // * RESTYPE_UTW
  980. // * RESTYPE_UTE
  981. // * RESTYPE_UTM
  982. // Returns a valid gff-type json structure, or a null value with GetJsonError() set.
  983. json TemplateToJson(string sResRef, int nResType);
  984.  
  985. // Returns the resource location of sResRef.nResType, as seen by the running module.
  986. // Note for dedicated servers: Checks on the module/server side, not the client.
  987. // Returns "" if the resource does not exist in the search space.
  988. string ResManGetAliasFor(string sResRef, int nResType);
  989.  
  990. // Finds the nNth available resref starting with sPrefix.
  991. // * Set bSearchBaseData to TRUE to also search base game content stored in your game installation directory.
  992. // WARNING: This can be very slow.
  993. // * Set sOnlyKeyTable to a specific keytable to only search the given named keytable (e.g. "OVERRIDE:").
  994. // Returns "" if no such resref exists.
  995. string ResManFindPrefix(string sPrefix, int nResType, int nNth = 1, int bSearchBaseData = FALSE, string sOnlyKeyTable = "");
  996.  
  997. // Create a NUI window from the given resref(.jui) for the given player.
  998. // * The resref needs to be available on the client, not the server.
  999. // * The token is a integer for ease of handling only. You are not supposed to do anything with it, except store/pass it.
  1000. // * The window ID needs to be alphanumeric and short. Only one window (per client) with the same ID can exist at a time.
  1001. // Re-creating a window with the same id of one already open will immediately close the old one.
  1002. // * See nw_inc_nui.nss for full documentation.
  1003. // Returns the window token on success (>0), or 0 on error.
  1004. int NuiCreateFromResRef(object oPlayer, string sResRef, string sWindowId = "");
  1005.  
  1006. // Create a NUI window inline for the given player.
  1007. // * The token is a integer for ease of handling only. You are not supposed to do anything with it, except store/pass it.
  1008. // * The window ID needs to be alphanumeric and short. Only one window (per client) with the same ID can exist at a time.
  1009. // Re-creating a window with the same id of one already open will immediately close the old one.
  1010. // * See nw_inc_nui.nss for full documentation.
  1011. // Returns the window token on success (>0), or 0 on error.
  1012. int NuiCreate(object oPlayer, json jNui, string sWindowId = "");
  1013.  
  1014. // You can look up windows by ID, if you gave them one.
  1015. // * Windows with a ID present are singletons - attempting to open a second one with the same ID
  1016. // will fail, even if the json definition is different.
  1017. // Returns the token if found, or 0.
  1018. int NuiFindWindow(object oPlayer, string sId);
  1019.  
  1020. // Destroys the given window, by token, immediately closing it on the client.
  1021. // Does nothing if nUiToken does not exist on the client.
  1022. // Does not send a close event - this immediately destroys all serverside state.
  1023. // The client will close the window asynchronously.
  1024. void NuiDestroy(object oPlayer, int nUiToken);
  1025.  
  1026. // Returns the originating player of the current event.
  1027. object NuiGetEventPlayer();
  1028.  
  1029. // Gets the window token of the current event (or 0 if not in a event).
  1030. int NuiGetEventWindow();
  1031.  
  1032. // Returns the event type of the current event.
  1033. // * See nw_inc_nui.nss for full documentation of all events.
  1034. string NuiGetEventType();
  1035.  
  1036. // Returns the ID of the widget that triggered the event.
  1037. string NuiGetEventElement();
  1038.  
  1039. // Get the array index of the current event.
  1040. // This can be used to get the index into an array, for example when rendering lists of buttons.
  1041. // Returns -1 if the event is not originating from within an array.
  1042. int NuiGetEventArrayIndex();
  1043.  
  1044. // Returns the window ID of the window described by nUiToken.
  1045. // Returns "" on error, or if the window has no ID.
  1046. string NuiGetWindowId(object oPlayer, int nUiToken);
  1047.  
  1048. // Gets the json value for the given player, token and bind.
  1049. // * json values can hold all kinds of values; but NUI widgets require specific bind types.
  1050. // It is up to you to either handle this in NWScript, or just set compatible bind types.
  1051. // No auto-conversion happens.
  1052. // Returns a json null value if the bind does not exist.
  1053. json NuiGetBind(object oPlayer, int nUiToken, string sBindName);
  1054.  
  1055. // Sets a json value for the given player, token and bind.
  1056. // The value is synced down to the client and can be used in UI binding.
  1057. // When the UI changes the value, it is returned to the server and can be retrieved via NuiGetBind().
  1058. // * json values can hold all kinds of values; but NUI widgets require specific bind types.
  1059. // It is up to you to either handle this in NWScript, or just set compatible bind types.
  1060. // No auto-conversion happens.
  1061. // * If the bind is on the watch list, this will immediately invoke the event handler with the "watch"
  1062. // even type; even before this function returns. Do not update watched binds from within the watch handler
  1063. // unless you enjoy stack overflows.
  1064. // Does nothing if the given player+token is invalid.
  1065. void NuiSetBind(object oPlayer, int nUiToken, string sBindName, json jValue);
  1066.  
  1067. // Swaps out the given element (by id) with the given nui layout (partial).
  1068. // * This currently only works with the "group" element type, and the special "_window_" root group.
  1069. void NuiSetGroupLayout(object oPlayer, int nUiToken, string sElement, json jNui);
  1070.  
  1071. // Mark the given bind name as watched.
  1072. // A watched bind will invoke the NUI script event every time it's value changes.
  1073. // Be careful with binding nui data inside a watch event handler: It's easy to accidentally recurse yourself into a stack overflow.
  1074. int NuiSetBindWatch(object oPlayer, int nUiToken, string sBind, int bWatch);
  1075.  
  1076. // Returns the nNth window token of the player, or 0.
  1077. // nNth starts at 0.
  1078. // Iterator is not write-safe: Calling DestroyWindow() will invalidate move following offsets by one.
  1079. int NuiGetNthWindow(object oPlayer, int nNth = 0);
  1080.  
  1081. // Return the nNth bind name of the given window, or "".
  1082. // If bWatched is TRUE, iterates only watched binds.
  1083. // If FALSE, iterates all known binds on the window (either set locally or in UI).
  1084. string NuiGetNthBind(object oPlayer, int nToken, int bWatched, int nNth = 0);
  1085.  
  1086. // Returns the event payload, specific to the event.
  1087. // Returns JsonNull if event has no payload.
  1088. json NuiGetEventPayload();
  1089.  
  1090. // Get the userdata of the given window token.
  1091. // Returns JsonNull if the window does not exist on the given player, or has no userdata set.
  1092. json NuiGetUserData(object oPlayer, int nToken);
  1093.  
  1094. // Sets an arbitrary json value as userdata on the given window token.
  1095. // This userdata is not read or handled by the game engine and not sent to clients.
  1096. // This mechanism only exists as a convenience for the programmer to store data bound to a windows' lifecycle.
  1097. // Will do nothing if the window does not exist.
  1098. void NuiSetUserData(object oPlayer, int nToken, json jUserData);
RAW Paste Data