session

package
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 4, 2024 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const MaxVisibleMailsCount = 100

Variables

View Source
var EventsHandleMap = map[eBroadcaster.EventType]EventsHandlersQueue{
	eBroadcaster.EventTypeIncomingWhisper:                NewEventHandler("IncomingWhisper", (*GameSession).HandleEventIncomingWhisperMessage),
	eBroadcaster.EventTypeGuildInviteCreated:             NewEventHandler("GuildInviteCreated", (*GameSession).HandleEventGuildInviteCreated),
	eBroadcaster.EventTypeGuildMemberPromoted:            NewEventHandler("GuildMemberPromoted", (*GameSession).HandleEventGuildMemberPromoted),
	eBroadcaster.EventTypeGuildMemberDemoted:             NewEventHandler("GuildMemberDemoted", (*GameSession).HandleEventGuildMemberDemoted),
	eBroadcaster.EventTypeGuildMOTDUpdated:               NewEventHandler("GuildMOTDUpdated", (*GameSession).HandleEventGuildMOTDUpdated),
	eBroadcaster.EventTypeGuildMemberAdded:               NewEventHandler("GuildMemberAdded", (*GameSession).HandleEventGuildMemberAdded),
	eBroadcaster.EventTypeGuildMemberLeft:                NewEventHandler("GuildMemberLeft", (*GameSession).HandleEventGuildMemberLeft),
	eBroadcaster.EventTypeGuildMemberKicked:              NewEventHandler("GuildMemberKicked", (*GameSession).HandleEventGuildMemberKicked),
	eBroadcaster.EventTypeGuildRankCreated:               NewEventHandler("GuildRankCreated", (*GameSession).HandleEventGuildRankCreated),
	eBroadcaster.EventTypeGuildRankUpdated:               NewEventHandler("GuildRankUpdated", (*GameSession).HandleEventGuildRankUpdated),
	eBroadcaster.EventTypeGuildRankDeleted:               NewEventHandler("GuildRankDeleted", (*GameSession).HandleEventGuildRankDeleted),
	eBroadcaster.EventTypeGuildNewMessage:                NewEventHandler("GuildNewMessage", (*GameSession).HandleEventGuildNewMessage),
	eBroadcaster.EventTypeIncomingMail:                   NewEventHandler("IncomingMail", (*GameSession).HandleEventIncomingMail),
	eBroadcaster.EventTypeGroupInviteCreated:             NewEventHandler("EventTypeGroupInviteCreated", (*GameSession).HandleEventGroupInviteCreated),
	eBroadcaster.EventTypeGroupCreated:                   NewEventHandler("EventTypeGroupCreated", (*GameSession).HandleEventGroupCreated),
	eBroadcaster.EventTypeGroupMemberOnlineStatusChanged: NewEventHandler("EventTypeGroupMemberOnlineStatusChanged", (*GameSession).HandleEventGroupMemberOnlineStatusChanged),
	eBroadcaster.EventTypeGroupMemberLeft:                NewEventHandler("EventTypeGroupMemberLeft", (*GameSession).HandleEventGroupMemberLeft),
	eBroadcaster.EventTypeGroupDisband:                   NewEventHandler("EventTypeGroupDisband", (*GameSession).HandleEventGroupDisband),
	eBroadcaster.EventTypeGroupMemberAdded:               NewEventHandler("EventTypeGroupMemberAdded", (*GameSession).HandleEventGroupMemberAdded),
	eBroadcaster.EventTypeGroupLeaderChanged:             NewEventHandler("EventTypeGroupLeaderChanged", (*GameSession).HandleEventGroupLeaderChanged),
	eBroadcaster.EventTypeGroupLootTypeChanged:           NewEventHandler("EventTypeGroupLootTypeChanged", (*GameSession).HandleEventGroupLootTypeChanged),
	eBroadcaster.EventTypeGroupConvertedToRaid:           NewEventHandler("EventTypeGroupConvertedToRaid", (*GameSession).HandleEventGroupConvertedToRaid),
	eBroadcaster.EventTypeGroupNewMessage:                NewEventHandler("EventTypeGroupNewMessage", (*GameSession).HandleEventGroupNewMessage),
	eBroadcaster.EventTypeGroupNewTargetIcon:             NewEventHandler("EventTypeGroupNewTargetIcon", (*GameSession).HandleEventGroupNewTargetIcon),
	eBroadcaster.EventTypeGroupDifficultyChanged:         NewEventHandler("EventTypeGroupDifficultyChanged", (*GameSession).HandleEventGroupDifficultyChanged),
}
View Source
var HandleMap = map[packet.Opcode]HandlersQueue{
	packet.CMsgCharCreate:               NewHandler("CMsgCharCreate", (*GameSession).CreateCharacter),
	packet.CMsgPlayerLogin:              NewHandler("CMsgPlayerLogin", (*GameSession).Login),
	packet.CMsgCharDelete:               NewHandler("CMsgCharDelete", (*GameSession).DeleteCharacter),
	packet.CMsgCharEnum:                 NewHandler("CMsgCharEnum", (*GameSession).CharactersList),
	packet.CMsgRealmSplit:               NewHandler("CMsgRealmSplit", (*GameSession).RealmSplit),
	packet.CMsgReadyForAccountDataTimes: NewHandler("CMsgReadyForAccountDataTimes", (*GameSession).ReadyForAccountDataTimes),
	packet.CMsgMessageChat:              NewHandler("CMsgMessageChat", (*GameSession).HandleChatMessage),
	packet.CMsgGuildQuery:               NewHandler("CMsgGuildQuery", (*GameSession).HandleGuildQuery),
	packet.CMsgWho:                      NewHandler("CMsgWho", (*GameSession).HandleWho),
	packet.CMsgGuildInvite:              NewHandler("CMsgGuildInvite", (*GameSession).HandleGuildInvite),
	packet.CMsgGuildInviteAccept:        NewHandler("CMsgGuildInviteAccept", (*GameSession).HandleGuildInviteAccept),
	packet.CMsgGuildRoster:              NewHandler("CMsgGuildRoster", (*GameSession).HandleGuildRoster),
	packet.CMsgGuildLeave:               NewHandler("CMsgGuildLeave", (*GameSession).HandleGuildLeave),
	packet.CMsgGuildRemove:              NewHandler("CMsgGuildRemove", (*GameSession).HandleGuildKick),
	packet.CMsgGuildMOTD:                NewHandler("CMsgGuildSMTD", (*GameSession).HandleGuildSetMessageOfTheDay),
	packet.CMsgGuildSetPublicNote:       NewHandler("CMsgGuildSetPublicNote", (*GameSession).HandleGuildSetPublicNote),
	packet.CMsgGuildSetOfficerNote:      NewHandler("CMsgGuildSetOfficerNote", (*GameSession).HandleGuildSetOfficerNote),
	packet.CMsgGuildInfoText:            NewHandler("CMsgGuildInfoText", (*GameSession).HandleGuildSetInfoText),
	packet.CMsgGuildRank:                NewHandler("CMsgGuildRank", (*GameSession).HandleGuildRankUpdate),
	packet.CMsgGuildAddRank:             NewHandler("CMsgGuildAddRank", (*GameSession).HandleGuildRankAdd),
	packet.CMsgGuildDelRank:             NewHandler("CMsgGuildDelRank", (*GameSession).HandleGuildRankDelete),
	packet.CMsgGuildPromote:             NewHandler("CMsgGuildPromote", (*GameSession).HandleGuildPromote),
	packet.CMsgGuildDemote:              NewHandler("CMsgGuildDemote", (*GameSession).HandleGuildDemote),
	packet.CMsgSendMail:                 NewHandler("CMsgSendMail", (*GameSession).HandleSendMail),
	packet.CMsgGetMailList:              NewHandler("CMsgGetMailList", (*GameSession).HandleGetMailList),
	packet.CMsgMailMarkAsRead:           NewHandler("CMsgMailMarkAsRead", (*GameSession).HandleMailMarksAsRead),
	packet.CMsgMailTakeMoney:            NewHandler("CMsgMailTakeMoney", (*GameSession).HandleMailTakeMoney),
	packet.CMsgMailTakeItem:             NewHandler("CMsgMailTakeItem", (*GameSession).HandleMailTakeItem),
	packet.CMsgMailDelete:               NewHandler("CMsgMailDelete", (*GameSession).HandleDeleteMail),
	packet.MsgQueryNextMailTime:         NewHandler("MsgQueryNextMailTime", (*GameSession).HandleQueryNextMailTime),
	packet.SMsgInitWorldStates:          NewHandler("SMsgInitWorldStates", (*GameSession).InterceptInitWorldStates),
	packet.SMsgLevelUpInfo:              NewHandler("SMsgLevelUpInfo", (*GameSession).InterceptLevelUpInfo),
	packet.CMsgPing:                     NewHandler("CMsgPing", (*GameSession).HandlePing),
	packet.SMsgPong:                     NewHandler("SMsgPong", (*GameSession).InterceptPong),
	packet.SMsgNewWorld:                 NewHandler("SMsgNewWorld", (*GameSession).InterceptNewWorld),
	packet.MsgGuildPermissions:          NewHandler("MsgGuildPermissions", (*GameSession).HandleGuildPermissions),
	packet.MsgGuildBankMoneyWithdrawn:   NewHandler("MsgGuildBankMoneyWithdrawn", (*GameSession).HandleGuildBankMoneyWithdrawn),
	packet.MsgMoveWorldPortAck:          NewHandler("MsgMoveWorldPortAck", (*GameSession).InterceptMoveWorldPortAck),
	packet.SMsgMOTD:                     NewHandler("SMsgMOTD", (*GameSession).InterceptMessageOfTheDay),
	packet.SMsgAccountDataTimes:         NewHandler("SMsgAccountDataTimes", (*GameSession).InterceptAccountDataTimes),

	packet.CMsgGroupInvite:         NewHandler("CMsgGroupInvite", (*GameSession).HandleGroupInvite),
	packet.CMsgGroupAccept:         NewHandler("CMsgGroupAccept", (*GameSession).HandleGroupInviteAccept),
	packet.CMsgGroupDecline:        NewHandler("CMsgGroupDecline", (*GameSession).HandleGroupInviteDeclined),
	packet.CMsgGroupUnInvite:       NewHandler("CMsgGroupUnInvite", (*GameSession).HandleGroupUninvite),
	packet.CMsgGroupUnInviteGuid:   NewHandler("CMsgGroupUnInviteGuid", (*GameSession).HandleGroupUninviteGUID),
	packet.CMsgGroupDisband:        NewHandler("CMsgGroupDisband", (*GameSession).HandleGroupLeave),
	packet.CMsgGroupRaidConvert:    NewHandler("CMsgGroupRaidConvert", (*GameSession).HandleGroupConvertToRaid),
	packet.CMsgGroupSetLeader:      NewHandler("CMsgGroupSetLeader", (*GameSession).HandleGroupSetLeader),
	packet.MsgRaidTargetUpdate:     NewHandler("MsgRaidTargetUpdate", (*GameSession).HandleSetGroupTargetIcon),
	packet.CMsgLootMethod:          NewHandler("CMsgLootMethod", (*GameSession).HandleSetLootMethod),
	packet.MsgSetDungeonDifficulty: NewHandler("MsgSetDungeonDifficulty", (*GameSession).HandleSetDungeonDifficulty),
	packet.MsgSetRaidDifficulty:    NewHandler("MsgSetRaidDifficulty", (*GameSession).HandleSetRaidDifficulty),
}

