コード例 #1
0
 public void AddGuildCopyMapDB(GuildCopyMapDB data)
 {
     if (!this.GuildCopyMapDBDict.ContainsKey(data.GuildID))
     {
         this.GuildCopyMapDBDict[data.GuildID] = data;
     }
 }
コード例 #2
0
ファイル: GuildCopyMapManager.cs プロジェクト: chenchungit/ky
        /// <summary>
        /// 更新帮会信息,先向数据库提交更新申请,后更新缓存
        /// </summary>
        public bool UpdateGuildCopyMapDB(GuildCopyMapDB data, int serverId)
        {
            // 查找现有信息 如果存在直接返回
            GuildCopyMapDB oldData = FindGuildCopyMapDB(data.GuildID, serverId);

            if (null == oldData)
            {
                LogManager.WriteLog(LogTypes.Error, string.Format("GuildCopyMapDBManager::UpdateGuildCopyMapDB null == oldData data.GuildID={0}", data.GuildID));
                return(false);
            }

            lock (GuildCopyMapDBDict)
            {
                // 向DB提申请
                string[]             dbFields        = null;
                string               strDbCmd        = string.Format("{0}:{1}:{2}:{3}:{4}", data.GuildID, data.FuBenID, data.State, data.OpenDay, data.Killers);
                TCPProcessCmdResults dbRequestResult = Global.RequestToDBServer(Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool
                                                                                , (int)TCPGameServerCmds.CMD_DB_UPDATEBANGHUIFUBEN, strDbCmd, out dbFields, serverId);
                if (dbRequestResult == TCPProcessCmdResults.RESULT_FAILED)
                {
                    LogManager.WriteLog(LogTypes.Error, string.Format("GuildCopyMapDBManager::ResetGuildCopyMapDB dbRequestResult == TCPProcessCmdResults.RESULT_FAILED strDbCmd={0}", strDbCmd));
                    return(false);
                }
                if (dbFields.Length < 1 || Convert.ToInt32(dbFields[0]) != 1)
                {
                    LogManager.WriteLog(LogTypes.Error, string.Format("GuildCopyMapDBManager::ResetGuildCopyMapDB 参数数量错误或失败 strDbCmd={0}, dbFields.Length={1}", strDbCmd, dbFields.Length));
                    return(false);
                }

                GuildCopyMapDBDict[data.GuildID] = data;
            }
            return(true);
        }
コード例 #3
0
        public GuildCopyMapDB FindGuildCopyMapDB(int guildid, int serverId)
        {
            GuildCopyMapDB result;

            if (guildid <= 0)
            {
                result = null;
            }
            else
            {
                GuildCopyMapDB data = null;
                lock (this.GuildCopyMapDBDict)
                {
                    if (this.GuildCopyMapDBDict.ContainsKey(guildid))
                    {
                        data = this.GuildCopyMapDBDict[guildid];
                    }
                    else
                    {
                        string[]             dbFields        = null;
                        string               strDbCmd        = string.Format("{0}", guildid);
                        TCPProcessCmdResults dbRequestResult = Global.RequestToDBServer(Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, 711, strDbCmd, out dbFields, serverId);
                        if (dbRequestResult == TCPProcessCmdResults.RESULT_FAILED)
                        {
                            LogManager.WriteLog(LogTypes.Error, string.Format("GuildCopyMapDBManager::FindGuildCopyMapDB dbRequestResult == TCPProcessCmdResults.RESULT_FAILED strDbCmd={0}", strDbCmd), null, true);
                            return(null);
                        }
                        if (dbFields.Length < 5 || Convert.ToInt32(dbFields[0]) <= 0)
                        {
                            LogManager.WriteLog(LogTypes.Error, string.Format("GuildCopyMapDBManager::FindGuildCopyMapDB 参数数量错误或失败 strDbCmd={0}, dbFields.Length={1}", strDbCmd, dbFields.Length), null, true);
                            return(null);
                        }
                        try
                        {
                            data = new GuildCopyMapDB
                            {
                                GuildID = Convert.ToInt32(dbFields[0]),
                                FuBenID = Convert.ToInt32(dbFields[1]),
                                State   = Convert.ToInt32(dbFields[2]),
                                OpenDay = Convert.ToInt32(dbFields[3]),
                                Killers = dbFields[4]
                            };
                            this.AddGuildCopyMapDB(data);
                            if (guildid != Convert.ToInt32(dbFields[0]))
                            {
                                LogManager.WriteLog(LogTypes.Error, string.Format("GuildCopyMapDBManager::FindGuildCopyMapDB DB返回的id不符,guildid={0}, dbFields[0]={1}", guildid, Convert.ToInt32(dbFields[0])), null, true);
                                return(null);
                            }
                        }
                        catch (Exception)
                        {
                            LogManager.WriteLog(LogTypes.Error, string.Format("GuildCopyMapDBManager::FindGuildCopyMapDB参数解析失败?", new object[0]), null, true);
                            return(null);
                        }
                    }
                }
                result = data;
            }
            return(result);
        }
