예제 #1
0
        public static void ProcessConfirmation(uint contextId, bool response)
        {
            if (confirmations.Remove <uint, Confirmation>(contextId, out var confirmationToProcess))
            {
                Player newMember = WorldManager.GetPlayerByGuidId(confirmationToProcess.Target);
                Player player    = WorldManager.GetPlayerByGuidId(confirmationToProcess.Initiator);
                switch (confirmationToProcess.ConfirmationType)
                {
                case Network.Enum.ConfirmationType.Fellowship:
                    player.CompleteConfirmation(confirmationToProcess.ConfirmationType, confirmationToProcess.ConfirmationID);
                    player.Fellowship.AddConfirmedMember(player, newMember, response);
                    break;

                case Network.Enum.ConfirmationType.SwearAllegiance:
                    break;

                default:
                    break;
                }
            }
        }
예제 #2
0
        /// <summary>
        /// Removes a spell from the enchantment registry, and
        /// sends the relevant network messages for spell removal
        /// </summary>
        public void Remove(BiotaPropertiesEnchantmentRegistry entry, bool sound = true)
        {
            var spellID = entry.SpellId;
            var spell   = DatabaseManager.World.GetCachedSpell((uint)spellID);

            if (WorldObject.Biota.TryRemoveEnchantment(spellID, out _, WorldObject.BiotaDatabaseLock))
            {
                WorldObject.ChangesDetected = true;
            }

            if (Player != null)
            {
                Player.Session.Network.EnqueueSend(new GameEventMagicRemoveEnchantment(Player.Session, (ushort)entry.SpellId, entry.LayerId));

                if (sound)
                {
                    Player.Session.Network.EnqueueSend(new GameMessageSound(Player.Guid, Sound.SpellExpire, 1.0f));
                }
            }
            else
            {
                var ownerID = WorldObject.OwnerId ?? WorldObject.WielderId;

                if (ownerID != null)
                {
                    var owner = WorldManager.GetPlayerByGuidId((uint)ownerID);

                    if (owner != null)
                    {
                        owner.Session.Network.EnqueueSend(new GameMessageSystemChat($"The spell {spell.Name} on {WorldObject.Name} has expired.", ChatMessageType.Magic));

                        if (sound)
                        {
                            owner.Session.Network.EnqueueSend(new GameMessageSound(owner.Guid, Sound.SpellExpire, 1.0f));
                        }
                    }
                }
            }
        }
예제 #3
0
        /// <summary>
        /// Called when a player joins/exits an Allegiance
        /// </summary>
        public static void Rebuild(Allegiance allegiance)
        {
            if (allegiance == null)
            {
                return;
            }

            RemoveCache(allegiance);

            // rebuild allegiance
            var refresh = GetAllegiance(allegiance.Monarch.Player);

            // relink players
            foreach (var member in allegiance.Members.Keys)
            {
                var player = WorldManager.GetPlayerByGuidId(member.Guid.Full);
                if (player == null)
                {
                    continue;
                }

                LoadPlayer(player);
            }
        }