|
| 1 | +# PartyObject |
| 2 | + |
| 3 | +PartyObjects represent collections of actors (users and NPCs) that are grouped together. They provide convenient methods to perform operations on multiple actors at once. |
| 4 | + |
| 5 | +- [PartyObject](#partyobject) |
| 6 | + - [PartyObject.GetMembers() \[\]ActorObject](#partyobjectgetmembers-actorobject) |
| 7 | + - [PartyObject.SendText(msg string)](#partyobjectsendtextmsg-string) |
| 8 | + - [PartyObject.SetResetRoomId(roomId int)](#partyobjectsetresetroomidroomid-int) |
| 9 | + - [PartyObject.GiveQuest(questId string)](#partyobjectgivequestquestid-string) |
| 10 | + - [PartyObject.AddGold(amt int \[, bankAmt int\])](#partyobjectaddgoldamt-int--bankamt-int) |
| 11 | + - [PartyObject.AddHealth(amt int)](#partyobjectaddhealthamt-int) |
| 12 | + - [PartyObject.AddMana(amt int)](#partyobjectaddmanaamt-int) |
| 13 | + - [PartyObject.Command(cmd string \[, waitSeconds float\])](#partyobjectcommandcmd-string--waitseconds-float) |
| 14 | + - [PartyObject.TrainSkill(skillName string, skillLevel int)](#partyobjecttrainskillskillname-string-skilllevel-int) |
| 15 | + - [PartyObject.MoveRoom(destRoomId int)](#partyobjectmoveroomdestroomid-int) |
| 16 | + - [PartyObject.AddEventLog(category string, message string)](#partyobjectaddeventlogcategory-string-message-string) |
| 17 | + - [PartyObject.GiveBuff(buffId int, source string)](#partyobjectgivebuffbuffid-int-source-string) |
| 18 | + - [PartyObject.CancelBuffWithFlag(buffFlag string)](#partyobjectcancelbuffwithflagbuffflag-string) |
| 19 | + - [PartyObject.RemoveBuff(buffId int)](#partyobjectremovebuffbuffid-int) |
| 20 | + - [PartyObject.ChangeAlignment(alignmentChange int)](#partyobjectchangealignmentalignmentchange-int) |
| 21 | + - [PartyObject.LearnSpell(spellId string)](#partyobjectlearnspellspellid-string) |
| 22 | + - [PartyObject.SetHealth(amt int)](#partyobjectsethealthamt-int) |
| 23 | + - [PartyObject.SetAdjective(adj string, addIt bool)](#partyobjectsetadjectiveadj-string-addit-bool) |
| 24 | + - [PartyObject.GiveTrainingPoints(ct int)](#partyobjectgivetrainingpointsct-int) |
| 25 | + - [PartyObject.GiveStatPoints(ct int)](#partyobjectgivestatpointsct-int) |
| 26 | + - [PartyObject.GiveExtraLife()](#partyobjectgiveextralife) |
| 27 | + - [PartyObject.GrantXP(xpAmt int, reason string)](#partyobjectgrantxpxpamt-int-reason-string) |
| 28 | + - [PartyObject.TimerSet(name string, period string)](#partyobjecttimersetname-string-period-string) |
| 29 | + |
| 30 | + |
| 31 | + |
| 32 | + |
| 33 | +## [PartyObject.GetMembers() []ActorObject](/internal/scripting/party_func.go) |
| 34 | +Returns an array of all ActorObjects in the party based on the party configuration. |
| 35 | + |
| 36 | +_Note: This includes both party members and their charmed creatures, filtered by presence/absence based on how the party object was created._ |
| 37 | + |
| 38 | +## [PartyObject.SendText(msg string)](/internal/scripting/party_func.go) |
| 39 | +Sends a message to all members of the party. |
| 40 | + |
| 41 | +| Argument | Explanation | |
| 42 | +| --- | --- | |
| 43 | +| msg | the message to send to all party members | |
| 44 | + |
| 45 | +## [PartyObject.SetResetRoomId(roomId int)](/internal/scripting/party_func.go) |
| 46 | +Sets the "Reset Room Id" for all user party members (where they will be sent if they log out). |
| 47 | + |
| 48 | +_Note: Only affects user party members, not NPCs. This is only useful if players are being sent to ephemeral chunks._ |
| 49 | + |
| 50 | +| Argument | Explanation | |
| 51 | +| --- | --- | |
| 52 | +| roomId | The RoomId all party members should be sent to | |
| 53 | + |
| 54 | +## [PartyObject.GiveQuest(questId string)](/internal/scripting/party_func.go) |
| 55 | +Grants a quest or progress on a quest to all party members. |
| 56 | + |
| 57 | +| Argument | Explanation | |
| 58 | +| --- | --- | |
| 59 | +| questId | The quest identifier string to give, such as `3-start` | |
| 60 | + |
| 61 | +## [PartyObject.AddGold(amt int [, bankAmt int])](/internal/scripting/party_func.go) |
| 62 | +Updates how much gold all party members have. |
| 63 | + |
| 64 | +| Argument | Explanation | |
| 65 | +| --- | --- | |
| 66 | +| amt | A positive or negative amount of gold to alter each party member's gold by | |
| 67 | +| bankAmt (optional) | A positive or negative amount of gold to alter each party member's bank gold by | |
| 68 | + |
| 69 | +## [PartyObject.AddHealth(amt int)](/internal/scripting/party_func.go) |
| 70 | +Updates how much health all party members have. |
| 71 | + |
| 72 | +| Argument | Explanation | |
| 73 | +| --- | --- | |
| 74 | +| amt | A positive or negative amount of health to alter each party member's health by | |
| 75 | + |
| 76 | +## [PartyObject.AddMana(amt int)](/internal/scripting/party_func.go) |
| 77 | +Updates how much mana all party members have. |
| 78 | + |
| 79 | +| Argument | Explanation | |
| 80 | +| --- | --- | |
| 81 | +| amt | A positive or negative amount of mana to alter each party member's mana by | |
| 82 | + |
| 83 | +## [PartyObject.Command(cmd string [, waitSeconds float])](/internal/scripting/party_func.go) |
| 84 | +Forces all party members to execute a command as if they entered it. |
| 85 | + |
| 86 | +_Note: Don't underestimate the power of this function! Complex and interesting behaviors or interactions can emerge from using it._ |
| 87 | + |
| 88 | +| Argument | Explanation | |
| 89 | +| --- | --- | |
| 90 | +| cmd | The command to execute such as `look west` or `say goodbye` | |
| 91 | +| waitSeconds (optional) | The number of seconds to wait before executing the command | |
| 92 | + |
| 93 | +## [PartyObject.TrainSkill(skillName string, skillLevel int)](/internal/scripting/party_func.go) |
| 94 | +Sets a skill level for all party members, if it's greater than what they already have. |
| 95 | + |
| 96 | +| Argument | Explanation | |
| 97 | +| --- | --- | |
| 98 | +| skillName | The name of the skill to train, such as `map` or `backstab` | |
| 99 | +| skillLevel | The skill level to train to | |
| 100 | + |
| 101 | +## [PartyObject.MoveRoom(destRoomId int)](/internal/scripting/party_func.go) |
| 102 | +Quietly moves all party members to a new room. |
| 103 | + |
| 104 | +| Argument | Explanation | |
| 105 | +| --- | --- | |
| 106 | +| destRoomId | The room id to move them all to | |
| 107 | + |
| 108 | +## [PartyObject.AddEventLog(category string, message string)](/internal/scripting/party_func.go) |
| 109 | +Adds a line to all party members' Event Log (`history`). |
| 110 | + |
| 111 | +| Argument | Explanation | |
| 112 | +| --- | --- | |
| 113 | +| category | A short single word category | |
| 114 | +| message | A single line describing the event | |
| 115 | + |
| 116 | +## [PartyObject.GiveBuff(buffId int, source string)](/internal/scripting/party_func.go) |
| 117 | +Grants all party members a Buff. |
| 118 | + |
| 119 | +| Argument | Explanation | |
| 120 | +| --- | --- | |
| 121 | +| buffId | The ID of the buff to give them | |
| 122 | +| source | The source of the buff, "item", "spell", "trap", "curse", etc. or empty | |
| 123 | + |
| 124 | +## [PartyObject.CancelBuffWithFlag(buffFlag string)](/internal/scripting/party_func.go) |
| 125 | +Cancels any buffs that have the flag provided for all party members. |
| 126 | + |
| 127 | +| Argument | Explanation | |
| 128 | +| --- | --- | |
| 129 | +| buffFlag | The buff flag to check [see buffspec.go](../buffs/buffspec.go) | |
| 130 | + |
| 131 | +## [PartyObject.RemoveBuff(buffId int)](/internal/scripting/party_func.go) |
| 132 | +Remove a buff from all party members without triggering onEnd. |
| 133 | + |
| 134 | +| Argument | Explanation | |
| 135 | +| --- | --- | |
| 136 | +| buffId | The ID of the buff to remove | |
| 137 | + |
| 138 | +## [PartyObject.ChangeAlignment(alignmentChange int)](/internal/scripting/party_func.go) |
| 139 | +Updates the alignment of all party members by a relative amount. Caps result at -100 to 100. |
| 140 | + |
| 141 | +| Argument | Explanation | |
| 142 | +| --- | --- | |
| 143 | +| alignmentChange | The alignment adjustment, from -200 to 200 | |
| 144 | + |
| 145 | +## [PartyObject.LearnSpell(spellId string)](/internal/scripting/party_func.go) |
| 146 | +Adds the spell to all party members' spellbooks. |
| 147 | + |
| 148 | +| Argument | Explanation | |
| 149 | +| --- | --- | |
| 150 | +| spellId | The ID of the spell | |
| 151 | + |
| 152 | +## [PartyObject.SetHealth(amt int)](/internal/scripting/party_func.go) |
| 153 | +Sets all party members' health to a specific amount. If this exceeds their maximum health, sets to their maximum health. |
| 154 | + |
| 155 | +| Argument | Explanation | |
| 156 | +| --- | --- | |
| 157 | +| amt | number of hitpoints to set them to | |
| 158 | + |
| 159 | +## [PartyObject.SetAdjective(adj string, addIt bool)](/internal/scripting/party_func.go) |
| 160 | +Adds or removes a specific text adjective to all party members' names. |
| 161 | + |
| 162 | +| Argument | Explanation | |
| 163 | +| --- | --- | |
| 164 | +| adj | Adjective such as "sleeping", "crying" or "busy" | |
| 165 | +| addIt | `true` to add it. `false` to remove it | |
| 166 | + |
| 167 | +## [PartyObject.GiveTrainingPoints(ct int)](/internal/scripting/party_func.go) |
| 168 | +Increases training points for all party members. |
| 169 | + |
| 170 | +| Argument | Explanation | |
| 171 | +| --- | --- | |
| 172 | +| ct | How many training points to give | |
| 173 | + |
| 174 | +## [PartyObject.GiveStatPoints(ct int)](/internal/scripting/party_func.go) |
| 175 | +Increases stat points for all party members. |
| 176 | + |
| 177 | +| Argument | Explanation | |
| 178 | +| --- | --- | |
| 179 | +| ct | How many stat points to give | |
| 180 | + |
| 181 | +## [PartyObject.GiveExtraLife()](/internal/scripting/party_func.go) |
| 182 | +Increases extra lives by 1 for all party members. |
| 183 | + |
| 184 | +## [PartyObject.GrantXP(xpAmt int, reason string)](/internal/scripting/party_func.go) |
| 185 | +Gives experience points to all party members. |
| 186 | + |
| 187 | +| Argument | Explanation | |
| 188 | +| --- | --- | |
| 189 | +| xpAmt | How much experience to grant | |
| 190 | +| reason | Short reasons such as "combat", "trash cleanup" | |
| 191 | + |
| 192 | +## [PartyObject.TimerSet(name string, period string)](/internal/scripting/party_func.go) |
| 193 | +Starts a new Round timer for all party members. |
| 194 | + |
| 195 | +| Argument | Explanation | |
| 196 | +| --- | --- | |
| 197 | +| name | A string identifier. Reusing names will overwrite previously assigned names | |
| 198 | +| period | How long until the timer expires. `1 real hour`, `1 hour`, etc | |
0 commit comments