Exemple #1
0
        public override void OnTalk(PlayerMobile player, bool contextMenu)
        {
            StudyOfSolenQuest qs = player.Quest as StudyOfSolenQuest;

            if (qs != null && qs.Naturalist == this)
            {
                StudyNestsObjective study = qs.FindObjective(typeof(StudyNestsObjective)) as StudyNestsObjective;

                if (study != null)
                {
                    if (!study.Completed)
                    {
                        PlaySound(0x41F);
                        qs.AddConversation(new NaturalistDuringStudyConversation());
                    }
                    else
                    {
                        QuestObjective obj = qs.FindObjective(typeof(ReturnToNaturalistObjective));

                        if (obj != null && !obj.Completed)
                        {
                            Seed reward;

                            PlantType type;
                            switch (Utility.Random(study.StudiedSpecialNest ? 34 : 16))
                            {
                            case 0:
                                type = PlantType.CampionFlowers;
                                break;

                            case 1:
                                type = PlantType.Poppies;
                                break;

                            case 2:
                                type = PlantType.Snowdrops;
                                break;

                            case 3:
                                type = PlantType.Bulrushes;
                                break;

                            case 4:
                                type = PlantType.Lilies;
                                break;

                            case 5:
                                type = PlantType.PampasGrass;
                                break;

                            case 6:
                                type = PlantType.Rushes;
                                break;

                            case 7:
                                type = PlantType.ElephantEarPlant;
                                break;

                            case 8:
                                type = PlantType.Fern;
                                break;

                            case 9:
                                type = PlantType.PonytailPalm;
                                break;

                            case 10:
                                type = PlantType.SmallPalm;
                                break;

                            case 11:
                                type = PlantType.CenturyPlant;
                                break;

                            case 12:
                                type = PlantType.WaterPlant;
                                break;

                            case 13:
                                type = PlantType.SnakePlant;
                                break;

                            case 14:
                                type = PlantType.PricklyPearCactus;
                                break;

                            case 15:
                                type = PlantType.BarrelCactus;
                                break;

                            case 16:
                                type = PlantType.TribarrelCactus;
                                break;

                            case 17:
                                type = PlantType.Cactus;
                                break;

                            case 18:
                                type = PlantType.FlaxFlowers;
                                break;

                            case 19:
                                type = PlantType.FoxgloveFlowers;
                                break;

                            case 20:
                                type = PlantType.HopsEast;
                                break;

                            case 21:
                                type = PlantType.OrfluerFlowers;
                                break;

                            case 22:
                                type = PlantType.CypressTwisted;
                                break;

                            case 23:
                                type = PlantType.HedgeShort;
                                break;

                            case 24:
                                type = PlantType.JuniperBush;
                                break;

                            case 25:
                                type = PlantType.SnowdropPatch;
                                break;

                            case 26:
                                type = PlantType.Cattails;
                                break;

                            case 27:
                                type = PlantType.PoppyPatch;
                                break;

                            case 28:
                                type = PlantType.SpiderTree;
                                break;

                            case 29:
                                type = PlantType.WaterLily;
                                break;

                            case 30:
                                type = PlantType.CypressStraight;
                                break;

                            case 31:
                                type = PlantType.HedgeTall;
                                break;

                            case 32:
                                type = PlantType.HopsSouth;
                                break;

                            default:
                                type = PlantType.SugarCanes;
                                break;
                            }

                            if (study.StudiedSpecialNest)
                            {
                                PlantTypeInfo typeInfo = PlantTypeInfo.GetInfo(type);

                                if (typeInfo.PlantCategory == PlantCategory.Peculiar && type != PlantType.Cactus)
                                {
                                    reward = new Seed(type, Utility.RandomBool() ? PlantHue.White : PlantHue.Black, false);
                                }
                                else
                                {
                                    reward = new Seed(type, PlantHue.FireRed, false);
                                }
                            }
                            else
                            {
                                reward = new Seed(type, Utility.RandomList(PlantHue.Pink, PlantHue.Magenta, PlantHue.Aqua), false);
                            }

                            if (player.PlaceInBackpack(reward))
                            {
                                obj.Complete();

                                PlaySound(0x449);
                                PlaySound(0x41B);

                                if (study.StudiedSpecialNest)
                                {
                                    qs.AddConversation(new SpecialEndConversation());
                                }
                                else
                                {
                                    qs.AddConversation(new EndConversation());
                                }
                            }
                            else
                            {
                                reward.Delete();

                                qs.AddConversation(new FullBackpackConversation());
                            }
                        }
                    }
                }
            }
            else
            {
                QuestSystem newQuest = new StudyOfSolenQuest(player, this);

                if (player.Quest == null && QuestSystem.CanOfferQuest(player, typeof(StudyOfSolenQuest)))
                {
                    PlaySound(0x42F);
                    newQuest.SendOffer();
                }
                else
                {
                    PlaySound(0x448);
                    newQuest.AddConversation(new DontOfferConversation());
                }
            }
        }
