示例#1
0
文件: Bonus.cs 项目: xiongeee/BBX
        public static void CloseBonus(TopicInfo topicinfo, int userid, int[] postIdArray, int[] winerIdArray, string[] winnerNameArray, string[] costBonusArray, string[] valuableAnswerArray, int bestAnswer)
        {
            int isbest = 0;

            topicinfo.Special = 3;
            Topics.UpdateTopic(topicinfo);
            for (int i = 0; i < winerIdArray.Length; i++)
            {
                int num = TypeConverter.StrToInt(costBonusArray[i]);
                if (winerIdArray[i] > 0 && num > 0)
                {
                    Users.UpdateUserExtCredits(winerIdArray[i], Scoresets.GetBonusCreditsTrans(), (float)num);
                }
                if (Utils.InArray(postIdArray[i].ToString(), valuableAnswerArray))
                {
                    isbest = 1;
                }
                if (postIdArray[i] == bestAnswer)
                {
                    isbest = 2;
                }
                BBX.Data.Bonus.AddLog(topicinfo.Tid, topicinfo.Posterid, winerIdArray[i], winnerNameArray[i], postIdArray[i], num, Scoresets.GetBonusCreditsTrans(), isbest);
            }
        }
示例#2
0
        public static Int32 SetMagicValue(Int32 magic, MagicType magicType, Int32 newmagicvalue)
        {
            string[] array = Utils.SplitString(magic.ToString(), "");
            switch (magicType)
            {
            case MagicType.HtmlTitle:
                if (array.Length >= 2)
                {
                    array[1] = newmagicvalue.ToString().Substring(0, 1);
                    return(String.Join("", array).ToInt(magic));
                }
                return(String.Format("1{0}", newmagicvalue.ToString().Substring(0, 1)).ToInt(magic));

            case MagicType.MagicTopic:
                if (array.Length >= 5)
                {
                    string[] array2 = Utils.SplitString(newmagicvalue.ToString().PadLeft(3, '0'), "");
                    array[2] = array2[0];
                    array[3] = array2[1];
                    array[4] = array2[2];
                    return(String.Join("", array).ToInt(magic));
                }
                return(String.Format("1{0}{1}", Topics.GetMagicValue(magic, MagicType.HtmlTitle), newmagicvalue.ToString().PadLeft(3, '0').Substring(0, 3)).ToInt(magic));

            case MagicType.TopicTag:
                if (array.Length >= 6)
                {
                    array[5] = newmagicvalue.ToString().Substring(0, 1);
                    return(String.Join("", array).ToInt(magic));
                }
                return(String.Format("1{0}{1}{2}", Topics.GetMagicValue(magic, MagicType.HtmlTitle), Topics.GetMagicValue(magic, MagicType.MagicTopic).ToString("000"), newmagicvalue.ToString().Substring(0, 1)).ToInt(magic));

            default:
                return(magic);
            }
        }
示例#3
0
 private static void LoadTopTopicListExtraInfo(Int32 topicTypePrefix, List <Topic> list)
 {
     Topics.LoadTopTopicListExtraInfo(topicTypePrefix, 600, 0, list);
 }