# Astrum For PUBG 开发指南

## **源码运行**

***

### **1. 开发环境**

Pycharm 2024.1.4

Python 3.10

### **2. 使用**

1. 前往 <https://www.astrumspace.top/download> 下载 Astrum For PUBG 源代码并解压
2. 安装项目所需要的依赖库（cmd到解压好的项目文件夹，输入pip install -r requirements.txt安装依赖库，具体步骤可自行百度）
3. 使用CMD或IDEA运行程序

{% code title="cmd到项目根目录" %}

```python
python Astrum_Pubg_Main.py
```

{% endcode %}

### **3. 分辨率适配**

#### **1. 修改截图区域**

打开文件中的Astrum\_Pubg\_Main.py

{% code title="Astrum\_Pubg\_Main.py" fullWidth="false" %}

```python
// 第43行
image = capture_and_save_screen_area(start_x, start_y, end_x, end_y)
```

{% endcode %}

(start\_x, start\_y) 为截图的起始坐标，也就是截图左上角顶点的坐标

(end\_x, end\_y) 为截图的结束坐标，也就是截图右下角顶点的坐标

这四个参数需要根据你电脑分辨率自行更改，使大地图能被截图区域覆盖即可

> 推荐先在游戏内N开着大地图截一张屏导入PS，再根据你选的起始坐标和结束坐标选出要截图的部分并保存，因为第三步还需要用这截图

示例：

<figure><img src="/files/lAj5NB9t5koWiLBNcIB1" alt="" width="563"><figcaption></figcaption></figure>

#### **2. 测量格长**

首先使用PS或者其他绘图软件测量地图上单个方块的长度

例图：

<figure><img src="/files/lZesacIBNL8RzXVrLMpg" alt=""><figcaption></figcaption></figure>

根据测量出的像素数可得一像素所代表的米数：100÷像素数

更改代码

{% code title="Astrum\_Pubg\_Main.py" %}

```python
// 第24行
proportion = 算出来的数，保留三位小数即可
```

{% endcode %}

#### **3. 修改玩家坐标**

在地图上绘制两条对角线（注意起点位置，别画歪了），两条线段的交点即为玩家坐标，测量出来即可

> 需要用你第一步**修改截图区域**的截图来测量玩家坐标，不然不准

<figure><img src="/files/lrYQLjh2XRuhdXq4wIVq" alt=""><figcaption></figcaption></figure>

得到坐标后修改下面两个变量的值，第一个是你测得的X坐标，第二个是Y坐标

{% code title="Astrum\_Pubg\_Main.py" %}

```python
// 第25行
player_Xcoord = 460
player_Ycoord = 460
```

{% endcode %}

#### **4. 修改窗口显示位置**

打开文件中的gui.py

{% code title="gui.py" %}

```python
// 第19行
self.setGeometry(0, 100, 3840, 2160)
```

{% endcode %}

第二个参数100是窗口距桌面底部的距离，设置为0的会导致任务栏消失，可以适当调低，但不建议设为0

第三个参数3840是你显示器横向分辨率，1080P就改成1080，2K改成2560，4K不用更改，但一些带鱼屏或不标准的屏幕需要你按照实际分辨率更改，上面仅供参考

第四个参数2160是你显示器纵向分辨率，与上面一条同理，自行更改

如想更改文字显示位置，请更改text\_x与text\_y

{% code title="gui.py" %}

```python
// 第24行
painter.setFont(QFont("Arial", 13, QFont.Bold)) # Arial是字体名称，13是字体大小
painter.setPen(QColor(255, 0, 0))  # RGB值，为文字颜色，当前255,0,0为红色

# 指定文字位置
text_x = 3300-25  # 文字X轴坐标 根据需要自行更改数值
text_y = 1230-110  # 文字Y轴坐标 根据需要自行更改数值

# 分割文本为多行
lines = self.text.split('\n')
line_height = 30  # 每行之间的高度，可以根据需要调整
```

{% endcode %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://astrum-3.gitbook.io/main/help/helplog/astrum-for-pubg-kai-fa-zhi-nan.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
