/// <summary> ///Clear 的测试 ///</summary> public void ClearTestHelper <KeyT, ValueT>() { SafeDictionary <KeyT, ValueT> target = new SafeDictionary <KeyT, ValueT>(); // TODO: 初始化为适当的值 target.Clear(); Assert.Inconclusive("无法验证不返回值的方法。"); }
internal void Reset() { this.totalCount = 0; this.loadedCount = 0; groupRes.Clear(); loadingGroupRes.Clear(); errRes.Clear(); }
void IDisposable.Dispose() { if (insertValues != null) { insertValues.Clear(); insertFields.Clear(); } _command = null; }
internal void Reset() { this.totalCount = 0; this.loadedCount = 0; groupRes.Clear(); loadingGroupRes.Clear(); errRes.Clear(); onComplete = null; onProgress = null; pool = false; }
private void Uncapture() { foreach (var resource in _readLog) { resource.Key.Release(); } foreach (var resource in _writeLog) { resource.Key.Release(); } _readLog.Clear(); _writeLog.Clear(); }
public void 清除SafeDictionary_清除成功_SafeDictionary長度應為0() { var safeDictionary = new SafeDictionary <int, int> { { 1, 2 }, { 2, 3 }, { 3, 4 } }; safeDictionary.Clear(); const int expectedCount = 0; safeDictionary.Count.Should().Be(expectedCount); }
public void Stop() { if (state != State.Bound) { return; } state = State.ShuttingDown; foreach (Connection c in Connections.Values()) { Send(c.Conn, SignatureMessage.disconnectSigMes); } Connections.Clear(); CleanupThreads(); state = State.RedyToBind; }
internal void ClearItems() { using (IQueryAdapter dbClient = ButterflyEnvironment.GetDatabaseManager().getQueryreactor()) { dbClient.runFastQuery("DELETE FROM items_users WHERE user_id = " + UserId); //Do join //dbClient.runFastQuery("DELETE FROM user_items_songs WHERE user_id = " + UserId); } mAddedItems.Clear(); mRemovedItems.Clear(); floorItems.Clear(); wallItems.Clear(); discs.Clear(); InventoryPets.Clear(); isUpdated = true; mClient.GetMessageHandler().GetResponse().Init(101); GetClient().GetMessageHandler().SendResponse(); }
public void OnDisconnect(object sender, string reason, Bot bot) { lock (tasks) { while (tasks.Count > 0) { Task task = tasks.Dequeue().task; if (BotUtility.isTaskRunning(task)) { task.Dispose(); } } } lock (subBots) { foreach (SubBot o in subBots.Values) { if (o != null) { o.onDisconnect(sender, reason, bot); o.onDisable(bot); bot.form.Invoke(new Action(() => { if (o.HasForm) { o.Form.Close(); } })); } } System.Threading.Thread.Sleep(500); subBots.Clear(); bot.form.Invoke(new Action(() => bot.form.subbotCheckedListBox.Items.Clear() )); } }
/// <summary> /// /// </summary> public void EmptyActionBars() { m_ToteActionBars.Clear(); }
public void 繞行SafeDictionary操作集合_不同執行緒同時對SafeDictionary新增與刪除元素_不應擲出例外() { var safeDictionary = new SafeDictionary <int, int> { { 1, 3 }, { 2, 8 }, { 3, 9 } }; Task.Run(() => { while (true) { safeDictionary.Add(0, 1); safeDictionary.Add(5, 7); safeDictionary.Add(2, 3); } }); Task.Run(() => { while (true) { ((ICollection <KeyValuePair <int, int> >)safeDictionary).Add(new KeyValuePair <int, int>(6, 1)); ((ICollection <KeyValuePair <int, int> >)safeDictionary).Add(new KeyValuePair <int, int>(7, 10)); ((ICollection <KeyValuePair <int, int> >)safeDictionary).Add(new KeyValuePair <int, int>(8, 4)); } }); Task.Run(() => { while (true) { ((ICollection <KeyValuePair <int, int> >)safeDictionary).Remove(new KeyValuePair <int, int>(6, 1)); ((ICollection <KeyValuePair <int, int> >)safeDictionary).Remove(new KeyValuePair <int, int>(7, 10)); ((ICollection <KeyValuePair <int, int> >)safeDictionary).Remove(new KeyValuePair <int, int>(8, 4)); } }); Task.Run(() => { while (true) { safeDictionary.Remove(2); safeDictionary.Remove(5); safeDictionary.Remove(0); } }); Task.Run(() => { while (true) { safeDictionary.Clear(); } }); var iterateKeyValuePairs = IterateDictionary(safeDictionary); var iterateKeys = IterateCollection(safeDictionary.Keys); var iterateValues = IterateCollection(safeDictionary.Values); Action action = () => Task.WaitAll(iterateKeys, iterateValues, iterateKeyValuePairs); action.Should().NotThrow(); }
private void CancelExtracted(bool throwOnFirstException, SafeDictionary<CancellationTokenRegistration, Action> callbacks) { if (Interlocked.CompareExchange(ref _cancelRequested, 1, 0) == 0) { _handle.Set(); UnregisterLinkedTokens(); List<Exception> exceptions = null; try { int id = _currentId; do { Action callback; if (callbacks.Remove(new CancellationTokenRegistration(id, this), out callback) && callback != null) { if (throwOnFirstException) { callback(); } else { try { callback(); } catch (Exception exception) { if (ReferenceEquals(exceptions, null)) { exceptions = new List<Exception>(); } exceptions.Add(exception); } } } } while (id-- != int.MinValue); } finally { callbacks.Clear(); } if (exceptions != null) { throw new AggregateException(exceptions); } } }
public static void ClearDns() { cacheDns.Clear(); cacheTime.Clear(); }
/// <summary> /// /// </summary> public void EmptyContainer() { m_ToteSubItems.Clear(); }
public Reincarnation(Client.GameState client, byte new_class) { if (client.Entity.Level < 130) return; _client = client; RemoveSkill = new SafeDictionary<ushort, PhoenixProject.Interfaces.ISkill>(500); Addskill = new SafeDictionary<ushort, PhoenixProject.Interfaces.ISkill>(500); #region Low level items for (byte i = 1; i < 9; i++) { if (i != 7) { Interfaces.IConquerItem item = client.Equipment.TryGetItem(i); if (item != null && item.ID != 0) { try { //client.UnloadItemStats(item, false); Database.ConquerItemInformation cii = new PhoenixProject.Database.ConquerItemInformation(item.ID, item.Plus); item.ID = cii.LowestID(Network.PacketHandler.ItemMinLevel(Network.PacketHandler.ItemPosition(item.ID))); item.Mode = PhoenixProject.Game.Enums.ItemMode.Update; item.Send(client); client.LoadItemStats(client.Entity); Database.ConquerItemTable.UpdateItemID(item, client); } catch { Console.WriteLine("Reborn item problem: " + item.ID); } } } } Interfaces.IConquerItem hand = client.Equipment.TryGetItem(5); if (hand != null) { client.Equipment.Remove(5); client.CalculateStatBonus(); client.CalculateHPBonus(); client.SendStatMessage(); } else //client.Screen.send(client.Entity.SpawnPacket, false); #endregion #region Remove Extra Skill if (client.Entity.FirstRebornClass == 15 && client.Entity.SecondRebornClass == 15 && client.Entity.Class == 15) { WontAdd(PhoenixProject.Game.Enums.SkillIDs.DragonWhirl); } if (client.Entity.FirstRebornClass == 25 && client.Entity.SecondRebornClass == 25 && client.Entity.Class == 25) { WontAdd(PhoenixProject.Game.Enums.SkillIDs.Perseverance); } if (client.Entity.FirstRebornClass == 45 && client.Entity.SecondRebornClass == 45 && client.Entity.Class == 45) { WontAdd(PhoenixProject.Game.Enums.SkillIDs.StarArrow); } if (client.Entity.FirstRebornClass == 55 && client.Entity.SecondRebornClass == 55 && client.Entity.Class == 55) { WontAdd(PhoenixProject.Game.Enums.SkillIDs.PoisonStar); } if (client.Entity.FirstRebornClass == 65 && client.Entity.SecondRebornClass == 65 && client.Entity.Class == 65) { WontAdd(PhoenixProject.Game.Enums.SkillIDs.SoulShackle); } if (client.Entity.FirstRebornClass == 135 && client.Entity.SecondRebornClass == 135 && client.Entity.Class == 135) { WontAdd(PhoenixProject.Game.Enums.SkillIDs.AzureShield); } if (client.Entity.FirstRebornClass == 145 && client.Entity.SecondRebornClass == 145 && client.Entity.Class == 145) { WontAdd(PhoenixProject.Game.Enums.SkillIDs.HeavenBlade); } #endregion Database.ReincarnationTable.NewReincarnated(client.Entity); Game.Features.Reincarnation.ReincarnateInfo info = new Game.Features.Reincarnation.ReincarnateInfo(); info.UID = client.Entity.UID; info.Level = client.Entity.Level; info.Experience = client.Entity.Experience; ServerBase.Kernel.ReincarnatedCharacters.Add(info.UID, info); client.Entity.FirstRebornClass = client.Entity.SecondRebornClass; client.Entity.SecondRebornClass = client.Entity.Class; client.Entity.Class = new_class; client.Entity.SecondRebornLevel = client.Entity.Level; client.Entity.Level = 15; client.Entity.Experience = 0; client.Entity.Atributes = (ushort)(client.ExtraAtributePoints(client.Entity.FirstRebornClass, client.Entity.FirstRebornLevel) + client.ExtraAtributePoints(client.Entity.SecondRebornClass, client.Entity.SecondRebornLevel) + 62); client.Spells.Clear(); client.Spells = new SafeDictionary<ushort, PhoenixProject.Interfaces.ISkill>(100); switch (client.Entity.FirstRebornClass) { case 15: { Add(PhoenixProject.Game.Enums.SkillIDs.Cyclone); Add(PhoenixProject.Game.Enums.SkillIDs.Hercules); Add(PhoenixProject.Game.Enums.SkillIDs.SpiritHealing); Add(PhoenixProject.Game.Enums.SkillIDs.Robot); break; } case 25: { Add(PhoenixProject.Game.Enums.SkillIDs.SuperMan); Add(PhoenixProject.Game.Enums.SkillIDs.Dash); Add(PhoenixProject.Game.Enums.SkillIDs.Shield); break; } case 45: { Add(PhoenixProject.Game.Enums.SkillIDs.Intensify); Add(PhoenixProject.Game.Enums.SkillIDs.Scatter); Add(PhoenixProject.Game.Enums.SkillIDs.RapidFire); Add(PhoenixProject.Game.Enums.SkillIDs.XPFly); Add(PhoenixProject.Game.Enums.SkillIDs.AdvancedFly); break; } case 55: { Add(PhoenixProject.Game.Enums.SkillIDs.FatalStrike); Add(PhoenixProject.Game.Enums.SkillIDs.ShurikenVortex); Add(PhoenixProject.Game.Enums.SkillIDs.ToxicFog); Add(PhoenixProject.Game.Enums.SkillIDs.TwofoldBlades); Add(PhoenixProject.Game.Enums.SkillIDs.PoisonStar); break; } case 65: { Add(PhoenixProject.Game.Enums.SkillIDs.RadiantPalm); Add(PhoenixProject.Game.Enums.SkillIDs.WhirlWindKick); Add(PhoenixProject.Game.Enums.SkillIDs.TripleAttack); Add(PhoenixProject.Game.Enums.SkillIDs.Oblivion); Add(PhoenixProject.Game.Enums.SkillIDs.Serenity); Add(PhoenixProject.Game.Enums.SkillIDs.Compassion); Add(PhoenixProject.Game.Enums.SkillIDs.TyrantAura); Add(PhoenixProject.Game.Enums.SkillIDs.TyrantAura); Add(PhoenixProject.Game.Enums.SkillIDs.DeflectionAura); break; } case 75: { Add(PhoenixProject.Game.Enums.SkillIDs.RadiantPalm); Add(PhoenixProject.Game.Enums.SkillIDs.WhirlWindKick); Add(PhoenixProject.Game.Enums.SkillIDs.TripleAttack); Add(PhoenixProject.Game.Enums.SkillIDs.Oblivion); Add(PhoenixProject.Game.Enums.SkillIDs.Serenity); Add(PhoenixProject.Game.Enums.SkillIDs.Compassion); Add(PhoenixProject.Game.Enums.SkillIDs.TyrantAura); Add(PhoenixProject.Game.Enums.SkillIDs.TyrantAura); Add(PhoenixProject.Game.Enums.SkillIDs.DeflectionAura); break; } case 135: { Add(PhoenixProject.Game.Enums.SkillIDs.Thunder); Add(PhoenixProject.Game.Enums.SkillIDs.WaterElf); Add(PhoenixProject.Game.Enums.SkillIDs.Cure); Add(PhoenixProject.Game.Enums.SkillIDs.Lightning); Add(PhoenixProject.Game.Enums.SkillIDs.Volcano); Add(PhoenixProject.Game.Enums.SkillIDs.Pray); Add(PhoenixProject.Game.Enums.SkillIDs.AdvancedCure); Add(PhoenixProject.Game.Enums.SkillIDs.Meditation); Add(PhoenixProject.Game.Enums.SkillIDs.Stigma); break; } case 140: { Add(PhoenixProject.Game.Enums.SkillIDs.Thunder); Add(PhoenixProject.Game.Enums.SkillIDs.Cure); Add(PhoenixProject.Game.Enums.SkillIDs.Lightning); Add(PhoenixProject.Game.Enums.SkillIDs.Tornado); Add(PhoenixProject.Game.Enums.SkillIDs.FireCircle); Add(PhoenixProject.Game.Enums.SkillIDs.FireMeteor); Add(PhoenixProject.Game.Enums.SkillIDs.FireRing); break; } } byte PreviousClass = client.Entity.FirstRebornClass; byte toClass = (byte)(client.Entity.SecondRebornClass - 4); Interfaces.ISkill[] ADD_spells = this.Addskill.Values.ToArray(); foreach (Interfaces.ISkill skill in ADD_spells) { skill.Available = true; if (!client.Spells.ContainsKey(skill.ID)) client.Spells.Add(skill.ID, skill); } #region Spells Interfaces.ISkill[] spells = client.Spells.Values.ToArray(); foreach (Interfaces.ISkill spell in spells) { spell.PreviousLevel = spell.Level; spell.Level = 0; spell.Experience = 0; #region Pirate if (PreviousClass == 75) { if (client.Entity.Class != 71) { switch (spell.ID) { case 10490: case 10415: case 10381: client.RemoveSpell(spell); break; } } } #endregion #region Monk if (PreviousClass == 65) { if (client.Entity.Class != 61) { switch (spell.ID) { case 10490: case 10415: case 10381: client.RemoveSpell(spell); break; } } } #endregion #region Warrior if (PreviousClass == 25) { if (client.Entity.Class != 21) { switch (spell.ID) { case 1025: if (client.Entity.Class != 21 && client.Entity.Class != 132) client.RemoveSpell(spell); break; } } } #endregion #region Ninja if (toClass != 51) { switch (spell.ID) { case 6010: case 6000: case 6011: client.RemoveSpell(spell); break; } } #endregion #region Trojan if (toClass != 11) { switch (spell.ID) { case 1115: client.RemoveSpell(spell); break; } } #endregion #region Archer if (toClass != 41) { switch (spell.ID) { case 8001: case 8000: case 8003: case 9000: case 8002: case 8030: client.RemoveSpell(spell); break; } } #endregion #region WaterTaoist if (PreviousClass == 135) { if (toClass != 132) { switch (spell.ID) { case 1000: case 1001: case 1010: case 1125: case 1100: case 8030: client.RemoveSpell(spell); break; case 1050: case 1175: case 1170: if (toClass != 142) client.RemoveSpell(spell); break; } } } #endregion #region FireTaoist if (PreviousClass == 145) { if (toClass != 142) { switch (spell.ID) { case 1000: case 1001: case 1150: case 1180: case 1120: case 1002: case 1160: case 1165: client.RemoveSpell(spell); break; } } } #endregion if (client.Spells.ContainsKey(spell.ID)) if (spell.ID != (ushort)Game.Enums.SkillIDs.Reflect) spell.Send(client); } #endregion Add(PhoenixProject.Game.Enums.SkillIDs.Bless); Addskill.Clear(); Addskill = new SafeDictionary<ushort, PhoenixProject.Interfaces.ISkill>(100); PreviousClass = client.Entity.SecondRebornClass; toClass = client.Entity.Class; switch (client.Entity.SecondRebornClass) { case 15: { Add(PhoenixProject.Game.Enums.SkillIDs.Robot); Add(PhoenixProject.Game.Enums.SkillIDs.Cyclone); Add(PhoenixProject.Game.Enums.SkillIDs.Hercules); Add(PhoenixProject.Game.Enums.SkillIDs.SpiritHealing); break; } case 25: { Add(PhoenixProject.Game.Enums.SkillIDs.SuperMan); Add(PhoenixProject.Game.Enums.SkillIDs.Dash); Add(PhoenixProject.Game.Enums.SkillIDs.Shield); break; } case 45: { Add(PhoenixProject.Game.Enums.SkillIDs.Intensify); Add(PhoenixProject.Game.Enums.SkillIDs.Scatter); Add(PhoenixProject.Game.Enums.SkillIDs.RapidFire); Add(PhoenixProject.Game.Enums.SkillIDs.XPFly); Add(PhoenixProject.Game.Enums.SkillIDs.AdvancedFly); break; } case 55: { Add(PhoenixProject.Game.Enums.SkillIDs.FatalStrike); Add(PhoenixProject.Game.Enums.SkillIDs.ShurikenVortex); Add(PhoenixProject.Game.Enums.SkillIDs.ToxicFog); Add(PhoenixProject.Game.Enums.SkillIDs.TwofoldBlades); break; } case 65: { Add(PhoenixProject.Game.Enums.SkillIDs.RadiantPalm); Add(PhoenixProject.Game.Enums.SkillIDs.WhirlWindKick); Add(PhoenixProject.Game.Enums.SkillIDs.TripleAttack); Add(PhoenixProject.Game.Enums.SkillIDs.Oblivion); Add(PhoenixProject.Game.Enums.SkillIDs.Serenity); Add(PhoenixProject.Game.Enums.SkillIDs.Compassion); Add(PhoenixProject.Game.Enums.SkillIDs.TyrantAura); Add(PhoenixProject.Game.Enums.SkillIDs.TyrantAura); Add(PhoenixProject.Game.Enums.SkillIDs.DeflectionAura); break; } case 75: { Add(PhoenixProject.Game.Enums.SkillIDs.RadiantPalm); Add(PhoenixProject.Game.Enums.SkillIDs.WhirlWindKick); Add(PhoenixProject.Game.Enums.SkillIDs.TripleAttack); Add(PhoenixProject.Game.Enums.SkillIDs.Oblivion); Add(PhoenixProject.Game.Enums.SkillIDs.Serenity); Add(PhoenixProject.Game.Enums.SkillIDs.Compassion); Add(PhoenixProject.Game.Enums.SkillIDs.TyrantAura); Add(PhoenixProject.Game.Enums.SkillIDs.TyrantAura); Add(PhoenixProject.Game.Enums.SkillIDs.DeflectionAura); break; } case 135: { Add(PhoenixProject.Game.Enums.SkillIDs.Thunder); Add(PhoenixProject.Game.Enums.SkillIDs.WaterElf); Add(PhoenixProject.Game.Enums.SkillIDs.Cure); Add(PhoenixProject.Game.Enums.SkillIDs.Lightning); Add(PhoenixProject.Game.Enums.SkillIDs.Volcano); Add(PhoenixProject.Game.Enums.SkillIDs.Pray); Add(PhoenixProject.Game.Enums.SkillIDs.Stigma); Add(PhoenixProject.Game.Enums.SkillIDs.AdvancedCure); Add(PhoenixProject.Game.Enums.SkillIDs.Meditation); break; } case 140: { Add(PhoenixProject.Game.Enums.SkillIDs.Thunder); Add(PhoenixProject.Game.Enums.SkillIDs.Cure); Add(PhoenixProject.Game.Enums.SkillIDs.Lightning); Add(PhoenixProject.Game.Enums.SkillIDs.Tornado); Add(PhoenixProject.Game.Enums.SkillIDs.FireCircle); Add(PhoenixProject.Game.Enums.SkillIDs.FireMeteor); Add(PhoenixProject.Game.Enums.SkillIDs.FireRing); break; } } //PreviousClass = client.Entity.FirstRebornClass; //toClass = client.Entity.SecondRebornClass; Add(PhoenixProject.Game.Enums.SkillIDs.Bless); Interfaces.ISkill[] aADD_spells = this.Addskill.Values.ToArray(); foreach (Interfaces.ISkill skill in aADD_spells) { skill.Available = true; if (!client.Spells.ContainsKey(skill.ID)) client.Spells.Add(skill.ID, skill); } #region Spells Interfaces.ISkill[] aspells = client.Spells.Values.ToArray(); foreach (Interfaces.ISkill aspell in spells) { aspell.PreviousLevel = aspell.Level; aspell.Level = 0; aspell.Experience = 0; #region Pirate if (PreviousClass == 75) { if (client.Entity.Class != 71) { switch (aspell.ID) { case 10490: case 10415: case 10381: client.RemoveSpell(aspell); break; } } } #endregion #region Monk if (PreviousClass == 65) { if (client.Entity.Class != 61) { switch (aspell.ID) { case 10490: case 10415: case 10381: client.RemoveSpell(aspell); break; } } } #endregion #region Warrior if (PreviousClass == 25) { if (client.Entity.Class != 21) { switch (aspell.ID) { case 1025: if (client.Entity.Class != 21 && client.Entity.Class != 132) client.RemoveSpell(aspell); break; } } } #endregion #region Ninja if (toClass != 51) { switch (aspell.ID) { case 6010: case 6000: case 6011: client.RemoveSpell(aspell); break; } } #endregion #region Trojan if (toClass != 11) { switch (aspell.ID) { case 1115: client.RemoveSpell(aspell); break; } } #endregion #region Archer if (toClass != 41) { switch (aspell.ID) { case 8001: case 8000: case 8003: case 9000: case 8002: case 8030: client.RemoveSpell(aspell); break; } } #endregion #region WaterTaoist if (PreviousClass == 135) { if (toClass != 132) { switch (aspell.ID) { case 1000: case 1001: case 1010: case 1125: case 1100: case 8030: client.RemoveSpell(aspell); break; case 1050: case 1175: case 1170: if (toClass != 142) client.RemoveSpell(aspell); break; } } } #endregion #region FireTaoist if (PreviousClass == 145) { if (toClass != 142) { switch (aspell.ID) { case 1000: case 1001: case 1150: case 1180: case 1120: case 1002: case 1160: case 1165: client.RemoveSpell(aspell); break; } } } #endregion if (client.Spells.ContainsKey(aspell.ID)) if (aspell.ID != (ushort)Game.Enums.SkillIDs.Reflect) aspell.Send(client); } #endregion Addskill.Clear(); Addskill = new SafeDictionary<ushort, PhoenixProject.Interfaces.ISkill>(20); #region Add Extra Skill if (client.Entity.FirstRebornClass == 15 && client.Entity.SecondRebornClass == 15 && client.Entity.Class == 11) { Add(PhoenixProject.Game.Enums.SkillIDs.DragonWhirl); } if (client.Entity.FirstRebornClass == 25 && client.Entity.SecondRebornClass == 25 && client.Entity.Class == 21) { Add(PhoenixProject.Game.Enums.SkillIDs.Perseverance); } if (client.Entity.FirstRebornClass == 45 && client.Entity.SecondRebornClass == 45 && client.Entity.Class == 41) { Add(PhoenixProject.Game.Enums.SkillIDs.StarArrow); } if (client.Entity.FirstRebornClass == 55 && client.Entity.SecondRebornClass == 55 && client.Entity.Class == 55) { Add(PhoenixProject.Game.Enums.SkillIDs.PoisonStar); Add(PhoenixProject.Game.Enums.SkillIDs.CounterKill); } if (client.Entity.FirstRebornClass == 65 && client.Entity.SecondRebornClass == 65 && client.Entity.Class == 61) { Add(PhoenixProject.Game.Enums.SkillIDs.SoulShackle); } if (client.Entity.FirstRebornClass == 135 && client.Entity.SecondRebornClass == 135 && client.Entity.Class == 132) { Add(PhoenixProject.Game.Enums.SkillIDs.AzureShield); } if (client.Entity.FirstRebornClass == 145 && client.Entity.SecondRebornClass == 145 && client.Entity.Class == 142) { Add(PhoenixProject.Game.Enums.SkillIDs.HeavenBlade); } #endregion Interfaces.ISkill[] aaADD_spells = this.Addskill.Values.ToArray(); foreach (Interfaces.ISkill skill in aaADD_spells) { skill.Available = true; if (!client.Spells.ContainsKey(skill.ID)) client.Spells.Add(skill.ID, skill); } #region Proficiencies foreach (Interfaces.ISkill proficiency in client.Proficiencies.Values) { proficiency.PreviousLevel = proficiency.Level; proficiency.Level = 0; proficiency.Experience = 0; proficiency.Send(client); } #endregion Database.DataHolder.GetStats(client.Entity.Class, client.Entity.Level, client); client.CalculateStatBonus(); client.CalculateHPBonus(); client.GemAlgorithm(); client.SendStatMessage(); Network.PacketHandler.WorldMessage(client.Entity.Name + " has got Reincarnation! Congratulations!"); }
public static void Sort(uint updateUID) { SortedDictionary<ulong, SortEntry<uint, NobilityInformation>> sortdict = new SortedDictionary<ulong, SortEntry<uint, NobilityInformation>>(); foreach (NobilityInformation info in Board.Values) { if (sortdict.ContainsKey(info.Donation)) { SortEntry<uint, NobilityInformation> entry = sortdict[info.Donation]; entry.Values.Add(info.EntityUID, info); } else { SortEntry<uint, NobilityInformation> entry = new SortEntry<uint, NobilityInformation>(); entry.Values = new Dictionary<uint, NobilityInformation>(); entry.Values.Add(info.EntityUID, info); sortdict.Add(info.Donation, entry); } } SafeDictionary<uint, NobilityInformation> sortedBoard = new SafeDictionary<uint, NobilityInformation>(1000000); sortedBoard.Clear(); int Place = 0; foreach (KeyValuePair<ulong, SortEntry<uint, NobilityInformation>> entries in sortdict.Reverse()) { foreach (KeyValuePair<uint, NobilityInformation> value in entries.Value.Values) { Client.GameState client = null; try { int previousPlace = value.Value.Position; value.Value.Position = Place; NobilityRank Rank = NobilityRank.Serf; if (Place > 100) { if (value.Value.Donation >= 200000000) { Rank = NobilityRank.Earl; } else if (value.Value.Donation >= 100000000) { Rank = NobilityRank.Baron; } else if (value.Value.Donation >= 30000000) { Rank = NobilityRank.Knight; } } else { if (Place < PhoenixProject.Database.rates.king) { //PhoenixProject.ServerBase.Kernel.SendWorldMessage(new PhoenixProject.Network.GamePackets.Message("Congratulation! " + client.Entity.Name + "Donation To King in Nobility Rank!", System.Drawing.Color.White, 2011), PhoenixProject.ServerBase.Kernel.GamePool.Values); Rank = NobilityRank.King; //PhoenixProject.Clan.nobmas(client); // ServerBase.Kernel.SendWorldMessage(new Message("Congratulation! " + client.Entity.Name + "Donation To King/Queen in Nobility Rank.", System.Drawing.Color.White, Message.Center), ServerBase.Kernel.GamePool.Values); //Rank = NobilityRank.King; } else if (Place < PhoenixProject.Database.rates.prince) { Rank = NobilityRank.Prince; //PhoenixProject.Clan.nobmas(client); // ServerBase.Kernel.SendWorldMessage(new Message("Congratulation! " + client.Entity.Name + "Donation To Prince in Nobility Rank.", System.Drawing.Color.White, Message.Center), ServerBase.Kernel.GamePool.Values); // Rank = NobilityRank.Prince; } else { Rank = NobilityRank.Duke; //PhoenixProject.Clan.nobmas(client); //ServerBase.Kernel.SendWorldMessage(new Message("Congratulation! " + client.Entity.Name + "Donation To Duke in Nobility Rank.", System.Drawing.Color.White, Message.Center), ServerBase.Kernel.GamePool.Values); //Rank = NobilityRank.Duke; } } var oldRank = value.Value.Rank; value.Value.Rank = Rank; if (ServerBase.Kernel.GamePool.TryGetValue(value.Key, out client)) { bool updateTheClient = false; if (oldRank != Rank) { updateTheClient = true; if (Rank == NobilityRank.Baron) { ServerBase.Kernel.SendWorldMessage(new Message("Congratulation! " + client.Entity.Name + " Donation To Baron in Nobility Rank.", System.Drawing.Color.White, Message.TopLeft), ServerBase.Kernel.GamePool.Values); } if (Rank == NobilityRank.Earl) { ServerBase.Kernel.SendWorldMessage(new Message("Congratulation! " + client.Entity.Name + " Donation To Earl in Nobility Rank.", System.Drawing.Color.White, Message.TopLeft), ServerBase.Kernel.GamePool.Values); } if (Rank == NobilityRank.Duke) { ServerBase.Kernel.SendWorldMessage(new Message("Congratulation! " + client.Entity.Name + " Donation To Duke in Nobility Rank.", System.Drawing.Color.White, Message.Center), ServerBase.Kernel.GamePool.Values); } if (Rank == NobilityRank.Prince) { ServerBase.Kernel.SendWorldMessage(new Message("Congratulation! " + client.Entity.Name + " Donation To Prince in Nobility Rank.", System.Drawing.Color.White, Message.Center), ServerBase.Kernel.GamePool.Values); } if (Rank == NobilityRank.King) { ServerBase.Kernel.SendWorldMessage(new Message("Congratulation! " + client.Entity.Name + " has become the new King/Queen in "+Database.rates.servername+"!", System.Drawing.Color.White, Message.Center), ServerBase.Kernel.GamePool.Values); } if (Rank == NobilityRank.Knight) { ServerBase.Kernel.SendWorldMessage(new Message("Congratulation! " + client.Entity.Name + " Donation To Knight in Nobility Rank.", System.Drawing.Color.White, Message.TopLeft), ServerBase.Kernel.GamePool.Values); } } else { if (previousPlace != Place) { updateTheClient = true; } } if (updateTheClient || client.Entity.UID == updateUID) { NobilityInfo update = new NobilityInfo(true); update.Type = NobilityInfo.Icon; update.dwParam = value.Key; update.UpdateString(value.Value); client.SendScreen(update, true); client.Entity.NobilityRank = value.Value.Rank; } } sortedBoard.Add(value.Key, value.Value); Place++; } catch { } } } Board = sortedBoard; lock (BoardList) { BoardList = Board.Values.ToList(); } }
/// <summary> /// 改变状态后调用 /// </summary> private void OnExitState() { statePrefs.Clear(); }
/// <summary> /// /// </summary> public void EmptyBag() { m_ToteContainers.Clear(); }