typestruct

package
v0.0.0-...-9d7a3c8 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Campaign_0 = 1
	Campaign_1 = 8 << 0
	Campaign_2 = 8 << 1
	Campaign_3 = 8 << 2
	Campaign_4 = 8 << 3
	Campaign_5 = 8 << 4
	Campaign_6 = 8 << 5
)
View Source
const (
	ChatDirectMessage = 0
	ChatChannel       = 1
	ChatRoom          = 2
	ChatIngameGlobal  = 3
	ChatIngameTeam    = 4
	ChatClan          = 5
	ChatParty         = 7 //组队
	ChatIngameParty   = 9
)
View Source
const (
	MessageCongratulate    = 11
	MessageNoticeImportant = 20
	MessageDialogBox       = 21
	MessageNotice          = 22
	MessageNotice2         = 23
	MessageDialogBoxExit   = 60
)
View Source
const (
	//packet's first main type
	PacketTypeVersion          = 0
	PacketTypeReply            = 1
	PacketTypeLogin            = 3
	PacketTypeServerList       = 5
	PacketTypeCharacter        = 6
	PacketTypeRequestRoomList  = 7
	PacketTypeRequestChannels  = 10
	PacketTypeRoom             = 65
	PacketTypeChat             = 67
	PacketTypeHost             = 68
	PacketTypePlayerInfo       = 69
	PacketTypeUdp              = 70
	PacketTypeShop             = 72
	PacketTypeBan              = 74
	PacketTypeOption           = 76
	PacketTypeFavorite         = 77
	PacketTypeUseItem          = 78
	PacketTypeQuickJoin        = 80
	PacketTypeReport           = 83
	PacketTypeSignature        = 85
	PacketTypeQuickStart       = 86
	PacketTypeAutomatch        = 88
	PacketTypeFriend           = 89
	PacketTypeUnlock           = 90
	PacketTypeNotify           = 91
	PacketTypeEvent            = 92
	PacketTypeGZ               = 95
	PacketTypeAchievement      = 96
	PacketTypeSupply           = 102
	PacketTypeDisassemble      = 104
	PacketTypeConfigInfo       = 106
	PacketTypeLobby            = 107
	PacketTypeUserStart        = 150
	PacketTypeRoomList         = 151
	PacketTypeInventory_Add    = 152
	PacketTypeInventory_Create = 154
	PacketTypeUserInfo         = 157
	//beacuse there is only 1 byte of sequence in packet , so max number is 0xff
	MINSEQUENCE = 0
	MAXSEQUENCE = math.MaxUint8
	//server will read 4 bytes of header
	HeaderLen = 4

	SUBMENU_ITEM_NUM = 9
)
View Source
const (
	GameStart         = 0
	HostJoin          = 1
	HostStop          = 3
	LeaveResultWindow = 4
	GameContinue      = 5

	//频道以及房间
	SendFullRoomList = 0
	JoinLobby        = 0
	SetLobby         = 1
	UpdateUserInfo   = 2

	//房间操作
	NewRoomRequest            = 0
	JoinRoomRequest           = 1
	LeaveRoomRequest          = 3
	ToggleReadyRequest        = 4
	GameStartRequest          = 5
	UpdateSettings            = 6
	OnCloseResultWindow       = 7
	JoinRoomFiled             = 8
	SetUserTeamRequest        = 9
	GameStartCountdownRequest = 19
	Feedback                  = 30

	//游戏模式
	ModeOriginal            = 1
	ModeTeamdeath           = 2
	ModeZombie              = 3
	ModeStealth             = 4
	ModeGunteamdeath        = 5
	ModeTutorial            = 6
	ModeHide                = 7
	ModePig                 = 8
	ModeAnimationtest_vcd   = 9
	ModeGz_survivor         = 10
	ModeDevtest             = 11
	ModeOriginalmr          = 12
	ModeOriginalmrdraw      = 13
	ModeCasualbomb          = 14
	ModeDeathmatch          = 15
	ModeScenario_test       = 16
	ModeGz                  = 17
	ModeGz_intro            = 18
	ModeGz_tour             = 19
	ModeGz_pve              = 20
	ModeEventmod01          = 21
	ModeDuel                = 22
	ModeGz_ZB               = 23
	ModeHeroes              = 24
	ModeEventmod02          = 25
	ModeZombiecraft         = 26
	ModeCampaign1           = 27
	ModeCampaign2           = 28
	ModeCampaign3           = 29
	ModeCampaign4           = 30
	ModeCampaign5           = 31
	ModeCampaign6           = 32
	ModeCampaign7           = 33
	ModeCampaign8           = 34
	ModeCampaign9           = 35
	ModeZ_scenario          = 36
	ModeZombie_prop         = 37
	ModeGhost               = 38
	ModeTag                 = 39
	ModeHide_match          = 40
	ModeHide_ice            = 41
	ModeDiy                 = 42
	ModeHide_Item           = 43
	ModeZd_boss1            = 44
	ModeZd_boss2            = 45
	ModeZd_boss3            = 46
	ModePractice            = 47
	ModeZombie_commander    = 48
	ModeCasualoriginal      = 49
	ModeHide2               = 50
	ModeGunball             = 51
	ModeZombie_zeta         = 53
	ModeTdm_small           = 54
	ModeDe_small            = 55
	ModeGunteamdeath_re     = 56
	ModeEndless_wave        = 57
	ModeRankmatch_original  = 58
	ModeRankmatch_teamdeath = 59
	ModePlay_ground         = 60
	ModeMadcity             = 61
	ModeHide_origin         = 62
	ModeTeamdeath_mutation  = 63
	ModeGiant               = 64
	ModeZ_scenario_side     = 65
	ModeHide_multi          = 66
	ModeMadcity_team        = 67
	ModeRankmatch_stealth   = 68

	//房间status
	StatusWaiting = 1
	StatusIngame  = 2

	//队伍平衡
	Disabled   = 0
	Enabled    = 1
	WithBots   = 2
	ByKadRatio = 4

	//房间包表示
	OUTCreateAndJoin  = 0
	OUTPlayerJoin     = 1
	OUTPlayerLeave    = 2
	OUTSetPlayerReady = 3
	OUTUpdateSettings = 4
	OUTSetHost        = 5
	OUTSetGameResult  = 6
	OUTsetUserTeam    = 7
	OUTCountdown      = 14

	DefaultCountdownNum = 7

	//Start CountDown
	InProgress = 0
	Stop       = 1
)
View Source
const (
	MAXCHANNELNUM       = 16
	MAXSERVERNUM        = 15
	MAXCHANNELROOMNUM   = 0xFF
	MAXROOMNUM          = 0xFFFF
	DefalutServerName   = "CSO2-Server[1/1]"
	DefalutChannelName1 = "CSO2-Channel[1/2]"
	DefalutChannelName2 = "CSO2-Channel[2/2]"

	//貌似非3以外的都被客户端认为是战队频道
	ChannelServerTypeNormal = 1
	ChannelServerTypeTeam   = 3

	//ChannelType
	ChannelTypeFree         = 0
	ChannelTypeNovice       = 1
	ChannelTypeNoviceLowKAD = 2
	ChannelTypeClan         = 3
	ChannelTypeBigCity      = 4
	ChannelTypeActive       = 5 //only open for active

	ChannelStatusBusy   = 0
	ChannelStatusNormal = 1
)
View Source
const (
	UdpPacketSignature = 87
	UDPTypeClient      = 0
	UDPTypeServer      = 256
	UDPTypeSourceTV    = 512
)
View Source
const (
	//user status
	UserNotReady = 0
	UserIngame   = 1
	UserReady    = 2

	//阵营
	UserForceUnknown          = 0
	UserForceTerrorist        = 1
	UserForceCounterTerrorist = 2
)
View Source
const (
	//MAXUSERNUM , 8096 is enough
	MAXUSERNUM = 8096
)

