protected override void ParseData(SqliteDataReader reader) { mGemInfos.Clear(); GemInfo gemInfo = null; if (reader != null) { if (reader.HasRows == true) { while (reader.Read()) { gemInfo = new GemInfo(); gemInfo.Id = DBTextResource.ParseUI_s(GetReaderString(reader, "id"), 0); gemInfo.Type = DBTextResource.ParseBT_s(GetReaderString(reader, "type"), 0); gemInfo.Lv = DBTextResource.ParseUS_s(GetReaderString(reader, "lv"), 0); gemInfo.NextGemId = DBTextResource.ParseUI_s(GetReaderString(reader, "next_gem_id"), 0); gemInfo.Attrs = DBTextResource.ParseArrayUintUint(GetReaderString(reader, "attr")); gemInfo.TypeName = GetReaderString(reader, "type_name"); #if UNITY_EDITOR if (mGemInfos.ContainsKey(gemInfo.Id)) { GameDebug.LogError(string.Format("[{0}]表重复添加的域id[{1}]", mTableName, gemInfo.Id)); continue; } #endif mGemInfos.Add(gemInfo.Id, gemInfo); } } } }
bool mIsBuyingDrug = false; // 是否正在买药,即发了买药的消息且服务端还没回复 public void UpdateAutoBuyDrugGoodsId() { if (LocalPlayerManager.Instance.LocalActorAttribute != null) { uint level = LocalPlayerManager.Instance.LocalActorAttribute.Level; List <List <uint> > uintUintList = DBTextResource.ParseArrayUintUint(GameConstHelper.GetString("GAME_HOOK_BUY_HP_DRUG_GOODS_ID")); foreach (List <uint> uintList in uintUintList) { if (level < uintList[0]) { mAutoBuyHPDrugGoodsId = uintList[1]; break; } } uintUintList = DBTextResource.ParseArrayUintUint(GameConstHelper.GetString("GAME_HOOK_BUY_MP_DRUG_GOODS_ID")); foreach (List <uint> uintList in uintUintList) { if (level < uintList[0]) { mAutoBuyMPDrugGoodsId = uintList[1]; break; } } UpdateAutoBuyDrugGoodsPrice(); } }
public static List <DBAttrItem> ParseDBAttrItems(string raw) { List <DBAttrItem> item_array = new List <DBAttrItem>(); List <List <uint> > uint_uint_array = DBTextResource.ParseArrayUintUint(raw); for (int index = 0; index < uint_uint_array.Count; ++index) { if (uint_uint_array[index].Count >= 2) { DBAttrItem item = new DBAttrItem(); item.attr_id = uint_uint_array[index][0]; item.attr_num = uint_uint_array[index][1]; item_array.Add(item); } } return(item_array); }
public DBDecorateItem GetData(uint gid) { DBDecorateItem ad = null; if (data.TryGetValue(gid, out ad)) { return(ad); } string query = string.Format("SELECT * FROM {0} WHERE {0}.{1}=\"{2}\"", mTableName, "gid", gid); var reader = DBManager.Instance.ExecuteSqliteQueryToReader(GlobalConfig.DBFile, mTableName, query); if (reader == null) { data[gid] = null; return(null); } if (!reader.HasRows || !reader.Read()) { data[gid] = null; reader.Close(); reader.Dispose(); return(null); } var ret = new DBDecorateItem(); ret.Gid = DBTextResource.ParseUI(GetReaderString(reader, "gid")); ret.Pos = DBTextResource.ParseUI(GetReaderString(reader, "pos_id")); ret.StrengthMax = DBTextResource.ParseUI(GetReaderString(reader, "max_lv")); ret.LvStep = DBTextResource.ParseUI(GetReaderString(reader, "lv_step")); ret.SwallowExpValue = DBTextResource.ParseUI(GetReaderString(reader, "value")); ret.Attrs = GetReaderString(reader, "attrs"); ret.LegendAttrs = DBTextResource.ParseArrayUintUint(GetReaderString(reader, "legend_attrs")); ret.DefaultExtraDesc = GetReaderString(reader, "default_extra_desc"); ret.DefaultStar = DBTextResource.ParseUI(GetReaderString(reader, "default_star")); data.Add(ret.Gid, ret); reader.Close(); reader.Dispose(); return(ret); }
protected override void ParseData(SqliteDataReader reader) { mEngravenfos.Clear(); EngraveInfo gemInfo = null; if (reader != null) { if (reader.HasRows == true) { while (reader.Read()) { gemInfo = new EngraveInfo(); gemInfo.Id = DBTextResource.ParseUI_s(GetReaderString(reader, "id"), 0); gemInfo.Type = DBTextResource.ParseBT_s(GetReaderString(reader, "type"), 0); gemInfo.Lv = DBTextResource.ParseUS_s(GetReaderString(reader, "lv"), 0); gemInfo.NextEngraveId = DBTextResource.ParseUI_s(GetReaderString(reader, "next_engrave_id"), 0); gemInfo.Attrs = DBTextResource.ParseArrayUintUint(GetReaderString(reader, "attr")); mEngravenfos.Add(gemInfo.Id, gemInfo); } } } }
protected override void ParseData(SqliteDataReader reader) { mInfos.Clear(); mSortInfos.Clear(); mNormalDegreeSortInfos.Clear(); DBGrowSkinItem info; if (reader != null) { if (reader.HasRows == true) { while (reader.Read()) { info = new DBGrowSkinItem(); info.GrowType = DBTextResource.ParseUI_s(GetReaderString(reader, "type"), 0); info.Id = DBTextResource.ParseUI_s(GetReaderString(reader, "id"), 0); info.Name = GetReaderString(reader, "name"); info.Desc = GetReaderString(reader, "desc"); //描述 info.UnlockType = (SkinUnLockType)DBTextResource.ParseUI_s(GetReaderString(reader, "unlock_type"), 0); //解锁方式 if (info.UnlockType == SkinUnLockType.WhenOpenFunc) { //info.UnlockPlayerLevel = DBTextResource.ParseUI_s(GetReaderString(reader, "unlock_condition"), 0); //解锁条件 } else if (info.UnlockType == SkinUnLockType.CostGoods) { info.UnLockGoodsConditionArray = new List <DBPet.UnLockGoodsCondition>(); List <List <uint> > str_array = DBTextResource.ParseArrayUintUint(GetReaderString(reader, "unlock_condition")); for (int index = 0; index < str_array.Count; ++index) { if (str_array[index].Count >= 2) { DBPet.UnLockGoodsCondition tmp_item = new DBPet.UnLockGoodsCondition(); tmp_item.goods_id = str_array[index][0]; tmp_item.goods_num = str_array[index][1]; info.UnLockGoodsConditionArray.Add(tmp_item); } else { GameDebug.LogError(string.Format("There is error unlock_condition (id = {0}) in data_grow_skin", info.Id)); } } } else if (info.UnlockType == SkinUnLockType.GrowLevel) { info.UnlockGrowLevel = DBTextResource.ParseUI_s(GetReaderString(reader, "unlock_condition"), 0); //解锁条件 } else { } info.UnlockDesc = GetReaderString(reader, "unlock_desc"); //解锁说明 info.SortId = DBTextResource.ParseUI_s(GetReaderString(reader, "sort_id"), 0); //排序ID info.Quality = DBTextResource.ParseUI_s(GetReaderString(reader, "quality"), 0); //品质 info.ActorId = DBTextResource.ParseUI_s(GetReaderString(reader, "actor_id"), 0); //角色ID info.ModelLocalPos = DBTextResource.ParseVector3(GetReaderString(reader, "model_local_pos")); info.ModelLocalScale = DBTextResource.ParseVector3(GetReaderString(reader, "model_local_scale")); info.ModelLocalScaleGoods = DBTextResource.ParseVector3(GetReaderString(reader, "model_local_scale_goods")); info.ModelLocalAngles = DBTextResource.ParseVector3(GetReaderString(reader, "model_local_angles")); info.ModelParentDefaultAngles = DBTextResource.ParseVector3(GetReaderString(reader, "model_parent_default_angles")); info.ModelParentLocalPos = DBTextResource.ParseVector3(GetReaderString(reader, "model_parent_local_pos")); info.ModelCameraOffset = DBTextResource.ParseVector3(GetReaderString(reader, "model_camera_offset")); info.ModelDefaultAngle = DBTextResource.ParseVector3(GetReaderString(reader, "model_default_angle")); info.ModelSceneOffset = DBTextResource.ParseVector3(GetReaderString(reader, "model_scene_offset")); info.SurfaceOffset = DBTextResource.ParseVector3(GetReaderString(reader, "surfaceOffset")); info.GetOffset = DBTextResource.ParseVector3(GetReaderString(reader, "getOffset")); info.AttrArray = DBTextResource.ParseDBAttrItems(GetReaderString(reader, "attr")); //属性加成 info.IdleActionWhenRiding = GetReaderString(reader, "idleActionWhenRiding"); info.RunActionWhenRiding = GetReaderString(reader, "runActionWhenRiding"); info.SceneModelOffset = DBTextResource.ParseVector3(GetReaderString(reader, "sceneModelOffset")); if (mInfos.ContainsKey(info.GrowType) == false) { mInfos.Add(info.GrowType, new Dictionary <uint, DBGrowSkinItem>()); } mInfos[info.GrowType][info.Id] = info; if (mSortInfos.ContainsKey(info.GrowType) == false) { mSortInfos.Add(info.GrowType, new List <DBGrowSkinItem>()); } mSortInfos[info.GrowType].Add(info); if (info.UnlockType == SkinUnLockType.WhenOpenFunc || info.UnlockType == SkinUnLockType.GrowLevel) { if (mNormalDegreeSortInfos.ContainsKey(info.GrowType) == false) { mNormalDegreeSortInfos.Add(info.GrowType, new List <DBGrowSkinItem>()); } mNormalDegreeSortInfos[info.GrowType].Add(info); } } foreach (var item in mSortInfos) { item.Value.Sort((a, b) => { if (a.SortId < b.SortId) { return(-1); } else if (a.SortId > b.SortId) { return(1); } if (a.Id < b.Id) { return(-1); } else if (a.Id > b.Id) { return(1); } return(0); }); } foreach (var item in mNormalDegreeSortInfos) { item.Value.Sort((a, b) => { if (a.UnlockType == SkinUnLockType.WhenOpenFunc) { if (b.UnlockType != SkinUnLockType.WhenOpenFunc) { return(-1); } } else { if (b.UnlockType == SkinUnLockType.WhenOpenFunc) { return(1); } else { if (a.UnlockGrowLevel < b.UnlockGrowLevel) { return(-1); } else if (a.UnlockGrowLevel > b.UnlockGrowLevel) { return(1); } return(0); } } if (a.Id < b.Id) { return(-1); } else if (a.Id > b.Id) { return(1); } return(0); }); } } } }
/// <summary> /// 获取一个套装信息 /// </summary> /// <returns></returns> public DBSuitInfo GetOneInfo(uint id, uint lv) { //foreach (DBSuitInfo info in mInfos) //{ // if (info.Id == id && info.Lv == lv) // { // return info; // } //} //return null; string csvId = id + "_" + lv; DBSuitInfo info = null; if (mInfos.TryGetValue(csvId, out info)) { return(info); } string queryStr = string.Format("SELECT * FROM {0} WHERE {0}.{1}=\"{2}\"", mTableName, "csv_id", csvId); var reader = DBManager.Instance.ExecuteSqliteQueryToReader(GlobalConfig.DBFile, mTableName, queryStr); if (reader == null) { mInfos.Add(csvId, null); return(null); } if (!reader.HasRows) { mInfos.Add(csvId, null); reader.Close(); reader.Dispose(); return(null); } if (!reader.Read()) { mInfos.Add(csvId, null); reader.Close(); reader.Dispose(); return(null); } info = new DBSuitInfo(); info.Id = DBTextResource.ParseUI_s(GetReaderString(reader, "id"), 0); info.Lv = DBTextResource.ParseUI_s(GetReaderString(reader, "lv"), 0); info.Name = GetReaderString(reader, "name"); info.PreviewName = GetReaderString(reader, "preview_name"); info.SuitId = DBTextResource.ParseUI_s(GetReaderString(reader, "suit_id"), 0); info.ColorNeed = DBTextResource.ParseUI_s(GetReaderString(reader, "color_need"), 0); info.StarNeed = DBTextResource.ParseUI_s(GetReaderString(reader, "star_need"), 0); info.NeedInfos = new List <DBSuitInfo.NeedInfo>(); info.NeedInfos.Clear(); List <List <uint> > needConfigs = DBTextResource.ParseArrayUintUint(GetReaderString(reader, "need")); foreach (List <uint> needConfig in needConfigs) { if (needConfig.Count >= 2) { DBSuitInfo.NeedInfo needInfo = new DBSuitInfo.NeedInfo(); needInfo.ColorNeed = needConfig[0]; needInfo.StarNeed = needConfig[1]; info.NeedInfos.Add(needInfo); } } info.CostGoodsIdList = new Dictionary <uint, List <KeyValuePair <uint, uint> > >(); info.CostGoodsIdList.Clear(); info.CostGoodsList = new Dictionary <uint, List <GoodsItem> >(); info.CostGoodsList.Clear(); // 锻造消耗的部位配置从3到10 for (uint i = 3; i <= 10; ++i) { List <KeyValuePair <uint, uint> > costGoodsIds = new List <KeyValuePair <uint, uint> >(); costGoodsIds.Clear(); string raw = GetReaderString(reader, "pos_" + i + "_cost"); raw = raw.Replace(" ", ""); var matchs = TextHelper.ParseBraceContent(raw, true); foreach (var _match in matchs) { uint goodsId = DBTextResource.ParseUI(_match[0]); uint num = DBTextResource.ParseUI(_match[1]); KeyValuePair <uint, uint> goodsIdPair = new KeyValuePair <uint, uint>(goodsId, num); costGoodsIds.Add(goodsIdPair); } SGameEngine.Pool <List <string> > .List.Free(matchs); info.CostGoodsIdList.Add(i, costGoodsIds); } #if UNITY_EDITOR if (mInfos.ContainsKey(csvId)) { GameDebug.LogError(string.Format("[{0}]表重复添加的域id[{1}]", mTableName, csvId)); reader.Close(); reader.Dispose(); return(info); } #endif mInfos.Add(csvId, info); reader.Close(); reader.Dispose(); return(info); }
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 EquipModData GetModData(uint eid) { EquipModData data = null; if (EquipModDatas.TryGetValue(eid, out data)) { return(data); } string query_str = string.Format("SELECT * FROM {0} WHERE {0}.{1}=\"{2}\"", mTableName, "gid", eid.ToString()); var reader = DBManager.Instance.ExecuteSqliteQueryToReader(GlobalConfig.DBFile, mTableName, query_str); if (reader == null) { EquipModDatas[eid] = null; return(null); } if (!reader.HasRows) { EquipModDatas[eid] = null; reader.Close(); reader.Dispose(); return(null); } if (!reader.Read()) { EquipModDatas[eid] = null; reader.Close(); reader.Dispose(); return(null); } var id = DBTextResource.ParseUI(GetReaderString(reader, "gid")); var pos = DBTextResource.ParseUI(GetReaderString(reader, "pos")); var ar_con_need = DBTextResource.ParseUI(GetReaderString(reader, "ar_con_need")); var ar_str_need = DBTextResource.ParseUI(GetReaderString(reader, "ar_str_need")); var ar_agi_need = DBTextResource.ParseUI(GetReaderString(reader, "ar_agi_need")); var ar_int_need = DBTextResource.ParseUI(GetReaderString(reader, "ar_int_need")); //var transfer_need = DBTextResource.ParseUI(GetReaderString(reader, "transfer_need")); var legend_attrs_num = DBTextResource.ParseUI(GetReaderString(reader, "legend_attrs_num")); var model = DBTextResource.ParseUI(GetReaderString(reader, "model")); var lv_step = DBTextResource.ParseUI(GetReaderString(reader, "lv_step")); var strength_max = DBTextResource.ParseUI(GetReaderString(reader, "strength_limit")); var suit_id = DBTextResource.ParseUI(GetReaderString(reader, "suit_id")); var pet_exp = DBTextResource.ParseUI(GetReaderString(reader, "pet_exp")); var default_extra_desc = GetReaderBytes(reader, "default_extra_desc"); var default_star = DBTextResource.ParseUI_s(GetReaderString(reader, "default_star"), 0); var can_identify = DBTextResource.ParseUI_s(GetReaderString(reader, "can_identify"), 0) == 1; var default_score = DBTextResource.ParseUI_s(GetReaderString(reader, "default_score"), 0); var legend_attrs = DBTextResource.ParseArrayUintUint(GetReaderString(reader, "legend_attrs")); var mod_data = new EquipModData(id, pos, ar_con_need, ar_str_need, ar_agi_need, ar_int_need, legend_attrs_num, model, lv_step, strength_max, suit_id, pet_exp, default_extra_desc, default_star, can_identify, default_score, legend_attrs); EquipModDatas.Add(mod_data.Id, mod_data); reader.Close(); reader.Dispose(); return(mod_data); }
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); }
/// <summary> /// 根据技能id和技能等级获取一个公会技能的信息 /// </summary> /// <param name="skill_id"></param> /// <param name="skill_level"></param> /// <returns></returns> public DBGuildSkillItem GetOneItem(uint skill_id, uint skill_level) { uint uid = skill_id * 1000 + skill_level; DBGuildSkillItem info; if (mInfos.TryGetValue(uid, out info)) { return(info); } string query_str = string.Format("SELECT * FROM {0} WHERE {0}.{1}=\"{2}\" AND {0}.{3}=\"{4}\"", mTableName, "id", skill_id, "lv", skill_level); var reader = DBManager.Instance.ExecuteSqliteQueryToReader(GlobalConfig.DBFile, mTableName, query_str); if (reader == null) { mInfos[uid] = null; return(null); } if (!reader.HasRows || !reader.Read()) { mInfos[uid] = null; reader.Close(); reader.Dispose(); return(null); } info = new DBGuildSkillItem(); info.SkillId = DBTextResource.ParseUI_s(GetReaderString(reader, "id"), 0); // 技能ID info.Name = GetReaderString(reader, "name"); //技能名字 info.Level = DBTextResource.ParseUI_s(GetReaderString(reader, "lv"), 0); //等级 info.OpenLv = DBTextResource.ParseUI_s(GetReaderString(reader, "open_lv"), 0); //开放等级(玩家等级) info.OpenCost = DBTextResource.ParseUI_s(GetReaderString(reader, "open_cost"), 0); //开启消耗帮贡 info.LvUpCost = DBTextResource.ParseUI_s(GetReaderString(reader, "lv_up_cost"), 0); //升级消耗帮贡 info.AttrArray = new List <DBCommonAttrItem>(); List <List <uint> > uint_uint_array = DBTextResource.ParseArrayUintUint(GetReaderString(reader, "attr")); for (int index = 0; index < uint_uint_array.Count; ++index) { if (uint_uint_array[index].Count >= 2) { DBCommonAttrItem item = new DBCommonAttrItem(); item.attr_id = uint_uint_array[index][0]; item.attr_num = uint_uint_array[index][1]; info.AttrArray.Add(item); } } info.Icon = GetReaderString(reader, "icon"); //图标 info.CurShowAttrArray = DBTextResource.ParseArrayUintUint(GetReaderString(reader, "cur_attr_id")); //玩家当前属性 info.CurAttrId = 0; //当前属性ID if (info.CurShowAttrArray != null && info.CurShowAttrArray.Count > 0 && info.CurShowAttrArray[0] != null && info.CurShowAttrArray[0].Count > 0) { info.CurAttrId = info.CurShowAttrArray[0][0]; } mInfos[uid] = info; reader.Close(); reader.Dispose(); return(info); }
/// <summary> /// 获取某个副本的信息 /// </summary> /// <returns>The instance info.</returns> /// <param name="id">Identifier.</param> public InstanceInfo GetInstanceInfo(uint id) { InstanceInfo info = null; if (mInstanceInfos.TryGetValue(id, out info)) { return(info); } string queryStr = string.Format("SELECT * FROM {0} WHERE {0}.{1}=\"{2}\"", mTableName, "id", id.ToString()); var table_reader = DBManager.Instance.ExecuteSqliteQueryToReader(GlobalConfig.DBFile, mTableName, queryStr); if (table_reader == null) { mInstanceInfos.Add(id, null); return(null); } if (!table_reader.HasRows) { mInstanceInfos.Add(id, null); table_reader.Close(); table_reader.Dispose(); return(null); } if (!table_reader.Read()) { mInstanceInfos.Add(id, null); table_reader.Close(); table_reader.Dispose(); return(null); } info = new InstanceInfo(); Type gameConstType = typeof(GameConst); info.mId = DBTextResource.ParseUI_s(GetReaderString(table_reader, "id"), 0); info.mMaxTime = DBTextResource.ParseI(GetReaderString(table_reader, "max_time")); info.mNeedGoods = DBTextResource.ParseDictionaryUintUint(GetReaderString(table_reader, "need_goods")); info.mDyNeedGoods = DBTextResource.ParseArrayUintUint(GetReaderString(table_reader, "dy_need_goods")); info.mNeedLv = DBTextResource.ParseUS_s(GetReaderString(table_reader, "need_lv"), 0); info.mLvUpLimit = DBTextResource.ParseUS_s(GetReaderString(table_reader, "lv_up_limit"), 0); info.mRecommendAttrs = ParseRecommendAttrs(GetReaderString(table_reader, "recommend_attrs")); info.mSingleEnter = DBTextResource.ParseI(GetReaderString(table_reader, "single_enter")) == 1 ? true : false; string mbCountStr = GetReaderString(table_reader, "mb_count"); ushort mbCount = 0; /* 进入人数四种要求: * 0:可单人,也可以任意组队(不用配) * 1:必须单人(可以没有队伍,也可以在只有他一个人的队伍中) * N(N>=2):必须N人以上组队 * {M,N}:大于等于M且小于等于N */ if (string.IsNullOrEmpty(mbCountStr) == true) { info.mMinMemberCount = 0; info.mMaxMemberCount = GameConstHelper.GetShort("GAME_TEAM_MEMBER_LIMIT"); } else if (ushort.TryParse(mbCountStr, out mbCount) == true) { info.mMinMemberCount = mbCount; if (info.mMinMemberCount == 0) { info.mMaxMemberCount = GameConstHelper.GetShort("GAME_TEAM_MEMBER_LIMIT"); } else if (info.mMinMemberCount == 1) { info.mMinMemberCount = 0; info.mMaxMemberCount = 1; } else { info.mMaxMemberCount = GameConstHelper.GetShort("GAME_TEAM_MEMBER_LIMIT"); } } else { List <uint> mbCountList = DBTextResource.ParseArrayUint(mbCountStr, ","); if (mbCountList.Count >= 2) { info.mMinMemberCount = (ushort)mbCountList[0]; info.mMaxMemberCount = (ushort)mbCountList[1]; } } info.mSweepCosts = DBTextResource.ParseDictionaryUintUint(GetReaderString(table_reader, "sweep_costs")); info.mSweepLimit = DBTextResource.ParseVector2(GetReaderString(table_reader, "sweep_limit")); info.mName = GetReaderString(table_reader, "name"); //System.Reflection.FieldInfo fieldInfo = null; //string warTypeStr = GetReaderString(table_reader, "war_type"); //if (mGameConstUintValueCache.ContainsKey(warTypeStr) == true) //{ // info.mWarType = mGameConstUintValueCache[warTypeStr]; //} //else //{ // fieldInfo = gameConstType.GetField(warTypeStr); // if (fieldInfo != null) // { // info.mWarType = Convert.ToUInt32(fieldInfo.GetValue(null)); // mGameConstUintValueCache[warTypeStr] = info.mWarType; // } // else // { // GameDebug.LogError("Can not find war type " + warTypeStr + " in db instance!!!"); // } //} //string warsubTypeStr = GetReaderString(table_reader, "war_subtype"); //if (string.IsNullOrEmpty(warsubTypeStr) == false) //{ // if (mGameConstUintValueCache.ContainsKey(warsubTypeStr) == true) // { // info.mWarSubType = mGameConstUintValueCache[warsubTypeStr]; // } // else // { // fieldInfo = gameConstType.GetField(warsubTypeStr); // if (fieldInfo != null) // { // info.mWarSubType = Convert.ToUInt32(fieldInfo.GetValue(null)); // mGameConstUintValueCache[warsubTypeStr] = info.mWarSubType; // } // else // { // GameDebug.LogError("Can not find sub war type " + warsubTypeStr + " in db instance!!!"); // } // } //} uint warType = 0; uint warSubType = 0; string warTypeStr = GetReaderString(table_reader, "war_type"); string warSubTypeStr = GetReaderString(table_reader, "war_subtype"); ConvertWarType(warTypeStr, warSubTypeStr, out warType, out warSubType); info.mWarType = warType; info.mWarSubType = warSubType; info.mDesc = GetReaderString(table_reader, "desc"); info.mStages.Clear(); string stagesStr = GetReaderString(table_reader, "stages"); List <string> stages = DBTextResource.ParseArrayString(stagesStr); for (int j = 0; j < stages.Count; j++) { if (!String.IsNullOrEmpty(stages[j])) { info.mStages.Add(DBTextResource.ParseUI(stages[j])); } } info.mPKType = DBTextResource.ParseI(GetReaderString(table_reader, "pk_type")); info.mReviveTimes = DBTextResource.ParseUS(GetReaderString(table_reader, "revive_times")); info.mReadyCountDown = DBTextResource.ParseUS(GetReaderString(table_reader, "ready_count_down")); info.mResultCountDown = DBTextResource.ParseUI(GetReaderString(table_reader, "result_count_down")); info.mIsReloadSceneWhenTheSame = DBTextResource.ParseI(GetReaderString(table_reader, "is_reload_scene_when_the_same")) == 0 ? false : true; info.mMinPos = DBTextResource.ParseVector2(GetReaderString(table_reader, "mini_map_pos_x")); info.mMaxPos = DBTextResource.ParseVector2(GetReaderString(table_reader, "mini_map_pos_y")); info.mMiniMapWidth = info.mMaxPos.x - info.mMinPos.x; info.mMiniMapHeight = info.mMaxPos.y - info.mMinPos.y; info.mMiniMapName = GetReaderString(table_reader, "mini_map"); info.mIsCanOpenMiniMap = DBTextResource.ParseI(GetReaderString(table_reader, "is_open_mini_map")) == 0 ? false : true; string isShowMarkStr = GetReaderString(table_reader, "is_show_mark"); if (isShowMarkStr == string.Empty || isShowMarkStr == "0") { info.mIsShowMark = false; } else { info.mIsShowMark = true; } string isAutoFightStr = GetReaderString(table_reader, "is_auto_fight"); if (isAutoFightStr == string.Empty || isAutoFightStr == "0") { info.mIsAutoFight = false; } else { info.mIsAutoFight = true; } string canNotRideStr = GetReaderString(table_reader, "can_not_ride"); if (canNotRideStr == string.Empty || canNotRideStr == "0") { info.mCanNotRide = false; } else { info.mCanNotRide = true; } info.mRewardIds = DBTextResource.ParseArrayUint(GetReaderString(table_reader, "reward_1"), ","); info.mShowRewardIds = DBTextResource.ParseArrayUint(GetReaderString(table_reader, "show_rewards"), ","); info.mNeedTaskId = DBTextResource.ParseUI_s(GetReaderString(table_reader, "need_task_id"), 0); info.mPlanesInstanceId = DBTextResource.ParseUI_s(GetReaderString(table_reader, "planes_dg_id"), 0); info.mStartTimeline = DBTextResource.ParseUI_s(GetReaderString(table_reader, "start_timeline"), 0); info.mGuardedNpcId = DBTextResource.ParseUI_s(GetReaderString(table_reader, "npc_id"), 0); string showBossAssStr = GetReaderString(table_reader, "show_boss_assistant"); if (showBossAssStr == string.Empty || showBossAssStr == "0") { info.mShowBossAssistant = false; } else { info.mShowBossAssistant = true; } info.mForbidJumpOutAnimationOut = DBTextResource.ParseUI_s(GetReaderString(table_reader, "forbid_jump_out_animation_out"), 0) == 1; info.mForbidWaterWaveEffect = DBTextResource.ParseUI_s(GetReaderString(table_reader, "forbid_water_wave_effect"), 0) == 1; info.mIsCanSendPosition = DBTextResource.ParseUI_s(GetReaderString(table_reader, "is_can_send_position"), 0) == 1; info.mMergeLevel = DBTextResource.ParseUI_s(GetReaderString(table_reader, "merge_level"), 0); info.mMergeConsume = DBTextResource.ParseDictionaryUintUint(GetReaderString(table_reader, "merge_consume")); #if UNITY_EDITOR if (mInstanceInfos.ContainsKey(info.mId)) { GameDebug.LogError(string.Format("[{0}]表重复添加的域id[{1}]", mTableName, info.mId)); table_reader.Close(); table_reader.Dispose(); return(info); } #endif mInstanceInfos.Add(info.mId, info); table_reader.Close(); table_reader.Dispose(); return(info); }
protected override void ParseData(SqliteDataReader reader) { mMinLevelSkillDict.Clear(); mInfos.Clear(); mInfosByType.Clear(); mInfosByActiveSkillId.Clear(); // mInfosCanSetKey.Clear(); // mInfosNoCanSetKey.Clear(); mInfosBySetSlotType.Clear(); DBSkillSlot db_slot = DBManager.Instance.GetDB <DBSkillSlot>(); AllSkillInfo info; if (reader != null) { if (reader.HasRows == true) { while (reader.Read()) { info = new AllSkillInfo(); info.Id = DBTextResource.ParseUI_s(GetReaderString(reader, "id"), 0); info.SkillType = (SKILL_TYPE)System.Enum.Parse(typeof(SKILL_TYPE), GetReaderString(reader, "type")); info.Sub_id = DBTextResource.ParseUI_s(GetReaderString(reader, "sub_id"), 0); //主动技能ID或者被动技能ID info.SortId = DBTextResource.ParseUS_s(GetReaderString(reader, "sort_id"), 0); info.Name = GetReaderString(reader, "name"); //技能名字 info.Source = GetReaderString(reader, "source"); //技能获取途径说明 info.Desc = GetReaderString(reader, "desc"); // info.Icon = GetReaderString(reader, "icon"); info.ModelId = DBTextResource.ParseUI_s(GetReaderString(reader, "model_id"), 0); info.ModelAction = GetReaderString(reader, "model_action"); info.Require_race = DBTextResource.ParseUI_s(GetReaderString(reader, "require_race"), 0); //职业限制( 取值参见 EVocationType) info.Skill_type_descript = GetReaderString(reader, "skill_type_descript"); //技能标签 info.zhuhun_txt = GetReaderString(reader, "zhuhun_txt"); //铸魂额外配置文本 info.SetSlotType = (SET_SLOT_TYPE)DBTextResource.ParseUI_s(GetReaderString(reader, "set_slot_type"), 0); if (info.SetSlotType == SET_SLOT_TYPE.None || info.SetSlotType == SET_SLOT_TYPE.MateSKill) { info.Can_set_key = false; //能否装备到技能槽 } else { info.Can_set_key = true; } info.ReplaceIds = DBTextResource.ParseArrayUint(GetReaderString(reader, "replace_ids"), ","); info.Level = DBTextResource.ParseUI_s(GetReaderString(reader, "level"), 0); info.ShowInPanel = DBTextResource.ParseUI_s(GetReaderString(reader, "show_in_panel"), 1) == 1; info.LevelNotice = GetReaderString(reader, "level_notice"); info.FixedKeyPos = DBTextResource.ParseUI_s(GetReaderString(reader, "fixed_key_pos"), 0); info.OpenHole = DBTextResource.ParseUI_s(GetReaderString(reader, "open_hole"), 0); string raw = GetReaderString(reader, "stop_hook_when_gain"); if (string.IsNullOrEmpty(raw) == true || raw.Equals("0") == true) { info.StopHookWhenGain = false; } else { info.StopHookWhenGain = true; } info.Attrs = DBTextResource.ParseArrayUintUint(GetReaderString(reader, "attrs")); mInfos.Add(info.Id, info); if (mInfosByType.ContainsKey(info.SkillType) == false) { mInfosByType.Add(info.SkillType, new Dictionary <uint, List <AllSkillInfo> >()); } if (mInfosByType[info.SkillType].ContainsKey(info.Require_race) == false) { mInfosByType[info.SkillType].Add(info.Require_race, new List <AllSkillInfo>()); } mInfosByType[info.SkillType][info.Require_race].Add(info); if (info.SkillType == SKILL_TYPE.Active) { mInfosByActiveSkillId[info.Sub_id] = info; if (mInfosBySetSlotType.ContainsKey(info.Require_race) == false) { mInfosBySetSlotType.Add(info.Require_race, new OneVocationActiveSkillInfos(info.Require_race)); } mInfosBySetSlotType[info.Require_race].AddSkillInfo(info); db_slot.AddSlotDefaultSkillId(info.Require_race, info.OpenHole, info.Id); } if (info.Level == 1) {//首先只记录等级为1 mMinLevelSkillDict.Add(info.Id, new List <DBDataAllSkill.AllSkillInfo>()); mMinLevelSkillDict[info.Id].Add(info); } } } } foreach (var item in mInfos) { if (item.Value.Level > 1 && item.Value.ReplaceIds != null && item.Value.ReplaceIds.Count > 0) {//检测所有大于等级1的技能 for (int index = 0; index < item.Value.ReplaceIds.Count; ++index) { uint skill_id = item.Value.ReplaceIds[index]; List <DBDataAllSkill.AllSkillInfo> find_info_array = null; if (mMinLevelSkillDict.TryGetValue(skill_id, out find_info_array)) { //插入等级为1的技能列表中去 item.Value.MinLevelTotalSkillId = skill_id; //设定等级为1的技能ID find_info_array.Add(item.Value); } } } } //等级排序 foreach (var item in mMinLevelSkillDict) { item.Value.Sort((a, b) => { if (a.Level < b.Level) { return(-1); } else if (a.Level > b.Level) { return(1); } return(0); }); for (int index = 0; index < item.Value.Count; ++index) { if (index == item.Value.Count - 1) { item.Value[index].NextLevelSkillTmpl = null; } else { item.Value[index].NextLevelSkillTmpl = item.Value[index + 1]; } } } foreach (var item in mInfosByType) { if (item.Value.ContainsKey(CommonVocationType)) { foreach (var item2 in item.Value) { if (item2.Key != CommonVocationType && item2.Key != PetVocationType) { item2.Value.AddRange(item.Value[CommonVocationType]); } } } } if (mInfosBySetSlotType.ContainsKey(CommonVocationType)) { foreach (var item in mInfosBySetSlotType) { if (item.Key == PetVocationType) { continue; } if (item.Key == CommonVocationType) { continue; } foreach (var copy_item in mInfosBySetSlotType[CommonVocationType].mSkills) { if (item.Value.mSkills.ContainsKey(copy_item.Key) == false) { item.Value.mSkills.Add(copy_item.Key, new List <AllSkillInfo>()); } item.Value.mSkills[copy_item.Key].AddRange(copy_item.Value); } } } }
public DBElementEquipGoodsItem GetData(uint gid) { DBElementEquipGoodsItem oneData = null; if (data.TryGetValue(gid, out oneData)) { return(oneData); } string query_str = string.Format("SELECT * FROM {0} WHERE {0}.{1}=\"{2}\"", TableName, "gid", gid.ToString()); var table_reader = DBManager.Instance.ExecuteSqliteQueryToReader(GlobalConfig.DBFile, TableName, query_str); if (table_reader == null) { data[gid] = null; return(null); } if (!table_reader.HasRows) { data[gid] = null; table_reader.Close(); table_reader.Dispose(); return(null); } if (!table_reader.Read()) { data[gid] = null; table_reader.Close(); table_reader.Dispose(); return(null); } oneData = new DBElementEquipGoodsItem(); oneData.Gid = DBTextResource.ParseUI(GetReaderString(table_reader, "gid")); oneData.Pos = DBTextResource.ParseUI(GetReaderString(table_reader, "type")); oneData.LvStep = DBTextResource.ParseUI(GetReaderString(table_reader, "lv_step")); oneData.Star = DBTextResource.ParseUI(GetReaderString(table_reader, "star")); oneData.StrenthenLimit = DBTextResource.ParseUI(GetReaderString(table_reader, "strength_limit")); oneData.Exp = DBTextResource.ParseUI(GetReaderString(table_reader, "exp")); List <List <uint> > basicAttrs = DBTextResource.ParseArrayUintUint(GetReaderString(table_reader, "attrs")); oneData.BasicAttrs = new ActorAttribute(); for (var i = 0; i < basicAttrs.Count; i++) { oneData.BasicAttrs.Add(basicAttrs[i][0], basicAttrs[i][1]); } List <List <uint> > legendAttrs = DBTextResource.ParseArrayUintUint(GetReaderString(table_reader, "legend_attrs")); if (legendAttrs.Count > 0 && legendAttrs[0].Count > 0) { oneData.LegendAttrId = legendAttrs[0][0]; } else { oneData.LegendAttrId = 0; } data[gid] = oneData; table_reader.Close(); table_reader.Dispose(); return(oneData); }
protected override void ParseData(SqliteDataReader reader) { mInfos.Clear(); mSortInfos.Clear(); DBDataAllSkill db_all_skill = DBManager.Instance.GetDB <DBDataAllSkill>(); DBStigmaInfo info; if (reader != null) { if (reader.HasRows == true) { while (reader.Read()) { info = new DBStigmaInfo(); info.Id = DBTextResource.ParseUI_s(GetReaderString(reader, "id"), 0); info.Name = GetReaderString(reader, "name"); info.Quality = DBTextResource.ParseUI_s(GetReaderString(reader, "quality"), 0); // 品质 info.CostGoodsId = DBTextResource.ParseUI_s(GetReaderString(reader, "cost"), 0); //消耗的物品ID info.Exp = DBTextResource.ParseUI_s(GetReaderString(reader, "exp"), 0); //每次获得经验 info.Rank = DBTextResource.ParseUI_s(GetReaderString(reader, "rank"), 0); //排序规则 info.Actor_id = DBTextResource.ParseUI_s(GetReaderString(reader, "actor_id"), 0); //角色ID info.ModelLocalPos = DBTextResource.ParseVector3(GetReaderString(reader, "model_local_pos")); info.ModelLocalScale = DBTextResource.ParseVector3(GetReaderString(reader, "model_local_scale")); info.ModelLocalAngles = DBTextResource.ParseVector3(GetReaderString(reader, "model_local_angles")); info.ModelParentDefaultAngles = DBTextResource.ParseVector3(GetReaderString(reader, "model_parent_default_angles")); info.ModelParentLocalPos = DBTextResource.ParseVector3(GetReaderString(reader, "model_parent_local_pos")); info.Icon = GetReaderString(reader, "icon"); //图标 List <List <uint> > skills_str_array = DBTextResource.ParseArrayUintUint(GetReaderString(reader, "skills")); //玩家技能列表(主键是玩家职业) info.PlayerSkills = new Dictionary <uint, List <DBStigmaSkillItemSkillItem> >(); skills_str_array = DBTextResource.ParseArrayUintUint(GetReaderString(reader, "skills")); for (int index = 0; index < skills_str_array.Count; ++index) { if (skills_str_array[index].Count >= 2) { uint skill_id = skills_str_array[index][0]; DBDataAllSkill.AllSkillInfo skill_info = db_all_skill.GetOneAllSkillInfo(skill_id); if (skill_info != null) { uint vocation = skill_info.Require_race; DBStigmaSkillItemSkillItem tmp_DBStigmaSkillItemSkillItem = new DBStigmaSkillItemSkillItem(); tmp_DBStigmaSkillItemSkillItem.skill_id = skill_id; tmp_DBStigmaSkillItemSkillItem.open_level = skills_str_array[index][1]; if (info.PlayerSkills.ContainsKey(vocation) == false) { info.PlayerSkills.Add(vocation, new List <DBStigmaSkillItemSkillItem>()); } info.PlayerSkills[vocation].Add(tmp_DBStigmaSkillItemSkillItem); } else { GameDebug.LogError(string.Format("Can't find the DBAllSkill = {0}", skill_id)); } } else { GameDebug.LogError(string.Format("There is error player_skills (id = {0}) in DBStigma", info.Id)); } } if (info.PlayerSkills.ContainsKey(DBDataAllSkill.CommonVocationType)) { foreach (var item in info.PlayerSkills) { if (item.Key == DBDataAllSkill.CommonVocationType) { continue; } item.Value.AddRange(info.PlayerSkills[DBDataAllSkill.CommonVocationType]); } } mInfos.Add(info.Id, info); mSortInfos.Add(info); } } } mSortInfos.Sort((a, b) => { if (a.Rank < b.Rank) { return(-1); } else if (a.Rank > b.Rank) { return(1); } return(0); }); }
protected override void ParseData(SqliteDataReader reader) { mInfos.Clear(); mOpenSkillInfos.Clear(); DBDataAllSkill db_all_skill = DBManager.Instance.GetDB <DBDataAllSkill>(); DBPetFetterItem info; if (reader != null) { if (reader.HasRows == true) { while (reader.Read()) { info = new DBPetFetterItem(); info.PetId = DBTextResource.ParseUI_s(GetReaderString(reader, "id"), 0); info.Index = DBTextResource.ParseUI_s(GetReaderString(reader, "index"), 0); info.Condition = new List <DBPet.UnLockPrePetCondition>(); List <List <uint> > str_array = DBTextResource.ParseArrayUintUint(GetReaderString(reader, "condition")); if (str_array != null) { for (int index = 0; index < str_array.Count; ++index) { if (str_array[index] != null && str_array[index].Count >= 2) { DBPet.UnLockPrePetCondition condition = new DBPet.UnLockPrePetCondition(); condition.pet_id = str_array[index][0]; condition.step_level = str_array[index][1]; info.Condition.Add(condition); } } } info.Attr = DBTextResource.ParseDBAttrItems(GetReaderString(reader, "attr")); List <uint> skill_array = DBTextResource.ParseArrayUint(GetReaderString(reader, "skills"), ","); info.Skills = new Dictionary <uint, List <FetterSkillItem> >(); if (skill_array != null) { for (int index = 0; index < skill_array.Count; ++index) { FetterSkillItem item = new FetterSkillItem(); item.skill_id = skill_array[index]; DBDataAllSkill.AllSkillInfo skill_info = db_all_skill.GetOneAllSkillInfo(item.skill_id); uint vocation = 0; if (skill_info != null) { vocation = skill_info.Require_race; } item.vocation = vocation; if (info.Skills.ContainsKey(item.vocation) == false) { info.Skills.Add(item.vocation, new List <FetterSkillItem>()); } info.Skills[item.vocation].Add(item); mOpenSkillInfos[item.skill_id] = info; } } if (info.Skills.ContainsKey(DBDataAllSkill.CommonVocationType)) { foreach (var item in info.Skills) { if (item.Key == DBDataAllSkill.CommonVocationType) { continue; } item.Value.AddRange(info.Skills[DBDataAllSkill.CommonVocationType]); } } if (mInfos.ContainsKey(info.PetId) == false) { mInfos.Add(info.PetId, new List <DBPetFetterItem>()); } mInfos[info.PetId].Add(info); } } } foreach (var item in mInfos) { item.Value.Sort((a, b) => { if (a.Index < b.Index) { return(-1); } else if (a.Index > b.Index) { return(1); } return(0); }); } }
protected override void ParseData(SqliteDataReader reader) { mInfos.Clear(); mSortInfos.Clear(); mEvolutionIds.Clear(); DBDataAllSkill db_all_skill = DBManager.Instance.GetDB <DBDataAllSkill>(); PetInfo info; if (reader != null) { if (reader.HasRows == true) { while (reader.Read()) { info = new PetInfo(); info.Id = DBTextResource.ParseUI_s(GetReaderString(reader, "id"), 0); info.Desc = GetReaderString(reader, "desc"); //说明 info.UnlockType = (PetUnLockType)DBTextResource.ParseUI_s(GetReaderString(reader, "unlock_type"), 0); //解锁方式 if (info.UnlockType == PetUnLockType.PlayerLevel) { info.UnlockPlayerLevel = DBTextResource.ParseUI_s(GetReaderString(reader, "unlock_condition"), 0); //解锁条件 } else if (info.UnlockType == PetUnLockType.CostGoods) { info.UnLockGoodsConditionArray = new List <UnLockGoodsCondition>(); List <List <uint> > str_array = DBTextResource.ParseArrayUintUint(GetReaderString(reader, "unlock_condition")); for (int index = 0; index < str_array.Count; ++index) { if (str_array[index].Count >= 2) { UnLockGoodsCondition tmp_item = new UnLockGoodsCondition(); tmp_item.goods_id = str_array[index][0]; tmp_item.goods_num = str_array[index][1]; info.UnLockGoodsConditionArray.Add(tmp_item); } else { GameDebug.LogError(string.Format("There is error unlock_condition (id = {0}) in data_pet", info.Id)); } } } else if (info.UnlockType == PetUnLockType.PrePetDegree) { List <uint> str_array = DBTextResource.ParseArrayUint(GetReaderString(reader, "unlock_condition"), ","); if (str_array != null && str_array.Count >= 2) { info.UnLockPrePetConditionData = new UnLockPrePetCondition(); info.UnLockPrePetConditionData.pet_id = str_array[0]; info.UnLockPrePetConditionData.step_level = str_array[1]; } else { GameDebug.LogError(string.Format("There is error unlock_condition (id = {0}) in data_pet", info.Id)); } } else if (info.UnlockType == PetUnLockType.EvolutionReplace) { info.PreIdInEvolution = DBTextResource.ParseUI_s(GetReaderString(reader, "unlock_condition"), 0); info.HasCheckEvolution = false; info.FirstPetIdInEvolution = 0; } else { } info.Unlock_desc = GetReaderString(reader, "unlock_desc"); //解锁说明 info.Rank = DBTextResource.ParseUI_s(GetReaderString(reader, "rank"), 0); //排序规则 info.Actor_id = DBTextResource.ParseUI_s(GetReaderString(reader, "actor_id"), 0); //角色ID info.Quality = DBTextResource.ParseUI_s(GetReaderString(reader, "quality"), 1); //品质 info.MaxQual = DBTextResource.ParseUI_s(GetReaderString(reader, "max_qual"), 1); //最高升品 info.MaxStep = DBTextResource.ParseUI_s(GetReaderString(reader, "max_step"), 1); //最高升阶 info.Head_icon = GetReaderString(reader, "head_icon"); // 头像 info.ModelCameraOffset = DBTextResource.ParseVector3(GetReaderString(reader, "model_camera_offset")); info.ModelCameraOffsetInfo = DBTextResource.ParseVector3(GetReaderString(reader, "model_camera_offset_info")); info.ModelCameraRotate = DBTextResource.ParseVector3(GetReaderString(reader, "model_camera_rotate")); info.ModelDefaultAngle = DBTextResource.ParseVector3(GetReaderString(reader, "model_default_angle")); info.ModelCameraOffset2 = DBTextResource.ParseVector3(GetReaderString(reader, "model_camera_offset_2")); info.ModelCameraOffset3 = DBTextResource.ParseVector3(GetReaderString(reader, "model_camera_offset_3")); info.ModelLocalPos = DBTextResource.ParseVector3(GetReaderString(reader, "model_local_pos")); info.ModelLocalScale = DBTextResource.ParseVector3(GetReaderString(reader, "model_local_scale")); info.ModelLocalAngles = DBTextResource.ParseVector3(GetReaderString(reader, "model_local_angles")); info.ModelLocalPos2 = DBTextResource.ParseVector3(GetReaderString(reader, "model_local_pos2")); info.ModelLocalScale2 = DBTextResource.ParseVector3(GetReaderString(reader, "model_local_scale2")); info.ModelShowModelOffset = DBTextResource.ParseVector3(GetReaderString(reader, "model_show_model_offset")); info.ModelShowCameraRotation = DBTextResource.ParseVector3(GetReaderString(reader, "model_show_camera_rotation")); info.ModelShowCameraOffset = DBTextResource.ParseVector3(GetReaderString(reader, "model_show_camera_offset")); info.ModelShowScale = DBTextResource.ParseVector3(GetReaderString(reader, "model_show_scale")); //技能列表 info.AllSkills = new List <PetSkillItem>(); info.Skills = new List <PetSkillItem>(); info.PassivitySkills = new List <PetSkillItem>(); List <List <uint> > skills_str_array = DBTextResource.ParseArrayUintUint(GetReaderString(reader, "skills")); for (int index = 0; index < skills_str_array.Count; ++index) { if (skills_str_array[index].Count >= 2) { PetSkillItem tmp_PetSkillItem = new PetSkillItem(); tmp_PetSkillItem.skill_id = skills_str_array[index][0]; tmp_PetSkillItem.open_degree = skills_str_array[index][1]; info.AllSkills.Add(tmp_PetSkillItem); DBDataAllSkill.AllSkillInfo skill_info = db_all_skill.GetOneAllSkillInfo(tmp_PetSkillItem.skill_id); if (skill_info != null) { if (skill_info.SkillType == DBDataAllSkill.SKILL_TYPE.Active) { info.Skills.Add(tmp_PetSkillItem); } else if (skill_info.SkillType == DBDataAllSkill.SKILL_TYPE.Passive) { info.PassivitySkills.Add(tmp_PetSkillItem); } } else { GameDebug.LogError(string.Format("[DBPet] can't find the skill! pet_id = {0} skill_id = {1}", info.Id, tmp_PetSkillItem.skill_id)); } } else { GameDebug.LogError(string.Format("There is error skills (id = {0}) in data_pet", info.Id)); } } //玩家技能 info.PlayerSkills = new Dictionary <uint, List <PetSkillItem> >(); skills_str_array = DBTextResource.ParseArrayUintUint(GetReaderString(reader, "player_skills")); for (int index = 0; index < skills_str_array.Count; ++index) { if (skills_str_array[index].Count >= 2) { PetSkillItem tmp_PetSkillItem = new PetSkillItem(); tmp_PetSkillItem.skill_id = skills_str_array[index][0]; tmp_PetSkillItem.open_degree = skills_str_array[index][1]; DBDataAllSkill.AllSkillInfo skill_info = db_all_skill.GetOneAllSkillInfo(tmp_PetSkillItem.skill_id); uint vocation = 0; if (skill_info != null) { vocation = skill_info.Require_race; } if (info.PlayerSkills.ContainsKey(vocation) == false) { info.PlayerSkills.Add(vocation, new List <PetSkillItem>()); } info.PlayerSkills[vocation].Add(tmp_PetSkillItem); } else { GameDebug.LogError(string.Format("There is error player_skills (id = {0}) in data_pet", info.Id)); } } if (info.PlayerSkills.ContainsKey(DBDataAllSkill.CommonVocationType)) { foreach (var item in info.PlayerSkills) { if (item.Key == DBDataAllSkill.CommonVocationType) { continue; } item.Value.AddRange(info.PlayerSkills[DBDataAllSkill.CommonVocationType]); } } //info.Icon = GetReaderString(reader, "icon"); mInfos.Add(info.Id, info); mSortInfos.Add(info); } } } int no_deal_evolution_count = 0; while (true) { no_deal_evolution_count = 0; foreach (var item in mInfos) { if (item.Value.UnlockType != PetUnLockType.EvolutionReplace) { continue; } if (item.Value.HasCheckEvolution) { continue;//已经处理过 } if (item.Value.PreIdInEvolution == 0) {//第一个进化的ID uint first_pet_id = item.Value.Id; mEvolutionIds[first_pet_id] = new List <uint>(); mEvolutionIds[first_pet_id].Add(item.Value.Id); item.Value.HasCheckEvolution = true; item.Value.FirstPetIdInEvolution = first_pet_id; } else if (mInfos.ContainsKey(item.Value.PreIdInEvolution) && mInfos[item.Value.PreIdInEvolution].HasCheckEvolution) {//非第一个进化的ID且前置进化ID已经计算过 uint first_pet_id = mInfos[item.Value.PreIdInEvolution].FirstPetIdInEvolution; mEvolutionIds[first_pet_id].Add(item.Value.Id); item.Value.HasCheckEvolution = true; item.Value.FirstPetIdInEvolution = first_pet_id; } else//后续循环处理 { no_deal_evolution_count++; } } if (no_deal_evolution_count <= 0) { break; } } mSortInfos.Sort((a, b) => { if (a.Rank < b.Rank) { return(-1); } else if (a.Rank > b.Rank) { return(1); } if (a.Id < b.Id) { return(-1); } else if (a.Id > b.Id) { return(1); } return(0); }); }