コード例 #1
0
ファイル: Book.cs プロジェクト: shagar-zharla/ACE
        public bool DeletePage(uint pageId, Player player)
        {
            var pages = Biota.GetBookAllPages(Guid.Full, BiotaDatabaseLock);

            var page = Biota.GetBookPageData(Guid.Full, pageId, BiotaDatabaseLock);

            if (page == null || (!page.IgnoreAuthor && player.Guid.Full != page.AuthorId && !(player is Sentinel) && !(player is Admin)))
            {
                return(false);
            }

            var success = Biota.DeleteBookPage(pageId, out var entity, BiotaDatabaseLock);

            if (!success)
            {
                return(false);
            }

            if (pageId < pages.Count - 1)
            {
                // handle deleting page from middle of book
                for (var i = pageId + 1; i < pages.Count; i++)
                {
                    var page2 = Biota.GetBookPageData(Guid.Full, i, BiotaDatabaseLock);
                    page2.PageId--;
                }
            }
            SetProperty(PropertyInt.AppraisalPages, pages.Count - 1);
            ChangesDetected = true;

            return(true);
        }
コード例 #2
0
        public bool DeletePage(uint pageId)
        {
            var pages = Biota.GetBookAllPages(Guid.Full, BiotaDatabaseLock);

            var success = Biota.DeleteBookPage(pageId, out var entity, BiotaDatabaseLock);

            if (!success)
            {
                return(false);
            }

            if (pageId < pages.Count - 1)
            {
                // handle deleting page from middle of book
                for (var i = pageId + 1; i < pages.Count; i++)
                {
                    var page = Biota.GetBookPageData(Guid.Full, i, BiotaDatabaseLock);
                    page.PageId--;
                }
            }
            SetProperty(PropertyInt.AppraisalPages, pages.Count - 1);
            ChangesDetected = true;

            return(true);
        }
コード例 #3
0
        public bool ModifyPage(uint pageId, string pageText)
        {
            var page = Biota.GetBookPageData(Guid.Full, pageId, BiotaDatabaseLock);

            if (page == null || page.PageText.Equals(pageText))
            {
                return(false);
            }

            page.PageText   = pageText;
            ChangesDetected = true;

            return(true);
        }
コード例 #4
0
ファイル: Book.cs プロジェクト: shagar-zharla/ACE
        public bool ModifyPage(uint pageId, string pageText, Player player)
        {
            var page = Biota.GetBookPageData(Guid.Full, pageId, BiotaDatabaseLock);

            if (page == null || page.PageText.Equals(pageText))
            {
                return(false);
            }

            if (page.IgnoreAuthor || (player.Guid.Full == page.AuthorId && player.Name == page.AuthorName && player.Account.AccountName == page.AuthorAccount) || player is Sentinel || player is Admin)
            {
                page.AuthorAccount = player.Account.AccountName;
                page.AuthorId      = player.Guid.Full;
                page.AuthorName    = player.Name;
                page.PageText      = pageText;
                ChangesDetected    = true;
            }
            else
            {
                return(false);
            }

            return(true);
        }
コード例 #5
0
ファイル: Book.cs プロジェクト: shagar-zharla/ACE
        public BiotaPropertiesBookPageData GetPage(uint pageId)
        {
            var page = Biota.GetBookPageData(Guid.Full, pageId, BiotaDatabaseLock);

            return(page);
        }