コード例 #1
0
ファイル: ItemMgr.cs プロジェクト: 0xFh/Asda2-Project
        public static void LoadAll()
        {
            if (Loaded)
            {
                return;
            }
            ContentMgr.Load <ItemTemplate>();
            OnLoaded();
            foreach (ItemTemplate template in Templates)
            {
                if (template != null)
                {
                    template.InitializeTemplate();
                }
            }

            TruncSets();
            if (ArchetypeMgr.Loaded)
            {
                ArchetypeMgr.LoadItems();
            }
            SpellHandler.InitTools();
            LoadItemCharRelations();
            Singleton <AuctionMgr> .Instance.LoadItems();

            if (QuestMgr.Loaded)
            {
                EnsureItemQuestRelations();
            }
            ServerApp <RealmServer> .InitMgr.SignalGlobalMgrReady(typeof(ItemMgr));

            Loaded = true;
        }
コード例 #2
0
ファイル: TestAccount.cs プロジェクト: NecroSharper/WCell
        public CharacterRecord AddRecord()
        {
            var record = Setup.CreateCharRecord();

            ArchetypeMgr.EnsureInitialize();
            TestCharacter.PrepareRecord(this, record,
                                        ArchetypeMgr.GetArchetype(RaceId.Human, ClassId.Warrior), true);
            Characters.Add(record);
            return(record);
        }
コード例 #3
0
ファイル: WhoListTest.cs プロジェクト: NecroSharper/WCell
        private static void AssertSameFaction(ParsedSegment whoList, FactionGroup factionGroup)
        {
            RaceId raceId;

            for (int i = 0; i < whoList.SubSegments["Characters"].List.Count; i++)
            {
                raceId = (RaceId)Enum.Parse(typeof(RaceId), whoList.SubSegments["Characters"].List[i]["Race"].Value.ToString(), true);
                Assert.AreEqual(factionGroup, ArchetypeMgr.GetRace(raceId).Faction.Group);
            }
        }
コード例 #4
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);
                        }
                    }
                }
            }
        }
コード例 #5
0
        public static void LoadAll()
        {
            if (!Loaded)
            {
                //ContentHandler.Load<ItemRandomSuffixInfo>();
                ContentMgr.Load <ItemTemplate>();
                ContentMgr.Load <ItemRandomEnchantEntry>();

                OnLoaded();

                foreach (var templ in Templates)
                {
                    if (templ != null)
                    {
                        templ.InitializeTemplate();
                    }
                }

                TruncSets();

                if (ArchetypeMgr.Loaded)
                {
                    ArchetypeMgr.LoadItems();
                }

                SpellHandler.InitTools();
                LoadItemCharRelations();

                AuctionMgr.Instance.LoadItems();

                if (QuestMgr.Loaded)
                {
                    EnsureItemQuestRelations();
                }

                RealmServer.InitMgr.SignalGlobalMgrReady(typeof(ItemMgr));
                Loaded = true;
            }
        }
コード例 #6
0
 public BaseClass GetBaseClass()
 {
     return(ArchetypeMgr.GetClass(Class));
 }
