summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgumi <git@gumi.ca>2020-07-27 20:50:10 -0400
committergumi <git@gumi.ca>2020-07-29 14:20:28 -0400
commitc90fd8aebcfa53a5f21519ea9eb4810e9e8a75ef (patch)
tree6677c5d1dffb552043dae0f1d85ec426f1da4e6f
parente09d39c59fb7fb15f9dda55299ff11619901331e (diff)
downloaddocs-c90fd8aebcfa53a5f21519ea9eb4810e9e8a75ef.tar.gz
docs-c90fd8aebcfa53a5f21519ea9eb4810e9e8a75ef.tar.bz2
docs-c90fd8aebcfa53a5f21519ea9eb4810e9e8a75ef.tar.xz
docs-c90fd8aebcfa53a5f21519ea9eb4810e9e8a75ef.zip
add docs the missing player cache functions
-rw-r--r--server/scripts/player_cache.md73
1 files changed, 63 insertions, 10 deletions
diff --git a/server/scripts/player_cache.md b/server/scripts/player_cache.md
index 4469be6..416f38b 100644
--- a/server/scripts/player_cache.md
+++ b/server/scripts/player_cache.md
@@ -2,12 +2,14 @@
The player cache keeps an in-memory copy of misc player data when they log in to the server to reduce the need to query the SQL database at runtime (which slightly adds lag). The player cache should be used whenever possible instead of writing queries.
+Note: `WEAK` references are not guaranteed to always return the same result. The data returned depends on what is already present in the cache or on the last login time of the character.
+
## name2account
Returns the account id associated with a char name.
```c
-"playerCache"::name2account("Reid");
+"playerCache"::name2account("Reid")
```
## name2char
@@ -15,7 +17,15 @@ Returns the account id associated with a char name.
Returns the char id associated with a char name.
```c
-"playerCache"::name2char("Reid");
+"playerCache"::name2char("Reid")
+```
+
+## name2vault
+
+Returns the Vault account id associated with a char name.
+
+```c
+"playerCache"::name2vault("Reid")
```
## char2account
@@ -23,25 +33,41 @@ Returns the char id associated with a char name.
Returns the account id associated with a char id.
```c
-"playerCache"::char2account(.@charID);
+"playerCache"::char2account(.@charID)
+```
+
+## char2name
+
+Returns the char name associated with a char id.
+
+```c
+"playerCache"::char2name(.@charID)
```
-## account2char
+## char2vault
+
+Returns the Vault account id associated with a char id.
+
+```c
+"playerCache"::char2vault(.@charID)
+```
+
+## account2char `[WEAK]`
Returns the char id associated with an account id.
**This is a weak reference**: an account id does not uniquely identify a character.
```c
-"playerCache"::account2char(.@accountID);
+"playerCache"::account2char(.@accountID)
```
-## vault2account
+## account2name `[WEAK]`
-Returns the account id associated with a Vault account id.
-**This is a weak reference**: a Vault account does not uniquely identify a game account.
+Returns the char name associated with an account id.
+**This is a weak reference**: an account id does not uniquely identify a character.
```c
-"playerCache"::vault2account(.@vaultID);
+"playerCache"::account2name(.@accountID)
```
## account2vault
@@ -49,5 +75,32 @@ Returns the account id associated with a Vault account id.
Returns the Vault account id associated with a game account id.
```c
-"playerCache"::account2vault(.@accountID);
+"playerCache"::account2vault(.@accountID)
+```
+
+## vault2account `[WEAK]`
+
+Returns the account id associated with a Vault account id.
+**This is a weak reference**: a Vault account does not uniquely identify a game account.
+
+```c
+"playerCache"::vault2account(.@vaultID)
+```
+
+## vault2char `[WEAK]`
+
+Returns the char id associated with a Vault account id.
+**This is a weak reference**: a Vault account does not uniquely identify a game character.
+
+```c
+"playerCache"::vault2char(.@vaultID)
+```
+
+## vault2name `[WEAK]`
+
+Returns the char name associated with a Vault account id.
+**This is a weak reference**: a Vault account does not uniquely identify a game character.
+
+```c
+"playerCache"::vault2name(.@vaultID)
```