-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathREADME.Adventure.Plugins.txt
107 lines (93 loc) · 3.08 KB
/
README.Adventure.Plugins.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
Here are the notes for how we did plugins
~/missions/PROJECT.yaml
~/missions/actioncastle.yaml
> namespace : ActionCastle
~/perl5/lib/Adventure/Module/NAMESPACE
~/perl5/lib/Adventure/Module/ActionCastle
There are currently 3 type of plugins folders (Actions, Exits, Turns)
$ tree
├── Action
│ ├── GiveRose.pm
│ ├── GoFishing.pm
│ ├── HitWithBranch.pm
│ ├── KillPlayer.pm
│ ├── LightCandle.pm
│ ├── LightLamp.pm
│ ├── Propose.pm
│ ├── SitThrone.pm
│ ├── TakeItem.pm
│ ├── TrollIsFed.pm
│ └── UnlockDoor.pm
├── Exit
│ └── Blocked.pm
└── Turn
├── ReceiveCommand.pm
└── TrollRage.pm
Actions -> definitions in yaml
> locations:
> LOCATION:
> name: Long location name
> description : Message to user about the location
> ...
> actions :
> ACTION :
> code : GoFishing
~/perl5/Adventure/lib/Adventure/Role/Actions.pm
> after init => sub {
> my ($self, $key, $config) = @_;
> $self->install_plugin($key, $config, {
> type => 'actions',
> namespace => 'Action',
> });
> };
Exits -> definitions in yaml
> locations:
> LOCATION:
> name: Long location name
> description : Message to user about the location
> exits :
> EXIT :
> code : Blocked
> params :
> destination : courtyard
> allow_property : troll_fed
> description : There is a mean troll in the way!
~/perl5/Adventure/lib/Adventure/Location.pm
> after init => sub {
> my ($self, $key, $config) = @_;
> # commenting out for now, will put back sometime... -sk.
> # warn "need to implement LOOK for $key. should that just be an action?";
> if (ref $config eq 'HASH') {
> if (exists $config->{actors}) {
> if (ref $config->{actors} eq 'ARRAY') {
> $self->add_actors($config->{actors});
> }
> else {
> die "$key actors must be an array";
> }
> }
> $self->install_plugin($key, $config, {
> type => 'exits',
> namespace => 'Exit',
> });
> }
> };
Turns -> definition in yaml
> player:
> end_turn_events :
> troll rage:
> code: TrollRage
~/perl5/Adventure/lib/Adventure/Player.pm
> after init => sub {
> my ($self, $key, $config) = @_;
> $self->add_aliases(['self','myself']);
> $self->install_plugin($key, $config, {
> type => 'start_turn_events',
> namespace => 'Turn',
> });
> $self->install_plugin($key, $config, {
> type => 'end_turn_events',
> namespace => 'Turn',
> });
> $self->location($config->{location});
> };