コード例 #1
0
 public void SendMarryPartyList(GameClient client, MarryPartyData partyData, int roleID = -1)
 {
     if (partyData != null || roleID > 0)
     {
         if (partyData == null)
         {
             partyData = this.m_MarryPartyDataCache.GetParty(roleID);
             if (partyData == null)
             {
                 int SpouseID = MarryLogic.GetSpouseID(roleID);
                 partyData = this.m_MarryPartyDataCache.GetParty(SpouseID);
                 if (partyData == null)
                 {
                     partyData = new MarryPartyData();
                 }
             }
         }
         client.sendCmd <Dictionary <int, MarryPartyData> >(880, new Dictionary <int, MarryPartyData>
         {
             {
                 roleID,
                 partyData
             }
         }, false);
     }
     else
     {
         client.sendCmd(this.m_MarryPartyDataCache.GetPartyList(TCPOutPacketPool.getInstance(), 880), true);
     }
 }
コード例 #2
0
ファイル: MarryOtherLogic.cs プロジェクト: chenchungit/ky
        public bool CanAddMarriageGoodWill(GameClient client)
        {
            //功能未开启
            if (!MarryLogic.IsVersionSystemOpenOfMarriage())
            {
                return(false);
            }

            //看看是不是情侣
            if (client.ClientData.MyMarriageData.byMarrytype == -1)
            {
                return(false);
            }

            sbyte tmpGoodwilllv   = client.ClientData.MyMarriageData.byGoodwilllevel;
            sbyte tmpGoodwillstar = client.ClientData.MyMarriageData.byGoodwillstar;

            //加值前先检查当前阶级是否已达上限 到达上限不加
            if (tmpGoodwilllv == byMaxGoodwillLv &&
                tmpGoodwillstar == byMaxGoodwillStar)
            {
                return(false);
            }

            return(true);
        }
