protected override void ParseData(SqliteDataReader reader) { if (reader == null || !reader.HasRows) { return; } while (reader.Read()) { DBSoulHoleItem ad = new DBSoulHoleItem(); ad.hole_id = DBTextResource.ParseUI(GetReaderString(reader, "hole_id")); ad.open_cond = DBTextResource.ParseUI(GetReaderString(reader, "open_cond")); string str_inlay_type = GetReaderString(reader, "inlay_type"); if (string.IsNullOrEmpty(str_inlay_type)) { ad.inlay_type = new List <uint>(); } else { ad.inlay_type = DBTextResource.ParseArrayUint(str_inlay_type, ","); } data.Add(ad.hole_id, ad); for (int i = 0; i < ad.inlay_type.Count; i++) { limitedList.Add(ad.inlay_type[i]); } } }
EquipAttrData ReadInfo(SqliteDataReader reader) { var id = GetReaderUint(reader, "id"); var base_g = GetReaderFloat(reader, "val"); // DBTextResource.ParseUI(GetReaderString(reader, "val"),0.0f); var sub_attr_id = DBTextResource.ParseUI(GetReaderString(reader, "sub_attr_id")); var attr_color_type = GetReaderString(reader, "attr_color_type"); var matchs = Regex.Matches(attr_color_type, @"\{(\d+),(\d+)\}"); List <ValueRange> attr_color_types = new List <ValueRange>(); foreach (Match _match in matchs) { if (_match.Success) { uint min = (DBTextResource.ParseUI(_match.Groups[1].Value)); uint max = DBTextResource.ParseUI(_match.Groups[2].Value); ValueRange value = new ValueRange(min, max); attr_color_types.Add(value); } } var attr_data = new EquipAttrData(id, sub_attr_id, base_g, attr_color_types); attr_data.AttrId = DBTextResource.ParseUI(GetReaderString(reader, "attr")); attr_data.ArgsStr = GetReaderString(reader, "args"); attr_data.Args = DBTextResource.ParseArrayUint(attr_data.ArgsStr, ","); return(attr_data); }
/// <summary> /// 背包物品中是否有增加货币的物品 /// </summary> /// <returns></returns> public bool HasAddMoneyGoods(uint moneyId) { foreach (var goods in ItemManager.Instance.BagGoodsOids.Values) { if (goods == null) { continue; } if (goods is GoodsEquip) // 不需要判断装备物品 { continue; } if (goods.effect == "add_money") { List <uint> arg = DBTextResource.ParseArrayUint(goods.arg, ","); if (arg.Count >= 2) { if (moneyId == arg[0] && arg[1] > 0) { return(true); } } } } return(false); }
protected override void ParseData(SqliteDataReader reader) { mInfos.Clear(); DBPassiveSkillInfo info; if (reader != null) { if (reader.HasRows == true) { while (reader.Read()) { info = new DBPassiveSkillInfo(); info.Id = DBTextResource.ParseUI_s(GetReaderString(reader, "id"), 0); if (info.Id == 0) { continue; } info.Exotics = DBTextResource.ParseArrayUint(GetReaderString(reader, "exotics"), ","); if (mInfos.ContainsKey(info.Id) == false) { mInfos.Add(info.Id, info); } } } } }
protected override void ParseData(SqliteDataReader reader) { if (mDeadSpaceLvInfos != null) { mDeadSpaceLvInfos.Clear(); if (reader != null) { while (reader.Read()) { DeadSpaceLvInfo info = new DeadSpaceLvInfo(); info.Id = DBTextResource.ParseUI(GetReaderString(reader, "id")); info.Score = DBTextResource.ParseUI(GetReaderString(reader, "score")); info.mRewards = DBTextResource.ParseArrayUint(GetReaderString(reader, "reward"), ","); info.Name = GetReaderString(reader, "name"); info.Grid = DBTextResource.ParseUI(GetReaderString(reader, "grid")); mDeadSpaceLvInfos.Add(info.Id, info); } } } mMaxScoreDeadSpaceLvInfo = null; }
DialogInfo GetItemInfo(uint id) { string query = string.Format("SELECT * FROM {0} WHERE {0}.{1}=\"{2}\"", mTableName, "id", id); var reader = DBManager.Instance.ExecuteSqliteQueryToReader(GlobalConfig.DBFile, mTableName, query); if (reader == null) { mDialogInfos[id] = null; return(null); } if (!reader.HasRows || !reader.Read()) { mDialogInfos[id] = null; reader.Close(); reader.Dispose(); return(null); } DialogInfo info = new DialogInfo(); info.mId = id; info.mType = (EDialogType)System.Enum.Parse(typeof(EDialogType), GetReaderString(reader, "type")); info.mDialogs = DBTextResource.ParseArrayUint(GetReaderString(reader, "dialogs"), ","); info.mAutoRunTime = DBTextResource.ParseUI_s(GetReaderString(reader, "auto_tun_time"), 0); mDialogInfos.Add(info.mId, info); reader.Close(); reader.Dispose(); return(info); }
protected override void ParseData(SqliteDataReader reader) { mGemHoleInfos.Clear(); GemHoleInfo gemHoleInfo = null; if (reader != null) { if (reader.HasRows == true) { while (reader.Read()) { gemHoleInfo = new GemHoleInfo(); gemHoleInfo.Pos = DBTextResource.ParseBT_s(GetReaderString(reader, "pos"), 0); gemHoleInfo.HoleId = DBTextResource.ParseBT_s(GetReaderString(reader, "hole_id"), 0); gemHoleInfo.CsvId = string.Format("{0}_{1}", gemHoleInfo.Pos, gemHoleInfo.HoleId); gemHoleInfo.LvStepLimit = DBTextResource.ParseUI_s(GetReaderString(reader, "lv_step_limit"), 0); gemHoleInfo.VipLimit = DBTextResource.ParseUI_s(GetReaderString(reader, "vip_limit"), 0); gemHoleInfo.GemList = DBTextResource.ParseArrayUint(GetReaderString(reader, "gem_list"), ","); #if UNITY_EDITOR if (mGemHoleInfos.ContainsKey(gemHoleInfo.CsvId)) { GameDebug.LogError(string.Format("[{0}]表重复添加的域id[{1}]", mTableName, gemHoleInfo.CsvId)); continue; } #endif mGemHoleInfos.Add(gemHoleInfo.CsvId, gemHoleInfo); } } } }
protected override void ParseData(SqliteDataReader reader) { if (reader == null || !reader.HasRows) { return; } while (reader.Read()) { DBMagicItem ad = new DBMagicItem(); ad.Id = DBTextResource.ParseUI(GetReaderString(reader, "id")); ad.SortId = DBTextResource.ParseI(GetReaderString(reader, "sort")); ad.Name = GetReaderString(reader, "name"); ad.IconName = GetReaderString(reader, "icon_name"); ad.Color = DBTextResource.ParseUI(GetReaderString(reader, "color")); ad.AssistAttrs = DBTextResource.ParseDBAttrItems(GetReaderString(reader, "attrs")); ad.SkillList = DBTextResource.ParseArrayUint(GetReaderString(reader, "skills"), ","); data.Add(ad.Id, ad); SortData.Add(ad); } SortData.Sort((a, b) => { if (a.SortId < b.SortId) { return(-1); } else if (a.SortId > b.SortId) { return(1); } return(0); }); }
Notice GetItemInfo(uint id) { string query = string.Format("SELECT * FROM {0} WHERE {0}.{1}=\"{2}\"", mTableName, "id", id); var reader = DBManager.Instance.ExecuteSqliteQueryToReader(GlobalConfig.DBFile, mTableName, query); if (reader == null) { mNoticeDict[id] = null; return(null); } if (!reader.HasRows || !reader.Read()) { mNoticeDict[id] = null; reader.Close(); reader.Dispose(); return(null); } Notice notice = new Notice(); notice.Id = id; notice.Template = GetReaderString(reader, "content"); notice.ShowChannels = DBTextResource.ParseArrayUint(GetReaderString(reader, "channel"), ","); notice.MinLv = DBTextResource.ParseUI_s(GetReaderString(reader, "min_lv"), 0); notice.MaxLv = DBTextResource.ParseUI_s(GetReaderString(reader, "max_lv"), 0); mNoticeDict.Add(notice.Id, notice); reader.Close(); reader.Dispose(); return(notice); }
/// <summary> /// 获取某个机器人的信息 /// </summary> /// <returns>The instance info.</returns> /// <param name="id">Identifier.</param> public ShemaleInfo GetShemaleInfo(uint id) { ShemaleInfo info = null; if (mShemaleInfos.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) { mShemaleInfos.Add(id, null); return(null); } if (!table_reader.HasRows) { mShemaleInfos.Add(id, null); table_reader.Close(); table_reader.Dispose(); return(null); } if (!table_reader.Read()) { mShemaleInfos.Add(id, null); table_reader.Close(); table_reader.Dispose(); return(null); } info = new ShemaleInfo(); info.Id = GetReaderUint(table_reader, "id"); info.Rid = DBTextResource.ParseUI_s(GetReaderString(table_reader, "rid"), 0); info.Shows = DBTextResource.ParseArrayUint(GetReaderString(table_reader, "show"), ","); #if UNITY_EDITOR if (mShemaleInfos.ContainsKey(info.Id)) { GameDebug.LogError(string.Format("[{0}]表重复添加的域id[{1}]", mTableName, info.Id)); return(info); } #endif mShemaleInfos.Add(info.Id, info); table_reader.Close(); table_reader.Dispose(); return(info); }
public uint GetDefaultScore() { //用最大的属性值计算默认评分 string temp = ArgsStr.Replace('[', '\0'); temp = temp.Replace(']', '\0'); temp = temp.Replace('{', '\0'); temp = temp.Replace('}', '\0'); List <uint> parseList = DBTextResource.ParseArrayUint(temp, ",", false); List <uint> attrValue = new List <uint>(); attrValue.Add(parseList[parseList.Count - 1]); return(GetScore(attrValue)); }
public static List <uint> ParseArrayUintAndUint(string arrayString, string del) { List <uint> list = null; if (arrayString.Contains("[")) { list = DBTextResource.ParseArrayUint(arrayString, del); } else { list = new List <uint>(); uint value = DBTextResource.ParseUI(arrayString); list.Add(value); } return(list); }
protected override void ParseData(SqliteDataReader reader) { mInfos.Clear(); if (reader != null) { if (reader.HasRows == true) { while (reader.Read()) { uint id = DBTextResource.ParseUI_s(GetReaderString(reader, "id"), 0); List <uint> parentIds = DBTextResource.ParseArrayUint(GetReaderString(reader, "parentIds"), ","); AddRedPointData(id, parentIds); } } } }
/// <summary> /// 获取指定搜索名字对应的物品ID /// </summary> /// <param name="name"></param> /// <returns></returns> public List <uint> GetGidArray(string name) { List <uint> info = null; if (mInfos.TryGetValue(name, out info)) { return(info); } else { string query_str = string.Format("SELECT {0}.{1} FROM {0} WHERE {0}.{2}=\"{3}\"", "goods_name_index", "gid", "name", name); var table_reader = DBManager.Instance.ExecuteSqliteQueryToReader(GlobalConfig.GoodsNameDBFile, "goods_name_index", query_str); if (table_reader == null) { mInfos[name] = null; return(null); } if (!table_reader.HasRows) { mInfos[name] = null; table_reader.Close(); table_reader.Dispose(); return(null); } if (!table_reader.Read()) { mInfos[name] = null; table_reader.Close(); table_reader.Dispose(); return(null); } var gid = GetReaderString(table_reader, "gid"); info = DBTextResource.ParseArrayUint(gid, ",", false); mInfos[name] = info; table_reader.Close(); table_reader.Dispose(); return(info); } }
public LightWeaponSoul GetData(uint GID) { if (data.ContainsKey(GID)) { return(data[GID]); } string query = string.Format("SELECT * FROM {0} WHERE {0}.{1}=\"{2}\"", mTableName, "id", 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 soul = new LightWeaponSoul(); soul.GID = DBTextResource.ParseUI_s(GetReaderString(reader, "id"), 0); List <uint> Pos = DBTextResource.ParseArrayUint(GetReaderString(reader, "position"), ","); soul.Pos_Type = Pos[0]; soul.Pos_Index = Pos[1]; var Resolve = DBTextResource.ParseArrayUint(GetReaderString(reader, "break"), ","); soul.ResolveType = Resolve[0]; soul.ResolveAmount = Resolve[1]; soul.BasicAttrs = DBTextResource.ParseDictionaryUintUint(GetReaderString(reader, "base_attrs")); data[GID] = soul; reader.Close(); reader.Dispose(); return(soul); }
public DBGuildTotemItem GetOneItem(uint lv) { DBGuildTotemItem info; if (mInfos.TryGetValue(lv, out info)) { return(info); } string query = string.Format("SELECT * FROM {0} WHERE {0}.{1}=\"{2}\"", mTableName, "lv", lv); var reader = DBManager.Instance.ExecuteSqliteQueryToReader(GlobalConfig.DBFile, mTableName, query); if (reader == null) { mInfos[lv] = null; return(null); } if (!reader.HasRows || !reader.Read()) { mInfos[lv] = null; reader.Close(); reader.Dispose(); return(null); } info = new DBGuildTotemItem(); info.Lv = DBTextResource.ParseUI_s(GetReaderString(reader, "lv"), 0); info.Exp = DBTextResource.ParseUL_s(GetReaderString(reader, "exp"), 0); info.Buffs = DBTextResource.ParseArrayUint(GetReaderString(reader, "buffs"), ","); info.Descs = DBTextResource.ParseArrayString(GetReaderString(reader, "descs")); info.NextOffsetDescs = DBTextResource.ParseArrayString(GetReaderString(reader, "next_offset_descs")); mInfos.Add(info.Lv, info); reader.Close(); reader.Dispose(); return(info); }
protected override void ParseData(SqliteDataReader reader) { mInfos.Clear(); DBEquipPosItem info; if (reader != null) { if (reader.HasRows == true) { while (reader.Read()) { info = new DBEquipPosItem(); info.PosId = DBTextResource.ParseUI_s(GetReaderString(reader, "pos"), 0); info.Name = GetReaderString(reader, "name"); info.PosType = (EquipPosType)DBTextResource.ParseUI_s(GetReaderString(reader, "type"), 0); info.CanStrength = DBTextResource.ParseUI_s(GetReaderString(reader, "can_strength"), 0) == 1; //能否强化 info.CanBaptize = DBTextResource.ParseUI_s(GetReaderString(reader, "can_baptize"), 0) == 1; //能否洗练 info.CanInlay = DBTextResource.ParseUI_s(GetReaderString(reader, "can_inlay"), 0) == 1; //能否镶嵌宝石 info.CanSuit = DBTextResource.ParseUI_s(GetReaderString(reader, "can_suit"), 0) == 1; //能否锻造套装 info.CanCastSoul = DBTextResource.ParseUI_s(GetReaderString(reader, "can_cast_soul"), 0) == 1; //能否铸魂 info.SortId = DBTextResource.ParseUI_s(GetReaderString(reader, "sort_id"), 0); info.CanBaptizeLv = DBTextResource.ParseUI_s(GetReaderString(reader, "can_baptize_lv"), 0); //可洗练需要的等级 info.CanAutoRecycle = DBTextResource.ParseUI_s(GetReaderString(reader, "can_auto_recycle"), 0) == 1; //能否自动置入回收 info.CanEngrave = DBTextResource.ParseUI_s(GetReaderString(reader, "can_engrave"), 0) == 1; //能否镶嵌铭刻 info.EngraveAtrrsDesc = GetReaderString(reader, "engrave_attrs_desc"); info.EngraveShowAttrIds = DBTextResource.ParseArrayUint(GetReaderString(reader, "engrave_show_attrs")); mInfos[info.PosId] = info; } } } }
Dictionary <uint, HookGoodsSettingInfo> ReadHookSettingGoodsInfos(string tableName, HookGoodsSettingInfo.ECondition condition) { Dictionary <uint, HookGoodsSettingInfo> hookSettingGoodsInfos = new Dictionary <uint, HookGoodsSettingInfo>(); hookSettingGoodsInfos.Clear(); List <Dictionary <string, string> > datas = DBManager.Instance.QuerySqliteTable <string>(GlobalConfig.DBFile, tableName); foreach (Dictionary <string, string> row in datas) { HookGoodsSettingInfo hookSettingGoodsInfo = new HookGoodsSettingInfo(); foreach (KeyValuePair <string, string> kv in row) { if (kv.Key == "id") { hookSettingGoodsInfo.Id = DBTextResource.ParseUI_s(kv.Value, 0); } else if (kv.Key == "condition") { hookSettingGoodsInfo.Condition = (HookGoodsSettingInfo.ECondition)DBTextResource.ParseUI_s(kv.Value, 0); } else if (kv.Key == "type") { hookSettingGoodsInfo.Type = (HookGoodsSettingInfo.EType)DBTextResource.ParseUI_s(kv.Value, 0); } else if (kv.Key == "param") { switch (hookSettingGoodsInfo.Type) { case HookGoodsSettingInfo.EType.OtherAll: { break; } case HookGoodsSettingInfo.EType.GoodsIds: { hookSettingGoodsInfo.Params = DBTextResource.ParseArrayUint(kv.Value, ","); break; } case HookGoodsSettingInfo.EType.GoodsType: { hookSettingGoodsInfo.Params = DBTextResource.ParseArrayUint(kv.Value, ","); break; } case HookGoodsSettingInfo.EType.EquipCertainColor: { hookSettingGoodsInfo.Params = new List <uint>(); hookSettingGoodsInfo.Params.Clear(); hookSettingGoodsInfo.Params.Add(DBTextResource.ParseUI_s(kv.Value, 0)); break; } case HookGoodsSettingInfo.EType.EquipUponCertainColor: { hookSettingGoodsInfo.Params = new List <uint>(); hookSettingGoodsInfo.Params.Clear(); hookSettingGoodsInfo.Params.Add(DBTextResource.ParseUI_s(kv.Value, 0)); break; } case HookGoodsSettingInfo.EType.EquipPoses: { hookSettingGoodsInfo.Params = DBTextResource.ParseArrayUint(kv.Value, ","); break; } default: break; } } else if (kv.Key == "name") { hookSettingGoodsInfo.Name = kv.Value; } } hookSettingGoodsInfo.IsOn = true; if (condition == hookSettingGoodsInfo.Condition) { hookSettingGoodsInfos.Add(hookSettingGoodsInfo.Id, hookSettingGoodsInfo); } } return(hookSettingGoodsInfos); }
public void UpdateSoul() { if (BasicAttrs == null) { BasicAttrs = new ActorAttribute(); } BasicAttrs.Clear(); CurLvHaveVal = 0; if (Lv >= 2) { for (int i = 1; i < Lv; i++) { string csv_id = string.Format("{0}_{1}", type_idx, i); var info = DBSoulLv.Instance.GetData(csv_id); if (info != null) { CurLvHaveVal += info.cream; } } } string key = string.Format("{0}_{1}", type_idx, Lv); SetAttribute(key, BasicAttrs, true); if (MaxBasicAttrs == null) { MaxBasicAttrs = new ActorAttribute(); } MaxBasicAttrs.Clear(); var data_soul_list = DBManager.Instance.QuerySqliteLikeKeyRow <string>(GlobalConfig.DBFile, "data_soul", "gid", type_idx.ToString()); if (data_soul_list.Count <= 0) { GameDebug.LogError("不存在该武魂id" + type_idx.ToString()); return; } var data_soul = data_soul_list[0]; MaxLv = DBTextResource.ParseUI(data_soul["max_lv"]); Tips = data_soul["tips"]; mSoulType = DBTextResource.ParseUI(data_soul["type"]); if (data_soul["s_type"].Contains("[")) { mTypeList = DBTextResource.ParseArrayUint(data_soul["s_type"], ","); } else { mTypeList = new List <uint>(); uint value = DBTextResource.ParseUI(data_soul["s_type"]); mTypeList.Add(value); } key = string.Format("{0}_{1}", type_idx, MaxLv); SetAttribute(key, MaxBasicAttrs, false); IsMaxLv = MaxLv == Lv; string oriDes = GoodsHelper.GetGoodsDescriptionByTypeId(type_idx); if (isShowAttr) { base.description = GetShowDetailText(); } else { base.description = oriDes; } }
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); }
/// <summary> /// 获取奖励item列表 /// </summary> /// <returns>The reward item list.</returns> /// <param name="rewardId">Reward identifier.</param> public List <RewardInfo> GetRewardItemList(uint rewardId) { List <RewardInfo> rewardList = new List <RewardInfo>(); rewardList.Clear(); if (mRewardInfosList == null) { mRewardInfosList = new Dictionary <uint, List <RewardInfo> >(); mRewardInfosList.Clear(); } if (mRewardInfosList.ContainsKey(rewardId) == true) { foreach (RewardInfo rewardInfo in mRewardInfosList[rewardId]) { rewardList.Add(rewardInfo); } } else { List <RewardInfo> rewardInfos = new List <RewardInfo>(); rewardInfos.Clear(); //string queryStr = string.Format("SELECT * FROM {0} WHERE {0}.{1} LIKE \"{2}__\"", "reward", "item_id", rewardId); //List<Dictionary<string, string>> rows = DBManager.Instance.QuerySqliteRow<string>(GlobalConfig.DBFile, queryStr, true); List <Dictionary <string, string> > rows = DBManager.Instance.QuerySqliteRow <string>(GlobalConfig.DBFile, "reward", "cid", rewardId.ToString()); if (rows.Count > 0) { foreach (Dictionary <string, string> row in rows) { RewardInfo rewardInfo = new RewardInfo(); string raw = string.Empty; row.TryGetValue("item_id", out raw); uint itemId = DBTextResource.ParseUI_s(raw, 0); rewardInfo.mItemID = itemId; row.TryGetValue("gid", out raw); uint gid = DBTextResource.ParseUI_s(raw, 0); rewardInfo.mGID = gid; row.TryGetValue("num", out raw); long num = 0; if (long.TryParse(raw, out num) == false) { List <long> nums = DBTextResource.ParseArrayLong(raw, ","); if (nums.Count > 0) { rewardInfo.mFixedNum = nums[0]; rewardInfo.mNum = nums[0]; } else { rewardInfo.mFixedNum = num; rewardInfo.mNum = num; } } else { rewardInfo.mFixedNum = num; rewardInfo.mNum = num; } row.TryGetValue("race", out raw); byte race = DBTextResource.ParseBT_s(raw, 0); rewardInfo.mVocation = race; row.TryGetValue("is_lv_eff", out raw); byte isLvEff = DBTextResource.ParseBT_s(raw, 0); rewardInfo.mEffectByLevel = isLvEff; row.TryGetValue("lv_limit", out raw); rewardInfo.mLvLimit = DBTextResource.ParseArrayUint(raw, ","); row.TryGetValue("is_bind", out raw); rewardInfo.mIsBind = DBTextResource.ParseUI_s(raw, 0); row.TryGetValue("sys_open", out raw); rewardInfo.mOpenSysId = DBTextResource.ParseUI_s(raw, 0); row.TryGetValue("show_color_effect2", out raw); if (string.IsNullOrEmpty(raw) == true || raw.Equals("0") == true) { rewardInfo.mShowColorEffect2 = false; } else { rewardInfo.mShowColorEffect2 = true; } rewardInfos.Add(rewardInfo); } } foreach (RewardInfo rewardInfo in rewardInfos) { rewardList.Add(rewardInfo); } mRewardInfosList.Add(rewardId, rewardInfos); } // 删除不是本职业的奖励 for (int i = rewardList.Count - 1; i >= 0; i--) { if (rewardList[i].mVocation != 0 && (uint)rewardList[i].mVocation != LocalPlayerManager.Instance.LocalActorAttribute.Vocation) { rewardList.Remove(rewardList[i]); } } if (rewardList == null) { rewardList = new List <RewardInfo>(); rewardList.Clear(); } return(rewardList); }
protected override void ParseData(SqliteDataReader reader) { if (reader == null || !reader.HasRows) { return; } SysConfig config = null; while (reader.Read()) { var id = DBTextResource.ParseUI(GetReaderString(reader, "sys_id")); config = new SysConfig(id); var sys_title = GetReaderString(reader, "sys_title"); var level = DBTextResource.ParseUS_s(GetReaderString(reader, "lv_open"), 0); string taskTypeStr = GetReaderString(reader, "task_limit"); if (string.IsNullOrEmpty(taskTypeStr)) { taskTypeStr = "0"; } var task_type = (ESysTaskType)Enum.Parse(typeof(ESysTaskType), taskTypeStr); var task_id = DBTextResource.ParseUI_s(GetReaderString(reader, "task_args"), 0); string positionStr = GetReaderString(reader, "position"); if (string.IsNullOrEmpty(positionStr)) { positionStr = "0"; } var pos = (ESysBtnPos)Enum.Parse(typeof(ESysBtnPos), positionStr); uint sub_pos = DBTextResource.ParseUI_s(GetReaderString(reader, "sub_pos"), 0); string fixedPosStr = GetReaderString(reader, "fixed_pos"); if (string.IsNullOrEmpty(fixedPosStr)) { fixedPosStr = "0"; } var is_fixed = (ESysBtnFixType)DBTextResource.ParseUI_s(fixedPosStr, 1); bool show_bg = DBTextResource.ParseUI_s(GetReaderString(reader, "show_bg"), 0) == 1; uint is_activity = DBTextResource.ParseUI_s(GetReaderString(reader, "is_activity"), 0); var desc = GetReaderString(reader, "desc"); var btn_sprite = GetReaderString(reader, "btn_spr"); var btn_text = GetReaderString(reader, "btn_text"); var sort_order = DBTextResource.ParseBT_s(GetReaderString(reader, "sort_order"), 0); var transfer_limit = DBTextResource.ParseUI_s(GetReaderString(reader, "transfer_limit"), 0); var not_open_tips = GetReaderString(reader, "not_open_tips"); var main_ui_btn_id = DBTextResource.ParseUI_s(GetReaderString(reader, "main_ui_btn_id"), 0); config.Init(level, task_type, task_id, pos, sub_pos, is_fixed, show_bg, is_activity == 1, desc, btn_sprite, btn_text, sort_order, transfer_limit, not_open_tips, sys_title, main_ui_btn_id); config.NeedAnim = DBTextResource.ParseUI_s(GetReaderString(reader, "is_need_anim"), 0) == 0 ? false : true; if (pos == ESysBtnPos.NONE) // 当在主ui上没有按钮图标的时候,也一定不需要播放开启的动画 { if (config.NeedAnim) { config.NeedAnim = false; GameDebug.LogError(string.Format("sys:{0} 在主ui上没有图标, 却配置了开启动画", id)); } } config.InitNeedShow = DBTextResource.ParseUI_s(GetReaderString(reader, "is_need_show"), 0) == 0 ? false : true; config.PatchId = DBTextResource.ParseI_s(GetReaderString(reader, "patch_id"), 0); config.HideBtnWhenActNotOpen = DBTextResource.ParseUI_s(GetReaderString(reader, "hide_btn_when_act_not_open"), 0) == 0 ? false : true; config.SysIdClosePresent = DBTextResource.ParseUI_s(GetReaderString(reader, "sys_id_close_present"), 0); // 如果有系统开放关联配置,需要将数据存在另外的字典中 if (config.SysIdClosePresent != 0) { List <uint> notifySysIdList = null; if (!mConfigRelation.TryGetValue(config.SysIdClosePresent, out notifySysIdList)) { notifySysIdList = new List <uint>(); mConfigRelation[config.SysIdClosePresent] = notifySysIdList; } if (!notifySysIdList.Contains(config.Id)) { notifySysIdList.Add(config.Id); } } config.TabOrder = DBTextResource.ParseUI_s(GetReaderString(reader, "tab_order"), 0); config.DropDown = DBTextResource.ParseArrayUint(GetReaderString(reader, "drop_down"), ","); config.DropDownType = DBTextResource.ParseUI(GetReaderString(reader, "drop_down_type")); config.UIBehavior = DBTextResource.ParseArrayString(GetReaderString(reader, "ui_behavior")); config.TimeLimitStr = GetReaderString(reader, "time_limit"); config.CustomCondition = DBTextResource.ParseUI_s(GetReaderString(reader, "custom_condition"), 0) == 0 ? false : true; mConfigList.Add(config); mConfigMap[config.Id] = config; } mConfigList.Sort(); }
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); }); } }
/// <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); } } } }
/// <summary> /// 根据TypeId返回默认Goods /// </summary> public virtual Goods SetIdFindData(uint _id) { this.type_idx = _id; var goods_info = GoodsHelper.GetGoodsInfo(_id); if (goods_info != null) { this.sub_type = goods_info.sub_type; this.effect = goods_info.effect; this.mRawName = goods_info.name; this.name = string.Format("{0}{1}</color>", GoodsHelper.GetGoodsColor(goods_info.color_type), goods_info.name); bool is_special_desc = false; if (goods_info.effect == "reward_group")//经验和金币类的礼包类的描述需要额外显示 { List <uint> reward_group_id_array = DBTextResource.ParseArrayUint(goods_info.arg); if (reward_group_id_array != null) { DBRewardGroup db_reward_group = DBManager.Instance.GetDB <DBRewardGroup>(); for (int index = 0; index < reward_group_id_array.Count; ++index) { uint reward_group_id = reward_group_id_array[index]; DBRewardGroup.DBRewardGroupInfo group_info = db_reward_group.GetOneDBRewardGroupInfo(reward_group_id); if (group_info != null && (group_info.IsCoinReward || group_info.IsExpReward)) { m_group_info = group_info; is_special_desc = true; } } } } else if (goods_info.effect == "add_lv_exp")//等级经验丹 { List <uint> arg_array = DBTextResource.ParseArrayUint(goods_info.arg, ","); if (arg_array != null && arg_array.Count >= 2) { uint level = arg_array[0]; //直接升级的等级 uint reward_id = arg_array[1]; //奖励ID m_level_in_add_lv_exp = level; DBRewardGroup.DBRewardGroupInfo group_info = new DBRewardGroup.DBRewardGroupInfo(); group_info.RewardId = reward_id; if (group_info != null && (group_info.IsCoinReward || group_info.IsExpReward)) { m_group_info = group_info; is_special_desc = true; } } } string des = goods_info.desc; this.src_description = goods_info.desc; if (des.CompareTo("") != 0 && is_special_desc == false) { if (des[0] == '"') { this.description = des.Substring(1, des.Length - 2); } else { this.description = des; } } this.arg = goods_info.arg; this.use_lv = goods_info.use_lv; this.use_job = goods_info.use_job; this.use_transfer = goods_info.use_transfer; this.gain_text = goods_info.gain_text; this.cd_id = goods_info.cd_id; this.is_mutil_use = goods_info.is_mutil_use == 1 ? true : false; this.gain_from = goods_info.gain_from; uint is_quick_int = goods_info.is_quick; if (is_quick_int == 0) { this.is_quickuse = false; } else { this.is_quickuse = true; } if (is_quick_int == 2) { this.is_quickuse_autoUse = true; } else { this.is_quickuse_autoUse = false;//是否快速使用(有倒计时) } if (is_quick_int == 3) { this.is_quickuse_always = true; } else { this.is_quickuse_always = false; } this.is_sell_confirmation = goods_info.is_confirmation == 1 ? true : false; this.client_use = goods_info.client_use; //暂时没有子类型 //this.sub_type = DBTextResource.ParseUI(data["sub_type"]); this.color_type = goods_info.color_type; this.icon_id = goods_info.icon_id; this.sort_id = goods_info.sort_id; this.sort_top = goods_info.sort_top; this.recycle_price = goods_info.sell_price; if (goods_info.is_show == 0) { this.tips_show = false; } else { this.tips_show = true; } this.price_recommend = goods_info.price_recommend; this.price_lower_limit = goods_info.price_lower_limit; this.price_upper_limit = goods_info.price_upper_limit; this.mktype_1 = goods_info.mktype_1; this.mktype_2 = goods_info.mktype_2; this.daily_use_limit = goods_info.daily_use_limit; this.guild_wpoint = goods_info.guild_wpoint; this.max_stack = goods_info.max_stack; this.is_display_goods = goods_info.is_display_goods == 1; this.show_step = goods_info.show_step; uint tmpl_is_bind = goods_info.bind; if (tmpl_is_bind == 1) { mGoodsTmplIsBind = true; } this.bind = tmpl_is_bind; this.wing_exp = goods_info.wing_exp; this.expire_time_inTmpl = goods_info.expire_time; this.is_precious = goods_info.is_precious; this.discount = goods_info.discount; this.overdue_notice_time = goods_info.overdue_notice_time; } return(this); }
public static NpcDefine MakeNpcDefine(uint npcId) { if (mNpcDefineCache == null) { mNpcDefineCache = new Dictionary <uint, NpcDefine>(); mNpcDefineCache.Clear(); } if (mNpcDefineCache.ContainsKey(npcId) == true) { return(mNpcDefineCache[npcId]); } NpcDefine define = new NpcDefine(); define.NpcId = npcId; var dbs = DBManager.Instance.QuerySqliteRow <string>(GlobalConfig.DBFile, "npc", "npc_id", npcId.ToString()); if (dbs.Count <= 0) { GameDebug.LogError("Error in MakeNpcDefine, can not find npc data by id " + npcId); return(null); } var dbNpc = dbs[0]; if (dbNpc.Count <= 0) { return(null); } if (dbNpc.Count > 0) { dbNpc.TryGetValue("idle_ani", out define.IdleAni); dbNpc.TryGetValue("const_title", out define.ConstTitle); dbNpc.TryGetValue("const_text", out define.ConstText); dbNpc.TryGetValue("const_btn_text", out define.ConstBtnText); dbNpc.TryGetValue("const_btn_pic", out define.ConstBtnPic); string rawData = string.Empty; dbNpc.TryGetValue("actor_id", out rawData); uint.TryParse(rawData, out define.ActorId); dbNpc.TryGetValue("light_mode", out rawData); if (string.IsNullOrEmpty(rawData) == true || rawData.Equals("0")) { define.LightMode = NpcDefine.ELightMode.ROLE; } else { uint lightModeUint = 0; uint.TryParse(rawData, out lightModeUint); define.LightMode = (NpcDefine.ELightMode)lightModeUint; } dbNpc.TryGetValue("radius", out rawData); float.TryParse(rawData, out define.Radius); dbNpc.TryGetValue("function", out rawData); define.Function = (NpcDefine.EFunction)System.Enum.Parse(typeof(NpcDefine.EFunction), rawData); define.FunctionParams.Clear(); int i = 1; bool ret = dbNpc.TryGetValue("param" + i, out rawData); while (ret) { define.FunctionParams.Add(rawData); ++i; ret = dbNpc.TryGetValue("param" + i, out rawData); } dbNpc.TryGetValue("voice", out rawData); define.VoiceIds = DBTextResource.ParseArrayUint(rawData, ","); } mNpcDefineCache.Add(npcId, define); return(define); }
public override void ParseClientGoodsStr_inner(Dictionary <string, string> param_dict) { base.ParseClientGoodsStr_inner(param_dict); if (NetEquip == null) { NetEquip = new Net.PkgGoodsInfo(); } if (NetEquip.equip == null) { NetEquip.equip = new Net.PkgEquip(); } if (NetEquip.equip.legend_attrs != null) { NetEquip.equip.legend_attrs.Clear(); } if (NetEquip.equip.extra_attrs != null) { NetEquip.equip.extra_attrs.Clear(); } LegendAttrs.Clear(); if (param_dict.ContainsKey("LegendAttrs")) {//传奇属性 string legend_str = param_dict["LegendAttrs"]; var matches = Regex.Matches(legend_str, @"(\d+),\[([\d|,]+)\]"); foreach (System.Text.RegularExpressions.Match _match in matches) { if (_match.Success) { uint attr_id = 0; if (uint.TryParse(_match.Groups[1].Value, out attr_id) == false) { continue; } List <uint> attr_uint_list = DBTextResource.ParseArrayUint(_match.Groups[2].Value, ",", false); if (attr_uint_list == null || attr_uint_list.Count == 0) { continue; } LegendAttrs.Add(attr_id, attr_uint_list); } } } ExtraAttrs.Clear(); if (param_dict.ContainsKey("ExtraAttrs")) {//额外属性 string legend_str = param_dict["ExtraAttrs"]; var matches = Regex.Matches(legend_str, @"(\d+),(\d+)"); foreach (System.Text.RegularExpressions.Match _match in matches) { if (_match.Success) { uint attr_id = 0; if (uint.TryParse(_match.Groups[1].Value, out attr_id) == false) { continue; } uint attr_num = 0; if (uint.TryParse(_match.Groups[2].Value, out attr_num) == false) { continue; } ExtraAttrs.Add(attr_id, attr_num); } } } if (IsHasIdentifyWing() && param_dict.ContainsKey("color_type")) { uint var_color_type = 0; if (uint.TryParse(param_dict["color_type"], out var_color_type)) { this.color_type = var_color_type; //装备的品质 } } }
uint CalcTargetNum(uint instanceId, string targetStr) { uint targetNum = 0; Neptune.Data levelData = xc.Dungeon.LevelManager.Instance.LoadLevelFileTemporary(SceneHelp.GetFirstStageId(instanceId)); if (levelData == null) { return(targetNum); } if (targetStr == "kill_all") { Dictionary <int, Neptune.BaseGenericNode> monsters = levelData.GetData <Neptune.MonsterBase>().Data; foreach (var monsterBase in monsters.Values) { if (monsterBase is Neptune.Monster) { ++targetNum; } else if (monsterBase is Neptune.MonsterGroup) { Neptune.MonsterGroup monsterGroup = (Neptune.MonsterGroup)monsterBase; DBMonster dbMonster = DBManager.Instance.GetDB <DBMonster>(); DBMonster.MonsterInfo monsterInfo = dbMonster.GetMonsterInfo(monsterGroup.ExcelId); if (monsterInfo != null) { targetNum += monsterInfo.Num; } } } } else { var matchs = System.Text.RegularExpressions.Regex.Matches(targetStr, @"\{kill,(\S+)\}"); foreach (System.Text.RegularExpressions.Match match in matchs) { if (match.Success) { List <uint> ids = DBTextResource.ParseArrayUint(match.Groups[1].Value, ","); foreach (uint id in ids) { Dictionary <int, Neptune.BaseGenericNode> monsters = levelData.GetData <Neptune.MonsterBase>().Data; foreach (var monsterBase in monsters.Values) { if (monsterBase.Id == id) { if (monsterBase is Neptune.Monster) { ++targetNum; } else if (monsterBase is Neptune.MonsterGroup) { Neptune.MonsterGroup monsterGroup = (Neptune.MonsterGroup)monsterBase; DBMonster dbMonster = DBManager.Instance.GetDB <DBMonster>(); DBMonster.MonsterInfo monsterInfo = dbMonster.GetMonsterInfo(monsterGroup.ExcelId); if (monsterInfo != null) { targetNum += monsterInfo.Num; } } } } } } } } return(targetNum); }
InstanceTypeInfo GetItemInfo(uint warType, uint warSubType) { uint key = MakeKey(warType, warSubType); var war_type = ""; if (warType == GameConst.WAR_TYPE_DUNGEON) { war_type = "WAR_TYPE_DUNGEON"; } else if (warType == GameConst.WAR_TYPE_WILD) { war_type = "WAR_TYPE_WILD"; } var war_sub_type = DBInstanceType.Instance.GetInstanceType(warSubType); string query = string.Format("SELECT * FROM {0} WHERE {0}.{1}=\"{2}\" AND {0}.{3}=\"{4}\"", mTableName, "war_type", war_type, "war_subtype", war_sub_type); var reader = DBManager.Instance.ExecuteSqliteQueryToReader(GlobalConfig.DBFile, mTableName, query); if (reader == null) { mInstanceTypeControls[key] = null; return(null); } if (!reader.HasRows || !reader.Read()) { mInstanceTypeControls[key] = null; reader.Close(); reader.Dispose(); return(null); } var info = new InstanceTypeInfo(); info.m_WarType = warType; info.m_WarSubType = warSubType; info.m_PrecedentPlayer = DBTextResource.ParseUI_s(GetReaderString(reader, "precedent_player"), 0) == 1; info.m_CannotHidePlayer = DBTextResource.ParseUI_s(GetReaderString(reader, "cannot_hide_player"), 0) == 1; info.m_PKLevelLimit = DBTextResource.ParseUI_s(GetReaderString(reader, "pk_lv_limit"), 0) == 1; info.m_UsePKMode = DBTextResource.ParseUI_s(GetReaderString(reader, "use_pk_mode"), 0) == 1; info.m_NoShowAtkCampTips = DBTextResource.ParseUI_s(GetReaderString(reader, "no_show_atk_camp_tips"), 0) == 1; info.m_IgnoreClickPlayer = DBTextResource.ParseUI_s(GetReaderString(reader, "ignore_click_player"), 0) == 1; info.m_ForceShowHpBar = DBTextResource.ParseUI_s(GetReaderString(reader, "force_show_hp_bar"), 0) == 1; info.m_ForbidUseGoodsTypes = DBTextResource.ParseArrayKeyValuePairUintUint(GetReaderString(reader, "forbid_use_goods_types")); info.m_ForbidChangePk = DBTextResource.ParseUI_s(GetReaderString(reader, "forbid_change_pk"), 0) == 1; info.m_ShowDanmakuChatChannels = DBTextResource.ParseArrayUint(GetReaderString(reader, "show_danmaku_switch"), ","); info.m_ForbidOpenWorldMap = DBTextResource.ParseUI_s(GetReaderString(reader, "forbid_open_world_map"), 0) == 1; info.m_HideHpBar = DBTextResource.ParseUI_s(GetReaderString(reader, "hide_hp_bar"), 0) == 1; info.m_HideCamp = DBTextResource.ParseUI_s(GetReaderString(reader, "hide_camp"), 0) == 1; info.m_ForbidPet = DBTextResource.ParseUI_s(GetReaderString(reader, "forbid_pet"), 0) == 1; info.m_HideTeam = DBTextResource.ParseUI_s(GetReaderString(reader, "hide_team"), 0) == 1; info.m_ForbidTeam = DBTextResource.ParseUI_s(GetReaderString(reader, "forbid_team"), 0) == 1; info.m_HidePvpHpBar = DBTextResource.ParseUI_s(GetReaderString(reader, "hide_pvp_hp_bar"), 0) == 1; info.m_AutoPickDrop = DBTextResource.ParseUI_s(GetReaderString(reader, "auto_pick_drop"), 0) == 1; info.m_IsShowAutoFightingGotExp = DBTextResource.ParseUI_s(GetReaderString(reader, "is_show_auto_fighting_got_exp"), 0) == 1; info.m_ActId = DBTextResource.ParseUI_s(GetReaderString(reader, "act_id"), 0); info.m_ExitTips = GetReaderString(reader, "exit_tips"); info.m_is_can_exit = DBTextResource.ParseUI_s(GetReaderString(reader, "is_can_exit"), 0) == 1; info.m_ForbidJumpOutAnimationOut = DBTextResource.ParseUI_s(GetReaderString(reader, "forbid_jump_out_animation_out"), 0) == 1; info.m_ForbidJumpOutAnimationIn = DBTextResource.ParseUI_s(GetReaderString(reader, "forbid_jump_out_animation_in"), 0) == 1; info.m_PlayJumpOutAnimationTeamIn = DBTextResource.ParseUI_s(GetReaderString(reader, "play_jump_out_animation_team_in"), 0) == 1; info.m_HideCount = DBTextResource.ParseUI_s(GetReaderString(reader, "hide_count"), 0) == 1; info.m_ForbidElfin = DBTextResource.ParseUI_s(GetReaderString(reader, "forbid_elfin"), 0) == 1; info.m_ForbidMagicPet = DBTextResource.ParseUI_s(GetReaderString(reader, "forbid_magic_pet"), 0) == 1; info.m_hide_guild = DBTextResource.ParseUI_s(GetReaderString(reader, "hide_guild"), 0) == 1; info.m_hide_mate = DBTextResource.ParseUI_s(GetReaderString(reader, "hide_mate"), 0) == 1; info.m_replace_name = GetReaderString(reader, "replace_name"); info.m_BanShortCutWin = DBTextResource.ParseUI_s(GetReaderString(reader, "ban_shortCut_win"), 0) == 1; info.m_BanBossNoticeWin = DBTextResource.ParseUI_s(GetReaderString(reader, "ban_boss_notice_win"), 0) == 1; info.m_BanMarriageNoticeWin = DBTextResource.ParseUI_s(GetReaderString(reader, "ban_marriage_notice_win"), 0) == 1; info.m_NoFlyShoe = DBTextResource.ParseUI_s(GetReaderString(reader, "no_fly_shoe"), 0) == 1; info.m_AutoCollect = DBTextResource.ParseUI_s(GetReaderString(reader, "auto_collect"), 0) == 1; info.m_DoNotPatrol = DBTextResource.ParseUI_s(GetReaderString(reader, "do_not_patrol"), 0) == 1; info.m_ShowServerName = DBTextResource.ParseUI_s(GetReaderString(reader, "show_server_name"), 0) == 1; info.m_ClearCd = DBTextResource.ParseUI_s(GetReaderString(reader, "clear_cd"), 0) == 1; info.m_MinPlayerCount = DBTextResource.ParseUI_s(GetReaderString(reader, "min_player_count"), 0); mInstanceTypeControls[key] = info; reader.Close(); reader.Dispose(); return(info); }