Dictionary <uint, uint> ParseRecommendAttrs(string str) { if (string.IsNullOrEmpty(str) == true) { return(null); } Dictionary <uint, uint> recommendAttrs = new Dictionary <uint, uint>(); recommendAttrs.Clear(); List <List <string> > arrayStringString = DBTextResource.ParseArrayStringString(str); foreach (List <string> arrayString in arrayStringString) { if (arrayString.Count >= 2) { uint attr = 0; uint.TryParse(arrayString[0], out attr); uint value = 0; uint.TryParse(arrayString[1], out value); recommendAttrs.Add(attr, value); } } return(recommendAttrs); }
public static List <NpcScenePosition> MakeNpcScenePositions(string raw) { if (string.IsNullOrEmpty(raw) == true) { return(null); } List <NpcScenePosition> result = new List <NpcScenePosition>(); result.Clear(); List <List <string> > stringsStrings = DBTextResource.ParseArrayStringString(raw); foreach (List <string> strings in stringsStrings) { result.Add(NpcScenePosition.Make(strings)); } return(result); }
TaskDefine ReadReader(SqliteDataReader reader) { ushort taskType = DBTextResource.ParseUS_s(GetReaderString(reader, "type"), 0); TaskDefine define = new TaskDefine(); define.Id = DBTextResource.ParseUI_s(GetReaderString(reader, "id"), 0); define.DescriptionBytes = GetReaderBytes(reader, "description"); define.NameBytes = GetReaderBytes(reader, "name"); define.Type = taskType; define.SubType = DBTextResource.ParseUI_s(GetReaderString(reader, "sub_type"), 0); define.RequestLevelMin = DBTextResource.ParseI_s(GetReaderString(reader, "lv_min"), 0); define.PreviousId = DBTextResource.ParseUI_s(GetReaderString(reader, "pre_id"), 0); define.NextId = DBTextResource.ParseUI_s(GetReaderString(reader, "next_id"), 0); define.NextId = DBTextResource.ParseUI_s(GetReaderString(reader, "next_id"), 0); string serverStepRawsString = GetReaderString(reader, "goals"); string clientStepRawsString = GetReaderString(reader, "steps"); string navigationPointsRawsString = GetReaderString(reader, "navigation_points"); define.Steps = TaskDefine.TaskStep.CreateStepsByRawString(serverStepRawsString, clientStepRawsString, navigationPointsRawsString); if (define.Steps == null || define.Steps.Count == 0) { GameDebug.LogError("Parse task " + define.Id + " error, step is empty!!!"); } define.RewardIds = DBTextResource.ParseArrayUint(GetReaderString(reader, "reward_ids"), ","); define.GetSkills = DBTextResource.ParseArrayUint(GetReaderString(reader, "get_skills"), ","); define.IsShowGetSkillProgress = DBTextResource.ParseI_s(GetReaderString(reader, "is_show_get_skill_progress"), 0) == 0 ? false : true; define.ReceiveDialogId = DBTextResource.ParseUI_s(GetReaderString(reader, "receive_dialog_id"), 0); define.SubmitDialogId = DBTextResource.ParseUI_s(GetReaderString(reader, "submit_dialog_id"), 0); define.ReceiveNpc = NpcScenePosition.Make(GetReaderString(reader, "receive_npc")); define.SubmitNpc = NpcScenePosition.Make(GetReaderString(reader, "submit_npc")); define.AutoRunType = (TaskDefine.EAutoRunType)DBTextResource.ParseBT_s(GetReaderString(reader, "auto_run"), 0); define.ShowPriority = DBManager.Instance.GetDB <DBTaskPriority>().GetTaskPriority((int)taskType); define.ShowPriority2 = DBManager.Instance.GetDB <DBTaskPriority>().GetTaskPriority2((int)taskType); string raw = GetReaderString(reader, "is_temporary_on_top"); if (string.IsNullOrEmpty(raw) == true || raw == "0") { define.IsTemporaryOnTop = false; } else { define.IsTemporaryOnTop = true; } string npcsRawString = GetReaderString(reader, "create_npcs_when_received"); define.CreateNpcsWhenReceived = TaskDefine.MakeNpcScenePositions(npcsRawString); npcsRawString = GetReaderString(reader, "delete_npcs_when_received"); define.DeleteNpcsWhenReceived = TaskDefine.MakeNpcScenePositions(npcsRawString); npcsRawString = GetReaderString(reader, "create_npcs_when_done"); define.CreateNpcsWhenDone = TaskDefine.MakeNpcScenePositions(npcsRawString); npcsRawString = GetReaderString(reader, "delete_npcs_when_done"); define.DeleteNpcsWhenDone = TaskDefine.MakeNpcScenePositions(npcsRawString); define.FollowNpcs = TaskDefine.MakeNpcScenePositions(GetReaderString(reader, "follow_npcs")); define.CanUseBoots = (DBTextResource.ParseI_s(GetReaderString(reader, "can_use_boots"), 0) > 0); define.ReceivedTimelineId = DBTextResource.ParseUI_s(GetReaderString(reader, "received_timeline_id"), 0); define.SubmitedTimelineId = DBTextResource.ParseUI_s(GetReaderString(reader, "submited_timeline_id"), 0); raw = GetReaderString(reader, "cost"); if (string.IsNullOrEmpty(raw) == false) { define.Costs = DBTextResource.ParseArrayStringString(raw); } raw = GetReaderString(reader, "show_reward_goods_id"); List <List <uint> > showRewardGoodsIdConfigs = DBTextResource.ParseArrayUintUint(raw); define.ShowRewardGoodsIds = new Dictionary <uint, uint>(); define.ShowRewardGoodsIds.Clear(); define.ShowRewardGoodsNums = new Dictionary <uint, uint>(); define.ShowRewardGoodsNums.Clear(); define.ShowRewardGoodsIsBinds = new Dictionary <uint, byte>(); define.ShowRewardGoodsIsBinds.Clear(); uint index = 1; foreach (List <uint> showRewardGoodsIdConfig in showRewardGoodsIdConfigs) { define.ShowRewardGoodsIds[index] = showRewardGoodsIdConfig[0]; define.ShowRewardGoodsNums[index] = showRewardGoodsIdConfig[1]; define.ShowRewardGoodsIsBinds[index] = (byte)showRewardGoodsIdConfig[2]; ++index; } mTasksData.Add(define.Id, define); if (mTasksDataByType.ContainsKey(define.Type) == true) { mTasksDataByType[define.Type].Add(define.Id, define); } else { Dictionary <uint, TaskDefine> taskDefines = new Dictionary <uint, TaskDefine>(); taskDefines.Clear(); taskDefines.Add(define.Id, define); mTasksDataByType.Add(define.Type, taskDefines); } return(define); }
public static List <TaskStep> CreateStepsByRawString(string serverRawString, string clientRawString, string navigationPointsRawsString) { if (string.IsNullOrEmpty(serverRawString) || string.IsNullOrEmpty(clientRawString)) { return(null); } List <TaskStep> steps = new List <TaskStep>(); steps.Clear(); List <List <string> > serverStepStringsStrings = DBTextResource.ParseArrayStringString(serverRawString); List <List <string> > clientStepStringsStrings = DBTextResource.ParseArrayStringString(clientRawString); if (serverStepStringsStrings.Count != clientStepStringsStrings.Count) { return(steps); } List <List <uint> > navigationPointsUintsUints = DBTextResource.ParseArrayUintUint(navigationPointsRawsString); for (int i = 0; i < serverStepStringsStrings.Count; ++i) { List <string> serverStepStrings = serverStepStringsStrings[i]; List <string> clientStepStrings = clientStepStringsStrings[i]; TaskStep step = new TaskStep(); step.Goal = serverStepStrings[0]; if (step.Goal.Equals(GameConst.GOAL_AUTO)) { step.ExpectResult = 1; step.Description = clientStepStrings[0]; } else if (step.Goal.Equals(GameConst.GOAL_TALK)) { step.ExpectResult = 1; uint.TryParse(serverStepStrings[1], out step.DialogId); uint.TryParse(clientStepStrings[0], out step.InstanceId); uint.TryParse(clientStepStrings[1], out step.NpcId); step.Description = clientStepStrings[2]; } else if (step.Goal.Equals(GameConst.GOAL_KILL_MON)) { uint.TryParse(serverStepStrings[1], out step.MonsterId); uint.TryParse(serverStepStrings[2], out step.ExpectResult); uint.TryParse(clientStepStrings[0], out step.InstanceId); step.Description = clientStepStrings[1]; } else if (step.Goal.Equals(GameConst.GOAL_KILL_GROUP_MON)) { uint.TryParse(serverStepStrings[1], out step.InstanceId); uint.TryParse(serverStepStrings[2], out step.MonsterId); uint.TryParse(serverStepStrings[3], out step.ExpectResult); step.Description = clientStepStrings[0]; } else if (step.Goal.Equals(GameConst.GOAL_INTERACT)) { uint.TryParse(serverStepStrings[1], out step.NpcId); uint.TryParse(serverStepStrings[2], out step.ExpectResult); uint.TryParse(clientStepStrings[0], out step.InstanceId); step.Description = clientStepStrings[1]; } else if (step.Goal.Equals(GameConst.GOAL_KILL_COLLECT)) { uint.TryParse(serverStepStrings[1], out step.MonsterId); uint.TryParse(serverStepStrings[3], out step.GoodsId); uint.TryParse(serverStepStrings[4], out step.ExpectResult); uint.TryParse(clientStepStrings[0], out step.InstanceId); step.Description = clientStepStrings[1]; } else if (step.Goal.Equals(GameConst.GOAL_COLLECT_GOODS)) { uint.TryParse(serverStepStrings[1], out step.MonsterLevel); uint.TryParse(serverStepStrings[3], out step.GoodsId); uint.TryParse(serverStepStrings[4], out step.ExpectResult); step.Description = clientStepStrings[0]; if (clientStepStrings.Count >= 3) { ushort.TryParse(clientStepStrings[1], out step.MinWorldBossSpecialMonId); ushort.TryParse(clientStepStrings[2], out step.MaxWorldBossSpecialMonId); } } else if (step.Goal.Equals(GameConst.GOAL_WAR_WIN) || step.Goal.Equals(GameConst.GOAL_WAR_GRADE)) { step.ExpectResult = 1; uint.TryParse(serverStepStrings[1], out step.InstanceId2); uint.TryParse(clientStepStrings[0], out step.InstanceId); uint.TryParse(clientStepStrings[1], out step.NpcId); step.Description = clientStepStrings[2]; if (clientStepStrings.Count > 3) { uint.TryParse(clientStepStrings[3], out step.SysId); } } else if (step.Goal.Equals(GameConst.GOAL_WAR_ENTER)) { if (serverStepStrings.Count > 2) { uint.TryParse(serverStepStrings[2], out step.ExpectResult); } else { step.ExpectResult = 1; } uint.TryParse(serverStepStrings[1], out step.InstanceId2); uint.TryParse(clientStepStrings[0], out step.InstanceId); uint.TryParse(clientStepStrings[1], out step.NpcId); step.Description = clientStepStrings[2]; if (clientStepStrings.Count > 3) { uint.TryParse(clientStepStrings[3], out step.SysId); } } else if (step.Goal.Equals(GameConst.GOAL_EQUIP_SUBMIT)) { uint.TryParse(serverStepStrings[1], out step.EquipColor); uint.TryParse(serverStepStrings[2], out step.EquipLvStep); step.Description = clientStepStrings[0]; } else if (step.Goal.Equals(GameConst.GOAL_SECRET_AREA)) { uint.TryParse(serverStepStrings[1], out step.SecretAreaId); step.Description = clientStepStrings[0]; } else if (step.Goal.Equals(GameConst.GOAL_TRIGRAM)) { uint race = Game.Instance.LocalPlayerVocation; for (int j = 1; j < serverStepStrings.Count; ++j) { uint trigramId = 0; uint.TryParse(serverStepStrings[j], out trigramId); if (TaskHelper.GetTrigramRace(trigramId) == race) { step.TrigramId = trigramId; } } step.Description = clientStepStrings[0]; } else if (step.Goal.Equals(GameConst.GOAL_EQUIP_WEAR)) { uint.TryParse(serverStepStrings[1], out step.EquipColor); uint.TryParse(serverStepStrings[2], out step.EquipLvStep); uint.TryParse(serverStepStrings[3], out step.ExpectResult); step.Description = clientStepStrings[0]; } else if (step.Goal.Equals(GameConst.GOAL_EQUIP_STRENGTH)) { uint.TryParse(serverStepStrings[1], out step.EquipStrenghtLv); uint.TryParse(serverStepStrings[2], out step.ExpectResult); step.Description = clientStepStrings[0]; } else if (step.Goal.Equals(GameConst.GOAL_EQUIP_GEM)) { uint.TryParse(serverStepStrings[1], out step.GemType); uint.TryParse(serverStepStrings[2], out step.GemLv); uint.TryParse(serverStepStrings[3], out step.ExpectResult); step.Description = clientStepStrings[0]; } else if (step.Goal.Equals(GameConst.GOAL_PET_LV)) { uint.TryParse(serverStepStrings[1], out step.PetLv); step.Description = clientStepStrings[0]; } else if (step.Goal.Equals(GameConst.GOAL_GROW_LV)) { uint.TryParse(serverStepStrings[1], out step.GrowType); uint.TryParse(serverStepStrings[2], out step.GrowLv); step.Description = clientStepStrings[0]; } else if (step.Goal.Equals(GameConst.GOAL_STAR_LV)) { step.Description = clientStepStrings[0]; uint.TryParse(serverStepStrings[1], out step.ExpectResult); } else if (step.Goal.Equals(GameConst.GOAL_GEM_LV)) { uint.TryParse(serverStepStrings[1], out step.ExpectResult); step.Description = clientStepStrings[0]; } else if (step.Goal.Equals(GameConst.GOAL_LIVENESS)) { uint.TryParse(serverStepStrings[1], out step.ExpectResult); step.Description = clientStepStrings[0]; } else if (step.Goal.Equals(GameConst.GOAL_EXP_JADE)) { uint.TryParse(serverStepStrings[1], out step.ExpectResult); step.Description = clientStepStrings[0]; } else if (step.Goal.Equals(GameConst.GOAL_GOODS_COMPOSE)) { uint.TryParse(serverStepStrings[1], out step.GoodsId); uint.TryParse(serverStepStrings[2], out step.ExpectResult); step.Description = clientStepStrings[0]; } else if (step.Goal.Equals(GameConst.GOAL_AFFILIED_ANY_BOSS)) { uint.TryParse(serverStepStrings[1], out step.ExpectResult); step.Description = clientStepStrings[0]; } else if (step.Goal.Equals(GameConst.GOAL_STIGMA_LV)) { uint.TryParse(serverStepStrings[1], out step.StigmaId); uint.TryParse(serverStepStrings[2], out step.StigmaLv); step.Description = clientStepStrings[0]; } else if (step.Goal.Equals(GameConst.GOAL_DRAGON_SOUL)) { uint.TryParse(serverStepStrings[1], out step.ExpectResult); step.Description = clientStepStrings[0]; } else if (step.Goal.Equals(GameConst.GOAL_CONTRACT_INHERIT)) { step.Description = clientStepStrings[0]; } else if (step.Goal.Equals(GameConst.GOAL_EQUIP_STRENGTH_TLV)) { uint.TryParse(serverStepStrings[1], out step.EquipStrenghtLv); uint.TryParse(serverStepStrings[1], out step.ExpectResult); step.Description = clientStepStrings[0]; } else if (step.Goal.Equals(GameConst.GOAL_TRIAL_BOSS)) { ushort.TryParse(serverStepStrings[1], out step.InstanceLv); step.Description = clientStepStrings[0]; } else if (step.Goal.Equals(GameConst.GOAL_KILL_BOSS)) { byte.TryParse(serverStepStrings[1], out step.WarTag); uint.TryParse(serverStepStrings[2], out step.MonsterLevel); uint.TryParse(serverStepStrings[3], out step.ExpectResult); step.Description = clientStepStrings[0]; } else if (step.Goal.Equals(GameConst.GOAL_LIGHT_EQUIP)) { ushort.TryParse(serverStepStrings[1], out step.LightEquipLv); step.Description = clientStepStrings[0]; } else if (step.Goal.Equals(GameConst.GOAL_RIDE_EQ_NUM)) { uint.TryParse(serverStepStrings[2], out step.ExpectResult); step.Description = clientStepStrings[0]; } else if (step.Goal.Equals(GameConst.GOAL_HONOR)) { uint.TryParse(serverStepStrings[1], out step.ExpectResult); step.Description = clientStepStrings[0]; } else if (step.Goal.Equals(GameConst.GOAL_ACT_FINISH)) { uint.TryParse(serverStepStrings[2], out step.ExpectResult); step.Description = clientStepStrings[0]; } else if (step.Goal.Equals(GameConst.GOAL_TRANSFER)) { uint.TryParse(serverStepStrings[1], out step.ExpectResult); step.Description = clientStepStrings[0]; } else if (step.Goal.Equals(GameConst.GOAL_SHOW_LV)) { uint.TryParse(serverStepStrings[2], out step.ExpectResult); step.Description = clientStepStrings[0]; } else if (step.Goal.Equals(GameConst.GOAL_BAPTIZE_NUM)) { uint.TryParse(serverStepStrings[1], out step.ExpectResult); step.Description = clientStepStrings[0]; } else { step.ExpectResult = 1; step.Description = clientStepStrings[0]; step.ServerParamStrings = serverStepStrings; step.ClientParamStrings = clientStepStrings; } if (i < navigationPointsUintsUints.Count) { List <uint> navigationPointsUints = navigationPointsUintsUints[i]; uint navigationInstanceId = 0; if (navigationPointsUints.Count > 0) { navigationInstanceId = navigationPointsUints[0]; } uint navigationTagId = 0; if (navigationPointsUints.Count > 1) { navigationTagId = navigationPointsUints[1]; } step.NavigationInstanceId = navigationInstanceId; step.NavigationTagId = navigationTagId; } steps.Add(step); } return(steps); }
protected override void ParseData(SqliteDataReader reader) { if (reader == null || !reader.HasRows) { return; } while (reader.Read()) { DBWorldBossItem ad = new DBWorldBossItem(); ad.Id = DBTextResource.ParseUI(GetReaderString(reader, "id")); ad.ShowAward = new List <DBWorldBoss.DBWorldBossRewardItem>(); List <List <string> > award_str_array = DBTextResource.ParseArrayStringString(GetReaderString(reader, "show_award_new")); for (int gid_index = 0; gid_index < award_str_array.Count; ++gid_index) { List <string> one_goods_array = award_str_array[gid_index]; if (one_goods_array.Count < 2) { continue; } uint goods_id = 0; if (uint.TryParse(one_goods_array[0], out goods_id) == false) { continue; } uint goods_num = 0; if (uint.TryParse(one_goods_array[1], out goods_num) == false) { continue; } string reward_type = ""; if (one_goods_array.Count > 2 && one_goods_array[2] != "" && one_goods_array[2] != "0") { reward_type = one_goods_array[2]; } DBWorldBossRewardItem reward_item = new DBWorldBossRewardItem(); reward_item.goods_id = goods_id; reward_item.goods_num = goods_num; reward_item.reward_type = reward_type; ad.ShowAward.Add(reward_item); } ad.MustDropAwardArray = new List <DBWorldBossRewardItem>(); award_str_array = DBTextResource.ParseArrayStringString(GetReaderString(reader, "must_drop_award")); for (int gid_index = 0; gid_index < award_str_array.Count; ++gid_index) { List <string> one_goods_array = award_str_array[gid_index]; if (one_goods_array.Count < 2) { continue; } uint goods_id = 0; if (uint.TryParse(one_goods_array[0], out goods_id) == false) { continue; } uint goods_num = 0; if (uint.TryParse(one_goods_array[1], out goods_num) == false) { continue; } string reward_type = ""; if (one_goods_array.Count > 2 && one_goods_array[2] != "" && one_goods_array[2] != "0") { reward_type = one_goods_array[2]; } DBWorldBossRewardItem reward_item = new DBWorldBossRewardItem(); reward_item.goods_id = goods_id; reward_item.goods_num = goods_num; reward_item.reward_type = reward_type; ad.MustDropAwardArray.Add(reward_item); } //ad.ShowAward = DBTextResource.ParseDBGoodsItem(GetReaderString(reader, "show_award")); ad.Tag = DBTextResource.ParseUI_s(GetReaderString(reader, "tag"), 0); ad.Rank = DBTextResource.ParseUI(GetReaderString(reader, "rank")); ad.ModelCameraOffset = DBTextResource.ParseVector3(GetReaderString(reader, "model_camera_offset")); ad.ModelCameraRotate = DBTextResource.ParseVector3(GetReaderString(reader, "model_camera_rotate")); ad.ModelDefaultAngle = DBTextResource.ParseVector3(GetReaderString(reader, "model_default_angle")); ad.DeathModelCenter = DBTextResource.ParseVector3(GetReaderString(reader, "death_model_center")); ad.DeathModelRadius = DBTextResource.ParseF(GetReaderString(reader, "death_model_radius")); ad.ColorType = DBTextResource.ParseUI_s(GetReaderString(reader, "color_type"), 0); ad.Order = DBTextResource.ParseUI_s(GetReaderString(reader, "order"), 0); data.Add(ad.Id, ad); m_sortData.Add(ad); } m_sortData.Sort((a, b) => { if (a.Rank < b.Rank) { return(-1); } else if (a.Rank > b.Rank) { return(1); } return(0); }); }