Iomega0318

Member
Ultima Expansion
Endless Journey
So don't shame me because I know this is probably a mess lol, but working on tying in a quest to the SOS system so I have added the following to Fishing:
C#:
                        //Iomega0318
                        PlayerMobile player = from as PlayerMobile;

                        if (player != null)
                        {
                            QuestSystem qs = player.Quest;

                            foreach (BaseQuest quest in player.Quests)
                            {
                                if (quest is ThePerfectCut)// && Utility.RandomDouble() < 0.1)
                                {
                                    Mobile m = from;
                                    PlayerMobile mobile = m as PlayerMobile;
                                    Account acct = (Account)from.Account;
                                    bool ThePerfectCut = Convert.ToBoolean(acct.GetTag("ThePerfectCut"));

                                    if (!ThePerfectCut) //added account tag check
                                    {
                                        if (Utility.Random(100) < 30) // 30% chance to drop
                                            switch (Utility.Random(5))
                                            {
                                                case 0: chest.DropItem(new RedHerring()); break;
                                                case 1: from.SendMessage("You fail to fish up the boots."); break;
                                                case 2: from.SendMessage("You fail to fish up the boots."); break;
                                                case 3: from.SendMessage("You fail to fish up the boots."); break;
                                                case 4: from.SendMessage("You fail to fish up the boots."); break;
                                            }
                                        else
                                            from.SendMessage("You fail to fish up the boots.");
                                        //chest.DropItem(new RedHerring());
                                        //player.SendLocalizedMessage(1095047, "", 0x23); // You pull a shellfish out of the water, but it doesn't have a rainbow pearl.
                                        chest.Movable = true;
                                        chest.Locked = false;
                                        chest.TrapType = TrapType.None;
                                        chest.TrapPower = 0;
                                        chest.TrapLevel = 0;

                                        chest.IsShipwreckedItem = false;

                                        sos.Delete();

                                        acct.SetTag("ThePerfectCut", "true");

                                        return chest;
                                    }
                                }
                            }
                        }
                        //Iomega0318
Short version, uses the SOS then checks if you have the active quest, allows you to attempt to fish that item up, then tags the account so you can't keep using more SOS's and fishing up more without redoing the quest.

Goal, I plan to remove the tag at the end of the quest to "reset" it. However as you can see you do have a chance of failure in fishing but it will still tag the account basically forcing you to resign from the quest but there is an issue that remains, the account tag gets set even if you fail rendering the ability to finish broken, is there a way to either not set the account tag on failure and possibly auto kill the quest for you if you failed?
 
So don't shame me because I know this is probably a mess lol, but working on tying in a quest to the SOS system so I have added the following to Fishing:
C#:
                        //Iomega0318
                        PlayerMobile player = from as PlayerMobile;

                        if (player != null)
                        {
                            QuestSystem qs = player.Quest;

                            foreach (BaseQuest quest in player.Quests)
                            {
                                if (quest is ThePerfectCut)// && Utility.RandomDouble() < 0.1)
                                {
                                    Mobile m = from;
                                    PlayerMobile mobile = m as PlayerMobile;
                                    Account acct = (Account)from.Account;
                                    bool ThePerfectCut = Convert.ToBoolean(acct.GetTag("ThePerfectCut"));

                                    if (!ThePerfectCut) //added account tag check
                                    {
                                        if (Utility.Random(100) < 30) // 30% chance to drop
                                            switch (Utility.Random(5))
                                            {
                                                case 0: chest.DropItem(new RedHerring()); break;
                                                case 1: from.SendMessage("You fail to fish up the boots."); break;
                                                case 2: from.SendMessage("You fail to fish up the boots."); break;
                                                case 3: from.SendMessage("You fail to fish up the boots."); break;
                                                case 4: from.SendMessage("You fail to fish up the boots."); break;
                                            }
                                        else
                                            from.SendMessage("You fail to fish up the boots.");
                                        //chest.DropItem(new RedHerring());
                                        //player.SendLocalizedMessage(1095047, "", 0x23); // You pull a shellfish out of the water, but it doesn't have a rainbow pearl.
                                        chest.Movable = true;
                                        chest.Locked = false;
                                        chest.TrapType = TrapType.None;
                                        chest.TrapPower = 0;
                                        chest.TrapLevel = 0;

                                        chest.IsShipwreckedItem = false;

                                        sos.Delete();

                                        acct.SetTag("ThePerfectCut", "true");

                                        return chest;
                                    }
                                }
                            }
                        }
                        //Iomega0318
Short version, uses the SOS then checks if you have the active quest, allows you to attempt to fish that item up, then tags the account so you can't keep using more SOS's and fishing up more without redoing the quest.

Goal, I plan to remove the tag at the end of the quest to "reset" it. However as you can see you do have a chance of failure in fishing but it will still tag the account basically forcing you to resign from the quest but there is an issue that remains, the account tag gets set even if you fail rendering the ability to finish broken, is there a way to either not set the account tag on failure and possibly auto kill the quest for you if you failed?
Sending you a PM....because...Xmlspawner FTW :cool:
 
