Skip to content
This repository has been archived by the owner on May 6, 2023. It is now read-only.

Commit

Permalink
Implemented new events
Browse files Browse the repository at this point in the history
  • Loading branch information
KarlOfDuty committed Mar 20, 2022
1 parent bdb0840 commit d290e7f
Show file tree
Hide file tree
Showing 7 changed files with 95 additions and 8 deletions.
6 changes: 5 additions & 1 deletion SCPDiscordPlugin/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public static class Config
{
{ "settings.playercount", true },
{ "settings.verbose", true },
{ "settings.debug", true },
{ "settings.debug", true },
{ "settings.metrics", true },
{ "settings.configvalidation", true },
{ "settings.rolesync", false }
Expand Down Expand Up @@ -63,6 +63,10 @@ public static class Config
{ "channels.onstopcountdown.noplayer", new string[]{ } },
{ "channels.onsummonvehicle.chaos", new string[]{ } },
{ "channels.onsummonvehicle.mtf", new string[]{ } },
{ "channels.ongeneratorfinish", new string[]{ } },
{ "channels.onscpdeathannouncement", new string[]{ } },
{ "channels.oncassiecustomannouncement", new string[]{ } },
{ "channels.oncassieteamannouncement", new string[]{ } },

// Player events
{ "channels.on079addexp", new string[]{ } },
Expand Down
38 changes: 34 additions & 4 deletions SCPDiscordPlugin/EventListeners/EnvironmentEventListener.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,22 +129,52 @@ public void OnSummonVehicle(SummonVehicleEvent ev)

public void OnGeneratorFinish(GeneratorFinishEvent ev)
{
this.plugin.VerboseError("Event not yet implemented");
Dictionary<string, string> variables = new Dictionary<string, string>
{
{ "room", ev.Generator.Room.RoomType.ToString() }
};
this.plugin.SendMessage(Config.GetArray("channels.ongeneratorfinish"), "environment.ongeneratorfinish", variables);
}

public void OnScpDeathAnnouncement(ScpDeathAnnouncementEvent ev)
{
this.plugin.VerboseError("Event not yet implemented");
if (!ev.ShouldPlay) return;

Dictionary<string, string> variables = new Dictionary<string, string>
{
{ "ipaddress", ev.DeadPlayer.IPAddress },
{ "name", ev.DeadPlayer.Name },
{ "playerid", ev.DeadPlayer.PlayerID.ToString() },
{ "steamid", ev.DeadPlayer.GetParsedUserID() },
{ "class", ev.DeadPlayer.PlayerRole.RoleID.ToString() },
{ "team", ev.DeadPlayer.PlayerRole.Team.ToString() }
};
this.plugin.SendMessage(Config.GetArray("channels.onscpdeathannouncement"), "environment.onscpdeathannouncement", variables);
}

public void OnCassieCustomAnnouncement(CassieCustomAnnouncementEvent ev)
{
this.plugin.VerboseError("Event not yet implemented");
if (!ev.Allow) return;

Dictionary<string, string> variables = new Dictionary<string, string>
{
{ "words", ev.Words }
};

this.plugin.SendMessage(Config.GetArray("channels.oncassiecustomannouncement"), "environment.oncassiecustomannouncement", variables);
}

public void OnCassieTeamAnnouncement(CassieTeamAnnouncementEvent ev)
{
this.plugin.VerboseError("Event not yet implemented");
if (!ev.Allow) return;

Dictionary<string, string> variables = new Dictionary<string, string>
{
{ "cassieunitname", ev.CassieUnitName },
{ "scpsleft", ev.SCPsLeft.ToString() }
};

this.plugin.SendMessage(Config.GetArray("channels.oncassieteamannouncement"), "environment.oncassieteamannouncement", variables);
}
}
}
4 changes: 4 additions & 0 deletions SCPDiscordPlugin/Language.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ internal static class Language
"environment.ondecontaminate",
"environment.onsummonvehicle.chaos",
"environment.onsummonvehicle.mtf",
"environment.ongeneratorfinish",
"environment.onscpdeathannouncement",
"environment.oncassiecustomannouncement",
"environment.oncassieteamannouncement",

