Esempio n. 1
0
    private void OnRealmConnectionFailed(JumpInPayload failedRealm)
    {
        bool isArchipelagoRealm = string.IsNullOrEmpty(failedRealm.realm.layer);

        if (failedRealm.gridPosition != lastJumpInTried.gridPosition ||
            failedRealm.realm.serverName != lastJumpInTried.realm.serverName ||
            (!isArchipelagoRealm && failedRealm.realm.layer != lastJumpInTried.realm.layer))
        {
            return;
        }

        if (nextMostPopulatedRealms.Count > 0)
        {
            WebInterface.NotifyStatusThroughChat("Trying to connect to the next more populated realm...");
            HotScenesController.HotSceneInfo.Realm nextRealmToTry = nextMostPopulatedRealms.Dequeue();
            SetLastJumpInTried(hotSceneInfo.baseCoords, nextRealmToTry.serverName, nextRealmToTry.layer);
            OnJumpIn?.Invoke(hotSceneInfo.baseCoords, nextRealmToTry.serverName, nextRealmToTry.layer);
        }
        else
        {
            WebInterface.NotifyStatusThroughChat("You'll stay in your current realm.");
            RealmsInfoBridge.OnRealmConnectionSuccess -= OnRealmConnectionSuccess;
            RealmsInfoBridge.OnRealmConnectionFailed  -= OnRealmConnectionFailed;
            OnJumpIn?.Invoke(hotSceneInfo.baseCoords, null, null);
        }
    }