node-csgo

授权协议 MIT License
开发语言 JavaScript
所属分类 Web应用开发、 常用JavaScript包
软件类型 开源软件
地区 不详
投 递 者 吴西岭
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

node-csgo

Need help? Don't open an issue - ask in the Gitter room.


A node-steam plugin for Counter-Strike: Global Offensive.

Based on node-dota2 by RJacksonm1

Used by

  • PopFlash - Alternative CS:GO matchmaking & PUG service.
  • CS:GO Stats - Detailed insights and statistics for competitive CS:GO

This list is getting too long. Wanna be on it? Message me on Gitter and we'll talk. - joshuaferrara

Requirements

  • node-steam
  • CS:GO must be purchased on the account you sign in with.

Initializing

Parameters:

  • steamUser - Pass a SteamUser instance to change your current status(In-game/not).
  • steamGC - Pass a SteamGameCoordinator instance to use to send & receive GC messages.
  • debug - A boolean noting whether to print information about operations to console.
var Steam = require('steam'),
    steamClient = new Steam.SteamClient(),
    steamUser = new Steam.SteamUser(steamClient),
    steamGC = new Steam.SteamGameCoordinator(steamClient, 730),
    csgo = require('csgo'),
    CSGO = new csgo.CSGOClient(steamUser, steamGC, false);

Methods

All methods require the SteamClient instance to be logged on.

CSGO

launch()

Reports to Steam that you're playing Counter-Strike: Global Offensive, and then initiates communication with the Game Coordinator.

exit()

Tells Steam that you are not playing CS:GO.

ToAccountID(steamId)

Converts a 64 bit steam ID to an account ID.

ToSteamID(accountId)

Converts an account ID to a 64 bit steam ID.

Rank.getString(int rank_id)

Converts an integer rank_id to a string. Ex: CSGO.Rank.getString(1) = "Silver I"

Level.getString(int player_level)

Converts an integer player_level to a string. Ex: CSGO.Level.getString(1) = "Recruit"

Matches

matchmakingStatsRequest()

Sends a message to the Game Coordinator requesting some matchmaking stats. Listen for the matchmakingStatsData event for the game coordinator's response. Requires the GC to be ready (listen for the ready event before calling).

requestRecentGames()

Requests a list of recent games for the currently logged in account. Listen for the matchList event for the game coordinator's response.

requestLiveGameForUser(accountId)

Requests current live game info for given user. Listen for the matchList event for the game coordinator's response.

requestGame(string matchid, string outcomeid, int token)

Requests info about game given a matchId, outcomeId, and token for a game (Tip: These can be found with the Sharecode decoder). Listen for the matchList event for the game coordinator's response.

requestWatchInfoFriends(arguments)

Requests watchable info for game.Arguments:

int request_id; //Not enough tests yet
account_ids[array_of_csgo_accounts];//Not enough tests yet
long serverid;//ServerID of match.
long matchid;//MatchID of match.

Example:

CSGO.requestWatchInfoFriends({
  serverid: new Long(-569600767, -2130640678, true).toString(),
  matchid: new Long(39, 719230023, true).toString()
});

Requirements: game should be live.

Listen for the watchList event for the game coordinator's response.

requestCurrentLiveGames()

Requests a list of current live games. Listen for the matchList event for the game coordinator's response.

Player Info

playerProfileRequest(accountId)

accountId is the player's account ID (A player's SteamID64 can be converted to an account ID with CSGO.ToAccountID(steamid)).

Requests a player's profile from the game coordinator. The player must be online and playing CS:GO. Listen for the playerProfile event for the game coordinator's response.

Rich Presence

Note: You cannot set your rich presence to arbitrary strings anymore. Rather, games now define a list of up to 20 rich presence values that can be displayed. See the SetRichPresence method in this documentation for more info.

richPresenceUpload(richPresenceObject)