コード例 #4
0
ファイル: GuildCopyMapManager.cs プロジェクト: chenchungit/ky
        /*public void RemoveGuildCopyMapDB(int guildid)
         * {
         *  //
         *  GuildCopyMapDBDict.Remove(guildid);
         * }*/

        /// <summary>
        /// 从数据库加载后增加到帮会缓存
        /// 更新信息请使用Update,防止出现没有保存的情况
        /// </summary>
        public void AddGuildCopyMapDB(GuildCopyMapDB data)
        {
            if (GuildCopyMapDBDict.ContainsKey(data.GuildID))
            {
                return;
            }
            GuildCopyMapDBDict[data.GuildID] = data;
        }
コード例 #5
0
ファイル: GuildCopyMapManager.cs プロジェクト: chenchungit/ky
        /// <summary>
        /// 重置副本信息
        /// </summary>
        public void ResetGuildCopyMapDB(int guildid, int serverId)
        {
            GuildCopyMapDB data = new GuildCopyMapDB()
            {
                GuildID = guildid,
                FuBenID = GameManager.GuildCopyMapMgr.FirstGuildCopyMapOrder,
                State   = (int)GuildCopyMapState.NotOpen,
                OpenDay = Global.GetOffsetDay(TimeUtil.NowDateTime()),
                Killers = "",
            };

            UpdateGuildCopyMapDB(data, serverId);
        }
コード例 #6
0
        public void CheckCurrGuildCopyMap(GameClient client, out int fubenid, out int seqid, int mapcode)
        {
            fubenid = -1;
            seqid   = -1;
            int            guildid = client.ClientData.Faction;
            GuildCopyMapDB data    = GameManager.GuildCopyMapDBMgr.FindGuildCopyMapDB(guildid, client.ServerId);

            if (null != data)
            {
                DateTime openTime = Global.GetRealDate(data.OpenDay);
                if (Global.BeginOfWeek(openTime) != Global.BeginOfWeek(TimeUtil.NowDateTime()))
                {
                    GameManager.GuildCopyMapDBMgr.ResetGuildCopyMapDB(guildid, client.ServerId);
                    fubenid = this.FirstGuildCopyMapOrder;
                }
                else if (data.FuBenID >= this.LastGuildCopyMapOrder && data.State == 2)
                {
                    fubenid = 0;
                }
                else if (data.State == 2)
                {
                    data.FuBenID = this.GetNextGuildCopyMapIndex(data.FuBenID);
                    data.State   = 0;
                    data.OpenDay = Global.GetOffsetDay(TimeUtil.NowDateTime());
                    if (GameManager.GuildCopyMapDBMgr.UpdateGuildCopyMapDB(data, client.ServerId))
                    {
                        fubenid = data.FuBenID;
                    }
                    this.UpdateGuildCopyMap(guildid, fubenid, -1, -1);
                }
                else
                {
                    fubenid = data.FuBenID;
                    GuildCopyMap CopyMap = this.FindGuildCopyMap(guildid);
                    if (null != CopyMap)
                    {
                        seqid = CopyMap.SeqID;
                    }
                }
            }
        }