Variables

View Source
var (
	ItemList     = make(map[uint32]ItemData)
	UnlockList   = make(map[uint32]UnlockData)
	BoxList      = make(map[uint32]BoxData)
	BoxIDs       = []uint32{}
	ShopItemList = []ShopItem{}
)
View Source
var (
	GAME_SERVER_ERROR                               = []byte("你与服务端的连接遭遇到不可恢复性错误,请联系服务器管理员并提供报错信息以便管理员查找和修复错误!")
	GAME_LOGIN_ALREADY                              = []byte("您的账号当前已经有人登录!如果你的账号已泄露请联系管理员!")
	GAME_LOGIN_EXIT_FORCE                           = []byte("您的账号当前有人登录!您已被强制退出!")
	GAME_LOGIN_ERROR                                = []byte("登录过程发生错误,请联系服务器管理员并提供报错信息以便管理员查找和修复错误!")
	GAME_ROOM_COUNT_MODE_ERROR                      = []byte("无法开始游戏!请检查你的房间设置,比如是否有2人及以上或者开启bot")
	GAME_ROOM_JOIN_ERROR                            = []byte("加入房间发生错误!")
	GAME_GM_ADD_ALLWEAPONS                          = []byte("所有武器已存入你的仓库!")
	GAME_CHANNEL_MESSAGE_NOT_IN                     = []byte("你未进入任何频道!")
	GAME_GM_NO_AUTHORIZE                            = []byte("你没有权限进行此操作!")
	GAME_USER_NEW_ITEM                              = []byte("你获得了管理员给予的物品!")
	GAME_USER_NEW_ITEM_RESTART                      = []byte("重启游戏以获得奖励的物品!")
	GAME_CHANNEL_MESSAGE                            = "频道"
	GAME_ROOM_JOIN_FAILED_CLOSED                    = []byte("#CSO2_POPUP_ROOM_JOIN_FAILED_CLOSED")
	GAME_ROOM_JOIN_FAILED_FULL                      = []byte("#CSO2_POPUP_ROOM_JOIN_FAILED_FULL")
	GAME_ROOM_JOIN_FAILED_BAD_PASSWORD              = []byte("#CSO2_POPUP_ROOM_JOIN_FAILED_INVALID_PASSWD")
	GAME_ROOM_CHANGETEAM_FAILED                     = []byte("#CSO2_POPUP_ROOM_CHANGETEAM_FAILED")
	GAME_ROOM_COUNTDOWN_FAILED_NOENEMIES            = []byte("#CSO2_UI_ROOM_COUNTDOWN_FAILED_NOENEMY")
	GAME_LOGIN_BAD_USERINFO                         = []byte("#CSO2_LoginAuth_Certify_NoPassport")
	GAME_LOGIN_BAD_PASSWORD                         = []byte("#CSO2_LoginAuth_WrongPassword")
	GAME_LOGIN_BAD_USERNAME                         = []byte("#CSO2_LoginAuth_UserNotExists")
	GAME_LOGIN_TENTH_FAILED                         = []byte("#CSO2_LoginAuth_TempBlockedByLoginFail")
	GAME_LOGIN_INVALID_USERINFO                     = []byte("#CSO2_ServerMessage_INVALID_USERINFO")
	GAME_REPORT_USER_SUCCEED                        = []byte("#CSO2_POPUP_USER_REPORT_SUCCEED")
	CSO2_BUY_FAIL_CN_0X11_NO_CASH                   = []byte("#CSO2_BUY_FAIL_CN_0X11_NO_CASH")
	CSO2_BUY_FAIL_NO_POINT                          = []byte("#CSO2_BUY_FAIL_NO_POINT")
	CSO2_BUY_FAIL_NO_MILEAGE                        = []byte("#CSO2_BUY_FAIL_NO_MILEAGE")
	CSO2_BUY_SUCCEED                                = []byte("#CSO2_BUY_SUCCEED")
	CSO2_BUY_FAIL_CN_0X12_DB_ERROR                  = []byte("#CSO2_BUY_FAIL_CN_0X12_DB_ERROR")
	CSO2_UI_RAMDOMBOX_ALERT_000                     = []byte("#CSO2_UI_RAMDOMBOX_ALERT_000")
	CSO2_UI_RANDOMBOX_KEY_ALERT_BUY_01              = []byte("#CSO2_UI_RANDOMBOX_KEY_ALERT_BUY_01")
	CSO2_POPUP_ROOM_LEAVE_PENALTY                   = []byte("#CSO2_POPUP_ROOM_LEAVE_PENALTY")
	CSO2_UI_RANK_CONDITION_HIDE                     = []byte("#CSO2_UI_RANK_CONDITION_HIDE")
	CSO2_BUY_FAIL_BUY_CONDITION_FAILED_BY_FAIL_ITEM = []byte("#CSO2_BUY_FAIL_BUY_CONDITION_FAILED_BY_FAIL_ITEM")
	CSO2_POPUP_NICKNAME_ALREADY_EXIST               = []byte("#CSO2_POPUP_NICKNAME_ALREADY_EXIST")
	CSO2_POPUP_NICKNAME_CHANGED_SUCCESS             = []byte("#CSO2_POPUP_NICKNAME_CHANGED_SUCCESS")
	CSO2_POPUP_MEGAPHONE_USE_FAIL_INVALID_ITEM      = []byte("#CSO2_POPUP_MEGAPHONE_USE_FAIL_INVALID_ITEM")
)
View Source
var (
	UnlockItemList = [...]uint32{
		1,
		9,
		10,
		24,
		11,
		60,
		31,
		17,
		28,
		59,
		53,
		26,
		25,
		63,
		20,
		7,
		62,
		5,
		44,
		16,
		12,
		22,
		52,
		70,
		71,
		77,
		85,
		48,
		29,
		32,
		37,
		106,
		112,
		111,
		110,
		105,
		114,
		107,
		109,
		74,
		75,
		78,
		82,
		91,
		95,
		96,
		100,
		104,
		109,
		108,
		110,
		66,
		67,
		120,
		121,
		124,
		122,
		123,
		125,
		126,
		129,
		130,
		131,
		133,
		132,
		135,
		138,
		143,
		144,
		145,
		155,
		156,
		151,
		152,
		153,
	}
	UnlockFullList = []UnlockItem{
		UnlockItem{
			UnlockItemList[0],
			0x0B,
			0x01,
			0x3E8,
		},
		UnlockItem{
			UnlockItemList[1],
			0x0C,
			0x01,
			0x5DC,
		},
		UnlockItem{
			UnlockItemList[2],
			0x0D,
			0x01,
			0x3E8,
		},
		UnlockItem{
			UnlockItemList[3],
			0x0E,
			0x01,
			0x5DC,
		},
		UnlockItem{
			UnlockItemList[4],
			0x0F,
			0x01,
			0x708,
		},
		UnlockItem{
			UnlockItemList[5],
			0x10,
			0x01,
			0xBB80,
		},
		UnlockItem{
			UnlockItemList[6],
			0x11,
			0x01,
			0x5DC0,
		},
		UnlockItem{
			UnlockItemList[7],
			0x12,
			0x01,
			0x708,
		},
		UnlockItem{
			UnlockItemList[8],
			0x13,
			0x01,
			0x1D4C,
		},
		UnlockItem{
			UnlockItemList[9],
			0x14,
			0x01,
			0x6160,
		},
		UnlockItem{
			UnlockItemList[10],
			0x15,
			0x01,
			0x7530,
		},
		UnlockItem{
			UnlockItemList[11],
			0x16,
			0x01,
			0xFA0,
		},
		UnlockItem{
			UnlockItemList[12],
			0x17,
			0x01,
			0x3A98,
		},
		UnlockItem{
			UnlockItemList[13],
			0x18,
			0x01,
			0x493E0,
		},
		UnlockItem{
			UnlockItemList[14],
			0x19,
			0x01,
			0xFA0,
		},
		UnlockItem{
			UnlockItemList[15],
			0x1A,
			0x01,
			0x3A98,
		},
		UnlockItem{
			UnlockItemList[16],
			0x1B,
			0x01,
			0x493E0,
		},
		UnlockItem{
			UnlockItemList[17],
			0x1C,
			0x01,
			0x708,
		},
		UnlockItem{
			UnlockItemList[18],
			0x1D,
			0x01,
			0x7530,
		},
		UnlockItem{
			UnlockItemList[19],
			0x1E,
			0x01,
			0x1388,
		},
		UnlockItem{
			UnlockItemList[20],
			0x1F,
			0x01,
			0x4E20,
		},
		UnlockItem{
			UnlockItemList[21],
			0x20,
			0x01,
			0x4E20,
		},
		UnlockItem{
			UnlockItemList[22],
			0x43,
			0x01,
			0x7530,
		},
		UnlockItem{
			UnlockItemList[23],
			0x57,
			0x01,
			0x7A120,
		},
		UnlockItem{
			UnlockItemList[24],
			0x58,
			0x01,
			0x7A120,
		},
		UnlockItem{
			UnlockItemList[25],
			0x59,
			0x01,
			0x190,
		},
		UnlockItem{
			UnlockItemList[26],
			0x81,
			0x01,
			0x370,
		},
		UnlockItem{
			UnlockItemList[27],
			0x90,
			0x01,
			0x7530,
		},
		UnlockItem{
			UnlockItemList[28],
			0x91,
			0x01,
			0xEA60,
		},
		UnlockItem{
			UnlockItemList[29],
			0x92,
			0x01,
			0x1E848,
		},
		UnlockItem{
			UnlockItemList[30],
			0x93,
			0x01,
			0x30D40,
		},
		UnlockItem{
			UnlockItemList[31],
			0xA8,
			0x00,
			0x28,
		},
		UnlockItem{
			UnlockItemList[32],
			0xA9,
			0x00,
			0x50,
		},
		UnlockItem{
			UnlockItemList[33],
			0xAA,
			0x00,
			0x28,
		},
		UnlockItem{
			UnlockItemList[34],
			0xAB,
			0x00,
			0x50,
		},
		UnlockItem{
			UnlockItemList[35],
			0xAC,
			0x00,
			0x28,
		},
		UnlockItem{
			UnlockItemList[36],
			0xAD,
			0x00,
			0x50,
		},
		UnlockItem{
			UnlockItemList[37],
			0xAE,
			0x00,
			0x28,
		},
		UnlockItem{
			UnlockItemList[38],
			0xAF,
			0x00,
			0x50,
		},
		UnlockItem{
			UnlockItemList[39],
			0xD7,
			0x01,
			0xC350,
		},
		UnlockItem{
			UnlockItemList[40],
			0xD8,
			0x01,
			0x17700,
		},
		UnlockItem{
			UnlockItemList[41],
			0xE8,
			0x01,
			0x11170,
		},
		UnlockItem{
			UnlockItemList[42],
			0xE9,
			0x01,
			0x1D4C0,
		},
		UnlockItem{
			UnlockItemList[43],
			0x106,
			0x01,
			0x249F0,
		},
		UnlockItem{
			UnlockItemList[44],
			0x119,
			0x01,
			0xEA60,
		},
		UnlockItem{
			UnlockItemList[45],
			0x11A,
			0x01,
			0x1D4C0,
		},
		UnlockItem{
			UnlockItemList[46],
			0x138,
			0x01,
			0x249F0,
		},
		UnlockItem{
			UnlockItemList[47],
			0x15C,
			0x01,
			0x7A120,
		},
		UnlockItem{
			UnlockItemList[48],
			0x182,
			0x01,
			0x186A0,
		},
		UnlockItem{
			UnlockItemList[49],
			0x183,
			0x01,
			0x186A0,
		},
		UnlockItem{
			UnlockItemList[50],
			0x184,
			0x01,
			0x186A0,
		},
		UnlockItem{
			UnlockItemList[51],
			0x1FA,
			0x01,
			0x7530,
		},
		UnlockItem{
			UnlockItemList[52],
			0x1FB,
			0x01,
			0xC350,
		},
		UnlockItem{
			UnlockItemList[53],
			0x1FC,
			0x01,
			0x30D40,
		},
		UnlockItem{
			UnlockItemList[54],
			0x207,
			0x00,
			0xA0,
		},
		UnlockItem{
			UnlockItemList[55],
			0x208,
			0x00,
			0x104,
		},
		UnlockItem{
			UnlockItemList[56],
			0x209,
			0x00,
			0x1E0,
		},
		UnlockItem{
			UnlockItemList[57],
			0x20A,
			0x00,
			0x244,
		},
		UnlockItem{
			UnlockItemList[58],
			0x258,
			0x00,
			0x244,
		},
		UnlockItem{
			UnlockItemList[59],
			0x259,
			0x00,
			0x30C,
		},
		UnlockItem{
			UnlockItemList[60],
			0x291,
			0x01,
			0x249F0,
		},
		UnlockItem{
			UnlockItemList[61],
			0x292,
			0x01,
			0x75300,
		},
		UnlockItem{
			UnlockItemList[62],
			0x293,
			0x01,
			0x35B60,
		},
		UnlockItem{
			UnlockItemList[63],
			0x294,
			0x00,
			0x140,
		},
		UnlockItem{
			UnlockItemList[64],
			0x295,
			0x00,
			0x208,
		},
		UnlockItem{
			UnlockItemList[65],
			0x31F,
			0x00,
			0x208,
		},
		UnlockItem{
			UnlockItemList[66],
			0x3A4,
			0x01,
			0x493E0,
		},
		UnlockItem{
			UnlockItemList[67],
			0x444,
			0x01,
			0x3A980,
		},
		UnlockItem{
			UnlockItemList[68],
			0x445,
			0x01,
			0x57E40,
		},
		UnlockItem{
			UnlockItemList[69],
			0x446,
			0x01,
			0x75300,
		},
		UnlockItem{
			UnlockItemList[70],
			0x4A9,
			0x01,
			0x249F0,
		},
		UnlockItem{
			UnlockItemList[71],
			0x4AA,
			0x01,
			0x30D40,
		},
		UnlockItem{
			UnlockItemList[72],
			0x4FC,
			0x01,
			0x9942,
		},
		UnlockItem{
			UnlockItemList[73],
			0x4FD,
			0x01,
			0x22986,
		},
		UnlockItem{
			UnlockItemList[74],
			0x4FE,
			0x01,
			0x2ED8C,
		},
	}
)
View Source
var (

	//UsersManager 全局用户管理
	UsersManager = UManager{
		0,
		map[uint32]*User{},
		usersManagerLock,
	}
	MaxUsers uint32 = 0
)
View Source
var (
	DefaultInventoryItem = []UserInventoryItem{}
)

