예제 #1
0
 private void Update()
 {
     if (Global.isSteamActive && this.m_waitForResult)
     {
         EResult resultStatus = SteamInventory.GetResultStatus(this.m_resultHandle);
         if (resultStatus != EResult.k_EResultPending)
         {
             if (resultStatus == EResult.k_EResultOK)
             {
                 uint num = 0U;
                 if (SteamInventory.GetResultItems(this.m_resultHandle, null, ref num) && num > 0U)
                 {
                     SteamItemDetails_t[] array = new SteamItemDetails_t[num];
                     SteamInventory.GetResultItems(this.m_resultHandle, array, ref num);
                     this.m_itemDetails.AddRange(array);
                 }
                 this.EquipSteamInventoryItems();
             }
             else
             {
                 Debug.Log("SteamInventoryHandler.cs: Couldn't get inventory: " + resultStatus.ToString());
             }
             SteamInventory.DestroyResult(this.m_resultHandle);
             this.m_waitForResult = false;
         }
     }
 }
예제 #2
0
        private async Task UpdateCMStatus(Monitor monitor, EResult result, string lastAction)
        {
            var keyName = ServerRecordToString(monitor.Server);

            Log.WriteInfo("CM", "{0,40} | {1,10} | {2,20} | {3}", keyName, monitor.Server.ProtocolTypes, result, lastAction);

            try
            {
                using var db = await GetConnection();

                await db.ExecuteAsync(
                    "INSERT INTO `CMs` (`Address`, `IsWebSocket`, `Status`, `LastAction`) VALUES(@IP, @IsWebSocket, @Status, @LastAction) ON DUPLICATE KEY UPDATE `Status` = VALUES(`Status`), `LastAction` = VALUES(`LastAction`)",
                    new
                {
                    IP          = keyName,
                    IsWebSocket = (monitor.Server.ProtocolTypes & ProtocolTypes.WebSocket) > 0,
                    Status      = result.ToString(),
                    LastAction  = lastAction
                }
                    );
            }
            catch (MySqlException e)
            {
                Log.WriteError("UpdateCM", "Failed to update status of {0}: {1}", keyName, e.Message);
            }
        }
예제 #3
0
        public void Send(byte[] data, int channelId)
        {
            EResult res = SendSocket(HostConnection, data, channelId);

            if (res != EResult.k_EResultOK)
            {
                Debug.LogError($"Could not send: {res.ToString()}");
            }
        }
예제 #4
0
        // this message arrives after we've requested the details for a match
        void OnMatchDetails(IPacketGCMsg packetMsg)
        {
            var msg = new ClientGCMsgProtobuf <CMsgGCMatchDetailsResponse>(packetMsg);

            EResult result = (EResult)msg.Body.result;

            if (result != EResult.OK)
            {
                ModernDialog.ShowMessage("无法查询比赛详情", result.ToString(), MessageBoxButton.OK);
            }

            tmpMatch = msg.Body.match;
        }
예제 #5
0
        public void Send(byte[] data, int channelId)
        {
            EResult res = SendSocket(HostConnection, data, channelId);

            if (res == EResult.k_EResultNoConnection || res == EResult.k_EResultInvalidParam)
            {
                Debug.Log($"Connection to server was lost.");
                InternalDisconnect();
            }
            else if (res != EResult.k_EResultOK)
            {
                Debug.LogError($"Could not send: {res.ToString()}");
            }
        }
예제 #6
0
        public async void NotifyCMOffline(Monitor monitor, EResult result = EResult.Invalid)
        {
            string keyName = monitor.Server.ToString();

            ServerInfo serverInfo = ServerInfo.DeserializeFromBytes(await redis.Hashes.Get(10, "steamstatus:servers", keyName));

            serverInfo.IsOnline = false;

            if (result != EResult.Invalid)
            {
                serverInfo.Result = result.ToString();
            }

            var task = redis.Hashes.Set(10, "steamstatus:servers", keyName, serverInfo.SerializeToBytes());
        }
