mrdev/lugo4php

Lugo Bots的PHP客户端

dev-main 2024-09-28 15:45 UTC

This package is auto-updated.

Last update: 2024-09-28 15:46:42 UTC


README

Lugo 4 PHP

用于创建Lugo Bots的PHP客户端

PRs welcome! contributors last update forks stars open issues license

Alt text


🌟 关于项目

Lugo4PHP是一个用PHP编写的包,用于连接Lugo Bots的服务器,隐藏了gRPC连接的复杂性,并提供了一些类和方法,帮助开发者创建自己的机器人。

🎯 功能

  • 连接到Lugo Bots的游戏服务器。
  • env类用于捕获变量和验证。
  • 对游戏类进行包装,以提供更强的类型。
  • 在Point和Vector2D等类中内置了常用方法,例如add()、scale()、subtract()、divide()等。
  • 在Player和Ball等类中内置了常用方法,例如$ball->distanceToPoint($point)、$ball->directionToPlayer($player)等。
  • 提供了各种快捷方式以实现更快速和清晰的访问,例如$inspector->getBallDirection()而不是$inspector->getBall()->getVelocity()->getDirection()。
  • 提供了生成命令的各种方法,例如$inspector->makeOrderLookAtDirection($direction)、$inspector->makeOrderMoveToRegion($region)、$inspector->makeOrderKickToPlayer($player)等。
  • 提供了重复的方法,可以选择抛出异常或返回null,例如$inspector->getMyPlayer(10)(如果玩家不存在则抛出错误)和$inspector->tryGetMyPlayer(10)(如果玩家不存在则返回null)。
  • 94%的代码由自动化测试覆盖,有助于添加新功能,同时降低破坏现有功能的风险。
  • 完全文档化,快速查找请访问:Lugo4php Docs

⚡ 使用方法

查看the-dummies-php,这是一个使用此包创建的机器人


🔧 开发

克隆项目

  git clone https://github.com/mauriciorobertodev/lugo4php.git

进入项目目录

  cd lugo4php

安装依赖

  composer install

使用BotTester运行测试游戏

  docker compose -f ./example/bot/docker-compose.yml up --remove-orphans

👋 贡献

欢迎贡献!

  1. 对项目进行forkhttps://github.com/mauriciorobertodev/lugo4php/fork
  2. 为您的修改创建一个branch(git checkout -b meu-novo-recurso)
  3. 执行commit(git commit -am '添加新功能...')
  4. 推送(git push origin meu-novo-recurso)
  5. 创建新的Pull Request



🔒 许可证

MIT许可证(MIT)。有关更多信息,请参阅许可证文件


🔗 有用链接

个人作品集:mauricioroberto.com/

项目链接:https://github.com/mauriciorobertodev/lugo4php

文档链接:https://lugo4php.mauricioroberto.com

the-dummies-php链接:https://github.com/mauriciorobertodev/the-dummies-php


💎 信用/认可


🔬 参考资料