protected override Hash GetState() { var hash = Hash.With(base.GetState()) .AndWith(Input.Object); _inOutHashMemory.Add(hash); return(Hash.With(_inOutHashMemory.ToArray())); }
public void ParseRow(string[] rowData) { DropIds = new CacheList <DropGroup>(); CleanOutDropIds = new CacheList <DropGroup>(); int index = 0; index++; Id = int.Parse(rowData[index++]); index++; Name = rowData[index++]; Description = rowData[index++]; RequestDescription0 = rowData[index++]; RequestDescription1 = rowData[index++]; RequestDescription2 = rowData[index++]; PrerequisiteInstanceId = int.Parse(rowData[index++]); PrerequisitePlayerLevel = int.Parse(rowData[index++]); InstanceGroupId = int.Parse(rowData[index++]); index++; // Skip recommend level PlayerExp = int.Parse(rowData[index++]); HeroExp = int.Parse(rowData[index++]); Coin = int.Parse(rowData[index++]); string drops = rowData[index++].Trim('"'); foreach (string drop in drops.Split(';')) { DropGroup dropGroup = new DropGroup(drop); DropIds.Add(dropGroup); } string cleanOutDrops = rowData[index++].Trim('"'); foreach (string drop in cleanOutDrops.Split(';')) { DropGroup dropGroup = new DropGroup(drop); CleanOutDropIds.Add(dropGroup); } SceneId = rowData[index++]; TimerType = int.Parse(rowData[index++]); TimerDuration = int.Parse(rowData[index++]); TimerAlert = int.Parse(rowData[index++]); //AIBehavior = rowData[index++]; index += 4; InstanceNpcs = rowData[index++]; SpawnPointX = float.Parse(rowData[index++]); SpawnPointY = float.Parse(rowData[index++]); SpawnAngle = float.Parse(rowData[index++]); index += 37; InInstanceChests = new CacheList <int>(); while (index < rowData.Length) { int chestId = int.Parse(rowData[index++]); if (chestId < 0) { break; } InInstanceChests.Add(chestId); } DTInstanceCache.AddOrUpdate(Id.ToString(), this); }
protected override ContextPhysicsMap SetCacheLock() { lock (LockObject) { if (!CacheList.ContainsKey(Key)) { CacheList.Add(Key, new ContextPhysicsMap(Key)); } } return(CacheList[Key]); }
private void DrawWatch(MyListDictionary <MemberInfo, MemberInfo> watch) { PlotHistory(); if (watch == null) { return; } List <object> log = new CacheList <object>(watch.Values.Count); StringBuilder sb = new StringBuilder(); Vector2 pos = new Vector2(100, 50);// m_counter * 0.2f); int i = -1; foreach (var list in watch.Values) { i++; if (i < SelectedMember) { continue; } object currentInstance = SelectedEntity; foreach (var member in list) { sb.Append("."); sb.Append(member.Name); currentInstance = member.GetValue(currentInstance); } sb.Append(":"); sb.Append(currentInstance.ToString()); MyRenderProxy.DebugDrawText2D(pos, sb.ToString(), m_toPlot.Contains(i) ? m_colors[i] : Color.White, 0.55f); pos.Y += 12; sb.Clear(); log.Add(currentInstance); } pos.X = 90; foreach (var toPlot in m_toPlot) { int idx = (toPlot - SelectedMember); if (idx < 0) { continue; } pos.Y = 50 + idx * 12; MyRenderProxy.DebugDrawText2D(pos, "*", m_colors[toPlot], 0.55f); } m_history.Add(log); if (m_history.Count >= MAX_HISTORY) { m_history.RemoveAtFast(m_frame); } m_frame++; m_frame %= MAX_HISTORY; }
/// <inherit /> protected override TValue SetCacheLock() { if (_initCache == null) { return(default(TValue)); } lock (LockObject) { if (!CacheList.ContainsKey(Key)) { CacheList.Add(Key, _initCache()); } } return(CacheList[Key]); }
public void ParseRow(string[] rowData) { int index = 0; index++; Id = int.Parse(rowData[index++]); index++; LevelUpCostCoin = new CacheList <int>(); for (; index < rowData.Length; index++) { LevelUpCostCoin.Add(int.Parse(rowData[index])); } DTGearCache.AddOrUpdate(Id.ToString(), this); }
protected override string SetCacheLock() { lock (LockObject) { if (CacheList.ContainsKey(Key)) { return(CacheList[Key]); } DbInfo dbInfo = Key; CacheList.Add(Key, AbsDbProvider.CreateInstance(dbInfo.DataType, dbInfo.DataVer).CreateDbConnstring(dbInfo.UserID, dbInfo.PassWord, dbInfo.Server, dbInfo.Catalog, dbInfo.DataVer, dbInfo.ConnectTimeout, dbInfo.PoolMinSize, dbInfo.PoolMaxSize, dbInfo.Port)); } return(CacheList[Key]); }
public static Caches GetCaches() { Cache _cache = HttpRuntime.Cache; IDictionaryEnumerator cacheEnum = _cache.GetEnumerator(); CacheList cl = new CacheList(); cl = new CacheList(); while (cacheEnum.MoveNext()) { cl.Add(new CacheInfo(cacheEnum.Key.ToString(), cacheEnum.Value.GetType().ToString())); } Caches rs = new Caches(); rs.CacheList = new CacheList(); cl.SortBy(CacheInfo.Columns.Key, true); rs.CacheList.AddRange(cl); rs.Total = cl.Count; return rs; }
/// <summary> /// 合成水晶 /// </summary> /// <param name="userCryStal1"></param> /// <param name="userCryStal2"></param> /// <param name="cryExprience2"></param> private void UpdateCrystal(string _userCrystalID1, string _userCrystalID2, int cryExprience2) { var package = UserCrystalPackage.Get(Uid); UserCrystalInfo userCryStalInfo1 = package.CrystalPackage.Find(m => m.UserCrystalID.Equals(_userCrystalID1)); UserCrystalInfo userCryStalInfo2 = package.CrystalPackage.Find(m => m.UserCrystalID.Equals(_userCrystalID2)); CacheList <SynthesisInfo> SynList = new CacheList <SynthesisInfo>(); SynList.Add(new SynthesisInfo() { DemandID = userCryStalInfo2.CrystalID, Num = userCryStalInfo2.CurrExprience }); userCryStalInfo1.CurrExprience = MathUtils.Addition(userCryStalInfo1.CurrExprience, cryExprience2); userCryStalInfo1.CurrExprience = MathUtils.Addition(userCryStalInfo1.CurrExprience, userCryStalInfo2.CurrExprience); package.SaveCrystal(userCryStalInfo1); //package.DelayChange(); UserHelper.CheckCrystalEscalate(ContextUser.UserID, userCryStalInfo1.UserCrystalID); UserLogHelper.AppenCtystalLog(ContextUser.UserID, 3, userCryStalInfo1.CrystalID, 0, 0, SynList, userCryStalInfo1.CrystalLv, userCryStalInfo1.CurrExprience); package.RemoveCrystal(userCryStalInfo2); }
protected override string SetCacheLock() { lock (LockObject) { if (CacheList.ContainsKey(Key)) { return(CacheList[Key]); } DbInfo dbInfo = Key; if (dbInfo == null) { Log.LogManger.Log.Error("未设置数据库配置文件"); return(null); } CacheList.Add(Key, AbsDbProvider.CreateInstance(dbInfo.DataType, dbInfo.DataVer).CreateDbConnstring(dbInfo.Server, dbInfo.Port, dbInfo.UserID, dbInfo.PassWord, dbInfo.Catalog, dbInfo.DataVer, dbInfo.Additional, dbInfo.ConnectTimeout, dbInfo.PoolMinSize, dbInfo.PoolMaxSize)); } return(CacheList[Key]); }
EntityBase Spawn(PoolController pool, Vector3 spawnPos, Quaternion spawnRot, GenericParams parms) { var spawned = pool.Spawn(data.entityRef, data.entityRef, spawnTo, spawnPos, spawnRot, null); var entity = spawned.GetComponent <EntityBase>(); if (entity && !mSpawnedEntities.Exists(entity)) { mSpawnedEntities.Add(entity); EntityRegisterCallbacks(entity, true); } if (spawnCallback != null) { spawnCallback(this, entity); } return(entity); }
public static T GetResponse <T>(string url, string cacheName) where T : new() { T targetObj; //var path = HostingEnvironment.ApplicationPhysicalPath + "Caches\\" + cacheName; var path = HostingEnvironment.MapPath($"~/Caches/{cacheName}"); if (File.Exists(path)) { targetObj = GetFileToJsonObj <T>(path); } else { CheckQueueTime(); using (var webClient = new WebClient()) { webClient.Encoding = Encoding.UTF8; var result = webClient.DownloadString(url); var json = JObject.Parse(result); targetObj = json.ToObject <T>(); // ReSharper disable once AssignNullToNotNullAttribute using (var streamWriter = new StreamWriter(path)) { streamWriter.Write(json); streamWriter.Flush(); streamWriter.Close(); } } var cacheModel = new CacheModel() { Name = Path.GetFileNameWithoutExtension(path), CreateDate = System.IO.File.GetLastWriteTime(path), FullPath = path }; CacheList.Add(cacheModel); } return(targetObj); }
public static void GuildFightCombatUserList() { _fightUserList = new CacheList<FightUser>(); var fightList = new ShareCacheStruct<ServerFight>().FindAll(m => m.FastID == info.FastID); foreach (ServerFight fight in fightList) { if (string.IsNullOrEmpty(fight.CombatMember)) { continue; } string[] strList = fight.CombatMember.Split(','); foreach (string s in strList) { if (string.IsNullOrEmpty(s)) { continue; } var FightStatusUser = _fightUserList.Find(m => !m.IsRemove && m.UserId == s); if (FightStatusUser != null) { continue; } FightUser fightUser = new FightUser(); fightUser.GuildID = fight.GuildID; fightUser.UserId = s; GameUser user = UserCacheGlobal.CheckLoadUser(s); if (user != null) { fightUser.UserName = user.NickName; user.UserStatus = UserStatus.FightCombat; } fightUser.WinCount = 0; fightUser.CityID = fight.CityID; fightUser.ObtainNum = 0; fightUser.InspirePercent = 0; fightUser.IsRemove = false; fightUser.IsNotEnough = false; _fightUserList.Add(fightUser); } } }
/// <summary> /// 保存后发生 /// </summary> /// <param name="context"></param> /// <param name="handleClass"></param> private void Context_SaveChangesEvent(CommonContext context, Type handleClass) { ManufactureCache MCModel = CacheList.FindLast(p => p.HandleClass == handleClass); if (MCModel == null) { MCModel = new ManufactureCache() { Context = context, HandleClass = handleClass, UseWriteTime = DateTime.Now }; CacheList.Add(MCModel); } else { MCModel.Context = context; MCModel.HandleClass = handleClass; MCModel.UseWriteTime = DateTime.Now; } }
static void Main(string[] args) { try { var dict = new CacheList <int>(); dict.Add(1); string js = dict.ToJson(); var temp = js.ParseJson <CacheList <int> >(); if (temp == null) { } GameServerListManager.Initialize(); var server = new GameProxy(); Console.WriteLine("Press Enter to exit..."); Console.ReadLine(); } catch (Exception ex) { TraceLog.WriteError("Main error:{0}", ex); } }
public void ParseRow(string[] rowData) { int index = 0; index++; Id = int.Parse(rowData[index++]); index++; Name = rowData[index++]; Description = rowData[index++]; RequestDescription0 = rowData[index++]; RequestDescription1 = rowData[index++]; RequestDescription2 = rowData[index++]; PrerequisiteInstanceId = int.Parse(rowData[index++]); InstanceGroupId = int.Parse(rowData[index++]); PlayerExp = int.Parse(rowData[index++]); HeroExp = int.Parse(rowData[index++]); Coin = int.Parse(rowData[index++]); DropIds = new CacheList <int>(); string Ids = rowData[index++].Trim('"'); foreach (string id in Ids.Split(',')) { DropIds.Add(int.Parse(id)); } SceneId = rowData[index++]; TimerType = int.Parse(rowData[index++]); TimerDuration = int.Parse(rowData[index++]); TimerAlert = int.Parse(rowData[index++]); index += 4; InstanceNpcs = rowData[index++]; SpawnPointX = float.Parse(rowData[index++]); SpawnPointY = float.Parse(rowData[index++]); SpawnAngle = float.Parse(rowData[index++]); index += 37; HeroId = int.Parse(rowData[index++]); DTInstanceStoryCache.AddOrUpdate(Id.ToString(), this); }
static void Main(string[] args) { try { var dict = new CacheList<int>(); dict.Add(1); string js = dict.ToJson(); var temp = js.ParseJson<CacheList<int>>(); if(temp == null) { } GameServerListManager.Initialize(); var server = new GameProxy(); Console.WriteLine("Press Enter to exit..."); Console.ReadLine(); } catch (Exception ex) { TraceLog.WriteError("Main error:{0}", ex); } }
private void DrawWatch(MyListDictionary<MemberInfo, MemberInfo> watch) { PlotHistory(); if (watch == null) return; List<object> log = new CacheList<object>(watch.Values.Count); StringBuilder sb = new StringBuilder(); Vector2 pos = new Vector2(100, 50);// m_counter * 0.2f); int i = -1; foreach (var list in watch.Values) { i++; if(i < SelectedMember) continue; object currentInstance = SelectedEntity; foreach (var member in list) { sb.Append("."); sb.Append(member.Name); currentInstance = member.GetValue(currentInstance); } sb.Append(":"); sb.Append(currentInstance.ToString()); MyRenderProxy.DebugDrawText2D(pos, sb.ToString(), m_toPlot.Contains(i) ? m_colors[i] : Color.White, 0.55f); pos.Y += 12; sb.Clear(); log.Add(currentInstance); } pos.X = 90; foreach (var toPlot in m_toPlot) { int idx = (toPlot - SelectedMember); if (idx < 0) continue; pos.Y = 50 + idx * 12; MyRenderProxy.DebugDrawText2D(pos, "*", m_colors[toPlot], 0.55f); } m_history.Add(log); if(m_history.Count >= MAX_HISTORY) m_history.RemoveAtFast(m_frame); m_frame++; m_frame %= MAX_HISTORY; }
/// <summary> /// 合成水晶 /// </summary> /// <param name="userCryStal1"></param> /// <param name="userCryStal2"></param> /// <param name="cryExprience2"></param> private void UpdateCrystal(string _userCrystalID1, string _userCrystalID2, int cryExprience2) { var package = UserCrystalPackage.Get(Uid); UserCrystalInfo userCryStalInfo1 = package.CrystalPackage.Find(m => m.UserCrystalID.Equals(_userCrystalID1)); UserCrystalInfo userCryStalInfo2 = package.CrystalPackage.Find(m => m.UserCrystalID.Equals(_userCrystalID2)); CacheList<SynthesisInfo> SynList = new CacheList<SynthesisInfo>(); SynList.Add(new SynthesisInfo() { DemandID = userCryStalInfo2.CrystalID, Num = userCryStalInfo2.CurrExprience }); userCryStalInfo1.CurrExprience = MathUtils.Addition(userCryStalInfo1.CurrExprience, cryExprience2); userCryStalInfo1.CurrExprience = MathUtils.Addition(userCryStalInfo1.CurrExprience,userCryStalInfo2.CurrExprience); package.SaveCrystal(userCryStalInfo1); //package.DelayChange(); UserHelper.CheckCrystalEscalate(ContextUser.UserID, userCryStalInfo1.UserCrystalID); UserLogHelper.AppenCtystalLog(ContextUser.UserID, 3, userCryStalInfo1.CrystalID, 0, 0, SynList, userCryStalInfo1.CrystalLv, userCryStalInfo1.CurrExprience); package.RemoveCrystal(userCryStalInfo2); }
/// <summary> /// 通關副本掉落物品 /// </summary> /// <param name="userID"></param> /// <param name="itemProbability"></param> /// <param name="itemRank"></param> /// <returns></returns> private static CacheList<PrizeItemInfo> GetKalpaPrizeItems(string userID, decimal itemProbability, string itemRank, int plotID, UserPlotInfo userPlot) { var itemList = new CacheList<PrizeItemInfo>(); PlotInfo plotInfo = new ShareCacheStruct<PlotInfo>().FindKey(plotID); if (plotInfo == null) { return itemList; } string[] items = itemRank.Trim().Split(new[] { ',' }); int count = items.Length + 1; int[] precent = new int[count]; int precentNum = 0; for (int i = 0; i < count; i++) { if (i != (count - 1)) { var itemInfo = items[i].Split('='); decimal prize = itemInfo[2].ToDecimal(); precent[i] = (prize * 1000).ToInt(); precentNum = MathUtils.Addition(precentNum, precent[i]); } else { precent[i] = (1000 - precentNum); } } int index = RandomUtils.GetHitIndexByTH(precent); if (plotInfo.PlotType != PlotType.Kalpa && index != (count - 1)) { if (items.Length == 0) { return itemList; } string[] itemArray = items[index].Split('='); if (itemArray.Length == 2) { int itemId = itemArray[0].ToInt(); if (new ShareCacheStruct<ItemBaseInfo>().FindKey(itemId) != null) { PrizeItemInfo itemInfo = itemList.Find(m => m.ItemID == itemId); if (itemInfo == null) { itemInfo = new PrizeItemInfo { Type = 0, ItemID = itemId, Num = itemArray[1].ToInt() }; itemList.Add(itemInfo); } else { itemInfo.Num += itemArray[1].ToInt(); } } } } List<UniversalInfo> universalInfoList = new List<UniversalInfo>(); GameUser userInfo = new PersonalCacheStruct<GameUser>().FindKey(userID); foreach (var itemInfo in itemList) { UserItemHelper.AddUserItem(userID, itemInfo.ItemID, itemInfo.Num, universalInfoList); if (userInfo != null) { CacheList<PrizeItemInfo> prizeItemInfos = new CacheList<PrizeItemInfo>(); prizeItemInfos.Add(new PrizeItemInfo() { Type = 0, ItemID = itemInfo.ItemID, Num = itemInfo.Num }); if (prizeItemInfos.Count > 0) { userInfo.UserExtend.UpdateNotify(obj => { userInfo.UserExtend.ItemList = prizeItemInfos; return true; }); //userInfo.Update(); } } } if (universalInfoList.Count > 0 && userPlot != null) { universalInfoList.ForEach(universalInfo => { userPlot.ItemList.Add(universalInfo); }); } NoviceHelper.PlotFestivalList(userInfo, plotID); //活动集合 GetKalpaplotEnchant(userInfo, itemList, plotID); //副本掉落附魔符 return itemList; }
/// <summary> /// Creates a list of points around the specified point (within a 3x3x3 grid), but only when they are within the bounds. /// </summary> private Vector3I[] CreateTestPoints(Vector3I point, Vector3I max) { List <Vector3I> points = new CacheList <Vector3I>(); if (point.X > 0) { points.Add(new Vector3I(point.X - 1, point.Y, point.Z)); } if (point.Y > 0) { points.Add(new Vector3I(point.X, point.Y - 1, point.Z)); } if (point.Z > 0) { points.Add(new Vector3I(point.X, point.Y, point.Z - 1)); } if (point.X < max.X) { points.Add(new Vector3I(point.X + 1, point.Y, point.Z)); } if (point.Y < max.Y) { points.Add(new Vector3I(point.X, point.Y + 1, point.Z)); } if (point.Z < max.Z) { points.Add(new Vector3I(point.X, point.Y, point.Z + 1)); } if (point.X > 0 && point.Y > 0) { points.Add(new Vector3I(point.X - 1, point.Y - 1, point.Z)); } if (point.Y > 0 && point.Z > 0) { points.Add(new Vector3I(point.X, point.Y - 1, point.Z - 1)); } if (point.X > 0 && point.Z > 0) { points.Add(new Vector3I(point.X - 1, point.Y, point.Z - 1)); } if (point.X < max.X && point.Y < max.Y) { points.Add(new Vector3I(point.X + 1, point.Y + 1, point.Z)); } if (point.Y < max.Y && point.Z < max.Z) { points.Add(new Vector3I(point.X, point.Y + 1, point.Z + 1)); } if (point.X < max.X && point.Z < max.Z) { points.Add(new Vector3I(point.X + 1, point.Y, point.Z + 1)); } if (point.X > 0 && point.Y < max.Y) { points.Add(new Vector3I(point.X - 1, point.Y + 1, point.Z)); } if (point.X < max.X && point.Y > 0) { points.Add(new Vector3I(point.X + 1, point.Y - 1, point.Z)); } if (point.Y > 0 && point.Z < max.Z) { points.Add(new Vector3I(point.X, point.Y - 1, point.Z + 1)); } if (point.Y < max.Y && point.Z > 0) { points.Add(new Vector3I(point.X, point.Y + 1, point.Z - 1)); } if (point.X > 0 && point.Z < max.Z) { points.Add(new Vector3I(point.X - 1, point.Y, point.Z + 1)); } if (point.X < max.X && point.Z > 0) { points.Add(new Vector3I(point.X + 1, point.Y, point.Z - 1)); } if (point.X > 0 && point.Y > 0 && point.Z > 0) { points.Add(new Vector3I(point.X - 1, point.Y - 1, point.Z - 1)); } if (point.X > 0 && point.Y > 0 && point.Z < max.Z) { points.Add(new Vector3I(point.X - 1, point.Y - 1, point.Z + 1)); } if (point.X > 0 && point.Y < max.Y && point.Z > 0) { points.Add(new Vector3I(point.X - 1, point.Y + 1, point.Z - 1)); } if (point.X > 0 && point.Y < max.Y && point.Z < max.Z) { points.Add(new Vector3I(point.X - 1, point.Y + 1, point.Z + 1)); } if (point.X < max.X && point.Y > 0 && point.Z > 0) { points.Add(new Vector3I(point.X + 1, point.Y - 1, point.Z - 1)); } if (point.X < max.X && point.Y > 0 && point.Z < max.Z) { points.Add(new Vector3I(point.X + 1, point.Y - 1, point.Z + 1)); } if (point.X < max.X && point.Y < max.Y && point.Z > 0) { points.Add(new Vector3I(point.X + 1, point.Y + 1, point.Z - 1)); } if (point.X < max.X && point.Y < max.Y && point.Z < max.Z) { points.Add(new Vector3I(point.X + 1, point.Y + 1, point.Z + 1)); } return(points.ToArray()); }
public void Add(string Key, string XmlUri) { CacheList.Add(Key, new DataCache(XmlUri)); }
/// <summary> /// 晋级公会 /// </summary> /// <returns></returns> public static ServerFight[] GetApply(FightStage stage, int cityID) { int fastID = info.FastID; FightStage fightStage = FightStage.Ready; if (stage == FightStage.Apply && info.FastID > 1) { fastID = MathUtils.Subtraction(fastID, 1); fightStage = FightStage.final; } if (stage == FightStage.semi_Wait) { fightStage = FightStage.quarter_final; } else if (stage == FightStage.final_Wait) { fightStage = FightStage.semi_final; } var fightGroupList = new ShareCacheStruct<ServerFightGroup>().FindAll(s => s.FastID == fastID && s.Stage == fightStage); foreach (var fightgroup in fightGroupList) { if (string.IsNullOrEmpty(fightgroup.WinGuildID)) { ServerFightGroupWinGuildID(fightgroup, fastID); } } var applyList = new ShareCacheStruct<ServerFight>().FindAll(s => s.FastID == info.FastID && s.Stage == stage && s.CityID == cityID); applyList.QuickSort((x, y) => { int result; if (x == null && y == null) return 0; if (x != null && y == null) return 1; if (x == null) return -1; result = (int)y.GetResult(stage).CompareTo(x.GetResult(stage)); if (result == 0) { var userGuildA = new ShareCacheStruct<UserGuild>().FindKey(x.GuildID); var userGuildB = new ShareCacheStruct<UserGuild>().FindKey(y.GuildID); if (userGuildA != null && userGuildB != null) { result = userGuildB.GuildLv.CompareTo(userGuildA.GuildLv); if (result == 0) { result = userGuildB.CurrExperience.CompareTo(userGuildA.CurrExperience); } } } return result; }); var apply = new CacheList<ServerFight>(); for (int i = 0; i < info.Lenght && i < applyList.Count; i++) { apply.Add(applyList[i]); } return apply.ToArray(); }
protected override SetTypesInitializersPair SetCacheLock() { lock (LockObject) { if (CacheList.ContainsKey(Key)) { return(CacheList[Key]); } var dbContextParam = Expression.Parameter(typeof(DbContext), "_context"); var initDelegates = new List <Action <DbContext> >(); // 一个DbContext对象下的所有Set实体类型 var setTypeList = new Dictionary <Type, List <string> >(); // 取得所有Set属性 foreach (var entityMap in ContextMapCacheManger.Cache(Key).EntityMapList) { // 实体类型,Set的泛型类型 var entityType = entityMap.Value != null?entityMap.Key.PropertyType.GetGenericArguments()[0] : null; List <string> propertyName; // 查找这个Set类在当前DbContext中,出现过几次,并记录属性。 if (!setTypeList.TryGetValue(entityMap.Key.PropertyType, out propertyName)) { propertyName = new List <string>(); setTypeList[entityMap.Key.PropertyType] = propertyName; } propertyName.Add(entityMap.Key.Name); // 属性set方法 var setter = entityMap.Key.GetSetMethod(nonPublic: true); if (setter != null && setter.IsPublic) { // 上下文的Set方法(不同Set,提供不同的方法) MethodInfo setMethod = null; switch (entityMap.Key.PropertyType.Name) { case "TableSet`1": setMethod = SetInitializer.TableSetMethod.MakeGenericMethod(entityType); break; case "TableSetCache`1": setMethod = SetInitializer.TableSetCacheMethod.MakeGenericMethod(entityType); break; case "ViewSet`1": setMethod = SetInitializer.ViewSetMethod.MakeGenericMethod(entityType); break; case "ViewSetCache`1": setMethod = SetInitializer.ViewSetCacheMethod.MakeGenericMethod(entityType); break; case "ProcSet`1": setMethod = SetInitializer.ProcSetMethod.MakeGenericMethod(entityType); break; case "SqlSet`1": setMethod = SetInitializer.SqlSetMethod.MakeGenericMethod(entityType); break; case "SqlSet": setMethod = SetInitializer.SqlSetNonGenericMethod; break; } // 取得实例化 //var dbContextInitializer = typeof(DbContext).GetField("_dbContextInitializer", BindingFlags.NonPublic | BindingFlags.Instance); //var newExpression = Expression.Call(Expression.MakeMemberAccess(dbContextParam, dbContextInitializer), setMethod, Expression.Constant(entityMap.Key)); var newExpression = Expression.Call(dbContextParam, setMethod, Expression.Constant(entityMap.Key)); // 赋值 var setExpression = Expression.Call(Expression.Convert(dbContextParam, Key), setter, newExpression); initDelegates.Add(Expression.Lambda <Action <DbContext> >(setExpression, dbContextParam).Compile()); } } // 实体化所有Set属性 Action <DbContext> initializer = context => { foreach (var initer in initDelegates) { initer(context); } }; var setInfo = new SetTypesInitializersPair(setTypeList, initializer); CacheList.Add(Key, setInfo); return(setInfo); } }
private void SetEmbattle(EmbattleQueue combatGrid, CacheList<CombatEmbattle> list) { IGeneral[] generalList = combatGrid.FindAll(true); foreach (IGeneral general in generalList) { if (general != null && general is CombatGeneral) { CombatGeneral cgeneral = (CombatGeneral)general; list.Add(new CombatEmbattle { UserID = cgeneral.UserID, GeneralID = cgeneral.GeneralID, GeneralName = cgeneral.GeneralName, GeneralLv = cgeneral.Lv, HeadID = cgeneral.HeadID, AbilityID = cgeneral.TempAbility == null ? 0 : cgeneral.TempAbility.AbilityID, LiveNum = cgeneral.LifeNum, LiveMaxNum = cgeneral.LifeMaxNum, MomentumNum = cgeneral.Momentum, MaxMomentumNum = CombatGeneral.MomentumOut, Position = cgeneral.Position, IsWait = cgeneral.IsWait, BattleHead = cgeneral.BattleHeadID }); } } if (list.Count == 0) { new BaseLog().SaveDebugLog("战斗异常,未能加载佣兵数据"); } }
public override bool TakeAction() { short opType = 0; UserItemInfo synthesisUserItem = null; var package = UserItemPackage.Get(Uid); UserItemInfo userItem = null; if (!string.IsNullOrEmpty(_userItemID)) { var userItemList = package.ItemPackage.FindAll(m => !m.IsRemove && m.UserItemID.Equals(_userItemID)); foreach (var item in userItemList) { if (item.ItemStatus == ItemStatus.Sell) { package.RemoveItem(userItem); continue; } else if (item.SoldDate > MathUtils.SqlMinDate) { item.SoldDate = MathUtils.SqlMinDate; //package.Update(); userItem = item; } else { userItem = item; } } if (userItem == null) { return(false); } ItemBaseInfo itemBaseOpType = new ConfigCacheSet <ItemBaseInfo>().FindKey(userItem.ItemID); if (itemBaseOpType == null) { return(false); } if (itemBaseOpType.ItemType == ItemType.TuZhi) { opType = 1; } else { opType = 2; } } else if (!string.IsNullOrEmpty(_userEquID)) { opType = 1; userItem = package.ItemPackage.Find(m => !m.IsRemove && m.UserItemID.Equals(_userEquID)); } if (userItem == null) { return(false); } int genlv = ContextUser.UserLv; CacheList <SynthesisInfo> synthesisInfoList = new CacheList <SynthesisInfo>(); short itemLv = 0; List <ItemSynthesisInfo> itemSynthesisArray = new ConfigCacheSet <ItemSynthesisInfo>().FindAll(m => m.SynthesisID == userItem.ItemID); //图纸ID if (itemSynthesisArray.Count > 0) { ItemSynthesisInfo synthesisInfo = itemSynthesisArray[0]; if (synthesisInfo == null) { return(false); } ItemBaseInfo itemInfo = new ConfigCacheSet <ItemBaseInfo>().FindKey(synthesisInfo.ItemID); if (itemInfo != null && itemInfo.ItemType == ItemType.ZhuangBei && itemInfo.DemandLv > genlv) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St_LevelNotEnough; return(false); } List <ItemSynthesisInfo> synthesisArray = new ConfigCacheSet <ItemSynthesisInfo>().FindAll(m => m.ItemID == synthesisInfo.ItemID);//合成物品的材料数组 if (synthesisArray.Count == 0) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().LoadDataError; return(false); } int useGold = GetSytnthesisGold(ContextUser.UserID, synthesisInfo.ItemID); if (_ops == 1) { #region 普通合成 if (!GetMaterialsNum(ContextUser.UserID, synthesisInfo.ItemID) && ContextUser.VipLv < 4) { ErrorCode = 3; ErrorInfo = LanguageManager.GetLang().St1603_MaterialsNotEnough; return(false); } if (!GetMaterialsNum(ContextUser.UserID, synthesisInfo.ItemID) && ContextUser.VipLv >= 4) { ErrorCode = 2; ErrorInfo = LanguageManager.GetLang().St1603_MaterialsNotEnough + "," + string.Format(LanguageManager.GetLang().St1603_SynthesisEnergyNum, useGold); return(false); } foreach (ItemSynthesisInfo synthesis in synthesisArray) { ItemBaseInfo itemsInfo = new ConfigCacheSet <ItemBaseInfo>().FindKey(synthesis.SynthesisID); if (itemInfo == null) { return(false); } if (!string.IsNullOrEmpty(_userEquID) && synthesis.SynthesisID == userItem.ItemID && itemsInfo != null && itemInfo.ItemType == ItemType.ZhuangBei) { if (userItem.ItemStatus == ItemStatus.YongBing) { //if (UserHelper.IsItemEquSpare(ContextUser, userItem.UserItemID)) //{ // ErrorCode = LanguageManager.GetLang().ErrorCode; // ErrorInfo = LanguageManager.GetLang().St_ItemEquIndexOfSpare; // return false; //} if (IsLevelNotEnough(ContextUser, userItem.GeneralID, synthesisInfo.ItemID)) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St_LevelNotEnough; return(false); } UserItemHelper.AddItemLog(ContextUser.UserID, userItem.ItemID, userItem.Num, userItem.ItemLv, 9, userItem.UserItemID); synthesisInfoList.Add(new SynthesisInfo() { DemandID = userItem.ItemID, Num = 1 }); //package.SyncCache(() => //{ // userItem.IsRemove = true; // package.ItemPackage.Remove(userItem); // package.DelayChange(); //}); } } else { if (itemsInfo != null && itemsInfo.ItemType == ItemType.ZhuangBei) { synthesisUserItem = GetUserItemInfo(ContextUser.UserID, itemsInfo.ItemID); if (IsLevelNotEnough(ContextUser, synthesisUserItem.GeneralID, synthesisInfo.ItemID)) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St_LevelNotEnough; return(false); } //synthesisUserItem = GetUserItemInfo(ContextUser.UserID, itemsInfo.ItemID); } else { synthesisInfoList.Add(new SynthesisInfo() { DemandID = synthesis.SynthesisID, Num = synthesis.DemandNum }); UserItemHelper.UseUserItem(ContextUser.UserID, synthesis.SynthesisID, synthesis.DemandNum); } } } if (!string.IsNullOrEmpty(_userEquID)) { itemLv = MathUtils.Subtraction(userItem.ItemLv, (short)5, (short)1); UpdateUserItem(synthesisInfo.ItemID, userItem); UserLogHelper.AppenItemSynthesisLog(ContextUser.UserID, opType, synthesisInfo.ItemID, 1, synthesisInfoList, null, 0, itemLv, userItem.ItemLv); } else { if (synthesisUserItem != null) { itemLv = MathUtils.Subtraction(synthesisUserItem.ItemLv, (short)5, (short)1); UpdateUserItem(synthesisInfo.ItemID, synthesisUserItem); UserLogHelper.AppenItemSynthesisLog(ContextUser.UserID, opType, synthesisInfo.ItemID, 1, synthesisInfoList, null, 0, itemLv, userItem.ItemLv); } else { UserItemHelper.AddUserItem(ContextUser.UserID, synthesisInfo.ItemID, synthesisArray[0].SynthesisNum); UserLogHelper.AppenItemSynthesisLog(ContextUser.UserID, opType, synthesisInfo.ItemID, 1, synthesisInfoList, null, 0, itemLv, userItem.ItemLv); } } #endregion } else if (_ops == 2) { #region 晶石合成 if (!VipHelper.GetVipOpenFun(ContextUser.VipLv, ExpandType.JuanZouZhiJieWanCheng)) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St_VipNotEnoughNotFuntion; return(false); } ErrorCode = 1; ErrorInfo = string.Format(LanguageManager.GetLang().St1603_SynthesisEnergyNum, useGold); return(false); #endregion } else if (_ops == 3) { #region 确认晶石合成 if (ContextUser.GoldNum < useGold) { ErrorCode = 1; ErrorInfo = LanguageManager.GetLang().St_GoldNotEnough; return(false); } //原因:配置材料不使用晶石合成时提示 string userItemName = UseritemGoldName(ContextUser.UserID, synthesisArray); if (!string.IsNullOrEmpty(userItemName)) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = string.Format(LanguageManager.GetLang().St_ItemIsGold, userItemName); return(false); } foreach (ItemSynthesisInfo synthesis in synthesisArray) { int curNum = 0; ItemBaseInfo itemsInfo = new ConfigCacheSet <ItemBaseInfo>().FindKey(synthesis.SynthesisID); if (!string.IsNullOrEmpty(_userEquID) && synthesis.SynthesisID == userItem.ItemID) { if (userItem.ItemStatus == ItemStatus.YongBing) { if (IsLevelNotEnough(ContextUser, userItem.GeneralID, synthesisInfo.ItemID)) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St_LevelNotEnough; return(false); } UserItemHelper.AddItemLog(ContextUser.UserID, userItem.ItemID, userItem.Num, userItem.ItemLv, 9, userItem.UserItemID); synthesisInfoList.Add(new SynthesisInfo() { DemandID = userItem.ItemID, Num = 1 }); } } else { if (itemsInfo != null && itemsInfo.ItemType == ItemType.ZhuangBei) { synthesisUserItem = GetUserItemInfo(ContextUser.UserID, itemsInfo.ItemID); if (IsLevelNotEnough(ContextUser, synthesisUserItem.GeneralID, synthesisInfo.ItemID)) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St_LevelNotEnough; return(false); } } else { var itemArray = UserItemHelper.GetItems(Uid).FindAll(u => u.ItemID.Equals(synthesis.SynthesisID) && (u.ItemStatus == ItemStatus.BeiBao || u.ItemStatus == ItemStatus.CangKu)); if (itemArray.Count > 0) { foreach (var item in itemArray) { curNum += item.Num; } if (synthesis.DemandNum < curNum) { UserItemHelper.UseUserItem(ContextUser.UserID, synthesis.SynthesisID, synthesis.DemandNum); synthesisInfoList.Add(new SynthesisInfo() { DemandID = synthesis.SynthesisID, Num = synthesis.DemandNum }); } else { UserItemHelper.UseUserItem(ContextUser.UserID, synthesis.SynthesisID, curNum); synthesisInfoList.Add(new SynthesisInfo() { DemandID = synthesis.SynthesisID, Num = curNum }); } } } } } if (!string.IsNullOrEmpty(_userEquID)) { itemLv = MathUtils.Subtraction(userItem.ItemLv, (short)5, (short)1); UpdateUserItem(synthesisInfo.ItemID, userItem); UserLogHelper.AppenItemSynthesisLog(ContextUser.UserID, opType, synthesisInfo.ItemID, 1, synthesisInfoList, null, 0, itemLv, userItem.ItemLv); } else { if (synthesisUserItem != null) { itemLv = MathUtils.Subtraction(synthesisUserItem.ItemLv, (short)5, (short)1); UpdateUserItem(synthesisInfo.ItemID, synthesisUserItem); UserLogHelper.AppenItemSynthesisLog(ContextUser.UserID, opType, synthesisInfo.ItemID, 1, synthesisInfoList, null, 0, itemLv, userItem.ItemLv); } else { UserItemHelper.AddUserItem(ContextUser.UserID, synthesisInfo.ItemID, synthesisArray[0].SynthesisNum); UserLogHelper.AppenItemSynthesisLog(ContextUser.UserID, opType, synthesisInfo.ItemID, 1, synthesisInfoList, null, 0, itemLv, userItem.ItemLv); } } ContextUser.UseGold = MathUtils.Addition(ContextUser.UseGold, useGold, int.MaxValue); // ContextUser.Update(); #endregion } } return(true); }
public override bool TakeAction() { short opType = 0; UserItemInfo synthesisUserItem = null; var package = UserItemPackage.Get(Uid); UserItemInfo userItem = null; if (!string.IsNullOrEmpty(_userItemID)) { var userItemList = package.ItemPackage.FindAll(m => !m.IsRemove && m.UserItemID.Equals(_userItemID)); foreach (var item in userItemList) { if (item.ItemStatus == ItemStatus.Sell) { package.RemoveItem(userItem); continue; } else if (item.SoldDate > MathUtils.SqlMinDate) { item.SoldDate = MathUtils.SqlMinDate; //package.Update(); userItem = item; } else { userItem = item; } } if (userItem == null) return false; ItemBaseInfo itemBaseOpType = new ConfigCacheSet<ItemBaseInfo>().FindKey(userItem.ItemID); if (itemBaseOpType == null) return false; if (itemBaseOpType.ItemType == ItemType.TuZhi) { opType = 1; } else { opType = 2; } } else if (!string.IsNullOrEmpty(_userEquID)) { opType = 1; userItem = package.ItemPackage.Find(m => !m.IsRemove && m.UserItemID.Equals(_userEquID)); } if (userItem == null) { return false; } int genlv = ContextUser.UserLv; CacheList<SynthesisInfo> synthesisInfoList = new CacheList<SynthesisInfo>(); short itemLv = 0; List<ItemSynthesisInfo> itemSynthesisArray = new ConfigCacheSet<ItemSynthesisInfo>().FindAll(m => m.SynthesisID == userItem.ItemID); //图纸ID if (itemSynthesisArray.Count > 0) { ItemSynthesisInfo synthesisInfo = itemSynthesisArray[0]; if (synthesisInfo == null) return false; ItemBaseInfo itemInfo = new ConfigCacheSet<ItemBaseInfo>().FindKey(synthesisInfo.ItemID); if (itemInfo != null && itemInfo.ItemType == ItemType.ZhuangBei && itemInfo.DemandLv > genlv) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St_LevelNotEnough; return false; } List<ItemSynthesisInfo> synthesisArray = new ConfigCacheSet<ItemSynthesisInfo>().FindAll(m => m.ItemID == synthesisInfo.ItemID);//合成物品的材料数组 if (synthesisArray.Count == 0) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().LoadDataError; return false; } int useGold = GetSytnthesisGold(ContextUser.UserID, synthesisInfo.ItemID); if (_ops == 1) { #region 普通合成 if (!GetMaterialsNum(ContextUser.UserID, synthesisInfo.ItemID) && ContextUser.VipLv < 4) { ErrorCode = 3; ErrorInfo = LanguageManager.GetLang().St1603_MaterialsNotEnough; return false; } if (!GetMaterialsNum(ContextUser.UserID, synthesisInfo.ItemID) && ContextUser.VipLv >= 4) { ErrorCode = 2; ErrorInfo = LanguageManager.GetLang().St1603_MaterialsNotEnough + "," + string.Format(LanguageManager.GetLang().St1603_SynthesisEnergyNum, useGold); return false; } foreach (ItemSynthesisInfo synthesis in synthesisArray) { ItemBaseInfo itemsInfo = new ConfigCacheSet<ItemBaseInfo>().FindKey(synthesis.SynthesisID); if (itemInfo == null) return false; if (!string.IsNullOrEmpty(_userEquID) && synthesis.SynthesisID == userItem.ItemID && itemsInfo != null && itemInfo.ItemType == ItemType.ZhuangBei) { if (userItem.ItemStatus == ItemStatus.YongBing) { //if (UserHelper.IsItemEquSpare(ContextUser, userItem.UserItemID)) //{ // ErrorCode = LanguageManager.GetLang().ErrorCode; // ErrorInfo = LanguageManager.GetLang().St_ItemEquIndexOfSpare; // return false; //} if (IsLevelNotEnough(ContextUser, userItem.GeneralID, synthesisInfo.ItemID)) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St_LevelNotEnough; return false; } UserItemHelper.AddItemLog(ContextUser.UserID, userItem.ItemID, userItem.Num, userItem.ItemLv, 9, userItem.UserItemID); synthesisInfoList.Add(new SynthesisInfo() { DemandID = userItem.ItemID, Num = 1 }); //package.SyncCache(() => //{ // userItem.IsRemove = true; // package.ItemPackage.Remove(userItem); // package.DelayChange(); //}); } } else { if (itemsInfo != null && itemsInfo.ItemType == ItemType.ZhuangBei) { synthesisUserItem = GetUserItemInfo(ContextUser.UserID, itemsInfo.ItemID); if (IsLevelNotEnough(ContextUser, synthesisUserItem.GeneralID, synthesisInfo.ItemID)) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St_LevelNotEnough; return false; } //synthesisUserItem = GetUserItemInfo(ContextUser.UserID, itemsInfo.ItemID); } else { synthesisInfoList.Add(new SynthesisInfo() { DemandID = synthesis.SynthesisID, Num = synthesis.DemandNum }); UserItemHelper.UseUserItem(ContextUser.UserID, synthesis.SynthesisID, synthesis.DemandNum); } } } if (!string.IsNullOrEmpty(_userEquID)) { itemLv = MathUtils.Subtraction(userItem.ItemLv, (short)5, (short)1); UpdateUserItem(synthesisInfo.ItemID, userItem); UserLogHelper.AppenItemSynthesisLog(ContextUser.UserID, opType, synthesisInfo.ItemID, 1, synthesisInfoList, null, 0, itemLv, userItem.ItemLv); } else { if (synthesisUserItem != null) { itemLv = MathUtils.Subtraction(synthesisUserItem.ItemLv, (short)5, (short)1); UpdateUserItem(synthesisInfo.ItemID, synthesisUserItem); UserLogHelper.AppenItemSynthesisLog(ContextUser.UserID, opType, synthesisInfo.ItemID, 1, synthesisInfoList, null, 0, itemLv, userItem.ItemLv); } else { UserItemHelper.AddUserItem(ContextUser.UserID, synthesisInfo.ItemID, synthesisArray[0].SynthesisNum); UserLogHelper.AppenItemSynthesisLog(ContextUser.UserID, opType, synthesisInfo.ItemID, 1, synthesisInfoList, null, 0, itemLv, userItem.ItemLv); } } #endregion } else if (_ops == 2) { #region 晶石合成 if (!VipHelper.GetVipOpenFun(ContextUser.VipLv, ExpandType.JuanZouZhiJieWanCheng)) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St_VipNotEnoughNotFuntion; return false; } ErrorCode = 1; ErrorInfo = string.Format(LanguageManager.GetLang().St1603_SynthesisEnergyNum, useGold); return false; #endregion } else if (_ops == 3) { #region 确认晶石合成 if (ContextUser.GoldNum < useGold) { ErrorCode = 1; ErrorInfo = LanguageManager.GetLang().St_GoldNotEnough; return false; } //原因:配置材料不使用晶石合成时提示 string userItemName = UseritemGoldName(ContextUser.UserID, synthesisArray); if (!string.IsNullOrEmpty(userItemName)) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = string.Format(LanguageManager.GetLang().St_ItemIsGold, userItemName); return false; } foreach (ItemSynthesisInfo synthesis in synthesisArray) { int curNum = 0; ItemBaseInfo itemsInfo = new ConfigCacheSet<ItemBaseInfo>().FindKey(synthesis.SynthesisID); if (!string.IsNullOrEmpty(_userEquID) && synthesis.SynthesisID == userItem.ItemID) { if (userItem.ItemStatus == ItemStatus.YongBing) { if (IsLevelNotEnough(ContextUser, userItem.GeneralID, synthesisInfo.ItemID)) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St_LevelNotEnough; return false; } UserItemHelper.AddItemLog(ContextUser.UserID, userItem.ItemID, userItem.Num, userItem.ItemLv, 9, userItem.UserItemID); synthesisInfoList.Add(new SynthesisInfo() { DemandID = userItem.ItemID, Num = 1 }); } } else { if (itemsInfo != null && itemsInfo.ItemType == ItemType.ZhuangBei) { synthesisUserItem = GetUserItemInfo(ContextUser.UserID, itemsInfo.ItemID); if (IsLevelNotEnough(ContextUser, synthesisUserItem.GeneralID, synthesisInfo.ItemID)) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St_LevelNotEnough; return false; } } else { var itemArray = UserItemHelper.GetItems(Uid).FindAll(u => u.ItemID.Equals(synthesis.SynthesisID) && (u.ItemStatus == ItemStatus.BeiBao || u.ItemStatus == ItemStatus.CangKu)); if (itemArray.Count > 0) { foreach (var item in itemArray) { curNum += item.Num; } if (synthesis.DemandNum < curNum) { UserItemHelper.UseUserItem(ContextUser.UserID, synthesis.SynthesisID, synthesis.DemandNum); synthesisInfoList.Add(new SynthesisInfo() { DemandID = synthesis.SynthesisID, Num = synthesis.DemandNum }); } else { UserItemHelper.UseUserItem(ContextUser.UserID, synthesis.SynthesisID, curNum); synthesisInfoList.Add(new SynthesisInfo() { DemandID = synthesis.SynthesisID, Num = curNum }); } } } } } if (!string.IsNullOrEmpty(_userEquID)) { itemLv = MathUtils.Subtraction(userItem.ItemLv, (short)5, (short)1); UpdateUserItem(synthesisInfo.ItemID, userItem); UserLogHelper.AppenItemSynthesisLog(ContextUser.UserID, opType, synthesisInfo.ItemID, 1, synthesisInfoList, null, 0, itemLv, userItem.ItemLv); } else { if (synthesisUserItem != null) { itemLv = MathUtils.Subtraction(synthesisUserItem.ItemLv, (short)5, (short)1); UpdateUserItem(synthesisInfo.ItemID, synthesisUserItem); UserLogHelper.AppenItemSynthesisLog(ContextUser.UserID, opType, synthesisInfo.ItemID, 1, synthesisInfoList, null, 0, itemLv, userItem.ItemLv); } else { UserItemHelper.AddUserItem(ContextUser.UserID, synthesisInfo.ItemID, synthesisArray[0].SynthesisNum); UserLogHelper.AppenItemSynthesisLog(ContextUser.UserID, opType, synthesisInfo.ItemID, 1, synthesisInfoList, null, 0, itemLv, userItem.ItemLv); } } ContextUser.UseGold = MathUtils.Addition(ContextUser.UseGold, useGold, int.MaxValue); // ContextUser.Update(); #endregion } } return true; }
public override bool TakeAction() { var package = UserCrystalPackage.Get(Uid); if (ops == 1) { UserCrystalInfo userCryStal1 = package.CrystalPackage.Find(m => m.UserCrystalID.Equals(userCrystalID1)); UserCrystalInfo userCryStal2 = package.CrystalPackage.Find(m => m.UserCrystalID.Equals(userCrystalID2)); // UserCrystal userCryStal1 = UserCrystal.FindKey(userCrystalID1); //UserCrystal userCryStal2 = UserCrystal.FindKey(userCrystalID2); if (userCryStal1 == null || userCryStal2 == null) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St1308_CrystalNotEnough; return(false); } if (userCryStal1.CrystalLv > 9) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St1308_CrystalLvFull; return(false); } CrystalInfo crystalInfo1 = new ShareCacheStruct <CrystalInfo>().FindKey(userCryStal1.CrystalID); CrystalInfo crystalInfo2 = new ShareCacheStruct <CrystalInfo>().FindKey(userCryStal2.CrystalID); int cryExprience1 = 0; int cryExprience2 = 0; if (crystalInfo1 != null && crystalInfo2 != null) { cryExprience1 = crystalInfo1.Experience; cryExprience2 = crystalInfo2.Experience; if (crystalInfo1.CrystalQuality == crystalInfo2.CrystalQuality) { if (userCryStal1.CurrExprience >= userCryStal2.CurrExprience) { UpdateCrystal(userCrystalID1, userCrystalID2, cryExprience2); } else { UpdateCrystal(userCrystalID2, userCrystalID1, cryExprience1); } } else if (crystalInfo1.CrystalQuality > crystalInfo2.CrystalQuality) { UpdateCrystal(userCrystalID1, userCrystalID2, cryExprience2); } else { UpdateCrystal(userCrystalID2, userCrystalID1, cryExprience1); } } } else if (ops == 2) { CacheList <SynthesisInfo> SynList = new CacheList <SynthesisInfo>(); int experience = 0; var userCrystalArray = package.CrystalPackage.FindAll(m => m.IsSale == 2 && m.GeneralID.Equals(0)); if (userCrystalArray.Count == 0) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St1308_CrystalNotEnough; return(false); } userCrystalArray.QuickSort((x, y) => { int result = 0; if (x == null && y == null) { return(0); } if (x != null && y == null) { return(1); } if (x == null) { return(-1); } result = (int)new ShareCacheStruct <CrystalInfo>().FindKey(y.CrystalID).CrystalQuality.CompareTo( new ShareCacheStruct <CrystalInfo>().FindKey(x.CrystalID).CrystalQuality); if (result == 0) { result = y.CurrExprience.CompareTo(x.CurrExprience); } return(result); }); UserCrystalInfo userCrystal1 = package.CrystalPackage.Find(m => m.UserCrystalID == userCrystalArray[0].UserCrystalID); int maxExprience = 0; if (userCrystal1 == null) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St1308_CrystalNotEnough; return(false); } short upLv = 10; CrystalLvInfo crystalLvInfo = new ShareCacheStruct <CrystalLvInfo>().FindKey(userCrystal1.CrystalID, upLv); maxExprience = crystalLvInfo == null ? 0 : crystalLvInfo.UpExperience; foreach (UserCrystalInfo crystal in userCrystalArray) { CrystalInfo crystalInfo = new ShareCacheStruct <CrystalInfo>().FindKey(crystal.CrystalID); if (crystalInfo != null) { experience = crystalInfo.Experience; } if (userCrystal1.UserCrystalID != crystal.UserCrystalID) { SynList.Add(new SynthesisInfo() { DemandID = crystal.CrystalID, Num = crystal.CurrExprience }); if (userCrystal1.CurrExprience >= maxExprience) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St1308_CrystalLvFull; break; } experience = MathUtils.Addition(experience, userCrystal1.CurrExprience); experience = MathUtils.Addition(experience, crystal.CurrExprience); userCrystal1.CurrExprience = experience; package.SaveCrystal(userCrystal1); //package.DelayChange(); package.RemoveCrystal(crystal); } } UserLogHelper.AppenCtystalLog(ContextUser.UserID, 3, userCrystal1.CrystalID, 0, 0, SynList, userCrystal1.CrystalLv, userCrystal1.CurrExprience); UserHelper.CheckCrystalEscalate(ContextUser.UserID, userCrystalArray[0].UserCrystalID); } return(true); }
/// <summary> /// 副本奖励,如果通关下发通关奖励 /// </summary> /// <param name="userID"></param> /// <param name="plotNpcInfo"></param> /// <param name="userPlotCombat"></param> internal static void DoPlotPrize(string userID, PlotNPCInfo plotNpcInfo, UserPlotCombat userPlotCombat, int npcGeneralNum, out int honourNum) { honourNum = 0; int experience = 0; PlotInfo plotInfo = new ConfigCacheSet<PlotInfo>().FindKey(plotNpcInfo.PlotID); var package = UserPlotPackage.Get(userID); if (plotInfo == null || plotNpcInfo == null || userPlotCombat == null || package == null) { return; } GameUser user = new GameDataCacheSet<GameUser>().FindKey(userID); if (user != null) { experience += plotNpcInfo.Experience; userPlotCombat.Experience = plotNpcInfo.Experience; if (!string.IsNullOrEmpty(user.MercenariesID)) { //公会技能加成 userPlotCombat.Experience = MathUtils.RoundCustom(experience * CombatHelper.GetGuildAbilityNum(user.UserID, GuildAbilityType.Experience)).ToInt(); experience = userPlotCombat.Experience; } var cacheSetGeneral = new GameDataCacheSet<UserGeneral>(); var userMagic = new GameDataCacheSet<UserMagic>().Find(user.UserID, s => s.IsEnabled); int userMagicID = userMagic == null ? 0 : userMagic.MagicID; var userEmbattleList = new GameDataCacheSet<UserEmbattle>().FindAll(userID, s => s.MagicID == userMagicID && s.GeneralID > 0); int generalNum = 0; userEmbattleList.ForEach(userEmbattle => { var userGeneral = cacheSetGeneral.FindKey(userID, userEmbattle.GeneralID); generalNum = userGeneral != null && userGeneral.LifeNum > 0 ? MathUtils.Addition(generalNum, 1) : generalNum; }); user.GeneralAllCount = MathUtils.Addition(user.GeneralAllCount, userPlotCombat.GeneralNum); user.GeneralKillCount = MathUtils.Addition(user.GeneralKillCount, (userPlotCombat.GeneralNum - generalNum)); //怪物掉落物品) if (plotNpcInfo.IsBoss) { if (plotInfo.PlotType == PlotType.Normal && user.PlotProgress < plotInfo.PlotID) { user.PlotProgress = plotInfo.PlotID; } //日常任务-通关副本 TaskHelper.TriggerDailyTask(userID, 4005); DateTime currDate = DateTime.Now; //通关奖励 var userPlot = UserPlotHelper.GetUserPlotInfo(userID, plotNpcInfo.PlotID); if (userPlot == null) { userPlot = new UserPlotInfo(); userPlot.PlotID = plotNpcInfo.PlotID; userPlot.CreateDate = currDate; package.SaveItem(userPlot); } NoviceHelper.PlotFestivalList(user, plotInfo.PlotID); //活动集合 List<UserPlotCombat> preUserPlotList = new GameDataCacheSet<UserPlotCombat>().FindAll(userID, m => !m.PlotNpcID.Equals(userPlotCombat.PlotNpcID) && m.PlotID == plotNpcInfo.PlotID); preUserPlotList.Add(userPlotCombat); List<UserPlotCombat> plotCombatList = preUserPlotList; short starScore; PlotSuccessType plotSuccessType = PlotSuccessType.No; userPlot.ScoreNum = GetPlotScoreNum(plotCombatList, out starScore); userPlot.PlotStatus = PlotStatus.Completed; userPlot.AttackScore = 0; userPlot.DefenseScore = 0; userPlot.ItemID = 0; userPlot.EnchantID = 0; userPlot.PlotSuccessType = plotSuccessType; //获得星星等级 if (userPlotCombat.IsWin) { double pren = 0; GetStar(user, generalNum, out starScore, out plotSuccessType, out pren); userPlot.StarScore = starScore; userPlot.PlotSuccessType = plotSuccessType; //获得荣誉值 honourNum = plotInfo.HonourNum; userPlot.PlotNum = MathUtils.Addition(userPlot.PlotNum, 1); if (GetPlotChallengeNum(userID, plotNpcInfo.PlotID) == 1) { if (starScore >= 3) { if (plotInfo.PlotType==PlotType.Elite) // 如果是精英副本 { if (userPlot.FirstWin==false) // 如果是首次获得3星 { userPlot.FirstWin = true; userPlot.ExpNum = (int)(plotInfo.ExpNum * 2); userPlot.PennyNum = (int)(plotInfo.GameCoin * 2); } else { userPlot.ExpNum = plotInfo.ExpNum; userPlot.PennyNum = plotInfo.GameCoin; } } else { userPlot.ExpNum = (int)(plotInfo.ExpNum * 2); userPlot.PennyNum = (int)(plotInfo.GameCoin * 2); } } else { userPlot.ExpNum = plotInfo.ExpNum; userPlot.PennyNum = plotInfo.GameCoin; } honourNum = honourNum * starScore; } else { userPlot.ExpNum = plotInfo.ExpNum; userPlot.PennyNum = plotInfo.GameCoin; } userPlot.HonourNum = honourNum; GeneralEscalateHelper.AddUserLv(user, honourNum); } else { PlotFailureType plotFailureType; GetFailure(npcGeneralNum, out plotFailureType); userPlot.PlotFailureType = plotFailureType; } // userPlot.ExpNum = plotInfo.ExpNum; userPlot.GoldNum = plotInfo.GetRandomGold(); if (!string.IsNullOrEmpty(user.MercenariesID)) { //公会技能加成 userPlot.Experience = MathUtils.RoundCustom(userPlot.Experience * CombatHelper.GetGuildAbilityNum(user.UserID, GuildAbilityType.Experience)).ToInt(); userPlot.ExpNum = MathUtils.RoundCustom(userPlot.ExpNum * CombatHelper.GetGuildAbilityNum(user.UserID, GuildAbilityType.ExpNum)).ToInt(); userPlot.PennyNum = MathUtils.RoundCustom(userPlot.PennyNum * CombatHelper.GetGuildAbilityNum(user.UserID, GuildAbilityType.CoinNum)).ToInt(); } CacheList<PrizeItemInfo> itemList = new CacheList<PrizeItemInfo>(); string itemName = string.Empty; if (plotInfo.PlotType != PlotType.Kalpa) { var copyList = GetPrizeItems(userID, plotInfo.ItemProbability, plotInfo.ItemRank, plotInfo.PlotID, userPlot); copyList.Foreach(item => { if (item.Type == 0) { itemList.Add(item); } return true; }); if (itemList.Count > 0) { userPlot.ItemID = itemList[0].ItemID; var item = new ConfigCacheSet<ItemBaseInfo>().FindKey(userPlot.ItemID); itemName = item != null ? item.ItemName : string.Empty; } } if (!string.IsNullOrEmpty(plotInfo.EnchantID) && plotInfo.EnchantProbability > 0) { var copyList = GetKalpaPrizeItems(userID, plotInfo.ItemProbability, plotInfo.ItemRank, plotInfo.PlotID, userPlot); copyList.Foreach(item => { if (item.Type == 2) { itemList.Add(item); if (plotInfo.PlotType != PlotType.Kalpa) { userPlot.EnchantID = item.ItemID; EnchantAddUser(user, item.ItemID); } } return true; }); } if (plotInfo.PlotType == PlotType.Elite) { //精英副本奖励发聊天<label color='0,255,0' >{0}</label><label>{0}</label> string content = string.Format(LanguageManager.GetLang().St_PlotRewardNotice, user.NickName, plotNpcInfo.NpcName, itemName); new TjxChatService().SystemSend(ChatType.World, content); } //祝福加金币 if (UserHelper.GainBlessing(user, 0) > 0) { UserHelper.GainBlessing(user, 1); userPlot.BlessPennyNum = (int)Math.Floor(userPlot.PennyNum * new GuildMember().BlessingCionPercent); userPlot.PennyNum = MathUtils.Addition(userPlot.PennyNum, userPlot.BlessPennyNum); user.GameCoin = MathUtils.Addition(user.GameCoin, userPlot.PennyNum, int.MaxValue); } if (userPlot.CompleteDate <= MathUtils.SqlMinDate) { userPlot.CompleteDate = currDate; } userPlot.RefleshDate = currDate; //experience = userPlot.Experience; //userPlotCombat.Experience = experience; experience += userPlot.Experience + userPlot.BlessExperience; user.GameCoin = MathUtils.Addition(user.GameCoin, userPlot.PennyNum, int.MaxValue); user.ExpNum = MathUtils.Addition(user.ExpNum, userPlot.ExpNum, int.MaxValue); user.ItemGold = MathUtils.Addition(user.ItemGold, userPlot.GoldNum, int.MaxValue); //user.Update(); //奖励日志 UserPlotPrizeLog prizeLog = new UserPlotPrizeLog { PrizeLogID = Guid.NewGuid().ToString(), ScoreNum = userPlot.ScoreNum, StarScore = userPlot.StarScore, PrizeItem = itemList, Experience = userPlot.Experience, ExpNum = userPlot.ExpNum, GameCoin = userPlot.PennyNum, PlotID = userPlot.PlotID, UserID = userID, CreateDate = DateTime.Now }; var sender = DataSyncManager.GetDataSender(); sender.Send(prizeLog); //重置评价 foreach (UserPlotCombat plotCombat in plotCombatList) { //只有一个NPC时更新不了 //if (plotCombatList.Count > 1 && plotCombat.Equals(userPlotCombat)) continue; plotCombat.GeneralNum = 0; plotCombat.GeneralOverNum = 0; plotCombat.OverNum = 0; //plotCombat.Update(); } //通关副本 副本ID清空 if (user.UserExtend != null) { user.UserExtend.UpdateNotify(obj => { user.UserExtend.PlotStatusID = 0; user.UserExtend.PlotNpcID = 0; user.UserExtend.MercenarySeq = 0; return true; }); } package.SaveItem(userPlot); user.GeneralAllCount = 0; user.GeneralKillCount = 0; if (plotInfo.PlotType == PlotType.Normal) { int multiple = FestivalHelper.DuplicateDropDouble(user.UserID); if (multiple > 1) { FestivalHelper.DuplicateDropDoubleRestrain(user.UserID); } } } //佣兵经验 AddExprerience(user, experience); } }
private void SendStateSync(MyClientStateBase state) { var now = m_timeFunc(); ClientData clientData; if (m_clientStates.TryGetValue(state.EndpointId, out clientData)) { if (clientData.StateGroups.Count == 0) { return; } EndpointId endpointId = state.EndpointId; // TODO: Limit events clientData.EventQueue.Send(); using (m_tmpSortEntries) { foreach (var entry in clientData.StateGroups.Values) { // No state sync for pending or sleeping replicables if (!clientData.Replicables[entry.Owner].HasActiveStateSync) { continue; } entry.FramesWithoutSync++; entry.Priority = entry.Group.GetGroupPriority(entry.FramesWithoutSync, state); if (entry.Priority > 0) { m_tmpSortEntries.Add(entry); } } m_tmpSortEntries.Sort(MyStateDataEntryComparer.Instance); byte firstWaitingPacket = (byte)(clientData.LastReceivedAckId - m_outOfOrderAcceptThreshold); byte nextPacketId = (byte)(clientData.StateSyncPacketId + 1); if (clientData.WaitingForReset || nextPacketId == firstWaitingPacket) { clientData.WaitingForReset = true; return; } clientData.StateSyncPacketId++; m_sendStream.ResetWrite(); m_sendStream.WriteByte(clientData.StateSyncPacketId); int MTUBytes = (int)m_callback.GetMTUSize(endpointId); int messageBitSize = 8 * (MTUBytes - 8 - 1); // MTU - headers // TODO: Rewrite int maxToSend = MTUBytes / 8; // lets assume the shortest message is 8 Bytes long int sent = 0; // TODO:SK limit to N in panic entries per packet foreach (var entry in m_tmpSortEntries) { var oldWriteOffset = m_sendStream.BitPosition; m_sendStream.WriteNetworkId(entry.GroupId); entry.Group.Serialize(m_sendStream, state, clientData.StateSyncPacketId, messageBitSize); if (m_sendStream.BitPosition > oldWriteOffset && m_sendStream.BitPosition <= messageBitSize) { clientData.PendingStateSyncAcks[clientData.StateSyncPacketId].Add(entry.Group); sent++; entry.FramesWithoutSync = 0; } else { // When serialize returns false, restore previous bit position m_sendStream.SetBitPositionWrite(oldWriteOffset); } if (sent >= maxToSend) { break; } } m_callback.SendStateSync(m_sendStream, endpointId); //Server.SendMessage(m_sendStream, guid, PacketReliabilityEnum.UNRELIABLE, PacketPriorityEnum.MEDIUM_PRIORITY, MyChannelEnum.StateDataSync); } } }
public static void Push(MsgData data) { MsgList.Add(data); }
public void Add(string Key, DataCache DataCache) { CacheList.Add(Key, DataCache); }
private static Caches GetCaches(bool isGetAll, int pageIndex, int pageSize, string sort, bool isAsc, string cacheKey, string cacheType) { Cache _cache = HttpRuntime.Cache; IDictionaryEnumerator cacheEnum = _cache.GetEnumerator(); CacheList cl = new CacheList(); cl = new CacheList(); while (cacheEnum.MoveNext()) { if (!string.IsNullOrEmpty(cacheKey) && cacheEnum.Key.ToString().ToUpper().IndexOf(cacheKey.ToUpper()) < 0) continue; if (!string.IsNullOrEmpty(cacheType) && cacheEnum.Value.GetType().ToString().ToUpper().IndexOf(cacheType.ToUpper()) < 0) continue; cl.Add(new CacheInfo(cacheEnum.Key.ToString(), cacheEnum.Value.GetType().ToString())); } Caches rs = new Caches(); rs.CacheList = new CacheList(); if (isGetAll) { cl.SortBy(sort, isAsc); rs.CacheList.AddRange(cl); } else rs.CacheList.AddRange(cl.GetPaging(pageSize, pageIndex, sort, isAsc)); rs.Total = cl.Count; return rs; }
private static void SetRandomItem(CacheList<MysteryShops> mysteryList, List<ItemType> itemList, DateTime nextDate) { foreach (ItemType itemType in itemList) { List<ItemBaseInfo> itemArray = new ConfigCacheSet<ItemBaseInfo>().FindAll(u => u.IsMystery == 1 && u.ItemType == itemType); if (itemArray.Count == 0) { throw new Exception("刷新神秘商店出错:物品" + itemType + "类型不存在"); } ItemBaseInfo itemInfo = itemArray[RandomUtils.GetRandom(0, itemArray.Count)]; if (mysteryList.Exists(m => m.ItemID == itemInfo.ItemID)) { itemArray = new ConfigCacheSet<ItemBaseInfo>().FindAll(u => u.IsMystery == 1 && u.ItemID != itemInfo.ItemID && u.ItemType == itemType); if (itemArray.Count == 0) { throw new Exception("刷新神秘商店出错:物品" + itemType + "类型不存在"); } itemInfo = itemArray[RandomUtils.GetRandom(0, itemArray.Count)]; } mysteryList.Add(new MysteryShops() { ItemID = itemInfo.ItemID, NextDate = nextDate, BuyNum = 0, ItemNum = itemInfo.MysteryNum }); } }
/// <summary> /// 天地劫获取附魔符 /// </summary> /// <param name="userInfo"></param> /// <param name="itemList"></param> /// <param name="npcInfo"></param> /// <param name="chatService"></param> private static void GetKalpaplotEnchant(GameUser userInfo, CacheList<PrizeItemInfo> itemList, int plotID) { EnchantInfo enchantInfo = GetPrizeEnchant(userInfo.UserID, plotID); if (enchantInfo == null || enchantInfo.EnchantID == 0) return; PrizeItemInfo itemInfo = itemList.Find(m => m.ItemID == enchantInfo.EnchantID); if (itemInfo == null) { itemInfo = new PrizeItemInfo { Type = 2, ItemID = enchantInfo.EnchantID, Num = 1 }; itemList.Add(itemInfo); } else { itemInfo.Num += 1; } }
public override bool TakeAction() { UserRank rankInfo = null; var ranking = RankingFactory.Get <UserRank>(CombatRanking.RankingKey); rankInfo = UserHelper.FindRankUser(Current.UserId, RankType.Combat); if (rankInfo == null) { rankInfo = new UserRank() { UserID = Current.UserId, NickName = GetBasis.NickName, UserLv = GetBasis.UserLv, VipLv = GetBasis.VipLv, RankId = int.MaxValue, RankDate = DateTime.Now, }; ranking.TryAppend(rankInfo); rankInfo = ranking.Find(s => (s.UserID == Current.UserId)); } receipt = new CombatMatchData(); receipt.RankId = GetBasis.CombatRankID; receipt.CombatTimes = GetCombat.CombatTimes; receipt.LastFailedDate = Util.ConvertDateTimeStamp(GetCombat.LastFailedDate); //UserRank info = null; CacheList <int> MachList = new CacheList <int>(); if (rankInfo.RankId <= MaxCount) { for (int i = MaxCount; i > 0; --i) { MachList.Add(i); } } else if (rankInfo.RankId <= 30) {// 前30名去前5位 int num = 0; for (int i = rankInfo.RankId - 1; i > 0 && num < MaxCount; --i) { MachList.Add(i); num++; } } else if (rankInfo.RankId <= 100) {// 前100名去前10位 if (rankInfo.RankId <= 30 + MaxCount) { for (int i = rankInfo.RankId - 1; i > 30; --i) { MachList.Add(i); } int currcount = MachList.Count; for (int i = 30; i > 30 - (MaxCount - currcount); --i) { MachList.Add(i); } } else { int num = 0; for (int i = rankInfo.RankId - 1; i > 30 && num < 10; --i) { MachList.Add(i); num++; } } } else if (rankInfo.RankId <= 500) {// 前500名去前30位 if (rankInfo.RankId <= 100 + MaxCount) { for (int i = rankInfo.RankId - 1; i > 100; --i) { MachList.Add(i); } CacheList <int> temp = new CacheList <int>(); for (int i = 100; i > 90; --i) { temp.Add(i); } int mach; int currcount = MachList.Count; for (int i = 0; i < MaxCount - currcount; ++i) { RandMach(ref temp, out mach); MachList.Add(mach); } } else { int num = 0; for (int i = rankInfo.RankId - 1; i > 100 && num < 30; --i) { MachList.Add(i); num++; } } } else if (rankInfo.RankId <= 1000) { if (rankInfo.RankId <= 500 + MaxCount) { for (int i = rankInfo.RankId - 1; i > 500; --i) { MachList.Add(i); } CacheList <int> temp = new CacheList <int>(); for (int i = 500; i > 470; --i) { temp.Add(i); } int mach; int currcount = MachList.Count; for (int i = 0; i < MaxCount - currcount; ++i) { RandMach(ref temp, out mach); MachList.Add(mach); } } else { int num = 0; for (int i = rankInfo.RankId - 1; i > 500 && num < 100; --i) { MachList.Add(i); num++; } } } else { if (rankInfo.RankId <= 1000 + MaxCount) { for (int i = rankInfo.RankId - 1; i > 1000; --i) { MachList.Add(i); } CacheList <int> temp = new CacheList <int>(); for (int i = 1000; i > 900; --i) { temp.Add(i); } int mach; int currcount = MachList.Count; for (int i = 0; i < MaxCount - currcount; ++i) { RandMach(ref temp, out mach); MachList.Add(mach); } } else { int num = 0; for (int i = rankInfo.RankId - 1; i > 1000 && num < 200; --i) { MachList.Add(i); num++; } } } int mach_tops; for (int i = 0; MachList.Count > 0 && i < MaxCount; ++i) { RandMach(ref MachList, out mach_tops); int rankID = 0; UserRank machinfo = null; if (ranking.TryGetRankNo(m => (m.RankId == mach_tops), out rankID)) { machinfo = ranking.Find(s => (s.RankId == mach_tops)); } if (machinfo != null) { UserAttributeCache attribute = UserHelper.FindUserAttribute(machinfo.UserID); UserEquipsCache equips = UserHelper.FindUserEquips(machinfo.UserID); CombatMatchUserData data = new CombatMatchUserData() { UserId = machinfo.UserID, NickName = machinfo.NickName, Profession = machinfo.Profession, AvatarUrl = machinfo.AvatarUrl, RankId = machinfo.RankId, UserLv = machinfo.UserLv, VipLv = machinfo.VipLv, FightingValue = attribute.FightValue, Equips = equips, // SkillCarryList = user.SkillCarryList }; receipt.RivalList.Add(data); } } // 日志 //foreach (CombatLogData data in GetCombat.LogList) //{ // UserRank info = null; // if (ranking.TryGetRankNo(m => (m.UserID == data.UserId), out rankID)) // { // info = ranking.Find(s => (s.UserID == data.UserId)); // } // JPCombatLogData cld = new JPCombatLogData(); // cld.UserId = data.UserId; // if (info != null) // cld.RivalCurrRankId = info.RankId; // cld.Type = data.Type; // cld.FightResult = data.Status; // cld.Log = UserHelper.FormatCombatLog(data); // receipt.LogList.Add(cld); //} return(true); }
/// <summary> /// 天地劫获取灵件 /// </summary> /// <param name="userInfo"></param> /// <param name="itemList"></param> /// <param name="npcInfo"></param> /// <param name="chatService"></param> private static void GetKalpaplotSparePart(GameUser userInfo, CacheList<PrizeItemInfo> itemList, PlotNPCInfo npcInfo, TjxChatService chatService) { if (npcInfo != null && RandomUtils.IsHit(npcInfo.SparePartProbability)) { SparePartInfo partInfo = new ConfigCacheSet<SparePartInfo>().FindKey(npcInfo.SparePartID); if (partInfo != null && SparePartInfo.IsExist(npcInfo.SparePartID)) { UserSparePart sparePart = UserSparePart.GetRandom(npcInfo.SparePartID); if (sparePart != null) { PrizeItemInfo itemInfo = itemList.Find(m => m.ItemID == npcInfo.SparePartID); if (itemInfo == null) { itemInfo = new PrizeItemInfo { Type = 1, ItemID = npcInfo.SparePartID, Num = 1 }; itemList.Add(itemInfo); } else { itemInfo.Num += 1; } if (UserHelper.AddSparePart(userInfo, sparePart)) { //userInfo.Update(); } else { //掉落灵件 chatService.SystemSendWhisper(userInfo, string.Format(LanguageManager.GetLang().St4303_SparePartFalling, partInfo.Name)); } } } } }
public override bool TakeAction() { var syntheList = new CacheList <SynthesisInfo>(); var package = UserEnchant.Get(ContextUser.UserID); if (ops == 1) { UserEnchantInfo userEnchantinfo1 = package.EnchantPackage.Find(m => m.UserEnchantID == userEnchantID1); UserEnchantInfo userEnchantinfo2 = package.EnchantPackage.Find(m => m.UserEnchantID == userEnchantID2); if (userEnchantinfo1 == null || userEnchantinfo2 == null) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St1256_EnchantNotEnough; return(false); } if (userEnchantinfo1.EnchantLv >= GameConfigSet.MaxEnchantLv) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St1256_OutMaxEnchantLv; return(false); } int entExprience1 = 0; int entExprience2 = 0; EnchantInfo enchant1 = new ShareCacheStruct <EnchantInfo>().FindKey(userEnchantinfo1.EnchantID); EnchantInfo enchant2 = new ShareCacheStruct <EnchantInfo>().FindKey(userEnchantinfo2.EnchantID); if (enchant1 != null && enchant2 != null) { entExprience1 = enchant1.Experience; entExprience2 = enchant2.Experience; if (userEnchantinfo1.EnchantLv > userEnchantinfo2.EnchantLv || (userEnchantinfo1.EnchantLv == userEnchantinfo2.EnchantLv && userEnchantinfo1.CurrExprience >= userEnchantinfo2.CurrExprience)) { UpdateEnchant(userEnchantID1, userEnchantID2, entExprience2); syntheList.Add(new SynthesisInfo() { DemandID = userEnchantinfo2.EnchantID, Num = userEnchantinfo2.CurrExprience }); UserLogHelper.AppenEnchantLog(ContextUser.UserID, 4, userEnchantinfo1, syntheList); } else { UpdateEnchant(userEnchantID2, userEnchantID1, entExprience1); syntheList.Add(new SynthesisInfo() { DemandID = userEnchantinfo1.EnchantID, Num = userEnchantinfo1.CurrExprience }); UserLogHelper.AppenEnchantLog(ContextUser.UserID, 4, userEnchantinfo2, syntheList); } } } else if (ops == 2) { int experience = 0; var enchantArray = package.EnchantPackage.FindAll(m => string.IsNullOrEmpty(m.UserItemID)); if (enchantArray.Count == 0) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St1256_EnchantNotEnough; return(false); } if (enchantArray.Count == 1) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St1256_EnchantNumNotEnough; return(false); } enchantArray.QuickSort((x, y) => { int result = 0; if (x == null && y == null) { return(0); } if (x != null && y == null) { return(1); } if (x == null) { return(-1); } result = y.EnchantLv.CompareTo(x.EnchantLv); if (result == 0) { result = y.CurrExprience.CompareTo(x.CurrExprience); } return(result); }); UserEnchantInfo uEnchantInfo = package.EnchantPackage.Find(m => m.UserEnchantID == enchantArray[0].UserEnchantID); if (uEnchantInfo == null) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St1262_EnchantSynthesisNotEnough; return(false); } EnchantLvInfo enchantLvInfo = new ShareCacheStruct <EnchantLvInfo>().FindKey(uEnchantInfo.EnchantID, GameConfigSet.MaxEnchantLv); int maxExprience = enchantLvInfo == null ? 0 : enchantLvInfo.Experience; foreach (var info in enchantArray) { EnchantInfo enchantInfo = new ShareCacheStruct <EnchantInfo>().FindKey(info.EnchantID); if (enchantInfo != null) { experience = enchantInfo.Experience; } if (uEnchantInfo.UserEnchantID != info.UserEnchantID) { if (uEnchantInfo.CurrExprience >= maxExprience) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St1256_OutMaxEnchantLv; return(false); } syntheList.Add(new SynthesisInfo() { DemandID = info.EnchantID, Num = info.CurrExprience }); UpdateEnchant(uEnchantInfo.UserEnchantID, info.UserEnchantID, experience); } } UserLogHelper.AppenEnchantLog(ContextUser.UserID, 4, uEnchantInfo, syntheList); } return(true); }
/// <summary> /// 扫荡副本 /// </summary> /// <param name="userID"></param> /// <param name="itemProbability"></param> /// <param name="itemRank"></param> /// <returns></returns> private static CacheList<PrizeItemInfo> GetPrizeItems(string userID, decimal itemProbability, string itemRank, int plotID, UserPlotInfo userPlot) { List<UniversalInfo> universalInfoList = new List<UniversalInfo>(); var itemList = new CacheList<PrizeItemInfo>(); string[] items = itemRank.Trim().Split(new[] { ',' }); int count = items.Length + 1; int[] precent = new int[count]; int precentNum = 0; for (int i = 0; i < count; i++) { if (i != (count - 1)) { var itemInfo = items[i].Split('='); decimal prize = itemInfo[2].ToDecimal(); precent[i] = (prize * 1000).ToInt(); precentNum = MathUtils.Addition(precentNum, precent[i]); } else { precent[i] = (1000 - precentNum); } } int index = RandomUtils.GetHitIndexByTH(precent); if (index != (count - 1)) { int itemId = 0; int num = 0; if (items.Length > 1) { itemId = items[index].Split('=')[0].ToInt(); num = items[index].Split('=')[1].ToInt(); } else { itemId = items[0].Split('=')[0].ToInt(); num = items[0].Split('=')[1].ToInt(); } var itemBase = new ConfigCacheSet<ItemBaseInfo>().FindKey(itemId); if (itemBase != null) { PrizeItemInfo prizeItem = itemList.Find(m => m.ItemID == itemId); if (prizeItem == null) { prizeItem = new PrizeItemInfo { Type = 0, ItemID = itemId, Num = num }; itemList.Add(prizeItem); } else { prizeItem.Num += num; } } } GameUser userInfo = new GameDataCacheSet<GameUser>().FindKey(userID); foreach (var itemInfo in itemList) { UserItemHelper.AddUserItem(userID, itemInfo.ItemID, itemInfo.Num, universalInfoList); if (userInfo != null) { CacheList<PrizeItemInfo> prizeItemInfos = new CacheList<PrizeItemInfo>(); prizeItemInfos.Add(new PrizeItemInfo() { Type = 0, ItemID = itemInfo.ItemID, Num = itemInfo.Num }); if (prizeItemInfos.Count > 0) { userInfo.UserExtend.UpdateNotify(obj => { userInfo.UserExtend.ItemList = prizeItemInfos; return true; }); //userInfo.Update(); } } } NoviceHelper.PlotFestivalList(userInfo, plotID); //活动集合 if (universalInfoList.Count > 0) { foreach (var item in universalInfoList) { if (userPlot.ItemList != null) { userPlot.ItemList.Add(item); } } } return itemList; }
public override bool TakeAction() { var syntheList = new CacheList<SynthesisInfo>(); var package = UserEnchant.Get(ContextUser.UserID); if (ops == 1) { UserEnchantInfo userEnchantinfo1 = package.EnchantPackage.Find(m => m.UserEnchantID == userEnchantID1); UserEnchantInfo userEnchantinfo2 = package.EnchantPackage.Find(m => m.UserEnchantID == userEnchantID2); if (userEnchantinfo1 == null || userEnchantinfo2 == null) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St1256_EnchantNotEnough; return false; } if (userEnchantinfo1.EnchantLv >= GameConfigSet.MaxEnchantLv) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St1256_OutMaxEnchantLv; return false; } int entExprience1 = 0; int entExprience2 = 0; EnchantInfo enchant1 = new ConfigCacheSet<EnchantInfo>().FindKey(userEnchantinfo1.EnchantID); EnchantInfo enchant2 = new ConfigCacheSet<EnchantInfo>().FindKey(userEnchantinfo2.EnchantID); if (enchant1 != null && enchant2 != null) { entExprience1 = enchant1.Experience; entExprience2 = enchant2.Experience; if (userEnchantinfo1.EnchantLv > userEnchantinfo2.EnchantLv || (userEnchantinfo1.EnchantLv == userEnchantinfo2.EnchantLv && userEnchantinfo1.CurrExprience >= userEnchantinfo2.CurrExprience)) { UpdateEnchant(userEnchantID1, userEnchantID2, entExprience2); syntheList.Add(new SynthesisInfo() { DemandID = userEnchantinfo2.EnchantID, Num = userEnchantinfo2.CurrExprience }); UserLogHelper.AppenEnchantLog(ContextUser.UserID, 4, userEnchantinfo1, syntheList); } else { UpdateEnchant(userEnchantID2, userEnchantID1, entExprience1); syntheList.Add(new SynthesisInfo() { DemandID = userEnchantinfo1.EnchantID, Num = userEnchantinfo1.CurrExprience }); UserLogHelper.AppenEnchantLog(ContextUser.UserID, 4, userEnchantinfo2, syntheList); } } } else if (ops == 2) { int experience = 0; var enchantArray = package.EnchantPackage.FindAll(m => string.IsNullOrEmpty(m.UserItemID)); if (enchantArray.Count == 0) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St1256_EnchantNotEnough; return false; } if (enchantArray.Count == 1) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St1256_EnchantNumNotEnough; return false; } enchantArray.QuickSort((x, y) => { int result = 0; if (x == null && y == null) return 0; if (x != null && y == null) return 1; if (x == null) return -1; result = y.EnchantLv.CompareTo(x.EnchantLv); if (result == 0) { result = y.CurrExprience.CompareTo(x.CurrExprience); } return result; }); UserEnchantInfo uEnchantInfo = package.EnchantPackage.Find(m => m.UserEnchantID == enchantArray[0].UserEnchantID); if (uEnchantInfo == null) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St1262_EnchantSynthesisNotEnough; return false; } EnchantLvInfo enchantLvInfo = new ConfigCacheSet<EnchantLvInfo>().FindKey(uEnchantInfo.EnchantID, GameConfigSet.MaxEnchantLv); int maxExprience = enchantLvInfo == null ? 0 : enchantLvInfo.Experience; foreach (var info in enchantArray) { EnchantInfo enchantInfo = new ConfigCacheSet<EnchantInfo>().FindKey(info.EnchantID); if (enchantInfo != null) { experience = enchantInfo.Experience; } if (uEnchantInfo.UserEnchantID != info.UserEnchantID) { if (uEnchantInfo.CurrExprience >= maxExprience) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St1256_OutMaxEnchantLv; return false; } syntheList.Add(new SynthesisInfo() { DemandID = info.EnchantID, Num = info.CurrExprience }); UpdateEnchant(uEnchantInfo.UserEnchantID, info.UserEnchantID, experience); } } UserLogHelper.AppenEnchantLog(ContextUser.UserID, 4, uEnchantInfo, syntheList); } return true; }
public static CacheList<PrizeItemInfo> GetPlotMonsterItems(string userID, int plotNpcID) { CacheList<PrizeItemInfo> itemList = new CacheList<PrizeItemInfo>(); GameUser userInfo = new GameDataCacheSet<GameUser>().FindKey(userID); if (userInfo != null) { int doubleitem = GetDouble(userID, plotNpcID); int multiple = FestivalHelper.DuplicateDropDouble(userID); List<PlotEmbattleInfo> embattleInfoList = new ConfigCacheSet<PlotEmbattleInfo>().FindAll(m => m.PlotNpcID == plotNpcID); foreach (PlotEmbattleInfo embattleInfo in embattleInfoList) { MonsterInfo monster = new ConfigCacheSet<MonsterInfo>().FindKey(embattleInfo.MonsterID); if (monster == null) { continue; } //原因:活动类型修改 if (RandomUtils.IsHit(NoviceHelper.FestivalMultiple(monster.ItemProbability))) //if (RandomUtils.IsHit(FestivalHelper.DuplicateDropDouble(userID, monster.ItemProbability))) { if (ItemBaseInfo.IsExist(monster.ItemID)) { PrizeItemInfo itemInfo = itemList.Find(m => m.ItemID == monster.ItemID); if (itemInfo == null) { itemInfo = new PrizeItemInfo { Type = 0, ItemID = monster.ItemID, Num = 1 * doubleitem * multiple }; itemList.Add(itemInfo); } else { itemInfo.Num += 1 * doubleitem * multiple; } } } } foreach (var itemInfo in itemList) { UserItemHelper.AddUserItem(userID, itemInfo.ItemID, itemInfo.Num); CacheList<PrizeItemInfo> prizeItemInfos = new CacheList<PrizeItemInfo>(); prizeItemInfos.Add(new PrizeItemInfo() { Type = 0, ItemID = itemInfo.ItemID, Num = itemInfo.Num }); if (prizeItemInfos.Count > 0) { userInfo.UserExtend.UpdateNotify(obj => { userInfo.UserExtend.ItemList = prizeItemInfos; return true; }); //userInfo.Update(); } } } return itemList; }
public override bool TakeAction() { var package = UserCrystalPackage.Get(Uid); if (ops == 1) { UserCrystalInfo userCryStal1 = package.CrystalPackage.Find(m => m.UserCrystalID.Equals(userCrystalID1)); UserCrystalInfo userCryStal2 = package.CrystalPackage.Find(m => m.UserCrystalID.Equals(userCrystalID2)); // UserCrystal userCryStal1 = UserCrystal.FindKey(userCrystalID1); //UserCrystal userCryStal2 = UserCrystal.FindKey(userCrystalID2); if (userCryStal1 == null || userCryStal2 == null) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St1308_CrystalNotEnough; return false; } if (userCryStal1.CrystalLv > 9) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St1308_CrystalLvFull; return false; } CrystalInfo crystalInfo1 = new ShareCacheStruct<CrystalInfo>().FindKey(userCryStal1.CrystalID); CrystalInfo crystalInfo2 = new ShareCacheStruct<CrystalInfo>().FindKey(userCryStal2.CrystalID); int cryExprience1 = 0; int cryExprience2 = 0; if (crystalInfo1 != null && crystalInfo2 != null) { cryExprience1 = crystalInfo1.Experience; cryExprience2 = crystalInfo2.Experience; if (crystalInfo1.CrystalQuality == crystalInfo2.CrystalQuality) { if (userCryStal1.CurrExprience >= userCryStal2.CurrExprience) { UpdateCrystal(userCrystalID1, userCrystalID2, cryExprience2); } else { UpdateCrystal(userCrystalID2, userCrystalID1, cryExprience1); } } else if (crystalInfo1.CrystalQuality > crystalInfo2.CrystalQuality) { UpdateCrystal(userCrystalID1, userCrystalID2, cryExprience2); } else { UpdateCrystal(userCrystalID2, userCrystalID1, cryExprience1); } } } else if (ops == 2) { CacheList<SynthesisInfo> SynList = new CacheList<SynthesisInfo>(); int experience = 0; var userCrystalArray = package.CrystalPackage.FindAll(m => m.IsSale == 2 && m.GeneralID.Equals(0)); if (userCrystalArray.Count == 0) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St1308_CrystalNotEnough; return false; } userCrystalArray.QuickSort((x, y) => { int result = 0; if (x == null && y == null) return 0; if (x != null && y == null) return 1; if (x == null) return -1; result = (int)new ShareCacheStruct<CrystalInfo>().FindKey(y.CrystalID).CrystalQuality.CompareTo( new ShareCacheStruct<CrystalInfo>().FindKey(x.CrystalID).CrystalQuality); if (result == 0) { result = y.CurrExprience.CompareTo(x.CurrExprience); } return result; }); UserCrystalInfo userCrystal1 = package.CrystalPackage.Find(m => m.UserCrystalID == userCrystalArray[0].UserCrystalID); int maxExprience = 0; if (userCrystal1 == null) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St1308_CrystalNotEnough; return false; } short upLv = 10; CrystalLvInfo crystalLvInfo = new ShareCacheStruct<CrystalLvInfo>().FindKey(userCrystal1.CrystalID, upLv); maxExprience = crystalLvInfo == null ? 0 : crystalLvInfo.UpExperience; foreach (UserCrystalInfo crystal in userCrystalArray) { CrystalInfo crystalInfo = new ShareCacheStruct<CrystalInfo>().FindKey(crystal.CrystalID); if (crystalInfo != null) { experience = crystalInfo.Experience; } if (userCrystal1.UserCrystalID != crystal.UserCrystalID) { SynList.Add(new SynthesisInfo() { DemandID = crystal.CrystalID, Num = crystal.CurrExprience }); if (userCrystal1.CurrExprience >= maxExprience) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St1308_CrystalLvFull; break; } experience = MathUtils.Addition(experience, userCrystal1.CurrExprience); experience = MathUtils.Addition(experience, crystal.CurrExprience); userCrystal1.CurrExprience = experience; package.SaveCrystal(userCrystal1); //package.DelayChange(); package.RemoveCrystal(crystal); } } UserLogHelper.AppenCtystalLog(ContextUser.UserID, 3, userCrystal1.CrystalID, 0, 0, SynList, userCrystal1.CrystalLv, userCrystal1.CurrExprience); UserHelper.CheckCrystalEscalate(ContextUser.UserID, userCrystalArray[0].UserCrystalID); } return true; }
/// <summary> /// Marks replicable as successfully created, ready to receive events and state groups data. /// </summary> void SetReplicableReady(NetworkId networkId, IMyReplicable replicable, bool loaded) { MyPendingReplicable pendingReplicable; if (m_pendingReplicables.TryGetValue(networkId, out pendingReplicable)) { m_pendingReplicables.Remove(networkId); if (loaded) { var ids = pendingReplicable.StateGroupIds; AddNetworkObjectClient(networkId, replicable); using (m_tmpGroups) { IMyStreamableReplicable streamable = replicable as IMyStreamableReplicable; if (streamable != null && pendingReplicable.IsStreaming) { var group = streamable.GetStreamingStateGroup(); m_tmpGroups.Add(group); } replicable.GetStateGroups(m_tmpGroups); Debug.Assert(ids.Count == m_tmpGroups.Count, "Number of state groups on client and server for replicable does not match"); for (int i = 0; i < m_tmpGroups.Count; i++) { if (m_tmpGroups[i] != replicable && m_tmpGroups[i].GroupType != StateGroupEnum.Streamining) { AddNetworkObjectClient(ids[i], m_tmpGroups[i]); } } } m_eventBuffer.ProcessEvents(networkId, m_eventHandler, m_isBlockedHandler, NetworkId.Invalid); } else { MyLog.Default.WriteLine("Failed to create replicable ! Type : " + replicable.ToString()); m_eventBuffer.RemoveEvents(networkId); IMyStreamableReplicable streamable = replicable as IMyStreamableReplicable; if (streamable != null && pendingReplicable.IsStreaming) { var group = streamable.GetStreamingStateGroup(); group.Destroy(); NetworkId streaingGroupId; if (TryGetNetworkIdByObject(group, out streaingGroupId)) { RemoveNetworkedObject(group); } MyLog.Default.WriteLine("removing streaming group for not loaded replicable !"); } } m_sendStream.ResetWrite(); m_sendStream.WriteNetworkId(networkId); m_sendStream.WriteBool(loaded); m_callback.SendReplicableReady(m_sendStream); } else { m_pendingReplicables.Remove(networkId); using (m_tmpGroups) { IMyStreamableReplicable streamable = replicable as IMyStreamableReplicable; if (streamable != null && streamable.NeedsToBeStreamed) { var group = streamable.GetStreamingStateGroup(); m_tmpGroups.Add(group); MyLog.Default.WriteLine("removing streaming group for not loaded replicable !"); } replicable.GetStateGroups(m_tmpGroups); foreach (var g in m_tmpGroups) { if (g != null) // when terminal repblicable fails to attach to block its state group is null becouase its created inside hook method. { g.Destroy(); } } } replicable.OnDestroy(); } }