コード例 #1
0
        public int HandleAdmireStatue(GameClient client, int toCoupleId, int admireType)
        {
            int       toDay       = TimeUtil.MakeYearMonthDay(TimeUtil.NowDateTime());
            MoBaiData MoBaiConfig = null;
            int       result;

            if (!Data.MoBaiDataInfoList.TryGetValue(2, out MoBaiConfig))
            {
                result = -3;
            }
            else if (client.ClientData.ChangeLifeCount < MoBaiConfig.MinZhuanSheng || (client.ClientData.ChangeLifeCount == MoBaiConfig.MinZhuanSheng && client.ClientData.Level < MoBaiConfig.MinLevel))
            {
                result = -19;
            }
            else
            {
                int maxAdmireNum   = MoBaiConfig.AdrationMaxLimit;
                int hadAdmireCount = this.GetAdmireCount(client, toDay);
                if (this._Statue != null && this._Statue.IsDivorced != 1 && this._Statue.DbCoupleId > 0 && (client.ClientData.RoleID == this._Statue.Man.RoleId || client.ClientData.RoleID == this._Statue.Wife.RoleId))
                {
                    maxAdmireNum += MoBaiConfig.ExtraNumber;
                }
                int   nVIPLev        = client.ClientData.VipLevel;
                int[] nArrayVIPAdded = GameManager.systemParamsList.GetParamValueIntArrayByName("VIPMoBaiNum", ',');
                if (nVIPLev > VIPEumValue.VIPENUMVALUE_MAXLEVEL || nArrayVIPAdded.Length < 1)
                {
                    result = -3;
                }
                else
                {
                    maxAdmireNum += nArrayVIPAdded[nVIPLev];
                    double awardmuti = 0.0;
                    JieRiMultAwardActivity activity = HuodongCachingMgr.GetJieRiMultAwardActivity();
                    if (null != activity)
                    {
                        JieRiMultConfig config = activity.GetConfig(12);
                        if (null != config)
                        {
                            awardmuti += config.GetMult();
                        }
                    }
                    SpecPriorityActivity spAct = HuodongCachingMgr.GetSpecPriorityActivity();
                    if (null != spAct)
                    {
                        awardmuti += spAct.GetMult(SpecPActivityBuffType.SPABT_Admire);
                    }
                    awardmuti    = Math.Max(1.0, awardmuti);
                    maxAdmireNum = (int)((double)maxAdmireNum * awardmuti);
                    if (hadAdmireCount >= maxAdmireNum)
                    {
                        result = -16;
                    }
                    else if (admireType == 1 && Global.GetTotalBindTongQianAndTongQianVal(client) < MoBaiConfig.NeedJinBi)
                    {
                        result = -9;
                    }
                    else if (admireType == 2 && client.ClientData.UserMoney < MoBaiConfig.NeedZuanShi)
                    {
                        result = -10;
                    }
                    else
                    {
                        int    ec    = TianTiClient.getInstance().CoupleWishAdmire(client.ClientData.RoleID, client.ClientData.ZoneID, admireType, toCoupleId);
                        double nRate = (client.ClientData.ChangeLifeCount == 0) ? 1.0 : Data.ChangeLifeEverydayExpRate[client.ClientData.ChangeLifeCount];
                        if (admireType == 1)
                        {
                            Global.SubBindTongQianAndTongQian(client, MoBaiConfig.NeedJinBi, "膜拜情侣祝福");
                            long nExp = (long)(nRate * (double)MoBaiConfig.JinBiExpAward);
                            if (nExp > 0L)
                            {
                                GameManager.ClientMgr.ProcessRoleExperience(client, nExp, true, true, false, "none");
                            }
                            if (MoBaiConfig.JinBiZhanGongAward > 0)
                            {
                                GameManager.ClientMgr.AddBangGong(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, ref MoBaiConfig.JinBiZhanGongAward, AddBangGongTypes.CoupleWishMoBai, 0);
                            }
                            if (MoBaiConfig.LingJingAwardByJinBi > 0)
                            {
                                GameManager.ClientMgr.ModifyMUMoHeValue(client, MoBaiConfig.LingJingAwardByJinBi, "膜拜情侣祝福", true, true, false);
                            }
                        }
                        if (admireType == 2)
                        {
                            GameManager.ClientMgr.SubUserMoney(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, MoBaiConfig.NeedZuanShi, "膜拜情侣祝福", true, true, false, DaiBiSySType.None);
                            int nExp2 = (int)(nRate * (double)MoBaiConfig.ZuanShiExpAward);
                            if (nExp2 > 0)
                            {
                                GameManager.ClientMgr.ProcessRoleExperience(client, (long)nExp2, true, true, false, "none");
                            }
                            if (MoBaiConfig.ZuanShiZhanGongAward > 0)
                            {
                                GameManager.ClientMgr.AddBangGong(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, ref MoBaiConfig.ZuanShiZhanGongAward, AddBangGongTypes.CoupleWishMoBai, 0);
                            }
                            if (MoBaiConfig.LingJingAwardByZuanShi > 0)
                            {
                                GameManager.ClientMgr.ModifyMUMoHeValue(client, MoBaiConfig.LingJingAwardByZuanShi, "膜拜情侣祝福", true, true, false);
                            }
                        }
                        this.AddAdmireCount(client, toDay, toCoupleId, 1);
                        if (this._Statue != null && this._Statue.DbCoupleId > 0 && this._Statue.DbCoupleId == toCoupleId)
                        {
                            this._Statue.BeAdmireCount++;
                        }
                        result = 1;
                    }
                }
            }
            return(result);
        }