LOL I figured it out, but will read the PM for sure. It was quest.RemoveQuest();

Here is my completed code btw which seems to work.
C#:
                        //Iomega0318
                        PlayerMobile player = from as PlayerMobile;

                        if (player != null)
                        {
                            QuestSystem qs = player.Quest;

                            foreach (BaseQuest quest in player.Quests)
                            {
                                if (quest is ThePerfectCut)// && Utility.RandomDouble() < 0.1)
                                {
                                    Mobile m = from;
                                    PlayerMobile mobile = m as PlayerMobile;
                                    Account acct = (Account)from.Account;
                                    bool ThePerfectCut = Convert.ToBoolean(acct.GetTag("ThePerfectCut"));

                                    if (!ThePerfectCut) //added account tag check
                                    {
                                        if (Utility.Random(100) < 30) // 30% chance to drop   
                                            switch (Utility.Random(5))
                                            {
                                                case 0:
                                                    chest.DropItem(new RedHerring());
                                                    acct.SetTag("ThePerfectCut", "true"); break;
                                                case 1:
                                                    from.SendMessage("You fail to fish up the boots.");
                                                    quest.RemoveQuest(); break;
                                                case 2:
                                                    from.SendMessage("You fail to fish up the boots.");
                                                    quest.RemoveQuest(); break;
                                                case 3:
                                                    from.SendMessage("You fail to fish up the boots.");
                                                    quest.RemoveQuest(); break;
                                                case 4:
                                                    from.SendMessage("You fail to fish up the boots.");
                                                    quest.RemoveQuest(); break;
                                            }
                                        else
                                        {
                                            from.SendMessage("You fail to fish up the boots.");
                                            quest.RemoveQuest();
                                        }
                                        //chest.DropItem(new RedHerring());
                                        //player.SendLocalizedMessage(1095047, "", 0x23); // You pull a shellfish out of the water, but it doesn't have a rainbow pearl.
                                        chest.Movable = true;
                                        chest.Locked = false;
                                        chest.TrapType = TrapType.None;
                                        chest.TrapPower = 0;
                                        chest.TrapLevel = 0;

                                        chest.IsShipwreckedItem = false;

                                        sos.Delete();

                                        //acct.SetTag("ThePerfectCut", "true");

                                        return chest;
                                    }
                                }
                            }
                        }
                        //Iomega0318
 
Last edited:
LOL I figured it out, but will read the PM for sure. It was quest.RemoveQuest();

Here is my completed code btw which seems to work.
C#:
                        //Iomega0318
                        PlayerMobile player = from as PlayerMobile;

                        if (player != null)
                        {
                            QuestSystem qs = player.Quest;

                            foreach (BaseQuest quest in player.Quests)
                            {
                                if (quest is ThePerfectCut)// && Utility.RandomDouble() < 0.1)
                                {
                                    Mobile m = from;
                                    PlayerMobile mobile = m as PlayerMobile;
                                    Account acct = (Account)from.Account;
                                    bool ThePerfectCut = Convert.ToBoolean(acct.GetTag("ThePerfectCut"));

                                    if (!ThePerfectCut) //added account tag check
                                    {
                                        if (Utility.Random(100) < 30) // 30% chance to drop  
                                            switch (Utility.Random(5))
                                            {
                                                case 0:
                                                    chest.DropItem(new RedHerring());
                                                    acct.SetTag("ThePerfectCut", "true"); break;
                                                case 1:
                                                    from.SendMessage("You fail to fish up the boots.");
                                                    quest.RemoveQuest(); break;
                                                case 2:
                                                    from.SendMessage("You fail to fish up the boots.");
                                                    quest.RemoveQuest(); break;
                                                case 3:
                                                    from.SendMessage("You fail to fish up the boots.");
                                                    quest.RemoveQuest(); break;
                                                case 4:
                                                    from.SendMessage("You fail to fish up the boots.");
                                                    quest.RemoveQuest(); break;
                                            }
                                        else
                                        {
                                            from.SendMessage("You fail to fish up the boots.");
                                            quest.RemoveQuest();
                                        }
                                        //chest.DropItem(new RedHerring());
                                        //player.SendLocalizedMessage(1095047, "", 0x23); // You pull a shellfish out of the water, but it doesn't have a rainbow pearl.
                                        chest.Movable = true;
                                        chest.Locked = false;
                                        chest.TrapType = TrapType.None;
                                        chest.TrapPower = 0;
                                        chest.TrapLevel = 0;

                                        chest.IsShipwreckedItem = false;

                                        sos.Delete();

                                        //acct.SetTag("ThePerfectCut", "true");

                                        return chest;
                                    }
                                }
                            }
                        }
                        //Iomega0318
So like an hour later I finish typing everything up...:D:p
 

Active Shards

Donations

Total amount
$0.00
Goal
$1,000.00
Back