跳转至

Go:玩家

函数

PlayerByName

Go
func PlayerByName(name string) Player

这个名字的玩家。关于权限、金钱或归属的判断要用 PlayerByXuid:名字会换主人。

  • 参数:
    • name : string
  • 返回值类型:Player

PlayerByXuid

Go
func PlayerByXuid(xuid string) Player

这个 xuid 的玩家。

  • 参数:
    • xuid : string
  • 返回值类型:Player

PlayerByUuid

Go
func PlayerByUuid(uuid string) Player

这个 uuid 的玩家。

  • 参数:
    • uuid : string
  • 返回值类型:Player

Broadcast

Go
func Broadcast(msg string) error

给每个在线玩家发送一条消息。

ListPlayers

Go
func ListPlayers() ([]PlayerInfo, error)

列出在线玩家。解析不了的条目会被跳过,并记一条警告,所以一条坏数据不会让「谁在线」变得答不上来。

  • 返回值类型:([]PlayerInfo, error)
  • 对应槽位:list_players、log

ByName

Go
func ByName(name string) PlayerSel

按名字选择一名玩家。

  • 参数:
    • name : string
  • 返回值类型:PlayerSel

ByXuid

Go
func ByXuid(xuid string) PlayerSel

按 xuid 选择一名玩家。

  • 参数:
    • xuid : string
  • 返回值类型:PlayerSel

ByUuid

Go
func ByUuid(uuid string) PlayerSel

按 uuid 选择一名玩家。

  • 参数:
    • uuid : string
  • 返回值类型:PlayerSel

Player

Go
1
2
3
type Player struct {
    Sel PlayerSel
}

一名玩家,由选择器指定。它的大部分方法由 abi.h 的常量表生成,每个属性和动作一个;其余是手写的方法。

Player.Resolve

Go
func (p Player) Resolve() (Entity, error)

这名玩家对应的实体。返回错误表示没有人和选择器对得上。

Player.IsOnline

Go
func (p Player) IsOnline() bool

判断选择器是否对得上一名在线玩家。每个 ABI v2 宿主都有它用到的那个槽位,所以 false 就表示没有人对得上。

Player.SendMessage

Go
func (p Player) SendMessage(msg string) error

给这名玩家发送一行聊天消息。

Player.SendMessageTyped

Go
func (p Player) SendMessageTyped(msg string, kind int32) error

给这名玩家发送一条指定 TextPacket 类型的消息。

Player.SendTitle

Go
func (p Player) SendTitle(slot int32, text string, fadeIn, stay, fadeOut int32) error

显示一个标题:slot 为 0 是主标题,1 是副标题,2 是动作栏;时间的单位是刻。

  • 参数:
    • slot : int32
    • text : string
    • fadeIn : int32
    • stay : int32
    • fadeOut : int32
  • 返回值类型:error
  • 对应槽位:player_send_title

Player.Disconnect

Go
func (p Player) Disconnect(reason string) error

带着原因把这名玩家从服务器上移除。

Player.SetGameType

Go
func (p Player) SetGameType(mode int32) error

设置这名玩家的游戏模式,也就是 GameType 读到的那个值。

Player.Teleport

Go
func (p Player) Teleport(dim int32, x, y, z float64) error

把这名玩家移到任何已注册维度里的一个位置。

  • 参数:
    • dim : int32
    • x : float64
    • y : float64
    • z : float64
  • 返回值类型:error
  • 对应槽位:player_teleport

Player.CarriedItem

Go
func (p Player) CarriedItem() (Item, error)

这名玩家手里拿着的物品。

Player.InventoryItem

Go
func (p Player) InventoryItem(slot int32) (Item, error)

物品栏某一格里的物品。

  • 参数:
    • slot : int32
  • 返回值类型:(Item, error)
  • 对应槽位:player_get_item

Player.SetInventoryItem

Go
func (p Player) SetInventoryItem(slot int32, item Item) error

把一个物品放进物品栏的某一格。

  • 参数:
    • slot : int32
    • item : Item
  • 返回值类型:error
  • 对应槽位:player_set_item

Player.ConnID

Go
func (p Player) ConnID() (uint64, error)

这名玩家的网络连接 id。

Player.Inventory

Go
func (p Player) Inventory() Container

把这名玩家的物品栏当作容器。

  • 返回值类型:Container

Player.EnderChest

Go
func (p Player) EnderChest() Container

把这名玩家的末影箱当作容器。

  • 返回值类型:Container

Player.Armor

Go
func (p Player) Armor() Container

把这名玩家的盔甲栏当作容器。

  • 返回值类型:Container

Player.Offhand

Go
func (p Player) Offhand() Container

把这名玩家的副手栏当作容器。

  • 返回值类型:Container

Player.GameType

Go
func (p Player) GameType() (float64, error)

读取 PIER_PPROP_GAME_TYPE:(G) Player::getPlayerGameType;写入用 player_set_gamemode

Player.Level

Go
func (p Player) Level() (float64, error)

读取 PIER_PPROP_LEVEL:(S) 属性 Player::LEVEL()

Player.SetLevel

Go
func (p Player) SetLevel(v float64) error

