PRoConEvents.MULTIbalancer.StartMoveImmediate C# (CSharp) Method

StartMoveImmediate() private method

private StartMoveImmediate ( MoveInfo move, bool sendMessages ) : void
move MoveInfo
sendMessages bool
return void
        private void StartMoveImmediate(MoveInfo move, bool sendMessages)
        {
            // Do an immediate move, also used by the move thread
            if (!fIsEnabled || fPluginState != PluginState.Active) {
            ConsoleDebug("StartMoveImmediate called while fIsEnabled is " + fIsEnabled + " or fPluginState is "  + fPluginState);
            return;
            }

            fLastFastMoveTimestamp = DateTime.Now; // Any move resets the timer for fast moves

            // Send before messages?
            if (sendMessages) {
            Yell(move.Name, move.YellBefore);
            Chat(move.Name, move.ChatBefore, (move.For == MoveType.Unswitch || QuietMode)); // player only if unswitch or Quiet
            }

            lock (fMoving) {
            if (!fMoving.ContainsKey(move.Name)) fMoving[move.Name] = move;
            }
            // Do the move
            if (!EnableLoggingOnlyMode) {
            int toSquad = ToSquad(move.Name, move.Destination);
            ServerCommand("admin.movePlayer", move.Name, move.Destination.ToString(), toSquad.ToString(), "false");
            ScheduleListPlayers(10);
            }

            // Remember move
            PlayerModel player = GetPlayer(move.Name);
            if (player != null) {
            if (player.LastMoveTo != 0) ConsoleDebug("StartMoveImmediate: ^b" + move.Name + "^n player.LastMoveTo != 0, " + player.LastMoveTo);
            player.LastMoveTo = move.Destination;
            }

            // Log move
            String r = null;
            switch (move.For) {
            case MoveType.Balance: r = " for balance"; break;
            case MoveType.Unstack: r = " to unstack teams"; break;
            case MoveType.Unswitch: r = " to unswitch player"; break;
            default: r = " for ???"; break;
            }
            String moving = (move.Fast) ? "FAST MOVING" : "MOVING";
            String doing = (EnableLoggingOnlyMode) ? "^9(SIMULATING) ^b^1" + moving + "^0 " : "^b^1" + moving + "^0 ";
            DebugWrite(doing + move.Name + "^n from " + move.SourceName + " to " + move.DestinationName + r, 4);
        }
MULTIbalancer