예제 #1
0
        /// <summary>
        /// Returns the current rank that this player has of this talent
        /// </summary>
        public Talent GetTalent(TalentId id)
        {
            Talent talent;

            ById.TryGetValue(id, out talent);
            return(talent);
        }
예제 #2
0
        /// <summary>
        /// Whether the given talent can be learned by this Character
        /// </summary>
        public bool CanLearn(TalentId id, int rank)
        {
            TalentEntry entry = TalentMgr.GetEntry(id);

            if (entry != null)
            {
                return(CanLearn(entry, rank));
            }
            return(false);
        }
예제 #3
0
        public Talent Learn(TalentId id, int rank)
        {
            var entry = TalentMgr.GetEntry(id);

            if (entry != null)
            {
                return(Learn(entry, rank));
            }
            return(null);
        }
예제 #4
0
        /// <summary>
        /// Returns the current rank that this player has of this talent
        /// </summary>
        public int GetRank(TalentId id)
        {
            Talent talent;

            if (ById.TryGetValue(id, out talent))
            {
                return(talent.Rank);
            }
            return(-1);
        }
예제 #5
0
        public Talent Learn(TalentId id, int rank)
        {
            TalentEntry entry = TalentMgr.GetEntry(id);

            if (entry != null)
            {
                return(this.Learn(entry, rank));
            }
            return((Talent)null);
        }
예제 #6
0
        public bool Remove(TalentId id)
        {
            var talent = GetTalent(id);

            if (talent != null)
            {
                talent.Remove();
                return(true);
            }
            return(false);
        }
예제 #7
0
        private void SendLearnTalentPacket(TalentId id, int rank)
        {
            using (var packet = new RealmPacketOut(RealmServerOpCode.CMSG_PET_LEARN_TALENT))
            {
                packet.Write(Cat.EntityId);
                packet.Write((uint)id);
                packet.Write(rank - 1);

                Master.FakeClient.ReceiveCMSG(packet, true, true);
            }
        }
예제 #8
0
        public bool Remove(TalentId id)
        {
            Talent talent = GetTalent(id);

            if (talent == null)
            {
                return(false);
            }
            talent.Remove();
            return(true);
        }
예제 #9
0
        public static void HandleLearnTalent(IRealmClient client, RealmPacketIn packet)
        {
            TalentId         id      = (TalentId)packet.ReadUInt32();
            int              rank    = packet.ReadInt32();
            TalentCollection talents = client.ActiveCharacter.Talents;

            if (talents.Learn(id, rank) == null)
            {
                return;
            }
            TalentHandler.SendTalentGroupList(talents);
        }
예제 #10
0
        public uint GetExp(TalentId talent)
        {
            if (!this.ExpList.ContainsKey(talent))
                return 0;

            uint exp = 0;

            foreach (var skill in this.ExpList[talent])
                exp += skill.Value;

            return exp;
        }
예제 #11
0
        public static void HandleSaveTalentGroup(IRealmClient client, RealmPacketIn packet)
        {
            int num = packet.ReadInt32();
            TalentCollection talents = client.ActiveCharacter.Talents;

            for (int index = 0; index < num; ++index)
            {
                TalentId id   = (TalentId)packet.ReadUInt32();
                int      rank = packet.ReadInt32();
                talents.Learn(id, rank);
            }

            TalentHandler.SendTalentGroupList(talents);
        }
예제 #12
0
		public static ITalentRecord NewTalentRecord(SpecProfile profile, int talentGroupId, TalentId talentId, int rank)
		{
			var newRecord = new TalentRecord()
			{
				SpecProfile = profile,
				TalentGroupId = talentGroupId,
				TalentId = talentId,
				Rank = rank
			};

			// TODO: Only save in DB-queue context!
			//newRecord.CreateAndFlush();

			return newRecord;
		}
