Exemplo n.º 1
0
        public TargetInfo GetTarget()
        {
            Targeting.ResetTarget();
            this.Reset();

            if (this.targetExpression.ToLower() != "none")
            {
                if (!String.IsNullOrEmpty(this.targetExpression))
                {
                    GetTarget(Targeting.ParseTargets(this.targetExpression));
                }
                else
                {
                    GetTarget(this.serial);
                }

                if (!this.serial.IsValidCust() || !((UOObject)this).Exist)
                {
                    StaticTarget t = UIManager.Target();
                    if (((Serial)t.Serial).IsValidCust() || t.X > 0 && t.X < 65535 || t.Y > 0 && t.Y < 65535)
                    {
                        this.Success    = true;
                        this.x          = t.X;
                        this.y          = t.Y;
                        this.z          = t.Z;
                        this.serial     = t.Serial;
                        this.graphic    = t.Graphic;
                        this.targetType = t.Type;
                    }
                }
            }
            return(this);
        }
Exemplo n.º 2
0
        public static bool ValidateUndeepWater(Map map, object obj, ref int z)
        {
            if (!(obj is StaticTarget))
            {
                return(false);
            }

            StaticTarget target = (StaticTarget)obj;

            if (BaseHouse.FindHouseAt(target.Location, map, 0) != null)
            {
                return(false);
            }

            int itemID = target.ItemID;

            for (int i = 0; i < m_UndeepWaterTiles.Length; i += 2)
            {
                if (itemID >= m_UndeepWaterTiles[i] && itemID <= m_UndeepWaterTiles[i + 1])
                {
                    z = target.Z;
                    return(true);
                }
            }

            return(false);
        }
Exemplo n.º 3
0
            protected override void OnTarget(Mobile from, object o)
            {
                try
                {
                    if (o is Item)
                    {
                        Item item = (Item)o as Item;

                        if (item != null)
                        {
                            string type = item.GetType().ToString();
                            string id   = "0x" + item.ItemID.ToString("X");
                            from.SendMessage(type + " " + id);
                        }
                    }
                    else if (o is StaticTarget)
                    {
                        StaticTarget targ = (StaticTarget)o;
                        from.SendMessage("static " + "  " + "0x" + targ.ItemID.ToString("X"));
                    }
                }
                catch
                {
                    from.SendMessage("Ceci n'est pas un objet");
                }
            }
Exemplo n.º 4
0
//I ADDED for fill pitcher from statics part 2 of 3
        private void FillPitcherWithWater(Mobile from, object pitcher, object targ)
        {
            string whatisit = null;
//			object targeted = null;//Trying to clear up yellows. was assigned but never used.
            StaticTarget statictarget = targ as StaticTarget;
            Item         itemtarget   = targ as Item;

            if (targ != null && targ is StaticTarget)
            {
                whatisit = "StaticTargeted";
            }
            if (targ != null && targ is Item)
            {
                whatisit = "ItemTargeted";
            }
            if (((whatisit != null) && whatisit == "StaticTargeted") && (!from.InRange(statictarget.Location, 3) || !from.InLOS(statictarget)))
            {
                from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
                return;                                                         //return = stop action and wont allow to fill
            }
            if (((whatisit != null) && whatisit == "ItemTargeted") && (!from.InRange(itemtarget.Location, 3) || !from.InLOS(itemtarget)))
            {
                from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
                return;                                                         //return = stop action and wont allow to fill
            }
            from.PlaySound(0x4E);
            this.Content  = BeverageType.Water;
            this.Poison   = null;
            this.Poisoner = null;
            this.Quantity = this.MaxQuantity;
            from.SendLocalizedMessage(1010089);             // You fill the container with water.
        }
Exemplo n.º 5
0
        //---------------------------------------------------------------------------------------------

        public void VyhodKlamakNa()
        {
            UOItem itemKlamak = NajdiKlamak();

            if (!itemKlamak.Exist || !itemKlamak.Serial.IsValid)
            {
                ItemHelper.OpenContainerRecursive(World.Player.Backpack);
                itemKlamak = NajdiKlamak();
            }

            if (itemKlamak.Exist && itemKlamak.Serial.IsValid)
            {
                Game.RunScriptCheck(1500);
                World.Player.PrintMessage("Kam klamaka?");
                StaticTarget st = UIManager.Target();
                itemKlamak.Move(1, st.X, st.Y, st.Z);
                Game.Wait(400);
                Game.CurrentGame.CurrentPlayer.SwitchWarmode();
                itemKlamak.Use();
            }
            else
            {
                World.Player.PrintMessage("Neni klamak");
            }
        }
