コード例 #1
0
        public static void WriteInstanceStubs()
        {
            var dir = ToolConfig.DefaultAddonSourceDir + "Instances/";

            RealmDBMgr.Initialize();
            ContentMgr.Initialize();
            World.InitializeWorld();
            InstanceMgr.Initialize();

            foreach (var instance in InstanceMgr.InstanceInfos)
            {
                var className = instance.Id.ToString();
                var baseClass = typeof(BaseInstance).Name;
                var file      = dir + className + ".cs";
                if (!File.Exists(file))
                {
                    using (var writer = new CodeFileWriter(file, "WCell.Addons.Default.Instances",
                                                           className,
                                                           "class",
                                                           ": " + baseClass,
                                                           "WCell.RealmServer.Instances"))
                    {
                    }
                }
            }
        }
コード例 #2
0
        public static void WriteContentStubs()
        {
            Utility.Measure("DBSetup.Initialize()", 1, () => RealmDBMgr.Initialize());
            Utility.Measure("ContentHandler.SaveDefaultStubs()", 1, ContentMgr.SaveDefaultStubs);

            ContentMgr.SaveDefaultStubs();
        }
コード例 #3
0
ファイル: WCellEnumWriter.cs プロジェクト: NecroSharper/WCell
        public static void WriteAllEnums()
        {
            RealmDBMgr.Initialize();
            ContentMgr.Initialize();
            World.InitializeWorld();
            SpellHandler.LoadSpells();
            FactionMgr.Initialize();
            SpellHandler.Initialize2();
            AreaTriggerMgr.Initialize();

            WriteZoneEnum();
            WriteMapEnum();
            WriteSkillEnums();
            WriteRangeEnum();
            WriteFactionEnums();
            WriteSpellFocusEnum();
            WriteSpellId();
            WriteSpellMechanicEnum();
            WriteTalentEnums();
            WriteItemId();
            WriteItemSetId();
            WriteNpcId();
            WriteCreatureFamilyId();
            WriteGOEntryId();
            WriteRealmCategory();
            WriteTotemCategories();
            WriteAreaTriggers();

            //NPCMgr.ForceInitialize();
            //WriteRideEnum();
        }
コード例 #4
0
ファイル: WCellEnumWriter.cs プロジェクト: NecroSharper/WCell
        public static void WriteNpcId()
        {
            RealmDBMgr.Initialize();
            SpellHandler.LoadSpells();
            FactionMgr.Initialize();
            NPCMgr.LoadAll();

            WriteEnum("NPCId", " : uint", "NPCs", NPCMgr.GetAllEntries(), false,
                      (item) => { return(item != null); },
                      (item) => { return(item.DefaultName); },
                      entry =>
            {
                var strs = new List <string>();
                if (entry.DefaultTitle.Length > 0)
                {
                    strs.Add("Title: " + entry.DefaultTitle);
                }
                if (entry.MinLevel > 0)
                {
                    strs.Add("Level: " + entry.MinLevel +
                             (entry.MaxLevel != entry.MinLevel ? " - " + entry.MaxLevel : ""));
                }
                if (entry.Rank != CreatureRank.Normal)
                {
                    strs.Add("Rank: " + entry.Rank + (entry.IsLeader ? " (Leader)" : ""));
                }
                else if (entry.IsLeader)
                {
                    strs.Add("Leader");
                }
                return(strs.ToString("\n"));
            },
                      (item, name) => null,
                      (item) => { return(item.Id.ToString()); });
        }
コード例 #5
0
ファイル: WCellEnumWriter.cs プロジェクト: NecroSharper/WCell
        public static void WriteItemSetId()
        {
            RealmDBMgr.Initialize();
            World.InitializeWorld();
            SpellHandler.LoadSpells();
            ItemMgr.ForceInitialize();

            WriteEnum("ItemSetId", " : uint", "Items", ItemMgr.Sets, false,
                      (item) => true,
                      (item) => item.Name,
                      set =>
            {
                var strs = new List <string>();
                foreach (ItemTemplate templ in set.Templates)
                {
                    strs.Add(templ.ToString());
                }
                strs.Add(" \nBoni:");
                for (int i = 0; i < set.Boni.Length; i++)
                {
                    Spell[] boni = set.Boni[i];
                    if (boni != null)
                    {
                        strs.Add((i + 1) + " Items: " + boni.ToString(", "));
                    }
                }
                if (set.RequiredSkillValue > 0)
                {
                    strs.Add(" \nRequires: " + set.RequiredSkillValue + " " + set.RequiredSkill);
                }
                return(strs.ToString("\n"));
            },
                      (item, name) => null,
                      (item) => item.Id.ToString());
        }
