Documentation
¶
Overview ¶
Package client implements the core World of Warcraft 3.3.5a protocol clients.
AuthClient performs SRP6 authentication against an authserver and returns realm list information plus the session key.
WorldClient manages the encrypted world session, character operations (enum/create/delete/login), object tracking, movement, combat, spells, chat, and exposes callbacks for higher layers (bot, testkit, orchestrator).
This is the pure protocol layer with no AI, navigation, or DB coupling. It is intended for use both by the AzerothGhost bot runtime and directly in integration tests.
Package client implements the core World of Warcraft 3.3.5a protocol clients.
AuthClient performs SRP6 authentication against an authserver and returns realm list information plus the session key.
WorldClient manages the encrypted world session, character operations (enum/create/delete/login), object tracking, movement, combat, spells, chat, and exposes callbacks for higher layers (bot, testkit, orchestrator).
This is the pure protocol layer with no AI, navigation, or DB coupling. It is intended for use both by the AzerothGhost bot runtime and directly in integration tests.
Index ¶
- Constants
- func CreatureGUID(entry, counter uint32) uint64
- func GameObjectGUID(entry, counter uint32) uint64
- func IsHighValueTraceOpcode(op uint16) bool
- func MakePetActionButton(action uint32, actType uint8) uint32
- func OpcodeName(op uint16) string
- func ParseGuildBankMoneyWithdrawn(data []byte) (int32, error)
- func ParseTurnInPetitionResults(data []byte) (uint32, error)
- func PlayerVisibleItemEntryField(slot uint8) uint16
- func SpellFailReasonName(reason uint8) string
- func TradeStatusName(st uint32) string
- type AttackReject
- type AuthClient
- type CharEnumEntry
- type GroupMember
- type GroupState
- type GuildBankList
- type GuildBankListItem
- type GuildBankTabInfo
- type HookID
- type ItemPushResult
- type KnownSpell
- type LogLevel
- type LootAllPassed
- type LootItem
- type LootRollEvent
- type LootRollWon
- type LootStartRoll
- type PetitionShowSignatures
- type PetitionSignResults
- type RealmInfo
- type RejectClass
- type SessionPhase
- type SessionPhaseChange
- type SpellCooldown
- type SummonRequest
- type TradeStatusInfo
- type WorldClient
- func (w *WorldClient) AcceptTrade() error
- func (w *WorldClient) ActiveLootRolls() []LootStartRoll
- func (w *WorldClient) AddGroupDeclineHook(fn func(declinerName string)) (cancel func())
- func (w *WorldClient) AddGroupInviteHook(fn func(inviterName string, alreadyInGroup bool)) (cancel func())
- func (w *WorldClient) AddGroupListHook(fn func(GroupState)) (cancel func())
- func (w *WorldClient) AddInstanceResetHook(fn func(mapID uint32, ok bool)) (cancel func())
- func (w *WorldClient) AddLootAllPassedHook(fn func(LootAllPassed)) (cancel func())
- func (w *WorldClient) AddLootOpenedHook(fn func(lootGUID uint64, items []LootItem)) (cancel func())
- func (w *WorldClient) AddLootRollHook(fn func(LootRollEvent)) (cancel func())
- func (w *WorldClient) AddLootRollWonHook(fn func(LootRollWon)) (cancel func())
- func (w *WorldClient) AddLootStartRollHook(fn func(LootStartRoll)) (cancel func())
- func (w *WorldClient) AddPacketHook(fn func(opcode uint16, data []byte)) (cancel func())
- func (w *WorldClient) AddSpellCastResultHook(fn func(spellID uint32, success bool, failReason uint8)) (cancel func())
- func (w *WorldClient) AddSummonRequestHook(fn func(SummonRequest)) (cancel func())
- func (w *WorldClient) AddTradeStatusHook(fn func(TradeStatusInfo)) (cancel func())
- func (w *WorldClient) ApplyLocalDamage(guid uint64, damage uint32)
- func (w *WorldClient) ArmSummonRequest() (wait func(timeout time.Duration) (SummonRequest, error), cancel func())
- func (w *WorldClient) AttackStop() error
- func (w *WorldClient) AttackSwing(targetGUID uint64) error
- func (w *WorldClient) AttackingGUID() uint64
- func (w *WorldClient) AutoEquipItem(bag, slot uint8) error
- func (w *WorldClient) BeginTrade() error
- func (w *WorldClient) CancelAura(spellID uint32) error
- func (w *WorldClient) CancelCast() error
- func (w *WorldClient) CancelTrade() error
- func (w *WorldClient) CastSpell(spellID uint32, targetGUID uint64) error
- func (w *WorldClient) CastSpellAtPosition(spellID uint32, x, y, z float32) error
- func (w *WorldClient) ChannelSpell() uint32
- func (w *WorldClient) CharGUID() uint64
- func (w *WorldClient) CharRace() uint8
- func (w *WorldClient) ClearActiveLootRolls()
- func (w *WorldClient) ClearCombat()
- func (w *WorldClient) ClearPendingSummon()
- func (w *WorldClient) ClearTarget()
- func (w *WorldClient) ClearTradeItem(tradeSlot uint8) error
- func (w *WorldClient) Close()
- func (w *WorldClient) CompleteCinematic() error
- func (w *WorldClient) Connect(worldAddr string) error
- func (w *WorldClient) ControlGUID() uint64
- func (w *WorldClient) CorpseReclaimDelayMs() uint32
- func (w *WorldClient) CreateCharacter(name string, ...) error
- func (w *WorldClient) CreatureQuery(entry uint32, guid uint64) error
- func (w *WorldClient) DeleteCharacter(guid uint64) error
- func (w *WorldClient) DismissPet(petGUID uint64) error
- func (w *WorldClient) EquippedSlot(entry uint32) (uint8, bool)
- func (w *WorldClient) FindGameObjectByEntry(entry uint32, maxDist float32) uint64
- func (w *WorldClient) FindUnitByEntry(entry uint32, maxDist float32) uint64
- func (w *WorldClient) FlushLearnedSpellLog()
- func (w *WorldClient) GameObjectUse(guid uint64) error
- func (w *WorldClient) GetNearbyPlayers(maxDist float32) []*WorldObject
- func (w *WorldClient) GetNearbyUnits(maxDist float32) []*WorldObject
- func (w *WorldClient) GetObject(guid uint64) *WorldObject
- func (w *WorldClient) GroupAccept() error
- func (w *WorldClient) GroupDecline() error
- func (w *WorldClient) GroupDisband() error
- func (w *WorldClient) GroupInvite(playerName string) error
- func (w *WorldClient) GroupLeave() error
- func (w *WorldClient) GroupMembers() []GroupMember
- func (w *WorldClient) GroupSetLeader(playerGUID uint64) error
- func (w *WorldClient) GroupState() GroupState
- func (w *WorldClient) GroupUninvite(memberName string) error
- func (w *WorldClient) GroupUninviteGUID(memberGUID uint64, reason string) error
- func (w *WorldClient) HasPendingSummon() bool
- func (w *WorldClient) Health() uint32
- func (w *WorldClient) InCombat() bool
- func (w *WorldClient) InGroup() bool
- func (w *WorldClient) InitiateTrade(targetGUID uint64) error
- func (w *WorldClient) IsChanneling() bool
- func (w *WorldClient) IsGroupLeader() bool
- func (w *WorldClient) IsInWorld() bool
- func (w *WorldClient) IsOnVehicle() bool
- func (w *WorldClient) IsSpellReady(spellID uint32) bool
- func (w *WorldClient) IsStopped() bool
- func (w *WorldClient) KnowsSpell(spellID uint32) bool
- func (w *WorldClient) LastInstanceResetMap() uint32
- func (w *WorldClient) LastTimeSyncCounter() uint32
- func (w *WorldClient) LastTradeStatus() TradeStatusInfo
- func (w *WorldClient) ListGameObjectEntries(limit int) []uint32
- func (w *WorldClient) LogLevel() LogLevel
- func (w *WorldClient) LoginCharacter(guid uint64) error
- func (w *WorldClient) Loot(guid uint64) error
- func (w *WorldClient) LootItem(slot uint8) error
- func (w *WorldClient) LootMasterGive(lootGUID uint64, slot uint8, targetGUID uint64) error
- func (w *WorldClient) LootMoney() error
- func (w *WorldClient) LootRelease(guid uint64) error
- func (w *WorldClient) LootRoll(itemGUID uint64, itemSlot uint32, rollType uint8) error
- func (w *WorldClient) MarkObjectDead(guid uint64)
- func (w *WorldClient) MaxHealth() uint32
- func (w *WorldClient) Money() uint32
- func (w *WorldClient) MoveForward() error
- func (w *WorldClient) MoveForwardAt(x, y, z, o float32) error
- func (w *WorldClient) MoveForwardAtTime(x, y, z, o float32, at time.Time) error
- func (w *WorldClient) MoveSpeed() float32
- func (w *WorldClient) MoveStop() error
- func (w *WorldClient) MoveStopAt(x, y, z, o float32) error
- func (w *WorldClient) MoveStopAtTime(x, y, z, o float32, at time.Time) error
- func (w *WorldClient) NameQuery(guid uint64) error
- func (w *WorldClient) NextCinematicCamera() error
- func (w *WorldClient) ObjectTrackStats() (byType map[uint8]int, gameObjectHigh int, total int)
- func (w *WorldClient) PendingSummon() SummonRequest
- func (w *WorldClient) PetAction(petGUID uint64, actionData uint32, targetGUID uint64) error
- func (w *WorldClient) PetAttackCommand(petGUID, targetGUID uint64) error
- func (w *WorldClient) PlayerCharmGUID() uint64
- func (w *WorldClient) PlayerLevel() uint32
- func (w *WorldClient) PlayerPetGUID() uint64
- func (w *WorldClient) PlayerVehicleEnter(playerGUID uint64) error
- func (w *WorldClient) Position() (x, y, z, o float32, mapID uint32)
- func (w *WorldClient) Power() (current, max uint32)
- func (w *WorldClient) QuestgiverAcceptQuest(npcGUID uint64, questID uint32) error
- func (w *WorldClient) QuestgiverChooseReward(npcGUID uint64, questID uint32, reward uint32) error
- func (w *WorldClient) QuestgiverCompleteQuest(npcGUID uint64, questID uint32) error
- func (w *WorldClient) QuestgiverHello(npcGUID uint64) error
- func (w *WorldClient) ReclaimCorpse() error
- func (w *WorldClient) RepopRequest() error
- func (w *WorldClient) RequestCharList() error
- func (w *WorldClient) RequestVehicleExit() error
- func (w *WorldClient) ResetInstances() error
- func (w *WorldClient) Run() error
- func (w *WorldClient) SelfAuraStacks(spellID uint32) int
- func (w *WorldClient) SelfAuras() []uint32
- func (w *WorldClient) SelfHasAura(spellID uint32) bool
- func (w *WorldClient) SelfIsPvP() bool
- func (w *WorldClient) SendChatMessage(msgType, lang uint32, message string) error
- func (w *WorldClient) SendGMCommand(command string) error
- func (w *WorldClient) SendGuildBankBuyTab(bankerGUID uint64, tab uint8) error
- func (w *WorldClient) SendGuildBankDepositItem(bankerGUID uint64, tab, slot, bag, bagSlot uint8, itemEntry, stackCount uint32) error
- func (w *WorldClient) SendGuildBankDepositMoney(bankerGUID uint64, amount uint32) error
- func (w *WorldClient) SendGuildBankQueryTab(bankerGUID uint64, tab uint8, fullUpdate bool) error
- func (w *WorldClient) SendGuildBankWithdrawItem(bankerGUID uint64, tab, slot uint8, itemEntry, stackCount uint32) error
- func (w *WorldClient) SendGuildBankWithdrawMoney(bankerGUID uint64, amount uint32) error
- func (w *WorldClient) SendGuildBankerActivate(bankerGUID uint64, fullUpdate bool) error
- func (w *WorldClient) SendGuildChatMessage(message string) error
- func (w *WorldClient) SendGuildCommand(command string) error
- func (w *WorldClient) SendHeartbeat() error
- func (w *WorldClient) SendHeartbeatAt(x, y, z, o float32) error
- func (w *WorldClient) SendHeartbeatAtTime(x, y, z, o float32, at time.Time) error
- func (w *WorldClient) SendJump() error
- func (w *WorldClient) SendLogout() error
- func (w *WorldClient) SendMovementHeartbeat() error
- func (w *WorldClient) SendMovementHeartbeatAt(x, y, z, o float32) error
- func (w *WorldClient) SendMovementHeartbeatAtTime(x, y, z, o float32, at time.Time) error
- func (w *WorldClient) SendMovementHeartbeatWithJump(fallTime uint32, zspeed, sinAngle, cosAngle, xyspeed float32) error
- func (w *WorldClient) SendMovementHeartbeatWithJumpAt(x, y, z, o float32, fallTime uint32, ...) error
- func (w *WorldClient) SendMovementHeartbeatWithJumpAtTime(x, y, z, o float32, at time.Time, fallTime uint32, ...) error
- func (w *WorldClient) SendOfferPetition(petitionItemGUID, targetGUID uint64) error
- func (w *WorldClient) SendPacketRaw(opcode uint16, data []byte) error
- func (w *WorldClient) SendPetitionBuy(npcGUID uint64, guildName string) error
- func (w *WorldClient) SendPetitionDecline(petitionItemGUID uint64) error
- func (w *WorldClient) SendPetitionQuery(petitionID uint32, petitionItemGUID uint64) error
- func (w *WorldClient) SendPetitionShowSignatures(petitionItemGUID uint64) error
- func (w *WorldClient) SendPetitionSign(petitionItemGUID uint64) error
- func (w *WorldClient) SendPing(seq uint32) error
- func (w *WorldClient) SendReadyForAccountDataTimes() error
- func (w *WorldClient) SendRealmSplit() error
- func (w *WorldClient) SendTextEmote(emoteID uint32, targetGUID uint64) error
- func (w *WorldClient) SendTurnInPetition(petitionItemGUID uint64) error
- func (w *WorldClient) SessionPhase() SessionPhase
- func (w *WorldClient) SetActiveMover(guid uint64) error
- func (w *WorldClient) SetCharRace(race uint8)
- func (w *WorldClient) SetFacing(orientation float32) error
- func (w *WorldClient) SetFacingAt(x, y, z, o float32) error
- func (w *WorldClient) SetFacingAtTime(x, y, z, o float32, at time.Time) error
- func (w *WorldClient) SetFacingMoving(orientation float32) error
- func (w *WorldClient) SetFacingMovingAt(x, y, z, o float32) error
- func (w *WorldClient) SetFacingMovingAtTime(x, y, z, o float32, at time.Time) error
- func (w *WorldClient) SetLevelForTest(l uint32)
- func (w *WorldClient) SetLogLevel(level LogLevel)
- func (w *WorldClient) SetLootMethod(method uint8, lootMaster uint64, threshold uint8) error
- func (w *WorldClient) SetOnTradeStatus(fn func(TradeStatusInfo))
- func (w *WorldClient) SetPvP(on bool) error
- func (w *WorldClient) SetSheathed(state uint32) error
- func (w *WorldClient) SetTarget(targetGUID uint64) error
- func (w *WorldClient) SetTradeGold(copper uint32) error
- func (w *WorldClient) SetTradeItem(tradeSlot, bag, invSlot uint8) error
- func (w *WorldClient) SpellClick(guid uint64) error
- func (w *WorldClient) Stop()
- func (w *WorldClient) StopChan() <-chan struct{}
- func (w *WorldClient) SummonResponse(summonerGUID uint64, agree bool) error
- func (w *WorldClient) TargetGUID() uint64
- func (w *WorldClient) Teleport(mapID uint32, x, y, z, o float32) error
- func (w *WorldClient) TeleportSeq() uint64
- func (w *WorldClient) TimeSyncResponses() uint64
- func (w *WorldClient) TradeOpen() bool
- func (w *WorldClient) TradeStatusSeen() bool
- func (w *WorldClient) TradeStatusSeq() uint64
- func (w *WorldClient) UnacceptTrade() error
- func (w *WorldClient) UnitChannelSpell(guid uint64) uint32
- func (w *WorldClient) UnitEquippedSlot(guid uint64, entry uint32) (uint8, bool)
- func (w *WorldClient) UnitVisibleItemEntry(guid uint64, slot uint8) uint32
- func (w *WorldClient) UpdatePosition(x, y, z, o float32)
- func (w *WorldClient) VehicleGUID() uint64
- func (w *WorldClient) VisibleItemEntry(slot uint8) uint32
- func (w *WorldClient) WaitCorpseReclaimAllowed(timeout time.Duration) error
- func (w *WorldClient) WaitForLogin(timeout time.Duration) error
- func (w *WorldClient) WaitForLogout(timeout time.Duration) error
- func (w *WorldClient) WaitForSessionPhase(want SessionPhase, timeout time.Duration) error
- func (w *WorldClient) WaitForTeleportAfter(afterSeq uint64, timeout time.Duration) error
- func (w *WorldClient) WaitNotOnVehicle(timeout time.Duration) error
- func (w *WorldClient) WaitOnVehicle(timeout time.Duration) (uint64, error)
- func (w *WorldClient) WaitSummonRequest(timeout time.Duration) (SummonRequest, error)
- type WorldObject
- func (o *WorldObject) AuraStacks(spellID uint32) int
- func (o *WorldObject) Clone() *WorldObject
- func (o *WorldObject) DistanceTo(x, y, z float32) float32
- func (o *WorldObject) EquippedSlot(entry uint32) (uint8, bool)
- func (o *WorldObject) GUIDField(fieldIndex uint16) uint64
- func (o *WorldObject) GetActiveAuras() []uint32
- func (o *WorldObject) HasAura(spellID uint32) bool
- func (o *WorldObject) HasKnownPosition() bool
- func (o *WorldObject) Health() uint32
- func (o *WorldObject) InterpolatedPosition() (float32, float32, float32)
- func (o *WorldObject) IsAlive() bool
- func (o *WorldObject) IsPvP() bool
- func (o *WorldObject) IsUnit() bool
- func (o *WorldObject) Level() uint32
- func (o *WorldObject) MaxHealth() uint32
- func (o *WorldObject) PvPStateByte() uint8
- func (o *WorldObject) Value(field uint16) uint32
- func (o *WorldObject) VisibleItemEntry(slot uint8) uint32
Constants ¶
const ( AuthLogonChallenge byte = 0x00 AuthLogonProof byte = 0x01 AuthRealmList byte = 0x10 )
Auth command opcodes
const ( CmsgGuildBankerActivate uint16 = 0x03E6 CmsgGuildBankQueryTab uint16 = 0x03E7 SmsgGuildBankList uint16 = 0x03E8 CmsgGuildBankSwapItems uint16 = 0x03E9 CmsgGuildBankBuyTab uint16 = 0x03EA CmsgGuildBankUpdateTab uint16 = 0x03EB CmsgGuildBankDepositMoney uint16 = 0x03EC CmsgGuildBankWithdrawMoney uint16 = 0x03ED MsgGuildBankLogQuery uint16 = 0x03EE MsgGuildPermissions uint16 = 0x03FD MsgGuildBankMoneyWithdrawn uint16 = 0x03FE MsgQueryGuildBankText uint16 = 0x040A CmsgSetGuildBankText uint16 = 0x040B )
Guild bank opcodes (3.3.5a).
const ( SmsgLootRollWon uint16 = 0x029F CmsgLootRoll uint16 = 0x02A0 SmsgLootStartRoll uint16 = 0x02A1 SmsgLootRoll uint16 = 0x02A2 CmsgLootMasterGive uint16 = 0x02A3 SmsgLootAllPassed uint16 = 0x029E )
Group loot roll opcodes (3.3.5a).
const ( RollPass uint8 = 0 RollNeed uint8 = 1 RollGreed uint8 = 2 RollDisenchant uint8 = 3 )
Roll types for CMSG_LOOT_ROLL (LootMgr.h).
const ( PetitionSignOK uint32 = 0 PetitionSignAlreadySigned uint32 = 1 PetitionSignAlreadyInGuild uint32 = 2 PetitionSignCantSignOwn uint32 = 3 )
PetitionSignResult codes (SMSG_PETITION_SIGN_RESULTS).
const ( PetitionTurnOK uint32 = 0 PetitionTurnAlreadyInGuild uint32 = 2 PetitionTurnNeedMoreSignatures uint32 = 4 )
PetitionTurnResult codes (SMSG_TURN_IN_PETITION_RESULTS).
const ( RejectReasonNotInRange = "NOT_IN_RANGE" RejectReasonBadFacing = "BAD_FACING" RejectReasonDeadTarget = "DEAD_TARGET" RejectReasonCantAttack = "CANT_ATTACK" RejectReasonAttackStop = "ATTACK_STOP" )
Well-known swing error reason strings (match handleAttackSwingError callers).
const ( SmsgSummonRequest uint16 = 0x02AB CmsgSummonResponse uint16 = 0x02AC CmsgResetInstances uint16 = 0x031D SmsgInstanceReset uint16 = 0x031E SmsgInstanceResetFailed uint16 = 0x031F SmsgResetFailedNotify uint16 = 0x0396 CmsgGameObjectUse uint16 = 0x00B1 )
Summon / instance-reset opcodes (3.3.5a).
const ( CmsgInitiateTrade uint16 = 0x0116 CmsgBeginTrade uint16 = 0x0117 CmsgBusyTrade uint16 = 0x0118 CmsgIgnoreTrade uint16 = 0x0119 CmsgAcceptTrade uint16 = 0x011A CmsgUnacceptTrade uint16 = 0x011B CmsgCancelTrade uint16 = 0x011C CmsgSetTradeItem uint16 = 0x011D CmsgClearTradeItem uint16 = 0x011E CmsgSetTradeGold uint16 = 0x011F SmsgTradeStatus uint16 = 0x0120 SmsgTradeStatusExt uint16 = 0x0121 )
Trade opcodes (3.3.5a / AzerothCore Opcodes.h).
const ( TradeStatusBusy uint32 = 0 TradeStatusBeginTrade uint32 = 1 TradeStatusOpenWindow uint32 = 2 TradeStatusTradeCanceled uint32 = 3 TradeStatusTradeAccept uint32 = 4 TradeStatusBusy2 uint32 = 5 TradeStatusNoTarget uint32 = 6 TradeStatusBackToTrade uint32 = 7 TradeStatusTradeComplete uint32 = 8 TradeStatusTradeRejected uint32 = 9 TradeStatusTargetTooFar uint32 = 10 TradeStatusWrongFaction uint32 = 11 TradeStatusCloseWindow uint32 = 12 TradeStatusIgnoreYou uint32 = 14 TradeStatusYouStunned uint32 = 15 TradeStatusTargetStunned uint32 = 16 TradeStatusYouDead uint32 = 17 TradeStatusTargetDead uint32 = 18 TradeStatusYouLogout uint32 = 19 TradeStatusTargetLogout uint32 = 20 TradeStatusTrialAccount uint32 = 21 TradeStatusWrongRealm uint32 = 22 TradeStatusNotOnTapList uint32 = 23 )
TradeStatus codes (SharedDefines.h TradeStatus).
const ( TradeSlotTradedCount = 6 TradeSlotCount = 7 )
Trade slot layout (TradeData.h): 0..5 traded, 6 non-traded.
const ( CmsgSpellClick uint16 = 0x03F8 CmsgRequestVehicleExit uint16 = 0x0476 CmsgDismissControlledVehicle uint16 = 0x046D CmsgPlayerVehicleEnter uint16 = 0x04A8 SmsgClientControlUpdate uint16 = 0x0159 SmsgPlayerVehicleData uint16 = 0x04A7 SmsgOnCancelExpectedRideVehicleAura uint16 = 0x049D )
Vehicle / control opcodes (3.3.5a / AzerothCore Opcodes.h).
const ( SmsgAuthChallenge uint16 = 0x01EC CmsgAuthSession uint16 = 0x01ED SmsgAuthResponse uint16 = 0x01EE CmsgCharEnum uint16 = 0x0037 SmsgCharEnum uint16 = 0x003B CmsgCharCreate uint16 = 0x0036 SmsgCharCreate uint16 = 0x003A CmsgCharDelete uint16 = 0x0038 SmsgCharDelete uint16 = 0x003C CmsgPlayerLogin uint16 = 0x003D SmsgLoginVerifyWorld uint16 = 0x0236 CmsgPing uint16 = 0x01DC SmsgPong uint16 = 0x01DD SmsgTimeSyncReq uint16 = 0x0390 CmsgTimeSyncResp uint16 = 0x0391 CmsgMessageChat uint16 = 0x0095 SmsgMessageChat uint16 = 0x0096 CmsgTextEmote uint16 = 0x0104 SmsgTextEmote uint16 = 0x0105 SmsgEmote uint16 = 0x0103 MsgMoveJump uint16 = 0x00BB MsgMoveFallLand uint16 = 0x00C9 MsgMoveHeartbeat uint16 = 0x00EE MsgMoveStartForward uint16 = 0x00B5 MsgMoveStop uint16 = 0x00B7 MsgMoveStartBackward uint16 = 0x00B6 MsgMoveStartStrafeLeft uint16 = 0x00B8 MsgMoveStartStrafeRight uint16 = 0x00B9 MsgMoveStopStrafe uint16 = 0x00BA MsgMoveStartTurnLeft uint16 = 0x00BC MsgMoveStartTurnRight uint16 = 0x00BD MsgMoveStopTurn uint16 = 0x00BE MsgMoveSetFacing uint16 = 0x00DA MsgMoveTeleportAck uint16 = 0x00C7 SmsgMoveKnockBack uint16 = 0x00EF SmsgMoveTeleport uint16 = 0x00C5 CmsgSetActiveMover uint16 = 0x026A CmsgLogoutRequest uint16 = 0x004B SmsgLogoutResponse uint16 = 0x004C SmsgLogoutComplete uint16 = 0x004D SmsgWardenData uint16 = 0x02E6 CmsgWardenData uint16 = 0x02E7 CmsgReadyForAccountDataTimes uint16 = 0x04FF SmsgAccountDataTimes uint16 = 0x0209 CmsgRealmSplit uint16 = 0x038C SmsgRealmSplit uint16 = 0x038B SmsgAddonInfo uint16 = 0x02EF SmsgTutorialFlags uint16 = 0x00FD SmsgCancelCombat uint16 = 0x014E CmsgCompleteCinematic uint16 = 0x00FC CmsgNextCinematicCamera uint16 = 0x00FB // Combat opcodes CmsgAttackSwing uint16 = 0x0141 CmsgAttackStop uint16 = 0x0142 SmsgAttackStart uint16 = 0x0143 SmsgAttackStop uint16 = 0x0144 SmsgAttackSwingNotInRange uint16 = 0x0145 SmsgAttackSwingBadFacing uint16 = 0x0146 SmsgAttackSwingDeadTarget uint16 = 0x0148 SmsgAttackSwingCantAttack uint16 = 0x0149 SmsgAttackerStateUpdate uint16 = 0x014A // Spell opcodes CmsgCastSpell uint16 = 0x012E SmsgSpellStart uint16 = 0x0131 SmsgSpellGo uint16 = 0x0132 SmsgSpellFailure uint16 = 0x0133 SmsgSpellCooldown uint16 = 0x0134 SmsgCastFailed uint16 = 0x0130 // server error for failed casts (may be sent on bad target) SmsgInitialSpells uint16 = 0x012A // Post-login spellbook updates (GM .learn, trainers, talents). Without these // KnowsSpell only reflects SMSG_INITIAL_SPELLS from login. SmsgLearnedSpell uint16 = 0x012B SmsgSupercededSpell uint16 = 0x012C SmsgRemovedSpell uint16 = 0x0203 SmsgCooldownEvent uint16 = 0x0135 SmsgClearCooldown uint16 = 0x01DE CmsgCancelCast uint16 = 0x012F // CMSG_CANCEL_AURA = 0x136 on 3.3.5a (AC Opcodes.h). 0x133 is SMSG_SPELL_FAILURE only; // using 0x133 made CancelAura a silent no-op server-side. CmsgCancelAura uint16 = 0x0136 // CMSG_TOGGLE_PVP = 0x253. Payload: optional uint8 (1 = on, 0 = off). CmsgTogglePvp uint16 = 0x0253 // Update object opcodes SmsgUpdateObject uint16 = 0x00A9 SmsgDestroyObject uint16 = 0x00AA SmsgCompressedUpdate uint16 = 0x01F6 SmsgMonsterMove uint16 = 0x00DD SmsgMonsterMoveTransport uint16 = 0x02AE SmsgCompressedMoves uint16 = 0x02FB SmsgMultipleMoves uint16 = 0x051E // Loot opcodes CmsgLoot uint16 = 0x015D CmsgLootMoney uint16 = 0x015E CmsgLootRelease uint16 = 0x015F SmsgLootResponse uint16 = 0x0160 CmsgAutostoreLootItem uint16 = 0x0108 SmsgLootRemoved uint16 = 0x0162 SmsgLootReleaseResponse uint16 = 0x0161 // Item / inventory opcodes CmsgAutoequipItem uint16 = 0x010A // Quest opcodes CmsgQuestgiverHello uint16 = 0x0184 SmsgQuestgiverQuestList uint16 = 0x0185 CmsgQuestgiverAcceptQuest uint16 = 0x0189 CmsgQuestgiverCompleteQuest uint16 = 0x018A CmsgQuestgiverChooseReward uint16 = 0x018E SmsgQuestgiverQuestDetails uint16 = 0x0188 SmsgQuestgiverRequestItems uint16 = 0x018B SmsgQuestgiverOfferReward uint16 = 0x018D SmsgQuestupdateComplete uint16 = 0x01A8 // Group opcodes CmsgGroupInvite uint16 = 0x006E SmsgGroupInvite uint16 = 0x006F CmsgGroupAccept uint16 = 0x0072 CmsgGroupDecline uint16 = 0x0073 SmsgGroupDecline uint16 = 0x0074 CmsgGroupUninvite uint16 = 0x0075 CmsgGroupUninviteGuid uint16 = 0x0076 SmsgGroupUninvite uint16 = 0x0077 CmsgGroupSetLeader uint16 = 0x0078 SmsgGroupSetLeader uint16 = 0x0079 CmsgLootMethod uint16 = 0x007A CmsgGroupDisband uint16 = 0x007B // also leave party on 3.3.5a SmsgGroupDestroyed uint16 = 0x007C SmsgGroupList uint16 = 0x007D SmsgPartyCommandResult uint16 = 0x007F // Pet opcodes CmsgPetAction uint16 = 0x0175 CmsgPetAbandon uint16 = 0x0176 SmsgPetSpells uint16 = 0x0179 // Level up SmsgLevelupInfo uint16 = 0x01D4 // Death handling CmsgRepopRequest uint16 = 0x015A CmsgReclaimCorpse uint16 = 0x01D2 SmsgCorpseReclaimDelay uint16 = 0x0269 // uint32 delay milliseconds // Target / selection CmsgSetSelection uint16 = 0x013D // Misc SmsgNewWorld uint16 = 0x003E SmsgTransferPending uint16 = 0x003F // MsgMoveWorldportAck (CMSG_WORLD_TELEPORT response / WORLDPORT_ACK) — 0x00DC MsgMoveWorldportAck uint16 = 0x00DC SmsgAiReaction uint16 = 0x013C SmsgPowerUpdate uint16 = 0x0480 // Speed change SmsgForceRunSpeedChange uint16 = 0x00E2 CmsgForceRunSpeedChangeAck uint16 = 0x00E3 // Name query CmsgNameQuery uint16 = 0x0050 SmsgNameQueryResponse uint16 = 0x0051 CmsgCreatureQuery uint16 = 0x0060 SmsgCreatureQueryResponse uint16 = 0x0061 // Set sheathed CmsgSetSheathed uint16 = 0x01E0 // Sheath states SheathStateUnarmed uint32 = 0 SheathStateMelee uint32 = 1 SheathStateRanged uint32 = 2 // Aura updates (SMSG_AURA_UPDATE / SMSG_AURA_UPDATE_ALL). // These are the primary way AC delivers per-slot aura info (not just value fields). // See AzerothCore SpellAuras.cpp AuraApplication::BuildUpdatePacket. SmsgAuraUpdate uint16 = 0x0496 SmsgAuraUpdateAll uint16 = 0x0495 // Guild / arena petitions (3.3.5a). Guild charter signatures are owned by // ToCloud9 charserver; arena charters stay worldserver-local. CmsgPetitionBuy uint16 = 0x01BD CmsgPetitionShowSignatures uint16 = 0x01BE SmsgPetitionShowSignatures uint16 = 0x01BF CmsgPetitionSign uint16 = 0x01C0 SmsgPetitionSignResults uint16 = 0x01C1 MsgPetitionDecline uint16 = 0x01C2 CmsgOfferPetition uint16 = 0x01C3 CmsgTurnInPetition uint16 = 0x01C4 SmsgTurnInPetitionResults uint16 = 0x01C5 CmsgPetitionQuery uint16 = 0x01C6 SmsgPetitionQueryResponse uint16 = 0x01C7 MsgPetitionRename uint16 = 0x02C1 )
Opcodes (subset needed for the bot)
const ( ChatMsgSay uint32 = 0x01 ChatMsgParty uint32 = 0x02 ChatMsgRaid uint32 = 0x03 ChatMsgGuild uint32 = 0x04 ChatMsgYell uint32 = 0x06 ChatMsgEmote uint32 = 0x08 )
Chat message types
const ( LangUniversal uint32 = 0x00 LangOrcish uint32 = 0x01 LangCommon uint32 = 0x07 )
Language
const ( BaseSpeedWalk float32 = 2.5 BaseSpeedRun float32 = 7.0 BaseSpeedRunBack float32 = 4.5 BaseSpeedSwim float32 = 4.722222 BaseSpeedSwimBack float32 = 2.5 BaseSpeedFlight float32 = 7.0 )
Movement speeds from AzerothCore Unit.cpp (yards per second)
const ( MoveFlagNone uint32 = 0x00000000 MoveFlagForward uint32 = 0x00000001 MoveFlagBackward uint32 = 0x00000002 MoveFlagStrafeLeft uint32 = 0x00000004 MoveFlagStrafeRight uint32 = 0x00000008 MoveFlagTurnLeft uint32 = 0x00000010 MoveFlagTurnRight uint32 = 0x00000020 MoveFlagFalling uint32 = 0x00001000 MoveFlagSwimming uint32 = 0x00200000 MoveFlagFlying uint32 = 0x02000000 )
Movement flags
const ( ObjectTypeObject uint8 = 0 ObjectTypeItem uint8 = 1 ObjectTypeContainer uint8 = 2 ObjectTypeUnit uint8 = 3 ObjectTypePlayer uint8 = 4 ObjectTypeGameObj uint8 = 5 ObjectTypeDynObj uint8 = 6 ObjectTypeCorpse uint8 = 7 )
ObjectType constants
const ( UpdateTypeValues uint8 = 0 UpdateTypeMovement uint8 = 1 UpdateTypeCreateObject uint8 = 2 UpdateTypeCreateObject2 uint8 = 3 UpdateTypeOutOfRangeObjects uint8 = 4 UpdateTypeNearObjects uint8 = 5 )
Update types
const ( ObjectFieldGUID = 0x0000 // 2 uint32s ObjectFieldType = 0x0002 UnitFieldEntry = 0x0003 // OBJECT_FIELD_ENTRY UnitFieldCharm = 0x0006 // OBJECT_END + 0x0000 (2 uint32s = GUID) UnitFieldSummon = 0x0008 // OBJECT_END + 0x0002 (2 uint32s = GUID) — active pet UnitFieldCharmedBy = 0x000C // OBJECT_END + 0x0006 UnitFieldSummonedBy = 0x000E // OBJECT_END + 0x0008 UnitFieldCreatedBy = 0x0010 // OBJECT_END + 0x000A UnitFieldTarget = 0x0012 // OBJECT_END + 0x000C = 0x0012 (2 uint32s = GUID) UnitFieldChannelObject = 0x0014 // OBJECT_END + 0x000E UnitChannelSpell = 0x0016 // OBJECT_END + 0x0010 UnitFieldBytes0 = 0x0017 // OBJECT_END + 0x0011 = 0x0017 (race, class, gender, powertype) UnitFieldHealth = 0x0018 // OBJECT_END + 0x0012 UnitFieldPower1 = 0x0019 // OBJECT_END + 0x0013 (mana/rage/energy) UnitFieldMaxHealth = 0x0020 // OBJECT_END + 0x001A UnitFieldMaxPower1 = 0x0021 // OBJECT_END + 0x001B UnitFieldLevel = 0x0036 // OBJECT_END + 0x0030 UnitFieldFaction = 0x0037 // OBJECT_END + 0x0031 (faction template) UnitFieldFlags = 0x003B // OBJECT_END + 0x0035 UnitFieldFlags2 = 0x003C // OBJECT_END + 0x0036 // UNIT_FIELD_BYTES_2 = OBJECT_END + 0x0074 (sheath / PvP / FFA / sanctuary). UnitFieldBytes2 = 0x007A UnitFieldDisplayID = 0x0043 // OBJECT_END + 0x003D UnitFieldNativeDisplayID = 0x0044 // OBJECT_END + 0x003E UnitDynamicFlags = 0x004F // OBJECT_END + 0x0049 UnitNPCFlags = 0x0052 // OBJECT_END + 0x004C // UNIT_END = OBJECT_END + 0x008E = 0x94 (3.3.5a) // PLAYER_FIELD_COINAGE = UNIT_END + 0x03FE PlayerFieldCoinage = 0x0492 // PLAYER_VISIBLE_ITEM_1_ENTRYID = UNIT_END + 0x0087. Each paper-doll slot // is entry + enchantment (stride 2). Slot 0 = head … slot 18 = tabard. PlayerVisibleItem1EntryID uint16 = 0x011B PlayerVisibleItemStride uint16 = 2 // UNIT_FIELD_AURASTATE (bitmask of aura states). Fast path hint only; // authoritative aura list comes from SMSG_AURA_UPDATE* packets. UnitFieldAuraState = 0x003C // OBJECT_END + 0x0036 (typical); adjust if your build differs )
Unit fields from AzerothCore UpdateFields.h (OBJECT_END = 0x0006)
const ( EquipmentSlotHead uint8 = 0 EquipmentSlotNeck uint8 = 1 EquipmentSlotShoulders uint8 = 2 EquipmentSlotBody uint8 = 3 // shirt EquipmentSlotChest uint8 = 4 EquipmentSlotWaist uint8 = 5 EquipmentSlotLegs uint8 = 6 EquipmentSlotFeet uint8 = 7 EquipmentSlotWrists uint8 = 8 EquipmentSlotHands uint8 = 9 EquipmentSlotFinger1 uint8 = 10 EquipmentSlotFinger2 uint8 = 11 EquipmentSlotTrinket1 uint8 = 12 EquipmentSlotTrinket2 uint8 = 13 EquipmentSlotBack uint8 = 14 EquipmentSlotMainHand uint8 = 15 EquipmentSlotOffHand uint8 = 16 EquipmentSlotRanged uint8 = 17 EquipmentSlotTabard uint8 = 18 EquipmentSlotEnd uint8 = 19 )
Equipment slots (3.3.5a SharedDefines.h EQUIPMENT_SLOT_*). These are also the PLAYER_VISIBLE_ITEM index (slot 0 → visible item 1).
const ( LootMethodFreeForAll uint8 = 0 LootMethodRoundRobin uint8 = 1 LootMethodMasterLoot uint8 = 2 LootMethodGroupLoot uint8 = 3 LootMethodNeedBeforeGreed uint8 = 4 )
LootMethod values for CMSG_LOOT_METHOD / SMSG_GROUP_LIST (3.3.5a).
const ( ItemQualityPoor uint8 = 0 ItemQualityNormal uint8 = 1 ItemQualityUncommon uint8 = 2 ItemQualityRare uint8 = 3 ItemQualityEpic uint8 = 4 ItemQualityLegendary uint8 = 5 )
Item quality thresholds for CMSG_LOOT_METHOD (3.3.5a ItemQualities). AC rejects lootThreshold < Uncommon in HandleLootMethodOpcode.
const ( PetCommandStay uint32 = 0 PetCommandFollow uint32 = 1 PetCommandAttack uint32 = 2 PetCommandAbandon uint32 = 3 // dismiss summoned pet / abandon hunter pet PetActCommand uint8 = 0x07 )
Pet command / action-bar packing (CharmInfo.h / Unit.h).
const ( UnitDynflagLootable = 0x0001 UnitDynflagDead = 0x0020 )
From AC SharedDefines.h - dyn flags for dead/lootable corpses
const ( UnitFlagInCombat uint32 = 0x00080000 UnitFlagNotAttackable uint32 = 0x00000002 UnitFlagNotAttackable1 uint32 = 0x00000080 UnitFlagImmuneToPC uint32 = 0x00000100 UnitFlagNotAttackable2 uint32 = 0x00010000 UnitFlagNotSelectable uint32 = 0x02000000 UnitFlagDisarmed uint32 = 0x00200000 UnitFlagPacified uint32 = 0x00020000 UnitFlagStunned uint32 = 0x00040000 UnitFlagDead uint32 = 0x20000000 UnitFlagTaxiFlight uint32 = 0x00100000 // from AC UnitDefines.h - must skip for attack (see _IsValidAttackTarget) )
UnitFlags
const ( UnitByte2FlagPvP uint32 = 0x01 UnitByte2FlagFFAPvP uint32 = 0x04 UnitByte2FlagSanctuary uint32 = 0x08 )
UNIT_FIELD_BYTES_2 byte 1 (UnitPVPStateFlags).
const GameObjectMeetingStoneSummonPortal uint32 = 179944
GameObjectMeetingStoneSummonPortal is created by SpellCreateMeetingStonePortal.
const GuildBankSlotAuto uint8 = 0xFF
GuildBankSlotAuto asks the server to place into the first free bank slot.
const SmsgItemPushResult uint16 = 0x0166
SMSG_ITEM_PUSH_RESULT (3.3.5a).
const SpellCreateMeetingStonePortal uint32 = 59782
SpellCreateMeetingStonePortal creates GO 179944 (reqParticipants=2): initiator + one helper click. Misc GO entry 179944; used after initiator SetTarget(far player).
const SpellRitualOfSummoning = SpellSummonPlayer
Deprecated alias — prefer SpellSummonPlayer for the EffectSummonPlayer spell.
const SpellSummonPlayer uint32 = 7720
SpellSummonPlayer is EFFECT_SUMMON_PLAYER (SMSG_SUMMON_REQUEST to unitTarget). Fired when a summoning ritual portal completes (e.g. GO 179944 spellId).
const SpellWarlockRitualOfSummoning uint32 = 698
SpellRitualOfSummoning is the warlock channel that creates GO 194108 (needs 2 helper clicks).
const (
TextEmoteLaugh uint32 = 0x3C // 60 = LAUGH
)
Laugh emote ID
Variables ¶
This section is empty.
Functions ¶
func CreatureGUID ¶
CreatureGUID builds a 3.3.5a HighGuid::Unit ObjectGuid (entry + counter).
func GameObjectGUID ¶
GameObjectGUID builds a 3.3.5a HighGuid::GameObject ObjectGuid (entry + counter).
func IsHighValueTraceOpcode ¶
IsHighValueTraceOpcode reports opcodes worth recording under --trace-packets. Excludes flood-prone update/move streams that drown the timeline.
func MakePetActionButton ¶
MakePetActionButton packs spell/action + ACT_* type into CMSG_PET_ACTION data.
func OpcodeName ¶
OpcodeName returns a human-readable name for known 3.3.5a opcodes. Unknown values are returned as hex (e.g. "0x1234").
func ParseGuildBankMoneyWithdrawn ¶
ParseGuildBankMoneyWithdrawn decodes MSG_GUILD_BANK_MONEY_WITHDRAWN (remaining copper today, -1 unlimited).
func ParseTurnInPetitionResults ¶
ParseTurnInPetitionResults decodes SMSG_TURN_IN_PETITION_RESULTS.
func PlayerVisibleItemEntryField ¶ added in v1.0.8
PlayerVisibleItemEntryField is PLAYER_VISIBLE_ITEM_(slot+1)_ENTRYID, or 0 if slot is out of range.
func SpellFailReasonName ¶
SpellFailReasonName maps 3.3.5a SpellCastResult codes (AC SharedDefines) to short names. Common e2e/AI reasons are covered; unknown codes fall back to REASON_N.
func TradeStatusName ¶
TradeStatusName returns a short label for logging.
Types ¶
type AttackReject ¶
type AttackReject struct {
GUID uint64
Reason string // e.g. "NOT_IN_RANGE", "BAD_FACING", "DEAD_TARGET", "CANT_ATTACK", "ATTACK_STOP"
Class RejectClass
Opcode uint16
}
AttackReject is structured feedback from the server (or client inference) about why an attack/swing failed.
func (AttackReject) IsTerminal ¶
func (r AttackReject) IsTerminal() bool
IsTerminal reports whether this reject should drop the target from the valid pool.
func (AttackReject) IsTransient ¶
func (r AttackReject) IsTransient() bool
IsTransient reports whether the bot should keep the target and correct posture.
type AuthClient ¶
type AuthClient struct {
// contains filtered or unexported fields
}
AuthClient handles the authentication protocol
func NewAuthClient ¶
func NewAuthClient(username, password string) *AuthClient
NewAuthClient creates a new auth client
func (*AuthClient) Authenticate ¶
func (a *AuthClient) Authenticate(authAddr string) ([]RealmInfo, error)
Authenticate connects to the auth server and performs SRP6 authentication
func (*AuthClient) SessionKey ¶
func (a *AuthClient) SessionKey() []byte
SessionKey returns the session key after successful authentication
type CharEnumEntry ¶
CharEnumEntry holds character data from SMSG_CHAR_ENUM
type GroupMember ¶
type GroupMember struct {
Name string
GUID uint64
Online uint8
SubGroup uint8
Flags uint8
Roles uint8
}
GroupMember is one other party member from SMSG_GROUP_LIST (self is omitted).
type GroupState ¶
type GroupState struct {
InGroup bool
GroupType uint8
OwnSubGroup uint8
OwnFlags uint8
OwnRoles uint8
GroupGUID uint64
Counter uint32
// MemberCount is total party size including self (derived: otherMembers+1 when InGroup).
MemberCount int
Members []GroupMember // other members only
LeaderGUID uint64
LootMethod uint8
LootMaster uint64
LootThresh uint8
}
GroupState is the last SMSG_GROUP_LIST snapshot for this client. InGroup is false when the server sent the empty destroyed-list form (memberCount==0 and leaderGUID==0) or after SMSG_GROUP_DESTROYED.
func ParseGroupList ¶
func ParseGroupList(data []byte) (GroupState, error)
ParseGroupList parses SMSG_GROUP_LIST into GroupState (exported for unit tests).
type GuildBankList ¶
type GuildBankList struct {
Money uint64
Tab uint8
Remaining int32
FullUpdate bool
TabInfos []GuildBankTabInfo // only when FullUpdate && Tab==0
Items []GuildBankListItem
}
GuildBankList is a parsed SMSG_GUILD_BANK_LIST (full or partial).
func ParseGuildBankList ¶
func ParseGuildBankList(data []byte) (*GuildBankList, error)
ParseGuildBankList decodes SMSG_GUILD_BANK_LIST.
type GuildBankListItem ¶
type GuildBankListItem struct {
Slot uint8
Entry uint32
Flags int32
RandomPropertyID int32
Count int32
EnchantmentID int32
Charges uint8
}
GuildBankListItem is one slot entry in SMSG_GUILD_BANK_LIST.
type GuildBankTabInfo ¶
GuildBankTabInfo is name/icon of a purchased bank tab.
type ItemPushResult ¶
type ItemPushResult struct {
PlayerGUID uint64
Received uint32 // 0=looted, 1=from npc
Created uint32 // 0=received, 1=created
ShowChatMessage uint32
BagSlot uint8
// ItemSlot is the backpack/equip slot, or 0xFFFFFFFF when stacked onto existing.
ItemSlot uint32
Entry uint32
SuffixFactor uint32
RandomPropertyID int32
Count uint32
// InventoryCount is the player's total count of this entry after the push.
InventoryCount uint32
}
ItemPushResult is a parsed SMSG_ITEM_PUSH_RESULT payload. Note: the packet does not carry the item ObjectGuid — only entry + bag/slot.
func ParseItemPushResult ¶
func ParseItemPushResult(data []byte) (*ItemPushResult, error)
ParseItemPushResult decodes SMSG_ITEM_PUSH_RESULT. Layout (AC Player::SendNewItem): guid(8) + received(4) + created(4) + chat(4) + bag(1) + slot(4) + entry(4) + suffix(4) + randomProp(4) + count(4) + invCount(4).
type KnownSpell ¶
KnownSpell represents a spell the bot knows
type LogLevel ¶
type LogLevel int
LogLevel filters WorldClient diagnostic output when logFunc is non-nil. nil logFunc is always silent (unchanged contract).
Ordering: higher value = more verbose. A message emits when messageLevel <= configured LogLevel (Error is most important).
const ( // LogSilent disables all WorldClient logs even when logFunc is set. LogSilent LogLevel = 0 // LogError auth/hard failures only. LogError LogLevel = 1 // LogWarn protocol warnings, parse errors, terminal swing rejects. LogWarn LogLevel = 2 // LogInfo lifecycle / sparse e2e signal (default when logFunc != nil). LogInfo LogLevel = 3 // LogDebug hot paths: selection, swings, GM verbose, trade status, damage. LogDebug LogLevel = 4 // LogTrace per-spell learn lines and opcode hex dumps. LogTrace LogLevel = 5 )
func ParseLogLevel ¶
ParseLogLevel maps common names to LogLevel (case-insensitive).
type LootAllPassed ¶
type LootAllPassed struct {
ItemGUID uint64
ItemSlot uint32
ItemID uint32
RandomPropID uint32
RandomSuffix uint32
}
LootAllPassed is SMSG_LOOT_ALL_PASSED.
func ParseLootAllPassed ¶
func ParseLootAllPassed(data []byte) (LootAllPassed, error)
ParseLootAllPassed decodes SMSG_LOOT_ALL_PASSED.
type LootRollEvent ¶
type LootRollEvent struct {
ItemGUID uint64
ItemSlot uint32
TargetGUID uint64
ItemID uint32
RandomSuffix uint32
RandomPropID uint32
RollNumber uint8
RollType uint8
AutoPass uint8
}
LootRollEvent is SMSG_LOOT_ROLL (someone voted).
func ParseLootRoll ¶
func ParseLootRoll(data []byte) (LootRollEvent, error)
ParseLootRoll decodes SMSG_LOOT_ROLL.
type LootRollWon ¶
type LootRollWon struct {
ItemGUID uint64
ItemSlot uint32
ItemID uint32
RandomSuffix uint32
RandomPropID uint32
WinnerGUID uint64
RollNumber uint8
RollType uint8
}
LootRollWon is SMSG_LOOT_ROLL_WON.
func ParseLootRollWon ¶
func ParseLootRollWon(data []byte) (LootRollWon, error)
ParseLootRollWon decodes SMSG_LOOT_ROLL_WON.
type LootStartRoll ¶
type LootStartRoll struct {
ItemGUID uint64
MapID uint32
ItemSlot uint32
ItemID uint32
RandomSuffix uint32
RandomPropID uint32
ItemCount uint32
CountdownMS uint32
RollVoteMask uint8
}
LootStartRoll is SMSG_LOOT_START_ROLL.
func ParseLootStartRoll ¶
func ParseLootStartRoll(data []byte) (LootStartRoll, error)
ParseLootStartRoll decodes SMSG_LOOT_START_ROLL.
type PetitionShowSignatures ¶
type PetitionShowSignatures struct {
PetitionGUID uint64
OwnerGUID uint64
PetitionID uint32
SignatoryGUIDs []uint64
}
PetitionShowSignatures is the parsed SMSG_PETITION_SHOW_SIGNATURES payload.
func ParsePetitionShowSignatures ¶
func ParsePetitionShowSignatures(data []byte) (*PetitionShowSignatures, error)
ParsePetitionShowSignatures decodes SMSG_PETITION_SHOW_SIGNATURES.
type PetitionSignResults ¶
PetitionSignResults is the parsed SMSG_PETITION_SIGN_RESULTS payload.
func ParsePetitionSignResults ¶
func ParsePetitionSignResults(data []byte) (*PetitionSignResults, error)
ParsePetitionSignResults decodes SMSG_PETITION_SIGN_RESULTS.
type RejectClass ¶
type RejectClass int
RejectClass classifies server combat/cast feedback so upper layers can distinguish protocol/precondition misses from true terminal world-state.
Transient: bot should adjust (approach, face, wait) and keep the target. Terminal: target is not a valid attack target; clear and do not re-pick soon. Unknown: ambiguous (e.g. SMSG_ATTACK_STOP); clear swing state but do not invent death.
const ( RejectUnknown RejectClass = iota RejectTransient RejectTerminal )
func ClassifyAttackSwingReason ¶
func ClassifyAttackSwingReason(reason string) RejectClass
ClassifyAttackSwingReason maps SMSG_ATTACKSWING_* reasons to a reject class. Transient preconditions (range/facing) must never be treated as death.
func (RejectClass) String ¶
func (c RejectClass) String() string
type SessionPhase ¶
type SessionPhase int
SessionPhase mirrors AzerothCore WorldSession status gates that matter for bots. Gameplay CMSG (move/cast/attack) is only valid in PhaseInWorld; far teleports temporarily require WORLDPORT_ACK before movement is accepted again.
const ( PhaseNone SessionPhase = iota PhaseConnected // TCP + crypto ready, waiting AUTH_RESPONSE PhaseAuthed // AUTH_OK; char enum/create/login allowed PhaseLoading // CMSG_PLAYER_LOGIN sent; waiting LOGIN_VERIFY_WORLD PhaseInWorld // character in world; normal gameplay PhaseFarTransfer // SMSG_NEW_WORLD received; WORLDPORT_ACK in flight PhaseNearTeleport // SMSG_MOVE_TELEPORT for self; TELEPORT_ACK in flight PhaseLogout )
func (SessionPhase) String ¶
func (p SessionPhase) String() string
type SessionPhaseChange ¶
type SessionPhaseChange struct {
From SessionPhase
To SessionPhase
Reason string
}
SessionPhaseChange is emitted on every phase transition.
type SpellCooldown ¶
SpellCooldown tracks a spell's cooldown expiry
type SummonRequest ¶
type SummonRequest struct {
SummonerGUID uint64
ZoneID uint32
AutoDecline uint32 // ms until auto-decline
ReceivedAt time.Time
}
SummonRequest is a pending SMSG_SUMMON_REQUEST.
type TradeStatusInfo ¶
type TradeStatusInfo struct {
Status uint32
TraderGUID uint64 // BEGIN_TRADE
Result uint32 // CLOSE_WINDOW inventory result
IsTargetResult uint8
ItemLimitedByLimitCategory uint32
Slot uint8 // WRONG_REALM / NOT_ON_TAPLIST
}
TradeStatusInfo is a parsed SMSG_TRADE_STATUS.
func ParseTradeStatus ¶
func ParseTradeStatus(data []byte) (TradeStatusInfo, error)
ParseTradeStatus decodes SMSG_TRADE_STATUS (variable payload after status).
type WorldClient ¶
type WorldClient struct {
OnCharList func(chars []CharEnumEntry)
OnCharCreateResult func(data []byte)
OnChatMessage func(senderName, message string, msgType uint8)
OnLevelUp func(newLevel uint32)
OnDeath func()
OnKill func(victimGUID uint64)
OnObjectUpdate func(guid uint64, obj *WorldObject)
OnObjectRemove func(guid uint64)
OnLootOpened func(lootGUID uint64, items []LootItem)
OnCombatStart func(attackerGUID, victimGUID uint64)
OnCombatStop func()
// OnInvalidTarget is fired only for terminal rejects (dead / cant-attack).
// Prefer OnAttackReject for full taxonomy (transient vs terminal).
OnInvalidTarget func(victimGUID uint64)
// OnAttackReject fires for every classified attack-side server reject so bots
// can approach/face on transient errors instead of marking the unit dead.
OnAttackReject func(r AttackReject)
// OnPacket is invoked for every received world opcode (before handlers).
// Prefer AddPacketHook for multi-subscriber waiters.
OnPacket func(opcode uint16, data []byte)
// OnPacketSend is invoked for every outbound world opcode (after build, before write).
OnPacketSend func(opcode uint16, data []byte)
// OnSpellCastResult reports SPELL_GO (success) or SPELL_FAILURE / CAST_FAILED.
// failReason is 0 on success; otherwise the server reason byte when available.
OnSpellCastResult func(spellID uint32, success bool, failReason uint8)
// OnServerRelocate fires when the server forcibly moves the player (charge,
// blink, knockback, monster-move spline on self). Bot must abort local paths
// or updateMovement will write pre-relocate coords back over the new pose.
OnServerRelocate func(x, y, z, o float32, reason string)
// OnSessionPhase fires on every session phase transition.
OnSessionPhase func(c SessionPhaseChange)
// OnProtocolWarning fires when we send gameplay opcodes outside PhaseInWorld.
OnProtocolWarning func(msg string, opcode uint16, phase SessionPhase)
// TraceLogOpcodes enables noisy console dumps of combat/spell server opcodes.
// Off by default; bots enable under --validation-mode --trace-packets.
TraceLogOpcodes bool
// OnGroupInvite fires when SMSG_GROUP_INVITE arrives (inviter name).
OnGroupInvite func(inviterName string, alreadyInGroup bool)
// OnGroupList fires after each SMSG_GROUP_LIST parse (including empty leave).
OnGroupList func(state GroupState)
// OnTradeStatus fires for every SMSG_TRADE_STATUS.
OnTradeStatus func(info TradeStatusInfo)
// OnLootStartRoll fires when a new group roll window opens.
OnLootStartRoll func(r LootStartRoll)
// OnLootRoll fires when any member votes.
OnLootRoll func(r LootRollEvent)
// OnLootRollWon fires when a roll is awarded.
OnLootRollWon func(r LootRollWon)
// OnLootAllPassed fires when everyone passes.
OnLootAllPassed func(r LootAllPassed)
OnSummonRequest func(SummonRequest)
// contains filtered or unexported fields
}
WorldClient handles the world server protocol
func NewWorldClient ¶
func NewWorldClient(username string, sessionKey []byte, logFunc func(string, ...interface{})) *WorldClient
NewWorldClient creates a world client. logFunc nil → fully silent. Non-nil defaults to LogInfo (lifecycle / sparse diagnostics; hot paths and per-spell learn lines require LogDebug / LogTrace via SetLogLevel).
func (*WorldClient) AcceptTrade ¶
func (w *WorldClient) AcceptTrade() error
AcceptTrade sends CMSG_ACCEPT_TRADE (empty payload on 3.3.5a).
func (*WorldClient) ActiveLootRolls ¶
func (w *WorldClient) ActiveLootRolls() []LootStartRoll
ActiveLootRolls returns a copy of pending start-roll snapshots.
func (*WorldClient) AddGroupDeclineHook ¶
func (w *WorldClient) AddGroupDeclineHook(fn func(declinerName string)) (cancel func())
AddGroupDeclineHook registers a listener for SMSG_GROUP_DECLINE (leader side).
func (*WorldClient) AddGroupInviteHook ¶
func (w *WorldClient) AddGroupInviteHook(fn func(inviterName string, alreadyInGroup bool)) (cancel func())
func (*WorldClient) AddGroupListHook ¶
func (w *WorldClient) AddGroupListHook(fn func(GroupState)) (cancel func())
func (*WorldClient) AddInstanceResetHook ¶
func (w *WorldClient) AddInstanceResetHook(fn func(mapID uint32, ok bool)) (cancel func())
AddInstanceResetHook fires on SMSG_INSTANCE_RESET (ok=true) or FAILED (ok=false).
func (*WorldClient) AddLootAllPassedHook ¶
func (w *WorldClient) AddLootAllPassedHook(fn func(LootAllPassed)) (cancel func())
func (*WorldClient) AddLootOpenedHook ¶
func (w *WorldClient) AddLootOpenedHook(fn func(lootGUID uint64, items []LootItem)) (cancel func())
func (*WorldClient) AddLootRollHook ¶
func (w *WorldClient) AddLootRollHook(fn func(LootRollEvent)) (cancel func())
func (*WorldClient) AddLootRollWonHook ¶
func (w *WorldClient) AddLootRollWonHook(fn func(LootRollWon)) (cancel func())
func (*WorldClient) AddLootStartRollHook ¶
func (w *WorldClient) AddLootStartRollHook(fn func(LootStartRoll)) (cancel func())
func (*WorldClient) AddPacketHook ¶
func (w *WorldClient) AddPacketHook(fn func(opcode uint16, data []byte)) (cancel func())
AddPacketHook registers a raw opcode listener. Returns cancel (safe to call once).
func (*WorldClient) AddSpellCastResultHook ¶
func (w *WorldClient) AddSpellCastResultHook(fn func(spellID uint32, success bool, failReason uint8)) (cancel func())
func (*WorldClient) AddSummonRequestHook ¶
func (w *WorldClient) AddSummonRequestHook(fn func(SummonRequest)) (cancel func())
AddSummonRequestHook registers a multi-subscriber SMSG_SUMMON_REQUEST listener.
func (*WorldClient) AddTradeStatusHook ¶
func (w *WorldClient) AddTradeStatusHook(fn func(TradeStatusInfo)) (cancel func())
func (*WorldClient) ApplyLocalDamage ¶
func (w *WorldClient) ApplyLocalDamage(guid uint64, damage uint32)
ApplyLocalDamage applies damage seen in AttackerStateUpdate packets to the local object cache. This helps when the server doesn't promptly send UNIT_FIELD_HEALTH=0 updates for mobs killed by other players/bots (common in multi-bot scenarios). We locally simulate the health reduction so IsAlive() and targeting see death faster, avoiding the "8/55 on dead mob" problem.
func (*WorldClient) ArmSummonRequest ¶
func (w *WorldClient) ArmSummonRequest() (wait func(timeout time.Duration) (SummonRequest, error), cancel func())
ArmSummonRequest arms before the summon-generating action (Arm → cast → Wait).
func (*WorldClient) AttackStop ¶
func (w *WorldClient) AttackStop() error
AttackStop sends CMSG_ATTACKSTOP to stop attacking
func (*WorldClient) AttackSwing ¶
func (w *WorldClient) AttackSwing(targetGUID uint64) error
AttackSwing sends CMSG_ATTACKSWING to start melee attacking a target
func (*WorldClient) AttackingGUID ¶
func (w *WorldClient) AttackingGUID() uint64
AttackingGUID returns the GUID we last sent CMSG_ATTACKSWING for (0 if not swinging).
func (*WorldClient) AutoEquipItem ¶
func (w *WorldClient) AutoEquipItem(bag, slot uint8) error
AutoEquipItem sends CMSG_AUTOEQUIP_ITEM for a bag/slot inventory location. bag=255 is the backpack; slots 23..38 are backpack item slots on 3.3.5a.
func (*WorldClient) BeginTrade ¶
func (w *WorldClient) BeginTrade() error
BeginTrade sends CMSG_BEGIN_TRADE (response to BEGIN_TRADE status).
func (*WorldClient) CancelAura ¶
func (w *WorldClient) CancelAura(spellID uint32) error
CancelAura sends CMSG_CANCEL_AURA for spellID.
func (*WorldClient) CancelCast ¶
func (w *WorldClient) CancelCast() error
CancelCast sends CMSG_CANCEL_CAST (optional cast count; 0 is fine).
func (*WorldClient) CancelTrade ¶
func (w *WorldClient) CancelTrade() error
CancelTrade sends CMSG_CANCEL_TRADE.
func (*WorldClient) CastSpell ¶
func (w *WorldClient) CastSpell(spellID uint32, targetGUID uint64) error
CastSpell sends CMSG_CAST_SPELL for the given spell targeting a unit
func (*WorldClient) CastSpellAtPosition ¶
func (w *WorldClient) CastSpellAtPosition(spellID uint32, x, y, z float32) error
CastSpellAtPosition sends a spell targeted at a world position (ground-targeted AoE). 3.3.5a target flags: TARGET_FLAG_DEST_LOCATION = 0x40 (0x20 is SOURCE_LOCATION).
func (*WorldClient) ChannelSpell ¶
func (w *WorldClient) ChannelSpell() uint32
ChannelSpell returns UNIT_CHANNEL_SPELL on the player (0 if not channeling).
func (*WorldClient) CharGUID ¶
func (w *WorldClient) CharGUID() uint64
CharGUID returns the GUID of the logged-in character.
func (*WorldClient) CharRace ¶
func (w *WorldClient) CharRace() uint8
CharRace returns the race set via SetCharRace / character create.
func (*WorldClient) ClearActiveLootRolls ¶
func (w *WorldClient) ClearActiveLootRolls()
ClearActiveLootRolls drops cached start-roll state (e.g. between tests).
func (*WorldClient) ClearCombat ¶
func (w *WorldClient) ClearCombat()
ClearCombat clears the combat state.
func (*WorldClient) ClearPendingSummon ¶
func (w *WorldClient) ClearPendingSummon()
ClearPendingSummon drops the cached summon request (after accept/decline).
func (*WorldClient) ClearTarget ¶
func (w *WorldClient) ClearTarget()
ClearTarget clears the current target selection.
func (*WorldClient) ClearTradeItem ¶
func (w *WorldClient) ClearTradeItem(tradeSlot uint8) error
ClearTradeItem clears a trade slot.
func (*WorldClient) Close ¶
func (w *WorldClient) Close()
Close closes the connection and unblocks any pending reads. Always signals stopChan (once) so waiters wake on hard disconnect.
func (*WorldClient) CompleteCinematic ¶
func (w *WorldClient) CompleteCinematic() error
CompleteCinematic sends CMSG_COMPLETE_CINEMATIC
func (*WorldClient) Connect ¶
func (w *WorldClient) Connect(worldAddr string) error
Connect connects to the world server
func (*WorldClient) ControlGUID ¶
func (w *WorldClient) ControlGUID() uint64
ControlGUID returns the unit last granted by SMSG_CLIENT_CONTROL_UPDATE (0 if self/none).
func (*WorldClient) CorpseReclaimDelayMs ¶
func (w *WorldClient) CorpseReclaimDelayMs() uint32
CorpseReclaimDelayMs returns the last SMSG_CORPSE_RECLAIM_DELAY value (0 if none).
func (*WorldClient) CreateCharacter ¶
func (w *WorldClient) CreateCharacter(name string, race, class, gender, skin, face, hairStyle, hairColor, facialHair, outfitID uint8) error
CreateCharacter sends CMSG_CHAR_CREATE
func (*WorldClient) CreatureQuery ¶
func (w *WorldClient) CreatureQuery(entry uint32, guid uint64) error
CreatureQuery sends CMSG_CREATURE_QUERY to look up a creature name
func (*WorldClient) DeleteCharacter ¶
func (w *WorldClient) DeleteCharacter(guid uint64) error
DeleteCharacter sends CMSG_CHAR_DELETE for the given GUID. Call RequestCharList before/after as needed to refresh the list. This should only be used when explicitly allowed (orchestrator or --delete-existing-chars).
func (*WorldClient) DismissPet ¶
func (w *WorldClient) DismissPet(petGUID uint64) error
DismissPet sends pet COMMAND_ABANDON via CMSG_PET_ACTION (works for summon dismiss).
func (*WorldClient) EquippedSlot ¶ added in v1.0.8
func (w *WorldClient) EquippedSlot(entry uint32) (uint8, bool)
EquippedSlot returns this session's paper-doll slot showing entry, or false.
func (*WorldClient) FindGameObjectByEntry ¶
func (w *WorldClient) FindGameObjectByEntry(entry uint32, maxDist float32) uint64
FindGameObjectByEntry returns the GUID of a tracked GameObject with the given template entry within maxDist yards of the player (0 = unlimited distance). Entry is matched via OBJECT_FIELD_ENTRY when known, else the 24-bit entry field packed into map-specific ObjectGuids. Returns 0 if none found.
func (*WorldClient) FindUnitByEntry ¶
func (w *WorldClient) FindUnitByEntry(entry uint32, maxDist float32) uint64
FindUnitByEntry returns the GUID of a tracked unit (NPC) with the given template entry. maxDist 0 disables the distance filter (still prefers nearer matches when positions are known). Units without a known position are still considered — CREATE can deliver entry before a usable movement block.
func (*WorldClient) FlushLearnedSpellLog ¶
func (w *WorldClient) FlushLearnedSpellLog()
FlushLearnedSpellLog emits one Info summary for batched SMSG_LEARNED_SPELL packets (e.g. after .learn all my class). Safe to call often; no-ops when count is 0.
func (*WorldClient) GameObjectUse ¶
func (w *WorldClient) GameObjectUse(guid uint64) error
GameObjectUse sends CMSG_GAMEOBJ_USE for guid (uint64).
func (*WorldClient) GetNearbyPlayers ¶
func (w *WorldClient) GetNearbyPlayers(maxDist float32) []*WorldObject
GetNearbyPlayers returns all tracked players within maxDist yards. Returns clones for private per-bot world view.
func (*WorldClient) GetNearbyUnits ¶
func (w *WorldClient) GetNearbyUnits(maxDist float32) []*WorldObject
GetNearbyUnits returns all tracked units (NPCs) within maxDist yards. Returns clones so each bot/AI gets its own private version of the world state (helps with races and different layers/views per connection).
func (*WorldClient) GetObject ¶
func (w *WorldClient) GetObject(guid uint64) *WorldObject
GetObject returns a tracked object by GUID, or nil if not found. It returns a clone so the caller gets its own private snapshot of the world state.
func (*WorldClient) GroupAccept ¶
func (w *WorldClient) GroupAccept() error
GroupAccept sends CMSG_GROUP_ACCEPT to accept a group invitation
func (*WorldClient) GroupDecline ¶
func (w *WorldClient) GroupDecline() error
GroupDecline sends CMSG_GROUP_DECLINE (empty body on 3.3.5a).
func (*WorldClient) GroupDisband ¶
func (w *WorldClient) GroupDisband() error
GroupDisband is an alias of GroupLeave (same client opcode).
func (*WorldClient) GroupInvite ¶
func (w *WorldClient) GroupInvite(playerName string) error
GroupInvite sends CMSG_GROUP_INVITE to invite a player by name. 3.3.5a / AC layout: null-terminated name + uint32 (unk, always 0). Omitting the uint32 can cause HandleGroupInviteOpcode to short-read and drop the invite.
func (*WorldClient) GroupLeave ¶
func (w *WorldClient) GroupLeave() error
GroupLeave sends CMSG_GROUP_DISBAND, which on 3.3.5a leaves the party (and disbands when the last/leader path dissolves the group).
func (*WorldClient) GroupMembers ¶
func (w *WorldClient) GroupMembers() []GroupMember
GroupMembers returns other members from the last SMSG_GROUP_LIST (not including self).
func (*WorldClient) GroupSetLeader ¶
func (w *WorldClient) GroupSetLeader(playerGUID uint64) error
GroupSetLeader sends CMSG_GROUP_SET_LEADER for the given player GUID.
func (*WorldClient) GroupState ¶
func (w *WorldClient) GroupState() GroupState
GroupState returns a snapshot of the last SMSG_GROUP_LIST state.
func (*WorldClient) GroupUninvite ¶
func (w *WorldClient) GroupUninvite(memberName string) error
GroupUninvite sends CMSG_GROUP_UNINVITE by character name (kick / cancel invite).
func (*WorldClient) GroupUninviteGUID ¶
func (w *WorldClient) GroupUninviteGUID(memberGUID uint64, reason string) error
GroupUninviteGUID sends CMSG_GROUP_UNINVITE_GUID.
func (*WorldClient) HasPendingSummon ¶
func (w *WorldClient) HasPendingSummon() bool
HasPendingSummon reports a non-zero summoner GUID in cache.
func (*WorldClient) Health ¶
func (w *WorldClient) Health() uint32
Health returns current player health.
func (*WorldClient) InCombat ¶
func (w *WorldClient) InCombat() bool
InCombat returns whether the bot thinks it is in combat.
func (*WorldClient) InGroup ¶
func (w *WorldClient) InGroup() bool
InGroup reports whether the last group list indicated membership.
func (*WorldClient) InitiateTrade ¶
func (w *WorldClient) InitiateTrade(targetGUID uint64) error
InitiateTrade sends CMSG_INITIATE_TRADE targeting other player GUID.
func (*WorldClient) IsChanneling ¶
func (w *WorldClient) IsChanneling() bool
IsChanneling reports non-zero UNIT_CHANNEL_SPELL on the player.
func (*WorldClient) IsGroupLeader ¶
func (w *WorldClient) IsGroupLeader() bool
IsGroupLeader reports whether charGUID matches the last list's leader GUID.
func (*WorldClient) IsInWorld ¶
func (w *WorldClient) IsInWorld() bool
IsInWorld reports whether the character is in a normal gameplay phase.
func (*WorldClient) IsOnVehicle ¶
func (w *WorldClient) IsOnVehicle() bool
IsOnVehicle reports charm or non-self control (driver/passenger control seat).
func (*WorldClient) IsSpellReady ¶
func (w *WorldClient) IsSpellReady(spellID uint32) bool
IsSpellReady returns true if the spell is known and off cooldown.
func (*WorldClient) IsStopped ¶
func (w *WorldClient) IsStopped() bool
IsStopped reports whether Close/Stop has been called (socket no longer usable). Prefer this over session phase for cleanup paths — phase can lag a closed conn.
func (*WorldClient) KnowsSpell ¶
func (w *WorldClient) KnowsSpell(spellID uint32) bool
KnowsSpell returns true if the bot has learned the given spell.
func (*WorldClient) LastInstanceResetMap ¶
func (w *WorldClient) LastInstanceResetMap() uint32
LastInstanceResetMap is the map id from the last SMSG_INSTANCE_RESET (0 if none/failed).
func (*WorldClient) LastTimeSyncCounter ¶
func (w *WorldClient) LastTimeSyncCounter() uint32
LastTimeSyncCounter returns the last SMSG_TIME_SYNC_REQ counter we answered.
func (*WorldClient) LastTradeStatus ¶
func (w *WorldClient) LastTradeStatus() TradeStatusInfo
LastTradeStatus returns the last SMSG_TRADE_STATUS snapshot. Note: TradeStatusBusy == 0, so an all-zero struct means "never received" unless TradeStatusSeen is true. Prefer TradeStatusSeen / TradeStatusSeq for that distinction.
func (*WorldClient) ListGameObjectEntries ¶
func (w *WorldClient) ListGameObjectEntries(limit int) []uint32
ListGameObjectEntries returns up to limit unique entry samples from tracked GOs (debug).
func (*WorldClient) LogLevel ¶
func (w *WorldClient) LogLevel() LogLevel
LogLevel returns the current filter level.
func (*WorldClient) LoginCharacter ¶
func (w *WorldClient) LoginCharacter(guid uint64) error
LoginCharacter sends CMSG_PLAYER_LOGIN
func (*WorldClient) Loot ¶
func (w *WorldClient) Loot(guid uint64) error
Loot sends CMSG_LOOT to loot a unit/object
func (*WorldClient) LootItem ¶
func (w *WorldClient) LootItem(slot uint8) error
LootItem sends CMSG_AUTOSTORE_LOOT_ITEM to take a loot item by slot
func (*WorldClient) LootMasterGive ¶
func (w *WorldClient) LootMasterGive(lootGUID uint64, slot uint8, targetGUID uint64) error
LootMasterGive sends CMSG_LOOT_MASTER_GIVE.
func (*WorldClient) LootMoney ¶
func (w *WorldClient) LootMoney() error
LootMoney sends CMSG_LOOT_MONEY to collect money from loot
func (*WorldClient) LootRelease ¶
func (w *WorldClient) LootRelease(guid uint64) error
LootRelease sends CMSG_LOOT_RELEASE to close the loot window
func (*WorldClient) LootRoll ¶
func (w *WorldClient) LootRoll(itemGUID uint64, itemSlot uint32, rollType uint8) error
LootRoll sends CMSG_LOOT_ROLL (itemGUID, slot, rollType).
func (*WorldClient) MarkObjectDead ¶
func (w *WorldClient) MarkObjectDead(guid uint64)
MarkObjectDead forces health=0 for the given GUID in the object cache. Used on kill prediction/confirmation so IsAlive() and BT decisions see death immediately instead of waiting for the next values update (prevents chasing/looking at dead).
func (*WorldClient) MaxHealth ¶
func (w *WorldClient) MaxHealth() uint32
MaxHealth returns max player health.
func (*WorldClient) Money ¶
func (w *WorldClient) Money() uint32
Money returns player copper from PLAYER_FIELD_COINAGE (0 if not yet seen).
func (*WorldClient) MoveForward ¶
func (w *WorldClient) MoveForward() error
MoveForward starts forward movement toward a destination. The caller is responsible for sending MsgMoveStop when arriving.
func (*WorldClient) MoveForwardAt ¶
func (w *WorldClient) MoveForwardAt(x, y, z, o float32) error
func (*WorldClient) MoveForwardAtTime ¶
func (w *WorldClient) MoveForwardAtTime(x, y, z, o float32, at time.Time) error
func (*WorldClient) MoveSpeed ¶
func (w *WorldClient) MoveSpeed() float32
MoveSpeed returns the current movement speed.
func (*WorldClient) MoveStopAt ¶
func (w *WorldClient) MoveStopAt(x, y, z, o float32) error
func (*WorldClient) MoveStopAtTime ¶
func (w *WorldClient) MoveStopAtTime(x, y, z, o float32, at time.Time) error
func (*WorldClient) NameQuery ¶
func (w *WorldClient) NameQuery(guid uint64) error
NameQuery sends CMSG_NAME_QUERY to look up a player name
func (*WorldClient) NextCinematicCamera ¶
func (w *WorldClient) NextCinematicCamera() error
NextCinematicCamera sends CMSG_NEXT_CINEMATIC_CAMERA
func (*WorldClient) ObjectTrackStats ¶
func (w *WorldClient) ObjectTrackStats() (byType map[uint8]int, gameObjectHigh int, total int)
ObjectTrackStats returns counts by TypeID plus how many objects carry HighGuid GameObject.
func (*WorldClient) PendingSummon ¶
func (w *WorldClient) PendingSummon() SummonRequest
PendingSummon returns the last SMSG_SUMMON_REQUEST snapshot (zero if none).
func (*WorldClient) PetAction ¶
func (w *WorldClient) PetAction(petGUID uint64, actionData uint32, targetGUID uint64) error
PetAction sends CMSG_PET_ACTION (petGUID, packed action, targetGUID).
func (*WorldClient) PetAttackCommand ¶
func (w *WorldClient) PetAttackCommand(petGUID, targetGUID uint64) error
PetAttackCommand commands the pet to attack targetGUID.
func (*WorldClient) PlayerCharmGUID ¶
func (w *WorldClient) PlayerCharmGUID() uint64
PlayerCharmGUID returns UNIT_FIELD_CHARM on the player object (controlled vehicle).
func (*WorldClient) PlayerLevel ¶
func (w *WorldClient) PlayerLevel() uint32
PlayerLevel returns the bot's current level.
func (*WorldClient) PlayerPetGUID ¶
func (w *WorldClient) PlayerPetGUID() uint64
PlayerPetGUID returns UNIT_FIELD_SUMMON on the player object (0 if none).
func (*WorldClient) PlayerVehicleEnter ¶
func (w *WorldClient) PlayerVehicleEnter(playerGUID uint64) error
PlayerVehicleEnter sends CMSG_PLAYER_VEHICLE_ENTER (raid member vehicle kit).
func (*WorldClient) Position ¶
func (w *WorldClient) Position() (x, y, z, o float32, mapID uint32)
Position returns the current position of the character.
func (*WorldClient) Power ¶
func (w *WorldClient) Power() (current, max uint32)
func (*WorldClient) QuestgiverAcceptQuest ¶
func (w *WorldClient) QuestgiverAcceptQuest(npcGUID uint64, questID uint32) error
QuestgiverAcceptQuest sends CMSG_QUESTGIVER_ACCEPT_QUEST
func (*WorldClient) QuestgiverChooseReward ¶
func (w *WorldClient) QuestgiverChooseReward(npcGUID uint64, questID uint32, reward uint32) error
QuestgiverChooseReward sends CMSG_QUESTGIVER_CHOOSE_REWARD
func (*WorldClient) QuestgiverCompleteQuest ¶
func (w *WorldClient) QuestgiverCompleteQuest(npcGUID uint64, questID uint32) error
QuestgiverCompleteQuest sends CMSG_QUESTGIVER_COMPLETE_QUEST
func (*WorldClient) QuestgiverHello ¶
func (w *WorldClient) QuestgiverHello(npcGUID uint64) error
QuestgiverHello sends CMSG_QUESTGIVER_HELLO
func (*WorldClient) ReclaimCorpse ¶
func (w *WorldClient) ReclaimCorpse() error
ReclaimCorpse sends CMSG_RECLAIM_CORPSE (resurrect at corpse)
func (*WorldClient) RepopRequest ¶
func (w *WorldClient) RepopRequest() error
RepopRequest sends CMSG_REPOP_REQUEST (release spirit after death)
func (*WorldClient) RequestCharList ¶
func (w *WorldClient) RequestCharList() error
RequestCharList sends CMSG_CHAR_ENUM
func (*WorldClient) RequestVehicleExit ¶
func (w *WorldClient) RequestVehicleExit() error
RequestVehicleExit sends empty CMSG_REQUEST_VEHICLE_EXIT (leave seat).
func (*WorldClient) ResetInstances ¶
func (w *WorldClient) ResetInstances() error
ResetInstances sends empty CMSG_RESET_INSTANCES (leader or solo).
func (*WorldClient) Run ¶
func (w *WorldClient) Run() error
Run starts reading and processing packets. Blocks until connection closes.
func (*WorldClient) SelfAuraStacks ¶
func (w *WorldClient) SelfAuraStacks(spellID uint32) int
SelfAuraStacks returns stack count for spellID on the player (0 if absent).
func (*WorldClient) SelfAuras ¶
func (w *WorldClient) SelfAuras() []uint32
SelfAuras returns a snapshot of active aura spell IDs on the player.
func (*WorldClient) SelfHasAura ¶
func (w *WorldClient) SelfHasAura(spellID uint32) bool
SelfHasAura reports whether the player currently has spellID as an active aura (from SMSG_AURA_UPDATE* tracking on the self WorldObject).
func (*WorldClient) SelfIsPvP ¶
func (w *WorldClient) SelfIsPvP() bool
SelfIsPvP reports UNIT_BYTE2_FLAG_PVP on the player's own object.
func (*WorldClient) SendChatMessage ¶
func (w *WorldClient) SendChatMessage(msgType, lang uint32, message string) error
SendChatMessage sends a chat message
func (*WorldClient) SendGMCommand ¶
func (w *WorldClient) SendGMCommand(command string) error
SendGMCommand sends a chat message that is a GM command (e.g., ".gm on"). Language is the character's native racial language — see nativeChatLang.
func (*WorldClient) SendGuildBankBuyTab ¶
func (w *WorldClient) SendGuildBankBuyTab(bankerGUID uint64, tab uint8) error
SendGuildBankBuyTab purchases the next bank tab (only guild master).
func (*WorldClient) SendGuildBankDepositItem ¶
func (w *WorldClient) SendGuildBankDepositItem(bankerGUID uint64, tab, slot, bag, bagSlot uint8, itemEntry, stackCount uint32) error
SendGuildBankDepositItem deposits the inventory item at (bag, bagSlot) into bank tab/slot. Use GuildBankSlotAuto (0xFF) for first free bank slot. stackCount 0 means the whole stack.
func (*WorldClient) SendGuildBankDepositMoney ¶
func (w *WorldClient) SendGuildBankDepositMoney(bankerGUID uint64, amount uint32) error
SendGuildBankDepositMoney deposits copper from the player into the guild bank.
func (*WorldClient) SendGuildBankQueryTab ¶
func (w *WorldClient) SendGuildBankQueryTab(bankerGUID uint64, tab uint8, fullUpdate bool) error
SendGuildBankQueryTab requests SMSG_GUILD_BANK_LIST for a tab.
func (*WorldClient) SendGuildBankWithdrawItem ¶
func (w *WorldClient) SendGuildBankWithdrawItem(bankerGUID uint64, tab, slot uint8, itemEntry, stackCount uint32) error
SendGuildBankWithdrawItem withdraws the bank item at tab/slot into inventory. stackCount 0 means the whole stack.
AC GuildHandler allows NULL_BAG/NULL_SLOT (255/255) for auto inventory placement on withdraw. bag=0/slot=0 is equipment and is rejected (EQUIP_ERR).
func (*WorldClient) SendGuildBankWithdrawMoney ¶
func (w *WorldClient) SendGuildBankWithdrawMoney(bankerGUID uint64, amount uint32) error
SendGuildBankWithdrawMoney withdraws copper from the guild bank to the player.
func (*WorldClient) SendGuildBankerActivate ¶
func (w *WorldClient) SendGuildBankerActivate(bankerGUID uint64, fullUpdate bool) error
SendGuildBankerActivate opens the guild bank UI for bankerGUID (GO type 34). fullUpdate=true requests tab metadata + full item list for tab 0.
func (*WorldClient) SendGuildChatMessage ¶
func (w *WorldClient) SendGuildChatMessage(message string) error
SendGuildChatMessage sends a message to guild chat (works for many servers even while dead).
func (*WorldClient) SendGuildCommand ¶
func (w *WorldClient) SendGuildCommand(command string) error
SendGuildCommand sends a GM-style command via guild chat channel (preferred for .revive etc while dead).
func (*WorldClient) SendHeartbeat ¶
func (w *WorldClient) SendHeartbeat() error
SendHeartbeat sends a movement heartbeat (stationary, no movement flags)
func (*WorldClient) SendHeartbeatAt ¶
func (w *WorldClient) SendHeartbeatAt(x, y, z, o float32) error
func (*WorldClient) SendHeartbeatAtTime ¶
func (w *WorldClient) SendHeartbeatAtTime(x, y, z, o float32, at time.Time) error
func (*WorldClient) SendJump ¶
func (w *WorldClient) SendJump() error
SendJump sends a jump movement packet
func (*WorldClient) SendLogout ¶
func (w *WorldClient) SendLogout() error
SendLogout sends CMSG_LOGOUT_REQUEST
func (*WorldClient) SendMovementHeartbeat ¶
func (w *WorldClient) SendMovementHeartbeat() error
SendMovementHeartbeat sends a movement heartbeat while moving (with forward flag)
func (*WorldClient) SendMovementHeartbeatAt ¶
func (w *WorldClient) SendMovementHeartbeatAt(x, y, z, o float32) error
func (*WorldClient) SendMovementHeartbeatAtTime ¶
func (w *WorldClient) SendMovementHeartbeatAtTime(x, y, z, o float32, at time.Time) error
func (*WorldClient) SendMovementHeartbeatWithJump ¶
func (w *WorldClient) SendMovementHeartbeatWithJump(fallTime uint32, zspeed, sinAngle, cosAngle, xyspeed float32) error
SendMovementHeartbeatWithJump sends a forward heartbeat that also has MOVEMENTFLAG_FALLING and includes the jump/fall trajectory data (zspeed, sin/cos angle, xyspeed). This matches packets seen in manual movement logs for the initial move while a small drop/fall is occurring.
func (*WorldClient) SendMovementHeartbeatWithJumpAt ¶
func (w *WorldClient) SendMovementHeartbeatWithJumpAt(x, y, z, o float32, fallTime uint32, zspeed, sinAngle, cosAngle, xyspeed float32) error
func (*WorldClient) SendMovementHeartbeatWithJumpAtTime ¶
func (*WorldClient) SendOfferPetition ¶
func (w *WorldClient) SendOfferPetition(petitionItemGUID, targetGUID uint64) error
SendOfferPetition offers a charter to another online player (target receives SHOW_SIGNATURES).
func (*WorldClient) SendPacketRaw ¶
func (w *WorldClient) SendPacketRaw(opcode uint16, data []byte) error
SendPacketRaw exposes the encrypted packet sender for advanced usage.
func (*WorldClient) SendPetitionBuy ¶
func (w *WorldClient) SendPetitionBuy(npcGUID uint64, guildName string) error
SendPetitionBuy buys a guild charter from a tabard-designer NPC (CMSG_PETITION_BUY). Packet layout mirrors AC WorldSession::HandlePetitionBuyOpcode.
func (*WorldClient) SendPetitionDecline ¶
func (w *WorldClient) SendPetitionDecline(petitionItemGUID uint64) error
SendPetitionDecline declines a petition offer and notifies the owner.
func (*WorldClient) SendPetitionQuery ¶
func (w *WorldClient) SendPetitionQuery(petitionID uint32, petitionItemGUID uint64) error
SendPetitionQuery queries charter metadata.
func (*WorldClient) SendPetitionShowSignatures ¶
func (w *WorldClient) SendPetitionShowSignatures(petitionItemGUID uint64) error
SendPetitionShowSignatures requests the signature list for a charter item.
func (*WorldClient) SendPetitionSign ¶
func (w *WorldClient) SendPetitionSign(petitionItemGUID uint64) error
SendPetitionSign signs a guild/arena charter for the logged-in character.
func (*WorldClient) SendPing ¶
func (w *WorldClient) SendPing(seq uint32) error
SendPing sends CMSG_PING
func (*WorldClient) SendReadyForAccountDataTimes ¶
func (w *WorldClient) SendReadyForAccountDataTimes() error
SendReadyForAccountDataTimes sends CMSG_READY_FOR_ACCOUNT_DATA_TIMES
func (*WorldClient) SendRealmSplit ¶
func (w *WorldClient) SendRealmSplit() error
SendRealmSplit sends CMSG_REALM_SPLIT
func (*WorldClient) SendTextEmote ¶
func (w *WorldClient) SendTextEmote(emoteID uint32, targetGUID uint64) error
SendTextEmote sends a text emote (e.g., laugh)
func (*WorldClient) SendTurnInPetition ¶
func (w *WorldClient) SendTurnInPetition(petitionItemGUID uint64) error
SendTurnInPetition turns a charter in (guild creation for guild charters).
func (*WorldClient) SessionPhase ¶
func (w *WorldClient) SessionPhase() SessionPhase
SessionPhase returns the current protocol phase.
func (*WorldClient) SetActiveMover ¶
func (w *WorldClient) SetActiveMover(guid uint64) error
SetActiveMover sends CMSG_SET_ACTIVE_MOVER
func (*WorldClient) SetCharRace ¶
func (w *WorldClient) SetCharRace(race uint8)
SetCharRace records the character race (call at create/login). Used for chat language.
func (*WorldClient) SetFacing ¶
func (w *WorldClient) SetFacing(orientation float32) error
SetFacing sets the character's facing orientation
func (*WorldClient) SetFacingAt ¶
func (w *WorldClient) SetFacingAt(x, y, z, o float32) error
func (*WorldClient) SetFacingAtTime ¶
func (w *WorldClient) SetFacingAtTime(x, y, z, o float32, at time.Time) error
func (*WorldClient) SetFacingMoving ¶
func (w *WorldClient) SetFacingMoving(orientation float32) error
SetFacingMoving sets facing while moving (includes forward flag, like real client)
func (*WorldClient) SetFacingMovingAt ¶
func (w *WorldClient) SetFacingMovingAt(x, y, z, o float32) error
func (*WorldClient) SetFacingMovingAtTime ¶
func (w *WorldClient) SetFacingMovingAtTime(x, y, z, o float32, at time.Time) error
func (*WorldClient) SetLevelForTest ¶
func (w *WorldClient) SetLevelForTest(l uint32)
SetLevelForTest forces the internal level (used by scenario prep when GM .level packet update may lag or not fire the expected handler).
func (*WorldClient) SetLogLevel ¶
func (w *WorldClient) SetLogLevel(level LogLevel)
SetLogLevel filters WorldClient diagnostics when logFunc is non-nil.
func (*WorldClient) SetLootMethod ¶
func (w *WorldClient) SetLootMethod(method uint8, lootMaster uint64, threshold uint8) error
SetLootMethod sends CMSG_LOOT_METHOD (leader only). method: LootMethod* constants; lootMaster used for master loot (else 0); threshold is item quality threshold (e.g. 2 = uncommon).
func (*WorldClient) SetOnTradeStatus ¶
func (w *WorldClient) SetOnTradeStatus(fn func(TradeStatusInfo))
SetOnTradeStatus sets the legacy single OnTradeStatus under cbMu.
func (*WorldClient) SetPvP ¶
func (w *WorldClient) SetPvP(on bool) error
SetPvP sends CMSG_TOGGLE_PVP with an explicit on/off byte (AC ApplyModFlag).
func (*WorldClient) SetSheathed ¶
func (w *WorldClient) SetSheathed(state uint32) error
SetSheathed sets sheath state: 0=unsheathed, 1=melee, 2=ranged
func (*WorldClient) SetTarget ¶
func (w *WorldClient) SetTarget(targetGUID uint64) error
SetTarget sends CMSG_SET_SELECTION to set the current target
func (*WorldClient) SetTradeGold ¶
func (w *WorldClient) SetTradeGold(copper uint32) error
SetTradeGold sets offered copper.
func (*WorldClient) SetTradeItem ¶
func (w *WorldClient) SetTradeItem(tradeSlot, bag, invSlot uint8) error
SetTradeItem puts bag/slot item into trade slot (0..5). bag: 255 = backpack (INVENTORY_SLOT_BAG_0), matching client item-push encoding.
func (*WorldClient) SpellClick ¶
func (w *WorldClient) SpellClick(guid uint64) error
SpellClick sends CMSG_SPELLCLICK for guid (uint64, not packed). Primary entry path for creature vehicles (npc_spellclick_spells).
func (*WorldClient) Stop ¶
func (w *WorldClient) Stop()
Stop requests the client to stop. It also closes the underlying connection so that a blocked readPacket/readLoop unblocks promptly.
func (*WorldClient) StopChan ¶
func (w *WorldClient) StopChan() <-chan struct{}
StopChan returns the channel that is closed when the connection stops
func (*WorldClient) SummonResponse ¶
func (w *WorldClient) SummonResponse(summonerGUID uint64, agree bool) error
SummonResponse sends CMSG_SUMMON_RESPONSE (summoner GUID + agree bool).
func (*WorldClient) TargetGUID ¶
func (w *WorldClient) TargetGUID() uint64
TargetGUID returns the current target GUID.
func (*WorldClient) Teleport ¶
func (w *WorldClient) Teleport(mapID uint32, x, y, z, o float32) error
Teleport attempts to move the player to the given location. Preferred implementation for tests uses a GM command (requires GM rights). Falls back or can be extended to use CMSG_WORLD_TELEPORT + ack handling.
func (*WorldClient) TeleportSeq ¶
func (w *WorldClient) TeleportSeq() uint64
TeleportSeq returns how many self near/far teleports have completed (packet-driven). Snapshot before a teleport command, then WaitForTeleportAfter.
func (*WorldClient) TimeSyncResponses ¶
func (w *WorldClient) TimeSyncResponses() uint64
TimeSyncResponses returns how many CMSG_TIME_SYNC_RESP we sent.
func (*WorldClient) TradeOpen ¶
func (w *WorldClient) TradeOpen() bool
TradeOpen reports whether the client believes a trade window is active.
func (*WorldClient) TradeStatusSeen ¶
func (w *WorldClient) TradeStatusSeen() bool
TradeStatusSeen reports whether any SMSG_TRADE_STATUS was received this session.
func (*WorldClient) TradeStatusSeq ¶
func (w *WorldClient) TradeStatusSeq() uint64
TradeStatusSeq is a monotonic counter of SMSG_TRADE_STATUS packets (0 = none yet).
func (*WorldClient) UnacceptTrade ¶
func (w *WorldClient) UnacceptTrade() error
UnacceptTrade sends CMSG_UNACCEPT_TRADE.
func (*WorldClient) UnitChannelSpell ¶
func (w *WorldClient) UnitChannelSpell(guid uint64) uint32
UnitChannelSpell returns UNIT_CHANNEL_SPELL for any tracked unit.
func (*WorldClient) UnitEquippedSlot ¶ added in v1.0.8
func (w *WorldClient) UnitEquippedSlot(guid uint64, entry uint32) (uint8, bool)
UnitEquippedSlot returns guid's paper-doll slot showing entry, or false.
func (*WorldClient) UnitVisibleItemEntry ¶ added in v1.0.8
func (w *WorldClient) UnitVisibleItemEntry(guid uint64, slot uint8) uint32
UnitVisibleItemEntry returns the worn item entry in slot on guid (0 if unknown).
func (*WorldClient) UpdatePosition ¶
func (w *WorldClient) UpdatePosition(x, y, z, o float32)
UpdatePosition locally updates the stored position.
func (*WorldClient) VehicleGUID ¶
func (w *WorldClient) VehicleGUID() uint64
VehicleGUID is the best-effort vehicle the player is on/controlling. Prefers UNIT_FIELD_CHARM, then non-self control GUID.
func (*WorldClient) VisibleItemEntry ¶ added in v1.0.8
func (w *WorldClient) VisibleItemEntry(slot uint8) uint32
VisibleItemEntry returns this session's worn item entry in equipment slot 0..18 from PLAYER_VISIBLE_ITEM_* (0 if unknown or empty).
func (*WorldClient) WaitCorpseReclaimAllowed ¶
func (w *WorldClient) WaitCorpseReclaimAllowed(timeout time.Duration) error
WaitCorpseReclaimAllowed blocks until the server reclaim delay from the last SMSG_CORPSE_RECLAIM_DELAY has elapsed (or timeout). If no delay packet arrived, returns immediately (PvE delay often 0 and may omit a long wait). Does not teleport or reclaim — Arm → Wait delay → Tele → WaitNear → Reclaim.
func (*WorldClient) WaitForLogin ¶
func (w *WorldClient) WaitForLogin(timeout time.Duration) error
WaitForLogin waits until the SMSG_LOGIN_VERIFY_WORLD has arrived (signaling successful world entry after LoginCharacter). It is safe to call multiple times.
func (*WorldClient) WaitForLogout ¶
func (w *WorldClient) WaitForLogout(timeout time.Duration) error
WaitForLogout waits for the logout to complete
func (*WorldClient) WaitForSessionPhase ¶
func (w *WorldClient) WaitForSessionPhase(want SessionPhase, timeout time.Duration) error
WaitForSessionPhase blocks until SessionPhase equals want, or timeout. Driven by phase transitions (SMSG_AUTH_RESPONSE, LOGIN_VERIFY_WORLD, teleports, …).
func (*WorldClient) WaitForTeleportAfter ¶
func (w *WorldClient) WaitForTeleportAfter(afterSeq uint64, timeout time.Duration) error
WaitForTeleportAfter waits until TeleportSeq advances past afterSeq (self tele complete). Use after GM `.go` / far transfer; near-tele and NEW_WORLD both bump the sequence.
func (*WorldClient) WaitNotOnVehicle ¶
func (w *WorldClient) WaitNotOnVehicle(timeout time.Duration) error
WaitNotOnVehicle waits until IsOnVehicle is false.
func (*WorldClient) WaitOnVehicle ¶
func (w *WorldClient) WaitOnVehicle(timeout time.Duration) (uint64, error)
WaitOnVehicle waits until IsOnVehicle is true; returns the vehicle GUID.
func (*WorldClient) WaitSummonRequest ¶
func (w *WorldClient) WaitSummonRequest(timeout time.Duration) (SummonRequest, error)
WaitSummonRequest waits for a SMSG_SUMMON_REQUEST (arms hook then polls cache). Prefer ArmSummonRequest before the action that generates the packet.
type WorldObject ¶
type WorldObject struct {
GUID uint64
TypeID uint8 // ObjectType*
Entry uint32
Values map[uint16]uint32
// Position data
PosX, PosY, PosZ float32
Orientation float32
MapID uint32
// Last time we received a position update for this object (MonsterMove or movement block).
// Used to detect stale positions for targets (e.g. mob wandered but we stopped receiving updates).
LastPosUpdate time.Time
// Last time we received *any* update for this object (values, movement, etc.).
// Indicates the server still considers it visible to us.
LastSeen time.Time
// Movement interpolation
DestX, DestY, DestZ float32
IsMoving bool
MoveStartTime time.Time
MoveDuration time.Duration
StartX, StartY, StartZ float32
// Derived convenience fields
Name string
IsPlayer bool
// contains filtered or unexported fields
}
WorldObject represents a tracked object in the game world
func (*WorldObject) AuraStacks ¶
func (o *WorldObject) AuraStacks(spellID uint32) int
AuraStacks returns the highest stack/charges count observed for spellID on this object (0 if missing). Values come from SMSG_AURA_UPDATE stackOrCharges.
func (*WorldObject) Clone ¶
func (o *WorldObject) Clone() *WorldObject
Clone returns a deep copy of the WorldObject. This gives callers (e.g. AI logic) their own private version of the world state snapshot, reducing races with concurrent packet updates to the live cache.
func (*WorldObject) DistanceTo ¶
func (o *WorldObject) DistanceTo(x, y, z float32) float32
DistanceTo computes 3D distance to another position, using interpolated position for moving objects.
func (*WorldObject) EquippedSlot ¶ added in v1.0.8
func (o *WorldObject) EquippedSlot(entry uint32) (uint8, bool)
EquippedSlot returns the first paper-doll slot whose visible entry matches, or false if the item is not shown as worn.
func (*WorldObject) GUIDField ¶
func (o *WorldObject) GUIDField(fieldIndex uint16) uint64
GUIDField reads a 2×uint32 ObjectGuid from Values at fieldIndex (low then high).
func (*WorldObject) GetActiveAuras ¶
func (o *WorldObject) GetActiveAuras() []uint32
GetActiveAuras returns a snapshot of active spell IDs on the object.
func (*WorldObject) HasAura ¶
func (o *WorldObject) HasAura(spellID uint32) bool
HasAura reports whether spellID is currently applied to this object (populated from SMSG_AURA_UPDATE* packets and UNIT_FIELD_AURASTATE).
func (*WorldObject) HasKnownPosition ¶
func (o *WorldObject) HasKnownPosition() bool
HasKnownPosition reports whether we have ever received a real position for this object. Stubs created by aura packets (etc.) stay at 0,0,0 until a movement/create block arrives.
func (*WorldObject) Health ¶
func (o *WorldObject) Health() uint32
Health returns the current health of the object, or 0 if unknown.
func (*WorldObject) InterpolatedPosition ¶
func (o *WorldObject) InterpolatedPosition() (float32, float32, float32)
InterpolatedPosition returns the estimated current position for a moving object. Pure read: does not mutate the object (safe under RLock / concurrent AI ticks). For create-time splines and MONSTER_MOVE, Pos* is the segment start; callers that path to Pos* without interpolating run to a stale "old" location.
func (*WorldObject) IsAlive ¶
func (o *WorldObject) IsAlive() bool
IsAlive returns true if the object appears to be alive.
func (*WorldObject) IsPvP ¶
func (o *WorldObject) IsPvP() bool
IsPvP reports UNIT_BYTE2_FLAG_PVP on this object.
func (*WorldObject) IsUnit ¶
func (o *WorldObject) IsUnit() bool
IsUnit returns true if the object type is unit (NPC) or player.
func (*WorldObject) Level ¶
func (o *WorldObject) Level() uint32
Level returns the level of the unit, or 0 if unknown.
func (*WorldObject) MaxHealth ¶
func (o *WorldObject) MaxHealth() uint32
MaxHealth returns the maximum health of the object, or 0 if unknown.
func (*WorldObject) PvPStateByte ¶
func (o *WorldObject) PvPStateByte() uint8
PvPStateByte is UNIT_FIELD_BYTES_2 byte 1 (PVP / FFA / sanctuary).
func (*WorldObject) Value ¶
func (o *WorldObject) Value(field uint16) uint32
Value returns a raw update field value (thread-safe). For bot AI and advanced consumers. Prefer typed helpers (Health(), IsAlive(), Level(), HasAura()...) when possible.
func (*WorldObject) VisibleItemEntry ¶ added in v1.0.8
func (o *WorldObject) VisibleItemEntry(slot uint8) uint32
VisibleItemEntry returns the item entry shown in equipment slot 0..18 from PLAYER_VISIBLE_ITEM_(slot+1)_ENTRYID (0 if unknown, empty, or slot is invalid).