写入 PIER_PPROP_LEVEL:(S) 属性 Player::LEVEL()

  • 参数:
    • v : float64
  • 返回值类型:error
  • 对应槽位:player_set_num

Player.Experience

Go
func (p Player) Experience() (float64, error)

读取 PIER_PPROP_EXPERIENCE:(S) 属性 Player::EXPERIENCE()(经验条进度,0 到 1)

Player.SetExperience

Go
func (p Player) SetExperience(v float64) error

写入 PIER_PPROP_EXPERIENCE:(S) 属性 Player::EXPERIENCE()(经验条进度,0 到 1)

  • 参数:
    • v : float64
  • 返回值类型:error
  • 对应槽位:player_set_num

Player.Hunger

Go
func (p Player) Hunger() (float64, error)

读取 PIER_PPROP_HUNGER:(S) 属性 Player::HUNGER()

Player.SetHunger

Go
func (p Player) SetHunger(v float64) error

写入 PIER_PPROP_HUNGER:(S) 属性 Player::HUNGER()

  • 参数:
    • v : float64
  • 返回值类型:error
  • 对应槽位:player_set_num

Player.Saturation

Go
func (p Player) Saturation() (float64, error)

读取 PIER_PPROP_SATURATION:(S) 属性 Player::SATURATION()

Player.SetSaturation

Go
func (p Player) SetSaturation(v float64) error

写入 PIER_PPROP_SATURATION:(S) 属性 Player::SATURATION()

  • 参数:
    • v : float64
  • 返回值类型:error
  • 对应槽位:player_set_num

Player.Exhaustion

Go
func (p Player) Exhaustion() (float64, error)

读取 PIER_PPROP_EXHAUSTION:(S) 属性 Player::EXHAUSTION()

Player.SetExhaustion

Go
func (p Player) SetExhaustion(v float64) error

写入 PIER_PPROP_EXHAUSTION:(S) 属性 Player::EXHAUSTION()

  • 参数:
    • v : float64
  • 返回值类型:error
  • 对应槽位:player_set_num

Player.XpNeededNextLevel

Go
func (p Player) XpNeededNextLevel() (float64, error)

读取 PIER_PPROP_XP_NEEDED_NEXT_LEVEL:(G) Player::getXpNeededForNextLevel

Player.Luck

Go
func (p Player) Luck() (float64, error)

读取 PIER_PPROP_LUCK:(G) Player::getLuck

Player.SelectedSlot

Go
func (p Player) SelectedSlot() (float64, error)

读取 PIER_PPROP_SELECTED_SLOT:(G) Player::getSelectedItemSlot;设置用 PIER_PACT_SET_SELECTED_SLOT

Player.IsOperator

Go
func (p Player) IsOperator() (bool, error)

读取 PIER_PPROP_IS_OPERATOR:(G) Player::isOperator

Player.CanUseOperatorBlocks

Go
func (p Player) CanUseOperatorBlocks() (bool, error)

读取 PIER_PPROP_CAN_USE_OPERATOR_BLOCKS:(G) Player::canUseOperatorBlocks

Player.IsFlying

Go
func (p Player) IsFlying() (bool, error)

读取 PIER_PPROP_IS_FLYING:(G) Player::isFlying

Player.CanJump

Go
func (p Player) CanJump() (bool, error)

读取 PIER_PPROP_CAN_JUMP:(G) Player::canJump

Player.IsEmoting

Go
func (p Player) IsEmoting() (bool, error)

读取 PIER_PPROP_IS_EMOTING:(G) Player::isEmoting

Player.IsInRaid

Go
func (p Player) IsInRaid() (bool, error)

读取 PIER_PPROP_IS_IN_RAID:(G) Player::isInRaid

Player.IsHurt

Go
func (p Player) IsHurt() (bool, error)

读取 PIER_PPROP_IS_HURT:(G) Player::isHurt

Player.IsScoping

Go
func (p Player) IsScoping() (bool, error)

读取 PIER_PPROP_IS_SCOPING:(G) Player::isScoping

Player.CanSleep

Go
func (p Player) CanSleep() (bool, error)

读取 PIER_PPROP_CAN_SLEEP:(G) Player::canSleep

Player.HasRespawnPosition

Go
func (p Player) HasRespawnPosition() (bool, error)

读取 PIER_PPROP_HAS_RESPAWN_POSITION:(G) Player::hasRespawnPosition

Player.ClientSubId

Go
func (p Player) ClientSubId() (float64, error)

读取 PIER_PPROP_CLIENT_SUB_ID:(G) Player::getClientSubId

Player.CanUseAbility

Go
func (p Player) CanUseAbility() (bool, error)

读取 PIER_PPROP_CAN_USE_ABILITY:(G) Player::canUseAbility;能力编号要经 player_action 的读取路径传入,见 PIER_PACT_CAN_USE_ABILITY

Player.Direction

Go
func (p Player) Direction() (float64, error)

读取 PIER_PPROP_DIRECTION:(G) Player::getDirection(0=南,1=西,2=北,3=东)

Player.ChunkRadius

Go
func (p Player) ChunkRadius() (float64, error)

读取 PIER_PPROP_CHUNK_RADIUS:(G) Player::getChunkRadius