コード例 #7
0
        /// <summary>
        /// Creates a new character and loads all required character data from the database
        /// </summary>
        /// <param name="acc">The account the character is associated with</param>
        /// <param name="record">The name of the character to load</param>
        /// <param name="client">The client to associate with this character</param>
        internal protected void Create(RealmAccount acc, CharacterRecord record, IRealmClient client)
        {
            client.ActiveCharacter = this;
            acc.ActiveCharacter    = this;

            Type        |= ObjectTypes.Player;
            ChatChannels = new List <ChatChannel>(5);

            m_logoutTimer = new TimerEntry(0, DefaultLogoutDelayMillis, totalTime => FinishLogout());

            Account  = acc;
            m_client = client;

            m_record = record;
            EntityId = EntityId.GetPlayerId(m_record.EntityLowId);
            m_name   = m_record.Name;

            Archetype  = ArchetypeMgr.GetArchetype(record.Race, record.Class);
            MainWeapon = GenericWeapon.Fists;
            PowerType  = m_archetype.Class.DefaultPowerType;

            StandState = StandState.Sit;

            Money  = (uint)m_record.Money;
            Outfit = m_record.Outfit;
            //ScaleX = m_archetype.Race.Scale;
            ScaleX     = 1;
            Gender     = m_record.Gender;
            Skin       = m_record.Skin;
            Facial     = m_record.Face;
            HairStyle  = m_record.HairStyle;
            HairColor  = m_record.HairColor;
            FacialHair = m_record.FacialHair;
            UnitFlags  = UnitFlags.PlayerControlled;
            Experience = m_record.Xp;
            RestXp     = m_record.RestXp;

            SetInt32(UnitFields.LEVEL, m_record.Level);
            // cannot use Level property, since it will trigger certain events that we don't want triggered
            NextLevelXP = XpGenerator.GetXpForlevel(m_record.Level + 1);
            MaxLevel    = RealmServerConfiguration.MaxCharacterLevel;

            RestState = RestState.Normal;

            Orientation = m_record.Orientation;

            m_bindLocation = new WorldZoneLocation(
                m_record.BindMap,
                new Vector3(m_record.BindX, m_record.BindY, m_record.BindZ),
                m_record.BindZone);

            PvPRank         = 1;
            YieldsXpOrHonor = true;

            foreach (var school in SpellConstants.AllDamageSchools)
            {
                SetFloat(PlayerFields.MOD_DAMAGE_DONE_PCT + (int)school, 1);
            }
            SetFloat(PlayerFields.DODGE_PERCENTAGE, 1.0f);

            // Auras
            m_auras = new PlayerAuraCollection(this);

            // spells
            m_spells = PlayerSpellCollection.Obtain(this);

            // factions
            WatchedFaction = m_record.WatchedFaction;
            Faction        = FactionMgr.ByRace[(uint)record.Race];
            m_reputations  = new ReputationCollection(this);

            // skills
            m_skills = new SkillCollection(this);

            // talents
            m_talents = new PlayerTalentCollection(this);

            // achievements
            m_achievements = new AchievementCollection(this);

            // Items
            m_inventory = new PlayerInventory(this);

            m_mailAccount = new MailAccount(this);

            m_questLog = new QuestLog(this);

            // tutorial flags
            TutorialFlags = new TutorialFlags(m_record.TutorialFlags);

            // Make sure client and internal state is updated with combat base values
            UnitUpdates.UpdateSpellCritChance(this);

            // Mask of activated TaxiNodes
            m_taxiNodeMask = new TaxiNodeMask();

            PowerCostMultiplier = 1f;

            m_lastPlayTimeUpdate = DateTime.Now;

            MoveControl.Mover      = this;
            MoveControl.CanControl = true;

            IncMeleePermissionCounter();

            SpeedFactor = DefaultSpeedFactor;

            // basic setup
            if (record.JustCreated)
            {
                ModStatsForLevel(m_record.Level);
                BasePower = RegenerationFormulas.GetPowerForLevel(this);
            }
            else
            {
                BaseHealth = m_record.BaseHealth;
                SetBasePowerDontUpdate(m_record.BasePower);

                SetBaseStat(StatType.Strength, m_record.BaseStrength);
                SetBaseStat(StatType.Stamina, m_record.BaseStamina);
                SetBaseStat(StatType.Spirit, m_record.BaseSpirit);
                SetBaseStat(StatType.Intellect, m_record.BaseIntellect);
                SetBaseStat(StatType.Agility, m_record.BaseAgility);

                Power = m_record.Power;
                SetInt32(UnitFields.HEALTH, m_record.Health);
            }
        }
コード例 #8
0
ファイル: WhoListTest.cs プロジェクト: NecroSharper/WCell
 public static void Init(TestContext testContext)
 {
     Setup.EnsureBasicSetup();
     FactionMgr.Initialize();
     ArchetypeMgr.EnsureInitialize();
 }