Files
netease-modsdk-wiki/docs/mcdocs/1-ModAPI/接口/实体/经验球.md
2025-03-17 13:24:39 +08:00

71 lines
1.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
sidebarDepth: 1
---
# 经验球
## GetOrbExperience
<span style="display:inline;color:#ff5555">服务端</span>
method in mod.server.component.expCompServer.ExpComponentServer
- 描述
获取经验球的经验
- 参数
- 返回值
| <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- |
| int | 经验值,正整数。获取失败的情况下返回-1。 |
- 示例
```python
import mod.server.extraServerApi as serverApi
comp = serverApi.GetEngineCompFactory().CreateExp(entityId)
print(comp.GetOrbExperience())
```
## SetOrbExperience
<span style="display:inline;color:#ff5555">服务端</span>
method in mod.server.component.expCompServer.ExpComponentServer
- 描述
设置经验球经验
- 参数
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- | :--- |
| exp | int | 经验球经验 |
- 返回值
| <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- |
| bool | 设置是否成功 |
- 备注
- 设置经验球经验entityId是经验球的entityId,如果经验小于等于0拾取后不再加经验
- 示例
```python
import mod.server.extraServerApi as serverApi
comp = serverApi.GetEngineCompFactory().CreateExp(entityId)
comp.SetOrbExperience(25)
```