Functions

func NewGroupServiceUnavailableErr added in v0.0.2

func NewGroupServiceUnavailableErr(err error) error

func NewMailServiceUnavailableErr

func NewMailServiceUnavailableErr(err error) error

Types

type ChatType

type ChatType uint8
const (
	ChatTypeSystem ChatType = iota
	ChatTypeSay
	ChatTypeParty
	ChatTypeRaid
	ChatTypeGuild
	ChatTypeOfficer
	ChatTypeYell
	ChatTypeWhisper
	ChatTypeWhisperForeign
	ChatTypeWhisperInform
	ChatTypeRaidLeader  = 0x27
	ChatTypePartyLeader = 0x33
)

type EventHandler

type EventHandler func(*GameSession, context.Context, *eBroadcaster.Event) error

type EventsHandlersQueue

type EventsHandlersQueue struct {
	// contains filtered or unexported fields
}

func NewEventHandler

func NewEventHandler(name string, handlers ...EventHandler) EventsHandlersQueue

func (*EventsHandlersQueue) Handle

func (q *EventsHandlersQueue) Handle(ctx context.Context, session *GameSession, e *eBroadcaster.Event) error

type GameSession

type GameSession struct {
	// contains filtered or unexported fields
}

GameSession represents session of the player, holds world and game sockets, routes and handles packets.

