Esempio n. 1
0
        private void cmbArmorPid_SelectedValueChanged(object sender, EventArgs e)
        {
            cmbForcedCrType.Enabled = (cmbArmorPid.Text != "Proto Default");
            if (!cmbForcedCrType.Enabled)
            {
                return;
            }

            cmbForcedCrType.Items.Clear();

            if (CurrentNpc == null)
            {
                return;
            }

            ProtoCritter CrProt = ProtoManager.Protos[CurrentNpc.Proto.Id];

            if (CrProt == null)
            {
                Message.Show("Proto for critter not loaded, unable to gain gender information.", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (cmbArmorPid.Text == "None")
            {
                if (CrProt.Params[Consts.ST_GENDER] == 1) // female
                {
                    cmbForcedCrType.Items.Add(GetCrTypeDefineByPid(61) + " [61]");
                    cmbForcedCrType.Items.Add(GetCrTypeDefineByPid(63) + " [63]");
                }
                else
                {
                    cmbForcedCrType.Items.Add(GetCrTypeDefineByPid(62) + " [62]");
                    cmbForcedCrType.Items.Add(GetCrTypeDefineByPid(64) + " [64]");
                }
                if (CurrentNpc.ForcedCrType == -1 || CurrentNpc.ForcedCrType == 0)
                {
                    cmbForcedCrType.SelectedIndex = 0;
                }
            }
            else
            {
                if (cmbArmorPid.SelectedIndex < 2)
                {
                    return;
                }

                ArmorProto ItProt = (ArmorProto)ArmorProtos[cmbArmorPid.SelectedIndex - 2];
                if (CrProt.Params[Consts.ST_GENDER] == 1)
                {
                    AddCrTypeToCmb(cmbForcedCrType, ItProt.Armor_CrTypeFemale);
                    AddCrTypeToCmb(cmbForcedCrType, ItProt.Armor_CrTypeFemale2);
                    AddCrTypeToCmb(cmbForcedCrType, ItProt.Armor_CrTypeFemale3);
                    AddCrTypeToCmb(cmbForcedCrType, ItProt.Armor_CrTypeFemale4);
                }
                else
                {
                    AddCrTypeToCmb(cmbForcedCrType, ItProt.Armor_CrTypeMale);
                    AddCrTypeToCmb(cmbForcedCrType, ItProt.Armor_CrTypeMale2);
                    AddCrTypeToCmb(cmbForcedCrType, ItProt.Armor_CrTypeMale3);
                    AddCrTypeToCmb(cmbForcedCrType, ItProt.Armor_CrTypeMale4);
                }

                if (CurrentNpc.ForcedCrType == -1 || CurrentNpc.ForcedCrType == 0)
                {
                    cmbForcedCrType.SelectedIndex = 0;
                }
            }
        }
Esempio n. 2
0
 private void AddArmorProtoToCmb(ArmorProto ItProt, ComboBox Cmb)
 {
     Cmb.Items.Add(ItProt.Name + " [" + (!String.IsNullOrEmpty(ItemPid.GetDefineName(ItProt.ProtoId)) ? ItemPid.GetDefineName(ItProt.ProtoId) : ItProt.ProtoId.ToString()) + "]");
 }
 private void AddArmorProtoToCmb(ArmorProto ItProt, ComboBox Cmb)
 {
     Cmb.Items.Add(ItProt.Name + " [" + (!String.IsNullOrEmpty(ItemPid.GetDefineName(ItProt.ProtoId)) ? ItemPid.GetDefineName(ItProt.ProtoId) : ItProt.ProtoId.ToString()) + "]");
 }