コード例 #7
0
        public bool UpdateGuildCopyMapDB(GuildCopyMapDB data, int serverId)
        {
            GuildCopyMapDB oldData = this.FindGuildCopyMapDB(data.GuildID, serverId);
            bool           result;

            if (null == oldData)
            {
                LogManager.WriteLog(LogTypes.Error, string.Format("GuildCopyMapDBManager::UpdateGuildCopyMapDB null == oldData data.GuildID={0}", data.GuildID), null, true);
                result = false;
            }
            else
            {
                lock (this.GuildCopyMapDBDict)
                {
                    string[] dbFields = null;
                    string   strDbCmd = string.Format("{0}:{1}:{2}:{3}:{4}", new object[]
                    {
                        data.GuildID,
                        data.FuBenID,
                        data.State,
                        data.OpenDay,
                        data.Killers
                    });
                    TCPProcessCmdResults dbRequestResult = Global.RequestToDBServer(Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, 10172, strDbCmd, out dbFields, serverId);
                    if (dbRequestResult == TCPProcessCmdResults.RESULT_FAILED)
                    {
                        LogManager.WriteLog(LogTypes.Error, string.Format("GuildCopyMapDBManager::ResetGuildCopyMapDB dbRequestResult == TCPProcessCmdResults.RESULT_FAILED strDbCmd={0}", strDbCmd), null, true);
                        return(false);
                    }
                    if (dbFields.Length < 1 || Convert.ToInt32(dbFields[0]) != 1)
                    {
                        LogManager.WriteLog(LogTypes.Error, string.Format("GuildCopyMapDBManager::ResetGuildCopyMapDB 参数数量错误或失败 strDbCmd={0}, dbFields.Length={1}", strDbCmd, dbFields.Length), null, true);
                        return(false);
                    }
                    this.GuildCopyMapDBDict[data.GuildID] = data;
                }
                result = true;
            }
            return(result);
        }
コード例 #8
0
ファイル: GuildCopyMapManager.cs プロジェクト: chenchungit/ky
        /// <summary>
        /// 根据帮会id查找帮会副本信息
        /// </summary>
        public GuildCopyMapDB FindGuildCopyMapDB(int guildid, int serverId)
        {
            if (guildid <= 0)
            {
                return(null);
            }

            GuildCopyMapDB data = null;

            lock (GuildCopyMapDBDict)
            {
                // 先在缓存里查找
                if (GuildCopyMapDBDict.ContainsKey(guildid))
                {
                    data = GuildCopyMapDBDict[guildid];
                }
                // 缓存里没有就去数据库申请
                else
                {
                    // 去db要数据
                    string[]             dbFields        = null;
                    string               strDbCmd        = string.Format("{0}", guildid);
                    TCPProcessCmdResults dbRequestResult = Global.RequestToDBServer(Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool
                                                                                    , (int)TCPGameServerCmds.CMD_SPR_GETBANGHUIFUBEN, strDbCmd, out dbFields, serverId);
                    if (dbRequestResult == TCPProcessCmdResults.RESULT_FAILED)
                    {
                        LogManager.WriteLog(LogTypes.Error, string.Format("GuildCopyMapDBManager::FindGuildCopyMapDB dbRequestResult == TCPProcessCmdResults.RESULT_FAILED strDbCmd={0}", strDbCmd));
                        return(null);
                    }

                    if (dbFields.Length < 5 || Convert.ToInt32(dbFields[0]) <= 0)
                    {
                        LogManager.WriteLog(LogTypes.Error, string.Format("GuildCopyMapDBManager::FindGuildCopyMapDB 参数数量错误或失败 strDbCmd={0}, dbFields.Length={1}", strDbCmd, dbFields.Length));
                        return(null);
                    }

                    try
                    {
                        data = new GuildCopyMapDB()
                        {
                            GuildID = Convert.ToInt32(dbFields[0]),
                            FuBenID = Convert.ToInt32(dbFields[1]),
                            State   = Convert.ToInt32(dbFields[2]),
                            OpenDay = Convert.ToInt32(dbFields[3]),
                            Killers = dbFields[4],
                        };

                        // 加入缓存
                        AddGuildCopyMapDB(data);

                        if (guildid != Convert.ToInt32(dbFields[0]))
                        {
                            LogManager.WriteLog(LogTypes.Error, string.Format("GuildCopyMapDBManager::FindGuildCopyMapDB DB返回的id不符,guildid={0}, dbFields[0]={1}", guildid, Convert.ToInt32(dbFields[0])));
                            return(null);
                        }
                    }

                    catch (Exception)
                    {
                        LogManager.WriteLog(LogTypes.Error, string.Format("GuildCopyMapDBManager::FindGuildCopyMapDB参数解析失败?"));
                        return(null);
                    }
                }
            }

            return(data);
        }
