예제 #1
0
        public static void WriteAll()
        {
            DBSetup.Initialize();
            World.EnsureMapDataLoaded();
            SpellHandler.Initialize();
            FactionMgr.Initialize();
            SkillHandler.Initialize();
            TalentMgr.Initialize();

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

            NPCMgr.ForceInitialize();
            WriteRideEnum();
        }
예제 #2
0
        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()); });
        }
예제 #3
0
        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
        public static void LoadEntries(bool force)
        {
            if (!force && entriesLoaded)
            {
                return;
            }

            try
            {
                Loading = true;
                FactionMgr.Initialize();

                ContentMgr.Load <NPCEquipmentEntry>(force);
                //Dont move this into LoadTrainers, the templates must
                //be loaded before NPC Entries
                ContentMgr.Load <TrainerSpellTemplate>(force);
                ContentMgr.Load <NPCEntry>(force);

                //foreach (var entry in Entries)
                //{
                //    if (entry != null && entry.Template == null)
                //    {
                //        ContentHandler.OnInvalidData("NPCEntry had no corresponding NPCTemplate: " + entry.NPCId);
                //    }
                //}

                LoadTrainers(force);

                // mount-entries
                //foreach (var spell in SpellHandler.ById)
                //{
                //    if (spell != null && spell.IsMount)
                //    {
                //        var id = (MountId)spell.Effects[0].MiscValue;
                //        if ((int)id >= Entries.Length)
                //        {
                //            log.Warn("Invalid Mount Id: " + id);
                //            spell.Effects[0].EffectType = SpellEffectType.Dummy;		// reach-around fix for the time being
                //            continue;
                //        }
                //        var entry = Entries[(int)id];
                //        if (entry != null)
                //        {
                //            Mounts[id] = entry;
                //        }
                //    }
                //}

                EntriesLoaded = true;
            }
            finally
            {
                Loading = false;
            }
        }
예제 #5
0
        public static void Init()
        {
            RealmDBMgr.Initialize();
            var mgr = RealmServer.RealmServer.InitMgr;

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

            ContentMgr.Initialize();

            SpellHandler.LoadSpells();
            FactionMgr.Initialize();
            SpellHandler.Initialize2();
        }
예제 #6
0
        public void TestInitialReputations()
        {
            Setup.EnsureDBSetup();
            FactionMgr.Initialize();

            var stormWind = FactionMgr.Get(FactionId.Stormwind);
            var bootyBay  = FactionMgr.Get(FactionId.BootyBay);

            Assert.IsNotNull(bootyBay);

            var reputation = new Reputation(new ReputationRecord(), bootyBay, 1000, ReputationFlags.None);

            Asser.FlatNotSet(reputation.Flags, ReputationFlags.AtWar);
        }
예제 #7
0
 public static void WriteNpcId()
 {
     SpellHandler.Initialize();
     FactionMgr.Initialize();
     NPCMgr.ForceInitialize();
     WriteEnum("NPCId", "NPCs", NPCMgr.Prototypes, false,
               (item) => { return(item.Entry != null); },
               (item) => {
         return(item.Entry.Name);
     },
               prototype => {
         var strs = new List <string>();
         if (prototype.Entry.Title.Length > 0)
         {
             strs.Add("Title: " + prototype.Entry.Title);
         }
         if (prototype.MinLevel > 0)
         {
             strs.Add("Level: " + prototype.MinLevel + (prototype.MaxLevel != prototype.MinLevel ? " - " + prototype.MaxLevel : ""));
         }
         if (prototype.DefaultFaction != null)
         {
             strs.Add("Faction: " + prototype.DefaultFaction);
         }
         if (prototype.Entry.Rank != CreatureRank.Normal)
         {
             strs.Add("Rank: " + prototype.Entry.Rank + (prototype.Entry.IsLeader ? " (Leader)" : ""));
         }
         else if (prototype.Entry.IsLeader)
         {
             strs.Add("Leader");
         }
         if (prototype.Entry.Spells != null && prototype.Entry.Spells.Length > 0)
         {
             strs.Add("Spells: " + prototype.Entry.Spells.ToString(", "));
         }
         if (prototype.Auras != null && prototype.Auras.Length > 0)
         {
             strs.Add("Auras: " + prototype.Auras.ToString(", "));
         }
         return(strs.ToString("\n"));
     },
               (item, name) => null,
               (item) => { return(item.Entry.Id.ToString()); });
 }
