/// <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); }
/// <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); }
public Talent Learn(TalentId id, int rank) { var entry = TalentMgr.GetEntry(id); if (entry != null) { return(Learn(entry, rank)); } return(null); }
/// <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); }
public Talent Learn(TalentId id, int rank) { TalentEntry entry = TalentMgr.GetEntry(id); if (entry != null) { return(this.Learn(entry, rank)); } return((Talent)null); }
public bool Remove(TalentId id) { var talent = GetTalent(id); if (talent != null) { talent.Remove(); return(true); } return(false); }
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); } }
public bool Remove(TalentId id) { Talent talent = GetTalent(id); if (talent == null) { return(false); } talent.Remove(); return(true); }
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); }
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; }
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); }
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; }
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); }
/// <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)); }
/// <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)); }
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); }
/// <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)); }
/// <summary> /// Returns the requested TalentEntry /// </summary> public static TalentEntry GetEntry(TalentId talentId) { return Entries[(uint)talentId]; }
/// <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)); }
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); } }
/// <summary>Returns the requested TalentEntry</summary> public static TalentEntry GetEntry(TalentId talentId) { return(Entries[(uint)talentId]); }