Player.NetworkRtt

Go
func (p Player) NetworkRtt() (float64, error)

读取 PIER_PPROP_NETWORK_RTT:(G) getNetworkStatus().mPing(毫秒)

Player.Platform

Go
func (p Player) Platform() (float64, error)

读取 PIER_PPROP_PLATFORM:(G) Player::getPlatform

Player.EnchantmentSeed

Go
func (p Player) EnchantmentSeed() (float64, error)

读取 PIER_PPROP_ENCHANTMENT_SEED:(G) Player::getEnchantmentSeed

Player.IsUsingItem

Go
func (p Player) IsUsingItem() (bool, error)

读取 PIER_PPROP_IS_USING_ITEM:(G) Player::isUsingItem

Player.IsBlocking

Go
func (p Player) IsBlocking() (bool, error)

读取 PIER_PPROP_IS_BLOCKING:(G) Player::isBlocking

Player.IsGliding

Go
func (p Player) IsGliding() (bool, error)

读取 PIER_PPROP_IS_GLIDING:(G) Player::isGliding

Player.IsSwimming

Go
func (p Player) IsSwimming() (bool, error)

读取 PIER_PPROP_IS_SWIMMING:(G) Player::isSwimming

Player.PermissionLevel

Go
func (p Player) PermissionLevel() (float64, error)

读取 PIER_PPROP_PERMISSION_LEVEL:(G) Player::getPlayerPermissionLevel

Player.Score

Go
func (p Player) Score() (float64, error)

读取 PIER_PPROP_SCORE:(G) Player::getScore

Player.FallDistance

Go
func (p Player) FallDistance() (float64, error)

读取 PIER_PPROP_FALL_DISTANCE:(G) Actor::getFallDistance

Player.IsDead

Go
func (p Player) IsDead() (bool, error)

读取 PIER_PPROP_IS_DEAD:(G) Actor::isDead

Player.HasDiedBefore

Go
func (p Player) HasDiedBefore() (bool, error)

读取 PIER_PPROP_HAS_DIED_BEFORE:(G) Player::hasDiedBefore

Player.Dimension

Go
func (p Player) Dimension() (float64, error)

读取 PIER_PPROP_DIMENSION:(G) Actor::getDimensionId

Player.RealName

Go
func (p Player) RealName() (string, error)

读取 PIER_PSTR_REAL_NAME:取自 Player::getRealName

Player.Uuid

Go
func (p Player) Uuid() (string, error)

读取 PIER_PSTR_UUID:取自 Player::getUuid().asString()

Player.Xuid

Go
func (p Player) Xuid() (string, error)

读取 PIER_PSTR_XUID:取自 Player::getXuid

Player.IpAndPort

Go
func (p Player) IpAndPort() (string, error)

读取 PIER_PSTR_IP_AND_PORT:取自 Player::getIPAndPort

Player.LocaleCode

Go
func (p Player) LocaleCode() (string, error)

读取 PIER_PSTR_LOCALE_CODE:取自 Player::getLocaleCode

Player.NameTag

Go
func (p Player) NameTag() (string, error)

读取 PIER_PSTR_NAME_TAG:取自 Actor::getNameTag(显示名)

Player.LastDeathPos

Go
func (p Player) LastDeathPos() (string, error)

读取 PIER_PSTR_LAST_DEATH_POS:SNBT {x,y,z};没有时为 ""

Player.LastDeathDimension

Go
func (p Player) LastDeathDimension() (string, error)

读取 PIER_PSTR_LAST_DEATH_DIMENSION:维度 id,以字符串表示

Player.NetworkStatus

Go
func (p Player) NetworkStatus() (string, error)

读取 PIER_PSTR_NETWORK_STATUS:SNBT {ping,avg_ping,packet_loss,max_ping}

Player.PlatformOnlineId

Go
func (p Player) PlatformOnlineId() (string, error)

读取 PIER_PSTR_PLATFORM_ONLINE_ID:取自 Player::getPlatformOnlineId

Player.RespawnPos

Go
func (p Player) RespawnPos() (string, error)

读取 PIER_PSTR_RESPAWN_POS:SNBT {x,y,z,dim}:这名玩家会在哪里重生。不会为空:没有床的玩家报告的是世界出生点,这两种情况区分不开。

Player.SetAbility

Go
func (p Player) SetAbility(sarg string, a, b, c float64) (string, error)

执行 PIER_PACT_SET_ABILITY:a 为 AbilitiesIndex,b 为 0 或 1(布尔类的能力)或者浮点数(FlySpeed 等)。写完以后会把 PlayerPermissionLevel 恢复成写之前的值:引擎的 LayeredAbilities::setAbility 走的是「切换到自定义权限」那条路,会把玩家推到 Custom,而这个等级会和能力层一起放进 UpdateAbilitiesPacket 发给客户端。要改权限等级,用 PIER_PACT_SET_PERMISSION_LEVEL。玩家加入完成之前(Player::isPlayerInitialized)调用会被拒绝,返回 false:客户端还在加载时写入的能力会一直不同步,直到玩家重新进入。模拟玩家不受这个限制。

