Beispiel #1
0
        private static void SupplicateForRecall(PlayerInstance ch, string argument)
        {
            var oldfavor = ch.PlayerData.Favor;

            if (CheckFunctions.CheckIfTrue(ch, ch.PlayerData.Favor < ch.PlayerData.CurrentDeity.SupplicateRecallCost,
                                           "Your favor is inadequate for such a supplication."))
            {
                return;
            }
            if (CheckFunctions.CheckIfSet(ch, ch.CurrentRoom.Flags, RoomFlags.NoSupplicate, "You have been forsaken!"))
            {
                return;
            }
            if (CheckFunctions.CheckIfTrue(ch, ch.HasTimer(TimerTypes.RecentFight) && !ch.IsImmortal(),
                                           "You cannot supplicate recall under adrenaline!"))
            {
                return;
            }

            RoomTemplate location = null;

            if (!ch.IsNpc() && ch.PlayerData.Clan != null)
            {
                location = RepositoryManager.Instance.ROOMS.Get(ch.PlayerData.Clan.RecallRoom);
            }

            if (!ch.IsNpc() && location == null && ch.Level >= 5 && ch.PlayerData.Flags.IsSet(PCFlags.Deadly))
            {
                location = RepositoryManager.Instance.ROOMS.Get(VnumConstants.ROOM_VNUM_DEADLY);
            }

            if (location == null)
            {
                var raceRecallRoom = RepositoryManager.Instance.RACES.Get(ch.CurrentRace.GetValue()).RaceRecallRoom;
                location = RepositoryManager.Instance.ROOMS.Get(raceRecallRoom);
            }

            if (location == null)
            {
                location = RepositoryManager.Instance.ROOMS.Get(VnumConstants.ROOM_VNUM_TEMPLE);
            }

            if (CheckFunctions.CheckIfNullObject(ch, location, "You are completely lost."))
            {
                return;
            }

            comm.act(ATTypes.AT_MAGIC, "$n disappears in a column of divine power.", ch, null, null, ToTypes.Room);

            var oldRoom = ch.CurrentRoom;

            oldRoom.RemoveFrom(ch);
            location.AddTo(ch);

            if (ch.CurrentMount != null)
            {
                oldRoom.RemoveFrom(ch.CurrentMount);
                location.AddTo(ch.CurrentMount);
            }

            comm.act(ATTypes.AT_MAGIC, "$n appears in the room from a column of divine power.", ch, null, null, ToTypes.Room);

            Look.do_look(ch, "auto");
            ch.PlayerData.Favor -= ch.PlayerData.CurrentDeity.SupplicateRecallCost;

            if (ch.PlayerData.Favor < ch.PlayerData.CurrentDeity.SusceptNum)
            {
                ch.Susceptibility.SetBit(ch.PlayerData.CurrentDeity.Suscept);
            }

            if ((oldfavor > ch.PlayerData.CurrentDeity.AffectedNum &&
                 ch.PlayerData.Favor <= ch.PlayerData.CurrentDeity.AffectedNum) ||
                (oldfavor > ch.PlayerData.CurrentDeity.ElementNum &&
                 ch.PlayerData.Favor <= ch.PlayerData.CurrentDeity.ElementNum) ||
                (oldfavor < ch.PlayerData.CurrentDeity.SusceptNum &&
                 ch.PlayerData.Favor >= ch.PlayerData.CurrentDeity.SusceptNum))
            {
                ch.update_aris();
            }
        }