func NewGameSession

func NewGameSession(
	ctx context.Context, logger *zerolog.Logger,
	gameSocket sockets.Socket, accountID uint32,
	authPacket *packet.Packet, params GameSessionParams,
) *GameSession

func (*GameSession) CanInteractWithMailingObject

func (s *GameSession) CanInteractWithMailingObject(ctx context.Context, object uint64) (bool, error)

func (*GameSession) CharactersList

func (s *GameSession) CharactersList(ctx context.Context, p *packet.Packet) error

func (*GameSession) CreateCharacter added in v0.0.3

func (s *GameSession) CreateCharacter(ctx context.Context, p *packet.Packet) error

func (*GameSession) DeleteCharacter added in v0.0.3

func (s *GameSession) DeleteCharacter(ctx context.Context, p *packet.Packet) error

func (*GameSession) GuildLoginCommand

func (s *GameSession) GuildLoginCommand(ctx context.Context) error

func (*GameSession) HandleChatMessage

func (s *GameSession) HandleChatMessage(ctx context.Context, p *packet.Packet) error

func (*GameSession) HandleDeleteMail

func (s *GameSession) HandleDeleteMail(ctx context.Context, p *packet.Packet) error

func (*GameSession) HandleEventGroupConvertedToRaid added in v0.0.2

