tustin/cod-php

Call of Duty API 的 PHP API 包装器。

1.0 2018-11-26 22:44 UTC

This package is auto-updated.

Last update: 2024-09-29 04:43:27 UTC


README

Call of Duty 伴侣应用 API 的包装器。

用法

按照下面的代码示例拼接,以构建一个使用此库的工作示例。

登录

use CallOfDuty\Client;

$client = new Client();
// Use Activision email and password to login.
$client->login('me@email.com', 'pa55w0rd');

设置用户

// Username and platform the user plays on.
$user = $client->user('tustin25', 'psn');

黑 Ops 4

$bo4 = $user->blackOps4();
// Or alternatively
$bo4 = $user->bo4(); // Alias of blackOps4()

黑出

待办事项

多人游戏

待办事项

僵尸

$zm = $bo4->zombies();

// Spit out some user information
echo sprintf("Prestige %d, level %d\n", $zm->prestige(), $zm->level());
echo sprintf("\tKills - %d\n", $zm->lifetime()->kills());
echo sprintf("\tDowns - %d\n", $zm->lifetime()->downs());
echo sprintf("\tHeadshots - %d\n", $zm->lifetime()->headshots());

二战

待办事项

完整代码示例

<?php
require_once 'vendor/autoload.php';

use CallOfDuty\Client;

$client = new Client();
$client->login('me@email.com', 'pa55w0rd');

$zm = $client->user('tustin25', 'psn')->blackOps4()->zombies();

foreach ($zm->recentMatches() as $match) {
    echo sprintf(
        "%s - Round %d (%s)\n", 
        $match->map(),
        $match->roundReached(),
        $match->difficulty()
    );

    $stats = $match->playerStats();

    echo sprintf("\tKills - %d\n", $stats->kills());
    echo sprintf("\tDowns - %d\n", $stats->downs());
    echo sprintf("\tSpecialist Kills - %s\n", $stats->maxedSpecialWeaponKills());
}

echo sprintf("%s - Prestige %d, level %d\n", 'tustin25', $zm->prestige(), $zm->level());
echo sprintf("\tKills - %d\n", $zm->lifetime()->kills());
echo sprintf("\tDowns - %d\n", $zm->lifetime()->downs());
echo sprintf("\tHeadshots - %d\n", $zm->lifetime()->headshots());