コード例 #9
0
ファイル: GuildCopyMapManager.cs プロジェクト: chenchungit/ky
        /// <summary>
        /// 检查死亡的怪物是否为帮会副本boss并进行通关处理
        /// </summary>
        public void ProcessMonsterDead(GameClient client, Monster monster)
        {
            // 怪物所在场景不是帮会地图
            if (IsGuildCopyMap(monster.CurrentMapCode) == false)
            {
                return;
            }

            SystemXmlItem systemFuBenItem = null;

            if (!GameManager.systemFuBenMgr.SystemXmlItemDict.TryGetValue(monster.CurrentMapCode, out systemFuBenItem))
            {
                return;
            }

            if (null == systemFuBenItem)
            {
                return;
            }

            int nBossID = systemFuBenItem.GetIntValue("BossID");

#if ___CC___FUCK___YOU___BB___
            // 不是boss
            if (nBossID != monster.XMonsterInfo.MonsterId)
            {
                return;
            }
#else
            // 不是boss
            if (nBossID != monster.MonsterInfo.ExtensionID)
            {
                return;
            }
#endif
            // 没有对应副本?
            CopyMap copyMap = GameManager.CopyMapMgr.FindCopyMap(monster.CurrentCopyMapID);
            if (null == copyMap)
            {
                LogManager.WriteLog(LogTypes.Error, string.Format("GuildCopyMapManager::ProcessMonsterDead (null == copyMap), CurrentCopyMapID={0}", monster.CurrentCopyMapID));
                return;
            }

            GuildCopyMap mapData = GameManager.GuildCopyMapMgr.FindGuildCopyMapBySeqID(copyMap.FuBenSeqID);
            if (null == mapData)
            {
                LogManager.WriteLog(LogTypes.Error, string.Format("GuildCopyMapManager::ProcessMonsterDead (null == mapData), copyMap.FuBenSeqID={0}", copyMap.FuBenSeqID));
                return;
            }
            int guildid = mapData.GuildID;

            // 玩家没有帮会?
            GuildCopyMapDB data = GameManager.GuildCopyMapDBMgr.FindGuildCopyMapDB(guildid /*client.ClientData.Faction*//*不再用击杀者的帮会id*/, client.ServerId);
            if (null == data)
            {
                LogManager.WriteLog(LogTypes.Error, string.Format("GuildCopyMapManager::ProcessMonsterDead (null == data), guildid={0}", client.ClientData.Faction));
                return;
            }

            List <GameClient> objsList = copyMap.GetClientsList();
            // 副本里没人?
            if (null == objsList || objsList.Count <= 0)
            {
                LogManager.WriteLog(LogTypes.Error, string.Format("GuildCopyMapManager::ProcessMonsterDead (null == objsList || objsList.Count <= 0), CurrentCopyMapID={0}", monster.CurrentCopyMapID));
                return;
            }

            // 更新副本记录的状态
            if (copyMap.FubenMapID >= data.FuBenID)
            {
                data.FuBenID = copyMap.FubenMapID;
                data.State   = (int)GuildCopyMapState.Passed;
                if (copyMap.FubenMapID == GameManager.GuildCopyMapMgr.FirstGuildCopyMapOrder)
                {
                    data.Killers = monster.WhoKillMeName;
                }
                else
                {
                    data.Killers += ",";
                    data.Killers += monster.WhoKillMeName;
                }
            }
#if ___CC___FUCK___YOU___BB___
            //触发战盟事件
            GlobalEventSource.getInstance().fireEvent(ZhanMengShijianEvent.createKillBossEvent(Global.FormatRoleName4(client), client.ClientData.Faction,
                                                                                               monster.XMonsterInfo.MonsterId, client.ServerId));
#else
            //触发战盟事件
            GlobalEventSource.getInstance().fireEvent(ZhanMengShijianEvent.createKillBossEvent(Global.FormatRoleName4(client), client.ClientData.Faction,
                                                                                               monster.MonsterInfo.ExtensionID, client.ServerId));
#endif
            // 检查是否更新成功
            bool result = GameManager.GuildCopyMapDBMgr.UpdateGuildCopyMapDB(data, client.ServerId);
            if (false == result)
            {
                string logStr = @"GuildCopyMapManager::ProcessMonsterDead (false == result), 
                        data.GuildID={0}, data.FuBenID={1}, data.State={2}, data.OpenDay={3}, data.Killers={4}";
                LogManager.WriteLog(LogTypes.Error, string.Format(logStr, data.GuildID, data.FuBenID, data.State, data.OpenDay, data.Killers));
                return;
            }
        }
