Ruben 的个人资料CruzAzul100 ™ MSN Messen...照片日志列表更多 工具 帮助

日志


4月22日

GameDesire (Manual Part 3)

4.11.     room_info_players

205RRRR2104091


room_info_players(gameId, roomId, short=0,access=’’)

 

That function is used to look for players playing at given room

gameId

That parameters describe game that we are interested in

roomId

Room number

short

Data returned by that function can be either in short of long form

access

If set we use access field from room configuration – when admins check is not checked only requests with valid access code will get extra data about admins in the room

Function return list of players at the tables.  Each player has state flag – 0 means player does not play, 1 –he.she play at one table, 2 he/she plays at two or more tables.

 

 

That function returns eg, for query room_info_players(game27,0,0)

 

 

room_info_players =
        {
                ret = 1
                count = 1
                tbl =
                {
                        0 =
                        {
                                name = wwylon1972
                                state = 0
                        }
                }
        }

 

And for for query: action= room_info_players(game27,0,1)

 

 room_info_players =
        {
                ret = 1
                count = 1
                tbl = 0 wwylon1972
        }

 

4.12.     player_results

player_results(player,gameId,ranking=0,ladder=0,short=0)

 

That function is used to look for player results. If game has ranking and ladder – you can retrieve ranking change for given player(user).

player

Login of player

gameId

That parameters describe game that we are interested in

ranking

Set tit to 1 to get ranking change

ladder

Set tit to 1 to get ladder change

short

Short format of returned ranking/ladder date

 

 

That function returns eg, for query room_info_players(game27,0,0)

