public static List <Dictionary <uint, float> > GetRecommendAttrByVocation(uint vocation) { List <Dictionary <uint, float> > finalList = new List <Dictionary <uint, float> >(); List <string> lvpoint_recommend = DBManager.Instance.QuerySqliteField <string>(GlobalConfig.DBFile, "lvpoint_recommend", "vocation", vocation.ToString(), "recommend_attr"); if (lvpoint_recommend.Count == 0) { return(finalList); } string raw = lvpoint_recommend[0]; raw = raw.Replace(" ", ""); var matchs = Regex.Matches(raw, @"\{(\d+),(\d+)\}"); foreach (Match _match in matchs) { if (_match.Success) { Dictionary <uint, float> list = new Dictionary <uint, float>(); uint id = (DBTextResource.ParseUI(_match.Groups[1].Value)); var value = (DBTextResource.ParseF(_match.Groups[2].Value) / 100.0f); list.Add(id, value); finalList.Add(list); } } return(finalList); }
/// <summary> /// 角色加点取系数 /// </summary> /// <param name="key"></param> /// <returns></returns> public static Dictionary <uint, float> GetAddProperty(string key) { List <string> data_attr_conv = DBManager.Instance.QuerySqliteField <string>(GlobalConfig.DBFile, "data_attr_conv", "csv_id", key, "client_attrs"); if (data_attr_conv.Count == 0) { return(null); } string raw = data_attr_conv[0]; raw = raw.Replace(" ", ""); var matchs = Regex.Matches(raw, @"\{(\d+),(\d+)\}"); Dictionary <uint, float> list = new Dictionary <uint, float>(); foreach (Match _match in matchs) { if (_match.Success) { uint id = (DBTextResource.ParseUI(_match.Groups[1].Value)); var value = (DBTextResource.ParseF(_match.Groups[2].Value) / 100.0f); list.Add(id, value); } } return(list); }
protected override void ParseData(SqliteDataReader reader) { if (reader == null || !reader.HasRows) { return; } mInfos.Clear(); mSortInfos.Clear(); while (reader.Read()) { var tmp_info = new TrialBossItem(); tmp_info.DgnId = DBTextResource.ParseUI(GetReaderString(reader, "dgn_id")); //副本ID tmp_info.TrialType = DBTextResource.ParseUI(GetReaderString(reader, "type")); tmp_info.Rank = DBTextResource.ParseUI(GetReaderString(reader, "rank")); tmp_info.ActorId = DBTextResource.ParseUI(GetReaderString(reader, "actor_id")); tmp_info.ShowAward = DBTextResource.ParseDBGoodsItem(GetReaderString(reader, "show_award")); tmp_info.ShowAssistAward = DBTextResource.ParseDBGoodsItem(GetReaderString(reader, "show_assist_award")); tmp_info.ModelCameraOffset = DBTextResource.ParseVector3(GetReaderString(reader, "model_camera_offset")); tmp_info.DefaultAngles = DBTextResource.ParseVector3(GetReaderString(reader, "default_angles")); tmp_info.CameraViewField = DBTextResource.ParseF(GetReaderString(reader, "camera_view_field")); tmp_info.CameraRotate = DBTextResource.ParseVector3(GetReaderString(reader, "camera_rotate")); tmp_info.DefaultActionName = GetReaderString(reader, "default_action_name"); tmp_info.Icon = GetReaderString(reader, "icon"); if (mInfos.ContainsKey(tmp_info.DgnId) == false) { mInfos.Add(tmp_info.DgnId, tmp_info); if (mSortInfos.ContainsKey(tmp_info.TrialType) == false) { mSortInfos.Add(tmp_info.TrialType, new List <TrialBossItem>()); } mSortInfos[tmp_info.TrialType].Add(tmp_info); } else { GameDebug.LogError("DBTrialBoss contain the same info; Dgn_id = " + tmp_info.DgnId); } } foreach (var item in mSortInfos) { mSortInfos[item.Key].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) { if (reader == null || !reader.HasRows) { return; } while (reader.Read()) { DBFootprintItem ad = new DBFootprintItem(); ad.Id = DBTextResource.ParseUI(GetReaderString(reader, "id")); ad.EffectFile = GetReaderString(reader, "effect_file"); ad.LowEffectFile = GetReaderString(reader, "low_effect_file"); ad.DelayTime = DBTextResource.ParseF(GetReaderString(reader, "delay_time")); ad.CDTime = DBTextResource.ParseF(GetReaderString(reader, "cd_time")); ad.MinDistance = DBTextResource.ParseF(GetReaderString(reader, "min_distance")); data.Add(ad.Id, ad); } }
public static void ResponseClickEmojiTextHref(string origText) { if (origText.Contains("goodsOid")) { string idStr = origText.Replace("goodsOid=", ""); var matchs = Regex.Matches(idStr, @"\{(\d+),(\d+)\}"); foreach (Match _match in matchs) { if (_match.Success) { uint sendId = (DBTextResource.ParseUI(_match.Groups[1].Value)); ulong goodsOid = DBTextResource.ParseUL_s(_match.Groups[2].Value, 0); Net.C2STalkGoods pack = new Net.C2STalkGoods(); pack.uuid = sendId; pack.oid = goodsOid; //GameDebug.LogError("=============== OnClickHref test"); Net.NetClient.GetBaseClient().SendData <Net.C2STalkGoods>(xc.protocol.NetMsg.MSG_TALK_GOODS, pack); } } //兼容3个参数和2个参数 matchs = Regex.Matches(idStr, @"\{(\d+),(\d+),(\d+)\}"); foreach (Match _match in matchs) { if (_match.Success) { uint sendId = (DBTextResource.ParseUI(_match.Groups[1].Value)); ulong goodsOid = DBTextResource.ParseUL_s(_match.Groups[2].Value, 0); ulong goodsGid = DBTextResource.ParseUL_s(_match.Groups[3].Value, 0); Net.C2STalkGoods pack = new Net.C2STalkGoods(); pack.uuid = sendId; pack.oid = goodsOid; pack.gid = (uint)goodsGid; Net.NetClient.GetBaseClient().SendData <Net.C2STalkGoods>(xc.protocol.NetMsg.MSG_TALK_GOODS, pack); } } } else if (origText.Contains("teamId")) { var idStr = origText.Replace("teamId=", ""); var teamId = uint.Parse(idStr); TeamManager.Instance.Apply(teamId); } else if (origText.Contains("playerId")) {//查看玩家 var idStr = origText.Replace("playerId=", ""); List <string> param_list = DBTextResource.ParseArrayString(idStr, ";"); if (param_list.Count >= 5) { // 不能查看玩家自己的信息 if (param_list[0].Equals(LocalPlayerManager.Instance.LocalActorAttribute.UnitId.obj_idx.ToString()) == false) { Dictionary <string, string> playerInfo = new Dictionary <string, string>(); playerInfo.Clear(); playerInfo.Add("uuid", param_list[0]); xc.ui.ugui.UIManager.Instance.ShowWindow("UIWatchPlayerWindow", playerInfo); } } else { GameDebug.LogError("playerId param is error! idStr = " + idStr); } } else if (origText.Contains("jumpSysId=")) {//跳转系统ID var idStr = origText.Replace("jumpSysId=", ""); List <string> param_list = DBTextResource.ParseArrayString(idStr, ";"); if (param_list.Count >= 1) { uint sys_id = 0; if (uint.TryParse(param_list[0], out sys_id)) { if (LuaScriptMgr.Instance != null) { XLua.LuaFunction func = LuaScriptMgr.Instance.GetLuaFunction(LuaScriptMgr.Instance.Lua.Global, "GotoSysRouter_chatItem"); if (func != null) { func.Action(param_list); } } } } else { GameDebug.LogError("jumpSysId param is error! idStr = " + idStr); } } else if (origText.Contains("clientGoodsTips")) {//客户端拼凑的物品TIPS string idStr = origText; //var idStr = origText.Replace("clientGoodsTips=", ""); var matchs = Regex.Matches(origText, @"clientGoodsTips=\{(.+)\}"); foreach (Match _match in matchs) { if (_match.Success) { idStr = _match.Groups[1].Value; } } Goods item_info = xc.GoodsHelper.ParseClientGoodsStr(idStr); if (item_info != null) { GoodsHelper.ShowGoodsTips(item_info, null, null, "GuildWarehouseNormal"); } else { GameDebug.LogError("playerId param is error! idStr = " + idStr); } } else if (origText.Contains("enter_guild_manor")) {//进入帮派领地 if (SysConfigManager.GetInstance().CheckSysHasOpened(GameConst.SYS_OPEN_GUILD, true)) { if (LocalPlayerManager.Instance.GuildID > 0) { InstanceHelper.EnterGuildManor(); } else { xc.UINotice.Instance.ShowMessage(xc.TextHelper.GetConstText("CODE_TEXT_LOCALIZATION_77")); xc.ui.ugui.UIManager.GetInstance().ShowSysWindow("UIGuildWindow"); } } } else if (origText.Contains("goodsTips")) {//查看物品 string idStr = origText.Replace("goodsTips=", ""); var matchs = Regex.Matches(idStr, @"\{(\d+),(\d+)\}"); foreach (Match _match in matchs) { if (_match.Success) { uint sendId = (DBTextResource.ParseUI(_match.Groups[1].Value)); ulong goodsOid = DBTextResource.ParseUL_s(_match.Groups[2].Value, 0); Net.C2STalkGoods pack = new Net.C2STalkGoods(); pack.uuid = sendId; pack.oid = goodsOid; //GameDebug.LogError("=============== OnClickHref test"); Net.NetClient.GetBaseClient().SendData <Net.C2STalkGoods>(xc.protocol.NetMsg.MSG_TALK_GOODS, pack); } } } else if (origText.Contains("goodsGid")) { var matchs = Regex.Matches(origText, @"goodsGid=\{(\d+),(\d+)\}"); foreach (Match _match in matchs) { if (_match.Success) { //uint playerId = (DBTextResource.ParseUI(_match.Groups[1].Value)); uint goodsGid = DBTextResource.ParseUI(_match.Groups[2].Value); var goods = GoodsHelper.CreateGoodsByTypeId(goodsGid); if (goods != null) { GoodsHelper.ShowGoodsTips(goods); } } } } else if (origText.Contains("position=")) { var matchs = Regex.Matches(origText, @"position=\{(\d+),(\d+),(\d+\.?\d*),(\d+\.?\d*)\}"); foreach (Match _match in matchs) { if (_match.Success) { uint instanceId = DBTextResource.ParseUI(_match.Groups[1].Value); uint line = DBTextResource.ParseUI(_match.Groups[2].Value); float x = DBTextResource.ParseF(_match.Groups[3].Value); float z = DBTextResource.ParseF(_match.Groups[4].Value); ClientEventMgr.GetInstance().FireEvent( (int)ClientEvent.CE_CHAT_JUMP_TO_CONST_POSITION, new CEventEventParamArgs(instanceId, line, x, z)); } } } else if (origText.Contains("marketGoodsTips")) { var matchs = Regex.Matches(origText, @"marketGoodsTips=\{(\d+)\}"); foreach (Match _match in matchs) { if (_match.Success) { uint goodsOid = DBTextResource.ParseUI(_match.Groups[1].Value); Net.C2SMarketDetail pack = new Net.C2SMarketDetail(); pack.oid = goodsOid; Net.NetClient.GetBaseClient().SendData <Net.C2SMarketDetail>(xc.protocol.NetMsg.MSG_MARKET_DETAIL, pack); } } } else { ClientEventMgr.GetInstance().FireEvent((int)ClientEvent.CE_CHAT_RESPONSE_CLICK_TEXT_HREF, new CEventEventParamArgs(origText)); } }
/// <summary> /// 获取表格中的技能数据 /// </summary> public SkillInfoSev GetSkillInfo(uint skill_id) { SkillInfoSev skill_info = null; if (!mSkillInfoMap.TryGetValue(skill_id, out skill_info)) { string query_str = string.Format("SELECT * FROM {0} WHERE {0}.{1}=\"{2}\"", "data_skill", "id", skill_id); var table_reader = DBManager.Instance.ExecuteSqliteQueryToReader(GlobalConfig.DBFile, "data_skill", query_str); if (table_reader == null) { mSkillInfoMap[skill_id] = null; return(null); } if (!table_reader.HasRows || !table_reader.Read()) { mSkillInfoMap[skill_id] = null; table_reader.Close(); table_reader.Dispose(); return(null); } skill_info = new SkillInfoSev(); skill_info.Id = DBTextResource.ParseUI(GetReaderString(table_reader, "id")); skill_info.IsPg = DBTextResource.ParseUS_s(GetReaderString(table_reader, "is_pg"), 0) == 1; skill_info.FindTargetType = DBTextResource.ParseUS_s(GetReaderString(table_reader, "find_target"), 1); skill_info.FindTarget = skill_info.FindTargetType != 0; skill_info.TargetLimit = GetReaderString(table_reader, "target_limit"); skill_info.IsTrigger = GetReaderString(table_reader, "action_type") != "active"; skill_info.CDTime = DBTextResource.ParseUI_s(GetReaderString(table_reader, "cd"), 0); skill_info.Range = DBTextResource.ParseUI_s(GetReaderString(table_reader, "range"), 0) * 0.01f - 0.5f; // 因为服务端减少了容错,攻击范围变得更小了,所以这里减0.5 skill_info.Range = Mathf.Max(0f, skill_info.Range); skill_info.MpCost = DBTextResource.ParseI_s(GetReaderString(table_reader, "cost"), 0); skill_info.Target = GetReaderString(table_reader, "target"); skill_info.ForwardSpeed = (float)DBTextResource.ParseI_s(GetReaderString(table_reader, "forward_move_speed"), 0) * 0.01f; skill_info.ForwardTime = (float)DBTextResource.ParseI_s(GetReaderString(table_reader, "forward_move_time"), 0) * GlobalConst.MilliToSecond; skill_info.MaxSingTime = (float)DBTextResource.ParseI_s(GetReaderString(table_reader, "max_sing_time"), 0) * GlobalConst.MilliToSecond; skill_info.CastingSpeed = (float)DBTextResource.ParseI_s(GetReaderString(table_reader, "casting_move_speed"), 0) * 0.01f; skill_info.CastingTime = (float)DBTextResource.ParseI_s(GetReaderString(table_reader, "casting_move_time"), 0) * GlobalConst.MilliToSecond; skill_info.BulletId = DBTextResource.ParseUI_s(GetReaderString(table_reader, "bullet_id"), 0); skill_info.ParentSkillId = DBTextResource.ParseUI_s(GetReaderString(table_reader, "parent_skill"), 0); skill_info.ChildSkillId = DBTextResource.ParseUI_s(GetReaderString(table_reader, "child_skill"), 0); skill_info.AnimationName = GetReaderString(table_reader, "skill_ani"); skill_info.Sound = GetReaderString(table_reader, "skill_sound"); skill_info.CastingReadyName = GetReaderString(table_reader, "skill_sing_ani"); skill_info.CastingAnimationName = GetReaderString(table_reader, "skill_casting_ani"); skill_info.CastingEndAnimationName = GetReaderString(table_reader, "skill_casting_end_ani"); skill_info.RigidityTime = DBTextResource.ParseUS_s(GetReaderString(table_reader, "rigidity_time"), 0) * GlobalConst.MilliToSecond; skill_info.CacheTime = DBTextResource.ParseUS_s(GetReaderString(table_reader, "cache_time"), 0) * GlobalConst.MilliToSecond; skill_info.SkillAnnounce = GetReaderString(table_reader, "skill_announce"); skill_info.CostFury = DBTextResource.ParseUI_s(GetReaderString(table_reader, "cost_fury"), 0); skill_info.GenFury = DBTextResource.ParseUI_s(GetReaderString(table_reader, "gen_fury"), 0); skill_info.IsFalseHitBack = DBTextResource.ParseUS_s(GetReaderString(table_reader, "isFalseHitBack"), 0) == 1; skill_info.UiEffectIconList = DBTextResource.ParseArrayString(GetReaderString(table_reader, "ui_effect_icon_list"), ",", true); skill_info.UiEffectSoundName = GetReaderString(table_reader, "ui_effect_sound"); string[] ratios = TextHelper.GetTupleFromString(GetReaderString(table_reader, "multi_hit_ratio")); if (ratios != null) { skill_info.MultiHitRatios = new List <float>(); for (int j = 0; j < ratios.Length; ++j) { float ratio = DBTextResource.ParseF(ratios[j]); skill_info.MultiHitRatios.Add(ratio); } } string[] delays = TextHelper.GetTupleFromString(GetReaderString(table_reader, "multi_hit_delay")); if (delays != null) { skill_info.MultiHitDelayTimes = new List <float>(); for (int j = 0; j < delays.Length; ++j) { float delay = DBTextResource.ParseF(delays[j]); skill_info.MultiHitDelayTimes.Add(delay); } } if (skill_info.MultiHitDelayTimes != null && skill_info.MultiHitDelayTimes.Count != skill_info.MultiHitRatios.Count) { string log = string.Format("SkillId: {0} 多段伤害系数与延迟时间不匹配", skill_info.Id); Debug.LogError(log); } string[] effects = TextHelper.GetTupleFromString(GetReaderString(table_reader, "effects")); // 先把table_reader关闭,因为在GetBattleFxInfo和GetSkillEffectInfo中需要获取新的Reader table_reader.Close(); table_reader.Dispose(); // 获取技能特效参数 DBBattleFx.BattleFxInfo battleInfo = DBBattleFx.Instance.GetBattleFxInfo(skill_info.Id); if (battleInfo != null) { skill_info.BattleFxInfo = battleInfo; } else { if (skill_info.IsTrigger == false)// 非触发类型的技能才需要战斗效果信息 { GameDebug.LogError(string.Format("Skill: {0}没有对应的战斗效果信息", skill_info.Id)); } } // 追踪目标类型的子弹(依赖于battleInfo,所以要放在battleInfo数据读取之后) if (skill_info.BulletId != 0 && skill_info.IsTrigger == false) { DBBulletTrace.BulletInfo bulletInfo = DBBulletTrace.GetInstance().GetBulletInfo(skill_info.BulletId); if (bulletInfo != null) { skill_info.BulletTrace = new BulletTrackInstance(bulletInfo, skill_info); } } // 获取技能效果参数 if (effects != null) { for (int j = 0; j < effects.Length; ++j) { uint effectId = DBTextResource.ParseUI(effects[j]); var effect_info = DBSkillEffect.GetInstance().GetSkillEffectInfo(effectId); if (effect_info == null) { string log = string.Format("SkillId: {0} 对应的技能效果Id: {1} 错误", skill_info.Id, effectId); Debug.LogError(log); } else { if (effect_info.type == "charge" || effect_info.type == "teleport")// 冲锋、瞬移技能的移动速度参数放在效果表中配置 { skill_info.CastingSpeed = effect_info.p1 * GlobalConst.UnitScale; if (effect_info.type == "teleport") { skill_info.Invisible = true; } } } } } mSkillInfoMap[skill_info.Id] = skill_info; } return(skill_info); }
protected override void ParseData(SqliteDataReader reader) { if (reader == null || !reader.HasRows) { return; } while (reader.Read()) { DBWorldBossItem ad = new DBWorldBossItem(); ad.Id = DBTextResource.ParseUI(GetReaderString(reader, "id")); ad.ShowAward = new List <DBWorldBoss.DBWorldBossRewardItem>(); List <List <string> > award_str_array = DBTextResource.ParseArrayStringString(GetReaderString(reader, "show_award_new")); for (int gid_index = 0; gid_index < award_str_array.Count; ++gid_index) { List <string> one_goods_array = award_str_array[gid_index]; if (one_goods_array.Count < 2) { continue; } uint goods_id = 0; if (uint.TryParse(one_goods_array[0], out goods_id) == false) { continue; } uint goods_num = 0; if (uint.TryParse(one_goods_array[1], out goods_num) == false) { continue; } string reward_type = ""; if (one_goods_array.Count > 2 && one_goods_array[2] != "" && one_goods_array[2] != "0") { reward_type = one_goods_array[2]; } DBWorldBossRewardItem reward_item = new DBWorldBossRewardItem(); reward_item.goods_id = goods_id; reward_item.goods_num = goods_num; reward_item.reward_type = reward_type; ad.ShowAward.Add(reward_item); } ad.MustDropAwardArray = new List <DBWorldBossRewardItem>(); award_str_array = DBTextResource.ParseArrayStringString(GetReaderString(reader, "must_drop_award")); for (int gid_index = 0; gid_index < award_str_array.Count; ++gid_index) { List <string> one_goods_array = award_str_array[gid_index]; if (one_goods_array.Count < 2) { continue; } uint goods_id = 0; if (uint.TryParse(one_goods_array[0], out goods_id) == false) { continue; } uint goods_num = 0; if (uint.TryParse(one_goods_array[1], out goods_num) == false) { continue; } string reward_type = ""; if (one_goods_array.Count > 2 && one_goods_array[2] != "" && one_goods_array[2] != "0") { reward_type = one_goods_array[2]; } DBWorldBossRewardItem reward_item = new DBWorldBossRewardItem(); reward_item.goods_id = goods_id; reward_item.goods_num = goods_num; reward_item.reward_type = reward_type; ad.MustDropAwardArray.Add(reward_item); } //ad.ShowAward = DBTextResource.ParseDBGoodsItem(GetReaderString(reader, "show_award")); ad.Tag = DBTextResource.ParseUI_s(GetReaderString(reader, "tag"), 0); ad.Rank = DBTextResource.ParseUI(GetReaderString(reader, "rank")); ad.ModelCameraOffset = DBTextResource.ParseVector3(GetReaderString(reader, "model_camera_offset")); ad.ModelCameraRotate = DBTextResource.ParseVector3(GetReaderString(reader, "model_camera_rotate")); ad.ModelDefaultAngle = DBTextResource.ParseVector3(GetReaderString(reader, "model_default_angle")); ad.DeathModelCenter = DBTextResource.ParseVector3(GetReaderString(reader, "death_model_center")); ad.DeathModelRadius = DBTextResource.ParseF(GetReaderString(reader, "death_model_radius")); ad.ColorType = DBTextResource.ParseUI_s(GetReaderString(reader, "color_type"), 0); ad.Order = DBTextResource.ParseUI_s(GetReaderString(reader, "order"), 0); data.Add(ad.Id, ad); m_sortData.Add(ad); } m_sortData.Sort((a, b) => { if (a.Rank < b.Rank) { return(-1); } else if (a.Rank > b.Rank) { return(1); } return(0); }); }