Beispiel #1
0
        static PortalExit ParseExit(IDataRecord record)
        {
            PortalExit data = new PortalExit();

            data.Map = record.GetText(0).Cp437ToUnicode();

            data.X = (ushort)record.GetInt32(1);
            data.Y = (ushort)record.GetInt32(2);
            data.Z = (ushort)record.GetInt32(3);
            return(data);
        }
Beispiel #2
0
        public static bool Handle(Player p, ushort x, ushort y, ushort z)
        {
            if (!p.level.hasPortals)
            {
                return(false);
            }

            PortalExit exit = Get(p.level.MapName, x, y, z);

            if (exit == null)
            {
                return(false);
            }
            Orientation rot = p.Rot;

            if (p.level.name != exit.Map)
            {
                Level curLevel = p.level;
                p.summonedMap = exit.Map;
                bool changedMap = false;

                try {
                    changedMap = PlayerActions.ChangeMap(p, exit.Map);
                } catch (Exception ex) {
                    Logger.LogError(ex);
                    changedMap = false;
                }

                p.summonedMap = null;
                if (!changedMap)
                {
                    p.Message("Unable to use this portal, as this portal goes to that map."); return(true);
                }
                p.BlockUntilLoad(10);
            }

            Position pos = Position.FromFeetBlockCoords(exit.X, exit.Y, exit.Z);

            p.SendPos(Entities.SelfID, pos, rot);
            return(true);
        }