-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
61 changed files
with
7,466 additions
and
575 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,161 @@ | ||
using Steamworks; | ||
using WFServer; | ||
|
||
public class ChatCommands : CovePlugin | ||
{ | ||
|
||
Server Server { get; set; } // lol | ||
|
||
public ChatCommands(Server server) : base(server) | ||
{ | ||
Server = server; | ||
} | ||
|
||
public override void onInit() | ||
{ | ||
base.onInit(); | ||
|
||
log("Chat commands are here!"); | ||
} | ||
|
||
public override void onPlayerJoin(WFPlayer player) | ||
{ | ||
base.onPlayerJoin(player); | ||
//sendPlayerChatMessage(player, "use !help for a list of commands!"); | ||
} | ||
|
||
public override void onChatMessage(WFPlayer sender, string message) | ||
{ | ||
base.onChatMessage(sender, message); | ||
|
||
char[] msg = message.ToCharArray(); | ||
if (msg[0] == "!".ToCharArray()[0]) // its a command! | ||
{ | ||
string command = message.Split(" ")[0].ToLower(); | ||
switch (command) | ||
{ | ||
case "!help": | ||
{ | ||
sendPlayerChatMessage(sender, "--- HELP ---"); | ||
sendPlayerChatMessage(sender, "Not much here tbh..."); | ||
} | ||
break; | ||
|
||
case "!users": | ||
if (!isPlayerAdmin(sender)) return; | ||
string messageBody = ""; | ||
foreach (var player in getAllPlayers()) | ||
{ | ||
messageBody += $"{player.FisherName} [{player.SteamId}]: {player.FisherID}\n"; | ||
} | ||
|
||
//SendLetter(id, SteamClient.SteamId, "Players in the server", messageBody, "Always here - ", "Cove"); | ||
break; | ||
|
||
case "!spawn": | ||
{ | ||
if (!isPlayerAdmin(sender)) return; | ||
|
||
var actorType = message.Split(" ")[1].ToLower(); | ||
bool spawned = false; | ||
switch (actorType) | ||
{ | ||
case "rain": | ||
Server.spawnRainCloud(); | ||
spawned = true; | ||
break; | ||
|
||
case "fish": | ||
Server.spawnFish(); | ||
spawned = true; | ||
break; | ||
|
||
case "meteor": | ||
spawned = true; | ||
Server.spawnFish("fish_spawn_alien"); | ||
break; | ||
|
||
case "portal": | ||
Server.spawnVoidPortal(); | ||
spawned = true; | ||
break; | ||
|
||
case "metal": | ||
Server.spawnMetal(); | ||
spawned = true; | ||
break; | ||
} | ||
if (spawned) | ||
{ | ||
sendPlayerChatMessage(sender, $"Spawned {actorType}"); | ||
} | ||
else | ||
{ | ||
sendPlayerChatMessage(sender, $"\"{actorType}\" is not a spawnable actor!"); | ||
} | ||
} | ||
break; | ||
|
||
case "!kick": | ||
if (!isPlayerAdmin(sender)) return; | ||
var kickUser = message.Split(" ")[1].ToUpper(); | ||
WFPlayer kickedplayer = getAllPlayers().ToList().Find(p => p.FisherID == kickUser); | ||
if (kickedplayer == null) | ||
{ | ||
sendPlayerChatMessage(sender, "That's not a player!"); | ||
} | ||
else | ||
{ | ||
Dictionary<string, object> packet = new Dictionary<string, object>(); | ||
packet["type"] = "kick"; | ||
|
||
sendPacketToPlayer(packet, kickedplayer); | ||
|
||
sendPlayerChatMessage(sender, $"Kicked {kickedplayer.FisherName}"); | ||
sendGlobalChatMessage($"{kickedplayer.FisherName} was kicked from the lobby!"); | ||
} | ||
break; | ||
|
||
case "!setjoinable": | ||
{ | ||
if (!isPlayerAdmin(sender)) return; | ||
string arg = message.Split(" ")[1].ToLower(); | ||
if (arg == "true") | ||
{ | ||
Server.gameLobby.SetJoinable(true); | ||
sendPlayerChatMessage(sender, $"Opened lobby!"); | ||
if (!Server.codeOnly) | ||
{ | ||
Server.gameLobby.SetData("type", "public"); | ||
sendPlayerChatMessage(sender, $"Unhid server from server list"); | ||
} | ||
} | ||
else if (arg == "false") | ||
{ | ||
Server.gameLobby.SetJoinable(false); | ||
sendPlayerChatMessage(sender, $"Closed lobby!"); | ||
if (!Server.codeOnly) | ||
{ | ||
Server.gameLobby.SetData("type", "code_only"); | ||
sendPlayerChatMessage(sender, $"Hid server from server list"); | ||
} | ||
} | ||
else | ||
{ | ||
sendPlayerChatMessage(sender, $"\"{arg}\" is not true or false!"); | ||
} | ||
} | ||
break; | ||
|
||
case "!refreshadmins": | ||
{ | ||
if (!isPlayerAdmin(sender)) return; | ||
Server.readAdmins(); | ||
} | ||
break; | ||
} | ||
} | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> | ||
<DebugType>none</DebugType> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'"> | ||
<DebugType>none</DebugType> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\WFServer\WFServer.csproj" /> | ||
<EmbeddedResource Include="plugin.cfg"></EmbeddedResource> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# plugin name | ||
name = Chat Commands | ||
|
||
# plugin id | ||
id = chatcommands | ||
|
||
# authors! | ||
author = DrMeepso |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.