Example #1
0
func P_login_req(hostid int32, pkt *packet.Packet) []byte {
	tbl, _ := PKT_LOGIN_REQ(pkt)
	ret := LOGIN_ACK{F_success: 0}

	if core.Login(tbl.F_id, hostid) {
		ret.F_success = 1
	}

	return packet.Pack(-1, &ret, nil)
}
Example #2
0
func P_adduser_req(hostid int32, pkt *packet.Packet) []byte {
	tbl, _ := PKT_ID(pkt)
	ret := INT{F_v: 0}

	if core.LoadUser(tbl.F_id) {
		core.Login(tbl.F_id, hostid)
		ret.F_v = 1
	}

	return packet.Pack(-1, &ret, nil)
}
Example #3
0
func P_login_req(hostid int32, pkt *packet.Packet) []byte {
	tbl, _ := PKT_LOGIN_REQ(pkt)
	ret := LOGIN_ACK{F_success: false}

	if core.Login(tbl.F_id, hostid) {
		ret.F_success = true

		// 登陆后,将联盟消息push给玩家
		group := core.Group(tbl.F_group)
		if group != nil {
			ch := ForwardChan(hostid)
			objs := group.Recv(tbl.F_groupmsgmax + 1)
			for _, v := range objs {
				ch <- v.Json()
			}

			ret.F_groupmsgmax = group.MaxMsgId
		}
	}

	return packet.Pack(-1, &ret, nil)
}