コード例 #1
0
 public static void CopyAuctionDB2Item(GoldAuctionDBItem sData, out GoldAuctionItem rData)
 {
     try
     {
         rData = new GoldAuctionItem();
         rData.ProductionTime = sData.ProductionTime;
         rData.AuctionTime    = sData.AuctionTime;
         rData.AuctionSource  = sData.AuctionSource;
         rData.StrGoods       = sData.StrGoods;
         rData.BuyerData      = new AuctionRoleData();
         CopyData.Copy <AuctionRoleData>(sData.BuyerData, ref rData.BuyerData);
         foreach (AuctionRoleData item in sData.RoleList)
         {
             AuctionRoleData temp = new AuctionRoleData();
             CopyData.Copy <AuctionRoleData>(item, ref temp);
             rData.RoleList.Add(temp);
         }
         rData.BossLife       = sData.BossLife;
         rData.KillBossRoleID = sData.KillBossRoleID;
         rData.UpDBWay        = sData.UpDBWay;
         rData.AuctionType    = sData.AuctionType;
         rData.OldAuctionType = sData.OldAuctionType;
         rData.Lock           = false;
     }
     catch (Exception ex)
     {
         rData = null;
         LogManager.WriteLog(LogTypes.Exception, string.Format("[ljl]{0}", ex.ToString()), null, true);
     }
 }