func (s *GameSession) HandleEventGroupConvertedToRaid(ctx context.Context, e *eBroadcaster.Event) error

func (*GameSession) HandleEventGroupCreated added in v0.0.2

func (s *GameSession) HandleEventGroupCreated(ctx context.Context, e *eBroadcaster.Event) error

func (*GameSession) HandleEventGroupDifficultyChanged added in v0.0.2

func (s *GameSession) HandleEventGroupDifficultyChanged(ctx context.Context, e *eBroadcaster.Event) error

func (*GameSession) HandleEventGroupDisband added in v0.0.2

func (s *GameSession) HandleEventGroupDisband(ctx context.Context, e *eBroadcaster.Event) error

func (*GameSession) HandleEventGroupInviteCreated added in v0.0.2

func (s *GameSession) HandleEventGroupInviteCreated(ctx context.Context, e *eBroadcaster.Event) error

func (*GameSession) HandleEventGroupLeaderChanged added in v0.0.2

func (s *GameSession) HandleEventGroupLeaderChanged(ctx context.Context, e *eBroadcaster.Event) error

func (*GameSession) HandleEventGroupLootTypeChanged added in v0.0.2

func (s *GameSession) HandleEventGroupLootTypeChanged(ctx context.Context, e *eBroadcaster.Event) error

