events

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: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Unmarshal

func Unmarshal(data []byte, payload interface{}) (int, error)

Types

type CharacterUpdate

type CharacterUpdate struct {
	ID   uint64  `json:"i"`
	Lvl  *uint8  `json:"l,omitempty"`
	Map  *uint32 `json:"m,omitempty"`
	Area *uint32 `json:"a,omitempty"`
	Zone *uint32 `json:"z,omitempty"`
}

CharacterUpdate represents new values of fields for the character.

type ChatEventIncomingWhisperPayload

type ChatEventIncomingWhisperPayload struct {
	SenderGUID   uint64
	SenderName   string
	SenderRace   uint8
	ReceiverGUID uint64
	ReceiverName string
	Language     uint32
	Msg          string
}

ChatEventIncomingWhisperPayload represents payload of ChatEventIncomingWhisper event

type ChatServiceEvent

type ChatServiceEvent int

ChatServiceEvent is event type that chat service generates

const (
	// ChatEventIncomingWhisper chat event for a new incoming whisper for the character
	ChatEventIncomingWhisper ChatServiceEvent = iota + 1
)

func (ChatServiceEvent) SubjectName

func (e ChatServiceEvent) SubjectName(loadBalancerID string) string

SubjectName is key that nats uses

type ChatServiceProducer

type ChatServiceProducer interface {
	IncomingWhisper(payload *ChatEventIncomingWhisperPayload) error
}

func NewChatServiceProducerNatsJSON

func NewChatServiceProducerNatsJSON(conn *nats.Conn, ver string, loadBalancerID string) ChatServiceProducer

type EventToReadGenericPayload

type EventToReadGenericPayload struct {
	Version   string          `json:"v"`
	EventType int             `json:"t"`
	Payload   json.RawMessage `json:"p"`
}

type EventToSendGenericPayload

type EventToSendGenericPayload struct {
	Version   string      `json:"v"`
	EventType int         `json:"t"`
	Payload   interface{} `json:"p"`
}

type GameServer added in v0.0.2

type GameServer struct {
	ID            string
	Address       string
	RealmID       uint32
	AvailableMaps []uint32

	OldAssignedMapsToHandle []uint32
	NewAssignedMapsToHandle []uint32
}

func (GameServer) OnlyNewMaps added in v0.0.2

func (s GameServer) OnlyNewMaps() []uint32

func (GameServer) OnlyRemovedMaps added in v0.0.2

func (s GameServer) OnlyRemovedMaps() []uint32

type GenericGuildEvent

type GenericGuildEvent struct {
	// ServiceID is identifier of guild service
	ServiceID string
	RealmID   uint32

	GuildID   uint64
	GuildName string

	MembersOnline []uint64
}

type GroupEventConvertedToRaidHandler added in v0.0.2

type GroupEventConvertedToRaidHandler interface {
	// GroupConvertedToRaidEvent handles group conversion to raid events.
	GroupConvertedToRaidEvent(payload *GroupEventGroupConvertedToRaidPayload) error
}

type GroupEventGroupConvertedToRaidPayload added in v0.0.2

type GroupEventGroupConvertedToRaidPayload struct {
	ServiceID string
	RealmID   uint32

	GroupID uint
	Leader  uint64

	OnlineMembers []uint64
}

type GroupEventGroupCreatedHandler added in v0.0.2

type GroupEventGroupCreatedHandler interface {
	// GroupCreatedEvent handles group invite created events.
	GroupCreatedEvent(payload *GroupEventGroupCreatedPayload) error
}

type GroupEventGroupCreatedPayload added in v0.0.2

type GroupEventGroupCreatedPayload struct {
	ServiceID string
	RealmID   uint32

	GroupID          uint
	LeaderGUID       uint64
	LootMethod       uint8
	LooterGUID       uint64
	LootThreshold    uint8
	GroupType        uint8
	Difficulty       uint8
	RaidDifficulty   uint8
	MasterLooterGuid uint64
	Members          []GroupMember
}

type GroupEventGroupDifficultyChangedHandler added in v0.0.2