コード例 #10
0
ファイル: GuildCopyMapManager.cs プロジェクト: chenchungit/ky
        /// <summary>
        /// 检查帮会副本的数据库状态,找到应该进入的副本id,副本流水id,副本code
        /// fubenid = 0 表示本周的副本全通关了
        /// fubenid = -1 表示在调用之前应该先判断玩家是否有帮会
        /// </summary>
        public void CheckCurrGuildCopyMap(GameClient client, out int fubenid, out int seqid, int mapcode)
        {
            fubenid = -1;
            seqid   = -1;
            mapcode = -1;
            int guildid = client.ClientData.Faction;

            GuildCopyMapDB data = GameManager.GuildCopyMapDBMgr.FindGuildCopyMapDB(guildid, client.ServerId);

            // 没有帮会 否则不应该为空
            if (null == data)
            {
                return;
            }

            // 开始时间不是本周
            DateTime openTime = Global.GetRealDate(data.OpenDay);

            if (Global.BeginOfWeek(openTime) != Global.BeginOfWeek(TimeUtil.NowDateTime()))
            {
                // 重置数据库信息 并使用第一个副本id 让玩家重新开始
                GameManager.GuildCopyMapDBMgr.ResetGuildCopyMapDB(guildid, client.ServerId);
                fubenid = FirstGuildCopyMapOrder;
                return;
            }

            // 到达最后一关并且已经通了
            if (data.FuBenID >= LastGuildCopyMapOrder && data.State == (int)GuildCopyMapState.Passed)
            {
                fubenid = 0;
                return;
            }

            // 已经通关
            if (data.State == (int)GuildCopyMapState.Passed)
            {
                // 更新数据库
                data.FuBenID = GetNextGuildCopyMapIndex(data.FuBenID);
                data.State   = (int)GuildCopyMapState.NotOpen;
                data.OpenDay = Global.GetOffsetDay(TimeUtil.NowDateTime());

                if (GameManager.GuildCopyMapDBMgr.UpdateGuildCopyMapDB(data, client.ServerId))
                {
                    fubenid = data.FuBenID;
                }
                UpdateGuildCopyMap(guildid, fubenid, -1, -1);
                return;
            }
            else
            {
                fubenid = data.FuBenID;
            }

            //if (!IsGuildCopyMap(newmapid))
            //    newmapid = FirstGuildCopyMapOrder;

            GuildCopyMap CopyMap = FindGuildCopyMap(guildid);

            if (null == CopyMap)
            {
                return;
            }

            seqid = CopyMap.SeqID;
        }
