Ejemplo n.º 1
0
        private static List <int> MuiltchargeGetBindmoney(int addMoney, int nPlatfromID, string[] binddatalist, CFirstChargeMgr.ChargeType eChargeType, SingleChargeData chargeData)
        {
            List <int> templist = new List <int>();

            switch (eChargeType)
            {
            case CFirstChargeMgr.ChargeType.YingYongBao:
            {
                List <int> typelist = chargeData.singleData.Keys.ToList <int>();
                typelist.Sort();
                int tempmoney = 0;
                int i         = typelist.Count - 1;
                while (i >= 0)
                {
                    if (typelist[i] <= addMoney)
                    {
                        if (typelist[i] != chargeData.YueKaMoney || chargeData.ChargePlatType == 1)
                        {
                            if (!CFirstChargeMgr.HasGetFirstbindMoney(typelist[i], binddatalist))
                            {
                                if (tempmoney + typelist[i] <= addMoney)
                                {
                                    templist.Add(typelist[i]);
                                    tempmoney += typelist[i];
                                }
                            }
                        }
                    }
IL_CB:
                    i--;
                    continue;
                    goto IL_CB;
                }
                break;
            }

            case CFirstChargeMgr.ChargeType.GangAoTai:
            {
                List <int> typelist = chargeData.singleData.Keys.ToList <int>();
                typelist.Sort();
                for (int i = typelist.Count - 1; i >= 0; i--)
                {
                    if (typelist[i] <= addMoney)
                    {
                        if (chargeData.YueKaBangZuan == 1 || typelist[i] != chargeData.YueKaMoney)
                        {
                            if (!CFirstChargeMgr.HasGetFirstbindMoney(typelist[i], binddatalist))
                            {
                                templist.Add(typelist[i]);
                                break;
                            }
                        }
                    }
                }
                break;
            }

            default:
            {
                int nValue = 0;
                chargeData.singleData.TryGetValue(addMoney, out nValue);
                if (nValue > 0)
                {
                    if (chargeData.YueKaBangZuan == 1 || addMoney != chargeData.YueKaMoney || chargeData.ChargePlatType == 1)
                    {
                        if (!CFirstChargeMgr.HasGetFirstbindMoney(addMoney, binddatalist))
                        {
                            templist.Add(addMoney);
                        }
                    }
                }
                break;
            }
            }
            return(templist);
        }
Ejemplo n.º 2
0
 public static void SendToRolebindgold(DBManager dbMgr, string uid, int rid, int addMoney, SingleChargeData chargeData)
 {
     if (chargeData == null)
     {
         LogManager.WriteException(string.Concat(new object[]
         {
             "送绑钻失败,配置表信息为空 uid=",
             uid,
             " money=",
             addMoney
         }));
     }
     else
     {
         string data        = CFirstChargeMgr.GetFirstChargeInfo(dbMgr, uid);
         string strPlat     = (uid.Length >= 4) ? uid.Substring(0, 4) : "";
         int    nPlatformID = 1;
         if (strPlat == "APPS")
         {
             nPlatformID = 2;
         }
         CFirstChargeMgr.ChargeType type = CFirstChargeMgr.ChargeType.Normal;
         string strYYB = (uid.Length >= 3) ? uid.Substring(0, 3) : "";
         if (strYYB == "YYB")
         {
             type = CFirstChargeMgr.ChargeType.YingYongBao;
         }
         else if (strYYB == "GAT" || strYYB == "430")
         {
             type = CFirstChargeMgr.ChargeType.GangAoTai;
         }
         string[] datalist = null;
         if (!string.IsNullOrEmpty(data))
         {
             datalist = data.Split(new char[]
             {
                 ','
             });
         }
         List <int> listAddMoney = CFirstChargeMgr.MuiltchargeGetBindmoney(addMoney, nPlatformID, datalist, type, chargeData);
         if (listAddMoney != null)
         {
             for (int i = 0; i < listAddMoney.Count; i++)
             {
                 if (!string.IsNullOrEmpty(data))
                 {
                     data = data + "," + listAddMoney[i];
                 }
                 else
                 {
                     data = string.Concat(listAddMoney[i]);
                 }
             }
             if (!CFirstChargeMgr.UpdateFirstCharge(dbMgr, uid, data, 0))
             {
                 LogManager.WriteException(string.Concat(new object[]
                 {
                     "送绑钻失败,保存数据库失败 uid=",
                     uid,
                     " money=",
                     addMoney
                 }));
             }
             else
             {
                 for (int i = 0; i < listAddMoney.Count; i++)
                 {
                     int    bindMoney = chargeData.singleData[listAddMoney[i]];
                     string gmCmdData = string.Format("-updateBindgold {0} {1} {2} {3}", new object[]
                     {
                         uid,
                         rid,
                         bindMoney,
                         data
                     });
                     ChatMsgManager.AddGMCmdChatMsg(-1, gmCmdData);
                 }
             }
         }
     }
 }