type GroupEventGroupDifficultyChangedHandler interface {
	// GroupDifficultyChangedEvent handles dungeon and raid difficulty changes.
	GroupDifficultyChangedEvent(payload *GroupEventGroupDifficultyChangedPayload) error
}

type GroupEventGroupDifficultyChangedPayload added in v0.0.2

type GroupEventGroupDifficultyChangedPayload struct {
	ServiceID string
	RealmID   uint32

	GroupID uint
	Updater uint64

	DungeonDifficulty *uint8 `json:"DungeonDifficulty,omitempty"`
	RaidDifficulty    *uint8 `json:"RaidDifficulty,omitempty"`

	Receivers []uint64
}

type GroupEventGroupDisbandHandler added in v0.0.2

type GroupEventGroupDisbandHandler interface {
	// GroupDisbandEvent handles group disband events.
	GroupDisbandEvent(payload *GroupEventGroupDisbandPayload) error
}

type GroupEventGroupDisbandPayload added in v0.0.2

type GroupEventGroupDisbandPayload struct {
	ServiceID string
	RealmID   uint32

	GroupID       uint
	OnlineMembers []uint64
}

type GroupEventGroupLeaderChangedPayload added in v0.0.2

type GroupEventGroupLeaderChangedPayload struct {
	ServiceID string
	RealmID   uint32

	GroupID        uint
	PreviousLeader uint64
	NewLeader      uint64

	OnlineMembers []uint64
}

type GroupEventGroupLootTypeChangedPayload added in v0.0.2

type GroupEventGroupLootTypeChangedPayload struct {
	ServiceID string
	RealmID   uint32

	GroupID uint

	NewLootType        uint8
	NewLooterGUID      uint64
	NewLooterThreshold uint8

	OnlineMembers []uint64
}

type GroupEventGroupMemberAddedPayload added in v0.0.2

type GroupEventGroupMemberAddedPayload struct {
	ServiceID string
	RealmID   uint32

	GroupID    uint
	MemberGUID uint64
	MemberName string

	OnlineMembers []uint64
}

type GroupEventGroupMemberLeftHandler added in v0.0.2

type GroupEventGroupMemberLeftHandler interface {
	// GroupMemberLeftEvent handles group member left events.
	GroupMemberLeftEvent(payload *GroupEventGroupMemberLeftPayload) error
}

type GroupEventGroupMemberLeftPayload added in v0.0.2

type GroupEventGroupMemberLeftPayload struct {
	ServiceID string
	RealmID   uint32

	GroupID     uint
	MemberGUID  uint64
	MemberName  string
	NewLeaderID uint64 // If the leaving member was the leader, specify the new leader ID

	OnlineMembers []uint64
}

type GroupEventGroupMemberOnlineStatusChangedHandler added in v0.0.2

type GroupEventGroupMemberOnlineStatusChangedHandler interface {
	// GroupMemberOnlineStatusChangedEvent handles group member online status changed events.
	GroupMemberOnlineStatusChangedEvent(payload *GroupEventGroupMemberOnlineStatusChangedPayload) error
}

type GroupEventGroupMemberOnlineStatusChangedPayload added in v0.0.2

type GroupEventGroupMemberOnlineStatusChangedPayload struct {
	ServiceID string
	RealmID   uint32

	GroupID    uint
	MemberGUID uint64
	IsOnline   bool

	OnlineMembers []uint64
}

type GroupEventInviteCreatedHandler added in v0.0.2

type GroupEventInviteCreatedHandler interface {
	// GroupInviteCreatedEvent handles group invite created events.
	GroupInviteCreatedEvent(payload *GroupEventInviteCreatedPayload) error
}

type GroupEventInviteCreatedPayload added in v0.0.2

type GroupEventInviteCreatedPayload struct {
	// ServiceID is identifier of guild service
	ServiceID string
	RealmID   uint32

	GroupID uint

	InviterGUID uint64
	InviterName string

	InviteeGUID uint64
	InviteeName string
}

type GroupEventLeaderChangedHandler added in v0.0.2

type GroupEventLeaderChangedHandler interface {
	// GroupLeaderChangedEvent handles leader changed events.
	GroupLeaderChangedEvent(payload *GroupEventGroupLeaderChangedPayload) error
}