Exemplo n.º 6
0
        //---------------------------------------------------------------------------------------------

        public void AddTree()
        {
            DataTable dt = Cal.Engine.GetOtSetDataTable(new UOPosition().DbViewNameForLoad);

            if (dt.Rows.Count > 0)
            {
                Game.PrintMessage("Tree count: " + dt.Select("IsTree=1").Length);
            }

            StaticTarget tree = UIManager.Target();

            UO.Print(tree.Graphic);

            if (tree.Graphic != 0)
            {
                UOPosition pos = new UOPosition(tree.X, tree.Y, (ushort)tree.Z);
                pos.EnsureLoadByPosition();
                pos.IsTree      = true;
                pos.TypeChecked = true;
                pos.Stepable    = false;
                if (pos.Save())
                {
                    Game.PrintMessage("Tree add: " + pos.ToString());
                }
            }
        }
Exemplo n.º 7
0
        private static PilferFlags PilferTarget(StaticTarget target, Mobile from)
        {
            int itemID = target.ItemID;

            itemID &= 0x3FFF;

            StaticTile[] tiles = from.Map.Tiles.GetStaticTiles(target.X, target.Y);

            for (int i = 0; i < tiles.Length; ++i)
            {
                int tileID = tiles[i].ID;
                tileID &= 0x3FFF;
                if ((tileID >= 0xA9F && tileID <= 0xAA5) ||
                    (tileID >= 0xADF && tileID <= 0xB18))   //display case IDs
                {
                    return(ProcessDisplayCase(tiles));
                }
            }
            if (Core.Debug)
            {
                Console.WriteLine("TEST: Not a display case.");
            }

            return(PilferTileItem(itemID));
        }
Exemplo n.º 8
0
        protected virtual bool OnTarget(object targeted)
        {
            Mobile mob = targeted as Mobile;

            if (mob != null)
            {
                return(this.OnTarget(mob));
            }
            Item obj = targeted as Item;

            if (obj != null)
            {
                return(this.OnTarget(obj));
            }
            GroundTarget groundTarget = targeted as GroundTarget;

            if (groundTarget != null)
            {
                return(this.OnTarget(groundTarget));
            }
            StaticTarget staticTarget = targeted as StaticTarget;

            if (staticTarget != null)
            {
                return(this.OnTarget(staticTarget));
            }
            return(false);
        }
Exemplo n.º 9
0
        //int segmentSize = 1;
        //int direction = -1;
        //int currentRadius = 0;
        //int x = World.Player.X;
        //int y = World.Player.Y;


        //List<UOPositionBase> trees = new List<UOPositionBase>();

        //while (currentRadius < radius)
        //{
        //  x = x + segmentSize * direction;

        //  UO.WaitTargetTile(x, y, z, Graphic.Invariant);
        //  //x y 1

        //  y = y + segmentSize * direction;

        //  //x y 2

        //  direction = direction * -1;
        //  segmentSize++;
        //  currentRadius = segmentSize / 2;


        //}



        //---------------------------------------------------------------------------------------------

        public void RemoveTree()
        {
            StaticTarget tree = UIManager.Target();

            UO.Print(tree.Graphic);

            if (tree.Graphic != 0)
            {
                UOPosition pos = new UOPosition(tree.X, tree.Y, (ushort)tree.Z);
                if (pos.LoadByPosition())
                {
                    if (pos.Remove())
                    {
                        UO.Print("Strom odebran");
                    }
                    else
                    {
                        UO.Print("Strom se nepodarilo odebrat");
                    }
                }
                else
                {
                    UO.Print("Strom neni v DB");
                }
            }
        }
