Git Product home page Git Product logo

chatcommands's Introduction

Chat Commands

Chat commands is a server side mod that allow players to use chat commands

Requirements For Development

  • Harmony for .NET Framework 4.7.2

0Harmony.dll is located in release file, If you are not going to make development you can ignore this requirement.

Installation

  • Download the latest release (It's located on right panel)
  • Add the following xml node to your [Dedicated Server Files]/Modules/Multiplayer/SubModule.xml file, between the <SubModules> </SubModules> tags.
<SubModule>
    <Name value="ChatCommands" />
    <DLLName value="ChatCommands.dll" />
    <SubModuleClassType value="ChatCommands.ChatCommandsSubModule" />
    <Tags>
        <Tag key="DedicatedServerType" value="custom" />
    </Tags>
</SubModule>
  • Your SubModule.xml file should look like this
<?xml version="1.0" encoding="utf-8"?>
<Module>
	<Name value="Multiplayer" />
	<Id value="Multiplayer" />
	<Version value="e1.8.0" />
	<DefaultModule value="true" />
	<ModuleCategory value="Multiplayer" />
	<Official value="true" />
	<DependedModules>
		<DependedModule Id="Native" DependentVersion="e1.8.0" Optional="false" />
	</DependedModules>
	<SubModules>
        <!-- Added here -->
        <SubModule>
            <Name value="ChatCommands" />
            <DLLName value="ChatCommands.dll" />
            <SubModuleClassType value="ChatCommands.ChatCommandsSubModule" />
            <Tags>
                <Tag key="DedicatedServerType" value="custom" />
            </Tags>
        </SubModule>
        <!-- Your other submodules -->
	</SubModules>
</Module>

Usage

While in the server you can open up the chat and type !help command to see what commands you can use.

User Commands

  • !help shows the help message
  • !login <password> Logins as an administrator
  • !me <message> Me command that everyone knows...

Admin Commands

  • !ban Bans a player. Caution ! First user that contains the provided input will be banned. Usage !ban <Player Name>
  • !fade Evaporate a player. Usage !fade <Player name>
  • !godmode Ascend yourself. Be something selestial
  • !gold Set gold to a player. Usage !gold <Player Name> <amount>
  • !kick Kicks a player. Caution ! First user that contains the provided input will be kicked. Usage !kick <Player Name>
  • !kill Kills a provided username. Usage !kill <Player Name>
  • !tp Teleport yourself to another. Usage !tp <Target User>
  • !tptome Teleport player to you. Usage !tptome <Target User>
  • !unban Unbans a player. Usage !unban <Player Name>
  • !maps Lists available maps for the current, or a different, game type. !maps <game type>
  • !changemap Changes the map. Use !maps to see available map IDs. !chagemap <map id>
  • !mapfacs Changes the map and the team factions. !chagemapfacs <map id> <team1 faction> <team2 faction>
  • !mission Changes the game type, map, and factions. !mission <game type> <map id> <team1 faction> <team2 faction>
  • !bots Changes the number of bots for each factions. !bots <team1 bots> <team2 bots>
  • !id Returns your unique ID !id
  • !healme Healing yourself !healme
  • !heal Healing a player !heal <Player Name>
  • !healall Heal all players !healall

Login password is randomly generated, you can find the password under bin/Win64_ServerShipping/chatCommands.json and banlist is also in the same folder.

I want to create my own command.

Create a class that implements Command interface. And voila you have your own command. At the server startup it's automagically detects the Command implemented classes and appends it to registry. Lets examine an example.

namespace ChatCommands.Commands
{
    class GodMode : Command // This is our class that implements `Command` interface.
    {
        // Here you can define who can use this command.
        public bool CanUse(NetworkCommunicator networkPeer) 
        {
            bool isAdmin = false;
            // Check if the user is admin
            bool isExists = AdminManager.Admins.TryGetValue(networkPeer.VirtualPlayer.Id.ToString(), out isAdmin);
            return isExists && isAdmin;
        }
        
        // Define the command here. Note that mod only filters command that starts with `!`
        public string Command()
        {
            return "!godmode"; 
        }

        // Your command's description.
        public string Description()
        {
            return "Ascend yourself. Be something selestial"; 
        }

        // Execution phase of the command.
        public bool Execute(NetworkCommunicator networkPeer, string[] args)
        {
            // networkPeer: issuer of the command
            // args: arguments of the command.
            // If a user types `!godmode blabla` `args[0]` will be `blabla`
            if (networkPeer.ControlledAgent != null) {
                networkPeer.ControlledAgent.BaseHealthLimit = 2000;
                networkPeer.ControlledAgent.HealthLimit = 2000;
                networkPeer.ControlledAgent.Health = 2000;
                networkPeer.ControlledAgent.SetMinimumSpeed(10);
                networkPeer.ControlledAgent.SetMaximumSpeedLimit(10, false);
                
            }
            return true;
        }
    }
}

For more example you can check other commands.

If you want to contribute you can, if you want me to implement a command, please open up an issue.

License

MIT

Thanks to

  • Horns
  • Falcomfr

chatcommands's People

Contributors

falcomfr avatar hornsguy avatar mentalrob avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

chatcommands's Issues

Remove End Mission Delays

There are currently two ways that a mission change can be delayed:

  1. If a change is triggered during warmups, that is 30 seconds (MultiplayerWarmupComponent hard coded 30)
  2. There is hard coded 15 second end of round timer (MissionLobbyComponent static read only PostMatchWaitDuration )

These slow downs happen regardless of if you run the end_mission command or are doing things through chat commands

About Login as Admin

Hello I tried to use Config file for login as an admin but I don't know where to paste my ID can you help me pls :/

Latest Release is missing

Hey Mentalrob,

nice work.

The source code and the releases seem to be out of date.
Is there a reason for this?

Using with own mod

Hello,

Nice work !! I try to using with my own mod (simple Mod with SubModule.xml and SceneObj)
But i got this error:
image

Thank you !

Healing command

Hello,

It would be nice to add a command to heal one player or all players.

Thank you

Dll

Hey, how can we get the ChatCommands.dll because it is not in the installation file you give and i don't think it will work without it . Besides where do i must move your Chatcommands folder ?

!mission command

Hi,

Nice work !!! When using the !mission command if I'm on a siege and choose a battle map, it doesn't seem to work, only maps of the current type seem to be usable.

Thank you !

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.