Beispiel #1
0
        public void RestorePKingNpc(int pkKingRoleID)
        {
            NPC npc = NPCGeneralManager.FindNPC(GameManager.MainMapCode, FakeRoleNpcId.PkKing);

            if (null != npc)
            {
                npc.ShowNpc = true;
                GameManager.ClientMgr.NotifyMySelfNewNPCBy9Grid(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, npc);
                FakeRoleManager.ProcessDelFakeRoleByType(FakeRoleTypes.DiaoXiang, false);
            }
        }
Beispiel #2
0
 public static void ProcessAddMonster(Monster monster)
 {
     try
     {
         DateTime now = TimeUtil.NowDateTime();
         if ((now - MoYuLongXue.MoYuRunTimeData.LastBirthTimePoint).TotalMinutes > 1.0)
         {
             Global.BroadcastRoleActionMsg(null, RoleActionsMsgTypes.HintMsg, string.Format(GLang.GetLang(4004, new object[0]), monster.MonsterInfo.VSName), true, GameInfoTypeIndexes.Hot, ShowGameInfoTypes.HintAndBox, 0, 0, 100, 100);
             MoYuLongXue.MoYuRunTimeData.LastBirthTimePoint = now;
         }
         NPC npc       = null;
         int mapCode   = 0;
         int leftCount = 0;
         lock (MoYuLongXue.MoYuRunTimeData.Mutex)
         {
             MoYuMonsterInfo moYuInfo;
             if (!MoYuLongXue.MoYuRunTimeData.MonsterXmlDict.TryGetValue(monster.MonsterInfo.ExtensionID, out moYuInfo))
             {
                 return;
             }
             mapCode = moYuInfo.MapCode;
             MoYuLongXue.MoYuRunTimeData.BossAttackLogDict[monster.RoleID] = new BossAttackLog
             {
                 InjureSum    = 0L,
                 BHInjure     = new Dictionary <long, BHAttackLog>(),
                 BHAttackRank = new List <BHAttackLog>()
             };
             leftCount = MoYuLongXue.MoYuRunTimeData.BossAttackLogDict.Count;
             npc       = NPCGeneralManager.FindNPC(moYuInfo.MapCode, moYuInfo.NpcID);
         }
         if (null != npc)
         {
             npc.ShowNpc = false;
             GameManager.ClientMgr.NotifyMySelfDelNPCBy9Grid(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, npc);
         }
         List <GameClient> clientList = GameManager.ClientMgr.GetMapGameClients(mapCode);
         foreach (GameClient client in clientList)
         {
             client.sendCmd <int>(1907, leftCount, false);
         }
         MoYuLongXue.NotifyBossLogBy9Grid(monster);
     }
     catch (Exception ex)
     {
         LogManager.WriteLog(LogTypes.Error, string.Format("MoYuLongXue :: 处理场景刷新怪物异常。", new object[0]), ex, true);
     }
 }
Beispiel #3
0
        public void ReplacePKKingNpc(int roleId)
        {
            RoleDataEx rd = this.KingRoleData;

            this.KingRoleData = null;
            if (rd == null || rd.RoleID != roleId)
            {
                rd = Global.sendToDB <RoleDataEx, KingRoleGetData>(13230, new KingRoleGetData
                {
                    KingType = 1
                }, 0);
                if (rd == null || rd.RoleID != roleId)
                {
                    RoleDataEx dbRd = Global.sendToDB <RoleDataEx, string>(275, string.Format("{0}:{1}", -1, roleId), 0);
                    if (dbRd == null || dbRd.RoleID <= 0)
                    {
                        return;
                    }
                    rd = dbRd;
                    if (!Global.sendToDB <bool, KingRolePutData>(13231, new KingRolePutData
                    {
                        KingType = 1,
                        RoleDataEx = rd
                    }, 0))
                    {
                    }
                }
            }
            if (rd != null && rd.RoleID > 0)
            {
                this.KingRoleData = rd;
                NPC npc = NPCGeneralManager.FindNPC(GameManager.MainMapCode, FakeRoleNpcId.PkKing);
                if (null != npc)
                {
                    npc.ShowNpc = false;
                    GameManager.ClientMgr.NotifyMySelfDelNPCBy9Grid(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, npc);
                    FakeRoleManager.ProcessDelFakeRoleByType(FakeRoleTypes.DiaoXiang, false);
                    FakeRoleManager.ProcessNewFakeRole(new SafeClientData
                    {
                        RoleData = rd
                    }, npc.MapCode, FakeRoleTypes.DiaoXiang, 4, (int)npc.CurrentPos.X, (int)npc.CurrentPos.Y, FakeRoleNpcId.PkKing);
                }
            }
        }
Beispiel #4
0
 public static bool ProcessMonsterDie(Monster monster)
 {
     try
     {
         NPC  npc       = null;
         bool ret       = true;
         int  mapCode   = 0;
         int  leftCount = 0;
         lock (MoYuLongXue.MoYuRunTimeData.Mutex)
         {
             BossAttackLog   attackLog;
             MoYuMonsterInfo monsterInfo;
             if (!MoYuLongXue.MoYuRunTimeData.BossAttackLogDict.TryGetValue(monster.RoleID, out attackLog))
             {
                 ret = false;
             }
             else if (!MoYuLongXue.MoYuRunTimeData.MonsterXmlDict.TryGetValue(monster.MonsterInfo.ExtensionID, out monsterInfo))
             {
                 ret = false;
             }
             else
             {
                 mapCode = monsterInfo.MapCode;
                 List <BHAttackLog> bhAttackLogList = attackLog.BHAttackRank;
                 int countLimit = Global.GMin(bhAttackLogList.Count, 5);
                 for (int i = 0; i < countLimit; i++)
                 {
                     foreach (KeyValuePair <int, long> role in bhAttackLogList[i].RoleInjure)
                     {
                         GameClient client = GameManager.ClientMgr.FindClient(role.Key);
                         if (null != client)
                         {
                             if (client.ClientData.MapCode == monsterInfo.MapCode)
                             {
                                 if (role.Value >= (long)monsterInfo.HurtMin)
                                 {
                                     GameManager.ClientMgr.ModifyChengJiuPointsValue(client, monsterInfo.Chengjiu, "魔域龙穴boss奖励", true, true);
                                     GameManager.ClientMgr.ModifyShengWangValue(client, monsterInfo.Shengwang, "魔域龙穴boss奖励", true, true);
                                 }
                             }
                         }
                     }
                 }
                 npc = NPCGeneralManager.FindNPC(monsterInfo.MapCode, monsterInfo.NpcID);
             }
             MoYuLongXue.MoYuRunTimeData.BossAttackLogDict.Remove(monster.RoleID);
             leftCount = MoYuLongXue.MoYuRunTimeData.BossAttackLogDict.Count;
         }
         List <GameClient> clientList = GameManager.ClientMgr.GetMapGameClients(mapCode);
         foreach (GameClient client in clientList)
         {
             client.sendCmd <int>(1907, leftCount, false);
         }
         if (null != npc)
         {
             npc.ShowNpc = true;
             GameManager.ClientMgr.NotifyMySelfNewNPCBy9Grid(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, npc);
         }
         return(ret);
     }
     catch (Exception ex)
     {
         LogManager.WriteLog(LogTypes.Error, string.Format("MoYuLongXue :: 处理boss被击杀异常。", new object[0]), ex, true);
     }
     return(false);
 }