Exemplo n.º 1
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            int count = reader.ReadInt();

            for (int i = 0; i < count; i++)
            {
                Item item = reader.ReadItem();

                if (item != null && !item.Deleted)
                {
                    m_QuestItems.Add(item);
                }
            }

            count = reader.ReadInt();
            for (int i = 0; i < count; i++)
            {
                int mobIndex = reader.ReadInt();
                m_Infos[mobIndex] = new HumilityQuestMobileInfo(reader);
            }

            count = reader.ReadInt();
            for (int i = 0; i < count; i++)
            {
                Mobile m = reader.ReadMobile();
                if (m != null)
                {
                    m_GivenTo.Add(m);
                }
            }
        }
Exemplo n.º 2
0
        public override void OnDoubleClick(Mobile from)
        {
            PlayerMobile pm = from as PlayerMobile;

            if (pm == null || !InRange(from.Location, 3))
            {
                return;
            }

            if (QuestHelper.GetQuest(pm, typeof(WhosMostHumbleQuest)) is WhosMostHumbleQuest quest && pm.Backpack != null && !quest.HasGivenTo(this))
            {
                Item item = from.FindItemOnLayer(Layer.Cloak);

                if (item is GreyCloak cloak && cloak.Owner == null)
                {
                    int idx = HumilityQuestMobileInfo.GetNPCIndex(GetType());

                    if (idx > -1 && quest.Infos.ContainsKey(idx) && idx < quest.Infos.Count)
                    {
                        Type needs = quest.Infos[idx].Needs;

                        Item need = from.Backpack.FindItemByType(needs);

                        // Found needed item
                        if (need != null)
                        {
                            need.Delete();
                            quest.RemoveQuestItem(need);

                            Item nextItem = Loot.Construct(quest.Infos[idx].Gives);

                            if (nextItem != null)
                            {
                                from.Backpack.DropItem(nextItem);
                                quest.AddQuestItem(nextItem, this);

                                if (this is Sean)
                                {
                                    SayTo(from, Greeting + 3, string.Format("#{0}", quest.Infos[idx].NeedsLoc));
                                }
                                else
                                {
                                    SayTo(from, Greeting + 4, string.Format("#{0}\t#{1}", quest.Infos[idx].NeedsLoc, quest.Infos[idx].GivesLoc));
                                }
                            }
                        }
                        else //Didn't find needed item
                        {
                            from.SendGump(new HumilityItemQuestGump(this, quest, idx));
                        }
                    }
                    else
                    {
                        Console.WriteLine("Error finding index for {0}", this);
                    }
                }
Exemplo n.º 3
0
        public override void OnAccept()
        {
            base.OnAccept();

            Owner.SendGump(new QuestInfoGump(1075736)); // Excellent. When thou hast satisfied the needs of the most humble, thou wilt be given an item meant for me. Take this <B>brass ring</B> to start ye on the way.

            Item cloak = new GreyCloak();
            Item ring  = new BrassRing();

            m_QuestItems.Add(cloak);
            m_QuestItems.Add(ring);

            Owner.Backpack.DropItem(cloak);
            Owner.Backpack.DropItem(ring);

            List <Type> itemTypes = new List <Type>(HumilityQuestMobileInfo.ItemTypes);
            List <Type> mobTypes  = new List <Type>(HumilityQuestMobileInfo.MobileTypes);

            for (int i = 0; i < 25; i++)
            {
                int ran = Utility.RandomMinMax(1, itemTypes.Count - 2);

                Type t = itemTypes[ran];
                itemTypes.Remove(t);
                itemTypes.Insert(Utility.RandomMinMax(1, itemTypes.Count - 2), t);
            }

            for (int i = 0; i < 25; i++)
            {
                int ran = Utility.RandomMinMax(0, mobTypes.Count - 2);

                if (ran > 0)
                {
                    Type t = mobTypes[ran];
                    mobTypes.Remove(t);
                    mobTypes.Insert(Utility.RandomMinMax(1, mobTypes.Count - 2), t);
                }
            }

            for (int i = 0; i < mobTypes.Count; i++)
            {
                int mobIndex = HumilityQuestMobileInfo.GetNPCIndex(mobTypes[i]);
                int need     = i;
                int give     = need + 1;

                Type needs = itemTypes[need];
                Type gives = itemTypes[give];

                m_Infos[mobIndex] = new HumilityQuestMobileInfo(needs, gives, HumilityQuestMobileInfo.GetLoc(needs), HumilityQuestMobileInfo.GetLoc(gives));
            }
        }
Exemplo n.º 4
0
        public override void OnAccept()
        {
            base.OnAccept();

            Item cloak = new GreyCloak();
            Item ring  = new BrassRing();

            m_QuestItems.Add(cloak);
            m_QuestItems.Add(ring);

            Owner.Backpack.DropItem(cloak);
            Owner.Backpack.DropItem(ring);

            List <Type> itemTypes = new List <Type>(HumilityQuestMobileInfo.ItemTypes);
            List <Type> mobTypes  = new List <Type>(HumilityQuestMobileInfo.MobileTypes);

            for (int i = 0; i < 25; i++)
            {
                int ran = Utility.RandomMinMax(1, itemTypes.Count - 2);

                Type t = itemTypes[ran];
                itemTypes.Remove(t);
                itemTypes.Insert(Utility.RandomMinMax(1, itemTypes.Count - 2), t);
            }

            for (int i = 0; i < 25; i++)
            {
                int ran = Utility.RandomMinMax(0, mobTypes.Count - 2);

                if (ran > 0)
                {
                    Type t = mobTypes[ran];
                    mobTypes.Remove(t);
                    mobTypes.Insert(Utility.RandomMinMax(1, mobTypes.Count - 2), t);
                }
            }

            for (int i = 0; i < mobTypes.Count; i++)
            {
                int mobIndex = HumilityQuestMobileInfo.GetNPCIndex(mobTypes[i]);
                int need     = i;
                int give     = need + 1;

                Type needs = itemTypes[need];
                Type gives = itemTypes[give];

                m_Infos[mobIndex] = new HumilityQuestMobileInfo(needs, gives, HumilityQuestMobileInfo.GetLoc(needs), HumilityQuestMobileInfo.GetLoc(gives));
            }
        }
Exemplo n.º 5
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            int count = reader.ReadInt();
            for (int i = 0; i < count; i++)
            {
                Item item = reader.ReadItem();

                if (item != null && !item.Deleted)
                    m_QuestItems.Add(item);
            }

            count = reader.ReadInt();
            for (int i = 0; i < count; i++)
            {
                int mobIndex = reader.ReadInt();
                m_Infos[mobIndex] = new HumilityQuestMobileInfo(reader);
            }

            count = reader.ReadInt();
            for (int i = 0; i < count; i++)
            {
                Mobile m = reader.ReadMobile();
                if (m != null)
                    m_GivenTo.Add(m);
            }
        }
Exemplo n.º 6
0
        public override void OnAccept()
        {
            base.OnAccept();

            Owner.SendGump(new QuestInfoGump(1075736)); // Excellent. When thou hast satisfied the needs of the most humble, thou wilt be given an item meant for me. Take this <B>brass ring</B> to start ye on the way.

            Item cloak = new GreyCloak();
            Item ring = new BrassRing();

            m_QuestItems.Add(cloak);
            m_QuestItems.Add(ring);

            Owner.Backpack.DropItem(cloak);
            Owner.Backpack.DropItem(ring);

            List<Type> itemTypes = new List<Type>(HumilityQuestMobileInfo.ItemTypes);
            List<Type> mobTypes = new List<Type>(HumilityQuestMobileInfo.MobileTypes);

            for (int i = 0; i < 25; i++)
            {
                int ran = Utility.RandomMinMax(1, itemTypes.Count - 2);

                Type t = itemTypes[ran];
                itemTypes.Remove(t);
                itemTypes.Insert(Utility.RandomMinMax(1, itemTypes.Count - 2), t);
            }

            for (int i = 0; i < 25; i++)
            {
                int ran = Utility.RandomMinMax(0, mobTypes.Count - 2);

                if (ran > 0)
                {
                    Type t = mobTypes[ran];
                    mobTypes.Remove(t);
                    mobTypes.Insert(Utility.RandomMinMax(1, mobTypes.Count - 2), t);
                }
            }

            for (int i = 0; i < mobTypes.Count; i++)
            {
                int mobIndex = HumilityQuestMobileInfo.GetNPCIndex(mobTypes[i]);
                int need = i;
                int give = need + 1;

                Type needs = itemTypes[need];
                Type gives = itemTypes[give];

                m_Infos[mobIndex] = new HumilityQuestMobileInfo(needs, gives, HumilityQuestMobileInfo.GetLoc(needs), HumilityQuestMobileInfo.GetLoc(gives));
            }
        }