예제 #8
0
        public static void WriteFactionEnums()
        {
            FactionMgr.Initialize();

            WriteEnum <Faction>("FactionId", "Factions", FactionMgr.ById,
                                (faction) => { return(true); },
                                (faction) => { return(faction.Entry.Name); },
                                (faction) => { return(((int)faction.Id).ToString()); });

            WriteEnum <Faction>("FactionRepListId", "Factions", FactionMgr.ByRepId,
                                (faction) => { return(true); },
                                (faction) => { return(faction.Entry.Name); },
                                (faction) => { return(((int)faction.RepListId).ToString()); });

            WriteEnum <Faction>("FactionTemplateId", "Factions", FactionMgr.ByTemplateId,
                                (faction) => { return(true); },
                                (faction) => { return(faction.Entry.Name); },
                                (faction) => { return(((int)faction.Template.Id).ToString()); });
        }
예제 #9
0
        public static void WriteFactionEnums()
        {
            FactionMgr.Initialize();

            WriteEnum("FactionId", " : uint", "Factions", FactionMgr.ById,
                      (faction) => { return(true); },
                      (faction) => { return(faction.Entry.Name); },
                      (faction) => { return(((int)faction.Id).ToString()); });

            WriteEnum("FactionReputationIndex", "", "Factions", FactionMgr.ByReputationIndex,
                      (faction) => true,
                      (faction) => faction.Entry.Name,
                      (faction) => ((int)faction.ReputationIndex).ToString());

            WriteEnum("FactionTemplateId", " : uint", "Factions", FactionMgr.ByTemplateId,
                      (faction) => { return(true); },
                      (faction) => { return(faction.Entry.Name); },
                      (faction) => { return(((int)faction.Template.Id).ToString()); });
        }
예제 #10
0
파일: NPCMgr.cs 프로젝트: uvbs/Asda2-Server
        public static void LoadEntries(bool force)
        {
            if (!force)
            {
                if (NPCMgr.entriesLoaded)
                {
                    return;
                }
            }

            try
            {
                NPCMgr.Loading = true;
                FactionMgr.Initialize();
                ContentMgr.Load <NPCEntry>(force);
                NPCMgr.EntriesLoaded = true;
            }
            finally
            {
                NPCMgr.Loading = false;
            }
        }
예제 #11
0
        public static void WriteItemId()
        {
            World.InitializeWorld();
            SpellHandler.LoadSpells();
            FactionMgr.Initialize();
            NPCMgr.LoadAll();
            ItemMgr.ForceInitialize();

            WriteEnum("ItemId", " : uint", "Items", ItemMgr.Templates, false,
                      (item) => { return(item.DefaultName != null); },
                      (item) => { return(item.DefaultName); },
                      template =>
            {
                var strs = new List <string>();
                if (!string.IsNullOrEmpty(template.DefaultDescription))
                {
                    strs.Add("Desc: " + template.DefaultDescription);
                }
                if (template.InventorySlotType != InventorySlotType.None)
                {
                    strs.Add(template.InventorySlotType.ToString());
                }
                if (template.Level > 0)
                {
                    strs.Add("Level: " + template.Level);
                }
                if (template.Set != null)
                {
                    strs.Add("Set: " + template.Set);
                }
                if (template.Class != ItemClass.None)
                {
                    strs.Add("Class: " + template.Class);
                }
                return(strs.ToString("\n"));
            },
                      (item, name) => null,
                      (item) => { return(item.Id.ToString()); });
        }
예제 #12
0
 public NPC CreateVendor(FactionId faction)
 {
     FactionMgr.Initialize();
     return(CreateVendor(FactionMgr.Get(faction)));
 }
예제 #13
0
 public NPC CreateMob(FactionId factionId)
 {
     FactionMgr.Initialize();
     return(CreateMob(FactionMgr.Get(factionId)));
 }
예제 #14
0
        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()); });
        }
예제 #15
0
 public override void Process(CmdTrigger <ToolCmdArgs> trigger)
 {
     FactionMgr.Initialize();
     Pepsi.FactionStudies.WriteFactionTemplatesByFlag();
 }
예제 #16
0
 public static void Init(TestContext testContext)
 {
     Setup.EnsureBasicSetup();
     FactionMgr.Initialize();
     ArchetypeMgr.EnsureInitialize();
 }