コード例 #2
0
        /// <summary>
        /// 膜拜雕像
        /// </summary>
        /// <param name="client"></param>
        /// <param name="toCoupleId"></param>
        /// <param name="admireType"></param>
        /// <returns></returns>
        public int HandleAdmireStatue(GameClient client, int toCoupleId, int admireType)
        {
            int       toDay       = TimeUtil.MakeYearMonthDay(TimeUtil.NowDateTime());
            string    strcmd      = "";
            MoBaiData MoBaiConfig = null;

            if (!Data.MoBaiDataInfoList.TryGetValue((int)MoBaiTypes.CoupleWish, out MoBaiConfig))
            {
                return(StdErrorCode.Error_Config_Fault);
            }

            if (client.ClientData.ChangeLifeCount < MoBaiConfig.MinZhuanSheng ||
                (client.ClientData.ChangeLifeCount == MoBaiConfig.MinZhuanSheng && client.ClientData.Level < MoBaiConfig.MinLevel))
            {
                return(StdErrorCode.Error_Level_Limit);
            }

//             不管有没有雕像都可以膜拜
//             if (this._Statue == null || this._Statue.DbCoupleId != toCoupleId
//                 || this._Statue.ManRoleDataEx == null || this._Statue.WifeRoleDataEx == null)
//                 return StdErrorCode.Error_Operation_Denied;

            int maxAdmireNum   = MoBaiConfig.AdrationMaxLimit;
            int hadAdmireCount = GetAdmireCount(client, toDay);

            if (this._Statue != null && this._Statue.IsDivorced != 1 && this._Statue.DbCoupleId > 0 &&
                (client.ClientData.RoleID == this._Statue.Man.RoleId || client.ClientData.RoleID == this._Statue.Wife.RoleId))
            {
                // 玩家未离婚,且是雕像情侣有额外次数
                maxAdmireNum += MoBaiConfig.ExtraNumber;
            }

            // 玩家是VIP 有额外的次数
            int nVIPLev = client.ClientData.VipLevel;

            int[] nArrayVIPAdded = GameManager.systemParamsList.GetParamValueIntArrayByName("VIPMoBaiNum");
            if (nVIPLev > (int)VIPEumValue.VIPENUMVALUE_MAXLEVEL || (nArrayVIPAdded.Length > 13 || nArrayVIPAdded.Length < 1))
            {
                return(StdErrorCode.Error_Config_Fault);
            }
            maxAdmireNum += nArrayVIPAdded[nVIPLev];

            // 节日活动多倍
            JieRiMultAwardActivity activity = HuodongCachingMgr.GetJieRiMultAwardActivity();
            JieRiMultConfig        config   = activity != null?activity.GetConfig((int)MultActivityType.DiaoXiangCount) : null;

            if (null != config)
            {
                maxAdmireNum = maxAdmireNum * ((int)config.GetMult() + 1) /*做倍数处理的时候减了1*/;
            }

            // 膜拜次数达到上限
            if (hadAdmireCount >= maxAdmireNum)
            {
                return(StdErrorCode.Error_No_Residue_Degree);
            }

            // 金币膜拜
            if (admireType == 1 && Global.GetTotalBindTongQianAndTongQianVal(client) < MoBaiConfig.NeedJinBi)
            {
                return(StdErrorCode.Error_JinBi_Not_Enough);
            }

            // 钻石膜拜
            if (admireType == 2 && client.ClientData.UserMoney < MoBaiConfig.NeedZuanShi)
            {
                return(StdErrorCode.Error_ZuanShi_Not_Enough);
            }

            int ec = TianTiClient.getInstance().CoupleWishAdmire(client.ClientData.RoleID, client.ClientData.ZoneID, admireType, toCoupleId);
            //if (ec < 0) return ec;

            double nRate = client.ClientData.ChangeLifeCount == 0 ? 1 : Data.ChangeLifeEverydayExpRate[client.ClientData.ChangeLifeCount];

            if (admireType == 1)
            {
                Global.SubBindTongQianAndTongQian(client, MoBaiConfig.NeedJinBi, "膜拜情侣祝福");

                // 配置值*转生倍率
                int nExp = (int)(nRate * MoBaiConfig.JinBiExpAward);
                if (nExp > 0)
                {
                    GameManager.ClientMgr.ProcessRoleExperience(client, nExp, true);
                }

                // 战功
                if (MoBaiConfig.JinBiZhanGongAward > 0)
                {
                    GameManager.ClientMgr.AddBangGong(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool,
                                                      client, ref MoBaiConfig.JinBiZhanGongAward, AddBangGongTypes.CoupleWishMoBai);
                }

                if (MoBaiConfig.LingJingAwardByJinBi > 0)
                {
                    GameManager.ClientMgr.ModifyMUMoHeValue(client, MoBaiConfig.LingJingAwardByJinBi, "膜拜情侣祝福", true, true);
                }
            }

            if (admireType == 2)
            {
                GameManager.ClientMgr.SubUserMoney(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool,
                                                   client, MoBaiConfig.NeedZuanShi, "膜拜情侣祝福");

                // 配置值*转生倍率
                int nExp = (int)(nRate * MoBaiConfig.ZuanShiExpAward);
                if (nExp > 0)
                {
                    GameManager.ClientMgr.ProcessRoleExperience(client, nExp, true);
                }

                // 战功
                if (MoBaiConfig.ZuanShiZhanGongAward > 0)
                {
                    GameManager.ClientMgr.AddBangGong(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool,
                                                      client, ref MoBaiConfig.ZuanShiZhanGongAward, AddBangGongTypes.CoupleWishMoBai);
                }

                if (MoBaiConfig.LingJingAwardByZuanShi > 0)
                {
                    GameManager.ClientMgr.ModifyMUMoHeValue(client, MoBaiConfig.LingJingAwardByZuanShi, "膜拜情侣祝福", true, true);
                }
            }

            AddAdmireCount(client, toDay, toCoupleId);
            if (this._Statue != null && this._Statue.DbCoupleId > 0 && this._Statue.DbCoupleId == toCoupleId)
            {
                this._Statue.BeAdmireCount++; // 先手工临时加1次,让本服膜拜的人立即看到, 等一会会自动从中心同步过来
            }
            return(StdErrorCode.Error_Success);
        }