DjumHoRDe | Дата: Четвер, 16.12.2010, 14:09 | Сообщение # 1 |
Скаут
Группа: Пользователи
|
Исправления опыта в журнале боя . Quote Index: Chat/ChatMgr.cs =================================================================== --- Chat/ChatMgr.cs (revision 849) +++ Chat/ChatMgr.cs (working copy) @@ -589,7 +589,21 @@ } } + /// <summary> + /// Sends the amount of experience gained to the characters combat log. + /// </summary> + /// <param name="target">the character to receieve the combat log message</param> + /// <param name="message">the message to display in the characters combat log</param> + public static void SendCombatLogExperienceMessage(IPacketReceiver target, string message) + { + using (var packet = CreateCharChatMessage(ChatMsgType.CombatXPGain, ChatLanguage.Universal, EntityId.Zero, EntityId.Zero, null, message, ChatTag.None)) + { + target.Send(packet); + } + } + + /// <summary> /// Sends a whisper from one player to another. /// </summary> /// <param name="sender">the sender of the whisper</param> Index: Entities/Character.cs =================================================================== --- Entities/Character.cs (revision 849) +++ Entities/Character.cs (working copy) @@ -556,6 +556,35 @@ { this.SayYellEmote(ChatMsgType.Emote, SpokenLanguage, msg); } + + /// <summary> + /// Sends the amount of experience gained to the characters combat log. + /// </summary> + /// <param name="enemy">The enemy that the character just killed.</param> + /// <param name="experience">The amount of experience gained from it.</param> + public void SendCombatLogExperience(Unit enemy, int experience) + { + if (enemy == null) + { + return; + } + + // Generate the message to send + string message = string.Format("{0} dies, you gain {1} experience.", enemy.Name, experience); + string bonusMessage; + + // Check for any rest Xp + var bonus = Math.Min(RestXp, experience); + + if (bonus > 0) + { + bonusMessage = string.Format(" (+{0} exp Rested bonus)", bonus); + message = string.Concat(message, bonusMessage); + } + + // Send the message + ChatMgr.SendCombatLogExperienceMessage(this, message); + } #endregion public void Send(RealmPacketOut packet) Index: Entities/NPC.cs =================================================================== --- Entities/NPC.cs (revision 849) +++ Entities/NPC.cs (working copy) @@ -862,8 +862,9 @@ // TODO: Consider reductions if someone else killed the mob var chr = (Character)looter; var baseXp = m_region.XpCalculator(looter.Level, this); + chr.SendCombatLogExperience(this, baseXp); XpGenerator.XpDistributer(chr, baseXp); - chr.QuestLog.OnNPCKilled(this); + chr.QuestLog.OnNPCKilled(this); } if (m_currentTamer != null)
|
|
|
|