Ejemplo n.º 1
0
func makeConnect() (msg *protocol.Message) {
	connect := &protocol.Connect{Version: proto.Uint32(ProtocolVersion)}

	return &protocol.Message{
		Connect: connect,
		Type:    protocol.NewMessage_Type(protocol.Message_CONNECT),
	}
}
Ejemplo n.º 2
0
func makeAssignControl(uid int32, revoked bool) (msg *protocol.Message) {
	ctrl := &protocol.AssignControl{
		Uid:     &uid,
		Revoked: &revoked,
	}

	return &protocol.Message{
		AssignControl: ctrl,
		Type:          protocol.NewMessage_Type(protocol.Message_ASSIGNCONTROL),
	}
}
Ejemplo n.º 3
0
func makeRemoveEntity(id int32, name string) (msg *protocol.Message) {
	removeEntity := &protocol.RemoveEntity{
		Id:   proto.Int32(id),
		Name: proto.String(name),
	}

	return &protocol.Message{
		RemoveEntity: removeEntity,
		Type:         protocol.NewMessage_Type(protocol.Message_REMOVEENTITY),
	}
}
Ejemplo n.º 4
0
func makeAddEntity(id int32, name string) (msg *protocol.Message) {
	addEntity := &protocol.AddEntity{
		Id:   proto.Int32(id),
		Name: proto.String(name),
	}

	return &protocol.Message{
		AddEntity: addEntity,
		Type:      protocol.NewMessage_Type(protocol.Message_ADDENTITY),
	}
}
Ejemplo n.º 5
0
func makeLoginResult(succeeded bool, reason int32) (msg *protocol.Message) {
	loginResult := &protocol.LoginResult{
		Succeeded: proto.Bool(succeeded),
		Reason:    protocol.NewLoginResult_Reason(reason),
	}

	return &protocol.Message{
		LoginResult: loginResult,
		Type:        protocol.NewMessage_Type(protocol.Message_LOGINRESULT),
	}
}
Ejemplo n.º 6
0
func makeDisconnect(reason int32, reasonString string) (msg *protocol.Message) {
	disconnect := &protocol.Disconnect{
		Reason:    protocol.NewDisconnect_Reason(reason),
		ReasonStr: proto.String(reasonString),
	}

	return &protocol.Message{
		Disconnect: disconnect,
		Type:       protocol.NewMessage_Type(protocol.Message_DISCONNECT),
	}
}
Ejemplo n.º 7
0
func makeUpdateState(id int32, stateId string, value *protocol.StateValue) (msg *protocol.Message) {
	updateState := &protocol.UpdateState{
		Id:      proto.Int32(id),
		StateId: proto.String(stateId),
		Value:   value,
	}

	return &protocol.Message{
		UpdateState: updateState,
		Type:        protocol.NewMessage_Type(protocol.Message_UPDATESTATE),
	}
}
Ejemplo n.º 8
0
func makeLogin(name string, authToken string, permissions uint32) (msg *protocol.Message) {
	login := &protocol.Login{
		Name:        proto.String(name),
		Authtoken:   proto.String(authToken),
		Permissions: proto.Uint32(permissions),
	}

	return &protocol.Message{
		Login: login,
		Type:  protocol.NewMessage_Type(protocol.Message_LOGIN),
	}
}
Ejemplo n.º 9
0
func makeEntityDeath(uid int32, name string, kuid int32, kname string) (msg *protocol.Message) {
	entityDeath := &protocol.EntityDeath{
		Uid:        &uid,
		Name:       &name,
		KillerUid:  &kuid,
		KillerName: &kname,
	}

	return &protocol.Message{
		EntityDeath: entityDeath,
		Type:        protocol.NewMessage_Type(protocol.Message_ENTITYDEATH),
	}
}
Ejemplo n.º 10
0
func makeCombatHit(auid int32, aname string, vuid int32, vname string, damage float32) (msg *protocol.Message) {
	combatHit := &protocol.CombatHit{
		AttackerUid:  &auid,
		AttackerName: &aname,
		VictimUid:    &vuid,
		VictimName:   &vname,
		Damage:       &damage,
	}

	return &protocol.Message{
		CombatHit: combatHit,
		Type:      protocol.NewMessage_Type(protocol.Message_COMBATHIT),
	}
}