public static bool GetNpcFunctionData(GameClient client, int extensionID, NPCData npcData, SystemXmlItem systemNPC) { bool result; if (null == systemNPC) { result = false; } else { string operaIDsByString = systemNPC.GetStringValue("Operations"); operaIDsByString.Trim(); if (operaIDsByString != "") { int[] operaIDsByInt = Global.StringArray2IntArray(operaIDsByString.Split(new char[] { ',' })); if (null == npcData.OperationIDs) { npcData.OperationIDs = new List <int>(); } for (int i = 0; i < operaIDsByInt.Length; i++) { if (!Global.FilterNPCOperationByID(client, operaIDsByInt[i], extensionID)) { npcData.OperationIDs.Add(operaIDsByInt[i]); } } } string scriptIDsByString = systemNPC.GetStringValue("Scripts"); if (null != scriptIDsByString) { scriptIDsByString = scriptIDsByString.Trim(); } if (!string.IsNullOrEmpty(scriptIDsByString)) { int[] scriptIDsByInt = Global.StringArray2IntArray(scriptIDsByString.Split(new char[] { ',' })); if (null == npcData.ScriptIDs) { npcData.ScriptIDs = new List <int>(); } for (int i = 0; i < scriptIDsByInt.Length; i++) { int errorCode = 0; if (!Global.FilterNPCScriptByID(client, scriptIDsByInt[i], out errorCode)) { npcData.ScriptIDs.Add(scriptIDsByInt[i]); } } } result = true; } return(result); }
/// <summary> /// 解析任务奖励 /// </summary> /// <param name="systemTask"></param> private void ParseAwards(SystemXmlItem systemTask, out List <AwardsItemData> taskAwardsList, out List <AwardsItemData> otherAwardsList) { taskAwardsList = otherAwardsList = null; AwardsItemData awardsItem = null; string taskAwardsString = systemTask.GetStringValue("Taskaward").Trim(); if (!string.IsNullOrEmpty(taskAwardsString)) { string[] taskAwardsFields = taskAwardsString.Split('|'); if (null != taskAwardsFields) { taskAwardsList = new List <AwardsItemData>(); for (int i = 0; i < taskAwardsFields.Length; i++) { // 解析任务装备奖励 awardsItem = null; ParseTaskAwardsItem(taskAwardsFields[i], out awardsItem); if (null != awardsItem) { taskAwardsList.Add(awardsItem); } else { LogManager.WriteLog(LogTypes.Error, string.Format("解析任务装备奖励失败: TaskID={0}", systemTask.GetIntValue("ID"))); } } } } string goodsEndTime = systemTask.GetStringValue("GoodsEndTime").Trim(); string otherAwardsString = systemTask.GetStringValue("OtherTaskaward").Trim(); if (!string.IsNullOrEmpty(otherAwardsString)) { string[] otherAwardsFields = otherAwardsString.Split('|'); if (null != otherAwardsFields) { otherAwardsList = new List <AwardsItemData>(); for (int i = 0; i < otherAwardsFields.Length; i++) { // 解析任务装备奖励 awardsItem = null; ParseOtherAwardsItem(otherAwardsFields[i], out awardsItem, goodsEndTime); if (null != awardsItem) { otherAwardsList.Add(awardsItem); } else { LogManager.WriteLog(LogTypes.Error, string.Format("解析任务其他奖励失败: TaskID={0}", systemTask.GetIntValue("ID"))); } } } } }
/// <summary> /// 解析Xml项 /// </summary> /// <param name="systemXmlItem"></param> private static void ParseXmlItem(SystemXmlItem systemXmlItem, List <BroadcastInfoItem> broadcastInfoItemList) { int id = systemXmlItem.GetIntValue("ID"); int infoClass = systemXmlItem.GetIntValue("InfoClass"); int hintErrID = systemXmlItem.GetIntValue("HintErrID"); int timeType = systemXmlItem.GetIntValue("TimeType"); int kaiFuStartDay = systemXmlItem.GetIntValue("StartDay"); int kaiFuShowType = systemXmlItem.GetIntValue("ShowType"); string weekDays = systemXmlItem.GetStringValue("WeekDays"); string times = systemXmlItem.GetStringValue("Times"); string text = systemXmlItem.GetStringValue("Text"); string onlineNotice = systemXmlItem.GetStringValue("OnlineNotice"); int minZhuanSheng = systemXmlItem.GetIntValue("MinZhuanSheng"); int minLevel = systemXmlItem.GetIntValue("MinLevel"); if (string.IsNullOrEmpty(times)) { LogManager.WriteLog(LogTypes.Error, string.Format("解析广播配置表中的时间项失败, ID={0}", id)); return; } BroadcastTimeItem[] broadcastTimeItemArray = ParseBroadcastTimeItems(times); if (null == broadcastTimeItemArray) { LogManager.WriteLog(LogTypes.Error, string.Format("解析广播配置表中的时间项为数组时失败, ID={0}", id)); return; } if (string.IsNullOrEmpty(text)) { LogManager.WriteLog(LogTypes.Error, string.Format("解析广播配置表中的时间项失败, ID={0}", id)); return; } DateTimeRange[] onlineNoticeTimeRanges = Global.ParseDateTimeRangeStr(onlineNotice); BroadcastInfoItem broadcastInfoItem = new BroadcastInfoItem() { ID = id, InfoClass = infoClass, HintErrID = hintErrID, TimeType = timeType, KaiFuStartDay = kaiFuStartDay, KaiFuShowType = kaiFuShowType, WeekDays = weekDays, Times = broadcastTimeItemArray, OnlineNoticeTimeRanges = onlineNoticeTimeRanges, Text = text.Replace(":", ""), //防止出现半角的冒号 MinZhuanSheng = minZhuanSheng, MinLevel = minLevel, }; broadcastInfoItemList.Add(broadcastInfoItem); }
/// <summary> /// 加载参数(4字节赋值,不考虑线程安全) /// </summary> public void LoadParams() { SystemXmlItem systemBattle = null; if (!GameManager.SystemArenaBattle.SystemXmlItemDict.TryGetValue(1, out systemBattle)) { return; } List <string> timePointsList = new List <string>(); string[] fields = null; string timePoints = systemBattle.GetStringValue("TimePoints"); if (null != timePoints && timePoints != "") { fields = timePoints.Split(','); for (int i = 0; i < fields.Length; i++) { timePointsList.Add(fields[i].Trim()); } } TimePointsList = timePointsList; MapCode = systemBattle.GetIntValue("MapCode"); MinChangeLifeLev = systemBattle.GetIntValue("MinZhuanSheng"); MinLevel = systemBattle.GetIntValue("MinLevel"); MinRequestNum = systemBattle.GetIntValue("MinRequestNum"); MaxEnterNum = systemBattle.GetIntValue("MaxEnterNum"); FallGiftNum = systemBattle.GetIntValue("FallGiftNum"); FallID = systemBattle.GetIntValue("FallID"); DisableGoodsIDs = systemBattle.GetStringValue("DisableGoodsIDs"); AddExpSecs = systemBattle.GetIntValue("AddExpSecs"); //20秒到 100秒之间 NotifyBattleKilledNumSecs = Global.GMax(20, Global.GMin(100, systemBattle.GetIntValue("NotifyBattleKilledNumSecs"))); WaitingEnterSecs = systemBattle.GetIntValue("WaitingEnterSecs");; PrepareSecs = systemBattle.GetIntValue("PrepareSecs");; FightingSecs = systemBattle.GetIntValue("FightingSecs");; ClearRolesSecs = systemBattle.GetIntValue("ClearRolesSecs"); BattleLineID = Global.GMax(1, systemBattle.GetIntValue("LineID")); ReloadGiveAwardsGoodsDataList(systemBattle); m_nPushMsgDayID = Global.SafeConvertToInt32(GameManager.GameConfigMgr.GetGameConifgItem(GameConfigNames.PKKingPushMsgDayID)); }
/// <summary> /// 解析装备属性 /// </summary> /// <param name="systemGoods"></param> /// <param name="equipPropItem"></param> private void ParseEquipProps(SystemXmlItem systemGoods, out EquipPropItem equipPropItem) { equipPropItem = null; string props = systemGoods.GetStringValue("EquipProps"); string[] fields = props.Split(','); if (fields.Length != (int)ExtPropIndexes.Max_Configed) //属性个数不符合 { LogManager.WriteLog(LogTypes.Error, string.Format("解析物品属性失败: EquipID={0}", systemGoods.GetIntValue("ID"))); return; } double[] arryDoubles = null; try { arryDoubles = Global.StringArray2DoubleArray(fields); } catch (Exception) { LogManager.WriteLog(LogTypes.Error, string.Format("转换物品属性数组: EquipID={0}", systemGoods.GetIntValue("ID"))); return; } equipPropItem = new EquipPropItem(); //for (int i = 0; i < 5; i++) //{ // equipPropItem.BaseProps[i] = arryDoubles[i]; //} for (int i = 0; i < (int)ExtPropIndexes.Max_Configed; i++) { equipPropItem.ExtProps[i] = arryDoubles[i]; } }
public void ParseEquipProps(SystemXmlItem systemGoods, out EquipPropItem equipPropItem) { equipPropItem = null; string props = systemGoods.GetStringValue("EquipProps"); string[] fields = props.Split(new char[] { ',' }); if (fields.Length != 177) { LogManager.WriteLog(LogTypes.Fatal, string.Format("解析物品属性失败: EquipID={0},EquipProps属性期望个数{1},实际个数{2}", systemGoods.GetIntValue("ID", -1), 177, fields.Length), null, true); } double[] arryDoubles = null; try { arryDoubles = Global.StringArray2DoubleArray(fields); } catch (Exception) { LogManager.WriteLog(LogTypes.Error, string.Format("转换物品属性数组: EquipID={0}", systemGoods.GetIntValue("ID", -1)), null, true); return; } equipPropItem = new EquipPropItem(); int i = 0; while (i < 177 && i < arryDoubles.Length) { equipPropItem.ExtProps[i] = arryDoubles[i]; i++; } }
/// <summary> /// 从lua脚本计算 /// </summary> /// <param name="taskID"></param> /// <param name="itemName"></param> /// <returns></returns> private long CalcLuaScript(GameClient client, int taskID, SystemXmlItem systemTask, string itemName) { if (null == systemTask) { if (!GameManager.SystemTasksMgr.SystemXmlItemDict.TryGetValue(taskID, out systemTask)) { return(-1); } } long ret = -1; string luaScriptFileName = systemTask.GetStringValue(itemName); if (string.IsNullOrEmpty(luaScriptFileName)) { return(ret); } //生成完整的脚本文件路径 luaScriptFileName = AppDomain.CurrentDomain.BaseDirectory + @"scripts/tasks/" + luaScriptFileName; //执行对话脚本 object[] result = Global.ExcuteLuaFunction(client, luaScriptFileName, "calcTaskAwards", null, null); if (null != result && result.Length > 0) { ret = (long)result[0]; } return(ret); }
private static void ParseXmlItem(SystemXmlItem systemXmlItem, List <PopupWinItem> popupWinItemList) { int id = systemXmlItem.GetIntValue("ID", -1); int hintFileID = systemXmlItem.GetIntValue("HintFileID", -1); string times = systemXmlItem.GetStringValue("Times"); if (!string.IsNullOrEmpty(times)) { PopupWinTimeItem[] popupWinTimeItemArray = PopupWinMgr.ParsePopupWinTimeItems(times); if (null == popupWinTimeItemArray) { LogManager.WriteLog(LogTypes.Error, string.Format("解析弹窗配置表中的时间项为数组时失败, ID={0}", id), null, true); } else { PopupWinItem popupWinItem = new PopupWinItem { ID = id, HintFileID = hintFileID, Times = popupWinTimeItemArray }; popupWinItemList.Add(popupWinItem); } } }
private bool CheckSceneCenterState(KarenBattleScene karenBattleScene, KarenCenterConfig center, long nowTicks) { List <object> enemiesObjList = new List <object>(); GameManager.ClientMgr.LookupEnemiesInCircle(karenBattleScene.m_nMapCode, karenBattleScene.CopyMapId, center.PosX, center.PosY, center.Radius, enemiesObjList); Dictionary <int, GameClient> OwnerSideDict = new Dictionary <int, GameClient>(); int newBattleSide = 0; foreach (object item in enemiesObjList) { GameClient client = item as GameClient; if (client.ClientData.CurrentLifeV > 0) { OwnerSideDict[client.ClientData.BattleWhichSide] = client; } } if (OwnerSideDict.Count == 1) { newBattleSide = OwnerSideDict.Keys.FirstOrDefault <int>(); } bool result; if (newBattleSide == 0 || newBattleSide == center.BattleWhichSide) { center.OwnCalculateSide = 0L; center.OwnCalculateTicks = 0L; result = false; } else if (center.OwnCalculateSide != (long)newBattleSide) { center.OwnCalculateSide = (long)newBattleSide; center.OwnCalculateTicks = nowTicks; result = false; } else if (nowTicks - center.OwnCalculateTicks >= (long)(center.OccupyTime * 1000)) { if (center.BattleWhichSide != 0) { karenBattleScene.ScoreData[center.BattleWhichSide - 1].ResourceList.Remove(center.ID); } center.OwnTicksDelta = 0L; center.OwnTicks = nowTicks; center.BattleWhichSide = newBattleSide; karenBattleScene.ScoreData[center.BattleWhichSide - 1].ResourceList.Add(center.ID); GameClient client = OwnerSideDict.Values.FirstOrDefault <GameClient>(); SystemXmlItem systemNPC = null; if (GameManager.SystemNPCsMgr.SystemXmlItemDict.TryGetValue(center.NPCID, out systemNPC)) { string param = systemNPC.GetStringValue("SName"); string param2 = client.ClientData.JunTuanName; KarenBattleManager.getInstance().NtfKarenNotifyMsg(karenBattleScene, KarenNotifyMsgType.Own, client.ClientData.JunTuanId, param, param2); } result = true; } else { result = false; } return(result); }
private long CalcLuaScript(GameClient client, int taskID, SystemXmlItem systemTask, string itemName) { if (null == systemTask) { if (!GameManager.SystemTasksMgr.SystemXmlItemDict.TryGetValue(taskID, out systemTask)) { return(-1L); } } long ret = -1L; string luaScriptFileName = systemTask.GetStringValue(itemName); long result2; if (string.IsNullOrEmpty(luaScriptFileName)) { result2 = ret; } else { luaScriptFileName = DataHelper.CurrentDirectory + "scripts/tasks/" + luaScriptFileName; object[] result = Global.ExcuteLuaFunction(client, luaScriptFileName, "calcTaskAwards", null, null); if (result != null && result.Length > 0) { ret = (long)result[0]; } result2 = ret; } return(result2); }
public void ReloadGiveAwardsGoodsDataList(SystemXmlItem systemBattle = null) { if (null == systemBattle) { if (!GameManager.SystemArenaBattle.SystemXmlItemDict.TryGetValue(1, out systemBattle)) { return; } } List <GoodsData> goodsDataList = new List <GoodsData>(); string giveGoodsIDs = systemBattle.GetStringValue("GiveGoodsIDs").Trim(); string[] fields = giveGoodsIDs.Split(new char[] { ',' }); if (fields != null && fields.Length > 0) { for (int i = 0; i < fields.Length; i++) { if (!string.IsNullOrEmpty(fields[i].Trim())) { int goodsID = Convert.ToInt32(fields[i].Trim()); SystemXmlItem systemGoods = null; if (!GameManager.SystemGoods.SystemXmlItemDict.TryGetValue(goodsID, out systemGoods)) { LogManager.WriteLog(LogTypes.Error, string.Format("PK之王配置文件中,配置的固定物品奖励中的物品不存在, GoodsID={0}", goodsID), null, true); } else { GoodsData goodsData = new GoodsData { Id = -1, GoodsID = goodsID, Using = 0, Forge_level = 0, Starttime = "1900-01-01 12:00:00", Endtime = "1900-01-01 12:00:00", Site = 0, Quality = 0, Props = "", GCount = 1, Binding = 0, Jewellist = "", BagIndex = 0, AddPropIndex = 0, BornIndex = 0, Lucky = 0, Strong = 0, ExcellenceInfo = 0, AppendPropLev = 0, ChangeLifeLevForEquip = 0 }; goodsDataList.Add(goodsData); } } } } this.GiveAwardsGoodsDataList = goodsDataList; }
/// <summary> /// 根据ID获取时间限制字段 /// </summary> /// <param name="systemScriptItem"></param> /// <returns></returns> private static DateTimeRange[] GetTimeLimitsByID(int timeLimitsID) { DateTimeRange[] dateTimeRangeArray = null; lock (_TimeLimitsDict) { if (_TimeLimitsDict.TryGetValue(timeLimitsID, out dateTimeRangeArray)) { return(dateTimeRangeArray); } } SystemXmlItem systemSpecialTimeItem = null; if (!GameManager.systemSpecialTimeMgr.SystemXmlItemDict.TryGetValue(timeLimitsID, out systemSpecialTimeItem)) { return(null); } string timeLimits = systemSpecialTimeItem.GetStringValue("TimeLimits"); if (string.IsNullOrEmpty(timeLimits)) { return(null); } dateTimeRangeArray = Global.ParseDateTimeRangeStr(timeLimits); lock (_TimeLimitsDict) { _TimeLimitsDict[timeLimitsID] = dateTimeRangeArray; } return(dateTimeRangeArray); }
private List <double[]> ParseSystemXmlItem(SystemXmlItem xmlItem) { string equipProps = xmlItem.GetStringValue("EquipProps"); List <double[]> result; if (string.IsNullOrEmpty(equipProps)) { result = null; } else { string[] fields = equipProps.Split(new char[] { '|' }); if (fields == null || fields.Length <= 0) { result = null; } else { List <double[]> propsList = new List <double[]>(); for (int i = 0; i < fields.Length; i++) { propsList.Add(this.ParseStringProps(fields[i])); } result = propsList; } } return(result); }
/// <summary> /// 解析五行奇阵的奖励项 /// </summary> /// <param name="systemXmlItem"></param> public static void ParseWuXingAwardItem(SystemXmlItem systemXmlItem) { List <GoodsData> goodsDataList = null; string goodsIDs = systemXmlItem.GetStringValue("GoodsIDs"); if (!string.IsNullOrEmpty(goodsIDs)) { string[] fields = goodsIDs.Split('|'); if (fields.Length > 0) { goodsDataList = ParseGoodsDataList(fields); } else { LogManager.WriteLog(LogTypes.Error, string.Format("解析WuXingAwards.xml配置项中的物品奖励失败, MapCode={0}", systemXmlItem.GetIntValue("MapCode"))); } } else { LogManager.WriteLog(LogTypes.Error, string.Format("解析WuXingAwards.xml配置项中的物品奖励失败, MapCode={0}", systemXmlItem.GetIntValue("MapCode"))); } TheWuXingMapAwardItem = new WuXingMapAwardItem() { MapCode = systemXmlItem.GetIntValue("MapCode"), Money1 = systemXmlItem.GetIntValue("Moneyaward"), ExpXiShu = systemXmlItem.GetDoubleValue("ExpXiShu"), GoodsDataList = goodsDataList, MinBlessPoint = systemXmlItem.GetIntValue("MinBlessPoint"), MaxBlessPoint = systemXmlItem.GetIntValue("MaxBlessPoint"), }; }
public void InitAngelTemple() { Global.QueryDayActivityTotalPointInfoToDB(SpecialActivityTypes.AngelTemple); this.AngelTempleMonsterUpgradePercent = Global.SafeConvertToDouble(GameManager.GameConfigMgr.GetGameConifgItem("AngelTempleMonsterUpgradeNumber")); this.AngelTempleMinHurt = GameManager.systemParamsList.GetParamValueIntByName("AngelTempleMinHurt", -1); double[] AngelTempleBossUpgradeParams = GameManager.systemParamsList.GetParamValueDoubleArrayByName("AngelTempleBossUpgrade", ','); if (AngelTempleBossUpgradeParams != null && AngelTempleBossUpgradeParams.Length == 4) { this.AngelTempleBossUpgradeTime = (int)AngelTempleBossUpgradeParams[0]; this.AngelTempleBossUpgradeParam1 = AngelTempleBossUpgradeParams[1]; this.AngelTempleBossUpgradeParam2 = AngelTempleBossUpgradeParams[2]; this.AngelTempleBossUpgradeParam3 = AngelTempleBossUpgradeParams[3]; } this.m_sKillBossRoleName = GameManager.GameConfigMgr.GetGameConifgItem("AngelTempleRole"); for (int i = 0; i < 5; i++) { AngelTemplePointInfo tmp = new AngelTemplePointInfo(); tmp.m_RoleID = 0; tmp.m_DamagePoint = 0L; tmp.m_GetAwardFlag = 0; tmp.m_RoleName = ""; this.m_PointInfoArray[i] = tmp; } this.m_BossHP = 10000L; SystemXmlItem ItemAngelTempleData = null; GameManager.systemAngelTempleData.SystemXmlItemDict.TryGetValue(1, out ItemAngelTempleData); if (ItemAngelTempleData == null) { throw new Exception("AngelTemple Scene ERROR"); } this.m_AngelTempleData.MapCode = ItemAngelTempleData.GetIntValue("MapCode", -1); this.m_AngelTempleData.MinChangeLifeNum = ItemAngelTempleData.GetIntValue("MinZhuangSheng", -1); this.m_AngelTempleData.MinLevel = ItemAngelTempleData.GetIntValue("MinLevel", -1); List <string> strTimeList = new List <string>(); string timePoints = ItemAngelTempleData.GetStringValue("TimePoints"); if (timePoints != null && timePoints != "") { string[] sField = timePoints.Split(new char[] { ',' }); for (int i = 0; i < sField.Length; i++) { strTimeList.Add(sField[i].Trim()); } } this.m_AngelTempleData.BeginTime = strTimeList; this.m_AngelTempleData.PrepareTime = Global.GMax(ItemAngelTempleData.GetIntValue("PrepareSecs", -1), ItemAngelTempleData.GetIntValue("WaitingEnterSecs", -1)); this.m_AngelTempleData.DurationTime = ItemAngelTempleData.GetIntValue("FightingSecs", -1); this.m_AngelTempleData.LeaveTime = ItemAngelTempleData.GetIntValue("ClearRolesSecs", -1); this.m_AngelTempleData.MinPlayerNum = ItemAngelTempleData.GetIntValue("MinRequestNum", -1); this.m_AngelTempleData.MaxPlayerNum = ItemAngelTempleData.GetIntValue("MaxEnterNum", -1); this.m_AngelTempleData.BossID = ItemAngelTempleData.GetIntValue("BossID", -1); this.m_AngelTempleData.BossPosX = ItemAngelTempleData.GetIntValue("BossPosX", -1); this.m_AngelTempleData.BossPosY = ItemAngelTempleData.GetIntValue("BossPosY", -1); }
public static void CheckGongGaoInfo(GameClient client, int nID) { string strBeginTime = ""; string strEndTime = ""; using (Dictionary <int, SystemXmlItem> .ValueCollection.Enumerator enumerator = GongGaoDataManager.systemGongGaoMgr.SystemXmlItemDict.Values.GetEnumerator()) { if (enumerator.MoveNext()) { SystemXmlItem systemMallItem = enumerator.Current; strBeginTime = systemMallItem.GetStringValue("FromDate"); strEndTime = systemMallItem.GetStringValue("ToDate"); } } int nHaveGongGao = 0; string strCurrDateTime = TimeUtil.NowDateTime().ToString("yyyy-MM-dd HH:mm:ss"); if (string.Compare(strCurrDateTime, strBeginTime) >= 0 && string.Compare(strCurrDateTime, strEndTime) <= 0) { nHaveGongGao = 1; } int nLianXuLoginReward = 0; int nLeiJiLoginReward = 0; if (client._IconStateMgr.CheckFuLiLianXuDengLuReward(client)) { nLianXuLoginReward = 1; } if (client._IconStateMgr.CheckFuLiLeiJiDengLuReward(client)) { nLeiJiLoginReward = 1; } GongGaoData gongGaoData = new GongGaoData(); if (1 == nHaveGongGao) { gongGaoData.strGongGaoInfo = GongGaoDataManager.strGongGaoXML; } gongGaoData.nHaveGongGao = nHaveGongGao; gongGaoData.nLianXuLoginReward = nLianXuLoginReward; gongGaoData.nLeiJiLoginReward = nLeiJiLoginReward; client.sendCmd <GongGaoData>(nID, gongGaoData, false); }
private static void ParseWuXingXmlItem(SystemXmlItem systemXmlItem) { int npcID = systemXmlItem.GetIntValue("NPCID", -1); int mapCode = systemXmlItem.GetIntValue("MapCode", -1); int needGoodsID = systemXmlItem.GetIntValue("NeedGoodsID", -1); int globalID = systemXmlItem.GetIntValue("GlobalID", -1); string otherNPCIDs = systemXmlItem.GetStringValue("OtherNPCIDs"); string goToMaps = systemXmlItem.GetStringValue("GoToMaps"); WuXingMapItem wuXingMapItem = WuXingMapMgr.ParseGlobalConfigItem(globalID, otherNPCIDs, goToMaps); WuXingNPCItem wuXingNPCItem = new WuXingNPCItem { NPCID = npcID, MapCode = mapCode, NeedGoodsID = needGoodsID, MapItem = wuXingMapItem }; string key = string.Format("{0}_{1}", mapCode, npcID); WuXingMapMgr.WuXingNPCDict[key] = wuXingNPCItem; }
public void LoadGoodsItemsDict(SystemXmlItems systemGoodsMgr) { Dictionary <string, SystemXmlItem> goodsItemsDict = new Dictionary <string, SystemXmlItem>(); foreach (int key in systemGoodsMgr.SystemXmlItemDict.Keys) { SystemXmlItem systemGoods = systemGoodsMgr.SystemXmlItemDict[key]; string strKey = systemGoods.GetStringValue("Title"); goodsItemsDict[strKey] = systemGoods; } this._GoodsItemsDict = goodsItemsDict; }
/// <summary> /// 获取指定任务编号的任务名称 /// </summary> /// <param name="taskId"></param> /// <returns></returns> public static string GetTaskName(int taskId) { //修改目标NPC的状态 SystemXmlItem systemTask = null; if (!GameManager.SystemTasksMgr.SystemXmlItemDict.TryGetValue(taskId, out systemTask)) { return(taskId.ToString()); } return(systemTask.GetStringValue("Title")); }
public void LoadParams() { SystemXmlItem systemBattle = null; if (GameManager.SystemBattle.SystemXmlItemDict.TryGetValue(1, out systemBattle)) { List <string> timePointsList = new List <string>(); string timePoints = systemBattle.GetStringValue("TimePoints"); if (timePoints != null && timePoints != "") { string[] fields = timePoints.Split(new char[] { ',' }); for (int i = 0; i < fields.Length; i++) { timePointsList.Add(fields[i].Trim()); } } this.TimePointsList = timePointsList; this.MapCode = systemBattle.GetIntValue("MapCode", -1); this.MinLevel = systemBattle.GetIntValue("MinLevel", -1); this.MinRequestNum = systemBattle.GetIntValue("MinRequestNum", -1); this.MaxEnterNum = systemBattle.GetIntValue("MaxEnterNum", -1); this.FallGiftNum = systemBattle.GetIntValue("FallGiftNum", -1); this.FallID = systemBattle.GetIntValue("FallID", -1); this.DisableGoodsIDs = systemBattle.GetStringValue("DisableGoodsIDs"); this.AddExpSecs = systemBattle.GetIntValue("AddExpSecs", -1); this.NotifyBattleKilledNumSecs = Global.GMax(5, Global.GMin(100, systemBattle.GetIntValue("NotifyBattleKilledNumSecs", -1))); this.WaitingEnterSecs = systemBattle.GetIntValue("WaitingEnterSecs", -1); this.PrepareSecs = systemBattle.GetIntValue("PrepareSecs", -1); this.FightingSecs = systemBattle.GetIntValue("FightingSecs", -1); this.ClearRolesSecs = systemBattle.GetIntValue("ClearRolesSecs", -1); this.m_NeedMinChangeLev = systemBattle.GetIntValue("MinZhuanSheng", -1); this.BattleLineID = Global.GMax(1, systemBattle.GetIntValue("LineID", -1)); this.ReloadGiveAwardsGoodsDataList(systemBattle); Global.QueryDayActivityTotalPointInfoToDB(SpecialActivityTypes.CampBattle); BattleManager.PushMsgDayID = Global.SafeConvertToInt32(GameManager.GameConfigMgr.GetGameConifgItem("BattlePushMsgDayID")); } }
public static string GetTaskName(int taskId) { SystemXmlItem systemTask = null; string result; if (!GameManager.SystemTasksMgr.SystemXmlItemDict.TryGetValue(taskId, out systemTask)) { result = taskId.ToString(); } else { result = systemTask.GetStringValue("Title"); } return(result); }
/// <summary> /// 解析xml配置项 /// </summary> /// <param name="systemXmlItem"></param> private static List <ChuanQiQianHuaItem> ParseSystemXmlItem(SystemXmlItem systemXmlItem) { List <ChuanQiQianHuaItem> list = new List <ChuanQiQianHuaItem>(); string qianHua = systemXmlItem.GetStringValue("QiangHua"); if (string.IsNullOrEmpty(qianHua)) { return(list); } string[] qianHuaFields = qianHua.Split('|'); for (int i = 0; i < qianHuaFields.Length; i++) { list.AddRange(ParseChuanQiQianHuaItem((int)systemXmlItem.GetIntValue("ID"), qianHuaFields[i])); } return(list); }
public void SubmitCrystalBuff(GameClient client, int areaLuaID) { KarenBattleQiZhiConfig_East crystalItem = client.SceneContextData as KarenBattleQiZhiConfig_East; if (null != crystalItem) { lock (this.RuntimeData.Mutex) { KarenBattleScene scene; if (this.SceneDict.TryGetValue(client.ClientData.FuBenSeqID, out scene)) { KarenCenterConfig center = null; if (scene.KarenCenterConfigDict.TryGetValue(areaLuaID, out center)) { if (center.BattleWhichSide == client.ClientData.BattleWhichSide) { KarenBattleClientContextData contextData = client.SceneContextData2 as KarenBattleClientContextData; if (contextData != null && scene.m_eStatus == GameSceneStatuses.STATUS_BEGIN) { int addScore = crystalItem.HandInNum; scene.ScoreData[client.ClientData.BattleWhichSide - 1].Score += addScore; scene.ScoreData[client.ClientData.BattleWhichSide - 1].ticks = TimeUtil.NOW(); if (addScore > 0) { this.NotifyTimeStateInfoAndScoreInfo(client, false, true); } } SystemXmlItem systemNPC = null; if (GameManager.SystemNPCsMgr.SystemXmlItemDict.TryGetValue(center.NPCID, out systemNPC)) { string param = client.ClientData.JunTuanName; string param2 = systemNPC.GetStringValue("SName"); KarenBattleManager.getInstance().NtfKarenNotifyMsg(scene, KarenNotifyMsgType.Submit, client.ClientData.JunTuanId, param, param2); } this.UpdateBuff4GameClient(client, crystalItem.BuffGoodsID, crystalItem, false); this.AddDelayCreateMonster(scene, TimeUtil.NOW() + (long)(crystalItem.RefreshCD * 1000), crystalItem); } } } } } }
public void InstallJunQi(KarenBattleScene scene, GameClient client, KarenBattleQiZhiConfig_West item) { CopyMap copyMap = scene.CopyMap; GameMap gameMap = GameManager.MapMgr.GetGameMap(scene.m_nMapCode); if (copyMap != null && null != gameMap) { item.Alive = true; item.BattleWhichSide = client.ClientData.BattleWhichSide; item.OwnTicks = TimeUtil.NOW(); scene.ScoreData[item.BattleWhichSide - 1].ResourceList.Add(item.ID); GameManager.MonsterZoneMgr.AddDynamicMonsters(copyMap.MapCode, item.QiZhiID, copyMap.CopyMapID, 1, item.PosX / gameMap.MapGridWidth, item.PosY / gameMap.MapGridHeight, 0, 0, SceneUIClasses.KarenWest, item, null); SystemXmlItem systemNPC = null; if (GameManager.SystemNPCsMgr.SystemXmlItemDict.TryGetValue(item.QiZuoID, out systemNPC)) { string param = systemNPC.GetStringValue("SName"); string param2 = client.ClientData.JunTuanName; KarenBattleManager.getInstance().NtfKarenNotifyMsg(scene, KarenNotifyMsgType.Own, client.ClientData.JunTuanId, param, param2); } this.BroadcastSceneScoreInfo(scene); } }
private static List <ChuanQiQianHuaItem> ParseSystemXmlItem(SystemXmlItem systemXmlItem) { List <ChuanQiQianHuaItem> list = new List <ChuanQiQianHuaItem>(); string qianHua = systemXmlItem.GetStringValue("QiangHua"); List <ChuanQiQianHuaItem> result; if (string.IsNullOrEmpty(qianHua)) { result = list; } else { string[] qianHuaFields = qianHua.Split(new char[] { '|' }); for (int i = 0; i < qianHuaFields.Length; i++) { list.AddRange(ChuanQiQianHua.ParseChuanQiQianHuaItem(systemXmlItem.GetIntValue("ID", -1), qianHuaFields[i])); } result = list; } return(result); }
/// <summary> /// 解析Xml项中的属性 /// </summary> /// <param name="xmlItem"></param> /// <returns></returns> private List <double[]> ParseSystemXmlItem(SystemXmlItem xmlItem) { string equipProps = xmlItem.GetStringValue("EquipProps"); if (string.IsNullOrEmpty(equipProps)) { return(null); } string[] fields = equipProps.Split('|'); if (null == fields || fields.Length <= 0) { return(null); } List <double[]> propsList = new List <double[]>(); for (int i = 0; i < fields.Length; i++) { propsList.Add(ParseStringProps(fields[i])); } return(propsList); }
public static bool GetNpcFunctionData(GameClient client, int extensionID, NPCData npcData, SystemXmlItem systemNPC) { if (null == systemNPC) { return(false); } //查询是否有系统功能 string operaIDsByString = systemNPC.GetStringValue("Operations"); operaIDsByString.Trim(); if (operaIDsByString != "") { int[] operaIDsByInt = Global.StringArray2IntArray(operaIDsByString.Split(',')); if (null == npcData.OperationIDs) { npcData.OperationIDs = new List <int>(); } for (int i = 0; i < operaIDsByInt.Length; i++) { //过滤功能 if (Global.FilterNPCOperationByID(client, operaIDsByInt[i], extensionID)) { continue; } npcData.OperationIDs.Add(operaIDsByInt[i]); } } //查询是否有NPC功能脚本 string scriptIDsByString = systemNPC.GetStringValue("Scripts"); if (null != scriptIDsByString) { scriptIDsByString = scriptIDsByString.Trim(); } if (!string.IsNullOrEmpty(scriptIDsByString)) { int[] scriptIDsByInt = Global.StringArray2IntArray(scriptIDsByString.Split(',')); if (null == npcData.ScriptIDs) { npcData.ScriptIDs = new List <int>(); } for (int i = 0; i < scriptIDsByInt.Length; i++) { int errorCode = 0; //过滤功能脚本 if (Global.FilterNPCScriptByID(client, scriptIDsByInt[i], out errorCode)) { continue; } npcData.ScriptIDs.Add(scriptIDsByInt[i]); } } return(true); }
/// <summary> /// 配置的功能是否开启 /// </summary> /// <param name="client"></param> /// <param name="id"></param> /// <returns></returns> public static bool IsGongNengOpened(GameClient client, GongNengIDs id, bool hint = false) { SystemXmlItem xmlItem = null; if (GameManager.SystemSystemOpen.SystemXmlItemDict.TryGetValue((int)id, out xmlItem)) { int trigger = xmlItem.GetIntValue("TriggerCondition"); // 等级 if (trigger == 1) { int[] paramArray = xmlItem.GetIntArrayValue("TimeParameters"); if (paramArray.Length == 2) { if (Global.GetUnionLevel(paramArray[0], paramArray[1]) > Global.GetUnionLevel(client)) { if (hint) { string msg = string.Format(Global.GetLang("开启此功能需要达到【{0}】转【{1}】级"), paramArray[0], paramArray[1]); GameManager.ClientMgr.NotifyHintMsg(client, msg); } return(false); } } return(true); } // 完成指定任务 else if (trigger == 7) { int taskId = xmlItem.GetIntValue("TimeParameters"); if (client.ClientData.MainTaskID < taskId) { if (hint) { string msg = string.Format(Global.GetLang("开启此功能需要完成主线任务【{0}】"), GlobalNew.GetTaskName(taskId)); GameManager.ClientMgr.NotifyHintMsg(client, msg); } return(false); } return(true); } // 羽毛阶数 else if (trigger == 14) { string str = xmlItem.GetStringValue("TimeParameters"); if (string.IsNullOrEmpty(str)) { return(true); } string[] fields = str.Split(','); if (fields.Length != 2) { return(true); } int suit = Convert.ToInt32(fields[0]); int star = Convert.ToInt32(fields[1]); return((client.ClientData.MyWingData.WingID > suit) || (client.ClientData.MyWingData.WingID == suit && client.ClientData.MyWingData.ForgeLevel >= star)); } // 成就阶数 else if (trigger == 15) { if (client.ClientData.ChengJiuLevel < xmlItem.GetIntValue("TimeParameters")) { return(false); } } // 军衔阶数 else if (trigger == 16) { int junxian = GameManager.ClientMgr.GetShengWangLevelValue(client); if (junxian < xmlItem.GetIntValue("TimeParameters")) { return(false); } } else if (trigger == 20) { int bangHuiLevel = Global.GetBangHuiLevel(client); if (bangHuiLevel < xmlItem.GetIntValue("TimeParameters")) { return(false); } } } return(true); }
/// <summary> /// 解析Xml项 /// </summary> /// <param name="systemXmlItem"></param> private static void ParseXmlItem(SystemXmlItem systemXmlItem) { int mapCode = systemXmlItem.GetIntValue("MapCode"); int fuBenID = systemXmlItem.GetIntValue("CopyID"); int maxTime = systemXmlItem.GetIntValue("MaxTime"); int money1 = systemXmlItem.GetIntValue("Moneyaward"); int experience = systemXmlItem.GetIntValue("Experienceaward"); int nTmpFirstGold = systemXmlItem.GetIntValue("FirstGold"); int nTmpFirstExp = systemXmlItem.GetIntValue("FirstExp"); int nMinSaoDangTimer = systemXmlItem.GetIntValue("MinSaoDangTime"); int nTmpXingHunAward = systemXmlItem.GetIntValue("XingHunaward"); int nTmpFirstXingHunAward = systemXmlItem.GetIntValue("FirstXingHun"); int nTmpZhanGongaward = systemXmlItem.GetIntValue("ZhanGongaward"); List <GoodsData> goodsDataList = null; string goodsIDs = systemXmlItem.GetStringValue("GoodsIDs"); if (!string.IsNullOrEmpty(goodsIDs)) { string[] fields = goodsIDs.Split('|'); if (fields.Length > 0) { goodsDataList = ParseGoodsDataList(fields); } //else //{ // LogManager.WriteLog(LogTypes.Error, string.Format("解析副本地图映射配置项中的物品奖励失败, FuBenID={0}, MapCode={1}", fuBenID, mapCode)); //} } //else //{ // LogManager.WriteLog(LogTypes.Error, string.Format("解析副本地图映射配置项中的物品奖励失败, FuBenID={0}, MapCode={1}", fuBenID, mapCode)); //} // 首次通关奖励解析 ChenXiaojun List <GoodsData> goodsFirstDataList = null; string goodsFirstIDs = systemXmlItem.GetStringValue("FirstGoodsID"); if (!string.IsNullOrEmpty(goodsFirstIDs)) { string[] fields = goodsFirstIDs.Split('|'); if (fields.Length > 0) { goodsFirstDataList = ParseGoodsDataList(fields); } } FuBenMapItem fuBenMapItem = new FuBenMapItem() { FuBenID = fuBenID, MapCode = mapCode, MaxTime = maxTime, Money1 = money1, Experience = experience, GoodsDataList = goodsDataList, FirstGoodsDataList = goodsFirstDataList, MinSaoDangTimer = nMinSaoDangTimer, nFirstExp = nTmpFirstExp, nFirstGold = nTmpFirstGold, nXingHunAward = nTmpXingHunAward, nFirstXingHunAward = nTmpFirstXingHunAward, nZhanGongaward = nTmpZhanGongaward, }; string key = string.Format("{0}_{1}", fuBenID, mapCode); _FuBenMapCode2MapItemDict[key] = fuBenMapItem; List <int> mapCodeList = null; if (!_FuBen2MapCodeListDict.TryGetValue(fuBenID, out mapCodeList)) { mapCodeList = new List <int>(); _FuBen2MapCodeListDict[fuBenID] = mapCodeList; } mapCodeList.Add(mapCode); _MapCode2FuBenDict[mapCode] = fuBenID; }
public void AddSkillCoolDownForClient(GameClient client, int skillID) { SystemXmlItem systemMagic = null; if (GameManager.SystemMagicQuickMgr.MagicItemsDict.TryGetValue(skillID, out systemMagic)) { long nowTicks = TimeUtil.NOW(); int cdTime = Global.GMax(0, systemMagic.GetIntValue("CDTime", -1)); int pubCDTime = Global.GMax(0, systemMagic.GetIntValue("PubCDTime", -1)); if (cdTime <= 0) { int nParentMagicID = systemMagic.GetIntValue("ParentMagicID", -1); if (nParentMagicID > 0) { if (GameManager.SystemMagicQuickMgr.MagicItemsDict.TryGetValue(nParentMagicID, out systemMagic)) { cdTime = Global.GMax(0, systemMagic.GetIntValue("CDTime", -1)); } } } long delayTicks = Data.MaxServerClientTimeDiff; if (client.ClientData.CurrentMagicCode == skillID) { delayTicks = nowTicks - client.ClientData.CurrentMagicTicks; } if (cdTime > 0) { cdTime *= 1000; if (client.ClientData.CurrentMagicCode == skillID && client.ClientData.CurrentMagicCDSubPercent > 0.0) { cdTime = Convert.ToInt32((double)cdTime * (1.0 - client.ClientData.CurrentMagicCDSubPercent)); cdTime = (int)Math.Max((long)cdTime, delayTicks); int nextMagicID = systemMagic.GetIntValue("NextMagicID", -1); if (nextMagicID <= 0) { client.ClientData.CurrentMagicCDSubPercent = 0.0; } } Global.AddCoolDownItem(this.SkillCoolDownDict, skillID, nowTicks, (long)cdTime - delayTicks); if (systemMagic.GetStringValue("HorseSkill") == "1") { ExtData extData = ExtDataManager.GetClientExtData(client); extData.ZuoQiSkillCDTicks = nowTicks + (long)cdTime - delayTicks; extData.ZuoQiSkillCdTime = (long)cdTime - delayTicks; } } if (pubCDTime > 0) { client.ClientData.CurrentMagicActionEndTicks = nowTicks - delayTicks + (long)pubCDTime; if (null != client.ClientData.SkillDataList) { for (int i = 0; i < client.ClientData.SkillDataList.Count; i++) { SkillData skillData = client.ClientData.SkillDataList[i]; if (null != skillData) { Global.AddCoolDownItem(this.SkillCoolDownDict, skillData.SkillID, nowTicks, (long)pubCDTime - delayTicks); } } } } } }