예제 #7
0
        private string GetCreateErrorText(EResult error)
        {
            return(error switch
            {
                EResult.k_EResultInsufficientPrivilege =>
                "You are currently restricted from uploading content due to a hub ban, " +
                "account lock, or community ban. You may need to contact Steam Support.",

                EResult.k_EResultBanned =>
                "You don't have permission to upload content " +
                "to this hub because they have an active VAC or Game ban.",

                EResult.k_EResultTimeout =>
                "Retried 3 times, but still timed out while publishing.",

                EResult.k_EResultNotLoggedOn =>
                "You haven't log on yet.",

                EResult.k_EResultServiceUnavailable =>
                "The workshop server hosting the content is having issues. Retry later.",

                EResult.k_EResultInvalidParam =>
                "One of the submission fields contains something not being accepted by that field.",

                EResult.k_EResultAccessDenied =>
                "There was a problem trying to save the title and description. Access was denied.",

                EResult.k_EResultLimitExceeded =>
                "You have exceeded their Steam Cloud quota. Remove some items and try again.",

                EResult.k_EResultFileNotFound =>
                "The uploaded file could not be found.",

                EResult.k_EResultDuplicateRequest =>
                "The file was already successfully uploaded.",

                EResult.k_EResultDuplicateName =>
                "You already have a Steam Workshop item with that name.",

                EResult.k_EResultServiceReadOnly =>
                "Due to a recent password or email change, " +
                "you are not allowed to upload new content. " +
                "Usually this restriction will expire in 5 days, " +
                "but can last up to 30 days if your account has been inactive recently.",
                _ => error.ToString(),
            });
예제 #8
0
        public void Send(int connectionId, byte[] data, int channelId)
        {
            if (connToMirrorID.TryGetValue(connectionId, out HSteamNetConnection conn))
            {
                EResult res = SendSocket(conn, data, channelId);

                if (res != EResult.k_EResultOK)
                {
                    Debug.LogError($"Could not send: {res.ToString()}");
                }
            }
            else
            {
                Debug.LogError("Trying to send on unknown connection: " + connectionId);
                OnReceivedError.Invoke(connectionId, new Exception("ERROR Unknown Connection"));
            }
        }
예제 #9
0
 private void HandleDropResult()
 {
     if (this.m_waitForResult && Global.isSteamActive)
     {
         bool    flag         = false;
         EResult resultStatus = SteamInventory.GetResultStatus(this.m_itemDropHandle);
         if (resultStatus != EResult.k_EResultPending)
         {
             if (resultStatus == EResult.k_EResultOK)
             {
                 uint num = 0U;
                 if (SteamInventory.GetResultItems(this.m_itemDropHandle, null, ref num))
                 {
                     SteamItemDetails_t[] array = new SteamItemDetails_t[num];
                     if (num > 0U)
                     {
                         SteamInventory.GetResultItems(this.m_itemDropHandle, array, ref num);
                         for (int i = 0; i < array.Length; i++)
                         {
                             if ((array[i].m_unFlags & 256) == 0)
                             {
                                 this.m_itemPopupGui.ShowGui(true, array[i].m_iDefinition.m_SteamItemDef);
                                 break;
                             }
                         }
                     }
                     else
                     {
                         flag = true;
                     }
                 }
             }
             else
             {
                 Debug.Log("RemoteCharacter.cs: Couldn't get item drop: " + resultStatus.ToString());
             }
             SteamInventory.DestroyResult(this.m_itemDropHandle);
             this.m_waitForResult = false;
             if (flag)
             {
                 this.GetPromoItem();
             }
         }
     }
 }
예제 #10
0
    private IEnumerator ShowResult()
    {
        ShowEnemyCards();
        resultText.text = result.ToString();
        resultText.gameObject.SetActive(true);
        resultText.color = Color.clear;
        float perc = 0;

        while (perc < 1)
        {
            resultText.color = Color.Lerp(Color.clear, Color.white, perc);
            perc            += Time.deltaTime;
            yield return(null);
        }
        yield return(new WaitForSeconds(1.5f));

        perc = 0;
        while (perc < 1)
        {
            resultText.color = Color.Lerp(Color.clear, Color.white, 1 - perc);
            perc            += Time.deltaTime;
            yield return(null);
        }
        resultText.gameObject.SetActive(false);
        if (result == EResult.DRAW)
        {
            Restart();
        }
        else
        {
            if (result == EResult.WIN)
            {
                GameState.CallResult = true;
            }
            yield return(new WaitForSeconds(1.2f));

            phase = EPhase.CLOSE;
            gameObject.SetActive(false);
        }
    }
예제 #11
0
        public void Start()
        {
            Output("Starting SalienClient...");

            while (true)
            {
                GetUserInfoResponse UserInfo = GetUserInfo();
                if (UserInfo == null)
                {
                    Output(String.Format("Failed Getting UserInfo, retrying in {0} seconds...", SleepSeconds), ConsoleColor.Red);
                    Thread.Sleep(TimeSpan.FromSeconds(SleepSeconds));
                    continue;
                }

                // Leave our current game
                if (UserInfo.Active_Zone_Game != 0)
                {
                    Output("Leaving Active Zone...");
                    EResult LeaveGameResult = LeaveGame(UserInfo.Active_Zone_Game);
                    if (LeaveGameResult == EResult.OK)
                    {
                        Output("Left Active Zone!", ConsoleColor.Green);
                    }
                    else
                    {
                        Output(String.Format("Error Leaving Active Zone: {0}, retrying in {1} seconds...", LeaveGameResult.ToString(), SleepSeconds), ConsoleColor.Red);
                        Thread.Sleep(TimeSpan.FromSeconds(SleepSeconds));
                        continue;
                    }
                }

                // Leave our current planet
                if (UserInfo.Active_Planet != 0)
                {
                    Output("Leaving Active Planet...");
                    EResult LeavePlanetResult = LeaveGame(UserInfo.Active_Planet);
                    if (LeavePlanetResult == EResult.OK)
                    {
                        Output("Left Active Planet!", ConsoleColor.Green);
                    }
                    else
                    {
                        Output(String.Format("Error Leaving Active Planet: {0}, retrying in {1} seconds...", LeavePlanetResult.ToString(), SleepSeconds), ConsoleColor.Red);
                        Thread.Sleep(TimeSpan.FromSeconds(SleepSeconds));
                        continue;
                    }
                }

                // Search for a new game
                Output("Finding Planet and Zone to Join...");
                (Planet planet, Planet_Zone zone) = FindZone();
                if (zone == null)
                {
                    Output(String.Format("Failed to Find a Zone, retrying in {0} seconds...", SleepSeconds), ConsoleColor.Red);
                    Thread.Sleep(TimeSpan.FromSeconds(SleepSeconds));
                    continue;
                }

                if (zone.Type == 4)
                {
                    Output(String.Format("Found Boss Zone: {0} on Planet: {1} ({2})!", zone.Zone_Position, planet.ID, planet.State.Name), ConsoleColor.Blue);
                }
                else
                {
                    Output(String.Format("Found Zone: {0} with Difficulty: {1} on Planet: {2} ({3})!", zone.Zone_Position, zone.Difficulty, planet.ID, planet.State.Name), ConsoleColor.Green);
                }

                // Join Planet
                Output("Joining Planet...");
                EResult JoinPlanetResult = JoinPlanet(planet.ID);
                if (JoinPlanetResult == EResult.OK)
                {
                    Output("Joined Planet!", ConsoleColor.Green);
                }
                else
                {
                    Output(String.Format("Error Joining Planet: {0}, retrying in {1} seconds...", JoinPlanetResult.ToString(), SleepSeconds), ConsoleColor.Red);
                    Thread.Sleep(TimeSpan.FromSeconds(SleepSeconds));
                    continue;
                }

                while (true)
                {
                    // Join Zone
                    Output("Joining Zone...");

                    // Boss Zone
                    if (zone.Type == 4)
                    {
                        (EResult Result, bool WaitingForPlayers)JoinBossZoneResult = JoinBossZone(zone.Zone_Position);
                        if (JoinBossZoneResult.Result == EResult.OK)
                        {
                            Output("Joined Boss Zone!", ConsoleColor.Blue);
                        }
                        else
                        {
                            Output(String.Format("Error Joining Boss Zone: {0}, retrying in {1} seconds...", JoinBossZoneResult.Result.ToString(), SleepSeconds), ConsoleColor.Red);
                            Thread.Sleep(TimeSpan.FromSeconds(SleepSeconds));
                            break;
                        }

                        // Report Score
                        int  Heal              = 0;
                        int  Fails             = 0;
                        int  PreviousXPGained  = 0;
                        bool WaitingForPlayers = JoinBossZoneResult.WaitingForPlayers;
                        while (true)
                        {
                            (EResult Result, ReportBossDamageResponse Response) = ReportBossDamage(WaitingForPlayers, (Heal == 23));
                            if (Result == EResult.OK)
                            {
                                if (Response.Boss_Status == null)
                                {
                                    Output(String.Format("Waiting... Sleeping for {0} seconds...", SleepSeconds), ConsoleColor.Blue);
                                    Thread.Sleep(TimeSpan.FromSeconds(SleepSeconds));
                                    continue;
                                }
                                else
                                {
                                    WaitingForPlayers = Response.Waiting_For_Players;
                                }

                                if (WaitingForPlayers)
                                {
                                    Output(String.Format("Waiting for players... Sleeping for {0}", SleepSeconds), ConsoleColor.Blue);
                                    Thread.Sleep(TimeSpan.FromSeconds(SleepSeconds));
                                    continue;
                                }

                                string output = String.Format("Boss HP: {0} / {1}\t Lasers: {2}, Heals: {3}\t",
                                                              Response.Boss_Status.Boss_HP, Response.Boss_Status.Boss_Max_HP,
                                                              Response.Num_Laser_Uses, Response.Num_Team_Heals);

                                if (Response.Game_Over)
                                {
                                    output = "GAME OVER";
                                }

                                if (AccountID != 0)
                                {
                                    Boss_Player Player = Response.Boss_Status.Boss_Players.First(x => x.AccountID == AccountID);
                                    if (!Response.Game_Over)
                                    {
                                        output += String.Format("HP: {0} / {1}, Level: {2}, Score: {3} / {4}, XP Earned: {5}",
                                                                Player.HP, Player.Max_HP, Player.New_Level, Player.Score_On_Join + Player.XP_Earned, Player.Next_Level_Score, Player.XP_Earned);

                                        PreviousXPGained = Player.XP_Earned;
                                    }
                                    else
                                    {
                                        output += String.Format(", XP Gained: {0}, Bonus XP: {1}, Total XP: {2}",
                                                                PreviousXPGained, Player.XP_Earned - PreviousXPGained, Player.XP_Earned);
                                    }
                                }
                                Output(output, ConsoleColor.Blue);

                                if (Response.Game_Over)
                                {
                                    break;
                                }
                            }
                            else if (Result == EResult.InvalidState)
                            {
                                break;
                            }
                            else
                            {
                                Output(String.Format("Error Reporting Boss Damage: {0}, retrying in {1} seconds...", Result.ToString(), SleepSeconds), ConsoleColor.Red);
                                Fails++;
                                Thread.Sleep(TimeSpan.FromSeconds(SleepSeconds));
                            }

                            if (Fails > 5)
                            {
                                break;
                            }

                            Heal++;

                            if (Heal > 23)
                            {
                                Heal = 0;
                            }

                            Thread.Sleep(TimeSpan.FromSeconds(5));
                        }
                        break;
                    }
                    // Normal Zone
                    else
                    {
                        EResult JoinZoneResult = JoinZone(zone.Zone_Position);
                        if (JoinZoneResult == EResult.OK)
                        {
                            Output("Joined Zone!", ConsoleColor.Green);
                        }
                        else if (JoinZoneResult == EResult.Expired)
                        {
                            Output("The Zone we tried joining has been captured...", ConsoleColor.Yellow);
                            break;
                        }
                        else
                        {
                            Output(String.Format("Error Joining Zone: {0}, retrying in {1} seconds...", JoinZoneResult.ToString(), SleepSeconds), ConsoleColor.Red);
                            Thread.Sleep(TimeSpan.FromSeconds(SleepSeconds));
                            break;
                        }


                        // Wait (and check if a better zone was found)
                        Output("Sleeping for 110 seconds...");
                        for (int i = 1; i < 110; i++)
                        {
                            Thread.Sleep(TimeSpan.FromSeconds(1));
                            if (Program.NewZone != null)
                            {
                                if (zone.Difficulty < Program.NewZone.Difficulty || Program.NewZone.Type == 4)
                                {
                                    break;
                                }
                            }
                        }
                        if (Program.NewZone != null)
                        {
                            if (zone.Difficulty < Program.NewZone.Difficulty || Program.NewZone.Type == 4)
                            {
                                break;
                            }
                        }

                        // Report Score
                        (EResult Result, ReportScoreResponse Response) = ReportScore(300 << zone.Difficulty);
                        if (Result == EResult.OK)
                        {
                            Output(String.Format("Finished Zone for {0} XP... Current Level: {1}, Current Score: {2}, Next Level Score: {3}",
                                                 300 << zone.Difficulty, Response.New_Level, Response.New_Score, Response.Next_Level_Score), ConsoleColor.Magenta);
                        }
                        else if (Result == EResult.NoMatch)
                        {
                            Output("The Zone we just finished was captured before we could report our score...", ConsoleColor.Yellow);
                            break;
                        }
                        else
                        {
                            Output(String.Format("Error Reporting Score: {0}, retrying in {1} seconds...", Response.ToString(), SleepSeconds), ConsoleColor.Red);
                            Thread.Sleep(TimeSpan.FromSeconds(SleepSeconds));
                            break;
                        }
                    }
                }
            }
        }
예제 #12
0
 public static string GetLabel(this EResult result)
 {
     return(result.ToString().Substring(9));
 }
예제 #13
0
 private void UpdateInventory()
 {
     if (Global.isSteamActive && this.m_waitForResult)
     {
         EResult resultStatus = SteamInventory.GetResultStatus(this.m_resultHandle);
         if (resultStatus != EResult.k_EResultPending)
         {
             if (resultStatus == EResult.k_EResultOK)
             {
                 uint num = 0U;
                 if (SteamInventory.GetResultItems(this.m_resultHandle, null, ref num))
                 {
                     SteamItemDetails_t[] array = new SteamItemDetails_t[num];
                     int num2 = 0;
                     if (this.m_completeRefresh)
                     {
                         this.m_itemDetails.Clear();
                     }
                     if (num > 0U)
                     {
                         SteamInventory.GetResultItems(this.m_resultHandle, array, ref num);
                         if (this.m_completeRefresh)
                         {
                             this.m_itemDetails.AddRange(array);
                         }
                         else
                         {
                             for (int i = 0; i < array.Length; i++)
                             {
                                 for (int j = 0; j < this.m_itemDetails.Count; j++)
                                 {
                                     if (array[i].m_itemId.m_SteamItemInstanceID == this.m_itemDetails[j].m_itemId.m_SteamItemInstanceID && 0 < (array[i].m_unFlags & 256))
                                     {
                                         this.m_itemDetails.RemoveAt(j);
                                         break;
                                     }
                                 }
                             }
                             for (int k = 0; k < array.Length; k++)
                             {
                                 if ((array[k].m_unFlags & 256) == 0)
                                 {
                                     this.m_itemDetails.Add(array[k]);
                                     num2 = array[k].m_iDefinition.m_SteamItemDef;
                                 }
                             }
                         }
                         int  lookItemDef = this.m_steamInventoryHandler.GetLookItemDef();
                         int  skinItemDef = this.m_steamInventoryHandler.GetSkinItemDef();
                         bool flag        = true;
                         bool flag2       = true;
                         int  num3        = 0;
                         for (int l = 0; l < this.m_itemDetails.Count; l++)
                         {
                             if (this.m_itemDetails[l].m_iDefinition.m_SteamItemDef == lookItemDef)
                             {
                                 flag = false;
                             }
                             else if (this.m_itemDetails[l].m_iDefinition.m_SteamItemDef == skinItemDef)
                             {
                                 flag2 = false;
                             }
                             if (3000 > this.m_itemDetails[l].m_iDefinition.m_SteamItemDef)
                             {
                                 num3++;
                             }
                         }
                         if (flag2 || flag)
                         {
                             this.m_steamInventoryHandler.SetLook((!flag) ? lookItemDef : 0, (!flag2) ? skinItemDef : 0);
                         }
                         this.m_txtCaseCount.transform.parent.gameObject.SetActive(0 < num3);
                         this.m_txtCaseCount.text = num3.ToString();
                     }
                     if (this.m_caseOpenFlag && num2 != 0)
                     {
                         this.m_caseOpenGui.Showtime(num2, this.m_generatorDefId);
                     }
                     else
                     {
                         this.UpdateInventoryDisplay();
                     }
                 }
             }
             else
             {
                 Debug.Log("SteamInventoryGUI.cs: Couldn't get inventory: " + resultStatus.ToString());
             }
             SteamInventory.DestroyResult(this.m_resultHandle);
             this.m_waitForResult = false;
         }
     }
 }
예제 #14
0
 public SaliensApiException(EResult eResult, string message) : base($"Error {eResult.ToString()} ({(int)eResult}): {message}") =>
     this.EResult = eResult;
예제 #15
0
        public async void NotifyCMOffline( Monitor monitor, EResult result = EResult.Invalid )
        {
            string keyName = monitor.Server.ToString();

            ServerInfo serverInfo = ServerInfo.DeserializeFromBytes( await redis.Hashes.Get( 10, "steamstatus:servers", keyName ) );

            serverInfo.IsOnline = false;

            if ( result != EResult.Invalid )
            {
                serverInfo.Result = result.ToString();
            }

            var task = redis.Hashes.Set( 10, "steamstatus:servers", keyName, serverInfo.SerializeToBytes() );
        }