Sets the rich presence object for the currently logged in user. Rich presence is Valve's solution to giving friends information on what you're doing in a game. For example, when you see information about another friends matchmaking game (as in, the map and score), this is set by using rich presence. An example of how to use this method can be found in example.js

Item Data

itemDataRequest(string s, string a, string d, string m)

Requests item data for the specified CSGO item inspect link parameters. The parameter s has a value when the inspect link is from an inventory; likewise, the parameter m has a value when the inspect link is from the market. If there is no value for a given parameter from the inspect link, set it to "0".

Listen for the itemData event for the game coordinator's response.

Example for an inventory inspect link for a CSGO item

// steam://rungame/730/76561202255233023/+csgo_econ_action_preview%20S76561198084749846A6768147729D12557175561287951743
CSGO.itemDataRequest("76561198084749846", "6768147729", "12557175561287951743", "0");

Example for a market inspect link for a CSGO item

// steam://rungame/730/76561202255233023/+csgo_econ_action_preview%20M563330426657599553A6710760926D9406593057029549017
CSGO.itemDataRequest("0", "6710760926", "9406593057029549017", "563330426657599553");

Sharecode Decoding/Encoding

new CSGO.SharecodeDecoder(string code);

Instantiates a SharecodeDecoder class to decode sharecodes.

Calling the decode() method of the SharecodeDecoder will return an object with the decoded information.

console.log(new CSGO.SharecodeDecoder("CSGO-U6MWi-hYFWJ-opPwD-JciHm-qOijD").decode())

{ matchId: '3106049990460440633',
  outcomeId: '3106056003414655216',
  tokenId: '11842' }

Events

ready

Emitted when the GC is ready to receive messages. Be careful not to declare anonymous functions as event handlers here, as you'll need to be able to invalidate event handlers on an unready event.

unready

Emitted when the connection status to the GC changes, and renders the library unavailable to interact. You should clear any event handlers set in the ready event here, otherwise you'll have multiple handlers for each message every time a new ready event is sent.

exited

Emitted when .exit() is called as a convenience for clearing handlers upon intentional exits.

itemData (itemDataResponse)

{ 
    "iteminfo":
   { 
        "accountid": null,
        "itemid": Long { "low": -1821786863, "high": 1, "unsigned": true },
        "defindex": 7,
        "paintindex": 474,
        "rarity": 6,
        "quality": 4,
        "paintwear": 1054492909,
        "paintseed": 183,
        "killeaterscoretype": null,
        "killeatervalue": null,
        "customname": null,
        "stickers": [],
        "inventory": 3221225475,
        "origin": 8,
        "questid": null,
        "dropreason": null,
        "floatvalue": 0.4263376295566559 
    }
}

Emitted when the game coordinator responds to the itemDataRequest method.