Functions

func BuildHeader

func BuildHeader(seq *uint8, id uint8) []byte

BuildHeader 建立数据包通用头部

func BuildRoomSetting

func BuildRoomSetting(room *Room, flags uint64) []byte

创建房间设置数据包

func BuildUserInfo

func BuildUserInfo(flags uint32, info UserInfo, id uint32, needID bool) []byte

func GetFlags

func GetFlags(room Room) uint64

func GetNextSeq

func GetNextSeq(seq *uint8) uint8

GetNextSeq 获取下一次的seq数据包序号

func IsIllegal

func IsIllegal(num uint32) bool

func IsItemRepetable

func IsItemRepetable(itemid uint32) bool

func NewNullString

func NewNullString() []byte

NewNullString 新建空的字符串

func ReadSubMenu

func ReadSubMenu(b []byte, offset *int) []uint32

func SendPacket

func SendPacket(data []byte, client net.Conn)

SendPacket 发送数据包

func WriteItem

func WriteItem(num uint32, curitem *uint8) []byte

func WriteLen

func WriteLen(data *[]byte)

WriteLen 写入数据长度到数据包通用头部

Types

type BoxData

type BoxData struct {
	BoxID      uint32
	BoxName    string
	Items      []BoxItem
	TotalValue int
	KeyId      uint32
	OptId      uint32
}

