Пример #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);
            }
        }
Пример #2
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);
                }
            }
        }