public Item EnsureItem(ItemId item, int amount) { Setup.EnsureBasicSetup(); ItemMgr.LoadAll(); return(EnsureItem(ItemMgr.GetTemplate(item), amount)); }
public static void WriteAllQuests() { Tools.StartRealm(); QuestMgr.LoadAll(); ItemMgr.LoadAll(); NPCMgr.LoadNPCDefs(); GOMgr.LoadAll(); AreaTriggerMgr.Initialize(); WriteQuests("Quests", null); }
public static void Init(TestContext testContext) { chr = Setup.AllianceCharacterPool.Create(); client = chr.FakeClient; disenchantSpell = SpellHandler.Get(SpellId.DisenchantPT); disenchantSpell.CastDelay = 0; // we don't want to wait ItemMgr.LoadAll(); //LootMgr.LoadAll(); ContentMgr.Load <ItemLootItemEntry>(); }
public void TestAddItems() { ItemMgr.LoadAll(); var chr = Setup.AllianceCharacterPool.Create(); var inv = chr.Inventory; chr.Level = 70; chr.EnsureInWorldAndLiving(); PlayerInventory.AutoEquipNewItems = true; inv.Purge(); var err = inv.TryAdd(ItemId.SmallRedPouch, InventorySlot.Bag1); Assert.AreEqual(InventoryError.OK, err); err = inv.TryAdd(ItemId.MiningSack); Assert.AreEqual(InventoryError.OK, err); var pouch = inv[InventorySlot.Bag1] as Container; Assert.IsNotNull(pouch); Assert.AreEqual(ItemId.SmallRedPouch, pouch.Template.ItemId); var miningBag = inv[InventorySlot.Bag2] as Container; Assert.IsNotNull(miningBag); Assert.AreEqual(ItemId.MiningSack, miningBag.Template.ItemId); var stuff = new[] { new ItemStackDescription(ItemId.SlimyMurlocScale, 3), new ItemStackDescription(ItemId.WornShortsword, 3) }; var materials = new[] { new ItemStackDescription(ItemId.SilverOre, 3), new ItemStackDescription(ItemId.GoldOre, 3) }; err = inv.TryAddAll(stuff); Assert.AreEqual(InventoryError.OK, err); Assert.AreEqual(4, inv.Count); // 2 bags + 2 other items Assert.AreEqual(0, miningBag.BaseInventory.Count); err = inv.TryAddAll(materials); Assert.AreEqual(InventoryError.OK, err); Assert.AreEqual(2, miningBag.BaseInventory.Count); }
public override void Process(CmdTrigger <RealmServerCmdArgs> trigger) { if (ItemMgr.Loaded) { trigger.Reply("Item definitions have already been loaded."); } else { RealmServer.IOQueue.AddMessage(() => { trigger.Reply("Loading Items..."); ItemMgr.LoadAll(); trigger.Reply("Done."); }); } }
public static void WriteAllItemInfo() { Tools.StartRealm(); ItemMgr.LoadAll(); using (var writer = new StreamWriter(DefaultDumpFile)) { foreach (var item in ItemMgr.Templates) { if (item != null) { item.Dump(writer, ""); writer.WriteLine(); writer.WriteLine("########################################"); writer.WriteLine(); } } } WriteTiers(); }
/* * /// <summary> * /// Converts the log-file in the given file (within the <c>LogFolder</c>) * /// to a human-readable file within the <c>LogOutputFolder</c>. * /// </summary> * /// <param name="filename">The name of the file within the LogFolder to be converter</param> * /// <param name="converter">The Converter-method, either <c>KSnifferLogConverter.ConvertLog</c> or <c>SniffzitLogConverter.ConvertLog</c></param> * public static void ConvertLog(string filename, Action<string, string> converter) * { * Directory.CreateDirectory(ToolConfig.LogFolder); * Directory.CreateDirectory(ToolConfig.LogOutputFolder); * * var inputFile = Path.Combine(ToolConfig.LogFolder, filename); * Console.WriteLine("Converting log-file: " + new FileInfo(inputFile).FullName); * * DebugUtil.Init(); * * var outFile = Path.Combine(ToolConfig.LogOutputFolder, filename); * if (!outFile.EndsWith(".txt")) * { * outFile += ".txt"; * } * converter(inputFile, outFile); * } * * [Tool] * public static void ConvertKSnifferLogSingleLine(string filename) * { * Directory.CreateDirectory(ToolConfig.LogFolder); * Directory.CreateDirectory(ToolConfig.LogOutputFolder); * * var inputFile = Path.Combine(ToolConfig.LogFolder, filename); * Console.Write("Converting log-file: " + new FileInfo(inputFile).FullName + " ..."); * * DebugUtil.Init(); * * var outFile = Path.Combine(ToolConfig.LogOutputFolder, filename); * if (!outFile.EndsWith(".txt")) * { * outFile += ".txt"; * } * * KSnifferLogConverter.ConvertLog(inputFile, outFile, true); * Console.WriteLine("Done. - Output has been written to: " + new FileInfo(outFile).FullName); * //Console.WriteLine(); * }*/ public static void Startup() { Utility.Measure("Load all", 1, () => { ItemMgr.LoadAll(); NPCMgr.LoadNPCDefs(); GOMgr.LoadAll(); QuestMgr.LoadAll(); }); Utility.Measure("Basic startup sequence", 1, () => { RealmServ.Instance.Start(); Utility.Measure("Load all", 1, () => { ItemMgr.LoadAll(); NPCMgr.LoadNPCDefs(); GOMgr.LoadAll(); QuestMgr.LoadAll(); }); Map.AutoSpawnMaps = true; var easternKD = World.GetNonInstancedMap(MapId.EasternKingdoms); var kalimdor = World.GetNonInstancedMap(MapId.Kalimdor); var outlands = World.GetNonInstancedMap(MapId.Outland); Utility.Measure("Spawning Main Maps", 1, () => { //easternKD.Start(); //kalimdor.Start(); }); GC.Collect(); Console.WriteLine("Total memory usage with fully spawned world: {0}", GC.GetTotalMemory(true)); }); }
public virtual void LoadAll(CmdTrigger <RealmServerCmdArgs> trigger, bool force) { DateTime now = DateTime.Now; try { if (ItemMgr.Loaded) { trigger.Reply("Item definitions have already been loaded."); } else { trigger.Reply("Loading Items..."); ItemMgr.LoadAll(); trigger.Reply("Done."); } } catch (Exception ex) { this.FailNotify(trigger, ex); } try { if (NPCMgr.Loaded) { trigger.Reply("NPC definitions have already been loaded."); } else { trigger.Reply("Loading NPCs..."); NPCMgr.LoadNPCDefs(force); trigger.Reply("Done."); } } catch (Exception ex) { this.FailNotify(trigger, ex); } try { if (GOMgr.Loaded) { trigger.Reply("GO definitions have already been loaded."); } else { trigger.Reply("Loading GOs..."); GOMgr.LoadAll(); trigger.Reply("Done."); } } catch (Exception ex) { this.FailNotify(trigger, ex); } try { if (QuestMgr.Loaded) { trigger.Reply("Quest definitions have already been loaded."); } else { trigger.Reply("Loading Quests..."); QuestMgr.LoadAll(); trigger.Reply("Done."); } } catch (Exception ex) { this.FailNotify(trigger, ex); } try { if (Asda2LootMgr.Loaded) { trigger.Reply("Loot has already been loaded."); } else { trigger.Reply("Loading Loot..."); Asda2LootMgr.LoadAll(); trigger.Reply("Done."); } } catch (Exception ex) { this.FailNotify(trigger, ex); } trigger.Reply("All done - Loading took: " + (object)(DateTime.Now - now)); GC.Collect(2, GCCollectionMode.Optimized); if (!Map.AutoSpawnMaps) { return; } MapCommand.MapSpawnCommand.SpawnAllMaps(trigger); }