예제 #1
0
 public static void PostTopic(int userId, IXForum forumInfo, bool isNeedAnimation)
 {
     if (userId == -1)
     {
         return;
     }
     float[] values = Forums.GetValues(forumInfo.PostcrEdits);
     if (values != null)
     {
         UpdateUserExtCredits(userId, values, false);
     }
     else
     {
         UpdateUserExtCredits(userId, 1, CreditsOperationType.PostTopic, 1, false);
     }
     if (isNeedAnimation)
     {
         WriteUpdateUserExtCreditsCookies((values != null) ? values : Scoresets.GetUserExtCredits(CreditsOperationType.PostTopic));
     }
 }
예제 #2
0
        //public static void PostReply(int userId, IXForum forumInfo, bool isNeedAnimation = false)
        public static void PostReply(int userId, String replyCredits, bool isNeedAnimation = false)
        {
            if (userId == -1)
            {
                return;
            }

            float[] values = Forums.GetValues(replyCredits);
            if (values != null)
            {
                UpdateUserExtCredits(userId, values, false);
            }
            else
            {
                UpdateUserExtCredits(userId, 1, CreditsOperationType.PostReply, 1, false);
            }
            if (isNeedAnimation)
            {
                WriteUpdateUserExtCreditsCookies((values != null) ? values : Scoresets.GetUserExtCredits(CreditsOperationType.PostReply));
            }
        }
예제 #3
0
        public static void DeletePost(Post pi, bool reserveAttach)
        {
            var config = GeneralConfigInfo.Current;

            if (config.Losslessdel == 0 || pi.PostDateTime.AddHours(config.Losslessdel * 24) > DateTime.Now)
            {
                var     type      = (pi.Layer == 0) ? CreditsOperationType.PostTopic : CreditsOperationType.PostReply;
                var     forumInfo = pi.Forum as IXForum;
                float[] array     = Forums.GetValues((type == CreditsOperationType.PostTopic) ? forumInfo.PostcrEdits : forumInfo.ReplycrEdits);
                if (array == null)
                {
                    array = Scoresets.GetUserExtCredits(type);
                }
                UpdateUserExtCredits(pi.PosterID, array, 1, type, -1, true);
                if (!reserveAttach)
                {
                    int att = Attachment.FindCountByPid(pi.ID);
                    if (att != 0)
                    {
                        DeleteAttachments(pi.PosterID, att);
                    }
                }
            }
        }
예제 #4
0
 private static int UpdateUserExtCredits(int uid, int mount, CreditsOperationType creditsOperationType, int pos, bool allowMinus)
 {
     return(UpdateUserExtCredits(uid, Scoresets.GetUserExtCredits(creditsOperationType), mount, creditsOperationType, pos, allowMinus));
 }