diff --git a/docs/documentation.md b/docs/documentation.md
index 7367f2f..89c8f6a 100644
--- a/docs/documentation.md
+++ b/docs/documentation.md
@@ -349,6 +349,7 @@ export function onCommand(
[function Room.listenCharEvent](#function-room-listencharevent)
[function Room.listenExit](#function-room-listenexit)
[function Room.privateDescribe](#function-room-privatedescribe)
+ [function Room.profileIterator](#function-room-profileiterator)
[function Room.removeCommand](#function-room-removecommand)
[function Room.setExit](#function-room-setexit)
[function Room.setRoom](#function-room-setroom)
@@ -375,6 +376,14 @@ export function onCommand(
[method close](#method-room-exititerator-close)
[method getExit](#method-room-exititerator-getexit)
[class Room.MoveMsgs](#class-room-movemsgs)
+ [class Room.Profile](#class-room-profile)
+ [class Room.ProfileIterator](#class-room-profileiterator)
+ [method next](#method-room-profileiterator-next)
+ [method rewind](#method-room-profileiterator-rewind)
+ [method getID](#method-room-profileiterator-getid)
+ [method isValid](#method-room-profileiterator-isvalid)
+ [method close](#method-room-profileiterator-close)
+ [method getProfile](#method-room-profileiterator-getprofile)
[class Room.RoomDetails](#class-room-roomdetails)
Script namespace
@@ -2629,6 +2638,21 @@ targeted characters.
* `targetCharIds` (Array<[ID](#type-id)>)
+---
+
+function Room.profileIterator
+
+```ts
+Room.profileIterator(): ProfileIterator
+```
+
+Gets an iterator for the profiles for the room. Order is undefined.
+
+Returns
+
+* ([Room.ProfileIterator](#class-room-profileiterator))
+
+
---
function Room.removeCommand
@@ -2840,7 +2864,7 @@ Room character.
class Room.Char properties
-* `id` (string): Character ID.
+* `id` ([ID](#type-id)): Character ID.
* `name` (string): Character name.
* `surname` (string): Character surname.
* `avatar` ([ID](#type-id)): Character avatar.
@@ -2969,7 +2993,7 @@ Room exit.
class Room.Exit properties
-* `id` (string): Exit ID.
+* `id` ([ID](#type-id)): Exit ID.
* `keys` (Array<string>): Exit keys.
* `name` (string): Exit name.
* `icon` ([ExitIcon](#enum-exiticon)): Exit icon.
@@ -3105,6 +3129,129 @@ Move messages used when entering or leaving a room.
* `travelMsg` (string)
+---
+
+class Room.Profile
+
+Room profile.
+
+class Room.Profile properties
+
+* `id` ([ID](#type-id)): Profile ID.
+* `name` (string): Profile name.
+* `key` (string): Profile key.
+* `desc` (string): Profile desc.
+* `image` ([ID](#type-id)): Profile image.
+
+
+---
+
+class Room.ProfileIterator
+
+
+
+```ts
+new Room.ProfileIterator(iterator: i32)
+```
+
+Constructor of the Iterator instance.
+
+Parameters
+
+* `iterator` (i32)
+
+
+class Room.ProfileIterator properties
+
+* `iterator` (i32)
+
+
+---
+
+method Room.ProfileIterator.next
+
+```ts
+next(): void
+```
+
+Advances the iterator by one. Always check isValid() after a next()
+to ensure have not reached the end of the iterator.
+
+
+---
+
+method Room.ProfileIterator.rewind
+
+```ts
+rewind(): void
+```
+
+Rewinds the iterator cursor all the way back to first position, which
+would be the smallest key, or greatest key if inReverse() was called.
+
+Any iterator prefix passed to withPrefix() will be used on rewind.
+The iterator is rewound by default.
+
+
+---
+
+method Room.ProfileIterator.getID
+
+```ts
+getID(): ID
+```
+
+Returns the key string of the current key-value pair. It will abort
+if the cursor has reached the end of the iterator.
+
+Returns
+
+* ([ID](#type-id))
+
+
+---
+
+method Room.ProfileIterator.isValid
+
+```ts
+isValid(): boolean
+```
+
+Returns false when the cursor is at the end of the iterator.
+
+Returns
+
+* (boolean)
+
+
+---
+
+method Room.ProfileIterator.close
+
+```ts
+close(): void
+```
+
+Closes the iterator. Any further calls to the iterator will cause an
+error. May be called multiple times.
+
+
+---
+
+method Room.ProfileIterator.getProfile
+
+```ts
+getProfile(): Profile
+```
+
+Returns the current profile. It will abort if the cursor has reached the
+end of the iterator.
+
+Returns
+
+* ([Room.Profile](#class-room-profile))
+
+
---
class Room.RoomDetails
diff --git a/lib/env.ts b/lib/env.ts
index 793537a..98da82a 100644
--- a/lib/env.ts
+++ b/lib/env.ts
@@ -57,6 +57,9 @@ export declare namespace Room {
@external("env", "room.removeCommand")
export function removeCommand(key: string): boolean
+
+ @external("env", "room.profileIterator")
+ export function profileIterator(): i32
}
export declare namespace Script {
diff --git a/lib/host.ts b/lib/host.ts
index 4f30e7d..be35d6b 100644
--- a/lib/host.ts
+++ b/lib/host.ts
@@ -932,7 +932,7 @@ export namespace Room {
@json
export class Char {
/** Character ID. */
- id: string = "";
+ id: ID = "";
/** Character name. */
name: string = "";
/** Character surname. */
@@ -961,7 +961,7 @@ export namespace Room {
@json
export class Exit {
/** Exit ID. */
- id: string = "";
+ id: ID = "";
/** Exit keys. */
keys: string[] = [];
/** Exit name. */
@@ -988,6 +988,23 @@ export namespace Room {
transparent: boolean = false;
}
+ /**
+ * Room profile.
+ */
+ @json
+ export class Profile {
+ /** Profile ID. */
+ id: ID = "";
+ /** Profile name. */
+ name: string = "";
+ /** Profile key. */
+ key: string = "";
+ /** Profile desc. */
+ desc: string = "";
+ /** Profile image. */
+ image: ID = "";
+ }
+
/**
* Starts listening to room events on the current instance. If `instance` is
* set, it starts listening for events in that specific instance, or null
@@ -1169,6 +1186,13 @@ export namespace Room {
return new ExitIterator(room_binding.exitIterator());
}
+ /**
+ * Gets an iterator for the profiles for the room. Order is undefined.
+ */
+ export function profileIterator(): ProfileIterator {
+ return new ProfileIterator(room_binding.profileIterator());
+ }
+
/**
* Gets a character in the room by ID.
* @param charId - Character ID.
@@ -1299,6 +1323,17 @@ export namespace Room {
return JSON.parse(String.UTF8.decode(iterator_binding.value(super.iterator)));
}
}
+
+ export class ProfileIterator extends BaseIterator {
+ /**
+ * Returns the current profile. It will abort if the cursor has reached the
+ * end of the iterator.
+ */
+ getProfile(): Profile {
+ // @ts-expect-error
+ return JSON.parse(String.UTF8.decode(iterator_binding.value(super.iterator)));
+ }
+ }
}
/**
diff --git a/lib/types/host/index.d.ts b/lib/types/host/index.d.ts
index d88c0b0..21fca03 100644
--- a/lib/types/host/index.d.ts
+++ b/lib/types/host/index.d.ts
@@ -620,7 +620,7 @@ declare namespace Room {
*/
class Char {
/** Character ID. */
- id: string;
+ id: ID;
/** Character name. */
name: string;
/** Character surname. */
@@ -647,7 +647,7 @@ declare namespace Room {
*/
class Exit {
/** Exit ID. */
- id: string;
+ id: ID;
/** Exit keys. */
keys: string[];
/** Exit name. */
@@ -673,6 +673,21 @@ declare namespace Room {
/** Is transparent flag. */
transparent: boolean;
}
+ /**
+ * Room profile.
+ */
+ class Profile {
+ /** Profile ID. */
+ id: ID;
+ /** Profile name. */
+ name: string;
+ /** Profile key. */
+ key: string;
+ /** Profile desc. */
+ desc: string;
+ /** Profile image. */
+ image: ID;
+ }
/**
* Starts listening to room events on the current instance. If `instance` is
* set, it starts listening for events in that specific instance, or null
@@ -806,6 +821,10 @@ declare namespace Room {
* Gets an iterator for the exits in the room. Order is undefined.
*/
function exitIterator(): ExitIterator;
+ /**
+ * Gets an iterator for the profiles for the room. Order is undefined.
+ */
+ function profileIterator(): ProfileIterator;
/**
* Gets a character in the room by ID.
* @param charId - Character ID.
@@ -895,6 +914,13 @@ declare namespace Room {
*/
getExit(): Exit;
}
+ class ProfileIterator extends BaseIterator {
+ /**
+ * Returns the current profile. It will abort if the cursor has reached the
+ * end of the iterator.
+ */
+ getProfile(): Profile;
+ }
}
/**
* Script API functions.