コード例 #6
0
ファイル: SpellOutput.cs プロジェクト: NecroSharper/WCell
        public static void Init()
        {
            RealmDBMgr.Initialize();
            var mgr = RealmServer.RealmServer.InitMgr;

            RealmAddonMgr.Initialize(mgr);
            mgr.PerformInitialization();

            ContentMgr.Initialize();

            SpellHandler.LoadSpells();
            FactionMgr.Initialize();
            SpellHandler.Initialize2();
        }
コード例 #7
0
ファイル: Setup.cs プロジェクト: NecroSharper/WCell
        public static void ResetDB()
        {
            RealmDBMgr.Initialize();

            int count = CharacterRecord.GetCount();

            if (count > 500)
            {
                throw new Exception("Cannot run tests on production servers since it requires to drop the complete Database. " +
                                    "Test run aborted because " + count + " Characters were found (must not be more than 500). Drop the Database manually to proceed.");
            }

            DatabaseUtil.DropSchema();
            DatabaseUtil.CreateSchema();
        }
コード例 #8
0
ファイル: SpellLineWriter.cs プロジェクト: NecroSharper/WCell
        public static void CreateMaps()
        {
            if (Maps != null)
            {
                return;
            }

            RealmDBMgr.Initialize();
            ContentMgr.Initialize();
            SpellHandler.LoadSpells();
            SpellHandler.Initialize2();

            World.InitializeWorld();
            World.LoadDefaultMaps();
            ArchetypeMgr.EnsureInitialize();                            // for default spells

            NPCMgr.LoadNPCDefs();                                       // for trainers

            Maps = new Dictionary <string, HashSet <Spell> > [(int)ClassId.End];

            FindTalents();
            FindAbilities();

            foreach (var spell in SpellHandler.ById)
            {
                if (spell != null && spell.Ability != null && LineSkills.Contains(spell.Ability.Skill.Id))
                {
                    AddSpell(spell, true);
                }
            }

            // remove empty lines
            foreach (var dict in Maps)
            {
                if (dict != null)
                {
                    foreach (var pair in dict.ToArray())
                    {
                        if (pair.Value.Count == 0)
                        {
                            dict.Remove(pair.Key);
                        }
                    }
                }
            }
        }
コード例 #9
0
ファイル: ContentMgr.cs プロジェクト: uvbs/Asda2-Server
 public static void InitializeDefault()
 {
     RealmDBMgr.Initialize();
     ContentMgr.InitializeAndLoad(typeof(ContentMgr).Assembly);
 }
コード例 #10
0
 private static void Init()
 {
     RealmDBMgr.Initialize();
     SpellHandler.LoadSpells();
     AreaTriggerMgr.Initialize();
 }
コード例 #11
0
ファイル: GOOutput.cs プロジェクト: NecroSharper/WCell
 private static void Init()
 {
     RealmDBMgr.Initialize();
     SpellHandler.LoadSpells();
     GOMgr.LoadAll();
 }
コード例 #12
0
ファイル: WCellEnumWriter.cs プロジェクト: NecroSharper/WCell
        public static void WriteSpellId()
        {
            RealmDBMgr.Initialize();
            ContentMgr.Initialize();
            World.InitializeWorld();
            SpellHandler.LoadSpells();
            FactionMgr.Initialize();
            SpellHandler.Initialize2();

            var noSpell = new Spell {
                Name = "None", Effects = new SpellEffect[0]
            };

            SpellHandler.ById[0] = noSpell;
            WriteEnum("SpellId", " : uint", "Spells", SpellHandler.ById, false,
                      (spell) => { return(true); },
                      (spell) => { return(spell.FullName + spell.RankDesc); },
                      (spell) =>
            {
                TalentEntry talent = spell.Talent;

                var descs = new List <string>();

                if (spell.IsPassive)
                {
                    descs.Add("Passive");
                }

                if (talent != null)
                {
                    descs.Add("Talent");
                }
                else if (spell.Ability != null &&
                         spell.Ability.Skill != null && spell.Ability.Skill.Category != SkillCategory.Invalid)
                {
                    descs.Add(spell.Ability.Skill.Category.ToString());
                }

                if (spell.IsTeachSpell)
                {
                    descs.Add("Teachspell");
                }
                if (spell.Level > 0)
                {
                    descs.Add("Level: " + spell.Level);
                }

                string desc = string.Join(", ", descs.ToArray());

                if (!string.IsNullOrEmpty(spell.Description))
                {
                    if (desc.Length > 0)
                    {
                        desc += "\n";
                    }
                    desc += spell.Description;
                }

                return(desc);
            },
                      (spell, name) => { return(null); },
                      (spell) => { return(spell.Id.ToString()); });
        }