type GroupEventLootTypeChangedHandler added in v0.0.2

type GroupEventLootTypeChangedHandler interface {
	// GroupLootTypeChangedEvent handles loot type changed events.
	GroupLootTypeChangedEvent(payload *GroupEventGroupLootTypeChangedPayload) error
}

type GroupEventMemberAddedHandler added in v0.0.2

type GroupEventMemberAddedHandler interface {
	// GroupMemberAddedEvent handles group member added events.
	GroupMemberAddedEvent(payload *GroupEventGroupMemberAddedPayload) error
}

type GroupEventNewMessageHandler added in v0.0.2

type GroupEventNewMessageHandler interface {
	// GroupChatMessageReceivedEvent handles new chat message event.
	GroupChatMessageReceivedEvent(payload *GroupEventNewMessagePayload) error
}

type GroupEventNewMessagePayload added in v0.0.2

type GroupEventNewMessagePayload struct {
	ServiceID string
	RealmID   uint32

	GroupID uint

	SenderGUID uint64
	SenderName string

	Language uint32
	Msg      string

	MessageType uint8

	Receivers []uint64
}

type GroupEventNewTargetIconHandler added in v0.0.2

type GroupEventNewTargetIconHandler interface {
	// GroupTargetItemSetEvent handles new target icon event.
	GroupTargetItemSetEvent(payload *GroupEventNewTargetIconPayload) error
}

type GroupEventNewTargetIconPayload added in v0.0.2

type GroupEventNewTargetIconPayload struct {
	ServiceID string
	RealmID   uint32

	GroupID uint
	Updater uint64
	Target  uint64
	IconID  uint8

	Receivers []uint64
}

type GroupEventsConsumer added in v0.0.2

type GroupEventsConsumer interface {
	// Listen is non-blocking operation that listens to the group events.
	Listen() error

	// Stop stops listening to events.
	Stop() error
}

GroupEventsConsumer listens to group events and handles events if there are handlers.

func NewGroupEventsConsumer added in v0.0.2

func NewGroupEventsConsumer(nc *nats.Conn, options ...GroupEventsConsumerOption) GroupEventsConsumer

NewGroupEventsConsumer creates new GroupEventsConsumer with given options. Need to provide at least one handler as option, otherwise it will not listen at all.

type GroupEventsConsumerOption added in v0.0.2

type GroupEventsConsumerOption interface {
	// contains filtered or unexported methods
}

GroupEventsConsumerOption option to initialize group events consumer.

func WithGroupDifficultyChangedHandler added in v0.0.2

func WithGroupDifficultyChangedHandler(h GroupEventGroupDifficultyChangedHandler) GroupEventsConsumerOption

WithGroupDifficultyChangedHandler creates group events consumer option with difficulty changes handler. If not specified, listener will ignore this kind of events.

func WithGroupEventConsumerConvertedToRaidHandler added in v0.0.2

func WithGroupEventConsumerConvertedToRaidHandler(h GroupEventConvertedToRaidHandler) GroupEventsConsumerOption

WithGroupEventConsumerConvertedToRaidHandler creates group events consumer option with converted to raid handler. If not specified, listener will ignore this kind of events.

func WithGroupEventConsumerGroupCreatedHandler added in v0.0.2

func WithGroupEventConsumerGroupCreatedHandler(h GroupEventGroupCreatedHandler) GroupEventsConsumerOption

WithGroupEventConsumerGroupCreatedHandler creates group events consumer option with group created handler. If not specified, listener will ignore this kind of events.

func WithGroupEventConsumerGroupDisbandHandler added in v0.0.2

func WithGroupEventConsumerGroupDisbandHandler(h GroupEventGroupDisbandHandler) GroupEventsConsumerOption

WithGroupEventConsumerGroupDisbandHandler creates group events consumer option with group disband handler. If not specified, listener will ignore this kind of events.

func WithGroupEventConsumerGroupMemberLeftHandler added in v0.0.2

func WithGroupEventConsumerGroupMemberLeftHandler(h GroupEventGroupMemberLeftHandler) GroupEventsConsumerOption

WithGroupEventConsumerGroupMemberLeftHandler creates group events consumer option with group member left handler. If not specified, listener will ignore this kind of events.