type BoxItem

type BoxItem struct {
	ItemID   uint32
	ItemName string
	Value    int
	Day      uint16
}

type ChannelInfo

type ChannelInfo struct {
	ChannelID     uint8
	ChannelName   []byte
	Unk00         uint16
	Unk01         uint16
	Unk02         uint8
	ChannelType   uint8
	ChannelStatus uint8
	NextRoomID    uint8
	RoomNum       uint16
	Rooms         map[uint16]*Room
	RoomNums      map[uint8]uint16

	ChannelMutex *sync.Mutex
}

频道信息,隶属于分区服务器,用于请求服务器和请求频道

type ChannelServer

type ChannelServer struct {
	ServerIndex  uint8
	ServerStatus uint8
	ServerType   uint8
	ServerName   []byte
	ChannelCount uint8
	Channels     []*ChannelInfo
}

分区服务器,管理所拥有的频道

type InAchievementCampaignPacket

type InAchievementCampaignPacket struct {
	CampaignId uint16
}

type InAchievementPacket

type InAchievementPacket struct {
	Type uint8
}

type InAssistPacket

type InAssistPacket struct {
	KillerID     uint32
	Unk00        uint8  //可能是辅助击杀人数?
	AssisterID   uint32 //貌似是击杀方式?
	Unk01        uint16
	Unk02        uint16
	Unk03        uint16
	AssisterTeam uint8 //待定,也可能是杀手的队伍
}

type InChangeTeamPacket

type InChangeTeamPacket struct {
	NewTeam uint8
}

type InChatPacket

type InChatPacket struct {
	Type           uint8
	DestinationLen uint8
	Destination    []byte
	MessageLen     uint16
	Message        []byte
}

type InDeathPacket

type InDeathPacket struct {
	DeadID     uint32
	Unk00      uint32 //一直是0
	Unk01      uint8  //貌似是死亡方式?
	DeathNum   uint16 //死亡数,生化模式3倍
	PlayerTeam uint8  //待定
}

type InDisassembleItemPacket

type InDisassembleItemPacket struct {
	SubType uint8
}

type InDisassemblePacket

type InDisassemblePacket struct {
	Type uint8
}

type InDisassembleWeaponPacket

type InDisassembleWeaponPacket struct {
	Unk00  uint32
	Unk01  uint8
	ItemID uint32
	Unk02  uint32
	Unk03  uint32
}

type InEventPacket

type InEventPacket struct {
	Type uint8
}

type InFavoritePacket

type InFavoritePacket struct {
	PacketType uint8
}

type InFavoriteSetCosmetics

type InFavoriteSetCosmetics struct {
	Slot   uint8
	ItemId uint32
}

type InFavoriteSetLoadout

type InFavoriteSetLoadout struct {
	Loadout    uint8
	WeaponSlot uint8
	ItemId     uint32
}

type InFeedbackPacket

type InFeedbackPacket struct {
	ErrorCode uint16
	// contains filtered or unexported fields
}

type InGameScorePacket

type InGameScorePacket struct {
	WinnerTeam uint8
	TrScore    uint8
	CtScore    uint8
	PacketType uint8 //maybe
	HostID     uint32
	Unk00      uint32
}

type InHostBuyItemPacket

type InHostBuyItemPacket struct {
	UserID         uint32
	NumItemsBought uint8
	Items          []uint32
}

type InHostItemUsingPacket

type InHostItemUsingPacket struct {
	UserID uint32
	ItemID uint32
}

type InHostPacket

type InHostPacket struct {
	InHostType uint8
}

type InHostSetBuyMenu

type InHostSetBuyMenu struct {
	Userid uint32
}

type InHostSetInventoryPacket

type InHostSetInventoryPacket struct {
	UserID uint32
}

type InHostSetLoadoutPacket

type InHostSetLoadoutPacket struct {
	UserID uint32
}

type InHostTeamChangingPacket

type InHostTeamChangingPacket struct {
	UserId uint32
	Unk00  uint8
	//unk01   uint8
	NewTeam uint8
}

type InItemUsePacket

type InItemUsePacket struct {
	ItemSeq  uint16
	ItemType uint8

	String []byte
	// contains filtered or unexported fields
}

type InJoinRoomPacket

type InJoinRoomPacket struct {
	RoomId        uint16
	LenOfPassWord uint8
	PassWord      []byte
}

type InKillPacket

type InKillPacket struct {
	Unk00      uint8 //一直是0
	KillerID   uint32
	Unk01      uint32 //一直是0
	Unk02      uint8
	KillType   uint8  //貌似是击杀方式?
	KillNum    uint16 //杀敌数,生化模式3倍
	PlayerTeam uint8  //待定
}

type InLoginPacket

type InLoginPacket struct {
	LenOfNexonUsername uint8
	NexonUsername      []byte //假定nexonUsername是唯一
	LenOfGameUsername  uint8
	GameUsername       []byte
	Unknown01          uint8
	LenOfPassWd        uint16
	PassWd             []byte
	//HddHwid 	   	   16 bytes
	HddHwid []byte
	//netCafeID 	   4 bytes
	NetCafeID          uint32
	Unknown02          uint32
	UserSn             uint64
	LenOfUnknownString uint16
	UnknownString03    []byte
	Unknown04          uint8
	IsLeague           uint8
	LenOfString        uint8
	String             []byte
}

type InNewRoomPacket

type InNewRoomPacket struct {
	LenOfName  uint8
	RoomName   []byte
	Unk00      uint16
	Unk01      uint8
	GameModeID uint8
	MapID      uint8
	WinLimit   uint8
	KillLimit  uint16
	Unk02      uint8
	Unk03      uint8
	Unk04      uint8
	LenOfUnk05 uint8
	Unk05      []byte
	Unk06      uint8
	Unk07      uint8
	Unk08      uint8
	Unk09      uint8
	Unk10      uint8
	Unk11      uint32
}

InNewRoomPacket 新建房间时传进来的数据包

type InNotifyListPacket

type InNotifyListPacket struct {
	InType uint8
}

type InNotifyPacket

type InNotifyPacket struct {
	InNotifyType uint8
}

type InOpenBoxPacket

type InOpenBoxPacket struct {
	BoxID uint32
	Unk00 uint32
}

type InOptionBuyMenu

type InOptionBuyMenu struct {
	MenuLength uint16
	Unk00      uint8
	Buymenu    UserBuyMenu
}

type InOptionPacket

type InOptionPacket struct {
	OptionPacketType uint8
}

type InPlayerInfoPacket

type InPlayerInfoPacket struct {
	InfoType uint8
}

