public void MasterUpdateShipModule(string gameRefID, string characterID, ShipModelSlotType slotType, string templateID) { UpdateShipModel op = new UpdateShipModel { CharacterId = characterID, GameRefId = gameRefID, SlotType = (byte)slotType, TemplateId = templateID }; OperationRequest request = new OperationRequest((byte)ServerToServerOperationCode.UpdateShipModel, op); this.MasterPeer.SendOperationRequest(request, new SendParameters()); }
protected override void OnOperationRequest(OperationRequest operationRequest, SendParameters sendParameters) { try { if (log.IsDebugEnabled) { log.DebugFormat("OnOperationRequest: pid={0}, op={1}", this.ConnectionId, operationRequest.OperationCode); } OperationResponse response = null; switch ((ServerToServerOperationCode)operationRequest.OperationCode) { default: response = new OperationResponse(operationRequest.OperationCode) { ReturnCode = -1, DebugMessage = "Unknown operation code" }; break; case ServerToServerOperationCode.RegisterGameServer: { response = this.ServerId.HasValue ? new OperationResponse(operationRequest.OperationCode) { ReturnCode = -1, DebugMessage = "Already registered" } : this.HandleRegisterGameServerRequest(operationRequest); break; } case ServerToServerOperationCode.UpdateShipModel: { UpdateShipModel operation = new UpdateShipModel(this.Protocol, operationRequest); if (!operation.IsValid) { response = new OperationResponse(operationRequest.OperationCode) { ReturnCode = (short)ReturnCode.InvalidOperationParameter, DebugMessage = "InvalidOperationParameter" }; } else { UpdateShipModelEvent evtData = new UpdateShipModelEvent { CharacterId = operation.CharacterId, GameRefId = operation.GameRefId, SlotType = operation.SlotType, TemplateId = operation.TemplateId }; EventData evt = new EventData((byte)S2SEventCode.UpdateShipModel, evtData); application.GameServers.SendEvent(evt, new SendParameters(), ServerType.SelectCharacter); } break; } case ServerToServerOperationCode.UpdateCharacter: { UpdateCharacter operation = new UpdateCharacter(this.Protocol, operationRequest); UpdateCharacterEvent evtData = new UpdateCharacterEvent { CharacterId = operation.CharacterId, Deleted = operation.Deleted, GameRefId = operation.GameRefId, Model = operation.Model, Race = operation.Race, Workshop = operation.Workshop, Exp = operation.Exp, WorldId = operation.WorldId }; EventData evt = new EventData((byte)S2SEventCode.UpdateCharacter, evtData); application.GameServers.SendEvent(evt, new SendParameters(), ServerType.SelectCharacter); break; } } if (response != null) { this.SendOperationResponse(response, sendParameters); } } catch (Exception ex) { log.Error(ex); } }