func WithGroupEventConsumerGroupMemberOnlineStatusChangedHandler added in v0.0.2

func WithGroupEventConsumerGroupMemberOnlineStatusChangedHandler(h GroupEventGroupMemberOnlineStatusChangedHandler) GroupEventsConsumerOption

WithGroupEventConsumerGroupMemberOnlineStatusChangedHandler creates group events consumer option with group member online status changed. If not specified, listener will ignore this kind of events.

func WithGroupEventConsumerInviteCreatedHandler added in v0.0.2

func WithGroupEventConsumerInviteCreatedHandler(h GroupEventInviteCreatedHandler) GroupEventsConsumerOption

WithGroupEventConsumerInviteCreatedHandler creates group events consumer option with invite created handler. If not specified, listener will ignore this kind of events.

func WithGroupEventConsumerLeaderChangedHandler added in v0.0.2

func WithGroupEventConsumerLeaderChangedHandler(h GroupEventLeaderChangedHandler) GroupEventsConsumerOption

WithGroupEventConsumerLeaderChangedHandler creates group events consumer option with leader changed handler. If not specified, listener will ignore this kind of events.

func WithGroupEventConsumerLootTypeChangedHandler added in v0.0.2

func WithGroupEventConsumerLootTypeChangedHandler(h GroupEventLootTypeChangedHandler) GroupEventsConsumerOption

WithGroupEventConsumerLootTypeChangedHandler creates group events consumer option with loot type changed handler. If not specified, listener will ignore this kind of events.

func WithGroupEventConsumerMemberAddedHandler added in v0.0.2

func WithGroupEventConsumerMemberAddedHandler(h GroupEventMemberAddedHandler) GroupEventsConsumerOption

WithGroupEventConsumerMemberAddedHandler creates group events consumer option with member added handler. If not specified, listener will ignore this kind of events.

func WithGroupEventNewChatMessageHandler added in v0.0.2

func WithGroupEventNewChatMessageHandler(h GroupEventNewMessageHandler) GroupEventsConsumerOption

WithGroupEventNewChatMessageHandler creates group events consumer option with new chat message handler. If not specified, listener will ignore this kind of events.

func WithGroupEventNewTargetIconHandler added in v0.0.2

func WithGroupEventNewTargetIconHandler(h GroupEventNewTargetIconHandler) GroupEventsConsumerOption

WithGroupEventNewTargetIconHandler creates group events consumer option with new target icon handler. If not specified, listener will ignore this kind of events.

type GroupMember added in v0.0.2

type GroupMember struct {
	MemberGUID  uint64
	MemberFlags uint8
	MemberName  string
	IsOnline    bool
	SubGroup    uint8
	Roles       uint8
}

type GroupServiceEvent added in v0.0.2

type GroupServiceEvent int

GroupServiceEvent is event type that group service generates

const (
	// GroupEventInviteCreated group event when player invite created
	GroupEventInviteCreated GroupServiceEvent = iota + 1

	// GroupEventGroupCreated group event when group created
	GroupEventGroupCreated

	// GroupEventGroupMemberOnlineStatusChanged group event when group member cam online or offline
	GroupEventGroupMemberOnlineStatusChanged

	// GroupEventGroupMemberLeft group event when group member leaves
	GroupEventGroupMemberLeft

	// GroupEventGroupDisband group event when group is disbanded
	GroupEventGroupDisband

	// GroupEventGroupMemberAdded group event when a member is added to the group
	GroupEventGroupMemberAdded

	// GroupEventGroupLeaderChanged group event when the group leader is changed
	GroupEventGroupLeaderChanged

	// GroupEventGroupLootTypeChanged group event when the loot type is changed
	GroupEventGroupLootTypeChanged

	// GroupEventGroupConvertedToRaid group event when the group is converted to a raid
	GroupEventGroupConvertedToRaid

	// GroupEventNewChatMessage group event when somebody sends group or raid chat message
	GroupEventNewChatMessage

	// GroupEventNewTargetIcon group event when leader or assistant sets target icon for raid
	GroupEventNewTargetIcon

	// GroupEventGroupDifficultyChanged group event when dungeon or raid difficulty changed for the group
	GroupEventGroupDifficultyChanged
)