type InPointLottoPacket

type InPointLottoPacket struct {
	Type uint8
}

type InQuickList

type InQuickList struct {
	GameModID   uint8
	IsEnableBot uint8
}

type InQuickPacket

type InQuickPacket struct {
	InQuickType uint8
}

type InReportMsgPacket

type InReportMsgPacket struct {
	LenOfName uint8
	Name      []byte
	Type      uint8
	LenOfMsg  uint16
	Msg       []byte
	Unk00     uint16
}

type InReportPacket

type InReportPacket struct {
	Type uint8
}

type InReportSearchUserPacket

type InReportSearchUserPacket struct {
	LenOfName uint8
	Name      []byte
}

type InRevivedPacket

type InRevivedPacket struct {
	UserID uint32
	X      uint32 //待定,但是极像坐标
	Y      uint32
	Z      uint32
	Unk00  uint8
}

type InRoomCountdownPacket

type InRoomCountdownPacket struct {
	CountdownType uint8
	Count         uint8
}

func (InRoomCountdownPacket) ShouldCountdown

func (p InRoomCountdownPacket) ShouldCountdown() bool

type InRoomListRequestPacket

type InRoomListRequestPacket struct {
	ChannelServerIndex uint8
	ChannelIndex       uint8
}

InRoomListRequestPacket 房间列表请求,用于请求频道

type InRoomPaket

type InRoomPaket struct {
	InRoomType uint8
}

房间请求

type InSetAvatarPacket

type InSetAvatarPacket struct {
	AvatarId uint16
}

type InSetCampaignPacket

type InSetCampaignPacket struct {
	PacketType uint8
	CampaignId uint16
}

type InSetSignaturePacket

type InSetSignaturePacket struct {
	Len       uint8
	Signature []byte
}

type InSetTitlePacket

type InSetTitlePacket struct {
	TitleId uint16
}

type InShopBuyItemPacket

type InShopBuyItemPacket struct {
	ItemID uint32
}

type InShopPacket

type InShopPacket struct {
	InShopType uint8
}

type InSupplyPacket

type InSupplyPacket struct {
	Type uint8
}

type InTryItemUsePacket

type InTryItemUsePacket struct {
	ItemSeq  uint16
	ItemType uint8

	NewName []byte
	// contains filtered or unexported fields
}

type InUDPmsg

type InUDPmsg struct {
	Signature uint8
	UserId    uint32
	PortId    uint16
	IpAddress uint32
	Port      uint16

	PacketData         []byte
	Datalen            int
	CurOffset          int //可能32位
	ParsedSuccessfully bool
}

func (InUDPmsg) IsHeartbeat

func (p InUDPmsg) IsHeartbeat() bool

func (*InUDPmsg) PraseUDPpacket

func (dest *InUDPmsg) PraseUDPpacket(data []byte, len int) bool

type InUpSettingReq

type InUpSettingReq struct {
	Flags              uint64
	LenOfRoomName      uint8
	RoomName           []byte
	Unk00              uint8
	Unk01              uint8
	Unk02              uint32
	Unk03              uint32
	LenOfpasswd        uint8
	Passwd             []byte
	Unk10              uint16
	ForceCamera        uint8
	GameModeID         uint8
	MapID              uint8
	Unk13              uint8
	MaxPlayers         uint8
	WinLimit           uint8
	KillLimit          uint16
	Unk17              uint8
	Unk18              uint8
	WeaponRestrictions uint8
	Status             uint8
	Unk21              uint8
	MapCycleType       uint8
	Unk23              uint8
	Unk24              uint8
	Unk25              uint8
	NumOfMultiMaps     uint8
	MultiMaps          []uint8
	TeamBalanceType    uint8
	Unk29              uint8
	Unk30              uint8
	Unk31              uint8
	Unk32              uint8
	Unk33              uint8
	BotEnabled         uint8
	BotDifficulty      uint8
	NumCtBots          uint8
	NumTrBots          uint8
	Unk35              uint8
	Unk36              uint8
	Unk37              uint8
	Unk38              uint8
	Unk39              uint8
	IsIngame           uint8
	StartMoney         uint16
	ChangeTeams        uint8
	Unk43              uint8
	HltvEnabled        uint8
	Unk45              uint8
	RespawnTime        uint8
}

type InWeaponPointArray

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

type InWeaponPointPacket

type InWeaponPointPacket struct {
	KillType             uint32
	KillerID             uint32
	KillerWeaponID       uint32
	KillerTeam           uint8
	KillerClientType     uint8
	KillerCharacterType  uint8
	KillerCharacterClass uint32

	DeadType             uint32
	VictimID             uint32
	VictimWeaponID       uint32
	VictimTeam           uint8
	VictimClientType     uint8
	VictimCharacterType  uint8
	VictimCharacterClass uint32

	KillerX uint32
	KillerY uint32
	KillerZ uint32

	VictimX uint32
	VictimY uint32
	VictimZ uint32

	ArraySize uint16 //待定
	Array     []InWeaponPointArray
}

type ItemData

type ItemData struct {
	ItemID      uint32
	Name        string
	Class       string
	Category    string
	BuyCategory string
	ItemType    int
}

type ItemOption

type ItemOption struct {
	Price uint32
	Count uint16
	Day   uint16
}

type OutAchievementCampaign

type OutAchievementCampaign struct {
	Unk00        uint16
	Unk01        uint32
	RewardTitle  uint16
	RewardIcon   uint16
	RewardPoints uint32
	RewardXp     uint32
	NumOfItems   uint8
	Items        []OutAchievementCampaignItems
	Unk02        uint16
}

OutAchievementCampaign from l-leite

type OutAchievementCampaignItems

type OutAchievementCampaignItems struct {
	ItemId      uint32
	Ammount     uint16
	TimeLimited uint16 // 1 and 0
}

OutAchievementCampaignItems from l-leite

type OutLobbyJoinRoom

type OutLobbyJoinRoom struct {
	Unk00 uint8
	Unk01 uint8
	Unk02 uint8
}

未知,用于请求频道

type PacketData

type PacketData struct {
	Data      []byte
	Sequence  uint8
	Length    uint16
	Id        uint8
	CurOffset int
}

PacketData ,data part of packet

func (*PacketData) PraseChangeTeamPacket

func (p *PacketData) PraseChangeTeamPacket(dest *InChangeTeamPacket) bool

func (*PacketData) PraseChannelRequest

func (p *PacketData) PraseChannelRequest(dest *InRoomListRequestPacket) bool

func (*PacketData) PraseDisassembleItemPacket

func (p *PacketData) PraseDisassembleItemPacket(dest *InDisassembleItemPacket) bool

func (*PacketData) PraseDisassemblePacket

func (p *PacketData) PraseDisassemblePacket(dest *InDisassemblePacket) bool

func (*PacketData) PraseDisassembleWeaponPacket

func (p *PacketData) PraseDisassembleWeaponPacket(dest *InDisassembleWeaponPacket) bool

func (*PacketData) PraseFavoritePacket

func (p *PacketData) PraseFavoritePacket(dest *InFavoritePacket) bool

func (*PacketData) PraseFavoriteSetCosmeticsPacket

func (p *PacketData) PraseFavoriteSetCosmeticsPacket(dest *InFavoriteSetCosmetics) bool

func (*PacketData) PraseFavoriteSetLoadoutPacket

func (p *PacketData) PraseFavoriteSetLoadoutPacket(dest *InFavoriteSetLoadout) bool

func (*PacketData) PraseHostPacket

func (p *PacketData) PraseHostPacket(dest *InHostPacket) bool

func (*PacketData) PraseInAchievementCampaignPacket

