Example #1
0
        public void ProcessOptOut(Player player, byte optOutType)
        {
            if (!Players.ContainsKey(player.CharacterId))
            {
                Players.Add(player.CharacterId, new ContributionInfo(player));
            }

            ContributionInfo contrib = Players[player.CharacterId];

            if (contrib.OptOutType == optOutType)
            {
                return;
            }

            contrib.OptOutType = optOutType;

            if (optOutType == 0)
            {
                player.SendLocalizeString(Info.Name, ChatLogFilters.CHATLOGFILTERS_SAY, Localized_text.TEXT_PUBLIC_QUEST_OPT_OUT_DISABLE);
            }
            else
            {
                player.SendLocalizeString(Info.Name, ChatLogFilters.CHATLOGFILTERS_SAY, Localized_text.TEXT_PUBLIC_QUEST_OPT_OUT_ENABLE);
            }

            PacketOut Out = new PacketOut((byte)Opcodes.F_OBJECTIVE_UPDATE);

            Out.WriteUInt32(Info.Entry);
            Out.WriteByte(8);
            Out.WriteByte(optOutType);
            Out.WriteUInt16(0);
            player.SendPacket(Out);
        }
Example #2
0
        /// <summary>
        /// When a player is healed, grants delayed contribution to the healing player if there is damage from a PQ mob yet to be healed through.
        /// </summary>
        /// <param name="target">The healed player.</param>
        /// <param name="healer">The healing player.</param>
        /// <param name="healCount">The amount healed.</param>
        public void NotifyPlayerHealed(Player target, Player healer, uint healCount)
        {
            if (!Players.ContainsKey(target.CharacterId))
            {
                Players.Add(target.CharacterId, new ContributionInfo(target));
            }

            if (!Players.ContainsKey(healer.CharacterId))
            {
                Players.Add(healer.CharacterId, new ContributionInfo(healer));
            }

            ContributionInfo targetInfo = Players[target.CharacterId];

            if (targetInfo.HealingDamagePool > 0)
            {
                if (healCount > targetInfo.HealingDamagePool)
                {
                    healCount -= targetInfo.HealingDamagePool;
                    targetInfo.HealingDamagePool = 0;
                    SplitContribution(healer, (ushort)targetInfo.HealingContribPool);
                    healer.SendClientMessage("Received " + targetInfo.HealingContribPool + " contribution from emptying the target's healing contribution pool.", ChatLogFilters.CHATLOGFILTERS_QUEST, true);
                    targetInfo.HealingContribPool = 0;
                }

                else
                {
                    float contribFactor = (float)healCount / targetInfo.HealingDamagePool;
                    SplitContribution(healer, (ushort)(targetInfo.HealingContribPool * contribFactor));
                    healer.SendClientMessage("Received " + (uint)(targetInfo.HealingContribPool * contribFactor) + " contribution from the target's healing contribution pool.", ChatLogFilters.CHATLOGFILTERS_QUEST, true);
                    targetInfo.HealingContribPool = (uint)(targetInfo.HealingContribPool * (1f - contribFactor));
                    return;
                }
            }

            foreach (ushort objectId in targetInfo.DamageTakenFrom.Keys)
            {
                ContributionInfo.HitInfo hitInfo = targetInfo.DamageTakenFrom[objectId];

                if (hitInfo.DamageTaken == 0)
                {
                    continue;
                }

                uint deltaHeal;

                if (healCount > hitInfo.DamageTaken)
                {
                    deltaHeal           = hitInfo.DamageTaken;
                    hitInfo.DamageTaken = 0;
                    healCount          -= deltaHeal;
                }

                else
                {
                    deltaHeal            = healCount;
                    hitInfo.DamageTaken -= healCount;
                }

                AddTrackedHeal(objectId, healer.CharacterId, deltaHeal);

                if (healCount == 0)
                {
                    break;
                }
            }
        }