这个动作有输出时,输出就是返回值;每个参数的含义写在 abi.h 里这个常量的注释中。

  • 参数:
    • sarg : string
    • a : float64
    • b : float64
    • c : float64
  • 返回值类型:(string, error)
  • 对应槽位:player_action

Player.CanUseAbilityAction

Go
func (p Player) CanUseAbilityAction(sarg string, a, b, c float64) (string, error)

执行 PIER_PACT_CAN_USE_ABILITY:a 为 AbilitiesIndex,输出 "0" 或 "1",调用 Player::canUseAbility

这个动作有输出时,输出就是返回值;每个参数的含义写在 abi.h 里这个常量的注释中。

  • 参数:
    • sarg : string
    • a : float64
    • b : float64
    • c : float64
  • 返回值类型:(string, error)
  • 对应槽位:player_action

Player.SetSelectedSlot

Go
func (p Player) SetSelectedSlot(sarg string, a, b, c float64) (string, error)

执行 PIER_PACT_SET_SELECTED_SLOT:a 为槽位,调用 Player::setSelectedSlot

这个动作有输出时,输出就是返回值;每个参数的含义写在 abi.h 里这个常量的注释中。

  • 参数:
    • sarg : string
    • a : float64
    • b : float64
    • c : float64
  • 返回值类型:(string, error)
  • 对应槽位:player_action

Player.GiveItem

Go
func (p Player) GiveItem(sarg string, a, b, c float64) (string, error)

执行 PIER_PACT_GIVE_ITEM:sarg 为物品 SNBT,经 ItemStack::fromTag 和 Player::addAndRefresh 给出

这个动作有输出时,输出就是返回值;每个参数的含义写在 abi.h 里这个常量的注释中。

  • 参数:
    • sarg : string
    • a : float64
    • b : float64
    • c : float64
  • 返回值类型:(string, error)
  • 对应槽位:player_action

Player.SetSpawnPoint

Go
func (p Player) SetSpawnPoint(sarg string, a, b, c float64) (string, error)

执行 PIER_PACT_SET_SPAWN_POINT:a、b、c 为坐标,sarg 为维度 id(任何已注册的维度都可以);原生调用 Player::setRespawnPosition

这个动作有输出时,输出就是返回值;每个参数的含义写在 abi.h 里这个常量的注释中。

  • 参数:
    • sarg : string
    • a : float64
    • b : float64
    • c : float64
  • 返回值类型:(string, error)
  • 对应槽位:player_action

Player.ClearTitle

Go
func (p Player) ClearTitle(sarg string, a, b, c float64) (string, error)

执行 PIER_PACT_CLEAR_TITLE:原生发送 SetTitlePacket(Clear)

这个动作有输出时,输出就是返回值;每个参数的含义写在 abi.h 里这个常量的注释中。

  • 参数:
    • sarg : string
    • a : float64
    • b : float64
    • c : float64
  • 返回值类型:(string, error)
  • 对应槽位:player_action

Player.SetTitle

Go
func (p Player) SetTitle(sarg string, a, b, c float64) (string, error)

执行 PIER_PACT_SET_TITLE:sarg 为文本,a 为位置(0 主标题,1 副标题,2 动作栏);原生发送 SetTitlePacket,文本原样发送

这个动作有输出时,输出就是返回值;每个参数的含义写在 abi.h 里这个常量的注释中。

  • 参数:
    • sarg : string
    • a : float64
    • b : float64
    • c : float64
  • 返回值类型:(string, error)
  • 对应槽位:player_action

Player.AddExperience

Go
func (p Player) AddExperience(sarg string, a, b, c float64) (string, error)

执行 PIER_PACT_ADD_EXPERIENCE:a 为经验值,调用 Player::addExperience

这个动作有输出时,输出就是返回值;每个参数的含义写在 abi.h 里这个常量的注释中。

  • 参数:
    • sarg : string
    • a : float64
    • b : float64
    • c : float64
  • 返回值类型:(string, error)
  • 对应槽位:player_action

Player.AddLevels

Go
func (p Player) AddLevels(sarg string, a, b, c float64) (string, error)

执行 PIER_PACT_ADD_LEVELS:a 为等级数,调用 Player::addLevels

这个动作有输出时,输出就是返回值;每个参数的含义写在 abi.h 里这个常量的注释中。

  • 参数:
    • sarg : string
    • a : float64
    • b : float64
    • c : float64
  • 返回值类型:(string, error)
  • 对应槽位:player_action

Player.StartCooldown

Go
func (p Player) StartCooldown(sarg string, a, b, c float64) (string, error)

执行 PIER_PACT_START_COOLDOWN:sarg 为物品名,a 为刻数,调用 Player::startItemCooldown

这个动作有输出时,输出就是返回值;每个参数的含义写在 abi.h 里这个常量的注释中。

  • 参数:
    • sarg : string
    • a : float64
    • b : float64
    • c : float64
  • 返回值类型:(string, error)
  • 对应槽位:player_action

Player.StartRiding

Go
func (p Player) StartRiding(sarg string, a, b, c float64) (string, error)

执行 PIER_PACT_START_RIDING:a 为坐骑的 ActorUniqueID(低 64 位),调用 Player::startRiding