Exemplo n.º 10
0
        public override void OnDispatch()
        {
            base.OnDispatch();
            if (!this.Spoof)
            {
                return;
            }
            PTarget_Spoof ptargetSpoof = (PTarget_Spoof)null;

            if (this.toTarget == null)
            {
                ptargetSpoof = new PTarget_Spoof(0, 12648430, this.SpoofFlags, 0, -1, -1, 0, 0);
            }
            else if (this.toTarget is Mobile)
            {
                Mobile mobile = this.toTarget as Mobile;
                ptargetSpoof = new PTarget_Spoof(0, 12648430, this.SpoofFlags, mobile.Serial, mobile.X, mobile.Y, mobile.Z, (int)mobile.Body);
            }
            else if (this.toTarget is Item)
            {
                Item obj = this.toTarget as Item;
                ptargetSpoof = new PTarget_Spoof(0, 12648430, this.SpoofFlags, obj.Serial, obj.X, obj.Y, obj.Z, obj.ID);
            }
            else if (this.toTarget is GroundTarget)
            {
                GroundTarget groundTarget = this.toTarget as GroundTarget;
                ptargetSpoof = new PTarget_Spoof(1, 12648430, this.SpoofFlags, 0, groundTarget.X, groundTarget.Y, groundTarget.Z, 0);
            }
            else if (this.toTarget is StaticTarget)
            {
                StaticTarget staticTarget = this.toTarget as StaticTarget;
                ptargetSpoof = new PTarget_Spoof(1, 12648430, this.SpoofFlags, 0, staticTarget.X, staticTarget.Y, staticTarget.Z, staticTarget.RealID);
            }
            Network.Send((Packet)ptargetSpoof);
        }
Exemplo n.º 11
0
        public virtual bool IsValidTile(object targeted, Map map)
        {
            int tileID = 0;

            if (targeted is LandTarget)
            {
                LandTarget obj = (LandTarget)targeted;
                tileID = obj.TileID;
            }

            else if (targeted is StaticTarget)
            {
                StaticTarget obj = (StaticTarget)targeted;
                tileID = obj.ItemID;
            }

            for (int i = 0; i < UseableTiles.Length; i++)
            {
                if (UseableTiles[i] == tileID)
                {
                    return(true);
                }
            }
            return(false);
        }
Exemplo n.º 12
0
        public virtual bool GetHarvestDetails(Mobile from, Item tool, object toHarvest, out int tileID, out Map map, out Point3D loc)
        {
            if (toHarvest is Static && !((Static)toHarvest).Movable)
            {
                Static obj = (Static)toHarvest;

                tileID = (obj.ItemID & 0x3FFF) | 0x4000;
                map    = obj.Map;
                loc    = obj.GetWorldLocation();
            }
            else if (toHarvest is StaticTarget)
            {
                StaticTarget obj = (StaticTarget)toHarvest;

                tileID = (obj.ItemID & 0x3FFF) | 0x4000;
                map    = from.Map;
                loc    = obj.Location;
            }
            else if (toHarvest is LandTarget obj)
            {
                tileID = obj.TileID;
                map    = from.Map;
                loc    = obj.Location;
            }
            else
            {
                tileID = 0;
                map    = null;
                loc    = Point3D.Zero;
                return(false);
            }

            return(map != null && map != Map.Internal);
        }
Exemplo n.º 13
0
        public override bool GetHarvestDetails(Mobile from, Item tool, object toHarvest, out int tileID, out Map map, out Point3D loc)
        {
            bool lava = HasTypeHook(tool, HookType.Lava);

            if (toHarvest is Static && !((Static)toHarvest).Movable)
            {
                Static obj = (Static)toHarvest;

                if (lava)
                {
                    tileID = obj.ItemID;
                }
                else
                {
                    tileID = (obj.ItemID & 0x3FFF) | 0x4000;
                }

                map = obj.Map;
                loc = obj.GetWorldLocation();
            }
            else if (toHarvest is StaticTarget)
            {
                StaticTarget obj = (StaticTarget)toHarvest;

                if (lava)
                {
                    tileID = obj.ItemID;
                }
                else
                {
                    tileID = (obj.ItemID & 0x3FFF) | 0x4000;
                }

                map = from.Map;
                loc = obj.Location;
            }
            else if (toHarvest is LandTarget)
            {
                LandTarget obj = (LandTarget)toHarvest;

                tileID = obj.TileID;
                map    = from.Map;
                loc    = obj.Location;
            }
            else
            {
                tileID = 0;
                map    = null;
                loc    = Point3D.Zero;
                return(false);
            }

            //Lava tile, no lava hook
            if (ValidateSpecialTile(tileID) && !lava)
            {
                return(false);
            }

            return(map != null && map != Map.Internal);
        }
