Exemple #1
0
        /// <summary>
        /// Receive a portal usage from the client, check the portal in the PortalManager
        /// Raise a warning if the portal isn't found.
        /// <seealso cref="PortalManager.GetPortal"/>
        /// </summary>
        public void OnSendUsePortal(SagaMap.Packets.Client.SendUsePortal p)
        {
            if (this.state != SESSION_STATE.MAP_LOADED)
            {
                return;
            }

            PortalManager.PortalInfo portal;
            portal = PortalManager.GetPortal(p.GetPortalID(), this.Char.mapID);
            if (portal.m_mapID != -1)
            {
                if (this.Char.mapID == portal.m_mapID)//if the destination is current map,there is no need to change the map.
                {
                    this.map.TeleportActor(this.Char, portal.m_x, portal.m_y, portal.m_z);
                }
                else
                {
                    this.map.SendActorToMap(this.Char, Convert.ToByte(portal.m_mapID), portal.m_x, portal.m_y, portal.m_z);
                }
            }
            else
            {
                if (this.Char.GMLevel >= 2)
                {
                    this.SendMessage("Saga", "Cannot find Portal with toID:" + p.GetPortalID() + " and fromID:" + this.Char.mapID + " in database", SagaMap.Packets.Server.SendChat.MESSAGE_TYPE.SYSTEM_MESSAGE);
                }
                else
                {
                    this.SendMessage("Saga", "This Portal is not implemented yet!", SagaMap.Packets.Server.SendChat.MESSAGE_TYPE.SYSTEM_MESSAGE);
                }

                Logger.ShowWarning("Cannot find Portal with toID:" + p.GetPortalID() + " and fromID:" + this.Char.mapID + " in database");
            }
        }