Documentation
¶
Index ¶
- Constants
- Variables
- func BuildHeader(seq *uint8, id uint8) []byte
- func BuildUserInfo(flags uint32, info UserInfo, id uint32, needID bool) []byte
- func GetNextSeq(seq *uint8) uint8
- func IsIllegal(num uint32) bool
- func NewNullString() []byte
- func ReadSubMenu(b []byte, offset *int) []uint32
- func SendPacket(data []byte, client net.Conn)
- func WriteItem(num uint32, curitem *uint8) []byte
- func WriteLen(data *[]byte)
- type ChannelInfo
- type ChannelServer
- type InAssistPacket
- type InChangeTeamPacket
- type InDeathPacket
- type InFavoritePacket
- type InFavoriteSetCosmetics
- type InFavoriteSetLoadout
- type InGameScorePacket
- type InHostPacket
- type InHostSetBuyMenu
- type InHostSetInventoryPacket
- type InHostSetLoadoutPacket
- type InHostTeamChangingPacket
- type InJoinRoomPacket
- type InKillPacket
- type InLoginPacket
- type InNewRoomPacket
- type InOptionBuyMenu
- type InOptionPacket
- type InPlayerInfoPacket
- type InQuickList
- type InQuickPacket
- type InRevivedPacket
- type InRoomCountdownPacket
- type InRoomListRequestPacket
- type InRoomPaket
- type InSetAvatarPacket
- type InSetSignaturePacket
- type InSetTitlePacket
- type InUDPmsg
- type InUpSettingReq
- type OutLobbyJoinRoom
- type PacketData
- func (p *PacketData) PraseChangeTeamPacket(dest *InChangeTeamPacket) bool
- func (p *PacketData) PraseChannelRequest(dest *InRoomListRequestPacket) bool
- func (p *PacketData) PraseFavoritePacket(dest *InFavoritePacket) bool
- func (p *PacketData) PraseFavoriteSetCosmeticsPacket(dest *InFavoriteSetCosmetics) bool
- func (p *PacketData) PraseFavoriteSetLoadoutPacket(dest *InFavoriteSetLoadout) bool
- func (p *PacketData) PraseHostPacket(dest *InHostPacket) bool
- func (p *PacketData) PraseInAssistPacket(dest *InAssistPacket) bool
- func (p *PacketData) PraseInDeathPacket(dest *InDeathPacket) bool
- func (p *PacketData) PraseInGameScorePacket(dest *InGameScorePacket) bool
- func (p *PacketData) PraseInKillPacket(dest *InKillPacket) bool
- func (p *PacketData) PraseInQuickListPacket(dest *InQuickList) bool
- func (p *PacketData) PraseInRevivedPacket(dest *InRevivedPacket) bool
- func (p *PacketData) PraseInTeamChangingPacket(dest *InHostTeamChangingPacket) bool
- func (p *PacketData) PraseJoinRoomPacket(dest *InJoinRoomPacket) bool
- func (dataPacket *PacketData) PraseLoginPacket(p *InLoginPacket) bool
- func (p *PacketData) PraseNewRoomQuest(dest *InNewRoomPacket) bool
- func (p *PacketData) PraseOptionPacket(dest *InOptionPacket) bool
- func (p *PacketData) PrasePlayerInfoPacket(dest *InPlayerInfoPacket) bool
- func (p *PacketData) PraseQuickPacket(dest *InQuickPacket) bool
- func (p *PacketData) PraseRoomCountdownPacket(dest *InRoomCountdownPacket) bool
- func (p *PacketData) PraseRoomPacket(dest *InRoomPaket) bool
- func (p *PacketData) PraseSaveBuyMenu(dest *InOptionBuyMenu) bool
- func (p *PacketData) PraseSetAvatarPacket(dest *InSetAvatarPacket) bool
- func (p *PacketData) PraseSetBuyMenuPacket(dest *InHostSetBuyMenu) bool
- func (p *PacketData) PraseSetSignaturePacket(dest *InSetSignaturePacket) bool
- func (p *PacketData) PraseSetTitlePacket(dest *InSetTitlePacket) bool
- func (p *PacketData) PraseSetUserInventoryPacket(dest *InHostSetInventoryPacket) bool
- func (p *PacketData) PraseSetUserLoadoutPacket(dest *InHostSetLoadoutPacket) bool
- func (p *PacketData) PraseUpdateRoomPacket(dest *InUpSettingReq) bool
- type PacketHeader
- type Room
- func (rm Room) CanStartGame() bool
- func (rm *Room) CheckIngameStatus()
- func (rm *Room) CountRoomCtKill()
- func (rm *Room) CountRoomTrKill()
- func (rm Room) FindDesirableTeam() int
- func (rm Room) GetAllCtNum() int
- func (rm Room) GetAllTrNum() int
- func (rm *Room) GetCountdown() uint8
- func (rm Room) GetFreeSlots() int
- func (rm Room) GetNumOfReadyPlayers() int
- func (rm Room) GetNumOfRealReadyPlayers() int
- func (rm Room) IsGlobalCountdownInProgress() bool
- func (rm *Room) JoinUser(u *User) bool
- func (rm *Room) ProgressCountdown(num uint8)
- func (rm *Room) ResetRoomKillNum()
- func (rm *Room) ResetRoomScore()
- func (rm *Room) ResetRoomWinner()
- func (rm Room) RoomGetUser(id uint32) *User
- func (rm *Room) RoomRemoveUser(id uint32)
- func (rm *Room) SetRoomHost(u *User)
- func (rm *Room) SetRoomScore(ctScore uint8, trScore uint8)
- func (rm *Room) SetRoomWinner(Winner uint8)
- func (rm *Room) SetStatus(status uint8)
- func (rm *Room) StopCountdown()
- func (dest *Room) ToUpdateSetting(src *InUpSettingReq)
- type RoomSettings
- type ServerManager
- type UManager
- type UnlockItem
- type UnlockKillNum
- type UnlockSeq
- type User
- func (u *User) AddMatches()
- func (u *User) AddWins()
- func (u *User) BuildUserNetInfo() []byte
- func (u *User) CountAssistNum()
- func (u *User) CountDeadNum(num uint16)
- func (u *User) CountKillNum(num uint16)
- func (u *User) GetAssists(num uint32)
- func (u *User) GetDeathes(num uint32)
- func (u *User) GetExp(num uint64)
- func (u *User) GetKills(num uint32)
- func (u *User) GetPoints(num uint64)
- func (u User) GetUserChannelID() uint8
- func (u User) GetUserChannelServerID() uint8
- func (u User) GetUserRoomID() uint16
- func (u User) GetUserTeam() uint8
- func (u User) IsUserReady() bool
- func (u User) IsVIP() bool
- func (u *User) JoinRoom(id uint16, team uint8)
- func (u *User) PunishPoints()
- func (u *User) QuitChannel()
- func (u *User) QuitRoom()
- func (u *User) ResetAssistNum()
- func (u *User) ResetDeadNum()
- func (u *User) ResetKillNum()
- func (u *User) SetAvatar(id uint16)
- func (u *User) SetBuyMenu(menu UserBuyMenu)
- func (u *User) SetID(id uint32)
- func (u *User) SetSignature(sig []byte)
- func (u *User) SetTitle(id uint16)
- func (u *User) SetUserChannel(id uint8)
- func (u *User) SetUserChannelServer(id uint8)
- func (u *User) SetUserIngame(ingame bool)
- func (u *User) SetUserName(loginName, username []byte)
- func (u *User) SetUserRoom(id uint16)
- func (u *User) SetUserStatus(status uint8)
- func (u *User) SetUserTeam(team uint8)
- func (u *User) UpdateHolepunch(portId uint16, localPort uint16, externalPort uint16) uint16
- type UserBuyMenu
- type UserInfo
- type UserInventory
- type UserInventoryItem
- type UserLoadout
- type UserNetInfo
Constants ¶
View Source
const ( Congratulate = 11 SystemImportant = 20 DialogBox = 21 System = 22 DialogBoxExit = 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 PacketTypeBan = 74 PacketTypeOption = 76 PacketTypeFavorite = 77 PacketTypeQuickJoin = 80 PacketTypeSignature = 85 PacketTypeQuickStart = 86 PacketTypeAutomatch = 88 PacketTypeFriend = 89 PacketTypeUnlock = 90 PacketTypeGZ = 95 PacketTypeAchievement = 96 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 //频道以及房间 SendFullRoomList = 0 JoinRoom = 1 UpdateUserInfo = 2 //房间操作 NewRoomRequest = 0 JoinRoomRequest = 1 LeaveRoomRequest = 3 ToggleReadyRequest = 4 GameStartRequest = 5 UpdateSettings = 6 OnCloseResultWindow = 7 SetUserTeamRequest = 9 GameStartCountdownRequest = 19 //游戏模式 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 ( GAME_ROOM_LEAVE_EARLY = []byte("你因提前退出而被扣除1000Points!") GAME_SERVER_ERROR = []byte("你与服务端的连接遭遇到不可恢复性错误,请联系服务器管理员并提供报错信息以便管理员查找和修复错误!") GAME_LOGIN_ALREADY = []byte("您的账号当前已经有人登录!如果你的账号已泄露请联系管理员!") GAME_LOGIN_ERROR = []byte("登录过程发生错误,请联系服务器管理员并提供报错信息以便管理员查找和修复错误!") GAME_ROOM_COUNT_MODE_ERROR = []byte("无法开始游戏!请检查你的房间设置,比如是否有2人及以上或者开启bot") 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_JOIN_ERROR = []byte("加入房间发生错误!") 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_USERNAME = []byte("#CSO2_LoginAuth_Certify_NoPassport") GAME_LOGIN_BAD_PASSWORD = []byte("#CSO2_LoginAuth_WrongPassword") GAME_LOGIN_INVALID_USERINFO = []byte("#CSO2_ServerMessage_INVALID_USERINFO") )
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 (
FullInventoryItem = CreateFullInventoryItem()
)
Functions ¶
func ReadSubMenu ¶
Types ¶
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 InAssistPacket ¶
type InChangeTeamPacket ¶
type InChangeTeamPacket struct {
NewTeam uint8
}
type InDeathPacket ¶
type InFavoritePacket ¶
type InFavoritePacket struct {
PacketType uint8
}
type InFavoriteSetCosmetics ¶
type InFavoriteSetLoadout ¶
type InGameScorePacket ¶
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 InJoinRoomPacket ¶
type InKillPacket ¶
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 InOptionBuyMenu ¶
type InOptionPacket ¶
type InOptionPacket struct {
OptionPacketType uint8
}
type InPlayerInfoPacket ¶
type InPlayerInfoPacket struct {
InfoType uint8
}
type InQuickList ¶
type InQuickPacket ¶
type InQuickPacket struct {
InQuickType uint8
}
type InRevivedPacket ¶
type InRoomCountdownPacket ¶
func (InRoomCountdownPacket) ShouldCountdown ¶
func (p InRoomCountdownPacket) ShouldCountdown() bool
type InRoomListRequestPacket ¶
InRoomListRequestPacket 房间列表请求,用于请求频道
type InSetAvatarPacket ¶
type InSetAvatarPacket struct {
AvatarId uint16
}
type InSetSignaturePacket ¶
type InSetTitlePacket ¶
type InSetTitlePacket struct {
TitleId uint16
}
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 ¶
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 OutLobbyJoinRoom ¶
未知,用于请求频道
type PacketData ¶
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) 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) PraseInAssistPacket ¶
func (p *PacketData) PraseInAssistPacket(dest *InAssistPacket) bool
func (*PacketData) PraseInDeathPacket ¶
func (p *PacketData) PraseInDeathPacket(dest *InDeathPacket) bool
func (*PacketData) PraseInGameScorePacket ¶
func (p *PacketData) PraseInGameScorePacket(dest *InGameScorePacket) 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) 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) PraseOptionPacket ¶
func (p *PacketData) PraseOptionPacket(dest *InOptionPacket) bool
func (*PacketData) PrasePlayerInfoPacket ¶
func (p *PacketData) PrasePlayerInfoPacket(dest *InPlayerInfoPacket) bool
func (*PacketData) PraseQuickPacket ¶
func (p *PacketData) PraseQuickPacket(dest *InQuickPacket) bool
func (*PacketData) PraseRoomCountdownPacket ¶
func (p *PacketData) PraseRoomCountdownPacket(dest *InRoomCountdownPacket) 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) 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) PraseUpdateRoomPacket ¶
func (p *PacketData) PraseUpdateRoomPacket(dest *InUpSettingReq) bool
type PacketHeader ¶
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
CtScore uint8
TrScore uint8
CtKillNum uint32
TrKillNum uint32
WinnerTeam uint8
RoomMutex *sync.Mutex
}
房间信息
func (Room) CanStartGame ¶
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 (Room) GetAllCtNum ¶
func (Room) GetAllTrNum ¶
func (*Room) GetCountdown ¶
func (Room) GetFreeSlots ¶
func (Room) GetNumOfReadyPlayers ¶
func (Room) GetNumOfRealReadyPlayers ¶
func (Room) IsGlobalCountdownInProgress ¶
func (*Room) ProgressCountdown ¶
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 (*Room) RoomRemoveUser ¶
func (*Room) SetRoomHost ¶ added in v0.3.1
func (*Room) SetRoomScore ¶
func (*Room) SetRoomWinner ¶
func (*Room) StopCountdown ¶
func (rm *Room) StopCountdown()
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 UnlockItem ¶ added in v0.3.7
type UnlockKillNum ¶ added in v0.3.7
type User ¶
type User struct {
//个人信息
Userid uint32
NexonUsername []byte //暂时两个name使用一个值
Username []byte
Password []byte
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
Mpoints uint32
TitleId uint16
UnlockedTitles []byte
Signature []byte
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 []byte
//连接
CurrentConnection net.Conn
//频道房间信息
CurrentChannelServerIndex uint8
CurrentChannelIndex uint8
CurrentRoomId uint16
CurrentTeam uint8
Currentstatus uint8
CurrentIsIngame bool
CurrentSequence *uint8
CurrentKillNum uint16
CurrentDeathNum uint16
CurrentAssistNum uint16
NetInfo UserNetInfo
//仓库信息
Inventory UserInventory
UserMutex *sync.Mutex
}
func GetNewUser ¶
func GetNewUser() User
func (*User) AddMatches ¶ added in v0.3.5
func (u *User) AddMatches()
func (*User) BuildUserNetInfo ¶
func (*User) CountAssistNum ¶
func (u *User) CountAssistNum()
func (*User) CountDeadNum ¶
func (*User) CountKillNum ¶
func (*User) GetAssists ¶ added in v0.3.5
func (*User) GetDeathes ¶ added in v0.3.5
func (User) GetUserChannelServerID ¶
GetUserChannelServerID 获取用户所在分区服务器ID
func (User) GetUserTeam ¶
func (User) IsUserReady ¶
func (*User) PunishPoints ¶ added in v0.3.5
func (u *User) PunishPoints()
func (*User) QuitChannel ¶
func (u *User) QuitChannel()
func (*User) ResetAssistNum ¶
func (u *User) ResetAssistNum()
func (*User) ResetDeadNum ¶
func (u *User) ResetDeadNum()
func (*User) ResetKillNum ¶
func (u *User) ResetKillNum()
func (*User) SetBuyMenu ¶
func (u *User) SetBuyMenu(menu UserBuyMenu)
func (*User) SetSignature ¶
func (*User) SetUserChannel ¶
func (*User) SetUserChannelServer ¶
func (*User) SetUserIngame ¶
func (*User) SetUserName ¶
func (*User) SetUserRoom ¶
func (*User) SetUserStatus ¶
func (*User) SetUserTeam ¶
type UserBuyMenu ¶
type UserBuyMenu struct {
Pistols []uint32
Shotguns []uint32
Smgs []uint32
Rifles []uint32
Snipers []uint32
Machineguns []uint32
Melees []uint32
Equipment []uint32
}
UserBuyMenu 用户的购买菜单
func CreateDefaultUserBuyMenu ¶ added in v0.3.7
func CreateDefaultUserBuyMenu() UserBuyMenu
func CreateFullUserBuyMenu ¶ added in v0.3.7
func CreateFullUserBuyMenu() UserBuyMenu
type UserInfo ¶
type UserInfo struct {
Title uint16
// contains filtered or unexported fields
}
发送出去的包结构,其中一些未知,知道后会加入user里去
func NewUserInfo ¶
type UserInventory ¶
type UserInventory struct {
NumOfItem uint16 //物品数量
Items []UserInventoryItem //物品
CTModel uint32 //当前的CT模型
TModel uint32 //当前的T模型
HeadItem uint32 //当前的头部装饰
GloveItem uint32 //当前的手套
BackItem uint32 //当前的背部物品
StepsItem uint32 //当前的脚步效果
CardItem uint32 //当前的卡片
SprayItem uint32 //当前的喷漆
BuyMenu UserBuyMenu //购买菜单
Loadouts []UserLoadout
}
func CreateFullUserInventory ¶ added in v0.3.7
func CreateFullUserInventory() UserInventory
func CreateNewUserInventory ¶
func CreateNewUserInventory() UserInventory
type UserInventoryItem ¶
func CreateDefaultInventoryItem ¶ added in v0.3.7
func CreateDefaultInventoryItem() []UserInventoryItem
func CreateFullInventoryItem ¶
func CreateFullInventoryItem() []UserInventoryItem
type UserLoadout ¶
type UserLoadout struct {
Items []uint32
}
func CreateDefaultLoadout ¶ added in v0.3.7
func CreateDefaultLoadout() []UserLoadout
func CreateFullLoadout ¶ added in v0.3.7
func CreateFullLoadout() []UserLoadout
Source Files
¶
Click to show internal directories.
Click to hide internal directories.