Exemplo n.º 14
0
    public void InstantiateTarget(Target targetLevel)
    {
        activeTarget = Instantiate(targets[(int)targetLevel.type], targetPos, Quaternion.identity);
        StaticTarget target = activeTarget.GetComponentInChildren <StaticTarget>();

        target.speed       = targetLevel.speed;
        target.time        = targetLevel.timeOfChangeDirOrSpeed;
        target.countKnives = targetLevel.amountFixedKnives;
    }
Exemplo n.º 15
0
        public void ThrowLavaBombTom()
        {
            UOItem potionItem = null;
            string text       = "";

            foreach (UOItem item in UO.Backpack.AllItems)
            {
                if (item.Graphic == 0x0F0D && item.Color == 0x000E && item.Flags == 0x0000)
                {
                    potionItem = item; break;
                }
            }

            if (potionItem == null || !potionItem.Exist)
            {
                UO.Warmode(!World.Player.Warmode);
                UO.Wait(100);

                UOItem kad   = World.Player.Backpack.AllItems.FindType(0x1843, 0x000E);
                UOItem empty = UO.Backpack.Items.FindType(0x0F0E);

                if (kad.Exist && empty.Exist)
                {
                    UO.WaitTargetObject(empty);
                    kad.Use();
                    UO.Wait(250);

                    potionItem = World.Player.Backpack.Items.FindType(0x0F0D, 0x000E);

                    if (potionItem.Exist)
                    {
                        potionItem.Move(1, World.Player.Backpack);
                        UO.Wait(100);
                    }
                }
                else
                {
                    UO.Print("Nemas kad s Lavama nebo prazdny lahve!");
                }
            }

            if (potionItem != null && potionItem.Exist)
            {
                World.Player.Print("Hazu lavabombu" + text);
                StaticTarget st = UIManager.Target();
                potionItem.Move(1, st.X, st.Y, st.Z);
            }
            else
            {
                World.Player.Print("Nemas lavabombu" + text);
            }
        }
Exemplo n.º 16
0
        public long RecordOutput(StaticTarget producingTarget, string filePath)
        {
            var fileObject = GetFileObject(filePath);

            if (fileObject.ProducingTarget != null && fileObject.ProducingTarget.Id != producingTarget.Id)
            {
                throw new ApplicationException($"Duplicate producer for {filePath}.  Produced by: " + fileObject.ProducingTarget.Location.LocationString + " and by " + producingTarget.Location.LocationString);
            }

            fileObject.ProducingTarget = producingTarget;

            return(fileObject.Id);
        }
Exemplo n.º 17
0
            public bool IsSurface(IPoint3D pnt)
            {
                if (pnt is StaticTarget)
                {
                    StaticTarget st = (StaticTarget)pnt;

                    if ((st.Flags & TileFlag.Surface) > 0)
                    {
                        return(true);
                    }
                }
                return(false);
            }
Exemplo n.º 18
0
        //---------------------------------------------------------------------------------------------


        public void ZazdiTarget(ushort ingotAmount)
        {
            UOItem ingots = World.Player.Backpack.AllItems.FindType(IronIngotType.Graphic, IronIngotType.Color);

            if (!ingots.Exist || ingots.Amount < ingotAmount)
            {
                UO.PrintWarning("Nemas potrebny pocet ingotu! Pocet: {0}", ingots.Exist ? ingots.Amount : 0);
                return;
            }

            UOItem kladivo = Kladivo;

            if (!kladivo.Exist)
            {
                return;
            }

            UO.PrintInformation("Zamer cil >");
            StaticTarget   target          = UIManager.Target();
            UOPositionBase currentPosition = new UOPositionBase(World.Player.X, World.Player.Y, 0);
            UOPositionBase targetPosition  = new UOPositionBase(target.X, target.Y, 0);

            if (Robot.GetRelativeVectorLength(currentPosition, targetPosition) < 4)
            {
                if (ingots.Move(ingotAmount, target.X, target.Y, target.Z))
                {
                    UO.Wait(100);
                    UOItem targetIngots = World.Ground.FindType(IronIngotType.Graphic, IronIngotType.Color);
                    if (targetIngots.Exist && targetIngots.Distance < 4)
                    {
                        UO.WaitTargetObject(targetIngots.Serial);
                        kladivo.Use();
                        UO.Wait(100);

                        UO.PrintInformation("Ingoty premeneny!");
                    }
                    else
                    {
                        UO.PrintWarning("Vzdalil jsi se od ingotu! Vzdalenost: {0}", targetIngots.Exist ? targetIngots.Distance : -1);
                    }
                }
                else
                {
                    UO.PrintWarning("Nepodarilo se presunout ingoty na cil!");
                }
            }
            else
            {
                UO.PrintWarning("Cil neexistuje, nebo je dal nez 3 policka! Vzdalenost: {0}", Robot.GetRelativeVectorLength(currentPosition, targetPosition));
            }
        }