func (*GameSession) HandleEventGroupMemberAdded added in v0.0.2

func (s *GameSession) HandleEventGroupMemberAdded(ctx context.Context, e *eBroadcaster.Event) error

func (*GameSession) HandleEventGroupMemberLeft added in v0.0.2

func (s *GameSession) HandleEventGroupMemberLeft(ctx context.Context, e *eBroadcaster.Event) error

func (*GameSession) HandleEventGroupMemberOnlineStatusChanged added in v0.0.2

func (s *GameSession) HandleEventGroupMemberOnlineStatusChanged(ctx context.Context, e *eBroadcaster.Event) error

func (*GameSession) HandleEventGroupNewMessage added in v0.0.2

func (s *GameSession) HandleEventGroupNewMessage(ctx context.Context, e *eBroadcaster.Event) error

func (*GameSession) HandleEventGroupNewTargetIcon added in v0.0.2

func (s *GameSession) HandleEventGroupNewTargetIcon(ctx context.Context, e *eBroadcaster.Event) error

func (*GameSession) HandleEventGuildInviteCreated

func (s *GameSession) HandleEventGuildInviteCreated(ctx context.Context, e *eBroadcaster.Event) error

func (*GameSession) HandleEventGuildMOTDUpdated

func (s *GameSession) HandleEventGuildMOTDUpdated(_ context.Context, e *eBroadcaster.Event) error

func (*GameSession) HandleEventGuildMemberAdded

func (s *GameSession) HandleEventGuildMemberAdded(_ context.Context, e *eBroadcaster.Event) error

func (*GameSession) HandleEventGuildMemberDemoted

func (s *GameSession) HandleEventGuildMemberDemoted(ctx context.Context, e *eBroadcaster.Event) error

func (*GameSession) HandleEventGuildMemberKicked

func (s *GameSession) HandleEventGuildMemberKicked(_ context.Context, e *eBroadcaster.Event) error

func (*GameSession) HandleEventGuildMemberLeft

func (s *GameSession) HandleEventGuildMemberLeft(_ context.Context, e *eBroadcaster.Event) error

func (*GameSession) HandleEventGuildMemberPromoted

func (s *GameSession) HandleEventGuildMemberPromoted(ctx context.Context, e *eBroadcaster.Event) error

func (*GameSession) HandleEventGuildNewMessage

func (s *GameSession) HandleEventGuildNewMessage(_ context.Context, e *eBroadcaster.Event) error

func (*GameSession) HandleEventGuildRankCreated

func (s *GameSession) HandleEventGuildRankCreated(_ context.Context, e *eBroadcaster.Event) error

func (*GameSession) HandleEventGuildRankDeleted

func (s *GameSession) HandleEventGuildRankDeleted(_ context.Context, e *eBroadcaster.Event) error

func (*GameSession) HandleEventGuildRankUpdated

func (s *GameSession) HandleEventGuildRankUpdated(_ context.Context, e *eBroadcaster.Event) error

func (*GameSession) HandleEventIncomingMail

func (s *GameSession) HandleEventIncomingMail(_ context.Context, e *eBroadcaster.Event) error

func (*GameSession) HandleEventIncomingWhisperMessage

func (s *GameSession) HandleEventIncomingWhisperMessage(ctx context.Context, e *eBroadcaster.Event) error

func (*GameSession) HandleGetMailList

func (s *GameSession) HandleGetMailList(ctx context.Context, p *packet.Packet) error

func (*GameSession) HandleGroupConvertToRaid added in v0.0.2

func (s *GameSession) HandleGroupConvertToRaid(ctx context.Context, _ *packet.Packet) error

func (*GameSession) HandleGroupInvite added in v0.0.2

func (s *GameSession) HandleGroupInvite(ctx context.Context, p *packet.Packet) error

func (*GameSession) HandleGroupInviteAccept added in v0.0.2