コード例 #11
0
        /// <summary>
        /// 检查死亡的怪物是否为帮会副本boss并进行通关处理
        /// </summary>
        public void ProcessMonsterDead(GameClient client, Monster monster)
        {
            // 怪物所在场景不是帮会地图
            if (IsGuildCopyMap(monster.CurrentMapCode) == false)
            {
                return;
            }

            SystemXmlItem systemFuBenItem = null;

            if (!GameManager.systemFuBenMgr.SystemXmlItemDict.TryGetValue(monster.CurrentMapCode, out systemFuBenItem))
            {
                return;
            }

            if (null == systemFuBenItem)
            {
                return;
            }

            int nBossID = systemFuBenItem.GetIntValue("BossID");

            // 不是boss
            if (nBossID != monster.MonsterInfo.ExtensionID)
            {
                return;
            }

            // 玩家没有帮会?
            GuildCopyMapDB data = GameManager.GuildCopyMapDBMgr.FindGuildCopyMapDB(client.ClientData.Faction);

            if (null == data)
            {
                LogManager.WriteLog(LogTypes.Error, string.Format("GuildCopyMapManager::ProcessMonsterDead (null == data), guildid={0}", client.ClientData.Faction));
                return;
            }

            // 没有对应副本?
            CopyMap copyMap = GameManager.CopyMapMgr.FindCopyMap(monster.CurrentCopyMapID);

            if (null == copyMap)
            {
                LogManager.WriteLog(LogTypes.Error, string.Format("GuildCopyMapManager::ProcessMonsterDead (null == copyMap), CurrentCopyMapID={0}", monster.CurrentCopyMapID));
                return;
            }

            // 没有奖励配置?
            FuBenMapItem fuBenMapItem = FuBenManager.FindMapCodeByFuBenID(copyMap.FubenMapID, copyMap.MapCode);

            if (null == fuBenMapItem)
            {
                LogManager.WriteLog(LogTypes.Error, string.Format("GuildCopyMapManager::ProcessMonsterDead (null == fuBenMapItem), CopyMapID={0}, MapCode={1}", copyMap.FubenMapID, copyMap.MapCode));
                return;
            }

            List <GameClient> objsList = copyMap.GetClientsList();

            // 副本里没人?
            if (null == objsList || objsList.Count <= 0)
            {
                LogManager.WriteLog(LogTypes.Error, string.Format("GuildCopyMapManager::ProcessMonsterDead (null == objsList || objsList.Count <= 0), CurrentCopyMapID={0}", monster.CurrentCopyMapID));
                return;
            }

            // 更新副本记录的状态
            if (copyMap.FubenMapID >= data.FuBenID)
            {
                data.FuBenID = copyMap.FubenMapID;
                data.State   = (int)GuildCopyMapState.Passed;
                if (copyMap.FubenMapID == GameManager.GuildCopyMapMgr.FirstGuildCopyMapOrder)
                {
                    data.Killers = monster.WhoKillMeName;
                }
                else
                {
                    data.Killers += ",";
                    data.Killers += monster.WhoKillMeName;
                }
            }

            // 检查是否更新成功
            bool result = GameManager.GuildCopyMapDBMgr.UpdateGuildCopyMapDB(data);

            if (false == result)
            {
                string logStr = @"GuildCopyMapManager::ProcessMonsterDead (false == result), 
                        data.GuildID={0}, data.FuBenID={1}, data.State={2}, data.OpenDay={3}, data.Killers={4}";
                LogManager.WriteLog(LogTypes.Error, string.Format(logStr, data.GuildID, data.FuBenID, data.State, data.OpenDay, data.Killers));
                return;
            }

            for (int i = 0; i < objsList.Count; i++)
            {
                //不在同一个地图上不参与分配
                GameClient gc = objsList[i];
                if (null == gc)
                {
                    continue;
                }

                // 准备发奖
                // 先检查上次领奖是不是本周~~
                int      nGuildCopyMapAwardDay = Global.GetRoleParamsInt32FromDB(gc, RoleParamName.GuildCopyMapAwardDay);
                DateTime AwardTime             = Global.GetRealDate(nGuildCopyMapAwardDay);
                if (Global.BeginOfWeek(AwardTime) != Global.BeginOfWeek(DateTime.Now))
                {
                    // 不是这周领奖则重置玩家领奖记录
                    Global.SaveRoleParamsInt32ValueToDB(gc, RoleParamName.GuildCopyMapAwardFlag, 0, true);
                }

                int  nGuildCopyMapAwardFlag = Global.GetRoleParamsInt32FromDB(gc, RoleParamName.GuildCopyMapAwardFlag);
                bool flag = GetGuildCopyMapAwardDayFlag(nGuildCopyMapAwardFlag, GetGuildCopyMapIndex(monster.CopyMapID), 1);
                // 领取过了
                if (flag == true)
                {
                    continue;
                }

                nGuildCopyMapAwardFlag = SetGuildCopyMapAwardDayFlag(nGuildCopyMapAwardFlag, GetGuildCopyMapIndex(monster.CopyMapID), 1);
                Global.SaveRoleParamsInt32ValueToDB(gc, RoleParamName.GuildCopyMapAwardFlag, nGuildCopyMapAwardFlag, true);
                Global.SaveRoleParamsInt32ValueToDB(gc, RoleParamName.GuildCopyMapAwardDay, Global.GetOffsetDay(DateTime.Now), true);
                // 发奖

                Global.SaveRoleParamsInt32ValueToDB(gc, RoleParamName.GuildZhanGong, Global.GetRoleParamsInt32FromDB(gc, RoleParamName.GuildZhanGong) + fuBenMapItem.nZhanGongaward, true);
                GameManager.ClientMgr.NotifySelfParamsValueChange(gc, RoleCommonUseIntParamsIndexs.ZhanGong, fuBenMapItem.nZhanGongaward);
            }
        }