Exemplo n.º 19
0
            static bool Prefix(BaseAI __instance, ref StaticTarget __result)
            {
                if (!modEnabled.Value)
                {
                    return(true);
                }

                if (noBuildingTargeting.Value || noBuildingTargetList.Contains(Utils.GetPrefabName(__instance.gameObject)))
                {
                    __result = null;
                    return(false);
                }
                return(true);
            }
    // Spawn a new target at a random location
    private void SpawnTarget()
    {
        // Get a random position in the game area
        Vector2 pos = gameArea.RandomPosition(0.9f);

        // Create a new target game object in that random position
        GameObject targetObj = Instantiate(target, pos, Quaternion.identity);

        // Get the script associated with the target game object
        StaticTarget targetScript = targetObj.GetComponent <StaticTarget>();

        // Attach a listener method to be called when the target is destroyed
        targetScript.Destroyed.AddListener(TargetDestroyed);
    }
Exemplo n.º 21
0
		public Point3D GetPoint( object o, bool eye )
		{
			Point3D p;

			if( o is Mobile )
			{
				p = ((Mobile)o).Location;
				p.Z += 14;//eye ? 15 : 10;
			}
			else if( o is Item )
			{
				p = ((Item)o).GetWorldLocation();
				p.Z += (((Item)o).ItemData.Height / 2) + 1;
			}
			else if( o is Point3D )
			{
				p = (Point3D)o;
			}
			else if( o is LandTarget )
			{
				p = ((LandTarget)o).Location;

				int low = 0, avg = 0, top = 0;
				GetAverageZ( p.X, p.Y, ref low, ref avg, ref top );

				p.Z = top + 1;
			}
			else if( o is StaticTarget )
			{
				StaticTarget st = (StaticTarget)o;
				ItemData id = TileData.ItemTable[st.ItemID & TileData.MaxItemValue];

				p = new Point3D( st.X, st.Y, st.Z - id.CalcHeight + (id.Height / 2) + 1 );
			}
			else if( o is IPoint3D )
			{
				p = new Point3D( (IPoint3D)o );
			}
			else
			{
				Console.WriteLine( "Warning: Invalid object ({0}) in line of sight", o );
				p = Point3D.Zero;
			}

			return p;
		}
Exemplo n.º 22
0
 protected override void OnTarget(Mobile from, object targeted)
 {
     if (targeted is LandTarget)
     {
         LandTarget targ = (LandTarget)targeted;
         DeplacerMobile(m_MovingMobile, new Point3D(targ.X, targ.Y, targ.Z));
     }
     else if (targeted is StaticTarget)
     {
         StaticTarget targ = (StaticTarget)targeted;
         DeplacerMobile(m_MovingMobile, new Point3D(targ.X, targ.Y, targ.Z));
     }
     else
     {
         from.SendMessage("Vous ne pouvez déplacer le mobile sur " + targeted.GetType().ToString());
     }
 }
Exemplo n.º 23
0
        //---------------------------------------------------------------------------------------------

        protected SekInfo SekTree(StaticTarget tree)
        {
            SekInfo info = new SekInfo();

            Journal.Clear();

            JournalEventWaiter jew = new JournalEventWaiter(true, "akce skoncila");

            Nastroj.Use();
            UO.WaitTargetTile(tree.X, tree.Y, tree.Z, tree.Graphic);
            jew.Wait(10000 + LatencyMeasurement.CurrentLatency);

            info.Mined   = Journal.Contains(true, "There are no logs left here to chop");
            info.Wrong   = Journal.Contains(true, "You can't think of a way to use that item", "That's too far away to chop", "Try chopping a tree");
            info.Special = Journal.Contains(true, "You found something special");

            return(info);
        }