player_results =
        {
                ret = 1
                tbl =
                {
                        RF =
                        {
                                desc = Rating
                                val = 0
                        }
                        games_completed =
                        {
                                desc = Games Completed
                                val = 0
                        }
                        games_abandoned =
                        {
                                desc = Games Abandoned
                                val = 0
                        }
                        wins =
                        {
                                desc = Wins
                                val = 0
                        }
                        loses =
                        {
                                desc = Loses
                                val = 0
                        }
                        streak =
                        {
                                desc = Streak
                                val = 0
                        }
                        max_break =
                        {
                                desc = Max Break
                                val = 0
                        }
                }
                ranking_count = 9
                ranking = 5034|5049|4987|4974|4961|4948|4948|4961|4948
                ladder_count = 9
                ladder = 3|3|3|3|3|3|3|2|3

 

 

 

 

 

4.13.     player_archive

player_archive(player,gameId, start=0,count=100)

 

That function is used to look for games played by player

player

Login of player

gameId

That parameters describe game that we are interested in

start

Start from that position

count

Get so much fields

 

 

That function returns eg, for player_archive(Object,game27,0,3)

 

player_archive =
        {
                ret = 1
                count = 3
                tbl =
                {
                        0 =
                        {
                                date_end = 2004-01-24 22:29:37
                                game_time = 14
                                login = Object;samuel
                                winner = 0;1
                                rating = 0;0
                                ladder = 0;0
                                rated_game = 0
                                end_mode = resign
                                max_break = 0;0
                                old_rating = 0;0
                                old_ladder = 0;0
                        }
                        1 =
                        {
                                date_end = 2004-01-24 22:26:47
                                game_time = 71
                                login = Object;bromba
                                winner = 0;1
                                rating = 0;0
                                ladder = 0;0
                                rated_game = 0
                                end_mode = resign
                                max_break = 0;1
                                old_rating = 0;0
                                old_ladder = 0;0
                        }
                        2 =
                        {
                                date_end = 2004-01-09 11:55:22
                                game_time = 124
                                login = Besti;Object
                                winner = 1;0
                                rating = 0;0
                                ladder = 0;0
                                rated_game = 0
                                end_mode = disconnect
                                max_break = 0;0
                                old_rating = 0;0
                                old_ladder = 0;0
                        }
                }
        }

 

 

4.14.     player_opponents

player_opponents(player,game,sort='',start=0,count=10,opponent='')

 

That function is used to look for player opponents.

player

Login of player

gameId

That parameters describe game that we are interested in

sort

How should we sort results

start

Start from that position

count

Get so much fields

opponent

Name of the opponent that we look for

W –        means wins

L -           means loses         

D -           means draws

 

 

That function returns eg, for player_opponents(Object,game22,,0,10)

player_opponents =
        {
                ret = 1
                count = 3
                start = 0
                tbl =
                {
                        0 =
                        {
                                login2 = bromba
                                w = 5
                                l = 1
                                d = 0
                        }
                        1 =
                        {
                                login2 = nexti
                                w = 1
                                l = 0
                                d = 0
                        }
                        2 =
                        {
                                login2 = samuel
                                w = 6
                                l = 24
                                d = 0
                        }
                }
        }

 

 

 

4.15.     private_room

 

Deprecated – not available


GameDesire (Manual Part 2)

4.6.           room_info

 

room_info(gameId,filter,fields,sort=’’)

 

Basic function to retrieve info about rooms for given game at the server

 

gameId

That parameters describe game that we are interested in

filter

That field will be used to limit searches to one kind of rooms.

Eg. we can fetch only rooms with admin. 

You can use following params: priv, admin, name of languages(eg. English), type of player, vip.

These options can be joined with |.! signs.

| - logical or eg. admin|priv will fetch data for private or rooms with admins.

! – logical not eg.!admin will fetch data for private or rooms with admins,

. – logical and eg admin.vip will return all games that are for vip and has admins.

 

Examples

 

Vip – vip rooms

!vip – remaining(not vip rooms)

 

private – private rooms

!private – not private (public) rooms

 

You can also add additional terms eg.

!private.vip – not private rooms for vip

!private.!vip – not private rooms for not vip (other players)

!private.!vip.admin – not private rooms for not vip with admin

!private.!vip.!admin – not private rooms for not vip without admin

 

You can go even further if you use |

Eg.

!private.vip.admin|private – not private rooms for vip with admin + all private rooms.

 

fields

That parameters describe games that we want to get. In that way we can optimize query. Available queries:

*

We should get all fields for rooms

All

We should get all fields for rooms

Id

Internal id for room

Name

Name of the room

Status

Status of the room – currently we have two flags that can appear here: admin and priv

Players

number of players at room

Max

max. number of players (there are cases that there is more than max number of players at room (reconnection of disconnected players)

 

 

Sort

Returned table can be sorted by different parameters (remember that only by one of returned parameters. Eg: When we sort game by players|name we will get data sorted first by number of players and then by name. If before sort field there is ! – we reverse sort. Eg.  !players|name will first sort descending by number of players and than by game name.

 

 

 

 

That function returns eg, for query room_info(game27,admin,*):

room_info =
        {
                ret = 1
                count = 4
                tbl =
                {
                        0 =
                        {
                                id = 0
                                name = Best Friends
                                status = admin
                                players = 2
                                max = 100
                        }
                        1 =
                        {
                                id = 1
                                name = Pool Party
                                status = admin
                                players = 0
                                max = 100
                        }
                        2 =
                        {
                                id = 2
                                name = The Deep End
                                status = admin
                                players = 0
                                max = 100
                        }
                        3 =
                        {
                                id = 3
                                name = Dust In The Wind
                                status = admin
                                players = 0
                                max = 100
                        }
                }
        }

 

 

4.7.           ranking

Ranking(gameId,secondary='',count=10,start=0,sortBy='')

 

That function retrieves info about ranking for one game

 

gameId

That parameters describe game that we are interested in

secondary

That parameter is used by some games:

·         In single word games it is used to select language,

·         In solitaires – to select variant,

·         In pinballs – to select mode

·         In jungle hunter – to select room

count

How many record do we want to retrieve

start

From that position we want to start

sortBy

Rankings for most games (except solitaires,pinballs and jungle hunter) can be sorted by different param. You can select here used param. Eg. if for snooker you will use RF – rankings will be sorted descending by ranking, if you use !RF – rankings will be sorted ascending by ranking.

 

That function returns both data and description for it.

 

 

That function returns eg, for query ranking(game4,0):

         ranking =
        {
                ret = 1
                desc =
                {
                        rating =
                        {
                                0 = R
                                1 = Rating
                        }
                        games_completed =
                        {
                                0 = GC
                                1 = Games Completed
                        }
                        games_abandoned =
                        {
                                0 = GA
                                1 = Games Abandoned
                        }
                        wins =
                        {
                                0 = W
                                1 = Wins
                        }
                        loses =
                        {
                                0 = L
                                1 = Loses
                        }
                }
                count = 3
                ranking =
                {
                        0 =
                        {
                                playerId = 372
                                login = Object
                                rating = 4991
                                games_completed = 6
                                games_abandoned = 1
                                wins = 0
                                loses = 6
                        }
                        1 =
                        {
                                playerId = 375
                                login = bromba
                                rating = 4984
                                games_completed = 1
                                games_abandoned = 1
                                wins = 0
                                loses = 1
                        }
                        2 =
                        {
                                playerId = 373
                                login = samuel
                                rating = 4935
                                games_completed = 6
                                games_abandoned = 4
                                wins = 5
                                loses = 1
                        }
                }
        }

 

 

4.8.           ranking_find

RankingFind(gameId,name,sortBy='')

 

That function is used to look for player at ranking page.

 

gameId

That parameters describe game that we are interested in

name

Name(login) of searched user.

sortBy

Rankings for most games (except solitaires,pinballs and jungle hunter) can be sorted by different param. You can select here used param. Eg. if for snooker you will use RF – rankings will be sorted descending by ranking, if you use !RF – rankings will be sorted ascending by ranking.

 

 

That function returns eg, for query action= ranking_find(game4,bromba)

 

        ranking_find =
        {
                ret = 1
                pos = 2
        }

 

 

 

4.9.           ladder

Deprecated – not available 

 

4.10.     ladder_find

 

Deprecated – not available


GameDesire (Manual)

GameDesire Interface

© Ganymede Technologies s.c.

ver. 2.07 2004-03-31

 

 

1.   Changes

 

Ver.2.08 – 2006-08-29

  • Changed room_info_players(game,room,short=0,access=’’) – now info about administration privilidges is exported

Ver.2.07- 2004-03-19

  • Added command room_info_players(game,room,short=0) - it returns player that are at rooms.
  • Added command player_results(player,game,ranking=0,ladder=0,short=0) – it gets results for player.
  • Added command player_archive(player,game,start=0,count=10) – it gets archived games for player.
  • Added command player_oponents(player,game,sort='',start=0,count=10,oponent='') – it gets opponents for player.
  • Added command private_room(game,room_name) - create private room.
  • Fixed problems with format for XML.
  • Limited length of user name (login) to 12 chars.

Ver.2.06

  • Added profiling – testing how fast given command happens.
  • Added mmcache support.

Ver.2.05

  • Added bank function. Added protection (passwd,IP) for vip function.
  • Remove type from register (you can use aff instead).

Ver.2.04

  • Changed params for ranking , ladder

Ver.2.03

  • New format of command register. Now if you want to register someone you need to provide passwd. Interface also check IP address that you use. Since now aff <2 are reserved, aff=2 is used for test purposes, aff>2 is used for our partners
  • Logout removed

Ver 2.01

  • Changed format of game_info and room_info, now you can filter params.

Ver.2.00

  • Added support for additional languages: Polish, German, Turkish, Danish, Dutch, Finnish, Portuguese, Slovenian, Swedish. Of course site have to yet translated to work with these languages…
  • New format of command register(nick,passwd[,type]) third parameter is used to distinguish between different types of users.
  • Added command vip(nick,expiration),
  • Added sorting parameters for room_info and game_info commands,
  • Added new commands ranking, ladder, ranking_find, ladder_find
  • Modified login system,
  • Status renamed to info. Status returns now some global parameters about games.

 

 

Ver.1.00

  • First version available

2.   Code integration

 

Basically there are some methods to integrate portal.

In order to help integration we prepared some additional code.

We wanted to keep it minimal and maximally functional. We intend to add some methods to fetch statistics for games (rankings/ladders etc/). If you think that something is missing – send us a note. If you want different format of exported data – also.

Basically we assume that that module can be used in two different modes.

a)       Serves should be able to get data from our servers and next generate pages from that data

b)       Clients (html files) should be able to generate (with javascript) pages.

 

 

 

3.   How to get data from servers

To get data from the servers you should use file:  interface.php

 

Eg:

http://server_addres.com/ interface.php?aff=2&mode=xml&action=game_info(game20,name|icon)

 

retrieve name and name of icon for the game that has internal number 20

 

 

Basically after the interface.php? following (separated by &) params can exist

 

Param

Description

Example

aff

Interface number (used to distinguish affiliate players and to gather statistics).

Caution number <2 are reserved for internal use. Number 2 is reserved for development (time to time all users created with that number will be delete from database. Numbers > 2 are for our partners.

aff=3

 

passwd

Interface password - necessary when user use register command

passwd= 6f683dbd31538752b6bb59c28bedb46d

lng

Change used language. Available languages:

  • English
  • German
  • Turkish
  • Danish
  • Dutch
  • Finnish
  • Portuguese
  • Slovenian
  • Swedish
  • Spanish
  • Russian

You can also use numeric values as used on GameDesire web site (Some of these languages are defined, but currently yet not available).

lng=german

mode

How the result of query are given back. Available formats:

  • html
  • xml
  • js
  • php
  • raw

If there will be any other format necessary please contact with us.

mode=js

action

 

It is used to query data – more detailed description below

action=game_info(game20,name|icon)

 

 

3.1.           Action param

As a parameter for action we have list of queries. Queries are separated by;

So valid parameters are:

game_info(game20,name|icon)

game_info(game20,name|icon);room_info(game20,*,*,*)

 

Each query has format:

ret:fun(params)

 

Ret

values that should keep the result of query – if omitted we use fun as the value to keep return from query

Fun

One of available functions for queries

params

params for function – they are separated by commas

 

3.2.           Password

Some commands are password and Ip protected:

  • Register,
  • VIP,
  • Bank

 

Eg.

http://www.gamedesire.com/interface.php?aff=2&passwd=6f683dbd31538752b6bb59c28bedb46d&action=register(wwylon,wwylonpassword)

 

In that case we check passwd. If passwd for aff is not valid = we raport error

We also check  IP addresses. If IP address of caller is different than set for aff number – we raport error.

 

3.3.           Profile

We added support for profiling – now you can test how long given calls executed. To get info place add profile=1 to url.

 

Eg.

http://www.gamedesire.com/interface.php?action=info()&aff=2&profile=1

  status =
        {
                ret = 1
                players = 0
        }
        profile =
        {
                time = 0.0432
        }                       

 

3.4.           MMCache

We added support for mmcache – results of some functions are cached in mmcache (PHP accelerator and cache). Eg. Results returned by function game_info. To disable cache for test purposes please use nocache directive.

Eg.

http://www.gamedesire.com/interface.php?aff=2&action=game_info(filter,fields,sort=’’)&nocache=1          

 

 

 

4.   Available functions

 

CAUTION!

Not all functions mentioned in that doc are available to every of our partners. Some of these functions are used internally and will not be available to any of our partners. Available functions are displayed by info.

 

4.1.           info

 

info()

 

it simply returns status of the module + list of available commands.

 

 

It returns (html format) eg.: for

action=info()

 info =
        {
                ret = 1
                name = Interface for GameDesire games
                copyrights = Ganymede Technologies s.c www.ganymede.com.pl
                www = www.gamedesire.com
                ver = 1.00
                commands =
                {
                        status = status() - returns status of module (eg. number of players for all games)
                        info = info() - returns info of module (eg. info about commands and version of software)
                        exist_nick = exist_nick(nick) - checks if nick exists
                        register = register(nick,passwd,,id=0) - registers new nick, (email, expiration are currently unused)
                        vip = vip(nick,expiration) - expiration: standard date format, it returns current vip date (so call it with 0 expiration date to get current one)
                        logout = logout(nick) - it logout nick
                        game_info = game_info(filter,fields,sort='') - it returns info about games; filter = name | id | group_name | type | all | *; fields = id | eng_name | name | desc | group | players | icon | is_help | screens | all | *; sort = list of fields
                        room_info = room_info(game,filter,fields,sort='') - it returns info about rooms for one game; filter = *|any|priv|admin|vip|ladder|type|lang; fields = id | name | status | players | max | all |*; sort = list of fields
                        ranking = ranking(gameId,secondary='',page=0,sortBy='') - it returns ranking;gameId (eg. game27 for snooker); secondary -secondary selector (for word games - language, for solitaires - solitaire type, etc.); page - page from start, each page has 10 positions; sortBy - which field should be used for sorting('!'sign reverse sorting
                        ranking_find = ranking_find(gameId,name,sortBy='')- it is used to look for player at ranking page;
                        ladder = ladder(gameId,page=0) - return position on ladder; gameId (eg. game27 for snooker); page - page from start, each page has 10 positions;
                        ladder_find = ladder_find(gameId,playerId) - it is used to look for player at ladder page;
                }
        }

 

 

 

 


4.2.           status

status()

 

Returns some global params about game site: currently only number of players on the site.

 

 

It returns (html format) eg.:

        status =
        {
                ret = 1
                players = 0
        }

 

 

 

 

4.3.           exist_nick

 

exist_nick(nick)

 

checks if nick exists – is registered

 

 

It returns (html format) eg.:

      exist_nick =
        {
                ret = 1
        }

 

 

 

 


4.4.           register

 

Deprecated – not available 

 

 


4.4.1.             vip

 

Deprecated – not available 

 

 

 

4.5.           game_info

 

game_info(filter,fields,sort=’’)        

 

Basic function to retrieve info about all games at the server

 

filter

That parameters describe games that we are interested in. One of following value can be used:

*

Function should return info about all games

all

Function should return info about all games

name

English name of the game (eg. bridge)

id

internal id of the game – eg. game27 means snooker

group

Filter for game group – in that way you can fetch games belonging to only one group

These options can be joined with |.! signs.

| - logical or eg. snooker|chess will fetch data for chess and snooker.

! – logical not eg.!pub will return all games that do not belong to pub group

. – logical and eg. !pub.single will return all games that are single player not pub games.

fields

That parameters describe games that we want to get. In that way we can optimize query. Available queries:

*

We should get all fields for selected games

all

We should get all fields for selected games

id

Internal Id of the game eg. for snooker we will get 27

eng_name

English name as can be used for range

name

Name of the game (that should be displayed)

desc

Description for the game

group

Groups for the game (separated with | sign)

players

Current number of players for given group

icon

String that should be used to fetch icons

is_help

Bool that describe if we have help of not.

screens

String that should be used to fetch screens from the game

start

String that should be used to start game

As in previous example these options can be joined with | sign.

Sort

Returned table can be sorted by different parameters (remember that only by one of returned parameters. Eg: When we sort game by players|name we will get data sorted first by number of players and then by name. If before sort field there is ! – we reverse sort. Eg.  !players|name will first sort descending by number of players and than by game name.

More details how to use that function you will find in point 3.

 

 

That function returns eg, for query action=game_info(game12|game27,name|start)

  game_info =
        {
                ret = 1
                count = 2
                tbl =
                {
                        0 =
                        {
                                name = Snooker
                                start = n|780|545|Snooker
                        }
                        1 =
                        {
                                name = Chess
                                start = n|680|545|Chess
                        }
                }
        }