matchmakingStatsData (matchmakingStatsResponse)

  • matchmakingStatsResponse - Raw response object. Example response below.
{
    "account_id": 137013074,
    "ongoingmatch": {                                       // Only populated when logged in user is in a match
        "serverid": 90112014586923017,
        "direct_udp_ip": 2734604850,
        "direct_udp_port": 27035,
        "reservationid": 18374688715512210549,
        "reservation": {
            "game_type": 520,
            "match_id": 3245263802660290728,
            "tournament_event": null,
            "pre_match_data": null
        },
        "map": "de_dust2",
        "server_address": "=[A:1:153428969:9318]:0"
    },
    "global_stats": {
        "players_online": 423480,
        "servers_online": 132472,
        "players_searching": 4212,
        "servers_available": 65497,
        "ongoing_matches": 17016,
        "search_time_avg": 46530,
        "search_statistics": [
            {
                "game_type": 264,
                "search_time_avg": 128555,
                "players_searching": 148
            },
            {
                "game_type": 520,
                "search_time_avg": 31962,
                "players_searching": 1768
            },
            {
                "game_type": 1032,
                "search_time_avg": 122353,
                "players_searching": 426
            },
            {
                "game_type": 2056,
                "search_time_avg": 136133,
                "players_searching": 160
            },
            {
                "game_type": 4104,
                "search_time_avg": 62643,
                "players_searching": 1069
            },
            {
                "game_type": 8200,
                "search_time_avg": 70380,
                "players_searching": 563
            },
            {
                "game_type": 16392,
                "search_time_avg": 115923,
                "players_searching": 132
            },
            {
                "game_type": 32776,
                "search_time_avg": 54906,
                "players_searching": 1248
            },
            {
                "game_type": 65544,
                "search_time_avg": 116871,
                "players_searching": 183
            },
            {
                "game_type": 131080,
                "search_time_avg": 82308,
                "players_searching": 145
            },
            {
                "game_type": 262152,
                "search_time_avg": 209331,
                "players_searching": 105
            },
            {
                "game_type": 524296,
                "search_time_avg": 270376,
                "players_searching": 110
            },
            {
                "game_type": 1048584,
                "search_time_avg": 64499,
                "players_searching": 1020
            },
            {
                "game_type": 268435464,
                "search_time_avg": 84615,
                "players_searching": 642
            },
            {
                "game_type": 536870920,
                "search_time_avg": 104965,
                "players_searching": 478
            },
            {
                "game_type": 2097160,
                "search_time_avg": 198734,
                "players_searching": 228
            },
            {
                "game_type": 134217736,
                "search_time_avg": 147703,
                "players_searching": 203
            },
            {
                "game_type": 8388616,
                "search_time_avg": 538828,
                "players_searching": 138
            },
            {
                "game_type": 16777224,
                "search_time_avg": 232350,
                "players_searching": 192
            },
            {
                "game_type": 4194312,
                "search_time_avg": 237269,
                "players_searching": 151
            },
            {
                "game_type": 33554440,
                "search_time_avg": 203183,
                "players_searching": 181
            }
        ],
        "main_post_url": "",
        "required_appid_version": 13494,
        "pricesheet_version": 1438240620,
        "twitch_streams_version": 2,
        "active_tournament_eventid": 6,
        "active_survey_id": 0
    },
    "penalty_seconds": null,                                // Contains amount of time logged in account has an MM cooldown
    "penalty_reason": null,                                 // Integer representing reason for MM cooldown
    "vac_banned": 0,
    "ranking": {
        "account_id": 137013074,
        "rank_id": 11,
        "wins": 192,
        "rank_change": null
    },
    "commendation": {
        "cmd_friendly": 3,
        "cmd_teaching": 3,
        "cmd_leader": 3
    },
    "medals": {
        "medal_team": 0,
        "medal_combat": 0,
        "medal_weapon": 0,
        "medal_global": 0,
        "medal_arms": 0,
        "display_items_defidx": [],
        "featured_display_item_defidx": null
    },
    "my_current_event": null,
    "my_current_event_teams": [],
    "my_current_team": null,
    "my_current_event_stages": [],
    "survey_vote": null,
    "activity": null,
    "player_level": 3,
    "player_cur_xp": 327684342,
    "player_xp_bonus_flags": null
}

Emitted when the game coordinator responds to the matchmakingStatsRequest method.

playerProfile (Response to playerProfileRequest)

{
  "request_id": null,
  "account_profiles": [
    {
      "account_id": 137013074,
      "ongoingmatch": null,
      "global_stats": null,
      "penalty_seconds": null,
      "penalty_reason": null,
      "vac_banned": null,
      "ranking": {
        "account_id": 137013074,
        "rank_id": 11,
        "wins": 192,
        "rank_change": null
      },
      "commendation": {
        "cmd_friendly": 3,
        "cmd_teaching": 3,
        "cmd_leader": 3
      },
      "medals": {
        "medal_team": 0,
        "medal_combat": 0,
        "medal_weapon": 0,
        "medal_global": 0,
        "medal_arms": 0,
        "display_items_defidx": [],
        "featured_display_item_defidx": null
      },
      "my_current_event": null,
      "my_current_event_teams": [],
      "my_current_team": null,
      "my_current_event_stages": [],
      "survey_vote": null,
      "activity": null,
      "player_level": 3,
      "player_cur_xp": 327684342,
      "player_xp_bonus_flags": null
    }
  ]
}