func (p *PacketData) PraseInAchievementCampaignPacket(dest *InAchievementCampaignPacket) bool

func (*PacketData) PraseInAchievementPacket

func (p *PacketData) PraseInAchievementPacket(dest *InAchievementPacket) bool

func (*PacketData) PraseInAssistPacket

func (p *PacketData) PraseInAssistPacket(dest *InAssistPacket) bool

func (*PacketData) PraseInChatPacket

func (p *PacketData) PraseInChatPacket(dest *InChatPacket) bool

func (*PacketData) PraseInDeathPacket

func (p *PacketData) PraseInDeathPacket(dest *InDeathPacket) bool

func (*PacketData) PraseInEventPacket

func (p *PacketData) PraseInEventPacket(dest *InEventPacket) bool

func (*PacketData) PraseInGameScorePacket

func (p *PacketData) PraseInGameScorePacket(dest *InGameScorePacket) bool

func (*PacketData) PraseInHostBuyItemPacket

func (p *PacketData) PraseInHostBuyItemPacket(dest *InHostBuyItemPacket) bool

func (*PacketData) PraseInHostItemUsingPacket

func (p *PacketData) PraseInHostItemUsingPacket(dest *InHostItemUsingPacket) bool

func (*PacketData) PraseInKillPacket

func (p *PacketData) PraseInKillPacket(dest *InKillPacket) bool

func (*PacketData) PraseInQuickListPacket

func (p *PacketData) PraseInQuickListPacket(dest *InQuickList) bool

func (*PacketData) PraseInRevivedPacket

func (p *PacketData) PraseInRevivedPacket(dest *InRevivedPacket) bool

func (*PacketData) PraseInTeamChangingPacket

func (p *PacketData) PraseInTeamChangingPacket(dest *InHostTeamChangingPacket) bool

func (*PacketData) PraseInWeaponPointPacket

func (p *PacketData) PraseInWeaponPointPacket(dest *InWeaponPointPacket) bool

func (*PacketData) PraseItemUsePacket

func (p *PacketData) PraseItemUsePacket(dest *InItemUsePacket) bool

func (*PacketData) PraseJoinRoomPacket

func (p *PacketData) PraseJoinRoomPacket(dest *InJoinRoomPacket) bool

func (*PacketData) PraseLoginPacket

func (dataPacket *PacketData) PraseLoginPacket(p *InLoginPacket) bool

func (*PacketData) PraseNewRoomQuest

func (p *PacketData) PraseNewRoomQuest(dest *InNewRoomPacket) bool

func (*PacketData) PraseNotifyListPacket

func (p *PacketData) PraseNotifyListPacket(dest *InNotifyListPacket) bool

func (*PacketData) PraseNotifyPacket

func (p *PacketData) PraseNotifyPacket(dest *InNotifyPacket) bool

func (*PacketData) PraseOpenBoxPacket

func (p *PacketData) PraseOpenBoxPacket(dest *InOpenBoxPacket) bool

func (*PacketData) PraseOptionPacket

func (p *PacketData) PraseOptionPacket(dest *InOptionPacket) bool

func (*PacketData) PrasePlayerInfoPacket

func (p *PacketData) PrasePlayerInfoPacket(dest *InPlayerInfoPacket) bool

func (*PacketData) PrasePointLottoPacket

func (p *PacketData) PrasePointLottoPacket(dest *InPointLottoPacket) bool

func (*PacketData) PraseQuickPacket

func (p *PacketData) PraseQuickPacket(dest *InQuickPacket) bool

func (*PacketData) PraseReportMsgPacket

func (p *PacketData) PraseReportMsgPacket(dest *InReportMsgPacket) bool

func (*PacketData) PraseReportPacket

func (p *PacketData) PraseReportPacket(dest *InReportPacket) bool

func (*PacketData) PraseReportSearchUserPacket

func (p *PacketData) PraseReportSearchUserPacket(dest *InReportSearchUserPacket) bool

func (*PacketData) PraseRoomCountdownPacket

func (p *PacketData) PraseRoomCountdownPacket(dest *InRoomCountdownPacket) bool

func (*PacketData) PraseRoomFeedbackPacket

func (p *PacketData) PraseRoomFeedbackPacket(dest *InFeedbackPacket) bool

func (*PacketData) PraseRoomPacket

func (p *PacketData) PraseRoomPacket(dest *InRoomPaket) bool

func (*PacketData) PraseSaveBuyMenu

func (p *PacketData) PraseSaveBuyMenu(dest *InOptionBuyMenu) bool

func (*PacketData) PraseSetAvatarPacket

func (p *PacketData) PraseSetAvatarPacket(dest *InSetAvatarPacket) bool

func (*PacketData) PraseSetBuyMenuPacket

func (p *PacketData) PraseSetBuyMenuPacket(dest *InHostSetBuyMenu) bool

func (*PacketData) PraseSetCampaignPacket

func (p *PacketData) PraseSetCampaignPacket(dest *InSetCampaignPacket) bool

func (*PacketData) PraseSetSignaturePacket

func (p *PacketData) PraseSetSignaturePacket(dest *InSetSignaturePacket) bool

func (*PacketData) PraseSetTitlePacket

func (p *PacketData) PraseSetTitlePacket(dest *InSetTitlePacket) bool

func (*PacketData) PraseSetUserInventoryPacket

func (p *PacketData) PraseSetUserInventoryPacket(dest *InHostSetInventoryPacket) bool

func (*PacketData) PraseSetUserLoadoutPacket

func (p *PacketData) PraseSetUserLoadoutPacket(dest *InHostSetLoadoutPacket) bool

func (*PacketData) PraseShopBuyItemPacket

func (p *PacketData) PraseShopBuyItemPacket(dest *InShopBuyItemPacket) bool

func (*PacketData) PraseShopPacket

func (p *PacketData) PraseShopPacket(dest *InShopPacket) bool

func (*PacketData) PraseSupplyPacket

func (p *PacketData) PraseSupplyPacket(dest *InSupplyPacket) bool

func (*PacketData) PraseTryItemUsePacket

func (p *PacketData) PraseTryItemUsePacket(dest *InTryItemUsePacket) bool

func (*PacketData) PraseUpdateRoomPacket

func (p *PacketData) PraseUpdateRoomPacket(dest *InUpSettingReq) bool

type PacketHeader

type PacketHeader struct {
	Data     []byte
	Sequence uint8
	Length   uint16
}

PacketHeader ,header of packet , 4 bytes len

func (*PacketHeader) PraseHeadPacket

func (p *PacketHeader) PraseHeadPacket()

type Room

type Room struct {
	Id uint16
	//Flags              uint64
	RoomNumber         uint8
	PasswordProtected  uint8
	Unk08              uint8
	HostUserID         uint32
	HostUserName       []byte
	Unk11              uint8
	Unk12              uint8
	Unk13              uint32
	Unk14              uint16
	Unk15              uint16
	Unk16              uint32
	Unk17              uint16
	Unk18              uint16
	Unk19              uint8
	Unk20              uint8
	Unk21              uint8
	Unk24              uint8
	Unk26              uint8
	Unk27              []uint8
	Unk28              uint8
	Unk29              uint8
	Unk30              uint64
	Unk31              uint8
	Unk35              uint8
	AreFlashesDisabled uint8
	CanSpec            uint8
	IsVipRoom          uint8
	VipRoomLevel       uint8

	//设置
	Setting             RoomSettings
	CountingDown        bool
	Countdown           uint8
	NumPlayers          uint8
	Users               map[uint32]*User
	ParentChannel       uint8
	ParentChannelServer uint8
	CtScore             uint8
	TrScore             uint8
	CtKillNum           uint32
	TrKillNum           uint32
	WinnerTeam          uint8

	RoomMutex *sync.Mutex
}

