Esempio n. 1
0
        /*public static void Move(int source, int destination, int amount, int x, int y)
         * {
         *      Assistant.Item bag = Assistant.World.FindItem(destination);
         *      Assistant.Item item = Assistant.World.FindItem(source);
         *      int serialdestination = 0;
         *
         *      if (item == null)
         *      {
         *              Scripts.SendMessageScriptError("Script Error: Move: Source Item  not found");
         *              return;
         *      }
         *
         *      if (bag != null)
         *      {
         *              serialdestination = bag.Serial;
         *      }
         *      else
         *      {
         *              Assistant.Mobile mbag = Assistant.World.FindMobile(destination);
         *              if (mbag != null)
         *              {
         *                      serialdestination = mbag.Serial;
         *              }
         *              else
         *              {
         *                      Scripts.SendMessageScriptError("Script Error: Move: Destination not found");
         *                      return;
         *              }
         *      }
         *
         *      Assistant.Point3D loc = Assistant.Point3D.MinusOne;
         *      if (x != -1 && y != -1)
         *              loc = new Assistant.Point3D(x, y, 0);
         *
         *      if (amount == 0)
         *      {
         *              Assistant.Client.Instance.SendToServerWait(new LiftRequest(item.Serial, item.Amount));
         *              Assistant.Client.Instance.SendToServerWait(new DropRequest(item.Serial, loc, serialdestination));
         *      }
         *      else
         *      {
         *              if (item.Amount < amount)
         *              {
         *                      amount = item.Amount;
         *              }
         *              Assistant.Client.Instance.SendToServerWait(new LiftRequest(item.Serial, amount));
         *              Assistant.Client.Instance.SendToServerWait(new DropRequest(item.Serial, loc, serialdestination));
         *      }
         * }*/

        public static void Move(int source, int destination, int amount, int x, int y)
        {
            Assistant.Item   bag  = Assistant.World.FindItem(destination);
            Assistant.Item   item = Assistant.World.FindItem(source);
            Assistant.Mobile mbag = null;

            int  serialdestination = 0;
            bool isMobile          = false;
            bool onLocation        = false;
            int  newamount         = 0;

            if (item == null)
            {
                Scripts.SendMessageScriptError("Script Error: Move: Source Item  not found");
                return;
            }

            if (bag != null)
            {
                serialdestination = bag.Serial;
            }
            else
            {
                mbag = Assistant.World.FindMobile(destination);
                if (mbag != null)
                {
                    isMobile          = true;
                    serialdestination = mbag.Serial;
                }
            }

            if (serialdestination == 0)
            {
                Scripts.SendMessageScriptError("Script Error: Move: Destination not found");
                return;
            }

            Assistant.Point3D loc = Assistant.Point3D.MinusOne;
            if (x != -1 && y != -1)
            {
                onLocation = true;
                loc        = new Assistant.Point3D(x, y, 0);
            }

            // calcolo amount
            if (amount == 0)
            {
                newamount = item.Amount;
            }
            else
            {
                if (item.Amount < amount)
                {
                    newamount = item.Amount;
                }
                else
                {
                    newamount = amount;
                }
            }

            if (isMobile)
            {
                Assistant.DragDropManager.DragDrop(item, newamount, mbag.Serial);
            }
            else if (onLocation)
            {
                Assistant.DragDropManager.DragDrop(item, newamount, bag, loc);
            }
            else
            {
                Assistant.DragDropManager.DragDrop(item, newamount, bag);
            }
        }
Esempio n. 2
0
        public static bool GetLandFlag(int itemid, string flagname)
        {
            switch (flagname)
            {
            case "None":
                if (TileData.LandTable[itemid].Flags == TileFlag.None)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }

            case "Translucent":                     // The tile is rendered with partial alpha-transparency.
                if ((TileData.LandTable[itemid].Flags & TileFlag.Translucent) != 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }

            case "Wall":                     // The tile is a wall.
                if ((TileData.LandTable[itemid].Flags & TileFlag.Wall) != 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }

            case "Damaging":                     // The tile can cause damage when moved over.
                if ((TileData.LandTable[itemid].Flags & TileFlag.Damaging) != 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }

            case "Impassable":                     // The tile may not be moved over or through.
                if ((TileData.LandTable[itemid].Flags & TileFlag.Impassable) != 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }

            case "Surface":                     // The tile is a surface. It may be moved over, but not through.
                if ((TileData.LandTable[itemid].Flags & TileFlag.Surface) != 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }

            case "Bridge":                     // The tile is a stair, ramp, or ladder.
                if ((TileData.LandTable[itemid].Flags & TileFlag.Bridge) != 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }

            case "Window":                     // The tile is a window.
                if ((TileData.LandTable[itemid].Flags & TileFlag.Window) != 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }

            case "NoShoot":                     // The tile blocks line of sight.
                if ((TileData.LandTable[itemid].Flags & TileFlag.NoShoot) != 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }

            case "Foliage":                     // The tile becomes translucent when walked behind. Boat masts also have this flag.
                if ((TileData.LandTable[itemid].Flags & TileFlag.Foliage) != 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }

            case "HoverOver":                     // Gargoyles can fly over
                if ((TileData.LandTable[itemid].Flags & TileFlag.HoverOver) != 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }

            case "Roof":                     // The tile is a slanted roof.
                if ((TileData.LandTable[itemid].Flags & TileFlag.Roof) != 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }

            case "Door":                     // The tile is a door. Tiles with this flag can be moved through by ghosts and GMs.
                if ((TileData.LandTable[itemid].Flags & TileFlag.Door) != 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }

            case "Wet":
                if ((TileData.LandTable[itemid].Flags & TileFlag.Wet) != 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }

            default:
                Scripts.SendMessageScriptError("GetLandFlag: Invalid Flag to check");
                return(false);
            }
        }