这个动作有输出时,输出就是返回值;每个参数的含义写在 abi.h 里这个常量的注释中。

  • 参数:
    • sarg : string
    • a : float64
    • b : float64
    • c : float64
  • 返回值类型:(string, error)
  • 对应槽位:player_action

Player.StopRiding

Go
func (p Player) StopRiding(sarg string, a, b, c float64) (string, error)

执行 PIER_PACT_STOP_RIDING:调用 Player::stopRiding

这个动作有输出时,输出就是返回值;每个参数的含义写在 abi.h 里这个常量的注释中。

  • 参数:
    • sarg : string
    • a : float64
    • b : float64
    • c : float64
  • 返回值类型:(string, error)
  • 对应槽位:player_action

Player.Attack

Go
func (p Player) Attack(sarg string, a, b, c float64) (string, error)

执行 PIER_PACT_ATTACK:a 为目标的 ActorUniqueID(低 64 位),调用 Player::attack

这个动作有输出时,输出就是返回值;每个参数的含义写在 abi.h 里这个常量的注释中。

  • 参数:
    • sarg : string
    • a : float64
    • b : float64
    • c : float64
  • 返回值类型:(string, error)
  • 对应槽位:player_action

Player.Drop

Go
func (p Player) Drop(sarg string, a, b, c float64) (string, error)

执行 PIER_PACT_DROP:sarg 为物品 SNBT,a 为是否随机抛出(0 或 1),调用 Player::drop

这个动作有输出时,输出就是返回值;每个参数的含义写在 abi.h 里这个常量的注释中。

  • 参数:
    • sarg : string
    • a : float64
    • b : float64
    • c : float64
  • 返回值类型:(string, error)
  • 对应槽位:player_action

Player.Interact

Go
func (p Player) Interact(sarg string, a, b, c float64) (string, error)

执行 PIER_PACT_INTERACT:a 为目标的 ActorUniqueID,调用 Player::interact

这个动作有输出时,输出就是返回值;每个参数的含义写在 abi.h 里这个常量的注释中。

  • 参数:
    • sarg : string
    • a : float64
    • b : float64
    • c : float64
  • 返回值类型:(string, error)
  • 对应槽位:player_action

Player.StartUsingItem

Go
func (p Player) StartUsingItem(sarg string, a, b, c float64) (string, error)

执行 PIER_PACT_START_USING_ITEM:sarg 为物品 SNBT,a 为持续时间,调用 Player::startUsingItem

这个动作有输出时,输出就是返回值;每个参数的含义写在 abi.h 里这个常量的注释中。

  • 参数:
    • sarg : string
    • a : float64
    • b : float64
    • c : float64
  • 返回值类型:(string, error)
  • 对应槽位:player_action

Player.StopUsingItem

Go
func (p Player) StopUsingItem(sarg string, a, b, c float64) (string, error)

执行 PIER_PACT_STOP_USING_ITEM:调用 Player::stopUsingItem

这个动作有输出时,输出就是返回值;每个参数的含义写在 abi.h 里这个常量的注释中。

  • 参数:
    • sarg : string
    • a : float64
    • b : float64
    • c : float64
  • 返回值类型:(string, error)
  • 对应槽位:player_action

Player.SetChunkRadius

Go
func (p Player) SetChunkRadius(sarg string, a, b, c float64) (string, error)

执行 PIER_PACT_SET_CHUNK_RADIUS:a 为半径,调用 Player::setChunkRadius

这个动作有输出时,输出就是返回值;每个参数的含义写在 abi.h 里这个常量的注释中。

  • 参数:
    • sarg : string
    • a : float64
    • b : float64
    • c : float64
  • 返回值类型:(string, error)
  • 对应槽位:player_action

Player.SetEnchantmentSeed

Go
func (p Player) SetEnchantmentSeed(sarg string, a, b, c float64) (string, error)

执行 PIER_PACT_SET_ENCHANTMENT_SEED:a 为种子,调用 Player::setEnchantmentSeed

这个动作有输出时,输出就是返回值;每个参数的含义写在 abi.h 里这个常量的注释中。

  • 参数:
    • sarg : string
    • a : float64
    • b : float64
    • c : float64
  • 返回值类型:(string, error)
  • 对应槽位:player_action

Player.RegisterTrackedBoss

Go
func (p Player) RegisterTrackedBoss(sarg string, a, b, c float64) (string, error)

执行 PIER_PACT_REGISTER_TRACKED_BOSS:a 为 Boss 的 ActorUniqueID,调用 Player::registerTrackedBoss

这个动作有输出时,输出就是返回值;每个参数的含义写在 abi.h 里这个常量的注释中。

  • 参数:
    • sarg : string
    • a : float64
    • b : float64
    • c : float64
  • 返回值类型:(string, error)
  • 对应槽位:player_action

Player.UnregisterTrackedBoss

Go
func (p Player) UnregisterTrackedBoss(sarg string, a, b, c float64) (string, error)

执行 PIER_PACT_UNREGISTER_TRACKED_BOSS:a 为 Boss 的 ActorUniqueID,调用 Player::unRegisterTrackedBoss

