Пример #1
0
        public static bool OnHarvest(Mobile m, Item tool)
        {
            if (m is PlayerMobile && VolcanoMineBounds.Contains(m.Location))
            {
                object locked = tool;

                if (!m.BeginAction(locked))
                {
                    return(false);
                }

                m.Animate(Utility.RandomList(Mining.System.OreAndStone.EffectActions), 5, 1, true, false, 0);
                Timer.DelayCall(Mining.System.OreAndStone.EffectSoundDelay, () =>
                {
                    m.PlaySound(Utility.RandomList(Mining.System.OreAndStone.EffectSounds));
                });

                Timer.DelayCall(Mining.System.OreAndStone.EffectDelay, () =>
                {
                    TheGreatVolcanoQuest quest = QuestHelper.GetQuest((PlayerMobile)m, typeof(TheGreatVolcanoQuest)) as TheGreatVolcanoQuest;
                    Map map = m.Map;

                    if (map != null && map != Map.Internal && quest != null && !quest.Completed && 0.05 > Utility.RandomDouble())
                    {
                        if (m.CheckSkill(SkillName.Mining, 90, 100))
                        {
                            double chance = Utility.RandomDouble();

                            if (0.08 > chance)
                            {
                                BaseCreature spawn = new VolcanoElemental();
                                Point3D p          = m.Location;

                                for (int i = 0; i < 10; i++)
                                {
                                    int x = Utility.RandomMinMax(p.X - 1, p.X + 1);
                                    int y = Utility.RandomMinMax(p.Y - 1, p.Y + 1);
                                    int z = map.GetAverageZ(x, y);

                                    if (map.CanSpawnMobile(x, y, z))
                                    {
                                        p = new Point3D(x, y, z);
                                        break;
                                    }
                                }

                                spawn.MoveToWorld(p, map);
                                spawn.Combatant = m;

                                m.SendLocalizedMessage(1156508);      // Uh oh...that doesn't look like a lava rock!
                            }
                            else if (0.55 > chance)
                            {
                                //m.AddToBackpack(new LavaStone());
                                m.PrivateOverheadMessage(Server.Network.MessageType.Regular, 1154, 1156507, m.NetState);     // *You uncover a lava rock and carefully store it for later!*
                                quest.Update(m);
                            }
                            else
                            {
                                m.SendLocalizedMessage(1156509);      // You loosen some dirt but fail to find anything.
                            }
                        }
                        else
                        {
                            m.SendLocalizedMessage(1156509);      // You loosen some dirt but fail to find anything.
                        }
                    }
                    else
                    {
                        m.SendLocalizedMessage(1156509);      // You loosen some dirt but fail to find anything.
                    }
                    if (tool is IUsesRemaining)
                    {
                        ((IUsesRemaining)tool).UsesRemaining--;

                        if (((IUsesRemaining)tool).UsesRemaining <= 0)
                        {
                            m.SendLocalizedMessage(1044038);     // You have worn out your tool!
                            tool.Delete();
                        }
                    }

                    m.EndAction(locked);
                });

                return(true);
            }

            return(false);
        }
Пример #2
0
        public static bool OnHarvest(Mobile m, Item tool)
        {
            if (!(m is PlayerMobile) || m.Map != Map.TerMur)
            {
                return(false);
            }

            PlayerMobile pm = (PlayerMobile)m;

            if ((pm.ToggleMiningStone || pm.ToggleStoneOnly) && VolcanoMineBounds.Contains(m.Location))
            {
                object locked = tool;

                if (!m.BeginAction(locked))
                {
                    return(false);
                }

                m.Animate(AnimationType.Attack, 3);

                Timer.DelayCall(Mining.System.OreAndStone.EffectSoundDelay, () =>
                {
                    m.PlaySound(Utility.RandomList(Mining.System.OreAndStone.EffectSounds));
                });

                Timer.DelayCall(Mining.System.OreAndStone.EffectDelay, () =>
                {
                    if (QuestHelper.GetQuest(pm, typeof(TheGreatVolcanoQuest)) is TheGreatVolcanoQuest quest && !quest.Completed && 0.05 > Utility.RandomDouble())
                    {
                        if (m.CheckSkill(SkillName.Mining, 90, 100))
                        {
                            double chance = Utility.RandomDouble();

                            if (0.08 > chance)
                            {
                                BaseCreature spawn = new VolcanoElemental();
                                Point3D p          = m.Location;

                                for (int i = 0; i < 10; i++)
                                {
                                    int x = Utility.RandomMinMax(p.X - 1, p.X + 1);
                                    int y = Utility.RandomMinMax(p.Y - 1, p.Y + 1);
                                    int z = Map.TerMur.GetAverageZ(x, y);

                                    if (Map.TerMur.CanSpawnMobile(x, y, z))
                                    {
                                        p = new Point3D(x, y, z);
                                        break;
                                    }
                                }

                                spawn.OnBeforeSpawn(p, Map.TerMur);
                                spawn.MoveToWorld(p, Map.TerMur);
                                spawn.OnAfterSpawn();

                                spawn.Combatant = m;

                                m.SendLocalizedMessage(1156508);      // Uh oh...that doesn't look like a lava rock!
                            }
                            else if (0.55 > chance)
                            {
                                m.PrivateOverheadMessage(MessageType.Regular, 1154, 1156507, m.NetState);     // *You uncover a lava rock and carefully store it for later!*
                                quest.Update(m);
                            }
                            else
                            {
                                m.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1156509);     // You loosen some dirt but fail to find anything.
                            }
                        }
                        else
                        {
                            m.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1156509);     // You loosen some dirt but fail to find anything.
                        }
                    }
                    else
                    {
                        m.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1156509);     // You loosen some dirt but fail to find anything.
                    }

                    if (tool is IUsesRemaining remaining)
                    {
                        remaining.UsesRemaining--;

                        if (remaining.UsesRemaining <= 0)
                        {
                            m.SendLocalizedMessage(1044038);     // You have worn out your tool!
                            tool.Delete();
                        }
                    }

                    m.EndAction(locked);
                });