コード例 #12
0
 public void ProcessMonsterDead(GameClient client, Monster monster)
 {
     if (this.IsGuildCopyMap(monster.CurrentMapCode))
     {
         SystemXmlItem systemFuBenItem = null;
         if (GameManager.systemFuBenMgr.SystemXmlItemDict.TryGetValue(monster.CurrentMapCode, out systemFuBenItem))
         {
             if (null != systemFuBenItem)
             {
                 int nBossID = systemFuBenItem.GetIntValue("BossID", -1);
                 if (nBossID == monster.MonsterInfo.ExtensionID)
                 {
                     CopyMap copyMap = GameManager.CopyMapMgr.FindCopyMap(monster.CurrentCopyMapID);
                     if (null == copyMap)
                     {
                         LogManager.WriteLog(LogTypes.Error, string.Format("GuildCopyMapManager::ProcessMonsterDead (null == copyMap), CurrentCopyMapID={0}", monster.CurrentCopyMapID), null, true);
                     }
                     else
                     {
                         GuildCopyMap mapData = GameManager.GuildCopyMapMgr.FindGuildCopyMapBySeqID(copyMap.FuBenSeqID);
                         if (null == mapData)
                         {
                             LogManager.WriteLog(LogTypes.Error, string.Format("GuildCopyMapManager::ProcessMonsterDead (null == mapData), copyMap.FuBenSeqID={0}", copyMap.FuBenSeqID), null, true);
                         }
                         else
                         {
                             int            guildid = mapData.GuildID;
                             GuildCopyMapDB data    = GameManager.GuildCopyMapDBMgr.FindGuildCopyMapDB(guildid, client.ServerId);
                             if (null == data)
                             {
                                 LogManager.WriteLog(LogTypes.Error, string.Format("GuildCopyMapManager::ProcessMonsterDead (null == data), guildid={0}", client.ClientData.Faction), null, true);
                             }
                             else
                             {
                                 List <GameClient> objsList = copyMap.GetClientsList();
                                 if (objsList == null || objsList.Count <= 0)
                                 {
                                     LogManager.WriteLog(LogTypes.Error, string.Format("GuildCopyMapManager::ProcessMonsterDead (null == objsList || objsList.Count <= 0), CurrentCopyMapID={0}", monster.CurrentCopyMapID), null, true);
                                 }
                                 else
                                 {
                                     if (copyMap.FubenMapID >= data.FuBenID)
                                     {
                                         data.FuBenID = copyMap.FubenMapID;
                                         data.State   = 2;
                                         if (copyMap.FubenMapID == GameManager.GuildCopyMapMgr.FirstGuildCopyMapOrder)
                                         {
                                             data.Killers = monster.WhoKillMeName;
                                         }
                                         else
                                         {
                                             GuildCopyMapDB guildCopyMapDB = data;
                                             guildCopyMapDB.Killers += ",";
                                             GuildCopyMapDB guildCopyMapDB2 = data;
                                             guildCopyMapDB2.Killers += monster.WhoKillMeName;
                                         }
                                     }
                                     GlobalEventSource.getInstance().fireEvent(ZhanMengShijianEvent.createKillBossEvent(Global.FormatRoleName4(client), client.ClientData.Faction, monster.MonsterInfo.ExtensionID, client.ServerId));
                                     if (!GameManager.GuildCopyMapDBMgr.UpdateGuildCopyMapDB(data, client.ServerId))
                                     {
                                         string logStr = "GuildCopyMapManager::ProcessMonsterDead (false == result), \r\n                        data.GuildID={0}, data.FuBenID={1}, data.State={2}, data.OpenDay={3}, data.Killers={4}";
                                         LogManager.WriteLog(LogTypes.Error, string.Format(logStr, new object[]
                                         {
                                             data.GuildID,
                                             data.FuBenID,
                                             data.State,
                                             data.OpenDay,
                                             data.Killers
                                         }), null, true);
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }