Пример #1
0
        internal static bool ConnectClientToNPC(NetState client, BaseCreature Subject)
        {
            if (client == null)
            {
                return(false);
            }

            if (Subject.NetState == null)
            {
                Mobile clientMobile = client.Mobile;
                if (client.Account != null && clientMobile is PlayerMobile)
                {
                    client.Account.SetPseudoSeerLastCharacter(client.Mobile);
                }

                Subject.NetState = client;

                if (clientMobile != null)
                {
                    clientMobile.NetState = null;
                }

                Subject.NetState.Mobile = Subject;

                PacketHandlers.DoLogin(Subject.NetState, Subject);

                PossessedMonsters.Add(Subject);
                Subject.Account = client.Account;
                return(true);
            }
            return(false);
        }
Пример #2
0
        public void DoSwap(NetState ns, Mobile CharSelect)
        {
            if (CharSelect == null)
            {
                return;
            }

            Mobile from = ns.Mobile;

            if (from == CharSelect)
            {
                return;
            }

            from.CloseAllGumps();

            ns.BlockAllPackets = true;

            from.NetState       = null;
            CharSelect.NetState = ns;
            ns.Mobile           = CharSelect;

            ns.BlockAllPackets = false;

            PacketHandlers.DoLogin(ns, CharSelect);
        }
Пример #3
0
        internal static bool ConnectClientToPC(NetState client, PlayerMobile Subject)
        {
            if (Subject != null && Subject.NetState == null)
            {
                Mobile clientMobile = client.Mobile;

                Subject.NetState = client;

                if (clientMobile != null)
                {
                    clientMobile.NetState = null;
                }

                Subject.NetState.Mobile = Subject;

                PacketHandlers.DoLogin(Subject.NetState, Subject);
                return(true);
            }
            return(false);
        }
        public static void ChangeCharacter_OnCommand(CommandEventArgs e)
        {
            Mobile   from = e.Mobile;
            NetState ns   = from.NetState;

            if (from.GetLogoutDelay() > TimeSpan.Zero)
            {
                from.SendMessage("You can't insta-log here, or right now; you cannot switch characters.");
                return;
            }

            if (e.ArgString.Length == 0)
            {
                from.CloseAllGumps();

                // Return player to character select screen.
                ns.BlockAllPackets = true;

                from.NetState = null;

                ns.BlockAllPackets = false;

                ns.Send(new CharacterList(ns.Account, ns.CityInfo));

                Console.WriteLine("Client: {0}: Returning to character select. [{1}]",
                                  ns.ToString(),
                                  ns.Account.Username);

                return;
            }

            if (e.ArgString.ToUpper() == from.Name.ToUpper())
            {
                from.SendMessage("You're already using that character!");
                return;
            }

            Mobile newchar = null;

            for (int i = 0; i < from.Account.Length; i++)
            {
                if (from.Account[i] == null)
                {
                    continue;
                }

                if (from.Account[i].Name.ToUpper() == e.ArgString.ToUpper())
                {
                    newchar = from.Account[i];
                    break;
                }
            }

            if (newchar == null)
            {
                from.SendMessage("Can't find a character named '{0}' on your account.", e.ArgString);
                return;
            }

            // do the switch!
            from.CloseAllGumps();

            ns.BlockAllPackets = true;

            from.NetState    = null;
            newchar.NetState = ns;
            ns.Mobile        = newchar;

            ns.BlockAllPackets = false;

            PacketHandlers.DoLogin(ns, newchar);

            Console.WriteLine("Client: {0}: Character switch from '{2}' to '{3}' [{1}]", ns.ToString(),
                              from.Account.Username, from.Name, newchar.Name);
        }
Пример #5
0
        public static void ChangeCharacter_OnCommand(CommandEventArgs e)
        {
            Mobile   from = e.Mobile;
            NetState ns   = from.NetState;

            if (from.GetLogoutDelay() > TimeSpan.Zero)
            {
                from.SendMessage("Nemuzes se zde nebo nyni instantne odlogovat. ; nemuzes zmenit character.");
                return;
            }

            if (e.ArgString.Length == 0)
            {
                from.CloseAllGumps();

                // Return player to character select screen.
                ns.BlockAllPackets = true;

                from.NetState = null;

                ns.BlockAllPackets = false;

                ns.Send(new CharacterList(ns.Account, ns.CityInfo));

                Console.WriteLine("Client: {0}: Returning to character select. [{1}]",
                                  ns.ToString(),
                                  ns.Account.Username);

                return;
            }

            if (e.ArgString.ToUpper() == from.Name.ToUpper())
            {
                from.SendMessage("Prave pouzivas tento character!");
                return;
            }

            Mobile newchar = null;

            for (int i = 0; i < from.Account.Length; i++)
            {
                if (from.Account[i] == null)
                {
                    continue;
                }

                if (from.Account[i].Name.ToUpper() == e.ArgString.ToUpper())
                {
                    newchar = from.Account[i];
                    break;
                }
            }

            if (newchar == null)
            {
                from.SendMessage("Server nemuze najit charakter '{0}' na tvem uctu.", e.ArgString);
                return;
            }

            // do the switch!
            from.CloseAllGumps();

            ns.BlockAllPackets = true;

            from.NetState    = null;
            newchar.NetState = ns;
            ns.Mobile        = newchar;

            ns.BlockAllPackets = false;

            PacketHandlers.DoLogin(ns, newchar);

            Console.WriteLine("Client: {0}: Charakter prohozen z '{2}' na '{3}' [{1}]", ns.ToString(),
                              from.Account.Username, from.Name, newchar.Name);
        }