这个动作有输出时,输出就是返回值;每个参数的含义写在 abi.h 里这个常量的注释中。

  • 参数:
    • sarg : string
    • a : float64
    • b : float64
    • c : float64
  • 返回值类型:(string, error)
  • 对应槽位:player_action

Player.PlayEmote

Go
func (p Player) PlayEmote(sarg string, a, b, c float64) (string, error)

执行 PIER_PACT_PLAY_EMOTE:sarg 为表情的 id,调用 Player::playEmote

这个动作有输出时,输出就是返回值;每个参数的含义写在 abi.h 里这个常量的注释中。

  • 参数:
    • sarg : string
    • a : float64
    • b : float64
    • c : float64
  • 返回值类型:(string, error)
  • 对应槽位:player_action

Player.ResendAllChunks

Go
func (p Player) ResendAllChunks(sarg string, a, b, c float64) (string, error)

执行 PIER_PACT_RESEND_ALL_CHUNKS:调用 Player::resendAllChunks

这个动作有输出时,输出就是返回值;每个参数的含义写在 abi.h 里这个常量的注释中。

  • 参数:
    • sarg : string
    • a : float64
    • b : float64
    • c : float64
  • 返回值类型:(string, error)
  • 对应槽位:player_action

Player.OpenInventory

Go
func (p Player) OpenInventory(sarg string, a, b, c float64) (string, error)

执行 PIER_PACT_OPEN_INVENTORY:调用 Player::openInventory

这个动作有输出时,输出就是返回值;每个参数的含义写在 abi.h 里这个常量的注释中。

  • 参数:
    • sarg : string
    • a : float64
    • b : float64
    • c : float64
  • 返回值类型:(string, error)
  • 对应槽位:player_action

Player.SidebarSet

Go
func (p Player) SidebarSet(sarg string, a, b, c float64) (string, error)

执行 PIER_PACT_SIDEBAR_SET:sarg 为 "obj\ntitle\nline…",只对这名玩家显示的侧边栏

这个动作有输出时,输出就是返回值;每个参数的含义写在 abi.h 里这个常量的注释中。

  • 参数:
    • sarg : string
    • a : float64
    • b : float64
    • c : float64
  • 返回值类型:(string, error)
  • 对应槽位:player_action

Player.SidebarClear

Go
func (p Player) SidebarClear(sarg string, a, b, c float64) (string, error)

执行 PIER_PACT_SIDEBAR_CLEAR:sarg 为计分项,发送 RemoveObjectivePacket

这个动作有输出时,输出就是返回值;每个参数的含义写在 abi.h 里这个常量的注释中。

  • 参数:
    • sarg : string
    • a : float64
    • b : float64
    • c : float64
  • 返回值类型:(string, error)
  • 对应槽位:player_action

Player.SetPermissionLevel

Go
func (p Player) SetPermissionLevel(sarg string, a, b, c float64) (string, error)

执行 PIER_PACT_SET_PERMISSION_LEVEL:a 为 PlayerPermissionLevel(0 Visitor,1 Member,2 Operator,3 Custom)。调用 LayeredAbilities::setPlayerPermissions 并发送 UpdateAbilitiesPacket。读取一侧是 PIER_PPROP_PERMISSION_LEVEL。和 PIER_PACT_SET_ABILITY 一样,玩家加入完成之前调用会被拒绝。

这个动作有输出时,输出就是返回值;每个参数的含义写在 abi.h 里这个常量的注释中。

  • 参数:
    • sarg : string
    • a : float64
    • b : float64
    • c : float64
  • 返回值类型:(string, error)
  • 对应槽位:player_action

PlayerInfo

Go
1
2
3
4
5
6
7
type PlayerInfo struct {
    Name, Xuid, Uuid string
    Dim              int32
    HasDim           bool
    X, Y, Z          float64
    HasPos           bool
}

ListPlayers 报告的一名在线玩家。Dim 和位置只在有的时候才读取,HasDim 和 HasPos 说明它们有没有。

SelKind

Go
type SelKind int32

说明 PlayerSel 用什么来指定玩家。

名称 值 说明
SelName 0
SelXuid 1
SelUuid 2

PlayerSel

Go
1
2
3
4
type PlayerSel struct {
    Kind  SelKind
    Value string
}

按名字、xuid 或 uuid 指定一名玩家。

PlayerPos

Go
1
2
3
4
5
type PlayerPos struct {
    X, Y, Z   float64
    Dimension int32
    Found     bool
}

一名玩家所在的位置;没有人对得上时 Found 为 false。

PProp*

