Skip to content
This repository has been archived by the owner on Feb 13, 2018. It is now read-only.

CoCSharp.Client.API Documentation

FICTURE7 edited this page Sep 30, 2015 · 2 revisions

Introduction

We are trying to make the plugin API intuitive and easy to use. Help to improve it by giving feedbacks,
it can't really do much at the moment. :]

The base class is the Plugin class. It is the class that contains all the properties and methods to write plugins.

Plugin Class

Description

Base class that every plugin should inherit from. It is an abstract class.
Source: CoCSharp.Client.API.Plugin

Properties

Name Type Description
Client ICoCClient Gets the main client class.
Name string Gets the name of the plugin.
Description string Gets the description of the plugin.
Author string Gets the author(s) of the plugin.

Methods

Modifier Name Description
virtual OnUpdate Called every 100ms.
virtual OnEnable Called when the plugin is enabled.
virtual OnDisable Called when the plugin is disabled.
virtual OnLoad Called when the plugin is loaded.
virtual OnUnload Called when the plugin is unloaded.

Note

A PluginException will be raised if you access the Client property beofore OnLoad method was called.

ICoCClient Interface

Description

Provides methods to for plugins to use.
Source: CoCSharp.Client.API.ICoCClient

Properties

Name Type Description
Connection Socket Gets or sets the Socket which is associated with this ICoCClient.
Home Village Gets or sets the Village which is associated with this ICoCClient.
Avatar Avatar Gets or sets the Avatar which is associated with this ICoCClient.
Fingerprint Fingerprint Gets or sets the Fingerprint which is associated with this ICoCClient.

Methods

Name Description
SendChatMessage Sends the specified message to the global chat.
SendPacket Sends the specified packet to the server.
RegisterPacketHandler Registers the specified PacketHandler with the specified packet type.

Events

Name Description
ChatMessage The event raised when a chat message is received.
Login The event raised when logged in successfully.

Note

Client property in Plugin class will be set after OnLoad method was called.