private void LoadCardConstantsData()
 {
     byte[][] cardConstantsBytes = dataAccess.LoadCardConstantData();
     CardConstant.LoadFromBytes(cardConstantsBytes);
     this.cardConstantsBinding = new BindingListView <CardConstant>(CardConstant.List);
     this.cardConstantsDataGridView.DataSource = cardConstantsBinding;
 }
    public CardConstant(ushort cardIndex, byte[] bytes)
    {
        this.Index          = cardIndex;
        this.Name           = Cards.GetNameByIndex(cardIndex);
        this.bytes          = bytes;
        this.kind           = bytes[0];
        this.cardKind       = new CardKind(this.kind);
        this.kindOfs        = bytes[1];
        this.levelAttribute = new BitArray(new byte[] { bytes[2] });
        this.level          = bytes[2].splitByte()[1];
        this.attribute      = new CardAttribute(bytes[2].splitByte()[0]);
        this.DeckCost       = bytes[3];
        this.effectId       = BitConverter.ToUInt16(new byte[] { bytes[4], bytes[5] }, 0);
        this.xaxId          = BitConverter.ToUInt16(new byte[] { bytes[6], bytes[7] }, 0);

        this.apWithFlags            = new BitArray(new byte[] { bytes[8], bytes[9] });
        this.attack                 = CardConstant.GetAttackOrDefense(new byte[] { bytes[8], bytes[9] });
        this.hasImage               = apWithFlags[apWithFlags.Length - 3];
        this.passwordWorks          = apWithFlags[apWithFlags.Length - 2];
        this.appearsInReincarnation = apWithFlags[apWithFlags.Length - 1];

        this.dpWithFlags        = new BitArray(new byte[] { bytes[10], bytes[11] });
        this.defense            = CardConstant.GetAttackOrDefense(new byte[] { bytes[10], bytes[11] });
        this.appearsInSlotReels = dpWithFlags[dpWithFlags.Length - 3];
        this.isSlotRare         = dpWithFlags[dpWithFlags.Length - 2];

        this.hasAlternateArt = dpWithFlags[dpWithFlags.Length - 1];
        this.passwordArray   = new byte[] { bytes[12], bytes[13], bytes[14], bytes[15], bytes[16], bytes[17], bytes[18], bytes[19] };
        this.setCardColor();
    }
Beispiel #3
0
        private void makeDeckLeaderToolStripMenuItem_Click(object sender, EventArgs e)
        {
            CardConstant selectedCard = ((ObjectView <CardConstant>)trunkDataGridView.SelectedRows[0].DataBoundItem).Object;
            Deck         deck         = (Deck)deckDropdown.SelectedItem;

            deck.DeckLeader = new DeckCard(selectedCard, deck.DeckLeader.Rank);
            deckListBinding.ResetBindings(false);
        }
    private void applyButton_Click(object sender, EventArgs e)
    {
        for (int i = 0; i < this.selectedCardConstants.Count; i++)
        {
            int          cardIndex    = this.selectedCardConstants[i].Index;
            CardConstant cardConstant = CardConstant.List[cardIndex];
            this.applyCardChanges(ref cardConstant);
        }

        this.Close();
    }