func (s *GameSession) HandleGroupInviteAccept(ctx context.Context, _ *packet.Packet) error

func (*GameSession) HandleGroupInviteDeclined added in v0.0.2

func (s *GameSession) HandleGroupInviteDeclined(ctx context.Context, _ *packet.Packet) error

func (*GameSession) HandleGroupLeave added in v0.0.2

func (s *GameSession) HandleGroupLeave(ctx context.Context, _ *packet.Packet) error

func (*GameSession) HandleGroupSetLeader added in v0.0.2

func (s *GameSession) HandleGroupSetLeader(ctx context.Context, p *packet.Packet) error

func (*GameSession) HandleGroupUninvite added in v0.0.2

func (s *GameSession) HandleGroupUninvite(ctx context.Context, p *packet.Packet) error

func (*GameSession) HandleGroupUninviteGUID added in v0.0.2

func (s *GameSession) HandleGroupUninviteGUID(ctx context.Context, p *packet.Packet) error

func (*GameSession) HandleGuildBankMoneyWithdrawn

func (s *GameSession) HandleGuildBankMoneyWithdrawn(ctx context.Context, p *packet.Packet) error

func (*GameSession) HandleGuildDemote

func (s *GameSession) HandleGuildDemote(ctx context.Context, p *packet.Packet) error

func (*GameSession) HandleGuildInvite

func (s *GameSession) HandleGuildInvite(ctx context.Context, p *packet.Packet) error

func (*GameSession) HandleGuildInviteAccept

func (s *GameSession) HandleGuildInviteAccept(ctx context.Context, _ *packet.Packet) error

func (*GameSession) HandleGuildKick

func (s *GameSession) HandleGuildKick(ctx context.Context, p *packet.Packet) error

func (*GameSession) HandleGuildLeave

func (s *GameSession) HandleGuildLeave(ctx context.Context, p *packet.Packet) error

func (*GameSession) HandleGuildPermissions

func (s *GameSession) HandleGuildPermissions(ctx context.Context, p *packet.Packet) error

func (*GameSession) HandleGuildPromote

func (s *GameSession) HandleGuildPromote(ctx context.Context, p *packet.Packet) error

func (*GameSession) HandleGuildQuery

func (s *GameSession) HandleGuildQuery(ctx context.Context, p *packet.Packet) error

func (*GameSession) HandleGuildRankAdd

func (s *GameSession) HandleGuildRankAdd(ctx context.Context, p *packet.Packet) error

func (*GameSession) HandleGuildRankDelete

func (s *GameSession) HandleGuildRankDelete(ctx context.Context, p *packet.Packet) error

func (*GameSession) HandleGuildRankUpdate

func (s *GameSession) HandleGuildRankUpdate(ctx context.Context, p *packet.Packet) error

func (*GameSession) HandleGuildRoster

func (s *GameSession) HandleGuildRoster(ctx context.Context, p *packet.Packet) error

func (*GameSession) HandleGuildSetInfoText

func (s *GameSession) HandleGuildSetInfoText(ctx context.Context, p *packet.Packet) error

func (*GameSession) HandleGuildSetMessageOfTheDay

func (s *GameSession) HandleGuildSetMessageOfTheDay(ctx context.Context, p *packet.Packet) error

func (*GameSession) HandleGuildSetOfficerNote

func (s *GameSession) HandleGuildSetOfficerNote(ctx context.Context, p *packet.Packet) error

func (*GameSession) HandleGuildSetPublicNote

func (s *GameSession) HandleGuildSetPublicNote(ctx context.Context, p *packet.Packet) error

func (*GameSession) HandleMailMarksAsRead

func (s *GameSession) HandleMailMarksAsRead(ctx context.Context, p *packet.Packet) error

func (*GameSession) HandleMailTakeItem

func (s *GameSession) HandleMailTakeItem(ctx context.Context, p *packet.Packet) error