Emitted when the game coordinator responds to the playerProfileRequest method.

matchList (Response to requestRecentGames)

The whole response ended up being too big for the readme and caused browsers to crash. Due to this, I've only included an excerpt as to what's returned.

{
          "reservationid": {
            "low": 65,
            "high": 715485165,
            "unsigned": true
          },
          "reservation": {
            "account_ids": [
              2879081,
              182261908,
              225695551,
              30039512,
              90132590,
              94815387,
              37671978,
              31906737,
              137013074,
              61347894
            ],
            "game_type": 1032,
            "match_id": null,
            "server_version": null,
            "rankings": [],
            "encryption_key": null,
            "encryption_key_pub": null,
            "party_ids": [],
            "whitelist": [],
            "tv_master_steamid": null,
            "tournament_event": null,
            "tournament_teams": [],
            "tournament_casters_account_ids": [],
            "tv_relay_steamid": null,
            "pre_match_data": null
          },
          "map": "http://replay124.valve.net/730/003072985384448163905_0699089210.dem.bz2",
          "round": null,
          "kills": [
            21,
            22,
            15,
            15,
            12,
            37,
            20,
            23,
            17,
            15
          ],
          "assists": [
            5,
            5,
            1,
            3,
            4,
            2,
            3,
            2,
            6,
            7
          ],
          "deaths": [
            22,
            22,
            24,
            23,
            21,
            13,
            13,
            19,
            20,
            20
          ],
          "scores": [
            55,
            54,
            40,
            39,
            37,
            79,
            65,
            59,
            41,
            37
          ],
          "pings": [],
          "round_result": null,
          "match_result": 2,
          "team_scores": [
            11,
            16
          ],
          "confirm": null,
          "reservation_stage": null,
          "match_duration": 2332,
          "enemy_kills": [
            21,
            22,
            15,
            15,
            12,
            37,
            20,
            23,
            17,
            15
          ],
          "enemy_headshots": [
            12,
            11,
            4,
            2,
            3,
            9,
            6,
            9,
            3,
            12
          ],
          "enemy_3ks": [],
          "enemy_4ks": [],
          "enemy_5ks": [],
          "mvps": [
            4,
            3,
            1,
            1,
            2,
            4,
            5,
            2,
            3,
            2
          ],
          "spectators_count": null,
          "spectators_count_tv": null,
          "spectators_count_lnk": null,
          "enemy_kills_agg": []
        }

Emitted when requestRecentGames, requestGame, requestLiveGameForUser, requestCurrentLiveGames is replied to.

watchList (Response to requestWatchInfoFriends)

Example:

