func makeConnect() (msg *protocol.Message) { connect := &protocol.Connect{Version: proto.Uint32(ProtocolVersion)} return &protocol.Message{ Connect: connect, Type: protocol.NewMessage_Type(protocol.Message_CONNECT), } }
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), } }
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), } }
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), } }
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), } }
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), } }
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), } }
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), } }
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), } }
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), } }