Documentation ¶
Index ¶
- Constants
- Variables
- func ErrorMessageByCode(code int) string
- func FindMethodInputName(fd protoreflect.FileDescriptor, methodFullName string) (string, error)
- func FindMethodOutputName(fd protoreflect.FileDescriptor, methodFullName string) (string, error)
- func GetContestManagementServerUrl() (string, error)
- func GetGameServerUrl() (string, error)
- func GetMajsoulVersion() (string, error)
- func GetMessageFullName(pbMsg proto.Message, fd protoreflect.FileDescriptor) (string, error)
- type MajsoulChannel
- func (m *MajsoulChannel) Close(err error)
- func (m *MajsoulChannel) Connect(url string) error
- func (m *MajsoulChannel) ExitValue() error
- func (m *MajsoulChannel) IsOpen() bool
- func (m *MajsoulChannel) Send(msg []byte) ([]byte, error)
- func (m *MajsoulChannel) SetNotificationHandler(h func(msg []byte))
- type MajsoulGameServerConfig
- type MajsoulServerUrls
- type MajsoulVersion
Constants ¶
const ( ERR_UNKNOWN = 1 ERR_SYSTEM_ERROR = 2 ERR_CLIENT_PACKET_PARAM = 3 ERR_NOT_DEVELOPMENT_MODE = 4 ERR_SYSTEM_COMMUNICATION = 5 ERR_METHOD_NOT_FOUND = 6 ERR_EMPTY_INPUT = 101 ERR_INVALID_INPUT = 102 ERR_CONFIG_NOT_FOUND = 104 ERR_GIFT_CODE_NOT_VALID = 105 ERR_GIFT_CODE_ALREADY_USED = 106 ERR_GIFT_CODE_GAIN_USAGEID = 107 ERR_UNSUPPORT_OAUTH2 = 108 ERR_OAUTH2_EXPIRED = 109 ERR_OAUTH2_FAILED = 110 ERR_GIFT_CODE_PROCESSING = 112 ERR_GIFT_CODE_DURATION = 113 ERR_GIFT_CODE_DISCARDED = 114 ERR_FREQUENT_PHONE_CODE = 115 ERR_PHONE_CODE_EXPIRED = 116 ERR_SECURE_OPERATION_EXPIRED = 117 ERR_BIND_SAME_PHONE = 118 ERR_PHONE_SEND_FAILED = 119 ERR_RESOURCE_NOT_ENOUGH = 501 ERR_TEXT_FORBIDDEN_WORD = 502 ERR_ACCOUNT_BANNED = 503 ERR_RESOURCE_UNIQUE = 504 ERR_ACC_DUPLICATE_SIGN_UP = 1001 ERR_ACC_NOT_SIGN_UP = 1002 ERR_ACC_PASSWORD = 1003 ERR_ACC_NOT_LOGIN = 1004 ERR_ACC_ALREADY_LOGIN = 1005 ERR_ACC_NOT_EXIST = 1006 ERR_ACC_CHAR_NOT_LOCK = 1007 ERR_ACC_CHAR_ALREADY_LOCK = 1008 ERR_ACC_TICK_BY_SAME = 1009 ERR_ACC_NICKNAME_USED = 1010 ERR_ACC_NO_NICKNAME = 1011 ERR_ACC_HAS_NICKNAME = 1012 ERR_ACC_HAS_BIND_ACCOUNT = 1013 ERR_ACC_TARGET_ACCOUNT_USED = 1014 ERR_ACC_NEED_NICKNAME_ITEM = 1015 ERR_ACC_MOD_NICKNAME_CD = 1016 ERR_ACC_ALREADY_REG_REALNAME = 1017 ERR_ROOM_NOT_EXIST = 1100 ERR_ROOM_IS_FULL = 1101 ERR_ROOM_ALREADY_LEAVE = 1102 ERR_ROOM_NOT_OWNER = 1103 ERR_ROOM_NOT_ALL_READY = 1104 ERR_ROOM_ALREADY_JOIN = 1105 ERR_ROOM_NOT_JOIN = 1106 ERR_ROOM_TARGET_NOT_JOIN = 1107 ERR_ROOM_KICK_SELF = 1108 ERR_ACC_IS_PLAYING = 1109 ERR_ROOM_NO_AVAILABLE_ID = 1110 ERR_ROOM_NO_ENOUGH_SLOT = 1111 ERR_ROOM_MODE_INVALID = 1112 ERR_TOKEN_NOT_EXIST = 1201 ERR_TOKEN_INVALID = 1202 ERR_GAME_NOT_EXIST = 1203 ERR_GAME_REFUSED = 1204 ERR_GAME_NOT_PLAYING = 1205 ERR_GAME_ALREADY_FINISH = 1206 ERR_GAME_CAN_NOT_MANUAL_TER = 1207 ERR_GAME_CREATE_FAILED = 1208 ERR_MATCH_IN_MATCHING = 1301 ERR_MATCH_NOT_IN_MATCHING = 1302 ERR_UNSUPPORT_MATCH_MODE = 1303 ERR_MATCH_GOLD_LIMIT = 1304 ERR_MATCH_LEVEL_LIMIT = 1305 ERR_MATCH_MODE_NOT_OPEN = 1306 ERR_FRIEND_NOT_FRIEND = 1401 ERR_FRIEND_IS_FRIEND = 1402 ERR_SEARCH_TIMEOUT = 1403 ERR_SEARCH_INVALID = 1404 ERR_FRIEND_APPLY_METHOD = 1405 ERR_FRIEND_MAX_APPLY = 1406 ERR_FRIEND_MAX = 1407 ERR_FRIEND_ADD_SELF = 1408 ERR_FRIEND_MAX_TARGET = 1409 ERR_BAG_NO_ITEM = 1501 ERR_BAG_NOT_ENOUGH_ITEM = 1502 ERR_BAG_ITEM_NOT_USABLE = 1503 ERR_BAG_ITEM_NOT_COMPOSE = 1504 ERR_ACHIEVEMENT_NOT_ACHIEVED = 1601 ERR_TASK_DAILY_NOT_FOUND = 1611 ERR_TASK_DAILY_NO_REFRESH = 1612 ERR_MAIL_NOT_FOUND = 1701 ERR_MAIL_NO_ATTACHMENT = 1702 ERR_MAIL_ALREADY_TAKE = 1703 ERR_LIVE_GAME_NOT_FOUND = 1801 ERR_PAYMENT_CLOSED = 1900 ERR_PAYMENT_ORDER_NOT_FOUND = 1901 ERR_PAYMENT_ORDER_HANDLED = 1902 ERR_PAYMENT_PLATFORM = 1903 ERR_PAYMENT_GOODS_NOT_FOUND = 1904 ERR_PAYMENT_GP_VERIFY = 1951 ERR_PAYMENT_WECHAT_DISABLE = 1960 ERR_PAYMENT_WECHAT_POST_FAILED = 1961 ERR_PAYMENT_ALI_DISABLE = 1970 ERR_PAYMENT_ALI_TYPE_UNSUP = 1971 ERR_REVIVE_COIN_TIME = 2001 ERR_REVIVE_COIN_LIMIT = 2002 ERR_TITLE_NOT_UNLOCK = 2003 ERR_COMMENT_ONLY_FRIEND = 2004 ERR_COMMENT_FORBID = 2005 ERR_COMMENT_SELF = 2006 ERR_COMMENT_WHEN_GAMING = 2007 ERR_COMMENT_NO_PRIV_DELETE = 2008 ERR_COMMENT_CD = 2009 ERR_CHEST_NOT_FOUND = 2010 ERR_CHEST_INVALID_COUNT = 2011 ERR_CHARACTER_UNLOCK = 2201 ERR_CHARACTER_GIFT_TYPE = 2202 ERR_CHARACTER_GIFT_COUNT_MAX = 2203 ERR_CHARACTER_SKIN_UNLOCK = 2204 ERR_CHARACTER_IS_UPGRADE = 2205 ERR_CHARACTER_LEVEL = 2206 ERR_CHARACTER_CANNOT_MARRY = 2207 ERR_ITEM_CANNOT_SELL = 2301 ERR_SHOP_GOODS_NOT_FOUND = 2401 ERR_SHOP_GOODS_BUY_LIMIT = 2402 ERR_SHOP_ZHP_UNAVAILABLE = 2431 ERR_SHOP_ZHP_REFRESH_LIMIT = 2432 ERR_CONTEST_NOT_FOUND = 2501 ERR_CONTEST_MAX_ACTIVE = 2502 ERR_CONTEST_RANDOM_CID = 2503 ERR_CONTEST_MGR_HAS_LOGINED = 2504 ERR_CONTEST_MGR_NOT_LOGIN = 2505 ERR_CONTEST_MGR_NO_PRIVILEGE = 2506 ERR_CONTEST_NOT_START = 2507 ERR_CONTEST_ALREADY_END = 2508 ERR_CONTEST_PLAYER_NOT_MATCHING = 2509 ERR_CONTEST_LOCK_BY_OTHER = 2510 ERR_CONTEST_NO_ACCESS_MATCH = 2511 ERR_CONTEST_NO_PRIV_CHAT = 2512 ERR_CONTEST_NOT_CREATOR = 2513 ERR_CONTEST_MANAGER_COUNT_LIMIT = 2514 ERR_CONTEST_CREATE_TIME_LIMIT = 2515 ERR_CONTEST_BAN_CREATE = 2516 ERR_CONTEST_SETTING_PARAM = 2517 ERR_CONTEST_LEVEL_LIMIT = 2518 ERR_CONTEST_GAME_COUNT_LIMIT = 2519 ERR_CONTEST_PROLONG_LIMIT = 2520 ERR_CONTEST_AUTO_MATCHING = 2521 )
Variables ¶
var ( MSG_TYPE_NOTIFY = 1 MSG_TYPE_REQUEST = 2 MSG_TYPE_RESPONSE = 3 PING_INTERVAL = 5 //seconds TIMEOUT_INTERVAL = 3 //seconds OUTGOING_CHANNEL_SIZE = 20 NOTIFICATIONS_CHANNEL_SIZE = 100 )
var ( NA_BASE_URL = "https://mahjongsoul.game.yo-star.com" NA_VERSION_URL = "https://mahjongsoul.game.yo-star.com/version.json" NA_CONFIG_URL = "https://mahjongsoul.game.yo-star.com/v%s/config.json" NA_CONTEST_MANAGEMENT_BASE_URL = "https://mahjongsoul.tournament.yo-star.com" NA_CONTEST_MANAGEMENT_SERVER_LIST_URL = "https://mjusgs.mahjongsoul.com:%s/api/customized_contest/random" NA_CONTEST_MANAGEMENT_CONFIG_URL = "https://mahjongsoul.tournament.yo-star.com/dhs/js/config.js" )
var ERROR_STRINGS = map[int]string{}/* 145 elements not displayed */
Functions ¶
func ErrorMessageByCode ¶
func FindMethodInputName ¶
func FindMethodInputName(fd protoreflect.FileDescriptor, methodFullName string) (string, error)
func FindMethodOutputName ¶
func FindMethodOutputName(fd protoreflect.FileDescriptor, methodFullName string) (string, error)
func GetGameServerUrl ¶
func GetMajsoulVersion ¶
func GetMessageFullName ¶
func GetMessageFullName(pbMsg proto.Message, fd protoreflect.FileDescriptor) (string, error)
Types ¶
type MajsoulChannel ¶
type MajsoulChannel struct { //Underlying websocket connection Connection *websocket.Conn // contains filtered or unexported fields }
func NewMajsoulChannel ¶
func NewMajsoulChannel() *MajsoulChannel
Function for creating a new MajsoulChannel. Handles all field initalizations.
func (*MajsoulChannel) Close ¶
func (m *MajsoulChannel) Close(err error)
Closes the channel. The way channels are closed is by passing an error into the close channel. A nil value passed into the channel indicates that the channel was closed by the application and not due to encountering any errors.
func (*MajsoulChannel) Connect ¶
func (m *MajsoulChannel) Connect(url string) error
Connects to the server specified by the url string. The url string of a MahjongSoul server can be obtained by using the functions defined in majsoul.go
After successfully connecting, the channel can be closed by calling MajsoulChannel.Close()
func (*MajsoulChannel) ExitValue ¶
func (m *MajsoulChannel) ExitValue() error
ExitValue is the function for user applications to retrieve the error that caused the MajsoulChannel to close. A nil value means that the channel was closed by the user.
func (*MajsoulChannel) IsOpen ¶
func (m *MajsoulChannel) IsOpen() bool
func (*MajsoulChannel) Send ¶
func (m *MajsoulChannel) Send(msg []byte) ([]byte, error)
Processes and pushes a message to the outgoing channel for sendMsg() to handle
func (*MajsoulChannel) SetNotificationHandler ¶
func (m *MajsoulChannel) SetNotificationHandler(h func(msg []byte))
type MajsoulGameServerConfig ¶
type MajsoulServerUrls ¶
type MajsoulServerUrls struct {
Servers []string `json:"servers"`
}