Example #1
0
        private void ShowSelectedCharacterInfo()
        {
            if (listView_Characters.SelectedItems.Count == 1)                       //pois ListView seleciona "nada" antes de selecionar outro item.
            {
                charListLastSelectedIndex = listView_Characters.SelectedIndices[0]; // para uso posterior ao alterar lv

                listView_Characters.FocusedItem.Focused = false;
                selectedCharacter     = characters[listView_Characters.SelectedIndices[0]];
                selectedCharacterCIGA = cigaCharactersInfo.Find(ch => ch.CharType == selectedCharacter.CharType);

                picture_SelectedCharacter.Image = selectedCharacter.Image;
                lbl_CharacterName.ForeColor     = selectedCharacter.CharColor;

                //labels
                lbl_CharacterName.Text         = selectedCharacter.CharName;
                lbl_CharacterLevelAndPerc.Text =
                    $"Nível {selectedCharacter.Level}  ({selectedCharacter.LevelPercentage})";
                lbl_CharacterJob.Text     = $"{selectedCharacter.Promotion + 1}ª Classe";
                lbl_CharacterExpS4.Text   = $"{selectedCharacter.ExpS4} EXP";
                lbl_CharacterWinLoss.Text = $"Win: {selectedCharacter.Win} | Lose: {selectedCharacter.Lose}";

                lbl_CharacterCIGAGamePoint.Text = $"{selectedCharacterCIGA.GamePoint} GP";
                lbl_CharacterInventorySize.Text = $"Inventário: {selectedCharacterCIGA.InvenSize}";
                lbl_CharacterDefaultBonus.Text  = $"{selectedCharacterCIGA.DefaultBonus} Recargas de Vida";
                panel_SelectedCharacter.Visible = true;
            }
        }
        public bool ChangeGP(Users user, CIGACharacterInfo character, int amount)
        {
            int newGPValue = character.GamePoint + amount;

            using (IDbConnection connection = new System.Data.SqlClient.SqlConnection(Helper.CnnString("gcDB")))
            {
                try
                {
                    connection.Execute($"UPDATE CIGACharacterInfo SET GamePoint={newGPValue}" +
                                       $" WHERE LoginUID='{user.LoginUID}' and CharType = {character.CharType}");
                    character.GamePoint = newGPValue;
                    return(true);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                    return(false);
                }
            }
        }