Exemple #2
0
            /// <summary>
            /// Adds the page buttons (PlantTypes).
            /// </summary>
            private void AddPages(int MaxPerRow)
            {
                int pageindex   = 1;
                int itemindex   = 0;
                int buttonindex = 1;
                int verticaladd = 0;                 // temporary

                //#01 début
                if (seedinfo != null && !unknownstorage)               //si un type en mémoire et que ce n'est pas l'unknown
                {
                    PlantTypeInfo pii = null;
                    foreach (SeedInfo si in m_Box.KnownStorage)
                    {
                        if (si.Type == seedinfo.Type)                       //on met sa page en premier dans la liste
                        {
                            pii = PlantTypeInfo.GetInfo(si.Type);
                            AddButton(37, 55, 2103, 2104, 0, GumpButtonType.Page, pageindex);                        // Type button
                            AddHtmlLocalized(50, 50, 110, 20, pii.Name, false, false);                               // Plant name
                            pageindex++;
                        }
                    }
                    if (m_Box.UnknownStorage.Count > 0)                                                    //et donc les unknown en second
                    {
                        AddButton(37, 35 + pageindex * 20, 2103, 2104, 0, GumpButtonType.Page, pageindex); // Type button
                        AddHtmlLocalized(50, 30 + pageindex * 20, 110, 20, 1060800, false, false);         // Plant name: unknown
                        pageindex++;
                    }
                }
                else                //sinon comme d'hab
                {
                    //#01 fin
                    if (m_Box.UnknownStorage.Count > 0)
                    {
                        AddButton(37, 55, 2103, 2104, 0, GumpButtonType.Page, pageindex);                   // Type button
                        AddHtmlLocalized(50, 50, 110, 20, 1060800, false, false);                           // Plant name: unknown
                        pageindex++;
                    }
                }                //#01 fini le else

                PlantTypeInfo pi = null;

                //#01 début
                if (seedinfo != null)                           //toujours si un type en memoire
                {
                    foreach (SeedInfo si in m_Box.KnownStorage) //le reste de la liste SANS celui en mémoire puisqu'il est dejà en premier
                    {
                        if (si.Type != seedinfo.Type)
                        {
                            pi = PlantTypeInfo.GetInfo(si.Type);
                            AddButton(37, 35 + pageindex * 20, 2103, 2104, 0, GumpButtonType.Page, pageindex);                       // Type button
                            AddHtmlLocalized(50, 30 + pageindex * 20, 110, 20, pi.Name, false, false);                               // Plant name
                            pageindex++;
                        }
                    }
                }
                else
                {                //#01 fin
                    foreach (SeedInfo si in m_Box.KnownStorage)
                    {
                        pi = PlantTypeInfo.GetInfo(si.Type);
                        AddButton(37, 35 + pageindex * 20, 2103, 2104, 0, GumpButtonType.Page, pageindex);                   // Type button
                        AddHtmlLocalized(50, 30 + pageindex * 20, 110, 20, pi.Name, false, false);                           // Plant name
                        pageindex++;
                    }
                }                //#01 fini le else

                pageindex = 1;   // reset

                PlantHueInfo ph = null;

                //#01 début

                if (seedinfo != null && !unknownstorage)               //si un type en memoire, sa page est la première,
                //mais si c'est l'unknown, on fait comme d'hab (elle est la premiere)
                {
                    PlantType planttype = seedinfo.Type;

                    foreach (SeedInfo si in m_Box.KnownStorage)
                    {
                        if (si.Type == planttype)
                        {
                            pi = PlantTypeInfo.GetInfo(si.Type);
                            AddPage(1);
                            AddItem(187 + pi.OffsetX, 50 + pi.OffsetY, pi.ItemID, 0);                               // Plant picture
                            AddHtmlLocalized(264, 45, 170, 20, pi.Name, false, false);                              // Type description

                            itemindex   = 0;
                            verticaladd = 0;
                            foreach (SeedHue sh in si.Hues)
                            {
                                ph = PlantHueInfo.GetInfo(sh.Hue);
                                AddButton(170 + verticaladd, 130 + itemindex * 20, 22407, 22406, buttonindex++, GumpButtonType.Reply, 0);                                   // Take button
                                AddLabel(190 + verticaladd, 130 + itemindex * 20, 0x835, sh.Amount.ToString());

                                if ((int)sh.Hue < 0x8000000)
                                {
                                    AddHtmlLocalized(220 + verticaladd, 130 + itemindex * 20, 100, 20, ph.Name, false, false);                                       // Hue description
                                }
                                else
                                {
                                    AddLabel(220 + verticaladd, 130 + itemindex * 20, 0, "bright");
                                    AddHtmlLocalized(260 + verticaladd, 130 + itemindex * 20, 100, 20, ph.Name, false, false);                                       // Hue description
                                }
                                itemindex++;
                                if (itemindex >= MaxPerRow)                                  // start next row
                                {
                                    itemindex   = 0;
                                    verticaladd = 150;
                                }
                            }
                            pageindex++;
                        }
                    }
                }
                //#01 fin

                if (m_Box.UnknownStorage.Count > 0)
                {
                    AddPage(pageindex);
                    AddItem(190, 60, 1, 0);                                    // Plant picture
                    AddHtmlLocalized(264, 45, 170, 20, 3000575, false, false); // Type description: UNKNOWN

                    // Unknown seeds are displayed in a single category
                    foreach (SeedInfo si in m_Box.UnknownStorage)
                    {
                        foreach (SeedHue sh in si.Hues)
                        {
                            ph = PlantHueInfo.GetInfo(sh.Hue);
                            AddButton(170 + verticaladd, 130 + itemindex * 20, 22407, 22406, buttonindex++, GumpButtonType.Reply, 0); // Take button
                            AddLabel(190 + verticaladd, 130 + itemindex * 20, 0x835, sh.Amount.ToString());
                            AddHtmlLocalized(220 + verticaladd, 130 + itemindex * 20, 100, 20, ph.Name, false, false);                // Hue description
                            itemindex++;
                            if (itemindex >= MaxPerRow)                                                                               // Start next row
                            {
                                itemindex   = 0;
                                verticaladd = 150;
                            }
                        }
                    }
                    pageindex++;
                }

                foreach (SeedInfo si in m_Box.KnownStorage)
                {
                    if (seedinfo == null || si.Type != seedinfo.Type)                   //#01
                    {
                        pi = PlantTypeInfo.GetInfo(si.Type);
                        AddPage(pageindex);
                        AddItem(187 + pi.OffsetX, 50 + pi.OffsetY, pi.ItemID, 0);                   // Plant picture
                        AddHtmlLocalized(264, 45, 170, 20, pi.Name, false, false);                  // Type description

                        itemindex   = 0;
                        verticaladd = 0;
                        foreach (SeedHue sh in si.Hues)
                        {
                            ph = PlantHueInfo.GetInfo(sh.Hue);
                            AddButton(170 + verticaladd, 130 + itemindex * 20, 22407, 22406, buttonindex++, GumpButtonType.Reply, 0);                       // Take button
                            AddLabel(190 + verticaladd, 130 + itemindex * 20, 0x835, sh.Amount.ToString());

                            if ((int)sh.Hue < 0x8000000)
                            {
                                AddHtmlLocalized(220 + verticaladd, 130 + itemindex * 20, 100, 20, ph.Name, false, false);                           // Hue description
                            }
                            else
                            {
                                AddLabel(220 + verticaladd, 130 + itemindex * 20, 0, "bright");
                                AddHtmlLocalized(260 + verticaladd, 130 + itemindex * 20, 100, 20, ph.Name, false, false);                           // Hue description
                            }
                            itemindex++;
                            if (itemindex >= MaxPerRow)                      // start next row
                            {
                                itemindex   = 0;
                                verticaladd = 150;
                            }
                        }
                        pageindex++;
                    }                    //#01 fin du if
                }

                // Check if something was added
                if (pageindex == 1)
                {
                    AddPage(pageindex);
                    AddImage(175, 45, 7012, 2406);
                    AddHtmlLocalized(264, 45, 170, 20, 501038, false, false);                       // Claim List is empty
                }
            }