名称 值 说明
PPropGameType 0 即 PIER_PPROP_GAME_TYPE:(G) Player::getPlayerGameType;写入用 player_set_gamemode
PPropLevel 1 即 PIER_PPROP_LEVEL:(S) 属性 Player::LEVEL()
PPropExperience 2 即 PIER_PPROP_EXPERIENCE:(S) 属性 Player::EXPERIENCE()(经验条进度,0 到 1)
PPropHunger 3 即 PIER_PPROP_HUNGER:(S) 属性 Player::HUNGER()
PPropSaturation 4 即 PIER_PPROP_SATURATION:(S) 属性 Player::SATURATION()
PPropExhaustion 5 即 PIER_PPROP_EXHAUSTION:(S) 属性 Player::EXHAUSTION()
PPropXpNeededNextLevel 6 即 PIER_PPROP_XP_NEEDED_NEXT_LEVEL:(G) Player::getXpNeededForNextLevel
PPropLuck 7 即 PIER_PPROP_LUCK:(G) Player::getLuck
PPropSelectedSlot 8 即 PIER_PPROP_SELECTED_SLOT:(G) Player::getSelectedItemSlot;设置用 PIER_PACT_SET_SELECTED_SLOT
PPropIsOperator 9 即 PIER_PPROP_IS_OPERATOR:(G) Player::isOperator
PPropCanUseOperatorBlocks 10 即 PIER_PPROP_CAN_USE_OPERATOR_BLOCKS:(G) Player::canUseOperatorBlocks
PPropIsFlying 11 即 PIER_PPROP_IS_FLYING:(G) Player::isFlying
PPropCanJump 12 即 PIER_PPROP_CAN_JUMP:(G) Player::canJump
PPropIsEmoting 13 即 PIER_PPROP_IS_EMOTING:(G) Player::isEmoting
PPropIsInRaid 14 即 PIER_PPROP_IS_IN_RAID:(G) Player::isInRaid
PPropIsHurt 15 即 PIER_PPROP_IS_HURT:(G) Player::isHurt
PPropIsScoping 16 即 PIER_PPROP_IS_SCOPING:(G) Player::isScoping
PPropCanSleep 17 即 PIER_PPROP_CAN_SLEEP:(G) Player::canSleep
PPropHasRespawnPosition 18 即 PIER_PPROP_HAS_RESPAWN_POSITION:(G) Player::hasRespawnPosition
PPropClientSubId 19 即 PIER_PPROP_CLIENT_SUB_ID:(G) Player::getClientSubId
PPropCanUseAbility 20 即 PIER_PPROP_CAN_USE_ABILITY:(G) Player::canUseAbility;能力编号要经 player_action 的读取路径传入,见 PIER_PACT_CAN_USE_ABILITY
PPropDirection 21 即 PIER_PPROP_DIRECTION:(G) Player::getDirection(0=南,1=西,2=北,3=东)
PPropChunkRadius 22 即 PIER_PPROP_CHUNK_RADIUS:(G) Player::getChunkRadius
PPropNetworkRtt 23 即 PIER_PPROP_NETWORK_RTT:(G) getNetworkStatus().mPing(毫秒)
PPropPlatform 24 即 PIER_PPROP_PLATFORM:(G) Player::getPlatform
PPropEnchantmentSeed 25 即 PIER_PPROP_ENCHANTMENT_SEED:(G) Player::getEnchantmentSeed
PPropIsUsingItem 26 即 PIER_PPROP_IS_USING_ITEM:(G) Player::isUsingItem
PPropIsBlocking 27 即 PIER_PPROP_IS_BLOCKING:(G) Player::isBlocking
PPropIsGliding 28 即 PIER_PPROP_IS_GLIDING:(G) Player::isGliding
PPropIsSwimming 29 即 PIER_PPROP_IS_SWIMMING:(G) Player::isSwimming
PPropPermissionLevel 30 即 PIER_PPROP_PERMISSION_LEVEL:(G) Player::getPlayerPermissionLevel
PPropScore 31 即 PIER_PPROP_SCORE:(G) Player::getScore
PPropFallDistance 32 即 PIER_PPROP_FALL_DISTANCE:(G) Actor::getFallDistance
PPropIsDead 33 即 PIER_PPROP_IS_DEAD:(G) Actor::isDead
PPropHasDiedBefore 34 即 PIER_PPROP_HAS_DIED_BEFORE:(G) Player::hasDiedBefore
PPropDimension 35 即 PIER_PPROP_DIMENSION:(G) Actor::getDimensionId

PStr*

名称 值 说明
PStrRealName 0 即 PIER_PSTR_REAL_NAME:取自 Player::getRealName
PStrUuid 1 即 PIER_PSTR_UUID:取自 Player::getUuid().asString()
PStrXuid 2 即 PIER_PSTR_XUID:取自 Player::getXuid
PStrIpAndPort 3 即 PIER_PSTR_IP_AND_PORT:取自 Player::getIPAndPort
PStrLocaleCode 4 即 PIER_PSTR_LOCALE_CODE:取自 Player::getLocaleCode
PStrNameTag 5 即 PIER_PSTR_NAME_TAG:取自 Actor::getNameTag(显示名)
PStrLastDeathPos 6 即 PIER_PSTR_LAST_DEATH_POS:SNBT {x,y,z};没有时为 ""
PStrLastDeathDimension 7 即 PIER_PSTR_LAST_DEATH_DIMENSION:维度 id,以字符串表示
PStrNetworkStatus 8 即 PIER_PSTR_NETWORK_STATUS:SNBT {ping,avg_ping,packet_loss,max_ping}
PStrPlatformOnlineId 9 即 PIER_PSTR_PLATFORM_ONLINE_ID:取自 Player::getPlatformOnlineId
PStrRespawnPos 10 即 PIER_PSTR_RESPAWN_POS:SNBT {x,y,z,dim}:这名玩家会在哪里重生。不会为空:没有床的玩家报告的是世界出生点,这两种情况区分不开。

