Пример #1
1
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            int entryCount = reader.ReadInt();

            for (int i = 0; i < entryCount; i++)
                m_SystemEntries.Add(new SlayerSystemTracker(reader.ReadString(), reader.ReadInt(), reader.ReadString()));

            if (Owner is Mobile)
            {
                Mobile player = (Mobile)Owner;

                SlayerModule module = player.GetModule(typeof(SlayerModule)) as SlayerModule;

                if (module == null)
                    module = new SlayerModule(player);

                foreach (SlayerSystemTracker entry in m_SystemEntries)
                    module.SetSlayerCount(entry.SystemName, entry.SlayerCount);

                Delete();
            }
        }
Пример #2
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            Int32 version = reader.ReadInt();

            Int32 entryCount = reader.ReadInt();

            for (Int32 i = 0; i < entryCount; i++)
                m_TitleEntries[reader.ReadString()] = reader.ReadInt();

            if (Owner is Mobile)
            {
                Mobile player = (Mobile)Owner;

                SlayerModule module = player.GetModule(typeof(SlayerModule)) as SlayerModule;

                if (module == null)
                    module = new SlayerModule(player);

                foreach (String title in m_TitleEntries.Keys)
                    module.SetSlayerCount(title, (Int32)m_TitleEntries[title]);

                Delete();
            }
        }
Пример #3
0
        private void EventSink_OnKilledBy(OnKilledByEventArgs e)
        {
            if (!this.Enabled)
            {
                return;
            }

            BaseCreature creature = null;
            PlayerMobile player   = null;

            if (e.Killed is BaseCreature)
            {
                creature = (BaseCreature)e.Killed;
            }

            if (e.KilledBy is PlayerMobile)
            {
                player = (PlayerMobile)e.KilledBy;
            }

            SlayerModule module = player.GetModule(typeof(SlayerModule)) as SlayerModule;

            if (module == null)
            {
                module = new SlayerModule(player);
            }

            if (m_CrossReference.ContainsKey(creature.GetType()))
            {
                foreach (Int32 index in m_CrossReference[creature.GetType()])
                {
                    if (index < m_TitleDefinitions.Count && m_TitleDefinitions[index].CreatureRegistry.Contains(creature.GetType()))
                    {
                        TitleDefinition def = m_TitleDefinitions[index];

                        module.IncrementCounter(def.DefinitionName);

                        Int32      value      = module.GetSlayerCount(def.DefinitionName);
                        TitleEntry titleToSet = null;

                        foreach (TitleEntry entry in def.TitleRegistry)
                        {
                            if (entry.CountNeeded == value)
                            {
                                titleToSet = entry;
                            }
                        }

                        if (titleToSet != null)
                        {
                            foreach (TitleEntry entry in def.TitleRegistry)
                            {
                                if (player.CollectionTitles.Contains(entry.Title) && entry != titleToSet)
                                {
                                    player.CollectionTitles.Remove(entry.Title);
                                }
                            }

                            player.AddCollectionTitle(titleToSet.Title);
                            player.SendSound(0x3D);
                            player.SendMessage(0xC8, String.Format("Your have been awarded the title of '{0}' for {1} kills.", titleToSet.Title, value));

                            if (TitleAwarded != null)
                            {
                                TitleAwarded(player, def.DefinitionName, titleToSet.Title);
                            }

                            if (IsMaxTitle(titleToSet.Title, def.TitleRegistry) && MaximumTitleAchieved != null)
                            {
                                MaximumTitleAchieved(player, def.DefinitionName, titleToSet.Title);
                            }
                        }
                    }
                }
            }
        }
Пример #4
0
        private void EventSink_OnKilledBy(OnKilledByEventArgs e)
        {
            if (!this.Enabled)
                return;

            BaseCreature creature = null;
            PlayerMobile player = null;

            if (e.Killed is BaseCreature)
                creature = (BaseCreature)e.Killed;

            if (e.KilledBy is PlayerMobile)
                player = (PlayerMobile)e.KilledBy;

            SlayerModule module = player.GetModule(typeof(SlayerModule)) as SlayerModule;

            if (module == null)
                module = new SlayerModule(player);

            if (m_CrossReference.ContainsKey(creature.GetType()))
            {
                foreach(Int32 index in m_CrossReference[creature.GetType()])
                {
                    if (index < m_TitleDefinitions.Count && m_TitleDefinitions[index].CreatureRegistry.Contains(creature.GetType()))
                    {
                        TitleDefinition def = m_TitleDefinitions[index];

                        module.IncrementCounter(def.DefinitionName);

                        Int32 value = module.GetSlayerCount(def.DefinitionName);
                        TitleEntry titleToSet = null;

                        foreach (TitleEntry entry in def.TitleRegistry)
                            if (entry.CountNeeded == value)
                                titleToSet = entry;

                        if (titleToSet != null)
                        {
                            foreach (TitleEntry entry in def.TitleRegistry)
                                if (player.CollectionTitles.Contains(entry.Title) && entry != titleToSet)
                                    player.CollectionTitles.Remove(entry.Title);

                            player.AddCollectionTitle(titleToSet.Title);
                            player.SendSound(0x3D);
                            player.SendMessage(0xC8, String.Format("Your have been awarded the title of '{0}' for {1} kills.", titleToSet.Title, value));

                            if (TitleAwarded != null)
                                TitleAwarded(player, def.DefinitionName, titleToSet.Title);

                            if (IsMaxTitle(titleToSet.Title, def.TitleRegistry) && MaximumTitleAchieved != null)
                                MaximumTitleAchieved(player, def.DefinitionName, titleToSet.Title);

                        }
                    }
                }
            }
        }