예제 #13
0
        public static void HandlePetLearnTalent(IRealmClient client, RealmPacketIn packet)
        {
            EntityId  id1             = packet.ReadEntityId();
            Character activeCharacter = client.ActiveCharacter;
            NPC       npc             = activeCharacter.Map.GetObject(id1) as NPC;

            if (npc == null || !npc.IsAlive || npc != activeCharacter.ActivePet)
            {
                return;
            }
            TalentCollection talents = npc.Talents;
            TalentId         id2     = (TalentId)packet.ReadUInt32();
            int rank = packet.ReadInt32();

            talents.Learn(id2, rank);
            TalentHandler.SendTalentGroupList(talents);
        }
예제 #14
0
 /// <summary>
 /// Whether this Owner has a certain Talent.
 /// </summary>
 /// <param name="id">The TalentId of the Talent</param>
 /// <returns>True if the Owner has the specified Talent</returns>
 public bool HasTalent(TalentId id)
 {
     return(ById.ContainsKey(id));
 }
예제 #15
0
        /// <summary>
        /// Sets the given talent to the given rank without any checks.
        /// Make sure that the given TalentId is valid for this Character's class.
        /// </summary>
        public Talent Set(TalentId id, int rank)
        {
            var entry = TalentMgr.GetEntry(id);

            return(Set(entry, rank));
        }
예제 #16
0
        public TalentLevel GetTalentLevel(TalentId talent)
        {
            var exp = this.GetExp(talent) / 1000;

            if (exp < 1) return TalentLevel.None;
            else if (exp < 11) return TalentLevel.Fledgling;
            else if (exp < 36) return TalentLevel.Novice;
            else if (exp < 76) return TalentLevel.Amateur;
            else if (exp < 136) return TalentLevel.Green;
            else if (exp < 216) return TalentLevel.Naive;
            else if (exp < 316) return TalentLevel.Apprentice;
            else if (exp < 436) return TalentLevel.Senior;
            else if (exp < 576) return TalentLevel.Advanced;
            else if (exp < 736) return TalentLevel.Seasoned;
            else if (exp < 926) return TalentLevel.Skilled;
            else if (exp < 1146) return TalentLevel.Expert;
            else if (exp < 1396) return TalentLevel.Great;
            else if (exp < 1696) return TalentLevel.Champion;
            else if (exp < 2046) return TalentLevel.Wise;

            return (this.Grandmaster == talent ? TalentLevel.Grandmaster : TalentLevel.Master);
        }
예제 #17
0
        /// <summary>
        /// Whether the given talent can be learned by this Character
        /// </summary>
        public bool CanLearn(TalentId id, int rank)
        {
            var talent = TalentMgr.GetEntry(id);

            return(talent != null && CanLearn(talent, rank));
        }
예제 #18
0
파일: TalentMgr.cs 프로젝트: pallmall/WCell
		/// <summary>
		/// Returns the requested TalentEntry
		/// </summary>
		public static TalentEntry GetEntry(TalentId talentId)
		{
			return Entries[(uint)talentId];
		}
예제 #19
0
 /// <summary>
 /// Sets the given talent to the given rank without any checks.
 /// Make sure that the given TalentId is valid for this Character's class.
 /// </summary>
 public Talent Set(TalentId id, int rank)
 {
     return(Set(TalentMgr.GetEntry(id), rank));
 }
예제 #20
0
파일: PetTests.cs 프로젝트: pallmall/WCell
        private void SendLearnTalentPacket(TalentId id, int rank)
        {
            using(var packet = new RealmPacketOut(RealmServerOpCode.CMSG_PET_LEARN_TALENT))
            {
                packet.Write(Cat.EntityId);
                packet.Write((uint)id);
                packet.Write(rank - 1);

                Master.FakeClient.ReceiveCMSG(packet, true, true);
            }
        }
예제 #21
0
 /// <summary>Returns the requested TalentEntry</summary>
 public static TalentEntry GetEntry(TalentId talentId)
 {
     return(Entries[(uint)talentId]);
 }