func (*GameSession) HandleMailTakeMoney

func (s *GameSession) HandleMailTakeMoney(ctx context.Context, p *packet.Packet) error

func (*GameSession) HandlePackets

func (s *GameSession) HandlePackets(ctx context.Context)

HandlePackets handles game and world packets, as well as general events (like messages). Has infinite loop that can be broken with ctx or by closing gameSocket read channel.

func (*GameSession) HandlePing

func (s *GameSession) HandlePing(ctx context.Context, p *packet.Packet) error

func (*GameSession) HandleQueryNextMailTime

func (s *GameSession) HandleQueryNextMailTime(ctx context.Context, p *packet.Packet) error

func (*GameSession) HandleSendMail

func (s *GameSession) HandleSendMail(ctx context.Context, p *packet.Packet) error

func (*GameSession) HandleSetDungeonDifficulty added in v0.0.2

func (s *GameSession) HandleSetDungeonDifficulty(ctx context.Context, p *packet.Packet) error

func (*GameSession) HandleSetGroupTargetIcon added in v0.0.2

func (s *GameSession) HandleSetGroupTargetIcon(ctx context.Context, p *packet.Packet) error

func (*GameSession) HandleSetLootMethod added in v0.0.2

func (s *GameSession) HandleSetLootMethod(ctx context.Context, p *packet.Packet) error

func (*GameSession) HandleSetRaidDifficulty added in v0.0.2

func (s *GameSession) HandleSetRaidDifficulty(ctx context.Context, p *packet.Packet) error

func (*GameSession) HandleWho

func (s *GameSession) HandleWho(ctx context.Context, p *packet.Packet) error

func (*GameSession) InterceptAccountDataTimes added in v0.0.3

func (s *GameSession) InterceptAccountDataTimes(ctx context.Context, p *packet.Packet) error

func (*GameSession) InterceptInitWorldStates

func (s *GameSession) InterceptInitWorldStates(ctx context.Context, p *packet.Packet) error

func (*GameSession) InterceptLevelUpInfo

func (s *GameSession) InterceptLevelUpInfo(ctx context.Context, p *packet.Packet) error

func (*GameSession) InterceptMessageOfTheDay added in v0.0.3

func (s *GameSession) InterceptMessageOfTheDay(ctx context.Context, p *packet.Packet) error

func (*GameSession) InterceptMoveWorldPortAck

func (s *GameSession) InterceptMoveWorldPortAck(ctx context.Context, p *packet.Packet) error

func (*GameSession) InterceptNewWorld

func (s *GameSession) InterceptNewWorld(ctx context.Context, p *packet.Packet) error

func (*GameSession) InterceptPong

func (s *GameSession) InterceptPong(ctx context.Context, p *packet.Packet) error

func (*GameSession) LoadGroupForPlayer added in v0.0.2

func (s *GameSession) LoadGroupForPlayer(ctx context.Context) error

func (*GameSession) Login

func (s *GameSession) Login(ctx context.Context, p *packet.Packet) error

func (*GameSession) ReadyForAccountDataTimes

func (s *GameSession) ReadyForAccountDataTimes(ctx context.Context, p *packet.Packet) error

func (*GameSession) RealmSplit

func (s *GameSession) RealmSplit(ctx context.Context, p *packet.Packet) error

func (*GameSession) SendGroupUpdate added in v0.0.2

func (s *GameSession) SendGroupUpdate(ctx context.Context, groupID uint) error

func (*GameSession) SendSysMessage

func (s *GameSession) SendSysMessage(msg string)

type GameSessionParams

