public static int CompareByTypeAndID(this ArtifactData x, ArtifactData y) { return(x.ArtifactParam.CompareByTypeAndID(y.ArtifactParam)); }
static void LogDeserializeError(string message, ArtifactData container, string assetPath) { var what = !string.IsNullOrEmpty(assetPath) ? assetPath.ToHyperLink() : $"memory container of type '{container.GetType().FullName}'"; Debug.LogError($"Failed to deserialize {what}:\n{message}"); }
public async Task <IHttpActionResult> Post([FromBody] ArtifactData data) { return(await Task.FromResult(AddNewArtifact(data))); }
public static void DownloadUnit(UnitParam unit, JobData[] jobs = null) { // ISSUE: object of a compiler-generated type is created // ISSUE: variable of a compiler-generated type DownloadUtility.\u003CDownloadUnit\u003Ec__AnonStorey1ED unitCAnonStorey1Ed = new DownloadUtility.\u003CDownloadUnit\u003Ec__AnonStorey1ED(); // ISSUE: reference to a compiler-generated field unitCAnonStorey1Ed.unit = unit; // ISSUE: reference to a compiler-generated field if (unitCAnonStorey1Ed.unit == null) { return; } // ISSUE: reference to a compiler-generated field CharacterDB.Character character = CharacterDB.FindCharacter(unitCAnonStorey1Ed.unit.model); if (character == null) { return; } GameManager instance = MonoSingleton <GameManager> .Instance; // ISSUE: reference to a compiler-generated field if (unitCAnonStorey1Ed.unit.jobsets != null) { // ISSUE: reference to a compiler-generated field for (int index = 0; index < unitCAnonStorey1Ed.unit.jobsets.Length; ++index) { // ISSUE: reference to a compiler-generated field for (JobSetParam jobSetParam = instance.GetJobSetParam((string)unitCAnonStorey1Ed.unit.jobsets[index]); jobSetParam != null; jobSetParam = string.IsNullOrEmpty(jobSetParam.jobchange) ? (JobSetParam)null : instance.GetJobSetParam(jobSetParam.jobchange)) { JobParam jobParam = instance.GetJobParam(jobSetParam.job); // ISSUE: reference to a compiler-generated field SkillParam skillParam = string.IsNullOrEmpty(jobParam.atkskill[0]) ? instance.MasterParam.GetSkillParam(jobParam.atkskill[(int)unitCAnonStorey1Ed.unit.element]) : instance.MasterParam.GetSkillParam(jobParam.atkskill[0]); if (skillParam != null) { SkillSequence sequence = SkillSequence.FindSequence(skillParam.motion); if (sequence != null && !string.IsNullOrEmpty(sequence.SkillAnimation.Name) && index < character.Jobs.Count) { DownloadUtility.PrepareUnitAnimation(character.Jobs[index], sequence.SkillAnimation.Name, false, (JobParam)null); } } DownloadUtility.DownloadJobEquipment(jobParam); ArtifactParam artifactParam = MonoSingleton <GameManager> .GetInstanceDirect().MasterParam.GetArtifactParam(jobParam.artifact); if (artifactParam != null) { DownloadUtility.DownloadArtifact(artifactParam); } int artifactSlotIndex = JobData.GetArtifactSlotIndex(ArtifactTypes.Arms); if (jobs != null) { foreach (JobData job in jobs) { if (job != null) { // ISSUE: object of a compiler-generated type is created // ISSUE: variable of a compiler-generated type DownloadUtility.\u003CDownloadUnit\u003Ec__AnonStorey1EC unitCAnonStorey1Ec = new DownloadUtility.\u003CDownloadUnit\u003Ec__AnonStorey1EC(); List <ArtifactData> artifacts = MonoSingleton <GameManager> .GetInstanceDirect().Player.Artifacts; // ISSUE: reference to a compiler-generated field unitCAnonStorey1Ec.uniqId = job.Artifacts[artifactSlotIndex]; // ISSUE: reference to a compiler-generated method ArtifactData artifactData = artifacts.Find(new Predicate <ArtifactData>(unitCAnonStorey1Ec.\u003C\u003Em__1B4)); if (artifactData != null) { DownloadUtility.DownloadArtifact(artifactData.ArtifactParam); } } } } else { DownloadUtility.DownloadArtifact(instance.MasterParam.GetArtifactParam(jobParam.artifact)); } // ISSUE: reference to a compiler-generated field AssetManager.PrepareAssets(AssetPath.UnitImage(unitCAnonStorey1Ed.unit, jobSetParam.job)); // ISSUE: reference to a compiler-generated field AssetManager.PrepareAssets(AssetPath.UnitImage2(unitCAnonStorey1Ed.unit, jobSetParam.job)); // ISSUE: reference to a compiler-generated field AssetManager.PrepareAssets(AssetPath.UnitIconSmall(unitCAnonStorey1Ed.unit, jobSetParam.job)); // ISSUE: reference to a compiler-generated field AssetManager.PrepareAssets(AssetPath.UnitIconMedium(unitCAnonStorey1Ed.unit, jobSetParam.job)); // ISSUE: reference to a compiler-generated field AssetManager.PrepareAssets(AssetPath.UnitEyeImage(unitCAnonStorey1Ed.unit, jobSetParam.job)); } } // ISSUE: reference to a compiler-generated field JobSetParam[] changeJobSetParam = instance.GetClassChangeJobSetParam(unitCAnonStorey1Ed.unit.iname); if (changeJobSetParam != null && changeJobSetParam.Length > 0) { for (int index = 0; index < changeJobSetParam.Length; ++index) { JobSetParam jobSetParam = changeJobSetParam[index]; if (jobSetParam != null) { JobParam jobParam = instance.GetJobParam(jobSetParam.job); ArtifactParam artifactParam = MonoSingleton <GameManager> .GetInstanceDirect().MasterParam.GetArtifactParam(jobParam.artifact); if (artifactParam != null) { DownloadUtility.DownloadArtifact(artifactParam); } // ISSUE: reference to a compiler-generated field SkillParam skillParam = string.IsNullOrEmpty(jobParam.atkskill[0]) ? instance.MasterParam.GetSkillParam(jobParam.atkskill[(int)unitCAnonStorey1Ed.unit.element]) : instance.MasterParam.GetSkillParam(jobParam.atkskill[0]); if (skillParam != null) { SkillSequence sequence = SkillSequence.FindSequence(skillParam.motion); if (sequence != null && !string.IsNullOrEmpty(sequence.SkillAnimation.Name)) { DownloadUtility.PrepareUnitAnimation(character.Jobs[index], sequence.SkillAnimation.Name, false, (JobParam)null); } } } } } } for (int index = 0; index < character.Jobs.Count; ++index) { CharacterDB.Job job = character.Jobs[index]; DownloadUtility.PrepareUnitModels(job); DownloadUtility.PrepareUnitAnimation(job, "unit_info_idle0", true, (JobParam)null); DownloadUtility.PrepareUnitAnimation(job, "unit_info_act0", true, (JobParam)null); } // ISSUE: reference to a compiler-generated field AssetManager.PrepareAssets("CHM/Home_" + unitCAnonStorey1Ed.unit.model + "_walk0"); // ISSUE: reference to a compiler-generated field if (unitCAnonStorey1Ed.unit.skins != null) { List <ArtifactParam> artifacts = MonoSingleton <GameManager> .GetInstanceDirect().MasterParam.Artifacts; // ISSUE: object of a compiler-generated type is created // ISSUE: variable of a compiler-generated type DownloadUtility.\u003CDownloadUnit\u003Ec__AnonStorey1EE unitCAnonStorey1Ee = new DownloadUtility.\u003CDownloadUnit\u003Ec__AnonStorey1EE(); // ISSUE: reference to a compiler-generated field unitCAnonStorey1Ee.\u003C\u003Ef__ref\u0024493 = unitCAnonStorey1Ed; // ISSUE: reference to a compiler-generated field // ISSUE: reference to a compiler-generated field // ISSUE: reference to a compiler-generated field // ISSUE: reference to a compiler-generated field for (unitCAnonStorey1Ee.i = 0; unitCAnonStorey1Ee.i < unitCAnonStorey1Ed.unit.skins.Length; ++unitCAnonStorey1Ee.i) { // ISSUE: reference to a compiler-generated method ArtifactParam skin = artifacts.Find(new Predicate <ArtifactParam>(unitCAnonStorey1Ee.\u003C\u003Em__1B5)); if (skin != null) { // ISSUE: reference to a compiler-generated field AssetManager.PrepareAssets(AssetPath.UnitSkinImage(unitCAnonStorey1Ed.unit, skin, (string)null)); // ISSUE: reference to a compiler-generated field AssetManager.PrepareAssets(AssetPath.UnitSkinImage2(unitCAnonStorey1Ed.unit, skin, (string)null)); // ISSUE: reference to a compiler-generated field AssetManager.PrepareAssets(AssetPath.UnitSkinIconSmall(unitCAnonStorey1Ed.unit, skin, (string)null)); // ISSUE: reference to a compiler-generated field AssetManager.PrepareAssets(AssetPath.UnitSkinIconMedium(unitCAnonStorey1Ed.unit, skin, (string)null)); // ISSUE: reference to a compiler-generated field AssetManager.PrepareAssets(AssetPath.UnitSkinEyeImage(unitCAnonStorey1Ed.unit, skin, (string)null)); } } } // ISSUE: reference to a compiler-generated field DownloadUtility.PrepareUnitVoice(unitCAnonStorey1Ed.unit); }
/// <summary> /// 加载神器基本信息 /// </summary> public static void LoadArtifactData() { string fileName = "Config/ZaiZao.xml"; GeneralCachingXmlMgr.RemoveCachingXml(Global.GameResPath(fileName)); XElement xml = GeneralCachingXmlMgr.GetXElement(Global.GameResPath(fileName)); if (null == xml) { LogManager.WriteLog(LogTypes.Fatal, "加载Config/ZaiZao.xml时出错!!!文件不存在"); return; } try { _artifactList.Clear(); IEnumerable <XElement> xmlItems = xml.Elements(); foreach (var xmlItem in xmlItems) { if (xmlItem == null) { continue; } ArtifactData config = new ArtifactData(); config.ArtifactID = Convert.ToInt32(Global.GetDefAttributeStr(xmlItem, "ID", "0")); config.ArtifactName = Convert.ToString(Global.GetDefAttributeStr(xmlItem, "Name", "")); config.NewEquitID = Convert.ToInt32(Global.GetDefAttributeStr(xmlItem, "NewEquitID", "0")); config.NeedEquitID = Convert.ToInt32(Global.GetDefAttributeStr(xmlItem, "NeedEquitID", "0")); config.NeedGoldBind = Convert.ToInt32(Global.GetDefAttributeStr(xmlItem, "NeedBandJinBi", "0")); config.NeedZaiZao = Convert.ToInt32(Global.GetDefAttributeStr(xmlItem, "NeedZaiZao", "0")); config.SuccessRate = (int)(Convert.ToDouble(Global.GetDefAttributeStr(xmlItem, "SuccessRate", "0")) * 100); string needMaterial = Convert.ToString(Global.GetDefAttributeStr(xmlItem, "NeedGoods", "")); if (needMaterial.Length > 0) { config.NeedMaterial = new Dictionary <int, int>(); string[] materials = needMaterial.Split('|'); foreach (string str in materials) { string[] one = str.Split(','); int key = int.Parse(one[0]); int value = int.Parse(one[1]); config.NeedMaterial.Add(key, value); } } string failMaterial = Convert.ToString(Global.GetDefAttributeStr(xmlItem, "XiaoHuiGoods", "")); if (failMaterial.Length > 0) { config.FailMaterial = new Dictionary <int, int>(); string[] materials = failMaterial.Split('|'); foreach (string str in materials) { string[] one = str.Split(','); int key = int.Parse(one[0]); int value = int.Parse(one[1]); config.FailMaterial.Add(key, value); } } _artifactList.Add(config); } } catch (Exception ex) { LogManager.WriteLog(LogTypes.Fatal, "加载Config/ZaiZao.xml时文件出错", ex); } }
/// <summary> /// 神器再造 /// </summary> /// <param name="client"></param> /// <param name="equipID"></param> /// <returns></returns> public static ArtifactResultData UpArtifact(GameClient client, int equipID, bool isUseBind) { ArtifactResultData result = new ArtifactResultData(); #region 检查 //神器再造功能开放 bool isOpen = GlobalNew.IsGongNengOpened(client, GongNengIDs.Artifact); if (!isOpen) { result.State = (int)ArtifactResultType.EnoOpen; return(result); } // 从背包中找装备 GoodsData equipData = Global.GetGoodsByDbID(client, equipID); if (equipData == null) { result.State = (int)ArtifactResultType.EnoEquip; return(result); } //类型检测Categoriy=0-6、11-21的道具 int catetoriy = Global.GetGoodsCatetoriy(equipData.GoodsID); bool isCanCatetoriy = (catetoriy >= 0 && catetoriy <= 6) || (catetoriy >= 11 && catetoriy <= 21); if (!isCanCatetoriy) { result.State = (int)ArtifactResultType.EcantUp; return(result); } //Suit=10 SystemXmlItem systemGoods = null; if (!GameManager.SystemGoods.SystemXmlItemDict.TryGetValue(equipData.GoodsID, out systemGoods)) { result.State = (int)ArtifactResultType.EnoEquip; return(result); } int nSuitID = systemGoods.GetIntValue("SuitID"); if (nSuitID < ARTIFACT_SUIT) { result.State = (int)ArtifactResultType.EcantUp; return(result); } //神器基本数据 ArtifactData artifactDataBasic = GetArtifactDataByNeedId(equipData.GoodsID); if (artifactDataBasic == null) { result.State = (int)ArtifactResultType.EcantUp; return(result); } //再造点 bool enoughZaiZao = Global.IsRoleHasEnoughMoney(client, artifactDataBasic.NeedZaiZao, (int)MoneyTypes.ZaiZao) > 0; if (!enoughZaiZao) { result.State = (int)ArtifactResultType.EnoZaiZao; return(result); } //绑定金币 int goldBind = Global.GetTotalBindTongQianAndTongQianVal(client);; if (artifactDataBasic.NeedGoldBind > goldBind) { result.State = (int)ArtifactResultType.EnoGold; return(result); } //材料——成功扣除 foreach (var d in artifactDataBasic.NeedMaterial) { int materialId = d.Key; int count = d.Value; int totalCount = Global.GetTotalGoodsCountByID(client, materialId); if (totalCount < count) { result.State = (int)ArtifactResultType.EnoMaterial; return(result); } } //材料——失败扣除 foreach (var d in artifactDataBasic.FailMaterial) { int materialId = d.Key; int count = d.Value; int totalCount = Global.GetTotalGoodsCountByID(client, materialId); if (totalCount < count) { result.State = (int)ArtifactResultType.EnoMaterial; return(result); } } //背包已满 int freeBagIndex = Global.GetIdleSlotOfBagGoods(client); if (freeBagIndex < 0) { result.State = (int)ArtifactResultType.EnoBag; return(result); } #endregion #region 扣除 //扣除绑定金币 if (!Global.SubBindTongQianAndTongQian(client, artifactDataBasic.NeedGoldBind, "神器再造")) { result.State = (int)ArtifactResultType.EnoGold; return(result); } //几率 //bool isSuccess = true; bool isSuccess = false; int failCount = Global.GetRoleParamsInt32FromDB(client, RoleParamName.ArtifactFailCount); //失败次数 int failMax = (int)GameManager.systemParamsList.GetParamValueIntByName("ZaiZaoBaoDi"); if (failCount >= failMax) { isSuccess = true; failCount = 0; SetArtifactFailCount(client, failCount); } else { int rate = Global.GetRandomNumber(0, 100); if (rate < artifactDataBasic.SuccessRate) { isSuccess = true; failCount = 0; SetArtifactFailCount(client, failCount); } } bool useBind = false; bool useTimeLimit = false; //失败------------------------------------------------------------------------ if (!isSuccess) { //扣除材料 foreach (var d in artifactDataBasic.FailMaterial) { int materialId = d.Key; int count = d.Value; bool isOk = Global.UseGoodsBindOrNot(client, materialId, count, isUseBind, out useBind, out useTimeLimit) >= 1; if (!isOk) { result.State = (int)ArtifactResultType.EnoMaterial; return(result); } } failCount++; Global.SaveRoleParamsInt32ValueToDB(client, RoleParamName.ArtifactFailCount, failCount, true); GameManager.logDBCmdMgr.AddDBLogInfo(artifactDataBasic.NewEquitID, artifactDataBasic.ArtifactName, "神器再造失败", client.ClientData.RoleName, client.ClientData.RoleName, "再造", 1, client.ClientData.ZoneID, client.strUserID, -1, client.ServerId, equipData); EventLogManager.AddRoleEvent(client, OpTypes.Trace, OpTags.ShenQiZaiZao, LogRecordType.ShenQiZaiZao, artifactDataBasic.NewEquitID, 0, failCount); result.State = (int)ArtifactResultType.Fail; return(result); } //成功------------------------------------------------------------------------ //扣除材料 foreach (var d in artifactDataBasic.NeedMaterial) { int materialId = d.Key; int count = d.Value; bool oneUseBind = false; bool oneUseTimeLimit = false; bool isOk = Global.UseGoodsBindOrNot(client, materialId, count, isUseBind, out oneUseBind, out oneUseTimeLimit) >= 1; if (!isOk) { result.State = (int)ArtifactResultType.EnoMaterial; return(result); } useBind = useBind || oneUseBind; useTimeLimit = useTimeLimit || oneUseTimeLimit; } //扣除再造点 GameManager.ClientMgr.ModifyZaiZaoValue(client, -artifactDataBasic.NeedZaiZao, "神器再造", true, true); EventLogManager.AddRoleEvent(client, OpTypes.Trace, OpTags.ShenQiZaiZao, LogRecordType.ShenQiZaiZao, artifactDataBasic.NewEquitID, 1, 0); #endregion #region 再造 int _Forge_level = equipData.Forge_level; //强化等级 int _AppendPropLev = equipData.AppendPropLev; //追加等级 int _Lucky = equipData.Lucky; //幸运属性 int _ExcellenceInfo = equipData.ExcellenceInfo; //卓越属性 List <int> _WashProps = equipData.WashProps; //培养属性 int _Binding = equipData.Binding; //绑定状态 if (useBind) { _Binding = 1; } //扣除原有的装备 if (!GameManager.ClientMgr.NotifyUseGoods(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, equipID, false)) { result.State = (int)ArtifactResultType.EdelEquip; return(result); } //给予新的装备 int nItemDBID = Global.AddGoodsDBCommand(Global._TCPManager.TcpOutPacketPool, client, artifactDataBasic.NewEquitID, 1, equipData.Quality, // "", _Forge_level, _Binding, 0, equipData.Jewellist, //"" false, 1, /**/ "神器再造", Global.ConstGoodsEndTime, equipData.AddPropIndex, //0, // equipData.BornIndex, // _Lucky, 0, _ExcellenceInfo, _AppendPropLev, equipData.ChangeLifeLevForEquip,//0, // _WashProps); if (nItemDBID < 0) { result.State = (int)ArtifactResultType.EaddEquip; return(result); } #endregion // 玩家【用户名字】勇往直前,勇不可挡,通过了万魔塔第XX层! string broadcastMsg = StringUtil.substitute(Global.GetLang("玩家【{0}】成功进行了神器再造,获得了{2}阶装备【{1}】!"), Global.FormatRoleName(client, client.ClientData.RoleName), artifactDataBasic.ArtifactName, nSuitID + 1); //播放用户行为消息 Global.BroadcastRoleActionMsg(client, RoleActionsMsgTypes.HintMsg, broadcastMsg, true, GameInfoTypeIndexes.Hot, ShowGameInfoTypes.OnlySysHint); result.State = (int)ArtifactResultType.Success; result.EquipDbID = nItemDBID; result.Bind = _Binding; return(result); }
/// <summary> /// Creates the data for the specified row. /// </summary> /// <param name="Row">The row.</param> internal Data Create(Row Row) { Data Data; switch (this.Index) { case 0: { Data = new BuildingData(Row, this); break; } case 1: { Data = new LocaleData(Row, this); break; } case 2: { Data = new ResourceData(Row, this); break; } case 3: { Data = new CharacterData(Row, this); break; } case 6: { Data = new BuildingClassData(Row, this); break; } case 7: { Data = new ObstacleData(Row, this); break; } case 8: { Data = new EffectData(Row, this); break; } case 9: { Data = new ParticleEmitterData(Row, this); break; } case 10: { Data = new ExperienceLevelData(Row, this); break; } case 11: { Data = new TrapData(Row, this); break; } case 12: { Data = new AllianceBadgeData(Row, this); break; } case 13: { Data = new GlobalData(Row, this); break; } case 14: { Data = new TownhallLevelData(Row, this); break; } case 15: { Data = new PrototypeData(Row, this); break; } case 16: { Data = new NpcData(Row, this); break; } case 17: { Data = new DecoData(Row, this); break; } case 18: { Data = new ResourcePackData(Row, this); break; } case 20: { Data = new MissionData(Row, this); break; } case 21: { Data = new BillingPackageData(Row, this); break; } case 22: { Data = new AchievementData(Row, this); break; } case 25: { Data = new SpellData(Row, this); break; } case 26: { Data = new HintData(Row, this); break; } case 27: { Data = new LandingShipData(Row, this); break; } case 28: { Data = new ArtifactData(Row, this); break; } case 29: { Data = new ArtifactBonusData(Row, this); break; } case 30: { Data = new DeepseaParameterData(Row, this); break; } case 31: { Data = new ExplorationCostData(Row, this); break; } case 34: { Data = new ResourceShipData(Row, this); break; } case 35: { Data = new LootBoxData(Row, this); break; } case 36: { Data = new LiberatedIncomeData(Row, this); break; } case 37: { Data = new RegionData(Row, this); break; } case 38: { Data = new DefenseRewardData(Row, this); break; } case 39: { Data = new LocatorData(Row, this); break; } case 40: { Data = new EventData(Row, this); break; } case 41: { Data = new FootstepData(Row, this); break; } case 42: { Data = new PersistentEventRewardData(Row, this); break; } case 43: { Data = new CommunityLinkData(Row, this); break; } case 44: { Data = new ShieldData(Row, this); break; } case 45: { Data = new AbTestData(Row, this); break; } case 46: { Data = new LetterData(Row, this); break; } case 47: { Data = new RankData(Row, this); break; } case 48: { Data = new CountryData(Row, this); break; } case 51: { Data = new BoomboxData(Row, this); break; } case 52: { Data = new HeroData(Row, this); break; } case 53: { Data = new HeroAbilityData(Row, this); break; } case 54: { Data = new OfferData(Row, this); break; } case 55: { Data = new DeepLinkData(Row, this); break; } case 56: { Data = new SectorData(Row, this); break; } case 57: { Data = new SectorBonusData(Row, this); break; } default: { Data = new Data(Row, this); break; } } return(Data); }