func (GroupServiceEvent) SubjectName added in v0.0.2

func (e GroupServiceEvent) SubjectName() string

SubjectName is key that nats uses

type GroupServiceProducer added in v0.0.2

type GroupServiceProducer interface {
	// InviteCreated publishes an event for an invite being created.
	InviteCreated(payload *GroupEventInviteCreatedPayload) error

	// GroupCreated publishes an event for a group being created.
	GroupCreated(payload *GroupEventGroupCreatedPayload) error

	// GroupMemberOnlineStatusChanged publishes an event for a change in group member's online status.
	GroupMemberOnlineStatusChanged(payload *GroupEventGroupMemberOnlineStatusChangedPayload) error

	// GroupMemberLeft publishes an event for a group member leaving.
	GroupMemberLeft(payload *GroupEventGroupMemberLeftPayload) error

	// GroupDisband publishes an event for a group being disbanded.
	GroupDisband(payload *GroupEventGroupDisbandPayload) error

	// MemberAdded publishes an event for a member being added to the group.
	MemberAdded(payload *GroupEventGroupMemberAddedPayload) error

	// LeaderChanged publishes an event for a change in group leader.
	LeaderChanged(payload *GroupEventGroupLeaderChangedPayload) error

	// LootTypeChanged publishes an event for a change in loot type.
	LootTypeChanged(payload *GroupEventGroupLootTypeChangedPayload) error

	// ConvertedToRaid publishes an event for a group being converted to a raid.
	ConvertedToRaid(payload *GroupEventGroupConvertedToRaidPayload) error

	// TargetIconUpdated publishes an event for an update of target icon.
	TargetIconUpdated(payload *GroupEventNewTargetIconPayload) error

	// GroupDifficultyChanged publishes an event for an update of dungeon or raid difficulty
	GroupDifficultyChanged(payload *GroupEventGroupDifficultyChangedPayload) error

	// SendChatMessage publishes an event for a new chat message in a group or raid.
	SendChatMessage(payload *GroupEventNewMessagePayload) error
}

GroupServiceProducer defines the interface for producing group events.

func NewGroupServiceProducerNatsJSON added in v0.0.2

func NewGroupServiceProducerNatsJSON(conn *nats.Conn, ver string) GroupServiceProducer

NewGroupServiceProducerNatsJSON creates a new instance of groupServiceProducerNatsJSON.

type GuildEventGuildInfoUpdatedPayload

type GuildEventGuildInfoUpdatedPayload struct {
	GenericGuildEvent

	NewGuildInfo string
}

type GuildEventInviteCreatedPayload

type GuildEventInviteCreatedPayload struct {
	// ServiceID is identifier of guild service
	ServiceID string
	RealmID   uint32

	GuildID   uint64
	GuildName string

	InviterGUID uint64
	InviterName string

	InviteeGUID uint64
	InviteeName string
}

type GuildEventMOTDUpdatedPayload

type GuildEventMOTDUpdatedPayload struct {
	GenericGuildEvent

	NewMessageOfTheDay string
}

type GuildEventMemberAddedPayload

type GuildEventMemberAddedPayload struct {
	GenericGuildEvent

	MemberGUID uint64
	MemberName string
}

type GuildEventMemberDemotePayload

type GuildEventMemberDemotePayload struct {
	GenericGuildEvent

	RankID   uint8
	RankName string

	DemoterGUID uint64
	DemoterName string

	MemberGUID uint64
	MemberName string
}

type GuildEventMemberKickedPayload

type GuildEventMemberKickedPayload struct {
	GenericGuildEvent

	MemberGUID uint64
	MemberName string

	KickerGUID uint64
	KickerName string
}

type GuildEventMemberLeftPayload

type GuildEventMemberLeftPayload struct {
	GenericGuildEvent

	MemberGUID uint64
	MemberName string
}

type GuildEventMemberPromotePayload

type GuildEventMemberPromotePayload struct {
	GenericGuildEvent

	RankID   uint8
	RankName string

	PromoterGUID uint64
	PromoterName string

	MemberGUID uint64
	MemberName string
}

