Skip to content

Commit 097f237

Browse files
authored
GMCP data additions (#317)
# Changes * `Char.Enemies` * `Char.Affects` * Now have a source when able to derive this information. * `Comm.Channel` * `Game` * `Party` * Items more detailed now. * Meditation/Quit "buff" `TriggerCount` is now overridden to use proper `config.yaml` value (`Network.LogoutRounds`) * Teleport only moves the party if: * In same room as party member * Teleporter is the leader of the party
1 parent f930d92 commit 097f237

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+1968
-803
lines changed

_datafiles/guides/building/scripting/FUNCTIONS_ACTORS.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ ActorObjects are the basic object that represents Users and NPCs
3939
- [ActorObject.GiveItem(itemId ItemObject)](#actorobjectgiveitemitemid-itemobject)
4040
- [ActorObject.TakeItem(itemId ItemObject)](#actorobjecttakeitemitemid-itemobject)
4141
- [ActorObject.HasBuff(buffId int) bool](#actorobjecthasbuffbuffid-int-bool)
42-
- [ActorObject.GiveBuff(buffId int)](#actorobjectgivebuffbuffid-int)
42+
- [ActorObject.GiveBuff(buffId int, source string)](#actorobjectgivebuffbuffid-int-source-string)
4343
- [ActorObject.HasBuffFlag(buffFlag string) bool](#actorobjecthasbuffflagbuffflag-string-bool)
4444
- [ActorObject.CancelBuffWithFlag(buffFlag string) bool](#actorobjectcancelbuffwithflagbuffflag-string-bool)
4545
- [ActorObject.RemoveBuff(buffId int)](#actorobjectremovebuffbuffid-int)
@@ -339,12 +339,13 @@ Returns true if the Actor has the buffId supplied
339339
| --- | --- |
340340
| buffId | The ID of the buff to look for. |
341341

342-
## [ActorObject.GiveBuff(buffId int)](/internal/scripting/actor_func.go)
342+
## [ActorObject.GiveBuff(buffId int, source string)](/internal/scripting/actor_func.go)
343343
Grants an ActorObject a Buff
344344

345345
| Argument | Explanation |
346346
| --- | --- |
347347
| buffId | The ID of the buff to give them. |
348+
| source | The source of the buff, "item", "spell", "trap", "curse", etc. or empty. |
348349

349350
## [ActorObject.HasBuffFlag(buffFlag string) bool](/internal/scripting/actor_func.go)
350351
Find out if an ActorObject has a specific buff flag

_datafiles/sample-scripts/spells/neutral.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,6 @@ function onMagic(sourceActor, targetActor) {
4848
}
4949

5050
// Apply the illumination
51-
targetActor.GiveBuff(1);
51+
targetActor.GiveBuff(1, "spell");
5252

5353
}

_datafiles/world/default/buffs/15-sleeping.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ function onEnd(actor, triggersLeft) {
1919
SendUserMessage(actor.UserId(), 'You wake up!');
2020
SendRoomMessage(actor.GetRoomId(), actor.GetCharacterName(true)+' wakes up.', actor.UserId());
2121
actor.SetAdjective("sleeping", false);
22-
actor.GiveBuff(16) // Well Rested
22+
actor.GiveBuff(16, "sleep") // Well Rested
2323
}

_datafiles/world/default/buffs/21-explosion.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ function onTrigger(actor, triggersLeft) {
1414

1515
// Invoked when the buff has run its course.
1616
function onEnd(actor, triggersLeft) {
17-
actor.GiveBuff(22) // On fire
17+
actor.GiveBuff(22, "explosion") // On fire
1818
}

_datafiles/world/default/items/other-0/6-sleeping_bag.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ function onCommand_use(user, item, room) {
66

77
user.CancelBuffWithFlag("hidden"); // cancel any hidden buff (most item use should do this if it's noticeable)
88

9-
user.GiveBuff(15); // Give the sleeping buff
9+
user.GiveBuff(15, "sleep"); // Give the sleeping buff
1010

1111
item.AddUsesLeft(-1); // Decrement the uses left by 1
1212
item.MarkLastUsed(); // Update the last used round number to current

_datafiles/world/default/mobs/frostfang/scripts/2-guard-hungry.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,17 @@ function onAsk(mob, room, eventDetails) {
1717
match = UtilFindMatchIn(eventDetails.askText, nouns);
1818
if ( match.found ) {
1919

20-
if ( user.HasQuest("4-start") ) {
20+
if ( !user.HasQuest("4-start") ) {
2121

22-
mob.Command("sayto @" + String(user.UserId()) + " Thanks, but you've done enough. Too much, really.");
23-
24-
} else {
2522
mob.Command("emote rubs his belly.")
2623
mob.Command("say I forgot my lunch today, and I'm so hungry.")
2724
mob.Command("say Do you think you could find a cheese sandwich for me?")
2825

2926
user.GiveQuest("4-start")
27+
} else if ( user.HasQuest("4-end") ) {
28+
mob.Command("sayto @" + String(user.UserId()) + " Thanks, but you've done enough. Too much, really.");
29+
} else {
30+
mob.Command("emote rubs his belly.")
3031
}
3132

3233
return true;

_datafiles/world/default/rooms/frostfang/18.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ function onCommand_look(rest, user, room) {
66
matches = UtilFindMatchIn(rest, altar);
77
if ( matches.found ) {
88
SendUserMessage(user.UserId(), "<ansi fg=\"240\">The smell of the insense fills your nostrels, numbing your senses.</ansi>");
9-
user.GiveBuff(2);
9+
user.GiveBuff(2, "drugs");
1010
return true;
1111
}
1212

_datafiles/world/default/rooms/frostfang/35.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ function onCommand_west(rest, user, room) {
2222
SendUserMessage(user.UserId(), 'You feel a sense of warmth wash over you, and the biting cold air no longer bothers you.');
2323
SendUserMessage(user.UserId(), '');
2424

25-
user.GiveBuff(3);
25+
user.GiveBuff(3, "enchantment");
2626

2727
// Queue it with an input blocking flag and ignore further scripts flag
2828
user.CommandFlagged('west', EventFlags.CmdSkipScripts|EventFlags.CmdBlockInputUntilComplete, 1)
@@ -51,7 +51,7 @@ function onCommand_say(rest, user, room) {
5151

5252
user.GiveQuest("3-end");
5353

54-
user.GiveBuff(3);
54+
user.GiveBuff(3, "enchantment");
5555

5656
return true;
5757
}

_datafiles/world/default/rooms/frostfang/61.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ function onCommand_sleep(rest, user, room) {
55
SendRoomMessage(room.RoomId(), user.GetCharacterName(true)+" says something to the Inn keeper and is escorted to another room.", user.UserId());
66

77
user.MoveRoom(432);
8-
user.GiveBuff(15);
8+
user.GiveBuff(15, "sleep");
99

1010
return true;
1111
}

_datafiles/world/default/rooms/tutorial/901.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,12 @@ function onCommand(cmd, rest, user, room) {
7474
break;
7575
case 3:
7676
teacherMob.Command('emote touches you and you feel more focused.');
77-
user.GiveBuff(32);
77+
user.GiveBuff(32, "training");
7878
teacherMob.Command('say Sometimes you might become afflicted with a condition. Conditions can have good or bad effects.');
7979
teacherMob.Command('say type <ansi fg="command">conditions</ansi> to see any statuses affecting you.');
8080
break;
8181
case 4:
82-
user.GiveBuff(-32);
82+
user.GiveBuff(-32, "training");
8383
teacherMob.Command('say head <ansi fg="command">south</ansi> for the next lesson.');
8484
canGoSouth = true;
8585
default:

0 commit comments

Comments
 (0)