{
  "request_id": 0,
  "account_ids": [],
  "watchable_match_infos": [
    {
      "server_ip": 2453839835,
      "tv_port": 28056,
      "tv_spectators": 1,
      "tv_time": 417,
      "tv_watch_password": {
        "buffer": {
          "type": "Buffer",
          "data": [ ]
        },
        "offset": 21,
        "markedOffset": -1,
        "limit": 53,
        "littleEndian": true,
        "noAssert": false
      },
      "cl_decryptdata_key": null,
      "cl_decryptdata_key_pub": {
        "low": -249571153,
        "high": 1941167002,
        "unsigned": true
      },
      "game_type": 32776,
      "game_mapgroup": "mg_de_mirage",
      "game_map": "de_mirage",
      "server_id": {
        "low": 2054631424,
        "high": 20977258,
        "unsigned": true
      },
      "match_id": {
        "low": 32,
        "high": 719254593,
        "unsigned": true
      },
      "reservation_id": null
    }
  ],
  "extended_timeout": null
}
  • 翻译如下:BeepIsla / CSGO推荐机器人 手表 31  星 160  货叉 82 码  第 17期  拉取请求 0  动作  安全  见解 解雇 立即加入GitHub GitHub是超过4000万开发人员的家园,他们共同致力于托管和审查代码,管理项目以及共同构建软件。 注册 NodeJS中的Commend / Report机器人 CSGO 表彰 机器人 老师 领导人 友好 报告 恶意破坏

  • scrapy获取网易buff饰品信息继上一次的版本,继续优化。 在后期的测试当中,发现无法实现断点续爬的功能,观察发现和我们自己设置的url有关系(自己挖的坑自己跳),具体部分的代码如下,arms.py文件中。 base_data['biglable_link'] = 'https://buff.163.com/api/market/goods?game=csgo&page_num=1&categ

  • 多校第9场第3题,一场比赛3个计算几何,甘版下风。 讲道理,看到题就知道是要转一圈,题目也规定了线段之间无相交,这也意味着以同一个点为中心,线段之间的遮挡关系是不变的,我们就可以通过维护当前角度上最近的线段,来判断某个点是否能被击中。 维护遮挡关系,可以直接比较他们与当前角度的射线的交点,到原点的距离,这里用了一些奇怪的方法来获得这个距离(这个方法只有在确定与射线有交点后才是正确的。 #inclu

  • 题目传送门 代码: #include<bits/stdc++.h> using namespace std; typedef long long LL; const int maxn=100000+100; struct Node{ int s; int x[5]; }a[maxn],b[maxn]; LL ma[35],mb[35]; int main(){ int T;

  • Description 武器分主武器和副武器,每种武器有固定分数 S S 和kk 个属性 x1,...,xk x 1 , . . . , x k ,每次只能选一个主武器和一个副武器,两者搭配的分数为两者固定分数之和加上每项属性差的绝对值,问最高分数搭配 Input 第一行一整数 T T 表示用例组数,每组用例首先输入三整数n,m,kn,m,k 表示主武器数量、副武器数量以及每种武器的属性数,之后

 相关资料
  • Node是kubernetes集群的工作节点,可以是物理机也可以是虚拟机。 Node的状态 Node包括如下状态信息: Address HostName:可以被kubelet中的--hostname-override参数替代。 ExternalIP:可以被集群外部路由到的IP地址。 InternalIP:集群内部使用的IP,集群外部无法访问。 Condition OutOfDisk:磁盘空间不足时

  • node 负责 peer node 子命令。

  • 这用于确定进程需要运行的节点的值。 由于分布式编程用于在不同节点上运行函数,因此在希望在不同机器上运行程序时,此功能非常有用。 语法 (Syntax) node() 参数 (Parameters) None 返回值 (Return Value) 这将返回本地节点的名称。 如果节点未分发,则返回nonode@nohost 。 例如 (For example) -module(helloworld)

  • The Po.et Node The Po.et Node allows you to timestamp documents in a decentralized manner. It's built on top of the Bitcoin blockchain and IPFS. Index The Po.et Node Index How to Run the Po.et Node De

  • Node-Lua是一款基于Lua实现的脚本和服务器引擎,它支持构建海量Lua服务(Context_Lua)并以多线程方式运行在多核服务器上,采用了任务多路复用的设计方案,有效利用了多核优势。node-lua致力于构建一个快速、简单易用的Lua脚本和服务器开发和运行环境。该引擎参考了Node-Js和Skynet的设计思想,并对其进行了整合和优化。 该引擎当前版本实现了以下特性: 引擎核心层同时支持同

  • 在程序里经常都需要生成一些特定格式的 id ,每种场合的需求都可能有些不一样,虽然写起来代码不复杂,但零零碎碎的东西做多了也挺烦的,于是设计了这个用于 node.js 的万能 ID 生成器。 AnyID 生成的 ID 为字符串(也可以纯数字),信息密度尽可能的高,也就是用最少的位数表示尽量多的信息。 AnyID 设计的首要考虑原则是 API 的直观易用。看看这些例子: 指定长度,随机值填充 21