private DialogCondition Create(UniXMLElement element) { string type = element.GetString("type"); switch (type) { case QuestConditionName.ON_STATION: { return(new OnStationCondition()); } case QuestConditionName.QUEST_COMPLETED: { string questId = element.GetString("id"); return(new QuestCompletedCondition(questId)); } case QuestConditionName.AT_SPACE: { return(new AtSpaceCondition()); } case QuestConditionName.DIALOG_COMPLETED: { string id = element.GetString("id"); return(new DialogCompletedCondition(id)); } case QuestConditionName.USER_EVENT: { UserEventName eventName = (UserEventName)Enum.Parse(typeof(UserEventName), element.GetString("name")); return(CreateUserEventCondition(element, eventName)); } case QuestConditionName.COUNT_OF_ITEMS_GE: { string id = element.GetString("id"); InventoryObjectType itemType = (InventoryObjectType)Enum.Parse(typeof(InventoryObjectType), element.GetString("item_type")); int value = element.GetInt("value"); string updateText = string.Empty; if (element.HasAttribute("update_text")) { updateText = element.GetString("update_text"); } return(new CountOfItemsGECondition(itemType, id, value, updateText)); } case QuestConditionName.INT_VARIABLE_VALUE_EQ: case QuestConditionName.INT_VARIABLE_VARLUE_GE: case QuestConditionName.FLOAT_VARIABLE_VALUE_EQ: case QuestConditionName.BOOL_VARIABLE_VALUE_EQ: return(ParseVariableValueCondtion(type, element)); default: return(null); } }
private OperationResponse CallUserEvent(MmoActor player, OperationRequest request, RPCInvokeOperation op) { if (op.parameters != null && op.parameters.Length > 0) { RPCErrorCode code = RPCErrorCode.Ok; UserEventName eventName = (UserEventName)(int)op.parameters[0]; switch (eventName) { case UserEventName.object_scanner_select_ship: case UserEventName.start_moving: case UserEventName.rotate_camera: { //if (player.GetComponent<QuestManager>().TryCheckActiveQuests(new UserEvent(eventName))) { // s_Log.InfoFormat("player complete some quest with event: {0}".Lime(), eventName); //} else { // s_Log.InfoFormat("no quest completed by event: {0}".Orange(), eventName); //} } break; case UserEventName.dialog_completed: { //if(op.parameters.Length > 1) { // string dialogId = (string)op.parameters[1]; // player.GetComponent<DialogManager>().CompleteDialog(dialogId); //} else { // code = RPCErrorCode.MissedParameter; //} } break; default: { s_Log.Info(string.Format("error: no support for event: {0}", eventName).Red()); code = RPCErrorCode.UnsupportedEvent; } break; } RPCInvokeResponse respInstance = new RPCInvokeResponse { rpcId = op.rpcId, result = (int)code }; return(new OperationResponse(request.OperationCode, respInstance)); } return(InvalidOperationParameter(request)); }
public UserEventCondition(UserEventName nm) : base(QuestConditionName.USER_EVENT) { m_Name = nm; }
private DialogCondition CreateUserEventCondition(UniXMLElement element, UserEventName eventName) { return(new UserEventCondition(eventName)); }