Exemplo n.º 24
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                bool none        = true;
                bool validtarget = false;
                int  tileID      = 0;

                if (targeted is Static && !((Static)targeted).Movable)
                {
                    Static obj = (Static)targeted;
                    tileID      = (obj.ItemID & 0x3FFF) | 0x4000;
                    validtarget = true;
                }
                else if (targeted is StaticTarget)
                {
                    StaticTarget obj = (StaticTarget)targeted;
                    tileID      = (obj.ItemID & 0x3FFF) | 0x4000;
                    validtarget = true;
                }

                if (validtarget)
                {
                    TreeResource[] resources = TreeHarvest.GetResources(tileID);
                    if (resources.Length > 0)
                    {
                        none = false;
                        StringBuilder sb = new StringBuilder("That contains the following resources: ");
                        sb.Append(resources[0].ToString());
                        if (resources.Length > 1)
                        {
                            for (int x = 1; x < resources.Length; x++)
                            {
                                sb.Append(", ");
                                sb.Append(resources[x].ToString());
                            }
                        }
                        from.SendMessage(sb.ToString());
                    }
                }

                if (none)
                {
                    from.SendMessage("There are no tree resources there.");
                }
            }
Exemplo n.º 25
0
        public static void PrintAllTreesCount(int radius)
        {
            IRequestResult r = UO.WaitTargetTile(3348, 339, 4, Graphic.Invariant);

            UO.UseType(0x0F9E);
            //IClientTarget target = UIManager.Target();

            StaticTarget target = ((StaticTarget)r.GetType().GetField("Target").GetValue(r));


            {
                string name = null;
                if (target.Graphic != 0 && target.Graphic < DataFiles.Tiledata.Count)
                {
                    name = DataFiles.Tiledata.GetArt(target.Graphic).Name;
                }

                string format = "Tile X={0} Y={1} Z={2} Graphic=0x{3:X4}";
                if (name != null && name.Length > 0)
                {
                    format += " Name={4}";
                }

                UO.Print(format, target.X, target.Y, target.Z, target.Graphic, name);
            }
            // UO.Print(((StaticTarget)r.GetType().GetField("Target").GetValue(r))+ "" + " / " + Graphic.Invariant);

            {
                string name = null;
                if (target.Graphic != 0 && target.Graphic < DataFiles.Tiledata.Count)
                {
                    name = DataFiles.Tiledata.GetArt(target.Graphic).Name;
                }

                string format = "Tile X={0} Y={1} Z={2} Graphic=0x{3:X4}";
                if (name != null && name.Length > 0)
                {
                    format += " Name={4}";
                }

                Notepad.WriteLine(format, target.X, target.Y, target.Z, target.Graphic, name);
                Notepad.WriteLine();
            }
        }
Exemplo n.º 26
0
        public void VyhodKlamakNa(Serial s)
        {
            UOItem itemKlamak = new UOItem(s);

            if (!itemKlamak.Exist)
            {
                itemKlamak = NajdiKlamak();
            }

            if (!itemKlamak.Exist || !itemKlamak.Serial.IsValid)
            {
                ItemHelper.OpenContainerRecursive(World.Player.Backpack);
                itemKlamak = NajdiKlamak();
            }

            if (itemKlamak.Exist && itemKlamak.Serial.IsValid)
            {
                Game.RunScriptCheck(1500);
                World.Player.PrintMessage("Kam klamaka?");
                StaticTarget st = UIManager.Target();



                if (st.X > 0 && st.X < 8000)
                {
                    Game.PrintMessage("KPosition: [" + st.X + ", " + st.Y + "]");
                    Game.RunScriptCheck(1500);
                    itemKlamak.Move(1, st.X, st.Y, st.Z);
                    Game.Wait(400);
                    Game.CurrentGame.CurrentPlayer.SwitchWarmode();
                    itemKlamak.Use();
                    MobMaster.LasTimeUseKlamak = DateTime.Now;
                }
                else
                {
                    Game.PrintMessage("KPosition: Cancel");
                }
            }
            else
            {
                World.Player.PrintMessage("Neni klamak");
            }
            Game.RunScript(5);
        }