房间信息

func (Room) CanStartGame

func (rm Room) CanStartGame() bool

func (*Room) CheckIngameStatus

func (rm *Room) CheckIngameStatus()

func (*Room) CountRoomCtKill

func (rm *Room) CountRoomCtKill()

func (*Room) CountRoomTrKill

func (rm *Room) CountRoomTrKill()

func (Room) FindDesirableTeam

func (rm Room) FindDesirableTeam() int

func (Room) GetAllCtNum

func (rm Room) GetAllCtNum() int

func (Room) GetAllTrNum

func (rm Room) GetAllTrNum() int

func (*Room) GetCountdown

func (rm *Room) GetCountdown() uint8

func (Room) GetFreeSlots

func (rm Room) GetFreeSlots() int

func (Room) GetNumOfReadyPlayers

func (rm Room) GetNumOfReadyPlayers() int

func (Room) GetNumOfRealIngamePlayers

func (rm Room) GetNumOfRealIngamePlayers() int

func (Room) GetNumOfRealReadyPlayers

func (rm Room) GetNumOfRealReadyPlayers() int

func (Room) IsGlobalCountdownInProgress

func (rm Room) IsGlobalCountdownInProgress() bool

func (*Room) JoinUser

func (rm *Room) JoinUser(u *User) bool

func (*Room) ProgressCountdown

func (rm *Room) ProgressCountdown(num uint8)

func (*Room) ResetRoomKillNum

func (rm *Room) ResetRoomKillNum()

func (*Room) ResetRoomScore

func (rm *Room) ResetRoomScore()

func (*Room) ResetRoomWinner

func (rm *Room) ResetRoomWinner()

func (Room) RoomGetUser

func (rm Room) RoomGetUser(id uint32) *User

func (*Room) RoomRemoveUser

func (rm *Room) RoomRemoveUser(id uint32)

func (*Room) SetRoomHost

func (rm *Room) SetRoomHost(u *User)

func (*Room) SetRoomScore

func (rm *Room) SetRoomScore(ctScore uint8, trScore uint8)

func (*Room) SetRoomWinner

func (rm *Room) SetRoomWinner(Winner uint8)

func (*Room) SetStatus

func (rm *Room) SetStatus(status uint8)

func (*Room) StopCountdown

func (rm *Room) StopCountdown()

func (*Room) SyncUserNum

func (rm *Room) SyncUserNum(num uint8)

func (*Room) ToUpdateSetting

func (dest *Room) ToUpdateSetting(src *InUpSettingReq)

type RoomSettings

type RoomSettings struct {
	LenOfName          uint8
	RoomName           []byte
	Unk00              uint8
	Unk01              uint8
	Unk02              uint32
	Unk03              uint32
	LenOfPassWd        uint8
	PassWd             []byte
	Unk10              uint16
	ForceCamera        uint8
	GameModeID         uint8
	MapID              uint8
	Unk13              uint8
	MaxPlayers         uint8
	WinLimit           uint8
	KillLimit          uint16
	Unk17              uint8
	Unk18              uint8
	WeaponRestrictions uint8
	Status             uint8
	Unk21              uint8
	MapCycleType       uint8
	Unk23              uint8
	Unk24              uint8
	Unk25              uint8
	LenOfMultiMaps     uint8
	MultiMaps          []byte
	TeamBalanceType    uint8
	Unk29              uint8
	Unk30              uint8
	Unk31              uint8
	Unk32              uint8
	Unk33              uint8
	AreBotsEnabled     uint8
	BotDifficulty      uint8
	NumCtBots          uint8
	NumTrBots          uint8
	Unk35              uint8
	Unk36              uint8
	Unk37              uint8
	Unk38              uint8
	Unk39              uint8
	StartMoney         uint16
	ChangeTeams        uint8
	Unk43              uint8
	HltvEnabled        uint8
	Unk45              uint8
	RespawnTime        uint8
	NextMapEnabled     uint8
	Difficulty         uint8
	IsIngame           uint8
}

每个房间的设置数据

type ServerManager

type ServerManager struct {
	ServerNum uint8
	Servers   []*ChannelServer
}

主服务器,管理各个分区

type ShopItem

type ShopItem struct {
	ItemID   uint32
	Currency uint8
	Opt      []ItemOption
}

type UManager

type UManager struct {
	UserNum int
	Users   map[uint32]*User
	Lock    sync.Mutex
}

UManager 全局用户管理

func (*UManager) AddUser

func (dest *UManager) AddUser(src *User) bool

func (*UManager) DelUser

func (dest *UManager) DelUser(src *User) bool

func (*UManager) GetChannelUsers

func (dest *UManager) GetChannelUsers(chlsrvid, chlid uint8) []byte

type UnlockData

type UnlockData struct {
	ItemID         uint32
	NextItemID     uint32
	ConditionFlag0 uint32
	Count0         uint32
	ConditionFlag1 uint32
	Count1         uint32
	ConditionFlag2 uint32
	Count2         uint32
	ConditionFlag3 uint32
	Count3         uint32
	ConditionFlag4 uint32
	Count4         uint32
	Category       uint32
}

type UnlockItem

type UnlockItem struct {
	Itemid   uint32
	Seq      uint32
	CostType uint8
	Price    uint32
}

type UnlockKillNum

type UnlockKillNum struct {
	Unk00   uint32 //seq ?
	Itemid  uint32
	KillNum uint32
	Unk01   [6]byte //always 0
}

type UnlockSeq

type UnlockSeq struct {
	Nums uint16
	IDs  []uint32
}

type User

type User struct {
	//个人信息
	CheckUpdate          int
	Userid               uint32 `json:"-"`
	NexonID              uint64
	UserName             string
	IngameName           string
	Password             []byte
	Gm                   uint8
	Level                uint16
	Rank                 uint8
	RankFrame            uint8
	Points               uint64
	CurrentExp           uint64
	MaxExp               uint64
	PlayedMatches        uint32
	Wins                 uint32
	Kills                uint32
	Headshots            uint32
	Deaths               uint32
	Assists              uint32
	Accuracy             uint16
	SecondsPlayed        uint32
	NetCafeName          []byte
	Cash                 uint32
	ClanName             []byte
	ClanMark             uint32
	WorldRank            uint32
	Campaign             uint16
	Mpoints              uint32
	TitleId              uint16
	UnlockedTitles       []byte
	Signature            []byte
	UnreadedMsg          uint8
	BestGamemode         uint32
	BestMap              uint32
	UnlockedAchievements []byte
	Avatar               uint16
	UnlockedAvatars      []byte
	VipLevel             uint8
	VipXp                uint32
	SkillHumanCurXp      uint64
	SkillHumanMaxXp      uint64
	SkillHumanPoints     uint8
	SkillZombieCurXp     uint64
	SkillZombieMaxXp     uint64
	SkillZombiePoints    uint8
	UserMail             string
	//连接
	CurrentConnection net.Conn `json:"-"`
	//频道房间信息
	CurrentChannelServerIndex uint8       `json:"-"`
	CurrentChannelIndex       uint8       `json:"-"`
	CurrentRoomId             uint16      `json:"-"`
	CurrentTeam               uint8       `json:"-"`
	Currentstatus             uint8       `json:"-"`
	CurrentIsIngame           bool        `json:"-"`
	CurrentSequence           *uint8      `json:"-"`
	CurrentKillNum            uint16      `json:"-"`
	CurrentDeathNum           uint16      `json:"-"`
	CurrentAssistNum          uint16      `json:"-"`
	NetInfo                   UserNetInfo `json:"-"`
	//仓库信息
	Inventory   UserInventory
	WeaponKills map[uint32]uint32

	UserMutex *sync.Mutex `json:"-"`
}

