Beispiel #1
0
        public void GameVitalsUpdateUI(JObject user_info_data, JObject arena_data, JObject thief_data)
        {
            if (this.InvokeRequired)
            {
                VOID__VOID_JOBJECT_JOBJECT_JOBJECT de = GameVitalsUpdateUI;
                this.Invoke(de, new object[] { user_info_data, arena_data, thief_data });
                return;
            }

            try
            {
                if (user_info_data != null)
                {
                    GameObjs.Hero hero = new GameObjs.Hero(user_info_data);

                    this.lblLogin.Text = Utils.GetAppSetting("Login_Account").Trim();

                    this.lblIndicators.Text = "";
                    this.lblIndicators.Text += "[" + GameClient.GameAbbreviation(Game.Service).Replace("SW", "四国战记") + "] ";
                    if (Utils.True("Login_Chat")) this.lblIndicators.Text += "[Chat] ";
                    if (Utils.True("Game_Events")) this.lblIndicators.Text += "[Events] ";
                    if (Utils.False("Chat_AutoReconnect")) this.lblIndicators.Text += "[Reconnect] ";
                    if (GameClient.Want_Debug) this.lblIndicators.Text += "[Debug] ";
                    
                    this.trayIcon.Text =
                        (
                            "EK Unleashed\r\n" +
                            (Utils.ValidText(hero.Name) ? hero.Name + "\r\n" : "") +
                            (Utils.ValidText(Game.ServerName) ? Game.ServerName + "\r\n" : "") +
                            Game.Service.ToString().Replace("_", " ") + "\r\n" + 
                        "").Trim();

                    this.lblNickName.Text = hero.Name;
                    this.lblLastUpdated.Text = DateTime.Now.ToString();
                    this.lblLevel.Text = hero.Level.ToString();

                    this.prgXPToNext.Value = (int)hero.ProgressTowardLevel;
                    if (!this.prgXPToNext.Visible)
                        this.prgXPToNext.Visible = true;

                    // Causes the progress bar to be yellow, but stops the animation effect
                    Utils.SendMessage
                    (
                        this.prgXPToNext.Handle,
                        0x400 + 16, // WM_USER + PBM_SETSTATE
                        0x0003, // PBST_PAUSED
                        IntPtr.Zero
                    );

                    Game.User_Gems = hero.Gems;
                    Game.User_Level = hero.Level;
                    lock (this.locker)
                    {
                        this.lblGems.Text = Game.User_Gems.ToString("#,##0");
                    }
                    this.lblGold.Text = hero.Gold.ToString("#,##0");
                    this.lblFireTokens.Text = hero.FireTokens.ToString("#,##0");
                    this.lblEnergy.Text = hero.Energy.ToString() + " / " + user_info_data["data"]["EnergyMax"].ToString();
                    this.lblArena.Text = (hero.ArenaFightsLeft == 1) ? "1 fight remaining" : hero.ArenaFightsLeft.ToString() + " fights remaining";

                    this.lblDIAvailable.Text = "";
                    this.lblFriendRequest.Text = "";
                    this.lblEmail.Text = "";

                    if ((Utils.CInt(user_info_data["data"]["Boss"].ToString()) != 0) || (Game.DoingDemonInvasion))
                    {
                        this.lblEmail.Text = "A demon invasion is in progress.";
                        if (!Game.DoingDemonInvasion)
                            if (Utils.False("Game_FightDemonInvasions"))
                                Game.DoingDemonInvasion = true;
                    }
                    if (Utils.CInt(user_info_data["data"]["NewEmail"].ToString()) > 0)
                        this.lblEmail.Text = "You have " + Utils.CInt(user_info_data["data"]["NewEmail"].ToString()).ToString() + " new messages.";
                    if (Utils.CInt(user_info_data["data"]["FriendApplyNum"].ToString()) > 0)
                        this.lblFriendRequest.Text = "You have " + Utils.CInt(user_info_data["data"]["FriendApplyNum"].ToString()).ToString() + " new friend applicants.";
                }

                if (arena_data != null)
                {
                    this.lblArenaRank.Text = "rank " + Utils.CInt(arena_data["data"]["Rank"].ToString()).ToString("#,##0");
                }

                if (thief_data != null)
                {
                    this.lblThiefAvailable.Text = "";

                    int thieves_legendary = 0;
                    int thieves_regular = 0;

                    foreach (var thief in thief_data["data"]["Thieves"])
                    {
                        int tuid = Utils.CInt(thief["UserThievesId"].ToString());
                        int level = Utils.CInt(thief["ThievesId"].ToString());
                        int hp = Utils.CInt(thief["HPCurrent"].ToString());
                        int hpmax = Utils.CInt(thief["HPCount"].ToString());
                        bool legendary = Utils.CInt(thief["Type"].ToString()) == 2;
                        string discovered_by = thief["NickName"].ToString().Trim();
                        int flee_seconds_remaining = Utils.CInt(thief["FleeTime"].ToString());

                        if (flee_seconds_remaining > 0)
                        {
                            if (legendary)
                                thieves_legendary++;
                            else
                                thieves_regular++;
                        }
                    }

                    if (thieves_regular + thieves_legendary > 0)
                    {
                        if (thieves_legendary == 0)
                            this.lblThiefAvailable.Text = thieves_regular.ToString() + " " + Utils.PluralWord(thieves_regular, "thief", "thieves");
                        else if (thieves_regular == 0)
                            this.lblThiefAvailable.Text = thieves_legendary.ToString() + " legendary " + Utils.PluralWord(thieves_legendary, "thief", "thieves");
                        else
                            this.lblThiefAvailable.Text = thieves_regular.ToString() + " " + Utils.PluralWord(thieves_regular, "thief", "thieves") + " and " + thieves_legendary.ToString() + " legendary " + Utils.PluralWord(thieves_legendary, "thief", "thieves");
                    }
                }
            }
            catch { }

            return;
        }
Beispiel #2
0
        private void moreCardGroupsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (!Game.Want_Game_Login)
                return;

            this.tabsChatChannels.SelectedTab = this.tabNotifications;

            JObject js_user = null;
            GameObjs.Hero hero = null;

            try
            {
                js_user = JObject.Parse(Game.GetGameData("user", "GetUserInfo", false));
                hero = new GameObjs.Hero(js_user);
            }
            catch
            {
                return;
            }

            string js_decks = Game.GetGameData("card", "GetCardGroup");

            try
            {
                JObject jo_decks = JObject.Parse(js_decks);

                if (Utils.CInt(jo_decks["data"]["RmbGroupCash"]) == 0)
                {
                    Utils.LoggerNotifications("<color=#a07000>You can't buy a new card group.  You already have the maximum number of decks.");
                    return;
                }

                if (Utils.CInt(jo_decks["data"]["RmbGroupCash"]) > hero.Gems)
                {
                    Utils.LoggerNotifications("<color=#a07000>You can't buy a new card group.  You don't have enough gems.");
                    return;
                }
            }
            catch
            {
                return;
            }

            string js_buy = Game.GetGameData("card", "BuyCardGroup");

            try
            {
                Utils.DebugLogger(JSBeautifyLib.JSBeautify.BeautifyMe(js_buy));

                JObject jo_bought = JObject.Parse(js_buy);

                if (Utils.CInt(jo_bought["status"]) == 1)
                    Utils.LoggerNotifications("<color=#ffa000>You bought a new card group!");

                return;
            }
            catch { }

            Utils.LoggerNotifications("<color=#ff4040>Error buying a new card group!");
            return;

        }