"player.onplayerhurt.noattacker",
"player.onplayerhurt.friendlyfire",
Expand Down
25 changes: 24 additions & 1 deletion SCPDiscordPlugin/Languages/english-emote.yml
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,29 @@ environment:
mtf:
message: ":helicopter: **MTF helicopter is in visual range of the site, preparing to land.**"
regex: []

ongeneratorfinish:
# room
message: ":electric_plug: Generator has finished charging up in <var:room>"
regex: [ ]
onscpdeathannouncement:
# ipaddress
# name
# playerid
# steamid
# class
# team
message: ":white_check_mark: <var:class> has been recontained or neutralized."
regex: [ ]
oncassiecustomannouncement:
# words
message: ":loudspeaker: C.A.S.S.I.E Announcement: <var:words>"
regex: [ ]
oncassieteamannouncement:
# cassieunitname
# scpsleft
message: ":cop: **MTF <var:cassieunitname> has entered the facility.**"
regex: [ ]

player:
onplayerhurt:
Expand Down Expand Up @@ -1075,7 +1098,7 @@ team:
# players - List<Player>
# spawnchaos - bool
mtf:
message: ":cop: **Mobile TaskForce Epsilon-11 designated Nine-Tailed Fox has entered the facility.**"
message: ":cop: **Mobile Task Force Epsilon-11 designated Nine-Tailed Fox has entered the facility.**"
regex: []
ci:
message: ":spy: **Facility incursion detected, intruders identified as members of hostile GOI \"Chaos Insurgency\".**"
Expand Down
24 changes: 23 additions & 1 deletion SCPDiscordPlugin/Languages/english.yml
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,28 @@ environment:
mtf:
message: "**MTF helicopter is in visual range of the site, preparing to land.**"
regex: []
ongeneratorfinish:
# room
message: "Generator has finished charging up in <var:room>"
regex: [ ]
onscpdeathannouncement:
# ipaddress
# name
# playerid
# steamid
# class
# team
message: "<var:class> has been recontained or neutralized."
regex: [ ]
oncassiecustomannouncement:
# words
message: "C.A.S.S.I.E Announcement: <var:words>"
regex: [ ]
oncassieteamannouncement:
# cassieunitname
# scpsleft
message: "**MTF <var:cassieunitname> has entered the facility.**"
regex: [ ]

player:
onplayerhurt:
Expand Down Expand Up @@ -1009,7 +1031,7 @@ team:
# players - List<Player>
# spawnchaos - bool
mtf:
message: "**Mobile TaskForce Epsilon-11 designated Nine-Tailed Fox has entered the facility.**"
message: "**Mobile Task Force Epsilon-11 designated Nine-Tailed Fox has entered the facility.**"
regex: []
ci:
message: "**Facility incursion detected, intruders identified as members of hostile GOI \"Chaos Insurgency\".**"
Expand Down
2 changes: 1 addition & 1 deletion SCPDiscordPlugin/SCPDiscord.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace SCPDiscord
name = "SCPDiscord",
description = "SCP:SL - Discord bridge.",
id = "karlofduty.scpdiscord",
version = "2.0.1",
version = "2.0.2",
SmodMajor = 3,
SmodMinor = 10,
SmodRevision = 0
Expand Down
4 changes: 4 additions & 0 deletions SCPDiscordPlugin/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ channels:
onsummonvehicle:
chaos: [ "default" ]
mtf: [ "default" ]
ongeneratorfinish: [ "default" ]
onscpdeathannouncement: []
oncassiecustomannouncement: []
oncassieteamannouncement: []

# Player events
onplayerhurt:
Expand Down

0 comments on commit d290e7f

Please sign in to comment.