type GameSessionParams struct {
	CharServiceClient                pbChar.CharactersServiceClient
	ServersRegistryClient            pbServ.ServersRegistryServiceClient
	ChatServiceClient                pbChat.ChatServiceClient
	GuildsServiceClient              pbGuild.GuildServiceClient
	MailServiceClient                pbMail.MailServiceClient
	GroupServiceClient               pbGroup.GroupServiceClient
	EventsProducer                   events.LoadBalancerProducer
	CharsUpdsBarrier                 *service.CharactersUpdatesBarrier
	EventsBroadcaster                eBroadcaster.Broadcaster
	GameServerGRPCConnMgr            service.GameServerGRPCConnMgr
	PacketProcessTimeout             time.Duration
	ShowGameserverConnChangeToClient bool
}

type GroupOperation added in v0.0.2

type GroupOperation uint8
const (
	GroupOperationInvite GroupOperation = iota
	GroupOperationUninvite
	GroupOperationLeave
	GroupOperationSwap
)

type GroupResult added in v0.0.2

type GroupResult uint8
const (
	GroupResultOk GroupResult = iota
	GroupResultBadPlayerName
	GroupResultTargetNotInGroupS
	GroupResultTargetNotInInstanceS
	GroupResultGroupFull
	GroupResultAlreadyInGroup
	GroupResultNotInGroup
	GroupResultNotLeader
)

type GuildEventType

type GuildEventType uint8
const (
	GuildEventTypePromotion GuildEventType = iota
	GuildEventTypeDemotion
	GuildEventTypeMessageOfTheDay
	GuildEventTypeJoined
	GuildEventTypeLeft
	GuildEventTypeRemoved
	GuildEventTypeLeaderIS // don't know what is it
	GuildEventTypeLeaderChanged
	GuildEventTypeDisbanded
	GuildEventTypeTabardChanged
	GuildEventTypeRankUpdated
	GuildEventTypeRankDeleted
	GuildEventTypeSignedOn
	GuildEventTypeSignedOff
	GuildEventTypeBankSlotsChanged
	GuildEventTypeTabPurchased
	GuildEventTypeTabUpdated
	GuildEventTypeBankMoneySet
	GuildEventTypeTabAndMoneyUpdated
	GuildEventTypeBankTextChanged
)

type Handler

type Handler func(*GameSession, context.Context, *packet.Packet) error

func ForwardPacketToRandomGameServer

func ForwardPacketToRandomGameServer(waitOpcodeToClose packet.Opcode) Handler

type HandlersQueue

type HandlersQueue struct {
	// contains filtered or unexported fields
}

func NewHandler

func NewHandler(name string, handlers ...Handler) HandlersQueue

func (*HandlersQueue) Handle

func (q *HandlersQueue) Handle(ctx context.Context, session *GameSession, p *packet.Packet) error

type MailResponseStatus

type MailResponseStatus uint8
const (
	MailResponseStatusOk MailResponseStatus = iota
	MailResponseStatusEquipErr
	MailResponseStatusCannotSendToSelf
	MailResponseStatusNotEnoughMoney
	MailResponseStatusRecipientNotFound
	MailResponseStatusNotYourTeam
	MailResponseStatusInternalError
	MailResponseStatusDisabledForTrialAcc
	MailResponseStatusRecipientCapReached
	MailResponseStatusCantSendWrappedCOD
	MailResponseStatusMailAndChatSuspended
	MailResponseStatusTooManyAttachments
	MailResponseStatusMailAttachmentInvalid
	MailResponseStatusItemHasExpired
)

type MailResponseType

type MailResponseType uint8
const (
	MailResponseTypeMailSend MailResponseType = iota
	MailResponseTypeMoneyTaken
	MailResponseTypeItemTaken
	MailResponseTypeReturnedToSender
	MailResponseTypeDeleted
	MailResponseTypeMadePermanent
)

type PacketSendingControl added in v0.0.3

type PacketSendingControl struct {
	// contains filtered or unexported fields
}

PacketSendingControl contains flags to track sending of some packets that needs to be sent only once or similar to that.

type UserFriendlyError

type UserFriendlyError struct {
	UserError string
	RealError error
}

func (*UserFriendlyError) Error

func (e *UserFriendlyError) Error() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL