Coowon Developer Center

Getting Started

Coowon browser is based on Google Chrome, thus the extension mechanism is the same as Chrome’s. It supports all the Chrome extension APIs and more than that, we have added some special APIs for web games. Generally speaking, to develop Coowon extensions, you need to be a Chrome extension developer or Javascript programmer first. Getting started with Chrome extension here ( http://developer.chrome.com/extensions/getstarted.html ).
To help you make some extensions easier, we have produced the CDT ( Coowon Developer Tool ) which can help you to make screen-shot, find image-snippet on tab page, lock tab size, record/play mouse clicks and keyboard strokes as script, edit the recording script and etc.
If you are neither a Chrome extension developer nor a Javascript programmer, but still are interested in making your own bot, you may choose CRP ( Coowon Record & Play ) . It can help you to make a simple bot with just simple logic.

Coowon extension APIs Reference

To help browser gamers play games more convenient, Coowon have added some extra browser extension APIs for game extension developers. All the Coowon APIs are in coowon namespace.

Types

ImageClip

properties of ImageClip
x ( integer )
The left bound of the rectangular area.
y ( integer )
The top bound of the rectangular area.
width ( integer )
The width of the rectangular area.
height ( integer )
The height of the rectangular area.

Properties

None.

Methods

getTabSizeZoom

coowon.getTabSizeZoom(integer tabId, function callback)

Gets the size and zoom level of a specified tab.

Parameters
tabId ( integer )
Specifies the tab to be measured.
callback ( function )
Callback

The callback parameter should specify a function that looks like this:

function(object details) {...};
details ( object )
tab_id ( integer )
Specifies which tab's size and zoom level is returned.
x_width ( integer )
Returns the new width of the tab.
y_height ( integer )
Returns the new height of the tab.
zoom_level ( integer )
Returns the new zoom level of the tab.

mouseClick

coowon.mouseClick(integer tabId, object details)

Simulates a mouse click at the specific tab page.

Parameters
tabId ( integer )
Specifies the tab to which the fake mouse click will be sent.
details ( object )
Encapsulates the details information of a mouse click.
event_id ( integer )
Windows message id, WM_MOUSEMOVE, WM_LBUTTONDOWN etc. The most frequently used messages are:
  512 ( WM_MOUSEMOVE)
  513 ( WM_LBUTTONDOWN )
  514 ( WM_LBUTTONUP )
  515 ( WM_LBUTTONDBLCLK )
For a whole list of Windows messages, see Microsoft official reference:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms645533(v=vs.85).aspx
wparam ( integer )
Every Windows message has its definition of wparam parameter. Generally it indicates some functional keys (Ctrl, Shift, etc) are pressing for mouse events. For example, wparam is 1 to indicate the left mouse button is down in WM_MOUSEMOVE or WM_LBUTTONDOWN
( http://msdn.microsoft.com/en-us/library/windows/desktop/ms645607(v=vs.85).aspx ).
Read the official document to confirm the value of wparam.
xpos ( integer )
The X coordinate for mouse events.
ypos ( integer )
Indicates the Y coordinate for mouse event.

keyboardPress

coowon.keyboardPress(integer tabId, object details)

Simulates a keyboard press at the specific tab page.

Parameters
tabId ( integer )
Specifies the tab to which the fake keyboard event will be sent.
details ( object )
Encapsulates the details information of a keyboard event.
event_id ( integer )
Windows message id, WM_KEYDOWN, WM_KEYUP, etc. The most frequently used messages are:
  256( WM_KEYDOWN )
  257( WM_WM_KEYUP )
For a whole list of Windows keyboard messages, see Microsoft official reference:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms645530(v=vs.85).aspx
wparam ( integer )
Every Windows message has its definition of wparam parameter. Generally it means the virtual key code for keyboard events. Read the official document to confirm the value of wparam.
xpos ( integer )
The repeat count for keybroard events.
ypos ( integer )
Indicates whether the key is an extended key, such as the right-hand ALT and CTRL keys for keyboard events.

inputText

coowon.inputText(integer tabId, object details)

Input some characters to a specific location in the web page.

Parameters
tabId ( integer )
Specifies the tab to which the text will be input.
details ( object )
Encapsulates the details information of a text input.
xpos ( integer )
The x coordinate of the location where the text should be input to.
ypos ( integer )
The y coordinate of the location where the text should be input to.
text ( string )
The text to be input.

setEpochTimer

coowon.setEpochTimer(integer timerId, function callback)

Set a timer to call back at a specified time. The time is a time-stamp from Epoch ( 1,1,1970 00:00 ). If the browser exits during the time, the time is canceled.

Parameters
timerId ( integer )
Specifies the ID of the timer.
callback ( function )
Callback

The callback parameter should specify a function that looks like this:

function(object details) {...};
details ( object )
timerId ( integer )
Returns which timer is due, corresponding to the timerId set before.
timer_event ( string )
Returns if the timer is due or some other exceptions. If the timer is due, the value is "TimerCallbackSuccess". Other values are for exceptions.

lockTabClientSize

coowon.lockTabClientSize(integer tabId, object details)

Lock the size of the tab page area. The tab size needs to be locked sometimes especially when a bot ( Automated Task ) is running.

Parameters
tabId ( integer )
The tab whose size should be locked.
details ( object )
Encapsulates the details information of the lock.
lock_or_not ( integer )
Specifies if this call is a locking or unlocking action. 1 for locking, 0 for unlocking.
xpos ( integer )
The width of the locking size. Not used when lock_or_not is 0.
ypos ( integer )
The height of the locking size. Not used when lock_or_not is 0.

captureImageClip

coowon.captureImageClip(object details)

Launches the screen capture utility and captures a rectangular area in the screenshot. The captured image will be returned through coowon.onImageClipCaptured event.

Parameters
details ( object )
Encapsulates the details information of how to capture the screenshot clip.
max_width ( optional integer )
The maximized width when capturing the screenshot.
max_height ( optional integer )
The maximized height when capturing the screenshot.

findImageClip

coowon.findImageClip(integer tabId, object details)

Try to find a specified image clip on a specified tab page. The searching result will be returned through coowon.onImageClipFound event.

Parameters
tabId ( integer )
The tab page on which the image clip will be searched.
details ( object )
Encapsulates the details information of the image searching.
operation_id ( integer )
User assigned ID which will be returned in the searching result to distinguish different searching calls.
image_data ( string )
Base64 encoded bitmap data of the image clip to find. Typically got by calling coowon.captureImageClip() method.
range_x ( optional integer )
The x coordinate of the searching range. The web-page area out of this range will not be searched. If this value is not set, the browser will search the entire visible part of the web-page, and invalidates the values of range_y, range_width and range_height.
range_y ( optional integer )
The y coordinate of the searching range. The web-page area out of this range will not be searched. If this value is not set, the browser will search the entire visible part of the web-page, and invalidates the values of range_x, range_width and range_height.
range_width ( optional integer )
The width of the searching range. The web-page area out of this range will not be searched. If this value is set to 0 or not set, the browser will search the entire visible part of the web-page, and invalidates the values of range_x, range_y and range_height.
range_height ( optional integer )
The height of the searching range. The web-page area out of this range will not be searched. If this value is set to 0 or not set, the browser will search the entire visible part of the web-page, and invalidates the values of range_x, range_y and range_width.
timeout ( optional integer )
Timeout of image clip searching in millisecond, -1 or not set means infinite.
max_count ( optional integer )
Count limit of the searching result occurrences, 0 indicates no limit (find all occurrences).

stopFindImageClip

coowon.stopFindImageClip(integer tabId, object details)

Cancel a call of coowon.findImageClip() method.

Parameters
tabId ( integer )
The tab on which the coowon.findImageClip() method was called.
details ( object )
Encapsulates the details information of the image searching.
operation_id ( integer )
Identifies the corresponding call of coowon.findImageClip() method.

Events

Coowon events is compatible with Google Chrome extension events. That means, besides addListener() method, you can also call the removeListener(), hasListener() and hasListeners() methods.

onInputEvent

coowon.onInputEvent.addListener(function(integer tabId, object details) {...});

Fired when a mouse button is clicked or a key is pressed.

Listener Parameters
tabId ( integer )
The tab page from where the input event was sent.
details ( object )
event_id ( integer )
Windows event message id, WM_KEYDOWN, WM_KEYUP, WM_LBUTTONDOWN etc.
wparam ( integer )
The virtual key code for a keyboard event, or if some other functional keys are pressing for mouse event. See
http://msdn.microsoft.com/en-us/library/windows/desktop/ms645607(v=vs.85).aspx
xpos ( integer )
The X coordinate for a mouse event, or repeat count for a keybroard event.
ypos ( integer )
The Y coordinate for a mouse event, or the indicates whether the key is an extended key, such as the right-hand ALT and CTRL keys for a keyboard event.

onTabResized

coowon.onTabResized.addListener(function(integer tabId, object details) {...});

Fired when a tab is resized.

Listener Parameters
tabId ( integer )
Identifies the tab page which is resized.
details ( object )
x_width ( integer )
The new width of the tab.
y_height ( integer )
The new height of the tab.

onTabZoomed

coowon.onTabZoomed.addListener(function(integer tabId, object details) {...});

Fired when a tab is zoomed.

Listener Parameters
tabId ( integer )
Identifies the tab page which is zoomed.
details ( object )
zoom_level ( integer )
The new zoom level of the tab.

onImageClipCaptured

coowon.onImageClipCaptured.addListener(function(object details) {...});

Fired when an image clip captured by coowon.captureImageClip() method.

Listener Parameters
details ( object )
x ( integer )
The x coordinate of the captured image clip.
y ( integer )
The y coordinate of the captured image clip.
width ( integer )
The width of the captured image clip.
height ( integer )
The height of the captured image clip.
image_data ( string )
Base64 encoded bitmap data of the captured image clip. To show base64 string as a picture is easy, just google it.

onImageClipFound

coowon.onImageClipFound.addListener(function(integer tabId, integer operation_id, array of ImageClip clips) {...});

Fired when an image clip found in tab page.

Listener Parameters
tabId ( integer )
The tab page from where the image clip was found.
operation_id ( integer )
Identifies the corresponding call of coowon.findImageClip() method.
clips ( array of ImageClip )
Returns an array of ImageClip objects that are found by coowon.findImageClip() method.

Install extensions on Coowon Dockbar

To add your extension on Coowon Cockbar, you need to add
"coowon": {
"location": "dockbar"
}
in your manifest.json file. The dockbar is designed for gamers so that they can control bots(Automated Tasks) more easily while they keep clicking on the game page. And the dockbar extension can be pinned so that it won’t disappear when it loses focus unlike the normal Chrome extensions.

Loading...