type GuildEventMembersNoteUpdatedPayload

type GuildEventMembersNoteUpdatedPayload struct {
	GenericGuildEvent

	MemberGUID uint64
	MemberName string

	UpdaterGUID uint64
	UpdaterName string

	Note string
}

type GuildEventMembersOfficerNoteUpdatedPayload

type GuildEventMembersOfficerNoteUpdatedPayload struct {
	GenericGuildEvent

	MemberGUID uint64
	MemberName string

	UpdaterGUID uint64
	UpdaterName string

	Note string
}

type GuildEventNewMessagePayload

type GuildEventNewMessagePayload struct {
	ServiceID string
	RealmID   uint32

	GuildID uint64

	SenderGUID uint64
	SenderName string

	Language uint32
	Msg      string

	ForOfficers bool

	Receivers []uint64
}

type GuildEventRankCreatedPayload

type GuildEventRankCreatedPayload struct {
	GenericGuildEvent

	RankID   uint8
	RankName string

	RanksCount uint8
}

type GuildEventRankDeletedPayload

type GuildEventRankDeletedPayload struct {
	GenericGuildEvent

	RankID   uint8
	RankName string

	RanksCount uint8
}

type GuildEventRankUpdatedPayload

type GuildEventRankUpdatedPayload struct {
	GenericGuildEvent

	RankID          uint8
	RankName        string
	RankRights      uint32
	RankMoneyPerDay uint32

	RanksCount uint8
}

type GuildServiceEvent

type GuildServiceEvent int

GuildServiceEvent is event type that guilds service generates

const (
	// GuildEventInviteCreated guild event when player invite created
	GuildEventInviteCreated GuildServiceEvent = iota + 1

	// GuildEventMemberAdded guild event when new member added to the guild
	GuildEventMemberAdded

	// GuildEventMemberLeft guild event when member left the guild
	GuildEventMemberLeft

	// GuildEventMemberKicked guild event when member kicked from the guild
	GuildEventMemberKicked

	// GuildEventMemberNoteUpdated guild event when public note of the member updated
	GuildEventMemberNoteUpdated

	// GuildEventMemberOfficersNoteUpdated guild event when officers note of the member updated
	GuildEventMemberOfficersNoteUpdated

	// GuildEventRankCreated guild event when new guild rank created
	GuildEventRankCreated

	// GuildEventRankUpdated guild event when guild rank updated
	GuildEventRankUpdated

	// GuildEventRankDeleted guild event when guild rank deleted
	GuildEventRankDeleted

	// GuildEventMemberPromote guild event when guild member promoted
	GuildEventMemberPromote

	// GuildEventMemberDemote guild event when guild member demoted
	GuildEventMemberDemote

	// GuildEventMOTDUpdated guild event when message of the day updated
	GuildEventMOTDUpdated

	// GuildEventGuildInfoUpdated guild event when guild info message updated
	GuildEventGuildInfoUpdated

	// GuildEventNewMessage guild event when guild member sent some message
	GuildEventNewMessage
)

func (GuildServiceEvent) SubjectName

func (e GuildServiceEvent) SubjectName() string

SubjectName is key that nats uses

type GuildServiceProducer

type GuildServiceProducer interface {
	InviteCreated(payload *GuildEventInviteCreatedPayload) error

	MemberAdded(payload *GuildEventMemberAddedPayload) error
	MemberLeft(payload *GuildEventMemberLeftPayload) error
	MemberKicked(payload *GuildEventMemberKickedPayload) error

	RankCreated(payload *GuildEventRankCreatedPayload) error
	RankUpdated(payload *GuildEventRankUpdatedPayload) error
	RankDeleted(payload *GuildEventRankDeletedPayload) error

	MemberPromote(payload *GuildEventMemberPromotePayload) error
	MemberDemote(payload *GuildEventMemberDemotePayload) error

	MemberNoteUpdated(payload *GuildEventMembersNoteUpdatedPayload) error
	MemberOfficerNoteUpdated(payload *GuildEventMembersOfficerNoteUpdatedPayload) error

	MOTDUpdated(payload *GuildEventMOTDUpdatedPayload) error
	GuildInfoUpdated(payload *GuildEventGuildInfoUpdatedPayload) error

	NewMessage(payload *GuildEventNewMessagePayload) error
}