func GetNewUser

func GetNewUser() User

func (*User) AddItem

func (u *User) AddItem(itemid uint32, count uint16, times uint64) int

func (*User) AddItemSingle

func (u *User) AddItemSingle(itemid uint32, times uint64)

func (*User) AddMatches

func (u *User) AddMatches()

func (*User) AddWins

func (u *User) AddWins()

func (*User) BuildUserNetInfo

func (u *User) BuildUserNetInfo() []byte

func (*User) CheckCampaign

func (u *User) CheckCampaign(id uint16) bool

func (*User) CheckIllegalItem

func (u *User) CheckIllegalItem() []int

func (*User) CheckOutdatedItem

func (u *User) CheckOutdatedItem()

func (*User) CheckOutdatedItemIngame

func (u *User) CheckOutdatedItemIngame() []int

func (*User) CountAssistNum

func (u *User) CountAssistNum()

func (*User) CountDeadNum

func (u *User) CountDeadNum(num uint16)

func (*User) CountKillNum

func (u *User) CountKillNum(num uint16)

func (*User) CountWeaponKill

func (u *User) CountWeaponKill(itemid uint32)

func (*User) DecreaseItem

func (u *User) DecreaseItem(itemid uint32) (int, bool)

func (*User) ExtendItemTime

func (u *User) ExtendItemTime(itemid uint32, count uint16, times uint64) int

func (*User) GetAssists

func (u *User) GetAssists(num uint32)

func (*User) GetDeathes

func (u *User) GetDeathes(num uint32)

func (*User) GetExp

func (u *User) GetExp(num uint64)

func (*User) GetItemCount

func (u *User) GetItemCount(Idx int) int

func (*User) GetItemIDBySeq

func (u *User) GetItemIDBySeq(seq uint16) uint32

func (*User) GetKills

func (u *User) GetKills(num uint32)

func (*User) GetPoints

func (u *User) GetPoints(num uint64)

func (User) GetUserChannelID

func (u User) GetUserChannelID() uint8

获取用户所在频道ID

func (User) GetUserChannelServerID

func (u User) GetUserChannelServerID() uint8

GetUserChannelServerID 获取用户所在分区服务器ID

func (User) GetUserRoomID

func (u User) GetUserRoomID() uint16

获取用户所在房间ID

func (User) GetUserTeam

func (u User) GetUserTeam() uint8

func (User) IsGM

func (u User) IsGM() bool

func (User) IsUserReady

func (u User) IsUserReady() bool

func (User) IsVIP

func (u User) IsVIP() bool

func (*User) JoinRoom

func (u *User) JoinRoom(id uint16, team uint8)

func (*User) PunishPoints

func (u *User) PunishPoints()

func (*User) QuitChannel

func (u *User) QuitChannel()

func (*User) QuitRoom

func (u *User) QuitRoom()

func (*User) RemoveItem

func (u *User) RemoveItem(itemid uint32)

func (*User) ResetAssistNum

func (u *User) ResetAssistNum()

func (*User) ResetDeadNum

func (u *User) ResetDeadNum()

func (*User) ResetKillNum

func (u *User) ResetKillNum()

func (*User) SetAvatar

func (u *User) SetAvatar(id uint16)

func (*User) SetBoughtItem

func (u *User) SetBoughtItem(id uint32)

func (*User) SetBuyMenu

func (u *User) SetBuyMenu(menu UserBuyMenu)

func (*User) SetGM

func (u *User) SetGM()

func (*User) SetID

func (u *User) SetID(id uint32)

func (*User) SetInventoryItems

func (u *User) SetInventoryItems(items *[]UserInventoryItem)

func (*User) SetNewMutex

func (u *User) SetNewMutex()

func (*User) SetSignature

func (u *User) SetSignature(sig []byte)

func (*User) SetTitle

func (u *User) SetTitle(id uint16)

func (*User) SetUserChannel

func (u *User) SetUserChannel(id uint8)

func (*User) SetUserChannelServer

func (u *User) SetUserChannelServer(id uint8)

func (*User) SetUserIngame

func (u *User) SetUserIngame(ingame bool)

func (*User) SetUserName

func (u *User) SetUserName(loginName, username string)

func (*User) SetUserRoom

func (u *User) SetUserRoom(id uint16)

func (*User) SetUserStatus

func (u *User) SetUserStatus(status uint8)

func (*User) SetUserTeam

func (u *User) SetUserTeam(team uint8)

func (*User) SetVIP

func (u *User) SetVIP()

func (*User) UpdateCampaign

func (u *User) UpdateCampaign(id uint16)

func (*User) UpdateHolepunch

func (u *User) UpdateHolepunch(portId uint16, localPort uint16, externalPort uint16) uint16

func (*User) Updated

func (u *User) Updated()

func (*User) UseBox

func (u *User) UseBox(itemid, keyid uint32) bool

func (*User) UseCredits

func (u *User) UseCredits(num uint32) bool

func (*User) UseMPoints

func (u *User) UseMPoints(num uint32) bool

func (*User) UsePoints

func (u *User) UsePoints(num uint64) bool

type UserBuyMenu

type UserBuyMenu struct {
	Pistols     []uint32
	Shotguns    []uint32
	Smgs        []uint32
	Rifles      []uint32
	Snipers     []uint32
	Machineguns []uint32
	Melees      []uint32
	Equipment   []uint32
}

UserBuyMenu 用户的购买菜单

func CreateDefaultUserBuyMenu

func CreateDefaultUserBuyMenu() UserBuyMenu

func CreateFullUserBuyMenu

func CreateFullUserBuyMenu() UserBuyMenu

type UserInfo

type UserInfo struct {
	//flags                uint32 // should always be 0xFFFFFFFF for a full update
	NexonID uint64 // nexon id?

	Title uint16
	// contains filtered or unexported fields
}

发送出去的包结构,其中一些未知,知道后会加入user里去

func NewUserInfo

func NewUserInfo(u *User) UserInfo

type UserInventory

type UserInventory struct {
	NumOfItem            uint16              //物品数量
	Items                []UserInventoryItem //物品
	OnlyOnceBundleItemId map[uint32]bool
	CTModel              uint32 //当前的CT模型
	TModel               uint32 //当前的T模型
	HeadItem             uint32 //当前的头部装饰
	GloveItem            uint32 //当前的手套
	BackItem             uint32 //当前的背部物品
	StepsItem            uint32 //当前的脚步效果
	CardItem             uint32 //当前的卡片
	SprayItem            uint32 //当前的喷漆

	BuyMenu  UserBuyMenu //购买菜单
	Loadouts []UserLoadout
}

func CreateNewUserInventory

func CreateNewUserInventory() UserInventory

type UserInventoryItem

type UserInventoryItem struct {
	Id    uint32 //物品id
	Count uint16 //数量
	Type  uint8
	Time  uint64
}

type UserLoadout

type UserLoadout struct {
	Items []uint32
}

func CreateDefaultLoadout

func CreateDefaultLoadout() []UserLoadout

func CreateFullLoadout

func CreateFullLoadout() []UserLoadout

type UserNetInfo

type UserNetInfo struct {
	ExternalIpAddress  uint32
	ExternalClientPort uint16
	ExternalServerPort uint16
	ExternalTvPort     uint16

	LocalIpAddress  uint32
	LocalClientPort uint16
	LocalServerPort uint16
	LocalTvPort     uint16
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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