Exemplo n.º 1
0
        public override void OnMovement(Mobile m, Point3D oldLocation)
        {
            if (m.Alive && m is PlayerMobile pm)
            {
                var range = 3;

                if (pm.Alive && Math.Abs(Z - pm.Z) < 16 && InRange(m, range) && !InRange(oldLocation, range))
                {
                    if (pm.ToTItemsTurnedIn >= TreasuresOfTokuno.ItemsPerReward)
                    {
                        SayTo(
                            pm,
                            1070980
                            );                          // Congratulations! You have turned in enough minor treasures to earn a greater reward.

                        pm.CloseGump <ToTTurnInGump>(); // Sanity

                        if (!pm.HasGump <ToTRedeemGump>())
                        {
                            pm.SendGump(new ToTRedeemGump(this, false));
                        }
                    }
                    else
                    {
                        if (pm.ToTItemsTurnedIn == 0)
                        {
                            SayTo(
                                pm,
                                1071013
                                ); // Bring me 10 of the lost treasures of Tokuno and I will reward you with a valuable item.
                        }
                        else
                        {
                            SayTo(
                                pm,
                                1070981,
                                $"{pm.ToTItemsTurnedIn}\t{TreasuresOfTokuno.ItemsPerReward}"
                                ); // You have turned in ~1_COUNT~ minor artifacts. Turn in ~2_NUM~ to receive a reward.
                        }

                        var buttons = ToTTurnInGump.FindRedeemableItems(pm);

                        if (buttons.Count > 0 && !pm.HasGump <ToTTurnInGump>())
                        {
                            pm.SendGump(new ToTTurnInGump(this, buttons));
                        }
                    }
                }

                var leaveRange = 7;

                if (!InRange(m, leaveRange) && InRange(oldLocation, leaveRange))
                {
                    pm.CloseGump <ToTRedeemGump>();
                    pm.CloseGump <ToTTurnInGump>();
                }
            }
        }
Exemplo n.º 2
0
        public override void OnMovement(Mobile m, Point3D oldLocation)
        {
            //if( !TreasuresOfTokuno.Enabled )	//He still accepts items even if ToTs are turned off.
            //	return;

            if (m.Alive && m is PlayerMobile)
            {
                PlayerMobile pm = (PlayerMobile)m;

                int range = 3;

                if (m.Alive && Math.Abs(Z - m.Z) < 16 && InRange(m, range) && !InRange(oldLocation, range))
                {
                    if (pm.ToTItemsTurnedIn >= TreasuresOfTokuno.ItemsPerReward)
                    {
                        SayTo(pm, 1070980);                           // Congratulations! You have turned in enough minor treasures to earn a greater reward.

                        pm.CloseGump(typeof(ToTTurnInGump));          //Sanity

                        if (!pm.HasGump(typeof(ToTRedeemGump)))
                        {
                            pm.SendGump(new ToTRedeemGump(this, false));
                        }
                    }
                    else
                    {
                        if (pm.ToTItemsTurnedIn == 0)
                        {
                            SayTo(pm, 1071013);                               // Bring me 10 of the lost treasures of Tokuno and I will reward you with a valuable item.
                        }
                        else
                        {
                            SayTo(pm, 1070981, String.Format("{0}\t{1}", pm.ToTItemsTurnedIn, TreasuresOfTokuno.ItemsPerReward));                                 // You have turned in ~1_COUNT~ minor artifacts. Turn in ~2_NUM~ to receive a reward.
                        }
                        ArrayList buttons = ToTTurnInGump.FindRedeemableItems(pm);

                        if (buttons.Count > 0 && !pm.HasGump(typeof(ToTTurnInGump)))
                        {
                            pm.SendGump(new ToTTurnInGump(this, buttons));
                        }
                    }
                }

                int leaveRange = 7;

                if (!InRange(m, leaveRange) && InRange(oldLocation, leaveRange))
                {
                    pm.CloseGump(typeof(ToTRedeemGump));
                    pm.CloseGump(typeof(ToTTurnInGump));
                }
            }
        }