void Awake() { instance = this; itemCollection = DeserializeItems(); spellCollection = DeserializeSpells(); }
private void PopulateSpellCollectionAsync() { if (Global.Instance.SpellCollection.Count <= 0) { var uiThread = TaskScheduler.FromCurrentSynchronizationContext(); Task bk2Thread = Task.Factory.StartNew(() => ClearSpellInfo()) .ContinueWith(t1 => IoC.Get <IEventAggregator>().PublishOnUIThread("OpenProgressDialog"), uiThread) .ContinueWith(t2 => PopulateSpellCollection()) .ContinueWith(t3 => ClearSpellInfo()) .ContinueWith(t4 => IoC.Get <IEventAggregator>().PublishOnUIThread("CancelRootDialog"), uiThread); } else if (SpellCollection.Count <= 0) { SpellCollection = new BindableCollection <SpellCollection>(Global.Instance.SpellCollection); } else { if (!SpellCollection.SequenceEqual(Global.Instance.SpellCollection)) { var uiThread = TaskScheduler.FromCurrentSynchronizationContext(); Task bk2Thread = Task.Factory.StartNew(() => ClearSpellInfo()) .ContinueWith(t1 => IoC.Get <IEventAggregator>().PublishOnUIThread("OpenProgressDialog"), uiThread) .ContinueWith(t2 => PopulateSpellCollection()) .ContinueWith(t3 => ClearSpellInfo()) .ContinueWith(t4 => IoC.Get <IEventAggregator>().PublishOnUIThread("CancelRootDialog"), uiThread); } } }
public PSInitialSpells(SpellCollection spellCollection) : base(WorldOpcodes.SMSG_INITIAL_SPELLS) { //this.Write(Utils.HexToByteArray("00 28 00 62 1C 00 00 C6 00 00 00 4E 00 00 00 51 00 00 00 CB 00 00 00 76 23 00 00 6B 00 00 00 CC 00 00 00 CB 19 00 00 C4 00 00 00 C5 00 00 00 0A 02 00 00 9C 02 00 00 A0 02 00 00 4E 09 00 00 99 09 00 00 94 54 00 00 AF 09 00 00 B1 09 00 00 93 54 00 00 EA 0B 00 00 25 0D 00 00 B5 14 00 00 59 18 00 00 4D 19 00 00 66 18 00 00 67 18 00 00 4E 19 00 00 21 22 00 00 63 1C 00 00 BB 1C 00 00 C2 20 00 00 74 50 00 00 75 23 00 00 9C 23 00 00 A5 23 00 00 72 50 00 00 73 50 00 00 0B 56 00 00 1A 59 00 00 17 00 47 00 00 00 2F 00 00 00 00 00 00 00 00 00 99 09 00 00 2F 00 00 00 00 00 00 00 00 00 9A 09 00 00 2F 00 00 00 00 00 00 00 00 00 9B 09 00 00 2F 00 00 00 00 00 00 00 00 00 9C 09 00 00 2F 00 00 00 00 00 00 00 00 00 9F 09 00 00 2F 00 00 00 00 00 00 00 00 00 0B 10 00 00 2F 00 00 00 00 00 00 00 00 00 0C 10 00 00 2F 00 00 00 00 00 00 00 00 00 0D 10 00 00 2F 00 00 00 00 00 00 00 00 00 0F 10 00 00 2F 00 00 00 00 00 00 00 00 00 26 10 00 00 2F 00 00 00 00 00 00 00 00 00 27 10 00 00 2F 00 00 00 00 00 00 00 00 00 29 10 00 00 2F 00 00 00 00 00 00 00 00 00 2B 10 00 00 2F 00 00 00 00 00 00 00 00 00 F3 14 00 00 2F 00 00 00 00 00 00 00 00 00 F5 14 00 00 2F 00 00 00 00 00 00 00 00 00 F6 14 00 00 2F 00 00 00 00 00 00 00 00 00 F7 14 00 00 2F 00 00 00 00 00 00 00 00 00 8A 19 00 00 2F 00 00 00 00 00 00 00 00 00 B0 19 00 00 2F 00 00 00 00 00 00 00 00 00 FC 1B 00 00 2F 00 00 00 00 00 00 00 00 00 FD 1B 00 00 2F 00 00 00 00 00 00 00 00 00 C6 1C 00 00 2F 00 00 00 00 00 00 00 00 00")); Write((byte)0); Write((short)spellCollection.Count); foreach (var s in spellCollection) { Write((short)s.SpellID); Write((short)0); } Write((UInt16)spellCollection.Count); // SpellCooldowns count. foreach (var s in spellCollection) { Write((uint)s.SpellID); Write((short)0); Write((short)s.Catagory); if (s.Catagory == 0) { Write((uint)s.Cooldown); Write((uint)0); } else { Write((uint)0); Write((uint)s.Cooldown); } } }
public PSInitialSpells(SpellCollection spellCollection) : base(WorldOpcodes.SMSG_INITIAL_SPELLS) { this.Write((byte)0); this.Write((short)spellCollection.Count); foreach (var s in spellCollection) { this.Write((short)s.SpellID); this.Write((short)0); } this.Write((UInt16)spellCollection.Count); // SpellCooldowns count. foreach (var s in spellCollection) { this.Write((uint)s.SpellID); this.Write((short)0); this.Write((short)s.Catagory); if (s.Catagory == 0) { this.Write((uint)s.Cooldown); this.Write((uint)0); } else { this.Write((uint)0); this.Write((uint)s.Cooldown); } } }
public PlayerEntity(ObjectGUID objectGUID, character databaseCharacter, WorldSession session) : base(objectGUID) { this.Character = databaseCharacter; this.Session = session; this.SpellCollection = new SpellCollection(this); this.ActionButtonCollection = new ActionButtonCollection(this); }
public static void Start(object sender, EventArgs e) { Stopwatch sw = Stopwatch.StartNew(); Direct3D.RegisterCallbacks( ObjectManager = new ObjectManager(), ExecutionQueue = new EndSceneExecute(), Movement = new Movement(), Events = new WoWEvents(), Spellbook = new SpellCollection(), Scripts = new ScriptManager() ); Helper.Initialize(); Helper.FixInvalidPtrCheck(); DBC = new WoWDB(); Quests = new QuestCollection(); Inventory = new WoWInventory(); Camera = new WoWCamera(); Console = new WoWConsole(); ClientServices = new WoWClientServices(); sw.Stop(); Log.WriteLine(LogType.Good, "Initialization took {0} ms", sw.ElapsedMilliseconds); }
protected override void SetupFromSplitJsonString(string[] splitJsonString) { name = splitJsonString[0]; notes = splitJsonString[1]; size = EnumValue.CreateFromJsonString(splitJsonString[2]); restockSettings = RestockSettings.CreateFromJsonString(splitJsonString[3]); m_AvailabilityPerShopSizePerStockType = AvailabilityPerStockTypePerShopSize.Load(splitJsonString[4]); m_RestockFrequencyModifiersPerShopSize = RestockFrequencyModifiersPerShopSize.Load(splitJsonString[5]); m_ReadyCashPerShopSize = ReadyCashPerShopSize.Load(splitJsonString[6]); m_RarityPerCharacterClassPerSpellContainer = RarityPerCharacterClassPerSpellContainer.Load(splitJsonString[7]); m_BudgetRangePerPowerLevelPerStockType = FloatRangePerPowerLevelPerStockType.Load(splitJsonString[8]); m_ArmourCollection = ArmourCollection.Load(splitJsonString[9]); m_SpellCollection = SpellCollection.Load(splitJsonString[10]); m_WeaponCollection = WeaponCollection.Load(splitJsonString[11]); m_RingCollection = RingCollection.Load(splitJsonString[12]); m_RodCollection = RodCollection.Load(splitJsonString[13]); m_StaffCollection = StaffCollection.Load(splitJsonString[14]); m_WondrousCollection = WondrousCollection.Load(splitJsonString[15]); m_ArmourQualityCollection = ArmourQualityCollection.Load(splitJsonString[16]); m_WeaponQualityCollection = WeaponQualityCollection.Load(splitJsonString[17]); m_WeaponQualityConstraintsMatrix = WeaponQualityConstraintsMatrix.Load(splitJsonString[18]); m_ArmourQualityConstraintsMatrix = ArmourQualityConstraintsMatrix.Load(splitJsonString[19]); shops = new Shop[splitJsonString.Length - 20]; for (int i = 0; i < shops.Length; i++) { shops[i] = Shop.CreateFromJsonString(splitJsonString[i + 20]); } }
public static SpecificPotion CreateRandom(EnumValue powerLevel, SpellCollection availableSpells, FloatRange budgetRange) { SpecificPotion newSpecificPotion = CreateInstance <SpecificPotion>(); newSpecificPotion.powerLevel = powerLevel; availableSpells.PickAndApplySpell(budgetRange, newSpecificPotion); return(newSpecificPotion); }
public static SpecificWand CreateRandom(EnumValue powerLevel, SpellCollection availableSpells, FloatRange budgetRange) { SpecificWand newSpecificWand = CreateInstance <SpecificWand> (); newSpecificWand.powerLevel = powerLevel; newSpecificWand.charges = Random.Range(1, 11) + Random.Range(1, 11) + Random.Range(1, 11) + Random.Range(1, 11) + Random.Range(1, 11); availableSpells.PickAndApplySpell(budgetRange, newSpecificWand); return(newSpecificWand); }
public void ApplyFilter(SpellCollection spellCollection) { spellCollection.doesSpellPassFilter = new bool[spellCollection.spells.Length]; for (int i = 0; i < spellCollection.spells.Length; i++) { spellCollection.doesSpellPassFilter[i] = DoesSpellPassFilter(spellCollection.spells[i]); } }
private void LoadData() { AttackCollection.ReadObjects(Agent.GeneralConfiguration.TempFile); ArmCollection.ReadObjects(Agent.GeneralConfiguration.TempFile); FastDrawCollection.ReadObjects(Agent.GeneralConfiguration.TempFile); SpellCollection.ReadObjects(Agent.GeneralConfiguration.TempFile); SummonCollection.ReadObjects(Agent.GeneralConfiguration.TempFile); EnemyCollection.ReadObjects(Agent.GeneralConfiguration.TempFile); ItemCollection.ReadObjects(Agent.GeneralConfiguration.TempFile); AreaCollection.ReadObjects(Agent.GeneralConfiguration.TempFile); AreaCollection.SetAreaNames(); }
public override void WriteJson(JsonWriter Writer, object Value, JsonSerializer Serializer) { SpellCollection Collection = (SpellCollection)Value; if (Collection != null) { Collection.Save().WriteTo(Writer); } else { Writer.WriteNull(); } }
public override object ReadJson(JsonReader Reader, Type ObjectType, object ExistingValue, JsonSerializer Serializer) { SpellCollection Deck = (SpellCollection)ExistingValue; if (Deck == null) { Deck = new SpellCollection(); } Deck.Load(JArray.Load(Reader)); return(Deck); }
public void Cast(WoWUnit target) { if (!IsValid) { return; } if (target == null || !target.IsValid) { return; } //target.Select(); //WoWScript.ExecuteNoResults("CastSpellByID(" + Id + ")"); SpellCollection.CastSpell(Id, guid: target.Guid); }
protected override void SetupFromSplitJsonString(string[] splitJsonString) { name = splitJsonString[0]; notes = CreateStringFromSafeJson(splitJsonString[1]); m_Books = EnumSetting.Load(splitJsonString[2]); m_CharacterClasses = EnumSetting.Load(splitJsonString[3]); m_ShopSizes = EnumSetting.Load(splitJsonString[4]); m_SettlementSizes = EnumSetting.Load(splitJsonString[5]); m_Rarities = EnumSetting.Load(splitJsonString[6]); m_Allowances = EnumSetting.Load(splitJsonString[7]); m_UsesAutomaticBonusProgressionRules = Wrapper <bool> .CreateFromJsonString(splitJsonString[8]); m_UsesMinimumCasterLevelForSpellContainerItems = Wrapper <bool> .CreateFromJsonString(splitJsonString[9]); m_CasterTypesPerCharacterClass = SaveableSelectedEnumPerEnum.Load(splitJsonString[10]); m_WeightingPerRarity = WeightingPerRarity.Load(splitJsonString[11]); m_RestockSettingsPerSettlementSize = RestockSettingsPerSettlementSize.Load(splitJsonString[12]); m_AvailabilityPerShopSizePerStockType = AvailabilityPerStockTypePerShopSize.Load(splitJsonString[13]); m_RestockFrequencyModifiersPerShopSize = RestockFrequencyModifiersPerShopSize.Load(splitJsonString[14]); m_ReadyCashPerShopSize = ReadyCashPerShopSize.Load(splitJsonString[15]); m_RarityPerCharacterClassPerSpellContainer = RarityPerCharacterClassPerSpellContainer.Load(splitJsonString[16]); m_BudgetRangePerPowerLevelPerStockType = FloatRangePerPowerLevelPerStockType.Load(splitJsonString[17]); m_ArmourCollection = ArmourCollection.Load(splitJsonString[18]); m_SpellCollection = SpellCollection.Load(splitJsonString[19]); m_WeaponCollection = WeaponCollection.Load(splitJsonString[20]); m_RingCollection = RingCollection.Load(splitJsonString[21]); m_RodCollection = RodCollection.Load(splitJsonString[22]); m_StaffCollection = StaffCollection.Load(splitJsonString[23]); m_WondrousCollection = WondrousCollection.Load(splitJsonString[24]); m_ArmourQualityCollection = ArmourQualityCollection.Load(splitJsonString[25]); m_WeaponQualityCollection = WeaponQualityCollection.Load(splitJsonString[26]); m_WeaponQualityConstraintsMatrix = WeaponQualityConstraintsMatrix.Load(splitJsonString[27]); m_ArmourQualityConstraintsMatrix = ArmourQualityConstraintsMatrix.Load(splitJsonString[28]); settlements = new Settlement[splitJsonString.Length - 29]; for (int i = 0; i < settlements.Length; i++) { settlements[i] = Settlement.CreateFromJsonString(splitJsonString[i + 29]); } current = this; }
public void DeleteSpell() { try { int spellID = SpellCollection[SelectedIndex].ID; var forgeDatabase = Global.Instance.ForgeDatabase(); SPELL spell = forgeDatabase.Spells.Single(x => x.ID == spellID); forgeDatabase.Spells.DeleteOnSubmit(spell); forgeDatabase.SubmitChanges(); SpellCollection.RemoveAt(SelectedIndex); Global.Instance.SpellCollection = new BindableCollection <SpellCollection>(SpellCollection); ClearSpellInfo(); SelectedIndex = -1; } catch { } }
/// <summary> /// Initializes a new instance of the <see cref="Home"/> class. /// </summary> internal Home() { // Game this.Random = new Random(Resources.Random.Next()); this.ShopCycle = new ShopCycle(); this.SpellDeck = new SpellDeck(); this.SpellCollection = new SpellCollection(); this.DeckPresets = new int[5][]; this.DeckPresets[0] = new int[8]; this.DeckPresets[1] = new int[8]; this.DeckPresets[2] = new int[8]; this.DeckPresets[3] = new int[8]; this.DeckPresets[4] = new int[8]; // Game Timers. this.FreeChestTimer = new Timer(); this.NextShopCycleTimer = new Timer(); this.NextShopCycleTimer.StartTimer(new Time(), 86400); }
protected override void SetupFromSplitJsonString(string[] splitJsonString) { name = splitJsonString[0]; notes = CreateStringFromSafeJson(splitJsonString[1]); size = splitJsonString[2]; frequencyModifier = Wrapper <float> .CreateFromJsonString(splitJsonString[3]); readyCash = Wrapper <float> .CreateFromJsonString(splitJsonString[4]); stockTypes = FlagsEnumSetting.CreateFromJsonString(splitJsonString[5]); daysSinceLastRestock = Wrapper <int> .CreateFromJsonString(splitJsonString[6]); totalCash = Wrapper <float> .CreateFromJsonString(splitJsonString[7]); specificArmourCollection = SpecificArmourCollection.CreateFromJsonString(splitJsonString[8]); specificPotionCollection = SpecificPotionCollection.CreateFromJsonString(splitJsonString[9]); specificRingCollection = SpecificRingCollection.CreateFromJsonString(splitJsonString[10]); specificRodCollection = SpecificRodCollection.CreateFromJsonString(splitJsonString[11]); specificScrollCollection = SpecificScrollCollection.CreateFromJsonString(splitJsonString[12]); specificStaffCollection = SpecificStaffCollection.CreateFromJsonString(splitJsonString[13]); specificWandCollection = SpecificWandCollection.CreateFromJsonString(splitJsonString[14]); specificWeaponCollection = SpecificWeaponCollection.CreateFromJsonString(splitJsonString[15]); specificWondrousCollection = SpecificWondrousCollection.CreateFromJsonString(splitJsonString[16]); m_RarityPerCharacterClassPerSpellContainer = RarityPerCharacterClassPerSpellContainer.Load(splitJsonString[17]); m_BudgetRangePerPowerLevelPerStockType = FloatRangePerPowerLevelPerStockType.Load(splitJsonString[18]); m_ArmourCollection = ArmourCollection.Load(splitJsonString[19]); m_SpellCollection = SpellCollection.Load(splitJsonString[20]); m_WeaponCollection = WeaponCollection.Load(splitJsonString[21]); m_RingCollection = RingCollection.Load(splitJsonString[22]); m_RodCollection = RodCollection.Load(splitJsonString[23]); m_StaffCollection = StaffCollection.Load(splitJsonString[24]); m_WondrousCollection = WondrousCollection.Load(splitJsonString[25]); m_ArmourQualityCollection = ArmourQualityCollection.Load(splitJsonString[26]); m_WeaponQualityCollection = WeaponQualityCollection.Load(splitJsonString[27]); m_WeaponQualityConstraintsMatrix = WeaponQualityConstraintsMatrix.Load(splitJsonString[28]); m_ArmourQualityConstraintsMatrix = ArmourQualityConstraintsMatrix.Load(splitJsonString[29]); }
internal static void Start(object sender, EventArgs e) { //Debugger.Break(); Stopwatch sw = Stopwatch.StartNew(); ObjectManager = new ObjectManager(); AssemblyAnalyzer.RegisterTarget(ObjectManager); ESExecute = new EndSceneExecute(); AssemblyAnalyzer.RegisterTarget(ESExecute); DBC = new WoWDB(); Movement = new Movement(); AssemblyAnalyzer.RegisterTarget(Movement); LuaInterface.Initialize(); Events = new Events(); AssemblyAnalyzer.RegisterTarget(Events); Helper.Initialize(); Spellbook = new SpellCollection(); AssemblyAnalyzer.RegisterTarget(Spellbook); ScriptManager.Initialize(); Camera = new Camera(); //Initialize Chat Logger // qk Client.Chat.ChatThread.Start(); AssemblyAnalyzer.Analyze(Assembly.GetExecutingAssembly()); sw.Stop(); Log.WriteLine("Initialization took {0} ms", sw.ElapsedMilliseconds); }
public static void Start(object sender, EventArgs e) { Stopwatch sw = Stopwatch.StartNew(); Direct3D.RegisterCallbacks( ObjectManager = new ObjectManager(), ExecutionQueue = new EndSceneExecute(), Movement = new Movement(), Events = new WoWEvents(), Spellbook = new SpellCollection(), Scripts = new ScriptManager() ); Helper.Initialize(); DBC = new WoWDB(); Quests = new QuestCollection(); Inventory = new WoWInventory(); Camera = new WoWCamera(); sw.Stop(); Log.WriteLine(LogType.Good, "Initialization took {0} ms", sw.ElapsedMilliseconds); }
internal static void Stop(object sender, EventArgs e) { Log.WriteLine(LogType.Information, "Shutting down IceFlake"); Events = null; Spellbook = null; Movement = null; DBC = null; ObjectManager = null; ExecutionQueue = null; Memory.Detours.RemoveAll(); Memory.Patches.RemoveAll(); Memory = null; GC.Collect(); // We need something clever here... }