Exemplo n.º 1
0
 private void Add()
 {
     if (comboBoxAddEntites.SelectedValue.ToString() == eventsTypes)
     {
         EventTypeServices.Add(999999,
                               textBoxAddNameEntites.Text);
         DownloadAdd();
     }
     if (comboBoxAddEntites.SelectedValue.ToString() == footbollers)
     {
         FootballerServices.Add(999999,
                                textBoxAddNameEntites.Text);
         DownloadAdd();
     }
     if (comboBoxAddEntites.SelectedValue.ToString() == teamsTypes)
     {
         TeamTypeServices.Add(999999,
                              textBoxAddNameEntites.Text);
         DownloadAdd();
     }
     if (comboBoxAddEntites.SelectedValue.ToString() == trainers)
     {
         TrainerServices.Add(999999,
                             textBoxAddNameEntites.Text);
         DownloadAdd();
     }
     if (comboBoxAddEntites.SelectedValue.ToString() == positions)
     {
         PositionServices.Add(999999,
                              textBoxAddNameEntites.Text);
         DownloadAdd();
     }
 }
        public static void SendSpellList(this Creature c, Player p)
        {
            HashSet <SpellListItem> spells = new HashSet <SpellListItem>();

            foreach (var vendorspell in c.Template.VendorSpells.Values)
            {
                TrainerServices status = TrainerServices.TRAINER_SERVICE_AVAILABLE;
                Spell           spell;

                if (!DBC.Spell.TryGetValue(vendorspell.SpellId, out spell)) //Only use those with spells
                {
                    continue;
                }

                if (p.Spells.ContainsKey(vendorspell.SpellId))
                {
                    status = TrainerServices.TRAINER_SERVICE_USED;
                }
                else if (!p.CanPurchaseSpell(vendorspell))
                {
                    status = TrainerServices.TRAINER_SERVICE_UNAVAILABLE;
                }

                //Check existence
                //Check spell chain

                SpellListItem ti = new SpellListItem
                {
                    SpellId           = vendorspell.SpellId,
                    Status            = (byte)status,
                    Cost              = vendorspell.Cost,
                    SkillPoints       = (byte)vendorspell.SpellPointCost,
                    RequiredLevel     = (byte)vendorspell.RequiredLevel,
                    RequiredSkillLine = vendorspell.RequiredSkill,
                    RequiredSkillRank = vendorspell.RequiredSkillValue,
                    RequiredSkillStep = 0,
                    RequiredAbility   = new uint[] { 0, 0, 0 }
                };
                spells.Add(ti);
            }

            PacketWriter pk = new PacketWriter(Opcodes.SMSG_TRAINER_LIST);

            pk.WriteUInt64(c.Guid);
            pk.WriteUInt32(c.Template.TrainerType); //Type
            pk.WriteUInt32((uint)spells.Count);     //Spell count
            foreach (SpellListItem spell in spells)
            {
                spell.BuildPacket(ref pk);
            }

            p.Client.Send(pk);
        }
Exemplo n.º 3
0
 private void Delete()
 {
     if (comboBoxDownload.SelectedValue.ToString() == events)
     {
         EventServices.Delete(Convert.ToInt32(comboBoxDeleteByID.SelectedValue));
         DownloadDelete();
     }
     if (comboBoxDownload.SelectedValue.ToString() == eventsTypes)
     {
         EventTypeServices.Delete(Convert.ToInt32(comboBoxDeleteByID.SelectedValue));
         DownloadDelete();
     }
     if (comboBoxDownload.SelectedValue.ToString() == footbollers)
     {
         FootballerServices.Delete(Convert.ToInt32(comboBoxDeleteByID.SelectedValue));
         DownloadDelete();
     }
     if (comboBoxDownload.SelectedValue.ToString() == footbollersTeams)
     {
         FootballerTeamServices.Delete(Convert.ToInt32(comboBoxDeleteByID.SelectedValue));
         DownloadDelete();
     }
     if (comboBoxDownload.SelectedValue.ToString() == positions)
     {
         PositionServices.Delete(Convert.ToInt32(comboBoxDeleteByID.SelectedValue));
         DownloadDelete();
     }
     if (comboBoxDownload.SelectedValue.ToString() == teams)
     {
         TeamServices.Delete(Convert.ToInt32(comboBoxDeleteByID.SelectedValue));
         DownloadDelete();
     }
     if (comboBoxDownload.SelectedValue.ToString() == teamsTypes)
     {
         TeamTypeServices.Delete(Convert.ToInt32(comboBoxDeleteByID.SelectedValue));
         DownloadDelete();
     }
     if (comboBoxDownload.SelectedValue.ToString() == trainers)
     {
         TrainerServices.Delete(Convert.ToInt32(comboBoxDeleteByID.SelectedValue));
         DownloadDelete();
     }
 }