Exemplo n.º 27
0
        private static bool FindValidTile(Mobile m, HarvestDefinition definition, out object toHarvest)
        {
            Map map = m.Map;

            toHarvest = null;

            if (m == null || map == null || map == Map.Internal)
            {
                return(false);
            }

            for (int x = m.X - 1; x <= m.X + 1; x++)
            {
                for (int y = m.Y - 1; y <= m.Y + 1; y++)
                {
                    StaticTile[] tiles = map.Tiles.GetStaticTiles(x, y, false);

                    if (tiles.Length > 0)
                    {
                        foreach (var tile in tiles)
                        {
                            int id = (tile.ID & 0x3FFF) | 0x4000;

                            if (definition.Validate(id))
                            {
                                toHarvest = new StaticTarget(new Point3D(x, y, tile.Z), tile.ID);
                                return(true);
                            }
                        }
                    }

                    LandTile lt = map.Tiles.GetLandTile(x, y);

                    if (definition.Validate(lt.ID))
                    {
                        toHarvest = new LandTarget(new Point3D(x, y, lt.Z), map);
                        return(true);
                    }
                }
            }

            return(false);
        }
Exemplo n.º 28
0
        public static void GetSurfaceTop(ref IPoint3D p)
        {
            if (p is Item)
            {
                p = ((Item)p).GetSurfaceTop();
            }
            else if (p is StaticTarget)
            {
                StaticTarget t = (StaticTarget)p;
                int          z = t.Z;

                if ((t.Flags & TileFlag.Surface) == 0)
                {
                    z -= TileData.ItemTable[t.ItemID & TileData.MaxItemValue].CalcHeight;
                }

                p = new Point3D(t.X, t.Y, z);
            }
        }
Exemplo n.º 29
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is IPoint3D && from.Map != null)
                {
                    IPoint3D pnt = (IPoint3D)targeted;

                    BaseBoat boat = BaseBoat.FindBoatAt(pnt, from.Map);

                    if (boat != null && boat == m_Galleon && IsSurface(pnt))
                    {
                        IPooledEnumerable eable = from.Map.GetObjectsInRange(new Point3D(pnt), 0);

                        foreach (object o in eable)
                        {
                            if (o is Mobile || o is Item)
                            {
                                from.SendMessage("You cannot place the ship container there, try again.");
                                from.Target = new RelocateTarget(m_Container, m_Galleon);
                                eable.Free();
                                return;
                            }
                        }
                        eable.Free();

                        StaticTarget st = (StaticTarget)pnt;
                        int          z  = m_Galleon.ZSurface;

                        if (st != null)
                        {
                            z = st.Z;
                        }

                        m_Container.MoveToWorld(new Point3D(pnt.X, pnt.Y, z), from.Map);
                    }
                    else
                    {
                        from.SendMessage("You cannot place the ship container there, try again.");
                        from.Target = new RelocateTarget(m_Container, m_Galleon);
                    }
                }
            }
Exemplo n.º 30
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is IPoint3D && from.Map != null)
                {
                    IPoint3D pnt = (IPoint3D)targeted;

                    BaseBoat boat = BaseBoat.FindBoatAt(pnt, from.Map);

                    if (boat != null && boat == m_Galleon && IsSurface(pnt))
                    {
                        IPooledEnumerable eable = m_Pilot.Map.GetObjectsInRange(new Point3D(pnt), 0);

                        foreach (object o in eable)
                        {
                            if (o is Mobile || o is Item)
                            {
                                from.SendLocalizedMessage(1011577); // This is an invalid location.
                                from.Target = new RelocateTarget(m_Pilot, m_Galleon);
                                eable.Free();
                                return;
                            }
                        }
                        eable.Free();

                        StaticTarget st = (StaticTarget)pnt;
                        int          z  = m_Galleon.ZSurface;

                        if (st != null)
                        {
                            z = st.Z;
                        }

                        m_Pilot.MoveToWorld(new Point3D(pnt.X, pnt.Y, z), from.Map);
                    }
                    else
                    {
                        from.SendLocalizedMessage(1011577); // This is an invalid location.
                        from.Target = new RelocateTarget(m_Pilot, m_Galleon);
                    }
                }
            }