func NewGuildServiceProducerNatsJSON

func NewGuildServiceProducerNatsJSON(conn *nats.Conn, ver string) GuildServiceProducer

type LBCharacterLoggedInHandler

type LBCharacterLoggedInHandler interface {
	// HandleCharacterLoggedIn handles player logged in events.
	HandleCharacterLoggedIn(payload LBEventCharacterLoggedInPayload) error
}

type LBCharacterLoggedOutHandler

type LBCharacterLoggedOutHandler interface {
	// HandleCharacterLoggedOut handles player logged out events.
	HandleCharacterLoggedOut(payload LBEventCharacterLoggedOutPayload) error
}

type LBCharactersUpdatesHandler

type LBCharactersUpdatesHandler interface {
	// HandleCharactersUpdates handles pack of characters updates events.
	HandleCharactersUpdates(payload LBEventCharactersUpdatesPayload) error
}

type LBEventCharacterLoggedInPayload

type LBEventCharacterLoggedInPayload struct {
	RealmID        uint32
	LoadBalancerID string
	CharGUID       uint64
	CharName       string
	CharRace       uint8
	CharClass      uint8
	CharGender     uint8
	CharLevel      uint8
	CharZone       uint32
	CharMap        uint32
	CharPosX       float32
	CharPosY       float32
	CharPosZ       float32
	CharGuildID    uint32
	AccountID      uint32
}

LBEventCharacterLoggedInPayload represents payload of LBEventCharacterLoggedIn event.

type LBEventCharacterLoggedOutPayload

type LBEventCharacterLoggedOutPayload struct {
	RealmID        uint32
	LoadBalancerID string
	CharGUID       uint64
	CharName       string
	CharGuildID    uint32
	AccountID      uint32
}

LBEventCharacterLoggedOutPayload represents payload of LBEventCharacterLoggedOut event.

type LBEventCharactersUpdatesPayload

type LBEventCharactersUpdatesPayload struct {
	RealmID        uint32
	LoadBalancerID string
	Updates        []*CharacterUpdate
}

type LoadBalancerConsumer

type LoadBalancerConsumer interface {
	// Listen is non-blocking operation that listens to the load balancer events.
	Listen() error

	// Stop stops listening to events.
	Stop() error
}

LoadBalancerConsumer listens to load balancer events and handles events if there are handlers.

func NewLoadBalancerConsumer

func NewLoadBalancerConsumer(nc *nats.Conn, options ...LoadBalancerConsumerOption) LoadBalancerConsumer

NewLoadBalancerConsumer creates new LoadBalancerConsumer with given options. Need to provide at least one handler as option, otherwise it will not listen at all.

type LoadBalancerConsumerOption

type LoadBalancerConsumerOption interface {
	// contains filtered or unexported methods
}

LoadBalancerConsumerOption option to initialize load balancer consumer.

func WithLBConsumerCharsUpdatesHandler

func WithLBConsumerCharsUpdatesHandler(h LBCharactersUpdatesHandler) LoadBalancerConsumerOption

WithLBConsumerCharsUpdatesHandler creates load balancer consumer option with characters updates handler. If not specified, listener will ignore this kind of events.

func WithLBConsumerLoggedInHandler

func WithLBConsumerLoggedInHandler(h LBCharacterLoggedInHandler) LoadBalancerConsumerOption

WithLBConsumerLoggedInHandler creates load balancer consumer option with logged in handler. If not specified, listener will ignore this kind of events.

func WithLBConsumerLoggedOutHandler

func WithLBConsumerLoggedOutHandler(h LBCharacterLoggedOutHandler) LoadBalancerConsumerOption

WithLBConsumerLoggedOutHandler creates load balancer consumer option with logged out handler. If not specified, listener will ignore this kind of events.

type LoadBalancerEvent

type LoadBalancerEvent int

LoadBalancerEvent is event type that game load balancer generates.