コード例 #3
0
 public void SendSpouseDataToClient(GameClient client)
 {
     try
     {
         if (-1 != client.ClientData.MyMarriageData.nSpouseID)
         {
             MarriageData_EX myMarriageData_EX = new MarriageData_EX();
             GameClient      Spouseclient      = GameManager.ClientMgr.FindClient(client.ClientData.MyMarriageData.nSpouseID);
             if (null != Spouseclient)
             {
                 myMarriageData_EX.myMarriageData = Spouseclient.ClientData.MyMarriageData;
                 myMarriageData_EX.roleName       = Spouseclient.ClientData.RoleName;
                 myMarriageData_EX.Occupation     = Spouseclient.ClientData.OccupationList[0];
                 client.sendCmd <MarriageData_EX>(896, myMarriageData_EX, false);
             }
             else
             {
                 RoleDataEx roleDataEx = MarryLogic.GetOfflineRoleData(client.ClientData.MyMarriageData.nSpouseID);
                 if (roleDataEx != null)
                 {
                     myMarriageData_EX.roleName       = roleDataEx.RoleName;
                     myMarriageData_EX.Occupation     = roleDataEx.OccupationList[0];
                     myMarriageData_EX.myMarriageData = roleDataEx.MyMarriageData;
                     client.sendCmd <MarriageData_EX>(896, myMarriageData_EX, false);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         DataHelper.WriteFormatExceptionLog(ex, "SendSpouseDataToClient", false, false);
     }
 }
コード例 #4
0
ファイル: MarryPartyLogic.cs プロジェクト: chenchungit/ky
        // TODO: client should send spouse id
        // 发送婚宴信息
        public void SendMarryPartyList(GameClient client, MarryPartyData partyData, int roleID = -1)
        {
            Dictionary <int, MarryPartyData> marryPartyList;

            if (partyData != null || roleID > 0)
            {
                if (partyData == null)
                {
                    // 获取指定角色婚宴数据
                    partyData = m_MarryPartyDataCache.GetParty(roleID);
                    if (partyData == null)
                    {
                        int SpouseID = MarryLogic.GetSpouseID(roleID);
                        partyData = m_MarryPartyDataCache.GetParty(SpouseID);
                        if (partyData == null)
                        {
                            // 返回空代表通知客戶端自己沒有婚宴
                            partyData = new MarryPartyData();
                        }
                    }
                }

                marryPartyList = new Dictionary <int, MarryPartyData>();
                marryPartyList.Add(roleID, partyData);

                client.sendCmd <Dictionary <int, MarryPartyData> >((int)TCPGameServerCmds.CMD_SPR_MARRY_PARTY_QUERY, marryPartyList);
            }
            else
            {
                // 获取全部婚宴列表
                client.sendCmd(m_MarryPartyDataCache.GetPartyList(TCPOutPacketPool.getInstance(), (int)TCPGameServerCmds.CMD_SPR_MARRY_PARTY_QUERY));
            }
        }
コード例 #5
0
 public void UpdateRingAttr(GameClient client, bool bNeedUpdateSpouse = false, bool bIsLogin = false)
 {
     if (MarryLogic.IsVersionSystemOpenOfMarriage())
     {
         if (-1 != client.ClientData.MyMarriageData.nRingID)
         {
             if (-1 != client.ClientData.MyMarriageData.byMarrytype && -1 != client.ClientData.MyMarriageData.nSpouseID)
             {
                 GameClient   Spouseclient = GameManager.ClientMgr.FindClient(client.ClientData.MyMarriageData.nSpouseID);
                 MarriageData SpouseMarriageData;
                 if (null != Spouseclient)
                 {
                     SpouseMarriageData = Spouseclient.ClientData.MyMarriageData;
                 }
                 else
                 {
                     string tcpstring = string.Format("{0}", client.ClientData.MyMarriageData.nSpouseID);
                     SpouseMarriageData = Global.sendToDB <MarriageData, string>(10186, tcpstring, client.ServerId);
                 }
                 if (SpouseMarriageData != null && -1 != SpouseMarriageData.nRingID)
                 {
                     EquipPropItem myringitem        = GameManager.EquipPropsMgr.FindEquipPropItem(client.ClientData.MyMarriageData.nRingID);
                     EquipPropItem tmpmyringitem     = new EquipPropItem();
                     EquipPropItem spouseringitem    = GameManager.EquipPropsMgr.FindEquipPropItem(SpouseMarriageData.nRingID);
                     EquipPropItem tmpspouseringitem = new EquipPropItem();
                     for (int i = 0; i < tmpmyringitem.ExtProps.Length; i++)
                     {
                         tmpmyringitem.ExtProps[i]     = this.RingAttrJiSuan(client.ClientData.MyMarriageData.byGoodwilllevel, client.ClientData.MyMarriageData.byGoodwillstar, myringitem.ExtProps[i]);
                         tmpspouseringitem.ExtProps[i] = this.RingAttrJiSuan(SpouseMarriageData.byGoodwilllevel, SpouseMarriageData.byGoodwillstar, spouseringitem.ExtProps[i]);
                         tmpmyringitem.ExtProps[i]    += tmpspouseringitem.ExtProps[i] * this.dOtherRingmodulus;
                     }
                     client.ClientData.PropsCacheManager.SetExtProps(new object[]
                     {
                         PropsSystemTypes.MarriageRing,
                         tmpmyringitem.ExtProps
                     });
                     if (!bIsLogin)
                     {
                         GameManager.ClientMgr.NotifyUpdateEquipProps(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client);
                         GameManager.ClientMgr.NotifyOthersLifeChanged(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client, true, false, 7);
                     }
                     if (bNeedUpdateSpouse)
                     {
                         if (null != Spouseclient)
                         {
                             this.UpdateRingAttr(Spouseclient, false, false);
                         }
                     }
                 }
             }
         }
     }
 }
コード例 #6
0
        public static TCPProcessCmdResults ProcessMarryInit(TCPManager tcpMgr, TMSKSocket socket, TCPClientPool tcpClientPool, TCPRandKey tcpRandKey, TCPOutPacketPool pool, int nID, byte[] data, int count, out TCPOutPacket tcpOutPacket)
        {
            string cmdData = null;

            try
            {
                cmdData = new UTF8Encoding().GetString(data, 0, count);
            }
            catch (Exception)
            {
                LogManager.WriteLog(LogTypes.Error, string.Format("解析指令字符串错误, CMD={0}, Client={1}", (TCPGameServerCmds)nID, Global.GetSocketRemoteEndPoint(socket, false)), null, true);
                tcpOutPacket = TCPOutPacket.MakeTCPOutPacket(pool, "", nID);
                return(TCPProcessCmdResults.RESULT_FAILED);
            }
            try
            {
                string[] fields = cmdData.Split(new char[]
                {
                    ':'
                });
                if (fields.Length != 2)
                {
                    LogManager.WriteLog(LogTypes.Error, string.Format("指令参数个数错误, CMD={0}, Client={1}, Recv={2}", (TCPGameServerCmds)nID, Global.GetSocketRemoteEndPoint(socket, false), fields.Length), null, true);
                    tcpOutPacket = TCPOutPacket.MakeTCPOutPacket(pool, "", nID);
                    return(TCPProcessCmdResults.RESULT_FAILED);
                }
                int        roleID   = Convert.ToInt32(fields[0]);
                int        spouseID = Convert.ToInt32(fields[1]);
                GameClient client   = GameManager.ClientMgr.FindClient(socket);
                if (KuaFuManager.getInstance().ClientCmdCheckFaild(nID, client, ref roleID))
                {
                    LogManager.WriteLog(LogTypes.Error, string.Format("根据RoleID定位GameClient对象失败, CMD={0}, Client={1}, RoleID={2}", (TCPGameServerCmds)nID, Global.GetSocketRemoteEndPoint(socket, false), roleID), null, true);
                    tcpOutPacket = TCPOutPacket.MakeTCPOutPacket(pool, "", nID);
                    return(TCPProcessCmdResults.RESULT_FAILED);
                }
                if (client.ClientSocket.IsKuaFuLogin)
                {
                    client.sendCmd(nID, string.Format("{0}:{1}:{2}", -12, roleID, spouseID), false);
                    tcpOutPacket = null;
                    return(TCPProcessCmdResults.RESULT_OK);
                }
                MarryResult result = MarryLogic.MarryInit(client, spouseID);
                string      strcmd = string.Format("{0}:{1}:{2}", (int)result, roleID, spouseID);
                tcpOutPacket = TCPOutPacket.MakeTCPOutPacket(pool, strcmd, nID);
                return(TCPProcessCmdResults.RESULT_DATA);
            }
            catch (Exception ex)
            {
                DataHelper.WriteFormatExceptionLog(ex, Global.GetDebugHelperInfo(socket), false, false);
            }
            tcpOutPacket = TCPOutPacket.MakeTCPOutPacket(pool, "", nID);
            return(TCPProcessCmdResults.RESULT_FAILED);
        }
コード例 #7
0
        public static bool IsMarried(int roleID)
        {
            RoleDataEx roleDataEx = MarryLogic.GetOfflineRoleData(roleID);

            if (roleDataEx != null && roleDataEx.MyMarriageData != null)
            {
                if (roleDataEx.MyMarriageData.byMarrytype != -1)
                {
                    return(true);
                }
            }
            return(false);
        }
コード例 #8
0
        public static void showdown()
        {
            ZhanMengShiJianManager.getInstance().showdown();
            JingJiChangManager.getInstance().showdown();
            LiXianBaiTanManager.getInstance().showdown();
            LiXianGuaJiManager.getInstance().showdown();
            CmdRegisterTriggerManager.getInstance().showdown();
            SendCmdManager.getInstance().showdown();
            BossAIManager.getInstance().showdown();
            SaleManager.getInstance().showdown();
            LianZhiManager.GetInstance().showdown();
            ChengJiuManager.GetInstance().showdown();
            PrestigeMedalManager.getInstance().showdown();
            UnionPalaceManager.getInstance().showdown();
            UserActivateManager.getInstance().showdown();
            PetSkillManager.getInstance().showdown();
            UserReturnManager.getInstance().showdown();
            OlympicsManager.getInstance().showdown();
            TalentManager.getInstance().showdown();
            TodayManager.getInstance().showdown();
            FundManager.getInstance().showdown();
            WarnManager.getInstance().showdown();
            BuildingManager.getInstance().showdown();
            OnePieceManager.getInstance().showdown();
            MarryLogic.ApplyShutdownClear();
            TenManager.getInstance().showdown();
            SingletonTemplate <SevenDayActivityMgr> .Instance().showdown();

            SingletonTemplate <SoulStoneManager> .Instance().showdown();

            lock (GlobalServiceManager.Scene2ManagerDict)
            {
                foreach (List <IManager> list in GlobalServiceManager.Scene2ManagerDict.Values)
                {
                    foreach (IManager i in list)
                    {
                        try
                        {
                            i.showdown();
                        }
                        catch (Exception ex)
                        {
                            LogManager.WriteException(ex.ToString());
                        }
                    }
                }
            }
            FaceBookManager.getInstance().showdown();
        }
コード例 #9
0
 public static void ApplyShutdownClear()
 {
     lock (MarryLogic.MarryApplyList)
     {
         foreach (KeyValuePair <int, MarryApplyData> it in MarryLogic.MarryApplyList)
         {
             MarryApplyData applyData = it.Value;
             if (applyData.ApplyExpireTime > 0L)
             {
                 MarryLogic.ApplyReturnMoney(it.Key, applyData, null);
             }
         }
         MarryLogic.MarryApplyList.Clear();
     }
 }
コード例 #10
0
 public static void ApplyLogoutClear(GameClient client)
 {
     lock (MarryLogic.MarryApplyList)
     {
         MarryApplyData applyData;
         if (MarryLogic.MarryApplyList.TryGetValue(client.ClientData.RoleID, out applyData))
         {
             if (applyData.ApplyExpireTime > 0L)
             {
                 MarryLogic.ApplyReturnMoney(0, applyData, client);
                 applyData.ApplyExpireTime = 0L;
             }
         }
     }
 }
コード例 #11
0
ファイル: MarryPartyLogic.cs プロジェクト: chenchungit/ky
        public MarryPartyResult MarryPartyCancel(GameClient client)
        {
            if (!MarryLogic.IsVersionSystemOpenOfMarriage())
            {
                return(MarryPartyResult.NotOpen);
            }

            MarryPartyData partyData = m_MarryPartyDataCache.GetParty(client.ClientData.MyMarriageData.nSpouseID);

            if (partyData != null)
            {
                return(MarryPartyResult.NotOriginator);
            }

            return(MarryPartyRemove(client.ClientData.RoleID, false, client));
        }
コード例 #12
0
        public bool CanAddMarriageGoodWill(GameClient client)
        {
            bool result;

            if (!MarryLogic.IsVersionSystemOpenOfMarriage())
            {
                result = false;
            }
            else if (client.ClientData.MyMarriageData.byMarrytype == -1)
            {
                result = false;
            }
            else
            {
                sbyte tmpGoodwilllv   = client.ClientData.MyMarriageData.byGoodwilllevel;
                sbyte tmpGoodwillstar = client.ClientData.MyMarriageData.byGoodwillstar;
                result = (tmpGoodwilllv != this.byMaxGoodwillLv || tmpGoodwillstar != this.byMaxGoodwillStar);
            }
            return(result);
        }
コード例 #13
0
        public MarryPartyResult MarryPartyCancel(GameClient client)
        {
            MarryPartyResult result;

            if (!MarryLogic.IsVersionSystemOpenOfMarriage())
            {
                result = MarryPartyResult.NotOpen;
            }
            else
            {
                MarryPartyData partyData = this.m_MarryPartyDataCache.GetParty(client.ClientData.MyMarriageData.nSpouseID);
                if (partyData != null)
                {
                    result = MarryPartyResult.NotOriginator;
                }
                else
                {
                    result = this.MarryPartyRemove(client.ClientData.RoleID, false, client);
                }
            }
            return(result);
        }
コード例 #14
0
 public static void ApplyPeriodicClear(long ticks)
 {
     if (ticks >= MarryLogic.NextPeriodicCheckTime)
     {
         MarryLogic.NextPeriodicCheckTime = ticks + 10000L;
         lock (MarryLogic.MarryApplyList)
         {
             foreach (KeyValuePair <int, MarryApplyData> it in MarryLogic.MarryApplyList.ToList <KeyValuePair <int, MarryApplyData> >())
             {
                 MarryApplyData applyData = it.Value;
                 if (applyData.ApplyExpireTime > 0L && applyData.ApplyExpireTime <= ticks)
                 {
                     MarryLogic.ApplyReturnMoney(it.Key, applyData, null);
                     applyData.ApplyExpireTime = 0L;
                 }
                 if (applyData.ApplyCDEndTime <= ticks)
                 {
                     MarryLogic.MarryApplyList.Remove(it.Key);
                 }
             }
         }
     }
 }
コード例 #15
0
ファイル: MarryOtherLogic.cs プロジェクト: chenchungit/ky
        /// <summary>
        /// 发送情侣数据给客户端
        /// </summary>
        public void SendSpouseDataToClient(GameClient client)
        {
            try
            {
                if (-1 != client.ClientData.MyMarriageData.nSpouseID)
                {
                    MarriageData_EX myMarriageData_EX = new MarriageData_EX();
                    GameClient      Spouseclient      = GameManager.ClientMgr.FindClient(client.ClientData.MyMarriageData.nSpouseID);

                    //在线情况
                    if (null != Spouseclient)
                    {
                        myMarriageData_EX.myMarriageData = Spouseclient.ClientData.MyMarriageData;
                        myMarriageData_EX.roleName       = Spouseclient.ClientData.RoleName;
                        myMarriageData_EX.Occupation     = Spouseclient.ClientData.Occupation;
                        client.sendCmd <MarriageData_EX>((int)TCPGameServerCmds.CMD_SPR_MARRY_SPOUSE_DATA, myMarriageData_EX);
                    }
                    else //不在线情况
                    {
                        RoleDataEx roleDataEx = MarryLogic.GetOfflineRoleData(client.ClientData.MyMarriageData.nSpouseID);
                        if (roleDataEx != null)
                        {
                            myMarriageData_EX.roleName       = roleDataEx.RoleName;
                            myMarriageData_EX.Occupation     = roleDataEx.Occupation;
                            myMarriageData_EX.myMarriageData = roleDataEx.MyMarriageData;
                            //将结婚信息和配偶名称职业一起发过去
                            client.sendCmd <MarriageData_EX>((int)TCPGameServerCmds.CMD_SPR_MARRY_SPOUSE_DATA, myMarriageData_EX);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                DataHelper.WriteFormatExceptionLog(ex, "SendSpouseDataToClient", false);
            }
        }
コード例 #16
0
        public static void showdown()
        {
            //战盟事件管理器
            ZhanMengShiJianManager.getInstance().showdown();

            //竞技场管理器
            JingJiChangManager.getInstance().showdown();

            //离线摆摊
            LiXianBaiTanManager.getInstance().showdown();

            //离线挂机
            LiXianGuaJiManager.getInstance().showdown();

            //副本活动组队管理器
            CopyTeamManager.Instance().showdown();

            //指令注册管理器
            CmdRegisterTriggerManager.getInstance().showdown();

            //发送指令管理
            SendCmdManager.getInstance().showdown();

            //Boss AI管理器
            BossAIManager.getInstance().showdown();

            //MU交易所
            SaleManager.getInstance().showdown();

            //炼制系统
            LianZhiManager.GetInstance().showdown();

            // 成就升级
            ChengJiuManager.GetInstance().showdown();

            //声望勋章
            PrestigeMedalManager.getInstance().showdown();

            UnionPalaceManager.getInstance().showdown();
            UserActivateManager.getInstance().showdown();

            PetSkillManager.getInstance().showdown();

            //玩家召回
            UserReturnManager.getInstance().showdown();

            //天赋
            TalentManager.getInstance().showdown();

            //每日专享
            TodayManager.getInstance().showdown();

            FundManager.getInstance().showdown();

            WarnManager.getInstance().showdown();

            //领地
            BuildingManager.getInstance().showdown();

            //藏宝秘境
            OnePieceManager.getInstance().showdown();

            //求婚和离婚未返回金钱处理
            MarryLogic.ApplyShutdownClear();

            TenManager.getInstance().showdown();

            // 七日活动
            SevenDayActivityMgr.Instance().showdown();

            SoulStoneManager.Instance().showdown();

            //调用所有注册的管理模块的停止函数
            lock (Scene2ManagerDict)
            {
                foreach (var list in Scene2ManagerDict.Values)
                {
                    foreach (var m in list)
                    {
                        m.showdown();
                    }
                }
            }
        }
コード例 #17
0
        public static MarryResult MarryDivorce(GameClient client, MarryDivorceType divorceType)
        {
            MarryResult result;

            if (!MarryLogic.IsVersionSystemOpenOfMarriage())
            {
                result = MarryResult.NotOpen;
            }
            else if (0 >= client.ClientData.MyMarriageData.byMarrytype)
            {
                result = MarryResult.NotMarried;
            }
            else if (!SingletonTemplate <CoupleArenaManager> .Instance().IsNowCanDivorce(TimeUtil.NowDateTime()))
            {
                result = MarryResult.DeniedByCoupleAreanTime;
            }
            else
            {
                int        spouseID     = client.ClientData.MyMarriageData.nSpouseID;
                GameClient spouseClient = GameManager.ClientMgr.FindClient(spouseID);
                if (divorceType == MarryDivorceType.DivorceForce || divorceType == MarryDivorceType.DivorceFree || divorceType == MarryDivorceType.DivorceFreeAccept)
                {
                    if (client.ClientData.ExchangeID > 0 || client.ClientSocket.IsKuaFuLogin || client.ClientData.CopyMapID > 0)
                    {
                        return(MarryResult.SelfBusy);
                    }
                    if (-1 != client.ClientData.FuBenID && MapTypes.MarriageCopy == Global.GetMapType(client.ClientData.MapCode))
                    {
                        return(MarryResult.SelfBusy);
                    }
                    if (null != spouseClient)
                    {
                        if (-1 != spouseClient.ClientData.FuBenID && MapTypes.MarriageCopy == Global.GetMapType(spouseClient.ClientData.MapCode))
                        {
                            return(MarryResult.TargetBusy);
                        }
                    }
                    if (divorceType == MarryDivorceType.DivorceForce || divorceType == MarryDivorceType.DivorceFree)
                    {
                        if (MarryLogic.ApplyExist(client.ClientData.RoleID))
                        {
                            return(MarryResult.SelfBusy);
                        }
                    }
                }
                int _man  = client.ClientData.RoleID;
                int _wife = spouseID;
                if (client.ClientData.MyMarriageData.byMarrytype == 2)
                {
                    DataHelper2.Swap <int>(ref _man, ref _wife);
                }
                if (divorceType == MarryDivorceType.DivorceForce)
                {
                    if (client.ClientData.UserMoney < MarryLogic.DivorceForceCost)
                    {
                        return(MarryResult.MoneyNotEnough);
                    }
                    if (!SingletonTemplate <CoupleWishManager> .Instance().PreClearDivorceData(_man, _wife))
                    {
                        return(MarryResult.NotOpen);
                    }
                    if (!SingletonTemplate <CoupleArenaManager> .Instance().PreClearDivorceData(_man, _wife))
                    {
                        return(MarryResult.NotOpen);
                    }
                    if (!GameManager.ClientMgr.SubUserMoney(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, MarryLogic.DivorceForceCost, "强制离婚", false, true, false, DaiBiSySType.None))
                    {
                    }
                    client.ClientData.MyMarriageData.byMarrytype = -1;
                    client.ClientData.MyMarriageData.nSpouseID   = -1;
                    MarryFuBenMgr.UpdateMarriageData2DB(client);
                    MarriageOtherLogic.getInstance().ResetRingAttr(client);
                    if (null != spouseClient)
                    {
                        spouseClient.ClientData.MyMarriageData.nSpouseID   = -1;
                        spouseClient.ClientData.MyMarriageData.byMarrytype = -1;
                        MarryFuBenMgr.UpdateMarriageData2DB(spouseClient);
                        MarriageOtherLogic.getInstance().ResetRingAttr(spouseClient);
                        MarriageOtherLogic.getInstance().SendMarriageDataToClient(spouseClient, true);
                        if (spouseClient._IconStateMgr.CheckJieRiFanLi(spouseClient, ActivityTypes.JieriMarriage))
                        {
                            spouseClient._IconStateMgr.AddFlushIconState(14000, spouseClient._IconStateMgr.IsAnyJieRiTipActived());
                            spouseClient._IconStateMgr.SendIconStateToClient(spouseClient);
                        }
                    }
                    else
                    {
                        string       tcpstring          = string.Format("{0}", spouseID);
                        MarriageData spouseMarriageData = Global.sendToDB <MarriageData, string>(10186, tcpstring, client.ServerId);
                        if (spouseMarriageData != null && 0 < spouseMarriageData.byMarrytype)
                        {
                            spouseMarriageData.byMarrytype = -1;
                            spouseMarriageData.nSpouseID   = -1;
                            MarryFuBenMgr.UpdateMarriageData2DB(spouseID, spouseMarriageData, client);
                        }
                    }
                    MarryPartyLogic.getInstance().MarryPartyRemove(client.ClientData.RoleID, true, client);
                    MarryPartyLogic.getInstance().MarryPartyRemove(spouseID, true, client);
                    MarriageOtherLogic.getInstance().SendMarriageDataToClient(client, true);
                    if (client._IconStateMgr.CheckJieRiFanLi(client, ActivityTypes.JieriMarriage))
                    {
                        client._IconStateMgr.AddFlushIconState(14000, client._IconStateMgr.IsAnyJieRiTipActived());
                        client._IconStateMgr.SendIconStateToClient(client);
                    }
                    string msg = string.Format(GLang.GetLang(486, new object[0]), client.ClientData.RoleName);
                    MarryLogic.SendDivorceMail(spouseID, GLang.GetLang(487, new object[0]), msg, spouseClient, client.ServerId);
                    SingletonTemplate <CoupleArenaManager> .Instance().OnDivorce(client.ClientData.RoleID, spouseID);
                }
                else if (divorceType == MarryDivorceType.DivorceFree)
                {
                    if (null == spouseClient)
                    {
                        return(MarryResult.TargetOffline);
                    }
                    if (spouseClient.ClientData.ExchangeID > 0 || spouseClient.ClientSocket.IsKuaFuLogin || spouseClient.ClientData.CopyMapID > 0)
                    {
                        return(MarryResult.TargetBusy);
                    }
                    if (Global.GetTotalBindTongQianAndTongQianVal(client) < MarryLogic.DivorceCost)
                    {
                        return(MarryResult.MoneyNotEnough);
                    }
                    if (!Global.SubBindTongQianAndTongQian(client, MarryLogic.DivorceCost, "申请离婚"))
                    {
                        return(MarryResult.MoneyNotEnough);
                    }
                    MarryLogic.AddMarryApply(client.ClientData.RoleID, MarryApplyType.ApplyDivorce, spouseID);
                    string notifyData = string.Format("{0}:{1}", client.ClientData.RoleID, 1);
                    spouseClient.sendCmd(892, notifyData, false);
                    SingletonTemplate <CoupleArenaManager> .Instance().OnSpouseRequestDivorce(spouseClient, client);
                }
                else
                {
                    if (null == spouseClient)
                    {
                        return(MarryResult.TargetOffline);
                    }
                    if (!MarryLogic.RemoveMarryApply(spouseID, MarryApplyType.ApplyDivorce))
                    {
                        return(MarryResult.ApplyTimeout);
                    }
                    MarryLogic.RemoveMarryApply(spouseID, MarryApplyType.ApplyNull);
                    if (divorceType == MarryDivorceType.DivorceFreeAccept)
                    {
                        if (SingletonTemplate <CoupleWishManager> .Instance().PreClearDivorceData(_man, _wife) && SingletonTemplate <CoupleArenaManager> .Instance().PreClearDivorceData(_man, _wife))
                        {
                            client.ClientData.MyMarriageData.byMarrytype       = -1;
                            client.ClientData.MyMarriageData.nSpouseID         = -1;
                            spouseClient.ClientData.MyMarriageData.byMarrytype = -1;
                            spouseClient.ClientData.MyMarriageData.nSpouseID   = -1;
                            MarryFuBenMgr.UpdateMarriageData2DB(client);
                            MarryFuBenMgr.UpdateMarriageData2DB(spouseClient);
                            MarriageOtherLogic.getInstance().SendMarriageDataToClient(client, true);
                            MarriageOtherLogic.getInstance().SendMarriageDataToClient(spouseClient, true);
                            MarriageOtherLogic.getInstance().ResetRingAttr(client);
                            MarriageOtherLogic.getInstance().ResetRingAttr(spouseClient);
                            MarryPartyLogic.getInstance().MarryPartyRemove(client.ClientData.RoleID, true, client);
                            MarryPartyLogic.getInstance().MarryPartyRemove(spouseID, true, client);
                            if (client._IconStateMgr.CheckJieRiFanLi(client, ActivityTypes.JieriMarriage))
                            {
                                client._IconStateMgr.AddFlushIconState(14000, client._IconStateMgr.IsAnyJieRiTipActived());
                                client._IconStateMgr.SendIconStateToClient(client);
                            }
                            if (spouseClient._IconStateMgr.CheckJieRiFanLi(spouseClient, ActivityTypes.JieriMarriage))
                            {
                                spouseClient._IconStateMgr.AddFlushIconState(14000, spouseClient._IconStateMgr.IsAnyJieRiTipActived());
                                spouseClient._IconStateMgr.SendIconStateToClient(spouseClient);
                            }
                            SingletonTemplate <CoupleArenaManager> .Instance().OnDivorce(client.ClientData.RoleID, spouseID);
                        }
                        else
                        {
                            GameManager.ClientMgr.AddMoney1(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, spouseClient, MarryLogic.DivorceCost, "自由离婚拒绝返还绑金", false);
                            GameManager.ClientMgr.NotifyImportantMsg(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client, StringUtil.substitute(GLang.GetLang(488, new object[0]), new object[0]), GameInfoTypeIndexes.Error, ShowGameInfoTypes.ErrAndBox, 0);
                            GameManager.ClientMgr.NotifyImportantMsg(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, spouseClient, StringUtil.substitute(GLang.GetLang(488, new object[0]), new object[0]), GameInfoTypeIndexes.Error, ShowGameInfoTypes.ErrAndBox, 0);
                        }
                    }
                    else if (divorceType == MarryDivorceType.DivorceFreeReject)
                    {
                        GameManager.ClientMgr.AddMoney1(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, spouseClient, MarryLogic.DivorceCost, "自由离婚拒绝返还绑金", false);
                        string notifyData = string.Format("{0}:{1}", client.ClientData.RoleID, 3);
                        spouseClient.sendCmd(892, notifyData, false);
                    }
                }
                result = MarryResult.Success;
            }
            return(result);
        }
コード例 #18
0
        public static MarryResult MarryReply(GameClient client, int sourceID, int accept)
        {
            MarryResult result;

            if (!MarryLogic.IsVersionSystemOpenOfMarriage())
            {
                result = MarryResult.NotOpen;
            }
            else if (client.ClientData.MyMarriageData.byMarrytype > 0)
            {
                result = MarryResult.SelfMarried;
            }
            else
            {
                GameClient sourceClient = GameManager.ClientMgr.FindClient(sourceID);
                if (sourceClient == null)
                {
                    result = MarryResult.ApplyTimeout;
                }
                else if (sourceClient.ClientData.MyMarriageData.byMarrytype > 0)
                {
                    result = MarryResult.TargetMarried;
                }
                else if (!MarryLogic.RemoveMarryApply(sourceID, MarryApplyType.ApplyInit))
                {
                    result = MarryResult.ApplyTimeout;
                }
                else
                {
                    if (!client.ClientData.IsMainOccupation || !sourceClient.ClientData.IsMainOccupation)
                    {
                        accept = 0;
                    }
                    if (accept == 0 || client.ClientData.MyMarriageData.byAutoReject == 1)
                    {
                        string notifyData = string.Format("{0}:{1}:{2}", 1, client.ClientData.RoleID, client.ClientData.RoleName);
                        sourceClient.sendCmd(894, notifyData, false);
                        GameManager.ClientMgr.AddUserMoney(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, sourceClient, MarryLogic.MarryCost, "求婚被拒绝返还钻石", ActivityTypes.None, "");
                    }
                    else
                    {
                        MarryLogic.RemoveMarryApply(sourceID, MarryApplyType.ApplyNull);
                        MarryLogic.ApplyLogoutClear(client);
                        MarryLogic.RemoveMarryApply(client.ClientData.RoleID, MarryApplyType.ApplyNull);
                        int initRingID = 0;
                        if (null != MarriageOtherLogic.getInstance().WeddingRingDic.SystemXmlItemDict)
                        {
                            initRingID = MarriageOtherLogic.getInstance().WeddingRingDic.SystemXmlItemDict.Keys.First <int>();
                        }
                        if (sourceClient.ClientData.MyMarriageData.nRingID <= 0)
                        {
                            sourceClient.ClientData.MyMarriageData.nRingID = initRingID;
                        }
                        if (client.ClientData.MyMarriageData.nRingID <= 0)
                        {
                            client.ClientData.MyMarriageData.nRingID = initRingID;
                        }
                        sbyte sourceType = (sbyte)(sourceClient.ClientData.RoleSex != 1 || client.ClientData.RoleSex == sourceClient.ClientData.RoleSex ? 1 : 2);
                        sourceClient.ClientData.MyMarriageData.byMarrytype = sourceType;
                        client.ClientData.MyMarriageData.byMarrytype       = (sbyte)(sourceType == 1 ? 2 : 1);
                        sourceClient.ClientData.MyMarriageData.nSpouseID   = client.ClientData.RoleID;
                        client.ClientData.MyMarriageData.nSpouseID         = sourceID;
                        if (sourceClient.ClientData.MyMarriageData.byGoodwilllevel == 0)
                        {
                            sourceClient.ClientData.MyMarriageData.ChangTime       = TimeUtil.NowDateTime().ToString("yyyy-MM-dd HH:mm:ss");
                            sourceClient.ClientData.MyMarriageData.byGoodwilllevel = 1;
                        }
                        if (client.ClientData.MyMarriageData.byGoodwilllevel == 0)
                        {
                            client.ClientData.MyMarriageData.ChangTime       = TimeUtil.NowDateTime().ToString("yyyy-MM-dd HH:mm:ss");
                            client.ClientData.MyMarriageData.byGoodwilllevel = 1;
                        }
                        EventLogManager.AddRingBuyEvent(sourceClient, 0, initRingID, 0, 0, 0, 1, "");
                        EventLogManager.AddRingBuyEvent(client, 0, initRingID, 0, 0, 0, 1, "");
                        MarryFuBenMgr.UpdateMarriageData2DB(sourceClient);
                        MarryFuBenMgr.UpdateMarriageData2DB(client);
                        MarriageOtherLogic.getInstance().SendMarriageDataToClient(sourceClient, true);
                        MarriageOtherLogic.getInstance().SendMarriageDataToClient(client, true);
                        MarriageOtherLogic.getInstance().UpdateRingAttr(sourceClient, true, false);
                        if (client._IconStateMgr.CheckJieRiFanLi(client, ActivityTypes.JieriMarriage))
                        {
                            client._IconStateMgr.AddFlushIconState(14000, client._IconStateMgr.IsAnyJieRiTipActived());
                            client._IconStateMgr.SendIconStateToClient(client);
                        }
                        if (sourceClient._IconStateMgr.CheckJieRiFanLi(sourceClient, ActivityTypes.JieriMarriage))
                        {
                            sourceClient._IconStateMgr.AddFlushIconState(14000, sourceClient._IconStateMgr.IsAnyJieRiTipActived());
                            sourceClient._IconStateMgr.SendIconStateToClient(sourceClient);
                        }
                        FriendData friendData = Global.FindFriendData(client, sourceID);
                        if (friendData != null && friendData.FriendType != 0)
                        {
                            GameManager.ClientMgr.RemoveFriend(Global._TCPManager, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, friendData.DbID);
                            friendData = null;
                        }
                        if (friendData == null)
                        {
                            GameManager.ClientMgr.AddFriend(Global._TCPManager, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, -1, sourceID, Global.FormatRoleName(sourceClient, sourceClient.ClientData.RoleName), 0);
                        }
                        friendData = Global.FindFriendData(sourceClient, client.ClientData.RoleID);
                        if (friendData != null && friendData.FriendType != 0)
                        {
                            GameManager.ClientMgr.RemoveFriend(Global._TCPManager, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, sourceClient, friendData.DbID);
                            friendData = null;
                        }
                        if (friendData == null)
                        {
                            GameManager.ClientMgr.AddFriend(Global._TCPManager, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, sourceClient, -1, client.ClientData.RoleID, Global.FormatRoleName(client, client.ClientData.RoleName), 0);
                        }
                        string broadCastMsg = string.Format(GLang.GetLang(485, new object[0]), sourceClient.ClientData.RoleName, client.ClientData.RoleName);
                        Global.BroadcastRoleActionMsg(client, RoleActionsMsgTypes.Bulletin, broadCastMsg, true, GameInfoTypeIndexes.Hot, ShowGameInfoTypes.OnlySysHint, 0, 0, 100, 100);
                        SingletonTemplate <CoupleArenaManager> .Instance().OnMarry(sourceClient, client);
                    }
                    result = MarryResult.Success;
                }
            }
            return(result);
        }
コード例 #19
0
        public static MarryResult MarryInit(GameClient client, int spouseID)
        {
            MarryResult result;

            if (!client.ClientData.IsMainOccupation)
            {
                result = MarryResult.Error_Denied_For_Minor_Occupation;
            }
            else if (!GlobalNew.IsGongNengOpened(client, GongNengIDs.Marriage, true) || !MarryLogic.IsVersionSystemOpenOfMarriage())
            {
                result = MarryResult.NotOpen;
            }
            else if (client.ClientData.MyMarriageData.byMarrytype > 0)
            {
                result = MarryResult.SelfMarried;
            }
            else if (client.ClientData.ChangeLifeCount < 3)
            {
                result = MarryResult.SelfLevelNotEnough;
            }
            else if (client.ClientData.ExchangeID > 0 || client.ClientSocket.IsKuaFuLogin || client.ClientData.CopyMapID > 0)
            {
                result = MarryResult.SelfBusy;
            }
            else
            {
                GameClient spouseClient = GameManager.ClientMgr.FindClient(spouseID);
                if (spouseClient == null)
                {
                    result = MarryResult.TargetOffline;
                }
                else if (!spouseClient.ClientData.IsMainOccupation)
                {
                    result = MarryResult.Error_Denied_For_Minor_Occupation;
                }
                else if (!GlobalNew.IsGongNengOpened(spouseClient, GongNengIDs.Marriage, false))
                {
                    result = MarryResult.TargetNotOpen;
                }
                else
                {
                    if (!MarryLogic.SameSexMarry(false))
                    {
                        if (client.ClientData.RoleSex == spouseClient.ClientData.RoleSex)
                        {
                            return(MarryResult.InvalidSex);
                        }
                    }
                    if (spouseClient.ClientData.MyMarriageData.byMarrytype > 0)
                    {
                        result = MarryResult.TargetMarried;
                    }
                    else if (spouseClient.ClientData.ChangeLifeCount < 3)
                    {
                        result = MarryResult.TargetLevelNotEnough;
                    }
                    else if (spouseClient.ClientData.ExchangeID > 0 || spouseClient.ClientSocket.IsKuaFuLogin || spouseClient.ClientData.CopyMapID > 0)
                    {
                        result = MarryResult.TargetBusy;
                    }
                    else if (MarryLogic.ApplyExist(spouseID))
                    {
                        result = MarryResult.TargetBusy;
                    }
                    else if (spouseClient.ClientData.MyMarriageData.byAutoReject == 1)
                    {
                        result = MarryResult.AutoReject;
                    }
                    else if (MarryLogic.AddMarryApply(client.ClientData.RoleID, MarryApplyType.ApplyInit, spouseID) == null)
                    {
                        result = MarryResult.ApplyCD;
                    }
                    else if (!GameManager.ClientMgr.SubUserMoney(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, MarryLogic.MarryCost, "结婚", false, true, false, DaiBiSySType.None))
                    {
                        MarryLogic.RemoveMarryApply(client.ClientData.RoleID, MarryApplyType.ApplyNull);
                        result = MarryResult.MoneyNotEnough;
                    }
                    else
                    {
                        string notifyData = string.Format("{0}:{1}:{2}", 0, client.ClientData.RoleID, client.ClientData.RoleName);
                        spouseClient.sendCmd(894, notifyData, false);
                        result = MarryResult.Success;
                    }
                }
            }
            return(result);
        }
コード例 #20
0
        public MarryPartyResult MarryPartyCreate(GameClient client, int partyType, long startTime)
        {
            MarryPartyResult result2;

            if (!MarryLogic.IsVersionSystemOpenOfMarriage())
            {
                result2 = MarryPartyResult.NotOpen;
            }
            else
            {
                MarryPartyConfigData configData = this.GetMarryPartyConfigData(partyType);
                if (null == configData)
                {
                    result2 = MarryPartyResult.InvalidParam;
                }
                else
                {
                    MarriageData marryData = client.ClientData.MyMarriageData;
                    if (marryData.nSpouseID < 0 || marryData.byMarrytype < 0)
                    {
                        result2 = MarryPartyResult.NotMarry;
                    }
                    else
                    {
                        int    husbandRoleID;
                        string husbandName;
                        int    wifeRoleID;
                        string wifeName;
                        if (1 == marryData.byMarrytype)
                        {
                            husbandRoleID = client.ClientData.RoleID;
                            husbandName   = client.ClientData.RoleName;
                            wifeRoleID    = marryData.nSpouseID;
                            wifeName      = MarryLogic.GetRoleName(marryData.nSpouseID);
                        }
                        else
                        {
                            husbandRoleID = marryData.nSpouseID;
                            husbandName   = MarryLogic.GetRoleName(marryData.nSpouseID);
                            wifeRoleID    = client.ClientData.RoleID;
                            wifeName      = client.ClientData.RoleName;
                        }
                        MarryPartyData partyData = this.m_MarryPartyDataCache.AddParty(client.ClientData.RoleID, partyType, startTime, husbandRoleID, wifeRoleID, husbandName, wifeName);
                        if (partyData == null)
                        {
                            result2 = MarryPartyResult.AlreadyRequest;
                        }
                        else
                        {
                            MarryPartyResult     result   = MarryPartyResult.Success;
                            byte[]               byteData = null;
                            TCPProcessCmdResults dbResult = Global.RequestToDBServer3(Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, 10188, string.Format("{0}:{1}:{2}:{3}:{4}:{5}:{6}", new object[]
                            {
                                client.ClientData.RoleID,
                                partyType,
                                startTime,
                                husbandRoleID,
                                wifeRoleID,
                                husbandName,
                                wifeName
                            }), out byteData, client.ServerId);
                            if (TCPProcessCmdResults.RESULT_FAILED == dbResult || byteData == null || byteData.Length <= 6)
                            {
                                result = MarryPartyResult.AlreadyRequest;
                            }
                            if (result == MarryPartyResult.Success)
                            {
                                if (configData.PartyCost > Global.GetTotalBindTongQianAndTongQianVal(client))
                                {
                                    result = MarryPartyResult.NotEnoughMoney;
                                }
                                if (configData.PartyCost > 0)
                                {
                                    if (!Global.SubBindTongQianAndTongQian(client, configData.PartyCost, "举办婚宴"))
                                    {
                                        result = MarryPartyResult.NotEnoughMoney;
                                    }
                                }
                            }
                            if (result != MarryPartyResult.Success)
                            {
                                if (dbResult != TCPProcessCmdResults.RESULT_FAILED)
                                {
                                    try
                                    {
                                        Global.SendAndRecvData <string>(10189, string.Format("{0}", client.ClientData.RoleID), client.ServerId, 0);
                                    }
                                    catch (Exception)
                                    {
                                    }
                                }
                                this.m_MarryPartyDataCache.RemoveParty(client.ClientData.RoleID);
                                result2 = result;
                            }
                            else
                            {
                                int            length      = BitConverter.ToInt32(byteData, 0);
                                MarryPartyData dbPartyData = DataHelper.BytesToObject <MarryPartyData>(byteData, 6, length - 2);
                                this.m_MarryPartyDataCache.SetPartyTime(partyData, dbPartyData.StartTime);
                                this.SendMarryPartyList(client, partyData, -1);
                                result2 = result;
                            }
                        }
                    }
                }
            }
            return(result2);
        }
コード例 #21
0
        public MarryPartyResult MarryPartyJoin(GameClient client, int roleID)
        {
            MarryPartyResult result;

            if (!MarryLogic.IsVersionSystemOpenOfMarriage())
            {
                result = MarryPartyResult.NotOpen;
            }
            else
            {
                MarryPartyData partyData = this.m_MarryPartyDataCache.GetParty(roleID);
                if (partyData == null)
                {
                    result = MarryPartyResult.PartyNotFound;
                }
                else if (partyData.StartTime > TimeUtil.NOW())
                {
                    result = MarryPartyResult.NotStart;
                }
                else
                {
                    MarryPartyConfigData configData = this.GetMarryPartyConfigData(partyData.PartyType);
                    if (null == configData)
                    {
                        result = MarryPartyResult.PartyNotFound;
                    }
                    else if (configData.JoinCost > Global.GetTotalBindTongQianAndTongQianVal(client))
                    {
                        result = MarryPartyResult.NotEnoughMoney;
                    }
                    else
                    {
                        Dictionary <int, int> joinList = client.ClientData.MyMarryPartyJoinList;
                        int  targetPartyJoinCount      = 0;
                        int  allPartyJoinCount         = 0;
                        bool remove = false;
                        lock (joinList)
                        {
                            joinList.TryGetValue(roleID, out targetPartyJoinCount);
                            foreach (KeyValuePair <int, int> kv in client.ClientData.MyMarryPartyJoinList)
                            {
                                allPartyJoinCount += kv.Value;
                            }
                            if (allPartyJoinCount >= this.MarryPartyPlayerMaxJoinCount)
                            {
                                return(MarryPartyResult.ZeroPlayerJoinCount);
                            }
                            if (targetPartyJoinCount >= configData.PlayerMaxJoinCount)
                            {
                                return(MarryPartyResult.ZeroPlayerJoinCount);
                            }
                            if (!this.m_MarryPartyDataCache.IncPartyJoin(roleID, configData.PartyMaxJoinCount, out remove))
                            {
                                return(MarryPartyResult.ZeroPartyJoinCount);
                            }
                            targetPartyJoinCount++;
                            byte[] byteData = null;
                            TCPProcessCmdResults dbResult = Global.RequestToDBServer3(Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, 10190, string.Format("{0}:{1}:{2}", roleID, client.ClientData.RoleID, targetPartyJoinCount), out byteData, client.ServerId);
                            if (TCPProcessCmdResults.RESULT_FAILED == dbResult || byteData == null || byteData.Length <= 6)
                            {
                                this.m_MarryPartyDataCache.IncPartyJoinCancel(roleID);
                                return(MarryPartyResult.ZeroPartyJoinCount);
                            }
                            joinList[roleID] = targetPartyJoinCount;
                        }
                        if (configData.JoinCost > 0)
                        {
                            if (!Global.SubBindTongQianAndTongQian(client, configData.JoinCost, "參予婚宴"))
                            {
                                return(MarryPartyResult.NotEnoughMoney);
                            }
                        }
                        if (configData.RewardExp > 0)
                        {
                            GameManager.ClientMgr.ProcessRoleExperience(client, (long)configData.RewardExp, false, true, false, "none");
                        }
                        if (configData.RewardShengWang > 0)
                        {
                            GameManager.ClientMgr.ModifyShengWangValue(client, configData.RewardShengWang, "婚宴奖励", false, true);
                        }
                        if (configData.RewardXingHun > 0)
                        {
                            GameManager.ClientMgr.ModifyStarSoulValue(client, configData.RewardXingHun, "婚宴奖励", false, true);
                        }
                        if (remove)
                        {
                            this.MarryPartyRemoveInternal(roleID, true, client, null);
                            GoodsData goodData = Global.GetNewGoodsData(configData.RewardItem.GoodsID, configData.RewardItem.Binding);
                            goodData.GCount = configData.JoinCost * configData.PartyMaxJoinCount / configData.GoodWillRatio / 2;
                            List <GoodsData> goodList = new List <GoodsData>();
                            goodList.Add(goodData);
                            string sMsg = GLang.GetLang(493, new object[0]);
                            Global.UseMailGivePlayerAward3(roleID, goodList, GLang.GetLang(494, new object[0]), sMsg, 0, 0, 0);
                            int spouseID = (roleID == partyData.HusbandRoleID) ? partyData.WifeRoleID : partyData.HusbandRoleID;
                            Global.UseMailGivePlayerAward3(spouseID, goodList, GLang.GetLang(494, new object[0]), sMsg, 0, 0, 0);
                        }
                        this.SendMarryPartyJoinList(client);
                        this.SendMarryPartyList(client, partyData, -1);
                        result = MarryPartyResult.Success;
                    }
                }
            }
            return(result);
        }
コード例 #22
0
ファイル: MarryOtherLogic.cs プロジェクト: chenchungit/ky
        /// <summary>
        /// 更新婚戒属性
        /// bNeedUpdateSpouse 更新配偶戒指属性
        /// </summary>
        public void UpdateRingAttr(GameClient client, bool bNeedUpdateSpouse = false, bool bIsLogin = false)
        {
            //功能未开启不增加婚戒属性
            if (!MarryLogic.IsVersionSystemOpenOfMarriage())
            {
                return;
            }

            //看看是否有婚戒
            if (-1 == client.ClientData.MyMarriageData.nRingID)
            {
                return;
            }

            //看看是不是结婚了 没结婚不会增加婚戒属性
            if (-1 == client.ClientData.MyMarriageData.byMarrytype ||
                -1 == client.ClientData.MyMarriageData.nSpouseID)
            {
                return;
            }

            //[bing] 如果发现配偶在线直接取数据
            MarriageData SpouseMarriageData = null;
            GameClient   Spouseclient       = GameManager.ClientMgr.FindClient(client.ClientData.MyMarriageData.nSpouseID);

            if (null != Spouseclient)
            {
                SpouseMarriageData = Spouseclient.ClientData.MyMarriageData;
            }
            else
            {
                //取一下情侣的数据 需要情侣婚戒数据
                string tcpstring = string.Format("{0}", client.ClientData.MyMarriageData.nSpouseID);
                SpouseMarriageData = Global.sendToDB <MarriageData, String>((int)TCPGameServerCmds.CMD_DB_GET_MARRY_DATA, tcpstring, client.ServerId);
            }

            //没有数据? 或者出错?
            if (null == SpouseMarriageData ||
                -1 == SpouseMarriageData.nRingID)
            {
                return;
            }

            //结婚后,夫妻双方享受自己婚戒的BUFF最终属性,和对方婚戒的30%的最终属性

            //先找到自己婚戒的最终属性
            EquipPropItem myringitem    = GameManager.EquipPropsMgr.FindEquipPropItem(client.ClientData.MyMarriageData.nRingID);
            EquipPropItem tmpmyringitem = new EquipPropItem();

            //找到自己伴侣婚戒的最终属性
            EquipPropItem spouseringitem    = GameManager.EquipPropsMgr.FindEquipPropItem(SpouseMarriageData.nRingID);
            EquipPropItem tmpspouseringitem = new EquipPropItem();

            //计算婚戒最终属性
            for (int i = 0; i < tmpmyringitem.ExtProps.Length; ++i)
            {
                tmpmyringitem.ExtProps[i]     = RingAttrJiSuan(client.ClientData.MyMarriageData.byGoodwilllevel, client.ClientData.MyMarriageData.byGoodwillstar, myringitem.ExtProps[i]);
                tmpspouseringitem.ExtProps[i] = RingAttrJiSuan(SpouseMarriageData.byGoodwilllevel, SpouseMarriageData.byGoodwillstar, spouseringitem.ExtProps[i]);
                tmpmyringitem.ExtProps[i]    += tmpspouseringitem.ExtProps[i] * dOtherRingmodulus;
            }

            //更新属性 [bing] 因为现在只有一个婚戒 所以不要记ID了 mark
            client.ClientData.PropsCacheManager.SetExtProps(PropsSystemTypes.MarriageRing, /*client.ClientData.MyMarriageData.nRingID,*/ tmpmyringitem.ExtProps);

            if (false == bIsLogin)
            {
                // 通知客户端属性变化
                GameManager.ClientMgr.NotifyUpdateEquipProps(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client);
                // 总生命值和魔法值变化通知(同一个地图才需要通知)
                GameManager.ClientMgr.NotifyOthersLifeChanged(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client);
            }

            //如果情侣在线可能需要更新情侣的婚戒属性
            //取出情侣
            if (true == bNeedUpdateSpouse)
            {
                if (null != Spouseclient)
                {
                    UpdateRingAttr(Spouseclient, false);
                }
            }
        }
コード例 #23
0
        public static int GetSpouseID(int roleID)
        {
            RoleDataEx roleDataEx = MarryLogic.GetOfflineRoleData(roleID);

            return((roleDataEx != null && roleDataEx.MyMarriageData != null) ? roleDataEx.MyMarriageData.nSpouseID : -1);
        }
コード例 #24
0
ファイル: MarryPartyLogic.cs プロジェクト: chenchungit/ky
        public MarryPartyResult MarryPartyJoin(GameClient client, int roleID)
        {
            if (!MarryLogic.IsVersionSystemOpenOfMarriage())
            {
                return(MarryPartyResult.NotOpen);
            }

            MarryPartyData partyData = m_MarryPartyDataCache.GetParty(roleID);

            if (partyData == null)
            {
                return(MarryPartyResult.PartyNotFound);
            }

            if (partyData.StartTime > TimeUtil.NOW())
            {
                return(MarryPartyResult.NotStart);
            }

            MarryPartyConfigData configData = GetMarryPartyConfigData(partyData.PartyType);

            if (null == configData)
            {
                return(MarryPartyResult.PartyNotFound);
            }

            // 检查參予所需金币是否足够
            if (configData.JoinCost > Global.GetTotalBindTongQianAndTongQianVal(client))
            {
                return(MarryPartyResult.NotEnoughMoney);
            }

            // 检查參予次数
            Dictionary <int, int> joinList = client.ClientData.MyMarryPartyJoinList;
            int  targetPartyJoinCount      = 0;
            int  allPartyJoinCount         = 0;
            bool remove = false;

            lock (joinList)
            {
                joinList.TryGetValue(roleID, out targetPartyJoinCount);

                foreach (KeyValuePair <int, int> kv in client.ClientData.MyMarryPartyJoinList)
                {
                    allPartyJoinCount += kv.Value;
                }

                if (allPartyJoinCount >= MarryPartyPlayerMaxJoinCount)
                {
                    return(MarryPartyResult.ZeroPlayerJoinCount);
                }
                if (targetPartyJoinCount >= configData.PlayerMaxJoinCount)
                {
                    return(MarryPartyResult.ZeroPlayerJoinCount);
                }

                // 增加參予次数
                if (m_MarryPartyDataCache.IncPartyJoin(roleID, configData.PartyMaxJoinCount, out remove) == false)
                {
                    return(MarryPartyResult.ZeroPartyJoinCount);
                }

                ++targetPartyJoinCount;

                byte[] byteData = null;
                TCPProcessCmdResults dbResult =
                    Global.RequestToDBServer3(Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool,
                                              (int)TCPGameServerCmds.CMD_DB_MARRY_PARTY_JOIN_INC,
                                              string.Format("{0}:{1}:{2}", roleID, client.ClientData.RoleID, targetPartyJoinCount),
                                              out byteData,
                                              client.ServerId
                                              );
                if (TCPProcessCmdResults.RESULT_FAILED == dbResult || null == byteData || byteData.Length <= 6)
                {
                    m_MarryPartyDataCache.IncPartyJoinCancel(roleID);
                    return(MarryPartyResult.ZeroPartyJoinCount);
                }

                joinList[roleID] = targetPartyJoinCount;
            }

            if (configData.JoinCost > 0)
            {
                // 扣除參予所需金币
                if (Global.SubBindTongQianAndTongQian(client, configData.JoinCost, "參予婚宴") == false)
                {
                    // TODO: 沒处理參予次数已更新数据库的问题
                    return(MarryPartyResult.NotEnoughMoney);
                }
            }

            if (configData.RewardExp > 0)
            {
                GameManager.ClientMgr.ProcessRoleExperience(client, configData.RewardExp, false);
            }

            if (configData.RewardShengWang > 0)
            {
                GameManager.ClientMgr.ModifyShengWangValue(client, configData.RewardShengWang, "婚宴奖励", false);
            }

            if (configData.RewardXingHun > 0)
            {
                GameManager.ClientMgr.ModifyStarSoulValue(client, configData.RewardXingHun, "婚宴奖励", false);
            }

            if (remove == true)
            {
                MarryPartyRemoveInternal(roleID, true, client);

                // 婚宴结算, 换成友善度物品, 个数双方平分
                GoodsData goodData = Global.GetNewGoodsData(configData.RewardItem.GoodsID, configData.RewardItem.Binding);
                goodData.GCount = configData.JoinCost * configData.PartyMaxJoinCount / configData.GoodWillRatio / 2;
                List <GoodsData> goodList = new List <GoodsData>();
                goodList.Add(goodData);

                string sMsg = Global.GetLang("恭喜您成功举办了一场盛大的婚宴,宾客们馈赠的礼物已随这封邮件发送到您手上,请查收附件。");
                Global.UseMailGivePlayerAward3(roleID, goodList, Global.GetLang("婚宴"), sMsg, 0);

                int spouseID = (roleID == partyData.HusbandRoleID)? partyData.WifeRoleID : partyData.HusbandRoleID;
                Global.UseMailGivePlayerAward3(spouseID, goodList, Global.GetLang("婚宴"), sMsg, 0);
            }

            SendMarryPartyJoinList(client);
            SendMarryPartyList(client, partyData);

            //if (m_MarryPartyDataCache.GetPartyCount() <= 0)
            //{
            //    lock (MarryPartyNPCShowMutex)
            //    {
            //        if (MarryPartyNPCShow == true)
            //        {
            //            // TODO: add npc
            //            MarryPartyNPCShow = false;
            //        }
            //    }
            //}

            return(MarryPartyResult.Success);
        }
コード例 #25
0
 public bool processCmdEx(GameClient client, int nID, byte[] bytes, string[] cmdParams)
 {
     if (nID == 870)
     {
         int nSelect = 0;
         try
         {
             nSelect = Global.SafeConvertToInt32(cmdParams[0]);
         }
         catch (Exception ex)
         {
             DataHelper.WriteFormatExceptionLog(ex, "ProcessMarryFuben", false, false);
         }
         int[] iRet = null;
         if (!MarryLogic.IsVersionSystemOpenOfMarriage())
         {
             iRet = new int[]
             {
                 6
             };
             client.sendCmd <int[]>(nID, iRet, false);
         }
         else
         {
             if (1 == nSelect)
             {
                 iRet = new int[]
                 {
                     (int)this.GetMarriageInstanceState(client, null)
                 };
             }
             else if (2 == nSelect)
             {
                 iRet = new int[]
                 {
                     (int)this.ClientEnterRoom(client)
                 };
             }
             else if (3 == nSelect)
             {
                 iRet = new int[]
                 {
                     (int)this.ClientExitRoom(client)
                 };
             }
             else if (4 == nSelect)
             {
                 iRet = new int[]
                 {
                     (int)this.ClientReady(client, Global.SafeConvertToInt32(cmdParams[1]))
                 };
             }
             else if (5 == nSelect)
             {
                 iRet = new int[]
                 {
                     (int)this.ClientExitReady(client)
                 };
             }
             client.sendCmd <int[]>(nID, iRet, false);
         }
     }
     return(true);
 }
コード例 #26
0
ファイル: MarryPartyLogic.cs プロジェクト: chenchungit/ky
        public MarryPartyResult MarryPartyCreate(GameClient client, int partyType, long startTime)
        {
            if (!MarryLogic.IsVersionSystemOpenOfMarriage())
            {
                return(MarryPartyResult.NotOpen);
            }

            MarryPartyConfigData configData = GetMarryPartyConfigData(partyType);

            if (null == configData)
            {
                return(MarryPartyResult.InvalidParam);
            }

            MarriageData marryData = client.ClientData.MyMarriageData;

            if (marryData.nSpouseID < 0 || marryData.byMarrytype < 0)
            {
                return(MarryPartyResult.NotMarry);
            }

            int    husbandRoleID = 0;
            int    wifeRoleID    = 0;
            string husbandName   = "";
            string wifeName      = "";

            if (1 == marryData.byMarrytype)
            {
                husbandRoleID = client.ClientData.RoleID;
                husbandName   = client.ClientData.RoleName;
                wifeRoleID    = marryData.nSpouseID;
                wifeName      = MarryLogic.GetRoleName(marryData.nSpouseID);
            }
            else
            {
                husbandRoleID = marryData.nSpouseID;
                husbandName   = MarryLogic.GetRoleName(marryData.nSpouseID);
                wifeRoleID    = client.ClientData.RoleID;
                wifeName      = client.ClientData.RoleName;
            }

            // 必须先添加,以防夫妻重复举行婚宴。。。想不通为什么找我
            MarryPartyData partyData = m_MarryPartyDataCache.AddParty(client.ClientData.RoleID, partyType, startTime, husbandRoleID, wifeRoleID, husbandName, wifeName);

            if (partyData == null)
            {
                return(MarryPartyResult.AlreadyRequest);
            }

            MarryPartyResult result = MarryPartyResult.Success;

            byte[] byteData = null;
            TCPProcessCmdResults dbResult =
                Global.RequestToDBServer3(Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool,
                                          (int)TCPGameServerCmds.CMD_DB_MARRY_PARTY_ADD,
                                          string.Format("{0}:{1}:{2}:{3}:{4}:{5}:{6}", client.ClientData.RoleID, partyType, startTime, husbandRoleID, wifeRoleID, husbandName, wifeName),
                                          out byteData,
                                          client.ServerId
                                          );

            if (TCPProcessCmdResults.RESULT_FAILED == dbResult || null == byteData || byteData.Length <= 6)
            {
                result = MarryPartyResult.AlreadyRequest;
            }

            if (result == MarryPartyResult.Success)
            {
                // 检查举办所需金币是否足够
                if (configData.PartyCost > Global.GetTotalBindTongQianAndTongQianVal(client))
                {
                    result = MarryPartyResult.NotEnoughMoney;
                }
                if (configData.PartyCost > 0)
                {
                    // 扣除举办所需金币
                    if (Global.SubBindTongQianAndTongQian(client, configData.PartyCost, "举办婚宴") == false)
                    {
                        result = MarryPartyResult.NotEnoughMoney;
                    }
                }
            }

            if (result != MarryPartyResult.Success)
            {
                if (dbResult != TCPProcessCmdResults.RESULT_FAILED)
                {
                    try
                    {
                        Global.SendAndRecvData((int)TCPGameServerCmds.CMD_DB_MARRY_PARTY_REMOVE,
                                               string.Format("{0}", client.ClientData.RoleID),
                                               client.ServerId
                                               );
                    }
                    catch (Exception)
                    {
                    }
                }
                m_MarryPartyDataCache.RemoveParty(client.ClientData.RoleID);
                return(result);
            }

            Int32          length      = BitConverter.ToInt32(byteData, 0);
            MarryPartyData dbPartyData = DataHelper.BytesToObject <MarryPartyData>(byteData, 6, length - 2);

            m_MarryPartyDataCache.SetPartyTime(partyData, dbPartyData.StartTime);

            SendMarryPartyList(client, partyData);

            //lock (MarryPartyNPCShowMutex)
            //{
            //    if (MarryPartyNPCShow == false)
            //    {
            //        // TODO: add npc
            //        MarryPartyNPCShow = true;
            //    }
            //}

            return(result);
        }
コード例 #27
0
        public static string GetRoleName(int roleID)
        {
            RoleDataEx roleDataEx = MarryLogic.GetOfflineRoleData(roleID);

            return((roleDataEx != null) ? roleDataEx.RoleName : "");
        }
コード例 #28
0
        public static void initialize()
        {
#if BetaConfig
            int round = 9;
            Console.WriteLine("连接调试器或按任意键继续");
            do
            {
                Console.Write("\b\b" + round);
                if (Console.KeyAvailable)
                {
                    break;
                }
                Thread.Sleep(1000);
            } while (--round > 0);
            Console.Write("\b\b");
#endif
            //战盟事件管理器
            ZhanMengShiJianManager.getInstance().initialize();

            //竞技场管理器
            JingJiChangManager.getInstance().initialize();

            //离线摆摊
            LiXianBaiTanManager.getInstance().initialize();

            //离线挂机
            LiXianGuaJiManager.getInstance().initialize();

            //副本活动组队管理器
            CopyTeamManager.Instance().initialize();

            //指令注册管理器
            CmdRegisterTriggerManager.getInstance().initialize();

            //发送指令管理
            SendCmdManager.getInstance().initialize();

            //Boss AI管理器
            BossAIManager.getInstance().initialize();

            //洗炼管理器
            WashPropsManager.initialize();

            //MU交易所
            SaleManager.getInstance().initialize();

            //炼制系统
            LianZhiManager.GetInstance().initialize();

            // 成就升级
            ChengJiuManager.GetInstance().initialize();

            //声望勋章
            PrestigeMedalManager.getInstance().initialize();

            UnionPalaceManager.getInstance().initialize();
            UserActivateManager.getInstance().initialize();

            PetSkillManager.getInstance().initialize();

            //玩家召回
            UserReturnManager.getInstance().initialize();

            //天赋
            TalentManager.getInstance().initialize();

            //每日专享
            TodayManager.getInstance().initialize();

            FundManager.getInstance().initialize();

            //警告
            WarnManager.getInstance().initialize();

            //恶魔来袭
            EMoLaiXiCopySceneManager.LoadEMoLaiXiCopySceneInfo();

            //罗兰法阵副本
            LuoLanFaZhenCopySceneManager.initialize();

            //情侣副本管理器
            MarryFuBenMgr.getInstance().initialize();
            MarryLogic.LoadMarryBaseConfig();
            MarryPartyLogic.getInstance().LoadMarryPartyConfig();

            //领地
            BuildingManager.getInstance().initialize();

            // 藏宝秘境
            OnePieceManager.getInstance().initialize();

            //初始化跨服相关管理器
            RegisterManager4Scene((int)SceneUIClasses.Normal, KuaFuManager.getInstance());
            // RegisterManager4Scene((int)SceneUIClasses.LangHunLingYu, LangHunLingYuManager.getInstance());

            //注册罗兰城战管理器
            RegisterManager4Scene((int)SceneUIClasses.LuoLanChengZhan, LuoLanChengZhanManager.getInstance());
            RegisterManager4Scene((int)SceneUIClasses.Normal, FashionManager.getInstance());
            RegisterManager4Scene((int)SceneUIClasses.HuanYingSiYuan, HuanYingSiYuanManager.getInstance());
            RegisterManager4Scene((int)ManagerTypes.ClientGoodsList, JingLingQiYuanManager.getInstance());
            RegisterManager4Scene((int)SceneUIClasses.TianTi, TianTiManager.getInstance());
            RegisterManager4Scene((int)SceneUIClasses.YongZheZhanChang, YongZheZhanChangManager.getInstance());
            RegisterManager4Scene((int)SceneUIClasses.KingOfBattle, KingOfBattleManager.getInstance());
            RegisterManager4Scene((int)SceneUIClasses.MoRiJudge, MoRiJudgeManager.Instance());
            RegisterManager4Scene((int)SceneUIClasses.ElementWar, ElementWarManager.getInstance());
            RegisterManager4Scene((int)SceneUIClasses.CopyWolf, CopyWolfManager.getInstance());
            RegisterManager4Scene((int)SceneUIClasses.KuaFuBoss, KuaFuBossManager.getInstance());
            RegisterManager4Scene((int)SceneUIClasses.KuaFuMap, KuaFuMapManager.getInstance());
            RegisterManager4Scene((int)SceneUIClasses.Spread, SpreadManager.getInstance());
            RegisterManager4Scene((int)SceneUIClasses.KFZhengBa, ZhengBaManager.Instance());
            RegisterManager4Scene((int)SceneUIClasses.CoupleArena, CoupleArenaManager.Instance());
            RegisterManager4Scene((int)SceneUIClasses.Ally, AllyManager.getInstance());
            RegisterManager4Scene((int)SceneUIClasses.CoupleWish, CoupleWishManager.Instance());

            // 读取外挂列表和相关配置
            RobotTaskValidator.getInstance().Initialize(false, 0, 0, "");

            //初始化圣物系统相关配置
            HolyItemManager.getInstance().Initialize();

            //初始化塔罗牌相关配置
            TarotManager.getInstance().Initialize();

            // 七日活动
            SevenDayActivityMgr.Instance().initialize();

            // 魂石
            SoulStoneManager.Instance().initialize();

            TradeBlackManager.Instance().LoadConfig();
            //调用所有注册的管理模块的初始化函数
            lock (Scene2ManagerDict)
            {
                foreach (var list in Scene2ManagerDict.Values)
                {
                    foreach (var m in list)
                    {
                        bool      success = m.initialize();
                        IManager2 m2      = m as IManager2;
                        if (null != m2)
                        {
                            success = success && m2.initialize(GameCoreInterface.getinstance());
                        }

                        if (GameManager.ServerStarting && !success)
                        {
                            LogManager.WriteLog(LogTypes.Fatal, string.Format("执行{0}.initialize()失败,按任意键继续启动!", m.GetType()));
                            //Console.ReadKey(); HX_SERVER close the copy scenes;
                        }
                    }
                }
            }

            //应用宝
            TenManager.getInstance().initialize();
            TenRetutnManager.getInstance().initialize();

            //礼包码
            GiftCodeNewManager.getInstance().initialize();
        }
コード例 #29
0
        public static void initialize()
        {
            ZhanMengShiJianManager.getInstance().initialize();
            JingJiChangManager.getInstance().initialize();
            LiXianBaiTanManager.getInstance().initialize();
            LiXianGuaJiManager.getInstance().initialize();
            CmdRegisterTriggerManager.getInstance().initialize();
            SendCmdManager.getInstance().initialize();
            BossAIManager.getInstance().initialize();
            WashPropsManager.initialize();
            SaleManager.getInstance().initialize();
            LianZhiManager.GetInstance().initialize();
            ChengJiuManager.GetInstance().initialize();
            PrestigeMedalManager.getInstance().initialize();
            UnionPalaceManager.getInstance().initialize();
            UserActivateManager.getInstance().initialize();
            PetSkillManager.getInstance().initialize();
            UserReturnManager.getInstance().initialize();
            OlympicsManager.getInstance().initialize();
            TalentManager.getInstance().initialize();
            TodayManager.getInstance().initialize();
            FundManager.getInstance().initialize();
            WarnManager.getInstance().initialize();
            EMoLaiXiCopySceneManager.LoadEMoLaiXiCopySceneInfo();
            LuoLanFaZhenCopySceneManager.initialize();
            MarryFuBenMgr.getInstance().initialize();
            MarryLogic.LoadMarryBaseConfig();
            MarryPartyLogic.getInstance().LoadMarryPartyConfig();
            BuildingManager.getInstance().initialize();
            OnePieceManager.getInstance().initialize();
            GlobalServiceManager.RegisterManager4Scene(0, SingletonTemplate <CopyTeamManager> .Instance());
            GlobalServiceManager.RegisterManager4Scene(0, KuaFuManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(35, LangHunLingYuManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(0, RebornManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(0, RebornBoss.getInstance());
            GlobalServiceManager.RegisterManager4Scene(24, LuoLanChengZhanManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(0, FashionManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(0, OrnamentManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(0, ShenJiFuWenManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(0, YaoSaiJianYuManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(0, AlchemyManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(0, EraManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(0, VideoLogic.getInstance());
            GlobalServiceManager.RegisterManager4Scene(0, SpecPlatFuLiManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(25, HuanYingSiYuanManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(10000, JingLingQiYuanManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(26, TianTiManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(27, YongZheZhanChangManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(39, KingOfBattleManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(45, BangHuiMatchManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(48, CompManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(52, CompBattleManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(53, CompMineManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(57, ZorkBattleManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(47, KuaFuLueDuoManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(0, KarenBattleManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(41, KarenBattleManager_MapWest.getInstance());
            GlobalServiceManager.RegisterManager4Scene(42, KarenBattleManager_MapEast.getInstance());
            GlobalServiceManager.RegisterManager4Scene(29, SingletonTemplate <MoRiJudgeManager> .Instance());
            GlobalServiceManager.RegisterManager4Scene(28, ElementWarManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(49, WanMoXiaGuManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(34, CopyWolfManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(31, KuaFuBossManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(10003, KuaFuMapManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(10002, SpreadManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(36, SingletonTemplate <ZhengBaManager> .Instance());
            GlobalServiceManager.RegisterManager4Scene(38, SingletonTemplate <CoupleArenaManager> .Instance());
            GlobalServiceManager.RegisterManager4Scene(10004, AllyManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(10005, SingletonTemplate <CoupleWishManager> .Instance());
            GlobalServiceManager.RegisterManager4Scene(40, ZhengDuoManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(0, AoYunDaTiManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(0, RoleManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(0, ZhuanPanManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(0, ShenQiManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(0, JunTuanManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(0, LingDiCaiJiManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(0, HongBaoManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(0, YaoSaiBossManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(0, YaoSaiMissionManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(0, HuiJiManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(0, DeControl.getInstance());
            GlobalServiceManager.RegisterManager4Scene(0, GVoiceManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(0, ShenShiManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(0, JueXingManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(0, ZuoQiManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(0, ThemeBoss.getInstance());
            GlobalServiceManager.RegisterManager4Scene(0, ArmorManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(0, JingLingYuanSuJueXingManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(0, BianShenManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(55, TianTi5v5Manager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(0, UserRegressActiveManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(0, MountHolyStampManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(0, MazingerStoreManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(0, GlodAuctionProcessCmdEx.getInstance());
            GlobalServiceManager.RegisterManager4Scene(0, BoCaiManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(0, FunctionSendManager.GetInstance());
            GlobalServiceManager.RegisterManager4Scene(0, HuanLeDaiBiManager.GetInstance());
            GlobalServiceManager.RegisterManager4Scene(0, NewTimerProc.GetInstance());
            GlobalServiceManager.RegisterManager4Scene(56, ZhanDuiZhengBaManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(59, EscapeBattleManager.getInstance());
            GlobalServiceManager.RegisterManager4Scene(0, TestReceiveModel.getInstance());
            RobotTaskValidator.getInstance().Initialize(false, 0, 0, "");
            HolyItemManager.getInstance().Initialize();
            TarotManager.getInstance().Initialize();
            SingletonTemplate <SevenDayActivityMgr> .Instance().initialize();

            SingletonTemplate <SoulStoneManager> .Instance().initialize();

            SingletonTemplate <TradeBlackManager> .Instance().LoadConfig();

            lock (GlobalServiceManager.Scene2ManagerDict)
            {
                foreach (List <IManager> list in GlobalServiceManager.Scene2ManagerDict.Values)
                {
                    foreach (IManager i in list)
                    {
                        bool success = true;
                        try
                        {
                            success = (success && i.initialize());
                            IManager2 m2 = i as IManager2;
                            if (null != m2)
                            {
                                success = (success && m2.initialize(GameCoreInterface.getinstance()));
                            }
                        }
                        catch (Exception ex)
                        {
                            success = false;
                            LogManager.WriteException(ex.ToString());
                        }
                        if (GameManager.ServerStarting && !success)
                        {
                            LogManager.WriteLog(LogTypes.Fatal, string.Format("执行{0}.initialize()失败,按任意键继续启动!", i.GetType()), null, true);
                            Console.ReadKey();
                        }
                    }
                }
            }
            TenManager.getInstance().initialize();
            TenRetutnManager.getInstance().initialize();
            GiftCodeNewManager.getInstance().initialize();
            FaceBookManager.getInstance().initialize();
            AssemblyPatchManager.getInstance().initialize();
            IPStatisticsManager.getInstance().initialize();
            FuMoManager.getInstance().Initialize();
        }
コード例 #30
0
ファイル: MarryOtherLogic.cs プロジェクト: chenchungit/ky
        /// <summary>
        /// 提升奉献值
        /// </summary>
        public void UpdateMarriageGoodWill(GameClient client, int addGoodwillValue)
        {
            //功能未开启
            if (!MarryLogic.IsVersionSystemOpenOfMarriage())
            {
                return;
            }

            //看看是不是情侣
            if (client.ClientData.MyMarriageData.byMarrytype == -1)
            {
                return;
            }

            //不加也不减直接无视吧
            if (addGoodwillValue == 0)
            {
                return;
            }

            sbyte tmpGoodwilllv   = client.ClientData.MyMarriageData.byGoodwilllevel;
            sbyte tmpGoodwillstar = client.ClientData.MyMarriageData.byGoodwillstar;

            //加值前先检查当前阶级是否已达上限 到达上限不加
            if (tmpGoodwilllv == byMaxGoodwillLv &&
                tmpGoodwillstar == byMaxGoodwillStar)
            {
                return;
            }

            //加值
            client.ClientData.MyMarriageData.nGoodwillexp += addGoodwillValue;

            //用当前经验值增加上该阶级和星级应该有的经验
            int nNowLvAddExp = GoodwillAllExpList[(tmpGoodwilllv - 1) * byMaxGoodwillStar + tmpGoodwillstar];

            client.ClientData.MyMarriageData.nGoodwillexp += nNowLvAddExp;

            bool bUpdateLv   = false;
            bool bUpdateStar = false;

            //看看当前经验达到哪一级 直接设上去
            for (int i = 1; i < GoodwillAllExpList.Count; ++i)
            {
                //超过最后一项表示满级满星了
                if (i == GoodwillAllExpList.Count - 1 && client.ClientData.MyMarriageData.nGoodwillexp >= GoodwillAllExpList[i])
                {
                    client.ClientData.MyMarriageData.byGoodwilllevel = byMaxGoodwillLv;
                    client.ClientData.MyMarriageData.byGoodwillstar  = byMaxGoodwillStar;

                    bUpdateStar = true;

                    //设定到最大经验
                    client.ClientData.MyMarriageData.nGoodwillexp = GoodwillAllExpList[i] - GoodwillAllExpList[i - 1];
                }
                else if (client.ClientData.MyMarriageData.nGoodwillexp < GoodwillAllExpList[i])
                {
                    int nLv   = 0;
                    int nStar = 0;

                    //1阶情况
                    if (i <= byMaxGoodwillStar + 1)
                    {
                        nLv   = 1;
                        nStar = i - 1;
                    }
                    else
                    {
                        nLv   = (i - 2) / byMaxGoodwillStar + 1;
                        nStar = (i - 1) % byMaxGoodwillStar;
                        if (nStar == 0)
                        {
                            nStar = 10;
                        }
                    }

                    if (nLv != tmpGoodwilllv)
                    {
                        bUpdateLv = true;
                    }
                    if (nStar != tmpGoodwillstar)
                    {
                        bUpdateStar = true;
                    }

                    client.ClientData.MyMarriageData.byGoodwilllevel = (sbyte)nLv;
                    client.ClientData.MyMarriageData.byGoodwillstar  = (sbyte)nStar;

                    //发送客户端和记录数据库时清掉多余的经验部分 例如66点经验 - 当前阶级总共60点经验后剩 6 记录数据
                    client.ClientData.MyMarriageData.nGoodwillexp -= GoodwillAllExpList[i - 1];

                    break;
                }
            }

            //[bing] 更新时间
            if (true == bUpdateLv || true == bUpdateStar)
            {
                client.ClientData.MyMarriageData.ChangTime = TimeUtil.NowDateTime().ToString("yyyy-MM-dd HH:mm:ss");
            }

            //发送给DB update数据
            MarryFuBenMgr.UpdateMarriageData2DB(client);

            //更新婚戒属性
            if (true == bUpdateLv || true == bUpdateStar)
            {
                UpdateRingAttr(client, true);
            }

            //发送给客户端更新数据
            SendMarriageDataToClient(client, (true == bUpdateLv || true == bUpdateStar));

            if (true == bUpdateLv)
            {
                //[bing] 刷新客户端活动叹号
                if (client._IconStateMgr.CheckJieRiFanLi(client, ActivityTypes.JieriMarriage) == true ||
                    client._IconStateMgr.CheckSpecialActivity(client))
                {
                    client._IconStateMgr.AddFlushIconState((ushort)ActivityTipTypes.JieRiActivity, client._IconStateMgr.IsAnyJieRiTipActived());
                    client._IconStateMgr.SendIconStateToClient(client);
                }
            }

            if (addGoodwillValue > 0)
            {
                string strHint = StringUtil.substitute(Global.GetLang("你获得了:{0}点奉献度"), addGoodwillValue);
                GameManager.ClientMgr.NotifyImportantMsg(client, strHint, GameInfoTypeIndexes.Normal, ShowGameInfoTypes.PiaoFuZi);
            }
        }