Beispiel #5
0
        private void addCardsToDeck(List <DataGridViewRow> rows)
        {
            foreach (DataGridViewRow row in rows)
            {
                CardConstant   cardConstant = ((ObjectView <CardConstant>)row.DataBoundItem).Object;
                DeckLeaderRank rank         = new DeckLeaderRank((int)DeckLeaderRankType.NCO);
                DeckCard       deckCard     = new DeckCard(cardConstant, rank);
                deckCardListBinding.Add(deckCard);
            }

            refreshDeckInfoLabels();
        }
        private void ShowMultipleEditDialog(object sender, ToolStripItemClickedEventArgs e)
        {
            List <CardConstant> selectedCardConstants = new List <CardConstant>();

            for (int i = 0; i < this.cardConstantsDataGridView.SelectedRows.Count; i++)
            {
                CardConstant cardConstant = ((ObjectView <CardConstant>) this.cardConstantsDataGridView.SelectedRows[i].DataBoundItem).Object;
                selectedCardConstants.Add(CardConstant.List[cardConstant.Index]);
            }

            CardConstantsMultiEditForm form = new CardConstantsMultiEditForm(selectedCardConstants);

            form.ShowDialog();
            this.cardConstantsDataGridView.Refresh();
        }
    private void applyCardChanges(ref CardConstant cardConstant)
    {
        if (this.attackTouched)
        {
            cardConstant.Attack = (ushort)this.attackNumericUpDown.Value;
        }

        if (this.defenseTouched)
        {
            cardConstant.Defense = (ushort)this.defenseNumericUpDown.Value;
        }

        if (this.deckCostTouched)
        {
            cardConstant.DeckCost = (byte)this.deckCostNumericUpDown.Value;
        }

        if (this.slotsTouched)
        {
            cardConstant.AppearsInSlotReels = this.slotsCheckbox.Checked;
        }

        if (this.slotsRareTouched)
        {
            cardConstant.IsSlotRare = this.slotRaresCheckbox.Checked;
        }

        if (this.reincarnationTouched)
        {
            cardConstant.AppearsInReincarnation = this.reincarnationCheckbox.Checked;
        }

        if (this.passwordWorksTouched)
        {
            cardConstant.PasswordWorks = this.passwordWorksCheckbox.Checked;
        }

        if (this.levelTouched)
        {
            cardConstant.Level = (byte)this.levelNumericUpDown.Value;
        }
    }
        private Color CardConstantRowColor(CardConstant cardConstant)
        {
            switch (cardConstant.CardColor)
            {
            case CardColorType.NormalMonster:
                return(Color.FromArgb(160, 128, 0));

            case CardColorType.EffectMonster:
                return(Color.FromArgb(160, 80, 0));

            case CardColorType.Ritual:
                return(Color.FromArgb(81, 102, 141));

            case CardColorType.Trap:
                return(Color.FromArgb(160, 16, 64));

            case CardColorType.Magic:
                return(Color.FromArgb(0, 96, 48));

            default:
                return(Color.FromArgb(160, 128, 0));
            }
        }
    private void PopulateFields()
    {
        CardConstant firstCard = this.selectedCardConstants.First();

        bool attackChanged                 = false;
        bool defenseChanged                = false;
        bool deckCostChanged               = false;
        bool levelChanged                  = false;
        bool appearsInSlotReelsChanged     = false;
        bool isSlotRareChanged             = false;
        bool appearsInReincarnationChanged = false;
        bool passwordWorksChanged          = false;

        foreach (CardConstant constant in this.selectedCardConstants)
        {
            if (!attackChanged && (constant.Attack != firstCard.Attack))
            {
                attackChanged = true;
            }

            if (!defenseTouched && (constant.Defense != firstCard.Defense))
            {
                defenseChanged = true;
            }

            if (!deckCostChanged && (constant.DeckCost != firstCard.DeckCost))
            {
                deckCostChanged = true;
            }

            if (!levelChanged && (constant.Level != firstCard.Level))
            {
                levelChanged = true;
            }

            if (!appearsInSlotReelsChanged && (constant.AppearsInSlotReels != firstCard.AppearsInSlotReels))
            {
                appearsInSlotReelsChanged = true;
            }

            if (!isSlotRareChanged && (constant.IsSlotRare != firstCard.IsSlotRare))
            {
                appearsInSlotReelsChanged = true;
            }

            if (!appearsInReincarnationChanged && (constant.AppearsInReincarnation != firstCard.AppearsInReincarnation))
            {
                appearsInReincarnationChanged = true;
            }

            if (!passwordWorksChanged && (constant.PasswordWorks != firstCard.PasswordWorks))
            {
                passwordWorksChanged = true;
            }
        }

        if (attackChanged)
        {
            this.attackNumericUpDown.Text = "";
        }
        else
        {
            this.attackNumericUpDown.Value = firstCard.Attack;
        }

        if (defenseChanged)
        {
            this.defenseNumericUpDown.Text = "";
        }
        else
        {
            this.defenseNumericUpDown.Value = firstCard.Defense;
        }

        if (deckCostChanged)
        {
            this.deckCostNumericUpDown.Text = "";
        }
        else
        {
            this.deckCostNumericUpDown.Value = firstCard.DeckCost;
        }

        if (levelChanged)
        {
            this.levelNumericUpDown.Text = "";
        }
        else
        {
            this.levelNumericUpDown.Value = firstCard.Level;
        }

        this.slotsCheckbox.Checked         = appearsInSlotReelsChanged ? false : firstCard.AppearsInSlotReels;
        this.slotRaresCheckbox.Checked     = isSlotRareChanged ? false : firstCard.IsSlotRare;
        this.reincarnationCheckbox.Checked = appearsInReincarnationChanged ? false : firstCard.AppearsInReincarnation;
        this.passwordWorksCheckbox.Checked = passwordWorksChanged ? false : firstCard.PasswordWorks;
    }