villermen / runescape-lookup-commons
A PHP library containing RuneScape lookup components.
v6.1.1
2025-02-05 22:12 UTC
Requires
- php: >=8.1
- ext-json: *
- symfony/css-selector: ^6.0||^7.0
- symfony/dom-crawler: ^6.0||^7.0
- symfony/http-client: ^6.0||^7.0
Requires (Dev)
- phpstan/phpstan: ^2.0
- phpunit/phpunit: ^10.5.40
- dev-master
- v6.1.1
- v6.1.0
- v6.0.2
- v6.0.1
- v6.0.0
- v5.2.0
- v5.1.2
- v5.1.1
- v5.1.0
- v5.0.0
- v4.2.4
- v4.2.3
- v4.2.2
- v4.2.1
- v4.2.0
- v4.1.5
- v4.1.4
- v4.1.3
- v4.1.2
- v4.1.1
- v4.1.0
- v4.0.0
- v3.0.0
- v2.0.2
- v2.0.1
- v2.0.0
- v1.3.1
- v1.3.0
- v1.2.2
- v1.2.1
- v1.2.0
- v1.1.1
- v1.1.0
- v1.0.0
- dev-osrs-activity-api-mapping
- dev-fix-osrs-combat-level
This package is auto-updated.
Last update: 2025-02-05 22:17:18 UTC
README
A PHP library containing RuneScape lookup components.
Features
- Fetch and compare RS3 and OSRS high scores.
- Alternatively for RS3, RuneMetrics can be used to obtain high scores and activity feed together. It may contain high score data even for non-member players, but lacks activity high scores.
- Fetch player activity feed via RuneMetrics or Adventurer's log.
- Calculate combat levels and virtual skill levels.
Installation
composer require villermen/runescape-lookup-commons
Usage
Create or obtain an instance of Player
and use it with the PlayerDataFetcher
service to obtain high scores and other
information.
use Villermen\RuneScape\HighScore\HighScoreSkill; use Villermen\RuneScape\HighScore\OsrsSkill; use Villermen\RuneScape\HighScore\Rs3HighScore; use Villermen\RuneScape\HighScore\Rs3Skill; use Villermen\RuneScape\Player; use Villermen\RuneScape\Service\PlayerDataFetcher; $fetcher = new PlayerDataFetcher(); // You can optionally provide your own HTTP client. $player = new Player('playername'); $rs3HighScore = $fetcher->fetchIndexLite($player, oldSchool: false); $mining = $rs3HighScore->getSkill(Rs3Skill::MINING); $mining->level; // 110 $mining->getVirtualLevel(); // 123 $mining->getXpToNextLevel(); // 1231231 $rs3HighScore->getSkill(Rs3Skill::NECROMANCY)->xp // null $rs3HighScore->getSkill(Rs3Skill::TOTAL)->rank; // 1200000 $rs3HighScore->getCombatLevel(includeSummoning: true); // 138 $osrsHighScore = $fetcher->fetchIndexLite($player, oldSchool: true); $osrsHighScore->getSkill(OsrsSkill::HITPOINTS)->getLevelOrMinimum(); // 10 $highScore1 = new Rs3HighScore(skills: [new HighScoreSkill( skill: Rs3Skill::ATTACK, rank: null, level: 24, xp: 7420, )], activities: []); $highScore2 = new Rs3HighScore(skills: [new HighScoreSkill( skill: Rs3Skill::ATTACK, rank: 2000000, level: 25, xp: 7840, )], activities: []); $comparison = $highScore1->compareTo($highScore2); $comparison->getLevelDifference(Rs3Skill::ATTACK); // -1 $comparison->getRankDifference(Rs3Skill::ATTACK); // null $comparison->getXpDifference(Rs3Skill::ATTACK); // 420 $runeMetrics = $fetcher->fetchRuneMetrics($player); $runeMetrics->displayName; // "PlayerName" $runeMetrics->highScore; // Rs3HighScore $runeMetrics->activityFeed->items[0]->title; // "Quest complete: Evil Dave's big day out" $adventurersLog = $fetcher->fetchAdventurersLog($player); $adventurersLog->displayName; // "PlayerName" $adventurersLog->activityFeed->items[0]->description; // "I somehow switched bodies with Evil Dave and survived enough chores and shouting from Doris to find a way to swap back!"