ndarproj/agp-php

Axie基因解析工具

v1.1.2 2022-10-09 22:20 UTC

This package is auto-updated.

Last update: 2024-09-10 02:05:51 UTC


README

这是插件的JavaScript版本的一个端口,您可以在以下链接找到它: agp-npm

agp-php 是 Axie Infinity 的基因解析包。

agp 的名称代表 "Axie 基因解析器",它将 Axie 基因的十六进制表示形式解码为人类可读的格式。

要求

Composer,PHP 8.0 或更高版本。

安装

使用 Composer 进行安装

composer require ndarproj/agp-php

用法

要开始,您首先需要获取 Axie 的十六进制基因。您可以使用 Axie Infinity GraphQL 端点 获取此详细信息。在这个例子中,让我们使用十六进制 0x11c642400a028ca14a428c20cc011080c61180a0820180604233082

让我们从我们拥有的十六进制字符串创建一个 AxieGene 对象。

256位基因

use Ndarproj\AxieGeneParser\AxieGene;

$axieGene = new AxieGene(
    "0x11c642400a028ca14a428c20cc011080c61180a0820180604233082"
);

512位基因

use Ndarproj\AxieGeneParser\AxieGene;
use Ndarproj\AxieGeneParser\HexType;

$axieGene = new AxieGene(
    "0x280000000000010040412090830C0000000101942040440A00010190284082040001018C2061000A000101801021400400010180204080060001018418404008",
    HexType::Bit512
);

基因质量

您也可以直接通过 AxieGene 对象获取基因的质量。

$axieGene->getGeneQuality();

此对象会自动为您处理十六进制值的解析。您只需使用类的访问器即可获取您想要的基因信息。

以下是从 AxieGene 对象中可以获取的属性。

  • getGenes()
  • getCls()
  • getRegion()
  • getTag()
  • getBodySkin()
  • getPattern()
  • getColor()
  • getEyes()
  • getMouth()
  • getEars()
  • getHorn()
  • getBack()
  • getTail()