const (
	// LBEventCharacterLoggedIn is event that occurs when character logs in with CMsgPlayerLogin opcode.
	LBEventCharacterLoggedIn LoadBalancerEvent = iota + 1

	// LBEventCharacterLoggedOut is event that occurs when character logs out by any reason (regular logout or tcp connection closes).
	LBEventCharacterLoggedOut

	// LBEventCharactersUpdates pack of characters update that occurs every N seconds.
	LBEventCharactersUpdates
)

func (LoadBalancerEvent) SubjectName

func (e LoadBalancerEvent) SubjectName() string

SubjectName is key that nats uses.

type LoadBalancerProducer

type LoadBalancerProducer interface {
	CharacterLoggedIn(payload *LBEventCharacterLoggedInPayload) error
	CharacterLoggedOut(payload *LBEventCharacterLoggedOutPayload) error
	CharactersUpdates(payload *LBEventCharactersUpdatesPayload) error
}

func NewLoadBalancerProducerNatsJSON

func NewLoadBalancerProducerNatsJSON(conn *nats.Conn, ver string, realmID uint32, loadBalancerID string) LoadBalancerProducer

type MailEventIncomingMailPayload

type MailEventIncomingMailPayload struct {
	RealmID uint32

	SenderGUID   uint64
	ReceiverGUID uint64

	DeliveryTimestamp int64

	MailID uint32
}

MailEventIncomingMailPayload represents payload of MailEventIncomingMail event

type MailServiceEvent

type MailServiceEvent int

MailServiceEvent is event type that mail service generates

const (
	// MailEventIncomingMail mail event for a new incoming mail for the character
	MailEventIncomingMail MailServiceEvent = iota + 1
)

func (MailServiceEvent) SubjectName

func (e MailServiceEvent) SubjectName() string

SubjectName is key that nats uses

type MailServiceProducer

type MailServiceProducer interface {
	IncomingMail(payload *MailEventIncomingMailPayload) error
}

func NewMailServiceProducerNatsJSON

func NewMailServiceProducerNatsJSON(conn *nats.Conn, ver string) MailServiceProducer

type ServerRegistryEvent

type ServerRegistryEvent int

ServerRegistryEvent is event type that servers registry service generates.

const (
	// ServerRegistryEventLBAdded is event that occurs when server registry registers game load balancer.
	ServerRegistryEventLBAdded ServerRegistryEvent = iota + 1

	// ServerRegistryEventLBRemovedUnhealthy is event that occurs when game load balancer unhealthy, and it's been removed from registry.
	ServerRegistryEventLBRemovedUnhealthy

	// ServerRegistryEventGSMapsReassigned is event that occurs when servers registry reassigned maps to game servers.
	ServerRegistryEventGSMapsReassigned
)

func (ServerRegistryEvent) SubjectName

func (e ServerRegistryEvent) SubjectName() string

SubjectName is key that nats uses.

type ServerRegistryEventGSMapsReassignedPayload added in v0.0.2

type ServerRegistryEventGSMapsReassignedPayload struct {
	Servers []GameServer
}

type ServerRegistryEventLBAddedPayload

type ServerRegistryEventLBAddedPayload struct {
	ID              string
	Address         string
	HealthCheckAddr string
	RealmID         uint32
}

ServerRegistryEventLBAddedPayload represents payload of ServerRegistryEventLBAdded event.

type ServerRegistryEventLBRemovedUnhealthyPayload

type ServerRegistryEventLBRemovedUnhealthyPayload struct {
	ID              string
	Address         string
	HealthCheckAddr string
	RealmID         uint32
}

ServerRegistryEventLBRemovedUnhealthyPayload represents payload of ServerRegistryEventLBRemovedUnhealthy event.

type ServerRegistryProducer

type ServerRegistryProducer interface {
	LBAdded(payload *ServerRegistryEventLBAddedPayload) error
	LBRemovedUnhealthy(payload *ServerRegistryEventLBRemovedUnhealthyPayload) error
	GSMapsReassigned(payload *ServerRegistryEventGSMapsReassignedPayload) error
}

func NewServerRegistryProducerNatsJSON

func NewServerRegistryProducerNatsJSON(conn *nats.Conn, ver string) ServerRegistryProducer

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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