Exemplo n.º 4
0
        private void Change()
        {
            if (comboBoxDownload.SelectedValue.ToString() == eventsTypes)
            {
                EventTypeServices.Update(
                    Convert.ToInt32(comboBoxChangeEntityID.SelectedValue),
                    textBoxChangeEntityName.Text);
                DownloadChange();
            }
            if (comboBoxDownload.SelectedValue.ToString() == footbollers)
            {
                FootballerServices.Update(
                    Convert.ToInt32(comboBoxChangeEntityID.SelectedValue),
                    textBoxChangeEntityName.Text);
                DownloadChange();
            }

            if (comboBoxDownload.SelectedValue.ToString() == teams)
            {
                TeamServices.Update(
                    Convert.ToInt32(comboBoxTeamID.SelectedValue.ToString()),
                    textBoxChangeTeamName.Text,
                    Convert.ToInt32(comboBoxChangeTeamTypeForTeam.SelectedValue.ToString())
                    );
                DownloadChange();
            }
            if (comboBoxDownload.SelectedValue.ToString() == trainers)
            {
                TrainerServices.Update(
                    Convert.ToInt32(comboBoxChangeEntityID.SelectedValue),
                    textBoxChangeEntityName.Text);
                DownloadChange();
            }
            if (comboBoxDownload.SelectedValue.ToString() == positions)
            {
                PositionServices.Update(
                    Convert.ToInt32(comboBoxChangeEntityID.SelectedValue),
                    textBoxChangeEntityName.Text);
                DownloadChange();
            }
        }
Exemplo n.º 5
0
        public static void SendTalentList(this Player p)
        {
            HashSet <int>           nextTalent = new HashSet <int>();
            HashSet <SpellListItem> talents    = new HashSet <SpellListItem>();

            foreach (SkillLineAbility ability in DBC.SkillLineAbility.Values)
            {
                TrainerServices status    = TrainerServices.TRAINER_SERVICE_AVAILABLE;
                SkillLine       skillline = DBC.SkillLine[ability.m_skillLine];
                if (skillline.m_skillType != TALENT_SKILL_ID)
                {
                    continue;
                }

                Spell spell = null;
                if (!DBC.Spell.TryGetValue((uint)ability.m_spell, out spell)) //Only use those with spells
                {
                    continue;
                }

                if (p.Talents.Contains(ability.m_ID)) //Already have ability
                {
                    if (ability.m_supercededBySpell > 0)
                    {
                        nextTalent.Add(ability.m_supercededBySpell); //Store next as possibly available
                    }
                    status = TrainerServices.TRAINER_SERVICE_USED;
                }
                else
                {
                    if (nextTalent.Contains(ability.m_spell))
                    {
                        status = TrainerServices.TRAINER_SERVICE_AVAILABLE; //Definitely available as in superceed list
                    }
                    else if (spell.iRank == 1)
                    {
                        status = TrainerServices.TRAINER_SERVICE_AVAILABLE; //Definitely available as Rank 1
                    }
                    else
                    {
                        status = TrainerServices.TRAINER_SERVICE_UNAVAILABLE; //Probably not available as fallen through
                    }
                }

                SpellListItem ti = new SpellListItem();
                ti.SpellId           = (uint)ability.m_spell;
                ti.Status            = (byte)status;
                ti.TalentPoints      = 10;
                ti.RequiredLevel     = (byte)spell.baseLevel;
                ti.RequiredSkillLine = 0;
                ti.RequiredSkillRank = 0;
                ti.RequiredSkillStep = 0;
                ti.RequiredAbility   = new uint[] { 0, 0, 0 };
                talents.Add(ti);
            }

            PacketWriter pk = new PacketWriter(Opcodes.SMSG_TRAINER_LIST);

            pk.WriteUInt64(p.Guid);
            pk.WriteUInt32((uint)TrainerTypes.TRAINER_TYPE_TALENTS); //Type
            pk.WriteUInt32((uint)talents.Count);                     //Spell count
            foreach (SpellListItem spell in talents)
            {
                spell.BuildPacket(ref pk);
            }

            p.Client.Send(pk);
        }
Exemplo n.º 6
0
 public static void Print(RichTextBox richTextBox)
 {
     richTextBox.Text = TrainerServices.Download();
 }