Пример #1
0
 public void BackSpace(SpellListItem spell)
 {
     while (spellList.Remove(spell))
     {
         Debug.Log("Removing " + spell.strSpell);
     }
     UpdateDisplay();
 }
Пример #2
0
    public void AddSpellToList(string spellId)
    {
        Debug.Log("AddSpellToList " + spellId);
        SpellListItem spellListItem = CreateSpellListItem();

        spellListItem.SetParent(this);
        spellListItem.SetSpell(spellId);
        scrollViewContent.sizeDelta = scrollViewContent.sizeDelta + new Vector2(0, 250);
    }
        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);
        }
    public void RemoveSpell(SpellListItem spell)
    {
        GameObject spellToBeRemoved;

        if (newSpellBtns.TryGetValue(spell.strSpell, out spellToBeRemoved))
        {
            newSpellBtns.Remove(spell.strSpell);
            GameObjectUtility.CustomDestroy(spellToBeRemoved);
            BackSpace(spell);
        }
        else
        {
            Debug.Log("No spell removed");
        }
    }
 public void AddSpell(SpellListItem spell)
 {
     Debug.Log("Adding Spell: " + user.heroName + " :" + spell.strSpell);
     displayPanel.AddSpell(spell);
 }
 private void BackSpace(SpellListItem spell)
 {
     Debug.Log("BackSpace: " + spell.strSpell);
     displayPanel.BackSpace(spell);
 }
Пример #7
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);
        }
Пример #8
0
 public void AddSpell(SpellListItem spell)
 {
     spellList.Add(spell);
     UpdateDisplay();
 }