Server.Items.TreasureMap.HasRequiredSkill C# (CSharp) Method

HasRequiredSkill() private method

private HasRequiredSkill ( Server.Mobile from ) : bool
from Server.Mobile
return bool
		private bool HasRequiredSkill( Mobile from )
		{
			return ( from.Skills[SkillName.Cartography].Value >= GetMinSkillLevel() );
		}

Usage Example

            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Map.Deleted)
                {
                    return;
                }

                Map map = m_Map.m_ChestMap;

                if (m_Map.m_Completed)
                {
                    from.SendMessage("This treasure map has not yet been decoded.");
                }

                else if (!m_Map.Decoded)
                {
                    from.SendMessage("You have not yet decoded this treasure map.");
                }

                else if (!m_Map.HasRequiredSkill(from))
                {
                    from.SendMessage("You are not skilled enough in cartography to attempt to locate this treasure.");
                }

                else if (!from.CanBeginAction(typeof(TreasureMap)))
                {
                    from.SendMessage("You are already digging for treasure.");
                }

                else if (from.Map != m_Map.m_ChestMap)
                {
                    from.SendMessage("You seem to be in the right location but wrong facet!");
                }

                else
                {
                    IPoint3D p = targeted as IPoint3D;

                    Point3D targ3D;

                    if (p is Item)
                    {
                        targ3D = ((Item)p).GetWorldLocation();
                    }

                    else
                    {
                        targ3D = new Point3D(p);
                    }

                    int    maxRange;
                    double skillValue = from.Skills[SkillName.Mining].Value;

                    if (skillValue >= 100.0)
                    {
                        maxRange = 4;
                    }

                    else if (skillValue >= 81.0)
                    {
                        maxRange = 3;
                    }

                    else if (skillValue >= 51.0)
                    {
                        maxRange = 2;
                    }

                    else
                    {
                        maxRange = 1;
                    }

                    Point2D loc = m_Map.m_ActualLocation;
                    int     x = loc.X, y = loc.Y;

                    Point3D chest3D0 = new Point3D(loc, 0);

                    if (Utility.InRange(targ3D, chest3D0, maxRange))
                    {
                        if (from.Location.X == x && from.Location.Y == y)
                        {
                            from.SendLocalizedMessage(503030);                               // The chest can't be dug up because you are standing on top of it.
                        }
                        else if (map != null)
                        {
                            int z = map.GetAverageZ(x, y);

                            if (!map.CanFit(x, y, z, 16, true, true))
                            {
                                from.SendLocalizedMessage(503021);                                   // You have found the treasure chest but something is keeping it from being dug up.
                            }
                            else if (from.BeginAction(typeof(TreasureMap)))
                            {
                                new DigTimer(from, m_Map, new Point3D(x, y, z), map).Start();
                            }

                            else
                            {
                                from.SendLocalizedMessage(503020);                                   // You are already digging treasure.
                            }
                        }
                    }

                    else if (m_Map.Level > 0)
                    {
                        if (Utility.InRange(targ3D, chest3D0, 8))                            // We're close, but not quite
                        {
                            from.SendLocalizedMessage(503032);                               // You dig and dig but no treasure seems to be here.
                        }
                        else
                        {
                            from.SendLocalizedMessage(503035);                               // You dig and dig but fail to find any treasure.
                        }
                    }
                }
            }
All Usage Examples Of Server.Items.TreasureMap::HasRequiredSkill