コード例 #2
0
 private void SendMoney(GoldAuctionItem AuctionItem, long averageNum, AuctionConfig AuctionCfg)
 {
     try
     {
         Dictionary <AuctionRoleData, long> sendMsg = new Dictionary <AuctionRoleData, long>();
         if (averageNum >= 1L)
         {
             foreach (AuctionRoleData temp in AuctionItem.RoleList)
             {
                 long num = averageNum;
                 if (AuctionItem.BuyerData.Value > 0L && AuctionItem.BossLife > 0L && temp.Value <= AuctionItem.BossLife)
                 {
                     num += (long)((double)temp.Value / (double)AuctionItem.BossLife * (double)AuctionItem.BuyerData.Value);
                 }
                 sendMsg.Add(temp, num);
             }
             foreach (KeyValuePair <AuctionRoleData, long> temp2 in sendMsg)
             {
                 AuctionRoleData roleData = temp2.Key;
                 int             sendNum  = (int)temp2.Value;
                 try
                 {
                     if (sendNum > 0)
                     {
                         if (!Global.UseMailGivePlayerAward3(roleData.m_RoleID, null, AuctionCfg.SuccessTitle, string.Format(AuctionCfg.SuccessIntro, this.GetItemName(AuctionItem.StrGoods), sendNum), sendNum, 0, 0))
                         {
                             GameManager.logDBCmdMgr.AddMessageLog(-1, "钻石", "邮件发放金团结算失败", roleData.m_RoleName, roleData.m_RoleName, "增加", sendNum, roleData.ZoneID, roleData.strUserID, -1, roleData.ServerId, "");
                             LogManager.WriteLog(LogTypes.Error, string.Format("[ljl]邮件发放金团结算失败 send email roleid={0}, money={1}", roleData.m_RoleID, sendNum), null, true);
                         }
                         else
                         {
                             GameManager.logDBCmdMgr.AddDBLogInfo(-1, "钻石", "邮件发放金团结算", "系统", roleData.m_RoleName, "增加", sendNum, roleData.ZoneID, roleData.strUserID, -1, roleData.ServerId, null);
                         }
                     }
                 }
                 catch (Exception ex)
                 {
                     LogManager.WriteLog(LogTypes.Exception, string.Format("[ljl]发放奖励 send email roleid={0}, money={1}, {2}", roleData.m_RoleID, sendNum, ex.ToString()), null, true);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         LogManager.WriteLog(LogTypes.Exception, string.Format("[ljl]{0}", ex.ToString()), null, true);
     }
 }
コード例 #3
0
 public static void CopyGoldAuctionItem(GoldAuctionItem sData, ref GoldAuctionItem rData)
 {
     try
     {
         rData = new GoldAuctionItem();
         CopyData.Copy <GoldAuctionItem>(sData, ref rData);
         rData.RoleList = new List <AuctionRoleData>();
         foreach (AuctionRoleData item in sData.RoleList)
         {
             AuctionRoleData temp = new AuctionRoleData();
             CopyData.Copy <AuctionRoleData>(item, ref temp);
             rData.RoleList.Add(temp);
         }
     }
     catch (Exception ex)
     {
         rData = null;
         LogManager.WriteLog(LogTypes.Exception, string.Format("[ljl]{0}", ex.ToString()), null, true);
     }
 }
コード例 #4
0
 public int GetMaxmDamageID()
 {
     try
     {
         AuctionRoleData temp = new AuctionRoleData();
         foreach (AuctionRoleData item in this.RoleList)
         {
             if (item.Value > temp.Value)
             {
                 temp = item;
             }
         }
         if (null != temp)
         {
             return(temp.m_RoleID);
         }
     }
     catch
     {
     }
     return(0);
 }
コード例 #5
0
 public void ReturnOldAuctionMoney(AuctionRoleData BuyerData, string StrGoods)
 {
     try
     {
         lock (this.AuctionMutex)
         {
             int addMoney = (int)BuyerData.Value;
             if (!Global.UseMailGivePlayerAward3(BuyerData.m_RoleID, null, "竞拍失败", string.Format("您参与的活动奖励{0},在竞价中被超过,返还您{1}钻石", this.GetItemName(StrGoods), addMoney), addMoney, 0, 0))
             {
                 GameManager.logDBCmdMgr.AddMessageLog(-1, "钻石", "邮件发放金团结算失败", BuyerData.m_RoleName, BuyerData.m_RoleName, "增加", addMoney, BuyerData.ZoneID, BuyerData.strUserID, -1, BuyerData.ServerId, "");
                 LogManager.WriteLog(LogTypes.Error, string.Format("[ljl]邮件发放,有新的竞价者,把钱返回给之前竞价者,失败 send email roleid={0}, money={1}", BuyerData.m_RoleID, addMoney), null, true);
             }
             else
             {
                 GameManager.logDBCmdMgr.AddDBLogInfo(-1, "钻石", "邮件发放金团结算", "系统", BuyerData.m_RoleName, "增加", addMoney, BuyerData.ZoneID, BuyerData.strUserID, -1, BuyerData.ServerId, null);
             }
         }
     }
     catch (Exception ex)
     {
         LogManager.WriteLog(LogTypes.Exception, string.Format("[ljl]{0}", ex.ToString()), null, true);
     }
 }
コード例 #6
0
 public void KillBossAddAuction(int KillBossRole, long BossLife, List <AuctionRoleData> PointInfoList, AuctionEnum AuctionSource)
 {
     try
     {
         lock (this.AuctionMsgMutex)
         {
             AuctionAwardConfig AuctionAwardCfg = GoldAuctionConfigModel.RandAuctionAwardConfig();
             if (null == AuctionAwardCfg)
             {
                 LogManager.WriteLog(LogTypes.Error, "[ljl]KillBossAddAuction RandAuctionAwardConfig null == config", null, true);
             }
             else
             {
                 AuctionConfig AuctionCfg = GoldAuctionConfigModel.GetAuctionConfig((int)AuctionSource);
                 if (null == AuctionCfg)
                 {
                     LogManager.WriteLog(LogTypes.Error, string.Format("[ljl]GoldAuctionConfigModel.GetAuctionConfig({0}) null == config", AuctionSource), null, true);
                 }
                 else
                 {
                     GoldAuctionItem item = new GoldAuctionItem();
                     item.AuctionSource      = (int)AuctionSource;
                     item.KillBossRoleID     = KillBossRole;
                     item.UpDBWay            = 2;
                     item.ProductionTime     = TimeUtil.NowDataTimeString("yyyy-MM-dd HH:mm:ss.fff");
                     item.BuyerData          = new AuctionRoleData();
                     item.BuyerData.m_RoleID = 0;
                     item.BuyerData.Value    = (long)AuctionCfg.OriginPrice;
                     int index = Global.GetRandomNumber(AuctionAwardCfg.StartValues, AuctionAwardCfg.EndValues) - 1;
                     index         = Math.Min(index, AuctionAwardCfg.strGoodsList.Count - 1);
                     item.StrGoods = AuctionAwardCfg.strGoodsList[index];
                     if (null == GlobalNew.ParseGoodsData(AuctionAwardCfg.strGoodsList[index]))
                     {
                         LogManager.WriteLog(LogTypes.Error, string.Format("[ljl]null == item.Goods index={0}  ,  GoodsList.Count = {1}", index, AuctionAwardCfg.strGoodsList.Count), null, true);
                     }
                     else
                     {
                         item.BossLife = 0L;
                         foreach (AuctionRoleData PointInfo in PointInfoList)
                         {
                             item.BossLife += PointInfo.Value;
                             if (PointInfo.Value >= GameManager.systemParamsList.GetParamValueIntByName("AngelTempleAuction", -1))
                             {
                                 AuctionRoleData RoleData = new AuctionRoleData();
                                 CopyData.Copy <AuctionRoleData>(PointInfo, ref RoleData);
                                 item.RoleList.Add(RoleData);
                             }
                         }
                         if (item.BossLife < 1L)
                         {
                             item.BossLife = BossLife;
                         }
                         bool addFlag = false;
                         for (int i = 0; i < AuctionCfg.OrderList.Count; i++)
                         {
                             if (GoldAuctionManager.IsOpenAuction((AuctionOrderEnum)AuctionCfg.OrderList[i]))
                             {
                                 item.AuctionType = AuctionCfg.OrderList[i];
                                 item.LifeTime    = AuctionCfg.TimeList[i];
                                 if (item.AuctionType > 0 && item.AuctionType < 3)
                                 {
                                     if (this.GoldAuctionMgr.SendUpdate2DB(item))
                                     {
                                         this.GoldAuctionMgr.AddNewAuctionItem(item);
                                     }
                                     else
                                     {
                                         LogManager.WriteLog(LogTypes.Error, string.Format("[ljl]新拍卖物品存库失败 未加入 time={0},AuctionSource={1}", item.ProductionTime, AuctionSource), null, true);
                                     }
                                     addFlag = true;
                                     break;
                                 }
                                 LogManager.WriteLog(LogTypes.Error, string.Format("[ljl]AuctionType ={1} err,AuctionSource={0}", AuctionSource, item.AuctionType), null, true);
                             }
                         }
                         if (!addFlag)
                         {
                             int roleID = item.GetMaxmDamageID();
                             this.GoldAuctionMgr.SendItem(roleID, item.RoleList.Find((AuctionRoleData x) => x.m_RoleID == roleID), item, AuctionCfg);
                             LogManager.WriteLog(LogTypes.Info, string.Format("[ljl]新拍卖物品未加入 直接邮件发送给玩家第一名 time={0},AuctionSource={1}", item.ProductionTime, AuctionSource), null, true);
                         }
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         LogManager.WriteLog(LogTypes.Exception, string.Format("[ljl]{0}", ex.ToString()), null, true);
     }
 }
コード例 #7
0
        private void SetGlodAuction(GameClient client, int nID, byte[] bytes, string[] cmdParams, ref int Info)
        {
            GoldAuctionItem item = null;

            Info = 0;
            try
            {
                int      type    = Convert.ToInt32(cmdParams[1]);
                string[] itemKey = cmdParams[2].Split(new char[]
                {
                    '|'
                });
                int Price = Convert.ToInt32(cmdParams[3]);
                if (itemKey == null || itemKey.Length != 2)
                {
                    Info = 3;
                }
                else
                {
                    string ProductionTime = itemKey[0].Replace(',', ':');
                    int    AuctionSource  = Convert.ToInt32(itemKey[1]);
                    if (type == 1 && client.ClientData.Faction < 1)
                    {
                        Info = 1;
                    }
                    AuctionConfig AuctionCfg = GoldAuctionConfigModel.GetAuctionConfig(AuctionSource);
                    if (null == AuctionCfg)
                    {
                        LogManager.WriteLog(LogTypes.Error, string.Format("[ljl]SetGlodAuction ({0}) null == config", AuctionSource), null, true);
                        Info = 4;
                    }
                    else
                    {
                        item = this.GoldAuctionMgr.GetGoldAuctionItem(type, ProductionTime, AuctionSource, true);
                        if (item == null || item.AuctionType != type)
                        {
                            Info = 9;
                        }
                        else if (client.ClientData.RoleID == item.BuyerData.m_RoleID)
                        {
                            Info = 11;
                        }
                        else if (item.BuyerData.m_RoleID == 0 && Price < AuctionCfg.OriginPrice)
                        {
                            Info = 5;
                        }
                        else if (Price < AuctionCfg.UnitPrice)
                        {
                            Info = 6;
                        }
                        else if ((long)Price <= item.BuyerData.Value)
                        {
                            Info = 10;
                        }
                        else if (!GameManager.ClientMgr.SubUserMoney(client, Price, "金团拍卖购买", false, false, false, false, DaiBiSySType.None))
                        {
                            Info = 7;
                        }
                        if (Info != 0)
                        {
                            this.GoldAuctionMgr.UnLock(item.ProductionTime, item.AuctionSource);
                        }
                        else
                        {
                            AuctionRoleData oldBuyerData = new AuctionRoleData();
                            CopyData.Copy <AuctionRoleData>(item.BuyerData, ref oldBuyerData);
                            bool upFlag   = false;
                            int  newBuyer = client.ClientData.RoleID;
                            item.BuyerData.Value      = (long)Price;
                            item.BuyerData.m_RoleID   = client.ClientData.RoleID;
                            item.BuyerData.m_RoleName = client.ClientData.RoleName;
                            item.BuyerData.ZoneID     = client.ClientData.ZoneID;
                            item.BuyerData.strUserID  = client.strUserID;
                            item.BuyerData.ServerId   = client.ServerId;
                            if (Price >= AuctionCfg.MaxPrice && AuctionCfg.MaxPrice > 0)
                            {
                                if (!this.GoldAuctionMgr.DisposeAward(item))
                                {
                                    Info = 8;
                                    LogManager.WriteLog(LogTypes.Error, string.Format("[ljl]一口价 RoleId={0}, Price={1},itemKey={2} fail", newBuyer, Price, cmdParams[1]), null, true);
                                }
                                else
                                {
                                    this.GoldAuctionMgr.DelGoldAuction(item, "金团拍卖购买su");
                                    upFlag = true;
                                }
                            }
                            else if (!this.GoldAuctionMgr.UpdatePrice(item))
                            {
                                Info = 8;
                                LogManager.WriteLog(LogTypes.Error, string.Format("[ljl]更新价格 RoleId={0}, Price={1},itemKey={2} fail", newBuyer, Price, cmdParams[1]), null, true);
                            }
                            else
                            {
                                upFlag = true;
                            }
                            if (upFlag)
                            {
                                this.GoldAuctionMgr.ReturnOldAuctionMoney(oldBuyerData, item.StrGoods);
                            }
                            else
                            {
                                this.GoldAuctionMgr.UnLock(item.ProductionTime, item.AuctionSource);
                                GameManager.logDBCmdMgr.AddMessageLog(-1, "钻石", "金团购买失败扣除钻石", client.ClientData.RoleName, client.ClientData.RoleName, "减少", Price, client.ClientData.ZoneID, client.strUserID, -1, client.ServerId, "");
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                if (null != item)
                {
                    this.GoldAuctionMgr.UnLock(item.ProductionTime, item.AuctionSource);
                }
                Info = 100;
                LogManager.WriteLog(LogTypes.Exception, string.Format("[ljl]{0}", ex.ToString()), null, true);
            }
        }
コード例 #8
0
 public void SendItem(int roleID, AuctionRoleData roleData, GoldAuctionItem AuctionItem, AuctionConfig AuctionCfg)
 {
     lock (this.AuctionMutex)
     {
         try
         {
             if (roleID <= 0)
             {
                 LogManager.WriteLog(LogTypes.Error, string.Format("[ljl]SendItem roleid=0,ProductionTime={0},AuctionSource={1}", AuctionItem.ProductionTime, AuctionItem.AuctionSource), null, true);
             }
             else
             {
                 List <GoodsData> goodsData = new List <GoodsData>();
                 GoodsData        goods     = GlobalNew.ParseGoodsData(AuctionItem.StrGoods);
                 if (null == goods)
                 {
                     LogManager.WriteLog(LogTypes.Error, string.Format("[ljl]SendItem null == goods,ProductionTime={0},AuctionSource={1}", AuctionItem.ProductionTime, AuctionItem.AuctionSource), null, true);
                 }
                 else
                 {
                     goodsData.Add(goods);
                     string ItemName = this.GetItemName(AuctionItem.StrGoods);
                     if (null == roleData)
                     {
                         roleData = new AuctionRoleData();
                         GameClient client = GameManager.ClientMgr.FindClient(roleID);
                         if (client != null)
                         {
                             roleData.m_RoleID   = roleID;
                             roleData.strUserID  = client.strUserID;
                             roleData.m_RoleName = client.ClientData.RoleName;
                             roleData.ZoneID     = client.ClientData.ZoneID;
                             roleData.ServerId   = client.ServerId;
                         }
                     }
                     string strTitle;
                     string strIntro;
                     if (roleID == AuctionItem.BuyerData.m_RoleID)
                     {
                         strTitle = "购买成功";
                         strIntro = "在金团拍卖购买成功";
                     }
                     else
                     {
                         strTitle = AuctionCfg.FailTitle;
                         strIntro = string.Format(AuctionCfg.FailIntro, ItemName);
                     }
                     if (!Global.UseMailGivePlayerAward3(roleID, goodsData, strTitle, strIntro, 0, 0, 0))
                     {
                         GameManager.logDBCmdMgr.AddMessageLog(-1, ItemName, "邮件发放金团结算失败", roleData.m_RoleName, roleData.m_RoleName, "增加", goods.GCount, roleData.ZoneID, roleData.strUserID, -1, roleData.ServerId, AuctionItem.StrGoods);
                         LogManager.WriteLog(LogTypes.Error, string.Format("[ljl]SendItem 邮件发放金团结算失败 roleid={0}, item = {1}", roleID, AuctionItem.StrGoods), null, true);
                     }
                     else
                     {
                         GameManager.logDBCmdMgr.AddDBLogInfo(-1, ItemName, "邮件发放金团结算", "系统", roleData.m_RoleName, "增加", goods.GCount, roleData.ZoneID, roleData.strUserID, -1, roleData.ServerId, null);
                     }
                 }
             }
         }
         catch (Exception ex)
         {
             LogManager.WriteLog(LogTypes.Exception, string.Format("[ljl]SendItem send email roleid={0}, item = {1}", roleID, AuctionItem.StrGoods, ex.ToString()), null, true);
         }
     }
 }