PAct*

名称 值 说明
PActSetAbility 0 即 PIER_PACT_SET_ABILITY:a 为 AbilitiesIndex,b 为 0 或 1(布尔类的能力)或者浮点数(FlySpeed 等)。写完以后会把 PlayerPermissionLevel 恢复成写之前的值:引擎的 LayeredAbilities::setAbility 走的是「切换到自定义权限」那条路,会把玩家推到 Custom,而这个等级会和能力层一起放进 UpdateAbilitiesPacket 发给客户端。要改权限等级,用 PIER_PACT_SET_PERMISSION_LEVEL。玩家加入完成之前(Player::isPlayerInitialized)调用会被拒绝,返回 false:客户端还在加载时写入的能力会一直不同步,直到玩家重新进入。模拟玩家不受这个限制。
PActCanUseAbility 1 即 PIER_PACT_CAN_USE_ABILITY:a 为 AbilitiesIndex,输出 "0" 或 "1",调用 Player::canUseAbility
PActSetSelectedSlot 2 即 PIER_PACT_SET_SELECTED_SLOT:a 为槽位,调用 Player::setSelectedSlot
PActGiveItem 3 即 PIER_PACT_GIVE_ITEM:sarg 为物品 SNBT,经 ItemStack::fromTag 和 Player::addAndRefresh 给出
PActSetSpawnPoint 4 即 PIER_PACT_SET_SPAWN_POINT:a、b、c 为坐标,sarg 为维度 id(任何已注册的维度都可以);原生调用 Player::setRespawnPosition
PActClearTitle 5 即 PIER_PACT_CLEAR_TITLE:原生发送 SetTitlePacket(Clear)
PActSetTitle 6 即 PIER_PACT_SET_TITLE:sarg 为文本,a 为位置(0 主标题,1 副标题,2 动作栏);原生发送 SetTitlePacket,文本原样发送
PActAddExperience 7 即 PIER_PACT_ADD_EXPERIENCE:a 为经验值,调用 Player::addExperience
PActAddLevels 8 即 PIER_PACT_ADD_LEVELS:a 为等级数,调用 Player::addLevels
PActStartCooldown 9 即 PIER_PACT_START_COOLDOWN:sarg 为物品名,a 为刻数,调用 Player::startItemCooldown
PActStartRiding 10 即 PIER_PACT_START_RIDING:a 为坐骑的 ActorUniqueID(低 64 位),调用 Player::startRiding
PActStopRiding 11 即 PIER_PACT_STOP_RIDING:调用 Player::stopRiding
PActAttack 12 即 PIER_PACT_ATTACK:a 为目标的 ActorUniqueID(低 64 位),调用 Player::attack
PActDrop 13 即 PIER_PACT_DROP:sarg 为物品 SNBT,a 为是否随机抛出(0 或 1),调用 Player::drop
PActInteract 14 即 PIER_PACT_INTERACT:a 为目标的 ActorUniqueID,调用 Player::interact
PActStartUsingItem 15 即 PIER_PACT_START_USING_ITEM:sarg 为物品 SNBT,a 为持续时间,调用 Player::startUsingItem
PActStopUsingItem 16 即 PIER_PACT_STOP_USING_ITEM:调用 Player::stopUsingItem
PActSetChunkRadius 17 即 PIER_PACT_SET_CHUNK_RADIUS:a 为半径,调用 Player::setChunkRadius
PActSetEnchantmentSeed 18 即 PIER_PACT_SET_ENCHANTMENT_SEED:a 为种子,调用 Player::setEnchantmentSeed
PActRegisterTrackedBoss 19 即 PIER_PACT_REGISTER_TRACKED_BOSS:a 为 Boss 的 ActorUniqueID,调用 Player::registerTrackedBoss
PActUnregisterTrackedBoss 20 即 PIER_PACT_UNREGISTER_TRACKED_BOSS:a 为 Boss 的 ActorUniqueID,调用 Player::unRegisterTrackedBoss
PActPlayEmote 21 即 PIER_PACT_PLAY_EMOTE:sarg 为表情的 id,调用 Player::playEmote
PActResendAllChunks 22 即 PIER_PACT_RESEND_ALL_CHUNKS:调用 Player::resendAllChunks
PActOpenInventory 23 即 PIER_PACT_OPEN_INVENTORY:调用 Player::openInventory
PActSidebarSet 24 即 PIER_PACT_SIDEBAR_SET:sarg 为 "obj\ntitle\nline…",只对这名玩家显示的侧边栏
PActSidebarClear 25 即 PIER_PACT_SIDEBAR_CLEAR:sarg 为计分项,发送 RemoveObjectivePacket
PActSetPermissionLevel 26 即 PIER_PACT_SET_PERMISSION_LEVEL:a 为 PlayerPermissionLevel(0 Visitor,1 Member,2 Operator,3 Custom)。调用 LayeredAbilities::setPlayerPermissions 并发送 UpdateAbilitiesPacket。读取一侧是 PIER_PPROP_PERMISSION_LEVEL。和 PIER_PACT_SET_ABILITY 一样,玩家加入完成之前调用会被拒绝。